A full-featured CRM built with React, shadcn/ui, and Supabase.
feat: `#no-harness` by default
erwanMarmelab3a8b08ad7b45
diff --git a/.claude/agents/merger.md b/.claude/agents/merger.mdindex 099a5354..358161e4 100644--- a/.claude/agents/merger.md+++ b/.claude/agents/merger.md@@ -48,6 +48,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL|---|---|---|| `TASK_ID` | Stage A / SIMPLE / MIGRATION / ROLLBACK | Ticket ID (e.g. `TASK-003`) or the literal `SIMPLE` / `MIGRATION` / `ROLLBACK`. Absent in promotion-only mode — use `PROMOTE` in the contract line. || `MODE` | promotion-only | `MODE: promote` → run Stage B only and stop. (SIMPLE / MIGRATION / ROLLBACK are selected by the `ROLE:` line — see below.) |+| `STAGE` | technical-harness | `STAGE: a-only` → run **Stage A only** and stop, even in SIMPLE / MIGRATION mode. Never run Stage B / promotion. Used by the `#technical-harness` flow, which leaves the work on the session branch for the developer to promote. Overrides the automatic "Stage A then promotion" coupling. || `BRANCH_NAME` | Stage A / SIMPLE / MIGRATION / ROLLBACK | Feature (or rollback / ops) branch to merge. || `WORKTREE_PATH` | Stage A / SIMPLE / MIGRATION | Absolute path to the feature worktree (`<WORKTREE_BASE>/<TASK_ID>` or `<WORKTREE_BASE>/simple`). || `SESSION_SHORT_ID` | always recommended | Short session id. The orchestrator passes it directly. If absent, derive it as the first `-`-segment of `basename(TICKETS_DIR)` (wave) or of the session-id directory in `WORKTREE_PATH`. |@@ -58,6 +59,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL### Mode selection (first action — no tool call needed)- Spawn prompt `ROLE:` mentions **ROLLBACK mode** (rollback-conflict path) → run **ROLLBACK mode** (skip Stage A, run ROLLBACK PROMOTION on `BRANCH_NAME`). Contract `TASK_ID` is the literal `ROLLBACK`.+- Spawn prompt contains **`STAGE: a-only`** → run **Stage A only** on `BRANCH_NAME` (merge into `session/<SESSION_SHORT_ID>`) and stop after the Stage A contract. Never run Stage B / promotion, whatever the `ROLE:` line says. This takes precedence over the SIMPLE / MIGRATION coupling below. Contract `TASK_ID` stays the literal from the prompt (`SIMPLE` / `MIGRATION`).- Spawn prompt `ROLE:` mentions **SIMPLE mode** (SIMPLE flow) or **MIGRATION mode** (deploy-time migration round) → run **Stage A**, then immediately run **PROMOTION — Stage B**, then emit the contract. Contract `TASK_ID` is the literal `SIMPLE` or `MIGRATION` respectively. (Both are the same single-shot mechanic on the `<short>/simple` branch.)- Spawn prompt contains `MODE: promote` → run **PROMOTION — Stage B** only. Contract `TASK_ID` is `PROMOTE`.- Otherwise (`TASK_ID` is `TASK-XXX`) → run **Stage A** only, then emit the contract. Promotion for the wave runs once at the end of the request via a separate `MODE: promote` dispatch.@@ -89,7 +91,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAILfi```-4. **Capture short SHA and emit contract line** (Stage A only — not in SIMPLE / MIGRATION flow, which continues to Stage B)+4. **Capture short SHA and emit contract line** (Stage-A-only dispatches — the wave `TASK-XXX` path, or any dispatch carrying `STAGE: a-only`; a SIMPLE / MIGRATION flow *without* `STAGE: a-only` skips this and continues to Stage B)```bashcd <WORKTREE_BASE>/_session && git rev-parse --short HEAD```diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.mdindex 3db0fffc..8a496174 100644--- a/.claude/agents/orchestrator.md+++ b/.claude/agents/orchestrator.md@@ -23,9 +23,19 @@ Your developer / reviewer / merger subagents run one level below you: their inteThese instructions are the **mechanics**. Two concerns are owned by your surface, NOT by these instructions:-- **User-facing messaging.** Where these instructions say "emit a progress line" or "report to the user", phrase it for your surface. The web-chat surface persona (injected into your system prompt by the launcher) uses plain, non-technical language in the user's language (no file paths, no `TASK-XXX`, no git terms) and writes `ask-state` cartouches for confirmations; a developer session uses normal technical language. Example phrasings below are guidance, not literal scripts.+- **User-facing messaging.** Where these instructions say "emit a progress line" or "report to the user", phrase it for your surface. The web-chat surface persona (injected into your system prompt by the launcher) uses plain, non-technical language in the user's language (no file paths, no `TASK-XXX`, no git terms) and writes `ask-state` cartouches for confirmations; a developer session uses normal technical language. **If your dispatch prompt carries `PERSONA: technical`, you are talking to a real developer: use the full technical register unconditionally — file paths, `TASK-XXX`, git terms, `database`/`migration`/`Supabase` — and do NOT apply any plain-language / non-technical softening even if a web-chat persona is also present.** Example phrasings below are guidance, not literal scripts.- **Data-mode (demo/full).** The MODE-SWITCH intent and the demo→live data switch live in the web-chat surface persona (injected by the launcher), never here, and exist only when a `<mode>` tag is present in your context. With no `<mode>` tag — the default — data-mode does not exist: treat applying the migration (STATE PD-DEPLOY) as the terminal POST-DEV step. **When a `<mode>` tag IS present, PD-DEPLOY is NOT terminal** — after it succeeds you hand off to the surface's post-deploy step (in `demo` that is a mandatory demo→live offer; see STATE PD-DEPLOY).+### `PERSONA: technical` — the developer-harness contract++When your dispatch prompt carries `PERSONA: technical` (the `#technical-harness` opt-in), the request comes from a real developer who owns the merge and the deploy. Three behaviours change versus a normal run — they apply to every flow (SIMPLE, COMPLEX, SETUP):++1. **Full technical register** — as stated in the User-facing-messaging bullet above.+2. **Raw reporting.** Your final report is not a summary; it is the mechanical truth. Include: each `TASK-XXX` and its status, the branch names (`session/<SESSION_SHORT_ID>` and the per-task branches), the commit SHAs, each reviewer verdict (`APPROVED` / `REJECTED: <feedback>`), and any ADR file paths the developer wrote. Do not soften or omit failures.+3. **Stop at the session branch — never auto-promote.** The session branch is your terminal point. Do **not** dispatch the Stage-B promotion into the base branch, and do **not** run the POST-DEV migration round (STATE PD-* / writing-migrations). Merge every ticket into `session/<SESSION_SHORT_ID>` (Stage A only) and stop. The developer reviews the session branch, promotes it, and generates/applies migrations themselves. Still run the `pending-deploys.mjs` detection for **information only**, and report "schema changes detected — you will need a migration on merge" when it is non-empty; never generate or apply the migration yourself.++The main thread runs `/harness-diff` after you return, so end your report by naming the session branch it should diff.+---## CLASSIFICATION (priority order)@@ -296,6 +306,7 @@ Entered only from S-REVIEW on `BLOCKED:`.prompt: "ROLE: merger (SIMPLE mode — single-shot, no team)\nSESSION_SHORT_ID: <SESSION_SHORT_ID>\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\nWORKTREE_PATH: <WORKTREE_BASE>/simple\n\nFollow the WORKFLOW in merger.md. Use the single-shot columns (Stage A then promotion in one shot).\nOutput: \"DONE: SIMPLE commit=<short sha>\" OR \"FAILED: SIMPLE <reason>\""})```+ **`PERSONA: technical` → do NOT promote.** Add `STAGE: a-only` to the prompt so the merger runs Stage A only (merge into `session/<SESSION_SHORT_ID>`) and stops without Stage B: `"ROLE: merger (SIMPLE mode — single-shot, no team)\nSTAGE: a-only\nSESSION_SHORT_ID: …\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\nWORKTREE_PATH: <WORKTREE_BASE>/simple\n\nStage A ONLY — merge BRANCH_NAME into the session branch and stop. Do NOT run Stage B / promotion.\nOutput: \"DONE: SIMPLE commit=<short sha>\" OR \"FAILED: SIMPLE <reason>\""`4. One progress line, e.g. *"Wrapping up..."***End this turn.** → STATE S-DONE next turn.@@ -308,6 +319,7 @@ Entered only from S-REVIEW on `BLOCKED:`.4. Branch on detection:- Empty → send reply, STATE DONE.- Non-empty (schema-relevant) → append the satisfaction question to the reply (do NOT send a separate PD-ASK turn), end the turn, enter STATE PD-RESPOND. The POST-DEV machine (PD-MIG-DEV → … → PD-DONE) runs unchanged.+ - **`PERSONA: technical` override** → never enter the POST-DEV machine. On non-empty detection, add "schema changes detected — generate/apply a migration on merge" to the raw report; either way send the report (naming `session/<SESSION_SHORT_ID>`) and enter STATE DONE.**End.**@@ -431,6 +443,8 @@ Bash("for b in $(git -C $CLAUDE_PROJECT_DIR for-each-ref --format='%(refname:sho- **Non-empty** → those branches were developed but never merged. For each, resume its normal stages (review if no recorded verdict, then merge), then re-run the check until empty.- **Empty** → every developed ticket is on the session branch.+**`PERSONA: technical` → stop here.** Every reconciled ticket is already on `session/<SESSION_SHORT_ID>`. Do NOT promote and do NOT run POST-DEV: emit the raw per-ticket report (statuses, branches, SHAs, verdicts, ADR paths), run the `pending-deploys.mjs` detection for information only (add "schema changes detected — migration needed on merge" when non-empty), name the session branch for `/harness-diff`, and enter STATE DONE. The rest of this Promotion block is skipped.+Then promote the session branch to the base branch (the branch the session was forked from — both SETUP and COMPLEX). Stage A only put tickets on `session/<SESSION_SHORT_ID>`; nothing has reached the base branch yet.- **≥ 1 ticket reached `DONE`** → dispatch the promotion merger in the **foreground** and handle its result inline (do NOT run Stage 1–3 transitions for it):```diff --git a/CLAUDE.md b/CLAUDE.mdindex 14f278ae..19717a84 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -2,9 +2,9 @@# Agent Workflow-Code-change requests are handled by the **agent harness** by default: a team of subagents (planner, developer, quality-reviewer, merger, documentator) that implements the change through a deterministic, foreground pipeline in git worktrees.+Code-change requests can be handled by the **agent harness**: a team of subagents (planner, developer, quality-reviewer, merger, documentator) that implements the change through a deterministic, foreground pipeline in git worktrees. **The harness is opt-in — it does NOT run by default.** By default the main thread implements the change itself, no agents.-**When the main (top-level) session receives a code-change request, dispatch the `orchestrator` agent and relay its result — never route or implement it yourself.** Pass the `<session_dir>` value from your own context in the dispatch prompt (the orchestrator needs it to namespace worktrees and branches). **This directive is for the top-level session only: if you are a subagent (already inside the harness), ignore it — do your own job and never dispatch an orchestrator. A runtime hook (`block-nested-orchestrator`) enforces this.** The `orchestrator` owns all routing (classification SIMPLE vs COMPLEX, plus the SETUP / MEMORY / ROLLBACK-CONFLICT / RECOVERY operational intents, the dispatch templates, the 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`).+**Only when the user's request includes `#harness` or `#technical-harness` (or "use the agent team" / "with the harness") does the main (top-level) session dispatch the `orchestrator` agent and relay its result — never route or implement it yourself in that case.** Pass the `<session_dir>` value from your own context in the dispatch prompt (the orchestrator needs it to namespace worktrees and branches). **With `#technical-harness`**, also add a line `PERSONA: technical` to the dispatch prompt: it tells the orchestrator to use the full technical developer register (file paths, `TASK-XXX`, git terms, `database`/`migration`/`Supabase`), report the raw mechanical truth, and **stop at the session branch** (no promotion to the base branch, no deploy-time migration round). After that orchestrator returns, run `/harness-diff` to show the net diff of the session branch it stopped on. See the "Opting in" section below. **This directive is for the top-level session only: if you are a subagent (already inside the harness), ignore it — do your own job and never dispatch an orchestrator. A runtime hook (`block-nested-orchestrator`) enforces this.** The `orchestrator` owns all routing (classification SIMPLE vs COMPLEX, plus the SETUP / MEMORY / ROLLBACK-CONFLICT / RECOVERY operational intents, the dispatch templates, the 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`).**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 that question to the user (plain text or `AskUserQuestion`). **Do NOT resume the old orchestrator with `SendMessage` to relay their answer:** the runtime tags coordinator messages as carrying no user authority, so a relayed approval is ignored and the orchestrator loops re-asking forever. Instead, on the user's reply:- **Approved** → dispatch a **fresh** `orchestrator` (a 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.@@ -12,9 +12,17 @@ Code-change requests are handled by the **agent harness** by default: a team ofWhile that fresh dispatch runs, **do not start a parallel plan B** (don't generate the migration yourself, don't `TaskStop` it) — wait for it to finish, then relay its result.-## Opting out+## Opting in-`#no-harness` (or "implement directly" / "without the agent team" / "skip harness") makes the main thread implement the change itself, no agents. "no-harness for this session" keeps it off for the whole session.+The harness is off by default; the main thread implements code changes itself. `#harness` (or "use the agent team" / "with the harness") on a request routes that request through the orchestrator instead. "harness for this session" keeps it on for the whole session.++`#technical-harness` is the same opt-in for a real developer: it routes through the orchestrator **and** appends `PERSONA: technical` to the dispatch prompt, which changes three things (details in `.claude/agents/orchestrator.md` → "`PERSONA: technical` — the developer-harness contract"):++1. **Full technical register** — removes the plain-language filter that hides file paths, `TASK-XXX`, git terms, and words like `database`/`migration`/`Supabase`.+2. **Raw reporting** — the orchestrator reports the mechanical truth (per-ticket status, branch names, commit SHAs, reviewer verdicts, ADR paths), not a softened summary.+3. **Stops at the session branch** — the harness 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.++After the orchestrator returns from a `#technical-harness` run, the main thread runs `/harness-diff` to show the net diff of the session branch it stopped on.## Agents