Skip to content

feat: opt-in context filter keeps the passages of a large output that matter for the task - #141

Merged
DevMortimer merged 5 commits into
mainfrom
feat/opt-in-context-filter
Sep 29, 2026
Merged

DevMortimer merged 5 commits into
mainfrom
feat/opt-in-context-filter

Conversation

@DevMortimer

Copy link
Copy Markdown
Owner

For a large tool output that no format parser fits, the context saver gives the agent a blind excerpt: a head, lines matching error/fail/warn, and a tail. Text in the middle that matters for the task is dropped, and the agent has to search the saved full output for it. Over 11 days of recorded sessions, 43 outputs took this path and the agent went back to the full output after 8 of them.

Change (beta, off by default)

  • context.filter (enabled: false, chunkChars 2000, minScore 1.5, maxKeptChars 6000, timeoutMs 4000). When enabled, the output is split into chunks at line boundaries, the judge scores each chunk's usefulness for the agent's current task on a four-level rubric, and chunks scoring at least 1.5 are kept word for word in original order, with the final 1000 characters always kept and gaps marked.
  • Applies only where the blind excerpt would be used; parser excerpts, all, duplicates, and repeated runs are unchanged. Any failure (judge error, timeout, budget, no chunk passing) keeps today's excerpt.
  • Everything sent to the judge is redacted like every other request. docs/data-handling.md and the consent text state that the whole redacted output is sent when the filter is on.
  • context.filter.enabled is read from the user file only; a project may tune the other keys.
  • /warden status and the trace count filtered outputs separately (recalls, kept size, requests, time, fallbacks). scripts/filter-report.mjs summarises filtered versus excerpt outputs from session files, offline.
  • Method source: GPT Researcher's context filter (usefulness score per chunk with a keep threshold).
  • Version bump to 0.77.0.

Verification

  • npm run check: 1222 pass / 0 fail; typecheck and build clean. tests/filter.test.ts also passes 10 of 10 under Node 22.19.0.
  • Live check against the real judge: a 190,330-character git log --stat output (97 chunks) was filtered in 5 requests and 489 ms to 4,919 kept characters.

… matter for the task

Where the context saver would keep only the head/diagnostic/tail excerpt,
context.filter (beta, off by default) splits the output at line boundaries,
asks Jev one score question per chunk for the agent's current task, and keeps
chunks at or above minScore word for word in original order, with the final
1000 characters and marked gaps. Any failure keeps today's excerpt.

The ledger, /warden status, the trace, and scripts/filter-report.mjs count
filtered and excerpt outputs apart so a trial can be judged.
Turning the filter on sends whole redacted outputs to the judge and spends
requests, so a project file may tune the filter but not enable it.
The ask deadline timer is unref'd, so on Node 22.19.0 the loop drained
before the abort fired and the deadline test was cancelled.
@DevMortimer
DevMortimer merged commit 7ffef03 into main Sep 29, 2026
6 checks passed
@DevMortimer
DevMortimer deleted the feat/opt-in-context-filter branch September 29, 2026 02:29
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