|
| 1 | +# Control Directives |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Users can configure session-level parameters by adding `[[key:value]]` directives to their first message. These are parsed and stripped before the prompt reaches the agent. |
| 6 | + |
| 7 | +## Format |
| 8 | + |
| 9 | +``` |
| 10 | +@Bot [[ws:@openab]] [[title:Fix CI workflow]] |
| 11 | +help me debug the smoke test failures |
| 12 | +``` |
| 13 | + |
| 14 | +Rules: |
| 15 | +- Directives are only processed on the **first message** of a session |
| 16 | +- Consecutive `[[key:value]]` tokens at the start = directive header |
| 17 | +- First non-directive token/line = prompt content begins |
| 18 | +- Later `[[key:value]]` text in the message body is preserved verbatim |
| 19 | +- Duplicate keys: last value wins |
| 20 | +- Unknown keys: silently ignored (forward compatible) |
| 21 | +- Directives may span multiple lines: |
| 22 | + ``` |
| 23 | + [[ws:@openab]] |
| 24 | + [[title:Review PR]] |
| 25 | + please review this change |
| 26 | + ``` |
| 27 | + |
| 28 | +## Available Directives |
| 29 | + |
| 30 | +### `ws` — Workspace |
| 31 | + |
| 32 | +Set the session's working directory. The agent starts with this path as cwd, loading steering files and skills from it. |
| 33 | + |
| 34 | +``` |
| 35 | +[[ws:~/projects/myapp]] |
| 36 | +[[ws:@openab]] |
| 37 | +``` |
| 38 | + |
| 39 | +**Alias syntax:** Use `@name` to reference a configured alias (see [Workspaces](workspaces.md)). |
| 40 | + |
| 41 | +**Security:** |
| 42 | +- Path must be absolute (`~` or `/` prefix) |
| 43 | +- `~` expands to bot home directory (`$HOME`) |
| 44 | +- Path must exist and be a directory |
| 45 | +- Path must be within bot home subtree (symlink escapes caught by canonicalization) |
| 46 | +- Invalid paths abort the session with a user-visible error |
| 47 | + |
| 48 | +### `title` — Thread Title |
| 49 | + |
| 50 | +Set the initial thread/channel title (max 100 characters, truncated silently). |
| 51 | + |
| 52 | +``` |
| 53 | +[[title:Bug triage #42]] |
| 54 | +``` |
| 55 | + |
| 56 | +- Empty value (`[[title:]]`) = use auto-generated title |
| 57 | +- The agent may override this later per its own workflow |
| 58 | + |
| 59 | +## Behavior |
| 60 | + |
| 61 | +- Directives are **immutable** — once a session starts, parameters cannot be changed mid-conversation |
| 62 | +- To change workspace or title, start a new session |
| 63 | +- If no `[[ws:...]]` is specified, the session uses the bot's default working directory |
| 64 | +- If workspace resolution fails on a new session, the session is not created. However, `[[title:...]]` is applied independently before workspace validation — the thread title may already be set even if the session aborts. |
| 65 | + |
| 66 | +## Relationship to Output Directives |
| 67 | + |
| 68 | +| Aspect | Output Directives | Control Directives | |
| 69 | +|--------|-------------------|-------------------| |
| 70 | +| Direction | Agent → Platform | User → Bot | |
| 71 | +| Timing | Every response | First message only | |
| 72 | +| Syntax | `[[key:value]]` | `[[key:value]]` | |
| 73 | + |
| 74 | +## Future Directives (Phase 2+) |
| 75 | + |
| 76 | +| Directive | Purpose | |
| 77 | +|-----------|---------| |
| 78 | +| `[[model:...]]` | Select model for the session | |
| 79 | +| `[[repo:owner/repo]]` | Bind GitHub repository context | |
| 80 | +| `[[timeout:300]]` | Session timeout in seconds | |
| 81 | + |
| 82 | +## See Also |
| 83 | + |
| 84 | +- [Workspaces](workspaces.md) — configuring workspace aliases |
| 85 | +- [Output Directives](output-directives.md) — agent → platform directives |
| 86 | +- [ADR: Control Directives](adr/control-directives.md) — design rationale |
0 commit comments