feat(routing): narrow the menu on every host, and gate every host in CI - #78
Merged
Merged
Conversation
Claude Code has been narrowing its routing menu since #75 while the other four hosts still sent every context on the machine, alphabetically, on every call. The shared core already had everything needed; only each host's own bridge was missing the wiring. Copilot, Kimi Code and Codex take the same change as Claude: get_context accepts an optional query, and a request that matches something replaces the full menu with the contexts that matched it and the near-tie rule that comes with it. pi differs in one way worth noting. Its notes go into the system prompt before every turn as well as into get_context, and the system prompt has no request to match against — so that path keeps listing everything, which is the correct answer there. Each host gets a test that drives its own bridge end to end: a request that matches shows only what matched, and a call with no query still shows the whole store. The repository's coverage gate only watches the Claude plugin, so these tests are what holds the port honest.
The diff-coverage gate watched one plugin. That was fine while the other hosts were forks that rarely moved, and stopped being fine the moment a change had to be applied to five bridges at once: the four ports in this branch passed a green coverage job that had not read a line of them. Every host adapter is gated now. The generated Context core copied into each plugin is not: those copies are proven byte-identical by the sync check and by the host tests, and Claude's copy is gated, so requiring the same line to run five times would prove nothing further. Widening it found three real gaps in this branch. Copilot, Kimi and Codex had no test for the fallback that stops an unmatched question from hiding the whole store. pi's extension entry point was untested. And the Codex harness killed its bridge instead of closing it, so the child never flushed its coverage profile and everything it ran read as untested — a latent bug that only an ungated host could hide.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code has been narrowing its routing menu since #75. The other four hosts still sent every context on the machine, alphabetically, on every call. This brings them level — and widens the coverage gate so CI actually checks them.
The shared core already had everything; only each host's own bridge was missing the wiring.
Narrowing, on every host
Copilot, Kimi Code and Codex take the same change as Claude:
get_contextaccepts an optionalquery, and a request that matches something replaces the full menu with the contexts that matched it — carrying the near-tie rule from #76 with it.pi differs in one way worth knowing. Its notes go into the system prompt before every turn as well as into
get_context, and the system prompt has no request to match against. That path keeps listing everything, which is the correct answer there rather than an oversight.The conservative fallbacks from #75 apply everywhere: no query, too few contexts, or nothing matched all produce the full menu exactly as before.
The coverage gate now watches every host
It watched only
plugins/claude-code/neatcontext/src/. That was fine while the other hosts were forks that rarely moved, and stopped being fine the moment a change had to be applied to five bridges at once — the first draft of this PR sailed through a green coverage job that had not looked at a single line of it.Now gated:
src/claude,src/copilot,src/kimi,src/codex, and pi'ssrc/piandextensions/.One deliberate exclusion: the Context core copied into each plugin's
src/core/. Those copies are generated and proven byte-identical twice over — the sync check fails when one drifts, and the host tests assert equality against Claude's. Claude's copy is gated and is what the unit tests import. Gating the other four would demand the same line run five times to prove what equality already proves, and would fail honest changes.What the widened gate caught immediately
Three real gaps in this PR, which is the whole argument for it:
closeSession, whose comment has said all along that it exists for exactly this reason.CONTRIBUTING.mddocuments the gate's new scope, the exclusion and why, and the rule about letting spawned hosts exit.Result
289 changed lines across all five hosts, 0 uncovered. Full suite 380 passing.