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,52 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/12_token_usage.sh
3
- #
4
- # Demonstrates the --tokens flag, which displays token usage
5
- # after each response. When used with multiple models this lets
6
- # you compare how verbose each model is.
7
- #
8
- # Prerequisites: Run 00_setup_aia.sh first (OPENAI_API_KEY must be set).
9
- # Usage: cd examples && bash 12_token_usage.sh
10
-
11
- set -euo pipefail
12
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
13
-
14
- MODEL_A="gpt-4.1"
15
- MODEL_B="gpt-4.1-mini"
16
-
17
- echo "=== Demo 12: Token Usage ==="
18
- echo
19
- echo "The --tokens flag shows input and output token counts after"
20
- echo "each response. This is useful for monitoring usage and"
21
- echo "comparing verbosity across models."
22
- echo
23
-
24
- echo "The prompt file prompts_dir/sort_compare.md contains:"
25
- echo "==="
26
- cat prompts_dir/sort_compare.md
27
- echo "==="
28
- echo
29
-
30
- # --- Part 1: Single model with --tokens ---
31
-
32
- echo "--- Part 1: Single model with --tokens ---"
33
- echo
34
- echo "Running: aia -c ${CONFIG} --no-output --tokens sort_compare"
35
- echo
36
-
37
- aia -c "${CONFIG}" --no-output --tokens sort_compare
38
-
39
- echo
40
- echo
41
-
42
- # --- Part 2: Multiple models with --tokens ---
43
-
44
- echo "--- Part 2: Multiple models with --tokens ---"
45
- echo
46
- echo "With multiple models, token counts are shown for each model"
47
- echo "so you can compare their usage side by side."
48
- echo
49
- echo "Running: aia -c ${CONFIG} --no-output --tokens -m ${MODEL_A},${MODEL_B} sort_compare"
50
- echo
51
-
52
- aia -c "${CONFIG}" --no-output --tokens -m "${MODEL_A},${MODEL_B}" sort_compare
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/13_cost_tracking.sh
3
- #
4
- # Demonstrates the --cost flag, which displays per-model cost
5
- # estimates alongside token usage. This is useful for comparing
6
- # the price/performance of different providers.
7
- #
8
- # --cost implies --tokens, so you do not need both flags.
9
- #
10
- # This demo uses two inexpensive cloud models:
11
- # - gpt-4o-mini (OpenAI)
12
- # - claude-haiku-4-5 (Anthropic)
13
- #
14
- # Prerequisites:
15
- # - Run 00_setup_aia.sh first
16
- # - Set OPENAI_API_KEY and ANTHROPIC_API_KEY in your environment
17
- # Usage: cd examples && bash 13_cost_tracking.sh
18
-
19
- set -euo pipefail
20
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
21
-
22
- MODEL_A="gpt-4o-mini"
23
- MODEL_B="claude-haiku-4-5"
24
-
25
- echo "=== Demo 13: Cost Tracking ==="
26
- echo
27
- echo "The --cost flag shows token usage AND estimated cost for"
28
- echo "each model. With multiple models you get a side-by-side"
29
- echo "cost comparison table with totals."
30
- echo
31
- echo " Models: ${MODEL_A} (OpenAI), ${MODEL_B} (Anthropic)"
32
- echo
33
-
34
- # --- Check API keys ---
35
-
36
- missing_keys=()
37
- if [ -z "${OPENAI_API_KEY:-}" ]; then
38
- missing_keys+=("OPENAI_API_KEY")
39
- fi
40
- if [ -z "${ANTHROPIC_API_KEY:-}" ]; then
41
- missing_keys+=("ANTHROPIC_API_KEY")
42
- fi
43
-
44
- if [ ${#missing_keys[@]} -gt 0 ]; then
45
- echo "ERROR: The following API keys are not set:"
46
- for key in "${missing_keys[@]}"; do
47
- echo " - ${key}"
48
- done
49
- echo
50
- echo "Export them before running this demo:"
51
- for key in "${missing_keys[@]}"; do
52
- echo " export ${key}=your-key-here"
53
- done
54
- exit 1
55
- fi
56
-
57
- echo "The prompt file prompts_dir/whats_new.md contains:"
58
- echo "==="
59
- cat prompts_dir/whats_new.md
60
- echo "==="
61
- echo
62
-
63
- # --- Run with --cost ---
64
-
65
- echo "Running: aia -c ${CONFIG} --no-output --cost -m ${MODEL_A},${MODEL_B} whats_new"
66
- echo
67
-
68
- aia -c "${CONFIG}" --no-output --cost -m "${MODEL_A},${MODEL_B}" whats_new
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/14_output_file.sh
3
- #
4
- # Demonstrates the -o / --output option for saving responses
5
- # to a file. Also shows --append for accumulating multiple
6
- # responses in the same file.
7
- #
8
- # Options:
9
- # -o FILE Write response to FILE (overwrites)
10
- # -o Write response to temp.md (default name)
11
- # --no-output Do not write to any file
12
- # -a / --append Append instead of overwriting
13
- #
14
- # Prerequisites: Run 00_setup_aia.sh first.
15
- # Usage: cd examples && bash 14_output_file.sh
16
-
17
- set -euo pipefail
18
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
19
-
20
- OUTPUT_FILE="demo_output.md"
21
-
22
- # Clean up from previous runs
23
- rm -f "${OUTPUT_FILE}"
24
-
25
- echo "=== Demo 14: Output to File ==="
26
- echo
27
- echo "The -o flag saves the model's response to a file."
28
- echo "By default, each run overwrites the file. Use --append"
29
- echo "to accumulate responses."
30
- echo
31
-
32
- echo "The prompt file prompts_dir/limerick.md contains:"
33
- echo "==="
34
- cat prompts_dir/limerick.md
35
- echo "==="
36
- echo
37
-
38
- # --- Part 1: Write to a file ---
39
-
40
- echo "--- Part 1: Save response to a file ---"
41
- echo
42
- echo "Running: aia -c ${CONFIG} -o ${OUTPUT_FILE} limerick"
43
- echo
44
-
45
- aia -c "${CONFIG}" -o "${OUTPUT_FILE}" limerick
46
-
47
- echo
48
- echo "Contents of ${OUTPUT_FILE}:"
49
- echo "==="
50
- cat "${OUTPUT_FILE}"
51
- echo "==="
52
- echo
53
-
54
- # --- Part 2: Overwrite with a second run ---
55
-
56
- echo "--- Part 2: Overwrite (default behavior) ---"
57
- echo
58
- echo "Running the same command again overwrites the file."
59
- echo
60
- echo "Running: aia -c ${CONFIG} -o ${OUTPUT_FILE} limerick"
61
- echo
62
-
63
- aia -c "${CONFIG}" -o "${OUTPUT_FILE}" limerick
64
-
65
- echo
66
- echo "Contents of ${OUTPUT_FILE} (new response replaced the old one):"
67
- echo "==="
68
- cat "${OUTPUT_FILE}"
69
- echo "==="
70
- echo
71
-
72
- # --- Part 3: Append mode ---
73
-
74
- echo "--- Part 3: Append mode (--append) ---"
75
- echo
76
- echo "With --append, responses are added to the end of the file"
77
- echo "instead of replacing it."
78
- echo
79
- echo "Running: aia -c ${CONFIG} -o ${OUTPUT_FILE} --append limerick"
80
- echo
81
-
82
- aia -c "${CONFIG}" -o "${OUTPUT_FILE}" --append limerick
83
-
84
- echo
85
- echo "Contents of ${OUTPUT_FILE} (now has two responses):"
86
- echo "==="
87
- cat "${OUTPUT_FILE}"
88
- echo "==="
89
-
90
- # Clean up
91
- rm -f "${OUTPUT_FILE}"
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/15_parameters.sh
3
- #
4
- # Demonstrates prompt parameters defined in YAML front matter.
5
- # Parameters let you create reusable prompt templates with
6
- # placeholders that are filled in at runtime.
7
- #
8
- # In the front matter:
9
- # parameters:
10
- # name: World # has a default value
11
- # language: # null = required, user will be prompted
12
- #
13
- # In the prompt body, reference parameters with ERB:
14
- # Hello <%= name %>, welcome to <%= language %>!
15
- #
16
- # When a parameter has a default, AIA uses it automatically.
17
- # When a parameter is null (no default), AIA prompts the user
18
- # to enter a value interactively.
19
- #
20
- # Prerequisites: Run 00_setup_aia.sh first.
21
- # Usage: cd examples && bash 15_parameters.sh
22
-
23
- set -euo pipefail
24
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
25
-
26
- echo "=== Demo 15: Prompt Parameters ==="
27
- echo
28
- echo "Parameters make prompts reusable. Define them in the front"
29
- echo "matter with default values, then reference them in the"
30
- echo "prompt body with ERB tags like <%= name %>."
31
- echo
32
-
33
- # --- Part 1: All parameters have defaults ---
34
-
35
- echo "--- Part 1: All defaults provided ---"
36
- echo
37
- echo "The prompt file prompts_dir/greeting.md contains:"
38
- echo "==="
39
- cat prompts_dir/greeting.md
40
- echo "==="
41
- echo
42
- echo "All three parameters (name, language, tone) have defaults,"
43
- echo "so AIA fills them in automatically with no user interaction."
44
- echo
45
- echo "Running: aia -c ${CONFIG} --no-output greeting"
46
- echo
47
-
48
- aia -c "${CONFIG}" --no-output greeting
49
-
50
- echo
51
- echo
52
-
53
- # --- Part 2: A required parameter (interactive) ---
54
-
55
- echo "--- Part 2: Required parameter (null default) ---"
56
- echo
57
- echo "The prompt file prompts_dir/greeting_required.md contains:"
58
- echo "==="
59
- cat prompts_dir/greeting_required.md
60
- echo "==="
61
- echo
62
- echo "The 'name' parameter has no default (null), so AIA will"
63
- echo "prompt you to enter a value. 'language' defaults to Spanish."
64
- echo
65
- echo "Running: aia -c ${CONFIG} --no-output greeting_required"
66
- echo
67
-
68
- aia -c "${CONFIG}" --no-output greeting_required
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/16_directives.sh
3
- #
4
- # Demonstrates AIA directives — special functions available
5
- # inside prompt files via ERB and in chat mode via /command.
6
- #
7
- # Part 1 demonstrates the 'include' directive, which inserts
8
- # the contents of another file into the prompt at render time.
9
- # Part 2 shows how to create and load your own custom directive.
10
- #
11
- # Prerequisites: Run 00_setup_aia.sh first.
12
- # Usage: cd examples && bash 16_directives.sh
13
-
14
- set -euo pipefail
15
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
16
-
17
- echo "=== Demo 16: Directives ==="
18
- echo
19
- echo "Directives are built-in functions available in prompts (via ERB)"
20
- echo "and in chat mode (via /command). Here are the available directives:"
21
- echo
22
- echo " Prompt Manager Core:"
23
- echo " include - Include recursively and render another prompt file(s)"
24
- echo " insert - Insert (non-recursive) raw file contents (aliases: read)"
25
- echo
26
- echo "The remaining directives are more useful as /commands in chat mode:"
27
- echo
28
- echo " Configuration:"
29
- echo " /config - View or set configuration values"
30
- echo " /model - View or change the AI model"
31
- echo " /temp - Set the temperature parameter"
32
- echo " /top_p - Set the top_p parameter"
33
- echo
34
- echo " Context:"
35
- echo " /checkpoint - Create a named checkpoint"
36
- echo " /restore - Restore to a previous checkpoint"
37
- echo " /clear - Clear the conversation context"
38
- echo " /review - Display the current context"
39
- echo " /list - List all available checkpoints"
40
- echo
41
- echo " Execution:"
42
- echo " /ruby - Execute Ruby code"
43
- echo " /speak - Use text-to-speech"
44
- echo
45
- echo " Model:"
46
- echo " /models - List all available AI models"
47
- echo " /compare - Compare responses from multiple models"
48
- echo
49
- echo " Utility:"
50
- echo " /tools - List available tools"
51
- echo " /terse - Request concise responses"
52
- echo " /robot - Display ASCII robot art"
53
- echo " /help - Show directive help"
54
- echo
55
- echo " Web & File:"
56
- echo " /web - Fetch and include webpage content"
57
- echo " /skills - List available Claude Code skills"
58
- echo " /skill - Include a Claude Code skill"
59
- echo " /paste - Paste from the system clipboard"
60
- echo
61
-
62
- # --- Part 1: Using include in a prompt ---
63
-
64
- echo "--- Part 1: Using 'include' in a prompt file ---"
65
- echo
66
- echo "The included file prompts_dir/includes/ruby_facts.md contains:"
67
- echo "==="
68
- cat prompts_dir/includes/ruby_facts.md
69
- echo "==="
70
- echo
71
- echo "The prompt file prompts_dir/quiz_with_include.md contains:"
72
- echo "==="
73
- cat prompts_dir/quiz_with_include.md
74
- echo "==="
75
- echo
76
- echo "The <%= include 'includes/ruby_facts.md' %> directive pulls"
77
- echo "in the facts file at render time, so the model sees the"
78
- echo "combined content as one prompt."
79
- echo
80
- echo "Running: aia -c ${CONFIG} --no-output quiz_with_include"
81
- echo
82
-
83
- aia -c "${CONFIG}" --no-output quiz_with_include
84
-
85
- echo
86
- echo
87
-
88
- # --- Part 2: Creating a custom directive ---
89
-
90
- echo "--- Part 2: Creating and using a custom directive ---"
91
- echo
92
- echo "You can extend AIA with your own directives. A custom directive"
93
- echo "is a Ruby class that inherits from AIA::Directive. Define methods"
94
- echo "with a 'desc' line above them and they become available in both"
95
- echo "ERB prompts and as /commands in chat mode."
96
- echo
97
- echo "The file directives/timestamp_directive.rb contains:"
98
- echo "==="
99
- cat directives/timestamp_directive.rb
100
- echo "==="
101
- echo
102
- echo "The prompt file prompts_dir/with_timestamp.md uses it:"
103
- echo "==="
104
- cat prompts_dir/with_timestamp.md
105
- echo "==="
106
- echo
107
- echo "Load the custom directive with --tools and it becomes available"
108
- echo "alongside the built-in directives."
109
- echo
110
- echo "Running: aia -c ${CONFIG} --no-output --tools directives/timestamp_directive.rb with_timestamp"
111
- echo
112
-
113
- aia -c "${CONFIG}" --no-output --tools directives/timestamp_directive.rb with_timestamp
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/17_require_and_conditionals.sh
3
- #
4
- # Demonstrates two ERB power features:
5
- #
6
- # 1. --require (--rq) loads Ruby libraries so they are available
7
- # inside ERB expressions in prompts.
8
- #
9
- # 2. ERB control flow (<% if %> / <% elsif %> / <% else %>)
10
- # lets you conditionally include or exclude sections of a
11
- # prompt based on parameter values.
12
- #
13
- # Prerequisites: Run 00_setup_aia.sh first.
14
- # Usage: cd examples && bash 17_require_and_conditionals.sh
15
-
16
- set -euo pipefail
17
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
18
-
19
- echo "=== Demo 17: --require and Conditional ERB ==="
20
- echo
21
-
22
- # --- Part 1: --require to load a Ruby library ---
23
-
24
- echo "--- Part 1: Using --require to load a Ruby library ---"
25
- echo
26
- echo "The --rq flag loads a Ruby gem so ERB tags can use it."
27
- echo "Here we load 'json' to call JSON.pretty_generate inside"
28
- echo "the prompt."
29
- echo
30
- echo "The prompt file prompts_dir/require_demo.md contains:"
31
- echo "==="
32
- cat prompts_dir/require_demo.md
33
- echo "==="
34
- echo
35
- echo "Running: aia -c ${CONFIG} --no-output --rq json require_demo"
36
- echo
37
-
38
- aia -c "${CONFIG}" --no-output --rq json require_demo
39
-
40
- echo
41
- echo
42
-
43
- # --- Part 2: Conditional prompt text with ERB ---
44
-
45
- echo "--- Part 2: Conditional text with ERB and parameters ---"
46
- echo
47
- echo "ERB control flow tags (<% if %>) let you include different"
48
- echo "prompt text depending on parameter values."
49
- echo
50
- echo "The prompt file prompts_dir/conditional.md contains:"
51
- echo "==="
52
- cat prompts_dir/conditional.md
53
- echo "==="
54
- echo
55
- echo "The 'audience' parameter defaults to 'developer'."
56
- echo "The ERB if/elsif/else block selects the matching section."
57
- echo
58
- echo "Running with default (developer):"
59
- echo " aia -c ${CONFIG} --no-output conditional"
60
- echo
61
-
62
- aia -c "${CONFIG}" --no-output conditional
63
-
64
- echo
65
- echo
66
- echo "The same prompt could be run for a different audience by"
67
- echo "entering 'manager' or 'child' when prompted interactively,"
68
- echo "or by overriding the default in a pipeline."
data/examples/18_tools.sh DELETED
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/18_tools.sh
3
- #
4
- # Demonstrates loading RubyLLM::Tool classes via --require so
5
- # the model can call them as function tools during inference.
6
- #
7
- # This demo uses the shared_tools gem, which provides a library
8
- # of ready-made RubyLLM::Tool subclasses. AIA discovers them
9
- # automatically after the gem is required.
10
- #
11
- # Prerequisites:
12
- # - Run 00_setup_aia.sh first
13
- # - gem install shared_tools
14
- # Usage: cd examples && bash 18_tools.sh
15
-
16
- set -euo pipefail
17
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
18
-
19
- echo "=== Demo 18: Tools via --require ==="
20
- echo
21
- echo "The --rq (--require) flag loads Ruby gems at startup."
22
- echo "If a gem defines RubyLLM::Tool subclasses, AIA discovers"
23
- echo "them automatically and makes them available to the model."
24
- echo
25
- echo "The shared_tools gem provides tools like:"
26
- echo " - current_date_time — current date, time, timezone"
27
- echo " - system_info — OS, CPU, memory, disk details"
28
- echo " - dns — DNS lookups and record queries"
29
- echo " - cron — parse and explain cron expressions"
30
- echo " - clipboard — read/write the system clipboard"
31
- echo " and more."
32
- echo
33
-
34
- # --- Check that shared_tools is installed ---
35
-
36
- if ! gem list shared_tools --installed > /dev/null 2>&1; then
37
- echo "ERROR: The shared_tools gem is not installed."
38
- echo " Install with: gem install shared_tools"
39
- exit 1
40
- fi
41
-
42
- echo "The prompt file prompts_dir/use_tools.md contains:"
43
- echo "==="
44
- cat prompts_dir/use_tools.md
45
- echo "==="
46
- echo
47
- echo "shared_tools ships with 35+ tools. Passing all of them in one API"
48
- echo "call causes gpt-4.1 to skip tool use entirely. We use --allowed-tools"
49
- echo "to expose only the three tools this prompt actually needs."
50
- echo
51
- echo "Running: aia -c ${CONFIG} --no-output --rq shared_tools \\"
52
- echo " --allowed-tools current_date_time_tool,system_info_tool,dns_tool \\"
53
- echo " use_tools"
54
- echo
55
- echo "The model will call tools to get live data, then summarize"
56
- echo "the results."
57
- echo
58
-
59
- aia -c "${CONFIG}" --no-output --rq shared_tools \
60
- --allowed-tools current_date_time_tool,system_info_tool,dns_tool \
61
- use_tools
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/19_local_tools.sh
3
- #
4
- # Demonstrates loading a local RubyLLM::Tool from a file using
5
- # the --tools option. Unlike --require (which loads gems), --tools
6
- # loads .rb files directly from a path. You can pass a single file
7
- # or a directory (all .rb files in it will be loaded).
8
- #
9
- # Prerequisites: Run 00_setup_aia.sh first.
10
- # Usage: cd examples && bash 19_local_tools.sh
11
-
12
- set -euo pipefail
13
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
14
-
15
- echo "=== Demo 19: Local Tools ==="
16
- echo
17
- echo "The --tools flag loads RubyLLM::Tool subclasses from local"
18
- echo ".rb files. Pass a file path or a directory."
19
- echo
20
-
21
- echo "The tool file tools/word_count_tool.rb defines:"
22
- echo "==="
23
- cat tools/word_count_tool.rb
24
- echo "==="
25
- echo
26
- echo "The prompt file prompts_dir/use_local_tool.md contains:"
27
- echo "==="
28
- cat prompts_dir/use_local_tool.md
29
- echo "==="
30
- echo
31
- echo "Running: aia -c ${CONFIG} --no-output --tools tools/word_count_tool.rb use_local_tool"
32
- echo
33
-
34
- aia -c "${CONFIG}" --no-output --tools tools/word_count_tool.rb use_local_tool
@@ -1,102 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/20_mcp_servers.sh
3
- #
4
- # Demonstrates MCP (Model Context Protocol) server integration.
5
- # MCP servers expose tools over stdio that the model can call.
6
- #
7
- # AIA supports two ways to configure MCP servers:
8
- #
9
- # 1. JSON file via --mcp (Claude Desktop / VS Code format):
10
- # {
11
- # "mcpServers": {
12
- # "server_name": {
13
- # "command": "npx",
14
- # "args": ["-y", "@org/server", "/path"],
15
- # "env": {},
16
- # "timeout": 10000
17
- # }
18
- # }
19
- # }
20
- #
21
- # 2. YAML in the AIA config file (aia_config.yml):
22
- # mcp_servers:
23
- # - name: server_name
24
- # command: npx
25
- # args: ["-y", "@org/server", "/path"]
26
- # timeout: 10000
27
- #
28
- # Both forms are equivalent. JSON is handy for sharing configs
29
- # with Claude Desktop; YAML keeps everything in one config file.
30
- #
31
- # Filtering:
32
- # --mcp-use name1,name2 Connect only these servers
33
- # --mcp-skip name1,name2 Skip these servers
34
- # --no-mcp Disable all MCP servers
35
- # --mcp-list List configured servers and exit
36
- #
37
- # Prerequisites:
38
- # - Run 00_setup_aia.sh first
39
- # - Node.js / npx installed (for the filesystem MCP server)
40
- # Usage: cd examples && bash 20_mcp_servers.sh
41
-
42
- set -euo pipefail
43
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
44
-
45
- MCP_YAML_CONFIG="aia_config_with_mcp.yml"
46
-
47
- echo "=== Demo 20: MCP Servers ==="
48
- echo
49
- echo "MCP servers expose tools over stdio that the model can call."
50
- echo "AIA connects to them at startup and registers their tools."
51
- echo
52
-
53
- # --- Check that npx is available ---
54
-
55
- if ! command -v npx &> /dev/null; then
56
- echo "ERROR: npx is not installed."
57
- echo " Install Node.js from: https://nodejs.org"
58
- exit 1
59
- fi
60
-
61
- echo "The prompt file prompts_dir/list_with_mcp.md contains:"
62
- echo "==="
63
- cat prompts_dir/list_with_mcp.md
64
- echo "==="
65
- echo
66
-
67
- # --- Part 1: JSON config via --mcp ---
68
-
69
- echo "--- Part 1: JSON config via --mcp ---"
70
- echo
71
- echo "The JSON file mcp/filesystem.json contains:"
72
- echo "==="
73
- cat mcp/filesystem.json
74
- echo "==="
75
- echo
76
- echo "This configures the @modelcontextprotocol/server-filesystem"
77
- echo "MCP server with access to the prompts_dir directory."
78
- echo
79
- echo "Running: aia -c ${CONFIG} --no-output --mcp mcp/filesystem.json list_with_mcp"
80
- echo
81
-
82
- aia -c "${CONFIG}" --no-output --mcp mcp/filesystem.json list_with_mcp
83
-
84
- echo
85
- echo
86
-
87
- # --- Part 2: YAML config in aia_config.yml ---
88
-
89
- echo "--- Part 2: YAML config in the AIA config file ---"
90
- echo
91
- echo "The same server can be defined directly in the config file."
92
- echo "The file mcp/aia_config_with_mcp.yml contains:"
93
- echo "==="
94
- cat "${MCP_YAML_CONFIG}"
95
- echo "==="
96
- echo
97
- echo "With the MCP server in the config file, no --mcp flag is needed."
98
- echo
99
- echo "Running: aia -c ${MCP_YAML_CONFIG} --no-output list_with_mcp"
100
- echo
101
-
102
- aia -c "${MCP_YAML_CONFIG}" --no-output list_with_mcp