Add llm-claude-code plugin for Claude Code CLI#1
Merged
Conversation
Implement an LLM model plugin that uses the Claude Code CLI (`claude`) instead of the Anthropic API SDK. This allows users to leverage their existing Claude Code subscription without requiring a separate API key. Features: - Support for multiple Claude models (opus, sonnet, haiku) - Streaming via --output-format stream-json - Non-streaming via --output-format json - Conversation context handling - Configurable options (max_tokens, timeout, system_prompt, etc.) - Model aliases for convenience (cc, opus, sonnet, haiku)
- Add supports_schema = True to enable LLM's schema feature - Implement _execute_with_schema method for schema-based responses - Pass schema via --json-schema CLI flag - Extract structured output from various response formats - Update README with schema usage examples
- Use --append-system-prompt by default (preserves agentic behavior) - Add replace_system_prompt option to use --system-prompt instead - Remove inline "System:" prefix approach - Update README with system prompt documentation
New options: - add_dir: Additional directories for Claude to access - permission_mode: Control permission prompts (default/acceptEdits/bypassPermissions) - continue_conversation: Continue most recent conversation - resume: Resume a specific session by ID - cwd: Set working directory for execution - mcp_config: Path to MCP configuration file - verbose: Enable verbose logging These options map to Claude Code CLI flags for headless mode automation.
- Capture session_id from Claude Code CLI responses - Store session_id on response object for conversation continuity - Auto-resume Claude Code sessions when continuing LLM conversations - Remove confusing continue_conversation option (used wrong session) - Keep resume option for manual session management - Update documentation to reflect new behavior When using model.conversation(), the plugin now: 1. Captures session_id from first response 2. Uses --resume on subsequent turns (instead of embedding text context) 3. Falls back to text context if session_id unavailable
- Add pytest, pytest-cov, and coverage dependencies - Configure pytest with coverage reporting (80% threshold) - Add comprehensive test suite with 60 tests covering: - Model initialization and options - Streaming and non-streaming execution - Schema support for structured output - Conversation session management - Error handling - Achieve 90% code coverage
- Add tests.yml for CI on Python 3.10-3.14 - Add publish.yml for PyPI releases - Resolve pyproject.toml conflicts (keep comprehensive config) - Remove src/ directory (use flat module structure) - Remove simple test_plugin.py (replaced by comprehensive test suite)
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.
Implement an LLM model plugin that uses the Claude Code CLI (
claude)instead of the Anthropic API SDK. This allows users to leverage their
existing Claude Code subscription without requiring a separate API key.
Features: