Skip to content

feat(plugin): add bounded recall manifest budget selection (#319 slice A) - #323

Merged
hurttlocker merged 1 commit into
mainfrom
feat/319-recall-manifest-budget
Mar 11, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
feat/319-recall-manifest-budget

Conversation

@hurttlocker

Copy link
Copy Markdown
Owner

What this does

Implements #319 Slice A as a bounded plugin recall packing step:

  • adds a hard recall budget knob (recallBudgetChars)
  • builds a recall manifest before injection
  • deterministically keeps/drops recall items under budget
  • uses existing raw retrieval results only (no summary store)

Problem / Context

Current auto-recall flow is mostly:
search -> dedupe -> top N inject.

That path is not explicitly budget-aware, so recall payload size can drift and selection behavior is not clearly observable when payload pressure exists.

Issue: #319

How it works

1) New recall budget knob

Added config key:

  • recallBudgetChars (default 3000)

Wired in:

  • plugin/index.ts config parsing + known key validation
  • plugin/openclaw.plugin.json schema + UI hints
  • plugin/README.md options docs

2) Recall manifest + deterministic selection

Added plugin/recall.ts with a bounded planning step:

  • stable ranking (score desc, then deterministic tie-break)
  • hard budget enforcement before injection
  • explicit drop reasons (budget or limit)
  • manifest counters + selected/dropped item metadata

Auto-recall now does:

  1. search raw results
  2. optional dedupe
  3. build recall plan/manifest under limit + budget
  4. inject only selected context payload

3) Observability + testability

  • logs recall manifest summary:
    • budget
    • used chars
    • selected count
    • dropped count
  • deterministic behavior covered by unit tests in plugin/recall.test.ts

Files changed

  • plugin/index.ts
  • plugin/openclaw.plugin.json
  • plugin/README.md
  • plugin/recall.ts (new)
  • plugin/recall.test.ts (new)

Testing done

Exact commands run:

  1. node --check plugin/index.ts
  2. node --check plugin/recall.ts
  3. node --test plugin/*.test.ts
  4. go test ./...

Screenshots / before-after

Terminal/log behavior change:

  • before: only injected memory count/scores log line
  • after: explicit cortex: recall manifest ... summary with budget usage and deterministic selection accounting

Breaking changes / risks

Breaking changes: None.

Concise risk note:

  • tighter budget defaults can drop low-priority recall items in contexts with very long memory bodies
  • mitigated by:
    • explicit recallBudgetChars knob
    • deterministic keep/drop behavior
    • manifest logging for immediate operator visibility

Explicit out-of-scope (kept for later)

Merge notes

@hurttlocker
hurttlocker merged commit 972fcee into main Mar 11, 2026
4 checks passed
@hurttlocker
hurttlocker deleted the feat/319-recall-manifest-budget branch March 21, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant