fix(algorithm): read phase/progress/iteration from modern ISA frontmatter - #2122
Open
pai-scaffolde wants to merge 1 commit into
Open
pai-scaffolde wants to merge 1 commit into
pai-scaffolde wants to merge 1 commit into
Conversation
…tter Two readers still parse only the legacy ISA frontmatter keys. The session-start ACTIVE WORK block printed "ISA: ISA (UNKNOWN, 0/0)" for every current ISA, and a reflection written without --iteration always recorded iteration 1 even after the rewind hook had bumped the ISA. Modern ISAs carry phase:, progress: and iteration:; id:, status: and verification_summary: are the legacy keys. LoadContext now falls back to phase:/progress: (and to the directory slug for the id), and Reflect.ts reads iteration: from MEMORY/WORK/<slug>/ISA.md as the default. Legacy keys still win when present, and an explicit --iteration still wins. Reflect.ts resolves the ISA through the file's existing LIFEOS constant, so LIFEOS_DIR keeps working. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Reproduced on a fresh LifeOS 7.40.4 install (macOS, Claude Code in the Claude desktop app); the fix was applied to that install and run there before filing.
Observed
Every session-start ACTIVE WORK block reported the same placeholder ISA line, whatever the ISA actually said:
Note
Status: climbingon the line above — the dir-level reader already understandsphase:, the ISA summary right under it does not.Separately,
bun LIFEOS/TOOLS/Reflect.ts --session … --slug … --reflection …with no--iterationalways wrote"iteration":1, including for ISAs the rewind hook had already bumped to 2, 3, 4.Root cause
Both readers parse only the legacy ISA frontmatter keys. Modern ISAs carry
phase:,progress:anditeration:;id:,status:andverification_summary:are the pre-rename keys.hooks/LoadContext.hook.tsbuilds theisasummary fromid:/status:/verification_summary:alone, so all three matches miss and the hardcoded defaults'ISA','UNKNOWN','0/0'print instead. The dir-level status reader ~50 lines above already has thephase:fallback; this block was never given one.LIFEOS/TOOLS/Reflect.tsdefaultsiterationto the literal1when--iterationis absent. The ISA is the thing that actually tracks the iteration count, and nothing read it, so the reflection corpus silently recorded every rewound session as a first pass.Fix
LoadContext.hook.ts: addphase:andprogress:fallbacks to the ISA summary and fall back to the WORK directory slug for the id. Legacy keys still win when present, so old ISAs render exactly as before.progress:has its whitespace stripped so3 / 7and3/7both render3/7.Reflect.ts: addisaIteration(slug), which readsiteration:out ofMEMORY/WORK/<slug>/ISA.md, and use it as the default. An explicit--iterationstill wins; a missing or unparseable ISA still falls back to 1. The path is resolved through the module's existingLIFEOSconstant (process.env.LIFEOS_DIR ?? join(homedir(), ".claude", "LIFEOS")) rather than a freshhomedir()join, so a relocated config dir keeps working.How tested
Both files transpile:
bun build --target=bun --no-bundleon each, exit 0.LoadContext, against a throwaway
HOMEholding one WORK dir whoseISA.mdfrontmatter isphase: climbing/progress: "3/7"/iteration: 4, with a SessionStart payload on stdin:Reflect, same fixture,
--dry-runso nothing is appended:On the live install the same change produced
ISA: install-closeout-upstream (climbing, 3/12)in place ofISA: ISA (UNKNOWN, 0/0), andReflect --dry-runreported"iteration":3matching that ISA's frontmatter.Repro on a clean tree: create
LIFEOS/MEMORY/WORK/<YYYYMMDD-HHMMSS>-slug/ISA.mdwith a title plusphase: climbing,progress: "3/7",iteration: 4in the frontmatter, then run the two commands above against that tree.🤖 Generated with Claude Code