feat(offload): reasoning offload for codegraph_explore (bring-your-own endpoint)#918
Open
colbymchenry wants to merge 1 commit into
Open
feat(offload): reasoning offload for codegraph_explore (bring-your-own endpoint)#918colbymchenry wants to merge 1 commit into
colbymchenry wants to merge 1 commit into
Conversation
…n endpoint) codegraph_explore can now hand the source it retrieved to a reasoning model you point at — any OpenAI-compatible endpoint (Cerebras, OpenAI, a local vLLM/Ollama) with your own key — and return that model's tight, cited answer instead of the raw source dump. The agent's main context gets the answer in far fewer tokens, at the cost of one network round-trip. Off by default. Configure with `codegraph offload set-endpoint <url> --model <m> --key-env <ENV>` (or the CODEGRAPH_OFFLOAD_* env vars); status/disable manage it. The API key is never written to disk — the config stores the NAME of an env var and the key is read from it at call time. Strictly degradable: any failure (no endpoint, network, timeout, empty answer) returns null and the call falls back to the local source, so the offload can never surface an error to the agent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds an opt-in reasoning offload to
codegraph_explore. When configured, explore runs retrieval locally as usual, then hands the assembled source + your question to a reasoning model you bring — any OpenAI-compatible endpoint (Cerebras, OpenAI, a local vLLM/Ollama) with your own key — and returns that model's tight, cited answer instead of the raw source dump. Your agent's main context gets the answer in far fewer tokens, at the cost of one network round-trip.Off by default; nothing changes unless you turn it on.
Usage
codegraph offload set-endpoint https://api.cerebras.ai/v1 \ --model gpt-oss-120b --key-env CEREBRAS_API_KEY codegraph offload status # show endpoint / model / key source codegraph offload disableAlso settable by env (overrides the saved config, for CI):
CODEGRAPH_OFFLOAD_URL,_MODEL,_KEY,_EFFORT,_STYLE.Design
~/.codegraph/config.json) stores the name of an env var, and the key is read from it at call time.Coverage: full / partial / not foundverdict and citesfile:linefor every claim, so answers stay verifiable. Validated againstgpt-oss-120b-class models at low temperature; quality tracks the model you choose.nulland the call falls back to returning the local source. The offload can never surface an error to the agent.Layout
src/reasoning/config.ts—~/.codegraph/config.json+CODEGRAPH_OFFLOAD_*resolution (env overrides file).src/reasoning/reasoner.ts— the degradable synthesis client.src/mcp/tools.ts— opt-in hook inhandleExplore, after the output is assembled.src/bin/codegraph.ts—codegraph offload set-endpoint / status / disable.Tests
__tests__/offload.test.ts(12) — config round-trip, key-never-on-disk, env-overrides-file, key resolution, and every degradation path (no endpoint / reject / non-2xx / empty). Full suite green.🤖 Generated with Claude Code