feat: add Claude Code CLI provider - #14090
Closed
canderson26 wants to merge 11 commits into
Closed
Conversation
Collaborator
|
Related to #6427 (Claude CLI subprocess transport PR, still open). This appears to be a more complete implementation. |
Collaborator
|
Related to #6427. |
Author
|
Superseded by #15137: the replacement branch carries the Claude CLI provider plus the persistent/broker transport and privacy-scrubbed upstream-ready diff. |
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 new
claude-cliprovider that routes Hermes turns through the locally-installedclaudeCLI, letting users with an existing Claude Code login drive Hermes with their Claude subscription — no API key required.Hermes keeps orchestration, tools, MCP, session storage, compression, and multi-step reasoning. Claude Code is treated as a local external-process transport behind an OpenAI-compatible facade.
How it works
agent/claude_cli_client.py— OpenAI-stylechat.completionsfacade aroundclaude -p. Manages session id hydration/resume, streams responses live, and marshals Hermes tool calls through<tool_call>{...}</tool_call>blocks in Claude's text output.hermes modeladds a dedicated Claude Code CLI flow that detectsclaude auth status, picks a model, and sets a runtime mode.Runtime modes
standard— keeps Claude Code's default runtime behavior.stripped— disables Claude Code's MDS loader, auto-memory, git instructions, and Claude.ai MCP servers where possible, then bootstraps the Hermes system prompt into the Claude session before the first real turn. Recommended for Hermes.Usage
Requires:
PATH(orHERMES_CLAUDE_CLI_COMMAND/CLAUDE_CLI_PATH)claude auth loginsessionNew env vars
HERMES_CLAUDE_CLI_COMMANDclaude)HERMES_CLAUDE_CLI_ARGSHERMES_CLAUDE_CLI_CWDHERMES_CLAUDE_CLI_RESUMEtrue)HERMES_CLAUDE_CLI_STRIP_RUNTIMEHERMES_CLAUDE_CLI_USE_PROCESS_CWDHERMES_CLAUDE_CLI_DEBUG_LOGAlso added to the
HERMES_INFERENCE_PROVIDERand fallback-provider allow-lists.Tests
tests/agent/test_claude_cli_client.py— tool-call parsing, missing-binary error, session hydration reusetests/agent/test_model_metadata.py,test_models_dev.py— context-window resolution forclaude-clitests/agent/test_title_generator.py— delayed auto-title for Claude CLI sessions (avoids the bootstrap turn)tests/run_agent/test_compression_feasibility.py— compression threshold handling for the external-process backendAll 141 tests in the affected suite pass locally.
Docs
website/docs/integrations/providers.md— new provider section with runtime-mode guidancewebsite/docs/reference/environment-variables.md— all seven new env varsNotes for reviewers
CLAUDE_CODE_DISABLE_*,ENABLE_CLAUDEAI_MCP_SERVERS). If Anthropic renames them, stripped mode will silently degrade to standard.