Repository navigation
Description
Summary
Add a prompt-ready hierarchical summary layer that lets Cortex compress large memory neighborhoods into progressively smaller, provenance-preserving summaries for recall-time use.
Why
The current Cortex/OpenClaw path is strong at retrieval, provenance, and fact infrastructure, but it still relies heavily on injecting raw memories or top-N results. The next quality/cost step is to let Cortex hand the agent a compact summary tree when the raw set is too large for the prompt budget.
This is inspired by the pattern seen in ByteRover-style context trees, but the implementation should stay fully local-first and native to Cortex.
Desired outcome
When a query hits a large or diffuse memory neighborhood, Cortex should be able to return:
- a high-level summary node
- optional mid-level project/file/section summaries
- exact provenance pointers back to underlying source memories/facts
The agent should be able to expand from the summary back into the raw material when needed.
Proposed scope
- Build or derive hierarchical summaries over existing Cortex memory/project/file/section structure
- Preserve provenance to underlying source ids/paths/lines where possible
- Support summary selection as a lower-cost alternative to injecting many raw items
- Keep the implementation compatible with local SQLite-backed storage and existing hybrid retrieval
Acceptance criteria
- Cortex can generate/store hierarchical summaries for at least one real recall surface (project/file/section or equivalent)
- Summary records preserve links to underlying memories/facts/provenance
- Recall can prefer summary nodes when the raw candidate set would exceed a prompt budget
- A follow-up expansion path exists from summary -> underlying raw memories
- Tests cover both compression quality and provenance preservation
Implementation hints
Relevant current surfaces:
internal/ingest/markdown.goalready builds hierarchical section pathsinternal/extract/extract.gointentionally preserves structured markdown / section information- OpenClaw recall currently happens through
plugin/index.tsonbefore_agent_start
Out of scope
- Cloud-hosted context trees
- Any vendor lock-in or remote dependency
- Replacing raw retrieval entirely
Activity
hurttlocker commentedon Mar 11, 2026
Q explicitly approved moving straight into #318-lite after #324 merge.
This is not full #318 yet. Keep it to the bounded lite slice only:
Still out of scope:
Planned sequence after this:
feat(plugin): add bounded #318-lite grouped recall packing
feat(plugin): add bounded #318-lite grouped recall packing (#325)
hurttlocker commentedon Mar 11, 2026
Release-board hygiene note: