110 Commits

Author SHA1 Message Date
Boden Fuller a07f7c93d8 docs(cli): regenerate COMMANDS.md for --force-repair
Syncs CLI reference after adding --force-repair flag in
9218b7ba (fix(compile): default --repair to dry-run).
2026-04-15 13:55:25 -04:00
Boden Fuller 2b4d200b94 feat(compile): add --reset and --repair flags (na-pmx1.8)
--reset: delete .agents/compiled/ and .hashes.json before compiling.
Use to force a full rebuild or clean up stale output from a prior
broken compile run. Safe on missing dirs (idempotent).

--repair: scan .agents/compiled/ and remove article .md files with
zero inbound [[wikilinks]]. Infrastructure files (index.md, log.md,
lint-report.md) are always preserved. Addresses the 2026-04-15
scenario where a failed compile run left fallback stubs that later
had no natural way to be cleaned up.

Both flags are standalone-capable (no LLM runtime required) and
compose with --full / --compile-only.

Tests:
- TestResetCompileOutput_RemovesDirectory
- TestResetCompileOutput_IdempotentOnMissingDir
- TestRepairCompileOutput_RemovesOrphansOnly

Regenerated COMMANDS.md for the new flag entries.

Closes na-pmx1.8.
2026-04-15 12:45:40 -04:00
Boden Fuller fa6f4048af fix(compile,quickstart): embed compile.sh, auto-detect claude-cli, batch large corpora
Fixes three onboarding defects that surfaced on 2026-04-15 when running
against a global ~/.agents corpus from a non-git home directory:

1. `ao compile --full` failed in the installed bundle with
   "open skills/compile/scripts/compile.sh: file does not exist". The
   Makefile's sync-hooks target never copied compile.sh into
   cli/embedded/skills/, so the //go:embed all:skills fallback had
   nothing to fall back to. Fix: sync-hooks now seeds the script and a
   regression test (TestMaterializeCompileScriptFallsBackToEmbedded)
   asserts the embedded copy resolves when no local skills/ exists.

2. Headless compile implicitly required OLLAMA_HOST / OPENAI_API_KEY /
   ANTHROPIC_API_KEY with no actionable error when none were set, and
   ignored a locally installed `claude` CLI. Fix: resolveCompileRuntime
   auto-detects the `claude` binary and selects claude-cli runtime (no
   API key needed — inherits Claude Code auth). preflightCompileRuntime
   fails fast with an actionable error naming the exact env var to set.
   compile.sh gains a matching claude-cli backend and a --preflight flag.

3. The headless compiler concatenated all changed files into one LLM
   prompt, which is unworkable on 2000+ file corpora. Fix: compile.sh
   batches by --batch-size (default 25) and --max-batches (default
   unlimited); ao compile propagates both flags.

Onboarding gaps:

- $quickstart now detects a global ~/.agents corpus (GLOBAL_AGENTS=true)
  and, when GIT=false + AO=true, surfaces a harvest → compile →
  knowledge-activation path instead of only suggesting `git init`.
- Harvest SKILL.md clarifies that promotion writes to ~/.agents/learnings/
  (not ~/.agents) and adds a "which skill do I need?" decision table.
- Compile SKILL.md documents the claude-cli runtime and batching flags.
- skills-codex/compile/scripts/compile.sh wrapper now falls back through
  multiple candidate paths and finally delegates to `ao compile`, so an
  installed bundle without a sibling skills/ checkout still works.

Tests added:
- TestMaterializeCompileScriptFallsBackToEmbedded
- TestResolveCompileRuntime
- TestPreflightCompileRuntimeErrors (5 subtests)
- TestPreflightCompileRuntimeSuccess
- TestCompileScriptOptionsPassesBatchFlags
- TestQuickstartSkillCoversGlobalCorpus (both parity surfaces)

Verification:
  cd cli && go vet ./... && go test ./...   # all green
  bash skills/heal-skill/scripts/heal.sh --strict   # clean
  bash tests/docs/validate-doc-release.sh   # PASS
  bash scripts/check-contract-compatibility.sh   # 0 failures
  bash scripts/regen-codex-hashes.sh   # 3 skills rehashed
  bash scripts/generate-cli-reference.sh   # COMMANDS.md regenerated
2026-04-15 09:32:06 -04:00
Boden Fuller a01235a3a8 feat(dream): add adaptive long-haul corroboration 2026-04-14 23:12:36 -04:00
Boden Fuller 7dd2f7c426 fix(goals): extend CLI test gate timeout 2026-04-13 14:18:50 -04:00
Boden Fuller 875d1f1f21 feat(forge): expose tier1 chunk budget 2026-04-13 13:37:28 -04:00
Boden Fuller 253db82e18 feat(beads): add native audit cluster commands 2026-04-13 09:08:55 -04:00
Boden Fuller e1c45a7430 feat(forge): enqueue tier1 to Dream worker 2026-04-12 11:18:56 -04:00
Boden Fuller 1835d77057 feat(search): include Dream vault sources 2026-04-12 11:12:36 -04:00
Boden Fuller 4961e73a2e docs(cli): refresh evolve dream flags 2026-04-12 11:03:54 -04:00
Boden Fuller a3f04873b6 feat(sessions): prune orphan indexed pages 2026-04-12 09:57:44 -04:00
Boden Fuller 2b54967dcb feat(forge): add llm review backend 2026-04-12 05:44:55 -04:00
Boden Fuller 1e08b353ea feat(forge): add review eval harness 2026-04-12 05:31:49 -04:00
Boden Fuller 74751cb1d6 feat(search): add session retrieval eval harness 2026-04-12 04:53:23 -04:00
Bo 7dcaf68b10 docs(cli): add forge review command reference (#101) 2026-04-12 00:55:33 -04:00
Bo 4c5321c636 feat(dream): add local curator adapter (#97) 2026-04-12 00:24:25 -04:00
boshu2 4b06c7780f feat(cli): add compile command 2026-04-11 21:58:46 -04:00
Boden Fuller b0002aa065 feat(cli): add evolve operator command 2026-04-11 17:26:06 -04:00
Boden Fuller 3af559d560 feat(rpi): recover interrupted wave integration 2026-04-11 10:29:35 -04:00
Boden Fuller 6f7e7ed463 feat(ao): add 'ao beads verify|lint|harvest' stale-citation tooling
Three subcommands under a new 'ao beads' command group that complement
the bd CLI without replacing it. All commands degrade gracefully when
bd is not on PATH (warn + exit 0).

## Commands

### ao beads verify <bead-id>

Reads 'bd show <id>', extracts file paths, function references, and
backticked symbols from the description (or close reason for closed
beads), and checks each citation against HEAD. Reports FRESH / STALE /
UNKNOWN status per citation.

Bare filenames (e.g. 'loop.go' with no path) are treated specially:
the verifier walks cli/, skills/, docs/, scripts/, .agents/ to find
matches and reports FRESH if unique, UNKNOWN if ambiguous (with the
resolved path suggestions), STALE if zero matches.

Exit codes: 0 clean, 1 stale found, 2 bd error.

### ao beads lint [--status=open]

Batch-runs verify across every bead matching a status filter and
aggregates results. Exit code signals overall staleness — suitable
as a weekly audit or pre-release gate.

### ao beads harvest <bead-id>

Materialises a closed bead's close reason as a learning file at
.agents/learnings/YYYY-MM-DD-<id>-<slug>.md with frontmatter. Only
operates on closed beads. --dry-run prints to stdout instead of writing.

Compresses the bd-close → learnings pipeline into one command, so
operators running 'bd close <id> --reason "..."' can immediately
promote the reason into the knowledge flywheel.

## Design

* execBD / bdAvailable are package-level function vars so tests can
  inject fakes without touching PATH (pattern consistent with existing
  cmd/ao test hooks).
* parseBDShow is tolerant of both open and closed bead formats. Closed
  beads hide their original description and surface a 'Close reason:'
  line instead; the parser captures both and Body() prefers CloseReason.
* listBeadIDs uses a permissive <rig>-<ident> grammar so it handles
  flat rows, hierarchy rows (├──/└── tree chars), and future bd shape
  tweaks without breaking.
* No hard dependency on bd for tests — all L2 tests mock execBD and
  drive the parse/verify/render logic directly.

## Tests

cli/cmd/ao/beads_test.go (L2, 23 tests):
  * beadSlugify: basic, punctuation, truncation, empty, punct-only
  * parseBDShow: canonical open, closed with Close reason, empty errors
  * bdShowParsed.Body: prefers CloseReason, falls back to Description
  * extractCitations: file+line, function refs, backticked symbols, dedup
  * verifyFileCitation: fresh, stale, line-suffix handling
  * isClosedStatus: substring matching across bd status-field shapes
  * listBeadIDs: flat + tree output, non-bead lines skipped
  * verifyBead: bd-absent graceful degradation + end-to-end with fake
  * renderLearningBody: frontmatter + body composition

cli/cmd/ao/cobra_commands_test.go:
  * beads added to expectedCmds + parentExpectations (verify|lint|harvest)

## Smoke test

Ran against na-h61 (the bead closed earlier today). Found:
  - 4 FRESH, 0 STALE, 1 UNKNOWN (ambiguous bare 'types.go' — resolved
    to 6 candidates, correctly suggested full paths)
  - harvest --dry-run produced a clean learning file with frontmatter
  - lint --status=closed found 49 clean / 1 genuinely stale (na-63f.8
    references summary.json/summary.md which doesn't exist anywhere)

## Files

cli/cmd/ao/beads.go                  (new, ~550 LOC)
cli/cmd/ao/beads_test.go             (new, ~280 LOC)
cli/cmd/ao/cobra_commands_test.go    (+3 lines — beads in registry)
cli/docs/COMMANDS.md                 (regenerated)

## Why

Closes the last 3 items of the 7-item summary table from today's
retrospective. The first 4 items (--evidence, --commit-ready,
--discovery-artifact, stale-scope planning rule) landed in 63c8b81a.

The na-h61 session earlier today showed that bead descriptions drift
from HEAD within hours of being filed. Two of the five beads I closed
today had factually wrong descriptions (na-h61 cited a nonexistent
cli/cmd/ao/fitness.go; na-khk cited a non-reproducible env leak).
'ao beads verify' catches exactly this pattern before a new session
commits to the wrong mental model.
2026-04-11 08:36:23 -04:00
Boden Fuller fbe2dd04d0 feat(overnight): add C3 warn-only ratchet with rescue budget (Micro-epic 4)
Introduces the C3 warn-only ratchet from the Dream RunLoop Correctness
series. Warn-only mode now consumes a bounded rescue budget and falls back
to strict halting behaviour once exhausted, preventing the "warn-only
protects me forever" anti-pattern that enabled the 2026-02-22 evolve
overnight 115-cycle runaway.

New package-local primitives in cli/internal/overnight/warn_only_budget.go:
- WarnOnlyBudgetState on-disk schema v1
- ReadBudget with rescue matrix (missing → default, corrupt → default,
  out-of-range → clamp)
- WriteBudget atomic (CreateTemp → Sync → Rename)
- ResetBudget / DecrementBudget helpers
- Default rescue ceiling = 3

Loop integration via RunLoopOptions.WarnOnlyBudget (*WarnOnlyRatchet).
Pointer-based opt-in preserves legacy infinite-warn-only behaviour for
the existing L1/L2 test suites that pass WarnOnly=true without a ratchet.
At most one rescue is consumed per iteration even when both regression
and plateau fire on the same pass. Halt reasons are annotated
"(warn-only budget exhausted)" when the ratchet was the reason strict
mode kicked in.

Cmd-layer wiring in cli/cmd/ao/overnight.go reads .agents/overnight/
warn-only-budget.json at run start, passes a live ratchet with a
persistence callback, and stamps WarnOnlyBudgetInitial/WarnOnlyRemaining
into overnightSummary for the morning report.

New subcommand `ao overnight warn-only reset [--initial N] [--json]`
restores the budget file to a fresh state after an operator investigates
a burned-through budget.

Tests:
- L1 warn_only_budget_test.go covers all 4 rescue-matrix paths, atomic
  write round-trip, Reset semantics, and Decrement countdown.
- L1 overnight_test.go additions cover the reset subcommand (default +
  --initial override + --json emission) and the ratchet literal wire-in
  to RunLoopOptions, mirroring Micro-epic 2's RunID regression guard.

CLI docs regenerated via scripts/generate-cli-reference.sh. Pre-existing
failures in internal/rpi toolchain_test.go (unrelated "bushido" env var
leak on main HEAD) are out of scope.

Refs: .agents/handoff/2026-04-10-dream-runloop-correctness.md §Micro-epic 4
2026-04-10 22:48:10 -04:00
Boden Fuller ee515c82d6 feat: ship layered dream operator surfaces 2026-04-09 21:06:05 -04:00
Boden Fuller ad07b9baca feat: ship dream overnight runtime slice 2026-04-09 20:03:10 -04:00
Boden Fuller f6e122b946 docs: package codex native hooks release 2026-04-09 16:54:53 -04:00
Boden Fuller db7ceec92e fix(ci): sync docs/CHANGELOG, regen COMMANDS.md, trim using-agentops to 248 lines
- Sync docs/CHANGELOG.md with root CHANGELOG.md (adds v2.35.0 entry)
- Regenerate COMMANDS.md after codex.go help text changes
- Trim using-agentops SKILL.md from 255→248 lines (under 250 limit)
- Sync embedded using-agentops skill
2026-04-07 09:52:01 -04:00
Boden Fuller 970685ef84 docs(cli): regenerate COMMANDS.md after removing rpi workers command
Remove ao rpi workers subcommand docs following deletion of
rpi_workers.go in wave 11.
2026-04-06 19:17:27 -04:00
Boden Fuller 3eb679c6f6 feat(knowledge): rename athena → compile + add Karpathy-style knowledge compiler
Rename the athena skill to compile — a descriptive name that communicates
what it actually does. Extend with Karpathy's LLM Knowledge Bases architecture:

- New compile phase: LLM reads raw .agents/ artifacts and produces interlinked
  markdown wiki at .agents/compiled/ with index.md, log.md, backlinks
- New lint phase: detects contradictions, orphan pages, stale claims, coverage gaps
- Pluggable compute backend via AGENTOPS_COMPILE_RUNTIME (ollama|claude|openai)
- Hash-based incremental compilation (only recompile changed sources)
- compile.sh engine with security fixes (no shell injection, path traversal guard)
- Full rename across 93 files: skills, docs, CLI, tests, hooks, scripts, codex

Existing Mine → Grow → Defrag cycle preserved as phases within the larger
compile workflow. No vector DB — compiled wiki IS the retrieval layer.
2026-04-05 17:57:40 -04:00
Boden Fuller 723b730833 docs(cli): regenerate COMMANDS.md with flywheel gate subcommand 2026-04-05 10:30:41 -04:00
Boden Fuller cfadb6d32b docs(cli): regenerate COMMANDS.md with ao scenario subcommands 2026-04-05 09:15:27 -04:00
Boden Fuller 5cd584140c fix(ci): add scenario to expectedCmds in cobra registration test
The new `ao scenario` command was registered but not added to the
expectedCmds list in TestCobraExpectedCmdsMatchRegistration.
2026-04-05 09:14:56 -04:00
Boden Fuller 441ce684ba feat(rpi): add --mixed flag and provenance schema for cross-vendor execution (ag-6u7.1)
Add --mixed CLI flag to ao rpi phased. Extend executionPacket and
phaseHandoff structs with mixed_mode_requested, mixed_mode_effective,
planner_vendor, reviewer_vendor, and mixed_mode_degraded_reason fields.
Provenance is carried across phase boundaries via handoff and persisted
in the execution packet. Downstream phases (MR-2..MR-5) will populate
effective/vendor fields. Regenerated CLI docs.
2026-04-04 18:26:06 -04:00
Boden Fuller ad029207cf feat(flywheel): complete escape velocity epic (ag-9qm)
Section-first retrieval with weighted scoring, namespace comparison,
verified citation semantics, and escape velocity verification.

- Add weighted multi-feature scoring (heading, exact token, adjacency,
  proximity) gated by shadow namespace in inject_scoring.go
- Add `ao flywheel compare` command for primary-vs-shadow side-by-side
  metrics with promotion/rollback contract
- Add VerifyEscapeVelocity() with configurable targets (sigma>=0.30,
  rho>=0.65, sigma_rho > delta/100) in metrics_health.go
- Update 8 skill packet consumers with section evidence guidance and
  verified citation semantics (applied vs retrieved)
- 24 new tests across inject_scoring, metrics_flywheel, metrics_health
- Regenerate CLI reference for new compare subcommand

Closes: ag-9qm, ag-9qm.10, ag-9qm.11, ag-9qm.12, ag-9qm.13, ag-9qm.14
2026-04-04 16:22:38 -04:00
Boden Fuller 5db2d4b29b fix: remediate flywheel curation gaps 2026-04-03 10:13:59 -04:00
Boden Fuller bc7e7937bb feat(cli): add software-factory operator lane 2026-04-02 15:11:54 -04:00
Boden Fuller 1662e626e7 feat(retrieval): add --global flag and expand harvest roots (ag-z1b)
- retrieval-bench --live --global benchmarks against ~/.agents/learnings/
- harvest now scans ~/.claude/projects/ alongside ~/gt by default
2026-04-02 10:46:20 -04:00
Boden Fuller 4afa05dfc7 feat(retrieval): add --live mode to ao retrieval-bench (ag-iu3) 2026-04-02 10:41:30 -04:00
Boden Fuller eaf1ea7ce3 docs(cli): regenerate COMMANDS.md with retrieval-bench 2026-04-02 10:15:17 -04:00
Bo 69630a8de0 feat: add knowledge activation skill and CLI surfaces (#87)
* feat: add knowledge activation skill and CLI surfaces

* chore: sync embedded skills and codex artifact hashes

* test: cover quality signals hook in bats suite
2026-04-01 20:53:17 -04:00
Boden Fuller c1495588f6 feat(rpi): add runtime selection to serve
(cherry picked from commit 20aa3b55227d1356737fa397625bc190dd0dc356)
2026-04-01 20:23:07 -04:00
Boden Fuller c56269da1b fix(ci): resolve 3 CI failures — docs parity, hook portability, codex lifecycle
- harvest.go: use empty defaults with ~/  descriptions instead of baking $HOME
  into flag defaults, resolving cli-docs-parity failures across environments
- athena-session-defrag.sh: swap stat order to try Linux stat -c first, fixing
  integer expression error when macOS stat -f succeeds but returns mount path
- skills-codex/validation: replace ao codex stop with ao codex ensure-stop to
  pass codex lifecycle guard validation
2026-03-31 11:59:46 -04:00
Boden Fuller b247a133b9 fix(ci): resolve 4 pre-existing CI failures
- codex-runtime-sections: replace .claude/settings.json check with
  .git/hooks/ check in skills-codex/bootstrap/SKILL.md
- skill-lint: remove "bootstrap" trigger collision from scaffold skill,
  add bootstrap/design/harvest to codex-overrides catalog
- cli-docs-parity: regenerate COMMANDS.md (missing ao harvest docs)
- cli-integration: fix mawk-incompatible awk regex in athena-session-defrag
  hook (#{1,3} → ##?#? for portable h1-h3 matching)
2026-03-30 18:36:26 -04:00
Boden Fuller 49f0994a1b docs(hooks): add runtime modes table, update troubleshooting for dual-runtime
HOOKS.md now documents Claude/Codex/Manual runtime modes upfront.
Troubleshooting table updated with Codex-specific hook guidance.

Implements: ag-35a.2
2026-03-28 14:39:29 -04:00
Boden Fuller 8fdd789138 refactor(hooks): make ao hook tooling runtime-aware with Codex contract refs
Update hook command descriptions to acknowledge dual-runtime (Claude hooks
vs Codex skill-driven lifecycle). Add cross-references to the hook runtime
contract. Regen CLI docs.

Implements: ag-35a.4
2026-03-28 14:37:52 -04:00
Boden Fuller ea5d1148bb feat: harden codex hookless follow-up flows 2026-03-24 10:09:27 -04:00
Boden Fuller 9e4ddcf859 feat: add codex hookless lifecycle fallback 2026-03-23 15:24:33 -04:00
Boden Fuller 63e0b0fc18 feat(cli): add PROGRAM.md autodev contract 2026-03-23 10:54:10 -04:00
Boden Fuller 061edb548b fix(release): harden retag and audit artifacts 2026-03-22 21:11:41 -04:00
Boden Fuller 74bca4a4f6 docs(cli): refresh generated reference 2026-03-22 20:05:14 -04:00
Test User b6e16585e2 feat(search): wrap ao search around upstream cass 2026-03-22 15:48:15 -04:00
Boshu2 e5b4936724 fix: align ao search with forged session history 2026-03-22 09:56:37 -04:00