> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Features Overview

> AI-powered code editing and external CLI tool integrations for PraisonAI

# Code Features

PraisonAI provides powerful code editing capabilities and integrations with external AI coding CLI tools.

## Features

<CardGroup cols={2}>
  <Card title="Code Editing" icon="pen-to-square" href="/docs/code/editing">
    AI-powered code editing with SEARCH/REPLACE diff format, fuzzy matching, and workspace security
  </Card>

  <Card title="External Agents" icon="robot" href="/docs/code/external-agents">
    Integrate Claude Code, Gemini CLI, Codex CLI, and Cursor CLI as agent tools
  </Card>

  <Card title="Claude Code" icon="message-bot" href="/docs/code/claude-code">
    Integration with Anthropic's Claude Code CLI for AI-powered coding tasks
  </Card>

  <Card title="Gemini CLI" icon="google" href="/docs/code/gemini-cli">
    Integration with Google's Gemini CLI for code analysis and generation
  </Card>

  <Card title="Codex CLI" icon="openai" href="/docs/code/codex-cli">
    Integration with OpenAI's Codex CLI for non-interactive code execution
  </Card>

  <Card title="Cursor CLI" icon="cursor" href="/docs/code/cursor-cli">
    Integration with Cursor's CLI for headless code automation
  </Card>
</CardGroup>

## Quick Start

### Code Editing Tools

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai.code import (
    set_workspace,
    code_read_file,
    code_write_file,
    code_apply_diff,
    code_execute_command,
    CODE_TOOLS
)

# Set the workspace
set_workspace("/path/to/project")

# Read a file
content = code_read_file("src/main.py")

# Apply a diff
diff = """
<<<<<<< SEARCH
def old_function():
    pass
=======
def new_function():
    return "updated"
>>>>>>> REPLACE
"""
result = code_apply_diff("src/main.py", diff)
```

### External CLI Integrations

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai.integrations import (
    ClaudeCodeIntegration,
    GeminiCLIIntegration,
    CodexCLIIntegration,
    CursorCLIIntegration
)

# Create an integration
claude = ClaudeCodeIntegration(workspace="/path/to/project")

# Execute a coding task
result = await claude.execute("Refactor the auth module")

# Use as an agent tool
from praisonai import Agent
tool = claude.as_tool()
agent = Agent(tools=[tool])
```

## Performance

All integrations are designed with zero performance impact:

* **Lazy Loading**: Modules are only imported when used
* **Availability Caching**: CLI availability checks are cached
* **Async Execution**: Non-blocking subprocess execution
* **Import Time**: \< 1ms verified in tests

## CLI Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Use external agents from CLI
praisonai "Refactor the code" --external-agent claude
praisonai "Analyze codebase" --external-agent gemini
praisonai "Fix bugs" --external-agent codex
praisonai "Add tests" --external-agent cursor
```
