aias 0.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 +7 -0
- data/.envrc +1 -0
- data/.github/workflows/deploy-github-pages.yml +52 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +140 -0
- data/COMMITS.md +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +249 -0
- data/Rakefile +27 -0
- data/aia_schedule_idea.md +256 -0
- data/docs/assets/images/logo.jpg +0 -0
- data/docs/cli/add.md +101 -0
- data/docs/cli/check.md +70 -0
- data/docs/cli/clear.md +45 -0
- data/docs/cli/dry-run.md +57 -0
- data/docs/cli/index.md +51 -0
- data/docs/cli/install.md +198 -0
- data/docs/cli/last.md +49 -0
- data/docs/cli/list.md +40 -0
- data/docs/cli/next.md +49 -0
- data/docs/cli/remove.md +87 -0
- data/docs/cli/show.md +54 -0
- data/docs/cli/uninstall.md +29 -0
- data/docs/cli/update.md +75 -0
- data/docs/getting-started/installation.md +69 -0
- data/docs/getting-started/quick-start.md +105 -0
- data/docs/guides/configuration-layering.md +168 -0
- data/docs/guides/cron-environment.md +112 -0
- data/docs/guides/scheduling-prompts.md +319 -0
- data/docs/guides/understanding-cron.md +134 -0
- data/docs/guides/validation.md +114 -0
- data/docs/index.md +100 -0
- data/docs/reference/api.md +409 -0
- data/docs/reference/architecture.md +122 -0
- data/docs/reference/environment.md +67 -0
- data/docs/reference/logging.md +73 -0
- data/example_prompts/code_health_check.md +51 -0
- data/example_prompts/daily_digest.md +19 -0
- data/example_prompts/morning_standup.md +19 -0
- data/example_prompts/reports/monthly_review.md +44 -0
- data/example_prompts/reports/weekly_summary.md +22 -0
- data/example_prompts/you_are_good.md +22 -0
- data/exe/aias +5 -0
- data/lib/aias/block_parser.rb +42 -0
- data/lib/aias/cli/add.rb +30 -0
- data/lib/aias/cli/check.rb +50 -0
- data/lib/aias/cli/clear.rb +11 -0
- data/lib/aias/cli/dry_run.rb +24 -0
- data/lib/aias/cli/install.rb +57 -0
- data/lib/aias/cli/last.rb +26 -0
- data/lib/aias/cli/list.rb +20 -0
- data/lib/aias/cli/next.rb +28 -0
- data/lib/aias/cli/remove.rb +14 -0
- data/lib/aias/cli/show.rb +18 -0
- data/lib/aias/cli/uninstall.rb +15 -0
- data/lib/aias/cli/update.rb +30 -0
- data/lib/aias/cli/version.rb +10 -0
- data/lib/aias/cli.rb +91 -0
- data/lib/aias/cron_describer.rb +142 -0
- data/lib/aias/crontab_manager.rb +140 -0
- data/lib/aias/env_file.rb +75 -0
- data/lib/aias/job_builder.rb +56 -0
- data/lib/aias/paths.rb +14 -0
- data/lib/aias/prompt_scanner.rb +111 -0
- data/lib/aias/schedule_config.rb +31 -0
- data/lib/aias/validator.rb +101 -0
- data/lib/aias/version.rb +5 -0
- data/lib/aias.rb +17 -0
- data/mkdocs.yml +137 -0
- data/sig/aias.rbs +4 -0
- metadata +191 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
Get a prompt running on a schedule in under five minutes.
|
|
4
|
+
|
|
5
|
+
## Step 1 — Capture Your Environment
|
|
6
|
+
|
|
7
|
+
Run this once after installing `aias`:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
aias install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This snapshots your current shell's `PATH`, API keys, and `AIA_*` variables into `~/.config/aia/schedule/env.sh`. Every cron job sources that file so `aia` and its dependencies are available at run time.
|
|
14
|
+
|
|
15
|
+
Re-run `aias install` whenever you rotate an API key, install a new MCP server binary, or change your Ruby version.
|
|
16
|
+
|
|
17
|
+
See [Cron Environment](../guides/cron-environment.md) for full details.
|
|
18
|
+
|
|
19
|
+
## Step 2 — Add a `schedule:` Key to a Prompt
|
|
20
|
+
|
|
21
|
+
Open any AIA prompt file (`.md` in your prompts directory) and add a `schedule:` key to its YAML frontmatter:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
---
|
|
25
|
+
description: Morning digest
|
|
26
|
+
schedule: "0 8 * * *"
|
|
27
|
+
---
|
|
28
|
+
Summarize what happened overnight in the Ruby and AI ecosystems.
|
|
29
|
+
Keep the summary under 300 words.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The `schedule:` value accepts either a raw cron expression or a natural-language string. See [Scheduling Prompts](../guides/scheduling-prompts.md) for the full syntax.
|
|
33
|
+
|
|
34
|
+
## Step 3 — Preview the Crontab Entry
|
|
35
|
+
|
|
36
|
+
Before writing anything, see what `aias` would install:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
aias dry-run
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Example output:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
0 8 * * * /bin/bash -c 'source ~/.config/aia/schedule/env.sh && \
|
|
46
|
+
aia --prompts-dir /Users/you/.prompts \
|
|
47
|
+
--config ~/.config/aia/schedule/aia.yml \
|
|
48
|
+
daily_digest > ~/.config/aia/schedule/logs/daily_digest.log 2>&1'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Step 4 — Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
aias update
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`aias` scans every prompt file, validates the scheduled ones, and replaces the entire `aias`-managed block in your crontab:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
aias: installed 1 job(s)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Step 5 — Confirm
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
aias list
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
PROMPT ID SCHEDULE LOG
|
|
71
|
+
------------------------------ --------------- -----------------------------------------------
|
|
72
|
+
daily_digest 0 8 * * * /Users/you/.config/aia/schedule/logs/daily_digest.log
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
aias check
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
When everything is in sync:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
=== aias check ===
|
|
83
|
+
|
|
84
|
+
OK — crontab is in sync with scheduled prompts
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Step 6 — Add More Prompts (Optional)
|
|
88
|
+
|
|
89
|
+
Every `aias update` is a full sync. Add `schedule:` to more prompts, then run `update` again — new prompts are added, removed prompts are cleaned up automatically.
|
|
90
|
+
|
|
91
|
+
## What Happens at Runtime
|
|
92
|
+
|
|
93
|
+
When cron fires the job:
|
|
94
|
+
|
|
95
|
+
1. `env.sh` is sourced — PATH, API keys, and AIA variables are set
|
|
96
|
+
2. `aia` is invoked with the prompts directory and schedule config
|
|
97
|
+
3. AIA reads the prompt file, merges its frontmatter over the schedule config
|
|
98
|
+
4. The prompt runs using the model and settings defined in the frontmatter (or the schedule config defaults)
|
|
99
|
+
5. All output is written to `~/.config/aia/schedule/logs/<prompt_id>.log`
|
|
100
|
+
|
|
101
|
+
See [Configuration Layering](../guides/configuration-layering.md) for how `env.sh`, the schedule config, and prompt frontmatter combine.
|
|
102
|
+
|
|
103
|
+
## Disabling a Prompt
|
|
104
|
+
|
|
105
|
+
Remove or comment out the `schedule:` line, then run `aias update`. The orphaned crontab entry is removed automatically.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Configuration Layering
|
|
2
|
+
|
|
3
|
+
Every `aias`-scheduled job is configured through three independent layers that AIA merges at runtime. Understanding those layers — and their precedence — is the key to writing prompts that work reliably in a cron context.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
env.sh ← Layer 1: runtime environment
|
|
7
|
+
schedule/aia.yml ← Layer 2: base AIA configuration for all scheduled jobs
|
|
8
|
+
prompt frontmatter ← Layer 3: per-prompt overrides (wins over everything)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Frontmatter always wins. The schedule config provides defaults. `env.sh` makes the process runnable.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Layer 1 — env.sh
|
|
16
|
+
|
|
17
|
+
**File:** `~/.config/aia/schedule/env.sh`
|
|
18
|
+
**Purpose:** Reproduce the environment that existed when `aias install` was run.
|
|
19
|
+
|
|
20
|
+
Cron starts processes with a nearly empty environment: no Ruby version manager, no user-defined variables, no API keys. `env.sh` is sourced before every cron invocation, injecting the values AIA and its dependencies need:
|
|
21
|
+
|
|
22
|
+
| What it provides | Why it matters |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `PATH` | rbenv/asdf shims, gem bin dirs, MCP server binaries |
|
|
25
|
+
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, etc. | LLM API authentication |
|
|
26
|
+
| `AIA_*` variables | AIA runtime defaults (`AIA_PROMPTS__DIR`, `AIA_MODEL`, etc.) |
|
|
27
|
+
| `LANG`, `LC_ALL` | UTF-8 encoding for Ruby string handling |
|
|
28
|
+
|
|
29
|
+
**Populated by:** `aias install` — run once (or re-run when your shell environment changes). If you add a new API key or install a new MCP server binary, re-run `aias install` to capture it.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Layer 2 — Schedule config
|
|
34
|
+
|
|
35
|
+
**File:** `~/.config/aia/schedule/aia.yml`
|
|
36
|
+
**Purpose:** Base AIA configuration shared by all scheduled prompts.
|
|
37
|
+
|
|
38
|
+
Passed to every cron entry via the `--config` flag:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
aia --prompts-dir /path/to/prompts --config ~/.config/aia/schedule/aia.yml you_are_good
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When `--config` is used, AIA resets to its built-in defaults and loads this file. Your interactive `~/.config/aia/aia.yml` is **not** read during scheduled runs — the schedule config replaces it entirely. This isolation is intentional: scheduled jobs should not be affected by changes to your interactive configuration.
|
|
45
|
+
|
|
46
|
+
The schedule config sets:
|
|
47
|
+
|
|
48
|
+
| Setting | Typical value | What it does |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `llm.adapter` | `ruby_llm` | Default AI backend |
|
|
51
|
+
| `models` | `claude-haiku-4-5` | Default model (low cost, fast) |
|
|
52
|
+
| `llm.temperature`, `max_tokens` | base LLM parameters | Applied unless overridden by frontmatter |
|
|
53
|
+
| `output.append` | `false` | Each run overwrites the output file |
|
|
54
|
+
| `logging.llm.level` | `warn` | Log only warnings from the LLM layer |
|
|
55
|
+
| `logging.mcp.level` | `warn` | Log only warnings from MCP |
|
|
56
|
+
| `mcp_servers` | github, brew, crimson, etc. | MCP tools available to all scheduled prompts |
|
|
57
|
+
| `require_libs` | `["shared_tools"]` | Libraries loaded for every scheduled run |
|
|
58
|
+
| `prompts.dir` | your prompts path | Fallback if `--prompts-dir` is not on the command line |
|
|
59
|
+
|
|
60
|
+
Keep the schedule config conservative. It should represent the minimum needed for any scheduled prompt to run. Per-prompt requirements go in the frontmatter.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Layer 3 — Prompt frontmatter
|
|
65
|
+
|
|
66
|
+
**File:** the prompt `.md` file itself
|
|
67
|
+
**Purpose:** Per-prompt overrides that make each prompt self-contained.
|
|
68
|
+
|
|
69
|
+
AIA reads the YAML frontmatter of the prompt file after loading the schedule config. Frontmatter keys override any matching key in the schedule config. A prompt should declare in its frontmatter everything that makes it different from the base config.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Worked Example: `you_are_good.md`
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
---
|
|
77
|
+
flags:
|
|
78
|
+
debug: true
|
|
79
|
+
verbose: true
|
|
80
|
+
provider: ollama
|
|
81
|
+
models:
|
|
82
|
+
- name: gpt-oss:latest
|
|
83
|
+
role:
|
|
84
|
+
schedule: every 2 minutes
|
|
85
|
+
required: ['shared_tools']
|
|
86
|
+
tools:
|
|
87
|
+
rejected: ['browser_tool']
|
|
88
|
+
---
|
|
89
|
+
You are a supportive coding mentor. Generate a single, original positive
|
|
90
|
+
affirmation sentence about my Ruby programming skills...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `flags: debug: true / verbose: true`
|
|
94
|
+
|
|
95
|
+
The schedule config sets `logging.llm.level: warn` and `logging.mcp.level: warn` — quiet output for most jobs. This prompt overrides that with full debug and verbose logging, producing a detailed log entry for every run. Useful for a prompt you want to keep an eye on, or while developing a new prompt.
|
|
96
|
+
|
|
97
|
+
### `provider: ollama`
|
|
98
|
+
|
|
99
|
+
The schedule config's `llm.adapter: ruby_llm` points at cloud providers by default (Anthropic, OpenAI, etc.). `provider: ollama` routes this prompt to a local Ollama server instead.
|
|
100
|
+
|
|
101
|
+
**Why this matters for scheduled jobs:** cloud API calls can fail with rate limits, transient network errors, or timeouts. A local Ollama model has none of those risks. There are also no API costs. For prompts that don't require GPT-4-level reasoning — affirmations, local system tasks, scripted workflows — a local model is more reliable in an unattended context.
|
|
102
|
+
|
|
103
|
+
### `models: [{name: gpt-oss:latest}]`
|
|
104
|
+
|
|
105
|
+
Selects the specific Ollama model to use. Overrides the schedule config's `claude-haiku-4-5` default. The model must be pulled and running in Ollama before the cron job fires.
|
|
106
|
+
|
|
107
|
+
### `schedule: every 2 minutes`
|
|
108
|
+
|
|
109
|
+
This key is read exclusively by `aias` when building the cron entry. AIA itself ignores it at runtime. It is what caused `aias add` to produce:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
0,2,4,6,8,...,58 * * * * /opt/homebrew/bin/bash -c '...'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `required: ['shared_tools']`
|
|
116
|
+
|
|
117
|
+
Loads the `shared_tools` library, which provides the `eval` tool (shell command execution). The schedule config already declares `require_libs: ["shared_tools"]` globally, so this is redundant for this prompt — but it makes the prompt self-documenting. A reader can tell from the frontmatter alone what the prompt needs.
|
|
118
|
+
|
|
119
|
+
The `eval` tool is what allows the model to execute `say "..."` as a macOS speech command.
|
|
120
|
+
|
|
121
|
+
### `tools: rejected: ['browser_tool']`
|
|
122
|
+
|
|
123
|
+
Prevents the browser tool from being offered to the model even if the active MCP servers expose it. The schedule config loads several MCP servers (GitHub, brew, crimson, claude_code). Some of those may expose browsing capabilities; `rejected` is the safety valve that keeps this prompt narrowly scoped to only what it needs: the `eval`/shell tool.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## The Full Execution Flow
|
|
128
|
+
|
|
129
|
+
When cron fires this entry:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
/opt/homebrew/bin/bash -c 'source ~/.config/aia/schedule/env.sh && \
|
|
133
|
+
/path/to/aia \
|
|
134
|
+
--prompts-dir /path/to/example_prompts \
|
|
135
|
+
--config ~/.config/aia/schedule/aia.yml \
|
|
136
|
+
you_are_good > ~/.config/aia/schedule/logs/you_are_good.log 2>&1'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
1. **`source env.sh`** — PATH, API keys, AIA_* vars, LANG/LC_ALL injected into the process environment
|
|
140
|
+
2. **`aia` starts** — loads built-in defaults, then loads `schedule/aia.yml` via `--config` (base config set)
|
|
141
|
+
3. **`--prompts-dir`** — tells AIA where to find prompt files, bypassing any stale `prompts.dir` in the config
|
|
142
|
+
4. **AIA locates `you_are_good.md`** in the prompts directory
|
|
143
|
+
5. **Frontmatter merged** — `provider: ollama`, `models: gpt-oss:latest`, `flags`, `required`, `tools.rejected` all applied on top of the schedule config
|
|
144
|
+
6. **`shared_tools` loaded** — `eval`/shell tool registered and available to the model
|
|
145
|
+
7. **Prompt sent to Ollama `gpt-oss:latest`** — no API call, no network, no cost
|
|
146
|
+
8. **Model generates affirmation**, then calls `eval` with `say "..."`
|
|
147
|
+
9. **macOS `say`** speaks the affirmation aloud
|
|
148
|
+
10. **All output** (verbose/debug + response) written to `~/.config/aia/schedule/logs/you_are_good.log`
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Keeping Layers Separate
|
|
153
|
+
|
|
154
|
+
A useful mental model: each layer answers a different question.
|
|
155
|
+
|
|
156
|
+
| Layer | Question it answers |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `env.sh` | Can the process find the tools it needs? |
|
|
159
|
+
| `schedule/aia.yml` | What are the safe defaults for any unattended job? |
|
|
160
|
+
| Prompt frontmatter | What does *this specific prompt* need that differs from those defaults? |
|
|
161
|
+
|
|
162
|
+
Settings that belong in the schedule config: output format, default model and adapter, log verbosity, MCP server list, libraries that every prompt uses.
|
|
163
|
+
|
|
164
|
+
Settings that belong in frontmatter: anything prompt-specific — provider override, a specialised model, flags for debugging, additional `required` libs, tool restrictions.
|
|
165
|
+
|
|
166
|
+
Settings that belong only in `env.sh`: secrets (API keys), PATH construction, locale.
|
|
167
|
+
|
|
168
|
+
Never put API keys in frontmatter or the schedule config. They would be committed to version control if you track your prompts in git.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Cron Environment
|
|
2
|
+
|
|
3
|
+
> New to cron? See [Understanding Cron and Crontab](understanding-cron.md) first.
|
|
4
|
+
|
|
5
|
+
Cron runs processes in a nearly empty environment: no `PATH` beyond `/usr/bin:/bin`, no Ruby version manager, no user-defined variables. Without intervention, `aia` would not be found and API keys would not be set, so every job would fail silently.
|
|
6
|
+
|
|
7
|
+
## How aias Solves This
|
|
8
|
+
|
|
9
|
+
`aias` captures your live shell environment into a file and sources it before every cron invocation. This is a one-time setup step:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
aias install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`install` reads your current session's environment and writes it to `~/.config/aia/schedule/env.sh`. Every generated cron entry sources that file before running `aia`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
0 8 * * * /bin/bash -c 'source ~/.config/aia/schedule/env.sh && \
|
|
19
|
+
aia --prompts-dir /path/to/prompts \
|
|
20
|
+
--config ~/.config/aia/schedule/aia.yml \
|
|
21
|
+
daily_digest > ~/.config/aia/schedule/logs/daily_digest.log 2>&1'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## What Gets Captured
|
|
25
|
+
|
|
26
|
+
`aias install` captures these variable groups by default:
|
|
27
|
+
|
|
28
|
+
| Group | Example variables |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `PATH` | The full path including rbenv/asdf shims, Homebrew, MCP server binaries |
|
|
31
|
+
| `*_API_KEY` | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, etc. |
|
|
32
|
+
| `AIA_*` | `AIA_PROMPTS__DIR`, `AIA_MODEL`, `AIA_FLAGS__VERBOSE`, etc. |
|
|
33
|
+
| `LANG`, `LC_ALL` | Locale settings (required for Ruby UTF-8 string handling) |
|
|
34
|
+
|
|
35
|
+
### Capturing Additional Variables
|
|
36
|
+
|
|
37
|
+
Pass glob patterns to `aias install` to capture additional variable groups:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
aias install 'OPENROUTER_*'
|
|
41
|
+
aias install 'AIA_*' 'MY_SERVICE_*'
|
|
42
|
+
aias install 'AIA_* OPENROUTER_*' # space-separated in a single argument
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Patterns are matched case-insensitively. Variables matching the default groups are always included regardless of patterns.
|
|
46
|
+
|
|
47
|
+
## Keeping env.sh Current
|
|
48
|
+
|
|
49
|
+
`env.sh` is a snapshot of your environment at the time `aias install` was run. Re-run `install` whenever:
|
|
50
|
+
|
|
51
|
+
- You rotate or add an API key
|
|
52
|
+
- You install a new MCP server binary (it needs to be on `PATH`)
|
|
53
|
+
- You change your Ruby version or version manager configuration
|
|
54
|
+
- You add or change an `AIA_*` variable
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
aias install # re-captures and overwrites the managed block in env.sh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The file uses `# BEGIN aias-env` / `# END aias-env` markers. If you add your own content to `env.sh` outside those markers it is preserved on every `install` run.
|
|
61
|
+
|
|
62
|
+
## Why Not a Login Shell?
|
|
63
|
+
|
|
64
|
+
An earlier version of `aias` used `-l` (login shell) to source the user's shell profile on each run. This was unreliable on macOS: `/usr/libexec/path_helper` — invoked by the login profile — unconditionally rebuilds `PATH` from `/etc/paths` and `/etc/paths.d/`, discarding any rbenv or asdf shims added earlier in the session. Version manager shims would disappear, `aia` would not be found, and jobs would fail.
|
|
65
|
+
|
|
66
|
+
The `env.sh` approach captures `PATH` at the moment you run `aias install` — when the correct, fully-activated PATH is already in place — and replays it verbatim in every cron invocation.
|
|
67
|
+
|
|
68
|
+
## Viewing the Captured Environment
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cat ~/.config/aia/schedule/env.sh
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The managed block looks like:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# BEGIN aias-env
|
|
78
|
+
export PATH="/Users/you/.rbenv/shims:/opt/homebrew/bin:/usr/bin:/bin"
|
|
79
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
80
|
+
export AIA_PROMPTS__DIR="/Users/you/.prompts"
|
|
81
|
+
export LANG="en_US.UTF-8"
|
|
82
|
+
export LC_ALL="en_US.UTF-8"
|
|
83
|
+
# END aias-env
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Removing the Captured Environment
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
aias uninstall
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Removes the managed block from `env.sh`. The rest of the file (and the rest of the schedule configuration) is preserved. Installed cron jobs are not removed — use `aias clear` for that.
|
|
93
|
+
|
|
94
|
+
## Troubleshooting
|
|
95
|
+
|
|
96
|
+
If a job is failing, check the log first:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cat ~/.config/aia/schedule/logs/daily_digest.log
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**`aia: command not found`**
|
|
103
|
+
The `aia` binary path captured in `env.sh` is no longer valid. Common cause: you changed Ruby versions or reinstalled gems. Fix: re-run `aias install`.
|
|
104
|
+
|
|
105
|
+
**Ruby encoding error (`"\xE2" on US-ASCII`)**
|
|
106
|
+
`LANG` or `LC_ALL` is missing from `env.sh`. Fix: re-run `aias install` from a terminal with a UTF-8 locale.
|
|
107
|
+
|
|
108
|
+
**API authentication error**
|
|
109
|
+
The API key in `env.sh` is expired or wrong. Fix: set the correct key in your shell, then re-run `aias install`.
|
|
110
|
+
|
|
111
|
+
**MCP server binary not found**
|
|
112
|
+
The binary was installed after the last `aias install`. Fix: re-run `aias install` to capture the updated `PATH`.
|