Skip to main content

Autonomous Software Improvement — AST-precise code editing agent with verification gates (CLI + MCP server)

Project description

asicode

Autonomous Software Improvement — local safe patch runner and code editing tool: an AI-powered assistant for reading, analyzing, and modifying codebases with deterministic AST-level operations, transparent shell execution, and multi-language support.

Features

  • Multi-language code editing: Python, TypeScript, JavaScript, Go, Java, Kotlin, Rust, and more via tree-sitter AST parsing
  • AST-precise modifications: Edit symbols by name, insert/delete lines by anchor, apply typed AST operations (Python)
  • Vector search & RAG: Semantic code search with FAISS + sentence-transformers embedding
  • Structural analysis: Dead code detection, duplicate finding, unused import scanning, contradictory logic detection
  • Interactive CLI: Rich terminal interface with prompt-toolkit, command history, completion, and multi-line editing
  • Headless & automation modes: single-shot runs (asi -p), JSON/NDJSON output, and multi-agent orchestration (--orchestrate)
  • Design chat: Persistent conversation session with auto-compression and insight management
  • Shell shim layer: macOS/Linux compatibility layer for BSD-style command-line tools

Quick Start

# Recommended for CLI use: pipx installs into an isolated env and puts
# `asi` on your PATH, no venv activation needed
pipx install 'asicode @ git+https://github.com/socialherb/asicode.git'

# Or plain pip (inside a venv of your choice):
pip install git+https://github.com/socialherb/asicode.git

# Or with all features:
pip install 'asicode[all] @ git+https://github.com/socialherb/asicode.git'

# Start the interactive CLI
asi

Installation Options

# Core (includes tree-sitter AST parsing — one package covers 300+ languages)
pip install asicode

# With RAG (vector search for code)
pip install 'asicode[rag]'

# With browser automation
pip install 'asicode[browser]'

# Development tools
pip install 'asicode[dev,lint]'

# Everything
pip install 'asicode[all]'

Architecture

asicode/
├── asi.py              # Interactive CLI (REPL)
├── external_llm/           # Core engine
│   ├── agent/              # Agent loop, tool handlers, verification
│   ├── languages/          # Multi-language providers (Python, TS, Go, etc.)
│   ├── editor/             # Code editing (AST, anchor, text, patch)
│   └── repl/               # Design chat session management
├── scripts/                # Lint/reachability guards (CI)
└── tests/                  # Test suite (unit + integration)

Key Concepts

Agent Tool Loop

Every request runs through a single LLM tool-use loop: the model reads, searches, and edits the repository through typed tools, and each write is followed by verification. Headless mode (asi -p) and orchestration mode (--orchestrate, which decomposes a request and dispatches it to parallel sub-agent workers) drive the same loop.

Deterministic Editing

All code modifications are validated through multiple layers:

  • Syntax validation (AST parse gate)
  • Structural analysis (dependency graph, import consistency)
  • Verification loop (edit → verify → repair if needed)

Requirements

Python

  • Python 3.10+
  • macOS or Linux (BSD shim layer for macOS)

Bundled with the install

  • ruff — the linter used for post-edit verification (F821 undefined-name checks). It is a core dependency, so pip install asicode installs it automatically. No separate step needed.
  • tree-sitter — powers AST-based symbol/call/import detection for precise multi-language editing. The core install ships tree-sitter-language-pack (~2 MB) — a single package with full prebuilt-wheel platform coverage that covers every supported language out of the box (it also pulls in the tree-sitter core library automatically).

Recommended system tools

asicode degrades gracefully when these are missing, but installing them improves results:

Tool Used for Required when Behavior if absent
git Version control, diff/apply, change-impact analysis Almost always Core features expect git
ripgrep (rg) Fast code search (grep tool) Recommended Falls back to system grep
node TypeScript/JavaScript editing & validation Only when editing JS/TS JS/TS features disabled
gofmt / golangci-lint Go formatting & linting Only when editing Go Go linting disabled
docker Sandboxed web search (SearXNG) Only for isolated web search Web search disabled

Install git and ripgrep on macOS:

brew install git ripgrep

ripgrep can also be installed via the optional search extra (pip install asicode is unaffected if it fails — the grep fallback applies):

pip install 'asicode[search]'

Prebuilt wheels exist for macOS-arm64 and linux-x86_64; other platforms build from source.

Development

# Clone and install in editable mode
git clone <repo-url>
cd asicode
pip install -e '.[dev,lint,rag]'

# Run tests
pytest

# Run linting
ruff check
ruff format --check

# Run type checking
pyright

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asicode-0.2.6.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asicode-0.2.6-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file asicode-0.2.6.tar.gz.

File metadata

  • Download URL: asicode-0.2.6.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for asicode-0.2.6.tar.gz
Algorithm Hash digest
SHA256 8cc0c7224f49daf34b313fdc641d00286907e316c9e147e7ef6595b499e492c5
MD5 8d4b73046d882d7ac35bcabfa7139c53
BLAKE2b-256 5fa25aaf4ec075619439155f81b010496ab7b43b2bee83e3644b6b499d42183f

See more details on using hashes here.

File details

Details for the file asicode-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: asicode-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for asicode-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 039acb99ba95346363d76783f909162d36792d181626642d60c6e5e37cf125b0
MD5 95adf7467f284e2f3a0c68a017b922d7
BLAKE2b-256 6ca91fe30e9dbdc5b87944310ea38515728e9bedad3a5a8f5d22d86806c43e61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page