Repository navigation
feat(llm): run build --deep on a Claude subscription, and pin number formatting - #107
Closed
christian-jorge wants to merge 2 commits into
Closed
christian-jorge wants to merge 2 commits into
christian-jorge wants to merge 2 commits into
Conversation
…ting Adds a third transport, `claude-cli`, that drives the locally installed and already-signed-in Claude Code binary in headless mode. `--deep` previously required GRAFT_API_KEY, so a developer paying for a Claude subscription still had to buy separate API credits for concept nodes and per-symbol summaries. The CLI is a coding agent, not a completions endpoint, so the adapter narrows it: every built-in tool is disabled, and the user's settings, hooks, MCP servers and CLAUDE.md are kept out of the run — without that a personal "always answer in Portuguese" memory silently rewrites every summary in the graph. Structured output is emulated (no tool_choice on this wire) and transient failures are retried with backoff. Provider selection is explicit-first: an existing key-based setup resolves exactly as it did before. The CLI is only inferred when no key is configured. Also pins the savings/stats number formatting to en-US. Nine bare toLocaleString() calls followed the machine locale, so a pt-BR host rendered 1990 as "1.990" — and graft explicitly asks the reading agent to SUM those numbers across calls, making its headline metric ~1000x low. This was already failing three tests upstream. 681 tests, 0 failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Windows only *marks* a file deleted and keeps it in its directory until the last handle closes, so an rmdir racing a just-closed parse or an exiting child throws ENOTEMPTY. Bare rmSync teardowns made a DIFFERENT test fail on each full run while every one passed in isolation. Callers move over in later changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Merged
9 of 10 tasks
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.
graft build --deepwas gated onGRAFT_API_KEY, so a developer already paying for a Claude subscription still had to buy separate API credits for concept nodes and per-symbol summaries. This adds a third provider,claude-cli, that drives the locally installed and already-signed-in Claude Code binary in headless mode.Explicit-first selection. An existing key-based setup resolves to exactly the provider it always did; the CLI is only inferred when no key is configured at all, and the run says so out loud.
The CLI is an agent, so the adapter narrows it to a completions call.
--tools ""removes every built-in tool, so a summarization turn cannot touch the filesystem.--setting-sources "",--strict-mcp-config,--disable-slash-commandsand a replacing--system-promptkeep the user own hooks, MCP servers, skills andCLAUDE.mdout of the prompt — without that, a personal “always answer in Portuguese” memory silently rewrites every summary written into the graph. That is tested.Structured output is emulated. There is no
tool_choiceon this wire, so the tool own schema travels in the prompt and the reply is parsed back into a syntheticToolCall, with fence recovery, string-aware brace scanning and one corrective retry.synthesizeandcruxsee the shape they already get from Anthropic. The prompt goes over stdin, never argv — a 24k-char file summary would blow the 32767-char Windows command-line limit.Honest limits:
temperatureandmaxTokenshave no flag and are dropped, and each call is a process spawn, so throughput is lower than HTTP (raise-j). 19 tests, all process-free via an injectable runner — nothing spawnsclaude, hits the network, or needs a key.Also here: a locale bug that bites today
Nine bare
toLocaleString()calls followed the machine locale. On a pt-BR/de-DE host graft rendered 1990 as1.990— and graft explicitly asks the reading agent to sum those numbers across calls and report a turn total. An agent reading1.990gets 1.99, so the headline “tokens saved” metric came out ~1000x low for a large share of users. This is what makes three tests fail onmaintoday;formatCountpins it to en-US, because that line is a data interchange format that happens to be human-readable.The
rmDir()test helper also lands here because every later part needs it: Windows only marks a file deleted and keeps it in its directory until the last handle closes, so barermSyncteardowns made a different test fail on each full run while every one passed in isolation.Part of a stack. This work started as an audit of
mainand is split by area so each piece is reviewable on its own. Order, each based on the one before it:feat/subscription-provider—--deepwithout an API key, + the locale bugfix/graph-extraction— Python imports, JSX edges, WASM leakfix/query-and-viz-security— ReDoS, DNS rebinding, XSS,--infix/hosts-settings-safety— thesettings.jsonwipefix/llm-build-robustness— the concept-layer wipe, usage accountingfix/windows-and-cli-ux— the dead npm path on Windowschore/ci-and-packaging— type-check the tests, run the packaged artifactdocs/config-reference— the config surface the above introducedCross-fork PRs can only target
main, so GitHub shows the cumulative diff here. This PR own diff: main...christian-jorge:Graft:feat/subscription-providerEvery link in the stack is green on its own:
tscclean and the full suite at 0 failures on Windows. Happy to reorder, rebase, drop any piece, or squash the lot back into one — just say which.🤖 Generated with Claude Code