feat(notebook): rename ledger to notebook with subject-oriented grounding and add topic-awareness layerRefactor/notebook#6
Merged
Conversation
# Conflicts: # README.md
…ead of stale in-memory state
…hority, and edge-case coverage
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.
Note: This PR was generated by an AI agent. If you'd like to talk with other humans, drop by our Discord!
Summary
This PR renames the
ledgersubsystem tonotebook, upgrades its semantics from a sparse continuity cache to durable subject-oriented grounding, and introduces a topic-awareness layer that uses the active semantic frame to drive spawn-vs-handoff decisions with boundary detection.What changed
Renamed
ledger/→notebook/— the directory, state property (state.ledger→state.notebookPages), all public tools (ledger_add→notebook_write,ledger_get→notebook_read,ledger_list→notebook_index), and the interactive/ledgercommand →/notebook. Backward-compatible rehydration scans for bothledger-entryandnotebook-entrypersisted custom types, so no data loss across upgrades.Semantic upgrade — the notebook is now framed as durable cross-context grounding organized by subject/thread, not a running stream-of-consciousness cache. The CONTEXT_PRIMER, tool descriptions, and prompt guidelines all steer toward pages that outlive a single session: architecture, decisions, constraints, open questions. Transient task state belongs in the handoff brief, not the notebook.
New topic-awareness layer —
notebook/topic.ts+notebook/topic-tool.tsadd anactiveNotebookTopicfield to state, anotebook_topic_settool, and apendingTopicBoundaryHintmechanism. When the topic changes, the watchdog emits a boundary nudge (even below the 30% context heuristic) recommending a deliberate handoff. The TUI shows the topic in the status bar (🧭 topic), and the high-context warning widget is now topic-aware. Handoff compaction automatically clears the active topic so the next context starts fresh.Breaking changes
ledger_*tonotebook_*tool names.state.ledger→state.notebookPages(affects direct state access)./ledgerTUI command renamed to/notebook; the command now also accepts a topic argument (/notebook <topic>) to set the active frame.Value
The rename signals a real semantic upgrade — the notebook is a carefully curated set of durable pages for cross-context reuse, not a firehose of continuity scribbles. The topic-awareness layer gives the agent a lightweight frame for context-boundary decisions: stay and spawn within a topic, handoff when the topic shifts. This directly reduces the amount of stale context dragged across job boundaries, and the boundary hint mechanism catches mid-task pivots that would otherwise silently degrade context quality.
Attached is an agent optimized description of the changes in this PR - AGENT_REVIEW.md