237 Commits

Author SHA1 Message Date
Boden Fuller 5b9cd5520c Release v2.38.0 2026-04-22 19:35:48 -04:00
Bo 4b978ef918 Merge pull request #127 from boshu2/claude/skills-improvement-research-s3vwZ
chore(skills): backfill docs, validators, and lint; fix codex drift no-op
2026-04-22 07:33:44 -04:00
Claude c4166a5c51 docs: fix broken CLI links, add HOOKS/SCHEMAS/UPGRADING pages, expand GLOSSARY
Addresses a batch of documentation improvements identified in a full-docs
audit. The goal is to reduce newcomer friction from dead links and missing
canonical references, and to give skill/plugin authors explicit pages for
hooks, schemas, and version migration that were previously implied only by
source code.

Navigation fixes:
- docs/INDEX.md and docs/newcomer-guide.md pointed to the wrong path for
  the CLI reference (cli/commands.md vs. the real cli/docs/COMMANDS.md).
  Replace with the canonical github URL so both mkdocs and raw-GitHub
  readers land on the file.
- INDEX.md Getting Started section now opens with a "pick your path"
  router so evaluators, installers, contributors, and upgraders don't
  have to triangulate across three overlapping entry points.
- Link docs/getting-started/index.md from INDEX.md (was previously
  orphaned) and add an "Install verification" block pointing at ao doctor.

New pages:
- docs/HOOKS.md: user-facing orientation covering lifecycle events,
  install/uninstall, customization env vars, and common failure modes,
  pointing to cli/docs/HOOKS.md for the deep technical reference.
- docs/SCHEMAS.md: catalog of every JSON Schema under schemas/ and
  lib/schemas/, grouped by manifest vs. runtime artifact vs. internal
  contract, with validation commands.
- docs/UPGRADING.md: action-required version migration guide. Seeds
  Unreleased (2.38.x) and 2.37.x sections covering strict delegation,
  --no-lifecycle -> --no-scaffold rename, Olympus bridge removal,
  swarm-evidence schema enforcement, and pre-mortem gate tightening.

Reference quality:
- GLOSSARY.md: 11 new terms (.agents/, MEMORY.md, Compact/PreCompact,
  Compile, Context Window, Discovery, Dream/Overnight Run alias,
  Flywheel Health, Harvest, Holdout, RPI Phase, Session Lifecycle).
- troubleshooting.md: three new failure-mode sections (pre-mortem gate,
  go-test-precommit block, context-window compaction recovery).
- CONTRIBUTING.md: escalates the sync-skill-counts.sh requirement from
  an easily-missed sentence to a bold callout with CI-failure rationale.

mkdocs.yml: registers the three new pages in nav so they're reachable
from the published site and pass strict build.

Validation:
- tests/docs/validate-links.sh: 1553 links checked, 0 broken.
- tests/docs/validate-doc-release.sh: PASS.
- scripts/docs-build.sh --check: new docs introduce 0 warnings (the
  single remaining preexisting warning about index.md is out of scope).
2026-04-22 05:01:02 +00:00
Claude a5fa4cfa8c chore(skills): backfill docs, validators, and lint; fix codex drift no-op
Close the skills/skills-codex ecosystem gaps surfaced by the recent audit:

- docs/SKILLS.md now lists all 69 skills. Added an "Additional Skills" table
  covering the 21 previously undocumented entries (autodev, bootstrap, compile,
  deps, design, discovery, goals, grafana-platform-dashboard, harvest, perf,
  push, readme, red-team, refactor, reverse-engineer-rpi, review, scaffold,
  scenario, security, security-suite, test). Removed stale `/knowledge` router
  alias and nonexistent `extract` internal-table row.

- Added `scripts/validate.sh` behavioral contracts to the 16 skills that lacked
  one (autodev, bootstrap, deps, design, discovery, dream, harvest, llm-wiki,
  perf, red-team, refactor, review, scaffold, scenario, test, validation).
  Each encodes skill-specific assertions beyond the frontmatter check. Coverage:
  53/69 -> 69/69.

- Fixed `scripts/check-codex-parity-drift.sh` which was a silent no-op: it
  passed a non-existent --check flag to audit-codex-parity.py, swallowed the
  argparse error via `|| true`, then grep'd for strings the audit never emits.
  Now uses the exit code + JSON output and correctly fails on drift.

- Added `scripts/check-skill-size.sh` (warn>500, fail>800 lines) to flag
  oversized SKILL.md files that should decompose into references/*.md. Current
  state: 6 warnings (crank/implement/post-mortem/release/swarm/vibe), 0 fails.

Hygiene sweep: heal.sh --strict clean, codex parity audit clean, 69/69
validators green, size-lint reports no failures.

https://claude.ai/code/session_014AgjT36REb94fjL7sxrnFf
2026-04-22 04:56:28 +00:00
Bo 8e0da39d61 Remove lowercase docs index 2026-04-21 11:09:48 -04:00
Boden Fuller 6bbc0307e0 docs(philosophy): align flywheel diagram right edge
The vertical `│` and corner `┘` on the "Better next session" loop sat
at column 70, one past "Gates" (which ends at column 69). The diagram
visually hung off the right edge.

Moved both to column 69 so the loop closes directly under the "s" of
"Gates". Rebalanced the horizontal fill (22 `─` before text, 21 after)
to preserve loop text centering.
2026-04-19 15:23:50 -04:00
Boden Fuller 816a36d83f docs: align box-drawing vertical lines in ASCII art
Systematic pass over 104 markdown files with box-drawing characters.
Fixed 15 files where interior `│` / outer `┌┐└┘` / divider `┬┴` columns
were off by 1-2 cols from their reference row. Zero content changes —
only whitespace and `─` fill chars moved to recover column alignment.

## Files fixed

**docs/** — CI-CD.md, agentops-system-map.md, brownian-ratchet.md,
context-packet.md, curation-pipeline.md, the-science.md,
comparisons/README.md, comparisons/vs-claude-flow.md

**skills/** — SKILL-TIERS.md, swarm/SKILL.md,
crank/references/fire.md, standards/references/test-pyramid.md

**skills-codex/** — crank/references/fire.md,
quickstart/references/full-catalog.md,
standards/references/test-pyramid.md

## Common failure modes found

- Off-by-one closing corners (e.g., `└───────── ┘` with stray space → `└──────────┘`)
- Box width vs content width mismatch (interior row 1-2 chars wider than its `┌┐` box)
- Diverging canonical widths across rows (widened the narrow rows rather
  than truncate content)
- T-junctions (`┬` / `┴`) not aligned with `│` rows above/below

## Scope preserved

- Tree diagrams (`├── file.md` / `│   └── child.md`) — intentional
  variable-width indentation, left alone
- Markdown pipe tables — not ASCII art, not touched
- Content of labels/box text — unchanged

Verified: `scripts/docs-build.sh --check` (mkdocs strict) passes clean.
2026-04-19 15:11:31 -04:00
Boden Fuller 1e073d8363 chore: purge archived AO↔Olympus bridge integration + prefer local Go in precommit hook
Olympus (ol) was the power-user daemon predecessor to AgentOps, archived
in strategic-direction.md. The bridge contracts (SPEC_ONLY, never
enforced), MemRL policy surface, OL quarantine constraints collector, and
supporting scripts/tests all referenced a now-dead integration. Purging
them removes ~2400 lines of stale surface area.

## Deleted files
- docs/ol-bridge-contracts.md
- docs/architecture/ao-olympus-ownership-matrix.md
- docs/plans/2026-02-13-ao-olympus-bridge-next-steps.md
- docs/contracts/memrl-policy-integration.md
- docs/contracts/memrl-policy.schema.json
- docs/contracts/memrl-policy.profile.example.json
- cli/cmd/ao/inject_ol_test.go
- skills/vibe/scripts/ol-validate.sh + codex mirror
- skills-codex/swarm/scripts/ol-ratchet.sh, ol-wave-loader.sh
- tests/ol-integration/ (entire directory)

## CLI code stripped
- internal/search/types.go: OLConstraint struct + InjectedKnowledge.OLConstraints field
- internal/search/inject_run.go: CollectOLConstraints, WriteConstraintsSection, quarantineRelPath const, all related trim/render logic
- cmd/ao/inject.go: gatherOLConstraints, collectOLConstraints wrapper, olConstraint type alias, init-time call site
- Package comments in provenance/storage/types/formatter updated "olympus" → "agentops"
- formatter/markdown.go: session tag "olympus" → "agentops" (+ test update)
- Tests: deleted TestCollectOLConstraints + TestInject_collectOLConstraints, stripped OL subtests from TestFormatKnowledgeMarkdown and TestInject_*, renamed "olympus" literal test data to "other-repo"
- rpi_phased_context.go: stripped "matches Olympus DefaultTimeout" and "Modeled on Olympus internal/git/worktree.go" comments

## Docs + skills stripped
- mkdocs.yml nav: 3 entries removed (AO-Olympus Matrix, MemRL Policy, OL-AO Bridge)
- docs/INDEX.md, contracts/index.md, architecture/index.md, index.md: cross-refs removed
- strategic-direction.md: retirement rationale compressed to one paragraph
- docs/context-packet.md, positioning/devops-for-vibe-coding.md, plans/README.md: OL-specific content removed
- skills/vibe/SKILL.md + codex mirror, swarm/SKILL.md: OL script refs removed
- skills/vibe/references/deep-checks.md, plan/references/planning-rules.md (+ codex), pre-mortem/references/council-fail-patterns.md (+ codex): OL rule/pattern entries removed
- skills-codex hashes regenerated (plan, pre-mortem, swarm, vibe)

## Precommit hook fix
- hooks/go-test-precommit.sh: prefer ~/.local/go/bin/go when present. Hooks
  don't inherit interactive-shell PATH, so apt-provided go-1.22 would
  otherwise override a user-local 1.26 install. Mirrors the zshrc pattern.

## Retained (historical / useful)
- strategic-direction.md: 1-paragraph archival note
- Historical release notes (docs/releases/*.md) — immutable past-release record
- cli/testdata/transcripts/real-2.4mb.jsonl — captured test fixture
- docs/brownian-ratchet.md ol-rg3p bead-ID refs — internal bead prefix, not Olympus

## Verification
- go build ./... && go vet ./... clean
- go test ./... clean except pre-existing TestGCBridgeVersion_Live panic
- scripts/docs-build.sh --check (mkdocs strict) clean
- scripts/check-contract-compatibility.sh passes
- scripts/regen-codex-hashes.sh run — 4 skills updated
2026-04-19 14:33:00 -04:00
Boden Fuller 57527e3fd2 docs(theme): match agentops-showcase palette — warm terracotta on near-black
Source of truth: boshu2/agentops-showcase (12factoragentops.com).
Tokens copied from its tailwind.config.ts + globals.css.

## Palette
- Primary: #d97757 (hsl(15 55% 60%)) — warm clay / terracotta
- Accent: #fbcfb2 — soft peach
- Background: #0a0a0a (neutral-950, warm matte)
- Card bg: #111110 / #171512 (warm-tinted ladder)
- Foreground: #dea78c / #c79073 (warm tan on dark)
- Selection: rgba(217,119,87,0.3) with peach text

## Fonts
- Code: Space Mono (replaces JetBrains Mono) to match showcase
- Text: Inter (unchanged)

## Updated
- mkdocs.yml palette: primary/accent → "custom" so the theme defers to
  our CSS variables
- docs/assets/stylesheets/extra.css: full rewrite — header gradient,
  announce bar, buttons, grid cards, code blocks, tables, admonitions,
  nav, search, scrollbars, selection all retuned to the warm palette
- docs/assets/logo.svg + favicon.svg: gradient swapped from indigo→pink
  to terracotta→peach to match
- Hero landing H1 gradient: now clay→peach→amber
- Preserved the .landing-hero scoping so inner-page H1s stay solid,
  not gradient

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 12:14:58 -04:00
Boden Fuller 3425393dc2 docs(landing): lead with primary use case + headline skills table
Previous landing was too abstract ("operational layer") and buried the
skills behind a catalog link. Rewrite to:

## docs/index.md
- Open with the concrete problem: "Coding agents don't do their own
  bookkeeping" → session 15 rediscovers session 1's lessons without
  AgentOps
- Add "The primary use case" section with the 4-layer table (bookkeeping,
  validation, primitives, flows) and the flywheel diagram
- Add "See It Work" section with actual terminal examples of /council
  and /rpi so readers see what the system does, not just what it is
- Add "The headline skills" table with 9 skills + "use it when" framing
  (matches README.md)
- Add "Advanced: Day Loop and Night Loop" explaining /evolve and /dream
- Tabbed install blocks for Claude Code / Codex / OpenCode + ao CLI

## docs/_hooks/gen_skill_pages.py — skills/index.md generator
- Replace generic "Featured Workflows" with the same 9-skill headline
  table + use-case framing (consistent with landing and README)
- Reorganize complete catalog into 8 family groups (Validation, Flows,
  Bookkeeping, Session, Product, Utility, Platform, PR workflow) so
  readers can navigate 69 skills by purpose instead of alphabet
- "Related references" card block moved to the bottom

Both pages now answer "what is this and which skills do I try first"
before linking to the exhaustive catalog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 11:29:37 -04:00
Boden Fuller cc6750c4e8 feat(docs,skills): rebuild Pages site with MkDocs Material + harden RPI orchestrator delegation contract
## Docs site — boshu2.github.io/agentops

- Replace Jekyll minima with MkDocs Material (slate dark palette default)
- Landing hero scoped to .landing-hero (no gradient bleed on inner pages)
- Section landings (getting-started, architecture, reference, contracts, levels) with narrative ledes
- Generate skill catalog + per-skill pages from skills/*/SKILL.md at build
- Generate CLI reference from cli/docs/ at build (fails build on missing source)
- Fix every internal link via one-shot migration (scripts/migrations/2026-04-19-fix-docs-links.py)
- Wire mkdocs build --strict into pre-push gate (Check 25a)
- Replace .github/workflows/pages.yml with .github/workflows/docs.yml (actions/deploy-pages)
- README + docs/CONTRIBUTING updated with docs-build toolchain on-ramp
- tests/docs/validate-links.sh patched to understand mkdocs-generated paths

## RPI orchestrator strict-delegation contract

- Strict sub-skill delegation is now the default for /rpi, /discovery, /validation. No --full flag — always on.
- Canonical contract in skills/shared/references/strict-delegation-contract.md (plus Codex mirror)
- Forged learning with detection phrases + corrective actions (ao-inject-ready)
- Rename --no-lifecycle -> --no-scaffold in /discovery (Claude + Codex) with deprecation alias through v2.40.0
- Harden inline-work hotspots with orchestrator-owned markers in /crank STEPS 3a.3, 6.5, 8.7 + Inline Work Policy footer
- Flag consistency: --auto and --interactive scopes documented; --complexity syntax formalized
- CHANGELOG [Unreleased] documents + scaffolds; runtime hook enforcement explicitly deferred

## fix(hooks): go-test-precommit skips when no Go files staged

- Previously ran go vet + go build unconditionally, blocking non-Go commits when Go toolchain was missing or at a different version
- Now checks staged diff and exits cleanly if no *.go or go.{mod,sum,work} files are staged
- Applied to both hooks/ (source) and cli/embedded/hooks/ (synced)

Provenance: full RPI lifecycle with strict delegation at every phase boundary (Phase 1 Skill(discovery) -> Phase 2 Skill(crank) -> Phase 3 Skill(validation) -> Skill(vibe), Skill(post-mortem), Skill(retro)).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 10:37:58 -04:00
Boden Fuller f45bc11ed7 docs: add v2.37.2 release audit 2026-04-15 20:16:22 -04:00
Boden Fuller a5b6f468fb Release v2.37.2 2026-04-15 20:09:11 -04:00
Boden Fuller 50cf99fed9 feat(validation): swarm evidence schema + validator + gate wiring
Defines a tracked contract for swarm worker result files living under
.agents/swarm/results/<task>.json. These files were implicitly shaped
but never validated — misshapen packets could silently break crank
result ingestion.

- schemas/swarm-evidence.schema.json: JSON Schema. Required: task,
  status, files_changed, notes. Optional: tests, gate, evidence,
  before/after counters. additionalProperties=true permits task-specific
  extensions.
- scripts/validate-swarm-evidence.sh: jq-based validator accepting a
  file or directory. ajv fallback when available. Exit 0 pass, 1 fail.
- docs/contracts/swarm-evidence.md: human-readable contract doc with
  example and schema link. Added to docs/INDEX.md catalog.
- scripts/pre-push-gate.sh: new section 26b ('swarm evidence schema')
  invokes the validator on every push.
- scripts/check-contract-compatibility.sh: extended ref resolution to
  also search schemas/ so docs/contracts/*.md can cite
  schemas/*.schema.json without tripping the cataloguing check.

Consumes ag-yhr 'Implement executable swarm evidence schema validation'.
2026-04-15 16:48:17 -04:00
Boden Fuller 13f817062d docs: document decision-tree doc naming convention
{subject}-decision-tree.md (matches docs/skills-decision-tree.md).
Rationale: groups by subject alphabetically; keeps decision-tree as
suffix rather than noisy prefix duplicated across files.
2026-04-15 13:46:21 -04:00
Boden Fuller ecfa5f1d3b docs: consolidate skills decision tree to docs/ (na-pmx1.7)
Create docs/skills-decision-tree.md as the single source of truth for
"which skill do I need?". Replace duplicate tables in harvest SKILL.md,
knowledge-activation SKILL.md, and skills-codex mirrors with a pointer
link. Add INDEX.md entry.

Four files used to carry the same table; future edits now go in one
place. Quickstart already surfaces the individual skills under its
GIT=false + GLOBAL_AGENTS=true branch, so it does not need the
expanded reference — it is the entry point, not the index.

Closes na-pmx1.7.
2026-04-15 12:41:47 -04:00
Boden Fuller f68e9a316c docs: add v2.37.1 release audit 2026-04-15 00:18:28 -04:00
Boden Fuller 98671975ef Release v2.37.1 2026-04-15 00:13:04 -04:00
Boden Fuller a01235a3a8 feat(dream): add adaptive long-haul corroboration 2026-04-14 23:12:36 -04:00
Boden Fuller 8df916ed7f feat(dream): add yield telemetry to reports 2026-04-14 22:37:00 -04:00
Boden Fuller 4d9f0a110b feat(dream): emit actionable morning packets 2026-04-14 20:53:15 -04:00
Boden Fuller 13f989c309 docs: add v2.37.0 release audit 2026-04-14 18:03:12 -04:00
Boden Fuller e612076027 Release v2.37.0 2026-04-14 17:58:10 -04:00
Boden Fuller 2bfeb5bd35 docs(constraints): clarify active constraint inputs 2026-04-13 09:52:30 -04:00
Boden Fuller 586519fed5 docs: rewrite philosophy doc with context compiler thesis
Replaces the original 5-principles framing with the validated context
compiler thesis. Covers: environment problem, flywheel loop, .agents/
as universal format, tiered model, Brownian ratchet, and the Karpathy
bookkeeping insight. 98 lines, evidence-backed.
2026-04-12 20:44:33 -04:00
Boden Fuller 4971f36912 fix(release): validate audit artifact refs 2026-04-12 20:28:04 -04:00
Boden Fuller cdc780ad0d chore(gate): require preserved ref ownership 2026-04-12 20:18:20 -04:00
Boden Fuller 1a51354917 docs(team-runner): clarify claude sandbox semantics 2026-04-12 11:51:20 -04:00
Bo 4c5321c636 feat(dream): add local curator adapter (#97) 2026-04-12 00:24:25 -04:00
Boden Fuller a8cca4d15c chore(skills): refresh llm wiki artifacts 2026-04-11 22:36:24 -04:00
boshu2 c20fe90a61 merge: llm wiki integration
# Conflicts:
#	docs/cli-skills-map.md
2026-04-11 22:26:27 -04:00
Boden Fuller 91b2ef5d9d docs(positioning): prepare HN devto article draft 2026-04-11 22:16:16 -04:00
boshu2 4b06c7780f feat(cli): add compile command 2026-04-11 21:58:46 -04:00
Boden Fuller a1a58bfb28 docs(skills): add autodev contract skill 2026-04-11 21:57:03 -04:00
boshu2 d282c84bc8 docs: sync llm-wiki skill catalog 2026-04-11 21:35:23 -04:00
boshu2 8114d6a6da docs: capture compiled knowledge workspace requirements 2026-04-11 21:27:52 -04:00
Boden Fuller 2af0f4bd02 test(overnight): cover live tree hash statuses
Refs na-1iv
2026-04-11 21:00:19 -04:00
Boden Fuller 758f77cdc0 docs(profiles): replace obsolete learn command
Refs na-uuy.7
2026-04-11 20:45:48 -04:00
Bo 18d8f5b900 Add native Windows smoke coverage
Adds a blocking windows-smoke job, native PowerShell smoke script, Windows docs updates, and moves a Unix-only RPI lock permission test out of the Windows test path.
2026-04-11 19:52:32 -04:00
Bo 659c983ecc Add Windows ao installer
Adds a Windows PowerShell installer for ao, documents the Windows install path, fixes Windows-specific ao/runtime test issues, and removes the CI ripgrep dependency from the Codex override coverage validator.
2026-04-11 19:04:18 -04:00
Boden Fuller 1741517d0f docs(release): refresh v2.36 notes for retag 2026-04-11 18:02:19 -04:00
Boden Fuller b0002aa065 feat(cli): add evolve operator command 2026-04-11 17:26:06 -04:00
Boden Fuller cc3259f262 fix(ci): pin golangci-lint v2 contract 2026-04-11 14:09:00 -04:00
Boden Fuller 3af559d560 feat(rpi): recover interrupted wave integration 2026-04-11 10:29:35 -04:00
Boden Fuller 63c8b81ad6 feat(skills,docs): --evidence/--tdd council mode, --discovery-artifact rpi flag, stale-scope planning rule, docs/council-log/
Operationalizes the "pre-flight council validation against stale inherited
scope" pattern that caught the na-h61 M8 estimate inflation in the same
session. Five items from the summary table in today's retrospective.

## New flags

/council --evidence  (alias --tdd)
  Every finding must include 2+ test_assertions (grep, stat, go test, ...)
  that would mechanically prove the finding is real. Consolidation clamps
  verdict to WARN if any finding lacks assertions. Schema version bumps
  3 → 4. See skills/council/references/evidence-mode.md for the full
  schema, judge prompt additions, and a worked example.

/council --commit-ready
  Also writes the consolidated report to docs/council-log/YYYY-MM-DD-
  <mode>-<target-slug>.md (in addition to the transient .agents/council/
  path). Use when the verdict is load-bearing for a merged commit and
  the provenance should survive rebases. See docs/council-log/README.md.

/rpi --from=implementation --discovery-artifact=<path>
  Explicit "external discovery" entry point. When discovery has already
  been done by an upstream /council --evidence run (or a hand-written
  plan), pass the path and /rpi validates the artifact, extracts scope
  into an execution packet, and proceeds straight to /crank. See
  skills/rpi/references/discovery-artifact-mode.md. Formalizes the
  improvised pattern used in the na-h61 session earlier today.

## New planning rule

skills/plan/references/stale-scope-validation.md
  "Re-validate inherited scope estimates against HEAD before acting on
  deferred beads, handoff docs, or prior-session plans." Referenced from
  skills/plan/SKILL.md and skills/pre-mortem/SKILL.md. Includes the
  concrete na-h61 case study (395 LOC estimate collapsed to ~300 LOC
  once the council verified the staging infra already existed).

## New committable council artifact path

docs/council-log/
  README.md documents the convention and retention policy.
  2026-04-11-validate-m8-assumption-validation.md is the canonical
  example — the consolidation that caught the na-h61 scope inflation,
  now in git history so any future session can re-verify the reasoning.

## Files

skills/council/SKILL.md                             (+3 lines — new flags)
skills/council/references/evidence-mode.md          (new, ~180 lines)
skills/rpi/SKILL.md                                 (+3 lines — new flag)
skills/rpi/references/discovery-artifact-mode.md    (new, ~130 lines)
skills/plan/SKILL.md                                (+1 line — rule ref)
skills/plan/references/stale-scope-validation.md    (new, ~100 lines)
skills/pre-mortem/SKILL.md                          (+1 line — rule ref)
docs/council-log/README.md                          (new, ~90 lines)
docs/council-log/2026-04-11-validate-m8-...         (new, canonical example)

Follows the same-session retrospective request from the user after
closing na-h61. The CLI half (ao beads verify|lint|harvest) ships in a
separate commit.

Council parity: skills-codex/{council,rpi,plan,pre-mortem}/ exists and
is now drifted. Sync deferred per the CLAUDE.md deprecation note on
sync-codex-native-skills.sh — manual edit required, tracked as a
follow-up. Skill-lint remains pre-existing RED on main (unchanged by
this commit).
2026-04-11 08:35:39 -04:00
Boden Fuller 7e4e34ad9e feat(overnight): M8 C1 Option A — pre-commit fitness gate (closes na-h61)
Reorder the Dream RunLoop iteration body so fitness is measured against
the staging tree BEFORE cp.Commit() instead of against the already-mutated
live tree after. Under strict mode, a regression halt now fires before
the live ~/.agents/ is ever touched — external observers never see a
regressed state.

## What changed

Before (Option B):
  REDUCE → COMMIT → VerifyMetadataRoundTripPostCommit → MEASURE → DELTA → HALT
  On regression: status=halted-on-regression-POST-commit, NO rollback,
  live tree already mutated.

After (Option A, this commit):
  REDUCE → MEASURE (against cp.StagingDir) → DELTA → HALT (with Rollback)
         → COMMIT → VerifyMetadataRoundTripPostCommit
  On strict-mode regression/plateau: cp.Rollback() discards staging,
  status=halted-on-regression-PRE-commit, live tree untouched.

## Why the original 395 LOC estimate was inflated

Prior session deferred M8 as a ~395 LOC architectural change requiring
dedicated --complexity=full --mixed council. This session's pre-flight
council validation (3-judge --tdd mode) discovered that the staging
infrastructure already existed in the codebase:

  * cp.StagingDir is a full mirror of .agents/ subpaths
    (checkpoint.go:194-223)
  * REDUCE already writes into cp.StagingDir (reduce.go:186)
  * cp.Rollback() is safe at any state (checkpoint.go:345)
  * cp.StagingDir/.agents/ is a valid cwd for corpus.Compute — no
    signature change needed

The actual fix was a sequencing bug, not missing infrastructure.
Real size: ~300 LOC (code + tests + docs). Real re-plumbing: 1 existing
test (TestRunLoop_RegressionHaltStrict status assertion), well under
the pre-agreed 5-broken-tests abort gate.

## Files

cli/internal/overnight/types.go
  + StatusHaltedOnRegressionPreCommit (new enum value)
  + Validate() + IsCorpusCompounded() switches updated
  + StatusHaltedOnRegressionPostCommit kept for backward compat with
    persisted pre-M8 iterations

cli/internal/overnight/loop.go
  - Removed old COMMIT block at former loop.go:332-348
  - Removed old post-commit metadata check at former 350-360
  - Added new MEASURE block at former position, pointing RunMeasure at
    cp.StagingDir via a local RunLoopOptions copy
  - Added cp.Rollback() to the measure-error branch
  - Added cp.Rollback() + StatusHaltedOnRegressionPreCommit to the strict
    regression halt branch (and removed writeCommittedButFlaggedMarker,
    which was post-commit-specific)
  - Added cp.Rollback() + StatusHaltedOnRegressionPreCommit to the strict
    plateau halt branch
  - Inserted new COMMIT block + post-commit metadata check AFTER the
    warn-only rescue path, before the per-iter persist+append
  - Warn-only rescue path itself unchanged (tolerated regressions still
    commit; that's the whole point of warn-only)

cli/internal/overnight/loop_fitness_injection_test.go
  + TestM8_StrictRegression_HaltsPreCommit (T1 — the core wiring)
  + TestM8_StagingDiscardedOnPreCommitHalt (T2 — proves Rollback fired)
  + TestM8_HappyPath_CommitsNormally (T4 — pass-through not broken)
  ~ TestRunLoop_RegressionHaltStrict — status assertion updated to
    StatusHaltedOnRegressionPreCommit
  ~ TestRunLoop_WarnOnlyBudgetExhausted — same update; budget-exhausted
    fall-through to strict halt now uses PreCommit (consistency invariant)

docs/contracts/dream-run-contract.md
  + Iteration structure now documents 4 stages with Option A sequencing
  + Halt conditions table updated with new iter status values
  + Historical note explains the shift + why PostCommit status is kept

## Test results

* 4 new M8 tests pass
* 2 existing tests updated + pass
* Full overnight package green
* Full cli test suite green (go test ./...)
* Race detector clean (go test -race ./internal/overnight/...)
* go vet clean
* Scope gate: 1 broken existing test (< 5 abort threshold)

## Dream RunLoop Correctness epic status

M1-M7 + M8 + M9 all landed. Epic complete. M9 ratchet upgrade (warn→fail)
still gated on 1-2 clean post-679552ae main runs; na-h61 was the last
deferred item.

Closes: na-h61
Refs: .agents/council/2026-04-11-m8-assumption-validation-consolidated.md
      .agents/council/2026-04-11-m8-assumption-validation-judge{1,2}.md
2026-04-11 08:05:48 -04:00
Boden Fuller 13b10c8237 fix(overnight): split "rolled-back" into IterationStatus enum (C2)
The legacy "rolled-back" string at loop.go carried two fundamentally
different semantics at two producer sites:

  loop.go REDUCE pre-commit failure    — corpus NOT on disk
  loop.go post-commit regression halt  — corpus IS on disk

The second was a LIE: the label claimed rollback while cp.Commit()
had already compounded the corpus into the live tree. Operators
reading the morning report saw "rolled-back" and assumed no-op,
when in fact the mutation was permanent.

Fix: introduce a 5-value IterationStatus enum in types.go with
StatusRolledBackPreCommit and StatusHaltedOnRegressionPostCommit
as distinct constants. Update both producer sites. Add a
committed-but-flagged marker file in iteration_store.go that
operators can find via directory listing. Fix the Micro-epic 2
rehydration logic to use IsCorpusCompounded as the baseline
predicate (closing the known-limitation documented at
.agents/council/2026-04-10-pre-mortem-microepic-2-cycle-history.md
#pm-20260410-m2-005).

Ship the Status Precedence Truth Table in docs/contracts/dream-report.md
so the enum semantics are documented, not tribal.

Touches:
- cli/internal/overnight/types.go (IterationStatus enum + Validate + IsCorpusCompounded)
- cli/internal/overnight/loop.go (rename + rehydration predicate update + other status literals)
- cli/internal/overnight/iteration_store.go (marker helpers)
- cli/internal/overnight/overnight_e2e_test.go (predicate update)
- cli/cmd/ao/overnight.go (explicit string() cast at the Steps boundary)
- docs/contracts/dream-report.md (enum + truth table + historical note)
- Test additions: 4 L1 enum + 4 L1 marker + 3 L2 rehydration/hash invariant

The TestRunLoop_LiveTreeHashInvariant test lands the StatusDone case
only; follow-up fixture engineering for the other 4 status values is
tracked in bd issue na-1iv.

Plan: .agents/plans/2026-04-10-microepic-3-status-enum.md
Pre-mortem: .agents/council/2026-04-10-pre-mortem-microepic-3-status-enum.md
Closes known-limitation from .agents/council/2026-04-10-pre-mortem-microepic-2-cycle-history.md
2026-04-10 22:25:55 -04:00
Boden Fuller d20e21bd90 feat(overnight): persist cycle history + rehydrate on resume (C1)
Writes each Dream iteration to <outputDir>/<runID>/iterations/iter-N.json
via atomic CreateTemp -> Sync -> Rename -> fsyncDir, and rehydrates prior
iterations at RunLoop startup so a crashed or MEASURE-failed run resumes
with full history and a correct prevSnapshot baseline.

Fixes the 2026-02-22 evolve-overnight failure mode where a crashed run
silently lost iteration history and restarted from a fresh baseline.

Also fixes the pre-existing IterationID contract drift at loop.go:145:
the documented format at types.go:10 is "<run-id>-iter-<N>" but the
runtime generated just "iter-N". Now matches the documented contract.

Touches:
- cli/internal/overnight/iteration_store{.go,_test.go} (new)
- cli/internal/overnight/loop_testhooks.go (new; test-only fault hook)
- cli/internal/overnight/loop_resume_test.go (new; L2 resume + ID regression)
- cli/internal/overnight/loop.go (persist + rehydrate + ID fix + plateau replay)
- cli/internal/overnight/types.go (add required RunID field)
- cli/internal/overnight/{stages,boundary,overnight_e2e}_test.go (set RunID)
- cli/cmd/ao/overnight.go (wire summary.RunID into RunLoopOptions)
- docs/contracts/dream-report.md, docs/contracts/dream-run-contract.md
- skills/dream/SKILL.md, skills-codex/dream/SKILL.md (+ regen codex hashes)

Prevents direct recurrence of the 115-cycle runaway from 2026-02-22.
Plan: .agents/plans/2026-04-10-microepic-2-cycle-history.md
Pre-mortem: .agents/council/2026-04-10-pre-mortem-microepic-2-cycle-history.md
2026-04-10 21:43:00 -04:00
Boden Fuller b49c1204a0 feat(overnight): wave 5 — e2e tests, fixture, v1 reader, contracts, skill docs
Dream nightly compounder plan rev 2, Wave 5 (Issues 11, 12, 13)
executed by two parallel workers.

Issue 11 — L2 e2e tests + 150+ learning fixture + frozen v1 reader:

- NEW cli/internal/overnight/fixture/gen_fixture.go: deterministic
  fixture generator producing 150 learnings + 20 findings + 5
  patterns + 3 knowledge files with realistic metadata distribution
  (maturity mix 0.50/0.30/0.15/0.05, source_bead on 60%, utility
  0.1-0.9, mtime spanning 180 days). Parked at fixture/ not
  testdata/ because Go excludes testdata/ from package resolution.
  Two non-obvious tunings: pseudo-random hex bodies avoid dedup
  trigram overlap, and pattern[0] embeds all learning filenames to
  avoid orphan pruning during REDUCE.

- NEW cli/internal/overnight/overnight_e2e_test.go: three L2 tests
  driving INGEST + REDUCE + MEASURE against the full 150-learning
  fixture. TestRunLoop_L2_FullIteration_CorpusQualityMoves asserts
  catalog build, checkpoint, stage-order, metadata round-trip,
  findings routed, next-work.jsonl written, and fitness vector
  populated. TestRunLoop_L2_MetadataStripDetected exercises the
  pm-005 regression at L2 scale with checkpoint rollback.
  TestRunLoop_L2_CompoundFilterCliff_DoesNotSilentlyKillCorpus is
  the pm-015 guard: asserts no corpus-quality metric drops by more
  than 0.30 between iterations (the "cliff" threshold from
  2026-04-02-flywheel-quality-fixes).

- NEW cli/cmd/ao/testdata/v1_reader/summary_v1.go: frozen v1
  reader struct snapshot of overnightSummary at 2026-04-09 HEAD.
  Only struct definitions, no methods, to prevent drift.

- EXTENDED cli/cmd/ao/overnight_test.go: added
  TestRunOvernight_SchemaV2IsV1BackwardCompatible (pm-008 fix).
  Constructs a minimal v2 summary, marshals it, unmarshals into
  the frozen v1 reader, and asserts every v1 field is populated.
  Previous tests untouched.

Issue 12 — Contract v2 bumps:

- docs/contracts/dream-run-contract.md: new v2 iteration-loop
  section. Documents INGEST -> REDUCE -> MEASURE, the 5
  checkpointed subpaths, 5 halt conditions, 5 anti-goals, 6 new
  flags, startup recovery protocol, and the pm-011 concurrency
  guard. V1 content + Wave 2's "Retrieval-bench determinism"
  subsection preserved.

- docs/contracts/dream-report.md: Schema v2 section documenting
  the 4 new top-level fields (iterations, fitness_delta,
  plateau_reason, regression_reason) and the IterationSummary
  shape (14 fields). Explicit backward-compat guarantee
  referencing TestRunOvernight_SchemaV2IsV1BackwardCompatible.

Issue 13 — Skill docs:

- skills/dream/SKILL.md: added Compounding Loop (v2) section with
  anti-goals, 3 new /dream start examples, iteration sub-summary
  bullet in Output, Delineation vs /evolve table. 207/250 line
  budget.
- skills/harvest/SKILL.md: nightly-usage blockquote pointing at
  /dream start as the primary nightly driver and noting the
  .agents/overnight/run.lock refusal during Dream runs.
- skills/evolve/SKILL.md: Delineation vs /dream section
  (identical verbatim table to dream/SKILL.md — must be kept in
  sync). Pointer added in See Also.

Verification:
- go build ./... OK
- go vet ./... OK
- go test ./internal/overnight/... all green (e2e + unit)
- go test ./cmd/ao/ all green (incl. schema v2 backward-compat)
- heal.sh --strict clean
- check-contract-compatibility.sh 0 failures / 0 warnings

Follow-up flagged (not blocking): skills-codex/ parity for dream/
harvest/evolve needs a pass of scripts/audit-codex-parity.sh +
regen-codex-hashes.sh to propagate the markdown changes.

Refs: plan Issues 11/12/13, pre-mortem pm-008/011/012/015.
2026-04-10 12:53:58 -04:00
Boden Fuller 1f30e073aa feat(overnight): wave 1-2 — skeleton + independent components
Dream nightly compounder (plan rev 2). Lands Wave 1 skeleton and
Wave 2 parallel components per the file-conflict matrix.

Wave 1 — cli/internal/overnight/ skeleton:
- doc.go with package contract + anti-goals (no code mutation, no
  /rpi, no git ops, no symlinks, no swarm)
- types.go with RunLoopOptions and normalize() defaults (2h budget,
  6h max, K=2 plateau window, 0.05 regression floor, 512MB checkpoint
  cap, 12h stale-lock threshold)
- loop.go with public RunLoop surface (stub for Wave 3 stage drivers)

Wave 2 — independent components (zero file overlap, 6 workers):
- checkpoint.go: two-phase-commit staging overlay with marker-file
  crash-recovery protocol. VerifyMetadataRoundTrip computes set-diff
  over ALL frontmatter keys (pm-005 fix — no hardcoded allowlist)
- fitness.go / plateau.go: FitnessSnapshot.Delta with per-metric
  floors; PlateauState with K=2 minimum (pm-FEAS-08) and noisy-sample
  absorption
- findings_router.go: scans .agents/findings/f-*.md, dedups against
  next-work.jsonl by finding ID, regex-gates registry.json and
  README.md (pm-MISS-06 fix)
- queue.go: evolve pinned-queue format parser
- cli/internal/lifecycle/close_loop.go: extracted from
  cli/cmd/ao/flywheel_close_loop.go (pm-001 fix — the original plan
  mis-identified feedback_loop.go as a close-loop stub;
  feedback_loop.go is untouched). Dependency-injected ExecuteCloseLoop
  lets Dream's REDUCE call close-loop in-process. cmd/ao adapter
  preserves byte-for-byte stdout compatibility.
- cli/internal/corpus/: new package computing FitnessVector from the
  local corpus. Dedicated cli/cmd/ao/corpus.go CLI (pm-002 fix —
  corpus-quality stays OUT of the goals Directive subsystem).
- retrieval_bench.go + dream-run-contract.md: documented existing
  determinism (pm-012 fix — no --seed flag added, would be dead work).

Tests: 58 new tests across internal/overnight, internal/corpus,
and internal/lifecycle, all L1 unit tests per AI-native test shape.
All passing. 50+ pre-existing close-loop-adjacent cmd/ao tests
preserved unmodified.

Build: go build ./... OK, go vet ./... OK, all three new package
test suites green.

Refs: .agents/plans/2026-04-09-dream-nightly-compounder.md (rev 2),
.agents/council/2026-04-09-pre-mortem-dream-nightly-compounder.md
(attempt 1 FAIL → 15 findings patched → attempt 2 WARN/PROCEED).
2026-04-10 12:08:34 -04:00