feat(ledger): retire the legacy stores under FORGE_LEDGER_ONLY#63
Merged
Conversation
Implements the ROADMAP "Next" item "Legacy store retirement". Since P1 the PCM ledger has been the convergent WRITE store (dual-write via ledger_bridge) with a merged read (ledger_read); the remaining step was to stop writing the legacy files so the ledger is the only store. With FORGE_LEDGER_ONLY=1 (default off — every existing test is unchanged): - lessons_store.save skips the .md write (the ledger already holds the lesson) - cortex confirm/create/distill dedup against ledgerLessons, not the files - ledger_read.mergedLessons returns the ledger view alone - recall.add skips the fact file; recall.readFact falls back to the ledger (also fixes merged teammate facts that had no local file); the CLI re-indexes MEMORY.md / AGENTS.brain.md after the shadow write so the projection is current Reads materialize from the existing ledger view (claimToLesson / ledgerFacts); `forge ledger import` backfills so nothing local is stranded. New test/ledger_only.test.js exercises the on-path end to end. Verified: npm test (668 pass), npm run check, npm run typecheck, forge docs check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WTc41NYip9GZLu4n9a5vLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Implements the ROADMAP "Next" item "Legacy store retirement". Since P1 the PCM ledger has been the convergent write store (dual-write via
ledger_bridge) with a merged read (ledger_read, legacy ∪ ledger). The remaining step was to stop writing the legacy files so the ledger is the only store.With
FORGE_LEDGER_ONLY=1(default off — every existing test is unchanged):lessons_store.saveskips the.mdwrite — the ledger already holds the lesson (recordLessonEventshadows every save)cortexconfirm/create/distill dedup againstledgerLessons(materialized from the ledger, same legacy ids viaprovenance.task), not the filesledger_read.mergedLessonsreturns the ledger view alonerecall.addskips the fact file;recall.readFactnow falls back to the ledger — which also fixes a real gap: a merged teammate fact with no local file was previously unreadableMEMORY.md/AGENTS.brain.mdafter the shadow write so those projections stay current under ledger-onlyReads materialize from the existing ledger view (
claimToLesson/ledgerFacts), so no new read path was invented.forge ledger import(already present) backfills legacy content so nothing local is stranded when you flip the switch.src/util.js—ledgerOnly()switch.src/lessons_store.js,src/cortex.js,src/ledger_read.js,src/recall.js,src/cli.js— write-skips + ledger-only reads.test/ledger_only.test.js— exercises the on-path end to end.FORGE_LEDGER_ONLY),CHANGELOG.md, ROADMAP.Checklist
npm testpasses — 670 tests, 668 pass, 0 fail (2 pre-existing skips); 4 new casesnpm run checkpasses (Biome) — exit 0feat:)CHANGELOG.mdupdated under## [Unreleased]forge docs checkreconciledRisk & rollback
FORGE_LEDGER_ONLY(instant revert to legacy-canonical); or revert the commit. No destructive migration —forge ledger importonly adds content, idempotently.Extra checks
npm run typecheckpasses🤖 Generated with Claude Code
Generated by Claude Code