-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Summary
Add manifest-driven, budget-aware recall injection for the OpenClaw plugin so Cortex can choose the best mix of raw memories, summaries, and other compact cues under a hard prompt budget.
Why
Today the OpenClaw plugin auto-recall path is mostly "search -> dedupe -> inject top N". That works, but it is not explicitly budget-aware. Once summary packing exists, Cortex should decide what kind of context to inject based on a budget manifest rather than just raw ranking.
This is the part of the ByteRover pattern worth stealing: budget-aware context packing, not the cloud/service dependency model.
Desired outcome
Before before_agent_start injects context, the plugin should be able to build a small manifest like:
- budget class / token cap
- direct memories selected
- summary nodes selected
- ghost/archive cues selected
- items dropped due to budget pressure
This should make recall more deterministic, observable, and cheaper.
Proposed scope
- Introduce a recall manifest / packing plan step before context injection
- Let the plugin choose among raw memories vs compressed summary artifacts under a budget cap
- Make the selection deterministic and testable
- Expose the behavior through plugin config + docs
Acceptance criteria
- Plugin supports a configurable recall budget/cap or budget class
-
before_agent_startbuilds a manifest before injection - Manifest can mix multiple context artifact types (raw + summary, later ghost cues)
- Injected context stays under the target budget with deterministic selection behavior
- Plugin docs explain how the budget-aware packing works
- Tests cover selection behavior under tight vs relaxed budgets
Implementation hints
Relevant current surfaces:
plugin/index.ts(before_agent_start) currently handles auto-recall- current config knobs:
autoRecall,recallLimit,minScore,searchMode plugin/openclaw.plugin.jsonis the schema surface
Out of scope
- Remote prompt-packing services
- Hidden opaque heuristics with no observability
- Replacing Cortex search/ranking with a pure prompt-template hack