日本語 | 中文 | Español | Français | हिन्दी | Italiano | Português (BR)
Store what changed.
Active context compaction for AI agents. Typed deltas, structured state, provenance, and working-set budgeting for long-running conversations.
Chat transcripts are terrible working memory. They mix settled facts, tentative ideas, tool noise, repeated explanations, and changed plans into one growing noodle. As conversations grow, agents become senile — forgetting early constraints while clinging to stale plans.
Summaries smear. They flatten nuance, destroy provenance, and merge speculation with settled truth. You can't ask a summary "what did we decide about X and why?"
Don't store the conversation. Store what the conversation changed.
DeltaMind replaces transcript-as-memory with state-as-memory. Instead of summarizing history, it emits typed deltas — decisions made, constraints added, tasks opened, hypotheses introduced — and reconciles them into a structured, queryable state.
A 500-turn session should feel clearer at turn 500 than at turn 50.
Transcript turns → Event gate → Delta extractor → Normalizer → Reconciler → State ↑ LLM (gemma2:9b) ↓ ↑ Rule-based ┌────────┴────────┐ ↓ ↓ exportContext() save()/load() ↓ ↓ ai-loadout adapter PROVENANCE.jsonl ↓ snapshot.json claude-memories *.md projections ↓ advisory suggestions Three representations, single job each:
| Representation | Purpose | Format |
|---|---|---|
| Event log | What happened | PROVENANCE.jsonl (append-only) |
| State snapshot | Current truth | snapshot.json (versioned) |
| Markdown projections | Human inspection | *.md (generated, never authoritative) |
| Package | Description |
|---|---|
@deltamind/core | Typed deltas, state model, reconciliation, extraction, persistence, adapters |
@deltamind/cli | Operator CLI — inspect, export, replay, debug sessions |
import { createSession } from "@deltamind/core"; const session = createSession({ forceRuleOnly: true }); session.ingestBatch([ { turnId: "t-1", role: "user", content: "Build a REST API. Use TypeScript." }, { turnId: "t-2", role: "assistant", content: "I'll set up Express with TypeScript." }, { turnId: "t-3", role: "user", content: "Actually, switch to Fastify." }, ]); await session.process(); // What's in state? const stats = session.stats(); // → { totalItems: 5, activeDecisions: 1, openTasks: 1, ... } // Export budgeted context for injection const ctx = session.exportContext({ maxChars: 2000 }); // → Structured text: constraints, decisions, goals, tasks, recent changes // Save and resume later const snapshot = session.save();deltamind inspect # Active state grouped by kind deltamind changed --since 5 # What changed since seq 5 deltamind explain item-3 # Deep-dive: fields, provenance, revision chain deltamind export --for ai-loadout # Session layer for ai-loadout deltamind replay --type accepted # Walk provenance log deltamind suggest-memory # Advisory claude-memories updates deltamind save # Persist to .deltamind/ deltamind resume # Load session, show health summaryDeltaMind tracks 11 typed state changes:
| Delta | What it captures |
|---|---|
goal_set | What the session is trying to achieve |
decision_made | A settled choice |
decision_revised | A change to a prior decision |
constraint_added | A rule or boundary |
constraint_revised | A relaxation, tightening, or amendment |
task_opened | Work to be done |
task_closed | Work completed or abandoned |
fact_learned | A stable piece of knowledge |
hypothesis_introduced | A tentative idea (not a decision) |
branch_created | Unresolved alternatives |
item_superseded | Something replaced by something newer |
Hybrid by design. Two extractors with complementary strengths:
- Rule-based: Fast, precise, zero-cost. Catches explicit patterns ("we decided", "must not", "task: ..."). 100% precision, lower recall.
- LLM-backed (gemma2:9b via Ollama): Catches semantic items (goals, high-level decisions) that regex misses. 100% precision on safe models, higher recall on backbone deltas.
Both compute semantic IDs — FNV-1a hashes of canonicalized content. Equivalent meaning converges regardless of extraction path.
- Zero canonization: Hedged language ("maybe Redis?") never becomes a decision
- Advisory boundary: Memory suggestions exclude hypotheses and branch-tagged items
- Type-scoped revision: Decisions can only revise decisions, constraints only revise constraints
- Rejection over corruption: Invalid deltas are rejected, never silently absorbed
- Provenance required: Every accepted delta traces to source turns
| Transcript length | Context vs raw | Items growth |
|---|---|---|
| Short (9-14 turns) | 18-62% of raw | ~linear |
| Long (56-62 turns) | 12-24% of raw | sublinear (2.9x items for 5x turns) |
The longer the session, the more DeltaMind earns its keep. Query score: 6/6 across all fixture classes.
Phases 1–5C complete. 229 tests (192 core + 37 CLI).
- Phase 1: Schema, reconciler, invariants, harness, economics
- Phase 2: Rule-based extractor, LLM extractor, hybrid pipeline, model sweep, revision ontology
- Phase 3: Session runtime, persistence layer
- Phase 4: ai-loadout adapter, claude-memories adapter, dogfood harness
- Phase 5: LLM default runtime, semantic identity, operator CLI
MIT
Built by MCP Tool Shop
