Repository navigation
feat(llm): add Claude Code CLI as an LLM provider - #625
Open
IkoAfianando wants to merge 1 commit into
Open
IkoAfianando wants to merge 1 commit into
IkoAfianando wants to merge 1 commit into
Conversation
Add a "claude-code" LLM profile format that drives ARTEX's agents with the local `claude` binary instead of an HTTP endpoint, so a Claude subscription (or a `claude setup-token` OAuth token) can power exploration. ARTEX keeps its own agent loop, tools, permissions and transcripts. Norma still speaks Anthropic Messages to a placeholder URL; claudeCodeTransport answers each request by running one `claude -p` process with every built-in tool, MCP server, settings source and slash command disabled, so the CLI only produces text: - ARTEX's tool definitions go into the system prompt with a small JSON reply protocol, and the reply's tool calls are turned back into tool_use blocks; - the whole conversation is rendered into the prompt on stdin (each process is a fresh, stateless session); - the process gets a minimal environment, never the server's secrets, and the OAuth token is scrubbed from the environment after startup. Keyless like Ollama: no API key required when the CLI has its own login. Model is an alias (opus/sonnet/haiku) or a full model ID. Wired through FromEnv, ConfigFrom, the model-list and connection-test endpoints, task resolution, the System -> LLM UI (format option, token field, hidden base URL) and i18n. The Docker image installs the CLI and keeps its login in the root-only keys volume. Adds migration 0016 relaxing the llm_profiles format check, plus unit tests covering tool-call round-trips, streaming, prose fallback, auth-error handling and secret isolation.
Owner
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.
Summary
Adds a
claude-codeLLM profile format that drives ARTEX's agents with the localclaudebinary instead of an HTTP endpoint, so a Claude subscription (or aclaude setup-tokenOAuth token) can power exploration.ARTEX keeps its own agent loop, tools, permissions and transcripts. Norma still speaks Anthropic Messages to a placeholder URL; a new transport answers each request by running one
claude -pprocess with every built-in tool, MCP server, settings source and slash command disabled, so the CLI only produces text:tool_useblocks, so tools still run under ARTEX's executor and interception rules.CLAUDE_CODE_OAUTH_TOKENis added to the startup env scrub.Keyless like Ollama: no API key needed when the CLI has its own login. Model is an alias (
opus/sonnet/haiku) or a full model ID.Changes
agent/claude_code.go(new) + tests — the transport, reply protocol, prompt rendering and error/status mapping.agent/provider.go—FormatClaudeCode,IsKeylessFormat,FromEnv,ConfigFrom,Provider(),NewProvider()wiring.llm_profilesformat check + migration0016.tr/zh-CNi18n..env.example.Testing
go test ./agent/ ./server/ ./db/pass; new unit tests cover tool-call round-trips, streaming, prose fallback, auth-error handling (not retried, token scrubbed) and server-secret isolation.claudeCLI: connection test returnsOK; the agent loop returns a validBashtool call.claudepresent, isolation self-test still passes, migration0016applied.Notes / limitations
ARTEX_CLAUDE_CODE_MAX_PROCS(default 4) caps concurrent CLI processes.