feat: add cross-run accumulation ledger#1
Conversation
… hooks) Closes the open self-referential loop: Ada now reads AND writes its own compile state across runs. On Governor ACCEPT, a CompileRecord is written to the accumulation ledger with intent hash, gate deltas, entropy readings, and blueprint postcode. On the next compile, the Intent stage reads recent ledger entries as auxiliary context, surfacing prior bottlenecks and high-entropy stages. Implementation: - ACC stage code in provenance postcode system - CompileRecord, GateDelta, AccumulationContext types in compiler - compile_ledger table + recordCompile/getRecentCompileRecords in AdaStorage - MotherCompiler.buildCompileRecord (Governor Write Hook) - MotherCompiler.buildAccumulationContext (Intent Read Hook) - Both ada init and ada compile wired to read/write the ledger No new agents. No new pipeline stages. Two hooks, one artifact type. https://claude.ai/code/session_012aDqyuDBYMws5ZF2DuHeKs
Deploying motherlabs with
|
| Latest commit: |
1cb7805
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c80c0cb5.motherlabs.pages.dev |
| Branch Preview URL: | https://claude-add-accumulation-ledg.motherlabs.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cb78051e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // ─── Governor Write Hook: write CompileRecord to accumulation ledger ───── | ||
| try { | ||
| const storage = new AdaStorage(); | ||
| const compileRecord = MotherCompiler.buildCompileRecord(result, runId); | ||
| storage.recordCompile({ |
There was a problem hiding this comment.
Write compile ledger entries only after ACCEPT
This hook persists a CompileRecord unconditionally before the command checks gov.decision, so REJECT/ITERATE runs (including --strict failures) still enter the accumulation ledger and are then fed back into later intent context. That contradicts the accept-only contract used elsewhere (e.g., init path) and can pollute cross-run memory with runs that were explicitly rejected by governance.
Useful? React with 👍 / 👎.
| `INSERT OR REPLACE INTO compile_ledger | ||
| (run_id, project_path, intent_hash, blueprint_postcode, gate_deltas, entropy_readings, timestamp, decision, postcode_raw) | ||
| VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, |
There was a problem hiding this comment.
Avoid replacing ledger rows by non-unique run IDs
Using INSERT OR REPLACE on compile_ledger keyed by run_id can silently overwrite prior records when two compiles share the same generated run ID (callers use second-level timestamps like ML-${Math.floor(Date.now()/1000)}). That loses historical accumulation data and skews the context read hook toward fewer/incorrect prior runs.
Useful? React with 👍 / 👎.
Summary
CompileRecordto the accumulation ledger with intent hash, gate deltas, per-stage entropy readings, and blueprint postcode (PostcodeAddress:ML.ACC.{hash}/v1)No new agents. No new pipeline stages. Two hooks, one new artifact type.
Files changed
@ada/provenancepostcode.tsACCstage code@ada/compilertypes.tsCompileRecord,GateDelta,AccumulationContexttypes@ada/compilerengine.tsaccumulationContextoption +buildCompileRecord()/buildAccumulationContext()static methods@ada/compilerindex.ts@ada/storageindex.tscompile_ledgertable +recordCompile()/getRecentCompileRecords()/getRecordsByIntentHash()@ada/cliinit.ts@ada/clicompile.tsWhat this closes
ML.ACC.{hash}/v{n}— provenance system already handles thisWhat this does NOT do (deferred)
Test plan
pnpm --filter @ada/provenance --filter @ada/storage --filter @ada/compiler buildcompile_ledgertable is created on firstAdaStorageinstantiationada init "test"→ confirm CompileRecord written to ledger on ACCEPTada init "test"again → confirm accumulation context injected into intentML.ACC.{hash}/v1postcodeshttps://claude.ai/code/session_012aDqyuDBYMws5ZF2DuHeKs