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,478 +0,0 @@
1
- # Basic Usage
2
-
3
- Learn the fundamental patterns and workflows for using AIA effectively in your daily tasks.
4
-
5
- ## Core Usage Patterns
6
-
7
- ### 1. Simple Prompt Execution
8
- The most basic usage pattern - running a single prompt:
9
-
10
- ```bash
11
- # Execute a prompt with context
12
- aia my_prompt input_file.txt
13
-
14
- # Execute without additional context
15
- aia general_question
16
- ```
17
-
18
- ### 2. Model Selection
19
- Choose the appropriate model for your task:
20
-
21
- ```bash
22
- # Fast and economical for simple tasks
23
- aia --model gpt-3.5-turbo quick_question
24
-
25
- # High quality for complex analysis
26
- aia --model gpt-4 complex_analysis data.csv
27
-
28
- # Best for long documents
29
- aia --model claude-3-sonnet document_review long_doc.pdf
30
- ```
31
-
32
- ### 3. Output Management
33
- Control where and how AIA saves results:
34
-
35
- ```bash
36
- # Save to file
37
- aia --output result.md analysis_prompt data.csv
38
-
39
- # Append to existing file
40
- aia --output log.md --append status_check
41
-
42
- # Format with markdown
43
- aia --output report.md --markdown comprehensive_analysis
44
- ```
45
-
46
- ## Common Workflow Patterns
47
-
48
- ### Research and Analysis
49
- Typical workflow for research tasks:
50
-
51
- ```bash
52
- # Step 1: Gather information
53
- aia information_gathering --topic "AI trends 2024" --sources "web,papers"
54
-
55
- # Step 2: Analyze findings
56
- aia trend_analysis --data research_output.md --focus "enterprise adoption"
57
-
58
- # Step 3: Generate insights
59
- aia insight_generation --analysis analysis_output.md --format "executive_summary"
60
- ```
61
-
62
- ### Code Review and Development
63
- Standard development workflow:
64
-
65
- ```bash
66
- # Code quality check
67
- aia code_review src/main.py --focus "security,performance"
68
-
69
- # Generate documentation
70
- aia generate_docs --code src/ --format "markdown" --audience "developers"
71
-
72
- # Create tests
73
- aia test_generator --code src/main.py --framework "pytest" --coverage "comprehensive"
74
- ```
75
-
76
- ### Content Creation
77
- Content development workflow:
78
-
79
- ```bash
80
- # Research phase
81
- aia content_research --topic "microservices architecture" --depth "comprehensive"
82
-
83
- # Outline creation
84
- aia create_outline --topic "microservices" --audience "developers" --length "3000 words"
85
-
86
- # Content generation
87
- aia write_content --outline outline.md --style "technical" --examples "include"
88
- ```
89
-
90
- ## Configuration Patterns
91
-
92
- ### Environment-Specific Configurations
93
- Set up different configurations for different environments:
94
-
95
- ```yaml
96
- # ~/.config/aia/dev_config.yml
97
- model: gpt-3.5-turbo
98
- temperature: 0.7
99
- verbose: true
100
- debug: true
101
-
102
- # ~/.config/aia/prod_config.yml
103
- model: gpt-4
104
- temperature: 0.3
105
- verbose: false
106
- debug: false
107
- ```
108
-
109
- ```bash
110
- # Use environment-specific configs
111
- aia --config-file ~/.config/aia/dev_config.yml development_task
112
- aia --config-file ~/.config/aia/prod_config.yml production_analysis
113
- ```
114
-
115
- ### Task-Specific Model Selection
116
- Choose models based on task characteristics:
117
-
118
- ```bash
119
- # Creative tasks - higher temperature
120
- aia --model gpt-4 --temperature 1.2 creative_writing
121
-
122
- # Analysis tasks - lower temperature
123
- aia --model claude-3-sonnet --temperature 0.2 data_analysis
124
-
125
- # Quick tasks - fast model
126
- aia --model gpt-3.5-turbo --temperature 0.5 quick_summary
127
- ```
128
-
129
- ## File and Context Management
130
-
131
- ### Working with Multiple Files
132
- Handle multiple input files effectively:
133
-
134
- ```bash
135
- # Single file context
136
- aia code_review main.py
137
-
138
- # Multiple related files
139
- aia architecture_review src/*.py
140
-
141
- # Directory-based analysis
142
- aia project_analysis ./src/ --recursive --include "*.py,*.rb"
143
- ```
144
-
145
- ### Context Preparation
146
- Prepare context effectively for better results:
147
-
148
- ```bash
149
- # Include relevant documentation
150
- aia --include README.md,ARCHITECTURE.md code_review new_feature.py
151
-
152
- # Add configuration context
153
- aia --include config/database.yml,config/redis.yml deployment_review
154
-
155
- # Include test context
156
- aia --include tests/ code_quality_check src/
157
- ```
158
-
159
- ## Parameter and Variable Usage
160
-
161
- ### ERB Template Variables
162
- Use variables to make prompts reusable:
163
-
164
- ```markdown
165
- # ~/.prompts/parameterized_review.md
166
- Review the <%= file_type %> file for <%= focus_areas %>:
167
-
168
- File: /include <%= file_path %>
169
-
170
- Provide <%= detail_level %> analysis with recommendations.
171
- ```
172
-
173
- ```bash
174
- # Use with parameters
175
- aia parameterized_review \
176
- --file_type "Python script" \
177
- --focus_areas "security and performance" \
178
- --file_path "app.py" \
179
- --detail_level "comprehensive"
180
- ```
181
-
182
- ### Environment Variable Integration
183
- Use environment variables for dynamic configuration:
184
-
185
- ```bash
186
- # Set environment-specific variables
187
- export PROJECT_NAME="my-app"
188
- export ENVIRONMENT="staging"
189
- export REVIEW_FOCUS="security"
190
-
191
- # Use in prompts
192
- aia deployment_review --project "${PROJECT_NAME}" --env "${ENVIRONMENT}"
193
- ```
194
-
195
- ## Error Handling and Recovery
196
-
197
- ### Graceful Failure Handling
198
- Handle common failure scenarios:
199
-
200
- ```bash
201
- # Retry with different model on failure
202
- aia --model gpt-4 analysis_task || aia --model claude-3-sonnet analysis_task
203
-
204
- # Fallback to simpler approach
205
- aia comprehensive_analysis data.csv || aia simple_analysis data.csv
206
-
207
- # Debug mode for troubleshooting
208
- aia --debug --verbose problematic_task
209
- ```
210
-
211
- ### Input Validation
212
- Validate inputs before processing:
213
-
214
- ```bash
215
- # Check file exists before processing
216
- test -f input.csv && aia data_analysis input.csv || echo "Input file not found"
217
-
218
- # Verify model availability
219
- aia --available-models | grep -q "gpt-4" && aia --model gpt-4 task || aia task
220
- ```
221
-
222
- ## Performance Optimization
223
-
224
- ### Efficient Model Usage
225
- Optimize for speed and cost:
226
-
227
- ```bash
228
- # Use appropriate model for task complexity
229
- aia --model gpt-3.5-turbo simple_tasks # Fast and economical
230
- aia --model gpt-4 complex_reasoning # High quality when needed
231
- aia --model claude-3-haiku batch_processing # Fast for large batches
232
- ```
233
-
234
- ### Batch Processing
235
- Handle multiple similar tasks efficiently:
236
-
237
- ```bash
238
- # Process multiple files
239
- for file in *.py; do
240
- aia code_review "$file" --output "reviews/${file%.py}_review.md"
241
- done
242
-
243
- # Parallel processing
244
- parallel -j4 aia analysis_task {} --output {.}_analysis.md ::: *.csv
245
- ```
246
-
247
- ### Caching and Reuse
248
- Avoid redundant processing:
249
-
250
- ```bash
251
- # Check if output exists before processing
252
- output_file="analysis_$(date +%Y%m%d).md"
253
- test -f "$output_file" || aia daily_analysis --output "$output_file"
254
-
255
- # Reuse previous analysis
256
- aia followup_analysis --previous_analysis yesterday_analysis.md
257
- ```
258
-
259
- ## Integration Patterns
260
-
261
- ### Shell Integration
262
- Integrate AIA into shell workflows:
263
-
264
- ```bash
265
- #!/bin/bash
266
- # Automated analysis script
267
-
268
- echo "Starting analysis..."
269
- aia system_health_check --output health_$(date +%Y%m%d_%H%M).md
270
-
271
- if [ $? -eq 0 ]; then
272
- echo "Health check complete"
273
- aia generate_report --source health_*.md --output daily_report.md
274
- else
275
- echo "Health check failed, investigating..."
276
- aia troubleshoot_system --debug --verbose
277
- fi
278
- ```
279
-
280
- ### Git Hooks Integration
281
- Use AIA in Git workflows:
282
-
283
- ```bash
284
- #!/bin/sh
285
- # .git/hooks/pre-commit
286
-
287
- # Review changed files before commit
288
- changed_files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(py|rb|js)$')
289
-
290
- if [ -n "$changed_files" ]; then
291
- echo "Running AIA code review..."
292
- for file in $changed_files; do
293
- aia quick_code_review "$file" || exit 1
294
- done
295
- fi
296
- ```
297
-
298
- ### CI/CD Integration
299
- Integrate into continuous integration:
300
-
301
- ```yaml
302
- # .github/workflows/aia-analysis.yml
303
- name: AIA Code Analysis
304
- on: [pull_request]
305
-
306
- jobs:
307
- analyze:
308
- runs-on: ubuntu-latest
309
- steps:
310
- - uses: actions/checkout@v3
311
- - name: Setup Ruby
312
- uses: ruby/setup-ruby@v1
313
- with:
314
- ruby-version: 4.0.0
315
- - name: Install AIA
316
- run: gem install aia
317
- - name: Run Analysis
318
- run: |
319
- aia pr_analysis --diff_only --output analysis.md
320
- cat analysis.md >> $GITHUB_STEP_SUMMARY
321
- env:
322
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
323
- ```
324
-
325
- ## Troubleshooting Common Issues
326
-
327
- ### Model and API Issues
328
- ```bash
329
- # Test model availability
330
- aia --available-models | grep "gpt-4" || echo "GPT-4 not available"
331
-
332
- # Test API connection
333
- aia --model gpt-3.5-turbo --debug simple_test_prompt
334
-
335
- # Check API key
336
- echo $OPENAI_API_KEY | cut -c1-10 # Show first 10 chars only
337
- ```
338
-
339
- ### File and Permission Issues
340
- ```bash
341
- # Check file permissions
342
- ls -la ~/.prompts/my_prompt.md
343
- chmod 644 ~/.prompts/my_prompt.md
344
-
345
- # Verify directory access
346
- test -r ~/.prompts && echo "Prompts directory accessible" || echo "Permission issue"
347
-
348
- # Check prompt syntax
349
- aia --debug --dry-run my_prompt # Dry run to check syntax
350
- ```
351
-
352
- ### Performance Issues
353
- ```bash
354
- # Monitor token usage
355
- aia --verbose --debug resource_intensive_task 2>&1 | grep -i token
356
-
357
- # Profile execution time
358
- time aia complex_analysis large_dataset.csv
359
-
360
- # Use faster model for testing
361
- aia --model gpt-3.5-turbo quick_test
362
- ```
363
-
364
- ## Essential Prompt Patterns
365
-
366
- ### The `run` Prompt Pattern
367
-
368
- The `run` prompt is a configuration-only prompt that serves as a foundation for flexible AI interactions:
369
-
370
- ```bash
371
- # ~/.prompts/run.md
372
- # Desc: A configuration only prompt file for use with executable prompts
373
- # Put whatever you want here to setup the configuration desired.
374
- # You could also add a system prompt to preface your intended prompt
375
-
376
- /config model = gpt-4o-mini
377
- /config temperature = 0.7
378
- /config terse = true
379
- ```
380
-
381
- **Usage Examples:**
382
- ```bash
383
- # Direct question via pipe
384
- echo "What is the meaning of life?" | aia
385
-
386
- # File analysis
387
- aia my_code.py
388
-
389
- # Multiple files
390
- aia *.txt
391
-
392
- # With custom configuration
393
- echo "Explain quantum computing" | aia --model gpt-4 --temperature 1.0
394
- ```
395
-
396
- ### The Ad Hoc One-Shot Prompt
397
-
398
- Perfect for quick questions without cluttering your prompt collection:
399
-
400
- ```bash
401
- # ~/.prompts/ad_hoc.md
402
- [WHAT_NOW_HUMAN]
403
- ```
404
-
405
- **Usage:**
406
- ```bash
407
- aia ad_hoc
408
- # You'll be prompted: "Enter value for WHAT_NOW_HUMAN:"
409
- # Type your question and get an instant response
410
- ```
411
-
412
- ### Recommended Shell Setup
413
-
414
- Add these powerful aliases and functions to your shell configuration:
415
-
416
- ```bash
417
- # ~/.bashrc_aia (or add to ~/.bashrc)
418
- # Uses nested naming convention with double underscore
419
- export AIA_PROMPTS__DIR=~/.prompts
420
- export AIA_OUTPUT__FILE=./temp.md
421
- export AIA_MODEL=gpt-4o-mini
422
- export AIA_FLAGS__VERBOSE=true # Shows spinner while waiting for LLM response
423
-
424
- # Quick chat alias
425
- alias chat='aia --chat --terse'
426
-
427
- # Quick question function
428
- ask() { echo "$1" | aia --no-output; }
429
- ```
430
-
431
- **Usage Examples:**
432
- ```bash
433
- # Start quick chat
434
- chat
435
-
436
- # Ask quick questions
437
- ask "How do I install Docker on Ubuntu?"
438
- ask "What's the difference between REST and GraphQL?"
439
- ask "Explain the MVC pattern"
440
- ```
441
-
442
- ## Best Practices Summary
443
-
444
- ### Model Selection
445
- - Use `gpt-3.5-turbo` for simple, fast tasks
446
- - Use `gpt-4` for complex reasoning and critical analysis
447
- - Use `claude-3-sonnet` for long documents and detailed analysis
448
- - Use `claude-3-haiku` for batch processing and quick tasks
449
-
450
- ### Prompt Organization
451
- - Group related prompts in directories
452
- - Use descriptive, consistent naming
453
- - Include usage examples in prompt comments
454
- - Version control your prompt collection
455
-
456
- ### Configuration Management
457
- - Use environment variables for secrets
458
- - Create environment-specific configs
459
- - Document your configuration choices
460
- - Test configurations in safe environments
461
-
462
- ### Performance Optimization
463
- - Choose appropriate models for each task
464
- - Use batch processing for similar tasks
465
- - Cache results when appropriate
466
- - Monitor usage and costs
467
-
468
- ## Related Documentation
469
-
470
- - [Getting Started](getting-started.md) - Initial setup and first steps
471
- - [Chat Mode](chat.md) - Interactive usage patterns
472
- - [Working with Models](models.md) - Model selection strategies
473
- - [Advanced Prompting](../advanced-prompting.md) - Complex usage patterns
474
- - [Configuration](../configuration.md) - Detailed configuration options
475
-
476
- ---
477
-
478
- Master these basic patterns first, then explore the advanced features as your needs grow!