klaude-code


Nameklaude-code JSON
Version 0.1.19 PyPI version JSON
download
home_pageNone
SummaryCoding Agent CLI
upload_time2025-08-04 03:06:30
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseMIT
keywords cli ai coding assistant
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Klaude Code

Klaude Code is a powerful CLI tool that provides an AI-powered coding assistant. It offers an interactive interface to Claude (and OpenAI models) with advanced coding capabilities including file manipulation, code editing, task automation, and more.

## Features

- **Interactive AI Assistant**: Chat with Claude or GPT models for coding help
- **Multiple AI Providers**: Easy switching between Anthropic, OpenAI, DeepSeek, Gemini, and custom APIs
- **Configuration Profiles**: Manage multiple API configurations with simple commands
- **File Operations**: Read, write, edit, and search files with precision
- **Code Refactoring**: Multi-file edits, pattern replacement, and automated refactoring
- **Shell Integration**: Execute bash commands directly within the chat
- **Task Management**: Built-in todo list for tracking coding tasks
- **Session Persistence**: Resume conversations and maintain context across sessions
- **MCP Support**: Extend functionality with Model Context Protocol servers
- **Custom Commands**: Create reusable command patterns for common workflows
- **Image Support**: View and analyze images with multimodal AI capabilities

## Quick Start

### Installation

```bash
# Install with pip
pip install klaude-code

# Or install with uv (recommended)
uv tool install klaude-code
```

### Basic Usage

```bash
# Start interactive mode
klaude

# Run a single command (headless mode)
klaude --prompt "Fix the type errors in main.py"

# Resume your last session
klaude --continue

# Choose from previous sessions
klaude --resume
```

### Configuration

Klaude Code supports multiple configuration profiles for different AI providers and settings:

```bash
# View all available configurations
klaude config show

# Edit default configuration
klaude config edit
# Or use the short form
klaude edit

# Create or edit named configurations. Any config_*.json file in ~/.klaude will be recognized as a configuration profile.
klaude config edit anthropic    # Creates ~/.klaude/config_anthropic.json
klaude edit openai              # Creates ~/.klaude/config_openai.json
klaude edit deepseek            # Creates ~/.klaude/config_deepseek.json

# Use a specific configuration
klaude --config anthropic       # Use config_anthropic.json
klaude -f openai               # Short form with -f flag
```

## Usage

### Interactive Commands

Once in interactive mode, you can use various slash commands:

- `/status` - Show current configuration and model info
- `/clear` - Clear conversation history
- `/compact` - Compact conversation to free up context
- `/cost` - Show token usage and costs
- `/theme` - Switch between light, dark, light_ansi, and dark_ansi themes
- `/init` - Create a CLAUDE.md file for project-specific instructions
- `/memory` - Manage project/user memory
- `/save_custom_command` - Save conversation as reusable command

### Input Modes

Special prefixes activate different input modes:

- **Bash Mode** (`!`): Execute shell commands
  ```
  ! git status
  ! npm test
  ```

- **Plan Mode** (`*`): Enter planning interface for complex tasks
  ```
  * design the authentication system
  ```

- **Memory Mode** (`#`): Save instructions to memory
  ```
  # always use TypeScript strict mode
  ```

- **File Reference** (`@`): Reference files with auto-completion
  ```
  @main.py fix the syntax errors
  ```

- **Image Reference**: Paste images with Ctrl+V or reference image files
  ```
  [Image #1] what's in this screenshot?
  @path/to/image.png explain this diagram
  ```

### Custom Commands

Create reusable command patterns in:
- Project commands: `.claude/commands/`
- Global commands: `~/.claude/commands/`

Example custom command (`create_git_commit.md`):
```markdown
---
description: Create a git commit with context analysis
---

## Context
- Current git status: !`git status`
- Current git diff: !`git diff HEAD`

## Your task
Create a single git commit with a descriptive message.

Additional instructions: $ARGUMENTS
```

Use it as: `/create_git_commit add error handling`

## Available Tools

Klaude Code provides a comprehensive set of tools:

### File Operations
- **Read**: Read file contents with line numbers and view images
- **Write**: Create or overwrite files
- **Edit**: Make precise edits to specific lines
- **MultiEdit**: Batch multiple edits to a single file

### Search Tools
- **Grep**: Search file contents using regex patterns
- **Glob**: Find files by name patterns
- **LS**: List directory contents

### System Tools
- **Bash**: Execute shell commands with timeout support
- **TodoWrite/TodoRead**: Manage task lists
- **Task**: Spawn sub-agents for complex operations

## Usage Examples

```bash
# Quick configuration switching
klaude -f anthropic         # Use Claude for architectural discussions
klaude -f openai           # Switch to GPT for different perspectives  
klaude -f deepseek         # Use DeepSeek for coding tasks

# Refactor code with your preferred model
klaude -f anthropic
> refactor the authentication module to use JWT tokens

# Fix failing tests
> ! npm test
> fix the failing tests

# Search and replace
> rename all instances of getUserData to fetchUserData

# Create a new feature
> implement user profile management with CRUD operations

# Analyze images
> @screenshot.png what UI components are shown here?
> [paste image with Ctrl+V] explain this error message
```

## Session Management

Sessions are automatically saved and can be resumed:

```bash
# Start a new session
klaude
> implement user authentication

# Later, continue the same session
klaude --continue
> add password reset functionality
```

Sessions store:
- Complete message history
- Todo lists and their states
- File tracking information
- Working directory context

## Debugging

### Session Inspection

Sessions are stored in `.klaude/sessions/` with human-readable formats:

1. **Metadata files** (`*.metadata.*.json`): Session info, todo lists, file tracking
2. **Message files** (`*.messages.*.jsonl`): Complete conversation history

### Viewing Sessions

```bash
# List all sessions with metadata
klaude --resume

# Manually inspect session files
cd .klaude/sessions/
cat *.metadata.*.json | jq .
```

### Session File Structure

Metadata includes:
- Session ID and timestamps
- Working directory
- Message count
- Todo list with status
- Tracked file modifications

Messages are stored in JSONL format with:
- Role (user/assistant/tool)
- Content and tool calls
- Timestamps and metadata

## Requirements

- Python 3.13 or higher
- API key for Claude (Anthropic) or OpenAI
- Unix-like environment (macOS, Linux, WSL)

### Python Dependencies

Core dependencies include:
- `anthropic` - Claude API client
- `openai` - OpenAI API client
- `typer` - CLI framework
- `rich` - Terminal formatting
- `pydantic` - Data validation
- `prompt-toolkit` - Input handling
- `pillow` - Image processing
- `pyperclip` - Clipboard operations

## Model Context Protocol (MCP)

Enable MCP servers for extended functionality:

```bash
# Start with MCP enabled
klaude --mcp

# Configure MCP servers
klaude mcp edit
```

MCP allows integration with external tools and services beyond the built-in toolset.

## Tips and Best Practices

1. **Use Plan Mode** for complex tasks: `* plan the refactoring approach`
2. **Track Changes**: The AI automatically tracks file modifications
3. **Session Management**: Use `--continue` to maintain context across work sessions
4. **Custom Commands**: Create project-specific commands for repetitive tasks
5. **Context Window**: Use `/compact` when conversations get too long
6. **Cost Tracking**: Monitor usage with `/cost` command
7. **Image Analysis**: Copy screenshots to clipboard and paste with Ctrl+V for instant analysis
8. **Multimodal Workflows**: Combine code and visual elements for comprehensive development

## Command Line Options

```bash
klaude [OPTIONS] [PROMPT]

Options:
  --continue, -c              Continue from the latest session
  --resume, -r               Resume from a session
  --prompt, -p               Run in headless mode
  --config, -f TEXT          Use a specific config (e.g., 'anthropic' for ~/.klaude/config_anthropic.json)
  --model TEXT              Override the configured model
  --api-key TEXT             Override API key from config
  --base-url TEXT            Override base URL from config
  --max-tokens INTEGER       Override max tokens from config
  --theme [light|dark|light_ansi|dark_ansi]  Override theme from config
  --mcp, -m                  Enable Model Context Protocol
  --logo                     Show ASCII Art logo
```


## Project Structure

```
.klaude/
├── config.json          # Global configuration
├── mcp_servers.json     # MCP server configs
├── commands/            # Custom commands
├── memory/              # Saved instructions
└── sessions/            # Conversation history
```

## Getting Help

- Use `/status` to check your configuration
- Run `klaude --help` for command options
- Check session files in `.klaude/sessions/` for debugging
- Create project-specific instructions in `CLAUDE.md`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "klaude-code",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "cli, ai, coding, assistant",
    "author": null,
    "author_email": "inspirepan <panjixiang65@gamil.com>",
    "download_url": "https://files.pythonhosted.org/packages/bf/b7/833ccd3859ec3ad17b4eb155abd27282229711e6c54ed4550198ee4c5943/klaude_code-0.1.19.tar.gz",
    "platform": null,
    "description": "# Klaude Code\n\nKlaude Code is a powerful CLI tool that provides an AI-powered coding assistant. It offers an interactive interface to Claude (and OpenAI models) with advanced coding capabilities including file manipulation, code editing, task automation, and more.\n\n## Features\n\n- **Interactive AI Assistant**: Chat with Claude or GPT models for coding help\n- **Multiple AI Providers**: Easy switching between Anthropic, OpenAI, DeepSeek, Gemini, and custom APIs\n- **Configuration Profiles**: Manage multiple API configurations with simple commands\n- **File Operations**: Read, write, edit, and search files with precision\n- **Code Refactoring**: Multi-file edits, pattern replacement, and automated refactoring\n- **Shell Integration**: Execute bash commands directly within the chat\n- **Task Management**: Built-in todo list for tracking coding tasks\n- **Session Persistence**: Resume conversations and maintain context across sessions\n- **MCP Support**: Extend functionality with Model Context Protocol servers\n- **Custom Commands**: Create reusable command patterns for common workflows\n- **Image Support**: View and analyze images with multimodal AI capabilities\n\n## Quick Start\n\n### Installation\n\n```bash\n# Install with pip\npip install klaude-code\n\n# Or install with uv (recommended)\nuv tool install klaude-code\n```\n\n### Basic Usage\n\n```bash\n# Start interactive mode\nklaude\n\n# Run a single command (headless mode)\nklaude --prompt \"Fix the type errors in main.py\"\n\n# Resume your last session\nklaude --continue\n\n# Choose from previous sessions\nklaude --resume\n```\n\n### Configuration\n\nKlaude Code supports multiple configuration profiles for different AI providers and settings:\n\n```bash\n# View all available configurations\nklaude config show\n\n# Edit default configuration\nklaude config edit\n# Or use the short form\nklaude edit\n\n# Create or edit named configurations. Any config_*.json file in ~/.klaude will be recognized as a configuration profile.\nklaude config edit anthropic    # Creates ~/.klaude/config_anthropic.json\nklaude edit openai              # Creates ~/.klaude/config_openai.json\nklaude edit deepseek            # Creates ~/.klaude/config_deepseek.json\n\n# Use a specific configuration\nklaude --config anthropic       # Use config_anthropic.json\nklaude -f openai               # Short form with -f flag\n```\n\n## Usage\n\n### Interactive Commands\n\nOnce in interactive mode, you can use various slash commands:\n\n- `/status` - Show current configuration and model info\n- `/clear` - Clear conversation history\n- `/compact` - Compact conversation to free up context\n- `/cost` - Show token usage and costs\n- `/theme` - Switch between light, dark, light_ansi, and dark_ansi themes\n- `/init` - Create a CLAUDE.md file for project-specific instructions\n- `/memory` - Manage project/user memory\n- `/save_custom_command` - Save conversation as reusable command\n\n### Input Modes\n\nSpecial prefixes activate different input modes:\n\n- **Bash Mode** (`!`): Execute shell commands\n  ```\n  ! git status\n  ! npm test\n  ```\n\n- **Plan Mode** (`*`): Enter planning interface for complex tasks\n  ```\n  * design the authentication system\n  ```\n\n- **Memory Mode** (`#`): Save instructions to memory\n  ```\n  # always use TypeScript strict mode\n  ```\n\n- **File Reference** (`@`): Reference files with auto-completion\n  ```\n  @main.py fix the syntax errors\n  ```\n\n- **Image Reference**: Paste images with Ctrl+V or reference image files\n  ```\n  [Image #1] what's in this screenshot?\n  @path/to/image.png explain this diagram\n  ```\n\n### Custom Commands\n\nCreate reusable command patterns in:\n- Project commands: `.claude/commands/`\n- Global commands: `~/.claude/commands/`\n\nExample custom command (`create_git_commit.md`):\n```markdown\n---\ndescription: Create a git commit with context analysis\n---\n\n## Context\n- Current git status: !`git status`\n- Current git diff: !`git diff HEAD`\n\n## Your task\nCreate a single git commit with a descriptive message.\n\nAdditional instructions: $ARGUMENTS\n```\n\nUse it as: `/create_git_commit add error handling`\n\n## Available Tools\n\nKlaude Code provides a comprehensive set of tools:\n\n### File Operations\n- **Read**: Read file contents with line numbers and view images\n- **Write**: Create or overwrite files\n- **Edit**: Make precise edits to specific lines\n- **MultiEdit**: Batch multiple edits to a single file\n\n### Search Tools\n- **Grep**: Search file contents using regex patterns\n- **Glob**: Find files by name patterns\n- **LS**: List directory contents\n\n### System Tools\n- **Bash**: Execute shell commands with timeout support\n- **TodoWrite/TodoRead**: Manage task lists\n- **Task**: Spawn sub-agents for complex operations\n\n## Usage Examples\n\n```bash\n# Quick configuration switching\nklaude -f anthropic         # Use Claude for architectural discussions\nklaude -f openai           # Switch to GPT for different perspectives  \nklaude -f deepseek         # Use DeepSeek for coding tasks\n\n# Refactor code with your preferred model\nklaude -f anthropic\n> refactor the authentication module to use JWT tokens\n\n# Fix failing tests\n> ! npm test\n> fix the failing tests\n\n# Search and replace\n> rename all instances of getUserData to fetchUserData\n\n# Create a new feature\n> implement user profile management with CRUD operations\n\n# Analyze images\n> @screenshot.png what UI components are shown here?\n> [paste image with Ctrl+V] explain this error message\n```\n\n## Session Management\n\nSessions are automatically saved and can be resumed:\n\n```bash\n# Start a new session\nklaude\n> implement user authentication\n\n# Later, continue the same session\nklaude --continue\n> add password reset functionality\n```\n\nSessions store:\n- Complete message history\n- Todo lists and their states\n- File tracking information\n- Working directory context\n\n## Debugging\n\n### Session Inspection\n\nSessions are stored in `.klaude/sessions/` with human-readable formats:\n\n1. **Metadata files** (`*.metadata.*.json`): Session info, todo lists, file tracking\n2. **Message files** (`*.messages.*.jsonl`): Complete conversation history\n\n### Viewing Sessions\n\n```bash\n# List all sessions with metadata\nklaude --resume\n\n# Manually inspect session files\ncd .klaude/sessions/\ncat *.metadata.*.json | jq .\n```\n\n### Session File Structure\n\nMetadata includes:\n- Session ID and timestamps\n- Working directory\n- Message count\n- Todo list with status\n- Tracked file modifications\n\nMessages are stored in JSONL format with:\n- Role (user/assistant/tool)\n- Content and tool calls\n- Timestamps and metadata\n\n## Requirements\n\n- Python 3.13 or higher\n- API key for Claude (Anthropic) or OpenAI\n- Unix-like environment (macOS, Linux, WSL)\n\n### Python Dependencies\n\nCore dependencies include:\n- `anthropic` - Claude API client\n- `openai` - OpenAI API client\n- `typer` - CLI framework\n- `rich` - Terminal formatting\n- `pydantic` - Data validation\n- `prompt-toolkit` - Input handling\n- `pillow` - Image processing\n- `pyperclip` - Clipboard operations\n\n## Model Context Protocol (MCP)\n\nEnable MCP servers for extended functionality:\n\n```bash\n# Start with MCP enabled\nklaude --mcp\n\n# Configure MCP servers\nklaude mcp edit\n```\n\nMCP allows integration with external tools and services beyond the built-in toolset.\n\n## Tips and Best Practices\n\n1. **Use Plan Mode** for complex tasks: `* plan the refactoring approach`\n2. **Track Changes**: The AI automatically tracks file modifications\n3. **Session Management**: Use `--continue` to maintain context across work sessions\n4. **Custom Commands**: Create project-specific commands for repetitive tasks\n5. **Context Window**: Use `/compact` when conversations get too long\n6. **Cost Tracking**: Monitor usage with `/cost` command\n7. **Image Analysis**: Copy screenshots to clipboard and paste with Ctrl+V for instant analysis\n8. **Multimodal Workflows**: Combine code and visual elements for comprehensive development\n\n## Command Line Options\n\n```bash\nklaude [OPTIONS] [PROMPT]\n\nOptions:\n  --continue, -c              Continue from the latest session\n  --resume, -r               Resume from a session\n  --prompt, -p               Run in headless mode\n  --config, -f TEXT          Use a specific config (e.g., 'anthropic' for ~/.klaude/config_anthropic.json)\n  --model TEXT              Override the configured model\n  --api-key TEXT             Override API key from config\n  --base-url TEXT            Override base URL from config\n  --max-tokens INTEGER       Override max tokens from config\n  --theme [light|dark|light_ansi|dark_ansi]  Override theme from config\n  --mcp, -m                  Enable Model Context Protocol\n  --logo                     Show ASCII Art logo\n```\n\n\n## Project Structure\n\n```\n.klaude/\n\u251c\u2500\u2500 config.json          # Global configuration\n\u251c\u2500\u2500 mcp_servers.json     # MCP server configs\n\u251c\u2500\u2500 commands/            # Custom commands\n\u251c\u2500\u2500 memory/              # Saved instructions\n\u2514\u2500\u2500 sessions/            # Conversation history\n```\n\n## Getting Help\n\n- Use `/status` to check your configuration\n- Run `klaude --help` for command options\n- Check session files in `.klaude/sessions/` for debugging\n- Create project-specific instructions in `CLAUDE.md`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Coding Agent CLI",
    "version": "0.1.19",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " ai",
        " coding",
        " assistant"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "295277565f37e188d3faf8d28bdc77f38ca05cdd022fd4beb054f884253748fb",
                "md5": "64da078bcde0c693d054a3b0f02fd182",
                "sha256": "9f9c56854f517f32759b9f74d59e8a15180064760e4bc092865207704641c38c"
            },
            "downloads": -1,
            "filename": "klaude_code-0.1.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64da078bcde0c693d054a3b0f02fd182",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 214935,
            "upload_time": "2025-08-04T03:06:28",
            "upload_time_iso_8601": "2025-08-04T03:06:28.830389Z",
            "url": "https://files.pythonhosted.org/packages/29/52/77565f37e188d3faf8d28bdc77f38ca05cdd022fd4beb054f884253748fb/klaude_code-0.1.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bfb7833ccd3859ec3ad17b4eb155abd27282229711e6c54ed4550198ee4c5943",
                "md5": "91a7451be9b1d0f603bf4b3bb15aad5a",
                "sha256": "f6a39b45aa5b016b31849c67a7fce89fe2d26f1d6b1024b494495287a8371993"
            },
            "downloads": -1,
            "filename": "klaude_code-0.1.19.tar.gz",
            "has_sig": false,
            "md5_digest": "91a7451be9b1d0f603bf4b3bb15aad5a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 154002,
            "upload_time": "2025-08-04T03:06:30",
            "upload_time_iso_8601": "2025-08-04T03:06:30.616332Z",
            "url": "https://files.pythonhosted.org/packages/bf/b7/833ccd3859ec3ad17b4eb155abd27282229711e6c54ed4550198ee4c5943/klaude_code-0.1.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-04 03:06:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "klaude-code"
}
        
Elapsed time: 3.21369s