Session post-mortem subsystem + autonomous decision capture (A003)#2
Open
pskeshu wants to merge 2 commits into
Open
Session post-mortem subsystem + autonomous decision capture (A003)#2pskeshu wants to merge 2 commits into
pskeshu wants to merge 2 commits into
Conversation
Packages the forensic session analysis (first run by hand for session 6a4a3d9b) into a repeatable, stored capability authored by Claude Code: the session-postmortem skill + report schema (v1); a fan-out -> adversarial-verify -> synthesize workflow parameterized by session; and docs/POSTMORTEM_DESIGN.md covering the architecture, storage layout, the dev/agent-facing feedback loop (recurrence-tracked rollup + regression evals), and the phased build plan. Gently owns only the inputs/schema/storage/trigger; the intelligence lives in Claude Code. No harness runtime code changes in this commit. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Autonomous (event-driven) turns wrote no Decision row: only the non-streaming call_claude path recorded one, hardcoded to trigger=USER_MESSAGE. A fully autonomous run therefore left decisions.jsonl empty (session 6a4a3d9b), forcing post-mortems to reconstruct reasoning from conversation.json. run_wake_turn now aggregates the turn's tool calls and writes one Decision(trigger=EVENT, trigger_detail=<wake reason>) per wake. _write_production_decision gains optional trigger/trigger_detail params (defaults preserve the USER_MESSAGE behaviour, so chat turns are unchanged). Capture is best-effort and never breaks a turn. Scoped to the autonomous path; user turns on the web streaming path remain a separate capture gap. Verified: new tests/test_wake_decision_capture.py (4 cases) + existing tests/test_eval.py (27) pass. Full live wake-turn not exercised here. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
Why
The first autonomous run (session
6a4a3d9b) was analyzed by hand and surfaced a stack of harness issues — 3 live embryos falsely terminated, a dead vision tool, and an emptydecisions.jsonlthat forced the whole analysis to be reverse-engineered fromconversation.json. This PR turns that one-off into a repeatable capability and fixes the highest-leverage gap it exposed.What
1.
feat(postmortem)— Claude Code session post-mortem scaffoldPackages the forensic analysis into a repeatable, Claude-Code-authored, stored capability. Gently owns only the inputs/schema/storage/trigger; the intelligence lives in Claude Code.
.claude/skills/session-postmortem/— the analyst skill + report schema (v1).claude/workflows/session-postmortem.js— fan-out → adversarial-verify → synthesize, parameterized by sessiondocs/POSTMORTEM_DESIGN.md— architecture, storage layout, the dev/agent-facing feedback loop (recurrence-tracked rollup + regression evals), and the phased build planNo harness runtime code changes in this commit.
2.
fix(observability)— capture autonomous wake turns indecisions.jsonl(A003)Autonomous (event-driven) turns wrote no
Decisionrow — only the non-streamingcall_claudepath recorded one, hardcoded totrigger=USER_MESSAGE. So a fully autonomous run leftdecisions.jsonlempty.run_wake_turnnow aggregates the turn's tool calls and writes oneDecision(trigger=EVENT, trigger_detail=<wake reason>)per wake._write_production_decisiongains optionaltrigger/trigger_detailparams; defaults preserve theUSER_MESSAGEbehaviour, so chat turns are unchanged.Scope: autonomous path only; user turns on the web streaming path remain a separate (smaller) capture gap.
Verification
tests/test_wake_decision_capture.py(new, 4 cases) — EVENT trigger + wake reason + tool calls captured; default path still tagsUSER_MESSAGE; safe no-op when no decision log is attached.tests/test_eval.py(existing, 27) still pass — no regression.Notes
feature/temperature-operations-all(notmain), so the PR targets that branch.sessions/…_6a4a3d9b/postmortem/report.{yaml,md}) lives underD:\Gently3\(runtime data) and is intentionally not in the repo.d846dcda.Follow-ups (deferred; tracked in the report + design doc)
put_postmortemstorage_finalize_perception_runtrigger + orphaned-run reconciler (A006)analyze_volume), A001/A002 (drift-aware termination + refocus write-back)🤖 Generated with Claude Code