@action-llama/action-llama 0.13.5 → 0.13.7

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.
@@ -1,6 +1,6 @@
1
1
  # Action Llama Reference
2
2
 
3
- Action Llama is a CLI tool for running LLM agents as automated scripts. Agents run on cron schedules and/or in response to webhooks (GitHub, Sentry, Linear, Mintlify). Each agent is an LLM session that receives a system prompt (ACTIONS.md), gets credentials injected, and runs inside an isolated Docker container. The scheduler manages agent lifecycles, and a gateway HTTP server handles webhooks, resource locking, agent-to-agent calls, and an optional web dashboard.
3
+ CLI for running LLM agents on cron/webhooks. Docker isolation, ACTIONS.md prompt, credentials. Gateway: webhooks, locking, agent calls, dashboard.
4
4
 
5
5
  Package: `@action-llama/action-llama`. CLI binary: `al`.
6
6
 
@@ -19,38 +19,23 @@ my-project/
19
19
  Dockerfile # Custom Docker image for this agent (optional)
20
20
  ```
21
21
 
22
- Agent names are derived from the directory name. `"default"` is a reserved name and cannot be used as an agent name.
23
-
24
- ## Agent Docs
25
-
26
- | File | Scope | Purpose |
27
- |------|-------|---------|
28
- | `ACTIONS.md` | Per-agent (required) | System prompt injected as the LLM's system message at runtime |
29
- | `AGENTS.md` | Project root | Shared instructions loaded by `al chat` (interactive console only — not injected into automated runs) |
30
- | `CLAUDE.md` | Project root | Instructions for AI development tools (Claude Code, etc.). Not read by Action Llama at runtime. |
22
+ Agent names derive from directory name. `"default"` is reserved.
31
23
 
32
24
  ### ACTIONS.md — Writing Tips
33
25
 
34
- - Write as direct instructions to an LLM: "You are an automation agent. Your job is to..."
35
- - Use numbered steps for the workflow be specific about what commands to run
36
- - Reference `<agent-config>` for parameter values instead of hardcoding repo names, labels, etc.
37
- - Handle both trigger types if the agent uses both schedule and webhooks
38
- - Use `al-status` at natural milestones so operators can see progress in the TUI/dashboard
39
- - Use `al-rerun` when the agent completed work and there may be more items in the backlog
40
- - Keep it concise — the system prompt consumes tokens every run
26
+ - Direct LLM instructions; numbered steps; reference `<agent-config>` for params
27
+ - `al-status` at milestones, `al-rerun` when backlog remains; keep concise
41
28
 
42
29
  ## Prompt Assembly
43
30
 
44
- Understanding how the prompt is assembled is critical for writing effective ACTIONS.md files. The LLM receives two messages:
31
+ The LLM receives two messages:
45
32
 
46
33
  ### System message
47
34
 
48
- The contents of `ACTIONS.md` are sent as the system prompt. If the agent has locking or calling skills enabled (determined by the scheduler based on gateway availability and agent config), **skill blocks** are appended to teach the agent how to use those capabilities.
35
+ `ACTIONS.md` is the system prompt. With gateway, **skill blocks** appended:
49
36
 
50
37
  #### Locking skill block (injected when gateway is available)
51
38
 
52
- The following is prepended when the agent may need resource locking:
53
-
54
39
  ```xml
55
40
  <skill-lock>
56
41
  ## Skill: Resource Locking
@@ -99,8 +84,6 @@ rlock-heartbeat "github issue acme/app#42"
99
84
 
100
85
  #### Calling skill block (injected when gateway is available)
101
86
 
102
- The following is prepended when agent-to-agent calling is available:
103
-
104
87
  ```xml
105
88
  <skill-call>
106
89
  ## Skill: Agent-to-Agent Calls
@@ -150,11 +133,9 @@ echo "Line 1\nLine 2" | al-return
150
133
 
151
134
  ### User message
152
135
 
153
- The user message is built from a **static skeleton** (baked into the Docker image at build time) plus a **dynamic suffix** (passed at runtime based on trigger type).
136
+ Static skeleton + dynamic suffix. Static blocks:
154
137
 
155
- The static skeleton contains these XML blocks in order:
156
-
157
- **`<agent-config>`** — JSON of the `[params]` table from `agent-config.toml`:
138
+ **`<agent-config>`** `[params]` as JSON:
158
139
 
159
140
  ```xml
160
141
  <agent-config>
@@ -162,7 +143,7 @@ The static skeleton contains these XML blocks in order:
162
143
  </agent-config>
163
144
  ```
164
145
 
165
- **`<credential-context>`** — Lists available environment variables and tools based on the agent's credentials. Also includes git clone protocol guidance and the anti-exfiltration policy:
146
+ **`<credential-context>`** — env vars, tools, anti-exfiltration:
166
147
 
167
148
  ```xml
168
149
  <credential-context>
@@ -183,7 +164,7 @@ Use standard tools directly: `gh` CLI, `git`, `curl`.
183
164
  </credential-context>
184
165
  ```
185
166
 
186
- **`<environment>`** — Filesystem constraints:
167
+ **`<environment>`** — Filesystem:
187
168
 
188
169
  ```xml
189
170
  <environment>
@@ -194,7 +175,7 @@ All write operations (git clone, file creation, etc.) must target `/tmp`.
194
175
  </environment>
195
176
  ```
196
177
 
197
- **Dynamic suffix** — appended based on trigger type:
178
+ **Dynamic suffix** — by trigger type:
198
179
 
199
180
  | Trigger | Suffix |
200
181
  |---------|--------|
@@ -203,7 +184,7 @@ All write operations (git clone, file creation, etc.) must target `/tmp`.
203
184
  | Webhook | `<webhook-trigger>` block with event JSON, then `"A webhook event just fired. Review the trigger context above and take appropriate action."` |
204
185
  | Agent call | `<agent-call>` block with caller/context JSON, then `"You were called by the "<name>" agent. Review the call context above, do the requested work, and use al-return to send back your result."` |
205
186
 
206
- **`<webhook-trigger>`** example (webhook runs only):
187
+ **`<webhook-trigger>`** example:
207
188
 
208
189
  ```json
209
190
  {
@@ -225,7 +206,7 @@ All write operations (git clone, file creation, etc.) must target `/tmp`.
225
206
  }
226
207
  ```
227
208
 
228
- **`<agent-call>`** example (agent call runs only):
209
+ **`<agent-call>`** example:
229
210
 
230
211
  ```json
231
212
  {
@@ -236,7 +217,7 @@ All write operations (git clone, file creation, etc.) must target `/tmp`.
236
217
 
237
218
  ## config.toml
238
219
 
239
- The project-level `config.toml` lives at the root of your Action Llama project. All sections and fields are optional — sensible defaults are used for anything you omit.
220
+ Project root. All sections optional — sensible defaults apply.
240
221
 
241
222
  ### Full Annotated Example
242
223
 
@@ -302,7 +283,7 @@ endpoint = "https://telemetry.example.com/v1" # OpenTelemetry endpoint
302
283
 
303
284
  ### `[model]` — Default LLM
304
285
 
305
- Default model configuration inherited by all agents that don't define their own `[model]` section in `agent-config.toml`.
286
+ Default for agents without `[model]` in agent-config.
306
287
 
307
288
  | Field | Type | Required | Description |
308
289
  |-------|------|----------|-------------|
@@ -313,7 +294,7 @@ Default model configuration inherited by all agents that don't define their own
313
294
 
314
295
  ### `[local]` — Docker Container Settings
315
296
 
316
- Controls local Docker container isolation.
297
+ Local Docker container settings.
317
298
 
318
299
  | Field | Type | Default | Description |
319
300
  |-------|------|---------|-------------|
@@ -324,7 +305,7 @@ Controls local Docker container isolation.
324
305
 
325
306
  ### `[gateway]` — HTTP Server
326
307
 
327
- The gateway starts automatically when Docker mode or webhooks are enabled. It handles health checks, webhook reception, credential serving (local Docker only), resource locking, and the shutdown kill switch.
308
+ Starts automatically when Docker mode or webhooks enabled.
328
309
 
329
310
  | Field | Type | Default | Description |
330
311
  |-------|------|---------|-------------|
@@ -333,14 +314,14 @@ The gateway starts automatically when Docker mode or webhooks are enabled. It ha
333
314
 
334
315
  ### `[webhooks.<name>]` — Webhook Sources
335
316
 
336
- Named webhook sources that agents can reference in their `[[webhooks]]` triggers. Each source defines a provider type and an optional credential for signature validation.
317
+ Named sources agents reference in `[[webhooks]]` triggers.
337
318
 
338
319
  | Field | Type | Required | Description |
339
320
  |-------|------|----------|-------------|
340
321
  | `type` | string | Yes | Provider type: `"github"`, `"sentry"`, `"linear"`, or `"mintlify"` |
341
- | `credential` | string | No | Credential instance name for HMAC signature validation (e.g. `"MyOrg"` maps to `github_webhook_secret:MyOrg`). Omit for unsigned webhooks. |
322
+ | `credential` | string | No | Instance name for HMAC validation (e.g. `"MyOrg"` -> `github_webhook_secret:MyOrg`). Omit for unsigned. |
342
323
 
343
- Agents reference these sources by name in their `agent-config.toml`:
324
+ Agents reference by name:
344
325
 
345
326
  ```toml
346
327
  [[webhooks]]
@@ -356,7 +337,7 @@ events = ["issues"]
356
337
 
357
338
  ## agent-config.toml
358
339
 
359
- Each agent has an `agent-config.toml` file in its directory. The agent name is derived from the directory name and should not be included in the config.
340
+ Per-agent config. Name derives from directory.
360
341
 
361
342
  ### Full Annotated Example
362
343
 
@@ -458,41 +439,25 @@ sentryProjects = ["web-app", "api"]
458
439
  | `preflight` | array | No | Array of preflight steps that run before the LLM session. |
459
440
  | `params` | table | No | Custom key-value params injected into the prompt as `<agent-config>` |
460
441
 
461
- *At least one of `schedule` or `webhooks` is required (unless `scale = 0`). *Required within `[model]` if the agent defines its own model block (otherwise inherits from project `config.toml`).
442
+ *Need `schedule` or `webhooks` (unless `scale=0`). *Required in `[model]` if defined.
462
443
 
463
444
  ### Scale
464
445
 
465
- The `scale` field controls how many instances of an agent can run concurrently.
466
-
467
- - **Default**: 1 (only one instance can run at a time)
468
- - **Minimum**: 0 (disables the agent — no runners, cron jobs, or webhook bindings are created)
469
- - **Maximum**: No hard limit, but consider system resources and model API rate limits
470
-
471
- How it works:
472
-
473
- 1. **Scheduled runs**: If a cron trigger fires but all agent instances are busy, the scheduled run is skipped with a warning
474
- 2. **Webhook events**: If a webhook arrives but all instances are busy, the event is queued (up to `workQueueSize` limit in global config, default: 100)
475
- 3. **Agent calls**: If one agent calls another but all target instances are busy, the call is queued in the same work queue
476
-
477
- Each parallel instance uses a separate Docker container, has independent logging, and may consume LLM API quota concurrently.
446
+ Default: 1. Set 0 to disable. Busy: scheduled skipped, webhooks/calls queued.
478
447
 
479
448
  ### Timeout
480
449
 
481
- The `timeout` field controls the maximum runtime for an agent invocation. When the timeout expires, the container is terminated with exit code 124.
482
-
483
- **Resolution order:** `agent-config.toml timeout` → `config.toml [local].timeout` → `900` (default)
450
+ Max runtime per invocation. Container terminated with exit 124 on expiry.
484
451
 
485
- This means you can set a project-wide default in `[local].timeout` and override it per-agent.
452
+ Resolves: agent -> project `[local].timeout` -> `900`.
486
453
 
487
454
  ### Preflight
488
455
 
489
- Preflight steps run mechanical data-staging tasks after credentials are loaded but before the LLM session starts. They fetch data, clone repos, or run commands to prepare the workspace so the agent starts with everything it needs — instead of spending tokens fetching context at runtime.
456
+ Stage data after credentials load, before LLM session.
490
457
 
491
- Steps run **sequentially** in the order they appear in `agent-config.toml`, **inside the container** (or host process in `--no-docker` mode) after credential/env setup. Providers write files to disk — your ACTIONS.md references the staged files.
458
+ Sequential, inside container. `${VAR_NAME}` interpolation in params.
492
459
 
493
- Environment variable interpolation is supported: `${VAR_NAME}` in string params is resolved against `process.env` (which already has credentials injected).
494
-
495
- Each `[[preflight]]` entry has these fields:
460
+ Fields:
496
461
 
497
462
  | Field | Type | Required | Description |
498
463
  |-------|------|----------|-------------|
@@ -502,7 +467,7 @@ Each `[[preflight]]` entry has these fields:
502
467
 
503
468
  #### `shell` provider
504
469
 
505
- Runs a command via `/bin/sh`. Optionally captures stdout to a file.
470
+ Runs a command via `/bin/sh`.
506
471
 
507
472
  | Param | Type | Required | Description |
508
473
  |-------|------|----------|-------------|
@@ -519,7 +484,7 @@ output = "/tmp/context/issues.json"
519
484
 
520
485
  #### `http` provider
521
486
 
522
- Fetches a URL and writes the response body to a file.
487
+ Fetches a URL, writes response to file.
523
488
 
524
489
  | Param | Type | Required | Description |
525
490
  |-------|------|----------|-------------|
@@ -541,7 +506,7 @@ headers = { Authorization = "Bearer ${INTERNAL_TOKEN}" }
541
506
 
542
507
  #### `git-clone` provider
543
508
 
544
- Clones a git repository. Short `"owner/repo"` names are expanded to `git@github.com:owner/repo.git`; full URLs are passed through. Git credentials (SSH key, HTTPS token) are already configured from the agent's credentials.
509
+ `"owner/repo"` expands to `git@github.com:owner/repo.git`.
545
510
 
546
511
  | Param | Type | Required | Description |
547
512
  |-------|------|----------|-------------|
@@ -560,14 +525,11 @@ branch = "main"
560
525
  depth = 1
561
526
  ```
562
527
 
563
- Notes:
564
- - The `shell` provider is the escape hatch — anything a built-in provider doesn't cover can be expressed as a shell command
565
- - There is no per-step timeout — steps are bounded by the container-level timeout
566
- - Environment variables set inside `shell` child processes do not propagate back to the agent's `process.env`
528
+ `shell` is the escape hatch. No per-step timeout. Shell env vars don't propagate back (see [Environment variable persistence](#environment-variable-persistence) for a workaround).
567
529
 
568
530
  ### Webhook Trigger Fields
569
531
 
570
- Each `[[webhooks]]` entry has a required `source` field referencing a named webhook source from the project's `config.toml`. All filter fields below are optional. Omit all of them to trigger on everything from that source. All specified filters use AND logic — all must match for the agent to trigger.
532
+ Required `source` from `config.toml`. Filters optional (AND logic).
571
533
 
572
534
  | Field | Type | Required | Description |
573
535
  |-------|------|----------|-------------|
@@ -614,68 +576,19 @@ Each `[[webhooks]]` entry has a required `source` field referencing a named webh
614
576
  | `actions` | string[] | Event actions: failed, succeeded, etc. |
615
577
  | `branches` | string[] | Only for these branches |
616
578
 
617
- ### TOML Syntax Reminders
618
-
619
- - Strings: `key = "value"`
620
- - Arrays: `key = ["a", "b"]`
621
- - Tables (objects): `[tableName]` on its own line, followed by key-value pairs
622
- - Array of tables: `[[arrayName]]` on its own line — each block is one entry in the array
623
- - Inline tables: `headers = { Authorization = "Bearer ${TOKEN}" }`
624
- - Comments: `# comment`
625
-
626
- Example with multiple webhooks (each `[[webhooks]]` is a separate trigger):
627
-
628
- ```toml
629
- [[webhooks]]
630
- source = "my-github"
631
- events = ["issues"]
632
- actions = ["labeled"]
633
- labels = ["agent"]
634
-
635
- [[webhooks]]
636
- source = "my-github"
637
- events = ["pull_request"]
638
-
639
- [[webhooks]]
640
- source = "my-sentry"
641
- resources = ["error", "event_alert"]
642
- ```
643
-
644
579
  ### Model Configuration
645
580
 
646
- The `[model]` section is optional — agents inherit the default model from the project's `config.toml`. Only add `[model]` to an agent config if you want to override the default for that specific agent. If an agent defines its own `[model]` section, it fully overrides the project default — there is no field-level merging.
581
+ Optional. If defined, fully overrides project default (no merging).
647
582
 
648
583
  ## Credentials
649
584
 
650
- Credentials are stored in `~/.action-llama/credentials/<type>/<instance>/<field>`. Each credential type is a directory containing one file per field. Reference them in `agent-config.toml` by type name (e.g. `"github_token"`) for the `default` instance, or use `"type:instance"` for a named instance (e.g. `"git_ssh:botty"`).
585
+ Path: `~/.action-llama/credentials/<type>/<instance>/<field>`.
651
586
 
652
- **IMPORTANT:** Agents MUST NEVER ask users for credentials directly (API keys, tokens, passwords, etc.). Agents MUST NEVER run `al doctor` or interact with the credential system on behalf of the user. If a credential is missing at runtime, the agent should report the error and stop — the user will run `al doctor` and `al start` themselves.
587
+ **Agents MUST NEVER ask for credentials or run `al doctor`. Missing = report and stop.**
653
588
 
654
589
  ### How credentials work
655
590
 
656
- 1. **Configuration**: List credential types in your agent's `agent-config.toml`:
657
- ```toml
658
- credentials = ["github_token", "git_ssh"]
659
- ```
660
-
661
- 2. **Storage**: Credential values live in `~/.action-llama/credentials/<type>/<instance>/<field>`. Each field is a plain text file.
662
-
663
- 3. **Injection**: When an agent runs, the credentials it requires are mounted into the container at `/credentials/<type>/<instance>/<field>` and key values are injected as environment variables.
664
-
665
- 4. **Git identity**: The `git_ssh` credential includes `username` and `email` fields. These are injected as `GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_NAME`/`GIT_COMMITTER_EMAIL` env vars at runtime, so `git commit` works without requiring `git config`.
666
-
667
- 5. **LLM credentials**: The LLM credential (e.g. `anthropic_key`) does not need to be listed in the agent's `credentials` array — it is loaded automatically based on the `[model]` config.
668
-
669
- ### Named instances
670
-
671
- Each credential type supports named instances. Reference `"git_ssh"` for the default instance, or `"git_ssh:botty"` for a named instance:
672
-
673
- ```
674
- ~/.action-llama/credentials/git_ssh/default/id_rsa
675
- ~/.action-llama/credentials/git_ssh/default/username
676
- ~/.action-llama/credentials/git_ssh/botty/id_rsa
677
- ~/.action-llama/credentials/git_ssh/botty/username
678
- ```
591
+ List in `agent-config.toml`. Mounted at `/credentials/...`, key values as env vars. `git_ssh` sets `GIT_AUTHOR_*`/`GIT_COMMITTER_*`. LLM creds auto-loaded from `[model]`.
679
592
 
680
593
  ### Agent runtime credentials
681
594
 
@@ -710,11 +623,11 @@ Each credential type supports named instances. Reference `"git_ssh"` for the def
710
623
  | `linear_webhook_secret` | `secret` | Shared secret for Linear webhook verification |
711
624
  | `mintlify_webhook_secret` | `secret` | Shared secret for Mintlify webhook verification |
712
625
 
713
- Used by the gateway for payload verification — not injected into agent containers. The gateway automatically loads secrets from all credential instances and uses them to verify incoming webhook payloads.
626
+ Gateway only — not in agent containers.
714
627
 
715
628
  ### Infrastructure credentials
716
629
 
717
- These are used by CLI commands (provisioning, deployment) and are not injected into agent containers.
630
+ CLI only (provisioning, deployment).
718
631
 
719
632
  | Type | Fields | Description |
720
633
  |------|--------|-------------|
@@ -734,7 +647,7 @@ These are used by CLI commands (provisioning, deployment) and are not injected i
734
647
 
735
648
  ## Models
736
649
 
737
- Action Llama supports 8 LLM providers. Each agent can use a different provider and model — configure a project-wide default in `config.toml` under `[model]`, and override per agent in `agent-config.toml`.
650
+ 8 providers. Default in `config.toml [model]`, override per agent.
738
651
 
739
652
  | Provider | Credential | Example Models | Auth Types |
740
653
  |----------|-----------|---------------|------------|
@@ -758,94 +671,37 @@ Action Llama supports 8 LLM providers. Each agent can use a different provider a
758
671
  | `high` | Deep reasoning |
759
672
  | `xhigh` | Maximum reasoning budget |
760
673
 
761
- If omitted, thinking is not explicitly configured. For non-Anthropic providers, `thinkingLevel` is ignored.
762
-
763
- ### Model inheritance
764
-
765
- Agents without a `[model]` section inherit from the project `config.toml`. If an agent defines its own `[model]`, it fully overrides the project default — there is no field-level merging between the two.
766
-
767
- ```
768
- config.toml → [model] provider = "anthropic", model = "claude-sonnet-4-20250514"
769
- dev/agent-config.toml → (no [model] section — inherits Claude Sonnet)
770
- reviewer/agent-config.toml → [model] provider = "openai", model = "gpt-4o"
771
- devops/agent-config.toml → [model] provider = "groq", model = "llama-3.3-70b-versatile"
772
- ```
773
-
774
- The LLM credential does not need to be listed in the agent's `credentials` array — it is loaded automatically based on the `[model]` config.
674
+ Non-Anthropic providers ignore `thinkingLevel`.
775
675
 
776
676
  ## Webhooks
777
677
 
778
- Agents can be triggered by webhooks in addition to (or instead of) cron schedules. Four providers are supported: GitHub, Sentry, Linear, and Mintlify.
779
-
780
- ### Defining webhook sources
781
-
782
- Webhook sources are defined once in the project's `config.toml`. Each source has a name, a provider type, and an optional credential for signature validation:
783
-
784
- ```toml
785
- [webhooks.my-github]
786
- type = "github"
787
- credential = "MyOrg" # credential instance name (github_webhook_secret:MyOrg)
788
-
789
- [webhooks.my-sentry]
790
- type = "sentry"
791
- credential = "SentryProd" # credential instance name (sentry_client_secret:SentryProd)
792
-
793
- [webhooks.my-linear]
794
- type = "linear"
795
- credential = "LinearMain" # credential instance name (linear_webhook_secret:LinearMain)
796
-
797
- [webhooks.my-mintlify]
798
- type = "mintlify"
799
- credential = "MintlifyMain" # credential instance name (mintlify_webhook_secret:MintlifyMain)
800
- ```
678
+ Webhook triggers for agents.
801
679
 
802
680
  ### Runtime flow
803
681
 
804
- 1. The gateway receives a webhook POST request at `/webhooks/<type>` (e.g. `/webhooks/github`)
805
- 2. It verifies the payload signature using secrets loaded from the credential instances defined in `config.toml` webhook sources
806
- 3. It parses the event into a `WebhookContext` (source, event, action, repo, etc.)
807
- 4. It matches the context against each agent's webhook triggers (AND logic — all specified filter fields must match; omitted fields are not checked)
808
- 5. Matching agents are triggered with the webhook context injected into their prompt as a `<webhook-trigger>` block
809
-
810
- ### Webhook endpoints
811
-
812
- | Provider | Endpoint |
813
- |----------|----------|
814
- | GitHub | `/webhooks/github` |
815
- | Sentry | `/webhooks/sentry` |
816
- | Linear | `/webhooks/linear` |
817
- | Mintlify | `/webhooks/mintlify` |
818
-
819
- ### Queue behavior
820
-
821
- If all runners for a matching agent are busy, webhook events are queued (up to `workQueueSize`, default: 100). Scheduled runs are skipped if all busy.
822
-
823
- ### Hybrid agents
824
-
825
- Agents can have both `schedule` and `webhooks`. Scheduled runs poll for work proactively; webhook runs respond to events immediately.
682
+ POST `/webhooks/<type>` -> verify -> match triggers (AND) -> trigger agent. Busy: queued.
826
683
 
827
684
  ## Agent Commands
828
685
 
829
- Agents have access to shell commands for signaling the scheduler, calling other agents, and coordinating with resource locks. These commands are installed at `/app/bin/` (baked into the Docker image) and added to `PATH` at container startup. The preamble skill blocks (see Prompt Assembly above) teach agents the commands and their response formats.
686
+ At `/app/bin/` (in `PATH`). Skill blocks teach usage.
830
687
 
831
688
  ### Signal commands
832
689
 
833
- Signal commands write signal files that the scheduler reads after the session ends.
690
+ Write signal files for scheduler.
834
691
 
835
692
  #### `al-rerun`
836
693
 
837
- Request an immediate rerun to drain remaining backlog. Without this, the scheduler treats the run as complete and waits for the next scheduled tick.
694
+ Request immediate rerun to drain backlog.
838
695
 
839
696
  ```bash
840
697
  al-rerun
841
698
  ```
842
699
 
843
- - Only applies to **scheduled** runs. Webhook-triggered and agent-called runs do not re-run.
844
- - Reruns continue until the agent completes without calling `al-rerun`, hits an error, or reaches the `maxReruns` limit (default: 10).
700
+ Scheduled only. Until no `al-rerun`, error, or `maxReruns` (10).
845
701
 
846
702
  #### `al-status "<text>"`
847
703
 
848
- Update the status text shown in the TUI and web dashboard.
704
+ Update status text in TUI/dashboard.
849
705
 
850
706
  ```bash
851
707
  al-status "reviewing PR #42"
@@ -854,85 +710,71 @@ al-status "found 3 issues to work on"
854
710
 
855
711
  #### `al-return "<value>"`
856
712
 
857
- Return a value to the calling agent. Used when this agent was invoked via `al-call`.
713
+ Return a value to the calling agent (when invoked via `al-call`).
858
714
 
859
715
  ```bash
860
716
  al-return "PR looks good. Approved with minor suggestions."
861
717
  al-return '{"approved": true, "comments": 2}'
862
718
  ```
863
719
 
864
- For multiline results, pipe via stdin:
720
+ For multiline, pipe via stdin:
865
721
 
866
722
  ```bash
867
723
  echo "Line 1\nLine 2" | al-return
868
724
  ```
869
725
 
870
- The calling agent receives this value when it calls `al-wait`.
871
-
872
726
  #### `al-exit [code]`
873
727
 
874
- Terminate the agent with an exit code indicating an unrecoverable error. Defaults to exit code 15.
728
+ Terminate with exit code (default: 15).
875
729
 
876
730
  ```bash
877
731
  al-exit # exit code 15
878
732
  al-exit 1 # exit code 1
879
733
  ```
880
734
 
881
- Standard exit codes: 10 (auth failure), 11 (permission denied), 12 (rate limited), 13 (config error), 14 (dependency error), 15 (unrecoverable), 16 (user abort).
735
+ Codes: 10=auth, 11=perm, 12=rate, 13=config, 14=dep, 15=unrecoverable, 16=abort.
882
736
 
883
737
  ### Call commands
884
738
 
885
- Agent-to-agent calls allow agents to delegate work and collect results. These commands require the gateway (`GATEWAY_URL` must be set).
739
+ Require gateway.
886
740
 
887
741
  #### `al-call <agent>`
888
742
 
889
- Call another agent. Pass context via stdin. Returns a JSON response with a `callId`.
743
+ Call another agent. Pass context via stdin.
890
744
 
891
745
  ```bash
892
746
  echo "Review PR #42 on acme/app" | al-call reviewer
893
747
  ```
894
748
 
895
- **Response:**
896
-
897
749
  ```json
898
750
  {"ok": true, "callId": "abc123"}
899
- ```
900
-
901
- **Errors:**
902
-
903
- ```json
904
751
  {"ok": false, "error": "self-call not allowed"}
905
752
  {"ok": false, "error": "queue full"}
906
753
  ```
907
754
 
908
755
  #### `al-check <callId>`
909
756
 
910
- Non-blocking status check on a call. Never blocks.
757
+ Non-blocking status check.
911
758
 
912
759
  ```bash
913
760
  al-check abc123
914
761
  ```
915
762
 
916
- **Response:**
917
-
918
763
  ```json
919
764
  {"status": "pending"}
920
- {"status": "running"}
921
765
  {"status": "completed", "returnValue": "PR approved."}
922
766
  {"status": "error", "error": "timeout"}
923
767
  ```
924
768
 
925
769
  #### `al-wait <callId> [...] [--timeout N]`
926
770
 
927
- Wait for one or more calls to complete. Polls every 5 seconds. Default timeout: 900 seconds.
771
+ Wait for calls. Polls every 5s. Default timeout: 900s.
928
772
 
929
773
  ```bash
930
774
  al-wait abc123 --timeout 600
931
775
  al-wait abc123 def456 --timeout 300
932
776
  ```
933
777
 
934
- **Response:**
935
-
936
778
  ```json
937
779
  {
938
780
  "abc123": {"status": "completed", "returnValue": "PR approved."},
@@ -957,436 +799,123 @@ echo "$RESULTS" | jq ".\"$TEST_ID\".returnValue"
957
799
 
958
800
  #### Call rules
959
801
 
960
- - An agent cannot call itself (self-calls are rejected)
961
- - If all runners for the target agent are busy, the call is queued (up to `workQueueSize`, default: 100)
962
- - Call chains are allowed (A calls B, B calls C) up to `maxCallDepth` (default: 3)
963
- - Called runs do not re-run — they respond to the single call
964
- - The called agent receives an `<agent-call>` block with the caller name and context
965
- - To return a value, the called agent uses `al-return`
802
+ No self-calls. Chains up to `maxCallDepth` (3). Use `al-return` to respond.
966
803
 
967
804
  ### Lock commands
968
805
 
969
- Resource locks prevent multiple agent instances from working on the same resource. The underlying shell commands are `rlock`, `runlock`, and `rlock-heartbeat`.
806
+ Prevent duplicate work across instances.
970
807
 
971
808
  #### `rlock`
972
809
 
973
- Acquire an exclusive lock on a resource.
810
+ Acquire exclusive lock.
974
811
 
975
812
  ```bash
976
813
  rlock "github issue acme/app#42"
977
814
  ```
978
815
 
979
- **Success:**
816
+ Responses:
980
817
 
981
818
  ```json
982
819
  {"ok": true}
983
- ```
984
-
985
- **Already held:**
986
-
987
- ```json
988
820
  {"ok": false, "holder": "dev-abc123", "heldSince": "2025-01-15T10:30:00Z"}
989
- ```
990
-
991
- **Already holding another lock:**
992
-
993
- ```json
994
821
  {"ok": false, "reason": "already holding lock on ..."}
995
- ```
996
-
997
- **Deadlock detected:**
998
-
999
- ```json
1000
822
  {"ok": false, "reason": "possible deadlock detected", "cycle": ["dev-abc", "github pr acme/app#10", "dev-def", "deploy api-prod"]}
1001
823
  ```
1002
824
 
1003
825
  #### `runlock`
1004
826
 
1005
- Release a lock. Only the holder can release.
827
+ Release a lock (holder only).
1006
828
 
1007
829
  ```bash
1008
830
  runlock "github issue acme/app#42"
1009
831
  ```
1010
832
 
1011
- **Success:**
1012
-
1013
833
  ```json
1014
834
  {"ok": true}
1015
- ```
1016
-
1017
- **Not holder:**
1018
-
1019
- ```json
1020
835
  {"ok": false, "reason": "not the lock holder"}
1021
836
  ```
1022
837
 
1023
838
  #### `rlock-heartbeat`
1024
839
 
1025
- Reset the TTL on a held lock. Use during long-running work to prevent the lock from expiring.
840
+ Reset TTL on held lock during long work.
1026
841
 
1027
842
  ```bash
1028
843
  rlock-heartbeat "github issue acme/app#42"
1029
844
  ```
1030
845
 
1031
- **Success:**
1032
-
1033
846
  ```json
1034
847
  {"ok": true, "expiresAt": "2025-01-15T11:00:00Z"}
1035
848
  ```
1036
849
 
1037
850
  #### Lock behavior
1038
851
 
1039
- - Each container gets a unique per-run secret. Lock requests are authenticated with this secret, so only the container that acquired a lock can release or heartbeat it.
1040
- - When a container exits — whether it finishes successfully, hits an error, or times out — all of its locks are released automatically by the scheduler.
1041
- - An agent can hold **at most one lock at a time**. Release your current lock before acquiring another.
1042
- - Locks expire automatically after `lockTimeout` seconds (default: 1800 / 30 minutes) if not refreshed via heartbeat.
1043
- - Use descriptive keys: `"github issue acme/app#42"`, `"deploy api-prod"`
852
+ Per-run secret auth. Auto-release on exit. **One at a time**. Expire after `lockTimeout` (1800s).
1044
853
 
1045
854
  #### Lock graceful degradation
1046
855
 
1047
- When `GATEWAY_URL` is not set (e.g. non-containerized local runs), lock commands exit 0 with `{"ok":true}` — graceful degradation so agents work without a gateway.
1048
-
1049
- Call commands (`al-call`, `al-check`, `al-wait`) exit 5 when `GATEWAY_URL` is not set — they require a gateway.
856
+ No gateway: locks degrade gracefully (exit 0). Calls exit 5.
1050
857
 
1051
858
  ## CLI Commands
1052
859
 
1053
- ### `al new <name>`
1054
-
1055
- Creates a new Action Llama project. Runs interactive setup to configure credentials and LLM defaults.
1056
-
1057
- ```bash
1058
- npx @action-llama/action-llama new my-project
1059
- ```
1060
-
1061
- Creates:
1062
- - `my-project/package.json` — with `@action-llama/action-llama` dependency
1063
- - `my-project/.gitignore`
1064
- - `my-project/.workspace/` — runtime state directory
1065
- - Credential files in `~/.action-llama/credentials/`
1066
-
1067
- ### `al doctor`
1068
-
1069
- Checks all agent credentials and interactively prompts for any that are missing. Discovers agents in the project, collects their credential requirements (plus any webhook secret credentials), and ensures each one exists on disk. Also generates a gateway API key if one doesn't exist yet.
1070
-
1071
- Additionally validates webhook trigger field configurations to catch common errors like using `repository` instead of `repos`, misspelled field names, or invalid field types.
1072
-
1073
- ```bash
1074
- al doctor
1075
- al doctor -E production
1076
- ```
860
+ ### `al new <name>` — Create project
1077
861
 
1078
- | Option | Description |
1079
- |--------|-------------|
1080
- | `-p, --project <dir>` | Project directory (default: `.`) |
1081
- | `-E, --env <name>` | Environment name — pushes credentials to server and reconciles IAM |
862
+ ### `al doctor` Check/prompt for missing credentials. `-E` pushes to server.
1082
863
 
1083
- ### `al run <agent>`
864
+ ### `al run <agent>` — Single run for testing (`-H` headless)
1084
865
 
1085
- Manually triggers a single agent run. The agent runs once and the process exits when it completes. Useful for testing, debugging, or one-off runs without starting the full scheduler.
866
+ ### `al start` Start scheduler (`-w` dashboard, `-e` expose, `-H` headless, `--port <N>`)
1086
867
 
1087
- ```bash
1088
- al run dev
1089
- al run reviewer -p ./my-project
1090
- al run dev -E production
1091
- al run dev --headless
1092
- ```
868
+ ### `al stop` — Stop scheduler (in-flight runs finish)
1093
869
 
1094
- | Option | Description |
1095
- |--------|-------------|
1096
- | `-p, --project <dir>` | Project directory (default: `.`) |
1097
- | `-E, --env <name>` | Environment name |
1098
- | `-H, --headless` | Non-interactive mode (no TUI, no credential prompts) |
870
+ ### `al stat` Agent status overview
1099
871
 
1100
- ### `al start`
872
+ ### `al logs <agent>` — View logs (`-n`, `-f`, `-d`, `-r`, `-i`)
1101
873
 
1102
- Starts the scheduler. Runs all agents on their configured schedules and listens for webhooks.
874
+ ### `al pause/resume [name]` Pause/resume scheduler or agent
1103
875
 
1104
- ```bash
1105
- al start
1106
- al start -w # Enable web dashboard
1107
- al start -e # VPS deployment: expose gateway publicly
1108
- al start --port 3000 # Custom gateway port
1109
- al start -H # Headless (no TUI)
1110
- ```
876
+ ### `al kill <target>` — Kill agent or instance
1111
877
 
1112
- | Option | Description |
1113
- |--------|-------------|
1114
- | `-p, --project <dir>` | Project directory (default: `.`) |
1115
- | `-E, --env <name>` | Environment name |
1116
- | `-w, --web-ui` | Enable web dashboard |
1117
- | `-e, --expose` | Bind gateway to `0.0.0.0` (public) while keeping local-mode features |
1118
- | `-H, --headless` | Non-interactive mode (no TUI, no credential prompts) |
1119
- | `--port <number>` | Gateway port (overrides `[gateway].port` in config) |
878
+ ### `al chat [agent]` — Interactive console (with agent: credentials injected)
1120
879
 
1121
- ### `al stop`
880
+ ### `al push [agent]` — Deploy via SSH (full or hot-reload single agent)
1122
881
 
1123
- Stops the scheduler and clears all pending agent work queues. Sends a stop signal to the gateway. In-flight runs continue until they finish, but no new runs will start.
1124
-
1125
- ```bash
1126
- al stop
1127
- al stop -E production
1128
- ```
1129
-
1130
- | Option | Description |
1131
- |--------|-------------|
1132
- | `-p, --project <dir>` | Project directory (default: `.`) |
1133
- | `-E, --env <name>` | Environment name |
1134
-
1135
- ### `al stat`
1136
-
1137
- Shows status of all discovered agents in the project. Displays each agent's schedule, credentials, webhook configuration, and queue depth.
1138
-
1139
- ```bash
1140
- al stat
1141
- al stat -E production
1142
- ```
1143
-
1144
- | Option | Description |
1145
- |--------|-------------|
1146
- | `-p, --project <dir>` | Project directory (default: `.`) |
1147
- | `-E, --env <name>` | Environment name |
1148
-
1149
- ### `al logs <agent>`
1150
-
1151
- View log files for a specific agent.
1152
-
1153
- ```bash
1154
- al logs dev
1155
- al logs dev -n 100 # Show last 100 entries
1156
- al logs dev -f # Follow/tail mode
1157
- al logs dev -d 2025-01-15 # Specific date
1158
- al logs dev -r # Raw JSON log output
1159
- al logs dev -i abc123 # Specific instance
1160
- al logs dev -E production # Remote agent logs
1161
- ```
1162
-
1163
- | Option | Description |
1164
- |--------|-------------|
1165
- | `-p, --project <dir>` | Project directory (default: `.`) |
1166
- | `-E, --env <name>` | Environment name |
1167
- | `-n, --lines <N>` | Number of log entries (default: 50) |
1168
- | `-f, --follow` | Tail mode — watch for new entries |
1169
- | `-d, --date <YYYY-MM-DD>` | View a specific date's log file |
1170
- | `-r, --raw` | Raw JSON log output (no formatting) |
1171
- | `-i, --instance <id>` | Filter to a specific instance ID |
1172
-
1173
- ### `al pause [name]`
1174
-
1175
- Pause the scheduler or a single agent. Without a name, pauses the entire scheduler — all cron jobs stop firing. With a name, pauses that agent — its cron job stops firing and webhook events are ignored. In-flight runs continue until they finish. Requires the gateway.
1176
-
1177
- ```bash
1178
- al pause # Pause the scheduler
1179
- al pause dev # Pause a single agent
1180
- al pause dev -E production
1181
- ```
1182
-
1183
- | Option | Description |
1184
- |--------|-------------|
1185
- | `-p, --project <dir>` | Project directory (default: `.`) |
1186
- | `-E, --env <name>` | Environment name |
1187
-
1188
- ### `al resume [name]`
1189
-
1190
- Resume the scheduler or a single agent. Without a name, resumes the entire scheduler. With a name, resumes that agent — its cron job resumes firing and webhooks are accepted again.
1191
-
1192
- ```bash
1193
- al resume # Resume the scheduler
1194
- al resume dev # Resume a single agent
1195
- al resume dev -E production
1196
- ```
1197
-
1198
- | Option | Description |
1199
- |--------|-------------|
1200
- | `-p, --project <dir>` | Project directory (default: `.`) |
1201
- | `-E, --env <name>` | Environment name |
1202
-
1203
- ### `al kill <target>`
1204
-
1205
- Kill an agent (all running instances) or a single instance by ID. Tries the target as an agent name first; if not found, falls back to instance ID. This does **not** pause the agent — if it has a schedule, a new run will start at the next cron tick. To fully stop an agent, pause it first, then kill.
1206
-
1207
- ```bash
1208
- al kill dev # Kill all instances of an agent
1209
- al kill my-agent-abc123 # Kill a single instance by ID
1210
- al kill dev -E production
1211
- ```
1212
-
1213
- | Option | Description |
1214
- |--------|-------------|
1215
- | `-p, --project <dir>` | Project directory (default: `.`) |
1216
- | `-E, --env <name>` | Environment name |
1217
-
1218
- ### `al chat [agent]`
1219
-
1220
- Open an interactive console. Without an agent name, opens the project-level console for creating and managing agents. With an agent name, opens an interactive session scoped to that agent's environment — credentials are loaded and injected as environment variables (e.g. `GITHUB_TOKEN`, `GIT_SSH_COMMAND`), and the working directory is set to the agent's directory.
1221
-
1222
- ```bash
1223
- al chat # project-level console
1224
- al chat dev # interactive session with dev agent's credentials
1225
- ```
1226
-
1227
- | Option | Description |
1228
- |--------|-------------|
1229
- | `[agent]` | Agent name — loads its credentials and environment |
1230
- | `-p, --project <dir>` | Project directory (default: `.`) |
1231
-
1232
- When running in agent mode, the command probes the gateway and warns if it is not reachable:
1233
-
1234
- ```
1235
- Warning: No gateway detected at http://localhost:8080. Resource locks, agent calls, and signals are unavailable.
1236
- Start the scheduler with `al start` to enable these features.
1237
- ```
1238
-
1239
- The agent's ACTIONS.md is loaded as reference context but is **not** auto-executed — you drive the session interactively.
1240
-
1241
- ### `al push [agent]`
1242
-
1243
- Deploy your project to a server over SSH. Requires a `[server]` section in your environment file.
1244
-
1245
- ```bash
1246
- al push -E production # Full project push
1247
- al push dev -E production # Push only the dev agent (hot-reloaded)
1248
- al push --dry-run -E production # Preview what would be synced
1249
- al push --creds-only -E production # Sync only credentials
1250
- ```
1251
-
1252
- Without an agent name, pushes the entire project and can restart the remote service. With an agent name, pushes only that agent's files and credentials — the running scheduler detects the change and hot-reloads the agent without a full restart.
1253
-
1254
- | Option | Description |
1255
- |--------|-------------|
1256
- | `[agent]` | Agent name — push only this agent (hot-reloaded, no restart) |
1257
- | `-p, --project <dir>` | Project directory (default: `.`) |
1258
- | `-E, --env <name>` | Environment with `[server]` config |
1259
- | `--dry-run` | Show what would be synced without making changes |
1260
- | `--no-creds` | Skip credential sync |
1261
- | `--creds-only` | Sync only credentials (skip project files) |
1262
- | `--files-only` | Sync only project files (skip credentials) |
1263
- | `-a, --all` | Sync project files, credentials, and restart service |
1264
- | `--force-install` | Force `npm install` even if dependencies appear unchanged |
882
+ `--dry-run`, `--no-creds`, `--creds-only`, `--files-only`, `-a`, `--force-install`.
1265
883
 
1266
884
  ### Environment commands
1267
885
 
1268
- #### `al env init <name>`
1269
-
1270
- Create a new environment configuration file at `~/.action-llama/environments/<name>.toml`.
1271
-
1272
- ```bash
1273
- al env init production --type server
1274
- ```
1275
-
1276
- | Option | Description |
1277
- |--------|-------------|
1278
- | `--type <type>` | Environment type: `server` |
1279
-
1280
- #### `al env list`
1281
-
1282
- List all configured environments.
1283
-
1284
- #### `al env show <name>`
1285
-
1286
- Display the contents of an environment configuration file.
1287
-
1288
- #### `al env set [name]`
1289
-
1290
- Bind the current project to an environment by writing the environment name to `.env.toml`. Omit the name to unbind.
1291
-
1292
- ```bash
1293
- al env set production # Bind project to "production"
1294
- al env set # Unbind project from any environment
1295
- ```
1296
-
1297
- | Option | Description |
1298
- |--------|-------------|
1299
- | `-p, --project <dir>` | Project directory (default: `.`) |
1300
-
1301
- #### `al env check <name>`
1302
-
1303
- Verify that an environment is provisioned and configured correctly. Checks SSH connectivity, Docker availability, and server readiness.
1304
-
1305
- #### `al env prov [name]`
1306
-
1307
- Provision a new VPS and save it as an environment. Supports Vultr and Hetzner. If the name is omitted, you'll be prompted for one.
886
+ #### `al env init <name>` — Create at `~/.action-llama/environments/<name>.toml`
1308
887
 
1309
- #### `al env deprov <name>`
888
+ #### `al env list` / `al env show <name>` — List or show environments
1310
889
 
1311
- Tear down a provisioned environment. Stops containers, cleans up remote credentials, optionally deletes DNS records, and optionally deletes the VPS instance if it was provisioned via `al env prov`.
890
+ #### `al env set [name]` Bind/unbind project to environment (`.env.toml`)
1312
891
 
1313
- | Option | Description |
1314
- |--------|-------------|
1315
- | `-p, --project <dir>` | Project directory (default: `.`) |
1316
-
1317
- #### `al env logs [name]`
892
+ #### `al env check <name>` — Verify SSH, Docker, server readiness
1318
893
 
1319
- View server system logs (systemd journal) via SSH. If the name is omitted, uses the project's bound environment.
894
+ #### `al env prov [name]` Provision VPS (Vultr/Hetzner)
1320
895
 
1321
- ```bash
1322
- al env logs production
1323
- al env logs production -n 200 # Last 200 lines
1324
- al env logs production -f # Follow mode
1325
- ```
896
+ #### `al env deprov <name>` — Tear down environment
1326
897
 
1327
- | Option | Description |
1328
- |--------|-------------|
1329
- | `-p, --project <dir>` | Project directory (default: `.`) |
1330
- | `-n, --lines <N>` | Number of log lines (default: 50) |
1331
- | `-f, --follow` | Tail mode — watch for new entries |
898
+ #### `al env logs [name]` — Server logs via SSH (`-n`, `-f`)
1332
899
 
1333
900
  ### Credential commands
1334
901
 
1335
- #### `al creds ls`
1336
-
1337
- Lists all stored credentials grouped by type, showing field names but not values.
1338
-
1339
- #### `al creds add <ref>`
1340
-
1341
- Add or update a credential. Runs the interactive prompter with validation for the credential type.
902
+ #### `al creds ls` — List credentials (names, not values)
1342
903
 
1343
- ```bash
1344
- al creds add github_token # adds github_token:default
1345
- al creds add github_webhook_secret:myapp
1346
- al creds add git_ssh:prod
1347
- ```
904
+ #### `al creds add <ref>` — Add/update (`github_token` or `git_ssh:prod`)
1348
905
 
1349
- The `<ref>` format is `type` or `type:instance`. If no instance is specified, defaults to `default`. If the credential already exists, you'll be prompted to update it.
906
+ #### `al creds rm <ref>` Remove credential
1350
907
 
1351
- #### `al creds rm <ref>`
1352
-
1353
- Remove a credential from disk.
1354
-
1355
- ```bash
1356
- al creds rm github_token # removes github_token:default
1357
- al creds rm github_webhook_secret:myapp
1358
- ```
1359
-
1360
- #### `al creds types`
1361
-
1362
- Browse available credential types interactively. Presents a searchable list of all built-in credential types. On selection, shows the credential's fields, environment variables, and agent context, then offers to add it immediately.
908
+ #### `al creds types` — Browse credential types
1363
909
 
1364
910
  ### Agent commands
1365
911
 
1366
- #### `al agent new`
1367
-
1368
- Interactive wizard to create a new agent from a template. Prompts for agent type (dev, reviewer, devops, or custom), agent name, and then runs `al agent config` to configure the new agent.
1369
-
1370
- | Option | Description |
1371
- |--------|-------------|
1372
- | `-p, --project <dir>` | Project directory (default: `.`) |
1373
-
1374
- #### `al agent config <name>`
912
+ #### `al agent new` — Create from template (dev, reviewer, devops, custom)
1375
913
 
1376
- Interactively configure an existing agent. Opens a menu to edit each section of `agent-config.toml`: credentials, model, schedule, webhooks, and params. Runs `al doctor` on completion to validate the configuration.
1377
-
1378
- | Option | Description |
1379
- |--------|-------------|
1380
- | `-p, --project <dir>` | Project directory (default: `.`) |
914
+ #### `al agent config <name>` Configure agent interactively
1381
915
 
1382
916
  ### Global options
1383
917
 
1384
- These options are available on most commands:
1385
-
1386
- | Option | Description |
1387
- |--------|-------------|
1388
- | `-p, --project <dir>` | Project directory (default: `.`) |
1389
- | `-E, --env <name>` | Environment name (also `AL_ENV` env var or `environment` field in `.env.toml`) |
918
+ `-p <dir>` (project, default `.`) and `-E <name>` (env, also `AL_ENV` or `.env.toml`).
1390
919
 
1391
920
  ## Docker
1392
921
 
@@ -1400,11 +929,11 @@ al-project-base:latest ← project Dockerfile (skipped if unmodified from ba
1400
929
  al-<agent>:latest ← per-agent Dockerfile (if present)
1401
930
  ```
1402
931
 
1403
- If the project Dockerfile is unmodified (bare `FROM al-agent:latest`), the middle layer is skipped — agents build directly on `al-agent:latest`.
932
+ Bare project Dockerfile skips middle layer.
1404
933
 
1405
934
  ### Base image contents
1406
935
 
1407
- The base image (`al-agent:latest`) is built from `node:20-alpine` and includes:
936
+ Built from `node:20-alpine`:
1408
937
 
1409
938
  | Package | Purpose |
1410
939
  |---------|---------|
@@ -1415,19 +944,11 @@ The base image (`al-agent:latest`) is built from `node:20-alpine` and includes:
1415
944
  | `ca-certificates` | HTTPS for git, curl, npm |
1416
945
  | `openssh-client` | SSH for `GIT_SSH_COMMAND` — git clone/push over SSH |
1417
946
 
1418
- The base image also copies the compiled Action Llama application (`dist/`) and installs its npm dependencies.
1419
-
1420
- Entry point: `node /app/dist/agents/container-entry.js`
1421
-
1422
- Shell commands are baked into the image at `/app/bin/` (al-rerun, al-status, al-return, al-exit, al-call, al-check, al-wait, rlock, runlock, rlock-heartbeat).
947
+ Entry: `node /app/dist/agents/container-entry.js`. Commands at `/app/bin/`.
1423
948
 
1424
949
  ### Dockerfile conventions
1425
950
 
1426
- - `FROM al-agent:latest` the build pipeline automatically rewrites the `FROM` line to point at the correct base
1427
- - Switch to `root` for package installs, back to `node` (uid 1000) for the entry point
1428
- - Alpine base: use `apk add --no-cache`
1429
- - Agent images are named `al-<agent-name>:latest` (e.g. `al-dev:latest`) and are rebuilt on every `al start`
1430
- - The build context is the Action Llama package root (not the project directory), so `COPY` paths reference the package's `dist/`, `package.json`, etc.
951
+ `FROM al-agent:latest` (auto-rewritten). Images: `al-<name>:latest`.
1431
952
 
1432
953
  #### Project Dockerfile example
1433
954
 
@@ -1453,11 +974,7 @@ USER node
1453
974
 
1454
975
  #### Standalone Dockerfile (full control)
1455
976
 
1456
- If you need full control, the requirements are:
1457
- 1. Node.js 20+
1458
- 2. `/app/dist/agents/container-entry.js` must exist
1459
- 3. `ENTRYPOINT ["node", "/app/dist/agents/container-entry.js"]`
1460
- 4. `USER node` (uid 1000) for compatibility
977
+ Needs Node.js 20+, entry.js, `USER node`.
1461
978
 
1462
979
  ```dockerfile
1463
980
  FROM node:20-alpine
@@ -1471,11 +988,11 @@ USER node
1471
988
  ENTRYPOINT ["node", "/app/dist/agents/container-entry.js"]
1472
989
  ```
1473
990
 
1474
- The entry point reads `AGENT_CONFIG`, `PROMPT`, `GATEWAY_URL`, and `SHUTDOWN_SECRET` from environment variables, and credentials from `/credentials/`.
991
+ Reads `AGENT_CONFIG`, `PROMPT`, `GATEWAY_URL` from env.
1475
992
 
1476
993
  ### Container filesystem
1477
994
 
1478
- All agents run in isolated containers with a read-only root filesystem, dropped capabilities, non-root user, and resource limits.
995
+ Read-only root, non-root user, resource limits.
1479
996
 
1480
997
  | Path | Mode | Contents |
1481
998
  |------|------|----------|
@@ -1487,34 +1004,25 @@ All agents run in isolated containers with a read-only root filesystem, dropped
1487
1004
  | `/workspace` | read-write (2GB) | Persistent workspace |
1488
1005
  | `/home/node` | read-write (64MB) | Home directory |
1489
1006
 
1490
- ### Docker config options
1491
-
1492
- These go in `config.toml` under `[local]`:
1007
+ ### Environment variable persistence
1493
1008
 
1494
- | Key | Default | Description |
1495
- |-----|---------|-------------|
1496
- | `local.image` | `"al-agent:latest"` | Base Docker image name |
1497
- | `local.memory` | `"4g"` | Memory limit per container |
1498
- | `local.cpus` | `2` | CPU limit per container |
1499
- | `local.timeout` | `900` | Max container runtime in seconds |
1009
+ Write to `/tmp/env.sh` to persist environment variables across bash commands:
1500
1010
 
1501
- ## Gateway API
1502
-
1503
- The gateway is the HTTP server that runs alongside the scheduler. It handles webhooks, serves the web dashboard, and exposes control and status APIs used by CLI commands and the dashboard.
1504
-
1505
- The gateway starts automatically when needed — either when webhooks are configured, when `--web-ui` is passed to `al start`, or when Docker container communication is required. The port is controlled by the `[gateway].port` setting in `config.toml` (default: `8080`).
1506
-
1507
- ### Authentication
1011
+ ```bash
1012
+ echo 'export REPO="owner/repo"' > /tmp/env.sh
1013
+ echo 'export ISSUE_NUMBER=42' >> /tmp/env.sh
1014
+ gh issue view $ISSUE_NUMBER --repo $REPO
1015
+ ```
1508
1016
 
1509
- The gateway API is protected by an API key. The same key is used for both browser sessions and CLI access.
1017
+ File is automatically sourced before each bash command.
1510
1018
 
1511
- **Key location:** `~/.action-llama/credentials/gateway_api_key/default/key`
1019
+ See `[local]` in config.toml for Docker configuration options.
1512
1020
 
1513
- The key is generated automatically by `al doctor` or on first `al start`. To view or regenerate it, run `al doctor`.
1021
+ ## Gateway API
1514
1022
 
1515
- **CLI access:** CLI commands (`al stat`, `al pause`, `al resume`, `al kill`) automatically read the API key from the credential store and send it as a `Bearer` token in the `Authorization` header.
1023
+ Auto-starting HTTP server. Port: `[gateway].port`.
1516
1024
 
1517
- **Browser access:** The web dashboard uses cookie-based authentication. After logging in with the API key, an `al_session` cookie is set (HttpOnly, SameSite=Strict) so all subsequent requests — including SSE streams — are authenticated automatically.
1025
+ API key at `~/.action-llama/credentials/gateway_api_key/default/key`.
1518
1026
 
1519
1027
  ### Protected routes
1520
1028
 
@@ -1528,16 +1036,16 @@ The key is generated automatically by `al doctor` or on first `al start`. To vie
1528
1036
 
1529
1037
  ### Control API
1530
1038
 
1531
- All control endpoints use `POST` and require authentication.
1039
+ All `POST`, require auth.
1532
1040
 
1533
- **Scheduler control:**
1041
+ **Scheduler:**
1534
1042
 
1535
1043
  | Endpoint | Description |
1536
1044
  |----------|-------------|
1537
1045
  | `POST /control/pause` | Pause the scheduler (all cron jobs) |
1538
1046
  | `POST /control/resume` | Resume the scheduler |
1539
1047
 
1540
- **Agent control:**
1048
+ **Agents:**
1541
1049
 
1542
1050
  | Endpoint | Description |
1543
1051
  |----------|-------------|
@@ -1550,7 +1058,7 @@ All control endpoints use `POST` and require authentication.
1550
1058
 
1551
1059
  ### SSE Streams
1552
1060
 
1553
- Live updates use **Server-Sent Events (SSE)**:
1061
+ Live updates via **SSE**:
1554
1062
 
1555
1063
  | Endpoint | Description |
1556
1064
  |----------|-------------|
@@ -1566,31 +1074,9 @@ Live updates use **Server-Sent Events (SSE)**:
1566
1074
 
1567
1075
  ## Web Dashboard
1568
1076
 
1569
- Action Llama includes an optional web-based dashboard for monitoring agents in your browser. It provides a live view of agent statuses and streaming logs.
1570
-
1571
- ### Enabling
1572
-
1573
- Pass `-w` or `--web-ui` to `al start`:
1574
-
1575
- ```bash
1576
- al start -w
1577
- ```
1578
-
1579
- The dashboard URL is shown in the TUI header once the scheduler starts:
1580
-
1581
- ```
1582
- Dashboard: http://localhost:8080/dashboard
1583
- ```
1077
+ Enable with `al start -w`. URL: `http://localhost:<port>/dashboard`. Login with gateway API key.
1584
1078
 
1585
- The port is controlled by the `[gateway].port` setting in `config.toml` (default: `8080`).
1586
-
1587
- ### Authentication
1588
-
1589
- The dashboard is protected by the gateway API key. Navigate to `http://localhost:8080/dashboard` and you'll be redirected to a login page where you paste your API key. On success, an `al_session` cookie is set (HttpOnly, SameSite=Strict).
1590
-
1591
- ### Main Page — `/dashboard`
1592
-
1593
- Displays a live overview of all agents:
1079
+ ### `/dashboard`
1594
1080
 
1595
1081
  | Column | Description |
1596
1082
  |--------|-------------|
@@ -1602,24 +1088,13 @@ Displays a live overview of all agents:
1602
1088
  | Next Run | When the next scheduled run will happen |
1603
1089
  | Actions | **Run** (trigger an immediate run) and **Enable/Disable** (toggle the agent) |
1604
1090
 
1605
- The header includes a **Pause/Resume** button for the scheduler and a **Logout** link. Below the table, a **Recent Activity** section shows the last 20 log lines across all agents.
1606
-
1607
- All data updates in real time via Server-Sent Events (SSE) — no manual refresh needed.
1608
-
1609
- ### Agent Logs — `/dashboard/agents/<name>/logs`
1610
-
1611
- Displays a live-streaming log view for a single agent. Logs follow automatically by default (new entries scroll into view as they arrive). Features:
1612
-
1613
- - **Follow mode** — enabled by default, auto-scrolls. Scrolling up pauses follow; scrolling back to the bottom re-enables it.
1614
- - **Clear** — clears the log display (does not delete log files).
1615
- - **Connection status** — shows whether the SSE connection is active.
1616
- - **Log levels** — color-coded: green for INFO, yellow for WARN, red for ERROR.
1091
+ Pause/Resume, Recent Activity. SSE updates.
1617
1092
 
1618
- On initial load, the last 100 log entries from the agent's log file are displayed, then new entries stream in as they are written. No additional dependencies or frontend build steps are required — the dashboard is rendered as plain HTML with inline CSS and JavaScript.
1093
+ ### `/dashboard/agents/<name>/logs` Live streaming agent logs
1619
1094
 
1620
1095
  ## Environments
1621
1096
 
1622
- Projects are portable — cloud infrastructure details live outside the project directory using a three-layer config merge system (later values win, deep merge).
1097
+ Three-layer config merge (later wins):
1623
1098
 
1624
1099
  | Layer | File | Scope | Contents |
1625
1100
  |-------|------|-------|----------|
@@ -1627,15 +1102,9 @@ Projects are portable — cloud infrastructure details live outside the project
1627
1102
  | 2 | `.env.toml` | Project (gitignored) | `environment` field to select env, can override any config value |
1628
1103
  | 3 | `~/.action-llama/environments/<name>.toml` | Machine | `[server]` (SSH push deploy), `gateway.url`, `telemetry.endpoint` |
1629
1104
 
1630
- `[cloud]` and `[server]` must be in Layer 3 (environment file). Placing `[cloud]` in `config.toml` is an error. `[cloud]` and `[server]` are mutually exclusive within an environment.
1105
+ `[cloud]`/`[server]` must be Layer 3. Mutually exclusive.
1631
1106
 
1632
- ### Environment selection priority
1633
-
1634
- `-E`/`--env <name>` flag > `AL_ENV` env var > `.env.toml` `environment` field.
1635
-
1636
- ### Environment types
1637
-
1638
- For `al env init`: `server`.
1107
+ Priority: `-E` flag > `AL_ENV` env var > `.env.toml`. Type: `server`.
1639
1108
 
1640
1109
  ### Server environment example
1641
1110
 
@@ -1651,23 +1120,21 @@ expose = true
1651
1120
 
1652
1121
  ### VPS credential sync
1653
1122
 
1654
- When deploying to a VPS, credentials are transferred to the remote server via SSH. The remote layout mirrors the local one: `~/.action-llama/credentials/{type}/{instance}/{field}`. No external secrets manager is needed — same trust model as SSH access.
1123
+ Credentials synced via SSH.
1655
1124
 
1656
1125
  ## Running Agents
1657
1126
 
1658
- Start all agents with `al start` (or `npx al start`). This starts the scheduler which runs all discovered agents on their configured schedules/webhooks. There is no per-agent start command — `al start` always starts the entire project.
1127
+ `al start` runs all agents. No per-agent start.
1659
1128
 
1660
1129
  ### Automatic re-runs
1661
1130
 
1662
- When a scheduled agent runs `al-rerun`, the scheduler immediately re-runs it. This continues until the agent completes without `al-rerun` (no more work), hits an error, or reaches the `maxReruns` limit. This way an agent drains its work queue without waiting for the next cron tick.
1663
-
1664
- Webhook-triggered and agent-triggered runs do not re-run — they respond to a single event.
1131
+ `al-rerun` triggers re-run until done/error/`maxReruns`. Webhook/call runs don't re-run.
1665
1132
 
1666
1133
  ## Exit Codes
1667
1134
 
1668
1135
  ### Shell command exit codes
1669
1136
 
1670
- All gateway-calling shell commands (`rlock`, `runlock`, `rlock-heartbeat`, `al-call`, `al-check`, `al-wait`) share a common exit code scheme. **Always check exit codes** — do not assume success.
1137
+ **Always check exit codes.**
1671
1138
 
1672
1139
  | Exit | Meaning | HTTP | When |
1673
1140
  |------|---------|------|------|
@@ -1697,10 +1164,4 @@ All gateway-calling shell commands (`rlock`, `runlock`, `rlock-heartbeat`, `al-c
1697
1164
  | 15 | Unrecoverable (default) |
1698
1165
  | 16 | User abort |
1699
1166
 
1700
- Shell command codes (0-12) don't overlap with agent codes (10-16) or POSIX signal codes (128+).
1701
-
1702
- **Lock commands** (`rlock`, `runlock`, `rlock-heartbeat`) exit 0 with `{"ok":true}` when `GATEWAY_URL` is unset (graceful degradation for local/non-containerized runs).
1703
-
1704
- **Call commands** (`al-call`, `al-check`, `al-wait`) exit 5 when `GATEWAY_URL` is unset — they require a gateway.
1705
-
1706
- **Timeout:** Container terminated by timeout exits with code 124.
1167
+ Timeout: exit 124.