aia 1.1.0 → 2.0.0.0.pre.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +5 -1
  3. data/.loki +231 -0
  4. data/.quality/flay_baseline.txt +1 -0
  5. data/.quality/flog_baseline.txt +29 -0
  6. data/.quality/reek_baseline.txt +80 -0
  7. data/.rubocop.yml +116 -0
  8. data/.version +1 -1
  9. data/CHANGELOG.md +266 -42
  10. data/IMPLEMENTATION_PLAN.md +506 -0
  11. data/README.md +266 -238
  12. data/Rakefile +118 -5
  13. data/architecture_review.md +314 -0
  14. data/bin/aia +16 -0
  15. data/docs/AGENTS.md +40 -0
  16. data/docs/advanced-prompting.md +67 -3
  17. data/docs/cli-reference.md +312 -56
  18. data/docs/configuration.md +130 -19
  19. data/docs/contributing.md +56 -2
  20. data/docs/directives-reference.md +593 -78
  21. data/docs/faq.md +85 -3
  22. data/docs/guides/available-models.md +1 -1
  23. data/docs/guides/basic-usage.md +6 -6
  24. data/docs/guides/chat.md +40 -16
  25. data/docs/guides/crew.md +239 -0
  26. data/docs/guides/executable-prompts.md +1 -1
  27. data/docs/guides/index.md +1 -0
  28. data/docs/guides/models.md +15 -0
  29. data/docs/index.md +29 -2
  30. data/docs/installation.md +44 -17
  31. data/docs/mcp-integration.md +40 -0
  32. data/docs/prompt_management.md +85 -86
  33. data/docs/security.md +47 -0
  34. data/docs/special_projects_guide.md +386 -0
  35. data/docs/tools-and-mcp-examples.md +23 -0
  36. data/docs/workflows-and-pipelines.md +84 -7
  37. data/examples/.gitignore +1 -0
  38. data/examples/00_setup_aia.sh +27 -44
  39. data/examples/11_multi_model.sh +4 -14
  40. data/examples/12_token_usage.sh +3 -12
  41. data/examples/18_tools.sh +10 -2
  42. data/examples/22_chat_mode.sh +0 -10
  43. data/examples/23_verify.sh +139 -0
  44. data/examples/24_decompose.sh +139 -0
  45. data/examples/25_spawn.sh +139 -0
  46. data/examples/26_debate.sh +97 -0
  47. data/examples/27_mention_routing.sh +157 -0
  48. data/examples/28_model_switching.sh +106 -0
  49. data/examples/29_agent_harness.sh +177 -0
  50. data/examples/README.md +65 -0
  51. data/examples/advanced_multi_robot_capabilities_without_examples.md +106 -0
  52. data/examples/aia_config.yml +1 -1
  53. data/examples/aia_config_orchestrator.yml +45 -0
  54. data/examples/common.sh +19 -0
  55. data/examples/context/tech_stack.md +2 -2
  56. data/examples/prompts_dir/project_summary +2 -2
  57. data/examples/prompts_dir/roles/orchestrator.md +21 -0
  58. data/examples/requirements/sinatra_taskflow_app.md +139 -0
  59. data/examples/rules/01_classify_ruby.rb +16 -0
  60. data/examples/rules/02_prefer_claude_for_code.rb +19 -0
  61. data/examples/rules/03_gate_prompt_length.rb +19 -0
  62. data/examples/rules/04_tool_selection.rb +41 -0
  63. data/examples/rules/README.md +30 -0
  64. data/examples/run_all.sh +48 -15
  65. data/examples/tools/word_count_tool.rb +1 -1
  66. data/lib/AGENTS.md +57 -0
  67. data/lib/aia/chat_loop.rb +306 -159
  68. data/lib/aia/config/cli_parser.rb +174 -111
  69. data/lib/aia/config/defaults.yml +62 -33
  70. data/lib/aia/config/mcp_parser.rb +39 -46
  71. data/lib/aia/config/model_spec.rb +34 -2
  72. data/lib/aia/config/validator.rb +121 -138
  73. data/lib/aia/config.rb +110 -145
  74. data/lib/aia/content_extractor.rb +153 -0
  75. data/lib/aia/cost_calculator.rb +38 -0
  76. data/lib/aia/crew.rb +164 -0
  77. data/lib/aia/debate_handler.rb +166 -0
  78. data/lib/aia/delegate_handler.rb +112 -0
  79. data/lib/aia/directive.rb +33 -18
  80. data/lib/aia/directive_processor.rb +16 -7
  81. data/lib/aia/directives/configuration_directives.rb +160 -20
  82. data/lib/aia/directives/context_directives.rb +38 -26
  83. data/lib/aia/directives/execution_directives.rb +136 -4
  84. data/lib/aia/directives/model_directives.rb +76 -34
  85. data/lib/aia/directives/trakflow_directives.rb +44 -0
  86. data/lib/aia/directives/utility_directives.rb +203 -6
  87. data/lib/aia/directives/web_and_file_directives.rb +96 -60
  88. data/lib/aia/errors.rb +15 -0
  89. data/lib/aia/fact_asserter.rb +27 -0
  90. data/lib/aia/fzf.rb +9 -31
  91. data/lib/aia/handler_context.rb +17 -0
  92. data/lib/aia/handler_protocol.rb +19 -0
  93. data/lib/aia/history_transfer.rb +55 -0
  94. data/lib/aia/input_collector.rb +3 -3
  95. data/lib/aia/layered_orchestrator.rb +448 -0
  96. data/lib/aia/logger.rb +24 -4
  97. data/lib/aia/mcp_config_normalizer.rb +35 -0
  98. data/lib/aia/mcp_connection_manager.rb +305 -0
  99. data/lib/aia/mcp_discovery.rb +44 -0
  100. data/lib/aia/mcp_grouper.rb +33 -0
  101. data/lib/aia/mcp_utility.rb +57 -0
  102. data/lib/aia/mention_router.rb +260 -0
  103. data/lib/aia/model_alias_registry.rb +97 -0
  104. data/lib/aia/model_switch_handler.rb +100 -0
  105. data/lib/aia/network_builder.rb +155 -0
  106. data/lib/aia/network_memory_manager.rb +55 -0
  107. data/lib/aia/patches/ruby_llm_streaming_error.rb +43 -0
  108. data/lib/aia/patches/ruby_llm_tool_error.rb +96 -0
  109. data/lib/aia/pipeline_orchestrator.rb +262 -0
  110. data/lib/aia/plugin_loader.rb +170 -0
  111. data/lib/aia/plugin_monitor.rb +208 -0
  112. data/lib/aia/prompt_decomposer.rb +157 -0
  113. data/lib/aia/prompt_handler.rb +19 -39
  114. data/lib/aia/robot_builder.rb +51 -0
  115. data/lib/aia/robot_factory.rb +334 -0
  116. data/lib/aia/robot_namer.rb +116 -0
  117. data/lib/aia/session.rb +83 -17
  118. data/lib/aia/session_tracker.rb +209 -0
  119. data/lib/aia/similarity_scorer.rb +39 -0
  120. data/lib/aia/skill_utils.rb +105 -1
  121. data/lib/aia/spawn_handler.rb +129 -0
  122. data/lib/aia/spawn_spec_parser.rb +65 -0
  123. data/lib/aia/special_mode_handler.rb +302 -0
  124. data/lib/aia/startup_coordinator.rb +150 -0
  125. data/lib/aia/streaming_runner.rb +169 -0
  126. data/lib/aia/system_prompt_assembler.rb +88 -0
  127. data/lib/aia/task_coordinator.rb +202 -0
  128. data/lib/aia/task_decomposer.rb +57 -0
  129. data/lib/aia/task_executor.rb +51 -0
  130. data/lib/aia/tfidf_math.rb +27 -0
  131. data/lib/aia/tool_filter/tfidf.rb +116 -0
  132. data/lib/aia/tool_filter/wordnet_expander.rb +127 -0
  133. data/lib/aia/tool_filter.rb +82 -0
  134. data/lib/aia/tool_filter_registry.rb +30 -0
  135. data/lib/aia/tool_filter_strategy.rb +143 -0
  136. data/lib/aia/tool_loader.rb +210 -0
  137. data/lib/aia/tool_utility.rb +30 -0
  138. data/lib/aia/tools/delegate_to_foreman_tool.rb +70 -0
  139. data/lib/aia/tools/recruit_robot_tool.rb +60 -0
  140. data/lib/aia/tools/reskill_robot_tool.rb +44 -0
  141. data/lib/aia/tools/task_board_tool.rb +114 -0
  142. data/lib/aia/trakflow_bridge.rb +173 -0
  143. data/lib/aia/turn_state.rb +94 -0
  144. data/lib/aia/ui_presenter.rb +166 -198
  145. data/lib/aia/utility.rb +134 -87
  146. data/lib/aia/{history_manager.rb → variable_input_collector.rb} +8 -9
  147. data/lib/aia/verification_network.rb +58 -0
  148. data/lib/aia.rb +108 -63
  149. data/mkdocs.yml +1 -0
  150. metadata +179 -56
  151. data/justfile +0 -215
  152. data/lib/aia/adapter/chat_execution.rb +0 -242
  153. data/lib/aia/adapter/error_handler.rb +0 -68
  154. data/lib/aia/adapter/gem_activator.rb +0 -57
  155. data/lib/aia/adapter/mcp_connector.rb +0 -274
  156. data/lib/aia/adapter/modality_handlers.rb +0 -167
  157. data/lib/aia/adapter/model_registry.rb +0 -81
  158. data/lib/aia/adapter/multi_model_chat.rb +0 -218
  159. data/lib/aia/adapter/provider_configurator.rb +0 -59
  160. data/lib/aia/adapter/tool_filter.rb +0 -85
  161. data/lib/aia/adapter/tool_loader.rb +0 -90
  162. data/lib/aia/chat_processor_service.rb +0 -164
  163. data/lib/aia/prompt_pipeline.rb +0 -183
  164. data/lib/aia/ruby_llm_adapter.rb +0 -95
  165. data/lib/extensions/openstruct_merge.rb +0 -48
  166. data/lib/extensions/ruby_llm/.irbrc +0 -56
  167. data/lib/extensions/ruby_llm/modalities.rb +0 -36
  168. data/lib/extensions/ruby_llm/provider_fix.rb +0 -79
  169. data/lib/refinements/string.rb +0 -16
  170. data/main.just +0 -76
@@ -1,3 +1,90 @@
1
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
2
+
3
+ ## Table of Contents
4
+
5
+ - [CLI Reference](#cli-reference)
6
+ - [Usage Patterns](#usage-patterns)
7
+ - [Mode Options](#mode-options)
8
+ - [`--chat`](#--chat)
9
+ - [`-f, --fuzzy`](#-f---fuzzy)
10
+ - [`--terse`](#--terse)
11
+ - [`--tokens`](#--tokens)
12
+ - [`--cost`](#--cost)
13
+ - [`--mcp FILE`](#--mcp-file)
14
+ - [`--no-mcp`](#--no-mcp)
15
+ - [`--mcp-list`](#--mcp-list)
16
+ - [`--mu`, `--mcp-use NAMES`](#--mu---mcp-use-names)
17
+ - [`--ms`, `--mcp-skip NAMES`](#--ms---mcp-skip-names)
18
+ - [Adapter Options](#adapter-options)
19
+ - [`--available-models [QUERY]`](#--available-models-query)
20
+ - [Model Options](#model-options)
21
+ - [`-m MODEL, --model MODEL`](#-m-model---model-model)
22
+ - [`--[no-]consensus`](#--no-consensus)
23
+ - [`-s, --skill SKILL_IDS`](#-s---skill-skill_ids)
24
+ - [`--list-skills`](#--list-skills)
25
+ - [`--skills-dir DIR`](#--skills-dir-dir)
26
+ - [`--skills-prefix PREFIX`](#--skills-prefix-prefix)
27
+ - [`--sm, --speech-model MODEL`](#--sm---speech-model-model)
28
+ - [`--tm, --transcription-model MODEL`](#--tm---transcription-model-model)
29
+ - [File Options](#file-options)
30
+ - [`-c, --config-file FILE`](#-c---config-file-file)
31
+ - [`-o, --[no-]output [FILE]`](#-o---no-output-file)
32
+ - [`-a, --[no-]append`](#-a---no-append)
33
+ - [`--[no-]history-file [FILE]`](#--no-history-file-file)
34
+ - [`--md, --[no-]markdown`](#--md---no-markdown)
35
+ - [Prompt Options](#prompt-options)
36
+ - [`--prompts-dir DIR`](#--prompts-dir-dir)
37
+ - [`--roles-prefix PREFIX`](#--roles-prefix-prefix)
38
+ - [`-r, --role ROLE_ID`](#-r---role-role_id)
39
+ - [`--list-roles`](#--list-roles)
40
+ - [`--skills-prefix PREFIX`](#--skills-prefix-prefix-1)
41
+ - [`-s, --skill SKILL_IDS`](#-s---skill-skill_ids-1)
42
+ - [`--list-skills`](#--list-skills-1)
43
+ - [`-n, --next PROMPT_ID`](#-n---next-prompt_id)
44
+ - [`-p PROMPTS, --pipeline PROMPTS`](#-p-prompts---pipeline-prompts)
45
+ - [`--system-prompt PROMPT_ID`](#--system-prompt-prompt_id)
46
+ - [`--regex PATTERN`](#--regex-pattern)
47
+ - [AI Parameters](#ai-parameters)
48
+ - [`-t, --temperature TEMP`](#-t---temperature-temp)
49
+ - [`--max-tokens TOKENS`](#--max-tokens-tokens)
50
+ - [`--top-p VALUE`](#--top-p-value)
51
+ - [`--frequency-penalty VALUE`](#--frequency-penalty-value)
52
+ - [`--presence-penalty VALUE`](#--presence-penalty-value)
53
+ - [Audio/Image Options](#audioimage-options)
54
+ - [`--speak`](#--speak)
55
+ - [`--voice VOICE`](#--voice-voice)
56
+ - [`--is, --image-size SIZE`](#--is---image-size-size)
57
+ - [`--iq, --image-quality QUALITY`](#--iq---image-quality-quality)
58
+ - [`--style, --image-style STYLE`](#--style---image-style-style)
59
+ - [Tool Options](#tool-options)
60
+ - [`--rq LIBS, --require LIBS`](#--rq-libs---require-libs)
61
+ - [`--tools PATH_LIST`](#--tools-path_list)
62
+ - [`--at, --allowed-tools TOOLS_LIST`](#--at---allowed-tools-tools_list)
63
+ - [`--rt, --rejected-tools TOOLS_LIST`](#--rt---rejected-tools-tools_list)
64
+ - [`--list-tools`](#--list-tools)
65
+ - [Utility Options](#utility-options)
66
+ - [Log Level Options](#log-level-options)
67
+ - [`-d, --debug`](#-d---debug)
68
+ - [`--no-debug`](#--no-debug)
69
+ - [`--log-level LEVEL`](#--log-level-level)
70
+ - [`--log-to FILE`](#--log-to-file)
71
+ - [`-v, --[no-]verbose`](#-v---no-verbose)
72
+ - [`--[no-]thinking`](#--no-thinking)
73
+ - [`--refresh DAYS`](#--refresh-days)
74
+ - [`--dump FILE`](#--dump-file)
75
+ - [`--completion SHELL`](#--completion-shell)
76
+ - [`--version`](#--version)
77
+ - [`-h, --help`](#-h---help)
78
+ - [Usage Examples](#usage-examples)
79
+ - [Basic Examples](#basic-examples)
80
+ - [Advanced Examples](#advanced-examples)
81
+ - [Configuration Examples](#configuration-examples)
82
+ - [Environment Variables](#environment-variables)
83
+ - [Configuration Precedence](#configuration-precedence)
84
+ - [Related Documentation](#related-documentation)
85
+
86
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
87
+
1
88
  # CLI Reference
2
89
 
3
90
  Complete reference for all AIA command-line arguments, options, and flags.
@@ -41,7 +128,9 @@ aia -f
41
128
  **Note**: If `fzf` is not installed, AIA will exit with an error.
42
129
 
43
130
  ### `--terse`
44
- Adds a special instruction to the prompt asking the AI to keep responses short and to the point.
131
+ **Deprecated.** Accepted for backward compatibility but has no effect.
132
+
133
+ Formerly added a special instruction to the prompt asking the AI to keep responses short and to the point.
45
134
 
46
135
  ```bash
47
136
  aia --terse my_prompt
@@ -164,15 +253,6 @@ aia --ms playwright --ms filesystem --chat
164
253
 
165
254
  ## Adapter Options
166
255
 
167
- ### `--adapter ADAPTER`
168
- Interface that adapts AIA to the LLM. Currently supported: `ruby_llm`
169
-
170
- ```bash
171
- aia --adapter ruby_llm
172
- ```
173
-
174
- **Valid adapters**: `ruby_llm`
175
-
176
256
  ### `--available-models [QUERY]`
177
257
  List (then exit) available models that match the optional query. Query is a comma-separated list of AND components.
178
258
 
@@ -239,8 +319,12 @@ aia --model "gpt-4,claude-3-sonnet" --no-consensus my_prompt
239
319
  ### `-s, --skill SKILL_IDS`
240
320
  Inject one or more skills into the prompt before it is sent to the AI. Skills are loaded from the skills directory (default: `~/.prompts/skills/`). Multiple skills can be specified as a comma-separated list, and the flag may be repeated.
241
321
 
242
- Skills are inserted **after the role and before the user prompt**, providing task-level instructions for how the LLM should approach the request:
322
+ **Injection mode depends on `--chat`:**
323
+
324
+ - **Chat mode** (`--chat`): skill content is appended to the system prompt once, so it persists across all turns without repetition.
325
+ - **Pipeline mode** (default): skill content is appended to each individual prompt text, immediately after the role content.
243
326
 
327
+ In both modes the assembled order is:
244
328
  ```
245
329
  Role content (who the LLM is)
246
330
  Skill content (how to approach the task)
@@ -314,14 +398,26 @@ aia --skills-dir /shared/team-skills -s code-review my_prompt
314
398
  **Environment variable**: `AIA_SKILLS__DIR`
315
399
 
316
400
  ### `--skills-prefix PREFIX`
317
- Subdirectory name within `--prompts-dir` used as the skills prefix (default: `skills`). Affects `AIA.config.prompts.skills_prefix`.
401
+ Subdirectory name appended to the skills base to build the full skills path (default: none — unset). Affects `AIA.config.prompts.skills_prefix`.
402
+
403
+ Path resolution when prefix is set:
404
+ - If `--skills-dir` is also given: `skills-dir/prefix`
405
+ - Otherwise: `prompts-dir/prefix` (using `--prompts-dir` or `AIA_PROMPTS__DIR`)
318
406
 
319
407
  ```bash
320
408
  aia --skills-prefix team-skills --list-skills
409
+ # Looks for skills under ~/.prompts/team-skills/
410
+
411
+ aia --skills-dir /shared --skills-prefix team-skills --list-skills
412
+ # Looks for skills under /shared/team-skills/
321
413
  ```
322
414
 
415
+ **Environment variable**: `AIA_PROMPTS__SKILLS_PREFIX`
416
+
323
417
  ### `--sm, --speech-model MODEL`
324
- Speech model to use for text-to-speech functionality.
418
+ Set the `SPEECH_MODEL` environment variable that AIA passes to the
419
+ `speak_command`. AIA does not call any TTS API — this value is only meaningful
420
+ if your `speak_command` script reads `$SPEECH_MODEL`.
325
421
 
326
422
  ```bash
327
423
  aia --speech-model tts-1 --speak my_prompt
@@ -375,19 +471,30 @@ aia --output log.md --no-append my_prompt
375
471
  ```
376
472
 
377
473
  ### `--[no-]history-file [FILE]`
378
- Conversation history file for logging prompts and responses.
474
+ Path to the Reline readline history file used in `--chat` mode. Each chat session saves the raw follow-up inputs you typed so they can be recalled with the up-arrow key in future sessions. Up to 50 entries are kept; oldest entries are dropped first when the limit is reached. Has no effect in pipeline mode.
475
+
476
+ **File content**: plain text, one user input per line — no timestamps, no AI responses, no prompt IDs.
477
+
478
+ **Path resolution** (first match wins):
479
+ 1. `FILE` supplied to this flag (or `AIA_OUTPUT__HISTORY_FILE` env var)
480
+ 2. `<aia_dir>/chat_history` when `paths.aia_dir` is configured
481
+ 3. `~/.config/aia/chat_history` (built-in default)
482
+
483
+ **Large-file rotation**: when the history file exceeds an internal size threshold, the session renames it to `<file>.1` and starts a fresh file.
379
484
 
380
485
  ```bash
381
- # Enable history logging to default location
382
- aia --history-file my_prompt
486
+ # Use the default history file location
487
+ aia --chat my_prompt
383
488
 
384
- # Log to specific file
385
- aia --history-file /var/log/aia_history.log my_prompt
489
+ # Use a custom history file
490
+ aia --history-file ~/.aia_chat_history --chat my_prompt
386
491
 
387
- # Disable history logging
388
- aia --no-history-file my_prompt
492
+ # Disable history entirely for this session
493
+ aia --no-history-file --chat my_prompt
389
494
  ```
390
495
 
496
+ **Environment variable**: `AIA_OUTPUT__HISTORY_FILE`
497
+
391
498
  ### `--md, --[no-]markdown`
392
499
  Format output with Markdown.
393
500
 
@@ -472,6 +579,88 @@ Roles are discovered from:
472
579
 
473
580
  **See also**: `--role`, `--model`, `--prompts-dir`, `--roles-prefix`
474
581
 
582
+ ### `--skills-prefix PREFIX`
583
+ Subdirectory name appended to the base path to form the skills directory (default: none — unset).
584
+
585
+ When unset and no `--skills-dir` is given, skills are resolved from `~/.prompts/skills/`.
586
+
587
+ ```bash
588
+ # Use custom prefix under prompts-dir
589
+ aia --skills-prefix capabilities --skill expert
590
+ # Looks for ~/.prompts/capabilities/expert/SKILL.md
591
+
592
+ # Use prefix under an explicit skills-dir
593
+ aia --skills-dir /shared --skills-prefix team --skill expert
594
+ # Looks for /shared/team/expert/SKILL.md
595
+ ```
596
+
597
+ ### `-s, --skill SKILL_IDS`
598
+ One or more skill IDs to layer into the prompt after the role. Skills define *what the LLM does* in order to respond — they sit between the role (identity) and the user prompt in the assembled system prompt.
599
+
600
+ Each skill ID is the name of a subdirectory under `skills.dir` that contains a `SKILL.md` file (e.g., skill `testing` → `~/.prompts/skills/testing/SKILL.md`).
601
+
602
+ Accepts comma-separated values, multiple flags, or a combination of both:
603
+
604
+ ```bash
605
+ # Single skill
606
+ aia --skill testing my_prompt
607
+ aia -s testing my_prompt
608
+
609
+ # Comma-separated
610
+ aia --skill testing,debugging my_prompt
611
+
612
+ # Repeatable flag
613
+ aia --skill testing --skill debugging my_prompt
614
+
615
+ # Combined
616
+ aia --skill testing,debugging --skill refactoring my_prompt
617
+
618
+ # With a role (system → role → skills → user)
619
+ aia --role ruby_expert --skill testing --skill minitest my_prompt
620
+ ```
621
+
622
+ **Prompt assembly order** (first turn only):
623
+ 1. System prompt (guardrails)
624
+ 2. Role prompt (identity/personality)
625
+ 3. Skill prompt(s) (capabilities, in declaration order)
626
+ 4. User prompt
627
+
628
+ Follow-up turns in chat mode include only the system prompt and the user message; role and skills are carried implicitly via conversation history.
629
+
630
+ **See also**: `--role`, `--list-skills`, `--skills-prefix`
631
+
632
+ ### `--list-skills`
633
+ List all available skills and exit. A skill is a subdirectory of the skills directory that contains a `SKILL.md` file. Output is a formatted markdown document.
634
+
635
+ ```bash
636
+ # List all available skills
637
+ aia --list-skills
638
+
639
+ # Example output:
640
+ #
641
+ # ## debugging
642
+ #
643
+ # | Key | Value |
644
+ # |-----|-------|
645
+ # | name | debugging |
646
+ # | description | Debug Ruby applications. |
647
+ #
648
+ # ## minitest
649
+ #
650
+ # | Key | Value |
651
+ # |-----|-------|
652
+ # | name | minitest |
653
+ # | description | Write tests using Minitest. |
654
+ ```
655
+
656
+ Skills are discovered from:
657
+ - **Default location**: `~/.prompts/skills/`
658
+ - **Custom location**: Set via `--prompts-dir` and `--skills-prefix`
659
+ - **Convention**: Each skill is a subdirectory containing a `SKILL.md` file; plain `.md` files and subdirectories without `SKILL.md` are ignored
660
+ - **Output**: H2 heading per skill ID, followed by a two-column table of YAML front matter key/value pairs
661
+
662
+ **See also**: `--skill`, `--skills-prefix`
663
+
475
664
  ### `-n, --next PROMPT_ID`
476
665
  Next prompt to process (can be used multiple times to build a pipeline).
477
666
 
@@ -498,7 +687,7 @@ aia --system-prompt code_expert --chat my_code.py
498
687
  ```
499
688
 
500
689
  ### `--regex PATTERN`
501
- Regex pattern to extract parameters from prompt text.
690
+ **Deprecated.** No longer used; prompt parameters use ERB syntax.
502
691
 
503
692
  ```bash
504
693
  aia --regex '\{\{(\w+)\}\}' my_template_prompt
@@ -565,23 +754,77 @@ aia --presence-penalty -0.5 deep_dive
565
754
  ## Audio/Image Options
566
755
 
567
756
  ### `--speak`
568
- Convert text to audio and play it. Uses the configured speech model and voice.
757
+ After each AI response, AIA runs a three-stage pipeline with a progress spinner
758
+ for each stage:
759
+
760
+ | Stage | What happens | Spinner |
761
+ |-------|-------------|---------|
762
+ | 1. Generation | LLM streams text to the terminal | `Processing...` |
763
+ | 2. Conversion | Text is converted to an audio file | `Converting to audio...` |
764
+ | 3. Playback | Audio file is played | `Speaking...` |
765
+
766
+ **Local TTS (default):** `say` converts and plays in one step, so stages 2 and 3
767
+ share a single `Speaking...` spinner.
569
768
 
570
769
  ```bash
571
- aia --speak my_prompt
572
- aia --speak --voice nova my_prompt
770
+ aia --chat --speak my_prompt
771
+ aia --speak --voice Samantha my_prompt
772
+ ```
773
+
774
+ **Custom TTS script (e.g. OpenAI TTS):** AIA calls the script with two
775
+ arguments — the text (`$1`) and the path to write the audio file (`$2`) — then
776
+ plays the resulting file with `afplay`. The script is responsible **only** for
777
+ conversion; AIA handles playback and shows both spinners.
778
+
779
+ AIA does **not** call any TTS API itself. A ready-made script for OpenAI TTS is
780
+ installed at `~/.config/aia/tts.sh`:
781
+
782
+ ```bash
783
+ # ~/.config/aia/tts.sh — called as: tts.sh "text" /path/to/output.mp3
784
+ #!/usr/bin/env bash
785
+ model="${SPEECH_MODEL:-tts-1}"
786
+ voice="${AIA_AUDIO__VOICE:-alloy}"
787
+ curl -s https://api.openai.com/v1/audio/speech \
788
+ -H "Authorization: Bearer $OPENAI_API_KEY" \
789
+ -H "Content-Type: application/json" \
790
+ -d "{\"model\": \"$model\", \"input\": $(printf '%s' "$1" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'), \"voice\": \"$voice\"}" \
791
+ --output "$2"
792
+ ```
793
+
794
+ ```yaml
795
+ # ~/.config/aia/aia.yml
796
+ audio:
797
+ speak_command: ~/.config/aia/tts.sh
798
+ speech_model: tts-1-hd
799
+ voice: nova
800
+ ```
801
+
802
+ Or entirely from the CLI:
803
+
804
+ ```bash
805
+ aia --chat --speak \
806
+ --speak-command ~/.config/aia/tts.sh \
807
+ --speech-model tts-1-hd \
808
+ --voice nova \
809
+ my_prompt
573
810
  ```
574
811
 
575
812
  ### `--voice VOICE`
576
- Voice to use for speech synthesis.
813
+ Voice name passed to the `speak_command`.
814
+
815
+ For macOS `say` (default), specify a macOS voice name (run `say -v '?'` to list
816
+ available voices):
817
+
818
+ ```bash
819
+ aia --voice Samantha --speak my_prompt
820
+ aia --voice Alex --speak my_prompt
821
+ ```
822
+
823
+ For a custom OpenAI TTS script, use an OpenAI voice name instead:
577
824
 
578
825
  ```bash
579
826
  aia --voice alloy --speak my_prompt
580
- aia --voice echo --speak my_prompt
581
- aia --voice fable --speak my_prompt
582
- aia --voice nova --speak my_prompt
583
- aia --voice onyx --speak my_prompt
584
- aia --voice shimmer --speak my_prompt
827
+ aia --voice nova --speak my_prompt
585
828
  ```
586
829
 
587
830
  ### `--is, --image-size SIZE`
@@ -760,38 +1003,28 @@ Explicitly disable debug output. Sets `$DEBUG_ME = false`.
760
1003
  aia --no-debug my_prompt
761
1004
  ```
762
1005
 
763
- ### `--info`
764
- Set all loggers to INFO level. Shows informational messages and above.
765
-
766
- ```bash
767
- aia --info my_prompt
768
- aia --info --chat
769
- ```
770
-
771
- ### `--warn`
772
- Set all loggers to WARN level (this is the default). Shows warnings, errors, and fatal messages.
773
-
774
- ```bash
775
- aia --warn my_prompt
776
- ```
1006
+ ### `--log-level LEVEL`
1007
+ Set all loggers to the specified level. Only `--debug` / `--no-debug` exist as standalone flags; all other levels are set via this option.
777
1008
 
778
- ### `--error`
779
- Set all loggers to ERROR level. Shows only errors and fatal messages.
1009
+ Valid values for LEVEL: `debug`, `info`, `warn`, `error`, `fatal`
780
1010
 
781
1011
  ```bash
782
- aia --error my_prompt
783
- aia --error --chat
1012
+ aia --log-level info my_prompt
1013
+ aia --log-level warn --chat
1014
+ aia --log-level error my_prompt
1015
+ aia --log-level fatal my_prompt
784
1016
  ```
785
1017
 
786
- ### `--fatal`
787
- Set all loggers to FATAL level (least verbose). Shows only critical/fatal messages.
1018
+ ### `--log-to FILE`
1019
+ Redirect all logger output to FILE instead of STDOUT.
788
1020
 
789
1021
  ```bash
790
- aia --fatal my_prompt
1022
+ aia --log-to /var/log/aia.log my_prompt
1023
+ aia --log-to ~/aia_debug.log --debug --chat
791
1024
  ```
792
1025
 
793
1026
  **Log Level Hierarchy** (from most to least verbose):
794
- 1. `debug` - All messages including detailed debugging information
1027
+ 1. `debug` - All messages including detailed debugging information (use `--debug` / `--no-debug`)
795
1028
  2. `info` - Informational messages and above
796
1029
  3. `warn` - Warnings, errors, and fatal messages (default)
797
1030
  4. `error` - Only errors and fatal messages
@@ -809,6 +1042,24 @@ aia -v my_prompt
809
1042
  aia --no-verbose my_prompt
810
1043
  ```
811
1044
 
1045
+ ### `--[no-]thinking`
1046
+ Show or hide raw thinking/reasoning blocks in the output. Default: **off**.
1047
+
1048
+ Some local reasoning models (e.g. `qwen3` on Ollama) emit their chain-of-thought
1049
+ wrapped in `<think>...</think>` tags as part of the streamed response. By default
1050
+ AIA filters these blocks out so you only see the final answer. Pass `--thinking`
1051
+ to display the reasoning as well.
1052
+
1053
+ ```bash
1054
+ # Show the model's reasoning
1055
+ aia --chat --thinking -m ollama/qwen3:latest
1056
+
1057
+ # Explicitly hide it (the default)
1058
+ aia --chat --no-thinking -m ollama/qwen3:latest
1059
+ ```
1060
+
1061
+ Equivalent config key: `flags.thinking` (env: `AIA_FLAGS__THINKING`).
1062
+
812
1063
  ### `--refresh DAYS`
813
1064
  Refresh models database interval in days.
814
1065
 
@@ -908,8 +1159,11 @@ aia --config-file ./project_config.yml --prompts-dir ./project_prompts/ my_promp
908
1159
  # Save output with markdown formatting
909
1160
  aia --output analysis.md --markdown --append data_analysis dataset.csv
910
1161
 
911
- # Audio processing
912
- aia --transcription-model whisper-1 --speech-model tts-1-hd --voice echo audio_prompt audio_file.wav
1162
+ # Speak responses aloud (macOS say, default voice)
1163
+ aia --speak my_prompt
1164
+
1165
+ # Speak with a specific macOS voice
1166
+ aia --speak --voice Samantha my_prompt
913
1167
  ```
914
1168
 
915
1169
  ## Environment Variables
@@ -931,6 +1185,7 @@ export AIA_LLM__MAX_TOKENS="2048"
931
1185
  # Prompts settings (nested under prompts:)
932
1186
  export AIA_PROMPTS__DIR="/custom/prompts"
933
1187
  export AIA_PROMPTS__ROLES_PREFIX="roles"
1188
+ export AIA_PROMPTS__SKILLS_PREFIX="skills"
934
1189
 
935
1190
  # Output settings (nested under output:)
936
1191
  export AIA_OUTPUT__FILE="./output.md"
@@ -938,8 +1193,9 @@ export AIA_OUTPUT__APPEND="true"
938
1193
  export AIA_OUTPUT__HISTORY_FILE="~/.prompts/_prompts.log"
939
1194
 
940
1195
  # Audio settings (nested under audio:)
941
- export AIA_AUDIO__VOICE="alloy"
942
- export AIA_AUDIO__SPEECH_MODEL="tts-1"
1196
+ export AIA_AUDIO__VOICE="Samantha" # macOS voice (say -v '?'); or OpenAI voice for custom scripts
1197
+ export AIA_AUDIO__SPEAK_COMMAND="say" # default; replace with a custom TTS script for OpenAI TTS
1198
+ export AIA_AUDIO__SPEECH_MODEL="tts-1" # passed as SPEECH_MODEL to the speak_command script
943
1199
 
944
1200
  # Image settings (nested under image:)
945
1201
  export AIA_IMAGE__SIZE="1024x1024"