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: README.md
+57-3Lines changed: 57 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,11 @@ With CogniLayer, it already knows. Three things your agent doesn't have today:
10
10
11
11
🔍 **Code intelligence** — who calls what, what depends on what, what breaks if you rename a function. Tree-sitter AST parsing across 10+ languages, not grep
12
12
13
-
⚡**80-100K tokens saved per session** — 3 semantic queries replace 15 file reads. Your agent works faster because it already knows your codebase
13
+
🤖**Subagent context compression** — research subagents write findings to DB instead of dumping 40K+ tokens into parent context. Parent gets a 500-token summary + on-demand `memory_search` retrieval
⚡ **80-200K+ tokens saved per session** — semantic search replaces file reads, subagent findings go to DB instead of context. Longer sessions with subagents save more
Without CogniLayer, the subagent returns a 40K-token dump into parent context:
142
+
143
+
```
144
+
Parent (200K context):
145
+
→ spawn subagent: "Research community MCP servers"
146
+
← subagent returns: 40K tokens about 15 projects
147
+
→ all 40K crammed into parent context
148
+
→ remaining: 160K → next subagent → 120K → next → 80K...
149
+
```
150
+
151
+
With CogniLayer's Subagent Memory Protocol:
152
+
153
+
```
154
+
Parent (200K context):
155
+
→ spawn subagent: "Research MCP servers, save to memory"
156
+
← subagent writes details to DB, returns: "Saved 3 facts,
157
+
search 'MCP server ecosystem'. Summary: Python dominates,
158
+
FastMCP most popular, 3 architectural patterns."
159
+
→ parent context: ~500 tokens
160
+
→ need details? memory_search("MCP server ecosystem") → targeted pull
161
+
```
162
+
163
+
40K tokens compressed to 500. The findings persist in DB across sessions — not just for this conversation, but forever.
164
+
137
165
---
138
166
139
167
## Killer Features
@@ -143,7 +171,8 @@ Zero re-explanation. Claude picks up exactly where it left off, **including the
143
171
|**Code Intelligence**|`code_context` shows who calls what. `code_impact` maps blast radius before you touch anything. Powered by tree-sitter AST parsing |
144
172
|**Semantic Search**| Hybrid FTS5 + vector search finds the right fact even with different wording. Sub-millisecond response |
145
173
|**17 MCP Tools**| Memory, code analysis, safety, project context — Claude uses them automatically, no commands needed |
|**Subagent Protocol**| Research subagents save findings to DB instead of flooding parent context. 40K → 500 tokens per subagent task |
147
176
|**Crash Recovery**| Session dies? Next one auto-recovers from the change log. Works across both agents |
148
177
|**Cross-Project Knowledge**| Solved a CORS issue in project A? Search it from project B. Your experience compounds |
149
178
|**14 Fact Types**| Not dumb notes — error_fix, gotcha, api_contract, decision, pattern, procedure, and more |
@@ -470,6 +499,31 @@ Powered by [tree-sitter](https://tree-sitter.github.io/) AST parsing with langua
470
499
471
500
Indexing runs with a configurable time budget (default 30s). Partial results are usable immediately. Unresolved references are re-resolved on the next incremental run.
472
501
502
+
## Subagent Memory Protocol
503
+
504
+
When Claude spawns research subagents, the raw findings can be 40K+ tokens. Without the protocol, all of that goes into the parent's context window. The Subagent Memory Protocol uses the CogniLayer database as a side channel:
505
+
506
+
```
507
+
Subagent Parent
508
+
│ │
509
+
├── research (WebSearch, Read...) │
510
+
├── synthesize findings │
511
+
├── memory_write(consolidated facts) │ ← data goes to DB, not context
512
+
└── return: 500-token summary ────────┤ ← only summary enters context
513
+
│
514
+
memory_search() ──┤ ← parent pulls details on demand
515
+
```
516
+
517
+
Key design decisions:
518
+
- **Synthesis over granularity** — subagents group related findings into cohesive facts, not one-per-discovery
519
+
- **Task-specific tags** — each subagent gets a unique tag (e.g. `tags="subagent,auth-review"`) for filtering via `memory_search(tags="auth-review")`
520
+
- **Keywords inside facts** — each fact ends with `Search: keyword1, keyword2` so retrieval works even after context compaction
521
+
- **Write-last pattern** — all `memory_write` calls happen as the last step before return, saving subagent turns and tokens
522
+
- **Foreground-first** — subagents launch as foreground (reliable MCP access), user can Ctrl+B to background
523
+
- **Graceful fallback** — if MCP tools are unavailable, findings go directly in return text
524
+
525
+
The protocol is injected into CLAUDE.md automatically and requires no user configuration.
526
+
473
527
## Codex CLI Integration
474
528
475
529
Codex CLI has no hook system, so CogniLayer adapts:
0 commit comments