@dougharness/cli 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/bin.js +10 -3
  2. package/dist/bin.js.map +1 -1
  3. package/dist/board-serve.js +45 -10
  4. package/dist/board-serve.js.map +1 -1
  5. package/dist/board.d.ts +1 -1
  6. package/dist/board.js +33 -8
  7. package/dist/board.js.map +1 -1
  8. package/dist/init.js +1 -1
  9. package/dist/init.js.map +1 -1
  10. package/dist/memory-setup.d.ts +7 -0
  11. package/dist/memory-setup.js +75 -48
  12. package/dist/memory-setup.js.map +1 -1
  13. package/node_modules/@dougharness/flow/.claude-plugin/plugin.json +6 -2
  14. package/node_modules/@dougharness/flow/agents/coder.md +23 -0
  15. package/node_modules/@dougharness/flow/agents/lead.md +1 -1
  16. package/node_modules/@dougharness/flow/agents/planner.md +2 -2
  17. package/node_modules/@dougharness/flow/agents/spec-writer.md +23 -0
  18. package/node_modules/@dougharness/flow/agents/tester.md +21 -0
  19. package/node_modules/@dougharness/flow/hooks/hooks.json +4 -1
  20. package/node_modules/@dougharness/flow/hooks/register.tsx +75 -0
  21. package/node_modules/@dougharness/flow/lib/autopilot-core.mjs +117 -0
  22. package/node_modules/@dougharness/flow/lib/autopilot-view.mjs +17 -0
  23. package/node_modules/@dougharness/flow/lib/board.mjs +107 -10
  24. package/node_modules/@dougharness/flow/lib/card-land.mjs +115 -0
  25. package/node_modules/@dougharness/flow/lib/card-loop.mjs +746 -0
  26. package/node_modules/@dougharness/flow/lib/coordinator.mjs +368 -0
  27. package/node_modules/@dougharness/flow/lib/cost.mjs +44 -11
  28. package/node_modules/@dougharness/flow/lib/embeddings.mjs +147 -4
  29. package/node_modules/@dougharness/flow/lib/land.mjs +33 -9
  30. package/node_modules/@dougharness/flow/lib/memory.mjs +96 -33
  31. package/node_modules/@dougharness/flow/lib/plan.mjs +34 -5
  32. package/node_modules/@dougharness/flow/lib/worktrees.mjs +3 -3
  33. package/node_modules/@dougharness/flow/package.json +1 -1
  34. package/node_modules/@dougharness/flow/scripts/autopilot.mjs +407 -0
  35. package/node_modules/@dougharness/flow/scripts/board.mjs +128 -32
  36. package/node_modules/@dougharness/flow/scripts/context.mjs +4 -2
  37. package/node_modules/@dougharness/flow/scripts/cost.mjs +16 -3
  38. package/node_modules/@dougharness/flow/scripts/memory.mjs +29 -14
  39. package/node_modules/@dougharness/flow/scripts/plan.mjs +122 -30
  40. package/node_modules/@dougharness/flow/skills/doug-hand/SKILL.md +10 -4
  41. package/node_modules/@dougharness/flow/skills/doug-next/SKILL.md +34 -12
  42. package/node_modules/@dougharness/flow/skills/doug-plan/SKILL.md +1 -1
  43. package/node_modules/@dougharness/flow/skills/doug-start/SKILL.md +80 -0
  44. package/node_modules/@dougharness/flow/skills/doug-swarm/SKILL.md +2 -2
  45. package/node_modules/@dougharness/flow/skills/run-report/SKILL.md +12 -10
  46. package/node_modules/@dougharness/flow/workflows/card-queen.js +807 -0
  47. package/node_modules/@dougharness/flow/workflows/doug-implement.js +33 -21
  48. package/node_modules/@dougharness/gates/.claude-plugin/plugin.json +1 -1
  49. package/node_modules/@dougharness/gates/lib/anchor.mjs +29 -4
  50. package/node_modules/@dougharness/gates/lib/bash-rules.mjs +217 -20
  51. package/node_modules/@dougharness/gates/lib/gate-lock.mjs +126 -0
  52. package/node_modules/@dougharness/gates/lib/proposals.mjs +41 -5
  53. package/node_modules/@dougharness/gates/lib/scope.mjs +43 -4
  54. package/node_modules/@dougharness/gates/package.json +1 -1
  55. package/node_modules/@dougharness/gates/scripts/reanchor.mjs +2 -1
  56. package/node_modules/@dougharness/gates/scripts/stop-gate.mjs +148 -97
  57. package/node_modules/@dougharness/gates/scripts/verify.mjs +64 -5
  58. package/package.json +4 -4
  59. package/templates/board-app.js +48 -1
@@ -1,9 +1,10 @@
1
1
  // `doug memory setup`: find a running local embedding server, verify it, and (on the user's yes) enable it in
2
- // .doug/config.json. Never installs anything, never runs a child process, never throws for a bad server.
2
+ // .doug/config.json. Only when no server runs does it offer, as a second yes, to install the bundled local
3
+ // model into the user-level cache. Never throws for a bad server.
3
4
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
5
  import { join } from "node:path";
5
6
  import { createInterface } from "node:readline";
6
- import { checkEmbeddingSanity, createProvider, DEFAULT_SANITY_PAIRS, doctorReport, loadSanityPairs, probeProvider, readMemoryConfig } from "@dougharness/flow/lib/embeddings.mjs";
7
+ import { checkEmbeddingSanity, createProvider, DEFAULT_SANITY_PAIRS, doctorReport, downloadLocalModel, installLocalRuntime, loadSanityPairs, localCacheDir, probeProvider, readMemoryConfig } from "@dougharness/flow/lib/embeddings.mjs";
7
8
  import { embedLessons, openMemory } from "@dougharness/flow/lib/memory.mjs";
8
9
  const LLAMA_HINT = "llama-server -m <embedding model>.gguf --embeddings";
9
10
  // Conventional default ports. Verified: Ollama 11434, llama-server 8080, Unsloth Studio 8888.
@@ -166,6 +167,53 @@ function defaultAsk(question) {
166
167
  function urlEndpoint(url) {
167
168
  return { id: "url", label: "the given server", url, hint: "load or serve an embedding model in that server" };
168
169
  }
170
+ // Writes memory.embeddings into .doug/config.json, re-embeds the existing lessons, prints the doctor report.
171
+ // provider null means the config just written names the provider (the local preset).
172
+ async function enable(dir, provider, embeddingsConfig, out, local) {
173
+ const file = join(dir, ".doug", "config.json");
174
+ let config = null;
175
+ try {
176
+ if (existsSync(file)) {
177
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
178
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
179
+ config = parsed;
180
+ }
181
+ }
182
+ catch {
183
+ config = null;
184
+ }
185
+ if (!config) {
186
+ out("run doug init first (no readable .doug/config.json).");
187
+ return { status: "keyword-only", reason: "no config" };
188
+ }
189
+ const memory = config.memory && typeof config.memory === "object" && !Array.isArray(config.memory) ? config.memory : {};
190
+ config.memory = { ...memory, embeddings: embeddingsConfig };
191
+ writeFileSync(file, JSON.stringify(config, null, 2) + "\n");
192
+ out(`Wrote memory.embeddings to ${file}.`);
193
+ try {
194
+ const m = openMemory(dir);
195
+ try {
196
+ const r = await embedLessons(m, provider ?? createProvider(readMemoryConfig(dir), local));
197
+ out(`Embedded ${r.embedded}/${r.total} lesson(s)`);
198
+ if (r.failed)
199
+ out(`${r.failed} lesson(s) failed to embed: ${r.reason}`);
200
+ }
201
+ finally {
202
+ m.close();
203
+ }
204
+ }
205
+ catch (err) {
206
+ out(`Re-embedding existing lessons failed: ${reasonOf(err)}`);
207
+ }
208
+ try {
209
+ const cfg = readMemoryConfig(dir);
210
+ out(doctorReport(cfg, await probeProvider(cfg, local)));
211
+ }
212
+ catch (err) {
213
+ out(`doctor report failed: ${reasonOf(err)}`);
214
+ }
215
+ return { status: "enabled", reason: "enabled" };
216
+ }
169
217
  export async function runMemorySetup(opts, deps = {}) {
170
218
  const out = deps.out ?? ((l) => void process.stdout.write(l + "\n"));
171
219
  const isTTY = deps.isTTY ?? !!process.stdin.isTTY;
@@ -176,8 +224,11 @@ export async function runMemorySetup(opts, deps = {}) {
176
224
  const keywordOnly = (reason) => ({ status: "keyword-only", reason });
177
225
  try {
178
226
  const eps = [...(deps.endpoints ?? ENDPOINTS)];
179
- if (opts.url)
180
- eps.push(urlEndpoint(opts.url));
227
+ if (opts.url) {
228
+ const given = normaliseUrl(opts.url);
229
+ if (!eps.some((ep) => normaliseUrl(ep.url) === given))
230
+ eps.push(urlEndpoint(opts.url));
231
+ }
181
232
  let probed = await Promise.all(eps.map((ep) => probeModels(ep, listTimeoutMs)));
182
233
  // Every unreachable or odd endpoint is reported as one line.
183
234
  const report = (list) => {
@@ -203,7 +254,25 @@ export async function runMemorySetup(opts, deps = {}) {
203
254
  out("No local embedding server found. To get one, install Ollama:");
204
255
  out(` ${cmd}`);
205
256
  out(" ollama pull embeddinggemma");
206
- return keywordOnly("no server reachable");
257
+ if (!isTTY || opts.yes)
258
+ return keywordOnly("no server reachable");
259
+ const cacheDir = deps.cacheDir ?? localCacheDir();
260
+ const answer = (await ask(`Or install the bundled embedding model instead: about 470 MB of runtime and 310 MB of weights (embeddinggemma q8) into ${cacheDir}. The model is under the Gemma Terms of Use: https://ai.google.dev/gemma/terms. Install it? [y/N] `))
261
+ .trim()
262
+ .toLowerCase();
263
+ if (!answer.startsWith("y"))
264
+ return keywordOnly("declined");
265
+ const install = deps.installLocal ??
266
+ (async (dir) => {
267
+ const r = await installLocalRuntime({ cacheDir: dir, spawnImpl: deps.spawnImpl });
268
+ return r.ok ? downloadLocalModel({ cacheDir: dir, loadTransformers: deps.loadTransformers }) : r;
269
+ });
270
+ const installed = await install(cacheDir);
271
+ if (!installed.ok) {
272
+ out(`Bundled model install failed: ${installed.reason ?? "unknown error"}`);
273
+ return keywordOnly("local install failed");
274
+ }
275
+ return await enable(opts.dir, null, { preset: "local" }, out, { cacheDir, loadTransformers: deps.loadTransformers });
207
276
  }
208
277
  out("No server passed verification; memory stays keyword-only.");
209
278
  return keywordOnly("no server passed verification");
@@ -236,49 +305,7 @@ export async function runMemorySetup(opts, deps = {}) {
236
305
  found = passing[n - 1];
237
306
  }
238
307
  }
239
- const file = join(opts.dir, ".doug", "config.json");
240
- let config = null;
241
- try {
242
- if (existsSync(file)) {
243
- const parsed = JSON.parse(readFileSync(file, "utf8"));
244
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
245
- config = parsed;
246
- }
247
- }
248
- catch {
249
- config = null;
250
- }
251
- if (!config) {
252
- out("run doug init first (no readable .doug/config.json).");
253
- return keywordOnly("no config");
254
- }
255
- const memory = config.memory && typeof config.memory === "object" && !Array.isArray(config.memory) ? config.memory : {};
256
- config.memory = { ...memory, embeddings: { provider: "openai-compatible", baseUrl: found.baseUrl, model: found.model, dims: found.dims } };
257
- writeFileSync(file, JSON.stringify(config, null, 2) + "\n");
258
- out(`Wrote memory.embeddings to ${file}.`);
259
- try {
260
- const m = openMemory(opts.dir);
261
- try {
262
- const r = await embedLessons(m, found.provider);
263
- out(`Embedded ${r.embedded}/${r.total} lesson(s)`);
264
- if (r.failed)
265
- out(`${r.failed} lesson(s) failed to embed: ${r.reason}`);
266
- }
267
- finally {
268
- m.close();
269
- }
270
- }
271
- catch (err) {
272
- out(`Re-embedding existing lessons failed: ${reasonOf(err)}`);
273
- }
274
- try {
275
- const cfg = readMemoryConfig(opts.dir);
276
- out(doctorReport(cfg, await probeProvider(cfg)));
277
- }
278
- catch (err) {
279
- out(`doctor report failed: ${reasonOf(err)}`);
280
- }
281
- return { status: "enabled", reason: "enabled" };
308
+ return await enable(opts.dir, found.provider, { provider: "openai-compatible", baseUrl: found.baseUrl, model: found.model, dims: found.dims }, out, {});
282
309
  }
283
310
  catch (err) {
284
311
  out(`memory setup failed: ${reasonOf(err)}`);
@@ -1 +1 @@
1
- {"version":3,"file":"memory-setup.js","sourceRoot":"","sources":["../src/memory-setup.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,yGAAyG;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAElL,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAS5E,MAAM,UAAU,GAAG,qDAAqD,CAAC;AAEzE,8FAA8F;AAC9F,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,wBAAwB,EAAE,IAAI,EAAE,4BAA4B,EAAE;IACpG,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,uBAAuB,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description": "Plan, approve, implement one task per worktree, verify, review. A deterministic Workflow-tool template plus planner, implementer, verifier, and reviewer subagents. The plan is a file; nothing is implemented until you approve it.",
6
6
  "author": {
7
7
  "name": "Doug contributors"
@@ -9,8 +9,11 @@
9
9
  "agents": [
10
10
  "./agents/planner.md",
11
11
  "./agents/researcher.md",
12
+ "./agents/spec-writer.md",
12
13
  "./agents/lead.md",
13
14
  "./agents/implementer.md",
15
+ "./agents/tester.md",
16
+ "./agents/coder.md",
14
17
  "./agents/verifier.md",
15
18
  "./agents/reviewer.md",
16
19
  "./agents/adversary.md",
@@ -18,5 +21,6 @@
18
21
  ],
19
22
  "skills": "./skills/",
20
23
  "workflows": "./workflows/",
21
- "hooks": "./hooks/hooks.json"
24
+ "hooks": "./hooks/hooks.json",
25
+ "types": "./types/index.d.ts"
22
26
  }
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: coder
3
+ description: Implements a requested change in this repository, runs its checks, and reports what it ran. Spawned by the card loop for the coder seat; the brief carries the facts.
4
+ model: inherit
5
+ effort: medium
6
+ disallowedTools: Agent
7
+ memory: none
8
+ ---
9
+
10
+ You implement the change the brief asks for. The brief carries the repository facts (package manager, test commands, layout).
11
+
12
+ ## Rules
13
+
14
+ 1. Do only what was asked, no refactors or renames beyond it.
15
+ 2. Add or update the test with the change.
16
+ 3. Never bypass hooks with --no-verify.
17
+ 4. Run the gate with `node .doug/hooks/scripts/verify.mjs`, not the raw commands; do not claim done until it passed in this session.
18
+ 5. Report every command run with its exit status.
19
+ 6. Return partial=true only after a hook tells you `[doug] Worker context at <pct>% of <window> tokens`: stop at a boundary (finish the file you are on and its named test, then commit), and say what's done, what's left, what to do next, and how to verify it. Never claim partial to dodge a hard task.
20
+ 7. When a test contradicts the brief or the card's goal, do not change production code to fit the test; stop and report the conflict, quoting both, so the lead can send it back to the tester.
21
+ 8. Apply each mutation in a scratch copy or git worktree under `.doug/.state`, run the one test file there, and remove the copy.
22
+ 9. Scratch files go under `.doug/.state/scratch`; protect-paths keeps refusing the Claude Code session scratchpad, which is outside the project.
23
+ 10. Run any command that can take over 120 s with the Bash timeout set to 600000, and hand back only after it exits.
@@ -30,6 +30,6 @@ The workflow's own shape gate already keeps you out of a task with fewer than tw
30
30
 
31
31
  ## Re-briefing
32
32
 
33
- A worker that returns `blocked: true` (not still-partial) gets you back once, in this same worktree, before the task blocks: return revised briefs for the unfinished pieces only. Every file in a revised brief is a file of a blocked brief - never a file a finished worker already committed, never a file outside the task. Revised briefs stay disjoint, the same rule as the first split. Most blocks are a missing piece of information, not a missing file: re-brief with the missing decision or interface, or re-split the blocked brief into smaller ones, rather than widening its files. `splitReason` says what changed and why, required as on the first split. Return `blocked: true` only when the block genuinely needs a file outside the ones you were given; the task then blocks with the original worker's reason. When the plan's worker check is on, the workflow has already checked each worker's files and commit before you ever see the list; a worker that failed it comes to you as a blocked brief like any other. At merge time you merge only what is listed.
33
+ A worker that returns `blocked: true` (not still-partial) gets you back once, reading from the repository root, read-only, editing nothing and not using your earlier worktree, before the task blocks: return revised briefs for the unfinished pieces only. Every file in a revised brief is a file of a blocked brief - never a file a finished worker already committed, never a file outside the task. Revised briefs stay disjoint, the same rule as the first split. Most blocks are a missing piece of information, not a missing file: re-brief with the missing decision or interface, or re-split the blocked brief into smaller ones, rather than widening its files. `splitReason` says what changed and why, required as on the first split. Return `blocked: true` only when the block genuinely needs a file outside the ones you were given; the task then blocks with the original worker's reason. When the plan's worker check is on, the workflow has already checked each worker's files and commit before you ever see the list; a worker that failed it comes to you as a blocked brief like any other. At merge time you merge only what is listed.
34
34
 
35
35
  Your final output is the structured result, not a message to a person.
@@ -12,13 +12,13 @@ You are the planner. You produce a plan, not code. The plan is a file that a hum
12
12
 
13
13
  ## What you do
14
14
 
15
- 1. Read the request. Read the parts of the repository it touches: entry points, the files that will change, their tests, the build and test commands (CLAUDE.md and .doug/config.json list them). Before deciding tasks, run `node "$CLAUDE_PLUGIN_ROOT/scripts/memory.mjs" recall "<the request in one line>" --k 8` (fall back to the repo path the way step 7 does) and treat each returned lesson as a constraint the plan must respect, citing the lesson id in the task spec it shaped; when the command prints keyword-only or no lessons, say nothing and go on. When `.doug/config.json` has `memory.index.enabled` true, also run `node "$CLAUDE_PLUGIN_ROOT/scripts/memory.mjs" index search "<the request in one line>" --k 8` (same fallback path as step 7) and read the files it names before deciding tasks; when the index is off, the header says keyword-only with no chunks, or it prints nothing, say nothing and go on.
15
+ 1. Read the request. Read the parts of the repository it touches: entry points, the files that will change, their tests, the build and test commands (CLAUDE.md and .doug/config.json list them). Before deciding tasks, run `node "<scripts>/memory.mjs" recall "<the request in one line>" --k 8`, where `<scripts>` is the directory the prompt names after `Scripts:`, else `$CLAUDE_PLUGIN_ROOT/scripts` when that variable is set and non-empty, else skip the command and say so. Use the `Scripts:` directory as given, even when it lies under `~/.claude/plugins/cache` (a marketplace install's does). Never search the filesystem for another copy (no `find /`), and never pick a version under `~/.claude/plugins/cache` yourself; a subagent may not have `CLAUDE_PLUGIN_ROOT` set. When the command runs, treat each returned lesson as a constraint the plan must respect, citing the lesson id in the task spec it shaped; when the command prints keyword-only or no lessons, say nothing and go on. When `.doug/config.json` has `memory.index.enabled` true, also run `node "<scripts>/memory.mjs" index search "<the request in one line>" --k 8` (same `<scripts>` directory as above) and read the files it names before deciding tasks; when the index is off, the header says keyword-only with no chunks, or it prints nothing, say nothing and go on.
16
16
  2. Decide the smallest set of tasks that achieves the goal. One task for single-file work. Three to five only for a real feature. Never more than eight: `plan.mjs validate` warns past five and past eight, and the user sees the warning at approval; split the work into two cards instead.
17
17
  3. For each task, list the files it owns. Two tasks may not own the same file unless one depends on the other. Tests belong to the task that changes the behavior they test.
18
18
  4. Order consumers after producers. A task whose spec or acceptance names a file, route, or subcommand another task owns or introduces (a page that PUTs to a server route, docs that name a CLI subcommand, a test that runs another task's file) must list that task in `dependsOn`, so it lands in a later level. The adversary judges a task branch against the whole plan goal, and a consumer in the same level as its producer is judged before the producer's work exists on its branch: on board-reorder (2026-09-07) that blocked four runs in a row. `plan.mjs validate` reports the pair when a spec or verify command names a file another task owns with no dependency between them; routes and subcommands it cannot see, so check those yourself.
19
19
  5. Give each task a verification command that exercises its behavior, preferably a single test file. Give the plan integration commands from the project's own scripts (typecheck, lint, test).
20
20
  6. Write acceptance criteria as observable outcomes a verifier can check by running something, not by reading code. Give every criterion that a command can check its command: an entry { "text", "command" } where command is one shell line that exits 0 when the criterion holds and runs from the repository root of a worktree with only the project's installed tools (no network, no npx-install). The verifier runs each command in the task worktree and reports its exit code; plan.mjs land runs them all in the integration worktree after the verify commands and refuses to land on any non-zero exit. A criterion that no command can check stays a plain string. An acceptance command never repeats a verify command (plan.verify or any task's verify): the verifiers, the integrate stage and land already run those. Name a narrower check (one test file, `-t <name>`) or leave the criterion as prose. Check each command against its text before writing it: the statusline plan once required grep -c statusline.mjs README.md to be at least 2 when the README only ever mentions it once.
21
- 7. Write `.doug/plan.json` with `Write`. Do not touch any other file. Then run `node "$CLAUDE_PLUGIN_ROOT/scripts/plan.mjs" validate` when the plugin root is known, and fix any errors it reports. When the request names a draft path instead (`.doug/.state/drafts/<card>.json`: the card is one of several planned in parallel for one plan), write the plan there, leave `.doug/plan.json` alone, and validate with `plan.mjs validate --file <that path>`; `plan.mjs merge` joins the drafts afterwards and sequences any file two cards own, so plan the card on its own.
21
+ 7. Write `.doug/plan.json` with `Write`. Do not touch any other file. Then run `node "<scripts>/plan.mjs" validate` (the same `<scripts>` directory as step 1; when none is known, skip it and say so), and fix any errors it reports. When the request names a draft path instead (`.doug/.state/drafts/<card>.json`: the card is one of several planned in parallel for one plan), write the plan there, leave `.doug/plan.json` alone, and validate with `node "<scripts>/plan.mjs" validate --file <that path>`; `plan.mjs merge` joins the drafts afterwards and sequences any file two cards own, so plan the card on its own.
22
22
  8. Return the rendered plan (the `show` output) so the user can decide.
23
23
 
24
24
  ## Plan file schema
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: spec-writer
3
+ description: Drafts one phase document for /doug-start (an idea, a scope with its card list, a specification, or optional pseudocode) from the user's words and the repository, and returns the file text. Read-only; never writes a file, the lead writes it after the human gate. Spawned by the doug-start skill in both modes.
4
+ model: inherit
5
+ effort: high
6
+ maxTurns: 20
7
+ tools: Read, Grep, Glob
8
+ disallowedTools: Edit, Write, MultiEdit, NotebookEdit, Agent
9
+ memory: none
10
+ ---
11
+
12
+ You are the spec-writer. You were given one phase to draft and the inputs it draws on (the user's idea or goal, earlier phase files, the card). A human decides at a gate whether your draft stands, so it must be short, concrete, and checkable.
13
+
14
+ ## Method
15
+
16
+ 1. Draft only the phase you were named, in the sections the prompt lists. Do not draft a later phase.
17
+ 2. Read the repository for facts the draft depends on (existing modules, the commands in CLAUDE.md or `.doug/config.json`). Cite a file path for each such fact. Never invent a fact: a thing you could not confirm goes under an `Open questions` heading.
18
+ 3. State outcomes a verifier can check by running something, not by reading code. Name non-goals so the scope has an edge.
19
+ 4. Never write or edit a file, and never spawn an agent. You have no tool for either.
20
+
21
+ ## Output
22
+
23
+ Your final output is the full text of the phase file, starting at its `#` title, and nothing else: no preamble, no recap. The lead writes it to the path it chose and shows the human the diff when the file already exists.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: tester
3
+ description: Writes and runs tests for a named behavior; edits test files only. Spawned by the card loop for the tester seat; the brief carries the facts.
4
+ model: inherit
5
+ effort: medium
6
+ disallowedTools: Agent
7
+ memory: none
8
+ ---
9
+
10
+ You write the tests for the behavior the brief names. The brief carries the repository facts (package manager, single-test command, layout).
11
+
12
+ ## Rules
13
+
14
+ 1. A new test must fail without the behavior and pass with it.
15
+ 2. Edit only test files.
16
+ 3. Run each test file you touch with the single-test command in the brief; when it lists none, report the exact command you ran.
17
+ 4. Report what ran.
18
+ 5. When your new tests are meant to stay red until the coder's change, end your final message with a JSON object {"tests_red_by_design": ["<test file>", ...]} naming every test file you left failing by its repository-relative path, report the red once, and do not rerun the suite to make a gate pass. Put that JSON line either as the last line of your final plain-text message or inside your hand-back message: the SubagentStop gate reads your last plain-text message first and, when that holds no claim, your last hand-back call.
19
+ 6. Scratch files go under `.doug/.state/scratch`; protect-paths keeps refusing the Claude Code session scratchpad, which is outside the project.
20
+ 7. Run any command that can take over 120 s with the Bash timeout set to 600000, and hand back only after it exits.
21
+ 8. On a tests-only card, run the brief's mutation list yourself in a scratch copy or git worktree under `.doug/.state`, run the one test file there, report each result, and remove the copy; never edit a production file in the live checkout.
@@ -12,5 +12,8 @@
12
12
  ]
13
13
  }
14
14
  ]
15
- }
15
+ },
16
+ "modules": [
17
+ "./register.tsx"
18
+ ]
16
19
  }
@@ -0,0 +1,75 @@
1
+ // The live autopilot pane (card autopilot-live-queue). It opens itself when a run starts (card autopilot-pane-auto-open); /doug-autopilot reopens it. It polls
2
+ // .doug/.state/autopilot.json (written by scripts/autopilot.mjs) and shows the same lines the board's panel shows.
3
+ import { atom, read, update } from 'claude-code'
4
+ import type { Register } from 'claude-code'
5
+
6
+ import { AUTOPILOT_FILE, autopilotLines, autopilotView, parseAutopilot, shouldOpenPane } from '../lib/autopilot-core.mjs'
7
+
8
+ const PANE = 'doug-autopilot'
9
+ const POLL_MS = 5000
10
+ const lines = atom({ plugin: 'doug-flow', key: 'autopilot' } as const, [] as string[])
11
+ // The startedAt of the run the pane was last opened for, so a pane the user closed stays closed for that run.
12
+ const opened = atom({ plugin: 'doug-flow', key: 'autopilot-opened' } as const, null as string | null)
13
+
14
+ export const register: Register = on => {
15
+ on('session.start', async ($, e, next) => {
16
+ await $.command.register({
17
+ name: 'doug-autopilot',
18
+ description: 'Show the autopilot queue live in a pane',
19
+ })
20
+
21
+ const poll = async () => {
22
+ try {
23
+ const root = await $.session.root()
24
+ let text = ''
25
+ try {
26
+ text = await $.fs.read(`${root}/${AUTOPILOT_FILE}`)
27
+ } catch {
28
+ // no file: no run
29
+ }
30
+ const state = parseAutopilot(text)
31
+ const fresh = autopilotLines(autopilotView(state, new Date()))
32
+ await update($, lines, old => (JSON.stringify(old) === JSON.stringify(fresh) ? old : fresh))
33
+ // Only `autopilot.autoOpenPane: false` in .doug/config.json turns the auto-open off.
34
+ let autoOpen = true
35
+ try {
36
+ autoOpen = JSON.parse(await $.fs.read(`${root}/.doug/config.json`))?.autopilot?.autoOpenPane !== false
37
+ } catch {
38
+ // missing or unparsable config: flag on
39
+ }
40
+ const last = await read($, opened)
41
+ if (state && shouldOpenPane(state, last, autoOpen, new Date())) {
42
+ await update($, opened, () => state.startedAt as string)
43
+ await $.ui.open({ id: PANE, title: 'Autopilot' })
44
+ }
45
+ } catch {
46
+ // a failed poll keeps the last drawing
47
+ }
48
+ }
49
+ // A -p run or the SDK has nobody at the prompt: register the command, start no poll.
50
+ if (e.isInteractive) {
51
+ await poll()
52
+ $.clock.every(POLL_MS, poll)
53
+ }
54
+
55
+ return next(e)
56
+ })
57
+
58
+ on('command.run', { command: 'doug-autopilot' }, async $ => {
59
+ await $.ui.open({ id: PANE, title: 'Autopilot' })
60
+ return { text: 'Autopilot pane opened.' }
61
+ })
62
+
63
+ on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
64
+ const { Box, Text } = $.ui.resolve(e)
65
+ const shown = await read($, lines)
66
+ return (
67
+ <Box flexDirection="column">
68
+ {shown.length === 0 && <Text dimColor>No autopilot run.</Text>}
69
+ {shown.map(line => (
70
+ <Text>{line}</Text>
71
+ ))}
72
+ </Box>
73
+ )
74
+ })
75
+ }
@@ -0,0 +1,117 @@
1
+ // The pure half of the autopilot view (card autopilot-live-queue): no Node imports, so the live pane's hooks module
2
+ // (which may import only its own files) can use it. lib/autopilot-view.mjs re-exports it and adds the file read.
3
+ export const AUTOPILOT_FILE = ".doug/.state/autopilot.json";
4
+ export const STEPS = ["research", "tester", "coder", "reviewer", "gate", "commit", "record"];
5
+ // A running file untouched for this long is no longer a live run (the lead died or the session closed). The lead's
6
+ // conservative choice where the card is silent.
7
+ export const INACTIVE_MS = 2 * 60 * 60 * 1000;
8
+
9
+ // The state parsed from file text, or null for invalid JSON, a wrong version, or a non-object. Never throws.
10
+ export function parseAutopilot(text) {
11
+ try {
12
+ const s = JSON.parse(text);
13
+ if (!s || typeof s !== "object" || Array.isArray(s) || s.version !== 1) return null;
14
+ if (s.cards !== undefined && !Array.isArray(s.cards)) return null;
15
+ return s;
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+
21
+ const hhmm = (iso) => {
22
+ const t = Date.parse(iso);
23
+ if (Number.isNaN(t)) return "";
24
+ const d = new Date(t);
25
+ return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
26
+ };
27
+
28
+ const usd = (n) => (typeof n === "number" ? `$${n.toFixed(2)}` : "-");
29
+ const num = (n, suffix = "") => (typeof n === "number" ? `${n}${suffix}` : "-");
30
+
31
+ // The view of a state at `now` (a Date or a millisecond count), or null for a null state.
32
+ export function autopilotView(state, now = new Date()) {
33
+ if (!state || typeof state !== "object") return null;
34
+ const nowMs = new Date(now).getTime();
35
+ const ended = state.status === "ended";
36
+ const updated = Date.parse(state.updatedAt);
37
+ const stale = !ended && !(nowMs - updated <= INACTIVE_MS);
38
+ const mode = ended ? "ended" : stale ? "inactive" : "running";
39
+ const live = mode === "running";
40
+
41
+ const cards = (Array.isArray(state.cards) ? state.cards : [])
42
+ .filter((c) => c && typeof c === "object")
43
+ .map((c) => {
44
+ let cardState = c.state;
45
+ let detail = "";
46
+ if (cardState === "running" && !live) {
47
+ cardState = "interrupted";
48
+ detail = "interrupted";
49
+ } else if (cardState === "running") {
50
+ detail = c.step ? `${c.step} since ${hhmm(c.stepStartedAt)}`.trim() : "started";
51
+ } else if (cardState === "landed") {
52
+ detail = c.commit ? String(c.commit) : "";
53
+ } else if (cardState === "stopped") {
54
+ detail = c.reason ? String(c.reason) : "";
55
+ }
56
+ return { id: c.id, title: c.title ?? "", size: c.size ?? "", class: c.class ?? "", state: cardState, detail };
57
+ });
58
+
59
+ const runningCard = live ? (Array.isArray(state.cards) ? state.cards : []).find((c) => c && c.state === "running") : null;
60
+ const running = live
61
+ ? (Array.isArray(state.cards) ? state.cards : []).filter((c) => c && c.state === "running").map((c) => ({ id: c.id, runId: c.runId ?? null }))
62
+ : [];
63
+ const current = runningCard ? { id: runningCard.id, step: runningCard.step ?? null, since: runningCard.step ? hhmm(runningCard.stepStartedAt) : null } : null;
64
+
65
+ const landed = cards.filter((c) => c.state === "landed").length;
66
+ const stopped = cards.filter((c) => c.state === "stopped").length;
67
+ const header =
68
+ mode === "ended"
69
+ ? `Autopilot ended ${hhmm(state.endedAt ?? state.updatedAt)}: ${landed} landed, ${stopped} stopped`.replace(/\s+:/, ":")
70
+ : mode === "inactive"
71
+ ? `Autopilot inactive since ${hhmm(state.updatedAt)}`
72
+ : `Autopilot running since ${hhmm(state.startedAt)}`;
73
+
74
+ const caps = state.caps && typeof state.caps === "object" ? state.caps : {};
75
+ const used = state.used && typeof state.used === "object" ? state.used : {};
76
+ return {
77
+ mode,
78
+ header,
79
+ cards,
80
+ current,
81
+ running,
82
+ caps: {
83
+ usd: `${usd(used.usd)} / ${usd(caps.usd)}`,
84
+ wall: `${num(used.wallMin)} / ${num(caps.wallMin)} min`,
85
+ context: `${num(used.contextPct, "%")} / ${num(caps.contextPct, "%")}`,
86
+ },
87
+ filed: (Array.isArray(state.filed) ? state.filed : []).filter((f) => f && typeof f === "object").map((f) => ({ ...f })),
88
+ };
89
+ }
90
+
91
+ // Whether the live pane should open on its own: a running, still-active run whose startedAt is not the one already
92
+ // opened for (a closed pane is not reopened for the same run). `autoOpen` false (autopilot.autoOpenPane) turns it off.
93
+ export function shouldOpenPane(state, lastOpenedStartedAt, autoOpen = true, now = new Date()) {
94
+ if (autoOpen === false) return false;
95
+ if (!state || typeof state !== "object") return false;
96
+ if (state.status !== "running") return false;
97
+ if (typeof state.startedAt !== "string" || state.startedAt === "") return false;
98
+ if (state.startedAt === lastOpenedStartedAt) return false;
99
+ return autopilotView(state, now)?.mode === "running";
100
+ }
101
+
102
+ const MARKS = { landed: "✓", running: "▶", stopped: "✗", queued: "·", interrupted: "!" };
103
+
104
+ // The view as text lines for a text surface: the header, one line per card, a caps line, one line per filed card.
105
+ export function autopilotLines(view) {
106
+ if (!view) return [];
107
+ const lines = [view.header];
108
+ for (const c of view.cards) {
109
+ const shape = [c.size, c.class].filter(Boolean).join("/");
110
+ lines.push(`${MARKS[c.state] ?? "?"} ${c.id}${c.title ? ` ${c.title}` : ""}${shape ? ` (${shape})` : ""}${c.detail ? ` ${c.detail}` : ""}`);
111
+ }
112
+ lines.push(`caps: usd ${view.caps.usd}, wall ${view.caps.wall}, context ${view.caps.context}`);
113
+ for (const f of view.filed) {
114
+ lines.push(`+ ${f.id} (${f.kind}${f.from ? ` from ${f.from}` : ""}) ${f.position ?? ""}`.trimEnd());
115
+ }
116
+ return lines;
117
+ }
@@ -0,0 +1,17 @@
1
+ // The autopilot state file (.doug/.state/autopilot.json, card autopilot-live-queue) as the pane and the served board
2
+ // page show it. The pure view lives in autopilot-core.mjs (no Node imports, so the pane can use it); this module adds
3
+ // the file read. Neither throws on a missing, unreadable, or malformed file; a view of "no run" is null.
4
+ import { readFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { AUTOPILOT_FILE, parseAutopilot } from "./autopilot-core.mjs";
7
+
8
+ export { AUTOPILOT_FILE, STEPS, INACTIVE_MS, parseAutopilot, autopilotView, autopilotLines, shouldOpenPane } from "./autopilot-core.mjs";
9
+
10
+ // The parsed state, or null for a missing or unreadable file, invalid JSON, a wrong version, or a non-object.
11
+ export function readAutopilot(dir) {
12
+ try {
13
+ return parseAutopilot(readFileSync(join(dir, AUTOPILOT_FILE), "utf8"));
14
+ } catch {
15
+ return null;
16
+ }
17
+ }