Skip to content

feat(memory): type write-sessions as decision in the memory loop - #151

Merged
ajianaz merged 1 commit into
developfrom
feat/memory-decision-type
Oct 1, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/memory-decision-type

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

Memory-loop decision typing (#143): a session that executed any Write/Destructive tool is stored to uteke with --type decision and a wrote tag; plain context sessions keep the exact old shape (--type context, tags tole,session).

  • drive() surfaces the flag on TurnOutcome::Final { text, wrote }; resume_turn replays inherit it.
  • The flag is a durable, session-scoped fact register (fact.wrote_this_turn): set wherever such a tool settles — fresh execution AND crash-replay — and never reset by turn machinery. A session that ever wrote is a decision session, including across aborts (post-Provider 502 mid-turn wedges session at pc=Planning; recovery is interactive-only #84 pc=Final) and prompt-resumes.
  • remember_session picks type/tags from the flag. Content contract UNCHANGED: first prompt + final answer only — no raw tool output, no extra LLM call (v0 scope; injection-into-memory surface stays closed, noted in docs/threat-model.md).
  • Chat REPL folds both the Final flag and the durable register (abort coverage) into chat_wrote.

Two cora pre-commit MAJORs on the first cut, both real, both fixed with regression tests: (1) the in-RAM flag died at resume boundaries and replayed Writes were invisible → durable session-scoped register + ReExecute-path flag set; (2) the chat summary missed writes from turns that aborted before Final → fold the durable register after every outcome.

Why (the problem you're solving)

Comprehension-debt research (Oct 2026): decision journals are the organizational antidote. Tole's memory loop already persists session summaries; typing write-sessions as decision makes "recall every decision in this repo" a first-class uteke retrieval instead of an undifferentiated context stream. Smallest possible change; lands first in the 0.5 train (#143 → #145 stacks on these files).

Testing (how you verified this works)

  • Unit: write-session → wrote=true on Final; read-only → false; abort after a Write keeps the session flag (post-Provider 502 mid-turn wedges session at pc=Planning; recovery is interactive-only #84 semantics); Settling-crash resume inherits the flag (built via real begin+settle_ok helpers); guarded replay of a Write tool reports wrote=true and leaves the register true (e2e_resume); fake-binary argv asserts tole passes --type decision --tags tole,session,wrote (and the unchanged context shape otherwise).
  • Suites: workspace 255 passed / 0 failed; tole-core mobile profile lib 58/58; clippy --workspace --all-targets -- -D warnings clean; fmt clean; cora review "No issues found".
  • Live E2E (release binary, --memory uteke): a write mission stored the summary tagged tole,session,wrote — verified via uteke recall --json in the session namespace. KNOWN FLEET LIMITATION (not a tole bug): uteke CLI 0.19.0 silently normalizes --type decision to fact on the plain (non-room) remember path — tole sends the flag correctly (unit-pinned); upstream issue filed in codecoradev/uteke. Until the CLI honors it, the reliable discriminator is the wrote tag.

Sessions that executed a Write/Destructive tool are stored to uteke
with --type decision and a wrote tag; plain context sessions keep the
old shape. The flag is a durable, session-scoped fact register set
wherever such a tool settles (fresh execution and crash-replay), so it
survives resume boundaries — the two cora findings on the first cut
(in-RAM flag dying at resume; replayed writes invisible) are fixed and
regression-tested. Summary content contract unchanged (prompt+answer
only), so the injection-into-memory surface stays closed.

Closes #143
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 58800b3 into develop Oct 1, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/memory-decision-type branch October 1, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant