Repository navigation
Hypothesis ledger: record what each agent ruled out, and feed it to the next one (#303) - #337
Merged
currentbits merged 6 commits intoAug 17, 2026
Conversation
added 6 commits
August 17, 2026 19:30
Read-only card grouped invalidated / validated / inconclusive, hidden when the thread recorded none. Seeded on thread-1 for the browser demo.
…into coder/hypothesis-ledger-show-what-each-agent-t-887a7e
currentbits
deleted the
coder/hypothesis-ledger-show-what-each-agent-t-887a7e
branch
October 3, 2026 16:07
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.
Closes #303.
Agents currently only report the approach that worked. What they ruled out is thrown away, so the next agent — or the next best-of-N fork — happily walks back into the same dead end. This adds a per-thread hypothesis ledger and, more importantly, feeds the ruled-out half of it back into the next dispatch.
How it works
Capture is agent-authored, never inferred. A new
hypothesis_recordtool on the existing coder-threads MCP server takes{ threadId, projectId, claim, status: validated | invalidated | inconclusive, reason }, behind the sameassertSameProjectguard asthread_fork/thread_send. No transcript mining, no LLM pass, no scheduler. A sentence in the server INSTRUCTIONS tells agents to record each distinct approach as soon as they know how it turned out.Storage rides the thread.
ThreadInfo.hypotheses(contract insrc/shared/ipc.ts), capped at 50 rows / 200-char claim / 500-char reason.recordHypothesisvalidates the status, trims and truncates, drops the oldest row past the cap, and writes without bumpingupdatedAt— a ledger entry is not sidebar activity, same rule assetNotes.The ruled-out list reaches the next agent.
hypothesisNoteForjoinsplanboardNoteFor/selfIdNoteForas a standing note on every dispatched prompt, carrying theinvalidatedentries of the thread and up to fivehandoffFromancestors, deduped by claim and capped at 10 lines. Because it rides every turn rather than only the first, it survives context compaction and resumed sessions. It returns""when there is nothing to say, so threads without a ledger dispatch exactly as they do today.Surface. A read-only card on the Agents tab, ruled-out group first (that group is the point), then worked, then inconclusive — claim, reason and age per row. Rendered only when the thread has entries; a thread whose agents never recorded one looks unchanged. Grouping and the summary line live in a pure
src/hypothesisLedger.tsso the component stays dumb and the logic is testable.Verification
npm run test:electron992/993 — the single failure is the web-integration reconnect test that already fails onmain.npm run test:renderer831/831,npm run typecheckclean.electron/test/hypotheses.test.js(caps, validation, same-millisecond id collisions, ancestor walk,handoffFromcycle, cross-project rejection) plustest/hypothesisLedger.test.ts.Deliberately not built
Cross-sibling rollup for best-of-N: siblings start simultaneously, so one fork's dead end cannot reach the others in time. The ancestor walk covers the sequential case that actually matters; add the rollup when best-of-N gets a compare view to hang it on.
Any UI to edit or delete entries — the ledger is evidence, not a scratch pad.
runIdon an entry: nothing exposes the active run id to the MCP handler, so grouping the card by run would have stored a null and pretended.PR created by the Claude Code agent