aia 1.0.0.pre.beta → 1.1.0

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/CHANGELOG.md +89 -0
  4. data/COMMITS.md +192 -11
  5. data/README.md +327 -110
  6. data/docs/cli-reference.md +93 -10
  7. data/docs/configuration.md +29 -36
  8. data/docs/contributing.md +2 -2
  9. data/docs/directives-reference.md +49 -27
  10. data/docs/examples/index.md +2 -2
  11. data/docs/examples/mcp/index.md +93 -97
  12. data/docs/examples/prompts/automation/index.md +3 -2
  13. data/docs/examples/tools/index.md +17 -27
  14. data/docs/faq.md +9 -12
  15. data/docs/guides/basic-usage.md +4 -4
  16. data/docs/guides/chat.md +39 -34
  17. data/docs/guides/tools.md +4 -4
  18. data/docs/index.md +36 -62
  19. data/docs/installation.md +1 -1
  20. data/docs/mcp-integration.md +75 -139
  21. data/docs/prompt_management.md +88 -1
  22. data/docs/security.md +79 -81
  23. data/docs/tools-and-mcp-examples.md +8 -6
  24. data/docs/workflows-and-pipelines.md +2 -6
  25. data/examples/.gitignore +1 -0
  26. data/examples/README.md +41 -0
  27. data/examples/run_all.sh +261 -0
  28. data/lib/aia/adapter/chat_execution.rb +9 -7
  29. data/lib/aia/adapter/mcp_connector.rb +0 -29
  30. data/lib/aia/adapter/modality_handlers.rb +23 -15
  31. data/lib/aia/adapter/tool_filter.rb +21 -0
  32. data/lib/aia/adapter/tool_loader.rb +1 -9
  33. data/lib/aia/chat_loop.rb +244 -0
  34. data/lib/aia/chat_processor_service.rb +6 -3
  35. data/lib/aia/config/cli_parser.rb +56 -18
  36. data/lib/aia/config/defaults.yml +17 -2
  37. data/lib/aia/config/validator.rb +52 -11
  38. data/lib/aia/config.rb +29 -3
  39. data/lib/aia/directive.rb +29 -0
  40. data/lib/aia/directives/configuration_directives.rb +2 -1
  41. data/lib/aia/directives/execution_directives.rb +1 -1
  42. data/lib/aia/directives/model_directives.rb +28 -27
  43. data/lib/aia/directives/web_and_file_directives.rb +78 -40
  44. data/lib/aia/errors.rb +20 -1
  45. data/lib/aia/fzf.rb +8 -7
  46. data/lib/aia/input_collector.rb +24 -0
  47. data/lib/aia/prompt_handler.rb +36 -8
  48. data/lib/aia/prompt_pipeline.rb +183 -0
  49. data/lib/aia/session.rb +22 -372
  50. data/lib/aia/skill_utils.rb +61 -0
  51. data/lib/aia/ui_presenter.rb +8 -0
  52. data/lib/aia.rb +4 -0
  53. metadata +19 -45
@@ -129,7 +129,7 @@ Tools that can modify files or system state:
129
129
 
130
130
  ### Example Tool Template
131
131
  ```ruby
132
- # ~/.aia/tools/example_tool.rb
132
+ # ~/.config/aia/tools/example_tool.rb
133
133
  require 'json'
134
134
 
135
135
  class ExampleTool < RubyLLM::Tool
@@ -205,43 +205,33 @@ end
205
205
  ### Local Tool Directory
206
206
  ```bash
207
207
  # Create tool directory structure
208
- mkdir -p ~/.aia/tools/{core,development,analysis,web,system}
208
+ mkdir -p ~/.config/aia/tools/{core,development,analysis,web,system}
209
209
 
210
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/
211
+ cp file_analyzer.rb ~/.config/aia/tools/core/
212
+ cp code_quality.rb ~/.config/aia/tools/development/
213
+ cp data_analyzer.rb ~/.config/aia/tools/analysis/
214
214
  ```
215
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
216
+ ### Loading Tools by Directory
217
+ ```bash
218
+ # Load all tools from a directory
219
+ aia --tools ~/.config/aia/tools/core/ my_prompt
220
+
221
+ # Load tools from multiple directories
222
+ aia --tools ~/.config/aia/tools/core/ --tools ~/.config/aia/tools/development/ my_prompt
223
+
224
+ # Filter to specific tools
225
+ aia --tools ~/.config/aia/tools/ --allowed-tools FileAnalyzer,CodeQuality my_prompt
236
226
  ```
237
227
 
238
228
  ### Shared Tool Repositories
239
229
  ```bash
240
230
  # Clone shared tool repositories
241
- git clone https://github.com/team/aia-tools.git ~/.aia/shared-tools
231
+ git clone https://github.com/team/aia-tools.git ~/.config/aia/shared-tools
242
232
 
243
233
  # Use shared tools
244
- aia --tools ~/.aia/shared-tools/web/ api_analysis
234
+ aia --tools ~/.config/aia/shared-tools/web/ api_analysis
245
235
  ```
246
236
 
247
237
  ## Performance Considerations
data/docs/faq.md CHANGED
@@ -5,7 +5,7 @@ Common questions and answers about using AIA.
5
5
  ## Installation and Setup
6
6
 
7
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`.
8
+ **A:** AIA requires Ruby 3.2 or higher. You can check your Ruby version with `ruby --version`.
9
9
 
10
10
  ### Q: How do I install AIA?
11
11
  **A:** The easiest way is through RubyGems:
@@ -266,9 +266,9 @@ aia --chat --model gpt-4
266
266
  ```
267
267
 
268
268
  ### Q: How do I save chat conversations?
269
- **A:** Use the `/save` command within chat:
270
- ```
271
- You: /save conversation.md
269
+ **A:** Use the `--output` flag to save responses to a file:
270
+ ```bash
271
+ aia --chat --output conversation.md
272
272
  ```
273
273
 
274
274
  ### Q: Can I use tools in chat mode?
@@ -434,13 +434,10 @@ which git
434
434
  ### Q: Configuration issues
435
435
  **A:** Debug your configuration setup:
436
436
  ```bash
437
- # Check current configuration
438
- aia --config
439
-
440
- # Debug configuration loading
441
- aia --debug --config
437
+ # Dump current configuration to a file for inspection
438
+ aia --dump config_snapshot.yml
442
439
 
443
- # Test with verbose output
440
+ # Test with verbose and debug output
444
441
  aia --debug --verbose my_prompt
445
442
  ```
446
443
 
@@ -479,8 +476,8 @@ aia --debug my_prompt
479
476
  # Maximum debugging output
480
477
  aia --debug --verbose my_prompt
481
478
 
482
- # Check configuration in debug mode
483
- aia --debug --config
479
+ # Dump configuration for inspection
480
+ aia --dump config_snapshot.yml
484
481
  ```
485
482
 
486
483
  ### Q: Common error messages and solutions
@@ -93,13 +93,13 @@ aia write_content --outline outline.md --style "technical" --examples "include"
93
93
  Set up different configurations for different environments:
94
94
 
95
95
  ```yaml
96
- # ~/.aia/dev_config.yml
96
+ # ~/.config/aia/dev_config.yml
97
97
  model: gpt-3.5-turbo
98
98
  temperature: 0.7
99
99
  verbose: true
100
100
  debug: true
101
101
 
102
- # ~/.aia/prod_config.yml
102
+ # ~/.config/aia/prod_config.yml
103
103
  model: gpt-4
104
104
  temperature: 0.3
105
105
  verbose: false
@@ -108,8 +108,8 @@ debug: false
108
108
 
109
109
  ```bash
110
110
  # Use environment-specific configs
111
- aia --config-file ~/.aia/dev_config.yml development_task
112
- aia --config-file ~/.aia/prod_config.yml production_analysis
111
+ aia --config-file ~/.config/aia/dev_config.yml development_task
112
+ aia --config-file ~/.config/aia/prod_config.yml production_analysis
113
113
  ```
114
114
 
115
115
  ### Task-Specific Model Selection
data/docs/guides/chat.md CHANGED
@@ -72,6 +72,8 @@ Files in the current directory are:
72
72
  which files are over 1 week old?
73
73
  ```
74
74
 
75
+ > **Security Warning**: The `/ruby` and `/shell` directives execute code directly on your machine with your user permissions. `/ruby` runs arbitrary Ruby via `eval()` and `/shell` invokes system commands. Only use these directives with trusted prompts. Never run prompts from untrusted sources that contain these directives without reviewing them first.
76
+
75
77
  ## Advanced Chat Features
76
78
 
77
79
  ### Multi-Model Conversations
@@ -461,45 +463,46 @@ AI: Here are comprehensive unit tests...
461
463
  ## Customization and Configuration
462
464
 
463
465
  ### Chat-Specific Configuration
466
+
467
+ Chat mode uses the same configuration as regular AIA usage. Relevant settings in `~/.config/aia/aia.yml`:
468
+
464
469
  ```yaml
465
- # ~/.aia/chat_config.yml
466
- chat:
467
- default_model: gpt-4
468
- save_conversations: true
469
- conversation_dir: ~/aia_conversations
470
- auto_save_interval: 300 # seconds
471
- max_context_length: 16000
472
- show_token_count: true
473
-
474
- speech:
475
- enabled: false
470
+ # Model selection
471
+ models:
472
+ - name: gpt-4o
473
+
474
+ # LLM parameters
475
+ llm:
476
+ temperature: 0.7
477
+ max_tokens: 2048
478
+
479
+ # Audio for /say directive
480
+ audio:
476
481
  voice: alloy
477
- auto_play: true
482
+ speak_command: afplay
483
+ ```
478
484
 
479
- tools:
480
- auto_discover: true
481
- default_paths: [~/.aia/tools, ./tools]
482
- security_mode: safe
485
+ Start chat with specific options via CLI:
486
+
487
+ ```bash
488
+ aia --chat --model gpt-4o --tools ./tools/ my_system_prompt
489
+ aia --chat --output conversation.md my_prompt # Save output
483
490
  ```
484
491
 
485
- ### Custom Chat Commands
486
- You can define custom chat commands by creating tool functions:
492
+ ### Using Tools in Chat
487
493
 
488
- ```ruby
489
- # ~/.aia/tools/chat_commands.rb
490
- class ChatCommands < RubyLLM::Tool
491
- def summarize_conversation
492
- # Custom command to summarize the current conversation
493
- "<%= AIA.chat.context.summarize %>"
494
- end
494
+ Load custom RubyLLM tools into chat sessions:
495
495
 
496
- def export_code_snippets
497
- # Extract and export all code snippets from conversation
498
- "<%= AIA.chat.extract_code_blocks %>"
499
- end
500
- end
496
+ ```bash
497
+ # Load tools into a chat session
498
+ aia --chat --tools ./tools/file_analyzer.rb my_prompt
499
+
500
+ # Load tools from a directory
501
+ aia --chat --tools ./tools/ my_prompt
501
502
  ```
502
503
 
504
+ The AI model can call these tools during the conversation when relevant. See [Tools Guide](tools.md) for details on creating tools.
505
+
503
506
  ## Token Usage and Cost Tracking
504
507
 
505
508
  ### Displaying Token Usage
@@ -599,10 +602,12 @@ aia --chat --model gpt-3.5-turbo
599
602
  5. **Save Progress**: Regular saves prevent loss of valuable insights
600
603
 
601
604
  ### Security Considerations
602
- 1. **Sensitive Data**: Avoid sharing confidential information
603
- 2. **Tool Access**: Restrict tool permissions appropriately
604
- 3. **Session Management**: Clear sensitive conversations
605
- 4. **API Keys**: Keep credentials secure
605
+ 1. **Code Execution Directives**: `/ruby` executes arbitrary Ruby code and `/shell` runs system commands with your user permissions. Only use trusted prompts containing these directives
606
+ 2. **Sensitive Data**: Avoid sharing confidential information in prompts or chat
607
+ 3. **Tool Access**: Restrict tool permissions with `--allowed-tools` and `--rejected-tools`
608
+ 4. **MCP Servers**: Control which MCP servers can run with `--mcp-use` and `--mcp-skip`
609
+ 5. **Session Management**: Clear sensitive conversations with `/clear`
610
+ 6. **API Keys**: Keep credentials secure; never embed them in prompt files
606
611
 
607
612
  ### Productivity Tips
608
613
  1. **Keyboard Shortcuts**: Learn and use available shortcuts
data/docs/guides/tools.md CHANGED
@@ -69,7 +69,7 @@ aia --tools ./tools/ tool_discovery_prompt
69
69
 
70
70
  ### Basic Tool Structure
71
71
  ```ruby
72
- # ~/.aia/tools/file_analyzer.rb
72
+ # ~/.config/aia/tools/file_analyzer.rb
73
73
  class FileAnalyzer < RubyLLM::Tool
74
74
  description "Analyzes files for structure, content, and metadata"
75
75
 
@@ -167,7 +167,7 @@ end
167
167
 
168
168
  ### Web Integration Tool
169
169
  ```ruby
170
- # ~/.aia/tools/web_client.rb
170
+ # ~/.config/aia/tools/web_client.rb
171
171
  require 'net/http'
172
172
  require 'json'
173
173
  require 'uri'
@@ -257,7 +257,7 @@ end
257
257
 
258
258
  ### Data Analysis Tool
259
259
  ```ruby
260
- # ~/.aia/tools/data_analyzer.rb
260
+ # ~/.config/aia/tools/data_analyzer.rb
261
261
  require 'csv'
262
262
  require 'json'
263
263
 
@@ -680,7 +680,7 @@ end
680
680
  ### Tool Libraries
681
681
  ```bash
682
682
  # Organize tools in libraries
683
- ~/.aia/tools/
683
+ ~/.config/aia/tools/
684
684
  ├── core/ # Essential tools
685
685
  │ ├── file_ops.rb
686
686
  │ ├── web_client.rb
data/docs/index.md CHANGED
@@ -23,80 +23,48 @@ Welcome to AIA, your powerful CLI tool for dynamic prompt management and AI inte
23
23
 
24
24
  ---
25
25
 
26
- !!! danger "Breaking Changes in v1.0.0 (from v0.11.2)"
26
+ !!! tip "🚀 New: AI Assistant Scheduler (AIAS)"
27
27
 
28
- **Version 1.0.0 is a major release with breaking changes. Read this section before upgrading.**
28
+ **Schedule and automate your AIA prompts!** AIAS is a new Ruby gem that lets you run AIA prompts on a cron-like schedule — perfect for recurring AI tasks, automated reports, and timed workflows.
29
29
 
30
- !!! failure "Prompt File Format (Critical)"
30
+ **[View AIAS on GitHub →](https://github.com/madbomber/aias)**
31
31
 
32
- The prompt file format has changed completely. You **must** migrate your prompts.
33
-
34
- - **File extension** — `.txt` is now `.md`
35
- - **Parameters** — `[PLACEHOLDER]` is now `<%= placeholder %>`
36
- - **Metadata** — Separate `.json` history files are now YAML front matter inside the `.md` file
37
- - **Directive embedding** — `//config`, `//pipeline`, etc. are now YAML front matter keys
38
-
39
- **Before (v0.11.2):**
40
-
41
- # ~/.prompts/my_prompt.txt
42
- //config temperature 0.7
43
- //pipeline next_prompt, another_prompt
44
- Tell me about [TOPIC] in [LANGUAGE]
45
-
46
- **After (v1.0.0):**
47
-
48
- ---
49
- temperature: 0.7
50
- pipeline: [next_prompt, another_prompt]
51
- parameters:
52
- topic: null
53
- language: null
54
- ---
55
- Tell me about <%= topic %> in <%= language %>
56
-
57
- **Run the migration tool:**
58
-
59
- # Back up first (recommended)
60
- cp -r ~/.prompts ~/.prompts.backup
61
-
62
- # Migrate all prompts
63
- migrate_prompts --verbose ~/.prompts
64
-
65
- # Review flagged files (*.txt-review), then recover them
66
- migrate_prompts --reprocess ~/.prompts
67
-
68
- The `migrate_prompts` script is a standalone program in `bin/`. It handles placeholder conversion, directive migration, history file merging, and flags files with code fences for manual review. See [Migration Guide](guides/migrate-prompts.md) for details.
32
+ ---
69
33
 
70
- !!! warning "Removed and Deprecated CLI Options"
34
+ !!! tip "🎭 Roles: Give Your Robot a Personality"
71
35
 
72
- - **`--adapter` removed** AIA now exclusively uses `ruby_llm`. Remove `--adapter` from any scripts or aliases.
73
- - **`--regex` deprecated** — Parameter extraction uses ERB (`<%= param %>`) instead of regex. The flag prints a warning and has no effect.
74
- - **`--terse` deprecated** — No longer supported. The flag prints a warning and has no effect.
75
- - **`--metrics` renamed to `--tokens`** — Use `--tokens` to display token usage. `--cost` implies `--tokens`.
36
+ Roles are plain-text prompt files that define how your AI thinks, talks, and interacts with you. Drop one in `~/.prompts/roles/` and your robot instantly becomes someone new.
76
37
 
77
- !!! warning "Dependency: prompt_manager v0.5 to v1.0"
38
+ **For fun:**
39
+ ```bash
40
+ aia --chat --role pirate # Arrr, matey!
41
+ aia --chat --role nyc_cabbie # opinions about EVERYTHING
42
+ aia --chat --role stoned_hacker # solves it anyway, dude
43
+ ```
78
44
 
79
- The `prompt_manager` gem has been upgraded from `~> 0.5.8` to `~> 1.0`. This is the root cause of the prompt file format changes above. The new version uses ERB for parameter interpolation and YAML front matter for metadata. All prompt files must be in the new format.
45
+ **For serious work:**
46
+ ```bash
47
+ # Explains quantum physics to your 7-year-old
48
+ aia --chat --role first_grade_teacher
80
49
 
81
- !!! info "Environment Variables (from v0.10.0)"
50
+ # Three expert robots on the same design doc, simultaneously
51
+ aia --model gpt-4o=architect,claude=security,gemini=performance design.md
52
+ ```
82
53
 
83
- If upgrading from v0.9.x, environment variable names changed in v0.10.0 to use double underscore (`__`) for nested config sections:
54
+ Assign a different role to each model and get multiple expert perspectives in one command. **[Full Roles Guide →](guides/models.md)**
84
55
 
85
- | Old (v0.9.x) | New (v1.0.0) |
86
- |---|---|
87
- | `AIA_PROMPTS_DIR` | `AIA_PROMPTS__DIR` |
88
- | `AIA_OUT_FILE` | `AIA_OUTPUT__FILE` |
89
- | `AIA_VERBOSE` | `AIA_FLAGS__VERBOSE` |
90
- | `AIA_DEBUG` | `AIA_FLAGS__DEBUG` |
91
- | `AIA_CHAT` | `AIA_FLAGS__CHAT` |
92
- | `AIA_TEMPERATURE` | `AIA_LLM__TEMPERATURE` |
93
- | `AIA_MARKDOWN` | `AIA_OUTPUT__MARKDOWN` |
56
+ !!! tip "🎓 Skills: Teach Your Robot Your Process"
94
57
 
95
- `AIA_MODEL` is unchanged. See [Environment Variables](configuration.md#environment-variables) for the complete list.
58
+ Skills are structured instruction sets that tell your robot *exactly how* to approach a task — your workflow, your standards, every single time. Each skill is a directory with a `SKILL.md` file in `~/.prompts/skills/`.
96
59
 
97
- !!! info "Configuration Files (from v0.10.0)"
60
+ ```bash
61
+ aia -s code-quality my_prompt # one skill
62
+ aia -s code-quality,security-review my_prompt # stack them
63
+ aia --chat --role senior_dev -s code-quality # role + skill
64
+ /skill code-quality # add mid-chat
65
+ ```
98
66
 
99
- If upgrading from v0.9.x, configuration files now use a nested YAML structure with sections (`llm:`, `prompts:`, `output:`, `flags:`, etc.) and follow the XDG Base Directory Specification (`~/.config/aia/aia.yml`). See [Configuration Guide](configuration.md) for details.
67
+ Combine roles and skills: a pirate who follows your code review process, a first-grade teacher who uses your step-by-step explanation method, or multiple robots each with their own role and skill set all from the command line. **[Full Skills Guide](directives-reference.md)**
100
68
 
101
69
  ---
102
70
 
@@ -105,9 +73,15 @@ Welcome to AIA, your powerful CLI tool for dynamic prompt management and AI inte
105
73
  ### 🚀 Dynamic Prompt Management
106
74
  - **Hierarchical Configuration**: Embedded directives > CLI args > environment variables > config files > defaults
107
75
  - **Prompt Sequences and Workflows**: Chain prompts together for complex AI workflows
108
- - **Role-based Prompts**: Use predefined roles to context your AI interactions
109
76
  - **Fuzzy Search**: Find prompts quickly with fuzzy matching (requires `fzf`)
110
77
 
78
+ ### 🎭 Roles & 🎓 Skills
79
+ - **Robot Personalities**: Give any robot a voice — fun personas like a pirate or NYC cabbie, or professional ones like a senior architect or first-grade teacher
80
+ - **Per-Model Roles**: Assign a different role to each model in a multi-model session — `--model gpt-4o=architect,claude=security`
81
+ - **Reusable Skill Sets**: Encode your exact workflow once in a `SKILL.md` file; apply it to any prompt with `-s skill-name`
82
+ - **Role + Skill Combos**: A robot can be *who you want* (role) and *know exactly what to do* (skill) simultaneously
83
+ - **Mid-Chat Skills**: Add a skill to a running chat session with `/skill skill-name`
84
+
111
85
  ### 🔧 Powerful Integration
112
86
  - **Shell Integration**: Execute shell commands directly within prompts
113
87
  - **Ruby (ERB) Processing**: Use Ruby code in your prompts for dynamic content
data/docs/installation.md CHANGED
@@ -5,7 +5,7 @@ This guide will help you install AIA and get it running on your system.
5
5
  ## Prerequisites
6
6
 
7
7
  ### Required
8
- - **Ruby**: Version 3.0 or higher
8
+ - **Ruby**: Version 3.2 or higher
9
9
  - **RubyGems**: Usually comes with Ruby
10
10
 
11
11
  ### Recommended