# AFT by cortexkit

> AFT gives coding agents a proper IDE and OS — symbol-aware edits, semantic search, code health, bash compression, background tasks, and PTY, backed by a Rust binary with tree-sitter parsing.

AFT (Agent File Tools) is an open-source Rust binary that acts as the "sensorimotor cortex" for coding agents, sitting between an agent's reasoning and a codebase to provide structured perception and precise action. Built by Ufuk Altinok under the CortexKit organization, it is licensed under MIT and available on GitHub. The project targets AI coding agents running on harnesses like OpenCode and Pi, replacing their built-in primitive file tools with tree-sitter-parsed, symbol-aware equivalents.

## What It Is

AFT is a plugin layer — not an agent itself — that upgrades the tools a coding agent uses to read and modify code. Instead of handing an agent raw `read`, `edit`, and `bash` commands that force it to consume whole files and burn tokens on scrolling text, AFT provides structured operations: outline a file by symbols, zoom into a function, search by semantic meaning, follow a call graph, and edit by symbol name rather than line number. The README describes this as giving the agent "the real thing" — an IDE and an OS — organized into three cortex regions: sensory (perceive), motor (act), and brainstem (stay alive).

## Architecture and Deployment Model

AFT ships as a Rust binary with thin TypeScript adapter packages per harness. The binary speaks a JSON-over-stdio request/response protocol. One persistent process per project root stays alive for the project's lifetime, shared across sessions, keeping parse trees warm while each session maintains its own isolated undo history.

- **Sensory tools**: `aft_outline`, `aft_zoom`, `aft_search` (hybrid semantic + lexical), `aft_callgraph`, `aft_inspect`, trigram-indexed `grep`/`glob`
- **Motor tools**: symbol-aware `edit`, `write`, `apply_patch`, `aft_refactor`, `aft_import`, `ast_grep_search`/`ast_grep_replace`
- **Brainstem tools**: background bash tasks, PTY sessions, multi-tier output compression, `aft_safety` undo stack with named checkpoints

Setup is a single command (`npx @cortexkit/aft@latest setup`) that auto-detects installed harnesses and configures each one. The binary is resolved from cache, npm platform packages, PATH, cargo install, or GitHub releases.

## Language Coverage

AFT supports over 20 languages with varying feature depth. TypeScript/TSX, JavaScript/JSX, Python, Rust, Go, C/C++/C#, Java/Kotlin, Swift, Ruby, PHP, Lua, Perl, Zig, Solidity, Vue, and others all support outline and edit. Semantic search (embedding-backed) covers most of these, with local, OpenAI-compatible, or Ollama embedding backends. AST structural search via `ast_grep` covers the majority of compiled and scripting languages. Indexes honor `.gitignore` and an optional `.aftignore`.

## Part of the CortexKit Family

AFT is one of three planned CortexKit plugins, each modeled on a brain region:

- **Magic Context** (hippocampus): self-managing context and long-term memory across sessions
- **AFT** (sensorimotor cortex): perceives code structure and acts on it precisely
- **Alfonso** (prefrontal cortex, coming soon): executive control, planning, and delegation

The README positions AFT as "1 of the 3 plugins you'll ever need."

## Update: v0.42.0

The latest release is v0.42.0, published on 2026-06-26, with the repository last pushed on 2026-06-29. The project was created in March 2026 and has accumulated 176 stars and 21 forks on GitHub. A full benchmark suite covering search latency, retrieval quality, bash-output token reduction, and end-to-end agent task success is described as in progress, with numbers to be published once methodology is finalized.

## Features
- Symbol-aware file outline (aft_outline) for any file, directory, or remote URL
- Function/class zoom with optional call graph annotations (aft_zoom)
- Hybrid semantic + lexical code search with local, OpenAI-compatible, or Ollama embedding backends (aft_search)
- Cross-workspace call graph traversal and impact analysis (aft_callgraph)
- On-demand codebase health report: LSP errors, TODOs, dead code, duplicates (aft_inspect)
- Trigram-indexed regex search and file discovery (grep/glob)
- Symbol-aware edit by name with fuzzy matching and batch/multi-file transactions
- Workspace-wide refactoring: symbol move, function extraction, inlining (aft_refactor)
- Language-aware import add, remove, and organize (aft_import)
- Structural AST search and replace with meta-variables (ast_grep_search/ast_grep_replace)
- Background bash tasks with status inspection, kill, and watch
- Multi-tier output compression for noisy CLI output
- PTY sessions for REPLs and interactive terminal apps
- Per-file undo stack with named checkpoints and restore (aft_safety)
- Auto-setup via npx with harness auto-detection
- Supports 20+ languages including TypeScript, Python, Rust, Go, Java, Swift, Solidity, and more
- Indexes honor .gitignore and .aftignore
- One persistent Rust binary process per project root, shared across sessions
- Configurable via aft.jsonc at user or project level

## Integrations
OpenCode, Pi (badlogic/pi-mono coding agent), Magic Context (CortexKit), Ollama (embedding backend), OpenAI-compatible embedding APIs, LSP servers (auto-install), tree-sitter (25 languages), ast-grep, sccache

## Platforms
MACOS, LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v0.42.0

## Links
- Website: https://github.com/cortexkit/aft
- Documentation: https://github.com/cortexkit/aft/blob/main/docs/tools.md
- Repository: https://github.com/cortexkit/aft
- EveryDev.ai: https://www.everydev.ai/tools/aft-cortexkit
