Skip to content

feat(brief): refit the relevance gate on four repositories (#906) - #911

Merged
LivioGama merged 6 commits into
mainfrom
feat/906-gate-multirepo
Oct 14, 2026
Merged

LivioGama merged 6 commits into
mainfrom
feat/906-gate-multirepo

Conversation

@LivioGama

@LivioGama LivioGama commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #906

Stacked on #909 (base feat/906-region-pack; retarget to main when it merges).

Summary

The relevance gate was fitted on Pixel prompts alone. On the tool census (excalidraw, requests, ripgrep, pixel) it returned no brief for 7 of the 13 answer prompts and 13 of the 19 census prompts it sees (the 20th names a symbol and skips the gate). This refits it on four repositories and lets a low-tier prompt carry one part of the region pack.

Diagnosis, from pixel brief --json features at the pinned commits (the old gate: HIGH 1.298, LOW 0.731; closed = score <= LOW):

prompt score question struct_ratio shared/informative why closed
pixel-3 overview -1.00 no 0.44 2/4 no question shape, rare words spread over many files
pixel-5 error origin 0.40 no 1.00 7/7 statement ("I keep getting ..."), question worth 1.64 is missing; every other feature is a perfect match
excalidraw-3 config 0.37 no 0.74 6/8 statement; one file holds 6 of 8 words
excalidraw-4 review -0.33 no 0.60 4/6 imperative, ops word (commit, 0.11)
excalidraw-5 flow -0.43 no 0.62 5/7 imperative ("walk me through ...")
requests-3 overview -3.03 no 0.14 2/5 1 structural file, words are not the repo's
ripgrep-3 diagnosis 0.18 no 0.77 5/5 statement; all 5 words in one file

The shared cause: question (coefficient 1.64) is the only thing separating a statement from a question, so a prompt that is wholly in the repository's words but not phrased as a question lands 0.2-1.0 under LOW. The thresholds, set on 35 Pixel off-topic rows, were also tight (one false positive allowed at HIGH).

What changes

  • eval/brief-gate/prompts-multirepo.jsonl (150 rows): the 20 census prompts, 30 plain-English prompts written for each of excalidraw, requests and ripgrep at their pinned SHAs, 40 off-topic ones (chat, git/release/CI, generic programming, other applications' bugs; scored against all four repos, counted once). Dev/test 50/50, stratified by repo and topic. Built by scripts/research-gate/multirepo_set.py.
  • scripts/research-gate/gate_multirepo.py: refit on dev across both sets (features as pixel brief --json logs them, results/multirepo-features.json), L2 logistic C=0.3, balanced, 20x repeated grouped 5-fold; HIGH/LOW at the 5/10 % points of the pooled out-of-fold off-topic scores; test read once. New feature coverage = shared / informative (repo-size independent). gate_model.rs, relevance.rs, gate_reference.py and gate_parity.json follow; the Pixel-only model stays as results/gate-model-pixel-only.json.
  • A low-tier prompt gets at most one part of the region pack, ending on the lead line (without it the newly opened prompts rendered only 3 file names).

Evidence

results/multirepo-fit.txt (rates; off-topic multirepo prompts weigh once):

set / tier first gate TPR / FPR new gate TPR / FPR
multirepo test, high 0.52 / 0.00 0.58 / 0.00
multirepo test, high or low 0.63 / 0.00 0.73 / 0.00
Pixel set test, high 0.62 / 0.12 0.65 / 0.12
Pixel set test, high or low 0.74 / 0.19 0.85 / 0.15
Pixel set dev (out of fold), high 0.64 / 0.03 0.67 / 0.07
Pixel set dev (out of fold), high or low 0.70 / 0.10 0.85 / 0.10
all dev, out of fold, AUC 0.936 (test 0.900)

On the Pixel set no TPR falls and the FPR is equal or lower on test; the one exception is the high tier on dev, 0.03 to 0.07 (2 more of 30 off-topic prompts, in sample for the threshold). Per repo on test: excalidraw 0.65/0.00 and 0.71/0.00, requests 0.44/0.00 and 0.62/0.00, ripgrep 0.71/0.00 and 0.88/0.00. The off-topic multirepo prompts are easy (generic or other-stack), so their 0.00 says less than the Pixel set's other-repo rows. 53 prompts per repo is small: read these to about +-0.1.

Census gate, 19 prompts: opened 6 before, 9 now (gained pixel-5, excalidraw-1, excalidraw-3, ripgrep-3; lost ripgrep-5, 0.76 to 0.43). The overview, review and flow prompts stay closed.

Region-pack coverage, score_brief.py --sessions all with PIXEL_BRIEF_PARTS=3, line coverage, before (#909 head, old gate) vs this head:

group before after
answer, 13 15% 28%
edit, 7 0% 3%
all, 20 9% 19%
pixel-5 0% 81%
ripgrep-3 0% 68%
excalidraw-1 (edit) 0% 22%

Tests: cargo test -p pixel-cli 1110 unit + 369 CLI pass; workspace clippy -D warnings, fmt, SPDX clean; the Rust score equals gate_reference.py on the 7 recorded blocks (regenerated), a test holds gate_model.rs to the json (5 features, sha), new tests for coverage and the low-tier pack. Not run: a live agent re-run.

Honest limits: the model without coverage was also read on test as an ablation (0.64 / 0.07 high, 0.72 / 0.07 high or low on all test rows) after the choice was made on dev; it decided nothing. log(files_considered) and prompt word count improved pooled dev CV but failed to transfer between the two sets, so they are out. The gate still closes prompts that do not use the repository's words (overview, "review the latest commit", flow); that needs a different signal, not a threshold.

Merge Danger

Door: two-way. The constants and thresholds are one file; reverting restores the old gate. No wire or index version moves; brief-decisions.jsonl keeps its fields (the logged model string changes).

Blast radius: every weak or plain-language prompt: more of them open (TPR +6 to +11 points on test, FPR equal or lower on test), and a low-tier one now carries up to 9 800 characters instead of three file names.

Docs touched

ARCHITECTURE.md (the gate and the region pack), eval/brief-gate/README.md, scripts/research-gate/README.md, changelog.d/906-gate-multirepo.changed.md.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • Relevance screening now considers how much a prompt’s informative keywords are concentrated in a single related file.
    • Low-relevance prompts can now receive a compact brief with at most one leading section when relevant material is available.
    • The relevance gate is calibrated using prompts from multiple repositories.
  • Documentation
    • Added guidance on the expanded prompt evaluation set and updated gate research results.

LivioGama and others added 5 commits October 14, 2026 01:28
…#906)

For the symbols a prompt names (or quotes, or whose words the best files
spell) the brief now carries the definition with its doc comment and body,
its usage sites each inside the function that holds it, the functions that
use it with their call sites, and its tests by name with the first
assertion, as line-numbered blocks of exact source under one directive line.
A stale or missing graph falls back to the text search for the declaration.
The text may exceed one hook's cap: Pack::text is the whole of it and
split_parts cuts it at block boundaries into parts of 9 800 characters, at
most three (PIXEL_BRIEF_PARTS, default 1 until the installer registers
more). PIXEL_BRIEF_PACK=0 restores the packet. The decision log gains
pack_bytes, pack_parts, pack_targets and fallback.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… accept

Pi and OpenCode run `pixel brief` and drop any output over 4 000 bytes, so a
pack of up to 9 800 characters would have silenced them. The command now
prints at most 3 900 bytes unless PIXEL_BRIEF_PARTS says the host takes more;
the prompt hooks keep one part of 9 800.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

Merge origin/main (#907 multi-hook delivery). The pack's part count is the
number of hooks that deliver the brief: part 1 of `--part 1/N` builds for N,
a host with one hook for 1. PIXEL_BRIEF_PARTS stays as an override, and the
`brief` command keeps its 3 900-byte cap for Pi and OpenCode. The local text
index is opened once per brief instead of once per search, which cut a
region-pack brief on the local route from 275 ms to 76 ms.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pack of a cut packet ends on the lead line, the pack_parts metric counts
the slices the hooks deliver, and the CLI tests assert the values they claim.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate (four features, fitted on Pixel prompts alone) returned no brief for
7 of the 13 census answer prompts and 13 of the 19 census prompts it sees,
across excalidraw, requests, ripgrep and pixel.

- eval/brief-gate/prompts-multirepo.jsonl: the 20 census prompts, 30 written
  for each non-pixel repo and 40 off-topic ones (scored against every repo),
  split dev/test 50/50 by stratum; scripts/research-gate/multirepo_set.py.
- gate_multirepo.py refits the logistic on dev across both sets with a fifth
  feature, `coverage` (shared / informative keywords, repo-size independent),
  and calibrates HIGH/LOW at 5 / 10 % FP out of fold; test read once.
  Thresholds 1.298 / 0.731 -> 1.184 / 0.613. The Pixel-only model is kept
  as results/gate-model-pixel-only.json.
- A low-tier prompt now gets one part of the region pack, as a lead.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: Pixel-CLI/pixel/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93b2fb6d-a653-4843-907f-c803f894c8fd
📥 Commits

Reviewing files that changed from the base of the PR and between 2ae9849 and 1415072.

📒 Files selected for processing: 16
  • ARCHITECTURE.md
  • changelog.d/906-gate-multirepo.changed.md
  • crates/pixel/src/execution_brief/chain.rs
  • crates/pixel/src/execution_brief/gate_model.rs
  • crates/pixel/src/execution_brief/gate_parity.json
  • crates/pixel/src/execution_brief/relevance.rs
  • eval/brief-gate/README.md
  • eval/brief-gate/prompts-multirepo.jsonl
  • scripts/research-gate/README.md
  • scripts/research-gate/gate_multirepo.py
  • scripts/research-gate/gate_reference.py
  • scripts/research-gate/multirepo_set.py
  • scripts/research-gate/results/gate-model-pixel-only.json
  • scripts/research-gate/results/gate-model.json
  • scripts/research-gate/results/multirepo-features.json
  • scripts/research-gate/results/multirepo-fit.txt
 ____________________________________________________________
< Go forth and channel your goroutines; I'll guard the race. >
 ------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Base automatically changed from feat/906-region-pack to main October 14, 2026 00:16
@pixelio-bot

pixelio-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

⚠️ Pixelio: could not rebase this branch onto main.

could not resolve conflicts in ARCHITECTURE.md, changelog.d/906-region-pack.added.md, crates/pixel/src/execution_brief/chain.rs, crates/pixel/src/execution_brief/region_pack.rs, crates/pixel/tests/cli/region_pack_cli.rs after 6 pass(es)

@pixelio-bot

pixelio-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

Pixelio — needs human. Attempt budget exhausted.

Last failure: rebase conflict passes exhausted
A new head or @pixelio-bot will revive it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LivioGama
LivioGama merged commit 7ffb589 into main Oct 14, 2026
18 checks passed
@LivioGama
LivioGama deleted the feat/906-gate-multirepo branch October 14, 2026 00:25
LivioGama added a commit that referenced this pull request Nov 25, 2026
* feat(brief): region pack, the source an agent reads before it answers (#906)

For the symbols a prompt names (or quotes, or whose words the best files
spell) the brief now carries the definition with its doc comment and body,
its usage sites each inside the function that holds it, the functions that
use it with their call sites, and its tests by name with the first
assertion, as line-numbered blocks of exact source under one directive line.
A stale or missing graph falls back to the text search for the declaration.
The text may exceed one hook's cap: Pack::text is the whole of it and
split_parts cuts it at block boundaries into parts of 9 800 characters, at
most three (PIXEL_BRIEF_PARTS, default 1 until the installer registers
more). PIXEL_BRIEF_PACK=0 restores the packet. The decision log gains
pack_bytes, pack_parts, pack_targets and fallback.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(brief): keep the region pack under what the brief command's hosts accept

Pi and OpenCode run `pixel brief` and drop any output over 4 000 bytes, so a
pack of up to 9 800 characters would have silenced them. The command now
prints at most 3 900 bytes unless PIXEL_BRIEF_PARTS says the host takes more;
the prompt hooks keep one part of 9 800.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(brief): answer the CodeRabbit findings on the region pack (#906)

A pack of a cut packet ends on the lead line, the pack_parts metric counts
the slices the hooks deliver, and the CLI tests assert the values they claim.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(brief): refit the relevance gate on four repositories (#906)

The gate (four features, fitted on Pixel prompts alone) returned no brief for
7 of the 13 census answer prompts and 13 of the 19 census prompts it sees,
across excalidraw, requests, ripgrep and pixel.

- eval/brief-gate/prompts-multirepo.jsonl: the 20 census prompts, 30 written
  for each non-pixel repo and 40 off-topic ones (scored against every repo),
  split dev/test 50/50 by stratum; scripts/research-gate/multirepo_set.py.
- gate_multirepo.py refits the logistic on dev across both sets with a fifth
  feature, `coverage` (shared / informative keywords, repo-size independent),
  and calibrates HIGH/LOW at 5 / 10 % FP out of fold; test read once.
  Thresholds 1.298 / 0.731 -> 1.184 / 0.613. The Pixel-only model is kept
  as results/gate-model-pixel-only.json.
- A low-tier prompt now gets one part of the region pack, as a lead.

Refs #906

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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