Gate the pull channel on match strength; rule-built crux for keyless builds - #65
Open
anirudhkumar-nanonets wants to merge 2 commits into
Open
Gate the pull channel on match strength; rule-built crux for keyless builds#65anirudhkumar-nanonets wants to merge 2 commits into
anirudhkumar-nanonets wants to merge 2 commits into
Conversation
graft ask returned its full top-N with source inlined at any score, so a 0.05 match rendered exactly like a 0.9 one. The push channel has enforced STRONG_FLOOR/HIGH_FLOOR for a while; pull had no gate. Below both floors, return 3 pointers without source plus the productive next tool. --full overrules it.
Without a key there was no crux, so ask fell back to the whole span capped at 80 lines — a keyless build inlined up to 10x more per hit than a paid one. ruleCrux fills that gap from structure: functions get their opening, containers get their member signatures (span containment). -62% on a long function in a fixture. --crux runs the per-symbol meaning pass without the prose concept map, roughly half the LLM calls of --deep. Layer resolution moved out of the action handler into resolveBuildLayers so it is testable.
christian-jorge
pushed a commit
to christian-jorge/Graft
that referenced
this pull request
Aug 14, 2026
Adopt upstream PR NanoNets#65 (still open on NanoNets/Graft), cherry-picked with its original authorship: the weak-match gate on `ask`'s pull channel, a rule-built crux for keyless builds, and `--crux` to buy the per-symbol layer without the prose concept map. Nine conflict hunks resolved across five files. One of them was semantic rather than textual and is the reason this could not be taken as-is: upstream gates the LLM layers on `!!resolved.apiKey`, while this tree reaches a model through a signed-in Claude Code CLI subscription that has no key at all. Taken unchanged it would have degraded every subscription `--deep` to the structural build and told the user to set GRAFT_API_KEY — advice for a provider they are not on. The gate is `credentialProblem()` here and `resolveBuildLayers` takes `hasCredentials`. `--crux` matters more to this fork than to upstream: the FORK.md changes made `--deep` cost more per repo, and this is the flag that buys the half that pays off.
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.
Two changes to what
graft askreturns.4ff0873— gate the pull channel on match strengthisWeakMatch()insrc/ask/ask.tssuppresses the source pack when a lexicalresult is below both floors (
coverageStrong < STRONG_FLOOR,coverage < HIGH_FLOOR). A weak pack now returns 3 pointers and no inlined source insteadof a full pack with a savings footer.
--fullbypasses the gate.abdb043— rule-built crux for keyless buildsruleCrux()builds a <=8-line crux deterministically, with no LLM and no APIkey: signature plus the first meaningful lines for a function, a member
signature list for a class/interface/struct/trait/enum.
inlineSource()fallsback to it before
sliceSpan. Measured on one long function: 2848 -> 1071chars (-62%). Adds
--cruxto build the LLM crux layer without concept nodes,and
resolveBuildLayers()insrc/cli-meta.tsso layer selection is testable.Tests: 13 new (7 in
test/ask.test.ts, 6 intest/cli-meta.test.ts).On the benchmark numbers in README.md
This branch does not change README.md. The SWE-bench table on main (commit
00c9cc4) covers 20 instances, and they were not all measured on this code:graft-fix12-abdb043.tgz, v0.9.0)existed, under the older harness that still had web access enabled
Merging this makes the 11 the current behaviour. The 9 would need re-running to
put the whole table on one version.