aia 0.9.11 → 0.9.12

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/CHANGELOG.md +66 -2
  4. data/README.md +133 -4
  5. data/docs/advanced-prompting.md +721 -0
  6. data/docs/cli-reference.md +582 -0
  7. data/docs/configuration.md +347 -0
  8. data/docs/contributing.md +332 -0
  9. data/docs/directives-reference.md +490 -0
  10. data/docs/examples/index.md +277 -0
  11. data/docs/examples/mcp/index.md +479 -0
  12. data/docs/examples/prompts/analysis/index.md +78 -0
  13. data/docs/examples/prompts/automation/index.md +108 -0
  14. data/docs/examples/prompts/development/index.md +125 -0
  15. data/docs/examples/prompts/index.md +333 -0
  16. data/docs/examples/prompts/learning/index.md +127 -0
  17. data/docs/examples/prompts/writing/index.md +62 -0
  18. data/docs/examples/tools/index.md +292 -0
  19. data/docs/faq.md +414 -0
  20. data/docs/guides/available-models.md +366 -0
  21. data/docs/guides/basic-usage.md +477 -0
  22. data/docs/guides/chat.md +474 -0
  23. data/docs/guides/executable-prompts.md +417 -0
  24. data/docs/guides/first-prompt.md +454 -0
  25. data/docs/guides/getting-started.md +455 -0
  26. data/docs/guides/image-generation.md +507 -0
  27. data/docs/guides/index.md +46 -0
  28. data/docs/guides/models.md +507 -0
  29. data/docs/guides/tools.md +856 -0
  30. data/docs/index.md +173 -0
  31. data/docs/installation.md +238 -0
  32. data/docs/mcp-integration.md +612 -0
  33. data/docs/prompt_management.md +579 -0
  34. data/docs/security.md +629 -0
  35. data/docs/tools-and-mcp-examples.md +1186 -0
  36. data/docs/workflows-and-pipelines.md +563 -0
  37. data/examples/tools/mcp/github_mcp_server.json +11 -0
  38. data/examples/tools/mcp/imcp.json +7 -0
  39. data/lib/aia/chat_processor_service.rb +19 -3
  40. data/lib/aia/config/base.rb +224 -0
  41. data/lib/aia/config/cli_parser.rb +409 -0
  42. data/lib/aia/config/defaults.rb +88 -0
  43. data/lib/aia/config/file_loader.rb +131 -0
  44. data/lib/aia/config/validator.rb +184 -0
  45. data/lib/aia/config.rb +10 -860
  46. data/lib/aia/directive_processor.rb +27 -372
  47. data/lib/aia/directives/configuration.rb +114 -0
  48. data/lib/aia/directives/execution.rb +37 -0
  49. data/lib/aia/directives/models.rb +178 -0
  50. data/lib/aia/directives/registry.rb +120 -0
  51. data/lib/aia/directives/utility.rb +70 -0
  52. data/lib/aia/directives/web_and_file.rb +71 -0
  53. data/lib/aia/prompt_handler.rb +23 -3
  54. data/lib/aia/ruby_llm_adapter.rb +307 -128
  55. data/lib/aia/session.rb +27 -14
  56. data/lib/aia/utility.rb +12 -8
  57. data/lib/aia.rb +11 -2
  58. data/lib/extensions/ruby_llm/.irbrc +56 -0
  59. data/mkdocs.yml +165 -0
  60. metadata +77 -20
  61. /data/{images → docs/assets/images}/aia.png +0 -0
@@ -0,0 +1,292 @@
1
+ # Tools Examples
2
+
3
+ Collection of RubyLLM tools that extend AIA's capabilities with custom Ruby functions.
4
+
5
+ ## Available Tools
6
+
7
+ ### File Processing Tools
8
+ - **file_analyzer.rb** - Advanced file analysis and metadata extraction
9
+ - **log_analyzer.rb** - Log file parsing and pattern analysis
10
+ - **config_manager.rb** - Configuration file management and validation
11
+ - **document_processor.rb** - Document format conversion and processing
12
+
13
+ ### Web Integration Tools
14
+ - **web_client.rb** - HTTP client for API interactions
15
+ - **web_scraper.rb** - Web scraping and content extraction
16
+ - **api_tester.rb** - API endpoint testing and validation
17
+ - **webhook_handler.rb** - Webhook processing and management
18
+
19
+ ### Data Analysis Tools
20
+ - **data_analyzer.rb** - CSV and JSON data analysis
21
+ - **statistics_calculator.rb** - Statistical calculations and metrics
22
+ - **chart_generator.rb** - Data visualization and chart generation
23
+ - **database_connector.rb** - Database query and analysis tools
24
+
25
+ ### Development Tools
26
+ - **code_quality.rb** - Code quality analysis and metrics
27
+ - **test_runner.rb** - Test execution and reporting
28
+ - **dependency_checker.rb** - Dependency analysis and management
29
+ - **deploy_helper.rb** - Deployment assistance and validation
30
+
31
+ ### System Integration Tools
32
+ - **system_monitor.rb** - System monitoring and health checks
33
+ - **process_manager.rb** - Process management and control
34
+ - **backup_manager.rb** - Backup operations and scheduling
35
+ - **security_scanner.rb** - Security scanning and assessment
36
+
37
+ ## Tool Structure
38
+
39
+ All tools follow the standard RubyLLM::Tool pattern:
40
+
41
+ ```ruby
42
+ class ToolName < RubyLLM::Tool
43
+ description "Brief description of tool functionality"
44
+
45
+ def method_name(parameter1, parameter2 = nil)
46
+ # Tool implementation
47
+ return "Result string or JSON"
48
+ end
49
+
50
+ private
51
+
52
+ def helper_method
53
+ # Internal helper methods
54
+ end
55
+ end
56
+ ```
57
+
58
+ ## Usage Examples
59
+
60
+ ### Basic Tool Usage
61
+ ```bash
62
+ # Use a single tool
63
+ aia --tools file_analyzer.rb analyze_project project/
64
+
65
+ # Use multiple tools
66
+ aia --tools "web_client.rb,data_analyzer.rb" api_data_analysis
67
+
68
+ # Use tool directory
69
+ aia --tools ./tools/ comprehensive_analysis
70
+ ```
71
+
72
+ ### Tool Security
73
+ ```bash
74
+ # Restrict to specific tools
75
+ aia --tools ./tools/ --allowed_tools "file_analyzer,data_analyzer" safe_analysis
76
+
77
+ # Block potentially dangerous tools
78
+ aia --tools ./tools/ --rejected_tools "system_monitor,process_manager" user_analysis
79
+ ```
80
+
81
+ ### Tool Integration in Prompts
82
+ ```markdown
83
+ # Use tools within prompts
84
+ //tools file_analyzer.rb,web_client.rb
85
+
86
+ Analyze the project structure and check API endpoints:
87
+ 1. Use file_analyzer to examine project files
88
+ 2. Use web_client to test API endpoints
89
+ 3. Provide comprehensive assessment
90
+ ```
91
+
92
+ ## Tool Categories
93
+
94
+ ### Security Level: Safe
95
+ Tools that only read data and perform analysis:
96
+ - file_analyzer.rb
97
+ - data_analyzer.rb
98
+ - statistics_calculator.rb
99
+ - code_quality.rb
100
+
101
+ ### Security Level: Network
102
+ Tools that make network requests:
103
+ - web_client.rb
104
+ - web_scraper.rb
105
+ - api_tester.rb
106
+ - webhook_handler.rb
107
+
108
+ ### Security Level: System
109
+ Tools that interact with the system:
110
+ - system_monitor.rb
111
+ - process_manager.rb
112
+ - deploy_helper.rb
113
+ - security_scanner.rb
114
+
115
+ ### Security Level: Write
116
+ Tools that can modify files or system state:
117
+ - config_manager.rb (when writing configs)
118
+ - backup_manager.rb
119
+ - document_processor.rb (when saving files)
120
+
121
+ ## Tool Development Guidelines
122
+
123
+ ### Best Practices
124
+ 1. **Single Responsibility** - Each tool should do one thing well
125
+ 2. **Error Handling** - Comprehensive error handling and user feedback
126
+ 3. **Input Validation** - Validate all inputs and parameters
127
+ 4. **Security** - Follow principle of least privilege
128
+ 5. **Documentation** - Clear descriptions and usage examples
129
+
130
+ ### Example Tool Template
131
+ ```ruby
132
+ # ~/.aia/tools/example_tool.rb
133
+ require 'json'
134
+
135
+ class ExampleTool < RubyLLM::Tool
136
+ description "Example tool demonstrating best practices"
137
+
138
+ def process_data(input_data, options = {})
139
+ # Validate inputs
140
+ return "Error: No input data provided" if input_data.nil? || input_data.empty?
141
+
142
+ begin
143
+ # Process data
144
+ result = perform_processing(input_data, options)
145
+
146
+ # Return structured result
147
+ {
148
+ status: 'success',
149
+ data: result,
150
+ metadata: {
151
+ processed_at: Time.now.iso8601,
152
+ options_used: options
153
+ }
154
+ }.to_json
155
+
156
+ rescue StandardError => e
157
+ # Handle errors gracefully
158
+ {
159
+ status: 'error',
160
+ message: e.message,
161
+ type: e.class.name
162
+ }.to_json
163
+ end
164
+ end
165
+
166
+ private
167
+
168
+ def perform_processing(data, options)
169
+ # Actual processing logic
170
+ data.upcase
171
+ end
172
+ end
173
+ ```
174
+
175
+ ### Testing Tools
176
+ ```ruby
177
+ # test_example_tool.rb
178
+ require 'minitest/autorun'
179
+ require_relative 'example_tool'
180
+
181
+ class TestExampleTool < Minitest::Test
182
+ def setup
183
+ @tool = ExampleTool.new
184
+ end
185
+
186
+ def test_basic_functionality
187
+ result = @tool.process_data("test input")
188
+ parsed = JSON.parse(result)
189
+
190
+ assert_equal 'success', parsed['status']
191
+ assert_equal 'TEST INPUT', parsed['data']
192
+ end
193
+
194
+ def test_error_handling
195
+ result = @tool.process_data(nil)
196
+ parsed = JSON.parse(result)
197
+
198
+ assert_includes parsed['message'], 'No input data'
199
+ end
200
+ end
201
+ ```
202
+
203
+ ## Tool Installation and Distribution
204
+
205
+ ### Local Tool Directory
206
+ ```bash
207
+ # Create tool directory structure
208
+ mkdir -p ~/.aia/tools/{core,development,analysis,web,system}
209
+
210
+ # Copy tools to appropriate directories
211
+ cp file_analyzer.rb ~/.aia/tools/core/
212
+ cp code_quality.rb ~/.aia/tools/development/
213
+ cp data_analyzer.rb ~/.aia/tools/analysis/
214
+ ```
215
+
216
+ ### Tool Libraries
217
+ ```yaml
218
+ # ~/.aia/tool_config.yml
219
+ tool_libraries:
220
+ core:
221
+ path: ~/.aia/tools/core
222
+ security_level: safe
223
+
224
+ development:
225
+ path: ~/.aia/tools/development
226
+ security_level: safe
227
+
228
+ web:
229
+ path: ~/.aia/tools/web
230
+ security_level: network
231
+
232
+ system:
233
+ path: ~/.aia/tools/system
234
+ security_level: system
235
+ restricted: true
236
+ ```
237
+
238
+ ### Shared Tool Repositories
239
+ ```bash
240
+ # Clone shared tool repositories
241
+ git clone https://github.com/team/aia-tools.git ~/.aia/shared-tools
242
+
243
+ # Use shared tools
244
+ aia --tools ~/.aia/shared-tools/web/ api_analysis
245
+ ```
246
+
247
+ ## Performance Considerations
248
+
249
+ ### Tool Optimization
250
+ - Cache expensive operations
251
+ - Use appropriate data structures
252
+ - Implement timeouts for network operations
253
+ - Handle large data sets efficiently
254
+ - Profile and optimize slow operations
255
+
256
+ ### Memory Management
257
+ - Clean up temporary files
258
+ - Manage large object lifecycles
259
+ - Use streaming for large data processing
260
+ - Monitor memory usage in long-running operations
261
+
262
+ ## Troubleshooting
263
+
264
+ ### Common Issues
265
+ 1. **Tool Not Found** - Check file paths and permissions
266
+ 2. **Method Errors** - Verify method signatures and parameters
267
+ 3. **Permission Denied** - Check file and directory permissions
268
+ 4. **Network Timeouts** - Implement proper timeout handling
269
+ 5. **Memory Issues** - Optimize for large data processing
270
+
271
+ ### Debugging Tools
272
+ ```bash
273
+ # Debug tool loading
274
+ aia --debug --tools problem_tool.rb test_prompt
275
+
276
+ # Verbose tool execution
277
+ aia --verbose --tools analysis_tool.rb data_analysis
278
+
279
+ # Test tool isolation
280
+ ruby -r './my_tool.rb' -e "puts MyTool.new.test_method('input')"
281
+ ```
282
+
283
+ ## Related Documentation
284
+
285
+ - [Tools Integration Guide](../../guides/tools.md) - Detailed tool development guide
286
+ - [Advanced Prompting](../../advanced-prompting.md) - Complex tool integration
287
+ - [MCP Examples](../mcp/index.md) - Alternative integration approach
288
+ - [Configuration](../../configuration.md) - Tool configuration options
289
+
290
+ ---
291
+
292
+ Tools are the backbone of AIA's extensibility. Start with simple analysis tools and gradually build more sophisticated capabilities as your needs grow!
data/docs/faq.md ADDED
@@ -0,0 +1,414 @@
1
+ # Frequently Asked Questions
2
+
3
+ Common questions and answers about using AIA.
4
+
5
+ ## Installation and Setup
6
+
7
+ ### Q: What Ruby version is required for AIA?
8
+ **A:** AIA requires Ruby 3.0 or higher. You can check your Ruby version with `ruby --version`.
9
+
10
+ ### Q: How do I install AIA?
11
+ **A:** The easiest way is through RubyGems:
12
+ ```bash
13
+ gem install aia
14
+ ```
15
+
16
+ See the [Installation Guide](installation.md) for other installation methods.
17
+
18
+ ### Q: Where should I store my API keys?
19
+ **A:** Store API keys as environment variables in your shell profile (`.bashrc`, `.zshrc`, etc.):
20
+ ```bash
21
+ export OPENAI_API_KEY="your_key_here"
22
+ export ANTHROPIC_API_KEY="your_key_here"
23
+ ```
24
+
25
+ ### Q: Can I use AIA without internet access?
26
+ **A:** Yes, if you use local models through Ollama. Most AI models require internet access, but you can run models locally for offline use.
27
+
28
+ ## Basic Usage
29
+
30
+ ### Q: How do I create my first prompt?
31
+ **A:** Create a text file in your prompts directory:
32
+ ```bash
33
+ echo "Explain this code clearly:" > ~/.prompts/explain_code.txt
34
+ aia explain_code my_script.py
35
+ ```
36
+
37
+ ### Q: What's the difference between batch mode and chat mode?
38
+ **A:**
39
+ - **Batch mode** (default): Processes prompts once and exits
40
+ - **Chat mode** (`--chat`): Interactive conversation that maintains context
41
+
42
+ ### Q: How do I use fuzzy search for prompts?
43
+ **A:** Install `fzf` and use the `--fuzzy` flag:
44
+ ```bash
45
+ # Install fzf (macOS)
46
+ brew install fzf
47
+
48
+ # Use fuzzy search
49
+ aia --fuzzy
50
+ ```
51
+
52
+ ## Configuration
53
+
54
+ ### Q: Where is the configuration file located?
55
+ **A:** The main configuration file is at `~/.aia/config.yml`. You can create it if it doesn't exist.
56
+
57
+ ### Q: How do I change the default AI model?
58
+ **A:** Set it in your configuration file or use the command line:
59
+ ```bash
60
+ # In config file
61
+ model: gpt-4
62
+
63
+ # Command line
64
+ aia --model gpt-4 my_prompt
65
+ ```
66
+
67
+ ### Q: How do I set a custom prompts directory?
68
+ **A:** Use the `--prompts_dir` option or set it in configuration:
69
+ ```bash
70
+ # Command line
71
+ aia --prompts_dir /path/to/prompts my_prompt
72
+
73
+ # Environment variable
74
+ export AIA_PROMPTS_DIR="/path/to/prompts"
75
+ ```
76
+
77
+ ## Prompts and Directives
78
+
79
+ ### Q: What are directives and how do I use them?
80
+ **A:** Directives are special commands in prompts that start with `//`. Examples:
81
+ ```markdown
82
+ //config model gpt-4
83
+ //include my_file.txt
84
+ //shell ls -la
85
+ ```
86
+
87
+ See the [Directives Reference](directives-reference.md) for all available directives.
88
+
89
+ ### Q: How do I include files in prompts?
90
+ **A:** Use the `//include` directive:
91
+ ```markdown
92
+ //include README.md
93
+ //include /path/to/file.txt
94
+ ```
95
+
96
+ ### Q: Can I use Ruby code in prompts?
97
+ **A:** Yes, use the `//ruby` directive for one-liners:
98
+ ```markdown
99
+ //ruby puts "Hello, my name is#{ENV['USER']}"
100
+
101
+ # Or for multi-line or conditional code use ERB
102
+
103
+ <%=
104
+ puts "Hello, my name is #{ENV['USER']}"
105
+ puts "Today is #{Time.now.strftime('%Y-%m-%d')}"
106
+ %>
107
+ ```
108
+
109
+ ### Q: How do I create prompt workflows?
110
+ **A:** Use the `//pipeline` or `//next` directives:
111
+ ```markdown
112
+ //pipeline "step1,step2,step3"
113
+ //next next_prompt_id
114
+ ```
115
+
116
+ ## Models and Performance
117
+
118
+ ### Q: Which AI model should I use?
119
+ **A:** It depends on your needs:
120
+ - **GPT-3.5 Turbo**: Fast, cost-effective for simple tasks
121
+ - **GPT-4**: Best quality for complex reasoning
122
+ - **Claude-3 Sonnet**: Great for long documents and analysis
123
+ - **Claude-3 Haiku**: Fast and economical
124
+
125
+ ### Q: How do I use multiple models simultaneously?
126
+ **A:** Use comma-separated model names:
127
+ ```bash
128
+ aia --model "gpt-4,claude-3-sonnet" my_prompt
129
+ ```
130
+
131
+ ### Q: How do I reduce token usage and costs?
132
+ **A:**
133
+ - Use shorter prompts when possible
134
+ - Choose appropriate models (GPT-3.5 for simple tasks)
135
+ - Use temperature settings wisely
136
+ - Clear chat context regularly with `//clear`
137
+
138
+ ### Q: What's consensus mode?
139
+ **A:** Consensus mode combines responses from multiple models into a single, refined answer:
140
+ ```bash
141
+ aia --model "gpt-4,claude-3-sonnet" --consensus my_prompt
142
+ ```
143
+
144
+ ## Tools and Integration
145
+
146
+ ### Q: What are RubyLLM tools?
147
+ **A:** Tools are Ruby classes that extend AI capabilities with custom functions like file operations, web requests, or data analysis.
148
+
149
+ ### Q: How do I use tools with AIA?
150
+ **A:** Use the `--tools` option:
151
+ ```bash
152
+ aia --tools my_tool.rb my_prompt
153
+ aia --tools ./tools/ my_prompt
154
+ ```
155
+
156
+ ### Q: What's the difference between tools and MCP clients?
157
+ **A:**
158
+ - **Tools**: Ruby-based extensions that run in the same process
159
+ - **MCP clients**: External services using Model Context Protocol
160
+
161
+ ### Q: How do I create custom tools?
162
+ **A:** Create a Ruby class inheriting from `RubyLLM::Tool`:
163
+ ```ruby
164
+ class MyTool < RubyLLM::Tool
165
+ description "What this tool does"
166
+
167
+ def my_method(param)
168
+ # Implementation
169
+ "Result"
170
+ end
171
+ end
172
+ ```
173
+
174
+ ## Chat Mode
175
+
176
+ ### Q: How do I start a chat session?
177
+ **A:** Use the `--chat` flag:
178
+ ```bash
179
+ aia --chat
180
+ aia --chat --model gpt-4
181
+ ```
182
+
183
+ ### Q: How do I save chat conversations?
184
+ **A:** Use the `/save` command within chat:
185
+ ```
186
+ You: /save conversation.md
187
+ ```
188
+
189
+ ### Q: Can I use tools in chat mode?
190
+ **A:** Yes, enable tools when starting chat:
191
+ ```bash
192
+ aia --chat --tools ./tools/
193
+ ```
194
+
195
+ ### Q: How do I clear chat history?
196
+ **A:** Use the `/clear` command or `//clear` directive:
197
+ ```
198
+ You: /clear
199
+ ```
200
+
201
+ ## Troubleshooting
202
+
203
+ ### Q: "Command not found: aia"
204
+ **A:**
205
+ 1. Make sure Ruby's bin directory is in your PATH
206
+ 2. Try reinstalling: `gem uninstall aia && gem install aia`
207
+ 3. Check if using `--user-install`: `gem install aia --user-install`
208
+
209
+ ### Q: "No models available" error
210
+ **A:**
211
+ 1. Check your API keys are set correctly
212
+ 2. Verify internet connection
213
+ 3. Test with: `aia --available_models`
214
+
215
+ ### Q: "Permission denied" errors
216
+ **A:**
217
+ 1. Check file permissions: `ls -la ~/.prompts/`
218
+ 2. Ensure prompts directory is readable
219
+ 3. Check tool file permissions if using custom tools
220
+
221
+ ### Q: Prompts are slow or timing out
222
+ **A:**
223
+ 1. Try a faster model like `gpt-3.5-turbo`
224
+ 2. Reduce prompt length or complexity
225
+ 3. Check your internet connection
226
+ 4. Use `--debug` to see what's happening
227
+
228
+ ### Q: "Tool not found" errors
229
+ **A:**
230
+ 1. Verify tool file paths with `--tools`
231
+ 2. Check Ruby syntax in tool files
232
+ 3. Use `--debug` to see tool loading details
233
+ 4. Ensure tools inherit from `RubyLLM::Tool`
234
+
235
+ ## Advanced Usage
236
+
237
+ ### Q: How do I use AIA for code review?
238
+ **A:** Create a code review prompt:
239
+ ```markdown
240
+ //config model gpt-4
241
+ //config temperature 0.3
242
+
243
+ Review this code for bugs, security issues, and best practices:
244
+ //include <%= file %>
245
+ ```
246
+
247
+ ### Q: Can I use AIA for data analysis?
248
+ **A:** Yes, create data analysis tools and prompts:
249
+ ```bash
250
+ aia --tools data_analyzer.rb analyze_data dataset.csv
251
+ ```
252
+
253
+ ### Q: How do I integrate AIA into my development workflow?
254
+ **A:**
255
+ 1. Create project-specific prompts
256
+ 2. Use tools for code analysis
257
+ 3. Set up workflows with pipelines
258
+ 4. Use chat mode for interactive development
259
+
260
+ ### Q: How do I backup my prompts?
261
+ **A:** Use version control:
262
+ ```bash
263
+ cd ~/.prompts
264
+ git init
265
+ git add .
266
+ git commit -m "Initial prompt collection"
267
+ git remote add origin your-repo-url
268
+ git push -u origin main
269
+ ```
270
+
271
+ ## Getting Help
272
+
273
+ ### Q: Where can I find more examples?
274
+ **A:** Check the [Examples](examples/index.md) directory for real-world use cases and templates.
275
+
276
+ ### Q: How do I report bugs or request features?
277
+ **A:** Open an issue on GitHub: [https://github.com/MadBomber/aia/issues](https://github.com/MadBomber/aia/issues)
278
+
279
+ ### Q: Is there a community or forum?
280
+ **A:** Check the GitHub repository for discussions and community contributions.
281
+
282
+ ### Q: Where can I find the latest documentation?
283
+ **A:** The most up-to-date documentation is available in this docs site and the [GitHub repository](https://github.com/MadBomber/aia).
284
+
285
+ ## Tips and Best Practices
286
+
287
+ ### Q: What are some general best practices for prompts?
288
+ **A:**
289
+ 1. Be specific and clear in your instructions
290
+ 2. Provide necessary context and examples
291
+ 3. Use appropriate models for different tasks
292
+ 4. Organize prompts logically in directories
293
+ 5. Version control your prompt collection
294
+
295
+ ### Q: How do I optimize for performance?
296
+ **A:**
297
+ 1. Choose the right model for each task
298
+ 2. Use caching for expensive operations
299
+ 3. Batch similar requests when possible
300
+ 4. Monitor token usage and costs
301
+ 5. Use shorter prompts when sufficient
302
+
303
+ ### Q: Security considerations?
304
+ **A:**
305
+ 1. Don't commit API keys to version control
306
+ 2. Use environment variables for secrets
307
+ 3. Be cautious with shell commands in prompts
308
+ 4. Review tool permissions and access
309
+ 5. Use restricted tool access in shared environments
310
+
311
+ ## Troubleshooting
312
+
313
+ ### Q: "Prompt not found" error
314
+ **A:** This usually means AIA can't locate your prompt file:
315
+ ```bash
316
+ # Check prompts directory
317
+ ls $AIA_PROMPTS_DIR
318
+
319
+ # Verify prompt file exists
320
+ ls ~/.prompts/my_prompt.txt
321
+
322
+ # Use fuzzy search to find available prompts
323
+ aia --fuzzy
324
+ ```
325
+
326
+ ### Q: Model errors or "Model not available"
327
+ **A:** Check your model name and availability:
328
+ ```bash
329
+ # List available models
330
+ aia --available_models
331
+
332
+ # Check model name spelling
333
+ aia --model gpt-4o-mini # Correct
334
+ aia --model gpt4 # Incorrect
335
+ ```
336
+
337
+ ### Q: Shell integration not working
338
+ **A:** Verify your shell patterns and permissions:
339
+ ```bash
340
+ # Test shell patterns separately
341
+ echo "Test: $(date)" # Should show current date
342
+ echo "Home: $HOME" # Should show home directory
343
+
344
+ # Check if shell commands work in your environment
345
+ which date
346
+ which git
347
+ ```
348
+
349
+ ### Q: Configuration issues
350
+ **A:** Debug your configuration setup:
351
+ ```bash
352
+ # Check current configuration
353
+ aia --config
354
+
355
+ # Debug configuration loading
356
+ aia --debug --config
357
+
358
+ # Test with verbose output
359
+ aia --debug --verbose my_prompt
360
+ ```
361
+
362
+ ### Q: Performance issues with slow responses
363
+ **A:** Try these optimizations:
364
+ ```bash
365
+ # Use faster models
366
+ aia --model gpt-4o-mini my_prompt
367
+
368
+ # Reduce max tokens
369
+ aia --max_tokens 1000 my_prompt
370
+
371
+ # Lower temperature for faster responses
372
+ aia --temperature 0.1 my_prompt
373
+ ```
374
+
375
+ ### Q: Large prompt processing issues
376
+ **A:** Break down large prompts:
377
+ ```bash
378
+ # Use pipelines for multi-stage processing
379
+ aia --pipeline "analyze,summarize,report" large_data.csv
380
+
381
+ # Use selective file inclusion
382
+ //include specific_section.txt
383
+
384
+ # Check model context limits
385
+ aia --available_models | grep context
386
+ ```
387
+
388
+ ### Q: Debug mode - how to get more information?
389
+ **A:** Enable debug output for detailed troubleshooting:
390
+ ```bash
391
+ # Basic debug mode
392
+ aia --debug my_prompt
393
+
394
+ # Maximum debugging output
395
+ aia --debug --verbose my_prompt
396
+
397
+ # Check configuration in debug mode
398
+ aia --debug --config
399
+ ```
400
+
401
+ ### Q: Common error messages and solutions
402
+
403
+ | Error | Cause | Solution |
404
+ |-------|-------|----------|
405
+ | "Prompt not found" | Missing prompt file | Check file exists and spelling |
406
+ | "Model not available" | Invalid model name | Use `--available_models` to list valid models |
407
+ | "Shell command failed" | Invalid shell syntax | Test shell commands separately first |
408
+ | "Configuration error" | Invalid config syntax | Check config file YAML syntax |
409
+ | "API key missing" | No API key configured | Set environment variables for your models |
410
+ | "Permission denied" | File/directory permissions | Check file permissions and ownership |
411
+
412
+ ---
413
+
414
+ Don't see your question here? Check the [documentation](index.md) or [open an issue](https://github.com/MadBomber/aia/issues) on GitHub!