Skip to main content

Code Editing

PraisonAI provides a powerful code editing module for AI-powered code manipulation, inspired by Kilo Code’s architecture.

Installation

The code editing module is included with PraisonAI:

Quick Start

SEARCH/REPLACE Diff Format

The code editing module uses a SEARCH/REPLACE diff format for precise code modifications:

Line Number Hints

For faster matching in large files, use line number hints:

Available Tools

code_read_file

Read file contents with optional line range:

code_write_file

Create or overwrite a file:

code_apply_diff

Apply SEARCH/REPLACE diffs:

code_search_replace

Apply multiple search/replace operations:

code_list_files

List files in a directory:

code_execute_command

Execute shell commands:

Using with Agents

The code tools can be used directly with PraisonAI agents:

Features

Fuzzy Matching

The diff application uses fuzzy matching with Levenshtein distance:

Indentation Preservation

The module automatically preserves indentation when applying diffs:

Workspace Security

  • Path Traversal Protection: Prevents access outside workspace
  • Gitignore Support: Respects .gitignore patterns
  • Access Control: Configurable file access rules

Configuration

Set Workspace

Environment Variables

Module Structure