klaude-code


Nameklaude-code JSON
Version 0.1.13 PyPI version JSON
download
home_pageNone
SummaryCoding Agent CLI
upload_time2025-07-12 06:52:01
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
- **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 src/main.py"

# Resume your last session
klaude --continue

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

### Configuration

Configure your API keys and preferences:

```bash
# Edit configuration
klaude config edit

# View current configuration
klaude config show
```

## 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
  ```
  @src/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
# Refactor code
> 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
  --model TEXT              Override the configured model
  --api-key TEXT             API key
  --api-key-env TEXT         Environment variable for API key
  --mcp                      Enable Model Context Protocol
  --theme [light|dark|light_ansi|dark_ansi]       Color theme
  --compact-mode             Minimal output mode
```

## 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/d9/aa/7e4e14a2b65b7f9b24abd9e318cac770acdc142ecce050967a948a3b2bdd/klaude_code-0.1.13.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- **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 src/main.py\"\n\n# Resume your last session\nklaude --continue\n\n# Choose from previous sessions\nklaude --resume\n```\n\n### Configuration\n\nConfigure your API keys and preferences:\n\n```bash\n# Edit configuration\nklaude config edit\n\n# View current configuration\nklaude config show\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  @src/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# Refactor code\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  --model TEXT              Override the configured model\n  --api-key TEXT             API key\n  --api-key-env TEXT         Environment variable for API key\n  --mcp                      Enable Model Context Protocol\n  --theme [light|dark|light_ansi|dark_ansi]       Color theme\n  --compact-mode             Minimal output mode\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.13",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " ai",
        " coding",
        " assistant"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "482f95947d704670d4bc0f814d3469def03c7e947841ed4dff0bd00641df449f",
                "md5": "0dfa36913ad0d57b7a3cc50653e2e886",
                "sha256": "c535671e7adaad72f232ce64fb85c05584c28e231975ce867d98826e3f767457"
            },
            "downloads": -1,
            "filename": "klaude_code-0.1.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0dfa36913ad0d57b7a3cc50653e2e886",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 195659,
            "upload_time": "2025-07-12T06:52:00",
            "upload_time_iso_8601": "2025-07-12T06:52:00.036708Z",
            "url": "https://files.pythonhosted.org/packages/48/2f/95947d704670d4bc0f814d3469def03c7e947841ed4dff0bd00641df449f/klaude_code-0.1.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d9aa7e4e14a2b65b7f9b24abd9e318cac770acdc142ecce050967a948a3b2bdd",
                "md5": "20988f3e75b7586389e34809462ea3d2",
                "sha256": "5383559de5655ae78fb5e6540d0fcb3fc88711a2cdf5fa6fea5ab7d70667cae3"
            },
            "downloads": -1,
            "filename": "klaude_code-0.1.13.tar.gz",
            "has_sig": false,
            "md5_digest": "20988f3e75b7586389e34809462ea3d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 139195,
            "upload_time": "2025-07-12T06:52:01",
            "upload_time_iso_8601": "2025-07-12T06:52:01.939076Z",
            "url": "https://files.pythonhosted.org/packages/d9/aa/7e4e14a2b65b7f9b24abd9e318cac770acdc142ecce050967a948a3b2bdd/klaude_code-0.1.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-12 06:52:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "klaude-code"
}
        
Elapsed time: 0.42088s