Clause Code is an interactive terminal-based AI coding assistant powered by Anthropic's Claude. It combines powerful AI capabilities with delightful holiday theming to make your coding sessions more enjoyable and productive.
Key Features:
- π¬ Interactive chat interface with Claude's latest models (Sonnet 4.5, Haiku 4.5, Opus 4.1)
- π¨ Beautiful terminal UI with syntax highlighting and festive animations
- π Automatic code extraction and file writing
- π Holiday-themed status messages and ASCII art
- π Command history with auto-completion
- π Daily December coding challenges (advent calendar)
- βοΈ Flexible configuration with multiple Claude models
- Python 3.10 or higher
- An Anthropic API key
git clone https://github.com/yourusername/clause-code.git
cd clause-code
uv sync
uv run clause-codegit clone https://github.com/yourusername/clause-code.git
cd clause-code
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install
pip install -e .
# Run
clause-codeOn first launch, Clause Code will guide you through a quick setup:
- Enter your Anthropic API key (or set
ANTHROPIC_API_KEYenvironment variable) - Choose your preferred Claude model
- Set your project folder (optional)
- Select festive theme (Santa mode or Grinch mode)
You're ready to code with holiday cheer!
Simply type your questions or coding requests:
π You: Help me write a Python function to calculate fibonacci numbers
π
Sleighing...
Here's a festive fibonacci implementation...
[Generated code with syntax highlighting]
Clause Code automatically extracts and writes files from Claude's responses:
π You: Create a new file hello.py with a hello world function
π Jingling...
**File: hello.py**
[Code is automatically written to your project folder]
| Command | Description |
|---|---|
/help |
Show all available commands |
/setkey |
Configure or update your Anthropic API key |
/model |
Switch between Claude models (Sonnet, Haiku, Opus) |
/project |
Set your working directory |
/santa |
Enable festive mode with maximum holiday cheer |
/grinch |
Switch to minimal mode (less festive) |
/advent |
Get daily coding challenges (December only) |
/clear |
Clear conversation history and screen |
/exit or /quit |
Exit Clause Code |
Choose the right model for your task:
- Sonnet 4.5 (Default) - Best for coding, balanced performance and capability
- Haiku 4.5 - Fastest responses for quick questions
- Opus 4.1 - Most capable for complex reasoning tasks
Switch models anytime with /model
Two delightful themes:
- Santa Mode - Full holiday cheer with festive messages and animations
- Grinch Mode - Minimal, professional output for when you need focus
Watch Clause Code "think" with festive states:
- π Sleighing...
- π Jingling...
- β·οΈ Snowboarding...
- π Unwrapping...
- βοΈ Crystallizing...
- And more!
Daily coding challenges throughout December:
π You: /advent
π
December 5th Challenge: Binary Tree Decorations
[Fun coding challenge with holiday twist]Clause Code automatically:
- Extracts code blocks marked with file paths
- Creates files in your project directory
- Preserves file structure and formatting
- Highlights written files in the output
Clause Code stores configuration in ~/.clause-code/:
~/.clause-code/
βββ config.json # Application settings
βββ .api_key # Encrypted API key
βββ history # Command history
You can configure via commands or by editing config.json:
{
"model": "claude-sonnet-4-5-20250929",
"theme": "festive",
"project_folder": "/path/to/your/project",
"max_tokens": 64000
}Set your API key via environment variable:
export ANTHROPIC_API_KEY=sk-ant-your-key-heresrc/clause_code/
βββ __init__.py
βββ __main__.py # Entry point
βββ cli.py # Main CLI application
βββ agent.py # Claude SDK integration
βββ theme.py # Holiday theming system
βββ commands/ # Slash command handlers
β βββ __init__.py
β βββ base.py
β βββ config.py
βββ utils/ # Utilities
βββ __init__.py
βββ config.py # Configuration management
βββ file_writer.py # File extraction & writing
- CLI (cli.py) - Async chat loop, command routing, first-run setup
- Agent (agent.py) - Claude API integration, streaming responses, conversation history
- Theme (theme.py) - Festive messages, ASCII art, status animations
- Commands (commands/) - Slash command implementations
- Utils (utils/) - Configuration management, file operations
# Clone and install with dev dependencies
git clone https://github.com/yourusername/clause-code.git
cd clause-code
uv sync --extra dev
# Run tests
uv run pytest
# Format code
uv run black src/
uv run ruff check src/# Run all tests
pytest
# Run with coverage
pytest --cov=clause_code
# Run specific test file
pytest tests/test_agent.pyclause-code/
βββ src/clause_code/ # Main package
βββ tests/ # Test suite
βββ demo_project/ # Example projects
βββ pyproject.toml # Project configuration
βββ README.md # This file
βββ PLAN.md # Technical plan
βββ QUICKSTART.md # Quick start guide
βββ LICENSE # MIT License
Contributions are welcome! Here's how you can help:
- Report Bugs - Open an issue with details
- Suggest Features - Share your ideas for new commands or features
- Submit PRs - Fork, create a feature branch, and submit a PR
- Add Festive Content - More holiday messages, ASCII art, or challenges
- Follow PEP 8 style guidelines (enforced by Black)
- Add tests for new features
- Update documentation for user-facing changes
- Keep the festive spirit alive!
- anthropic (>=0.72.0) - Official Anthropic SDK
- rich (>=13.7.0) - Beautiful terminal formatting and syntax highlighting
- prompt-toolkit (>=3.0.43) - Interactive CLI with history and auto-completion
- click (>=8.1.7) - Command-line interface creation
- pydantic (>=2.5.0) - Configuration validation
- python-dotenv (>=1.0.0) - Environment variable management
- aiofiles (>=23.2.1) - Async file operations
- pytest (>=7.4.0) - Testing framework
- pytest-asyncio (>=0.21.0) - Async test support
- black (>=23.0.0) - Code formatting
- ruff (>=0.1.0) - Fast linting
Generate functions, classes, and complete modules with natural language requests.
Get instant feedback on code quality, potential bugs, and improvement suggestions.
Paste error messages and get detailed explanations with suggested fixes.
Ask questions about programming concepts, libraries, and best practices.
Request code improvements, optimization, and modernization.
Generate docstrings, comments, and README files.
- β/β - Navigate command history
- Tab - Auto-complete slash commands
- Ctrl+C - Cancel current operation
- Ctrl+D - Exit application
Make sure you've set your API key:
clause-code
π You: /setkeyOr set the environment variable:
export ANTHROPIC_API_KEY=sk-ant-your-key-hereEnsure you've installed in editable mode:
pip install -e .Make sure your virtual environment is activated or use:
python -m clause_code- Created by Hans Scharler
- Powered by Anthropic Claude
- Built with Python, Rich, and holiday spirit
Happy Coding and Happy Holidays!
π π βοΈ π β π π· βοΈ
Made with β€οΈ and festive cheer
