aia 0.9.4 → 0.9.6
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 +13 -1
- data/README.md +531 -536
- data/images/aia.png +0 -0
- data/lib/aia/chat_processor_service.rb +9 -8
- data/lib/aia/directive_processor.rb +18 -10
- data/lib/aia/ruby_llm_adapter.rb +5 -5
- data/lib/aia/utility.rb +1 -1
- data/lib/aia.rb +5 -1
- data/lib/extensions/ruby_llm/modalities.rb +30 -22
- metadata +34 -5
data/README.md
CHANGED
@@ -1,775 +1,770 @@
|
|
1
|
-
|
1
|
+
<div align="center">
|
2
|
+
<h1>AI Assistant (AIA)</h1>
|
3
|
+
<img src="images/aia.png" alt="Robots waiter ready to take your order."><br />
|
4
|
+
**The Prompt is the Code**
|
5
|
+
</div>
|
2
6
|
|
3
|
-
|
7
|
+
AIA is a command-line utility that facilitates interaction with AI models through dynamic prompt management. It automates the management of pre-compositional prompts and executes generative AI commands with enhanced features including embedded directives, shell integration, embedded Ruby, history management, interactive chat, and prompt workflows.
|
4
8
|
|
5
|
-
|
6
|
-
, , AIA is a command-line utility that facilitates
|
7
|
-
(\____/) AI Assistant interaction with AI models. It automates the
|
8
|
-
(_oo_) Fancy LLM management of pre-compositional prompts and
|
9
|
-
(O) is Online executes generative AI (Gen-AI) commands on those
|
10
|
-
__||__ \) prompts. AIA includes enhanced features such as
|
11
|
-
[/______\] / * embedded directives * shell integration
|
12
|
-
/ \__AI__/ \/ * embedded Ruby * history management
|
13
|
-
/ /__\ * interactive chat * prompt workflows
|
14
|
-
(\ /____\ # supports RubyLLM::Tool integration
|
15
|
-
```
|
16
|
-
|
17
|
-
AIA leverages the [prompt_manager gem](https://github.com/madbomber/prompt_manager) to manage prompts. It utilizes the [CLI tool fzf](https://github.com/junegunn/fzf) for prompt selection.
|
9
|
+
AIA leverages the [prompt_manager gem](https://github.com/madbomber/prompt_manager) to manage prompts, utilizes the [CLI tool fzf](https://github.com/junegunn/fzf) for prompt selection, and includes the [shared_tools gem](https://github.com/madbomber/shared_tools) which provides a collection of ready-to-use functions for use with LLMs that support tools.
|
18
10
|
|
19
11
|
**Wiki**: [Checkout the AIA Wiki](https://github.com/MadBomber/aia/wiki)
|
20
12
|
|
21
|
-
|
13
|
+
## Quick Start
|
14
|
+
|
15
|
+
1. **Install AIA:**
|
16
|
+
```bash
|
17
|
+
gem install aia
|
18
|
+
```
|
19
|
+
|
20
|
+
2. **Install dependencies:**
|
21
|
+
```bash
|
22
|
+
brew install fzf
|
23
|
+
```
|
24
|
+
|
25
|
+
3. **Create your first prompt:**
|
26
|
+
```bash
|
27
|
+
mkdir -p ~/.prompts
|
28
|
+
echo "What is [TOPIC]?" > ~/.prompts/ask.txt
|
29
|
+
```
|
30
|
+
|
31
|
+
4. **Run your prompt:**
|
32
|
+
```bash
|
33
|
+
aia ask
|
34
|
+
```
|
35
|
+
You'll be prompted to enter a value for `[TOPIC]`, then AIA will send your question to the AI model.
|
36
|
+
|
37
|
+
5. **Start an interactive chat:**
|
38
|
+
```bash
|
39
|
+
aia --chat
|
40
|
+
```
|
41
|
+
|
42
|
+
```plain
|
43
|
+
, ,
|
44
|
+
(\____/) AI Assistant
|
45
|
+
(_oo_) Fancy LLM
|
46
|
+
(O) is Online
|
47
|
+
__||__ \)
|
48
|
+
[/______\] /
|
49
|
+
/ \__AI__/ \/
|
50
|
+
/ /__\
|
51
|
+
(\ /____\
|
52
|
+
```
|
22
53
|
|
23
54
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
24
55
|
|
25
56
|
## Table of Contents
|
26
57
|
|
27
|
-
- [
|
28
|
-
|
29
|
-
|
30
|
-
- [
|
31
|
-
- [
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
- [
|
39
|
-
- [
|
40
|
-
- [
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
- [Using Directives in Chat Sessions](#using-directives-in-chat-sessions)
|
48
|
-
- [Prompt Sequences](#prompt-sequences)
|
49
|
-
- [--next](#--next)
|
50
|
-
- [--pipeline](#--pipeline)
|
51
|
-
- [Best Practices ??](#best-practices-)
|
52
|
-
- [Example pipeline](#example-pipeline)
|
53
|
-
- [All About ROLES](#all-about-roles)
|
54
|
-
- [The --roles_prefix (AIA_ROLES_PREFIX)](#the---roles_prefix-aia_roles_prefix)
|
55
|
-
- [The --role Option](#the---role-option)
|
56
|
-
- [Other Ways to Insert Roles into Prompts](#other-ways-to-insert-roles-into-prompts)
|
57
|
-
- [External CLI Tools Used](#external-cli-tools-used)
|
58
|
-
- [Shell Completion](#shell-completion)
|
59
|
-
- [My Most Powerful Prompt](#my-most-powerful-prompt)
|
60
|
-
- [My Configuration](#my-configuration)
|
61
|
-
- [Executable Prompts](#executable-prompts)
|
62
|
-
- [Usage](#usage)
|
58
|
+
- [Quick Start](#quick-start)
|
59
|
+
- [Installation & Prerequisites](#installation--prerequisites)
|
60
|
+
- [Basic Usage](#basic-usage)
|
61
|
+
- [Configuration](#configuration)
|
62
|
+
- [Essential Configuration Options](#essential-configuration-options)
|
63
|
+
- [Configuration Precedence](#configuration-precedence)
|
64
|
+
- [Complete Configuration Reference](#complete-configuration-reference)
|
65
|
+
- [Advanced Features](#advanced-features)
|
66
|
+
- [Prompt Directives](#prompt-directives)
|
67
|
+
- [Shell Integration](#shell-integration)
|
68
|
+
- [Embedded Ruby (ERB)](#embedded-ruby-erb)
|
69
|
+
- [Prompt Sequences](#prompt-sequences)
|
70
|
+
- [Roles and System Prompts](#roles-and-system-prompts)
|
71
|
+
- [RubyLLM::Tool Support](#rubyllmtool-support)
|
72
|
+
- [Examples & Tips](#examples--tips)
|
73
|
+
- [Practical Examples](#practical-examples)
|
74
|
+
- [Executable Prompts](#executable-prompts)
|
75
|
+
- [Tips from the Author](#tips-from-the-author)
|
76
|
+
- [Security Considerations](#security-considerations)
|
77
|
+
- [Troubleshooting](#troubleshooting)
|
63
78
|
- [Development](#development)
|
64
79
|
- [Contributing](#contributing)
|
65
80
|
- [Roadmap](#roadmap)
|
66
|
-
- [RubyLLM::Tool Support](#rubyllmtool-support)
|
67
|
-
- [What Are RubyLLM Tools?](#what-are-rubyllm-tools)
|
68
|
-
- [How to Use Tools](#how-to-use-tools)
|
69
|
-
- [`--tools` Option](#--tools-option)
|
70
|
-
- [Filtering the tool paths](#filtering-the-tool-paths)
|
71
|
-
- [`--at`, `--allowed_tools` Option](#--at---allowed_tools-option)
|
72
|
-
- [`--rt`, `--rejected_tools` Option](#--rt---rejected_tools-option)
|
73
|
-
- [Creating Your Own Tools](#creating-your-own-tools)
|
74
|
-
- [MCP Supported](#mcp-supported)
|
75
81
|
- [License](#license)
|
76
82
|
|
77
83
|
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
78
84
|
|
79
|
-
##
|
80
|
-
|
81
|
-
The following table provides a comprehensive list of configuration options, their default values, and the associated environment variables:
|
82
|
-
|
83
|
-
| Config Item Name | CLI Options | Default Value | Environment Variable |
|
84
|
-
|----------------------|-------------|-----------------------------|---------------------------|
|
85
|
-
| adapter | --adapter | ruby_llm | AIA_ADAPTER |
|
86
|
-
| aia_dir | | ~/.aia | AIA_DIR |
|
87
|
-
| append | -a, --append | false | AIA_APPEND |
|
88
|
-
| chat | --chat | false | AIA_CHAT |
|
89
|
-
| clear | --clear | false | AIA_CLEAR |
|
90
|
-
| config_file | -c, --config_file | ~/.aia/config.yml | AIA_CONFIG_FILE |
|
91
|
-
| debug | -d, --debug | false | AIA_DEBUG |
|
92
|
-
| embedding_model | --em, --embedding_model | text-embedding-ada-002 | AIA_EMBEDDING_MODEL |
|
93
|
-
| erb | | true | AIA_ERB |
|
94
|
-
| frequency_penalty | --frequency_penalty | 0.0 | AIA_FREQUENCY_PENALTY |
|
95
|
-
| fuzzy | -f, --fuzzy | false | AIA_FUZZY |
|
96
|
-
| image_quality | --iq, --image_quality | standard | AIA_IMAGE_QUALITY |
|
97
|
-
| image_size | --is, --image_size | 1024x1024 | AIA_IMAGE_SIZE |
|
98
|
-
| image_style | --style, --image_style | vivid | AIA_IMAGE_STYLE |
|
99
|
-
| log_file | -l, --log_file | ~/.prompts/_prompts.log | AIA_LOG_FILE |
|
100
|
-
| markdown | --md, --markdown | true | AIA_MARKDOWN |
|
101
|
-
| max_tokens | --max_tokens | 2048 | AIA_MAX_TOKENS |
|
102
|
-
| model | -m, --model | gpt-4o-mini | AIA_MODEL |
|
103
|
-
| next | -n, --next | nil | AIA_NEXT |
|
104
|
-
| out_file | -o, --out_file | temp.md | AIA_OUT_FILE |
|
105
|
-
| parameter_regex | --regex | '(?-mix:(\[[A-Z _|]+\]))' | AIA_PARAMETER_REGEX |
|
106
|
-
| pipeline | --pipeline | [] | AIA_PIPELINE |
|
107
|
-
| presence_penalty | --presence_penalty | 0.0 | AIA_PRESENCE_PENALTY |
|
108
|
-
| prompt_extname | | .txt | AIA_PROMPT_EXTNAME |
|
109
|
-
| prompts_dir | -p, --prompts_dir | ~/.prompts | AIA_PROMPTS_DIR |
|
110
|
-
| refresh | --refresh | 7 (days) | AIA_REFRESH |
|
111
|
-
| require_libs | --rq --require | [] | AIA_REQUIRE_LIBS |
|
112
|
-
| role | -r, --role | | AIA_ROLE |
|
113
|
-
| roles_dir | | ~/.prompts/roles | AIA_ROLES_DIR |
|
114
|
-
| roles_prefix | --roles_prefix | roles | AIA_ROLES_PREFIX |
|
115
|
-
| shell | | true | AIA_SHELL |
|
116
|
-
| speak | --speak | false | AIA_SPEAK |
|
117
|
-
| speak_command | | afplay | AIA_SPEAK_COMMAND |
|
118
|
-
| speech_model | --sm, --speech_model | tts-1 | AIA_SPEECH_MODEL |
|
119
|
-
| system_prompt | --system_prompt | | AIA_SYSTEM_PROMPT |
|
120
|
-
| temperature | -t, --temperature | 0.7 | AIA_TEMPERATURE |
|
121
|
-
| terse | --terse | false | AIA_TERSE |
|
122
|
-
| tool_paths | --tools | [] | AIA_TOOL_PATHS |
|
123
|
-
| allowed_tools | --at --allowed_tools | nil | AIA_ALLOWED_TOOLS |
|
124
|
-
| rejected_tools | --rt --rejected_tools | nil | AIA_REJECTED_TOOLS |
|
125
|
-
| top_p | --top_p | 1.0 | AIA_TOP_P |
|
126
|
-
| transcription_model | --tm, --transcription_model | whisper-1 | AIA_TRANSCRIPTION_MODEL |
|
127
|
-
| verbose | -v, --verbose | false | AIA_VERBOSE |
|
128
|
-
| voice | --voice | alloy | AIA_VOICE |
|
129
|
-
|
130
|
-
These options can be configured via command-line arguments, environment variables, or configuration files.
|
131
|
-
|
132
|
-
### Configuration Flexibility
|
133
|
-
|
134
|
-
AIA determines configuration settings using the following order of precedence:
|
135
|
-
|
136
|
-
1. Embedded config directives
|
137
|
-
2. Command-line arguments
|
138
|
-
3. Environment variables
|
139
|
-
4. Configuration files
|
140
|
-
5. Default values
|
141
|
-
|
142
|
-
For example, let's consider the `model` option. Suppose the following conditions:
|
143
|
-
|
144
|
-
- Default value is "gpt-4o-mini"
|
145
|
-
- No entry in the config file
|
146
|
-
- No environment variable value for `AIA_MODEL`
|
147
|
-
- No command-line argument provided for `--model`
|
148
|
-
- No embedded directive like `//config model = some-fancy-llm`
|
149
|
-
|
150
|
-
In this scenario, the model used will be "gpt-4o-mini". However, you can override this default by setting the model at any level of the precedence order. Additionally, you can dynamically ask for user input by incorporating an embedded directive with a placeholder parameter, such as `//config model = [PROCESS_WITH_MODEL]`. When processing the prompt, AIA will prompt you to input a value for `[PROCESS_WITH_MODEL]`.
|
151
|
-
|
152
|
-
If you do not like the default regex used to identify parameters within the prompt text, don't worry there is a way to configure it using the `--regex` option.
|
153
|
-
|
154
|
-
### Expandable Configuration
|
85
|
+
## Installation & Prerequisites
|
155
86
|
|
156
|
-
|
87
|
+
### Requirements
|
157
88
|
|
158
|
-
|
89
|
+
- **Ruby**: >= 3.2.0
|
90
|
+
- **External Tools**:
|
91
|
+
- [fzf](https://github.com/junegunn/fzf) - Command-line fuzzy finder
|
159
92
|
|
160
|
-
|
93
|
+
### Installation
|
161
94
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
- A value of `1` (one) updates the local model registry once per day.
|
166
|
-
- etc.
|
167
|
-
|
168
|
-
The date of the last successful refresh is stored in the configuration file under the key `last_refresh`. The default configuration file is located at `~/.aia/config.yml`. When a refresh is successful, the `last_refresh` value is updated to the current date, and the updated configuration is saved in `AIA.config.config_file`.
|
169
|
-
|
170
|
-
### Important Note
|
171
|
-
|
172
|
-
This approach to saving the `last_refresh` date can become cumbersome, particularly if you maintain multiple configuration files for different projects. The `last_refresh` date is only updated in the currently active configuration file. If you switch to a different project with a different configuration file, you may inadvertently hit the central model registry again, even if your local registry is already up to date.
|
173
|
-
|
174
|
-
## Shell Integration inside of a Prompt
|
175
|
-
|
176
|
-
AIA configures the `prompt_manager` gem to be fully integrated with your local shell by default. This is not an option - its a feature. If your prompt inclues text patterns like $HOME, ${HOME} or $(command) those patterns will be automatically replaced in the prompt text by the shell's value for those patterns.
|
177
|
-
|
178
|
-
#### Dynamic Shell Commands
|
179
|
-
|
180
|
-
Dynamic content can be inserted into the prompt using the pattern $(shell command) where the output of the shell command will replace the $(...) pattern. It will become part of the context / instructions for the prompt.
|
181
|
-
|
182
|
-
Consider the power of tailoring a prompt to your specific operating system:
|
95
|
+
```bash
|
96
|
+
# Install AIA gem
|
97
|
+
gem install aia
|
183
98
|
|
184
|
-
|
185
|
-
|
186
|
-
```
|
99
|
+
# Install required external tools (macOS)
|
100
|
+
brew install fzf
|
187
101
|
|
188
|
-
|
102
|
+
# Install required external tools (Linux)
|
103
|
+
# Ubuntu/Debian
|
104
|
+
sudo apt install fzf
|
189
105
|
|
190
|
-
|
191
|
-
|
106
|
+
# Arch Linux
|
107
|
+
sudo pacman -S fzf
|
192
108
|
```
|
193
109
|
|
194
|
-
|
110
|
+
### Setup Shell Completion
|
195
111
|
|
196
|
-
|
112
|
+
Get completion functions for your shell:
|
197
113
|
|
198
|
-
|
114
|
+
```bash
|
115
|
+
# For bash users
|
116
|
+
aia --completion bash >> ~/.bashrc
|
199
117
|
|
200
|
-
|
118
|
+
# For zsh users
|
119
|
+
aia --completion zsh >> ~/.zshrc
|
201
120
|
|
202
|
-
|
203
|
-
|
121
|
+
# For fish users
|
122
|
+
aia --completion fish >> ~/.config/fish/config.fish
|
204
123
|
```
|
205
124
|
|
206
|
-
|
125
|
+
## Basic Usage
|
207
126
|
|
208
|
-
|
127
|
+
### Command Line Interface
|
209
128
|
|
210
|
-
|
129
|
+
```bash
|
130
|
+
# Basic usage
|
131
|
+
aia [OPTIONS] PROMPT_ID [CONTEXT_FILES...]
|
211
132
|
|
212
|
-
|
133
|
+
# Interactive chat session
|
134
|
+
aia --chat [--role ROLE] [--model MODEL]
|
213
135
|
|
214
|
-
|
136
|
+
# Use a specific model
|
137
|
+
aia --model gpt-4 my_prompt
|
215
138
|
|
216
|
-
|
139
|
+
# Specify output file
|
140
|
+
aia --out_file result.md my_prompt
|
217
141
|
|
218
|
-
|
142
|
+
# Use a role/system prompt
|
143
|
+
aia --role expert my_prompt
|
219
144
|
|
220
|
-
|
221
|
-
|
145
|
+
# Enable fuzzy search for prompts
|
146
|
+
aia --fuzzy
|
222
147
|
```
|
223
148
|
|
224
|
-
|
225
|
-
|
226
|
-
### Parameter and Shell Substitution in Directives
|
149
|
+
### Key Command-Line Options
|
227
150
|
|
228
|
-
|
151
|
+
| Option | Description | Example |
|
152
|
+
|--------|-------------|---------|
|
153
|
+
| `--chat` | Start interactive chat session | `aia --chat` |
|
154
|
+
| `--model MODEL` | Specify AI model to use | `aia --model gpt-4` |
|
155
|
+
| `--role ROLE` | Use a role/system prompt | `aia --role expert` |
|
156
|
+
| `--out_file FILE` | Specify output file | `aia --out_file results.md` |
|
157
|
+
| `--fuzzy` | Use fuzzy search for prompts | `aia --fuzzy` |
|
158
|
+
| `--help` | Show complete help | `aia --help` |
|
229
159
|
|
230
|
-
|
160
|
+
### Directory Structure
|
231
161
|
|
232
|
-
```bash
|
233
|
-
//[DIRECTIVE_NAME] [DIRECTIVE_PARAMS]
|
234
162
|
```
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
What does that number mean to you?
|
163
|
+
~/.prompts/ # Default prompts directory
|
164
|
+
├── ask.txt # Simple question prompt
|
165
|
+
├── code_review.txt # Code review prompt
|
166
|
+
├── roles/ # Role/system prompts
|
167
|
+
│ ├── expert.txt # Expert role
|
168
|
+
│ └── teacher.txt # Teaching role
|
169
|
+
└── _prompts.log # History log
|
243
170
|
```
|
244
171
|
|
245
|
-
|
172
|
+
## Configuration
|
246
173
|
|
247
|
-
|
248
|
-
- `//command args`
|
174
|
+
### Essential Configuration Options
|
249
175
|
|
250
|
-
|
251
|
-
- `help`: Show available directives
|
252
|
-
- `shell` or `sh`: Execute a shell command
|
253
|
-
- `ruby` or `rb`: Execute Ruby code
|
254
|
-
- `config` or `cfg`: Show or update configuration
|
255
|
-
- `include` or `inc`: Include file content
|
256
|
-
- `next`: Set/Show the next prompt ID to be processed
|
257
|
-
- `pipeline`: Set/Extend/Show the workflow of prompt IDs
|
176
|
+
The most commonly used configuration options:
|
258
177
|
|
259
|
-
|
178
|
+
| Option | Default | Description |
|
179
|
+
|--------|---------|-------------|
|
180
|
+
| `model` | `gpt-4o-mini` | AI model to use |
|
181
|
+
| `prompts_dir` | `~/.prompts` | Directory containing prompts |
|
182
|
+
| `out_file` | `temp.md` | Default output file |
|
183
|
+
| `temperature` | `0.7` | Model creativity (0.0-1.0) |
|
184
|
+
| `chat` | `false` | Start in chat mode |
|
260
185
|
|
261
|
-
###
|
186
|
+
### Configuration Precedence
|
262
187
|
|
263
|
-
|
188
|
+
AIA determines configuration settings using this order (highest to lowest priority):
|
264
189
|
|
265
|
-
|
190
|
+
1. **Embedded config directives** (in prompt files): `//config model = gpt-4`
|
191
|
+
2. **Command-line arguments**: `--model gpt-4`
|
192
|
+
3. **Environment variables**: `export AIA_MODEL=gpt-4`
|
193
|
+
4. **Configuration files**: `~/.aia/config.yml`
|
194
|
+
5. **Default values**
|
266
195
|
|
267
|
-
|
268
|
-
|
269
|
-
The `//config` is the last and final way of changing the value for a configuration item for a specific prompt.
|
270
|
-
|
271
|
-
The switch options are treated like booleans. They are either `true` or `false`. Their name within the context of a `//config` directive always ends with a "?" character - question mark.
|
272
|
-
|
273
|
-
To set the value of a switch using ``//config` for example `--terse` or `--chat` to this:
|
196
|
+
### Configuration Methods
|
274
197
|
|
198
|
+
**Environment Variables:**
|
275
199
|
```bash
|
276
|
-
|
277
|
-
|
200
|
+
export AIA_MODEL=gpt-4
|
201
|
+
export AIA_PROMPTS_DIR=~/my-prompts
|
202
|
+
export AIA_TEMPERATURE=0.8
|
278
203
|
```
|
279
204
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
205
|
+
**Configuration File** (`~/.aia/config.yml`):
|
206
|
+
```yaml
|
207
|
+
model: gpt-4
|
208
|
+
prompts_dir: ~/my-prompts
|
209
|
+
temperature: 0.8
|
210
|
+
chat: false
|
285
211
|
```
|
286
212
|
|
287
|
-
|
213
|
+
**Embedded Directives** (in prompt files):
|
214
|
+
```
|
215
|
+
//config model = gpt-4
|
216
|
+
//config temperature = 0.8
|
288
217
|
|
289
|
-
|
290
|
-
//config model gpt-3.5-turbo
|
291
|
-
//config out_file temp.md
|
292
|
-
//config chat? true
|
293
|
-
//config terse? true
|
294
|
-
//config model gpt-4
|
218
|
+
Your prompt content here...
|
295
219
|
```
|
296
220
|
|
297
|
-
|
221
|
+
### Complete Configuration Reference
|
298
222
|
|
299
|
-
|
223
|
+
<details>
|
224
|
+
<summary>Click to view all configuration options</summary>
|
300
225
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
226
|
+
| Config Item Name | CLI Options | Default Value | Environment Variable |
|
227
|
+
|------------------|-------------|---------------|---------------------|
|
228
|
+
| adapter | --adapter | ruby_llm | AIA_ADAPTER |
|
229
|
+
| aia_dir | | ~/.aia | AIA_DIR |
|
230
|
+
| append | -a, --append | false | AIA_APPEND |
|
231
|
+
| chat | --chat | false | AIA_CHAT |
|
232
|
+
| clear | --clear | false | AIA_CLEAR |
|
233
|
+
| config_file | -c, --config_file | ~/.aia/config.yml | AIA_CONFIG_FILE |
|
234
|
+
| debug | -d, --debug | false | AIA_DEBUG |
|
235
|
+
| embedding_model | --em, --embedding_model | text-embedding-ada-002 | AIA_EMBEDDING_MODEL |
|
236
|
+
| erb | | true | AIA_ERB |
|
237
|
+
| frequency_penalty | --frequency_penalty | 0.0 | AIA_FREQUENCY_PENALTY |
|
238
|
+
| fuzzy | -f, --fuzzy | false | AIA_FUZZY |
|
239
|
+
| image_quality | --iq, --image_quality | standard | AIA_IMAGE_QUALITY |
|
240
|
+
| image_size | --is, --image_size | 1024x1024 | AIA_IMAGE_SIZE |
|
241
|
+
| image_style | --style, --image_style | vivid | AIA_IMAGE_STYLE |
|
242
|
+
| log_file | -l, --log_file | ~/.prompts/_prompts.log | AIA_LOG_FILE |
|
243
|
+
| markdown | --md, --markdown | true | AIA_MARKDOWN |
|
244
|
+
| max_tokens | --max_tokens | 2048 | AIA_MAX_TOKENS |
|
245
|
+
| model | -m, --model | gpt-4o-mini | AIA_MODEL |
|
246
|
+
| next | -n, --next | nil | AIA_NEXT |
|
247
|
+
| out_file | -o, --out_file | temp.md | AIA_OUT_FILE |
|
248
|
+
| parameter_regex | --regex | '(?-mix:(\[[A-Z _\|]+\]))' | AIA_PARAMETER_REGEX |
|
249
|
+
| pipeline | --pipeline | [] | AIA_PIPELINE |
|
250
|
+
| presence_penalty | --presence_penalty | 0.0 | AIA_PRESENCE_PENALTY |
|
251
|
+
| prompt_extname | | .txt | AIA_PROMPT_EXTNAME |
|
252
|
+
| prompts_dir | -p, --prompts_dir | ~/.prompts | AIA_PROMPTS_DIR |
|
253
|
+
| refresh | --refresh | 7 (days) | AIA_REFRESH |
|
254
|
+
| require_libs | --rq --require | [] | AIA_REQUIRE_LIBS |
|
255
|
+
| role | -r, --role | | AIA_ROLE |
|
256
|
+
| roles_dir | | ~/.prompts/roles | AIA_ROLES_DIR |
|
257
|
+
| roles_prefix | --roles_prefix | roles | AIA_ROLES_PREFIX |
|
258
|
+
| shell | | true | AIA_SHELL |
|
259
|
+
| speak | --speak | false | AIA_SPEAK |
|
260
|
+
| speak_command | | afplay | AIA_SPEAK_COMMAND |
|
261
|
+
| speech_model | --sm, --speech_model | tts-1 | AIA_SPEECH_MODEL |
|
262
|
+
| system_prompt | --system_prompt | | AIA_SYSTEM_PROMPT |
|
263
|
+
| temperature | -t, --temperature | 0.7 | AIA_TEMPERATURE |
|
264
|
+
| terse | --terse | false | AIA_TERSE |
|
265
|
+
| tool_paths | --tools | [] | AIA_TOOL_PATHS |
|
266
|
+
| allowed_tools | --at --allowed_tools | nil | AIA_ALLOWED_TOOLS |
|
267
|
+
| rejected_tools | --rt --rejected_tools | nil | AIA_REJECTED_TOOLS |
|
268
|
+
| top_p | --top_p | 1.0 | AIA_TOP_P |
|
269
|
+
| transcription_model | --tm, --transcription_model | whisper-1 | AIA_TRANSCRIPTION_MODEL |
|
270
|
+
| verbose | -v, --verbose | false | AIA_VERBOSE |
|
271
|
+
| voice | --voice | alloy | AIA_VOICE |
|
305
272
|
|
306
|
-
|
273
|
+
</details>
|
307
274
|
|
308
|
-
|
275
|
+
## Advanced Features
|
309
276
|
|
310
|
-
|
277
|
+
### Prompt Directives
|
311
278
|
|
312
|
-
|
279
|
+
Directives are special commands in prompt files that begin with `//` and provide dynamic functionality:
|
313
280
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
281
|
+
| Directive | Description | Example |
|
282
|
+
|-----------|-------------|---------|
|
283
|
+
| `//config` | Set configuration values | `//config model = gpt-4` |
|
284
|
+
| `//include` | Insert file contents | `//include path/to/file.txt` |
|
285
|
+
| `//shell` | Execute shell commands | `//shell ls -la` |
|
286
|
+
| `//ruby` | Execute Ruby code | `//ruby puts "Hello World"` |
|
287
|
+
| `//next` | Set next prompt in sequence | `//next summary` |
|
288
|
+
| `//pipeline` | Set prompt workflow | `//pipeline analyze,summarize,report` |
|
289
|
+
| `//clear` | Clear conversation history | `//clear` |
|
290
|
+
| `//help` | Show available directives | `//help` |
|
291
|
+
| `//available_models` | List available models | `//available_models` |
|
292
|
+
| `//review` | Review current context | `//review` |
|
318
293
|
|
319
|
-
|
294
|
+
#### Configuration Directive Examples
|
320
295
|
|
321
296
|
```bash
|
322
|
-
#
|
323
|
-
|
297
|
+
# Set model and temperature for this prompt
|
298
|
+
//config model = gpt-4
|
299
|
+
//config temperature = 0.9
|
324
300
|
|
325
|
-
#
|
326
|
-
//
|
327
|
-
|
301
|
+
# Enable chat mode and terse responses
|
302
|
+
//config chat = true
|
303
|
+
//config terse = true
|
328
304
|
|
329
|
-
|
330
|
-
Example:
|
331
|
-
```bash
|
332
|
-
//shell some_shell_command
|
305
|
+
Your prompt content here...
|
333
306
|
```
|
334
307
|
|
335
|
-
|
308
|
+
#### Dynamic Content Examples
|
336
309
|
|
337
|
-
There are no limitations on what the shell command can be. For example if you wanted to bypass the stripping of comments and directives from a file you could do something like this:
|
338
310
|
```bash
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
Which does basically the same thing as the `//include` directive, except it uses the entire content of the file. For relative file paths the same thing applies. The file's path will be relative to the PWD.
|
311
|
+
# Include file contents
|
312
|
+
//include ~/project/README.md
|
343
313
|
|
344
|
-
|
345
|
-
|
346
|
-
```bash
|
347
|
-
# Show the next promt ID
|
348
|
-
//next
|
314
|
+
# Execute shell commands
|
315
|
+
//shell git log --oneline -10
|
349
316
|
|
350
|
-
#
|
351
|
-
//
|
317
|
+
# Run Ruby code
|
318
|
+
//ruby require 'json'; puts JSON.pretty_generate({status: "ready"})
|
352
319
|
|
353
|
-
|
354
|
-
//config next
|
355
|
-
//config next = prompt_id
|
320
|
+
Analyze the above information and provide insights.
|
356
321
|
```
|
357
322
|
|
358
|
-
|
359
|
-
|
360
|
-
Examples:
|
361
|
-
```bash
|
362
|
-
# Show the current prompt workflow
|
363
|
-
//pipeline
|
364
|
-
|
365
|
-
# Set the prompt workflow
|
366
|
-
//pipeline = prompt_id_1, prompt_id_2, prompt_id_3
|
367
|
-
|
368
|
-
# Extend the prompt workflow
|
369
|
-
//pipeline << prompt_id_4, prompt_id_5, prompt_id_6
|
323
|
+
### Shell Integration
|
370
324
|
|
371
|
-
|
372
|
-
//config pipeline
|
373
|
-
//config pipeline = prompt_id_1, prompt_id_2, prompt_id_3
|
374
|
-
//config pipeline << prompt_id_4, prompt_id_5, prompt_id_6
|
375
|
-
```
|
325
|
+
AIA automatically processes shell patterns in prompts:
|
376
326
|
|
377
|
-
|
327
|
+
- **Environment variables**: `$HOME`, `${USER}`
|
328
|
+
- **Command substitution**: `$(date)`, `$(git branch --show-current)`
|
378
329
|
|
379
|
-
|
330
|
+
**Examples:**
|
380
331
|
|
381
332
|
```bash
|
382
|
-
|
383
|
-
|
333
|
+
# Dynamic system information
|
334
|
+
As a system administrator on a $(uname -s) platform, how do I optimize performance?
|
384
335
|
|
385
|
-
|
336
|
+
# Include file contents via shell
|
337
|
+
Here's my current configuration: $(cat ~/.bashrc | head -20)
|
386
338
|
|
387
|
-
|
339
|
+
# Use environment variables
|
340
|
+
My home directory is $HOME and I'm user $USER.
|
341
|
+
```
|
388
342
|
|
389
|
-
|
343
|
+
**Security Note**: Be cautious with shell integration. Review prompts before execution as they can run arbitrary commands.
|
390
344
|
|
391
|
-
|
345
|
+
### Embedded Ruby (ERB)
|
392
346
|
|
393
|
-
|
347
|
+
AIA supports full ERB processing in prompts for dynamic content generation:
|
394
348
|
|
395
|
-
|
349
|
+
```erb
|
350
|
+
<%# ERB example in prompt file %>
|
351
|
+
Current time: <%= Time.now %>
|
352
|
+
Random number: <%= rand(100) %>
|
396
353
|
|
397
|
-
|
354
|
+
<% if ENV['USER'] == 'admin' %>
|
355
|
+
You have admin privileges.
|
356
|
+
<% else %>
|
357
|
+
You have standard user privileges.
|
358
|
+
<% end %>
|
398
359
|
|
399
|
-
|
360
|
+
<%= AIA.config.model %> is the current model.
|
361
|
+
```
|
400
362
|
|
401
|
-
|
402
|
-
| --------- | ----------- |
|
403
|
-
| one | one.txt |
|
404
|
-
| two | two.txt |
|
405
|
-
| three | three.txt |
|
406
|
-
| four | four.txt |
|
363
|
+
### Prompt Sequences
|
407
364
|
|
365
|
+
Chain multiple prompts for complex workflows:
|
408
366
|
|
409
|
-
|
367
|
+
#### Using --next
|
410
368
|
|
411
369
|
```bash
|
412
|
-
|
413
|
-
aia
|
414
|
-
```
|
415
|
-
|
416
|
-
or within each of the prompt files you use the `//next` directive:
|
370
|
+
# Command line
|
371
|
+
aia analyze --next summarize --next report
|
417
372
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
three.txt contains //next four
|
373
|
+
# In prompt files
|
374
|
+
# analyze.txt contains: //next summarize
|
375
|
+
# summarize.txt contains: //next report
|
422
376
|
```
|
423
|
-
BUT if you have more than two prompts in your sequence then consider using the --pipeline option.
|
424
377
|
|
425
|
-
|
426
|
-
|
427
|
-
### --pipeline
|
378
|
+
#### Using --pipeline
|
428
379
|
|
429
380
|
```bash
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
or inside of the `one.txt` prompt file use this directive:
|
381
|
+
# Command line
|
382
|
+
aia research --pipeline analyze,summarize,report,present
|
434
383
|
|
435
|
-
|
436
|
-
//pipeline
|
384
|
+
# In prompt file
|
385
|
+
//pipeline analyze,summarize,report,present
|
437
386
|
```
|
438
387
|
|
439
|
-
|
440
|
-
|
441
|
-
### Best Practices ??
|
442
|
-
|
388
|
+
#### Example Workflow
|
443
389
|
|
444
|
-
|
390
|
+
**research.txt:**
|
391
|
+
```
|
392
|
+
//config model = gpt-4
|
393
|
+
//next analyze
|
445
394
|
|
395
|
+
Research the topic: [RESEARCH_TOPIC]
|
396
|
+
Provide comprehensive background information.
|
397
|
+
```
|
446
398
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
| three.txt | //config out_file three.md |
|
452
|
-
| four.txt | //config out_file four.md |
|
399
|
+
**analyze.txt:**
|
400
|
+
```
|
401
|
+
//config out_file = analysis.md
|
402
|
+
//next summarize
|
453
403
|
|
454
|
-
|
404
|
+
Analyze the research data and identify key insights.
|
405
|
+
```
|
455
406
|
|
456
|
-
|
407
|
+
**summarize.txt:**
|
408
|
+
```
|
409
|
+
//config out_file = summary.md
|
457
410
|
|
458
|
-
|
411
|
+
Create a concise summary of the analysis with actionable recommendations.
|
412
|
+
```
|
459
413
|
|
460
|
-
|
414
|
+
### Roles and System Prompts
|
461
415
|
|
462
|
-
|
416
|
+
Roles define the context and personality for AI responses:
|
463
417
|
|
464
418
|
```bash
|
465
|
-
#
|
466
|
-
|
467
|
-
# note that there is no "prompt" text only the directive
|
419
|
+
# Use a predefined role
|
420
|
+
aia --role expert analyze_code.rb
|
468
421
|
|
469
|
-
|
470
|
-
|
422
|
+
# Roles are stored in ~/.prompts/roles/
|
423
|
+
# expert.txt might contain:
|
424
|
+
# "You are a senior software engineer with 15 years of experience..."
|
471
425
|
```
|
472
426
|
|
473
|
-
|
427
|
+
**Creating Custom Roles:**
|
474
428
|
|
475
429
|
```bash
|
476
|
-
#
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
note any action items that were generated.
|
484
|
-
|
485
|
-
Format your response in markdown.
|
486
|
-
```
|
430
|
+
# Create a code reviewer role
|
431
|
+
cat > ~/.prompts/roles/code_reviewer.txt << EOF
|
432
|
+
You are an experienced code reviewer. Focus on:
|
433
|
+
- Code quality and best practices
|
434
|
+
- Security vulnerabilities
|
435
|
+
- Performance optimizations
|
436
|
+
- Maintainability issues
|
487
437
|
|
488
|
-
|
489
|
-
|
490
|
-
```bash
|
491
|
-
aia transcribe my_tech_meeting.m4a
|
438
|
+
Provide specific, actionable feedback.
|
439
|
+
EOF
|
492
440
|
```
|
493
441
|
|
494
|
-
|
495
|
-
|
442
|
+
### RubyLLM::Tool Support
|
496
443
|
|
497
|
-
|
444
|
+
AIA supports function calling through RubyLLM tools for extended capabilities:
|
498
445
|
|
499
|
-
|
500
|
-
|
501
|
-
|
446
|
+
```bash
|
447
|
+
# Load tools from directory
|
448
|
+
aia --tools ~/my-tools/ --chat
|
502
449
|
|
503
|
-
|
450
|
+
# Load specific tool files
|
451
|
+
aia --tools weather.rb,calculator.rb --chat
|
504
452
|
|
505
|
-
|
453
|
+
# Filter tools
|
454
|
+
aia --tools ~/tools/ --allowed_tools weather,calc
|
455
|
+
aia --tools ~/tools/ --rejected_tools deprecated
|
456
|
+
```
|
506
457
|
|
507
|
-
|
458
|
+
**Tool Examples** (see `examples/tools/` directory):
|
459
|
+
- File operations (read, write, list)
|
460
|
+
- Shell command execution
|
461
|
+
- API integrations
|
462
|
+
- Data processing utilities
|
508
463
|
|
509
|
-
|
464
|
+
**Shared Tools Collection:**
|
465
|
+
AIA includes the [shared_tools gem](https://github.com/madbomber/shared_tools) which provides a curated collection of commonly-used RubyLLM::Tool implementations:
|
510
466
|
|
511
467
|
```bash
|
512
|
-
|
513
|
-
|
468
|
+
# Access shared tools automatically (included with AIA)
|
469
|
+
aia --tools shared --chat
|
514
470
|
|
515
|
-
|
471
|
+
# Combine with custom tools
|
472
|
+
aia --tools shared,~/my-tools/ --chat
|
473
|
+
```
|
516
474
|
|
517
|
-
|
475
|
+
Available shared tools include:
|
476
|
+
- **File operations**: read, write, edit, search files
|
477
|
+
- **Web utilities**: fetch web pages, parse HTML/JSON
|
478
|
+
- **System tools**: execute commands, get system info
|
479
|
+
- **Data processing**: CSV/JSON manipulation, text analysis
|
480
|
+
- **API helpers**: HTTP requests, common API patterns
|
518
481
|
|
519
|
-
|
482
|
+
## Examples & Tips
|
520
483
|
|
521
|
-
|
484
|
+
### Practical Examples
|
522
485
|
|
486
|
+
#### Code Review Prompt
|
523
487
|
```bash
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
In this example the prompt text file `$AIA_ROLES_PREFIX/ruby.txt` is prepended to the prompt text file `$AIA_PROMPTS_DIR/sw_eng/doc_the_methods.txt`
|
488
|
+
# ~/.prompts/code_review.txt
|
489
|
+
//config model = gpt-4
|
490
|
+
//config temperature = 0.3
|
528
491
|
|
529
|
-
|
492
|
+
Review this code for:
|
493
|
+
- Best practices adherence
|
494
|
+
- Security vulnerabilities
|
495
|
+
- Performance issues
|
496
|
+
- Maintainability concerns
|
530
497
|
|
531
|
-
|
532
|
-
|
533
|
-
```text
|
534
|
-
As a [ROLE] tell me what you think about [SUBJECT]
|
498
|
+
Code to review:
|
499
|
+
//include [CODE_FILE]
|
535
500
|
```
|
536
501
|
|
537
|
-
|
538
|
-
|
539
|
-
## External CLI Tools Used
|
540
|
-
|
541
|
-
To install the external CLI programs used by AIA:
|
542
|
-
|
543
|
-
brew install fzf
|
544
|
-
|
545
|
-
fzf
|
546
|
-
Command-line fuzzy finder written in Go
|
547
|
-
[https://github.com/junegunn/fzf](https://github.com/junegunn/fzf)
|
502
|
+
Usage: `aia code_review mycode.rb`
|
548
503
|
|
504
|
+
#### Meeting Notes Processor
|
505
|
+
```bash
|
506
|
+
# ~/.prompts/meeting_notes.txt
|
507
|
+
//config model = gpt-4o-mini
|
508
|
+
//pipeline format,action_items
|
549
509
|
|
550
|
-
|
510
|
+
Raw meeting notes:
|
511
|
+
//include [NOTES_FILE]
|
551
512
|
|
552
|
-
|
513
|
+
Please clean up and structure these meeting notes.
|
514
|
+
```
|
553
515
|
|
516
|
+
#### Documentation Generator
|
554
517
|
```bash
|
555
|
-
|
556
|
-
|
518
|
+
# ~/.prompts/document.txt
|
519
|
+
//config model = gpt-4
|
520
|
+
//shell find [PROJECT_DIR] -name "*.rb" | head -10
|
557
521
|
|
558
|
-
|
522
|
+
Generate documentation for the Ruby project shown above.
|
523
|
+
Include: API references, usage examples, and setup instructions.
|
524
|
+
```
|
559
525
|
|
560
|
-
|
526
|
+
### Executable Prompts
|
561
527
|
|
562
|
-
|
528
|
+
Create reusable executable prompts:
|
563
529
|
|
564
|
-
|
530
|
+
**weather_report** (make executable with `chmod +x`):
|
531
|
+
```bash
|
532
|
+
#!/usr/bin/env aia run --no-out_file
|
533
|
+
# Get current weather for a city
|
565
534
|
|
566
|
-
|
567
|
-
|
535
|
+
What's the current weather in [CITY]?
|
536
|
+
Include temperature, conditions, and 3-day forecast.
|
537
|
+
Format as a brief, readable summary.
|
568
538
|
```
|
569
539
|
|
570
|
-
|
571
|
-
|
540
|
+
Usage:
|
572
541
|
```bash
|
573
|
-
|
542
|
+
./weather_report
|
543
|
+
# Prompts for city, outputs to stdout
|
544
|
+
|
545
|
+
./weather_report | glow # Render with glow
|
574
546
|
```
|
575
547
|
|
576
|
-
|
548
|
+
### Tips from the Author
|
577
549
|
|
550
|
+
**Most Versatile Prompt:**
|
578
551
|
```bash
|
579
|
-
|
552
|
+
# ~/.prompts/ad_hoc.txt
|
580
553
|
[WHAT_NOW_HUMAN]
|
581
554
|
```
|
555
|
+
Usage: `aia ad_hoc` - perfect for any quick question without cluttering shell history.
|
582
556
|
|
583
|
-
|
584
|
-
|
585
|
-
## My Configuration
|
586
|
-
|
587
|
-
I use the `bash` shell. In my `.bashrc` file I source another file named `.bashrc__aia` which looks like this:
|
588
|
-
|
557
|
+
**Recommended Shell Setup:**
|
589
558
|
```bash
|
590
|
-
# ~/.
|
591
|
-
# AI Assistant
|
592
|
-
|
593
|
-
# These are the defaults:
|
559
|
+
# ~/.bashrc_aia
|
594
560
|
export AIA_PROMPTS_DIR=~/.prompts
|
595
561
|
export AIA_OUT_FILE=./temp.md
|
596
|
-
export AIA_LOG_FILE=$AIA_PROMPTS_DIR/_prompts.log
|
597
562
|
export AIA_MODEL=gpt-4o-mini
|
598
|
-
|
599
|
-
# Not a default. Invokes spinner. If not true then there is no spinner
|
600
|
-
# for feedback while waiting for the LLM to respond.
|
601
|
-
export AIA_VERBOSE=true
|
563
|
+
export AIA_VERBOSE=true # Shows spinner while waiting
|
602
564
|
|
603
565
|
alias chat='aia --chat --terse'
|
604
|
-
|
605
|
-
# rest of the file is the completion function
|
566
|
+
alias ask='aia ad_hoc'
|
606
567
|
```
|
607
568
|
|
569
|
+
**Prompt Organization:**
|
570
|
+
```
|
571
|
+
~/.prompts/
|
572
|
+
├── daily/ # Daily workflow prompts
|
573
|
+
├── development/ # Coding and review prompts
|
574
|
+
├── research/ # Research and analysis
|
575
|
+
├── roles/ # System prompts
|
576
|
+
└── workflows/ # Multi-step pipelines
|
577
|
+
```
|
608
578
|
|
579
|
+
## Security Considerations
|
609
580
|
|
610
|
-
|
581
|
+
### Shell Command Execution
|
611
582
|
|
612
|
-
|
583
|
+
**⚠️ Important Security Warning**
|
613
584
|
|
614
|
-
|
615
|
-
# ~/.prompts/run.txt
|
616
|
-
# Desc: Run executable prompts coming in via STDIN
|
617
|
-
```
|
585
|
+
AIA executes shell commands and Ruby code embedded in prompts. This provides powerful functionality but requires caution:
|
618
586
|
|
619
|
-
|
587
|
+
- **Review prompts before execution**, especially from untrusted sources
|
588
|
+
- **Avoid storing sensitive data** in prompts (API keys, passwords)
|
589
|
+
- **Use parameterized prompts** instead of hardcoding sensitive values
|
590
|
+
- **Limit file permissions** on prompt directories if sharing systems
|
620
591
|
|
621
|
-
|
592
|
+
### Safe Practices
|
622
593
|
|
623
594
|
```bash
|
624
|
-
|
625
|
-
|
626
|
-
# Desc: The tope 10 cities by population
|
595
|
+
# ✅ Good: Use parameters for sensitive data
|
596
|
+
//config api_key = [API_KEY]
|
627
597
|
|
628
|
-
|
629
|
-
|
630
|
-
links to the Wikipedia pages. Format your response as a markdown document.
|
631
|
-
```
|
598
|
+
# ❌ Bad: Hardcode secrets
|
599
|
+
//config api_key = sk-1234567890abcdef
|
632
600
|
|
633
|
-
|
601
|
+
# ✅ Good: Validate shell commands
|
602
|
+
//shell ls -la /safe/directory
|
634
603
|
|
635
|
-
|
636
|
-
|
604
|
+
# ❌ Bad: Dangerous shell commands
|
605
|
+
//shell rm -rf / # Never do this!
|
637
606
|
```
|
638
607
|
|
639
|
-
|
640
|
-
|
641
|
-
Now just execute it like any other command in your terminal.
|
608
|
+
### Recommended Security Setup
|
642
609
|
|
643
610
|
```bash
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
Since its output is going to STDOUT you can setup a pipe chain. Using the CLI program `glow` to render markdown in the terminal
|
648
|
-
(brew install glow)
|
611
|
+
# Set restrictive permissions on prompts directory
|
612
|
+
chmod 700 ~/.prompts
|
613
|
+
chmod 600 ~/.prompts/*.txt
|
649
614
|
|
650
|
-
|
651
|
-
|
615
|
+
# Use separate prompts directory for shared/untrusted prompts
|
616
|
+
export AIA_PROMPTS_DIR_SHARED=~/shared-prompts
|
617
|
+
chmod 755 ~/shared-prompts
|
652
618
|
```
|
653
619
|
|
654
|
-
|
655
|
-
|
656
|
-
## Usage
|
620
|
+
## Troubleshooting
|
657
621
|
|
658
|
-
|
622
|
+
### Common Issues
|
659
623
|
|
624
|
+
**Prompt not found:**
|
660
625
|
```bash
|
661
|
-
|
662
|
-
|
626
|
+
# Check prompts directory
|
627
|
+
ls $AIA_PROMPTS_DIR
|
663
628
|
|
664
|
-
|
629
|
+
# Verify prompt file exists
|
630
|
+
ls ~/.prompts/my_prompt.txt
|
665
631
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
- `--role ROLE`: Specify a role/system prompt
|
670
|
-
- And many more (use --help to see all options)
|
632
|
+
# Use fuzzy search
|
633
|
+
aia --fuzzy
|
634
|
+
```
|
671
635
|
|
672
|
-
**
|
636
|
+
**Model errors:**
|
637
|
+
```bash
|
638
|
+
# List available models
|
639
|
+
aia --available_models
|
673
640
|
|
674
|
-
|
641
|
+
# Check model name spelling
|
642
|
+
aia --model gpt-4o # Correct
|
643
|
+
aia --model gpt4 # Incorrect
|
644
|
+
```
|
675
645
|
|
676
|
-
**
|
677
|
-
|
646
|
+
**Shell integration not working:**
|
647
|
+
```bash
|
648
|
+
# Verify shell patterns
|
649
|
+
echo "Test: $(date)" # Should show current date
|
650
|
+
echo "Home: $HOME" # Should show home directory
|
651
|
+
```
|
678
652
|
|
679
|
-
**
|
680
|
-
|
653
|
+
**Configuration issues:**
|
654
|
+
```bash
|
655
|
+
# Check current configuration
|
656
|
+
aia --config
|
681
657
|
|
682
|
-
|
658
|
+
# Debug configuration loading
|
659
|
+
aia --debug --config
|
660
|
+
```
|
683
661
|
|
684
|
-
|
662
|
+
### Error Messages
|
685
663
|
|
686
|
-
|
664
|
+
| Error | Cause | Solution |
|
665
|
+
|-------|-------|----------|
|
666
|
+
| "Prompt not found" | Missing prompt file | Check file exists and spelling |
|
667
|
+
| "Model not available" | Invalid model name | Use `--available_models` to list valid models |
|
668
|
+
| "Shell command failed" | Invalid shell syntax | Test shell commands separately first |
|
669
|
+
| "Configuration error" | Invalid config syntax | Check config file YAML syntax |
|
687
670
|
|
688
|
-
|
671
|
+
### Debug Mode
|
689
672
|
|
690
|
-
|
673
|
+
Enable debug output for troubleshooting:
|
691
674
|
|
692
|
-
|
693
|
-
|
694
|
-
|
675
|
+
```bash
|
676
|
+
# Enable debug mode
|
677
|
+
aia --debug my_prompt
|
695
678
|
|
696
|
-
|
679
|
+
# Combine with verbose for maximum output
|
680
|
+
aia --debug --verbose my_prompt
|
681
|
+
```
|
697
682
|
|
698
|
-
|
683
|
+
### Performance Issues
|
699
684
|
|
700
|
-
|
685
|
+
**Slow model responses:**
|
686
|
+
- Try smaller/faster models: `--model gpt-4o-mini`
|
687
|
+
- Reduce max_tokens: `--max_tokens 1000`
|
688
|
+
- Use lower temperature for faster responses: `--temperature 0.1`
|
701
689
|
|
702
|
-
|
690
|
+
**Large prompt processing:**
|
691
|
+
- Break into smaller prompts using `--pipeline`
|
692
|
+
- Use `//include` selectively instead of large files
|
693
|
+
- Consider model context limits
|
703
694
|
|
704
|
-
|
705
|
-
- Executing system commands
|
706
|
-
- Accessing external APIs
|
707
|
-
- Performing calculations
|
695
|
+
## Development
|
708
696
|
|
709
|
-
|
697
|
+
### Testing
|
710
698
|
|
711
|
-
|
699
|
+
```bash
|
700
|
+
# Run unit tests
|
701
|
+
rake test
|
712
702
|
|
713
|
-
|
703
|
+
# Run integration tests
|
704
|
+
rake integration
|
714
705
|
|
715
|
-
|
706
|
+
# Run all tests with coverage
|
707
|
+
rake all_tests
|
708
|
+
open coverage/index.html
|
709
|
+
```
|
716
710
|
|
717
|
-
|
711
|
+
### Building
|
718
712
|
|
719
713
|
```bash
|
720
|
-
#
|
721
|
-
|
722
|
-
|
723
|
-
# Or use multiple --tools flags
|
724
|
-
--tools my_first_tool.rb --tools /tool_repo/tools
|
725
|
-
```
|
714
|
+
# Install locally with documentation
|
715
|
+
just install
|
726
716
|
|
727
|
-
|
717
|
+
# Generate documentation
|
718
|
+
just gen_doc
|
728
719
|
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
Supporting files for tools can be placed in the same directory or subdirectories.
|
720
|
+
# Static code analysis
|
721
|
+
just flay
|
722
|
+
```
|
733
723
|
|
734
|
-
###
|
724
|
+
### Architecture Notes
|
735
725
|
|
736
|
-
|
726
|
+
**ShellCommandExecutor Refactor:**
|
727
|
+
The `ShellCommandExecutor` is now a class (previously a module) with instance variables for cleaner encapsulation. Class-level methods remain for backward compatibility.
|
737
728
|
|
738
|
-
|
729
|
+
**Prompt Variable Fallback:**
|
730
|
+
Variables are always parsed from prompt text when no `.json` history file exists, ensuring parameter prompting works correctly.
|
739
731
|
|
740
|
-
|
732
|
+
## Contributing
|
741
733
|
|
742
|
-
|
743
|
-
# Only allow tools with 'test' in their filename
|
744
|
-
--tools my_tools_directory --allowed_tools test
|
745
|
-
```
|
734
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MadBomber/aia.
|
746
735
|
|
747
|
-
|
736
|
+
### Reporting Issues
|
748
737
|
|
749
|
-
|
738
|
+
When reporting issues, please include:
|
739
|
+
- AIA version: `aia --version`
|
740
|
+
- Ruby version: `ruby --version`
|
741
|
+
- Operating system
|
742
|
+
- Minimal reproduction example
|
743
|
+
- Error messages and debug output
|
750
744
|
|
751
|
-
|
745
|
+
### Development Setup
|
752
746
|
|
753
747
|
```bash
|
754
|
-
|
755
|
-
|
748
|
+
git clone https://github.com/MadBomber/aia.git
|
749
|
+
cd aia
|
750
|
+
bundle install
|
751
|
+
rake test
|
756
752
|
```
|
757
753
|
|
758
|
-
|
759
|
-
|
760
|
-
### Creating Your Own Tools
|
761
|
-
|
762
|
-
To create a custom tool:
|
754
|
+
### Areas for Improvement
|
763
755
|
|
764
|
-
|
765
|
-
|
766
|
-
|
756
|
+
- Configuration UI for complex setups
|
757
|
+
- Better error handling and user feedback
|
758
|
+
- Performance optimization for large prompt libraries
|
759
|
+
- Enhanced security controls for shell integration
|
767
760
|
|
768
|
-
|
769
|
-
|
770
|
-
## MCP Supported
|
761
|
+
## Roadmap
|
771
762
|
|
772
|
-
|
763
|
+
- **Enhanced Search**: Restore full-text search within prompt files
|
764
|
+
- **Model Context Protocol**: Continue integration with ruby_llm gem
|
765
|
+
- **UI Improvements**: Better configuration management for fzf and rg tools
|
766
|
+
- **Performance**: Optimize prompt loading and processing
|
767
|
+
- **Security**: Enhanced sandboxing for shell command execution
|
773
768
|
|
774
769
|
## License
|
775
770
|
|