Skip to content

dsh-chapters

Open-source memory layer for coding agents · DeepSeek Harness plugin

Long memory for local AI — your agents keep every word, without ever summarizing a thing.

When the context window fills, dsh-chapters archives the conversation as verbatim chapters and opens the next session with a table of contents — compaction costs zero inference tokens, and every byte stays retrievable.

Getting started

  1. Install

    Adds dsh-chapters to your harness profile — a plain npm directory — and brings its six tools, seven commands, and both archive buttons with it. The release this site documents: 0.2.27.

    npm i @fractalsynapse/dsh-chapters@latest

    Run it in the profile directory (~/.dsh/profiles/<profile>/). §23 covers every path.

  2. Keep it current

    The same line re-run moves the profile to whatever npm calls latest — no number to chase, so no stale instruction is possible.

    npm i @fractalsynapse/dsh-chapters@latest
  3. Restart, then go

    Restart dsh web so the bundle loads. From any session: click Continue with chapters on a message to carry the work on, or Fork with chapters to branch it — one deterministic door, two intents. That’s the whole setup.

A profile is just a package.json plus its node_modules under<DSH home>/profiles/<name>/ — installing is npm, updating is npm again. The archive stays yours: plain Markdown, kept on uninstall.

What it gives you

Every claim below is measured, not projected — the runs, counters, and tapes behind it are in Part V.

01

Compaction that costs zero inference tokens

Summarizing means feeding the whole conversation back through the model, every time the window fills. This plugin archives by copying its own log instead — compacting costs nothing.

02

Verbatim memory your agents actually use

Archives are the original text, byte for byte — not a paraphrase you have to trust. In the documented run, agents reached into the archive on their own 49 times.

03

Nothing is ever destroyed

The session log is append-only. Compacting hides old spans in the window but keeps every word on disk, so the original session stays open — branch it, abandon the branch, keep working.

04

New sessions inherit a map, not a burden

A continuation starts with one short message: a table of contents of everything that came before. About 100 tokens instead of thousands.

05

The tool-output firehose, defused at arrival

Huge tool results — 40K-line logs, dumped lockfiles — never enter the context window. They are stored once, and the agent can search or read them on demand.

06

One link turns session memory into team memory

Point your project at a git repository or a TreeDX service, and every session under it can search the shared corpus. Offline it degrades to local-only and says so.

07

Built for the model on your own GPU

Made for small local models: no API key, no vector DB, no daemon, no telemetry. Your memory is plain Markdown files that any tool can read.

08

Team steering that respects every machine

Rules are proposals that bind only after each machine approves them. Approved rules ride into every continuation — under a budget that refuses with numbers instead of clipping a line.

09

Loud honesty, from the engine to the CI

When something cannot be done, the plugin refuses and says why. CI replays real recorded sessions, so nothing can fake green.

10

Continuity you can click

Every assistant message carries two buttons — Fork with chapters, Continue with chapters: ONE deterministic door pulled with two intents, branch the work or extend it. The plugin derives the ranges itself, so a click needs no model turn. Installing is one line; uninstalling leaves your archive and pool in place.

The commands

Scope & activation. Installing the plugin registers these commands, six agent tools, and both archive buttons — Fork with chapters and Continue with chapters, one deterministic door with two intents — in every session of your profile, nothing else to enable. Routing the host’s /compact through the plugin’s zero-token engine is the one part that needs the chapters preset: pick it from the preset menu in the composer (installed automatically; a continuation session composes its preset itself).

/chapters-link

Bind this workspace to a shared knowledge pool. One link per project — every later session and sub-agent under that path inherits it, and linking publishes what is already archived.

Usage
/chapters-link /home/you/team-kb.git            # local or bare git repo — no credentials
/chapters-link https://github.com/you/team-kb.git  <tok>  # smart-HTTP pool; token stored 0600 in the DSH home
/chapters-link treedx+https://kb.example.com/team  <tok>  # TreeDX service backend
/chapters-link                                            # show the current binding
Example output
Linked: project fractalsynapse/kb · transport git · mirror .dsh-knowledge/
Published 30 chapter(s), 2 artifact(s) · Sync: pending first push

/chapters-status

The state of the memory system for this workspace: sync mode with the steps behind it, pending counts, vocabulary mode — or an honest local-only with the failed step named.

Usage
/chapters-status
Example output
mode: synced (git · fractalsynapse/kb)
steps: cloned ✓ → published 2 new file(s), 28 already mirrored ✓ → pushed ✓
pending: 0 · last sync 2026-09-27 21:14 · vocabulary: shadow (17 candidates, apply off)

/chapters-enrich

Drive the background annotator that adds topics and search summaries to archived chapters. Batches run after pushes and on idle by themselves; the body text of a chapter can never be touched — a hash guard rejects it.

Usage
/chapters-enrich run                          # drain the queue now
/chapters-enrich model local/qwen3.8-flash-next   # choose the annotator (or: model clear)
/chapters-enrich report                           # what was annotated, with provenance
Example output
ladder drained: 3 chapter(s) annotated · 12 topic labels · 2 provenance entries appended
guard: 0 body mutations attempted · 1 legacy fragment stitched into index view

/chapters-rule

Teach agents durable practices. add writes a write-once proposed rule (it binds nothing yet); approve makes it core on THIS machine only; approved rules ride into every continuation notice verbatim.

Usage
/chapters-rule add retrieval "Search the pool for prior findings before designing changes."
/chapters-rule list --proposed
/chapters-rule approve retrieval/a17f
/chapters-rule revoke retrieval/a17f
Example output
proposed retrieval/a17f (category retrieval, write-once) — binds nothing until approved
approved on this machine (harness "ws-dev") → included in continuation notices under the 1,200-token core budget

/chapters-fork

ONE deterministic door, in its branch intent. Everything since the last archive is written as verbatim chapters (the plugin derives the ranges — no model turn, no frozen numbers) and a titled child opens whose whole history is the cumulative TOC. A branch gets zero plan bytes: its plans stay reachable as history, cited by the chapters.

Usage
/chapters-fork                      # title defaults to the parent's + "— branch"
/chapters-fork Try the TreeDX backend instead    # or name the branch
# the same door as the "Fork with chapters" button on any assistant message
Example output
Forked: 4 new chapter(s) archived (watermark respected: seqs 24..132), branch “Try the TreeDX backend instead” is session ch-6b9c…; TOC ~118 tokens, allowance 3900. Switch to it from the sidebar — its first message is the table of contents.

/chapters-continue

The same builder, in its continuation intent — the archive is identical, only what the child is TOLD differs: its notice carries the operative plan as a live directive, and if the session was still planning the child is seeded into plan mode for real.

Usage
/chapters-continue                    # same door, other intent
/chapters-continue Finish the retrieval hints
# the same door as the "Continue with chapters" button on any assistant message
Example output
Continued: 4 new chapter(s) archived (watermark respected: seqs 24..132), continuation “Finish the retrieval hints” is session ch-1a4d…; TOC ~121 tokens, allowance 3900. Switch to it from the sidebar — its first message is the table of contents.

/compact

The harness command — listed here because the chapters preset routes it through the plugin: an in-place checkpoint computed from the log (zero inference tokens) that carries your PLOT note forward and archives the hidden span first.

Usage
/compact    # with the 'chapters' preset selected in the preset menu
Example output
surface 57,221 → 23,643 tokens · seqs 10–154 shadowed (33,575 tok) · archived verbatim
plot carried: "PLOT: 3 of 6 reports in and cross-verified…" · inference tokens: 0

Authoritative detail — every flag, refusal message, output shape — lives in§15 Commands.