Agent Reference
https://aiiware.com/agent.mdQuick Start
Get up and running in under a minute.
1. Install
One command installs Node.js and the Aii CLI — Docker only if you later choose the local path:
curl -fsSL https://aiiware.com/install.sh | bashOr if you already have Node.js 18+:
npm install -g @aiiware/aii2. Go
aiiOn first run, Aii shows a choice screen — start free on Aii Cloud (no Docker, no key), or set up your own key or a local Ollama model. The provider wizard only runs if you choose the local path; the first-run choice takes it from here.
Update
aii installSelf-updates to the latest version. Use aii install 0.13.10 to pin a specific version.
What Can You Do With It?
Real commands, real results. Here's what Aii does in your terminal:
Interactive Mode
aiiJust type aii to start an interactive session. Ask questions, edit files, run commands, and use slash commands — all in a persistent conversation with full project context.
Understand Any Codebase
aii explain how this project worksDrop into any repo and get an instant architectural overview — files, patterns, dependencies, all synthesized from the actual code.
Fix Bugs Autonomously
aii fix the failing tests --autoPoint Aii at a problem and let it work. It reads files, edits code, runs tests, and iterates until the fix passes.
AI-Powered Git Workflow
aii run git commit -yAnalyzes your staged changes and generates a conventional commit message automatically.
Process Anything via Pipe
git diff | aii summarize the changesPipe any output to Aii for instant analysis — logs, diffs, error traces, API responses.
Autonomous Loops
aii loop "improve test coverage" --verify "npm test" --budget 5Set a goal, define exit conditions, and let the agent work continuously until the task is done or the budget is hit.
CLI Reference
The Aii CLI is an autonomous AI agent for your terminal. It reads files, writes code, runs commands, and searches the web — all through natural language.
Commands
| Command | Description |
|---|---|
aii | Interactive agent mode (default) |
aii [query] | Execute query with agent capabilities |
config | Configuration (init, show, validate, set, model, provider, apikey) |
sessions | Session management (list, info, resume, rename, delete) |
worktree | Git worktree management (create, list, remove, clean) |
mcp | MCP server management (list, catalog, install, add, remove, enable, disable, status, test, list-tools, update) |
prompt | Prompt library (list, show, use, create) |
run git commit | AI-generated git commit message |
run git pr | AI-generated pull request |
loop | Autonomous agent loop with configurable exit conditions (max iterations, budget, verify command, duration) |
persona | Persona management (install, use, list, status) |
skill | Skill management (list, info, install) |
soul | Soul management (help, show, switch) |
telegram | Telegram bot channel (start, pair, list, status, unpair) |
doctor | System health check |
Agent Tools
Tools the agent uses autonomously during execution:
| Tool | Description |
|---|---|
Read | Read file contents from the filesystem |
Write | Write content to a file (creates or overwrites) |
Edit | Make targeted edits to existing files |
Glob | Find files matching a pattern (e.g., **/*.ts) |
Grep | Search file contents with regex patterns |
Bash | Execute shell commands with permission checks |
WebSearch | Search the web for current information |
WebFetch | Fetch and parse content from a URL |
Task | Delegate subtasks to subagents |
Skill | Invoke a loaded skill by name |
Options
| Option | Description |
|---|---|
--clean | Just the result, no metadata |
--standard | Result + execution metrics |
--thinking | Full reasoning and context |
-v, --verbose | Verbose output (alias for --thinking) |
-d, --debug | Debug output |
--model <model> | Override LLM model |
--host <host:port> | API server host:port |
-y, --yes | Auto-confirm shell commands |
--offline | Offline mode (no web/MCP) |
-i, --interactive | Interactive chat mode |
-c, --continue-chat <id> | Continue chat session |
-n, --new-chat | Force new chat session |
--auto | Auto-approve all tool actions |
-q, --quiet | Minimal output (no banner) |
--no-colors | Disable colored output |
--no-emojis | Disable emoji icons |
--no-animations | Disable animations |
--no-streaming | Disable streaming output |
--show-tokens | Show token usage |
--show-cost | Show cost estimates |
Examples
# Start interactive agent session
aii
# Ask a question
aii explain what git rebase does
# Execute a task with agent capabilities
aii refactor this file to use async/await
# Auto mode (auto-approve all actions)
aii fix the failing tests --auto
# Pipe content for processing
cat error.log | aii summarize the errors
# Generate git commit message
aii run git commitSlash Commands
Available inside interactive agent mode. Type /help to see all commands.
| Command | Aliases | Description |
|---|---|---|
/help | /? /h | Show available commands |
/agents | — | List available subagents |
/aii [question] | — | Ask about Aii features, commands, and usage (built-in skill) |
/auto | — | Toggle auto-approve mode |
/clear | — | Clear conversation history |
/commit | — | Generate conventional commit message (built-in skill) |
/context | /ctx | Show context window usage and status |
/diff | — | Show recent file changes |
/exit | /quit /q | End the session and exit |
/history | — | Show conversation history summary |
/hooks | — | Show configured hooks |
/init | — | Generate AGENTS.md for this project |
/loop | — | Start autonomous agent loop |
/pause [duration] | — | Pause loop after current tool call (e.g., /pause 5m) |
/resume | — | Resume a paused loop |
/stop | — | Stop loop after current iteration |
/note <text> | — | Queue guidance note for the loop agent |
/now <text> | — | Inject urgent note immediately (between tool calls) |
/mcp | — | MCP server management |
/memory | /mem | Show or switch instruction files (AGENTS.md) |
/mode [mode] | — | Switch mode (normal, auto, plan) |
/model [name] | /m | Show or switch the current model |
/new | — | Start a new conversation |
/plan | — | Toggle plan mode (research only) |
/provider [name] | /p | Show or switch the LLM provider |
/persona [action] | — | Manage personas (install, use, list, status) |
/soul [name] | — | Show or switch the active soul (personality) |
/theme [name] | — | Show or switch the color theme |
/review-pr | — | Review a pull request (built-in skill) |
/sessions | — | List and manage server sessions |
/skills | — | Show, manage, or install skills |
/stats | — | Show session statistics |
/tasks | — | List and inspect subagent tasks |
/undo | — | Undo the last file change |
/worktree | /wt | Manage git worktrees |
Telegram Bot Channel
Connect Aii to Telegram as a bot — chat with your AI agent from anywhere, on any device.
| Command | Description |
|---|---|
telegram start [name] | Start a bot (default if no name) |
telegram pair <name> <token> | Pair a new bot with its token |
telegram list | List all configured bots |
telegram status [name] | Show bot status |
telegram unpair [name] | Remove a bot |
# Pair a bot with your Telegram token
aii telegram pair mybot 7123456789:AAF...xyz
# Pair with a specific project directory
aii telegram pair mybot TOKEN --project /path/to/project
# Start the bot
aii telegram start mybot
# List all configured bots
aii telegram listArchitecture
All Aii clients connect to a single local server that routes requests to your configured LLM provider.
Aii CLI Aii VSCode Aii Chrome
v0.14.9 v0.8.3 v0.5.7
| | |
+-----------------+-----------------+
|
WebSocket (localhost:26169)
|
+--------+--------+
| Aii Server |
| Docker · :26169 |
+--------+--------+
|
+-----------------+-----------------+
| | |
Anthropic OpenAI Google ...
(Claude) (GPT) (Gemini)Soul System
Each Aii agent has a soul — a personality that shapes how it communicates. Souls define tone, vocabulary, and interaction style without changing what the agent can do. Built on the open SoulSpec v0.4 standard.
Built-in Souls
| Soul | Style | Description |
|---|---|---|
thinker | Patient and collaborative | Thinks out loud, walks through reasoning step by step (default) |
doer | Direct and efficient | Leads with the answer — every sentence earns its place |
coder | Pair-programming partner | Reads your codebase, references specific files and lines |
Each soul is defined by four files: SOUL.md (personality and values), STYLE.md (communication rules), IDENTITY.md (who the agent is), and AGENTS.md (operational workflow and tool behaviors). A soul.json manifest ties them together with metadata and versioning. These are resolved automatically — you just pick a name.
Switching Souls
Switch souls from the CLI or mid-session with a slash command. Your preference persists to ~/.aii/config.yaml and applies across all channels.
| Command | Description |
|---|---|
soul help | Show available souls and current selection |
soul show | Show the active soul |
soul switch <name> | Switch to a different soul |
# Show available souls
aii soul help
# Switch to doer
aii soul switch doer
# Switch to coder
aii soul switch coder
# Switch back to thinker (default)
aii soul switch thinker
# During an interactive session
/soul doer
/soul coderPersonas
A persona bundles soul + skills + hooks + instructions + theme into a single installable package. One command to load a complete AI engineering identity. Built on SoulSpec v0.4 and the Agent Skills standard.
Commands
| Command | Description |
|---|---|
aii persona install <name> | Install from GitHub, GitLab, or local path |
aii persona use <name> | Activate a persona (loads all components) |
aii persona use --none | Deactivate and restore standalone config |
aii persona list | List installed personas |
aii persona status | Show active persona component details |
aii persona help | Show help |
Install Sources
# From GitHub
aii persona install github:aiiware/aii-personas/aiiware-full-stack-engineer
# From GitLab
aii persona install gitlab:owner/repo/persona-dir
# From local directory
aii persona install ./my-personaOfficial Personas
| Persona | Soul | Skills |
|---|---|---|
| full-stack-engineer | Concise, opinionated, test-first | code-review, api-design, debugging |
| code-reviewer | Constructive, severity-based | review-checklist, security-scan |
| mentor | Patient, uses analogies | explain-like-five, pair-programming, code-walkthrough |
Browse and install from github.com/aiiware/aii-personas
Create Your Own
A persona is a directory with a persona.json manifest at its root, plus skill, soul, hook, and theme files. See the official personas for examples.
my-persona/
├── persona.json # Manifest (name, version, skills, soul, hooks)
├── skills/ # Bundled skills (SKILL.md files)
├── souls/ # Soul definition (SoulSpec v0.4)
├── hooks/ # Quality gates (hooks.json + scripts)
└── themes/ # Visual themeSkills System
Skills are reusable prompt templates that extend the agent with domain-specific capabilities. They can be built-in, installed from GitHub, or created as custom project-level skills.
Built-in Skills
| Skill | Usage | Description |
|---|---|---|
/aii | /aii [question] | Self-serve help — ask about Aii features, commands, and usage |
/commit | /commit [--dry-run] [type] | Analyze staged changes and generate a conventional commit message |
/explain | /explain [topic] | Explain code, architecture, or concepts in the current project |
/review-pr | /review-pr [pr-number] | Review a pull request against a comprehensive checklist (requires gh CLI) |
# Ask about Aii features
/aii how do loops work?
/aii what commands are available?
# Generate a commit message from staged changes
/commit
# Preview without committing
/commit --dry-run
# Explain code or concepts
/explain this function
/explain how the auth module works
# Review current PR
/review-pr
# Review a specific PR by number
/review-pr 42Installing Skills
Install skills from GitHub repositories or manage installed skills. Install accepts GitHub URLs in any format — repo paths, blob URLs, and bare repo URLs all work.
# Install a skill from GitHub
/skills install owner/repo/skill-name
# List all available skills
/skills
# Reload skills after changes
/skills reload
# Uninstall a skill
/skills uninstall skill-nameCustom Skills
Create custom skills by adding a SKILL.md file in your project's .aii/skills/ directory or globally in ~/.aii/skills/.
---
name: my-skill
description: What this skill does
argument_hint: "[options]"
allowed_tools:
- Bash
- Read
- Grep
---
# My Custom Skill
Instructions for the agent when this skill is invoked...
## Steps
1. First do this
2. Then do thatMCP Integration
The Model Context Protocol (MCP) connects Aii to external tools and services. Install servers from the built-in catalog or add custom ones to extend what the agent can do.
Commands
| Command | Description |
|---|---|
mcp list | List all configured MCP servers |
mcp catalog | Browse available servers from catalog |
mcp install <name> | Install a server from the catalog |
mcp add <name> <command> [args...] | Add a custom MCP server |
mcp remove <name> | Remove a server |
mcp enable <name> | Enable a disabled server |
mcp disable <name> | Disable a server (keeps config) |
mcp status [name] | Check server configuration status |
mcp test <name> | Test if a server can start |
mcp list-tools [name] | List tools from server(s) |
mcp update <name> | Show update instructions |
mcp help | Show help message |
# Browse and install from catalog
aii mcp catalog
aii mcp install filesystem
# Add a custom server
aii mcp add myserver npx my-mcp-server --port 3000
# Check status of all servers
aii mcp status
# List available tools
aii mcp list-toolsCatalog
The MCP catalog provides a curated list of servers that can be installed with a single command. Server configurations are stored in ~/.aii/mcp_servers.json.
Autonomous Loops
Autonomous loops let the agent work continuously on a task until a completion condition is met. Configure exit conditions to control when the loop stops. Steer the agent mid-run with pause, resume, stop, note, and now commands — feedback appears in a dedicated toast zone, not mixed into agent output.
CLI Usage
# Basic loop with max iterations
aii loop "refactor all components to use hooks" --max 20
# Loop with verification command
aii loop "fix all test failures" --verify "npm test"
# Loop with budget limit
aii loop "improve test coverage" --budget 5
# Loop with duration limit
aii loop "clean up technical debt" --duration 30m
# Loop with completion promise
aii loop "migrate to TypeScript" --promise "ALL_FILES_MIGRATED"
# Combine multiple conditions
aii loop "fix all lint errors" --verify "npm run lint" --max 50 --budget 3
# Interactive: start from a session
/loop "optimize database queries" --max 10 --verify "npm test"Exit Conditions
| Condition | Flag | Description |
|---|---|---|
Max iterations | --max <N> | Stop after N iterations (hard cap: 1000) |
Verify command | --verify "<cmd>" | Stop when shell command exits with code 0 |
Promise string | --promise "<text>" | Stop when agent output contains exact string |
Budget | --budget <$N> | Stop when estimated cost exceeds N USD |
Duration | --duration <N>[s|m|h] | Stop after wall-clock time limit |
Input tokens | --input-tokens-limit <N> | Stop when cumulative input tokens exceeded |
Output tokens | --output-tokens-limit <N> | Stop when cumulative output tokens exceeded |
Mid-Loop Controls
Type these commands while the loop is running to steer the agent:
| Command | Description |
|---|---|
/stop | Graceful exit after the current iteration finishes |
/pause [duration] | Pause after current tool call (e.g., /pause 5m, /pause 2h). Timed pauses auto-resume. |
/resume | Resume a paused loop |
/stats | Live view of iteration count, tokens, cost, and elapsed time |
/note <text> | Queue guidance for the agent — consumed one per iteration with visual feedback |
/now <text> | Inject an urgent note immediately — the agent sees it at the next tool call boundary |
Pause takes effect between tool calls — the agent finishes its current tool, then waits. The status bar shows real-time telemetry including pause state with countdown timer.
/note vs /now — /note queues guidance for the next iteration. /now delivers it immediately within the current turn, so the agent can pivot without waiting. If the agent has no more tool calls left, /now falls back to the next iteration — your note is never lost.
Session Management
Sessions persist across channels — start a conversation in the CLI, continue it in VSCode, and pick it up again from Telegram. All sessions are managed by the Aii Server.
CLI Commands
| Command | Description |
|---|---|
sessions list | List active sessions with ID, name, channel, turns, cost |
sessions info <id> | Show full session details (model, tokens, cost, files modified) |
sessions resume <id> | Resume a session in interactive agent mode |
sessions rename <id> <name> | Rename a session |
sessions delete <id> | Delete a session |
# List all sessions
aii sessions list
# Filter by project
aii sessions list --project /path/to/project
# Show session details
aii sessions info abc123
# Resume a previous session
aii sessions resume abc123Slash Commands
# List sessions from inside a chat
/sessions list
# View session info
/sessions info abc123
# Resume a session
/sessions resume abc123
# Rename current session
/sessions rename abc123 my-feature-workHook System
Hooks let you run custom logic in response to agent events — validate tool calls before they execute, log actions, or enforce project rules.
Events
| Event | Description |
|---|---|
PreToolUse | Before a tool is executed (can block) |
PostToolUse | After a tool completes |
Stop | Agent decides to exit |
SubagentStart | Subagent begins execution |
SubagentStop | Subagent finishes execution |
Hook Types
| Type | Description | Decision |
|---|---|---|
script | Execute a shell command | Exit code 0 = allow, exit code 2 = block |
prompt | LLM evaluates a prompt | LLM determines allow or block |
Configuration
Configure hooks in .aii/hooks.json (project-level) or ~/.aii/hooks.json (global).
{
"hooks": [
{
"event": "PreToolUse",
"type": "script",
"command": "node .aii/validate-tool.js",
"timeout": 10000
},
{
"event": "PostToolUse",
"type": "script",
"command": "echo \"Tool $TOOL_NAME completed\""
}
]
}Worktrees
Git worktrees let you work on multiple branches simultaneously in isolated directories. Aii manages worktrees automatically — creating branches, tracking changes, and cleaning up when done.
CLI Commands
| Command | Description |
|---|---|
worktree create [name] | Create a new worktree with a dedicated branch |
worktree list | List all worktrees with branch, path, and status |
worktree remove <name> | Remove a named worktree |
worktree clean | Remove all clean worktrees (keeps those with uncommitted changes) |
# Create a worktree for a new feature
aii worktree create my-feature
# List all active worktrees
aii worktree list
# Clean up finished worktrees
aii worktree cleanSlash Commands
| Command | Description |
|---|---|
/worktree create [name] | Create a new worktree |
/worktree list | List worktrees |
/worktree resume <name> | Switch to a worktree |
/worktree commit [name] | Commit changes in a worktree |
/worktree diff [name] | Show changes in a worktree |
/worktree merge [name] | Merge a worktree branch |
/worktree remove <name> | Remove a worktree |
Alias: /wt can be used instead of /worktree.
Subagent System
Subagents are specialized AI workers that the agent delegates tasks to. Each subagent runs in its own context with a focused purpose, keeping the main conversation clean and enabling parallel work.
Built-in Agents
| Type | Purpose | Permission Mode |
|---|---|---|
explore | Exploration and research tasks | Read-only |
plan | Planning and architecture tasks | Read-only |
review | Code review and analysis | Read-only |
code | Code implementation and execution | Default |
# In interactive mode, view available agents
/agents
# View running and completed tasks
/tasks
# View details of a specific task
/tasks task-idCustom Agents
Define custom agent types with an AGENT.md file in .aii/agents/ or ~/.aii/agents/.
---
name: my-agent
description: Specialized agent for specific tasks
model_tier: standard
permission_mode: default
max_iterations: 50
allowed_tools:
- Read
- Grep
- Glob
- Bash
---
# My Custom Agent
You are a specialized agent that...
## Guidelines
- Focus on specific domain
- Follow these patternsLLM Configuration
Aii supports 8 LLM providers. Switch between them at any time.
| Provider | Config Value | Env Variable |
|---|---|---|
| Anthropic (Claude) | anthropic | ANTHROPIC_API_KEY |
| OpenAI (GPT) | openai | OPENAI_API_KEY |
| Google (Gemini) | gemini | GEMINI_API_KEY |
| DeepSeek | deepseek | DEEPSEEK_API_KEY |
| Moonshot | moonshot | MOONSHOT_API_KEY |
| Ollama (local) | ollama | OLLAMA_HOST |
| OpenRouter | openrouter | OPENROUTER_API_KEY |
| ZAI | zai | ZAI_API_KEY |
API Key Management
Use aii config apikey to set, list, or remove provider API keys. Keys are stored securely in ~/.aii/secrets.yaml with 0600 permissions.
# Set API key inline
aii config apikey anthropic sk-ant-xxx
# Set API key with masked input prompt
aii config apikey openai
# Set Ollama URL (Ollama uses URL instead of API key)
aii config apikey ollama http://localhost:11434
# List all configured providers
aii config apikey list
# Remove a provider key
aii config apikey remove deepseekSupported providers: anthropic, openai, gemini, deepseek, moonshot, zai, ollama, openrouter. You can also use environment variables:
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...Ollama (Local Models)
Ollama runs AI models locally on your machine. When you switch to Ollama, the CLI automatically queries your installed models and presents an interactive selector — no need to memorize model names.
# Switch to Ollama — auto-detects installed models
aii config provider ollama
# CLI queries localhost:11434 and shows:
# Select an Ollama model:
# ► llama3.1:8b
# mistral:7b
# codellama:13b
# gpt-oss:20b
# gemma2:9bIf Ollama is not running or has no models installed, the CLI falls back to a default and provides guidance. To configure a custom Ollama URL (e.g., remote server), use aii config apikey ollama http://your-host:11434.
Configuration
Aii configuration lives in ~/.aii/. Project-level settings go in .aii/ inside your project root.
| File | Path | Purpose |
|---|---|---|
| Config | ~/.aii/config.yaml | Main configuration (provider, model, API URL) |
| Secrets | ~/.aii/secrets.yaml | API keys (permissions: 0600) |
| MCP servers | ~/.aii/mcp_servers.json | MCP server definitions |
| AGENTS.md | .aii/AGENTS.md | Project instructions (loaded per-project) |
| Hooks | .aii/hooks.json | Project-level hooks |
# ~/.aii/config.yaml
llm:
provider: anthropic
model: claude-haiku-4-5
temperature: 0.7
max_tokens: 4000
api:
url: http://localhost:26169
streaming:
enabled: true
output_modes:
default: standard # clean | standard | thinkingAGENTS.md
Create an AGENTS.md file in your project root to give Aii project-specific context. Run /init inside a chat session to generate one automatically.
aii
# Inside the session:
/init # Generate AGENTS.md
/memory list # Show loaded instruction filesEnvironment Variables
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY | Anthropic (Claude) API key |
OPENAI_API_KEY | OpenAI (GPT) API key |
GEMINI_API_KEY | Google (Gemini) API key |
DEEPSEEK_API_KEY | DeepSeek API key |
AII_LLM_PROVIDER | Override LLM provider |
AII_MODEL | Override model |
AII_API_URL | Override server URL (default: localhost:26169) |
Troubleshooting
Use the built-in diagnostics and debug flags to identify and resolve issues quickly.
aii doctor
Run aii doctor to check system health. It runs 5 checks and reports status for each:
| Check | What It Verifies |
|---|---|
Config | Config file exists and is readable |
API Key | API key configured for the active provider |
Aii Server | Server is running and responding on the configured port |
MCP Servers | MCP configuration is valid |
Node.js | Node.js >= 18 installed |
Aii Doctor v0.14.9
Config .............. OK (~/.aii/config.yaml)
API Key ............. OK (google/gemini-2.5-flash)
Aii Server .......... OK (127.0.0.1:26169)
MCP Servers ......... OK (4 configured)
Node.js ............. OK (v24.7.0)
All checks passed.Common Issues
| Problem | Solution |
|---|---|
| Server not running | Run docker start aii-server or aii doctor to check status |
| API key not found | Run aii config apikey <provider> to set your key |
| Connection refused | Check that port 26169 is not blocked and Docker is running |
| Model not available | Run aii config model to see available models for your provider |
| MCP server fails to start | Run aii mcp test <name> to diagnose the issue |
| Ollama not detected | Ensure Ollama is running (ollama serve) and accessible at the configured URL |
| Permission denied on secrets | Check file permissions: chmod 600 ~/.aii/secrets.yaml |
For detailed debugging, use the --debug or --verbose flags with any command to see additional diagnostic output.
VSCode Extension
AI-powered code generation, commit messages, and interactive chat directly in your editor. Install from Marketplace
| Command | Description | Shortcut (Mac) | Shortcut (Win/Linux) |
|---|---|---|---|
| Generate Code | Generate code from selection or prompt | ⌘⇧G | Ctrl+Shift+G |
| Generate Commit | AI-generated git commit message | ⌘⇧C | Ctrl+Shift+C |
| Open Chat | Open Aii chat in sidebar | ⌘⇧A | Ctrl+Shift+A |
| Explain Code | Explain selected code | — | — |
| Translate Text | Translate selected text | — | — |
Chrome Extension
Side panel chat with full page context awareness. Install from Chrome Web Store
- Intelligent page context awareness — AI understands what you're reading
- Real-time streaming responses
- Slash commands — type
/to access 80+ AI prompts - Selection quick actions — select text to translate, explain, or summarize
- Custom prompts — create and organize your own AI prompts
- Conversation history saved locally
- Download as Image — export AI responses as PNG
- Privacy-focused — no data sent to third parties