Getting Started

Zap is a single Rust binary — no Python venv, no Node, no Docker. Install it and run it from any directory.

< 10 ms
Cold start
~9 MB
Binary size
0
Runtime deps
1

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Restart your terminal, or run source ~/.cargo/env.

2

Install zap

cargo install zap-coding-agent
3

Set your API key

# Add to ~/.zshrc export ANTHROPIC_API_KEY=sk-ant-...

Or configure Gemini, OpenAI, or a local model — see Configuration.

4

Run

cd your-project && zap

Type /init on first use to build the code index and generate a project summary.

Prefer a pre-built binary? Download from releases ↗

1

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env
2

Install zap

cargo install zap-coding-agent
3

Set your API key

# Add to ~/.bashrc or ~/.zshrc export ANTHROPIC_API_KEY=sk-ant-...
4

Run

cd your-project && zap

Pre-built binary available on the releases page ↗

1

One-line install (PowerShell)

irm https://raw.githubusercontent.com/zap-coding-agent/zap-coding-agent/main/install.ps1 | iex

Downloads and installs the pre-built binary. No Rust required.

2

Set your API key

# PowerShell — add to $PROFILE for persistence $env:ANTHROPIC_API_KEY = "sk-ant-..."
3

Run

cd your-project; zap

Prefer Rust? cargo install zap-coding-agentget Rust here ↗

Recommended: run /init after installing.

This builds the AST code index and generates a project summary. It takes 10–30 seconds and runs once per project. With the index active, zap resolves symbol locations from .zap/code.db instead of grepping — typically 3–5 fewer tool calls per task, and no duplicate files or invented patterns.

After big refactors, run /index to rebuild. See Code Indexing ↓ for how this works and a real-world example.

Configuration

All settings live in ~/.agent.toml. Create the file if it doesn't exist — zap reads it on every startup.

Minimal config
# ~/.agent.toml model = "claude-sonnet-4-6" [anthropic] api_key = "sk-ant-..." # or use ANTHROPIC_API_KEY env var
All options
# ~/.agent.toml model = "claude-sonnet-4-6" mode = "ask" # ask | auto skill_paths = ["~/.claude/skills", "~/.zap/skills"] [anthropic] api_key = "sk-ant-..." [gemini] api_key = "AIza..." [openai] api_key = "sk-..." base_url = "https://api.openai.com/v1" # override for local models [deepseek] api_key = "sk-..."
Tip: Set mode = "auto" to let zap run tools without asking for confirmation each time. Useful for trusted projects.

Project Init

Run /init once in a new project and zap goes from blank-slate to fully context-aware in about 30 seconds. It builds the code index, reads your source files, and writes persistent knowledge files the agent loads on every future session.

~30s
Time to full context
4 files
Written automatically
0
Manual steps after
What /init does

Detects your stack

Identifies language and framework from manifests (Cargo.toml, package.json, pom.xml) and fires the right skill automatically.

Builds the code index

Runs tree-sitter across your repo and writes the AST symbol index to .zap/code.db. The model queries what exists before writing anything new.

Writes project knowledge

Asks the LLM to read your source and fill in ZAP.md — build commands, architecture, key files, do-not-touch list.

Files created
FileWhat it containsLoaded when
ZAP.mdProject overview, build/test commands, architecture, do-not-touch listEvery session
.zap/understanding.mdModule map, data flows, non-obvious patterns, constraintsEvery session
.zap/context.mdLast session: goal, files touched, what's next (auto-updated on exit)Session start
.zap/session_log.mdHistory of all past sessions indexed by dateOn request
Example ZAP.md output
## Overview Order service — handles order lifecycle (create, fulfil, cancel). ## Build & Test mvn clean install && mvn test ## Architecture - OrderController → REST handlers - OrderService → business logic, calls OrderRepository - OrderRepository → JPA, Postgres via spring-data ## Do Not Touch - LegacyOrderMapper.java — deprecated, backwards compat only
After /init: Every future session starts informed. The agent already knows your build commands, architecture, and what you worked on last time. You never re-explain the project.

Skill-First Context

Skills are plain markdown files that zap injects into the context window before the model sees your message. The key insight: only relevant skills fire. A greeting costs 31 tokens. A Rust question gets the Rust skill injected automatically.

How it works
"hi, how are you?" no skills(31 tokens)
"refactor UserStore to use channels" ▶ rust(+650 tokens)
"add a useEffect to fetch user data" ▶ react(+422 tokens)
"write a test for the login handler" ▶ rust ▶ testing(+890 tokens)
Skill types
Type When it fires Example
Core Every message, always injected CLAUDE.md, project context
Trigger When your message matches a keyword trigger Rust, React, Python, testing skills
Skill file format

Skills are markdown files with an optional YAML frontmatter block. Files without frontmatter are always-on Core skills.

--- name: rust description: Rust coding conventions and best practices trigger: ["rust", "cargo", "tokio", "async"] --- # Rust - Prefer `Result<T, E>` over panic for recoverable errors - Use `clippy` for lints — treat warnings as errors in CI - Async: use `tokio::spawn` for concurrent tasks...
Where to put skills

Project skills

Drop .md files in .zap/skills/ inside your project. Checked in with your repo — shared with your team.

Global skills

Put skills in ~/.zap/skills/ or configure skill_paths in ~/.agent.toml to point at any directory.

Cross-agent compatibility

Skills created for Claude Code or Gemini work in zap. Point skill_paths at ~/.claude/skills to share them automatically.

# ~/.agent.toml skill_paths = ["~/.claude/skills", "~/.zap/skills"]
Pro tip: Use /skills in a session to see which skills are loaded and which triggered on the last message.

Code Indexing

Zap builds an AST-level symbol index of your project using tree-sitter and stores it in a local SQLite database at .zap/code.db. The model can query it to find what already exists before deciding what to create.

Building the index
# Run once per project, or after large refactors /init

Takes 10–30 seconds for medium projects. The index is gitignored by default — it's a local cache, not a committed artifact.

What's indexed

Symbols

Functions, structs, enums, traits, impls, classes, and methods — with their file path, line number, and signature.

Files

Every source file with its symbol count and last-indexed timestamp.

Languages

Rust, TypeScript, JavaScript, Python, Go, Java — and more via tree-sitter grammars.

How the model uses it

The model queries the index directly with SQLite. No fuzzy search, no hallucination — it either finds the symbol or it doesn't.

-- Find a symbol by name SELECT path, line, kind, signature FROM symbols WHERE name LIKE '%UserStore%' COLLATE NOCASE LIMIT 20; -- List all functions in a file SELECT name, line, signature FROM symbols WHERE path LIKE '%user_store%' AND kind = 'function' ORDER BY line;
Fewer tool calls per task

Without an index, an agent must grep through files to find where a symbol lives — that's multiple tool calls before it can even start. With the index built, zap resolves it in one SQL query.

Without /init (no index)
# 3–5 tool calls to find one symbol search_code("ProviderEntry") → too many results, grep again search_code("ProviderEntry struct") → found hint, read the file read_file("src/session/commands/provider.rs") → got the definition
With /init (index active)
# 1 SQL query, exact line number find_definition("ProviderEntry") → src/session/commands/provider.rs:31 src/tui/turn_handler.rs:82 # Two copies found — the duplication # is visible immediately
Real-world example: In a live code review, zap (with index) identified that the same 13-provider list was duplicated across two files — and flagged it as a Phase 0 refactor risk. Claude Code (without index, no grep) missed it entirely. See the full case study →

Context Visibility

Zap shows you exactly what's in the context window — token counts per message, which skills fired, and total usage. You can inspect, manage, and trim the context without starting a new session.

Commands
Command What it does
/context List all messages with their index and token count
/context drop 3 Remove message at index 3 (keeps the rest)
/context drop 3-7 Remove messages 3 through 7
/context clear Wipe the entire context — keeps skills and system prompt
Example output
[0] system 1,889 tokens (rust skill injected) [1] user 42 tokens "refactor UserStore to use channels" [2] assistant 630 tokens [3] user 28 tokens "looks good — add tests" [4] assistant 412 tokens ────────────────────────────────── total 3,001 tokens of 200,000 available
Why this matters: Most agents let the context balloon silently. When you're 180,000 tokens in and the model starts confusing earlier code with newer changes, you now have a scalpel instead of a restart button.

Casual Messages

Not every message is a coding task. When you greet zap or ask something unrelated to your project, it skips skill injection entirely — saving the tokens for when they count.

Casual message
"hi there" 31 tokens
"what's the weather?" 36 tokens
"thanks!" 28 tokens
Coding message
"fix the async error" ▶ rust · 650 tokens
"add a loading state" ▶ react · 422 tokens
"write unit tests" ▶ rust ▶ test · 890t

The classifier runs locally and adds zero latency — it's a keyword heuristic, not a model call. It errs on the side of injecting skills when uncertain.

Dynamic MCP Loading

Zap supports the Model Context Protocol. MCP servers start pending — their tool schemas don't enter the context until explicitly needed. No 10,000-token schema dump on every turn.

Configuration

Zap reads MCP config from ~/.zap/mcp.json (global) and .mcp.json (project-local). Both use the same Claude Code-compatible format.

// ~/.zap/mcp.json { "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"] }, "postgres": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres"], "env": { "DATABASE_URL": "postgresql://localhost/mydb" } } } }
How it differs from other agents

Other agents

Dump all MCP tool schemas into every context window at startup — even tools you never call.

Zap

Servers start idle. Schemas enter context only when the model decides to call that tool — keeping baseline cost near zero.

Compatibility: If you already have ~/.claude/mcp.json or a Claude Code MCP config, zap reads the same format. No migration needed.

Multi-Provider

Zap works with every major AI provider — and local models. Switch mid-session without restarting.

Claude Anthropic — claude-sonnet-4-6, claude-opus-4-7, haiku-4-5
Gemini Google — gemini-2.5-pro, gemini-2.5-flash
OpenAI GPT-4o, GPT-4o-mini, o3
DeepSeek deepseek-chat, deepseek-reasoner
LM Studio Any local model via OpenAI-compatible endpoint
Ollama llama3, mistral, codestral, and more
Switching providers
# Switch model mid-session /model gemini-2.5-pro # Or set a default in config model = "gemini-2.5-flash" # ~/.agent.toml
Local models (LM Studio / Ollama)
# ~/.agent.toml — point at any OpenAI-compatible server [openai] api_key = "lm-studio" base_url = "http://localhost:1234/v1" model = "lmstudio-community/Meta-Llama-3.1-8B-Instruct-GGUF"

Security Boundary

Zap is explicit about what it touches. Every shell command and file write is shown before it runs. You confirm — or deny — each action.

Zero telemetry

No usage data, no crash reports, no analytics. Your code and queries stay between you and your chosen model provider.

Keys stay local

API keys live in ~/.agent.toml or environment variables. Never logged, never sent anywhere other than the provider API.

Ask mode default

Tool calls (file edits, shell commands) require confirmation by default. Switch to auto only for trusted projects.

Modes
mode = "ask" # default: confirm every tool call mode = "auto" # run tools without prompting (trusted projects)
MIT License

Zap is open source under the MIT License. Read the code, fork it, audit it. The binary you run is built from the public source.

Session Memory

Zap keeps a running log of what was worked on and which files were touched. When you start a new session, the model has context from previous ones — without bloating the live context window.

How it works

.zap/context.md

Last session's work, files touched, and what's next. Updated by zap at the end of each session.

.zap/session_log.md

A brief history of past sessions — goal and files per session. Grows incrementally, never overwrites.

Project memory file

You can also create a CLAUDE.md (or .zap/PROJECT.md) with permanent project-level context that fires on every message as a Core skill.

# CLAUDE.md — project context, always injected # My Project This is a Rust web server using Axum and SQLx. Postgres 15 runs locally on port 5432. Tests use testcontainers — don't mock the database.
Tip: Keep CLAUDE.md concise. It fires on every message — every token in it is spent whether the model needs it or not. Put language-specific context in trigger skills instead.

Autonomous Mode

/goal <condition> runs turns automatically until the model signals it's done or a turn limit is reached. Use it for multi-step tasks you'd otherwise have to shepherd turn-by-turn.

How it works
# Run until done, up to 20 turns (default) /goal add pagination to the GET /orders endpoint and write tests # Set a custom turn limit /goal fix all clippy warnings --max 10 # Stop mid-flight /goal stop

The model runs tool calls autonomously each turn. When it's finished it ends its response with ✓ DONE and the loop stops. The sidebar shows the goal condition, current turn, and elapsed time while it runs. Ctrl+C cancels at any point.

Good for

Multi-file refactors, adding full feature layers (controller + service + tests), fixing all lints, running a test suite and fixing failures.

Permission mode

Goal mode respects your current permission mode. Use /mode auto before /goal to let it run without confirmation prompts on every tool call.

Tip: Be specific about the done condition. "Refactor auth module" is vague — "refactor auth module so all tests pass and cargo clippy has zero warnings" gives the model a clear signal to stop.

Commands Reference

Type any command at the zap prompt. Tab-completion is available for all slash commands.

Command Description
/initBuild (or rebuild) the code index for the current project
/skillsList loaded skills and which triggered last
/contextShow context window with token counts per message
/context drop NDrop message at index N
/context drop N-MDrop messages from index N through M
/context clearClear all messages (keeps skills and system prompt)
/model <name>Switch model for the current session
/provider <name>Switch AI provider mid-session
/mode askRequire confirmation for every tool call
/mode autoRun tools without confirmation prompts
/helpShow all available commands
/exitEnd the session (Ctrl+C also works)