activeloopai / activeloopai/hivemind
Propagate the 3-tier memory explanation from CC/Codex to Cursor/Hermes/Pi inject blobs
- Lingua principale
- TypeScript
- Stelle
- 1.6k
- Fork
- 107
- Merge medio
- 17h 30m
- PR unite (30g)
- 6
Descrizione
## Summary
The SessionStart inject blob in CC (`src/hooks/session-start.ts`) and Codex (`src/hooks/codex/session-start.ts`) includes a detailed "Deeplake memory has THREE tiers" section that tells the agent *when* to use each tier. The same blob in Cursor (`src/hooks/cursor/session-start.ts`), Hermes (`src/hooks/hermes/session-start.ts`), and Pi (`pi/extension-source/hivemind.ts` -> `CONTEXT_PREAMBLE`) collapses this to a one-liner. As a result, agents on the three short-form runtimes lose the time-based vs keyword-based vs raw-fallback decision tree and tend to default to grep on `~/.deeplake/memory/summaries/` even when `~/.deeplake/memory/index.md` would be the better starting point.
## Long-form (CC + Codex today)
```
Deeplake memory has THREE tiers - pick the right one for the question:
1. ~/.deeplake/memory/index.md - auto-generated index, top 50 most-recently-updated entries with Created + Last Updated + Project + Description columns. ~5 KB. **For "what's recent / who did X this week / since " queries, START HERE** and trust the Last Updated column over any "Started:" line in summary bodies.
2. ~/.deeplake/memory/summaries/ - condensed wiki summaries per session (~3 KB each). For keyword/topic recall, search these.
3. ~/.deeplake/memory/sessions/ - raw full-dialogue JSONL (~5 KB each). FALLBACK only - use when summaries don't contain the exact quote/turn you need.
Search workflow:
- Time-based ("last week", "today", "since X"): cat ~/.deeplake/memory/index.md and read the most-recent rows.
- Keyword/topic recall: grep -r "keyword" ~/.deeplake/memory/summaries/
- Raw transcript fallback only: grep -r "keyword" ~/.deeplake/memory/sessions/ (use sparingly - JSONL is verbose).
```
## Short-form (Cursor / Hermes / Pi today)
```
Structure: index.md (start here) -> summaries/*.md -> sessions/*.jsonl (last resort). Do NOT jump straight to JSONL.
```
The short version says the hierarchy exists but never explains *when* to choose which tier.
## Concrete behavioural impact
User question: "what did the team do last week?"
- **CC / Codex agent**: reads `index.md`, scans `Last Updated` column for entries within the last 7 days, returns those rows directly. ~1 SQL query equivalent.
- **Cursor / Hermes / Pi agent today**: defaults to `grep -r "last week" ~/.deeplake/memory/summaries/` - substring match on the literal phrase, returns essentially nothing useful (no summary literally contains "last week"). Often falls through to grepping JSONL. Result: more noise, worse answer, more roundtrips.
This was discovered while reviewing skilify discoverability parity in PR #98 - the inject blob differences between agents were audited and the 3-tier verbosity gap was the most concrete case where one agent demonstrably gives the agent strictly less guidance than another.
## Proposed fix
Replace the one-liner in the three short-form blobs with the long-form 3-tier explanation. Concretely:
- `src/hooks/cursor/session-start.ts` - replace the `Structure: index.md ...` line with the long-form 3-tier section + "Search workflow" sub-bullets
- `src/hooks/hermes/session-start.ts` - same
- `pi/extension-source/hivemind.ts` - same in `CONTEXT_PREAMBLE` (Pi already has the registered hivemind tools section; the 3-tier section complements it, since the bash fallback path still exists)
## Cost vs benefit
- ~10 extra lines per agent, 3 agents = ~30 line diff
- ~600 extra tokens per session in the inject text on Cursor / Hermes / Pi (one-time per session, not per turn)
- Benefit: agent guidance parity for the most common query pattern (time-based recall)
- No code change beyond the inject string; no new tests beyond extending `claude-code/tests/skilify-session-start-injection.test.ts` to assert the 3-tier section is present in all five hook-driven surfaces
## Acceptance criteria
- All five hook-driven session-start surfaces (CC, Codex, Cursor, Hermes, Pi) contain the same 3-tier explanation block + the same "Search workflow" sub-bullets
- Bundle-scan test asserts the 3-tier text is present in each shipped bundle (or raw .ts for Pi)
- OpenClaw is intentionally out of scope: its surface is `openclaw/skills/SKILL.md` which is plugin-namespaced and the agent reads it through a different ClawHub mechanism - separate concern
## Context
Surfaced during PR #98 reviews while consolidating per-agent inject blobs to bare `hivemind ` form. Sister issue to #100 (OpenClaw skilify spawn deduplication).
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.