@aiiware/aii 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +206 -183
  2. package/bin/aii +1487 -1450
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @aiiware/aii
2
2
 
3
- **AI-powered CLI assistant** with autonomous tool execution. An intelligent agent that can read, write, search, and execute commands in your terminal.
3
+ **AI-powered CLI agent** with autonomous tool execution, multi-agent delegation, and multi-channel access. An intelligent assistant that can read, write, search, and execute commands in your terminal — or through Telegram.
4
4
 
5
5
  ## Installation
6
6
 
@@ -19,13 +19,13 @@ npm install -g @aiiware/aii
19
19
  # Start interactive agent mode
20
20
  aii
21
21
 
22
- # Or run a single query
22
+ # Run a single task
23
23
  aii "explain what this project does"
24
24
 
25
25
  # Pipe content for processing
26
26
  cat error.log | aii "summarize the errors"
27
27
 
28
- # Auto-approve tool execution
28
+ # Auto-approve all tool executions
29
29
  aii --auto
30
30
  ```
31
31
 
@@ -40,212 +40,211 @@ aii "your task" # Run single task and exit
40
40
 
41
41
  ### Available Tools
42
42
 
43
- | Tool | Description |
44
- |---------------|--------------------------------|
45
- | **Read** | Read file contents |
46
- | **Write** | Create or overwrite files |
47
- | **Edit** | Make targeted edits to files |
48
- | **Glob** | Find files by pattern |
49
- | **Grep** | Search code with regex |
50
- | **Bash** | Execute shell commands |
51
- | **WebSearch** | Search the web |
52
- | **WebFetch** | Fetch and parse web pages |
43
+ | Tool | Description |
44
+ |---------------|------------------------------------------|
45
+ | **Read** | Read file contents |
46
+ | **Write** | Create or overwrite files |
47
+ | **Edit** | Make targeted edits to files |
48
+ | **Glob** | Find files by pattern |
49
+ | **Grep** | Search code with regex |
50
+ | **Bash** | Execute shell commands |
51
+ | **WebSearch** | Search the web |
52
+ | **WebFetch** | Fetch and parse web pages |
53
+ | **Task** | Delegate work to specialized subagents |
53
54
 
54
55
  ### Interactive Commands
55
56
 
56
- In agent mode, use these commands:
57
-
58
57
  ```text
59
58
  /help Show available commands
60
59
  /clear Clear conversation history
61
- /history Show conversation history
62
- /stats Show session statistics (tokens, cost)
60
+ /new Start a fresh conversation
61
+ /history Show conversation summary
63
62
  /model <model> Switch LLM model
64
63
  /provider <name> Switch LLM provider
65
64
  /context View context window usage
65
+ /stats Show session statistics (tokens, cost)
66
66
  /init Generate AGENTS.md for your project
67
- /init --with-hooks Generate AGENTS.md + hooks.json template
68
- /init help Show /init usage and options
69
- /hooks help Show /hooks usage and options
70
67
  /memory View loaded project instructions
71
- /memory reload Hot-reload instructions without restart
72
68
  /hooks View configured hooks
73
- /hooks reload Hot-reload hooks without restart
74
69
  /skills List available skills
75
- /skills help Show skills management commands
76
- /skills reload Re-discover skills without restarting
77
70
  /commit Generate commit message and commit
71
+ /loop Start autonomous agent loop
72
+ /mcp Manage MCP servers
73
+ /agents List available subagents
74
+ /tasks Inspect subagent task executions
75
+ /diff Show recent file changes
76
+ /undo Undo the last file change
77
+ /mode Show or switch operation mode (normal/auto/plan)
78
78
  /exit Exit the session
79
79
  ```
80
80
 
81
81
  ### Keyboard Shortcuts
82
82
 
83
- | Key | Action |
84
- |------------|----------------------------|
85
- | `Enter` | Submit input |
86
- | `Esc` | Cancel current request |
87
- | `Ctrl+C` | Exit immediately |
88
- | `Up/Down` | Navigate input history |
89
- | `Tab` | Autocomplete commands |
83
+ | Key | Action |
84
+ |------------|-------------------------------------|
85
+ | `Enter` | Submit input |
86
+ | `Esc` | Cancel current request |
87
+ | `Ctrl+C` | Exit immediately |
88
+ | `Ctrl+D` | Graceful exit with session summary |
89
+ | `Ctrl+L` | Clear conversation |
90
+ | `Up/Down` | Navigate input history |
91
+ | `Tab` | Select from command menu |
90
92
 
91
- ## Output Modes
93
+ ## Multi-Agent Subagents (v0.10)
92
94
 
93
- ```bash
94
- aii "query" --clean # Just the result
95
- aii "query" --standard # Result + metrics (default)
96
- aii "query" --thinking # Full reasoning chain
95
+ Delegate complex tasks to specialized subagents that run in parallel within the same session:
96
+
97
+ ```text
98
+ > analyze my codebase architecture and review the auth module
99
+
100
+ ● Running 2 agents...
101
+ ├─ Explore (Analyze codebase architecture) · 8 tool uses
102
+ │ └ Running (5s)
103
+ └─ Review (Review auth module) · 3 tool uses
104
+ └ Running (2s)
97
105
  ```
98
106
 
99
- ## Prompt Templates
107
+ ### Built-in Subagents
100
108
 
101
- Use pre-built templates for common tasks:
109
+ | Subagent | Purpose |
110
+ |-------------|----------------------------------------|
111
+ | **explore** | Fast codebase exploration (read-only) |
112
+ | **plan** | Architecture and implementation design |
113
+ | **review** | Code quality analysis |
102
114
 
103
- ```bash
104
- aii prompt list # List available prompts
105
- aii prompt show <name> # Show prompt details
106
- aii prompt use <name> --var value # Use a prompt template
107
- ```
115
+ ### Custom Subagents
108
116
 
109
- ## Configuration
117
+ Define your own subagents in `.aii/agents/` with custom system prompts, model tiers, and tool access levels.
118
+
119
+ ### Task Inspection
110
120
 
111
121
  ```bash
112
- aii config show # Show current configuration
113
- aii config validate # Validate configuration
114
- aii config set <key> <value> # Set a configuration value
115
- aii config model <model> # Change LLM model
116
- aii config provider <provider> # Change LLM provider
122
+ /tasks # List all task executions with IDs
123
+ /tasks <id> # Show full transcript for a specific task
117
124
  ```
118
125
 
119
- ### Config Files
120
-
121
- Configuration is stored in `~/.aii/`:
126
+ ## Telegram Bot Channel (v0.10)
122
127
 
123
- **config.yaml** - Main configuration:
128
+ Access your AI agent remotely through Telegram — works anywhere, no port forwarding needed:
124
129
 
125
- ```yaml
126
- llm:
127
- provider: anthropic
128
- model: claude-sonnet-4
129
- temperature: 0.7
130
-
131
- api:
132
- url: http://localhost:26169
133
- ```
130
+ ```bash
131
+ # Pair a Telegram bot
132
+ aii telegram pair mybot <bot-token>
134
133
 
135
- **secrets.yaml** - API keys:
134
+ # Start the bot listener
135
+ aii telegram start mybot
136
136
 
137
- ```yaml
138
- anthropic_api_key: sk-ant-...
139
- openai_api_key: sk-...
140
- deepseek_api_key: sk-...
137
+ # Manage multiple bots
138
+ aii telegram list
139
+ aii telegram status mybot
140
+ aii telegram unpair mybot
141
141
  ```
142
142
 
143
- Or use environment variables: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `DEEPSEEK_API_KEY`
143
+ **Bot commands in Telegram**: `/start`, `/help`, `/reset`, `/status`, `/compact`, `/model`
144
144
 
145
- ## CLI Options
145
+ ## MCP Integration (v0.10)
146
146
 
147
- | Option | Description |
148
- |----------------------|----------------------------------|
149
- | `--auto` | Auto-approve all tool executions |
150
- | `--clean` | Clean output mode |
151
- | `--standard` | Standard output mode (default) |
152
- | `--thinking` | Show full reasoning |
153
- | `--model <model>` | Override LLM model |
154
- | `--host <host:port>` | API server host |
155
- | `--no-streaming` | Disable streaming output |
156
- | `--quiet` | Minimal output |
157
- | `--verbose` | Show detailed stats |
158
- | `--no-context` | Disable context management |
147
+ Extend the agent with external tools via Model Context Protocol:
159
148
 
160
- ## Context Window Management (v0.3.0)
149
+ ```bash
150
+ /mcp catalog # Browse available servers
151
+ /mcp install github # One-command install from catalog
152
+ /mcp add myserver cmd args... # Add custom server
153
+ /mcp list # Show configured servers
154
+ /mcp remove myserver # Remove a server
155
+ ```
161
156
 
162
- Prevents "token limit exceeded" errors in long conversations with intelligent auto-summarization.
157
+ Once installed, MCP tools are available to the agent automatically.
163
158
 
164
- **Status Bar Indicator**: Shows real-time usage with color-coded alerts (🟢 🟡 🔴)
159
+ ## Autonomous Loops (v0.7)
165
160
 
166
- **Dynamic Thresholds**: Automatically adjusts based on each model's output capacity
161
+ Run the agent in a continuous loop for long-running autonomous tasks:
167
162
 
168
- - Claude Sonnet (32% output) → 63% critical threshold
169
- - Gemini Flash (3% output) → 92% critical threshold
163
+ ```bash
164
+ # Start a loop from CLI
165
+ aii loop --verify "npm test" --duration 5m
170
166
 
171
- **Auto-Summarization**: Older messages summarized when reaching critical threshold (~70%), preserving recent ~30K tokens in full
167
+ # Or start within a session
168
+ /loop --max 10 --promise "All tests passing"
169
+ ```
172
170
 
173
- **Commands**:
171
+ **Options**:
174
172
 
175
- - `/context` - View detailed usage breakdown
176
- - `/context clear` - Manually trigger summarization
173
+ | Option | Description |
174
+ |----------------------|------------------------------------------|
175
+ | `--max <N>` | Maximum iterations |
176
+ | `--verify "<cmd>"` | Run verification command after each step |
177
+ | `--promise "<text>"` | Stop when output contains this text |
178
+ | `--budget <$N>` | Cost limit |
179
+ | `--duration <time>` | Time limit (e.g., `30m`, `2h`) |
177
180
 
178
- ## Project Instructions (v0.5.0)
181
+ ## LLM Providers
179
182
 
180
- Teach the agent your project's conventions. Create an `AGENTS.md` file in your project root, and the agent will automatically learn your coding standards, commands, and rules.
183
+ Aii supports multiple LLM providers. Switch anytime with `/model` or `/provider`:
181
184
 
182
- ### Quick Setup
185
+ | Provider | Models | Setup |
186
+ | --- | --- | --- |
187
+ | **Anthropic** | Claude Sonnet, Opus, Haiku | API key |
188
+ | **OpenAI** | GPT-4o, GPT-4, o1, o3 | API key |
189
+ | **Google** | Gemini Pro, Flash | API key |
190
+ | **DeepSeek** | DeepSeek Chat, Coder | API key |
191
+ | **Ollama** | Llama, Mistral, and more | Local, no API key |
192
+ | **OpenRouter** | 300+ models via single API key | API key |
183
193
 
184
194
  ```bash
185
- # Auto-generate AGENTS.md by analyzing your project
186
- /init
187
-
188
- # View what instructions are loaded
189
- /memory
195
+ # Switch provider and model mid-session
196
+ /model claude-sonnet-4
197
+ /model ollama/llama3.1:8b
198
+ /provider openrouter
190
199
  ```
191
200
 
192
- The `/init` command detects your language, framework, build commands, and generates a customized `AGENTS.md`. Edit it to add your team's conventions.
193
-
194
- ### Supported Files
201
+ The provider is auto-detected from model names (e.g., `gpt-4o` routes to OpenAI).
195
202
 
196
- The agent discovers instruction files in this priority order:
203
+ ## Context Window Management (v0.3)
197
204
 
198
- - `AII.md` or `AGENTS.md` in project root
199
- - `~/.aii/AGENTS.md` for global preferences
205
+ Prevents "token limit exceeded" errors with intelligent auto-summarization:
200
206
 
201
- ### Example AGENTS.md
207
+ - **Status bar** shows real-time context usage with color-coded alerts
208
+ - **Auto-summarization** triggers when approaching the limit, preserving recent context
209
+ - **Dynamic thresholds** adjust per model's output capacity
202
210
 
203
- ```markdown
204
- # My Project
205
-
206
- ## Commands
207
- - Build: `npm run build`
208
- - Test: `npm test`
209
- - Lint: `npm run lint`
210
-
211
- ## Coding Standards
212
- - Use TypeScript strict mode
213
- - Prefer async/await over callbacks
214
- - Maximum line length: 100
215
-
216
- ## Safety Rules
217
- Never modify without asking:
218
- - .env files
219
- - Database migrations
211
+ ```bash
212
+ /context # View detailed usage breakdown
213
+ /context clear # Manually trigger summarization
220
214
  ```
221
215
 
222
- ## Hooks (v0.5.0)
216
+ ## Project Instructions (v0.5)
223
217
 
224
- Extend agent behavior with custom scripts. Create `.aii/hooks.json` to run scripts before/after tool execution:
218
+ Teach the agent your project's conventions with `AGENTS.md`:
225
219
 
226
220
  ```bash
227
- # Generate a hooks template
228
- /init --with-hooks
221
+ /init # Auto-generate by analyzing your project
222
+ /init --with-hooks # Also generate hooks.json template
223
+ /memory # View loaded instructions
224
+ /memory reload # Hot-reload without restart
225
+ ```
229
226
 
230
- # View configured hooks
231
- /hooks
227
+ The agent discovers `AII.md` or `AGENTS.md` in your project root, plus `~/.aii/AGENTS.md` for global preferences.
232
228
 
233
- # Show usage and options
234
- /hooks help
235
- ```
229
+ ## Hooks (v0.5)
236
230
 
237
- Hooks let you add validation, logging, or approval gates. See the [hooks documentation](https://aiiware.com/docs/hooks) for details.
231
+ Run custom scripts before/after tool execution:
238
232
 
239
- ## Skills (v0.6.0)
233
+ ```bash
234
+ /init --with-hooks # Generate hooks template
235
+ /hooks # View configured hooks
236
+ /hooks reload # Hot-reload without restart
237
+ ```
238
+
239
+ Hook types: `PreToolUse`, `PostToolUse`, `Stop`, `Iteration`
240
240
 
241
- Skills are reusable agent prompts that extend Aii with specialized capabilities.
241
+ ## Skills (v0.6)
242
242
 
243
- ### Invoking Skills
243
+ Extend the agent with reusable skill packages:
244
244
 
245
- **Natural language** -- just describe what you want, and the agent detects the right skill:
245
+ **Natural language** the agent auto-detects the right skill:
246
246
 
247
247
  ```text
248
- > explain what's an LLM
249
248
  > commit my changes
250
249
  > review the latest PR
251
250
  ```
@@ -254,83 +253,107 @@ Skills are reusable agent prompts that extend Aii with specialized capabilities.
254
253
 
255
254
  ```bash
256
255
  /commit # Generate commit message and execute
257
- /commit --dry-run # Preview commit message only
258
256
  /review-pr 123 # Review a pull request
259
257
  ```
260
258
 
261
- ### Managing Skills
259
+ **Managing skills**:
262
260
 
263
261
  ```bash
264
- /skills # List all skills (built-in, project, user)
265
- /skills help # Show all skills management commands
266
- /skills reload # Re-discover skills without restarting
262
+ /skills # List all skills
263
+ /skills install aiiware/skills/code-review # Install from GitHub
264
+ /skills install aiiware/skills/refactor --user # Install globally
265
+ /skills uninstall code-review # Remove a skill
266
+ /skills reload # Re-discover skills
267
267
  ```
268
268
 
269
- ### Built-in Skills
269
+ **Creating skills** — add `SKILL.md` files in `.aii/skills/`:
270
270
 
271
- | Skill | Description |
272
- |--------------|------------------------------------------|
273
- | `/commit` | Generate conventional commit messages |
274
- | `/review-pr` | Review PRs with quality checklist |
271
+ ```markdown
272
+ ---
273
+ name: my-skill
274
+ description: Does something useful
275
+ allowed-tools: Bash Read Grep
276
+ ---
275
277
 
276
- ### Installing Skills
278
+ Instructions for the agent...
279
+ Use $ARGUMENTS for user input.
280
+ ```
277
281
 
278
- Install skills from GitHub repositories:
282
+ ## Configuration
279
283
 
280
284
  ```bash
281
- # Shorthand format (owner/repo/skill-name)
282
- /skills install aiiware/skills/code-review # Install to project (.aii/skills/)
283
- /skills install aiiware/skills/refactor --user # Install globally (~/.aii/skills/)
285
+ aii config show # Show current configuration
286
+ aii config validate # Validate configuration
287
+ aii config set <key> <value> # Set a configuration value
288
+ aii config model <model> # Change LLM model
289
+ aii config provider <provider> # Change LLM provider
290
+ ```
284
291
 
285
- # Absolute GitHub URL format
286
- /skills install https://github.com/aiiware/skills/tree/main/code-review
287
- /skills install https://github.com/aiiware/skills/tree/main/refactor --user
292
+ Configuration is stored in `~/.aii/`:
288
293
 
289
- # Uninstall
290
- /skills uninstall code-review
291
- ```
294
+ **config.yaml** — Main configuration:
292
295
 
293
- **Shorthand format**: `owner/repo/skill-name` resolves to `github.com/owner/repo/skill-name/SKILL.md`
296
+ ```yaml
297
+ llm:
298
+ provider: anthropic
299
+ model: claude-sonnet-4
300
+ temperature: 0.7
294
301
 
295
- **URL format**: Use absolute GitHub URLs when you need to install from a specific branch or path.
302
+ api:
303
+ url: http://localhost:26169
304
+ ```
296
305
 
297
- ### Creating Custom Skills
306
+ **secrets.yaml** API keys:
298
307
 
299
- Create skills in `.aii/skills/my-skill/SKILL.md`:
308
+ ```yaml
309
+ anthropic_api_key: sk-ant-...
310
+ openai_api_key: sk-...
311
+ deepseek_api_key: sk-...
312
+ ```
300
313
 
301
- ```markdown
302
- ---
303
- name: my-skill
304
- description: Does something useful
305
- allowed-tools: Bash Read Grep
306
- ---
314
+ Or use environment variables: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `DEEPSEEK_API_KEY`
307
315
 
308
- # My Skill
316
+ ## CLI Options
309
317
 
310
- Instructions for the agent...
311
- Use $ARGUMENTS for user input.
312
- ```
318
+ | Option | Description |
319
+ |----------------------------|----------------------------------|
320
+ | `--auto` | Auto-approve all tool executions |
321
+ | `--model <model>` | Override LLM model |
322
+ | `--provider <provider>` | Override LLM provider |
323
+ | `--host <host:port>` | API server host |
324
+ | `-c, --continue-chat <id>` | Continue a previous session |
325
+ | `-n, --new-chat` | Force a new session |
326
+ | `--offline` | Disable web and MCP tools |
327
+ | `--clean` | Clean output mode |
328
+ | `--standard` | Standard output mode (default) |
329
+ | `--thinking` | Show full reasoning |
330
+ | `--no-streaming` | Disable streaming output |
331
+ | `-q, --quiet` | Minimal output |
332
+ | `-y, --yes` | Auto-confirm shell commands |
313
333
 
314
334
  ## System Commands
315
335
 
316
336
  ```bash
317
337
  aii doctor # System health check
338
+ aii stats # Usage analytics (models, cost)
318
339
  aii --help # Show help
319
340
  aii --version # Show version
320
341
  ```
321
342
 
322
343
  ## Features
323
344
 
324
- - **Autonomous Agent**: Executes multi-step tasks with tool use
325
- - **Real-time Streaming**: Token-by-token response display
326
- - **Interactive Mode**: Multi-turn conversations with full context
327
- - **Tool Execution**: Read, write, search, and run commands
328
- - **Multiple Providers**: Claude, GPT, Gemini, DeepSeek
329
- - **Prompt Templates**: Pre-built templates for common tasks
330
- - **Project Instructions**: Teach the agent your conventions with AGENTS.md
331
- - **Skills System**: Extend with reusable agent skills, invokable via slash commands or natural language
332
- - **Input History**: Navigate previous inputs with arrow keys
333
- - **Cancellation**: Press Esc to cancel any request
345
+ - **Autonomous Agent** Executes multi-step tasks with tool use
346
+ - **Multi-Agent Delegation** Parallel subagents for complex tasks
347
+ - **Telegram Access** Use your agent remotely via Telegram bots
348
+ - **MCP Integration** Extend with external tools via Model Context Protocol
349
+ - **Autonomous Loops** Continuous agent execution with verification and budgets
350
+ - **Multiple Providers** Claude, GPT, Gemini, DeepSeek, Ollama, OpenRouter
351
+ - **Real-time Streaming** Token-by-token response display
352
+ - **Context Management** Auto-summarization prevents token limit errors
353
+ - **Project Instructions** Teach the agent your conventions with AGENTS.md
354
+ - **Skills System** Extend with reusable skills, invokable via commands or natural language
355
+ - **Hooks** — Custom scripts for validation, logging, and approval gates
356
+ - **Session Persistence** — Continue previous conversations with `--continue-chat`
334
357
 
335
358
  ## Links
336
359