aia 2.0.0.0.pre.alpha → 2.0.0

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 (236) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/CHANGELOG.md +151 -228
  4. data/README.md +42 -19
  5. data/bin/aia +8 -3
  6. data/lib/aia/aia_completion.bash +2 -3
  7. data/lib/aia/aia_completion.fish +6 -5
  8. data/lib/aia/aia_completion.zsh +2 -3
  9. data/lib/aia/chat_loop.rb +24 -66
  10. data/lib/aia/config/cli_parser.rb +164 -123
  11. data/lib/aia/config/defaults.yml +12 -39
  12. data/lib/aia/config/mcp_parser.rb +42 -40
  13. data/lib/aia/config/model_spec.rb +8 -14
  14. data/lib/aia/config/validator.rb +144 -156
  15. data/lib/aia/config/value_caster.rb +76 -0
  16. data/lib/aia/config.rb +72 -54
  17. data/lib/aia/content_extractor.rb +2 -0
  18. data/lib/aia/cost_calculator.rb +1 -0
  19. data/lib/aia/crew.rb +29 -19
  20. data/lib/aia/debate_handler.rb +45 -20
  21. data/lib/aia/delegate_handler.rb +7 -3
  22. data/lib/aia/directive.rb +10 -8
  23. data/lib/aia/directives/configuration_directives.rb +164 -109
  24. data/lib/aia/directives/context_directives.rb +55 -40
  25. data/lib/aia/directives/execution_directives.rb +25 -25
  26. data/lib/aia/directives/model_directives.rb +112 -195
  27. data/lib/aia/directives/trakflow_directives.rb +27 -9
  28. data/lib/aia/directives/utility_directives.rb +86 -87
  29. data/lib/aia/directives/web_and_file_directives.rb +83 -63
  30. data/lib/aia/fact_asserter.rb +3 -3
  31. data/lib/aia/history_transfer.rb +64 -24
  32. data/lib/aia/layered_orchestrator.rb +66 -43
  33. data/lib/aia/logger.rb +27 -62
  34. data/lib/aia/mcp_config_normalizer.rb +27 -14
  35. data/lib/aia/mcp_connection_manager.rb +193 -186
  36. data/lib/aia/mcp_discovery.rb +43 -15
  37. data/lib/aia/mcp_grouper.rb +2 -1
  38. data/lib/aia/mcp_server_config.rb +48 -0
  39. data/lib/aia/mcp_utility.rb +28 -20
  40. data/lib/aia/mention_router.rb +22 -52
  41. data/lib/aia/modality_query.rb +36 -0
  42. data/lib/aia/model_alias_registry.rb +11 -11
  43. data/lib/aia/model_registry.rb +75 -0
  44. data/lib/aia/network_builder.rb +17 -11
  45. data/lib/aia/network_memory_manager.rb +6 -6
  46. data/lib/aia/patches/ruby_llm_streaming_error.rb +21 -4
  47. data/lib/aia/patches/ruby_llm_tool_param_compat.rb +18 -0
  48. data/lib/aia/pipeline_orchestrator.rb +88 -45
  49. data/lib/aia/plugin_monitor.rb +9 -6
  50. data/lib/aia/prompt_decomposer.rb +6 -4
  51. data/lib/aia/prompt_handler.rb +90 -69
  52. data/lib/aia/provider_registry.rb +105 -0
  53. data/lib/aia/robot_builder.rb +1 -1
  54. data/lib/aia/robot_factory.rb +77 -69
  55. data/lib/aia/robot_namer.rb +2 -8
  56. data/lib/aia/robot_sync.rb +79 -0
  57. data/lib/aia/role_catalog.rb +89 -0
  58. data/lib/aia/session.rb +32 -14
  59. data/lib/aia/session_tracker.rb +39 -41
  60. data/lib/aia/similarity_scorer.rb +5 -3
  61. data/lib/aia/skill_utils.rb +60 -19
  62. data/lib/aia/spawn_handler.rb +16 -4
  63. data/lib/aia/spawn_spec_parser.rb +6 -7
  64. data/lib/aia/special_mode_handler.rb +80 -57
  65. data/lib/aia/speech.rb +103 -0
  66. data/lib/aia/startup_coordinator.rb +17 -91
  67. data/lib/aia/streaming_runner.rb +16 -5
  68. data/lib/aia/system_prompt_assembler.rb +20 -15
  69. data/lib/aia/task_board.rb +60 -0
  70. data/lib/aia/task_coordinator.rb +10 -5
  71. data/lib/aia/timing.rb +15 -0
  72. data/lib/aia/tool_approver.rb +205 -0
  73. data/lib/aia/tool_filter.rb +1 -9
  74. data/lib/aia/tool_filter_strategy.rb +39 -25
  75. data/lib/aia/tool_introspection.rb +25 -0
  76. data/lib/aia/tool_loader.rb +71 -31
  77. data/lib/aia/tool_utility.rb +6 -5
  78. data/lib/aia/tools/delegate_to_foreman_tool.rb +6 -4
  79. data/lib/aia/tools/recruit_robot_tool.rb +12 -12
  80. data/lib/aia/tools/reskill_robot_tool.rb +7 -7
  81. data/lib/aia/tools/task_board_tool.rb +17 -16
  82. data/lib/aia/trakflow_bridge.rb +19 -11
  83. data/lib/aia/turn_state.rb +32 -8
  84. data/lib/aia/ui_presenter.rb +83 -59
  85. data/lib/aia/utility.rb +8 -24
  86. data/lib/aia/variable_input_collector.rb +1 -3
  87. data/lib/aia/verification_network.rb +10 -12
  88. data/lib/aia.rb +49 -8
  89. metadata +27 -162
  90. data/.better-commits.json +0 -150
  91. data/.config/tocer/configuration.yml +0 -6
  92. data/.envrc +0 -15
  93. data/.loki +0 -231
  94. data/.quality/flay_baseline.txt +0 -1
  95. data/.quality/flog_baseline.txt +0 -29
  96. data/.quality/reek_baseline.txt +0 -80
  97. data/.rubocop.yml +0 -116
  98. data/COMMITS.md +0 -196
  99. data/IMPLEMENTATION_PLAN.md +0 -506
  100. data/Rakefile +0 -160
  101. data/architecture_review.md +0 -314
  102. data/docs/AGENTS.md +0 -40
  103. data/docs/advanced-prompting.md +0 -814
  104. data/docs/assets/images/aia.png +0 -0
  105. data/docs/cli-reference.md +0 -1241
  106. data/docs/configuration.md +0 -747
  107. data/docs/contributing.md +0 -386
  108. data/docs/directives-reference.md +0 -1145
  109. data/docs/examples/index.md +0 -277
  110. data/docs/examples/mcp/index.md +0 -475
  111. data/docs/examples/prompts/analysis/index.md +0 -78
  112. data/docs/examples/prompts/automation/index.md +0 -109
  113. data/docs/examples/prompts/development/index.md +0 -125
  114. data/docs/examples/prompts/index.md +0 -333
  115. data/docs/examples/prompts/learning/index.md +0 -127
  116. data/docs/examples/prompts/writing/index.md +0 -62
  117. data/docs/examples/tools/index.md +0 -282
  118. data/docs/faq.md +0 -578
  119. data/docs/guides/available-models.md +0 -366
  120. data/docs/guides/basic-usage.md +0 -478
  121. data/docs/guides/chat.md +0 -680
  122. data/docs/guides/crew.md +0 -239
  123. data/docs/guides/executable-prompts.md +0 -331
  124. data/docs/guides/first-prompt.md +0 -454
  125. data/docs/guides/getting-started.md +0 -455
  126. data/docs/guides/image-generation.md +0 -507
  127. data/docs/guides/index.md +0 -48
  128. data/docs/guides/local-models.md +0 -306
  129. data/docs/guides/migrate-prompts.md +0 -335
  130. data/docs/guides/models.md +0 -1017
  131. data/docs/guides/shared-tools.md +0 -254
  132. data/docs/guides/tools.md +0 -831
  133. data/docs/index.md +0 -259
  134. data/docs/installation.md +0 -274
  135. data/docs/mcp-integration.md +0 -603
  136. data/docs/prompt_management.md +0 -665
  137. data/docs/security.md +0 -674
  138. data/docs/special_projects_guide.md +0 -386
  139. data/docs/tools-and-mcp-examples.md +0 -1211
  140. data/docs/workflows-and-pipelines.md +0 -636
  141. data/examples/.gitignore +0 -2
  142. data/examples/00_setup_aia.sh +0 -111
  143. data/examples/01_basic_usage.sh +0 -23
  144. data/examples/02_frontmatter.sh +0 -33
  145. data/examples/03_shell_integration.sh +0 -55
  146. data/examples/04_erb_templating.sh +0 -56
  147. data/examples/05_shell_then_erb.sh +0 -38
  148. data/examples/06_prompt_chaining.sh +0 -59
  149. data/examples/07_pipeline.sh +0 -46
  150. data/examples/08_context_files.sh +0 -43
  151. data/examples/09_roles.sh +0 -67
  152. data/examples/10_stdin_piping.sh +0 -49
  153. data/examples/11_multi_model.sh +0 -65
  154. data/examples/12_token_usage.sh +0 -52
  155. data/examples/13_cost_tracking.sh +0 -68
  156. data/examples/14_output_file.sh +0 -91
  157. data/examples/15_parameters.sh +0 -68
  158. data/examples/16_directives.sh +0 -113
  159. data/examples/17_require_and_conditionals.sh +0 -68
  160. data/examples/18_tools.sh +0 -61
  161. data/examples/19_local_tools.sh +0 -34
  162. data/examples/20_mcp_servers.sh +0 -102
  163. data/examples/21_executable_prompts.sh +0 -78
  164. data/examples/22_chat_mode.sh +0 -217
  165. data/examples/23_verify.sh +0 -139
  166. data/examples/24_decompose.sh +0 -139
  167. data/examples/25_spawn.sh +0 -139
  168. data/examples/26_debate.sh +0 -97
  169. data/examples/27_mention_routing.sh +0 -157
  170. data/examples/28_model_switching.sh +0 -106
  171. data/examples/29_agent_harness.sh +0 -177
  172. data/examples/README.md +0 -321
  173. data/examples/advanced_multi_robot_capabilities_without_examples.md +0 -106
  174. data/examples/aia_config.yml +0 -22
  175. data/examples/aia_config_orchestrator.yml +0 -45
  176. data/examples/aia_config_with_mcp.yml +0 -21
  177. data/examples/common.sh +0 -39
  178. data/examples/context/project_goals.md +0 -6
  179. data/examples/context/tech_stack.md +0 -7
  180. data/examples/directives/timestamp_directive.rb +0 -22
  181. data/examples/mcp/filesystem.json +0 -9
  182. data/examples/prompts_dir/analyze.md +0 -2
  183. data/examples/prompts_dir/brainstorm.md +0 -2
  184. data/examples/prompts_dir/conditional.md +0 -17
  185. data/examples/prompts_dir/creative.md +0 -4
  186. data/examples/prompts_dir/erbinfo.md +0 -5
  187. data/examples/prompts_dir/erbinfo_raw.md +0 -8
  188. data/examples/prompts_dir/evaluate.md +0 -2
  189. data/examples/prompts_dir/explain_joke.md +0 -1
  190. data/examples/prompts_dir/explain_recursion.md +0 -1
  191. data/examples/prompts_dir/fun_fact +0 -3
  192. data/examples/prompts_dir/greeting.md +0 -8
  193. data/examples/prompts_dir/greeting_required.md +0 -7
  194. data/examples/prompts_dir/hello.md +0 -1
  195. data/examples/prompts_dir/includes/ruby_facts.md +0 -4
  196. data/examples/prompts_dir/limerick.md +0 -1
  197. data/examples/prompts_dir/list_with_mcp.md +0 -3
  198. data/examples/prompts_dir/pick_best.md +0 -2
  199. data/examples/prompts_dir/project_summary +0 -12
  200. data/examples/prompts_dir/quiz_with_include.md +0 -6
  201. data/examples/prompts_dir/require_demo.md +0 -5
  202. data/examples/prompts_dir/roles/formal.md +0 -3
  203. data/examples/prompts_dir/roles/orchestrator.md +0 -21
  204. data/examples/prompts_dir/roles/pirate.md +0 -3
  205. data/examples/prompts_dir/shell_then_erb.md +0 -6
  206. data/examples/prompts_dir/sort_compare.md +0 -2
  207. data/examples/prompts_dir/summarize_context.md +0 -2
  208. data/examples/prompts_dir/sysinfo.md +0 -5
  209. data/examples/prompts_dir/sysinfo_raw.md +0 -8
  210. data/examples/prompts_dir/tagline.md +0 -1
  211. data/examples/prompts_dir/tell_joke.md +0 -1
  212. data/examples/prompts_dir/tell_joke_with_next.md +0 -4
  213. data/examples/prompts_dir/use_local_tool.md +0 -8
  214. data/examples/prompts_dir/use_tools.md +0 -8
  215. data/examples/prompts_dir/weather.md +0 -2
  216. data/examples/prompts_dir/whats_new.md +0 -2
  217. data/examples/prompts_dir/with_timestamp.md +0 -5
  218. data/examples/requirements/sinatra_taskflow_app.md +0 -139
  219. data/examples/rules/01_classify_ruby.rb +0 -16
  220. data/examples/rules/02_prefer_claude_for_code.rb +0 -19
  221. data/examples/rules/03_gate_prompt_length.rb +0 -19
  222. data/examples/rules/04_tool_selection.rb +0 -41
  223. data/examples/rules/README.md +0 -30
  224. data/examples/run_all.sh +0 -294
  225. data/examples/tools/word_count_tool.rb +0 -30
  226. data/lib/AGENTS.md +0 -57
  227. data/lib/aia/model_switch_handler.rb +0 -100
  228. data/mcp_servers/README.md +0 -110
  229. data/mcp_servers/apple-mcp.json +0 -8
  230. data/mcp_servers/filesystem.json +0 -9
  231. data/mcp_servers/mcp_server_chart.json +0 -11
  232. data/mcp_servers/playwright_one.json +0 -8
  233. data/mcp_servers/playwright_server_definition.json +0 -9
  234. data/mcp_servers/playwright_two.json +0 -8
  235. data/mcp_servers/tavily_mcp_server.json +0 -8
  236. data/mkdocs.yml +0 -169
@@ -1,78 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/21_executable_prompts.sh
3
- #
4
- # Demonstrates executable prompt files — prompt files with a shebang
5
- # line that can be run directly from the command line.
6
- #
7
- # AIA auto-detects the shebang (#!) and strips it before processing.
8
- # No special flag is needed. Just add a shebang, chmod +x, and run.
9
- #
10
- # Three ways to use an executable prompt:
11
- # 1. Run directly: ./prompts_dir/fun_fact
12
- # 2. Pass to aia: aia prompts_dir/fun_fact
13
- # 3. Pipe to aia: cat prompts_dir/fun_fact | aia --no-output
14
- #
15
- # Prerequisites:
16
- # - Run 00_setup_aia.sh first
17
- # Usage: cd examples && bash 21_executable_prompts.sh
18
-
19
- set -euo pipefail
20
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
21
-
22
- echo "=== Demo 21: Executable Prompts ==="
23
- echo
24
- echo "Executable prompts are prompt files with a shebang line."
25
- echo "AIA auto-detects the shebang, strips it, and processes"
26
- echo "the rest as a normal prompt — front matter, ERB, and all."
27
- echo
28
-
29
- # --- Part 1: A minimal executable prompt ---
30
-
31
- echo "--- Part 1: Minimal executable prompt ---"
32
- echo
33
- echo "The file prompts_dir/fun_fact contains:"
34
- echo "==="
35
- cat prompts_dir/fun_fact
36
- echo "==="
37
- echo
38
- echo "It has the executable bit set (chmod +x)."
39
- echo "Running it directly: ./prompts_dir/fun_fact"
40
- echo
41
-
42
- ./prompts_dir/fun_fact
43
-
44
- echo
45
- echo
46
-
47
- # --- Part 2: Executable prompt with front matter, ERB, and shell ---
48
-
49
- echo "--- Part 2: Executable prompt with front matter, ERB, and shell ---"
50
- echo
51
- echo "The file prompts_dir/project_summary contains:"
52
- echo "==="
53
- cat prompts_dir/project_summary
54
- echo "==="
55
- echo
56
- echo "This prompt combines a shebang, YAML front matter (temperature),"
57
- echo "ERB (<%= ... %>), and shell expansion (\$(...)). All three"
58
- echo "processing layers work inside executable prompts."
59
- echo
60
- echo "Running: ./prompts_dir/project_summary"
61
- echo
62
-
63
- ./prompts_dir/project_summary
64
-
65
- echo
66
- echo
67
-
68
- # --- Part 3: Piping an executable prompt file ---
69
-
70
- echo "--- Part 3: Piping a prompt file to AIA ---"
71
- echo
72
- echo "Any prompt file — even one with a shebang — can be piped to AIA."
73
- echo "The shebang line is automatically stripped from piped input."
74
- echo
75
- echo "Running: cat prompts_dir/fun_fact | aia -c ${CONFIG} --no-output"
76
- echo
77
-
78
- cat prompts_dir/fun_fact | aia -c "${CONFIG}" --no-output
@@ -1,217 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/22_chat_mode.sh
3
- #
4
- # Demonstrates interactive chat mode via the --chat flag.
5
- #
6
- # Chat mode opens a persistent conversation where the model
7
- # remembers everything said so far. The key insight: all batch
8
- # processing (prompt, pipeline, context files) completes FIRST,
9
- # then the chat session begins with that full context available.
10
- #
11
- # This demo uses `expect` to script the interactive sessions
12
- # so you can see the full flow without typing anything.
13
- #
14
- # Three scenarios:
15
- # 1. Pure chat — no prompt, just open a conversation
16
- # 2. Prompt then chat — batch processes a prompt, then chat
17
- # 3. Pipeline then chat — runs a full pipeline, then chat
18
- #
19
- # Prerequisites:
20
- # - Run 00_setup_aia.sh first
21
- # - expect (pre-installed on macOS, `brew install expect` otherwise)
22
- # Usage: cd examples && bash 22_chat_mode.sh
23
-
24
- set -euo pipefail
25
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
26
-
27
- # --- Check that expect is available ---
28
-
29
- if ! command -v expect &>/dev/null; then
30
- echo "ERROR: expect is not installed."
31
- echo " Install with: brew install expect"
32
- exit 1
33
- fi
34
-
35
- echo "=== Demo 22: Chat Mode ==="
36
- echo
37
- echo "The --chat flag opens an interactive conversation after all"
38
- echo "batch processing completes. The model retains context from"
39
- echo "everything that was processed before the chat session began."
40
- echo
41
- echo "This demo uses 'expect' to script the interactive portions."
42
- echo
43
-
44
- # --- Part 1: Pure chat mode ---
45
-
46
- echo "--- Part 1: Pure chat (no prompt ID) ---"
47
- echo
48
- echo "Running: aia -c ${CONFIG} --chat"
49
- echo
50
- echo "This starts a conversation with no initial context."
51
- echo "We will ask two questions, then exit."
52
- echo
53
-
54
- expect <<'EXPECT_SCRIPT'
55
- set timeout 120
56
- log_user 1
57
-
58
- spawn aia -c aia_config.yml --chat
59
-
60
- expect {
61
- "#=> " {}
62
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
63
- }
64
-
65
- send "What are the three primary colors?\r"
66
-
67
- expect {
68
- "#=> " {}
69
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
70
- }
71
-
72
- send "Now name a famous painting that uses all three.\r"
73
-
74
- expect {
75
- "#=> " {}
76
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
77
- }
78
-
79
- send "exit\r"
80
- expect eof
81
- EXPECT_SCRIPT
82
-
83
- drain_terminal
84
- echo
85
- echo
86
-
87
- # --- Part 2: Prompt then chat ---
88
-
89
- echo "--- Part 2: Prompt then chat ---"
90
- echo
91
- echo "The prompt file prompts_dir/hello.md is processed first in"
92
- echo "batch mode. Then the chat session starts with that response"
93
- echo "already in the conversation history."
94
- echo
95
- echo "Running: aia -c ${CONFIG} --chat hello"
96
- echo
97
-
98
- expect <<'EXPECT_SCRIPT'
99
- set timeout 120
100
- log_user 1
101
-
102
- spawn aia -c aia_config.yml --chat hello
103
-
104
- expect {
105
- "#=> " {}
106
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
107
- }
108
-
109
- send "What did you just say? Summarize it in one sentence.\r"
110
-
111
- expect {
112
- "#=> " {}
113
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
114
- }
115
-
116
- send "exit\r"
117
- expect eof
118
- EXPECT_SCRIPT
119
-
120
- drain_terminal
121
- echo
122
- echo
123
-
124
- # --- Part 3: Pipeline then chat ---
125
-
126
- echo "--- Part 3: Pipeline then chat ---"
127
- echo
128
- echo "This is the power combo: a full pipeline runs to completion,"
129
- echo "THEN the chat session begins with the entire pipeline's"
130
- echo "conversation history available for follow-up questions."
131
- echo
132
- echo "The pipeline is: brainstorm -> evaluate -> pick_best"
133
- echo "(from demos 07). After all three steps finish, we enter"
134
- echo "chat to ask follow-up questions about the results."
135
- echo
136
- echo "Running: aia -c ${CONFIG} --chat --pipeline evaluate,pick_best brainstorm"
137
- echo
138
-
139
- expect <<'EXPECT_SCRIPT'
140
- set timeout 180
141
- log_user 1
142
-
143
- spawn aia -c aia_config.yml --chat --pipeline evaluate,pick_best brainstorm
144
-
145
- expect {
146
- "#=> " {}
147
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
148
- }
149
-
150
- send "Why did you pick that name over the others?\r"
151
-
152
- expect {
153
- "#=> " {}
154
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
155
- }
156
-
157
- send "Suggest a three-word tagline for it.\r"
158
-
159
- expect {
160
- "#=> " {}
161
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
162
- }
163
-
164
- send "exit\r"
165
- expect eof
166
- EXPECT_SCRIPT
167
-
168
- drain_terminal
169
- echo
170
- echo
171
-
172
- # --- Part 4: Chat directives ---
173
-
174
- echo "--- Part 4: Chat directives ---"
175
- echo
176
- echo "Inside a chat session, directives like /help, /model,"
177
- echo "/temperature, and /checkpoint are available. These only"
178
- echo "work in chat mode, not in batch mode."
179
- echo
180
- echo "Running: aia -c ${CONFIG} --chat"
181
- echo
182
-
183
- expect <<'EXPECT_SCRIPT'
184
- set timeout 120
185
- log_user 1
186
-
187
- spawn aia -c aia_config.yml --chat
188
-
189
- expect {
190
- "#=> " {}
191
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
192
- }
193
-
194
- send "/help\r"
195
-
196
- expect {
197
- "#=> " {}
198
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
199
- }
200
-
201
- send "exit\r"
202
- expect eof
203
- EXPECT_SCRIPT
204
-
205
- drain_terminal
206
-
207
- echo
208
- echo
209
-
210
- # --- Part 5: Your turn ---
211
-
212
- echo "--- Part 5: Your turn ---"
213
- echo
214
- echo "The best way to experience chat mode is to play with it."
215
- echo
216
-
217
- aia -c "${CONFIG}" --chat
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/23_verify.sh
3
- #
4
- # Demonstrates /verify mode: VerificationNetwork.
5
- #
6
- # Two robots independently answer the same question with
7
- # slightly different system prompts, then a third "reconciler"
8
- # robot compares both answers, identifies agreements and
9
- # disagreements, and produces a final verified answer.
10
- #
11
- # All three robots use the same model -- no second model needed.
12
- #
13
- # How it works in chat:
14
- # 1. Type /verify → AIA sets verification mode for next prompt
15
- # 2. Type your question → two verifiers + reconciler run
16
- #
17
- # Prerequisites: Run 00_setup_aia.sh first
18
- # Usage: cd examples && bash 23_verify.sh
19
-
20
- set -euo pipefail
21
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
22
-
23
- if ! command -v expect &>/dev/null; then
24
- echo "ERROR: expect is not installed."
25
- echo " Install with: brew install expect"
26
- exit 1
27
- fi
28
-
29
- echo "=== Demo 23: Verify Mode (VerificationNetwork) ==="
30
- echo
31
- echo "The /verify directive runs two independent robots on the same"
32
- echo "question, then a third reconciler robot compares the answers"
33
- echo "and produces a final verified response."
34
- echo
35
- echo "Directive mechanics: /verify sets the mode for the NEXT prompt."
36
- echo "Type /verify, then type your question on the next line."
37
- echo
38
-
39
- # --- Part 1: Verify a factual question ---
40
-
41
- echo "--- Part 1: Verify a factual claim ---"
42
- echo
43
- echo "We'll type /verify, then ask about the causes of the 2008"
44
- echo "financial crisis. Two verifiers answer independently; the"
45
- echo "reconciler synthesizes a final, checked response."
46
- echo
47
- echo "Running: aia -c ${CONFIG} --chat"
48
- echo
49
-
50
- expect <<'EXPECT_SCRIPT'
51
- set timeout 300
52
- log_user 1
53
-
54
- spawn aia -c aia_config.yml --chat
55
-
56
- expect {
57
- "#=> " {}
58
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
59
- }
60
-
61
- send "/verify\r"
62
-
63
- expect {
64
- "#=> " {}
65
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
66
- }
67
-
68
- send "What were the three main causes of the 2008 global financial crisis?\r"
69
-
70
- expect {
71
- "#=> " {}
72
- timeout { puts "\n*** Timed out waiting for verification results ***"; exit 1 }
73
- }
74
-
75
- send "exit\r"
76
- expect eof
77
- EXPECT_SCRIPT
78
-
79
- drain_terminal
80
- echo
81
- echo
82
-
83
- # --- Part 2: Verify a technical question ---
84
-
85
- echo "--- Part 2: Verify a technical explanation ---"
86
- echo
87
- echo "Verification is especially useful for technical topics where"
88
- echo "subtle errors can slip through. Two independent passes catch"
89
- echo "more mistakes than one."
90
- echo
91
- echo "Running: aia -c ${CONFIG} --chat"
92
- echo
93
-
94
- expect <<'EXPECT_SCRIPT'
95
- set timeout 300
96
- log_user 1
97
-
98
- spawn aia -c aia_config.yml --chat
99
-
100
- expect {
101
- "#=> " {}
102
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
103
- }
104
-
105
- send "/verify\r"
106
-
107
- expect {
108
- "#=> " {}
109
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
110
- }
111
-
112
- send "Explain how TCP's three-way handshake works and why it guarantees reliable connection establishment.\r"
113
-
114
- expect {
115
- "#=> " {}
116
- timeout { puts "\n*** Timed out waiting for verification results ***"; exit 1 }
117
- }
118
-
119
- send "exit\r"
120
- expect eof
121
- EXPECT_SCRIPT
122
-
123
- drain_terminal
124
- echo
125
- echo
126
-
127
- # --- Part 3: Your turn ---
128
-
129
- echo "--- Part 3: Your turn ---"
130
- echo
131
- echo "Try /verify on any factual or technical question where you"
132
- echo "want cross-checked confidence rather than a single answer."
133
- echo
134
-
135
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
136
- echo "(Skipping interactive session in batch mode)"
137
- else
138
- aia -c "${CONFIG}" --chat
139
- fi
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/24_decompose.sh
3
- #
4
- # Demonstrates /decompose mode: PromptDecomposer.
5
- #
6
- # A coordinator robot analyzes whether a complex prompt can be
7
- # split into 2-5 independent sub-tasks. If decomposable, specialist
8
- # robots solve each in parallel and results are synthesized into
9
- # a unified answer. Falls back to normal mode if the prompt is not
10
- # decomposable.
11
- #
12
- # How it works in chat:
13
- # 1. Type /decompose → AIA sets decomposition mode for next prompt
14
- # 2. Type your complex question → coordinator splits, runs, synthesizes
15
- #
16
- # Prerequisites: Run 00_setup_aia.sh first
17
- # Usage: cd examples && bash 24_decompose.sh
18
-
19
- set -euo pipefail
20
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
21
-
22
- if ! command -v expect &>/dev/null; then
23
- echo "ERROR: expect is not installed."
24
- echo " Install with: brew install expect"
25
- exit 1
26
- fi
27
-
28
- echo "=== Demo 24: Decompose Mode (PromptDecomposer) ==="
29
- echo
30
- echo "The /decompose directive breaks a complex prompt into"
31
- echo "independent sub-tasks that run in parallel, then synthesizes"
32
- echo "their results into a single coherent response."
33
- echo
34
- echo "Directive mechanics: /decompose sets the mode for the NEXT prompt."
35
- echo "Type /decompose, then type your complex multi-part question."
36
- echo
37
-
38
- # --- Part 1: Decomposable multi-part question ---
39
-
40
- echo "--- Part 1: A complex decomposable question ---"
41
- echo
42
- echo "This question has several independent parts: explaining a"
43
- echo "concept, listing use cases, and making a recommendation."
44
- echo "The decomposer should split these and run them in parallel."
45
- echo
46
- echo "Running: aia -c ${CONFIG} --chat"
47
- echo
48
-
49
- expect <<'EXPECT_SCRIPT'
50
- set timeout 300
51
- log_user 1
52
-
53
- spawn aia -c aia_config.yml --chat
54
-
55
- expect {
56
- "#=> " {}
57
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
58
- }
59
-
60
- send "/decompose\r"
61
-
62
- expect {
63
- "#=> " {}
64
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
65
- }
66
-
67
- send "Explain the difference between TCP and UDP, list the top 3 use cases for each protocol, and recommend which to use for a real-time multiplayer game and explain why.\r"
68
-
69
- expect {
70
- "#=> " {}
71
- timeout { puts "\n*** Timed out waiting for decomposition results ***"; exit 1 }
72
- }
73
-
74
- send "exit\r"
75
- expect eof
76
- EXPECT_SCRIPT
77
-
78
- drain_terminal
79
- echo
80
- echo
81
-
82
- # --- Part 2: Non-decomposable question (fallback) ---
83
-
84
- echo "--- Part 2: A simple question (fallback to normal mode) ---"
85
- echo
86
- echo "If the prompt cannot be meaningfully split, the decomposer"
87
- echo "falls back to normal mode and answers directly. This shows"
88
- echo "that /decompose is safe to use on any prompt."
89
- echo
90
- echo "Running: aia -c ${CONFIG} --chat"
91
- echo
92
-
93
- expect <<'EXPECT_SCRIPT'
94
- set timeout 180
95
- log_user 1
96
-
97
- spawn aia -c aia_config.yml --chat
98
-
99
- expect {
100
- "#=> " {}
101
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
102
- }
103
-
104
- send "/decompose\r"
105
-
106
- expect {
107
- "#=> " {}
108
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
109
- }
110
-
111
- send "What is the capital of France?\r"
112
-
113
- expect {
114
- "#=> " {}
115
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
116
- }
117
-
118
- send "exit\r"
119
- expect eof
120
- EXPECT_SCRIPT
121
-
122
- drain_terminal
123
- echo
124
- echo
125
-
126
- # --- Part 3: Your turn ---
127
-
128
- echo "--- Part 3: Your turn ---"
129
- echo
130
- echo "Try /decompose on any complex, multi-part question or request."
131
- echo "The decomposer works best on prompts that have 2-5 clearly"
132
- echo "independent components."
133
- echo
134
-
135
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
136
- echo "(Skipping interactive session in batch mode)"
137
- else
138
- aia -c "${CONFIG}" --chat
139
- fi
data/examples/25_spawn.sh DELETED
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/25_spawn.sh
3
- #
4
- # Demonstrates /spawn mode: SpawnHandler.
5
- #
6
- # Dynamically creates a specialist robot on demand. You can name
7
- # the specialist type (/spawn ruby-expert) or let AIA auto-detect
8
- # from the content of your next prompt (/spawn with no args).
9
- # Spawned specialists are cached and reused within the session.
10
- #
11
- # How it works in chat:
12
- # 1. Type /spawn [optional type] → AIA sets spawn mode
13
- # 2. Type your question → specialist robot answers
14
- #
15
- # Prerequisites: Run 00_setup_aia.sh first
16
- # Usage: cd examples && bash 25_spawn.sh
17
-
18
- set -euo pipefail
19
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
20
-
21
- if ! command -v expect &>/dev/null; then
22
- echo "ERROR: expect is not installed."
23
- echo " Install with: brew install expect"
24
- exit 1
25
- fi
26
-
27
- echo "=== Demo 25: Spawn Mode (SpawnHandler) ==="
28
- echo
29
- echo "The /spawn directive creates a specialist robot to answer"
30
- echo "a domain-specific question. Specialists are cached for the"
31
- echo "session so repeated questions in the same domain reuse the"
32
- echo "same specialist robot."
33
- echo
34
- echo "Directive mechanics: /spawn [type] sets the mode for the NEXT"
35
- echo "prompt. Named type: /spawn security-expert. Auto-detect: /spawn"
36
- echo
37
-
38
- # --- Part 1: Explicit specialist type ---
39
-
40
- echo "--- Part 1: Explicit specialist (/spawn security-expert) ---"
41
- echo
42
- echo "We'll explicitly request a security expert to review a"
43
- echo "common code vulnerability pattern."
44
- echo
45
- echo "Running: aia -c ${CONFIG} --chat"
46
- echo
47
-
48
- expect <<'EXPECT_SCRIPT'
49
- set timeout 300
50
- log_user 1
51
-
52
- spawn aia -c aia_config.yml --chat
53
-
54
- expect {
55
- "#=> " {}
56
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
57
- }
58
-
59
- send "/spawn security-expert\r"
60
-
61
- expect {
62
- "#=> " {}
63
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
64
- }
65
-
66
- send "What are the top 3 SQL injection prevention techniques and how does parameterized query binding work?\r"
67
-
68
- expect {
69
- "#=> " {}
70
- timeout { puts "\n*** Timed out waiting for specialist response ***"; exit 1 }
71
- }
72
-
73
- send "exit\r"
74
- expect eof
75
- EXPECT_SCRIPT
76
-
77
- drain_terminal
78
- echo
79
- echo
80
-
81
- # --- Part 2: Auto-detect specialist ---
82
-
83
- echo "--- Part 2: Auto-detect specialist (/spawn with no args) ---"
84
- echo
85
- echo "Without a type, AIA asks the primary robot to determine what"
86
- echo "kind of specialist would best answer the next question."
87
- echo "The primary robot chooses the role and writes the specialist's"
88
- echo "system prompt automatically."
89
- echo
90
- echo "Running: aia -c ${CONFIG} --chat"
91
- echo
92
-
93
- expect <<'EXPECT_SCRIPT'
94
- set timeout 300
95
- log_user 1
96
-
97
- spawn aia -c aia_config.yml --chat
98
-
99
- expect {
100
- "#=> " {}
101
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
102
- }
103
-
104
- send "/spawn\r"
105
-
106
- expect {
107
- "#=> " {}
108
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
109
- }
110
-
111
- send "What database indexing strategies should I consider for a write-heavy time-series workload in PostgreSQL?\r"
112
-
113
- expect {
114
- "#=> " {}
115
- timeout { puts "\n*** Timed out waiting for specialist response ***"; exit 1 }
116
- }
117
-
118
- send "exit\r"
119
- expect eof
120
- EXPECT_SCRIPT
121
-
122
- drain_terminal
123
- echo
124
- echo
125
-
126
- # --- Part 3: Your turn ---
127
-
128
- echo "--- Part 3: Your turn ---"
129
- echo
130
- echo "Try /spawn ruby-expert, /spawn data-scientist, /spawn devops,"
131
- echo "or just /spawn and let AIA decide. Ask domain-specific questions"
132
- echo "that benefit from a focused specialist perspective."
133
- echo
134
-
135
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
136
- echo "(Skipping interactive session in batch mode)"
137
- else
138
- aia -c "${CONFIG}" --chat
139
- fi