Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Log for main thread

Jeromebe240127be51
diff --git a/CLAUDE.md b/CLAUDE.md
index e37a542d..950d3056 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -6,7 +6,7 @@ Code-change requests can be handled by the **agent harness**: a team of subagent
**Dispatch rule (top-level session only).** Only when the request opts into the harness (triggers under "Opting in") does the top-level session dispatch the `orchestrator` agent and relay its result; never route or implement it yourself in that case. Pass your context's `<session_dir>` in the dispatch prompt (the orchestrator needs it to namespace worktrees and branches). If you are a subagent (already inside the harness), ignore this: do your own job and never dispatch an orchestrator (the `block-nested-orchestrator` hook enforces it). The orchestrator owns all routing (classification SIMPLE vs COMPLEX, plus the SETUP / MEMORY / ROLLBACK-CONFLICT / RECOVERY intents, dispatch templates, wave + promotion mechanics, and the deploy-time migration round); it drives developer/reviewer/merger to a terminal point before returning. Each agent's last line is an output contract the others parse (`.claude/rules/agent-output-format.md`).
-**"Launched" is NOT "done" (read before you fill the silence).** The dispatch is *meant* to block until the orchestrator's final report, but in some runtimes (interactive Claude Code / the VS Code extension) the `Agent` tool returns immediately with `Async agent launched successfully … agentId: <id>` and the real result arrives later as a `task-notification`. That acknowledgement means dispatched, not finished. While it runs the orchestrator works silently in its own worktrees, so you see nothing, and that is normal. Do NOT read the quiet as "nothing is happening", and do NOT start implementing the feature yourself (no `Write`/`Edit`/`Bash` on the change, no re-dispatch): that is the exact bug that produces a duplicate, the main thread coding the same feature the orchestrator's developer is already building. Your only job after dispatching is to wait for the matching `task-notification`, then relay the orchestrator's final report. This mirrors the guard the orchestrator applies to its own workers (`.claude/agents/orchestrator.md` → "launched is NOT done").
+**"Launched" is NOT "done" (read before you fill the silence).** The dispatch is *meant* to block until the orchestrator's final report, but in some runtimes (interactive Claude Code / the VS Code extension) the `Agent` tool returns immediately with `Async agent launched successfully … agentId: <id>` and the real result arrives later as a `task-notification`. That acknowledgement means dispatched, not finished. Do NOT read the quiet as "nothing is happening", and do NOT start implementing the feature yourself (no `Write`/`Edit`/`Bash` on the change, no re-dispatch): that is the exact bug that produces a duplicate, the main thread coding the same feature the orchestrator's developer is already building. While it runs your ONLY job is to surface progress and then relay the final `task-notification` report: for a `#technical-harness` run, stream its progress log into the chat (recipe under "Opting in"); for a plain `#harness` run there is no log, so just wait for the notification. This mirrors the guard the orchestrator applies to its own workers (`.claude/agents/orchestrator.md` → "launched is NOT done").
**PD-ASK round-trip (migration confirmation).** The orchestrator ends its turn with a pending question, typically *"apply the database migration now?"*, and the task completes. Relay it to the user (plain text or `AskUserQuestion`). Do NOT resume the old orchestrator with `SendMessage` to relay the answer: the runtime tags coordinator messages as carrying no user authority, so a relayed approval is ignored and the orchestrator loops re-asking forever. On the user's reply:
- **Approved**: dispatch a **fresh** `orchestrator` (new `Agent` call) whose prompt begins with `<intent>apply-migration</intent>`, states the approval, and passes the same `<session_dir>`; it resumes the migration round from disk and applies it.
@@ -25,7 +25,7 @@ Off by default. `#harness` (or "use the agent team" / "with the harness") routes
3. **Stops at the session branch:** merges all work into `session/<id>` but does NOT promote to the base branch and does NOT run the deploy-time migration round; you review, promote, and generate/apply migrations yourself.
4. **Live progress log:** appends each step (ticket dispatched, developer done, reviewer verdict, merge) to `<session_dir>/harness-progress.log`.
-Its report lands only when the run finishes (and may arrive as a `task-notification`, see "launched is NOT done" above), so **before** dispatching a `#technical-harness` run print the watch command `tail -f <session_dir>/harness-progress.log` (real `<session_dir>` substituted) so the developer can follow along; after the orchestrator returns, run `/harness-diff` to show the net diff of the session branch it stopped on.
+**Live progress in the chat.** The orchestrator's report lands only when the run finishes (and may arrive as a `task-notification`, see "launched is NOT done" above), so give the developer a live feed of the progress log it appends to (effect 4). Dispatch the orchestrator with `run_in_background: true`, then immediately start a `Monitor` on that log so every step lands in the chat as it happens: `Monitor({command: "tail -n +1 -F <session_dir>/harness-progress.log", description: "harness progress", persistent: true})` (substitute the real `<session_dir>`; every log line is a real event, so no grep filter, and `-F` tolerates the file not existing yet). Do nothing else while it runs. The **authoritative** end signal is the orchestrator's `task-notification`, not the log (a crashed run goes quiet but still notifies): on it, `TaskStop` the monitor, relay the final report, and run `/harness-diff` to show the net diff of the session branch it stopped on. (A developer who prefers a terminal can also `tail -f` the same file directly.)
## Agents