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.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +89 -0
- data/COMMITS.md +192 -11
- data/README.md +327 -110
- data/docs/cli-reference.md +93 -10
- data/docs/configuration.md +29 -36
- data/docs/contributing.md +2 -2
- data/docs/directives-reference.md +49 -27
- data/docs/examples/index.md +2 -2
- data/docs/examples/mcp/index.md +93 -97
- data/docs/examples/prompts/automation/index.md +3 -2
- data/docs/examples/tools/index.md +17 -27
- data/docs/faq.md +9 -12
- data/docs/guides/basic-usage.md +4 -4
- data/docs/guides/chat.md +39 -34
- data/docs/guides/tools.md +4 -4
- data/docs/index.md +36 -62
- data/docs/installation.md +1 -1
- data/docs/mcp-integration.md +75 -139
- data/docs/prompt_management.md +88 -1
- data/docs/security.md +79 -81
- data/docs/tools-and-mcp-examples.md +8 -6
- data/docs/workflows-and-pipelines.md +2 -6
- data/examples/.gitignore +1 -0
- data/examples/README.md +41 -0
- data/examples/run_all.sh +261 -0
- data/lib/aia/adapter/chat_execution.rb +9 -7
- data/lib/aia/adapter/mcp_connector.rb +0 -29
- data/lib/aia/adapter/modality_handlers.rb +23 -15
- data/lib/aia/adapter/tool_filter.rb +21 -0
- data/lib/aia/adapter/tool_loader.rb +1 -9
- data/lib/aia/chat_loop.rb +244 -0
- data/lib/aia/chat_processor_service.rb +6 -3
- data/lib/aia/config/cli_parser.rb +56 -18
- data/lib/aia/config/defaults.yml +17 -2
- data/lib/aia/config/validator.rb +52 -11
- data/lib/aia/config.rb +29 -3
- data/lib/aia/directive.rb +29 -0
- data/lib/aia/directives/configuration_directives.rb +2 -1
- data/lib/aia/directives/execution_directives.rb +1 -1
- data/lib/aia/directives/model_directives.rb +28 -27
- data/lib/aia/directives/web_and_file_directives.rb +78 -40
- data/lib/aia/errors.rb +20 -1
- data/lib/aia/fzf.rb +8 -7
- data/lib/aia/input_collector.rb +24 -0
- data/lib/aia/prompt_handler.rb +36 -8
- data/lib/aia/prompt_pipeline.rb +183 -0
- data/lib/aia/session.rb +22 -372
- data/lib/aia/skill_utils.rb +61 -0
- data/lib/aia/ui_presenter.rb +8 -0
- data/lib/aia.rb +4 -0
- metadata +19 -45
data/docs/cli-reference.md
CHANGED
|
@@ -236,6 +236,90 @@ aia --model "gpt-4,claude-3-sonnet" --consensus my_prompt
|
|
|
236
236
|
aia --model "gpt-4,claude-3-sonnet" --no-consensus my_prompt
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
+
### `-s, --skill SKILL_IDS`
|
|
240
|
+
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
|
+
|
|
242
|
+
Skills are inserted **after the role and before the user prompt**, providing task-level instructions for how the LLM should approach the request:
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
Role content (who the LLM is)
|
|
246
|
+
Skill content (how to approach the task)
|
|
247
|
+
User prompt (what to do)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Only the body of each `SKILL.md` is injected — the YAML front matter is stripped.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Single skill (ID-based — resolved from skills directory)
|
|
254
|
+
aia --skill code-review my_prompt
|
|
255
|
+
aia -s summarizer my_prompt
|
|
256
|
+
|
|
257
|
+
# Path-based skill (relative, home-relative, or absolute path to a skill directory)
|
|
258
|
+
aia --skill ./local-skills/code-review my_prompt
|
|
259
|
+
aia --skill /shared/team-skills/security-audit my_prompt
|
|
260
|
+
aia --skill ~/my-skills/custom-skill my_prompt
|
|
261
|
+
|
|
262
|
+
# Combine with a role: role sets persona, skill sets method
|
|
263
|
+
aia --role ruby_expert --skill code-review review_prompt my_code.rb
|
|
264
|
+
|
|
265
|
+
# Multiple skills applied in order (comma-separated)
|
|
266
|
+
aia --skill "code-review,security-audit" my_prompt
|
|
267
|
+
|
|
268
|
+
# Repeatable form
|
|
269
|
+
aia -s code-review -s security-audit my_prompt
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Path resolution**: If a skill ID starts with `/`, `~/`, `./`, or `../`, it is treated as a filesystem path to a skill directory (which must contain `SKILL.md`). Otherwise it is looked up by ID in the skills directory.
|
|
273
|
+
|
|
274
|
+
**See also**: `--list-skills` to discover available skills, `/skill` chat directive, `--role` for personality
|
|
275
|
+
|
|
276
|
+
### `--list-skills`
|
|
277
|
+
List all available skills and exit. Skills are subdirectories under the skills directory, each containing a `SKILL.md` file with YAML front matter.
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
aia --list-skills
|
|
281
|
+
|
|
282
|
+
# With a custom skills directory
|
|
283
|
+
aia --skills-dir ~/work/skills --list-skills
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Example output**:
|
|
287
|
+
```markdown
|
|
288
|
+
## code-quality
|
|
289
|
+
|
|
290
|
+
| Key | Value |
|
|
291
|
+
|-----|-------|
|
|
292
|
+
| name | code-quality |
|
|
293
|
+
| description | Improve code quality through analysis and refactoring. |
|
|
294
|
+
| user-invocable | true |
|
|
295
|
+
|
|
296
|
+
## summarizer
|
|
297
|
+
|
|
298
|
+
| Key | Value |
|
|
299
|
+
|-----|-------|
|
|
300
|
+
| name | summarizer |
|
|
301
|
+
| description | Summarize documents and conversations concisely. |
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Each skill is shown as a `## skill-name` heading followed by a table of all front matter fields from its `SKILL.md`.
|
|
305
|
+
|
|
306
|
+
### `--skills-dir DIR`
|
|
307
|
+
Directory containing skill subdirectories (default: `~/.prompts/skills`). Each subdirectory must contain a `SKILL.md` file to be recognized as a skill.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
aia --skills-dir ~/work/skills --list-skills
|
|
311
|
+
aia --skills-dir /shared/team-skills -s code-review my_prompt
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Environment variable**: `AIA_SKILLS__DIR`
|
|
315
|
+
|
|
316
|
+
### `--skills-prefix PREFIX`
|
|
317
|
+
Subdirectory name within `--prompts-dir` used as the skills prefix (default: `skills`). Affects `AIA.config.prompts.skills_prefix`.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
aia --skills-prefix team-skills --list-skills
|
|
321
|
+
```
|
|
322
|
+
|
|
239
323
|
### `--sm, --speech-model MODEL`
|
|
240
324
|
Speech model to use for text-to-speech functionality.
|
|
241
325
|
|
|
@@ -259,7 +343,7 @@ Load configuration from a specific file.
|
|
|
259
343
|
|
|
260
344
|
```bash
|
|
261
345
|
aia --config-file /path/to/config.yml my_prompt
|
|
262
|
-
aia -c ~/.aia/custom_config.yml my_prompt
|
|
346
|
+
aia -c ~/.config/aia/custom_config.yml my_prompt
|
|
263
347
|
```
|
|
264
348
|
|
|
265
349
|
### `-o, --[no-]output [FILE]`
|
|
@@ -341,10 +425,15 @@ Role ID to prepend to the prompt. This applies the same role to all models.
|
|
|
341
425
|
For per-model role assignment, use the inline `MODEL=ROLE` syntax with `--model` instead.
|
|
342
426
|
|
|
343
427
|
```bash
|
|
344
|
-
# Apply role
|
|
428
|
+
# Apply role by ID (resolved from roles directory)
|
|
345
429
|
aia --role expert my_prompt
|
|
346
430
|
aia -r teacher explain_concept
|
|
347
431
|
|
|
432
|
+
# Path-based role (relative or absolute path to a .md file)
|
|
433
|
+
aia --role ./local-roles/domain-expert my_prompt
|
|
434
|
+
aia --role /shared/roles/security-auditor review.md
|
|
435
|
+
aia --role ~/my-roles/custom-persona my_prompt
|
|
436
|
+
|
|
348
437
|
# With multiple models (same role for all)
|
|
349
438
|
aia --model "gpt-4,claude" --role architect design.md
|
|
350
439
|
|
|
@@ -352,6 +441,8 @@ aia --model "gpt-4,claude" --role architect design.md
|
|
|
352
441
|
aia --model "gpt-4=architect,claude=security" design.md
|
|
353
442
|
```
|
|
354
443
|
|
|
444
|
+
**Path resolution**: If `ROLE_ID` starts with `/`, `~/`, `./`, or `../`, it is treated as a filesystem path to a role `.md` file. The `.md` extension is added automatically when the path has no file extension. Otherwise the ID is resolved relative to the roles directory.
|
|
445
|
+
|
|
355
446
|
**See also**: `--model` for inline role syntax, `--list-roles` for discovering available roles.
|
|
356
447
|
|
|
357
448
|
### `--list-roles`
|
|
@@ -821,14 +912,6 @@ aia --output analysis.md --markdown --append data_analysis dataset.csv
|
|
|
821
912
|
aia --transcription-model whisper-1 --speech-model tts-1-hd --voice echo audio_prompt audio_file.wav
|
|
822
913
|
```
|
|
823
914
|
|
|
824
|
-
## Exit Codes
|
|
825
|
-
|
|
826
|
-
- `0` - Success
|
|
827
|
-
- `1` - General error (invalid arguments, file not found, etc.)
|
|
828
|
-
- `2` - Configuration error
|
|
829
|
-
- `3` - Model/API error
|
|
830
|
-
- `4` - Tool execution error
|
|
831
|
-
|
|
832
915
|
## Environment Variables
|
|
833
916
|
|
|
834
917
|
Many CLI options have corresponding environment variables with the `AIA_` prefix.
|
data/docs/configuration.md
CHANGED
|
@@ -53,9 +53,27 @@ prompts:
|
|
|
53
53
|
roles_prefix: roles # Subdirectory name for role files
|
|
54
54
|
roles_dir: ~/.prompts/roles # Full path to roles directory
|
|
55
55
|
role: ~ # Default role
|
|
56
|
+
skills: [] # Skill IDs to prepend to prompt (set by --skill/-s)
|
|
57
|
+
skills_prefix: skills # Subdirectory name for skill directories
|
|
56
58
|
system_prompt: ~ # Default system prompt
|
|
57
59
|
parameter_regex: ~ # Regex for parameter extraction
|
|
58
60
|
|
|
61
|
+
# Roles Configuration
|
|
62
|
+
# Access: AIA.config.roles.dir
|
|
63
|
+
# Env: AIA_ROLES__DIR
|
|
64
|
+
roles:
|
|
65
|
+
dir: ~/.prompts/roles # Full path to roles directory
|
|
66
|
+
|
|
67
|
+
# Skills Configuration
|
|
68
|
+
# Access: AIA.config.skills.dir
|
|
69
|
+
# Env: AIA_SKILLS__DIR
|
|
70
|
+
#
|
|
71
|
+
# Skills are subdirectories under skills.dir, each containing a SKILL.md
|
|
72
|
+
# file with YAML front matter (name, description, and any custom fields).
|
|
73
|
+
# Use --skill/-s to prepend skills to prompts, --list-skills to browse.
|
|
74
|
+
skills:
|
|
75
|
+
dir: ~/.prompts/skills # Directory containing skill subdirectories
|
|
76
|
+
|
|
59
77
|
# Output Configuration
|
|
60
78
|
# Access: AIA.config.output.file, AIA.config.output.append, etc.
|
|
61
79
|
# Env: AIA_OUTPUT__FILE, AIA_OUTPUT__APPEND, etc.
|
|
@@ -167,25 +185,6 @@ paths:
|
|
|
167
185
|
context_files: []
|
|
168
186
|
```
|
|
169
187
|
|
|
170
|
-
### Model-Specific Configuration
|
|
171
|
-
|
|
172
|
-
You can create model-specific configuration files:
|
|
173
|
-
|
|
174
|
-
```yaml
|
|
175
|
-
# ~/.config/aia/models/gpt-4.yml
|
|
176
|
-
llm:
|
|
177
|
-
temperature: 0.3
|
|
178
|
-
max_tokens: 4000
|
|
179
|
-
top_p: 0.95
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
```yaml
|
|
183
|
-
# ~/.config/aia/models/claude-3.yml
|
|
184
|
-
llm:
|
|
185
|
-
temperature: 0.5
|
|
186
|
-
max_tokens: 8000
|
|
187
|
-
```
|
|
188
|
-
|
|
189
188
|
## Environment Variables
|
|
190
189
|
|
|
191
190
|
All configuration options can be set via environment variables with the `AIA_` prefix.
|
|
@@ -210,9 +209,13 @@ export AIA_PROMPTS__EXTNAME=".md"
|
|
|
210
209
|
export AIA_PROMPTS__ROLES_PREFIX="roles"
|
|
211
210
|
export AIA_PROMPTS__ROLES_DIR="~/.prompts/roles"
|
|
212
211
|
export AIA_PROMPTS__ROLE="expert"
|
|
212
|
+
export AIA_PROMPTS__SKILLS_PREFIX="skills"
|
|
213
213
|
export AIA_PROMPTS__SYSTEM_PROMPT="my_system_prompt"
|
|
214
214
|
export AIA_PROMPTS__PARAMETER_REGEX='\{\{(\w+)\}\}'
|
|
215
215
|
|
|
216
|
+
# Skills settings (nested under skills:)
|
|
217
|
+
export AIA_SKILLS__DIR="~/.prompts/skills"
|
|
218
|
+
|
|
216
219
|
# Output settings (nested under output:)
|
|
217
220
|
export AIA_OUTPUT__FILE="/tmp/aia_output.md"
|
|
218
221
|
export AIA_OUTPUT__APPEND="false"
|
|
@@ -255,7 +258,7 @@ export AIA_FLAGS__CLEAR="false"
|
|
|
255
258
|
export AIA_FLAGS__CONSENSUS="false"
|
|
256
259
|
|
|
257
260
|
# Logger settings (nested under logger:)
|
|
258
|
-
export AIA_LOGGER__AIA__FILE="~/.aia/aia.log"
|
|
261
|
+
export AIA_LOGGER__AIA__FILE="~/.config/aia/aia.log"
|
|
259
262
|
export AIA_LOGGER__AIA__LEVEL="debug"
|
|
260
263
|
export AIA_LOGGER__AIA__FLUSH="true"
|
|
261
264
|
export AIA_LOGGER__LLM__FILE="STDOUT"
|
|
@@ -312,7 +315,7 @@ Each logger can be configured independently in your `~/.config/aia/aia.yml`:
|
|
|
312
315
|
```yaml
|
|
313
316
|
logger:
|
|
314
317
|
aia:
|
|
315
|
-
file: STDOUT # STDOUT, STDERR, or a file path (e.g., ~/.aia/aia.log)
|
|
318
|
+
file: STDOUT # STDOUT, STDERR, or a file path (e.g., ~/.config/aia/aia.log)
|
|
316
319
|
level: warn # debug, info, warn, error, fatal
|
|
317
320
|
flush: true # true = immediate write, false = buffered
|
|
318
321
|
llm:
|
|
@@ -354,7 +357,7 @@ Logger settings can also be configured via environment variables:
|
|
|
354
357
|
|
|
355
358
|
```bash
|
|
356
359
|
# AIA logger settings
|
|
357
|
-
export AIA_LOGGER__AIA__FILE="~/.aia/aia.log"
|
|
360
|
+
export AIA_LOGGER__AIA__FILE="~/.config/aia/aia.log"
|
|
358
361
|
export AIA_LOGGER__AIA__LEVEL="debug"
|
|
359
362
|
export AIA_LOGGER__AIA__FLUSH="true"
|
|
360
363
|
|
|
@@ -602,27 +605,17 @@ aia --tools ./my_tools --debug test_prompt
|
|
|
602
605
|
|
|
603
606
|
### Updating from Older Versions
|
|
604
607
|
|
|
605
|
-
|
|
608
|
+
If upgrading from an earlier version of AIA, back up and recreate your configuration:
|
|
606
609
|
|
|
607
610
|
```bash
|
|
608
611
|
# Backup current config
|
|
609
612
|
cp ~/.config/aia/aia.yml ~/.config/aia/aia.yml.backup
|
|
610
613
|
|
|
611
|
-
#
|
|
612
|
-
aia --
|
|
614
|
+
# Dump current running configuration as a starting point
|
|
615
|
+
aia --dump ~/.config/aia/aia.yml
|
|
613
616
|
```
|
|
614
617
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
Generate configuration templates:
|
|
618
|
-
|
|
619
|
-
```bash
|
|
620
|
-
# Generate basic config
|
|
621
|
-
aia --generate-config basic > ~/.config/aia/aia.yml
|
|
622
|
-
|
|
623
|
-
# Generate advanced config with all options
|
|
624
|
-
aia --generate-config full > ~/.config/aia/aia.advanced.yml
|
|
625
|
-
```
|
|
618
|
+
Review the dumped file and merge any custom settings from your backup.
|
|
626
619
|
|
|
627
620
|
## Best Practices
|
|
628
621
|
|
data/docs/contributing.md
CHANGED
|
@@ -29,7 +29,7 @@ We welcome contributions to AIA! This guide will help you get started with contr
|
|
|
29
29
|
## Getting Started
|
|
30
30
|
|
|
31
31
|
### Prerequisites
|
|
32
|
-
- Ruby 3.
|
|
32
|
+
- Ruby 3.2+ installed
|
|
33
33
|
- Git for version control
|
|
34
34
|
- Familiarity with AI/LLM concepts
|
|
35
35
|
- Understanding of command-line tools
|
|
@@ -329,4 +329,4 @@ Questions? Feel free to open an issue or start a discussion on GitHub.
|
|
|
329
329
|
|
|
330
330
|
---
|
|
331
331
|
|
|
332
|
-
*Last updated:
|
|
332
|
+
*Last updated: February 2026*
|
|
@@ -156,7 +156,7 @@ export PUREMD_API_KEY="your_api_key"
|
|
|
156
156
|
**Aliases**: `/website`, `/web`
|
|
157
157
|
|
|
158
158
|
### `/skill`
|
|
159
|
-
Include
|
|
159
|
+
Include an AIA skill into the conversation context.
|
|
160
160
|
|
|
161
161
|
**Syntax**: `/skill skill_name`
|
|
162
162
|
|
|
@@ -169,38 +169,58 @@ Include a Claude Code skill into the conversation context.
|
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
**Features**:
|
|
172
|
-
- Reads `SKILL.md` from `~/.
|
|
172
|
+
- Reads `SKILL.md` from the skills directory (default: `~/.prompts/skills/<skill_name>/`)
|
|
173
173
|
- Supports prefix matching: `/skill code` finds the first subdirectory starting with "code"
|
|
174
174
|
- Exact matches take priority over prefix matches
|
|
175
|
-
-
|
|
175
|
+
- Injects only the **body content** of `SKILL.md` — the YAML front matter is stripped and never sent to the LLM
|
|
176
|
+
- Skills directory is configured via `skills.dir` or `--skills-dir`
|
|
177
|
+
|
|
178
|
+
**Role vs Skill**: A role defines the LLM's *personality*; a skill provides *task instructions* for how to carry out the user's request within that role. Skills are injected after the role and before the user prompt.
|
|
176
179
|
|
|
177
180
|
**Error Handling**:
|
|
178
|
-
- Missing skill name: `Error: /skill requires a skill name
|
|
179
|
-
- No matching directory: `Error: No skill matching 'name' found in
|
|
180
|
-
- Directory exists but no SKILL.md: `Error: Skill directory 'name' has no SKILL.md
|
|
181
|
+
- Missing skill name: `Error: /skill requires a skill name. Use /skills to list available skills.`
|
|
182
|
+
- No matching directory: `Error: No skill matching 'name' found in <dir>. Use /skills to list available skills.`
|
|
183
|
+
- Directory exists but no SKILL.md: `Error: Skill directory 'name' has no SKILL.md. Use /skills to list available skills.`
|
|
184
|
+
|
|
185
|
+
**See also**: `/skills` to list available skills, `--list-skills` CLI flag
|
|
181
186
|
|
|
182
187
|
### `/skills`
|
|
183
|
-
List
|
|
188
|
+
List available AIA skills with optional search filtering.
|
|
189
|
+
|
|
190
|
+
**Syntax**: `/skills [search terms]`
|
|
191
|
+
|
|
192
|
+
**Examples**:
|
|
193
|
+
```markdown
|
|
194
|
+
/skills # List all skills
|
|
195
|
+
/skills ruby # Skills matching "ruby"
|
|
196
|
+
/skills -python # Skills not matching "python"
|
|
197
|
+
/skills ruby -deprecated # Skills matching "ruby" but not "deprecated"
|
|
198
|
+
```
|
|
184
199
|
|
|
185
|
-
**
|
|
200
|
+
**Search term prefixes**:
|
|
201
|
+
- Bare word or `+word` — positive filter (skill must match)
|
|
202
|
+
- `-word`, `~word`, or `!word` — negative filter (skill must not match)
|
|
203
|
+
- Searches skill name and SKILL.md front matter fields (name, description, etc.)
|
|
186
204
|
|
|
187
205
|
**Example Output**:
|
|
188
206
|
```
|
|
189
|
-
Available Skills
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
api-developer
|
|
193
|
-
code-assist
|
|
207
|
+
Available Skills (~/.prompts/skills):
|
|
208
|
+
======================================
|
|
209
|
+
|
|
194
210
|
code-quality
|
|
211
|
+
Improve code quality through comprehensive analysis and refactoring.
|
|
212
|
+
|
|
195
213
|
frontend-design
|
|
214
|
+
Create distinctive, production-grade frontend interfaces.
|
|
196
215
|
|
|
197
|
-
Total:
|
|
216
|
+
Total: 2 skills
|
|
198
217
|
```
|
|
199
218
|
|
|
200
219
|
**Features**:
|
|
201
|
-
- Lists
|
|
220
|
+
- Lists skill subdirectories from `AIA.config.skills.dir` (default: `~/.prompts/skills/`)
|
|
202
221
|
- Sorted alphabetically
|
|
203
222
|
- Displays to STDOUT only (does not inject content into the prompt)
|
|
223
|
+
- Reads `SKILL.md` front matter for filtering and description display
|
|
204
224
|
|
|
205
225
|
## Execution Directives
|
|
206
226
|
|
|
@@ -544,32 +564,34 @@ ERROR: PUREMD_API_KEY is required in order to include a webpage
|
|
|
544
564
|
|
|
545
565
|
### Custom Directives
|
|
546
566
|
|
|
547
|
-
You can extend AIA with custom directives by
|
|
567
|
+
You can extend AIA with custom directives by subclassing `AIA::Directive`:
|
|
548
568
|
|
|
549
569
|
```ruby
|
|
550
|
-
# examples/directives/
|
|
570
|
+
# examples/directives/timestamp_directive.rb
|
|
551
571
|
module AIA
|
|
552
|
-
class
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
AIA.config.client.chat(meta_prompt)
|
|
572
|
+
class CustomDirectives < Directive
|
|
573
|
+
desc "Insert current timestamp (optional strftime format, default: %Y-%m-%d %H:%M:%S)"
|
|
574
|
+
def timestamp(args = [], context_manager = nil)
|
|
575
|
+
format = args.empty? ? '%Y-%m-%d %H:%M:%S' : args.join(' ')
|
|
576
|
+
Time.now.strftime(format)
|
|
558
577
|
end
|
|
559
578
|
end
|
|
560
579
|
end
|
|
561
580
|
```
|
|
562
581
|
|
|
563
|
-
**Usage:** Load custom directives with the
|
|
582
|
+
**Usage:** Load custom directives with the `--tools` option:
|
|
564
583
|
|
|
565
584
|
```bash
|
|
566
585
|
# Load custom directive
|
|
567
|
-
aia --tools examples/directives/
|
|
586
|
+
aia --tools examples/directives/timestamp_directive.rb --chat
|
|
568
587
|
|
|
569
|
-
# Use
|
|
570
|
-
/
|
|
588
|
+
# Use in chat mode
|
|
589
|
+
/timestamp
|
|
590
|
+
/timestamp %Y-%m-%d
|
|
571
591
|
```
|
|
572
592
|
|
|
593
|
+
See `examples/directives/` for more examples.
|
|
594
|
+
|
|
573
595
|
### Best Practices
|
|
574
596
|
|
|
575
597
|
1. **Test directives individually** before combining them
|
data/docs/examples/index.md
CHANGED
|
@@ -77,10 +77,10 @@ aia --pipeline "extract_data,analyze_data,generate_report" dataset.csv
|
|
|
77
77
|
### Custom Tool Integration
|
|
78
78
|
```bash
|
|
79
79
|
# Copy a useful tool
|
|
80
|
-
cp docs/examples/tools/file_analyzer.rb ~/.aia/tools/
|
|
80
|
+
cp docs/examples/tools/file_analyzer.rb ~/.config/aia/tools/
|
|
81
81
|
|
|
82
82
|
# Use it in a prompt
|
|
83
|
-
aia --tools ~/.aia/tools/file_analyzer.rb analyze_project
|
|
83
|
+
aia --tools ~/.config/aia/tools/file_analyzer.rb analyze_project
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
## Example Structure
|
data/docs/examples/mcp/index.md
CHANGED
|
@@ -110,62 +110,56 @@ server.connect();
|
|
|
110
110
|
|
|
111
111
|
### Basic MCP Configuration
|
|
112
112
|
```yaml
|
|
113
|
-
# ~/.aia/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
# ~/.config/aia/aia.yml
|
|
114
|
+
mcp_servers:
|
|
115
|
+
- name: github
|
|
116
|
+
command: python
|
|
117
|
+
args:
|
|
118
|
+
- github_analyzer.py
|
|
119
|
+
env:
|
|
120
|
+
GITHUB_TOKEN: "${GITHUB_TOKEN}"
|
|
121
|
+
|
|
122
|
+
- name: filesystem
|
|
123
|
+
command: node
|
|
124
|
+
args:
|
|
125
|
+
- filesystem_analyzer.js
|
|
126
|
+
- /allowed/path
|
|
127
|
+
|
|
128
|
+
- name: database
|
|
129
|
+
command: python
|
|
130
|
+
args:
|
|
131
|
+
- postgres_analyzer.py
|
|
132
|
+
env:
|
|
133
|
+
DATABASE_URL: "${DATABASE_URL}"
|
|
130
134
|
```
|
|
131
135
|
|
|
132
|
-
###
|
|
136
|
+
### MCP Configuration with Timeouts
|
|
133
137
|
```yaml
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- name: database
|
|
161
|
-
command: ["python", "mcp_clients/postgres_analyzer.py"]
|
|
162
|
-
env:
|
|
163
|
-
DATABASE_URL: "${READ_ONLY_DB_URL}"
|
|
164
|
-
MAX_QUERY_TIME: "10000"
|
|
165
|
-
security:
|
|
166
|
-
network_access: true
|
|
167
|
-
file_access: false
|
|
168
|
-
read_only: true
|
|
138
|
+
# ~/.config/aia/aia.yml
|
|
139
|
+
mcp_servers:
|
|
140
|
+
- name: github
|
|
141
|
+
command: python
|
|
142
|
+
args:
|
|
143
|
+
- mcp_clients/github_analyzer.py
|
|
144
|
+
env:
|
|
145
|
+
GITHUB_TOKEN: "${GITHUB_TOKEN}"
|
|
146
|
+
LOG_LEVEL: "INFO"
|
|
147
|
+
timeout: 30000
|
|
148
|
+
|
|
149
|
+
- name: filesystem
|
|
150
|
+
command: node
|
|
151
|
+
args:
|
|
152
|
+
- mcp_clients/filesystem_analyzer.js
|
|
153
|
+
- /home/user/projects
|
|
154
|
+
- /tmp/workspace
|
|
155
|
+
|
|
156
|
+
- name: database
|
|
157
|
+
command: python
|
|
158
|
+
args:
|
|
159
|
+
- mcp_clients/postgres_analyzer.py
|
|
160
|
+
env:
|
|
161
|
+
DATABASE_URL: "${READ_ONLY_DB_URL}"
|
|
162
|
+
timeout: 10000
|
|
169
163
|
```
|
|
170
164
|
|
|
171
165
|
## Usage Examples
|
|
@@ -181,7 +175,7 @@ aia --mcp github repo_analysis --owner microsoft --repo vscode
|
|
|
181
175
|
|
|
182
176
|
```markdown
|
|
183
177
|
# github_analysis.md
|
|
184
|
-
|
|
178
|
+
# Requires MCP server "github" configured in ~/.config/aia/aia.yml
|
|
185
179
|
|
|
186
180
|
# GitHub Repository Analysis
|
|
187
181
|
|
|
@@ -208,7 +202,7 @@ aia --mcp database schema_analysis --schema public
|
|
|
208
202
|
|
|
209
203
|
```markdown
|
|
210
204
|
# database_analysis.md
|
|
211
|
-
|
|
205
|
+
# Requires MCP server "database" configured in ~/.config/aia/aia.yml
|
|
212
206
|
|
|
213
207
|
# Database Schema Analysis
|
|
214
208
|
|
|
@@ -227,7 +221,8 @@ Provide actionable optimization recommendations.
|
|
|
227
221
|
### Multi-Client Integration
|
|
228
222
|
```markdown
|
|
229
223
|
# comprehensive_project_audit.md
|
|
230
|
-
|
|
224
|
+
# Requires MCP servers: github, filesystem, database
|
|
225
|
+
# Run with: aia --mcp-use github,filesystem,database comprehensive_project_audit
|
|
231
226
|
|
|
232
227
|
# Comprehensive Project Audit
|
|
233
228
|
|
|
@@ -264,38 +259,36 @@ Generate unified recommendations with implementation priority.
|
|
|
264
259
|
## Security Considerations
|
|
265
260
|
|
|
266
261
|
### MCP Security Best Practices
|
|
262
|
+
|
|
263
|
+
Control MCP server access using CLI flags:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Allow only specific MCP servers
|
|
267
|
+
aia --mcp-use github,filesystem --chat
|
|
268
|
+
|
|
269
|
+
# Skip specific MCP servers
|
|
270
|
+
aia --mcp-skip database --chat
|
|
271
|
+
|
|
272
|
+
# Disable all MCP servers
|
|
273
|
+
aia --no-mcp --chat
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Limit what each MCP server can access through its configuration:
|
|
277
|
+
|
|
267
278
|
```yaml
|
|
268
|
-
#
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
allowed_paths: ["/home/user/projects", "/tmp/aia-workspace"]
|
|
282
|
-
blocked_paths: ["/etc", "/var", "/usr"]
|
|
283
|
-
|
|
284
|
-
clients:
|
|
285
|
-
- name: github
|
|
286
|
-
security_profile: "network_only"
|
|
287
|
-
allowed_operations: ["read", "list"]
|
|
288
|
-
blocked_operations: ["write", "delete"]
|
|
289
|
-
|
|
290
|
-
- name: filesystem
|
|
291
|
-
security_profile: "filesystem_readonly"
|
|
292
|
-
max_file_size: "10MB"
|
|
293
|
-
max_files_per_request: 100
|
|
294
|
-
|
|
295
|
-
- name: database
|
|
296
|
-
security_profile: "database_readonly"
|
|
297
|
-
query_timeout: 10000
|
|
298
|
-
max_rows_per_query: 1000
|
|
279
|
+
# ~/.config/aia/aia.yml
|
|
280
|
+
mcp_servers:
|
|
281
|
+
- name: filesystem
|
|
282
|
+
command: mcp-server-filesystem
|
|
283
|
+
args:
|
|
284
|
+
- /home/user/projects # Restrict to safe directories
|
|
285
|
+
- /tmp/aia-workspace
|
|
286
|
+
|
|
287
|
+
- name: database
|
|
288
|
+
command: database-mcp-server
|
|
289
|
+
env:
|
|
290
|
+
DATABASE_URL: "${READ_ONLY_DB_URL}" # Use read-only credentials
|
|
291
|
+
timeout: 10000
|
|
299
292
|
```
|
|
300
293
|
|
|
301
294
|
### Access Control
|
|
@@ -388,18 +381,21 @@ python github_analyzer.py --test
|
|
|
388
381
|
```
|
|
389
382
|
|
|
390
383
|
#### Protocol Errors
|
|
384
|
+
|
|
385
|
+
Enable detailed MCP logging via the logger configuration:
|
|
386
|
+
|
|
391
387
|
```yaml
|
|
392
|
-
#
|
|
393
|
-
|
|
394
|
-
|
|
388
|
+
# ~/.config/aia/aia.yml
|
|
389
|
+
logger:
|
|
390
|
+
mcp:
|
|
391
|
+
file: /tmp/aia-mcp.log
|
|
395
392
|
level: debug
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
fallback_mode: graceful
|
|
393
|
+
flush: true
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Or via CLI:
|
|
397
|
+
```bash
|
|
398
|
+
aia --debug my_prompt # Sets all loggers to debug level
|
|
403
399
|
```
|
|
404
400
|
|
|
405
401
|
#### Performance Issues
|
|
@@ -89,8 +89,9 @@ aia --tools log_analyzer.rb incident_analysis /var/log/app.log
|
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
### MCP Integration
|
|
92
|
-
```
|
|
93
|
-
|
|
92
|
+
```bash
|
|
93
|
+
# Run with MCP servers for filesystem access
|
|
94
|
+
aia --mcp-use filesystem my_prompt
|
|
94
95
|
```
|
|
95
96
|
|
|
96
97
|
## Customization Parameters
|