Files
boshu2__agentops/scripts/test-flywheel.sh
T
Boden Fuller 4abd2a69be docs(context): sweep remaining ao inject references across docs/tests/scripts
Wave 3 of context-enforcement-phase3: replace ao inject workflow
guidance with ao lookup across documentation, test fixtures, and
scripts. Remaining 32 references are legitimate (inject command
implementation, CHANGELOG history, CLI reference tables, test
fixtures for command detection).

Files updated:
- 11 core docs (context-packet, seed-definition, leverage-points, etc.)
- 7 workflow diagram docs (brief, system-map, cli-skills-map, HOOKS, etc.)
- 4 scripts (proof-run, test-flywheel, check-skill-flag-refs, etc.)
- 3 shell tests (proof-run e2e, token-budgets, no-compaction)
- 1 Go test (json_validity_test.go)
- Production code: metrics_nudge.go, metrics_flywheel.go, hooks.go
2026-03-07 11:59:18 -05:00

105 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Flywheel Smoke Test
# Verifies the knowledge flywheel (forge transcript → forge markdown → lookup) works end-to-end
TEST_DIR="$(mktemp -d)"
AGENTS_DIR="${TEST_DIR}/.agents"
cleanup() {
rm -rf "$TEST_DIR"
}
trap cleanup EXIT
echo "=== Flywheel Smoke Test ==="
echo "Test directory: $TEST_DIR"
echo ""
# Setup test .agents structure
mkdir -p "$AGENTS_DIR"/{learnings,patterns,ao/pending,ao/index}
# Test 1: Lookup can read learnings
echo "--- Test 1: Lookup reads learnings ---"
cat > "$AGENTS_DIR/learnings/test-smoke.md" << 'EOF'
# Test Learning: Flywheel Smoke Test
**Date:** 2026-01-25
**Category:** testing
**Tags:** flywheel, smoke-test
## Learning
The flywheel pattern requires three connected phases:
1. Extract - pull knowledge from sessions
2. Forge - index and store knowledge
3. Inject - provide knowledge to new sessions
## Evidence
This is a test artifact for the flywheel smoke test.
EOF
# Check ao CLI exists
if ! command -v ao &> /dev/null; then
echo "⚠️ ao CLI not found - testing file structure only"
# Verify structure
if [[ -f "$AGENTS_DIR/learnings/test-smoke.md" ]]; then
echo "✓ Learnings file created"
else
echo "✗ Failed to create learnings file"
exit 1
fi
echo ""
echo "=== Smoke Test PASSED (structure only) ==="
echo "Note: Install ao CLI for full flywheel testing"
exit 0
fi
# With ao CLI available, run full test
cd "$TEST_DIR"
# Test lookup reads the learning
LOOKUP_OUTPUT=$(ao lookup --query "flywheel" --format markdown --max-tokens 500 2>&1 || true)
if echo "$LOOKUP_OUTPUT" | grep -q "Flywheel Smoke Test"; then
echo "✓ Lookup found test learning"
else
echo "⚠️ Lookup didn't find learning (may be empty without prior sessions)"
fi
# Test 2: Forge transcript can process last session
echo ""
echo "--- Test 2: Forge transcript processes last session ---"
EXTRACT_OUTPUT=$(ao forge transcript --last-session --quiet 2>&1 || true)
if [[ -z "$EXTRACT_OUTPUT" ]] || echo "$EXTRACT_OUTPUT" | grep -qi "error"; then
echo "⚠️ Extract had issues (expected without full setup)"
else
echo "✓ Extract ran without errors"
fi
# Test 3: Forge can index markdown
echo ""
echo "--- Test 3: Forge indexes knowledge ---"
FORGE_OUTPUT=$(ao forge markdown "$AGENTS_DIR/learnings/test-smoke.md" 2>&1 || true)
if echo "$FORGE_OUTPUT" | grep -qi "error"; then
echo "⚠️ Forge had issues (expected without full setup)"
else
echo "✓ Forge ran without errors"
fi
echo ""
echo "=== Smoke Test PASSED ==="
echo ""
echo "Flywheel components verified:"
echo " - .agents/learnings/ structure ✓"
echo " - ao lookup command ✓"
echo " - ao forge transcript --last-session --quiet command ✓"
echo " - ao forge markdown command ✓"