@dreb/coding-agent 2.49.0 → 2.51.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 (45) hide show
  1. package/README.md +15 -5
  2. package/agents/explore.md +8 -3
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +3 -1
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +1 -0
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/sdk.d.ts +3 -3
  10. package/dist/core/sdk.d.ts.map +1 -1
  11. package/dist/core/sdk.js +4 -3
  12. package/dist/core/sdk.js.map +1 -1
  13. package/dist/core/system-prompt.d.ts.map +1 -1
  14. package/dist/core/system-prompt.js +1 -0
  15. package/dist/core/system-prompt.js.map +1 -1
  16. package/dist/core/tools/index.d.ts +7 -0
  17. package/dist/core/tools/index.d.ts.map +1 -1
  18. package/dist/core/tools/index.js +6 -0
  19. package/dist/core/tools/index.js.map +1 -1
  20. package/dist/core/tools/subagent.d.ts.map +1 -1
  21. package/dist/core/tools/subagent.js +15 -9
  22. package/dist/core/tools/subagent.js.map +1 -1
  23. package/dist/core/tools/wait.d.ts.map +1 -1
  24. package/dist/core/tools/wait.js +2 -1
  25. package/dist/core/tools/wait.js.map +1 -1
  26. package/dist/core/tools/watch-github-ci.d.ts +35 -0
  27. package/dist/core/tools/watch-github-ci.d.ts.map +1 -0
  28. package/dist/core/tools/watch-github-ci.js +204 -0
  29. package/dist/core/tools/watch-github-ci.js.map +1 -0
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/index.js.map +1 -1
  34. package/docs/dashboard.md +142 -0
  35. package/docs/extensions.md +4 -2
  36. package/docs/mach6.md +3 -3
  37. package/docs/rpc.md +1 -1
  38. package/docs/sdk.md +4 -4
  39. package/package.json +1 -1
  40. package/skills/mach6-implement/SKILL.md +5 -4
  41. package/skills/mach6-issue/SKILL.md +9 -9
  42. package/skills/mach6-plan/SKILL.md +8 -8
  43. package/skills/mach6-publish/SKILL.md +5 -6
  44. package/skills/mach6-push/SKILL.md +2 -2
  45. package/skills/mach6-review/SKILL.md +4 -4
package/docs/dashboard.md CHANGED
@@ -474,3 +474,145 @@ TUI theme system** — dashboard themes intentionally do not map to TUI themes.
474
474
  loop; the tree design and RPC are ready).
475
475
  - No shell passthrough from the browser.
476
476
  - No subagent steering (the drill-in view is read-only).
477
+
478
+ ## Background service / auto-restart
479
+
480
+ The dashboard runs as a foreground process by default. For it to start on boot
481
+ and restart after crashes, run it as a system service.
482
+
483
+ ### Linux (systemd)
484
+
485
+ Save a user unit to `~/.config/systemd/user/dreb-dashboard.service`:
486
+
487
+ ```ini
488
+ [Unit]
489
+ Description=dreb web dashboard
490
+
491
+ [Service]
492
+ ExecStart=%h/.npm-global/bin/dreb-dashboard
493
+ Restart=on-failure
494
+
495
+ [Install]
496
+ WantedBy=default.target
497
+ ```
498
+
499
+ Use the absolute path from `which dreb-dashboard` for `ExecStart` (the example
500
+ matches an npm global prefix under `~/.npm-global`). Then:
501
+
502
+ ```bash
503
+ systemctl --user daemon-reload
504
+ systemctl --user enable --now dreb-dashboard
505
+ ```
506
+
507
+ ### macOS (launchd)
508
+
509
+ Create a **LaunchAgent** (not a LaunchDaemon) — the dashboard must run as the
510
+ logged-in user to read `~/.dreb/agent/sessions` and `auth.json`, and to spawn
511
+ `dreb --mode rpc` children under that user. A root LaunchDaemon would have the
512
+ wrong `HOME` and credentials.
513
+
514
+ Save a plist to `~/Library/LaunchAgents/com.dreb.dashboard.plist`:
515
+
516
+ ```xml
517
+ <?xml version="1.0" encoding="UTF-8"?>
518
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
519
+ <plist version="1.0">
520
+ <dict>
521
+ <key>Label</key>
522
+ <string>com.dreb.dashboard</string>
523
+ <!--
524
+ Invoke node directly on the resolved entry point. The `dreb-dashboard`
525
+ bin is a #!/usr/bin/env node script; launchd's minimal environment
526
+ cannot resolve `node` via PATH, so we point ProgramArguments at the
527
+ absolute node binary and the resolved dist/index.js.
528
+ -->
529
+ <key>ProgramArguments</key>
530
+ <array>
531
+ <string>/ABSOLUTE/PATH/TO/node</string>
532
+ <string>/ABSOLUTE/PATH/TO/@dreb/dashboard/dist/index.js</string>
533
+ <string>--port</string>
534
+ <string>5343</string>
535
+ </array>
536
+ <key>RunAtLoad</key>
537
+ <true/>
538
+ <key>KeepAlive</key>
539
+ <true/>
540
+ <!-- KeepAlive + ThrottleInterval gives crash auto-restart without a tight
541
+ fail-loop. kill -9 the process and launchd respawns it in seconds. -->
542
+ <key>ThrottleInterval</key>
543
+ <integer>10</integer>
544
+ <!--
545
+ HOME is set automatically for user agents, so ~/.dreb/agent/auth.json
546
+ (OAuth creds) is found. PATH lets RPC children spawn bash/git/node.
547
+ If you use API keys via shell environment variables rather than OAuth
548
+ creds, add the keys here — LaunchAgents do not source shell profiles.
549
+ -->
550
+ <key>EnvironmentVariables</key>
551
+ <dict>
552
+ <key>PATH</key>
553
+ <string>/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
554
+ </dict>
555
+ <key>StandardOutPath</key>
556
+ <string>/Users/YOU/Library/Logs/dreb-dashboard.out.log</string>
557
+ <key>StandardErrorPath</key>
558
+ <string>/Users/YOU/Library/Logs/dreb-dashboard.err.log</string>
559
+ </dict>
560
+ </plist>
561
+ ```
562
+
563
+ #### Finding the absolute paths
564
+
565
+ The two `ProgramArguments` paths vary by install method (Homebrew, nvm, bun
566
+ global, npm global prefix). Discover them:
567
+
568
+ ```bash
569
+ command -v node # → /opt/homebrew/bin/node
570
+ realpath "$(command -v dreb-dashboard)" # → /opt/homebrew/lib/node_modules/@dreb/dashboard/dist/index.js
571
+ # If `realpath` is not found, install coreutils: brew install coreutils
572
+ ```
573
+
574
+ Replace `/ABSOLUTE/PATH/TO/node` and `/ABSOLUTE/PATH/TO/@dreb/dashboard/dist/index.js`
575
+ with the actual output. Also replace `/Users/YOU/` in the log paths with your
576
+ home directory.
577
+
578
+ #### load / unload / status
579
+
580
+ Use the modern `launchctl bootstrap`/`bootout` API (not the deprecated
581
+ `load`/`unload`):
582
+
583
+ ```bash
584
+ # load / start
585
+ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.dreb.dashboard.plist
586
+ # stop / unload
587
+ launchctl bootout gui/$(id -u)/com.dreb.dashboard
588
+ # check state
589
+ launchctl print gui/$(id -u)/com.dreb.dashboard | grep -E 'state|pid'
590
+ ```
591
+
592
+ #### API-key providers
593
+
594
+ OAuth subscription credentials live in `~/.dreb/agent/auth.json` and are
595
+ found via the auto-set `HOME` — no secrets in the plist. If you use API keys
596
+ via shell environment variables (e.g. `ANTHROPIC_API_KEY`), add them to the
597
+ `EnvironmentVariables` dictionary:
598
+
599
+ ```xml
600
+ <key>EnvironmentVariables</key>
601
+ <dict>
602
+ <key>PATH</key>
603
+ <string>…</string>
604
+ <key>ANTHROPIC_API_KEY</key>
605
+ <string>sk-ant-…</string>
606
+ </dict>
607
+ ```
608
+
609
+ LaunchAgents do not source `.zshrc`/`.bashrc`/`.profile`, so env vars must be
610
+ set explicitly in the plist.
611
+
612
+ #### Local vs remote
613
+
614
+ The plist above runs in local-only mode (binds `127.0.0.1:5343`). For remote
615
+ access from a phone, add `--remote --allow you@example.com` to
616
+ `ProgramArguments` and see the [remote access walkthrough](#local-vs-remote--exactly-two-modes)
617
+ and [TLS setup](#native-tls-remote-https) for the Tailscale + HTTPS path.
618
+ Do not expose the port on your LAN — there is no LAN mode.
@@ -613,7 +613,7 @@ In the default parallel tool execution mode, sibling tool calls from the same as
613
613
  import { isToolCallEventType } from "@dreb/coding-agent";
614
614
 
615
615
  dreb.on("tool_call", async (event, ctx) => {
616
- // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "wait", "search", "ask_user", "skill", "tasks_update", "suggest_next", or custom tool names
616
+ // event.toolName - "bash", "read", "write", "edit", "grep", "find", "ls", "web_search", "web_fetch", "subagent", "wait", "watch_github_ci", "search", "ask_user", "skill", "tasks_update", "suggest_next", or custom tool names
617
617
  // event.toolCallId
618
618
  // event.input - tool parameters
619
619
 
@@ -1518,7 +1518,7 @@ async execute(toolCallId, params) {
1518
1518
 
1519
1519
  ### Overriding Built-in Tools
1520
1520
 
1521
- Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `search`, `ask_user`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`, `suggest_next`) can also be overridden.
1521
+ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `web_search`, `web_fetch`, `subagent`, `wait`, `watch_github_ci`, `search`, `ask_user`) by registering a tool with the same name. Interactive mode displays a warning when this happens. The factory-only tools (`skill`, `tasks_update`, `suggest_next`) can also be overridden.
1522
1522
 
1523
1523
  ```bash
1524
1524
  # Extension's read tool replaces built-in read
@@ -1549,6 +1549,8 @@ Built-in tool implementations:
1549
1549
  - [ls.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
1550
1550
  - [web.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/web.ts) - `web_search` and `web_fetch`
1551
1551
  - [subagent.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/subagent.ts)
1552
+ - [wait.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/wait.ts)
1553
+ - [watch-github-ci.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/watch-github-ci.ts) - `watch_github_ci`
1552
1554
  - [skill.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/skill.ts) - factory-only
1553
1555
  - [tasks.ts](https://github.com/aebrer/dreb/blob/master/packages/coding-agent/src/core/tools/tasks.ts) - factory-only
1554
1556
 
package/docs/mach6.md CHANGED
@@ -30,7 +30,7 @@ Assess an existing GitHub issue or create a new one.
30
30
  /skill:mach6-issue add dark mode # Create issue from description
31
31
  ```
32
32
 
33
- **Assess mode:** Launches parallel subagents to explore the codebase, then posts a structured assessment (summary, gaps, ambiguities, scope, risks) as an issue comment.
33
+ **Assess mode:** Launches parallel Explore agents to retrieve bounded code/documentation evidence, then has the primary agent synthesize and post the assessment (summary, gaps, ambiguities, scope, risks) as an issue comment.
34
34
 
35
35
  **Create mode:** Drafts a structured issue with title, summary, acceptance criteria, and technical notes.
36
36
 
@@ -44,7 +44,7 @@ Explore the codebase, create an implementation plan, open a draft PR, and post t
44
44
 
45
45
  - Reads the issue and any existing assessment
46
46
  - Checks project conventions (AGENTS.md, CONTRIBUTING.md, etc.)
47
- - Launches parallel subagents to explore similar features, architecture, and integration points
47
+ - Launches parallel Explore agents to locate related implementations, enumerate explicit flows/call sites, and quote bounded evidence; the primary agent owns architecture and planning
48
48
  - Creates a feature branch (`feature/issue-42-<slug>`) with an empty commit
49
49
  - Opens a draft PR linking to the issue
50
50
  - Posts the plan as a PR comment with `<!-- mach6-plan -->` marker
@@ -112,7 +112,7 @@ Pre-merge checks, version bump, docs update, merge, tag, and release.
112
112
  /skill:mach6-publish 53
113
113
  ```
114
114
 
115
- - Verifies CI passing, no merge conflicts, all findings addressed
115
+ - Verifies CI passing with the blocking `watch_github_ci` tool (never `wait` or a polling loop), no merge conflicts, and all findings addressed
116
116
  - Runs pre-merge checklist (version bump, tests)
117
117
  - Applies version bump on the feature branch
118
118
  - Proactively reviews and updates ALL documentation affected by the PR's changes
package/docs/rpc.md CHANGED
@@ -1112,7 +1112,7 @@ Response:
1112
1112
  },
1113
1113
  {
1114
1114
  "name": "Explore",
1115
- "description": "Codebase and web exploration find files, search code, search the web, answer questions. Read-only."
1115
+ "description": "Concrete evidence retrievallocate files, symbols, documentation, call sites, and exact snippets. No implementation work."
1116
1116
  }
1117
1117
  ]
1118
1118
  }
package/docs/sdk.md CHANGED
@@ -387,10 +387,10 @@ const { session } = await createAgentSession({ resourceLoader: loader });
387
387
 
388
388
  ```typescript
389
389
  import {
390
- codingTools, // read, bash, edit, write (subset — default is all 11)
390
+ codingTools, // read, bash, edit, write (subset — default is all 13 standard tools)
391
391
  readOnlyTools, // read, grep, find, ls
392
392
  readTool, bashTool, editTool, writeTool,
393
- grepTool, findTool, lsTool,
393
+ grepTool, findTool, lsTool, watchGithubCiTool,
394
394
  } from "@dreb/coding-agent";
395
395
 
396
396
  // Use built-in tool set
@@ -953,13 +953,13 @@ SettingsManager
953
953
  codingTools
954
954
  readOnlyTools
955
955
  readTool, bashTool, editTool, writeTool
956
- grepTool, findTool, lsTool
956
+ grepTool, findTool, lsTool, watchGithubCiTool
957
957
 
958
958
  // Tool factories (for custom cwd)
959
959
  createCodingTools
960
960
  createReadOnlyTools
961
961
  createReadTool, createBashTool, createEditTool, createWriteTool
962
- createGrepTool, createFindTool, createLsTool
962
+ createGrepTool, createFindTool, createLsTool, createWatchGithubCiTool
963
963
 
964
964
  // Types
965
965
  type CreateAgentSessionOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.49.0",
3
+ "version": "2.51.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {
@@ -18,7 +18,7 @@ This skill has two modes:
18
18
  2. **No `#N` in comment bodies** — Use "finding 3", "item 3" etc. instead.
19
19
  3. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
20
20
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
21
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
21
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
22
22
 
23
23
  ## Parent ownership and the formal-review checkpoint
24
24
 
@@ -133,13 +133,14 @@ tasks_update([
133
133
 
134
134
  #### If `ci` was specified:
135
135
 
136
+ Use `watch_github_ci` with `pr: "<pr-number>"` so the tool blocks until the pull request's checks pass or fail. Do not use `wait`, sleep, or repeated polling commands for CI.
137
+
138
+ If checks fail, use the returned check output to identify the failed run, then inspect it:
139
+
136
140
  ```bash
137
- gh pr checks <pr-number>
138
141
  gh run view <run-id> --log-failed
139
142
  ```
140
143
 
141
- **Note:** `gh pr checks` returns exit code 8 while checks are still pending — this is expected, not a failure. Wait and re-run if needed.
142
-
143
144
  Read the failed CI logs and identify issues. Extract test failures, stack traces, error messages. If all checks pass, report this and stop.
144
145
 
145
146
  #### If finding numbers were specified:
@@ -16,7 +16,7 @@ argument-hint: "[issue-number | description]"
16
16
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets (.env, credentials, tokens, keys).
17
17
  5. **Task tracking** — Use the `tasks_update` tool to show progress through multi-step commands.
18
18
  6. **Project conventions** — Check for CLAUDE.md, AGENTS.md, .dreb/CONTEXT.md, and CONTRIBUTING.md before planning or implementing.
19
- 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
19
+ 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
20
20
 
21
21
  ## Determine Mode
22
22
 
@@ -52,12 +52,12 @@ Update task: read → completed, explore → in_progress.
52
52
 
53
53
  ### Step 3: Explore the codebase
54
54
 
55
- Launch 2-3 Explore subagents in parallel targeting different aspects. Agent definitions specify their own model with a provider fallback list — defaults work across providers and are fine for most cases. Override only with good reason (e.g. a particularly complex issue warrants a stronger tier).
56
- - **Relevant code**: Find existing code related to the issue, trace implementation patterns
57
- - **Architecture**: Map relevant architecture layers, abstractions, data flow
58
- - **Prior work**: Check for related branches, PRs, or commits
55
+ Launch 2-3 Explore subagents in parallel for concrete evidence retrieval. Agent definitions specify their own model with a provider fallback list — defaults work across providers and are fine for most cases. Override only with good reason (e.g. a large repository requires inspecting many files).
56
+ - **Relevant code evidence**: Locate named related behavior and quote the exact implementation and test snippets
57
+ - **Flow inventory**: Enumerate files, symbols, imports, calls, and registrations in an explicitly named existing flow without diagnosing it
58
+ - **Prior-work evidence**: Locate related branches, PRs, commits, and documentation and report their exact references
59
59
 
60
- Each agent should return 5-10 key files. After agents complete, read all identified files.
60
+ Do not ask Explore to determine the root cause, interpret ambiguous requirements, recommend an implementation, decide architecture, or assess the issue. Each agent should return 5-10 key files with bounded evidence. After agents complete, read all identified files and have the primary agent synthesize the current state, gaps, scope, and risks.
61
61
 
62
62
  Update task: explore → completed, assess → in_progress.
63
63
 
@@ -76,7 +76,7 @@ Present to the user:
76
76
  Post as an issue comment:
77
77
 
78
78
  ```bash
79
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
79
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
80
80
  cat > "$GH_BODY" << 'MACH6_EOF'
81
81
  <!-- mach6-assessment -->
82
82
  ## Issue Assessment
@@ -109,7 +109,7 @@ ls .github/ISSUE_TEMPLATE/ 2>/dev/null
109
109
  ```
110
110
  If templates exist, read them and select the most appropriate one.
111
111
 
112
- Explore the codebase if needed to understand the relevant area.
112
+ If codebase context is needed, use Explore subagents only for bounded evidence such as locating named behavior, files, tests, call sites, or exact snippets. The primary agent must interpret that evidence and own the issue's requirements, proposed behavior, scope, and technical conclusions.
113
113
 
114
114
  ### Step 2: Draft the issue
115
115
 
@@ -128,7 +128,7 @@ Present the draft to the user for approval.
128
128
  ### Step 3: Create the issue
129
129
 
130
130
  ```bash
131
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
131
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
132
132
  cat > "$GH_BODY" << 'MACH6_EOF'
133
133
  <body>
134
134
  MACH6_EOF
@@ -18,7 +18,7 @@ This command is strictly for **planning**. Do NOT implement any code changes —
18
18
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
19
19
  5. **Task tracking** — Use the `tasks_update` tool to show progress through multi-step commands.
20
20
  6. **Project conventions** — Check for CLAUDE.md, AGENTS.md, .dreb/CONTEXT.md, and CONTRIBUTING.md before planning.
21
- 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
21
+ 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
22
22
 
23
23
  ## Step 1: Set up task tracking
24
24
 
@@ -53,12 +53,12 @@ Extract planning-relevant guidance: project layers, testing expectations, coding
53
53
 
54
54
  ## Step 4: Explore the codebase
55
55
 
56
- Launch 2-3 Explore subagents in parallel. Agent definitions specify their own model with a provider fallback list — defaults work across providers and are fine for most cases. Override only with good reason (e.g. a particularly large or complex codebase warrants a stronger tier).
57
- - **Similar features**: Find existing code that solves related problems, trace implementation patterns
58
- - **Architecture**: Map relevant architecture layers, abstractions, data flow
59
- - **Integration points**: Identify where new code connects to existing systems
56
+ Launch 2-3 Explore subagents in parallel for concrete evidence retrieval. Agent definitions specify their own model with a provider fallback list — defaults work across providers and are fine for most cases. Override only with good reason (e.g. a particularly large codebase requires inspecting many files).
57
+ - **Existing feature evidence**: Locate named related features and quote the exact implementation and test snippets that establish their patterns
58
+ - **Layer inventory**: Enumerate the files, symbols, imports, and calls in an explicitly named existing data flow without deciding the architecture
59
+ - **Integration evidence**: Enumerate concrete call sites, registrations, configuration, and documentation for the relevant symbols
60
60
 
61
- Include project conventions in each agent's context. Each agent returns 5-10 key files. Read all identified files.
61
+ Do not ask Explore to diagnose the problem, interpret ambiguous requirements, recommend an implementation, design the architecture, or produce the plan. Include project conventions in each agent's context. Each agent returns 5-10 key files with bounded evidence. Read all identified files, then have the primary agent synthesize the architecture, risks, and implementation plan.
62
62
 
63
63
  Update task: explore → completed, plan → in_progress.
64
64
 
@@ -98,7 +98,7 @@ git commit --allow-empty -m "chore: open PR for issue <N>"
98
98
  git push -u origin feature/issue-<N>-<slug>
99
99
 
100
100
  # Open draft PR
101
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
101
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
102
102
  cat > "$GH_BODY" << 'MACH6_EOF'
103
103
  Closes #<N>
104
104
 
@@ -114,7 +114,7 @@ Update task: branch → completed, post → in_progress.
114
114
  ## Step 7: Post plan to PR
115
115
 
116
116
  ```bash
117
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
117
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
118
118
  cat > "$GH_BODY" << 'MACH6_EOF'
119
119
  <!-- mach6-plan -->
120
120
  ## Implementation Plan
@@ -14,7 +14,7 @@ argument-hint: "<pr-number>"
14
14
  2. **No `#N` in comment bodies** — Use "finding 3", "item 3" etc. instead.
15
15
  3. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
16
16
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
17
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
17
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
18
 
19
19
  ## Step 1: Set up task tracking
20
20
 
@@ -34,10 +34,9 @@ tasks_update([
34
34
  gh pr checkout <pr-number>
35
35
  git pull
36
36
  gh pr view <pr-number> --json mergeable,mergeStateStatus,statusCheckRollup,reviewDecision,comments,body
37
- gh pr checks <pr-number>
38
37
  ```
39
38
 
40
- **Note:** `gh pr checks` returns exit code 8 while checks are still pending this is expected, not a failure. Wait and re-run if needed.
39
+ Use `watch_github_ci` with `pr: "<pr-number>"` to block until CI passes or fails. Do not use `wait`, sleep, or repeated polling commands for CI.
41
40
 
42
41
  Read ALL PR comments to understand the full history — plans, reviews, assessments, progress updates, and discussion.
43
42
 
@@ -90,7 +89,7 @@ Update task: checks → completed, version → in_progress.
90
89
  git push
91
90
  ```
92
91
 
93
- 5. Wait for CI to pass on the version bump commit before proceeding to merge.
92
+ 5. Use `watch_github_ci` with `pr: "<pr-number>"` and proceed only after it reports that CI passed on the version bump commit.
94
93
 
95
94
  If the project doesn't use versioning, skip this step.
96
95
 
@@ -127,7 +126,7 @@ Proactively review and update ALL documentation affected by the PR's changes. Th
127
126
  git push
128
127
  ```
129
128
 
130
- 5. Wait for CI to pass on the docs commit.
129
+ 5. Use `watch_github_ci` with `pr: "<pr-number>"` and proceed only after it reports that CI passed on the docs commit.
131
130
 
132
131
  If no documentation changes are needed (rare), skip this step.
133
132
 
@@ -181,7 +180,7 @@ git push --tags
181
180
 
182
181
  3. Present draft to user for approval, then create:
183
182
  ```bash
184
- GH_NOTES="$(mktemp /tmp/gh-release-notes.XXXXXX.md)"
183
+ GH_NOTES="$(mktemp /tmp/gh-release-notes.$$.XXXXXXXX)"
185
184
  cat > "$GH_NOTES" << 'MACH6_EOF'
186
185
  <release-notes>
187
186
  MACH6_EOF
@@ -15,7 +15,7 @@ argument-hint: "[commit message]"
15
15
  3. **No `#N` in comment bodies** — Use "finding 3", "item 3", "stage 2" etc. instead.
16
16
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets (.env, credentials, tokens, keys).
17
17
  5. **Task tracking** — Use the `tasks_update` tool to show progress.
18
- 6. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
+ 6. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
19
19
  7. **Stop after durable progress** — The commit, push, and GitHub progress comment are the accountability and recovery boundary. Do not invoke `mach6-review` or continue into a formal review cycle. Only the user may start formal review; offer it with `suggest_next` and stop.
20
20
 
21
21
  ## Step 1: Set up task tracking
@@ -82,7 +82,7 @@ If session context points to an issue but a PR also exists on the current branch
82
82
 
83
83
  Post a progress comment:
84
84
  ```bash
85
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
85
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
86
86
  cat > "$GH_BODY" << 'MACH6_EOF'
87
87
  <!-- mach6-progress -->
88
88
  ## Progress Update
@@ -14,7 +14,7 @@ argument-hint: "<pr-number> [code|errors|tests|completeness|simplify]"
14
14
  2. **HTML markers** — Use `<!-- mach6-review -->` and `<!-- mach6-assessment -->` as the first line of comment bodies.
15
15
  3. **No `#N` in comment bodies** — Use "finding 3", "item 3", "stage 2" etc. instead.
16
16
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
17
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
17
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
18
  6. **User-controlled checkpoint** — This formal multi-agent review runs only from an explicit user request, either through its slash command or a direct instruction to an agent to invoke it. An agent may invoke it in response to that request; otherwise agents must only offer it with `suggest_next`, never invoke it autonomously or start a review-fix-review loop.
19
19
  7. **Review durable work only** — Do not launch formal review agents against uncommitted or unpushed work. The commit, push, and GitHub progress comment are the accountability and recovery boundary.
20
20
 
@@ -126,7 +126,7 @@ Update task: review → completed, post-review → in_progress.
126
126
  Compile all findings from all agents into a single structured comment:
127
127
 
128
128
  ```bash
129
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
129
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
130
130
  cat > "$GH_BODY" << 'MACH6_EOF'
131
131
  <!-- mach6-review -->
132
132
  ## Code Review
@@ -195,7 +195,7 @@ Update task: assess → completed, post-assess → in_progress.
195
195
  ## Step 7: Post assessment
196
196
 
197
197
  ```bash
198
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
198
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
199
199
  cat > "$GH_BODY" << 'MACH6_EOF'
200
200
  <!-- mach6-assessment -->
201
201
  ## Review Assessment
@@ -229,7 +229,7 @@ Present to the user:
229
229
 
230
230
  If any findings were classified as **deferred**, ask the user if they want to create issues for them:
231
231
  ```bash
232
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
232
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
233
233
  cat > "$GH_BODY" << 'MACH6_EOF'
234
234
  <body referencing PR and finding>
235
235
  MACH6_EOF