You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,64 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
7
+
## [5.0.0] - 2026-04-20 — Portable Memory OS Release
8
+
9
+
Native Claude Code + Codex on one shared Dhee kernel. This release turns Dhee from "memory + router for one harness" into a portable memory OS with native harness install, host-parsed artifact reuse, continuity/handoff, shared-task collaboration, and signed export/import packs.
10
+
11
+
### Native harness layer
12
+
13
+
-`dhee install --harness all` configures both Claude Code and Codex against the same `~/.dhee` root.
14
+
- Claude Code remains hook-native for routing, memory updates, and context injection.
15
+
- Codex is now first-class through native config wiring plus incremental event-stream sync, so post-tool results and host-parsed artifacts become reusable Dhee context without manual re-sync.
16
+
-`dhee harness status|enable|disable` exposes install state and lets users turn either harness off cleanly from the CLI.
17
+
18
+
### Portable packs: `.dheemem` v1
19
+
20
+
- Added signed export/import packs with manifest validation.
21
+
- Packs now carry durable memories, vector nodes, artifact manifests, artifact extractions, artifact chunks, lineage/provenance rows, and a derived `handoff.json` bootstrap snapshot.
22
+
- Import supports `merge`, `replace`, and `dry-run`.
23
+
- Goal: a new machine or new harness can recover the same smart agent state without re-uploading files or rebuilding reusable context from scratch.
24
+
25
+
### Host-parsed artifact memory
26
+
27
+
- Dhee no longer claims ownership of OCR/LLM extraction for uploads in the hot path.
28
+
- Instead, the first successful host parse becomes the durable event: Claude Code `Read` results and Codex post-tool parse output can be stored as reusable artifact knowledge.
29
+
- Added first-class artifact storage:
30
+
-`artifact_assets`
31
+
-`artifact_bindings`
32
+
-`artifact_extractions`
33
+
-`artifact_chunks`
34
+
- Same artifact knowledge can now survive harness switches and portability import/export.
35
+
36
+
### Continuity and collaboration
37
+
38
+
- Added `thread_state` as the cheap continuity primitive for active work.
39
+
- Added `handoff.json` as a derived, structured bootstrap artifact inside `.dheemem`.
40
+
- Added shared-task collaboration so multiple agents on the same repo/task can reuse routed tool results and artifact knowledge instead of paying token cost repeatedly.
41
+
- Shared-task feeds are intentionally ephemeral: durable knowledge survives, transient tool-result chatter does not.
42
+
43
+
### Critical Surface Router v1
44
+
45
+
- Added the first routing-intelligence substrate that records whether information was:
46
+
- reflected back as digest + pointer
47
+
- refracted into durable memory
48
+
- absorbed as episodic/task-local signal
49
+
- transmitted raw
50
+
- Route decisions now track depth, semantic fit, structural fit, locality, confidence, and token delta.
51
+
- Initial coverage is live for routed `Read`/`Bash`/`Grep` and artifact parse/reuse flows.
52
+
53
+
### Years-of-memory substrate upgrades
54
+
55
+
- Added tiering, consolidation, and verification modules for engram facts/preferences.
56
+
- Introduced lineage/provenance read surfaces (`dhee why`, MCP `dhee_why`) so imported and artifact-derived knowledge stays inspectable.
57
+
- Removed the old `dheeModel/` package in favor of the in-tree training/evolution direction used by the current kernel.
58
+
59
+
### What I'm not claiming in this release
60
+
61
+
- Codex still does not expose Claude-style live pre-tool hooks; its native path is event-stream based and post-tool, not interceptive.
62
+
- The native harness story is real, but the architecture still has oversized composition-root files (`cli.py`, `mcp_server.py`, `sqlite.py`, `memory/main.py`) that need boundary cleanup in a follow-up pass.
63
+
- This release ships the portability substrate and collaboration bus; the fully public replay corpus and the broader decades-portability benchmark story remain separate benchmark work.
64
+
7
65
## [4.0.0] - 2026-04-18 — Context Router Release
8
66
9
67
Memory + token-saving router, one install. The router is now a first-class, in-tree feature with its own CLI surface, hooks, enforcement gate, and shareable savings report.
Copy file name to clipboardExpand all lines: README.md
+40-19Lines changed: 40 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,11 @@
4
4
5
5
<h1align="center">Dhee — Self-Evolving Memory & Context Router for AI Agents</h1>
6
6
7
-
<h3align="center">Cut LLM tokens by 90%. Perfect recall, even years in. Works with Claude Code, Cursor, Codex, Gemini CLI, Aider, Cline, and any MCP client.</h3>
7
+
<h3align="center">A measurable context router + self-evolving memory layer for AI agents. Works with Claude Code, Cursor, Codex, Gemini CLI, Aider, Cline, and any MCP client.</h3>
8
+
9
+
<palign="center"><sub>
10
+
Savings numbers are projections from router replay on real sessions (run <code>dhee router report</code> to reproduce on yours). A fully sanitized public replay corpus lands with the next release — until then, every "savings %" in this README is cited against the command that produced it, not a marketing slide.
11
+
</sub></p>
8
12
9
13
<palign="center">
10
14
Open-source agent memory layer and tool-output router for LLM apps.<br>
@@ -41,11 +45,11 @@
41
45
42
46
**Dhee is an open-source, self-evolving memory and context-router for LLM-powered AI agents.** It sits between your agent (Claude Code, Cursor, Codex, Gemini CLI, Aider, Cline, Goose, or any MCP-compatible client) and the model, and does three things so your CLAUDE.md, AGENTS.md, skills library, and tool output stop costing you tokens:
43
47
44
-
1.**Reduces tokens.** The agent only sees the slice of context it needs this turn. Your 2,000-line CLAUDE.md becomes ~300 tokens. A 10 MB tool-result becomes a 40-token digest with a pointer. Over a session, that's a 90%+ token reduction with zero information loss.
48
+
1.**Reduces tokens.** The agent only sees the slice of context it needs this turn. A fat CLAUDE.md is injected as heading-scoped chunks, not in full. A large tool-result is replaced with a digest + pointer; the model expands the pointer only when the digest isn't enough. The exact per-session savings are visible in `dhee router report` — it's your sessions, your numbers, not a marketing claim.
45
49
46
-
2.**Remembers everything — forever.** Doc chunks, session outcomes, failures, decisions, user preferences. Ebbinghaus decay pushes unused knowledge out of the hot path. Frequently-referenced memories are promoted. After five years you have 50,000 memories and the per-turn injection is still ~300 tokens.
50
+
2.**Remembers — and keeps doing so as the store grows.** Doc chunks, session outcomes, failures, decisions, user preferences. Tier-based retention is live: supersede chains with lineage, canonical write-once facts that never evict, reaffirmation-driven promotion (medium → high → canonical), and cold-archive forgetting of stale avoid-tier rows. Run `dhee why <memory_id>` to read the lineage of any fact.
47
51
48
-
3.**Self-evolves.**Dhee watches which memories the model actually expands, which digests are deep enough, which rules it ignores. It tunes its own retrieval depth per tool, per intent, per file type. No config file to hand-maintain. The longer you use it, the better it gets.
52
+
3.**Self-evolves — one product, one code path.**At the router layer, `dhee router tune` reads the expansion ledger and atomically rewrites `~/.dhee/router_policy.json`: deeper digests for classes the model keeps expanding, shallower for classes it never does. At the cognition layer, MetaBuddhi runs a full propose → assess → commit / rollback loop online with per-task-type group-relative confidence and a catastrophic-group guardrail that rolls back any strategy whose single-group regression crosses threshold even when the aggregate is positive. Nididhyasana gates training at session boundaries; a replay-based RL gate only promotes a candidate when it beats the incumbent by ≥ 0.02 on a held-out corpus. All native, no opt-in flag.
49
53
50
54
### Who it's for
51
55
@@ -63,15 +67,15 @@
63
67
curl -fsSL https://raw.githubusercontent.com/Sankhya-AI/Dhee/main/install.sh | sh
64
68
```
65
69
66
-
The installer creates `~/.dhee`, installs the `dhee` package, and auto-wires Claude Code hooks. Next time you open Claude Code in any project, cognition is on.
70
+
The installer creates `~/.dhee`, installs the `dhee` package, and configures Dhee as the native memory/router layer for both Claude Code and Codex. Both harnesses point at the same kernel, so memory, artifacts, shared-task results, and portability packs all compound in one place.
67
71
68
72
<details>
69
73
<summary><b>Other install options</b></summary>
70
74
71
75
**Via pip:**
72
76
```bash
73
77
pip install dhee
74
-
dhee install # configure Claude Code hooks
78
+
dhee install --harness all# configure Claude Code + Codex
@@ -89,7 +93,12 @@ docker compose up -d # uses OPENAI_API_KEY from env
89
93
```
90
94
</details>
91
95
92
-
After install, Dhee auto-ingests project docs (CLAUDE.md, AGENTS.md, SKILL.md, etc.) on the first session. Run `dhee ingest` manually any time to re-chunk.
96
+
After install:
97
+
- Claude Code uses native hooks for routing, memory updates, and shared-task context injection.
98
+
- Codex uses native `config.toml` + Dhee-managed instructions + incremental event-stream sync, so post-tool results and uploaded artifacts become shared reusable context without manual re-sync.
99
+
-`dhee harness status` shows the live state and `dhee harness disable --harness codex` turns a harness off cleanly.
100
+
101
+
Project docs (CLAUDE.md, AGENTS.md, SKILL.md, etc.) still auto-ingest on first use. Run `dhee ingest` manually any time to re-chunk.
93
102
94
103
---
95
104
@@ -167,7 +176,7 @@ And on the tool-use side, the **router** digests raw output at source — a 10 M
|**Self-evolving retrieval policy**|**Yes**| No | No | No | No | No |
173
182
|**Auto-digest tool output**|**Yes (router)**| No | No | No | No | No |
@@ -177,7 +186,9 @@ And on the tool-use side, the **router** digests raw output at source — a 10 M
177
186
|**External DB required**| No (SQLite) | No | Qdrant/pgvector | Postgres+vector | No | No |
178
187
|**License**| MIT | — | Apache-2 | Apache-2 | MIT | MIT |
179
188
180
-
Dhee is the only one that **reduces tokens *and* self-evolves its own retrieval policy *and* leads on recall.**
189
+
Dhee is the only one that **routes tool output at source *and* self-evolves its retrieval policy from an expansion ledger *and* leads on LongMemEval recall.**
190
+
191
+
<sub>¹ Run `dhee router report` to see the actual per-turn token curve on your sessions. The replay corpus is already built from your real activity — `dhee replay-corpus export` derives it from the durable samskara log, no synthetic data. A redacted public corpus with reproducible numbers lands in the next release.</sub>
181
192
182
193
---
183
194
@@ -209,7 +220,7 @@ Dhee turns that library into searchable, decay-aware, self-promoting memory:
|**Prospective**|`"Remember to run auth tests after login.py changes"` fires when the trigger matches — days, weeks, or months later. |
211
222
212
-
**Result:** after a year, you have 50 doc files, 10,000 memories, and 200 insights. The per-turn injection is still ~300 tokens of the *right* stuff. The 500-line CLAUDE.md your team grew into is an asset, not a liability.
223
+
**Target shape:** after a year of accumulation the per-turn injection stays bounded by token budget — *only* the matching slice of docs, insights, and policies above threshold reaches the model. The full canonical-tier retention guarantee (100% canonical survival across supersede chains on a decades-replay corpus) lands with movements 2–3 of the public plan. The substrate (propositional facts, supersede-ready schema, decay/promotion) ships today.
|**Typical 20-turn Opus session**|**1**|**~$0.004**|
254
265
255
-
Dheeoverhead: ~$0.004 per session. Token savings on a 20-turn Opus session: **~$0.50+**. That's a **>100× ROI**.
266
+
Dhee's own LLM overhead is ~$0.004 per session (one checkpoint call per ~10 memories). Token savings per session depend entirely on your tool-output footprint — `dhee router report` prints the delta for your real sessions.
256
267
257
268
### The router — digest at source
258
269
@@ -265,7 +276,7 @@ Four MCP tools replace `Read`/`Bash`/`Agent` on heavy calls:
265
276
-`mcp__dhee__dhee_agent(text)` — digests any long subagent return: file refs, headings, bullets, error signals, head/tail.
266
277
-`mcp__dhee__dhee_expand_result(ptr)` — only called when the digest genuinely isn't enough. Raw re-enters context on demand.
267
278
268
-
A 10 MB `git log --oneline -50000` becomes a ~200-token digest. Nothing else gets into context. This is where the serious savings live.
279
+
A huge `git log --oneline` becomes a short digest + pointer. Raw content is stored in the pointer store and only re-enters the context window when the model calls `dhee_expand_result(ptr)`. `dhee router report` shows the exact per-tool byte/token delta on your sessions.
269
280
270
281
### The cognition engine
271
282
@@ -286,11 +297,21 @@ Parallel intelligence layer — zero LLM calls on the hot path.
286
297
287
298
```bash
288
299
pip install dhee
289
-
dhee install # installs lifecycle hooks
300
+
dhee install --harness all
290
301
dhee ingest # chunks project docs into memory
291
302
```
292
303
293
-
Six hooks fire at the right moments. No SKILL.md, no plugin directory. The agent doesn't even know Dhee is there — it just gets better context.
304
+
Claude gets native lifecycle hooks, router enforcement, and shared-task context injection. No SKILL.md, no plugin directory, no manual `settings.json` editing.
305
+
306
+
### Codex — Native Config + Stream Sync
307
+
308
+
```bash
309
+
pip install dhee
310
+
dhee install --harness all
311
+
dhee harness status
312
+
```
313
+
314
+
Codex is wired natively through `~/.codex/config.toml` and a Dhee-managed instructions file. Dhee tails Codex's persisted event stream incrementally, so post-tool results, shared-task work, and host-parsed artifacts become reusable context without a manual sync step.
294
315
295
316
### MCP Server (Claude Code, Cursor, Codex, Gemini CLI, Cline, Goose, any MCP client)
296
317
@@ -338,13 +359,13 @@ Large AI-agent projects accumulate a fat `CLAUDE.md`, `AGENTS.md`, skills librar
338
359
Dhee is the only agent memory layer that (a) leads on the [LongMemEval](https://github.com/xiaowu0162/LongMemEval) retrieval benchmark at R@5 99.4% on the full 500-question set, (b) self-evolves its retrieval policy per tool and per intent, and (c) ships a **context router** that digests `Read`, `Bash`, and subagent output at source instead of dumping raw into context. See the [comparison table](#vs-alternatives).
339
360
340
361
### Does Dhee work with Claude Code, Cursor, Codex, Gemini CLI, or Aider?
341
-
Yes. Dhee ships native Claude Code hooks, an MCP server that plugs into Cursor, Codex, Gemini CLI, Cline, Goose, and any MCP client, plus a Python SDK and CLI. One install, every host.
362
+
Yes. Dhee now has first-class native integrations for Claude Code and Codex on one shared kernel. It also exposes an MCP server for Cursor, Gemini CLI, Cline, Goose, and other MCP clients.
342
363
343
364
### How does Dhee reduce Claude Code token usage?
344
-
Two ways: (1) it replaces a 500-line`CLAUDE.md` that normally re-loads every turn with a vector-indexed memory that injects only matching rules (~240 tokens instead of 5,700); (2) its router wraps `Read` and `Bash` so a 10 MB `git log`becomes a ~40-token digest with a pointer — raw content only re-enters context if the model explicitly expands the pointer.
365
+
Two ways: (1) it replaces a large`CLAUDE.md` that normally re-loads every turn with a heading-scoped, vector-indexed memory that injects only matching rules above threshold; (2) its router wraps `Read`/`Bash`/`Agent` so heavy tool output becomes a digest with a pointer — raw content only re-enters context if the model explicitly calls `dhee_expand_result(ptr)`. Exact per-turn savings on your own sessions are printed by `dhee router report`.
345
366
346
367
### Is Dhee production-ready? What storage does it use?
347
-
Dhee runs on SQLite by default — no Postgres, no Qdrant, no pgvector, no extra infra. It has 1000+ tests, reproducible benchmarks in-tree, an MIT license, and works offline with Ollama embeddings or online with OpenAI, NVIDIA NIM, or Gemini.
368
+
Dhee runs on SQLite by default — no Postgres, no Qdrant, no pgvector, no extra infra. It ships 1,170+ tests, reproducible benchmarks in-tree, an MIT license, and works offline with Ollama embeddings or online with OpenAI, NVIDIA NIM, or Gemini.
348
369
349
370
### How does Dhee's self-evolution actually work?
350
371
Every time the model calls `dhee_expand_result(ptr)` to see the raw output behind a digest, Dhee logs (tool, intent, depth). `dhee router tune` reads that ledger and atomically rewrites `~/.dhee/router_policy.json` — deeper digests for file types the model keeps expanding, shallower ones it never does. No config to hand-maintain. The longer you use it, the better it fits your workflow.
Benchmarks are reproducible from [`benchmarks/longmemeval/`](benchmarks/longmemeval/). Any improvement to R@k with full per-question output is welcome.
0 commit comments