DuoDuo docs

How DuoDuo works.

What DuoDuo is, how it learns, and the ways you reach it. Where there is something to do, these pages hand it to your DuoDuo.

Check health, upgrade safely, and keep the intuition layer useful.

Operate

Intuition & Compaction

Keep useful context without letting old conversations grow forever.

A transcript, the active model context, and long-term instinct are three different things with three different lifecycles. DuoDuo keeps them apart.

The filesystem is the durable body
Durable runtime state
runtime_dir/var/
events/Spine WAL · source of truth
sessions/conversation state
jobs/scheduled work
outbox/channel egress queue
usage/measured activity
Kernel · a Git repo
kernel_dir/
config/channel defaults
memory/intuition layer + dossiers
subconscious/partitions + playlist
Workspace
/your/project/

The project files the agent is reading and changing. The session stays attached to this workspace.

The filesystem is the database. The Spine WAL is the record of everything that crossed the machine's boundary: what audit, duoduo spine, and the subconscious read, and what the daemon rebuilds its routing from after a restart. Each runtime keeps the conversation it resumes in its own session files beside it. The kernel's Git history records every change to the intuition layer and configuration. Locks, PIDs, and heartbeat bookkeeping live separately as ephemeral files—safe to clear, never needed to recover. Run duoduo daemon config to see the paths used on this machine.

Three kinds of continuity#

LayerPurposeWhat survives
Session historyContinue one conversation with its workspace and model historyThe original transcript and session state remain on disk
Active contextGive the current model enough recent history to actIt can be compacted when it becomes expensive
Intuition & dossiersCarry distilled instincts and knowledge across sessionsDossiers, lessons, grooves, and the compact intuition layer live in the kernel

Compaction manages active context. The subconscious tends the intuition layer and its dossiers. Neither needs to delete the original event history.

From event evidence to intuition#

The pipeline is evidence-driven and split in two, so that reading experience and rewriting instinct never compete for the same wake:

  1. External interactions and tasks enter the append-only event history, one timeline shared by every channel and every runtime.
  2. Distil. gradient-distiller reads a bounded stretch of that history and writes text gradients.
  3. Weave. intuition-weaver, the only writer of the intuition layer, reads the accumulated gradients and moves the layer: add a line, rewrite one, reorder, retire, or re-point it at something reachable.
  4. Alongside them, entity dossiers are kept current, and a verified correction arc becomes a lesson while a procedure that converged through repeated use becomes a groove.
  5. The committer stages the kernel working tree and lands one commit, so every step above has a diff and a revert.

In one line: events —distill→ text gradients —weave→ intuition layer.

What a text gradient is#

A text gradient is a finding about one line of the intuition layer: the line, the events it was tested against, and which way it should move. Why DuoDuo learns this way is in Mental Model.

The intuition layer itself is a compact board (one line, one pointer) loaded into every future foreground session. The dossiers its lines point to stay linked on disk and are opened when a task needs them. On disk, the board and its dossiers live under the kernel's memory/ directory, with the board at memory/CLAUDE.md; the directory keeps that name, and the commands that check it are duoduo memory ….

Not every pass adds something. Greetings, receipts, transient task detail, and evidence that repeats what is already known produce no gradient, and a weave that finds nothing worth changing leaves the layer alone. The record is preserved either way; the layer moves only when something held up.

Measuring unused lines#

A line nobody reads still costs a slot in every prompt, so the weaver gets a second input next to the gradients: an activation report counting how often each line is read during real work. A line that never fires arrives as evidence to rewrite, re-point, or retire it. The count is kept in days when someone worked with DuoDuo rather than calendar days, so a quiet week does not age out a line that was earning its place.

Manual compaction#

Type /compact in the conversation, or ask DuoDuo to compact another one.

Compaction summarizes older active context to make room. It does not delete the original transcript.

DuoDuo tightens a teal band around the end of a long, connected accordion transcript.

Idle auto-compaction#

Idle auto-compaction is available for channel sessions and is off by default. When enabled, it can prepare a large conversation during a quiet period instead of making the next reply reopen the entire cold context.

Whether it pays depends on the backend's cache behavior, the measured size after compaction, and how often you come back after a long gap. Ask DuoDuo to turn it on for a conversation. The published smart-compaction skill reads the daemon's own compaction measurements, applies the break-even rule, and sets the thresholds for that one conversation unless you ask for a policy across a whole channel kind.

Inspect the intuition layer#

The kernel's memory/ tree has a mechanical, no-model check: duoduo memory check and its lints measure gaps and broken references, and can route a repair signal to the partition that owns the gap. The normal checks delete nothing. Ask DuoDuo to check the intuition layer; duoduo-runtime-admin runs the checks and starts any reclaim with a dry run, which you approve before anything is removed.

Prompt and intuition history#

The kernel is initialized as a Git repository, so every change to the intuition layer, dossiers, subconscious prompts, the playlist, and channel descriptors is a reviewable commit.

Package upgrades preserve existing subconscious prompts because they may have changed on this host. When a release ships revised defaults, ask DuoDuo to refresh them: duoduo-runtime-admin diffs the published partitions against the kernel, keeps partitions authored on this host, and commits a rollback point first. You approve the diff.