aia 2.0.0.0.pre.beta2 → 2.0.1

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 (227) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +152 -223
  3. data/README.md +41 -18
  4. data/bin/aia +8 -3
  5. data/lib/aia/aia_completion.bash +2 -3
  6. data/lib/aia/aia_completion.fish +6 -5
  7. data/lib/aia/aia_completion.zsh +2 -3
  8. data/lib/aia/chat_loop.rb +16 -14
  9. data/lib/aia/config/cli_parser.rb +123 -91
  10. data/lib/aia/config/defaults.yml +18 -40
  11. data/lib/aia/config/mcp_parser.rb +30 -36
  12. data/lib/aia/config/model_spec.rb +8 -14
  13. data/lib/aia/config/validator.rb +102 -103
  14. data/lib/aia/config/value_caster.rb +76 -0
  15. data/lib/aia/config.rb +70 -53
  16. data/lib/aia/crew.rb +29 -19
  17. data/lib/aia/debate_handler.rb +27 -10
  18. data/lib/aia/directives/configuration_directives.rb +55 -14
  19. data/lib/aia/directives/context_directives.rb +24 -12
  20. data/lib/aia/directives/execution_directives.rb +18 -23
  21. data/lib/aia/directives/model_directives.rb +41 -104
  22. data/lib/aia/directives/utility_directives.rb +16 -17
  23. data/lib/aia/directives/web_and_file_directives.rb +21 -14
  24. data/lib/aia/fact_asserter.rb +3 -3
  25. data/lib/aia/history_transfer.rb +64 -24
  26. data/lib/aia/logger.rb +14 -46
  27. data/lib/aia/mcp_config_normalizer.rb +27 -14
  28. data/lib/aia/mcp_connection_manager.rb +181 -184
  29. data/lib/aia/mcp_discovery.rb +43 -15
  30. data/lib/aia/mcp_grouper.rb +2 -1
  31. data/lib/aia/mcp_server_config.rb +20 -2
  32. data/lib/aia/mcp_utility.rb +24 -19
  33. data/lib/aia/mention_router.rb +15 -2
  34. data/lib/aia/modality_query.rb +36 -0
  35. data/lib/aia/model_alias_registry.rb +11 -11
  36. data/lib/aia/model_registry.rb +75 -0
  37. data/lib/aia/network_builder.rb +8 -7
  38. data/lib/aia/patches/mcp_stdio_stderr.rb +102 -0
  39. data/lib/aia/patches/ruby_llm_streaming_error.rb +21 -4
  40. data/lib/aia/patches/ruby_llm_tool_param_compat.rb +18 -0
  41. data/lib/aia/pipeline_orchestrator.rb +71 -38
  42. data/lib/aia/prompt_decomposer.rb +1 -1
  43. data/lib/aia/prompt_handler.rb +56 -29
  44. data/lib/aia/provider_registry.rb +105 -0
  45. data/lib/aia/robot_builder.rb +1 -1
  46. data/lib/aia/robot_factory.rb +67 -63
  47. data/lib/aia/robot_sync.rb +79 -0
  48. data/lib/aia/role_catalog.rb +89 -0
  49. data/lib/aia/session.rb +25 -11
  50. data/lib/aia/skill_utils.rb +60 -19
  51. data/lib/aia/spawn_handler.rb +16 -4
  52. data/lib/aia/spawn_spec_parser.rb +6 -7
  53. data/lib/aia/special_mode_handler.rb +28 -25
  54. data/lib/aia/speech.rb +70 -34
  55. data/lib/aia/startup_coordinator.rb +17 -92
  56. data/lib/aia/streaming_runner.rb +10 -2
  57. data/lib/aia/system_prompt_assembler.rb +12 -11
  58. data/lib/aia/task_board.rb +60 -0
  59. data/lib/aia/tool_approver.rb +205 -0
  60. data/lib/aia/tool_filter.rb +1 -10
  61. data/lib/aia/tool_filter_strategy.rb +12 -1
  62. data/lib/aia/tool_introspection.rb +9 -1
  63. data/lib/aia/tool_loader.rb +67 -33
  64. data/lib/aia/tool_utility.rb +6 -5
  65. data/lib/aia/tools/delegate_to_foreman_tool.rb +6 -4
  66. data/lib/aia/tools/recruit_robot_tool.rb +12 -12
  67. data/lib/aia/tools/reskill_robot_tool.rb +7 -7
  68. data/lib/aia/tools/task_board_tool.rb +16 -16
  69. data/lib/aia/trakflow_bridge.rb +14 -8
  70. data/lib/aia/turn_state.rb +31 -8
  71. data/lib/aia/ui_presenter.rb +16 -0
  72. data/lib/aia/utility.rb +6 -24
  73. data/lib/aia/variable_input_collector.rb +0 -3
  74. data/lib/aia/verification_network.rb +9 -10
  75. data/lib/aia/version.rb +1 -9
  76. data/lib/aia.rb +34 -8
  77. metadata +20 -161
  78. data/.better-commits.json +0 -150
  79. data/.config/tocer/configuration.yml +0 -6
  80. data/.envrc +0 -19
  81. data/.loki +0 -11
  82. data/.reek.yml +0 -160
  83. data/.rubocop.yml +0 -116
  84. data/.rubocop_strict.yml +0 -15
  85. data/.version +0 -1
  86. data/COMMITS.md +0 -196
  87. data/IMPLEMENTATION_PLAN.md +0 -506
  88. data/Rakefile +0 -47
  89. data/_typos.toml +0 -10
  90. data/aia.gemspec +0 -92
  91. data/architecture_review.md +0 -314
  92. data/config/aia.yml +0 -13
  93. data/docs/AGENTS.md +0 -40
  94. data/docs/advanced-prompting.md +0 -814
  95. data/docs/assets/images/aia.png +0 -0
  96. data/docs/cli-reference.md +0 -1241
  97. data/docs/configuration.md +0 -747
  98. data/docs/contributing.md +0 -386
  99. data/docs/directives-reference.md +0 -1145
  100. data/docs/examples/index.md +0 -277
  101. data/docs/examples/mcp/index.md +0 -475
  102. data/docs/examples/prompts/analysis/index.md +0 -78
  103. data/docs/examples/prompts/automation/index.md +0 -109
  104. data/docs/examples/prompts/development/index.md +0 -125
  105. data/docs/examples/prompts/index.md +0 -333
  106. data/docs/examples/prompts/learning/index.md +0 -127
  107. data/docs/examples/prompts/writing/index.md +0 -62
  108. data/docs/examples/tools/index.md +0 -282
  109. data/docs/faq.md +0 -578
  110. data/docs/guides/available-models.md +0 -366
  111. data/docs/guides/basic-usage.md +0 -478
  112. data/docs/guides/chat.md +0 -680
  113. data/docs/guides/crew.md +0 -239
  114. data/docs/guides/executable-prompts.md +0 -331
  115. data/docs/guides/first-prompt.md +0 -454
  116. data/docs/guides/getting-started.md +0 -455
  117. data/docs/guides/image-generation.md +0 -507
  118. data/docs/guides/index.md +0 -48
  119. data/docs/guides/local-models.md +0 -306
  120. data/docs/guides/migrate-prompts.md +0 -335
  121. data/docs/guides/models.md +0 -1017
  122. data/docs/guides/shared-tools.md +0 -254
  123. data/docs/guides/tools.md +0 -831
  124. data/docs/index.md +0 -259
  125. data/docs/installation.md +0 -274
  126. data/docs/mcp-integration.md +0 -603
  127. data/docs/prompt_management.md +0 -665
  128. data/docs/security.md +0 -674
  129. data/docs/special_projects_guide.md +0 -386
  130. data/docs/tools-and-mcp-examples.md +0 -1211
  131. data/docs/workflows-and-pipelines.md +0 -636
  132. data/examples/.gitignore +0 -2
  133. data/examples/00_setup_aia.sh +0 -111
  134. data/examples/01_basic_usage.sh +0 -23
  135. data/examples/02_frontmatter.sh +0 -33
  136. data/examples/03_shell_integration.sh +0 -55
  137. data/examples/04_erb_templating.sh +0 -56
  138. data/examples/05_shell_then_erb.sh +0 -38
  139. data/examples/06_prompt_chaining.sh +0 -59
  140. data/examples/07_pipeline.sh +0 -46
  141. data/examples/08_context_files.sh +0 -43
  142. data/examples/09_roles.sh +0 -67
  143. data/examples/10_stdin_piping.sh +0 -49
  144. data/examples/11_multi_model.sh +0 -65
  145. data/examples/12_token_usage.sh +0 -52
  146. data/examples/13_cost_tracking.sh +0 -68
  147. data/examples/14_output_file.sh +0 -91
  148. data/examples/15_parameters.sh +0 -68
  149. data/examples/16_directives.sh +0 -113
  150. data/examples/17_require_and_conditionals.sh +0 -68
  151. data/examples/18_tools.sh +0 -61
  152. data/examples/19_local_tools.sh +0 -34
  153. data/examples/20_mcp_servers.sh +0 -102
  154. data/examples/21_executable_prompts.sh +0 -78
  155. data/examples/22_chat_mode.sh +0 -217
  156. data/examples/23_verify.sh +0 -139
  157. data/examples/24_decompose.sh +0 -139
  158. data/examples/25_spawn.sh +0 -139
  159. data/examples/26_debate.sh +0 -97
  160. data/examples/27_mention_routing.sh +0 -157
  161. data/examples/28_model_switching.sh +0 -106
  162. data/examples/29_agent_harness.sh +0 -177
  163. data/examples/README.md +0 -321
  164. data/examples/advanced_multi_robot_capabilities_without_examples.md +0 -106
  165. data/examples/aia_config.yml +0 -22
  166. data/examples/aia_config_orchestrator.yml +0 -45
  167. data/examples/aia_config_with_mcp.yml +0 -21
  168. data/examples/common.sh +0 -39
  169. data/examples/context/project_goals.md +0 -6
  170. data/examples/context/tech_stack.md +0 -7
  171. data/examples/directives/timestamp_directive.rb +0 -22
  172. data/examples/mcp/filesystem.json +0 -9
  173. data/examples/prompts_dir/analyze.md +0 -2
  174. data/examples/prompts_dir/brainstorm.md +0 -2
  175. data/examples/prompts_dir/conditional.md +0 -17
  176. data/examples/prompts_dir/creative.md +0 -4
  177. data/examples/prompts_dir/erbinfo.md +0 -5
  178. data/examples/prompts_dir/erbinfo_raw.md +0 -8
  179. data/examples/prompts_dir/evaluate.md +0 -2
  180. data/examples/prompts_dir/explain_joke.md +0 -1
  181. data/examples/prompts_dir/explain_recursion.md +0 -1
  182. data/examples/prompts_dir/fun_fact +0 -3
  183. data/examples/prompts_dir/greeting.md +0 -8
  184. data/examples/prompts_dir/greeting_required.md +0 -7
  185. data/examples/prompts_dir/hello.md +0 -1
  186. data/examples/prompts_dir/includes/ruby_facts.md +0 -4
  187. data/examples/prompts_dir/limerick.md +0 -1
  188. data/examples/prompts_dir/list_with_mcp.md +0 -3
  189. data/examples/prompts_dir/pick_best.md +0 -2
  190. data/examples/prompts_dir/project_summary +0 -12
  191. data/examples/prompts_dir/quiz_with_include.md +0 -6
  192. data/examples/prompts_dir/require_demo.md +0 -5
  193. data/examples/prompts_dir/roles/formal.md +0 -3
  194. data/examples/prompts_dir/roles/orchestrator.md +0 -21
  195. data/examples/prompts_dir/roles/pirate.md +0 -3
  196. data/examples/prompts_dir/shell_then_erb.md +0 -6
  197. data/examples/prompts_dir/sort_compare.md +0 -2
  198. data/examples/prompts_dir/summarize_context.md +0 -2
  199. data/examples/prompts_dir/sysinfo.md +0 -5
  200. data/examples/prompts_dir/sysinfo_raw.md +0 -8
  201. data/examples/prompts_dir/tagline.md +0 -1
  202. data/examples/prompts_dir/tell_joke.md +0 -1
  203. data/examples/prompts_dir/tell_joke_with_next.md +0 -4
  204. data/examples/prompts_dir/use_local_tool.md +0 -8
  205. data/examples/prompts_dir/use_tools.md +0 -8
  206. data/examples/prompts_dir/weather.md +0 -2
  207. data/examples/prompts_dir/whats_new.md +0 -2
  208. data/examples/prompts_dir/with_timestamp.md +0 -5
  209. data/examples/requirements/sinatra_taskflow_app.md +0 -139
  210. data/examples/rules/01_classify_ruby.rb +0 -16
  211. data/examples/rules/02_prefer_claude_for_code.rb +0 -19
  212. data/examples/rules/03_gate_prompt_length.rb +0 -19
  213. data/examples/rules/04_tool_selection.rb +0 -41
  214. data/examples/rules/README.md +0 -30
  215. data/examples/run_all.sh +0 -294
  216. data/examples/tools/word_count_tool.rb +0 -30
  217. data/lib/AGENTS.md +0 -57
  218. data/lib/aia/model_switch_handler.rb +0 -100
  219. data/mcp_servers/README.md +0 -110
  220. data/mcp_servers/apple-mcp.json +0 -8
  221. data/mcp_servers/filesystem.json +0 -9
  222. data/mcp_servers/mcp_server_chart.json +0 -11
  223. data/mcp_servers/playwright_one.json +0 -8
  224. data/mcp_servers/playwright_server_definition.json +0 -9
  225. data/mcp_servers/playwright_two.json +0 -8
  226. data/mcp_servers/tavily_mcp_server.json +0 -8
  227. data/mkdocs.yml +0 -169
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/26_debate_fixed.sh
3
- #
4
- # Fixed version of the debate demonstration script
5
- #
6
- # Demonstrates /debate mode: DebateHandler.
7
- #
8
- # Two robots debate a topic across multiple rounds. Each round,
9
- # every robot responds to the previous arguments. Stops when any
10
- # robot says CONVERGED or after 5 rounds. Uses SimilarityScorer
11
- # to also detect convergence when responses become too similar.
12
- #
13
- # Requires a 2-model network (-m MODEL_A,MODEL_B).
14
-
15
- set -euo pipefail
16
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
17
-
18
- if ! command -v expect &>/dev/null; then
19
- echo "ERROR: expect is not installed."
20
- echo " Install with: brew install expect"
21
- exit 1
22
- fi
23
-
24
- MODEL_A="gpt-4.1"
25
- MODEL_B="gpt-4.1-mini"
26
-
27
- echo "=== Demo 26: Debate Mode (DebateHandler) ==="
28
- echo
29
- echo "The /debate directive pits two robots against each other in"
30
- echo "a structured multi-round debate. Each robot sees what the"
31
- echo "other said in the previous round and responds. The debate"
32
- echo "ends when a robot says CONVERGED or after 5 rounds."
33
- echo
34
- echo "Using models: ${MODEL_A} vs ${MODEL_B}"
35
- echo "Robot names: Tobor (gpt-4.1) and Vanguard (gpt-4.1-mini)"
36
- echo
37
-
38
- # --- Part 1: A technical debate ---
39
-
40
- echo "--- Part 1: Technical debate ---"
41
- echo
42
- echo "Both models will debate the best approach to API design."
43
- echo "Watch how their positions evolve across rounds."
44
- echo
45
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
46
- echo
47
-
48
- # Create the expect script with proper variable substitution
49
- expect -c "
50
- set timeout 600
51
- log_user 1
52
-
53
- spawn aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat
54
-
55
- expect {
56
- \"#=> \" {}
57
- timeout { puts \"\n*** Timed out waiting for chat prompt ***\"; exit 1 }
58
- }
59
-
60
- send \"/debate\r\"
61
-
62
- expect {
63
- \"#=> \" {}
64
- timeout { puts \"\n*** Timed out waiting for directive confirmation ***\"; exit 1 }
65
- }
66
-
67
- send \"REST vs GraphQL: which is the better default choice for a new web API in 2025, and why?\r\"
68
-
69
- expect {
70
- \"#=> \" {}
71
- timeout { puts \"\n*** Timed out waiting for debate results ***\"; exit 1 }
72
- }
73
-
74
- send \"exit\r\"
75
- expect eof
76
- "
77
-
78
- drain_terminal
79
- echo
80
- echo
81
-
82
- # --- Part 2: Your turn ---
83
-
84
- echo "--- Part 2: Your turn ---"
85
- echo
86
- echo "Try /debate on any topic where two perspectives are valuable:"
87
- echo "architecture decisions, tradeoffs, design choices, or even"
88
- echo "open-ended questions where you want multiple viewpoints stress-tested."
89
- echo
90
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
91
- echo
92
-
93
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
94
- echo "(Skipping interactive session in batch mode)"
95
- else
96
- aia -c "${CONFIG}" -m "${MODEL_A},${MODEL_B}" --chat
97
- fi
@@ -1,157 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/27_mention_routing.sh
3
- #
4
- # Demonstrates @mention routing in a multi-model network.
5
- #
6
- # In a 2-model chat session, prefix any message with @RobotName
7
- # to direct it to a specific robot. Only that robot responds.
8
- # Robot names are assigned by AIA based on the model:
9
- # gpt-4.1 → Tobor (first robot always gets the name "Tobor")
10
- # gpt-4.1-mini → Vanguard
11
- #
12
- # If the @name is not recognized, AIA lists available robot names.
13
- #
14
- # Requires a 2-model network (-m MODEL_A,MODEL_B).
15
- #
16
- # Prerequisites: Run 00_setup_aia.sh first (OPENAI_API_KEY must be set).
17
- # Usage: cd examples && bash 27_mention_routing.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
- MODEL_A="gpt-4.1"
29
- MODEL_B="gpt-4.1-mini"
30
-
31
- echo "=== Demo 27: @mention Routing ==="
32
- echo
33
- echo "In a multi-model network, prefix your message with @RobotName"
34
- echo "to direct it to a specific robot. Only that robot responds."
35
- echo
36
- echo "Using models: ${MODEL_A} vs ${MODEL_B}"
37
- echo "Robot names: Tobor (gpt-4.1) and Vanguard (gpt-4.1-mini)"
38
- echo
39
-
40
- # --- Part 1: Route to Tobor (gpt-4.1) ---
41
-
42
- echo "--- Part 1: Direct a question to @Tobor ---"
43
- echo
44
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
45
- echo
46
-
47
- expect <<'EXPECT_SCRIPT'
48
- set timeout 180
49
- log_user 1
50
-
51
- spawn aia -c aia_config.yml -m gpt-4.1,gpt-4.1-mini --chat
52
-
53
- expect {
54
- "#=> " {}
55
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
56
- }
57
-
58
- send "@Tobor What is your favorite metaphor for explaining recursion?\r"
59
-
60
- expect {
61
- "#=> " {}
62
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
63
- }
64
-
65
- send "exit\r"
66
- expect eof
67
- EXPECT_SCRIPT
68
-
69
- drain_terminal
70
- echo
71
- echo
72
-
73
- # --- Part 2: Route to Vanguard (gpt-4.1-mini) ---
74
-
75
- echo "--- Part 2: Direct a question to @Vanguard ---"
76
- echo
77
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
78
- echo
79
-
80
- expect <<'EXPECT_SCRIPT'
81
- set timeout 180
82
- log_user 1
83
-
84
- spawn aia -c aia_config.yml -m gpt-4.1,gpt-4.1-mini --chat
85
-
86
- expect {
87
- "#=> " {}
88
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
89
- }
90
-
91
- send "@Vanguard Describe the CAP theorem in one sentence.\r"
92
-
93
- expect {
94
- "#=> " {}
95
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
96
- }
97
-
98
- send "exit\r"
99
- expect eof
100
- EXPECT_SCRIPT
101
-
102
- drain_terminal
103
- echo
104
- echo
105
-
106
- # --- Part 3: Unknown @mention lists available robots ---
107
-
108
- echo "--- Part 3: Unknown @mention shows available robots ---"
109
- echo
110
- echo "If you @mention a name that doesn't match any robot,"
111
- echo "AIA lists the available robot names so you can correct it."
112
- echo
113
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
114
- echo
115
-
116
- expect <<'EXPECT_SCRIPT'
117
- set timeout 60
118
- log_user 1
119
-
120
- spawn aia -c aia_config.yml -m gpt-4.1,gpt-4.1-mini --chat
121
-
122
- expect {
123
- "#=> " {}
124
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
125
- }
126
-
127
- send "@nonexistent What is 2 + 2?\r"
128
-
129
- expect {
130
- "#=> " {}
131
- timeout { puts "\n*** Timed out waiting for response ***"; exit 1 }
132
- }
133
-
134
- send "exit\r"
135
- expect eof
136
- EXPECT_SCRIPT
137
-
138
- drain_terminal
139
- echo
140
- echo
141
-
142
- # --- Part 4: Mix @mention and normal turns ---
143
-
144
- echo "--- Part 4: Mix directed and undirected turns ---"
145
- echo
146
- echo "In a session you can freely mix @mention turns (one robot)"
147
- echo "with normal turns (all robots). This shows how to hold a"
148
- echo "selective conversation across a network."
149
- echo
150
- echo "Running: aia -c ${CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
151
- echo
152
-
153
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
154
- echo "(Skipping interactive session in batch mode)"
155
- else
156
- aia -c "${CONFIG}" -m "${MODEL_A},${MODEL_B}" --chat
157
- fi
@@ -1,106 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/28_model_switching.sh
3
- #
4
- # Demonstrates /model directive: switching models mid-conversation.
5
- #
6
- # The /model directive rebuilds the active robot with a new model
7
- # while preserving the full conversation history. Context is
8
- # transferred so the new model can see everything discussed so far.
9
- #
10
- # Note: Natural language model switching ("use gpt-4.1-mini instead")
11
- # is detected by ModelSwitchHandler but currently stubbed. Use
12
- # /model directly for reliable in-session model changes.
13
- #
14
- # Prerequisites:
15
- # - Run 00_setup_aia.sh first (OPENAI_API_KEY must be set)
16
- # Usage: cd examples && bash 28_model_switching.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
- MODEL_A="gpt-4.1"
28
- MODEL_B="gpt-4.1-mini"
29
-
30
- echo "=== Demo 28: Model Switching (/model directive) ==="
31
- echo
32
- echo "The /model directive switches the active model mid-conversation."
33
- echo "Conversation history is transferred so the new model has"
34
- echo "full context of everything discussed before the switch."
35
- echo
36
- echo "Starting model: ${MODEL_A}"
37
- echo "Switch target: ${MODEL_B}"
38
- echo
39
-
40
- # --- Part 1: Ask a question, switch models, ask a follow-up ---
41
-
42
- echo "--- Part 1: Ask a question, switch models, ask a follow-up ---"
43
- echo
44
- echo "We'll ask a question with ${MODEL_A}, switch to ${MODEL_B},"
45
- echo "then ask a follow-up. The second model should reference the"
46
- echo "first exchange because history is preserved across the switch."
47
- echo
48
- echo "Running: aia -c ${CONFIG} --chat"
49
- echo
50
-
51
- expect <<'EXPECT_SCRIPT'
52
- set timeout 180
53
- log_user 1
54
-
55
- spawn aia -c aia_config.yml --chat
56
-
57
- expect {
58
- "#=> " {}
59
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
60
- }
61
-
62
- send "Name three key differences between a process and a thread.\r"
63
-
64
- expect {
65
- "#=> " {}
66
- timeout { puts "\n*** Timed out waiting for first response ***"; exit 1 }
67
- }
68
-
69
- send "/model gpt-4.1-mini\r"
70
-
71
- expect {
72
- "#=> " {}
73
- timeout { puts "\n*** Timed out waiting for model switch ***"; exit 1 }
74
- }
75
-
76
- send "Based on what you just said, which is more appropriate for a CPU-bound image processing pipeline?\r"
77
-
78
- expect {
79
- "#=> " {}
80
- timeout { puts "\n*** Timed out waiting for follow-up response ***"; exit 1 }
81
- }
82
-
83
- send "exit\r"
84
- expect eof
85
- EXPECT_SCRIPT
86
-
87
- drain_terminal
88
- echo
89
- echo
90
-
91
- # --- Part 2: Your turn ---
92
-
93
- echo "--- Part 2: Your turn ---"
94
- echo
95
- echo "Use /model <name> any time during a chat to switch models."
96
- echo "The new model picks up the full conversation history."
97
- echo "You can switch back and forth as many times as you like."
98
- echo
99
- echo "Running: aia -c ${CONFIG} --chat"
100
- echo
101
-
102
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
103
- echo "(Skipping interactive session in batch mode)"
104
- else
105
- aia -c "${CONFIG}" --chat
106
- fi
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/29_agent_harness.sh
3
- #
4
- # Demonstrates AIA as a full agent harness using 3-tier layered orchestration.
5
- #
6
- # A complete application requirements document is fed to the /orchestrate
7
- # directive. AIA runs a three-tier execution:
8
- #
9
- # Tier 1 — Tobor (orchestrator)
10
- # Reads the full requirements and decomposes them into independent
11
- # architectural layers (e.g. Infrastructure, Data Models, Auth, Routes, Views).
12
- #
13
- # Tier 2 — Lead agents (one per layer)
14
- # Each lead agent receives its layer's requirements and further decomposes
15
- # them into specific implementation tasks, assigning a specialist type to
16
- # each task (e.g. sequel-migration-writer, sinatra-route-builder).
17
- #
18
- # Tier 3 — Specialist robots (one per task)
19
- # Each specialist receives a focused, concrete task and produces an actual
20
- # implementation artifact: a code file, migration, route handler, or spec.
21
- #
22
- # Synthesis
23
- # Each lead agent synthesizes its layer's artifacts into a summary.
24
- # Tobor then synthesizes all layer summaries into a final integration report.
25
- #
26
- # The application being built: TaskFlow — a multi-user project and task
27
- # management web app using Ruby, Sinatra, Sequel (SQLite), and ERB templates.
28
- # Full requirements: examples/requirements/sinatra_taskflow_app.md
29
- #
30
- # Prerequisites: Run 00_setup_aia.sh first (OPENAI_API_KEY must be set)
31
- # Requires: expect (brew install expect)
32
- # Usage: cd examples && bash 29_agent_harness.sh
33
-
34
- set -euo pipefail
35
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
36
-
37
- if ! command -v expect &>/dev/null; then
38
- echo "ERROR: expect is not installed."
39
- echo " Install with: brew install expect"
40
- exit 1
41
- fi
42
-
43
- MODEL_A="gpt-4.1"
44
- MODEL_B="gpt-4.1-mini"
45
- ORCH_CONFIG="aia_config_orchestrator.yml"
46
- REQUIREMENTS="requirements/sinatra_taskflow_app.md"
47
-
48
- echo "=== Demo 29: AIA Agent Harness — 3-Tier Layered Orchestration ==="
49
- echo
50
- echo "Application being built:"
51
- echo " TaskFlow — a multi-user project and task management web app"
52
- echo " Stack: Ruby + Sinatra + Sequel (SQLite) + ERB + Bootstrap 5"
53
- echo
54
- echo "Execution model:"
55
- echo " Tier 1 Tobor (orchestrator) decomposes requirements into layers"
56
- echo " Tier 2 One lead agent per layer decomposes into specialist tasks"
57
- echo " Tier 3 One specialist per task produces the implementation artifact"
58
- echo
59
-
60
- if [[ ! -f "${REQUIREMENTS}" ]]; then
61
- echo "ERROR: Requirements file not found: ${REQUIREMENTS}"
62
- echo " Expected at: examples/requirements/sinatra_taskflow_app.md"
63
- exit 1
64
- fi
65
-
66
- # --- Orchestration run ---
67
-
68
- echo "--- Orchestrated build: /orchestrate ---"
69
- echo
70
- echo "The directive /orchestrate enables 3-tier mode for the next prompt."
71
- echo "The next message is the full application requirements document."
72
- echo "AIA will:"
73
- echo " 1. Decompose requirements into architectural layers"
74
- echo " 2. Spawn a lead agent for each layer"
75
- echo " 3. Have each lead spawn specialists for its tasks"
76
- echo " 4. Collect artifacts and synthesize across all layers"
77
- echo
78
- echo "Requirements document: ${REQUIREMENTS}"
79
- echo "Running: aia -c ${ORCH_CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
80
- echo
81
- echo "Note: This demonstration runs 3+ tiers of agents in sequence."
82
- echo " Each layer spawns 2-4 specialists. Allow 10-20 minutes"
83
- echo " depending on OpenAI API response times."
84
- echo
85
-
86
- REQUIREMENTS_CONTENT=$(cat "${REQUIREMENTS}")
87
-
88
- expect <<EXPECT_SCRIPT
89
- set timeout 1800
90
- log_user 1
91
-
92
- spawn aia -c aia_config_orchestrator.yml -m gpt-4.1,gpt-4.1-mini --chat
93
-
94
- expect {
95
- "#=> " {}
96
- timeout { puts "\n*** Timed out waiting for chat prompt ***"; exit 1 }
97
- }
98
-
99
- send "/orchestrate\r"
100
-
101
- expect {
102
- "#=> " {}
103
- timeout { puts "\n*** Timed out waiting for directive confirmation ***"; exit 1 }
104
- }
105
-
106
- send {${REQUIREMENTS_CONTENT}}
107
- send "\r"
108
-
109
- expect {
110
- "#=> " {}
111
- timeout { puts "\n*** Timed out waiting for orchestration to complete ***"; exit 1 }
112
- }
113
-
114
- send "exit\r"
115
- expect eof
116
- EXPECT_SCRIPT
117
-
118
- drain_terminal
119
- echo
120
- echo
121
-
122
- # --- Show what was built ---
123
-
124
- echo "--- Generated application files ---"
125
- echo
126
-
127
- BUILD_DIR=$(ls -dt orchestrated_build_* 2>/dev/null | head -1)
128
-
129
- if [[ -z "${BUILD_DIR}" ]]; then
130
- echo "No build directory found. The orchestration may not have completed."
131
- else
132
- echo "Build directory: ${BUILD_DIR}"
133
- echo
134
- echo "Files produced by the agent team:"
135
- find "${BUILD_DIR}" -type f | sort | grep -v INTEGRATION_REPORT.md | while read -r f; do
136
- rel="${f#${BUILD_DIR}/}"
137
- lines=$(wc -l < "${f}" 2>/dev/null | tr -d ' ' || echo "?")
138
- printf " %-50s (%s lines)\n" "${rel}" "${lines}"
139
- done
140
- echo
141
- REPORT="${BUILD_DIR}/INTEGRATION_REPORT.md"
142
- if [[ -f "${REPORT}" ]]; then
143
- echo "--- INTEGRATION_REPORT.md ---"
144
- echo
145
- cat "${REPORT}"
146
- echo
147
- fi
148
-
149
- # Show a sample generated file (first non-report Ruby file found)
150
- SAMPLE=$(find "${BUILD_DIR}" -type f -name "*.rb" | sort | head -1)
151
- if [[ -n "${SAMPLE}" ]]; then
152
- echo "--- Sample artifact: ${SAMPLE#${BUILD_DIR}/} ---"
153
- echo
154
- cat "${SAMPLE}"
155
- echo
156
- fi
157
- fi
158
-
159
- # --- Interactive session ---
160
-
161
- echo "--- Interactive orchestration session ---"
162
- echo
163
- echo "The same session is now open for you to:"
164
- echo " /orchestrate run 3-tier orchestration on any requirements prompt"
165
- echo " /spawn <type> create a specialist lead agent for a focused task"
166
- echo " /decompose parallel workstreams for multi-part questions"
167
- echo " @Tobor address the orchestrator directly"
168
- echo " @Quark address the specialist network robot directly"
169
- echo
170
- echo "Running: aia -c ${ORCH_CONFIG} -m ${MODEL_A},${MODEL_B} --chat"
171
- echo
172
-
173
- if [[ "${BATCH_MODE:-}" == "true" ]]; then
174
- echo "(Skipping interactive session in batch mode)"
175
- else
176
- aia -c "${ORCH_CONFIG}" -m "${MODEL_A},${MODEL_B}" --chat
177
- fi