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,111 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/00_setup_aia.sh
3
- #
4
- # Sets up the environment for running AIA example demos.
5
- # Run this script first before any other example script.
6
- #
7
- # What it does:
8
- # 1. Verifies aia is installed
9
- # 2. Verifies OPENAI_API_KEY is set
10
- # 3. Verifies examples/prompts_dir exists
11
- # 4. Writes examples/aia_config.yml for use with -c flag
12
- #
13
- # Each demo script sources common.sh which clears AIA_* env vars
14
- # and sets CONFIG=aia_config.yml for clean, isolated runs.
15
- #
16
- # Usage:
17
- # cd examples
18
- # bash 00_setup_aia.sh
19
-
20
- set -euo pipefail
21
-
22
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23
- PROMPTS_DIR="${SCRIPT_DIR}/prompts_dir"
24
- CONFIG_FILE="${SCRIPT_DIR}/aia_config.yml"
25
-
26
- # When running from inside the development repo, prefer the local bin/aia
27
- # over any system-installed gem so setup reflects the version being demoed.
28
- REPO_BIN="$(cd "${SCRIPT_DIR}/.." && pwd)/bin"
29
- if [ -f "${REPO_BIN}/aia" ]; then
30
- export PATH="${REPO_BIN}:${PATH}"
31
- fi
32
-
33
- # The model to use for demos. gpt-4.1 is OpenAI's flagship model with
34
- # strong instruction-following and tool-calling support.
35
- DEMO_MODEL="gpt-4.1"
36
-
37
- echo "=== AIA Examples Setup ==="
38
- echo
39
-
40
- # --- Step 1: Check that aia is installed ---
41
-
42
- if ! command -v aia &> /dev/null; then
43
- echo "ERROR: 'aia' is not found."
44
- echo " From the repo: just install (installs local build)"
45
- echo " From RubyGems: gem install aia"
46
- exit 1
47
- fi
48
-
49
- AIA_VERSION=$(aia --version 2>/dev/null || echo "unknown")
50
- echo "[ok] aia is installed (v${AIA_VERSION})"
51
-
52
- # --- Step 2: Check that OPENAI_API_KEY is set ---
53
-
54
- if [ -z "${OPENAI_API_KEY:-}" ]; then
55
- echo "ERROR: OPENAI_API_KEY is not set."
56
- echo " Export your key before running demos:"
57
- echo " export OPENAI_API_KEY=sk-..."
58
- echo " Get a key at: https://platform.openai.com/api-keys"
59
- exit 1
60
- fi
61
-
62
- echo "[ok] OPENAI_API_KEY is set"
63
-
64
- # --- Step 3: Verify prompts directory ---
65
-
66
- echo
67
- if [ -d "${PROMPTS_DIR}" ]; then
68
- echo "[ok] prompts_dir exists at ${PROMPTS_DIR}"
69
- else
70
- mkdir -p "${PROMPTS_DIR}"
71
- echo "[ok] created prompts_dir at ${PROMPTS_DIR}"
72
- fi
73
-
74
- # --- Step 4: Write the config file ---
75
-
76
- cat > "${CONFIG_FILE}" <<EOF
77
- # AIA configuration for example demos
78
- # Used by all demo scripts via: aia -c aia_config.yml ...
79
- #
80
- # This file is loaded with the -c / --config-file flag.
81
- # It replaces the user's personal config (~/.config/aia/aia.yml),
82
- # starting from bundled defaults + these values only.
83
- # CLI flags passed directly to aia still take precedence.
84
- #
85
- # NOTE: Relative paths resolve against the directory where aia is invoked.
86
- # Run demo scripts from the examples/ directory.
87
-
88
- prompts:
89
- dir: ./prompts_dir
90
-
91
- models:
92
- - name: ${DEMO_MODEL}
93
-
94
- output:
95
- file: ~
96
-
97
- flags:
98
- chat: false
99
- EOF
100
-
101
- echo "[ok] wrote ${CONFIG_FILE}"
102
-
103
- # --- Done ---
104
-
105
- echo
106
- echo "=== Setup Complete ==="
107
- echo
108
- echo "All demo scripts use:"
109
- echo " aia -c aia_config.yml ..."
110
- echo " Model: ${DEMO_MODEL}"
111
- echo " Prompts dir: ${PROMPTS_DIR}"
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/01_basic_usage.sh
3
- #
4
- # Demonstrates the simplest use of aia: sending a prompt to a model
5
- # and printing the response.
6
- #
7
- # Prerequisites: Run 00_setup_aia.sh first.
8
- # Usage: cd examples && bash 01_basic_usage.sh
9
-
10
- set -euo pipefail
11
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
12
-
13
- echo "=== Demo 01: Basic Usage ==="
14
- echo
15
- echo "The prompt file prompts_dir/hello.md contains:"
16
- echo "==="
17
- cat prompts_dir/hello.md
18
- echo "==="
19
- echo
20
- echo "Running: aia -c ${CONFIG} --no-output hello"
21
- echo
22
-
23
- aia -c "${CONFIG}" --no-output hello
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/02_frontmatter.sh
3
- #
4
- # Demonstrates YAML front matter in prompt files.
5
- # Front matter lets you embed configuration directly in the prompt,
6
- # such as temperature, model, top_p, and more.
7
- #
8
- # Prerequisites: Run 00_setup_aia.sh first.
9
- # Usage: cd examples && bash 02_frontmatter.sh
10
-
11
- set -euo pipefail
12
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
13
-
14
- echo "=== Demo 02: YAML Front Matter ==="
15
- echo
16
- echo "Prompt files can include a YAML front matter block between"
17
- echo "--- delimiters. AIA applies these settings before sending"
18
- echo "the prompt to the model."
19
- echo
20
- echo "Supported root-level shorthands:"
21
- echo " model, temperature, top_p, next, pipeline, shell, erb"
22
- echo
23
- echo "The prompt file prompts_dir/creative.md contains:"
24
- echo "==="
25
- cat prompts_dir/creative.md
26
- echo "==="
27
- echo
28
- echo "The 'temperature: 0.9' setting makes the response more creative."
29
- echo
30
- echo "Running: aia -c ${CONFIG} --no-output creative"
31
- echo
32
-
33
- aia -c "${CONFIG}" --no-output creative
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/03_shell_integration.sh
3
- #
4
- # Demonstrates shell integration in prompts.
5
- # By default, $(command) is executed and replaced with its output
6
- # before the prompt is sent to the model. You can disable this
7
- # with 'shell: false' in the YAML front matter.
8
- #
9
- # Prerequisites: Run 00_setup_aia.sh first.
10
- # Usage: cd examples && bash 03_shell_integration.sh
11
-
12
- set -euo pipefail
13
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
14
-
15
- echo "=== Demo 03: Shell Integration ==="
16
- echo
17
- echo "AIA expands \$(command) and \$ENVAR in prompts before sending"
18
- echo "them to the model. This lets prompts include live system data."
19
- echo
20
-
21
- # --- Part 1: shell expansion ON (default) ---
22
-
23
- echo "--- Part 1: Shell expansion ON (default) ---"
24
- echo
25
- echo "The prompt file prompts_dir/sysinfo.md contains:"
26
- echo "==="
27
- cat prompts_dir/sysinfo.md
28
- echo "==="
29
- echo
30
- echo "The \$(command) references will be replaced with real values."
31
- echo
32
- echo "Running: aia -c ${CONFIG} --no-output sysinfo"
33
- echo
34
-
35
- aia -c "${CONFIG}" --no-output sysinfo
36
-
37
- echo
38
- echo
39
-
40
- # --- Part 2: shell expansion OFF via front matter ---
41
-
42
- echo "--- Part 2: Shell expansion OFF (shell: false) ---"
43
- echo
44
- echo "The prompt file prompts_dir/sysinfo_raw.md contains:"
45
- echo "==="
46
- cat prompts_dir/sysinfo_raw.md
47
- echo "==="
48
- echo
49
- echo "With 'shell: false' in the front matter, the \$(command)"
50
- echo "references are sent to the model as literal text."
51
- echo
52
- echo "Running: aia -c ${CONFIG} --no-output sysinfo_raw"
53
- echo
54
-
55
- aia -c "${CONFIG}" --no-output sysinfo_raw
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/04_erb_templating.sh
3
- #
4
- # Demonstrates ERB templating in prompts.
5
- # By default, <%= expression %> is evaluated as Ruby and replaced
6
- # with the result before the prompt is sent to the model. You can
7
- # disable this with 'erb: false' in the YAML front matter.
8
- #
9
- # Prerequisites: Run 00_setup_aia.sh first.
10
- # Usage: cd examples && bash 04_erb_templating.sh
11
-
12
- set -euo pipefail
13
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
14
-
15
- echo "=== Demo 04: ERB Templating ==="
16
- echo
17
- echo "AIA processes <%= expression %> tags as Ruby (ERB) before"
18
- echo "sending prompts to the model. This gives prompts access to"
19
- echo "the full Ruby language."
20
- echo
21
-
22
- # --- Part 1: ERB processing ON (default) ---
23
-
24
- echo "--- Part 1: ERB processing ON (default) ---"
25
- echo
26
- echo "The prompt file prompts_dir/erbinfo.md contains:"
27
- echo "==="
28
- cat prompts_dir/erbinfo.md
29
- echo "==="
30
- echo
31
- echo "The <%= %> tags will be evaluated and replaced with real values."
32
- echo
33
- echo "Running: aia -c ${CONFIG} --no-output erbinfo"
34
- echo
35
-
36
- aia -c "${CONFIG}" --no-output erbinfo
37
-
38
- echo
39
- echo
40
-
41
- # --- Part 2: ERB processing OFF via front matter ---
42
-
43
- echo "--- Part 2: ERB processing OFF (erb: false) ---"
44
- echo
45
- echo "The prompt file prompts_dir/erbinfo_raw.md contains:"
46
- echo "==="
47
- cat prompts_dir/erbinfo_raw.md
48
- echo "==="
49
- echo
50
- echo "With 'erb: false' in the front matter, the <%= %> tags"
51
- echo "are sent to the model as literal text."
52
- echo
53
- echo "Running: aia -c ${CONFIG} --no-output erbinfo_raw"
54
- echo
55
-
56
- aia -c "${CONFIG}" --no-output erbinfo_raw
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/05_shell_then_erb.sh
3
- #
4
- # Demonstrates that shell expansion runs BEFORE ERB processing.
5
- # This means $(command) and $ENVAR are replaced with their values
6
- # first, and then ERB evaluates the result as Ruby.
7
- #
8
- # This ordering lets you use shell output inside Ruby expressions.
9
- #
10
- # Prerequisites: Run 00_setup_aia.sh first.
11
- # Usage: cd examples && bash 05_shell_then_erb.sh
12
-
13
- set -euo pipefail
14
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
15
-
16
- echo "=== Demo 05: Shell Runs Before ERB ==="
17
- echo
18
- echo "AIA processes prompts in this order:"
19
- echo " 1. Shell: \$(command) and \$ENVAR are expanded"
20
- echo " 2. ERB: <%= expression %> is evaluated as Ruby"
21
- echo
22
- echo "This means shell output becomes part of the Ruby expression"
23
- echo "that ERB then evaluates."
24
- echo
25
- echo "The prompt file prompts_dir/shell_then_erb.md contains:"
26
- echo "==="
27
- cat prompts_dir/shell_then_erb.md
28
- echo "==="
29
- echo
30
- echo "For example:"
31
- echo " <%= \"\$(uname -s)\".downcase %>"
32
- echo " Step 1 (shell): <%= \"Darwin\".downcase %>"
33
- echo " Step 2 (ERB): darwin"
34
- echo
35
- echo "Running: aia -c ${CONFIG} --no-output shell_then_erb"
36
- echo
37
-
38
- aia -c "${CONFIG}" --no-output shell_then_erb
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/06_prompt_chaining.sh
3
- #
4
- # Demonstrates prompt chaining with --next and the 'next:' front
5
- # matter key. The first prompt's response becomes context for
6
- # the second prompt.
7
- #
8
- # Prerequisites: Run 00_setup_aia.sh first.
9
- # Usage: cd examples && bash 06_prompt_chaining.sh
10
-
11
- set -euo pipefail
12
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
13
-
14
- echo "=== Demo 06: Prompt Chaining ==="
15
- echo
16
- echo "AIA can chain prompts so the output of the first becomes"
17
- echo "context for the second. Two ways to do this:"
18
- echo " 1. CLI: --next prompt_id"
19
- echo " 2. Front matter: next: prompt_id"
20
- echo
21
-
22
- # --- Part 1: --next via CLI ---
23
-
24
- echo "--- Part 1: Chaining with --next CLI flag ---"
25
- echo
26
- echo "The prompt file prompts_dir/tell_joke.md contains:"
27
- echo "==="
28
- cat prompts_dir/tell_joke.md
29
- echo "==="
30
- echo
31
- echo "The prompt file prompts_dir/explain_joke.md contains:"
32
- echo "==="
33
- cat prompts_dir/explain_joke.md
34
- echo "==="
35
- echo
36
- echo "Running: aia -c ${CONFIG} --no-output --next explain_joke tell_joke"
37
- echo
38
-
39
- aia -c "${CONFIG}" --no-output --next explain_joke tell_joke
40
-
41
- echo
42
- echo
43
-
44
- # --- Part 2: next: in front matter ---
45
-
46
- echo "--- Part 2: Chaining with 'next:' in front matter ---"
47
- echo
48
- echo "The prompt file prompts_dir/tell_joke_with_next.md contains:"
49
- echo "==="
50
- cat prompts_dir/tell_joke_with_next.md
51
- echo "==="
52
- echo
53
- echo "The 'next: explain_joke' front matter does the same thing"
54
- echo "as --next but is embedded in the prompt file itself."
55
- echo
56
- echo "Running: aia -c ${CONFIG} --no-output tell_joke_with_next"
57
- echo
58
-
59
- aia -c "${CONFIG}" --no-output tell_joke_with_next
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/07_pipeline.sh
3
- #
4
- # Demonstrates a prompt pipeline — a sequence of prompts where
5
- # each step's response becomes context for the next.
6
- #
7
- # The --pipeline flag accepts comma-separated prompt IDs.
8
- # The first prompt ID is the main argument; the rest go in --pipeline.
9
- #
10
- # NOTE: The same chain could be embedded in the first prompt's
11
- # front matter instead:
12
- # ---
13
- # pipeline: evaluate, pick_best, tagline
14
- # ---
15
- #
16
- # Prerequisites: Run 00_setup_aia.sh first.
17
- # Usage: cd examples && bash 07_pipeline.sh
18
-
19
- set -euo pipefail
20
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
21
-
22
- echo "=== Demo 07: Prompt Pipeline ==="
23
- echo
24
- echo "A pipeline chains multiple prompts in sequence. Each prompt's"
25
- echo "response becomes context for the next. This is useful for"
26
- echo "multi-step reasoning and refinement workflows."
27
- echo
28
- echo "This demo runs a 4-step pipeline:"
29
- echo " 1. brainstorm — generate five gem names"
30
- echo " 2. evaluate — rate each name 1-5"
31
- echo " 3. pick_best — choose the winner"
32
- echo " 4. tagline — write a tagline for it"
33
- echo
34
-
35
- echo "The prompt files:"
36
- echo
37
- for p in brainstorm evaluate pick_best tagline; do
38
- echo "--- prompts_dir/${p}.md ---"
39
- cat "prompts_dir/${p}.md"
40
- done
41
- echo
42
-
43
- echo "Running: aia -c ${CONFIG} --no-output --pipeline evaluate,pick_best,tagline brainstorm"
44
- echo
45
-
46
- aia -c "${CONFIG}" --no-output --pipeline evaluate,pick_best,tagline brainstorm
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/08_context_files.sh
3
- #
4
- # Demonstrates the --context-files option, which attaches the
5
- # contents of one or more files to the prompt so the model can
6
- # reference them in its response.
7
- #
8
- # Context files are listed as positional arguments after the
9
- # prompt ID:
10
- # aia PROMPT_ID FILE1 FILE2 ...
11
- #
12
- # Prerequisites: Run 00_setup_aia.sh first.
13
- # Usage: cd examples && bash 08_context_files.sh
14
-
15
- set -euo pipefail
16
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
17
-
18
- echo "=== Demo 08: Context Files ==="
19
- echo
20
- echo "Context files let you attach file contents to a prompt so"
21
- echo "the model can read and reference them. List the files after"
22
- echo "the prompt ID on the command line."
23
- echo
24
-
25
- echo "The prompt file prompts_dir/summarize_context.md contains:"
26
- echo "==="
27
- cat prompts_dir/summarize_context.md
28
- echo "==="
29
- echo
30
-
31
- echo "We will attach two context files:"
32
- echo
33
- echo "--- context/project_goals.md ---"
34
- cat context/project_goals.md
35
- echo
36
- echo "--- context/tech_stack.md ---"
37
- cat context/tech_stack.md
38
- echo
39
-
40
- echo "Running: aia -c ${CONFIG} --no-output summarize_context context/project_goals.md context/tech_stack.md"
41
- echo
42
-
43
- aia -c "${CONFIG}" --no-output summarize_context context/project_goals.md context/tech_stack.md
data/examples/09_roles.sh DELETED
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/09_roles.sh
3
- #
4
- # Demonstrates the --role option, which prepends a role prompt
5
- # to the main prompt. Roles live as .md files in the roles/
6
- # subdirectory under the prompts directory.
7
- #
8
- # Prerequisites: Run 00_setup_aia.sh first.
9
- # Usage: cd examples && bash 09_roles.sh
10
-
11
- set -euo pipefail
12
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
13
-
14
- echo "=== Demo 09: Roles ==="
15
- echo
16
- echo "Roles are reusable system prompts stored as .md files in"
17
- echo "the roles/ subdirectory of your prompts directory. Use"
18
- echo "--role ROLE_ID to prepend a role to any prompt."
19
- echo
20
-
21
- echo "The prompt file prompts_dir/weather.md contains:"
22
- echo "==="
23
- cat prompts_dir/weather.md
24
- echo "==="
25
- echo
26
-
27
- echo "Available roles:"
28
- echo
29
- for role in prompts_dir/roles/*.md; do
30
- name=$(basename "$role" .md)
31
- echo "--- roles/${name}.md ---"
32
- cat "$role"
33
- done
34
- echo
35
-
36
- # --- Part 1: No role (baseline) ---
37
-
38
- echo "--- Part 1: No role (baseline) ---"
39
- echo
40
- echo "Running: aia -c ${CONFIG} --no-output weather"
41
- echo
42
-
43
- aia -c "${CONFIG}" --no-output weather
44
-
45
- echo
46
- echo
47
-
48
- # --- Part 2: Pirate role ---
49
-
50
- echo "--- Part 2: With --role pirate ---"
51
- echo
52
- echo "Running: aia -c ${CONFIG} --no-output --role pirate weather"
53
- echo
54
-
55
- aia -c "${CONFIG}" --no-output --role pirate weather
56
-
57
- echo
58
- echo
59
-
60
- # --- Part 3: Formal butler role ---
61
-
62
- echo "--- Part 3: With --role formal ---"
63
- echo
64
- echo "Running: aia -c ${CONFIG} --no-output --role formal weather"
65
- echo
66
-
67
- aia -c "${CONFIG}" --no-output --role formal weather
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/10_stdin_piping.sh
3
- #
4
- # Demonstrates piping input into aia via STDIN.
5
- # The piped content is appended to the prompt text before it
6
- # is sent to the model.
7
- #
8
- # Prerequisites: Run 00_setup_aia.sh first.
9
- # Usage: cd examples && bash 10_stdin_piping.sh
10
-
11
- set -euo pipefail
12
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
13
-
14
- echo "=== Demo 10: STDIN Piping ==="
15
- echo
16
- echo "You can pipe text into aia. The piped content is appended"
17
- echo "to the prompt so the model can reference it."
18
- echo
19
-
20
- echo "The prompt file prompts_dir/analyze.md contains:"
21
- echo "==="
22
- cat prompts_dir/analyze.md
23
- echo "==="
24
- echo
25
-
26
- # --- Part 1: Pipe a string ---
27
-
28
- echo "--- Part 1: Pipe a string with echo ---"
29
- echo
30
- echo "Running: echo \"Ruby is ...\" | aia -c ${CONFIG} --no-output analyze"
31
- echo
32
-
33
- echo "Ruby is a dynamic, interpreted programming language focused on
34
- simplicity and productivity. It was created by Yukihiro Matsumoto
35
- in 1995. Ruby is known for its elegant syntax, strong
36
- metaprogramming capabilities, and the Rails web framework that
37
- helped popularize it worldwide." | aia -c "${CONFIG}" --no-output analyze
38
-
39
- echo
40
- echo
41
-
42
- # --- Part 2: Pipe a command's output ---
43
-
44
- echo "--- Part 2: Pipe a command's output ---"
45
- echo
46
- echo "Running: ls -la prompts_dir/ | aia -c ${CONFIG} --no-output analyze"
47
- echo
48
-
49
- ls -la prompts_dir/ | aia -c "${CONFIG}" --no-output analyze
@@ -1,65 +0,0 @@
1
- #!/usr/bin/env bash
2
- # examples/11_multi_model.sh
3
- #
4
- # Demonstrates using multiple models in a single prompt.
5
- #
6
- # Comparison mode (default):
7
- # Each model answers independently and both responses are shown
8
- # side by side, prefixed with "from: model_name".
9
- #
10
- # Cooperative (consensus) mode:
11
- # Each model answers independently, then the first model
12
- # synthesizes a unified response from all answers.
13
- #
14
- # Multiple models are specified as a comma-separated list with -m.
15
- # This demo uses two OpenAI models (gpt-4.1 and gpt-4.1-mini).
16
- #
17
- # Prerequisites: Run 00_setup_aia.sh first (OPENAI_API_KEY must be set).
18
- # Usage: cd examples && bash 11_multi_model.sh
19
-
20
- set -euo pipefail
21
- source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
22
-
23
- MODEL_A="gpt-4.1"
24
- MODEL_B="gpt-4.1-mini"
25
-
26
- echo "=== Demo 11: Multiple Models ==="
27
- echo
28
- echo "AIA can send the same prompt to multiple models at once."
29
- echo "Specify models as a comma-separated list with -m."
30
- echo
31
- echo " Comparison mode (default): show each model's response"
32
- echo " Cooperative mode (--consensus): synthesize a unified answer"
33
- echo
34
-
35
- echo "The prompt file prompts_dir/explain_recursion.md contains:"
36
- echo "==="
37
- cat prompts_dir/explain_recursion.md
38
- echo "==="
39
- echo
40
-
41
- # --- Part 1: Comparison mode ---
42
-
43
- echo "--- Part 1: Comparison mode (default) ---"
44
- echo
45
- echo "Each model answers independently. Both responses are shown."
46
- echo
47
- echo "Running: aia -c ${CONFIG} --no-output -m ${MODEL_A},${MODEL_B} explain_recursion"
48
- echo
49
-
50
- aia -c "${CONFIG}" --no-output -m "${MODEL_A},${MODEL_B}" explain_recursion
51
-
52
- echo
53
- echo
54
-
55
- # --- Part 2: Cooperative (consensus) mode ---
56
-
57
- echo "--- Part 2: Cooperative mode (--consensus) ---"
58
- echo
59
- echo "Both models answer, then ${MODEL_A} synthesizes a single"
60
- echo "unified response from both answers."
61
- echo
62
- echo "Running: aia -c ${CONFIG} --no-output --consensus -m ${MODEL_A},${MODEL_B} explain_recursion"
63
- echo
64
-
65
- aia -c "${CONFIG}" --no-output --consensus -m "${MODEL_A},${MODEL_B}" explain_recursion