activeloopai / activeloopai/hivemind

Propagate the 3-tier memory explanation from CC/Codex to Cursor/Hermes/Pi inject blobs

Offen
#101 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
1.6k
Forks
107
Ø Merge
17 Std. 30 Min.
Gemergte PRs (30 T.)
6

Beschreibung

## 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).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.