Skip to content

Commit 5bcea92

Browse files
committed
V2.2.0
1 parent 8b764da commit 5bcea92

15 files changed

Lines changed: 4668 additions & 3206 deletions

README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<h3 align="center">The cognition layer that turns your agent into a HyperAgent.</h3>
88

99
<p align="center">
10-
4 tools. 1 LLM call per session. ~$0.004 total cost.<br>
10+
4-operation API. Deferred enrichment. Minimal hot-path cost.<br>
1111
Your agent remembers, learns from outcomes, and predicts what you need next.
1212
</p>
1313

@@ -33,9 +33,17 @@ Most memory layers are glorified vector stores. Store text, retrieve text. Your
3333

3434
### Benchmark: LongMemEval
3535

36-
Dhee achieves near-perfect retrieval on [LongMemEval](https://arxiv.org/abs/2410.10813), the standard benchmark for long-term conversational memory — temporal reasoning, multi-session aggregation, knowledge updates, and counterfactual tracking across 500+ questions.
36+
Dhee is being evaluated on [LongMemEval](https://arxiv.org/abs/2410.10813), the standard benchmark for long-term conversational memory — temporal reasoning, multi-session aggregation, knowledge updates, and counterfactual tracking across 500+ questions. Preliminary results are promising.
3737

38-
> Evaluation run in progress. Full results and methodology will be published in the benchmark report.
38+
> Full methodology and results will be published in the benchmark report.
39+
40+
---
41+
42+
## Status
43+
44+
Dhee is **experimental software under active development**. The core 4-operation API (`remember`/`recall`/`context`/`checkpoint`) is stable. Advanced subsystems (belief tracking, policy extraction, episodic indexing) are functional but evolving.
45+
46+
Use it. Build on it. But know that internals will change.
3947

4048
---
4149

@@ -93,7 +101,7 @@ Every interface — MCP, Python, CLI, JS — exposes the same 4 operations.
93101
### `remember(content)`
94102
Store a fact, preference, or observation.
95103

96-
**Hot path**: 0 LLM calls, 1 embedding (~$0.0002). The memory is stored immediately. Echo enrichment (paraphrases, keywords, question-forms that make future recall dramatically better) is deferred to `checkpoint`.
104+
**Hot path**: 0 LLM calls, 1 embedding (~$0.0002 typical). The memory is stored immediately. Echo enrichment (paraphrases, keywords, question-forms that make future recall dramatically better) is deferred to `checkpoint`.
97105

98106
```python
99107
d.remember("User prefers FastAPI over Flask")
@@ -103,7 +111,7 @@ d.remember("Project uses PostgreSQL 15 with pgvector")
103111
### `recall(query)`
104112
Search memory. Returns top-K results ranked by relevance.
105113

106-
**Hot path**: 0 LLM calls, 1 embedding (~$0.0002). Pure vector search with echo-boosted re-ranking.
114+
**Hot path**: 0 LLM calls, 1 embedding (~$0.0002 typical). Pure vector search with echo-boosted re-ranking.
107115

108116
```python
109117
results = d.recall("what database does the project use?")
@@ -161,6 +169,8 @@ d.checkpoint(
161169
| `checkpoint` | 1 per ~10 memories | 0 | ~$0.001 |
162170
| **Typical session** | **1** | **~15** | **~$0.004** |
163171

172+
> Costs assume OpenAI `text-embedding-3-small` at current pricing. Actual costs vary by provider, model, and configuration.
173+
164174
---
165175

166176
## How It Works (Under the Hood)
@@ -178,7 +188,7 @@ Stores memories in SQLite + a vector index. On the hot path (`remember`/`recall`
178188

179189
All of this happens in **1 LLM call per ~10 memories**. Not 4 calls per memory. One batched call.
180190

181-
Memory decays naturally (Ebbinghaus curve). Frequently accessed memories get promoted from short-term to long-term. Unused ones fade. ~45% less storage than systems that keep everything forever.
191+
Memory decays naturally (Ebbinghaus curve). Frequently accessed memories get promoted from short-term to long-term. Unused ones fade. Storage naturally reduces over time as unused memories decay, unlike systems that keep everything indefinitely.
182192

183193
### Cognition Engine — Buddhi
184194

@@ -193,6 +203,17 @@ Zero LLM calls on the hot path. Pure pattern matching + statistics. Persistence
193203

194204
Inspired by [Meta's DGM-Hyperagents](https://arxiv.org/abs/2603.19461) — agents that emergently develop persistent memory and performance tracking achieve self-accelerating improvement that transfers across domains. Dhee provides these capabilities as infrastructure.
195205

206+
#### Experimental Extensions
207+
208+
Beyond the core cognition engine, Dhee includes experimental subsystems that are functional but still evolving:
209+
210+
- **Belief store** — confidence-tracked facts with Bayesian updates and contradiction detection
211+
- **Policy store** — outcome-linked condition→action rules extracted from task completions
212+
- **Episodic indexing** — structured event extraction for temporal and aggregation queries
213+
- **Contrastive pairs & heuristic distillation** — learning from what worked vs. what failed
214+
215+
These are surfaced through `context()` and `checkpoint()` automatically when enabled.
216+
196217
---
197218

198219
## Architecture
@@ -245,7 +266,7 @@ m.think("complex question requiring reasoning across memories")
245266
```bash
246267
pip install dhee[openai,mcp] # OpenAI (recommended, cheapest embeddings)
247268
pip install dhee[gemini,mcp] # Google Gemini
248-
pip install dhee[ollama,mcp] # Ollama (local, zero cost)
269+
pip install dhee[ollama,mcp] # Ollama (local inference, no API costs)
249270
```
250271

251272
---
@@ -262,7 +283,7 @@ pytest
262283
---
263284

264285
<p align="center">
265-
<b>4 tools. 1 LLM call. Your agent remembers, learns, and predicts.</b>
286+
<b>4 operations. Deferred enrichment. Your agent remembers, learns, and predicts.</b>
266287
<br><br>
267288
<a href="https://github.com/Sankhya-AI/Dhee">GitHub</a> &middot;
268289
<a href="https://pypi.org/project/dhee">PyPI</a> &middot;

dhee/__init__.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828
from dhee.core.category import CategoryProcessor, Category, CategoryType, CategoryMatch
2929
from dhee.core.echo import EchoProcessor, EchoDepth, EchoResult
3030
from dhee.configs.base import MemoryConfig, FadeMemConfig, EchoMemConfig, CategoryMemConfig, ScopeConfig
31+
from dhee.core.belief import BeliefNode, BeliefStore, BeliefStatus
32+
from dhee.core.policy import PolicyCase, PolicyStore, PolicyStatus
33+
from dhee.core.task_state import TaskState, TaskStateStore, TaskStatus
34+
from dhee.core.episode import Episode, EpisodeStore, EpisodeStatus
35+
from dhee.core.trigger import TriggerManager, TriggerResult, TriggerContext
3136

3237
# Default: CoreMemory (lightest, zero-config)
3338
Memory = CoreMemory
3439

35-
__version__ = "2.1.0"
40+
__version__ = "2.2.0b1"
3641
__all__ = [
3742
# Tiered memory classes
3843
"CoreMemory",
@@ -59,6 +64,22 @@
5964
"EchoMemConfig",
6065
"CategoryMemConfig",
6166
"ScopeConfig",
67+
# Cognitive subsystems
68+
"BeliefNode",
69+
"BeliefStore",
70+
"BeliefStatus",
71+
"PolicyCase",
72+
"PolicyStore",
73+
"PolicyStatus",
74+
"TaskState",
75+
"TaskStateStore",
76+
"TaskStatus",
77+
"Episode",
78+
"EpisodeStore",
79+
"EpisodeStatus",
80+
"TriggerManager",
81+
"TriggerResult",
82+
"TriggerContext",
6283
]
6384

6485

dhee/core/__init__.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,71 @@
44
from dhee.core.fusion import fuse_memories
55
from dhee.core.retrieval import composite_score
66
from dhee.core.category import CategoryProcessor, Category, CategoryMatch, CategoryType
7+
from dhee.core.belief import BeliefNode, BeliefStore, BeliefStatus, Evidence, BeliefRevision
8+
from dhee.core.policy import PolicyCase, PolicyStore, PolicyStatus, PolicyCondition, PolicyAction
9+
from dhee.core.task_state import TaskState, TaskStateStore, TaskStatus, TaskStep, Blocker
10+
from dhee.core.episode import Episode, EpisodeStore, EpisodeStatus, EpisodeEvent
11+
from dhee.core.trigger import (
12+
TriggerManager,
13+
KeywordTrigger,
14+
TimeTrigger,
15+
EventTrigger,
16+
CompositeTrigger,
17+
SequenceTrigger,
18+
TriggerResult,
19+
TriggerContext,
20+
)
721

822
__all__ = [
23+
# Decay
924
"calculate_decayed_strength",
1025
"should_forget",
1126
"should_promote",
27+
# Conflict
1228
"resolve_conflict",
29+
# Echo
1330
"EchoProcessor",
1431
"EchoDepth",
1532
"EchoResult",
33+
# Fusion
1634
"fuse_memories",
35+
# Retrieval
1736
"composite_score",
37+
# Category
1838
"CategoryProcessor",
1939
"Category",
2040
"CategoryMatch",
2141
"CategoryType",
42+
# Belief
43+
"BeliefNode",
44+
"BeliefStore",
45+
"BeliefStatus",
46+
"Evidence",
47+
"BeliefRevision",
48+
# Policy
49+
"PolicyCase",
50+
"PolicyStore",
51+
"PolicyStatus",
52+
"PolicyCondition",
53+
"PolicyAction",
54+
# Task State
55+
"TaskState",
56+
"TaskStateStore",
57+
"TaskStatus",
58+
"TaskStep",
59+
"Blocker",
60+
# Episode
61+
"Episode",
62+
"EpisodeStore",
63+
"EpisodeStatus",
64+
"EpisodeEvent",
65+
# Trigger
66+
"TriggerManager",
67+
"KeywordTrigger",
68+
"TimeTrigger",
69+
"EventTrigger",
70+
"CompositeTrigger",
71+
"SequenceTrigger",
72+
"TriggerResult",
73+
"TriggerContext",
2274
]

dhee/core/buddhi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ def get_hyper_context(
352352
Called at session start or when context is needed. Returns
353353
everything: performance, insights, skills, intentions, warnings.
354354
"""
355-
# 1. Last session
355+
# 1. Last session (via kernel handoff, not memory object)
356356
last_session = None
357-
if memory and hasattr(memory, "get_last_session_digest"):
358-
try:
359-
last_session = memory.get_last_session_digest(user_id=user_id)
360-
except Exception:
361-
pass
357+
try:
358+
from dhee.core.kernel import get_last_session
359+
last_session = get_last_session()
360+
except Exception:
361+
pass
362362

363363
# 2. Performance snapshots for relevant task types
364364
performance = self._get_performance_snapshots(user_id, task_description)

0 commit comments

Comments
 (0)