Docs v0.9.107

Layered Memory and Lossless Compact

TatsuCode v0.9.107 introduces a layered instruction architecture that gives you finer control over how the agent behaves across projects, sessions, and machines — plus a separate continuity layer that keeps long sessions coherent across compaction and restore.

Two related changes, one page.


Layered Memory: Three Instruction Tiers

Three durable instruction layers, applied in order from broadest to narrowest. Each layer is loaded into the system prompt deterministically, in the same position every turn — which keeps the prompt cache warm and predictable.

1. Global Instructions — ~/.tatsu/AGENTS.md

User-wide preferences that should follow you across every project on your machine.

Good content:

  • "I prefer terse responses with no trailing summaries."
  • "Use Newtonsoft.Json, not System.Text.Json."
  • "When writing tests, use xUnit."

Don't put project-specific rules here.

2. Project Instructions — AGENTS.md (and friends)

Shared rules that live in the repository and apply to anyone working in it. TatsuCode discovers and merges all of these:

  • AGENTS.md
  • CLAUDE.md
  • GEMINI.md
  • .cursorrules
  • .github/copilot-instructions.md

Run /init to generate or update AGENTS.md from your codebase.

Good content:

  • Build / test / lint commands
  • Architectural boundaries
  • Repo-specific conventions

3. Local Override — .agents/AGENTS.local.md

The new layer in v0.9.107. Repo-local rules that override global and project layers — but stay out of the shared committed file.

Good content:

  • "On this machine I'm using Bun instead of Node."
  • "Skip the Linux-specific build steps; I'm on Windows."
  • Experimental rules you're trying out before committing them to the team's AGENTS.md.
  • Personal annotations for working in someone else's repo.

This layer wins when there's a conflict, so use it carefully — it's a power tool, not a session log.

Layer Order, Visualized

[ Base system prompt ]
      ↓
[ Global instructions     ] ← ~/.tatsu/AGENTS.md
      ↓
[ Project instructions    ] ← AGENTS.md, CLAUDE.md, etc.
      ↓
[ Local override          ] ← .agents/AGENTS.local.md
      ↓
[ Session continuity      ] ← active session metadata
      ↓
[ Active skills / plugins ]
      ↓
[ Active model info       ]

Later layers can refine or override earlier ones.


Lossless Compact: Session Continuity Across Compaction

A separate continuity layer that keeps long conversations coherent — even after the transcript has been summarized.

What Compaction Actually Does

When a conversation gets long, TatsuCode compacts it to keep tokens in budget. Compaction is a turn-pair summarization pass — it walks the transcript and replaces older user/assistant turns with shorter recaps, while preserving things the agent will still need:

  • Tool calls and their structured results
  • Files referenced and their important contents
  • Key decisions and the current objective

The compacted transcript then continues forward in the same chat — you don't restart, you don't lose your place. That's the part most other agentic tools get wrong: they either truncate (losing context) or restart (losing state).

Where the New Continuity Layer Fits

Alongside the compacted transcript, TatsuCode now maintains a structured continuity layer in session metadata. Think of it as a small, stable summary of:

  • The current objective
  • A concise running summary worth carrying forward

This layer is updated on compaction and on session save. Crucially, it's separate from the chat transcript — it lives in the system prompt's session-continuity slot and survives compactions and full session restore. So when you reload a session a week later, the agent picks up not just the (compacted) transcript, but a clean summary of where things were heading.

What This Means in Practice

  • Long conversations stay coherent. After a compaction, the agent still knows what you're working on and why.
  • Closing TatsuCode and resuming the session later works the same way as continuing live.
  • Compaction is no longer a "fresh start with a paragraph of context" — the agent retains tool-call awareness and the project objective.
  • The continuity layer is small and stable, so it doesn't bloat your prompt or churn the cache.

What It Doesn't Do

To set expectations honestly:

  • It doesn't preserve every detail of every prior turn — that's what the compacted transcript is for, and compaction is still a summary.
  • It doesn't replace manual /compact if you want to compress aggressively before a context-heavy task.
  • It doesn't extend the model's context window — long enough conversations still need compaction.

The point is that compaction is no longer destructive to the purpose of the conversation, even if individual turn content gets summarized. That's a meaningful step up from how most agent tools handle long sessions today.


How /init Fits Into This

/init still creates and updates AGENTS.md — the project instructions layer. It does not touch the global or local override layers.

If you want global preferences, edit ~/.tatsu/AGENTS.md yourself. If you want a local override on this machine, edit .agents/AGENTS.local.md.

After /init updates project instructions, the active prompt refreshes the durable instruction layers in place — no new session needed.


Best Practices

  • Global — durable user preferences. Update infrequently.
  • Project — shared team rules. Update when conventions change. Use /init to keep it grounded in the actual code.
  • Local override — temporary or machine-specific. Use sparingly; it wins over the others.
  • Don't put live state into any of these. They're durable instruction layers. Tool execution state, in-flight files, and turn-by-turn details belong in the conversation itself.
  • Don't update continuity manually on every turn. It's maintained automatically at compaction and save boundaries — that's what keeps it stable and cache-friendly.

Next Steps

Type to search documentation

Use to navigate, Enter to select