aia 1.1.0 → 2.0.0.0.pre.alpha

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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +5 -1
  3. data/.loki +231 -0
  4. data/.quality/flay_baseline.txt +1 -0
  5. data/.quality/flog_baseline.txt +29 -0
  6. data/.quality/reek_baseline.txt +80 -0
  7. data/.rubocop.yml +116 -0
  8. data/.version +1 -1
  9. data/CHANGELOG.md +266 -42
  10. data/IMPLEMENTATION_PLAN.md +506 -0
  11. data/README.md +266 -238
  12. data/Rakefile +118 -5
  13. data/architecture_review.md +314 -0
  14. data/bin/aia +16 -0
  15. data/docs/AGENTS.md +40 -0
  16. data/docs/advanced-prompting.md +67 -3
  17. data/docs/cli-reference.md +312 -56
  18. data/docs/configuration.md +130 -19
  19. data/docs/contributing.md +56 -2
  20. data/docs/directives-reference.md +593 -78
  21. data/docs/faq.md +85 -3
  22. data/docs/guides/available-models.md +1 -1
  23. data/docs/guides/basic-usage.md +6 -6
  24. data/docs/guides/chat.md +40 -16
  25. data/docs/guides/crew.md +239 -0
  26. data/docs/guides/executable-prompts.md +1 -1
  27. data/docs/guides/index.md +1 -0
  28. data/docs/guides/models.md +15 -0
  29. data/docs/index.md +29 -2
  30. data/docs/installation.md +44 -17
  31. data/docs/mcp-integration.md +40 -0
  32. data/docs/prompt_management.md +85 -86
  33. data/docs/security.md +47 -0
  34. data/docs/special_projects_guide.md +386 -0
  35. data/docs/tools-and-mcp-examples.md +23 -0
  36. data/docs/workflows-and-pipelines.md +84 -7
  37. data/examples/.gitignore +1 -0
  38. data/examples/00_setup_aia.sh +27 -44
  39. data/examples/11_multi_model.sh +4 -14
  40. data/examples/12_token_usage.sh +3 -12
  41. data/examples/18_tools.sh +10 -2
  42. data/examples/22_chat_mode.sh +0 -10
  43. data/examples/23_verify.sh +139 -0
  44. data/examples/24_decompose.sh +139 -0
  45. data/examples/25_spawn.sh +139 -0
  46. data/examples/26_debate.sh +97 -0
  47. data/examples/27_mention_routing.sh +157 -0
  48. data/examples/28_model_switching.sh +106 -0
  49. data/examples/29_agent_harness.sh +177 -0
  50. data/examples/README.md +65 -0
  51. data/examples/advanced_multi_robot_capabilities_without_examples.md +106 -0
  52. data/examples/aia_config.yml +1 -1
  53. data/examples/aia_config_orchestrator.yml +45 -0
  54. data/examples/common.sh +19 -0
  55. data/examples/context/tech_stack.md +2 -2
  56. data/examples/prompts_dir/project_summary +2 -2
  57. data/examples/prompts_dir/roles/orchestrator.md +21 -0
  58. data/examples/requirements/sinatra_taskflow_app.md +139 -0
  59. data/examples/rules/01_classify_ruby.rb +16 -0
  60. data/examples/rules/02_prefer_claude_for_code.rb +19 -0
  61. data/examples/rules/03_gate_prompt_length.rb +19 -0
  62. data/examples/rules/04_tool_selection.rb +41 -0
  63. data/examples/rules/README.md +30 -0
  64. data/examples/run_all.sh +48 -15
  65. data/examples/tools/word_count_tool.rb +1 -1
  66. data/lib/AGENTS.md +57 -0
  67. data/lib/aia/chat_loop.rb +306 -159
  68. data/lib/aia/config/cli_parser.rb +174 -111
  69. data/lib/aia/config/defaults.yml +62 -33
  70. data/lib/aia/config/mcp_parser.rb +39 -46
  71. data/lib/aia/config/model_spec.rb +34 -2
  72. data/lib/aia/config/validator.rb +121 -138
  73. data/lib/aia/config.rb +110 -145
  74. data/lib/aia/content_extractor.rb +153 -0
  75. data/lib/aia/cost_calculator.rb +38 -0
  76. data/lib/aia/crew.rb +164 -0
  77. data/lib/aia/debate_handler.rb +166 -0
  78. data/lib/aia/delegate_handler.rb +112 -0
  79. data/lib/aia/directive.rb +33 -18
  80. data/lib/aia/directive_processor.rb +16 -7
  81. data/lib/aia/directives/configuration_directives.rb +160 -20
  82. data/lib/aia/directives/context_directives.rb +38 -26
  83. data/lib/aia/directives/execution_directives.rb +136 -4
  84. data/lib/aia/directives/model_directives.rb +76 -34
  85. data/lib/aia/directives/trakflow_directives.rb +44 -0
  86. data/lib/aia/directives/utility_directives.rb +203 -6
  87. data/lib/aia/directives/web_and_file_directives.rb +96 -60
  88. data/lib/aia/errors.rb +15 -0
  89. data/lib/aia/fact_asserter.rb +27 -0
  90. data/lib/aia/fzf.rb +9 -31
  91. data/lib/aia/handler_context.rb +17 -0
  92. data/lib/aia/handler_protocol.rb +19 -0
  93. data/lib/aia/history_transfer.rb +55 -0
  94. data/lib/aia/input_collector.rb +3 -3
  95. data/lib/aia/layered_orchestrator.rb +448 -0
  96. data/lib/aia/logger.rb +24 -4
  97. data/lib/aia/mcp_config_normalizer.rb +35 -0
  98. data/lib/aia/mcp_connection_manager.rb +305 -0
  99. data/lib/aia/mcp_discovery.rb +44 -0
  100. data/lib/aia/mcp_grouper.rb +33 -0
  101. data/lib/aia/mcp_utility.rb +57 -0
  102. data/lib/aia/mention_router.rb +260 -0
  103. data/lib/aia/model_alias_registry.rb +97 -0
  104. data/lib/aia/model_switch_handler.rb +100 -0
  105. data/lib/aia/network_builder.rb +155 -0
  106. data/lib/aia/network_memory_manager.rb +55 -0
  107. data/lib/aia/patches/ruby_llm_streaming_error.rb +43 -0
  108. data/lib/aia/patches/ruby_llm_tool_error.rb +96 -0
  109. data/lib/aia/pipeline_orchestrator.rb +262 -0
  110. data/lib/aia/plugin_loader.rb +170 -0
  111. data/lib/aia/plugin_monitor.rb +208 -0
  112. data/lib/aia/prompt_decomposer.rb +157 -0
  113. data/lib/aia/prompt_handler.rb +19 -39
  114. data/lib/aia/robot_builder.rb +51 -0
  115. data/lib/aia/robot_factory.rb +334 -0
  116. data/lib/aia/robot_namer.rb +116 -0
  117. data/lib/aia/session.rb +83 -17
  118. data/lib/aia/session_tracker.rb +209 -0
  119. data/lib/aia/similarity_scorer.rb +39 -0
  120. data/lib/aia/skill_utils.rb +105 -1
  121. data/lib/aia/spawn_handler.rb +129 -0
  122. data/lib/aia/spawn_spec_parser.rb +65 -0
  123. data/lib/aia/special_mode_handler.rb +302 -0
  124. data/lib/aia/startup_coordinator.rb +150 -0
  125. data/lib/aia/streaming_runner.rb +169 -0
  126. data/lib/aia/system_prompt_assembler.rb +88 -0
  127. data/lib/aia/task_coordinator.rb +202 -0
  128. data/lib/aia/task_decomposer.rb +57 -0
  129. data/lib/aia/task_executor.rb +51 -0
  130. data/lib/aia/tfidf_math.rb +27 -0
  131. data/lib/aia/tool_filter/tfidf.rb +116 -0
  132. data/lib/aia/tool_filter/wordnet_expander.rb +127 -0
  133. data/lib/aia/tool_filter.rb +82 -0
  134. data/lib/aia/tool_filter_registry.rb +30 -0
  135. data/lib/aia/tool_filter_strategy.rb +143 -0
  136. data/lib/aia/tool_loader.rb +210 -0
  137. data/lib/aia/tool_utility.rb +30 -0
  138. data/lib/aia/tools/delegate_to_foreman_tool.rb +70 -0
  139. data/lib/aia/tools/recruit_robot_tool.rb +60 -0
  140. data/lib/aia/tools/reskill_robot_tool.rb +44 -0
  141. data/lib/aia/tools/task_board_tool.rb +114 -0
  142. data/lib/aia/trakflow_bridge.rb +173 -0
  143. data/lib/aia/turn_state.rb +94 -0
  144. data/lib/aia/ui_presenter.rb +166 -198
  145. data/lib/aia/utility.rb +134 -87
  146. data/lib/aia/{history_manager.rb → variable_input_collector.rb} +8 -9
  147. data/lib/aia/verification_network.rb +58 -0
  148. data/lib/aia.rb +108 -63
  149. data/mkdocs.yml +1 -0
  150. metadata +179 -56
  151. data/justfile +0 -215
  152. data/lib/aia/adapter/chat_execution.rb +0 -242
  153. data/lib/aia/adapter/error_handler.rb +0 -68
  154. data/lib/aia/adapter/gem_activator.rb +0 -57
  155. data/lib/aia/adapter/mcp_connector.rb +0 -274
  156. data/lib/aia/adapter/modality_handlers.rb +0 -167
  157. data/lib/aia/adapter/model_registry.rb +0 -81
  158. data/lib/aia/adapter/multi_model_chat.rb +0 -218
  159. data/lib/aia/adapter/provider_configurator.rb +0 -59
  160. data/lib/aia/adapter/tool_filter.rb +0 -85
  161. data/lib/aia/adapter/tool_loader.rb +0 -90
  162. data/lib/aia/chat_processor_service.rb +0 -164
  163. data/lib/aia/prompt_pipeline.rb +0 -183
  164. data/lib/aia/ruby_llm_adapter.rb +0 -95
  165. data/lib/extensions/openstruct_merge.rb +0 -48
  166. data/lib/extensions/ruby_llm/.irbrc +0 -56
  167. data/lib/extensions/ruby_llm/modalities.rb +0 -36
  168. data/lib/extensions/ruby_llm/provider_fix.rb +0 -79
  169. data/lib/refinements/string.rb +0 -16
  170. data/main.just +0 -76
@@ -1,6 +1,121 @@
1
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
2
+
3
+ ## Table of Contents
4
+
5
+ - [Directives Reference](#directives-reference)
6
+ - [Quick Reference](#quick-reference)
7
+ - [Directive Syntax](#directive-syntax)
8
+ - [Configuration Directives](#configuration-directives)
9
+ - [`/config`](#config)
10
+ - [`/model`](#model)
11
+ - [`/temperature`](#temperature)
12
+ - [`/top_p`](#top_p)
13
+ - [`/cost`](#cost)
14
+ - [File and Web Directives](#file-and-web-directives)
15
+ - [`/include`](#include)
16
+ - [`/paste`](#paste)
17
+ - [`/webpage`](#webpage)
18
+ - [`/skill`](#skill)
19
+ - [`/skills`](#skills)
20
+ - [Execution Directives](#execution-directives)
21
+ - [`/ruby`](#ruby)
22
+ - [`/say`](#say)
23
+ - [`/concurrent`](#concurrent)
24
+ - [`/verify`](#verify)
25
+ - [`/decompose`](#decompose)
26
+ - [`/debate`](#debate)
27
+ - [`/delegate`](#delegate)
28
+ - [`/spawn`](#spawn)
29
+ - [`/add_recruit`](#add_recruit)
30
+ - [`/reskill`](#reskill)
31
+ - [`/drop_recruit`](#drop_recruit)
32
+ - [Utility Directives](#utility-directives)
33
+ - [`/tools`](#tools)
34
+ - [`/next`](#next)
35
+ - [`/pipeline`](#pipeline)
36
+ - [`/mcp`](#mcp)
37
+ - [`/robots`](#robots)
38
+ - [`/terse`](#terse)
39
+ - [`/robot`](#robot)
40
+ - [Context Management Directives](#context-management-directives)
41
+ - [`/checkpoint`](#checkpoint)
42
+ - [`/restore`](#restore)
43
+ - [`/clear`](#clear)
44
+ - [`/review`](#review)
45
+ - [`/checkpoints_list`](#checkpoints_list)
46
+ - [TrakFlow Directives](#trakflow-directives)
47
+ - [`/tasks`](#tasks)
48
+ - [`/plan`](#plan)
49
+ - [`/task`](#task)
50
+ - [Model and Information Directives](#model-and-information-directives)
51
+ - [`/available_models`](#available_models)
52
+ - [`/compare`](#compare)
53
+ - [`/help`](#help)
54
+ - [Directive Processing Order](#directive-processing-order)
55
+ - [Advanced Usage Patterns](#advanced-usage-patterns)
56
+ - [Combining Directives](#combining-directives)
57
+ - [Dynamic Configuration](#dynamic-configuration)
58
+ - [Conditional Execution](#conditional-execution)
59
+ - [Workflow Automation](#workflow-automation)
60
+ - [Error Handling](#error-handling)
61
+ - [Common Errors](#common-errors)
62
+ - [Custom Directives](#custom-directives)
63
+ - [Best Practices](#best-practices)
64
+ - [Security Considerations](#security-considerations)
65
+ - [Safe Usage Tips](#safe-usage-tips)
66
+ - [Environment Variables for Directives](#environment-variables-for-directives)
67
+ - [Related Documentation](#related-documentation)
68
+
69
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
70
+
1
71
  # Directives Reference
2
72
 
3
- Directives are special commands embedded in prompts that provide dynamic functionality. All directives begin with `/` and are processed before the prompt is sent to the AI model.
73
+ Directives are slash commands available during interactive chat sessions. All directives begin with `/` and are processed before the prompt is sent to the AI model.
74
+
75
+ Use `/help` at any time to see all available directives.
76
+
77
+ ## Quick Reference
78
+
79
+ | Directive | Aliases | Description |
80
+ |-----------|---------|-------------|
81
+ | `/config` | `/cfg` | View or set configuration values |
82
+ | `/model` | | View or change the AI model |
83
+ | `/temperature` | `/temp` | Set temperature parameter |
84
+ | `/top_p` | `/topp` | Set top_p parameter |
85
+ | `/cost` | | Dump session cost/token metrics as CSV |
86
+ | `//include` | `//import` | Include file content at prompt load time (prompt_manager, not chat-time) |
87
+ | `/webpage` | `/website`, `/web` | Fetch and include web content |
88
+ | `/skill` | | Include a Claude Code skill |
89
+ | `/skills` | | List available Claude Code skills |
90
+ | `/paste` | `/clipboard` | Paste from system clipboard |
91
+ | `/ruby` | `/rb` | Execute Ruby code |
92
+ | `/say` | | Text-to-speech |
93
+ | `/concurrent` | `/conc` | Concurrent MCP server access |
94
+ | `/verify` | | Verification network (two answers + reconciliation) |
95
+ | `/decompose` | | Decompose prompt into parallel sub-tasks |
96
+ | `/debate` | | Multi-round debate between robots |
97
+ | `/delegate` | `/del` | Delegate subtasks via TrakFlow plan |
98
+ | `/spawn` | | Spawn a one-shot specialist robot for the next prompt |
99
+ | `/add_recruit` | `/add` | Recruit a persistent, `@mention`-able robot (optionally skilled) into the crew |
100
+ | `/drop_recruit` | `/drop` | Remove a robot from the crew |
101
+ | `/reskill` | | Reset a crew member to a clean slate and give it a new skill/role |
102
+ | `/tools` | | List available tools |
103
+ | `/mcp` | | MCP server connection status |
104
+ | `/robots` | | Show active robot configuration |
105
+ | `/robot` | | ASCII robot art |
106
+ | `/help` | | Show directive help |
107
+ | `/checkpoint` | `/ckp`, `/cp` | Create a conversation checkpoint |
108
+ | `/restore` | | Restore to a checkpoint |
109
+ | `/clear` | | Clear conversation context |
110
+ | `/review` | `/context` | Review conversation with checkpoint markers |
111
+ | `/checkpoints_list` | `/checkpoints` | List all checkpoints |
112
+ | `/tasks` | `/tf` | Show TrakFlow ready tasks |
113
+ | `/plan` | | Create a TrakFlow plan |
114
+ | `/task` | | Create a TrakFlow task |
115
+ | `/available_models` | `/am`, `/available`, `/all_models`, `/models`, `/llms` | List available AI models |
116
+ | `/compare` | `/cmp` | Compare responses from multiple models |
117
+ | `next` | | YAML front matter key: set next prompt in workflow (prompt_manager) |
118
+ | `pipeline` | `workflow` | YAML front matter key: define prompt workflow sequence (prompt_manager) |
4
119
 
5
120
  ## Directive Syntax
6
121
 
@@ -10,10 +125,10 @@ Directives are special commands embedded in prompts that provide dynamic functio
10
125
 
11
126
  Examples:
12
127
  ```markdown
13
- /config model gpt-4
14
- /include my_file.md
15
-
16
- <%= "Hello World" %>
128
+ /config temperature 0.8
129
+ /model gpt-4o, claude-sonnet-4
130
+ /debate
131
+ Should we use a monolith or microservices?
17
132
  ```
18
133
 
19
134
  ## Configuration Directives
@@ -95,28 +210,51 @@ Set nucleus sampling parameter (alternative to temperature).
95
210
 
96
211
  **Aliases**: `/topp`
97
212
 
213
+ ### `/cost`
214
+ Dump session cost and token metrics as CSV.
215
+
216
+ **Syntax**: `/cost`
217
+
218
+ **Example Output**:
219
+ ```
220
+ model,input_tokens,output_tokens,total_tokens,cost,elapsed,similarity
221
+ gpt-4o,1234,567,1801,$0.01234,2.3s,ref
222
+ claude-sonnet-4-20250514,1234,890,2124,$0.00987,3.1s,87.2%
223
+ TOTAL,2468,1457,3925,$0.02221,3.1s,
224
+ ```
225
+
226
+ **Features**:
227
+ - Shows per-turn breakdown: model, token counts, cost, elapsed time
228
+ - Includes similarity scores when multi-model mode is active
229
+ - Appends CSV to output file when `--output` is configured
230
+ - Totals row at the bottom summarizes the session
231
+
98
232
  ## File and Web Directives
99
233
 
100
234
  ### `/include`
101
- Include content from files or websites.
235
+ Include content from files into a prompt file.
102
236
 
103
- **Syntax**: `/include path_or_url`
237
+ > **Note**: `/include` (also written as `//include` in prompt files) is handled by the
238
+ > `prompt_manager` gem **during prompt loading**, before AIA processes the prompt.
239
+ > It is NOT a chat-time directive — you cannot type `/include` at the chat prompt and
240
+ > have it evaluated interactively. The inclusion happens when the prompt file is read
241
+ > from disk, so the included content is already present by the time AIA sees the prompt.
104
242
 
105
- **Examples**:
243
+ **Syntax** (inside a `.md` prompt file): `//include path_or_url`
244
+
245
+ **Examples** (in prompt files):
106
246
  ```markdown
107
- /include README.md
108
- /include /path/to/config.yml
109
- /include ~/Documents/notes.md
110
- /include https://example.com/page
247
+ //include README.md
248
+ //include /path/to/config.yml
249
+ //include ~/Documents/notes.md
111
250
  ```
112
251
 
113
252
  **Features**:
114
253
  - Supports tilde (`~`) and environment variable expansion
115
254
  - Prevents circular inclusions
116
- - Can include web pages (requires PUREMD_API_KEY)
117
255
  - Handles both absolute and relative file paths
118
256
 
119
- **Aliases**: `/import`
257
+ **Aliases**: `//import`
120
258
 
121
259
  ### `/paste`
122
260
  Insert content from the system clipboard.
@@ -163,66 +301,78 @@ Include an AIA skill into the conversation context.
163
301
  **Examples**:
164
302
  ```markdown
165
303
  /skill code-quality # Exact match
166
- /skill code # Prefix match (finds first match starting with "code")
304
+ /skill code # Prefix match (finds first alphabetical match starting with "code")
167
305
  /skill frontend-design # Exact match
168
306
  /skill front # Prefix match (finds "frontend-design")
169
307
  ```
170
308
 
171
309
  **Features**:
172
- - Reads `SKILL.md` from the skills directory (default: `~/.prompts/skills/<skill_name>/`)
310
+ - Reads `SKILL.md` from `<skills_dir>/<skill_name>/`
311
+ - Skills directory: `AIA.config.skills.dir` (default `~/.prompts/skills`); if `AIA_PROMPTS__SKILLS_PREFIX` is set, appended to `AIA_PROMPTS__DIR` to form the base
173
312
  - Supports prefix matching: `/skill code` finds the first subdirectory starting with "code"
174
313
  - Exact matches take priority over prefix matches
175
- - Injects only the **body content** of `SKILL.md` — the YAML front matter is stripped and never sent to the LLM
176
- - Skills directory is configured via `skills.dir` or `--skills-dir`
177
-
178
- **Role vs Skill**: A role defines the LLM's *personality*; a skill provides *task instructions* for how to carry out the user's request within that role. Skills are injected after the role and before the user prompt.
314
+ - Returns the full `SKILL.md` content for inclusion in the prompt
179
315
 
180
316
  **Error Handling**:
317
+ Errors are printed to stdout (visible to the user) and return `nil` so nothing is injected into the AI prompt:
181
318
  - Missing skill name: `Error: /skill requires a skill name. Use /skills to list available skills.`
182
- - No matching directory: `Error: No skill matching 'name' found in <dir>. Use /skills to list available skills.`
183
- - Directory exists but no SKILL.md: `Error: Skill directory 'name' has no SKILL.md. Use /skills to list available skills.`
184
-
185
- **See also**: `/skills` to list available skills, `--list-skills` CLI flag
319
+ - No matching directory: `Error: No skill matching 'name' found in <skills_dir>. Use /skills to list available skills.`
320
+ - Directory exists but no SKILL.md: `Error: Skill 'name' has no SKILL.md in <skills_dir>.`
186
321
 
187
322
  ### `/skills`
188
- List available AIA skills with optional search filtering.
323
+ List available AIA skills, optionally filtered by search terms.
189
324
 
190
- **Syntax**: `/skills [search terms]`
325
+ **Syntax**: `/skills [search_terms...]`
191
326
 
192
- **Examples**:
193
- ```markdown
194
- /skills # List all skills
195
- /skills ruby # Skills matching "ruby"
196
- /skills -python # Skills not matching "python"
197
- /skills ruby -deprecated # Skills matching "ruby" but not "deprecated"
327
+ **Example Output** (`/skills`):
198
328
  ```
329
+ code-assist: Code Assist
330
+ Help with coding tasks.
199
331
 
200
- **Search term prefixes**:
201
- - Bare word or `+word` — positive filter (skill must match)
202
- - `-word`, `~word`, or `!word` — negative filter (skill must not match)
203
- - Searches skill name and SKILL.md front matter fields (name, description, etc.)
332
+ code-quality: Code Quality
333
+ Enforce SOLID principles and clean code guidelines across all
334
+ language targets.
335
+
336
+ frontend-design: Frontend Design
337
+ Build interfaces.
204
338
 
205
- **Example Output**:
206
339
  ```
207
- Available Skills (~/.prompts/skills):
208
- ======================================
209
340
 
210
- code-quality
211
- Improve code quality through comprehensive analysis and refactoring.
341
+ **Search Term Filtering**:
342
+ - `/skills ruby arch` — show only skills whose YAML front matter contains both `ruby` AND `arch` (AND logic, case-insensitive substring match)
343
+ - Prefix `+` is treated as positive (same as bare term): `/skills +ruby`
344
+ - Prefix `-`, `~`, or `!` is AND NOT — excludes matching skills: `/skills ruby -test`
345
+ - Multiple negative terms each exclude independently
212
346
 
213
- frontend-design
214
- Create distinctive, production-grade frontend interfaces.
347
+ **Features**:
348
+ - Only lists subdirectories that contain a `SKILL.md` file; plain files and dirs without `SKILL.md` are ignored
349
+ - Skills directory: `AIA.config.skills.dir` (default `~/.prompts/skills`); if `AIA_PROMPTS__SKILLS_PREFIX` is set, appended to `AIA_PROMPTS__DIR` to form the base
350
+ - Results sorted alphabetically by skill ID
351
+ - Descriptions are word-wrapped to terminal width with 2-space indent on continuation lines
352
+ - Displays to STDOUT only (does not inject content into the AI prompt)
215
353
 
216
- Total: 2 skills
354
+ ## Execution Directives
355
+
356
+ ### `/ruby`
357
+ Execute arbitrary Ruby code and insert the result.
358
+
359
+ > **Security note:** `/ruby` executes the provided expression via `eval()` with no sandboxing. It has full access to the Ruby environment, the filesystem, and all loaded gems — equivalent to running arbitrary Ruby code in your terminal. Only use `/ruby` in prompts you trust. Do not share prompts containing `/ruby` unless you have reviewed their content.
360
+
361
+ **Syntax**: `/ruby expression`
362
+
363
+ **Examples**:
364
+ ```markdown
365
+ /ruby Time.now.strftime('%Y-%m-%d')
366
+ /ruby Dir.glob('*.rb').size
367
+ /ruby ENV['USER']
217
368
  ```
218
369
 
219
370
  **Features**:
220
- - Lists skill subdirectories from `AIA.config.skills.dir` (default: `~/.prompts/skills/`)
221
- - Sorted alphabetically
222
- - Displays to STDOUT only (does not inject content into the prompt)
223
- - Reads `SKILL.md` front matter for filtering and description display
371
+ - Evaluates the Ruby expression and inserts the string result into the prompt
372
+ - Has full access to the Ruby environment and loaded gems
373
+ - Returns error details if execution fails
224
374
 
225
- ## Execution Directives
375
+ **Aliases**: `/rb`
226
376
 
227
377
  ### `/say`
228
378
  Speak text using system text-to-speech (macOS/Linux).
@@ -239,6 +389,199 @@ Speak text using system text-to-speech (macOS/Linux).
239
389
  - macOS: Uses built-in `say` command
240
390
  - Linux: Requires `espeak` or similar TTS software
241
391
 
392
+ ### `/concurrent`
393
+ Execute the next prompt with concurrent MCP server access. AIA groups independent MCP servers and queries them in parallel, then synthesizes the results.
394
+
395
+ **Syntax**: `/concurrent`
396
+
397
+ **Examples**:
398
+ ```markdown
399
+ /concurrent
400
+ What files changed this week and are there any open issues related to them?
401
+ ```
402
+
403
+ **Features**:
404
+ - Enables concurrent MCP mode for the next prompt only
405
+ - Independent MCP servers are queried in parallel
406
+ - A "Weaver" synthesizer robot merges the results
407
+ - Requires at least 2 MCP servers to be connected
408
+
409
+ **Aliases**: `/conc`
410
+
411
+ ### `/verify`
412
+ Run the next prompt through a verification network. Two independent robots answer the same question, then a reconciler compares and merges the responses.
413
+
414
+ **Syntax**: `/verify`
415
+
416
+ **Examples**:
417
+ ```markdown
418
+ /verify
419
+ Is this SQL query safe from injection attacks?
420
+ ```
421
+
422
+ **Features**:
423
+ - Two robots independently answer the prompt
424
+ - A third robot reconciles any differences
425
+ - Increases confidence in factual or analytical answers
426
+ - Requires a multi-model or network configuration
427
+
428
+ ### `/decompose`
429
+ Decompose the next prompt into independent, concurrently-executable sub-tasks. The prompt is analyzed by a coordinator model, broken into pieces that have **no dependencies on each other**, each solved in parallel via `Async::Barrier`, and the results synthesized into a single response.
430
+
431
+ **Syntax**: `/decompose`
432
+
433
+ **Examples**:
434
+ ```markdown
435
+ /decompose
436
+ Analyze this codebase: review the test coverage, check for security issues, and assess performance.
437
+ ```
438
+
439
+ **Features**:
440
+ - Sub-tasks returned are **always guaranteed to be independent** — they can all run concurrently without waiting on each other
441
+ - If the prompt cannot be split into parallel work (e.g., tasks that must run sequentially or build on each other's output), the model returns an **empty subtasks array** and the prompt executes normally as a single request
442
+ - 2–5 sub-tasks maximum; single-step prompts are never decomposed
443
+ - Results from all parallel branches are synthesized into one coherent final response by the coordinator
444
+ - Best for prompts with multiple truly distinct aspects (e.g., "review X, analyze Y, and summarize Z" where X, Y, Z are independent)
445
+ - **Not suitable for sequential workflows** — use `/pipeline` or `/next` when tasks must chain
446
+
447
+ > **Design guarantee**: The decomposition model is explicitly instructed to return an empty `subtasks` array whenever any sub-task depends on the result of another. Parallelism is never approximated — it is either fully concurrent or the prompt runs as a whole.
448
+
449
+ ### `/debate`
450
+ Enable multi-round debate between robots in the network. Robots argue different perspectives and converge toward a consensus answer.
451
+
452
+ **Syntax**: `/debate`
453
+
454
+ **Examples**:
455
+ ```markdown
456
+ /debate
457
+ Should we use microservices or a monolith for this project?
458
+ ```
459
+
460
+ **Features**:
461
+ - Runs up to 5 rounds of debate between network robots
462
+ - Each robot sees all previous arguments before responding
463
+ - Debate ends early when robots signal convergence (CONVERGED keyword)
464
+ - Results include all debate rounds formatted as markdown
465
+ - Writes debate history to network memory for context
466
+ - Requires a multi-model network (2+ models)
467
+
468
+ ### `/delegate`
469
+ Delegate subtasks to specific robots via a structured TrakFlow plan. The lead robot decomposes the prompt into a JSON task plan, and robots execute steps sequentially.
470
+
471
+ **Syntax**: `/delegate`
472
+
473
+ **Examples**:
474
+ ```markdown
475
+ /delegate
476
+ Build a REST API with authentication, rate limiting, and documentation.
477
+ ```
478
+
479
+ **Features**:
480
+ - Lead robot creates a structured task decomposition (JSON)
481
+ - TaskCoordinator creates a TrakFlow plan from the decomposition
482
+ - Each subtask is assigned to and executed by a specific robot
483
+ - Prior step results flow as context into subsequent steps
484
+ - Creates a full execution trace with per-step results
485
+ - Requires a multi-model network
486
+
487
+ **Aliases**: `/del`
488
+
489
+ ### `/spawn`
490
+ Spawn a specialist robot for the **next prompt only**. The specialist is a
491
+ one-shot helper — it does not join the crew. To add a persistent, `@mention`-able
492
+ member instead, use [`/add_recruit`](#add_recruit).
493
+
494
+ **Syntax**: `/spawn` | `/spawn <type>` | `/spawn <name> <provider/model> <system prompt...>`
495
+
496
+ **Examples**:
497
+ ```markdown
498
+ # Auto-detect the best specialist type from the prompt
499
+ /spawn
500
+ Write a comprehensive test suite for the User model.
501
+
502
+ # Named specialist type
503
+ /spawn security
504
+ Audit this authentication module for vulnerabilities.
505
+
506
+ # Fully explicit: name, provider/model, and system prompt
507
+ /spawn researcher ollama/qwen3.6:latest You are careful and cite sources.
508
+ Summarize the latest changes to the locking strategy.
509
+ ```
510
+
511
+ **Features**:
512
+ - No arguments: auto-detects the best specialist type from the prompt content.
513
+ - A single `<type>` argument: spawns a specialist of that type (e.g., `security`, `testing`, `performance`), inheriting the current model with a domain-specific system prompt.
514
+ - Explicit form (`<name> <provider/model> <system prompt>`): sets the name, model/provider, and system prompt directly. Use `-` or `inherit` as the model token to keep the parent's model; `lms/...` maps to the `openai` provider.
515
+ - Specialist robots are cached and reused within the session.
516
+ - Creates a TrakFlow task when task coordination is active.
517
+
518
+ ### `/add_recruit`
519
+ Recruit a new robot into the crew. Unlike `/spawn`, a recruit **persists** for
520
+ the rest of the session, appears in [`/robots`](#robots), and answers to
521
+ `@name`. Recruits inherit the chief's local tools and connected MCP servers.
522
+
523
+ **Aliases**: `/add`
524
+
525
+ **Syntax**: `/add_recruit <name> [provider/model] [skill:<id>...] [system prompt...]`
526
+
527
+ **Examples**:
528
+ ```markdown
529
+ # Inherit the chief's model and a default persona
530
+ /add_recruit researcher
531
+
532
+ # Explicit provider/model plus a system prompt
533
+ /add_recruit critic anthropic/claude-3-5-sonnet You are a ruthless design critic.
534
+
535
+ # A local-model member
536
+ /add_recruit local ollama/qwen3.6:latest You are concise and fast.
537
+
538
+ # Assign a skill as the member's role (divides labor across the crew)
539
+ /add_recruit reviewer skill:security-review
540
+ /add_recruit reviewer - skill:security-review,ruby-style focus on the auth module
541
+ ```
542
+
543
+ **Features**:
544
+ - `<name>` is required and must be unique within the crew. `crew` is reserved (it is the broadcast handle, `@crew`).
545
+ - Omit `provider/model` to inherit the chief's model and provider; use `-` or `inherit` to inherit explicitly while still supplying skills or a system prompt.
546
+ - A `skill:<id>` token (anywhere after the name; comma-separate or repeat for several) assigns one or more [skills](guides/crew.md#giving-a-recruit-a-role-with-skills) as the member's role. The skill bodies become its system prompt; an unknown id is reported.
547
+ - Everything else after the model becomes the member's system prompt, appended after any skills.
548
+ - Address the recruit afterward with `@name`, or broadcast to the whole crew with `@crew`.
549
+
550
+ ### `/reskill`
551
+ Reset a crew member to a clean slate (a fresh conversation) and give it a new
552
+ role. The member keeps its `@name` and model. The chief cannot be reskilled.
553
+
554
+ **Syntax**: `/reskill <name> [skill:<id>...] [system prompt...]`
555
+
556
+ **Examples**:
557
+ ```markdown
558
+ # Repurpose a member with a different skill
559
+ /reskill larry skill:test-writing
560
+
561
+ # Or hand it a freeform role
562
+ /reskill larry you now summarize the other members' findings
563
+ ```
564
+
565
+ **Features**:
566
+ - Same `skill:<id>` and trailing-system-prompt handling as `/add_recruit` (there is no model token — the member's existing model is preserved).
567
+ - Useful for recovering a member that drifted off task, or moving the crew through phases (review → fix → summarize) without re-creating robots.
568
+
569
+ ### `/drop_recruit`
570
+ Remove a robot from the crew by name. The chief (the session's lead robot)
571
+ cannot be dropped.
572
+
573
+ **Aliases**: `/drop`
574
+
575
+ **Syntax**: `/drop_recruit <name>`
576
+
577
+ **Examples**:
578
+ ```markdown
579
+ /drop_recruit researcher
580
+ ```
581
+
582
+ See the [Crews guide](guides/crew.md) for `@mention` routing, `@crew`
583
+ broadcast, and concurrent vs. sequential execution.
584
+
242
585
  ## Utility Directives
243
586
 
244
587
  ### `/tools`
@@ -288,50 +631,156 @@ FileReader
288
631
  - Filtering is case-insensitive (e.g., "File", "FILE", and "file" all match)
289
632
 
290
633
  ### `/next`
291
- Set the next prompt to execute in a workflow.
634
+ Declare the next prompt to execute after this one in a workflow.
635
+
636
+ > **Note**: `next` is a **YAML front matter key** written at the top of a `.md` prompt
637
+ > file, not a chat-time slash command. It is processed by the prompt loader when the
638
+ > file is read, not interactively during a chat session.
639
+
640
+ **Syntax** (YAML front matter in a prompt file):
641
+ ```yaml
642
+ ---
643
+ next: analyze_results
644
+ ---
645
+ Your prompt body here.
646
+ ```
292
647
 
293
- **Syntax**: `/next prompt_id`
648
+ **Examples** (prompt files with `next` front matter):
649
+ ```yaml
650
+ ---
651
+ next: generate_report
652
+ ---
653
+ Summarize the extracted data.
654
+ ```
294
655
 
295
- **Examples**:
296
- ```markdown
297
- /next analyze_results
298
- /next generate_report
656
+ ```yaml
657
+ ---
658
+ next: finalize
659
+ ---
660
+ Analyze the results and identify key findings.
299
661
  ```
300
662
 
301
- **Usage**:
302
- - `/next` - Display current next prompt
303
- - `/next prompt_id` - Set next prompt in workflow
663
+ **Usage**: When AIA finishes running a prompt that has a `next` key in its front
664
+ matter, it automatically loads and executes the named prompt next.
304
665
 
305
666
  ### `/pipeline`
306
- Define or modify a prompt workflow sequence.
667
+ Declare an ordered sequence of prompts to run as a workflow.
668
+
669
+ > **Note**: `pipeline` is a **YAML front matter key** written at the top of a `.md`
670
+ > prompt file, not a chat-time slash command. It is processed by the prompt loader
671
+ > when the file is read, not interactively during a chat session. The alias
672
+ > `workflow` is also accepted as a front matter key.
673
+
674
+ **Syntax** (YAML front matter in a prompt file):
675
+ ```yaml
676
+ ---
677
+ pipeline: prompt1, prompt2, prompt3
678
+ ---
679
+ Your prompt body here.
680
+ ```
307
681
 
308
- **Syntax**: `/pipeline prompt1,prompt2,prompt3`
682
+ **Examples** (prompt files with `pipeline` front matter):
683
+ ```yaml
684
+ ---
685
+ pipeline: extract_data, analyze, report
686
+ ---
687
+ Begin the automated data processing workflow.
688
+ ```
309
689
 
310
- **Examples**:
311
- ```markdown
312
- /pipeline extract_data,analyze,report
313
- /pipeline code_review,optimize,test
690
+ ```yaml
691
+ ---
692
+ workflow: code_review, optimize, test
693
+ ---
694
+ Start the code quality pipeline.
314
695
  ```
315
696
 
316
- **Usage**:
317
- - `/pipeline` - Display current pipeline
318
- - `/pipeline prompts` - Set pipeline sequence
319
- - Can use comma-separated or space-separated prompt IDs
697
+ **Usage**: When AIA loads a prompt that has a `pipeline` (or `workflow`) key in its
698
+ front matter, it queues all listed prompts in order and runs them sequentially.
320
699
 
321
- **Aliases**: `/workflow`
700
+ **Aliases**: `workflow` (as a front matter key)
322
701
 
323
- ### `/terse`
324
- Add instruction for brief responses.
702
+ ### `/mcp`
703
+ Show MCP server connection status and available tools per server.
325
704
 
326
- **Syntax**: `/terse`
705
+ **Syntax**: `/mcp`
327
706
 
328
- **Example**:
329
- ```markdown
330
- /terse
331
- Explain machine learning algorithms.
707
+ **Example Output**:
708
+ ```
709
+ MCP Server Status
710
+ =================
711
+ Defined: 5 Connected: 3 Failed: 2
712
+
713
+ Connected Servers:
714
+ github (12 tools)
715
+ - github_create_issue
716
+ - github_list_repos
717
+ ...
718
+ filesystem (4 tools)
719
+ - read_file
720
+ - write_file
721
+ ...
722
+
723
+ Failed Servers:
724
+ slack: Connection refused
725
+ jira: Authentication failed
332
726
  ```
333
727
 
334
- Adds: "Keep your response short and to the point." to the prompt.
728
+ **Features**:
729
+ - Shows count of defined, connected, and failed MCP servers
730
+ - Lists each connected server with its tool count and tool names
731
+ - Shows error details for failed server connections
732
+ - Respects `--mcp-use` and `--mcp-skip` filtering
733
+
734
+ ### `/robots`
735
+ Show active robot configuration — the current robot or network topology.
736
+
737
+ **Syntax**: `/robots`
738
+
739
+ **Example Output** (single robot):
740
+ ```
741
+ Active Robot
742
+ ============
743
+ Mode: Single
744
+
745
+ Tobor
746
+ Model: gpt-4o (openai)
747
+ Wage: $0.0050 in / $0.0150 out per 1K tokens
748
+ Tools: 8 (3 local, 5 mcp)
749
+ Role: (default)
750
+ ```
751
+
752
+ **Example Output** (multi-model network):
753
+ ```
754
+ Active Robots
755
+ =============
756
+ Mode: Consensus Network (3 robots)
757
+
758
+ Tobor
759
+ Model: gpt-4o (openai)
760
+ Wage: $0.0050 in / $0.0150 out per 1K tokens
761
+ Tools: 5 (2 local, 3 mcp)
762
+ Role: architect
763
+
764
+ Spark
765
+ Model: claude-sonnet-4-20250514 (anthropic)
766
+ Wage: $0.0030 in / $0.0150 out per 1K tokens
767
+ Tools: 5 (2 local, 3 mcp)
768
+ Role: security
769
+
770
+ Weaver
771
+ Model: gpt-4o (openai)
772
+ Wage: $0.0050 in / $0.0150 out per 1K tokens
773
+ Tools: 0
774
+ Role: (default)
775
+ ```
776
+
777
+ **Features**:
778
+ - Shows mode: Single, Parallel, Consensus, or Pipeline
779
+ - Displays robot name, model, provider, cost, tools, and role
780
+ - For networks, shows all robots including the Weaver synthesizer
781
+
782
+ ### `/terse`
783
+ *Deprecated.* Previously added an instruction for concise responses. Now a no-op.
335
784
 
336
785
  ### `/robot`
337
786
  Generate ASCII art robot.
@@ -364,7 +813,7 @@ Create a named checkpoint of the current conversation context.
364
813
  - `/checkpoint` - Create an auto-named checkpoint
365
814
  - `/checkpoint name` - Create a checkpoint with specific name
366
815
 
367
- **Aliases**: `/cp`
816
+ **Aliases**: `/ckp`, `/cp`
368
817
 
369
818
  ### `/restore`
370
819
  Restore conversation context to a previously saved checkpoint.
@@ -430,6 +879,72 @@ Checkpoints: ruby_basics, oop_concepts
430
879
  - Truncates long messages for readability (200 characters)
431
880
  - Shows total message count and checkpoint summary
432
881
 
882
+ ### `/checkpoints_list`
883
+ List all saved checkpoints with their positions and timestamps.
884
+
885
+ **Syntax**: `/checkpoints_list`
886
+
887
+ **Example Output**:
888
+ ```
889
+ === Available Checkpoints ===
890
+ 1: position 4, created 14:32:07
891
+ → "Tell me about Ruby programming"
892
+ before_refactor: position 8, created 14:45:22
893
+ → "Now refactor the User model"
894
+ === End of Checkpoints ===
895
+ ```
896
+
897
+ **Features**:
898
+ - Shows checkpoint name, conversation position, and creation time
899
+ - Includes a preview of the last user message at the checkpoint
900
+ - Displays "No checkpoints available." when none exist
901
+
902
+ **Aliases**: `/checkpoints`
903
+
904
+ ## TrakFlow Directives
905
+
906
+ TrakFlow is AIA's built-in task tracking system for managing multi-step work.
907
+
908
+ ### `/tasks`
909
+ Show TrakFlow ready tasks and project summary.
910
+
911
+ **Syntax**: `/tasks [summary]`
912
+
913
+ **Examples**:
914
+ ```markdown
915
+ /tasks # Show ready tasks
916
+ /tasks summary # Show project summary
917
+ ```
918
+
919
+ **Features**:
920
+ - Without arguments: lists tasks that are ready to be worked on
921
+ - With `summary`: shows the overall project status
922
+ - Returns an initialization message if TrakFlow is not set up
923
+
924
+ **Aliases**: `/tf`
925
+
926
+ ### `/plan`
927
+ Create a TrakFlow plan from a description. The description is decomposed into actionable tasks.
928
+
929
+ **Syntax**: `/plan description`
930
+
931
+ **Examples**:
932
+ ```markdown
933
+ /plan Build user authentication with login, signup, and password reset
934
+ /plan Refactor the payment module into separate service objects
935
+ ```
936
+
937
+ ### `/task`
938
+ Create a single TrakFlow task.
939
+
940
+ **Syntax**: `/task title`
941
+
942
+ **Examples**:
943
+ ```markdown
944
+ /task Add input validation to the registration form
945
+ /task Write integration tests for the API endpoints
946
+ ```
947
+
433
948
  ## Model and Information Directives
434
949
 
435
950
  ### `/available_models`