@femtomc/mu-agent 26.2.101 → 26.2.103
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.
- package/README.md +5 -4
- package/dist/extensions/hud.d.ts.map +1 -1
- package/dist/extensions/hud.js +216 -15
- package/dist/operator.d.ts +176 -0
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +2 -169
- package/dist/session_factory.d.ts.map +1 -1
- package/dist/session_factory.js +21 -8
- package/dist/session_turn.d.ts.map +1 -1
- package/dist/session_turn.js +71 -16
- package/package.json +5 -5
- package/prompts/roles/operator.md +1 -0
- package/prompts/skills/hud/SKILL.md +12 -10
- package/prompts/skills/memory/SKILL.md +0 -3
- package/prompts/skills/mu/SKILL.md +87 -18
- package/prompts/skills/planning/SKILL.md +2 -1
- package/prompts/skills/setup-telegram/SKILL.md +5 -19
- package/prompts/skills/subagents/SKILL.md +2 -1
- package/prompts/skills/writing/SKILL.md +179 -0
|
@@ -11,9 +11,10 @@ run focused execution loops, and hand off to specialized skills when needed.
|
|
|
11
11
|
## Contents
|
|
12
12
|
|
|
13
13
|
- [Core contract](#core-contract)
|
|
14
|
+
- [CLI capability map](#cli-capability-map)
|
|
14
15
|
- [Default bounded investigation loop](#default-bounded-investigation-loop)
|
|
15
|
-
- [Common mutation patterns](#common-mutation-patterns)
|
|
16
|
-
- [Session and
|
|
16
|
+
- [Common mutation and diagnostics patterns](#common-mutation-and-diagnostics-patterns)
|
|
17
|
+
- [Session, serve, and one-shot surfaces](#session-serve-and-one-shot-surfaces)
|
|
17
18
|
- [Durable automation handoff](#durable-automation-handoff)
|
|
18
19
|
- [Evaluation scenarios](#evaluation-scenarios)
|
|
19
20
|
- [Escalation map](#escalation-map)
|
|
@@ -25,25 +26,66 @@ run focused execution loops, and hand off to specialized skills when needed.
|
|
|
25
26
|
- Start with bounded queries (`--limit`, scoped filters), then drill into specific entities.
|
|
26
27
|
|
|
27
28
|
2. **CLI-first state operations**
|
|
28
|
-
-
|
|
29
|
+
- Use `mu` command surfaces for state reads/writes (`issues`, `forum`, `memory`, `events`, `control`, `store`, `session`).
|
|
29
30
|
- Avoid hand-editing JSONL runtime journals for normal operations.
|
|
30
31
|
|
|
31
32
|
3. **Read -> act -> verify loop**
|
|
32
33
|
- Before writes: inspect relevant current state.
|
|
33
34
|
- After writes: re-read to confirm effect.
|
|
34
35
|
|
|
35
|
-
4. **
|
|
36
|
+
4. **Prefer self-discovery when uncertain**
|
|
37
|
+
- Run `mu --help` and `mu <command> --help` instead of guessing flags/subcommands.
|
|
38
|
+
- Use `mu guide` for the canonical in-CLI workflow map.
|
|
39
|
+
|
|
40
|
+
5. **Keep work reversible and explicit**
|
|
36
41
|
- Prefer small, composable steps.
|
|
37
42
|
- State assumptions and blockers clearly.
|
|
38
43
|
|
|
44
|
+
## CLI capability map
|
|
45
|
+
|
|
46
|
+
Use these command groups as the source of truth for current capabilities:
|
|
47
|
+
|
|
48
|
+
- Orientation + summaries:
|
|
49
|
+
- `mu --help`
|
|
50
|
+
- `mu guide`
|
|
51
|
+
- `mu status --pretty`
|
|
52
|
+
- Work graph + coordination:
|
|
53
|
+
- `mu issues <subcmd>`
|
|
54
|
+
- `mu forum <subcmd>`
|
|
55
|
+
- Context retrieval + traces:
|
|
56
|
+
- `mu memory <search|timeline|stats|index ...>`
|
|
57
|
+
- `mu events <list|trace ...>`
|
|
58
|
+
- Control-plane + operator config:
|
|
59
|
+
- `mu control status`
|
|
60
|
+
- `mu control harness`
|
|
61
|
+
- `mu control identities`
|
|
62
|
+
- `mu control operator <...>`
|
|
63
|
+
- `mu control config <get|set|unset ...>`
|
|
64
|
+
- `mu control reload`
|
|
65
|
+
- `mu control diagnose-operator`
|
|
66
|
+
- Session/runtime surfaces:
|
|
67
|
+
- `mu serve`, `mu stop`
|
|
68
|
+
- `mu session [list|config|<id>]`
|
|
69
|
+
- `mu turn ...`
|
|
70
|
+
- `mu exec ...`
|
|
71
|
+
- Durable automation:
|
|
72
|
+
- `mu heartbeats <...>`
|
|
73
|
+
- `mu cron <...>`
|
|
74
|
+
- Store forensics + replay:
|
|
75
|
+
- `mu store <paths|ls|tail ...>`
|
|
76
|
+
- `mu replay <id|path>`
|
|
77
|
+
- Provider auth:
|
|
78
|
+
- `mu login [<provider>] [--list] [--logout]`
|
|
79
|
+
|
|
39
80
|
## Default bounded investigation loop
|
|
40
81
|
|
|
41
82
|
```bash
|
|
42
83
|
mu status --pretty
|
|
43
84
|
mu issues list --status open --limit 20 --pretty
|
|
44
85
|
mu issues ready --limit 20 --pretty
|
|
45
|
-
mu forum
|
|
86
|
+
mu forum topics --prefix issue: --limit 20 --pretty
|
|
46
87
|
mu memory search --query "<topic>" --limit 20
|
|
88
|
+
mu events list --limit 20 --pretty
|
|
47
89
|
mu store tail events --limit 20 --pretty
|
|
48
90
|
```
|
|
49
91
|
|
|
@@ -52,37 +94,54 @@ Then inspect concrete targets:
|
|
|
52
94
|
```bash
|
|
53
95
|
mu issues get <id> --pretty
|
|
54
96
|
mu forum read issue:<id> --limit 20 --pretty
|
|
97
|
+
mu memory timeline --issue-id <id> --order desc --limit 40 --pretty
|
|
55
98
|
```
|
|
56
99
|
|
|
57
|
-
## Common mutation patterns
|
|
100
|
+
## Common mutation and diagnostics patterns
|
|
58
101
|
|
|
59
102
|
Issue/forum lifecycle:
|
|
60
103
|
|
|
61
104
|
```bash
|
|
105
|
+
mu issues claim <id> --pretty
|
|
62
106
|
mu issues update <id> --status in_progress --pretty
|
|
63
107
|
mu forum post issue:<id> -m "START: <plan>" --author operator
|
|
64
108
|
mu forum post issue:<id> -m "RESULT: <summary>" --author operator
|
|
65
109
|
mu issues close <id> --outcome success --pretty
|
|
66
110
|
```
|
|
67
111
|
|
|
68
|
-
Control-plane lifecycle:
|
|
112
|
+
Control-plane lifecycle and config:
|
|
69
113
|
|
|
70
114
|
```bash
|
|
71
115
|
mu control status --pretty
|
|
116
|
+
mu control harness --pretty
|
|
72
117
|
mu control identities --all --pretty
|
|
118
|
+
mu control config get --pretty
|
|
119
|
+
mu control operator get --pretty
|
|
73
120
|
mu control reload
|
|
74
121
|
```
|
|
75
122
|
|
|
76
|
-
|
|
123
|
+
Targeted config/operator updates:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
mu control config set control_plane.operator.enabled false
|
|
127
|
+
mu control config set control_plane.memory_index.every_ms 120000
|
|
128
|
+
mu control operator set openai-codex gpt-5.3-codex high
|
|
129
|
+
mu control diagnose-operator --limit 40 --pretty
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Store forensics and run replay:
|
|
77
133
|
|
|
78
134
|
```bash
|
|
135
|
+
mu store paths --pretty
|
|
79
136
|
mu store ls --pretty
|
|
80
137
|
mu store tail cp_commands --limit 20 --pretty
|
|
81
138
|
mu store tail cp_outbox --limit 20 --pretty
|
|
82
139
|
mu store tail cp_adapter_audit --limit 20 --pretty
|
|
140
|
+
mu store tail cp_operator_turns --limit 20 --pretty
|
|
141
|
+
mu replay <issue-id-or-log-path>
|
|
83
142
|
```
|
|
84
143
|
|
|
85
|
-
## Session and
|
|
144
|
+
## Session, serve, and one-shot surfaces
|
|
86
145
|
|
|
87
146
|
Primary interactive surface:
|
|
88
147
|
|
|
@@ -93,9 +152,17 @@ mu serve
|
|
|
93
152
|
Session follow-ups/handoffs:
|
|
94
153
|
|
|
95
154
|
```bash
|
|
96
|
-
mu session list --json --pretty
|
|
155
|
+
mu session list --kind all --all-workspaces --limit 50 --json --pretty
|
|
97
156
|
mu session <session-id>
|
|
98
157
|
mu turn --session-kind operator --session-id <session-id> --body "<follow-up>"
|
|
158
|
+
mu session config get --session-id <session-id>
|
|
159
|
+
mu session config set-thinking --session-id <session-id> --thinking minimal
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
One-shot prompt (no durable session):
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mu exec --message "<task>" --json
|
|
99
166
|
```
|
|
100
167
|
|
|
101
168
|
In attached terminal operator chat, `/mu` helpers are available (`/mu events`, `/mu hud ...`, `/mu help`).
|
|
@@ -110,8 +177,8 @@ mu cron --help
|
|
|
110
177
|
```
|
|
111
178
|
|
|
112
179
|
When work is multi-step and issue-graph driven, use `planning` to shape the DAG,
|
|
113
|
-
then `hierarchical-work-protocol` to keep DAG
|
|
114
|
-
`subagents` for durable execution.
|
|
180
|
+
then `hud` for canonical HUD behavior, then `hierarchical-work-protocol` to keep DAG
|
|
181
|
+
semantics consistent, then `subagents` for durable execution.
|
|
115
182
|
For recurring bounded automation loops, use `heartbeats`.
|
|
116
183
|
For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
|
|
117
184
|
|
|
@@ -119,20 +186,21 @@ For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
|
|
|
119
186
|
|
|
120
187
|
1. **Bounded investigation before mutation**
|
|
121
188
|
- Prompt: user asks for status + targeted change.
|
|
122
|
-
- Expected:
|
|
189
|
+
- Expected: gather scoped evidence first (`mu status`, `issues`, `forum`, `memory`/`events`), then perform minimal write and verify post-state.
|
|
123
190
|
|
|
124
191
|
2. **Control-plane diagnostics loop**
|
|
125
|
-
- Prompt:
|
|
126
|
-
- Expected:
|
|
192
|
+
- Prompt: messaging channel stopped responding.
|
|
193
|
+
- Expected: inspect `mu control status`, `harness`, identities, adapter audit/outbox logs; then apply smallest reversible fix (`config set`, relink, `reload`) and verify.
|
|
127
194
|
|
|
128
|
-
3. **Session
|
|
129
|
-
- Prompt:
|
|
130
|
-
- Expected:
|
|
195
|
+
3. **Session continuity + scope-safe config**
|
|
196
|
+
- Prompt: continue prior operator thread with model/thinking tweaks.
|
|
197
|
+
- Expected: use `mu session list` + `mu session <id>`/`mu turn`; when needed, apply `mu session config ...` (session-scoped) instead of mutating global defaults.
|
|
131
198
|
|
|
132
199
|
## Escalation map
|
|
133
200
|
|
|
134
201
|
- Historical context retrieval and index maintenance: **`memory`**
|
|
135
202
|
- Planning/decomposition and DAG review: **`planning`**
|
|
203
|
+
- HUD contract/state updates across surfaces: **`hud`**
|
|
136
204
|
- Shared DAG semantics for planning + execution: **`hierarchical-work-protocol`**
|
|
137
205
|
- Durable multi-agent orchestration: **`subagents`**
|
|
138
206
|
- Recurring bounded automation scheduling: **`heartbeats`**
|
|
@@ -142,3 +210,4 @@ For wall-clock schedules (one-shot, interval, cron-expression), use `crons`.
|
|
|
142
210
|
- **`setup-discord`**
|
|
143
211
|
- **`setup-telegram`**
|
|
144
212
|
- **`setup-neovim`**
|
|
213
|
+
- Technical writing/docs polish: **`writing`**
|
|
@@ -117,12 +117,13 @@ Tool contract (preferred when tools are available):
|
|
|
117
117
|
- `kv` status block (`phase`, `root`, `waiting_on_user`, `confidence`, `next_action`, `blocker`)
|
|
118
118
|
- `checklist` block for plan milestones
|
|
119
119
|
- actions: include useful follow-ups (for example, `snapshot`)
|
|
120
|
+
- metadata: include `style_preset:"planning"` for consistent renderer emphasis without repeating style hints
|
|
120
121
|
|
|
121
122
|
Example tool calls:
|
|
122
123
|
- Turn HUD on:
|
|
123
124
|
- `{"action":"on"}`
|
|
124
125
|
- Set/replace planning doc after investigation pass:
|
|
125
|
-
- `{"action":"set","doc":{"v":1,"hud_id":"planning","title":"Planning HUD","scope":"mu-root-123","chips":[{"key":"phase","label":"phase:investigating","tone":"dim"},{"key":"steps","label":"steps:1/4","tone":"accent"},{"key":"waiting","label":"waiting:no","tone":"dim"},{"key":"confidence","label":"conf:medium","tone":"accent"}],"sections":[{"kind":"kv","title":"Status","items":[{"key":"phase","label":"phase","value":"investigating"},{"key":"root","label":"root","value":"mu-root-123"},{"key":"waiting","label":"waiting_on_user","value":"no"},{"key":"confidence","label":"confidence","value":"medium"},{"key":"next","label":"next_action","value":"Draft root DAG"},{"key":"blocker","label":"blocker","value":"(none)"}]},{"kind":"checklist","title":"Checklist","items":[{"id":"1","label":"Investigate relevant code/docs/state","done":true},{"id":"2","label":"Create root + child issue DAG","done":false},{"id":"3","label":"Present plan + tradeoffs","done":false},{"id":"4","label":"Refine until approved","done":false}]}],"actions":[{"id":"snapshot","label":"Snapshot","command_text":"/mu hud snapshot","kind":"secondary"}],"snapshot_compact":"HUD(plan) · phase=investigating · steps=1/4 · waiting=no · conf=medium","updated_at_ms":1771853115000,"metadata":{"phase":"investigating","waiting_on_user":false,"confidence":"medium"}}}`
|
|
126
|
+
- `{"action":"set","doc":{"v":1,"hud_id":"planning","title":"Planning HUD","scope":"mu-root-123","chips":[{"key":"phase","label":"phase:investigating","tone":"dim"},{"key":"steps","label":"steps:1/4","tone":"accent"},{"key":"waiting","label":"waiting:no","tone":"dim"},{"key":"confidence","label":"conf:medium","tone":"accent"}],"sections":[{"kind":"kv","title":"Status","items":[{"key":"phase","label":"phase","value":"investigating"},{"key":"root","label":"root","value":"mu-root-123"},{"key":"waiting","label":"waiting_on_user","value":"no"},{"key":"confidence","label":"confidence","value":"medium"},{"key":"next","label":"next_action","value":"Draft root DAG"},{"key":"blocker","label":"blocker","value":"(none)"}]},{"kind":"checklist","title":"Checklist","items":[{"id":"1","label":"Investigate relevant code/docs/state","done":true},{"id":"2","label":"Create root + child issue DAG","done":false},{"id":"3","label":"Present plan + tradeoffs","done":false},{"id":"4","label":"Refine until approved","done":false}]}],"actions":[{"id":"snapshot","label":"Snapshot","command_text":"/mu hud snapshot","kind":"secondary"}],"snapshot_compact":"HUD(plan) · phase=investigating · steps=1/4 · waiting=no · conf=medium","updated_at_ms":1771853115000,"metadata":{"style_preset":"planning","phase":"investigating","waiting_on_user":false,"confidence":"medium"}}}`
|
|
126
127
|
- Human-facing status line:
|
|
127
128
|
- `{"action":"snapshot","snapshot_format":"compact"}`
|
|
128
129
|
|
|
@@ -21,8 +21,6 @@ Goal: get Telegram bot ingress and reply delivery working with minimal user-side
|
|
|
21
21
|
- Public webhook base URL reachable by Telegram (for example `https://mu.example.com`)
|
|
22
22
|
- Telegram bot token (from BotFather)
|
|
23
23
|
|
|
24
|
-
Optional (agent can usually discover):
|
|
25
|
-
- Bot username
|
|
26
24
|
|
|
27
25
|
## Agent-first workflow
|
|
28
26
|
|
|
@@ -47,18 +45,10 @@ mu control identities --all --pretty
|
|
|
47
45
|
|
|
48
46
|
If no running server is available, ask user to start `mu serve` in another terminal before reload/route checks.
|
|
49
47
|
|
|
50
|
-
### 2) Generate webhook secret
|
|
48
|
+
### 2) Generate webhook secret
|
|
51
49
|
|
|
52
50
|
Generate a strong webhook secret (do not expose it in final summaries).
|
|
53
51
|
|
|
54
|
-
If outbound network is available, discover bot username:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
curl -sS "https://api.telegram.org/bot<bot-token>/getMe"
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Extract `result.username` when present.
|
|
61
|
-
|
|
62
52
|
### 3) Configure Telegram webhook (agent does this when possible)
|
|
63
53
|
|
|
64
54
|
Set webhook to `https://<public-base>/webhooks/telegram` with secret token:
|
|
@@ -78,7 +68,6 @@ Use this canonical patch snippet (preserves unrelated keys):
|
|
|
78
68
|
```bash
|
|
79
69
|
export MU_TELEGRAM_WEBHOOK_SECRET='<TELEGRAM_WEBHOOK_SECRET>'
|
|
80
70
|
export MU_TELEGRAM_BOT_TOKEN='<TELEGRAM_BOT_TOKEN>'
|
|
81
|
-
export MU_TELEGRAM_BOT_USERNAME='<TELEGRAM_BOT_USERNAME_OR_EMPTY>'
|
|
82
71
|
config_path="$(mu control status --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["config_path"])')"
|
|
83
72
|
|
|
84
73
|
python3 - "$config_path" <<'PY'
|
|
@@ -98,8 +87,6 @@ adapters = cp.setdefault("adapters", {})
|
|
|
98
87
|
telegram = adapters.setdefault("telegram", {})
|
|
99
88
|
telegram["webhook_secret"] = os.environ["MU_TELEGRAM_WEBHOOK_SECRET"]
|
|
100
89
|
telegram["bot_token"] = os.environ["MU_TELEGRAM_BOT_TOKEN"]
|
|
101
|
-
username = os.environ.get("MU_TELEGRAM_BOT_USERNAME", "").strip()
|
|
102
|
-
telegram["bot_username"] = username or None
|
|
103
90
|
|
|
104
91
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
105
92
|
path.write_text(json.dumps(data, indent=2) + "\n")
|
|
@@ -107,8 +94,7 @@ PY
|
|
|
107
94
|
```
|
|
108
95
|
|
|
109
96
|
Replace placeholder values with secrets from the user.
|
|
110
|
-
|
|
111
|
-
Then `unset MU_TELEGRAM_WEBHOOK_SECRET MU_TELEGRAM_BOT_TOKEN MU_TELEGRAM_BOT_USERNAME` after patching.
|
|
97
|
+
Then `unset MU_TELEGRAM_WEBHOOK_SECRET MU_TELEGRAM_BOT_TOKEN` after patching.
|
|
112
98
|
|
|
113
99
|
### 5) Reload and verify
|
|
114
100
|
|
|
@@ -160,9 +146,9 @@ Ask user to send `/mu status` (or plain status text) and verify response deliver
|
|
|
160
146
|
- Inputs: agent cannot reach `api.telegram.org`.
|
|
161
147
|
- Expected: skill hands user exact `setWebhook` command, resumes after confirmation, and still completes local config/reload verification.
|
|
162
148
|
|
|
163
|
-
3. **
|
|
164
|
-
- Inputs:
|
|
165
|
-
- Expected:
|
|
149
|
+
3. **Token+secret only configuration**
|
|
150
|
+
- Inputs: valid bot token + webhook secret, no username discovery step.
|
|
151
|
+
- Expected: adapter activates and identity link can proceed from audit chat id.
|
|
166
152
|
|
|
167
153
|
## Safety requirements
|
|
168
154
|
|
|
@@ -192,8 +192,9 @@ Tool: `mu_hud`
|
|
|
192
192
|
- chips: health, mode, paused
|
|
193
193
|
- sections: queue counts + recent activity lines
|
|
194
194
|
- actions: refresh/spawn command hooks (if desired)
|
|
195
|
+
- metadata: include `style_preset:"subagents"` for consistent renderer emphasis
|
|
195
196
|
- Example update:
|
|
196
|
-
- `{"action":"set","doc":{"v":1,"hud_id":"subagents","title":"Subagents HUD","scope":"mu-root-123","chips":[{"key":"health","label":"healthy","tone":"success"},{"key":"mode","label":"mode:operator","tone":"dim"},{"key":"paused","label":"paused:no","tone":"dim"}],"sections":[{"kind":"kv","title":"Queue","items":[{"key":"ready","label":"Ready","value":"3"},{"key":"active","label":"Active","value":"2"},{"key":"sessions","label":"Sessions","value":"2"}]},{"kind":"activity","title":"Activity","lines":["Spawned worker for mu-abc123","Posted ORCH_PASS update"]}],"actions":[{"id":"refresh","label":"Refresh","command_text":"/mu hud snapshot","kind":"secondary"}],"snapshot_compact":"HUD(subagents) · healthy · mode=operator · ready=3 · active=2","updated_at_ms":1771853115000,"metadata":{"spawn_mode":"operator","spawn_paused":false}}}`
|
|
197
|
+
- `{"action":"set","doc":{"v":1,"hud_id":"subagents","title":"Subagents HUD","scope":"mu-root-123","chips":[{"key":"health","label":"healthy","tone":"success"},{"key":"mode","label":"mode:operator","tone":"dim"},{"key":"paused","label":"paused:no","tone":"dim"}],"sections":[{"kind":"kv","title":"Queue","items":[{"key":"ready","label":"Ready","value":"3"},{"key":"active","label":"Active","value":"2"},{"key":"sessions","label":"Sessions","value":"2"}]},{"kind":"activity","title":"Activity","lines":["Spawned worker for mu-abc123","Posted ORCH_PASS update"]}],"actions":[{"id":"refresh","label":"Refresh","command_text":"/mu hud snapshot","kind":"secondary"}],"snapshot_compact":"HUD(subagents) · healthy · mode=operator · ready=3 · active=2","updated_at_ms":1771853115000,"metadata":{"style_preset":"subagents","spawn_mode":"operator","spawn_paused":false}}}`
|
|
197
198
|
|
|
198
199
|
## Evaluation scenarios
|
|
199
200
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing
|
|
3
|
+
description: "Crafts clear, precise technical documentation. Use when writing or reviewing docs, PR descriptions, error messages, READMEs, API references, or any technical prose."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# writing
|
|
7
|
+
|
|
8
|
+
Use this skill when asked to write, edit, or review technical prose. This includes documentation, READMEs, PR descriptions, error messages, comments, API references, and commit messages.
|
|
9
|
+
|
|
10
|
+
## Contents
|
|
11
|
+
|
|
12
|
+
- [Core contract](#core-contract)
|
|
13
|
+
- [Writing workflows](#writing-workflows)
|
|
14
|
+
- [Common patterns by document type](#common-patterns-by-document-type)
|
|
15
|
+
- [Editing and review workflow](#editing-and-review-workflow)
|
|
16
|
+
- [Evaluation scenarios](#evaluation-scenarios)
|
|
17
|
+
|
|
18
|
+
## Core contract
|
|
19
|
+
|
|
20
|
+
1. **Audience first**
|
|
21
|
+
- Identify the reader's baseline knowledge before writing.
|
|
22
|
+
- Write for the busiest reader who needs this information.
|
|
23
|
+
- Honor their time: front-load the essential information.
|
|
24
|
+
|
|
25
|
+
2. **Clarity over style**
|
|
26
|
+
- One idea per sentence. Complex concepts deserve their own space.
|
|
27
|
+
- Active voice: "The system returns an error" not "An error is returned by the system."
|
|
28
|
+
- Precise terminology: use the same word for the same concept throughout.
|
|
29
|
+
- Concrete over abstract: "200ms latency" beats "fast performance."
|
|
30
|
+
|
|
31
|
+
3. **Structure for scanability**
|
|
32
|
+
- Headings should communicate the document structure without reading prose.
|
|
33
|
+
- Lists for parallel items (bullets for unordered, numbers for sequences).
|
|
34
|
+
- Code blocks and tables over prose descriptions.
|
|
35
|
+
- Inverted pyramid: conclusion, supporting details, background.
|
|
36
|
+
|
|
37
|
+
4. **Actionability**
|
|
38
|
+
- Imperative for procedures: "Run the migration" not "The migration should be run."
|
|
39
|
+
- Explicit consequences: state what happens if the user does X.
|
|
40
|
+
- Anticipate failure modes in troubleshooting sections.
|
|
41
|
+
|
|
42
|
+
5. **Accessibility**
|
|
43
|
+
- Plain language: avoid Latin abbreviations, buzzwords, metaphor-heavy descriptions.
|
|
44
|
+
- Sentence length: average 15-20 words. Vary rhythm but never confuse length with sophistication.
|
|
45
|
+
- Context for jargon: define domain-specific terms on first use or link to definitions.
|
|
46
|
+
|
|
47
|
+
6. **Verify by reading aloud**
|
|
48
|
+
- Awkward phrasing surfaces when spoken.
|
|
49
|
+
- Test instructions by following them exactly as written.
|
|
50
|
+
- Delete mercilessly: if a sentence doesn't inform or direct, cut it.
|
|
51
|
+
|
|
52
|
+
## Writing workflows
|
|
53
|
+
|
|
54
|
+
### A) Documentation from scratch
|
|
55
|
+
|
|
56
|
+
1. **Identify the audience and goal**
|
|
57
|
+
- Who will read this? What do they know? What must they do after reading?
|
|
58
|
+
|
|
59
|
+
2. **Outline the structure**
|
|
60
|
+
- Opening paragraph: what this document covers and why it matters.
|
|
61
|
+
- Body: group related concepts, sequence procedures in order of execution.
|
|
62
|
+
- Closing: next steps, related resources, or troubleshooting.
|
|
63
|
+
|
|
64
|
+
3. **Draft with constraints**
|
|
65
|
+
- Maximum 25 words per sentence on average.
|
|
66
|
+
- Active voice for all instructions.
|
|
67
|
+
- Code examples for any behavior described.
|
|
68
|
+
|
|
69
|
+
4. **Review against the contract**
|
|
70
|
+
- Scan test: can a reader grasp structure from headings alone?
|
|
71
|
+
- Action test: can a reader execute procedures without asking questions?
|
|
72
|
+
- Deletion pass: remove sentences that don't inform or direct.
|
|
73
|
+
|
|
74
|
+
### B) PR/commit description
|
|
75
|
+
|
|
76
|
+
1. **What changed** (imperative, present tense)
|
|
77
|
+
2. **Why it changed** (context, motivation)
|
|
78
|
+
3. **How to verify** (testing steps, expected outcomes)
|
|
79
|
+
4. **Breaking changes** (if any, with migration path)
|
|
80
|
+
|
|
81
|
+
Keep under 80 characters per line in the summary. Body wraps at 72 characters.
|
|
82
|
+
|
|
83
|
+
### C) Error messages
|
|
84
|
+
|
|
85
|
+
1. **State what happened** (not what didn't)
|
|
86
|
+
2. **Explain why** (the root cause, if known)
|
|
87
|
+
3. **Provide the fix** (concrete next step, not generic advice)
|
|
88
|
+
4. **Include identifiers** (error codes, relevant IDs, log locations)
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
```
|
|
92
|
+
Error: Connection refused to database 'prod-db' on port 5432.
|
|
93
|
+
Cause: The database service is not running or firewall blocks port 5432.
|
|
94
|
+
Fix: Start the service with 'sudo systemctl start postgresql' or verify firewall rules.
|
|
95
|
+
Log: See /var/log/postgresql/postgresql-14-main.log for details.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Common patterns by document type
|
|
99
|
+
|
|
100
|
+
### README.md
|
|
101
|
+
|
|
102
|
+
Structure:
|
|
103
|
+
1. One-line description of what this is
|
|
104
|
+
2. Installation/usage (minimal working example)
|
|
105
|
+
3. Key features (bullet list)
|
|
106
|
+
4. Configuration/options
|
|
107
|
+
5. Contributing/troubleshooting links
|
|
108
|
+
|
|
109
|
+
### API documentation
|
|
110
|
+
|
|
111
|
+
Per endpoint:
|
|
112
|
+
- Purpose (one sentence)
|
|
113
|
+
- HTTP method and path
|
|
114
|
+
- Parameters (name, type, required, description)
|
|
115
|
+
- Request/response examples
|
|
116
|
+
- Error codes and meanings
|
|
117
|
+
|
|
118
|
+
### Inline code comments
|
|
119
|
+
|
|
120
|
+
- **Why**, not what: explain intent, not obvious behavior.
|
|
121
|
+
- Non-obvious side effects or assumptions.
|
|
122
|
+
- TODO/FIXME with issue references, not vague notes.
|
|
123
|
+
- Public APIs: docstrings with parameters, returns, raises.
|
|
124
|
+
|
|
125
|
+
### Configuration docs
|
|
126
|
+
|
|
127
|
+
- Default values explicitly stated.
|
|
128
|
+
- Units for all numeric values (ms, bytes, percent).
|
|
129
|
+
- Validation constraints (min/max, allowed values).
|
|
130
|
+
- Impact of changing the value (what breaks, what improves).
|
|
131
|
+
|
|
132
|
+
## Editing and review workflow
|
|
133
|
+
|
|
134
|
+
When reviewing existing prose:
|
|
135
|
+
|
|
136
|
+
1. **Structural audit**
|
|
137
|
+
- Does the outline serve the reader's goal?
|
|
138
|
+
- Are headings descriptive? Is sequencing logical?
|
|
139
|
+
|
|
140
|
+
2. **Sentence-level edits**
|
|
141
|
+
- Convert passive to active voice.
|
|
142
|
+
- Replace vague quantifiers ("some", "many") with specifics.
|
|
143
|
+
- Break long sentences (\> 25 words) into two.
|
|
144
|
+
|
|
145
|
+
3. **Accuracy check**
|
|
146
|
+
- Verify all code examples execute as written.
|
|
147
|
+
- Confirm version numbers, paths, and URLs are current.
|
|
148
|
+
- Check that error messages match actual output.
|
|
149
|
+
|
|
150
|
+
4. **Final polish**
|
|
151
|
+
- Read aloud for awkward rhythm.
|
|
152
|
+
- Consistent formatting (punctuation in lists, code fences with languages).
|
|
153
|
+
- Spelling and grammar (but prioritize clarity over grammatical perfection).
|
|
154
|
+
|
|
155
|
+
## Evaluation scenarios
|
|
156
|
+
|
|
157
|
+
1. **Drafting documentation for a new feature**
|
|
158
|
+
- Prompt: user asks for docs for a feature they've implemented.
|
|
159
|
+
- Expected: skill identifies audience, structures around user goals not implementation details, includes working examples, and ends with verification steps.
|
|
160
|
+
|
|
161
|
+
2. **Reviewing a PR description**
|
|
162
|
+
- Prompt: user shares a draft PR description for feedback.
|
|
163
|
+
- Expected: skill checks for imperative summary line, clear what/why/how structure, and explicit breaking change notice if applicable.
|
|
164
|
+
|
|
165
|
+
3. **Improving error messages**
|
|
166
|
+
- Prompt: user shares error handling code or current error text.
|
|
167
|
+
- Expected: skill transforms vague messages into specific what/why/fix format with actionable next steps and relevant identifiers.
|
|
168
|
+
|
|
169
|
+
4. **Editing README for clarity**
|
|
170
|
+
- Prompt: user asks for help with a project's README.
|
|
171
|
+
- Expected: skill restructures for inverted pyramid, adds minimal working example, replaces feature paragraphs with scannable lists, and ensures installation steps are complete and ordered.
|
|
172
|
+
|
|
173
|
+
## Quality bar
|
|
174
|
+
|
|
175
|
+
- Every sentence earns its place: informs or directs.
|
|
176
|
+
- No sentence requires a second reading to understand.
|
|
177
|
+
- A reader can act on instructions without asking clarifying questions.
|
|
178
|
+
- Code examples execute without modification.
|
|
179
|
+
- A skim reader grasps the document's purpose and structure.
|