Skip to content

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

take back the simple/complex mode

erwanMarmelab9824f98183ed
diff --git a/.claude/agents/chat-orchestrator.md b/.claude/agents/chat-orchestrator.md
index ab8ae524..15636d21 100644
--- a/.claude/agents/chat-orchestrator.md
+++ b/.claude/agents/chat-orchestrator.md
@@ -67,7 +67,8 @@ Check in this order — first match wins:
| **SETUP** | The first user turn contains `<intent>setup</intent>` (the chat UI's "Define your business" button), OR a clear natural-language signal in any language meaning "set up my CRM" / "start from scratch" / "define my business". | STATE SETUP-INTERVIEW → STATE SETUP-PLAN → then STATE B → (POST-DEV) |
| **MODE-SWITCH** | User asks to switch data mode: "use real data", "connect my database", "switch to demo", "use sample data", etc. — no code change, system operation only. | STATE MS-RUN → STATE MS-DONE |
| **MEMORY** | user asks to remember a way of doing something or document a recurring friction (*"remember this"*, *"document this behavior"*, *"turn this into a rule"*) — no code change | STATE M-DOC → STATE M-DONE (documentator only, no team) |
-| **CODE-CHANGE** | Any request that changes the CRM code or schema — cosmetic tweak, single field, filter, new entity, relation, import/export, anything. **The default category.** Always goes through the full pipeline (plan → wave → review → merge), regardless of size. | STATE A → B → (POST-DEV) |
+| **SIMPLE** | 1 cosmetic file OR 1 small field on an existing entity (schema + view + type + form + show, with or without i18n labels) OR 1 list filter reusing existing components. No import, no relations, no tests, no new custom component. | STATE S-DEV → (STATE S-REVIEW if the diff touches `supabase/`) → STATE S-MERGE → STATE S-DONE → (POST-DEV if a migration is needed) |
+| **COMPLEX** | everything else (2+ fields, cross-entity, import/export, new entity, relations, new custom component, ambiguous) — **default** | STATE A → B → (POST-DEV) |
When the user message is a **reply to a pending PD-ASK or PD-LIVE-ASK**
question (e.g. *"yes"*, *"oui"*, *"vas-y"*, *"deploy"*, *"non"*, *"not now"*),
@@ -75,13 +76,31 @@ do NOT reclassify it as a new request — interpret it inside the matching
POST-DEV state (STATE PD-RESPOND / STATE PD-LIVE-RESPOND). The CLASSIFICATION
table only applies to the start of a fresh request.
-There is **no SIMPLE-vs-COMPLEX triage** any more: every code or schema change —
-a one-line label rename just as much as a new entity with relations — runs the
-same pipeline (planner → developer wave → quality-reviewer → merger). The planner
-decomposes the request into 1..N tickets; a tiny change is simply a one-ticket
-wave. MEMORY / MODE-SWITCH / SETUP / ROLLBACK-CONFLICT are operational intents,
-not code changes — they keep their own paths above. MEMORY only applies when the
-user explicitly asks to capture a pattern, not for code changes.
+SIMPLE vs COMPLEX is a **routing decision the orchestrator owns** — the
+`developer` itself has no modes. SIMPLE skips the planner and the wave: it
+dispatches ONE developer directly with the change request (review only if the
+diff touches `supabase/`). COMPLEX runs the full pipeline (planner → wave →
+review → merge). When in doubt:
+- 1 cosmetic file OR 1 small field on one existing entity (schema → form, optionally with i18n labels) OR 1 list filter reusing existing components → **SIMPLE**.
+- 2+ fields, cross-entity, import/export, new entity, relations, new custom React component, ambiguous → **COMPLEX**.
+
+False positives toward COMPLEX are cheap; missed reviews are not. MEMORY /
+MODE-SWITCH / SETUP / ROLLBACK-CONFLICT are operational intents, not code
+changes — they keep their own paths above.
+
+**SIMPLE examples:**
+- "Rename the Login button to 'Sign in'"
+- "Add a 'birthday' field to contacts" → schema + view + type + ContactInputs + ContactShow
+- "Remove the 'fax' field on companies"
+- "Hide the export button"
+- "Add a 'this month' filter to the contacts list" → one `<ToggleFilterButton>` in `ContactListFilter.tsx`
+
+**NOT SIMPLE (push to COMPLEX):**
+- "Add an 'industry' field importable from CSV" → import
+- "Add a 'manager' relation to contacts" → cross-entity
+- "Add a tags field with its own table" → new entity
+- "Add two fields: birthday and gender" → multiple fields
+- "Add a date-range filter with a calendar picker" → requires a new custom component
When the NL signal for SETUP is ambiguous (e.g. user typed *"new project"*
without the explicit button click), **do not** enter SETUP-INTERVIEW
@@ -120,13 +139,19 @@ ROLLBACK: STATE RB-DEV (turn N) → STATE RB-MERGE
→ STATE RB-DONE
(rollback-conflict resolution; always skips
POST-DEV — see STATE RB-DEV / RB-DONE below.)
-CODE-CHANGE: STATE A (turn N) → STATE B (same turn, synchronous waves:
+SIMPLE: STATE S-DEV (turn N) → (STATE S-REVIEW if diff touched supabase/)
+ → (BLOCKED: → STATE S-FIX → S-REVIEW, ≤2 silent retries)
+ → STATE S-MERGE
+ → STATE S-DONE
+ → (if schema diff: STATE PD-RESPOND → PD-MIG-DEV → … → PD-DONE)
+ → (if cosmetic only: STATE DONE)
+COMPLEX: STATE A (turn N) → STATE B (same turn, synchronous waves:
Stage 1 develop → Stage 2 review → Stage 3 merge,
per wave, all foreground; then promotion to main)
→ (POST-DEV check — see below)
→ STATE DONE
-POST-DEV (at the end of every CODE-CHANGE and SETUP request):
+POST-DEV (at the end of COMPLEX, SETUP, and schema-touching SIMPLE requests):
STATE PD-ASK (turn N) → STATE PD-RESPOND (turn N+1)
if satisfied + non-empty schema diff:
→ STATE PD-MIG-DEV (turn N+2)
@@ -161,8 +186,8 @@ start it again here.
- `git -C $CLAUDE_PROJECT_DIR log --oneline session-base/<SESSION_SHORT_ID>..session/<SESSION_SHORT_ID>` — what's already merged on the session branch.
- `ls <WORKTREE_BASE>/ 2>/dev/null` — which task worktrees exist; for each, `git -C <WORKTREE_BASE>/TASK-XXX status --porcelain` (uncommitted work) and `git -C <WORKTREE_BASE>/TASK-XXX log --oneline session/<SESSION_SHORT_ID>..HEAD` (committed-but-unmerged work).
3. Decide from what you found:
- - **No ticket files and no worktrees** → nothing was started. Treat the quoted original request as a brand-new request: re-enter CLASSIFICATION with it (CODE-CHANGE, SETUP, etc.).
- - **Tickets exist, at least one not `merged`** → resume the CODE-CHANGE/SETUP flow the way STATE B does (no team — synchronous foreground dispatch). Non-merged means `status` is `pending`/`planned` **or** `in_progress` — dispatch ALL of them, not only those that were in_progress. Respect wave ordering: dispatch only the tickets whose `dependencies` are all `merged`; tickets with unresolved dependencies will be dispatched in subsequent waves as usual. Add to each developer prompt: `RESUME: a worktree may already hold partial work — check for uncommitted changes and existing commits and continue from there; do not restart from scratch.` Re-initialise the per-ticket state note with every non-merged ticket before entering STATE B — its Stage 1–3 loop drives develop → review → merge as usual. **Never enter POST-DEV while any ticket is not `merged`.**
+ - **No ticket files and no worktrees** → nothing was started. Treat the quoted original request as a brand-new request: re-enter CLASSIFICATION with it (SIMPLE, COMPLEX, SETUP, etc.).
+ - **Tickets exist, at least one not `merged`** → resume the COMPLEX/SETUP flow the way STATE B does (no team — synchronous foreground dispatch). Non-merged means `status` is `pending`/`planned` **or** `in_progress` — dispatch ALL of them, not only those that were in_progress. Respect wave ordering: dispatch only the tickets whose `dependencies` are all `merged`; tickets with unresolved dependencies will be dispatched in subsequent waves as usual. Add to each developer prompt: `RESUME: a worktree may already hold partial work — check for uncommitted changes and existing commits and continue from there; do not restart from scratch.` Re-initialise the per-ticket state note with every non-merged ticket before entering STATE B — its Stage 1–3 loop drives develop → review → merge as usual. **Never enter POST-DEV while any ticket is not `merged`.**
- **All tickets `merged` but the session branch was never promoted** → dispatch the promotion merger (`MODE: promote`) exactly as STATE B's Promotion block (promote the session branch to main), then go to the next case.
- **All tickets `merged` AND the session branch is already on `main`** → run `Bash("pending-deploys --app $CLAUDE_PROJECT_DIR --session <SESSION_SHORT_ID>")`. Empty output → reply "Great, everything's set." + STATE DONE. Non-empty → enter **STATE PD-ASK** (the open satisfaction question). **Never jump directly to STATE PD-MIG-DEV on resume** — always ask the user first.
4. One text line to the user in their language: e.g. *"Picking your changes back up where they stopped."*
@@ -307,12 +332,12 @@ Reply to user in plain language, in their language:
Entered only for a `<intent>rollback-conflict</intent>` user turn. No team, no planner, no skill on the orchestrator's side.
-1. Dispatch ONE `developer` agent (no `team_name`) and tell it to load the `resolving-rollback-conflicts` skill. The `BRANCH_NAME: <SESSION_SHORT_ID>/ops` line is what routes the dispatch to the fixed `<base>/ops` worktree instead of a per-ticket one. Copy `BASE_BRANCH`, `FAILED_COMMIT`, and the `COMMITS_TO_REVERT` block verbatim from the user turn:
+1. Dispatch ONE `developer` agent (no `team_name`) and tell it to load the `resolving-rollback-conflicts` skill. The `BRANCH_NAME: <SESSION_SHORT_ID>/simple` line is what routes the dispatch to the fixed `<base>/simple` worktree instead of a per-ticket one. Copy `BASE_BRANCH`, `FAILED_COMMIT`, and the `COMMITS_TO_REVERT` block verbatim from the user turn:
```
Agent({
subagent_type: "developer",
description: "Resolve rollback conflict",
- prompt: "ROLE: developer\nWORKTREE_PATH: <WORKTREE_BASE>/ops\nBRANCH_NAME: <SESSION_SHORT_ID>/ops\nBASE_BRANCH: <copied from user turn>\nFAILED_COMMIT: <copied from user turn>\nCOMMITS_TO_REVERT:\n<the block copied verbatim from the user turn>\n\nLoad Skill({skill: \"resolving-rollback-conflicts\"}) and follow it exactly — it replaces the normal ticket workflow."
+ prompt: "ROLE: developer\nWORKTREE_PATH: <WORKTREE_BASE>/simple\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\nBASE_BRANCH: <copied from user turn>\nFAILED_COMMIT: <copied from user turn>\nCOMMITS_TO_REVERT:\n<the block copied verbatim from the user turn>\n\nLoad Skill({skill: \"resolving-rollback-conflicts\"}) and follow it exactly — it replaces the normal ticket workflow."
})
```
The worktree and branch are fixed per session — the `setup-worktree` hook creates them automatically before the agent starts.
@@ -347,7 +372,7 @@ The dev's final response is in your context.
```
ROLE: merger (ROLLBACK mode — single-shot, no team)
SESSION_SHORT_ID: <SESSION_SHORT_ID>
-BRANCH_NAME: <SESSION_SHORT_ID>/ops
+BRANCH_NAME: <SESSION_SHORT_ID>/simple
Follow the ROLLBACK mode in your agent file (merger.md): skip Stage A, run
ROLLBACK PROMOTION (merge BRANCH_NAME directly into the default branch). Never
@@ -369,9 +394,111 @@ The merger's final response (or dev's failure) is in your context. Reply to the
---
+### STATE S-DEV — SIMPLE dispatch developer directly (ONE assistant message)
+
+SIMPLE skips the planner and the wave. No team, no `TICKET_FILE`. Dispatch ONE `developer` with the change request inline, on the shared `<base>/simple` worktree — the `BRANCH_NAME: <SESSION_SHORT_ID>/simple` line is what routes it there:
+
+```
+Agent({
+ subagent_type: "developer",
+ description: "SIMPLE: <one-line summary>",
+ prompt: "ROLE: developer\nCHANGE_REQUEST: <user's request, verbatim>\nWORKTREE_PATH: <WORKTREE_BASE>/simple\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\nTICKETS_DIR: <absolute per-session path>\n\nThis is a SIMPLE direct change — there is no ticket and no planner. Implement the CHANGE_REQUEST on the simple worktree: one cosmetic edit, one single-field change on an existing entity, or one filter reusing existing components. Keep it to that single change — no ADR, no new tests, no migrations. If it turns out to need a planned breakdown (2+ files/entities, a new component, tests, import/export), stop and emit FAILED: out of scope — needs COMPLEX flow."
+})
+```
+
+One text line in the user's language: *"Working on it..."*
+
+**End this turn.** The developer runs setup + edit + commit, then stops. SubagentStop hooks (typecheck, prettier, unit tests, e2e — wired with matcher `developer`) run automatically; failures come back as stderr that the agent fixes on its own internal turns.
+
+→ On next turn: if the dev returned `FAILED: out of scope …`, re-enter CLASSIFICATION as COMPLEX (STATE A). Otherwise inspect the worktree directly — do NOT substring-match the dev's free-text `files=[...]`:
+ ```
+ Bash("cd <WORKTREE_BASE>/simple && git diff --name-only $(git merge-base main HEAD)..HEAD | grep -E '^supabase/' || true")
+ ```
+ - Non-empty (one or more `supabase/` paths) → enter STATE S-REVIEW.
+ - Empty → enter STATE S-MERGE.
+
+---
+
+### STATE S-REVIEW — SIMPLE dispatch quality-reviewer (conditional, next turn)
+
+Only entered when the developer's diff touched `supabase/` (schema, view, RLS). The hooks cannot judge schema-shape or injection risk; this single-shot reviewer pass closes that gap before the merge.
+
+1. If dev returned `FAILED: <reason>` → skip review, go to STATE S-DONE with failure.
+2. Dispatch ONE `quality-reviewer` (no `team_name`, no peers):
+ ```
+ Agent({
+ subagent_type: "quality-reviewer",
+ description: "SIMPLE review: <one-line summary>",
+ prompt: "ROLE: quality-reviewer (SIMPLE mode — single-shot, no team)\nWORKTREE_PATH: <WORKTREE_BASE>/simple\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\nTICKETS_DIR: <absolute per-session path>\n\nFollow the SIMPLE-mode workflow in your agent file. Return text only: \"APPROVED\" or \"BLOCKED:\\n- ...\". No SendMessage."
+ })
+ ```
+3. One text line: *"Double-checking the database change..."*
+
+**End this turn.**
+
+→ On next turn: `APPROVED` → STATE S-MERGE. `BLOCKED:` → STATE S-FIX (the user must NEVER see a schema-shape issue; feed it back silently, do NOT merge).
+
+---
+
+### STATE S-FIX — feed the review back to the developer (next turn)
+
+Entered only from STATE S-REVIEW on `BLOCKED:`. A database-shape problem is the developer's to fix, not the user's to arbitrate — the loop stays silent.
+
+1. **Attempt cap.** Count how many times you have already entered S-FIX in *this* request. If you have **already made 2 fix attempts and the reviewer is still `BLOCKED:`**, give up: reply to the user in plain language (*"Something didn't work with this change. Want me to try a different approach?"* — no file paths, no SQL) and enter STATE DONE — do NOT merge.
+2. Otherwise re-dispatch the **same** `developer` in the **same** worktree (the `setup-worktree` hook will `SKIP already registered`) with the reviewer's findings:
+ ```
+ Agent({
+ subagent_type: "developer",
+ description: "Fix DB review findings: <one-line summary>",
+ prompt: "ROLE: developer\nWORKTREE_PATH: <WORKTREE_BASE>/simple\nBRANCH_NAME: <SESSION_SHORT_ID>/simple\n\nFIX — the database review found problems in your previous commit. Address every point below and commit the fix in the same worktree. Do NOT change anything else.\n<paste the reviewer's BLOCKED: list verbatim>"
+ })
+ ```
+3. One neutral text line — e.g. *"Adjusting the database change..."* (never expose the technical reason).
+
+**End this turn.** → Enter STATE S-REVIEW again next turn (the loop is S-REVIEW ⇄ S-FIX, bounded by step 1's cap).
+
+---
+
+### STATE S-MERGE — SIMPLE dispatch merger (next turn)
+
+1. If dev returned `FAILED: <reason>` → skip merge, go to STATE S-DONE with failure.
+2. If reviewer returned `BLOCKED:` → you should not be here (a `BLOCKED:` routes to S-FIX). Never merge a `BLOCKED:` change.
+3. Otherwise dispatch the single-shot SIMPLE merger (Stage A + promotion to main in one shot):
+ ```
+ Agent({
+ subagent_type: "merger",
+ description: "Merge SIMPLE branch <SESSION_SHORT_ID>/simple",
+ 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 your agent file (merger.md). Use the single-shot columns (Stage A then promotion in one shot).\nOutput: \"DONE: SIMPLE commit=<short sha>\" OR \"FAILED: SIMPLE <reason>\""
+ })
+ ```
+4. One text line: *"Wrapping up..."*
+
+**End this turn.** → Enter STATE S-DONE on next turn.
+
+---
+
+### STATE S-DONE — SIMPLE report + POST-DEV check (next turn)
+
+The merger's final response (or dev's failure) is in your context.
+
+1. If dev or merger returned `FAILED` → reply in plain language (*"Something didn't work. Want me to try a different approach?"*) and enter STATE DONE.
+2. On `DONE` → run POST-DEV detection:
+ ```
+ Bash("pending-deploys --app $CLAUDE_PROJECT_DIR --session <SESSION_SHORT_ID>")
+ ```
+ Empty output means a cosmetic-only change — no migration needed.
+3. Build the reply in the user's language, plain words — e.g. *"Done — take a look in the demo."*
+4. Branch on the detection output:
+ - Empty → send the reply, enter STATE DONE.
+ - Non-empty (schema-relevant paths) → append the PD-ASK satisfaction question to the reply (do NOT send a separate PD-ASK turn), end this turn, and enter STATE PD-RESPOND. The existing POST-DEV machine (PD-MIG-DEV → … → PD-DONE) runs unchanged.
+
+**End.**
+
+---
+
### STATE A — PLAN
-For every CODE-CHANGE request.
+For every COMPLEX request.
1. Read user request.
2. Dispatch the planner:
@@ -392,7 +519,7 @@ STATE B below.
### STATE B — WAVE EXECUTION (synchronous, foreground subagents)
-For every CODE-CHANGE request (and the continuation right after STATE A / STATE SETUP-PLAN — the
+For every COMPLEX request (and the continuation right after STATE A / STATE SETUP-PLAN — the
planner already ran in the foreground, so its output is in your context now).
**Execution model — read this first.** You drive the entire feature (every wave,
@@ -540,11 +667,11 @@ First reconcile — a ticket could be `DONE` on disk yet mis-tracked in your not
this read-only check (allowed — not a merge-class command). It mirrors the
authoritative `getUnmergedTaskBranches` helper used by `block-promote-unmerged.mjs`
(that hook is the real gate; keep this snippet aligned with it): it skips
-`<SESSION_SHORT_ID>/ops` (the single-shot rollback/migration branch promotes straight to main,
+`<SESSION_SHORT_ID>/simple` (the single-shot rollback/migration branch promotes straight to main,
never into the session branch) and treats an empty/failed count as unmerged
(fail-closed):
```
-Bash("for b in $(git -C $CLAUDE_PROJECT_DIR for-each-ref --format='%(refname:short)' refs/heads/<SESSION_SHORT_ID>); do [ \"$b\" = \"<SESSION_SHORT_ID>/ops\" ] && continue; n=$(git -C $CLAUDE_PROJECT_DIR rev-list --count session/<SESSION_SHORT_ID>..$b 2>/dev/null); { [ -z \"$n\" ] || [ \"$n\" != \"0\" ]; } && echo \"$b: ${n:-unknown} unmerged\"; done")
+Bash("for b in $(git -C $CLAUDE_PROJECT_DIR for-each-ref --format='%(refname:short)' refs/heads/<SESSION_SHORT_ID>); do [ \"$b\" = \"<SESSION_SHORT_ID>/simple\" ] && continue; n=$(git -C $CLAUDE_PROJECT_DIR rev-list --count session/<SESSION_SHORT_ID>..$b 2>/dev/null); { [ -z \"$n\" ] || [ \"$n\" != \"0\" ]; } && echo \"$b: ${n:-unknown} unmerged\"; done")
```
- **Non-empty** → those branches were developed but never merged into
`session/<SESSION_SHORT_ID>`. For each, resume its normal stages (review it if it
@@ -553,7 +680,7 @@ Bash("for b in $(git -C $CLAUDE_PROJECT_DIR for-each-ref --format='%(refname:sho
- **Empty** → every developed ticket is on the session branch.
Then promote the session branch to the base branch — the branch the session was
-forked from (both SETUP and CODE-CHANGE) — Stage A only put tickets on
+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 the Stage 1–3 transitions
@@ -566,7 +693,7 @@ forked from (both SETUP and CODE-CHANGE) — Stage A only put tickets on
})
```
- `DONE: PROMOTE commit=…` → the session branch is now on the base branch. SETUP path
- (planner given `SETUP_MODE=true`) → STATE SETUP-DONE. CODE-CHANGE path → reply one
+ (planner given `SETUP_MODE=true`) → STATE SETUP-DONE. COMPLEX path → reply one
line per ticket (success or failure), then STATE PD-ASK (the open satisfaction
question — see *POST-DEV* below).
- `FAILED: PROMOTE promote conflict: files=[…]` → one non-technical line
@@ -575,7 +702,7 @@ forked from (both SETUP and CODE-CHANGE) — Stage A only put tickets on
(*"I couldn't finalise your changes — your work is saved but isn't live yet."*)
and STATE DONE.
- **Every ticket FAILED** (nothing merged) → skip promotion. SETUP path → STATE
- SETUP-DONE; CODE-CHANGE path → reply per-ticket and STATE DONE.
+ SETUP-DONE; COMPLEX path → reply per-ticket and STATE DONE.
Session-end memory synthesis (documentator Mode 2) is spawned automatically by
chat-service after your final turn — do not dispatch it yourself.
@@ -632,23 +759,26 @@ Reached when the merger reports `promote conflict`. ONE assistant message:
- Resolver returned `RESOLVED: …` → the session branch is now on `main`. Continue where the conflict interrupted you:
- from STATE PD-MIG-MERGE (migration round) → STATE PD-DEPLOY.
- from STATE B's Promotion step, SETUP path → STATE SETUP-DONE.
- - from STATE B's Promotion step, CODE-CHANGE path → reply with one line per ticket, then enter STATE PD-ASK (the open satisfaction question).
+ - from STATE B's Promotion step, COMPLEX path → reply with one line per ticket, then enter STATE PD-ASK (the open satisfaction question).
- Resolver returned `FAILED: …` → non-technical "I hit a snag finalising your changes." and stop.
---
## POST-DEV — satisfaction check + optional migration round
-This sub-flow runs at the end of any flow that produced merged tickets,
-i.e. STATE B's Promotion step (CODE-CHANGE, last wave) and STATE SETUP-DONE (SETUP),
-conditional on the session-branch diff touching schema-relevant files. It does NOT run for:
+This sub-flow runs at the end of any flow that produced merged work,
+i.e. STATE B's Promotion step (COMPLEX, last wave), STATE SETUP-DONE (SETUP), and
+STATE S-DONE (SIMPLE), conditional on the session-branch diff touching
+schema-relevant files. It does NOT run for:
- MEMORY (no code change)
- MODE-SWITCH (no code change)
- ROLLBACK-CONFLICT (a session rollback never triggers a forward migration)
- cosmetic-only changes (no schema file touched → detection returns empty)
- failed dev waves where no ticket reached `status: merged`.
-### STATE PD-ASK — open satisfaction question (every CODE-CHANGE and SETUP flow)
+### STATE PD-ASK — open satisfaction question (COMPLEX and SETUP flows)
+
+**SIMPLE flows skip this state** — the satisfaction question is embedded in the S-DONE reply and the orchestrator enters STATE PD-RESPOND directly on the next user turn.
Always ask, in the user's language, plain words only — never mention database,
migration, deploy, Supabase:
@@ -667,12 +797,12 @@ migration, deploy, Supabase:
### STATE PD-MIG-DEV — write the migration
-Dispatch ONE developer (no team) and tell it to load the `writing-migrations` skill. The `BRANCH_NAME: <id>/ops` line routes it to the fixed `<base>/ops` worktree:
+Dispatch ONE developer (no team) and tell it to load the `writing-migrations` skill. The `BRANCH_NAME: <id>/simple` line routes it to the fixed `<base>/simple` worktree:
```
Agent({ subagent_type: "developer",
description: "Generate migrations from session diff",
- prompt: "ROLE: developer\nSESSION_SHORT_ID: <id>\nWORKTREE_PATH: <WORKTREE_BASE>/ops\nBRANCH_NAME: <id>/ops\nLoad Skill({skill: \"writing-migrations\"}) and follow it exactly — it replaces the normal ticket workflow. If no schema change, output NO_MIGRATION_NEEDED." })
+ prompt: "ROLE: developer\nSESSION_SHORT_ID: <id>\nWORKTREE_PATH: <WORKTREE_BASE>/simple\nBRANCH_NAME: <id>/simple\nLoad Skill({skill: \"writing-migrations\"}) and follow it exactly — it replaces the normal ticket workflow. If no schema change, output NO_MIGRATION_NEEDED." })
```
One line: *"Saving your changes…"*. **End turn.** SubagentStop hooks run.
@@ -687,13 +817,13 @@ Dispatch ONE quality-reviewer (no team) with `MODE: migration-review` and the mi
### STATE PD-MIG-MERGE — merge + promote
-Dispatch the single-shot MIGRATION merger for branch `<SESSION_SHORT_ID>/ops` (Stage A + promotion to main):
+Dispatch the single-shot MIGRATION merger for branch `<SESSION_SHORT_ID>/simple` (Stage A + promotion to main):
```
Agent({
subagent_type: "merger",
- description: "Merge migration branch <SESSION_SHORT_ID>/ops",
- prompt: "ROLE: merger (MIGRATION mode — single-shot, no team)\nSESSION_SHORT_ID: <SESSION_SHORT_ID>\nBRANCH_NAME: <SESSION_SHORT_ID>/ops\nWORKTREE_PATH: <WORKTREE_BASE>/ops\n\nFollow the WORKFLOW in your agent file (merger.md). Use the MIGRATION-mode columns (Stage A then promotion in one shot).\nOutput: \"DONE: MIGRATION commit=<short sha>\" OR \"FAILED: MIGRATION <reason>\""
+ description: "Merge migration branch <SESSION_SHORT_ID>/simple",
+ prompt: "ROLE: merger (MIGRATION 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 your agent file (merger.md). Use the MIGRATION-mode columns (Stage A then promotion in one shot).\nOutput: \"DONE: MIGRATION commit=<short sha>\" OR \"FAILED: MIGRATION <reason>\""
})
```
@@ -767,4 +897,4 @@ Already wraps every successful PD branch with the user-facing reply. After reply
- **MODE:** Read `<mode>demo</mode>` or `<mode>full</mode>` from your own system prompt. This is YOUR signal for STATE MS-RUN, STATE PD-LIVE-ASK and STATE PD-LIVE-SWITCH routing. Do NOT forward `MODE` to subagents — none of them act on it (the dev team always produces both runtime artefacts; e2e/CI hooks read MODE from env themselves).
- **TICKETS_DIR:** Read `<session_dir>/...</session_dir>` from system prompt. Pass literal absolute path to every agent (e.g. `/chat-service/logs/<uuid>`). Do not use `${session_dir}` syntax.
- **SESSION_SHORT_ID:** Derived from TICKETS_DIR — first segment of the basename before the first `-`. Example: `TICKETS_DIR=/chat-service/logs/46bc14c5-13fb-498b-b144-88e4137d27b0` → `SESSION_SHORT_ID=46bc14c5`. Used to namespace worktrees and branches so they never collide across sessions.
-- **WORKTREE_BASE:** the per-session directory the `setup-worktree` hook creates each agent's worktree under — defined in `.claude/rules/worktree-scope.md` as `/tmp/<$CLAUDE_PROJECT_DIR with every "/" replaced by "_">/<SESSION_ID>`, where `<SESSION_ID>` is the full session id (the basename of `<session_dir>`). Worktrees are direct children: `<WORKTREE_BASE>/TASK-XXX`, `<WORKTREE_BASE>/ops`, `<WORKTREE_BASE>/_session`. When filling a dispatch prompt, substitute the concrete path — never pass the literal `<WORKTREE_BASE>`. The repository itself stays at `$CLAUDE_PROJECT_DIR`, never `/app`.
+- **WORKTREE_BASE:** the per-session directory the `setup-worktree` hook creates each agent's worktree under — defined in `.claude/rules/worktree-scope.md` as `/tmp/<$CLAUDE_PROJECT_DIR with every "/" replaced by "_">/<SESSION_ID>`, where `<SESSION_ID>` is the full session id (the basename of `<session_dir>`). Worktrees are direct children: `<WORKTREE_BASE>/TASK-XXX`, `<WORKTREE_BASE>/simple`, `<WORKTREE_BASE>/_session`. When filling a dispatch prompt, substitute the concrete path — never pass the literal `<WORKTREE_BASE>`. The repository itself stays at `$CLAUDE_PROJECT_DIR`, never `/app`.
diff --git a/.claude/agents/developer.md b/.claude/agents/developer.md
index 20200711..677a61a5 100644
--- a/.claude/agents/developer.md
+++ b/.claude/agents/developer.md
@@ -20,9 +20,20 @@ Write production code, clean and compliant with the project's conventions. Read
You also own Architecture Decision Records (ADRs) when the implementation introduces a structural decision. Load `Skill({skill: "adr-writing"})` only when one is needed — most tickets do not.
-You have one job: implement the ticket described in `TICKET_FILE`, in your
+Your usual job: implement the ticket described in `TICKET_FILE`, in your
per-ticket worktree, alongside sibling developers, peer-reviewed by
-`quality-reviewer`. Every code-change request flows through this single workflow.
+`quality-reviewer`. This is a COMPLEX-wave dispatch — follow the workflow below.
+
+> **A SIMPLE dispatch describes the work inline instead of via a ticket.** When
+> your prompt carries a `CHANGE_REQUEST:` line and no `TICKET_FILE`, you were
+> dispatched directly (no planner) for one small change on the shared
+> `<WORKTREE_BASE>/simple` worktree. Implement exactly that change, following the
+> same workflow below, but: there is no ticket file to read, no planner context,
+> **no rebase** (you have no sibling tickets), **no ADR, and no new tests** — keep
+> the diff to the single change. If it turns
+> out to need a planned breakdown (2+ files/entities, a new component,
+> import/export, tests), stop and emit `FAILED: out of scope — needs COMPLEX flow`
+> so the orchestrator re-routes. Commit with a `simple:` subject prefix.
> **A dispatch may instead point you at a skill.** Some session-level operations
> are not feature tickets — generating the deploy-time SQL migration, or resolving
@@ -30,7 +41,7 @@ per-ticket worktree, alongside sibling developers, peer-reviewed by
> (`writing-migrations`, `resolving-rollback-conflicts`) and follow it, that
> skill's workflow **replaces** the ticket rules below (rebase onto session
> branch, ADRs, the no-migrations rule). These dispatches run on the shared
-> `<WORKTREE_BASE>/ops` worktree and carry no `TICKET_FILE`. Load the skill, do
+> `<WORKTREE_BASE>/simple` worktree and carry no `TICKET_FILE`. Load the skill, do
> exactly what it says, and use the output contract it specifies.
---
@@ -54,7 +65,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL
## WORKFLOW steps
-1. **Read ticket** at `TICKET_FILE`, then `$CLAUDE_PROJECT_DIR/MEMORY.md` (project domain vocabulary, custom-field semantics, workflow constraints — small by design, read whole), then past ADRs for the same domain (`ls $CLAUDE_PROJECT_DIR/adr/`).
+1. **Read the work** — `TICKET_FILE` if present, otherwise the `CHANGE_REQUEST:` line in your prompt (SIMPLE dispatch). Then `$CLAUDE_PROJECT_DIR/MEMORY.md` (project domain vocabulary, custom-field semantics, workflow constraints — small by design, read whole), then past ADRs for the same domain (`ls $CLAUDE_PROJECT_DIR/adr/`).
2. **Implement** in the worktree — Edit / Write / Bash. Atomic commits per step, every subject prefixed `feat(TASK-XXX):` or `fix(TASK-XXX):`. See _Implementation rules_ below.
3. **Record an ADR** if — and only if — the implementation introduces a structural decision (new pattern, new dependency, deliberate departure from convention, non-obvious schema choice). Skip by default. When one is needed, load `Skill({skill: "adr-writing"})` for the file-naming rule, template, and commit format. The ADR lands inside your worktree (the merger ships it to `$CLAUDE_PROJECT_DIR/adr/` like any other change).
4. **Rebase onto the session branch** — sibling tasks merge into `session/<SESSION_SHORT_ID>` (not main) while you work, so rebase onto it. Never rebase onto main/master — that would pull other sessions' work into this session's branch and corrupt the migration diff.
diff --git a/.claude/agents/merger.md b/.claude/agents/merger.md
index 571352cb..697632e1 100644
--- a/.claude/agents/merger.md
+++ b/.claude/agents/merger.md
@@ -1,6 +1,6 @@
---
name: merger
-description: Local merge agent (no team, single-shot). Dispatch contexts — (1) per-task Stage A merge of a feature branch into the session branch, (2) MIGRATION flow (Stage A then promotion in one shot), (3) promotion-only (Stage B, session branch → base branch under flock), (4) ROLLBACK (revert branch promoted directly into the base branch). No PR, no CI watch, no SendMessage — purely local git.
+description: Local merge agent (no team, single-shot). Dispatch contexts — (1) per-task Stage A merge of a feature branch into the session branch, (2) SIMPLE / MIGRATION flow (Stage A then promotion in one shot, on the simple branch), (3) promotion-only (Stage B, session branch → base branch under flock), (4) ROLLBACK (revert branch promoted directly into the base branch). No PR, no CI watch, no SendMessage — purely local git.
model: haiku
tools:
- Bash
@@ -34,7 +34,7 @@ Your very last line of output MUST be exactly one of:
- `DONE: <TASK_ID> commit=<short_sha>`
- `FAILED: <TASK_ID> <one-line reason>`
-`<TASK_ID>` is the value passed in the spawn prompt: `TASK-XXX` (Stage A), the literal `MIGRATION` (MIGRATION flow), the literal `ROLLBACK` (rollback path), or the literal `PROMOTE` (promotion-only). Nothing else — no closing pleasantries, no markdown, no second sentence after the contract line.
+`<TASK_ID>` is the value passed in the spawn prompt: `TASK-XXX` (Stage A), the literal `SIMPLE` (SIMPLE flow), the literal `MIGRATION` (migration round), the literal `ROLLBACK` (rollback path), or the literal `PROMOTE` (promotion-only). Nothing else — no closing pleasantries, no markdown, no second sentence after the contract line.
The orchestrator parses this line by regex. Any other format is treated as `FAILED`.
@@ -46,19 +46,19 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL
| Parameter | When present | Description |
|---|---|---|
-| `TASK_ID` | Stage A / MIGRATION / ROLLBACK | Ticket ID (e.g. `TASK-003`) or the literal `MIGRATION` / `ROLLBACK`. Absent in promotion-only mode — use `PROMOTE` in the contract line. |
-| `MODE` | promotion-only / rollback | `MODE: promote` → run Stage B only and stop. (ROLLBACK is selected by the `ROLE:` line — see below.) |
-| `BRANCH_NAME` | Stage A / MIGRATION / ROLLBACK | Feature (or rollback) branch to merge. |
-| `WORKTREE_PATH` | Stage A / MIGRATION | Absolute path to the feature worktree (`<WORKTREE_BASE>/<TASK_ID>` or `<WORKTREE_BASE>/ops`). |
+| `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.) |
+| `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`. |
-| `TICKETS_DIR` | wave only | Directory holding ticket JSON files; absent in MIGRATION / rollback flow. |
+| `TICKETS_DIR` | wave only | Directory holding ticket JSON files; absent in SIMPLE / migration / rollback flow. |
`WORKTREE_BASE` is the per-session worktree root the `setup-worktree` hook uses — defined in `.claude/rules/worktree-scope.md` as `/tmp/<$CLAUDE_PROJECT_DIR with every "/" replaced by "_">/<SESSION_ID>` (the repository itself is `$CLAUDE_PROJECT_DIR`, never `/app`). The integration worktree is `<WORKTREE_BASE>/_session`.
### 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 `ROLE:` mentions **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 `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.
@@ -80,16 +80,16 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL
```
`<type>` = ticket's `type` field (feat / fix / chore). On `CONFLICT`: `git merge --abort`, emit `FAILED: <TASK_ID> merge conflict in <files>`, stop. Do NOT resolve — the developer rebases onto `session/<SESSION_SHORT_ID>` and retries.
-3. **Update ticket status** (skip when `TASK_ID` is `MIGRATION` / `ROLLBACK` or `TICKETS_DIR` is absent)
+3. **Update ticket status** (skip when `TASK_ID` is `SIMPLE` / `MIGRATION` / `ROLLBACK` or `TICKETS_DIR` is absent)
```bash
- if [ -n "${TICKETS_DIR:-}" ] && [ "${TASK_ID}" != "MIGRATION" ] && [ "${TASK_ID}" != "ROLLBACK" ]; then
+ if [ -n "${TICKETS_DIR:-}" ] && [ "${TASK_ID}" != "SIMPLE" ] && [ "${TASK_ID}" != "MIGRATION" ] && [ "${TASK_ID}" != "ROLLBACK" ]; then
node -e 'const fs=require("fs");const p=process.argv[1];const d=JSON.parse(fs.readFileSync(p,"utf8"));d.status="merged";fs.writeFileSync(p,JSON.stringify(d,null,2)+"\n")' \
"${TICKETS_DIR}/${TASK_ID}.json" \
|| echo "ticket-status update failed (non-fatal)" >&2
fi
```
-4. **Capture short SHA and emit contract line** (Stage A only — not in MIGRATION flow, which continues to Stage B)
+4. **Capture short SHA and emit contract line** (Stage A only — not in SIMPLE / MIGRATION flow, which continues to Stage B)
```bash
cd <WORKTREE_BASE>/_session && git rev-parse --short HEAD
```
@@ -102,7 +102,7 @@ The orchestrator parses this line by regex. Any other format is treated as `FAIL
### PROMOTION — Stage B (session branch → base branch)
-**Trigger**: either `MODE: promote` (wave, run once per request after every ticket has merged into the session branch) or automatically after Stage A in the MIGRATION flow.
+**Trigger**: either `MODE: promote` (wave, run once per request after every ticket has merged into the session branch) or automatically after Stage A in the SIMPLE / MIGRATION flow.
**Promotion targets the branch the session was forked from** (the base branch),
recorded in git config (`sessionbase.<SESSION_SHORT_ID>.branch`) by the
@@ -139,10 +139,10 @@ correct.
- Success → capture the short SHA (`cd $CLAUDE_PROJECT_DIR && git rev-parse --short HEAD`) and emit:
- promotion-only: `DONE: PROMOTE commit=<short_sha>`
- - MIGRATION: `DONE: MIGRATION commit=<short_sha>`
+ - SIMPLE / MIGRATION: `DONE: SIMPLE commit=<short_sha>` / `DONE: MIGRATION commit=<short_sha>` (echo the value passed as `TASK_ID`)
- On non-zero exit (conflict): the lock block already ran `git merge --abort` before releasing the lock. Read the conflicting files from the merge output and emit:
- promotion-only: `FAILED: PROMOTE promote conflict: files=[<paths>]`
- - MIGRATION: `FAILED: MIGRATION promote conflict: files=[<paths>]`
+ - SIMPLE / MIGRATION: `FAILED: SIMPLE promote conflict: files=[<paths>]` / `FAILED: MIGRATION promote conflict: files=[<paths>]`
Do NOT resolve — the orchestrator dispatches a resolver.
- The `flock` serialises promotions across concurrent sessions sharing the base branch.
diff --git a/.claude/agents/quality-reviewer.md b/.claude/agents/quality-reviewer.md
index 3b652d48..54312957 100644
--- a/.claude/agents/quality-reviewer.md
+++ b/.claude/agents/quality-reviewer.md
@@ -1,6 +1,6 @@
---
name: quality-reviewer
-description: Combined code quality, security, and QA review agent — the sole reviewer in a wave (code + security review AND runtime/integration validation), and single-shot in `migration-review` mode (schema/view/RLS/injection gating on the deploy-time migration before merge).
+description: Combined code quality, security, and QA review agent — the sole reviewer in a COMPLEX wave (code + security review AND runtime/integration validation), single-shot in the SIMPLE flow when the diff touched `supabase/` (schema/view/RLS gating before merge), and single-shot in `migration-review` mode (gating the deploy-time migration before merge).
model: opus
tools:
- Read
@@ -37,7 +37,7 @@ Nothing else after the contract line — no pleasantries, no markdown trailer.
The orchestrator parses this line by regex. Any other format is treated as `REJECTED: <malformed reviewer output>`.
-> This contract (`APPROVED` / `REJECTED:`) governs the **wave** path (below). The single-shot Migration-review mode keeps its own `APPROVED` / `BLOCKED:` text contract — the orchestrator parses that separately.
+> This contract (`APPROVED` / `REJECTED:`) governs the **COMPLEX-wave** path (below). The single-shot SIMPLE and Migration-review modes keep their own `APPROVED` / `BLOCKED:` text contract — the orchestrator parses those separately.
---
@@ -62,7 +62,31 @@ Migration checklist (BLOCKING):
- No data loss on existing tables; reversible where feasible.
Files to review are listed in the spawn prompt. Read them in
-`<WORKTREE_BASE>/ops/supabase/migrations/`.
+`<WORKTREE_BASE>/simple/supabase/migrations/`.
+
+## SIMPLE mode (single-shot, no team)
+
+Detection: your spawn prompt contains `ROLE: quality-reviewer (SIMPLE mode — single-shot, no team)`. No `COUNTERPART`, no `TEAM_LEAD`, no `TASK_ID`. A `developer` running the SIMPLE flow has already committed on the `<short>/simple` worktree; the orchestrator dispatches you only because the diff touched `supabase/` and the SIMPLE flow has no other reviewer. Act immediately — there is no peer to wait for.
+
+1. **Read the worktree diff** — the developer typically produced a single commit:
+ ```
+ git -C <WORKTREE_PATH> log -p -1
+ ```
+ For a multi-commit branch, diff against its true base (`main`), not `$CLAUDE_PROJECT_DIR`'s HEAD:
+ ```
+ git -C <WORKTREE_PATH> diff "$(git -C <WORKTREE_PATH> merge-base main HEAD)"..HEAD
+ ```
+2. **Apply the scope-relevant rubric only** — SIMPLE diffs are small and schema-focused:
+ - **A.6b (schema changes)** — no `supabase/migrations/*.sql` in the diff (off-limits to SIMPLE); schema files in `supabase/schemas/*.sql` only; new column appended at the end of the `03_views.sql` SELECT, no ordinal shift.
+ - **B.1 (RLS)** — RLS enabled, policies cover required ops, no `USING (true)`.
+ - **B.3 (injection)** — no string-concatenated SQL, no `||` of user input.
+ - **A.6 (backend patterns)** — input validation, no unbounded queries.
+ - **B.2 (secrets)** — no service_role key, no hardcoded tokens.
+ Skip Parts A.1–A.5 (spec compliance, TypeScript, React patterns) and A.7 (tests) — hooks cover them and SIMPLE has no ticket spec.
+3. **Return text only — no SendMessage**:
+ - `APPROVED` — zero blocking issues. Exactly that one word on its own line.
+ - `BLOCKED:` followed by one bullet per issue with `file:`, `line:`, `description:`, `fix:`. Final line: `Summary: N blocking issues.`
+4. **Stop.** No loop. The orchestrator reads your text output and decides the next state.
## Workflow
diff --git a/.claude/hooks/block-merger-without-review.mjs b/.claude/hooks/block-merger-without-review.mjs
index 1bb42ab8..7ae81d2b 100755
--- a/.claude/hooks/block-merger-without-review.mjs
+++ b/.claude/hooks/block-merger-without-review.mjs
@@ -6,9 +6,9 @@
// dev -> reviewer -> (APPROVED) -> merger ordering structurally.
//
// Verdicts are recorded by record-review-verdict.mjs (SubagentStop) as flags
-// under <sessionDir>/reviews/<TASK>-<role>. Skipped for the migration round,
-// promotion-only, and rollback dispatches (no per-ticket review), and when the
-// ticket can't be identified (fail open, never wedge the flow).
+// under <sessionDir>/reviews/<TASK>-<role>. Skipped for the SIMPLE flow, the
+// migration round, promotion-only, and rollback dispatches (no per-ticket
+// review), and when the ticket can't be identified (fail open, never wedge the flow).
import { existsSync, readFileSync } from "node:fs";
import { createHookContext } from "./lib/context.mjs";
@@ -21,7 +21,8 @@ const d = parseDispatch(input);
if (d.subagentType !== "merger") process.exit(0); // only gate merger dispatches
if (d.mode === "promote") process.exit(0); // promotion-only carries no per-ticket review
-if (["MIGRATION", "PROMOTE", "ROLLBACK"].includes(d.taskId)) process.exit(0);
+if (["SIMPLE", "MIGRATION", "PROMOTE", "ROLLBACK"].includes(d.taskId))
+ process.exit(0);
if (!/^TASK-\d+$/.test(d.taskId)) process.exit(0); // can't identify a ticket → fail open
const missing = REVIEW_ROLES.filter(
diff --git a/.claude/hooks/block-migration-writes.mjs b/.claude/hooks/block-migration-writes.mjs
index d94662ff..5e536dac 100755
--- a/.claude/hooks/block-migration-writes.mjs
+++ b/.claude/hooks/block-migration-writes.mjs
@@ -1,9 +1,9 @@
#!/usr/bin/env node
// PreToolUse(Write|Edit) — enforce deferred migrations: block writes to
// supabase/migrations-pending/* (always) and writes to supabase/migrations/* from
-// anywhere except the <base>/ops worktree. The developer writes migrations only
+// anywhere except the <base>/simple worktree. The developer writes migrations only
// when a dispatch sends it to the `writing-migrations` skill, which runs on the
-// shared <base>/ops worktree; a per-ticket developer writes under <base>/TASK-XXX
+// shared <base>/simple worktree; a per-ticket developer writes under <base>/TASK-XXX
// and must never touch migrations. The worktree path is the discriminator (the
// dispatch intent isn't visible at Write time), and it is authoritative —
// setup-worktree derives it, not the dispatch naming.
@@ -24,24 +24,25 @@ const baseAgent = agent.split("-TASK-")[0];
const isPendingMigration = (p) => p.includes("/supabase/migrations-pending/");
const isMigration = (p) => p.includes("/supabase/migrations/");
// Migrations are only legitimate in the deploy-time migration round, which always
-// runs on the fixed <base>/ops worktree (the writing-migrations skill).
-const isOpsWorktreeMigration = (p) => p.includes("/ops/supabase/migrations/");
+// runs on the fixed <base>/simple worktree (the writing-migrations skill).
+const isSimpleWorktreeMigration = (p) =>
+ p.includes("/simple/supabase/migrations/");
const RULES = [
{
blocked: isPendingMigration(filePath),
tag: "pending-folder",
reason:
- "Writing to supabase/migrations-pending/ is not allowed. Migrations live in supabase/migrations/ and are written only via the writing-migrations skill (on the <base>/ops worktree).",
+ "Writing to supabase/migrations-pending/ is not allowed. Migrations live in supabase/migrations/ and are written only via the writing-migrations skill (on the <base>/simple worktree).",
},
{
blocked:
baseAgent === "developer" &&
isMigration(filePath) &&
- !isOpsWorktreeMigration(filePath),
+ !isSimpleWorktreeMigration(filePath),
tag: "developer-migration",
reason:
- "A per-ticket developer is not allowed to write SQL migrations. They are written only via the writing-migrations skill, on the <base>/ops worktree.",
+ "A per-ticket developer is not allowed to write SQL migrations. They are written only via the writing-migrations skill, on the <base>/simple worktree.",
},
];
diff --git a/.claude/hooks/block-promote-unmerged.mjs b/.claude/hooks/block-promote-unmerged.mjs
index cc3da64d..4179d0c5 100755
--- a/.claude/hooks/block-promote-unmerged.mjs
+++ b/.claude/hooks/block-promote-unmerged.mjs
@@ -14,7 +14,7 @@ import { readFileSync } from "node:fs";
import { createHookContext } from "./lib/context.mjs";
import { parseDispatch } from "./lib/dispatch-parse.mjs";
import { getUnmergedTaskBranches, git } from "./lib/git.mjs";
-import { opsBranch, sessionBranch } from "./lib/topology.mjs";
+import { simpleBranch, sessionBranch } from "./lib/topology.mjs";
const input = JSON.parse(readFileSync(0, "utf8"));
const ctx = createHookContext(input, "block-promote-unmerged");
@@ -34,11 +34,11 @@ if (
}
// Task branches under refs/heads/<short>/ with commits not on the session branch.
-// <short>/ops is excluded: the single-shot rollback/migration round promotes it
+// <short>/simple is excluded: the single-shot rollback/migration round promotes it
// straight to main, never into the session branch, so it is legitimately "ahead"
// of session/<short> and must not block a wave promotion. Fails CLOSED — a
// branch whose rev-list count can't be read is reported as unmerged.
-const unmerged = getUnmergedTaskBranches(short, session, [opsBranch(ctx)]);
+const unmerged = getUnmergedTaskBranches(short, session, [simpleBranch(ctx)]);
if (unmerged.length === 0) process.exit(0);
diff --git a/.claude/hooks/cleanup-worktree.mjs b/.claude/hooks/cleanup-worktree.mjs
index aeabb613..1a8d6e01 100755
--- a/.claude/hooks/cleanup-worktree.mjs
+++ b/.claude/hooks/cleanup-worktree.mjs
@@ -2,7 +2,7 @@
// SubagentStop — remove this session's task worktrees once their branch has been
// merged (--no-ff, the merger's contract) into the session integration branch and
// the worktree has no uncommitted changes. Session worktrees/branches (_session,
-// ops, session*/), fresh worktrees, and unmerged work are preserved.
+// simple, session*/), fresh worktrees, and unmerged work are preserved.
import {
existsSync,
diff --git a/.claude/hooks/enforce-dev-dispatch.mjs b/.claude/hooks/enforce-dev-dispatch.mjs
index 2656592a..729ed851 100755
--- a/.claude/hooks/enforce-dev-dispatch.mjs
+++ b/.claude/hooks/enforce-dev-dispatch.mjs
@@ -8,9 +8,9 @@
// the worktree is finished). Keeps the orchestrator on the STATE B dispatch
// template instead of improvising a free-form prompt.
//
-// A developer dispatch on the <short>/ops branch (single-shot rollback /
+// A developer dispatch on the <short>/simple branch (single-shot rollback /
// migration) is intentionally NOT gated here: setup-worktree derives its fixed
-// <short>/ops worktree from the session, so those templates don't need a
+// <short>/simple worktree from the session, so those templates don't need a
// per-ticket WORKTREE_PATH (the per-ticket wave developer has no such fallback —
// its path is per-ticket and must be carried explicitly).
//
@@ -36,11 +36,13 @@ if (d.role === "promotion-conflict-resolver") {
);
}
-// Single-shot ops flows run on the fixed <short>/ops worktree that setup-worktree
+// Single-shot simple flows run on the fixed <short>/simple worktree that setup-worktree
// derives from the session; their templates need no per-ticket WORKTREE_PATH, so
// skip the per-ticket gate below.
-if (/\/ops$/.test(d.branchName) || /\/ops$/.test(d.worktreePath)) {
- ctx.accept("single-shot ops developer (<short>/ops) — fixed ops worktree");
+if (/\/simple$/.test(d.branchName) || /\/simple$/.test(d.worktreePath)) {
+ ctx.accept(
+ "single-shot simple developer (<short>/simple) — fixed simple worktree",
+ );
}
if (d.isolation === "worktree") {
diff --git a/.claude/hooks/lib/dispatch-parse.mjs b/.claude/hooks/lib/dispatch-parse.mjs
index 378a506d..1180282c 100644
--- a/.claude/hooks/lib/dispatch-parse.mjs
+++ b/.claude/hooks/lib/dispatch-parse.mjs
@@ -4,9 +4,9 @@
// block-merger-without-review, block-promote-unmerged) parses through here, so
// the contract regexes live in exactly one place.
//
-// TASK_ID is anchored at line start and only accepts TASK-<n> | MIGRATION | PROMOTE
-// | ROLLBACK, so prose mentioning another ticket (e.g. "TASK-001 is merged; now
-// merge this one") can never mis-key a gate.
+// TASK_ID is anchored at line start and only accepts TASK-<n> | SIMPLE | MIGRATION
+// | PROMOTE | ROLLBACK, so prose mentioning another ticket (e.g. "TASK-001 is
+// merged; now merge this one") can never mis-key a gate.
/**
* @param {Record<string, unknown>} input Parsed PreToolUse(Agent) payload.
@@ -28,7 +28,7 @@ export function parseDispatch(input) {
isolation: String(ti.isolation ?? ""),
runInBackground: Boolean(ti.run_in_background),
role: grab(/^ROLE:\s*(\S+)/m),
- taskId: grab(/^TASK_ID:\s*(TASK-\d+|MIGRATION|PROMOTE|ROLLBACK)\b/m),
+ taskId: grab(/^TASK_ID:\s*(TASK-\d+|SIMPLE|MIGRATION|PROMOTE|ROLLBACK)\b/m),
worktreePath: grab(/^WORKTREE_PATH:\s*(\S+)/m),
branchName: grab(/^BRANCH_NAME:\s*(\S+)/m),
mode: grab(/^MODE:\s*(\S+)/m),
diff --git a/.claude/hooks/lib/git.mjs b/.claude/hooks/lib/git.mjs
index 6a0970b0..402cb859 100644
--- a/.claude/hooks/lib/git.mjs
+++ b/.claude/hooks/lib/git.mjs
@@ -61,8 +61,8 @@ export function getWorktreeChangeSummary(wt, base) {
// (block-promote-unmerged.mjs); the chat-orchestrator's STATE B reconcile Bash
// mirrors it and must stay aligned. Fails CLOSED: a failed/unparseable rev-list
// count is reported as unmerged (count: null) rather than silently treated as
-// merged. `exclude` drops branches that legitimately never merge into the session
-// branch (e.g. <short>/ops, which promotes straight to main).
+// merged. `exclude` simple branches that legitimately never merge into the session
+// branch (e.g. <short>/simple, which promotes straight to main).
export function getUnmergedTaskBranches(short, sessionRef, exclude = []) {
const branches = git([
"for-each-ref",
diff --git a/.claude/hooks/lib/topology.mjs b/.claude/hooks/lib/topology.mjs
index bcf3dc8c..044a3a64 100644
--- a/.claude/hooks/lib/topology.mjs
+++ b/.claude/hooks/lib/topology.mjs
@@ -1,7 +1,7 @@
// Session worktree/branch topology — the single source for the layout created
// by setup-worktree and torn down by cleanup-worktree:
// <worktreeBase>/TASK-XXX on branch <short>/TASK-XXX (one per ticket)
-// <worktreeBase>/ops on branch <short>/ops (single-shot rollback / migration)
+// <worktreeBase>/simple on branch <short>/simple (single-shot rollback / migration)
// <worktreeBase>/_session on branch session/<short> (merger integration)
// session-base/<short> (fixed fork anchor)
// Every hook that builds or matches these names must go through this module.
@@ -9,17 +9,17 @@
import { join } from "node:path";
export const taskWorktreePath = (ctx, taskId) => join(ctx.worktreeBase, taskId);
-export const opsWorktreePath = (ctx) => join(ctx.worktreeBase, "ops");
+export const simpleWorktreePath = (ctx) => join(ctx.worktreeBase, "simple");
export const sessionWorktreePath = (ctx) => join(ctx.worktreeBase, "_session");
export const taskBranch = (ctx, taskId) => `${ctx.sessionShort}/${taskId}`;
-export const opsBranch = (ctx) => `${ctx.sessionShort}/ops`;
+export const simpleBranch = (ctx) => `${ctx.sessionShort}/simple`;
export const sessionBranch = (ctx) => `session/${ctx.sessionShort}`;
export const sessionBaseBranch = (ctx) => `session-base/${ctx.sessionShort}`;
// Infrastructure worktrees are never removed by cleanup.
-export const isInfraWorktreePath = (p) => p.endsWith("/_session") || p.endsWith("/ops");
+export const isInfraWorktreePath = (p) => p.endsWith("/_session") || p.endsWith("/simple");
// Session-lifetime branches are never deleted by cleanup.
-export const isProtectedBranch = (b) => /^session(-base)?\//.test(b) || /\/ops$/.test(b);
+export const isProtectedBranch = (b) => /^session(-base)?\//.test(b) || /\/simple$/.test(b);
// Directory names under <worktreeBase> that the leftover sweep may touch.
-export const isTaskWorktreeDirName = (name) => /^TASK-[0-9]+$/.test(name) || name === "ops";
+export const isTaskWorktreeDirName = (name) => /^TASK-[0-9]+$/.test(name) || name === "simple";
diff --git a/.claude/hooks/setup-worktree.mjs b/.claude/hooks/setup-worktree.mjs
index 31bf9bfb..d347f691 100755
--- a/.claude/hooks/setup-worktree.mjs
+++ b/.claude/hooks/setup-worktree.mjs
@@ -8,8 +8,8 @@
//
// Identity: a real TASK id (TASK-001) from the prompt's TASK_ID line or the
// dispatch name (developer-TASK-001) → <base>/<TASK_ID> (per-ticket wave); a
-// developer dispatch on the <short>/ops branch (rollback-conflict / migration,
-// no task) → <base>/ops. Paths are derived from topology (authoritative),
+// developer dispatch on the <short>/simple branch (rollback-conflict / migration,
+// no task) → <base>/simple. Paths are derived from topology (authoritative),
// matching the value the orchestrator substitutes into WORKTREE_PATH.
//
// Also resets stale review verdicts for a (re)dispatched developer, so a changed
@@ -33,8 +33,8 @@ import { getBaseBranch, getWorktreePaths, git } from "./lib/git.mjs";
import { REVIEW_ROLES, reviewFlag } from "./lib/reviews.mjs";
import { getFirstTaskId } from "./lib/teams.mjs";
import {
- opsBranch,
- opsWorktreePath,
+ simpleBranch,
+ simpleWorktreePath,
sessionBaseBranch,
sessionBranch,
sessionWorktreePath,
@@ -59,11 +59,12 @@ if (d.subagentType !== "developer") {
process.exit(0);
}
-// A developer dispatch whose branch/worktree is <short>/ops runs single-shot on
-// the shared <base>/ops worktree (rollback-conflict replay, deploy-time
-// migration) instead of a per-ticket one. The /ops branch is the discriminator;
+// A developer dispatch whose branch/worktree is <short>/simple runs single-shot on
+// the shared <base>/simple worktree (rollback-conflict replay, deploy-time
+// migration) instead of a per-ticket one. The /simple branch is the discriminator;
// every other developer dispatch is a per-ticket wave developer.
-const isOps = /\/ops$/.test(d.branchName) || /\/ops$/.test(d.worktreePath);
+const isSimple =
+ /\/simple$/.test(d.branchName) || /\/simple$/.test(d.worktreePath);
const taskId =
(/^TASK-\d+$/.test(d.taskId) && d.taskId) || getFirstTaskId(d.name);
@@ -73,9 +74,9 @@ let branchName;
if (taskId) {
worktreePath = taskWorktreePath(ctx, taskId);
branchName = taskBranch(ctx, taskId);
-} else if (isOps) {
- worktreePath = opsWorktreePath(ctx);
- branchName = opsBranch(ctx);
+} else if (isSimple) {
+ worktreePath = simpleWorktreePath(ctx);
+ branchName = simpleBranch(ctx);
} else if (d.role === "promotion-conflict-resolver") {
// The sanctioned $REPO-on-main exception (see enforce-dev-dispatch /
// worktree-scope): it works directly in the repo under the promote lock and
@@ -85,11 +86,11 @@ if (taskId) {
);
} else {
// A developer that passed enforce-dev-dispatch (so it carries WORKTREE_PATH)
- // but is neither a resolvable TASK-XXX nor an <short>/ops dispatch. We can't
+ // but is neither a resolvable TASK-XXX nor an <short>/simple dispatch. We can't
// derive the canonical worktree path; accepting would let the developer cd into
// a directory that was never created. Fail closed instead.
ctx.fail(
- "developer dispatch carries WORKTREE_PATH but no resolvable TASK-XXX id and no <short>/ops branch (expected a 'TASK_ID: TASK-XXX' line, a 'developer-TASK-XXX' name, or 'BRANCH_NAME: <SESSION_SHORT_ID>/ops'). Use the STATE B dispatch template.",
+ "developer dispatch carries WORKTREE_PATH but no resolvable TASK-XXX id and no <short>/simple branch (expected a 'TASK_ID: TASK-XXX' line, a 'developer-TASK-XXX' name, or 'BRANCH_NAME: <SESSION_SHORT_ID>/simple'). Use the STATE B dispatch template.",
{ log: "BLOCK unresolvable task id" },
);
}
diff --git a/.claude/hooks/test/block-merger-without-review.test.mjs b/.claude/hooks/test/block-merger-without-review.test.mjs
index 06fdc619..63d99a52 100644
--- a/.claude/hooks/test/block-merger-without-review.test.mjs
+++ b/.claude/hooks/test/block-merger-without-review.test.mjs
@@ -66,7 +66,7 @@ describe("block-merger-without-review", () => {
test("ignores the MIGRATION merger (no per-ticket review)", () => {
expect(
- run(`ROLE: merger\nTASK_ID: MIGRATION\nBRANCH_NAME: ${SS}/ops`),
+ run(`ROLE: merger\nTASK_ID: MIGRATION\nBRANCH_NAME: ${SS}/simple`),
).toBe(0);
});
diff --git a/.claude/hooks/test/block-promote-unmerged.test.mjs b/.claude/hooks/test/block-promote-unmerged.test.mjs
index a423505b..b8a07eef 100644
--- a/.claude/hooks/test/block-promote-unmerged.test.mjs
+++ b/.claude/hooks/test/block-promote-unmerged.test.mjs
@@ -102,14 +102,14 @@ describe("block-promote-unmerged", () => {
expect(run(PROMOTE)).toBe(0);
});
- test("ignores the <short>/ops branch even when ahead of the session branch", () => {
- // <short>/ops promotes straight to main (never into the session branch),
+ test("ignores the <short>/simple branch even when ahead of the session branch", () => {
+ // <short>/simple promotes straight to main (never into the session branch),
// so its commits are legitimately not on session/<short> and must NOT block a
// wave promotion.
- g("checkout", "-q", "-b", `${SS}/ops`, "main");
- writeFileSync(join(APP_DIR, "ops.txt"), "s\n");
+ g("checkout", "-q", "-b", `${SS}/simple`, "main");
+ writeFileSync(join(APP_DIR, "simple.txt"), "s\n");
g("add", ".");
- g("commit", "-qm", "feat: an ops change");
+ g("commit", "-qm", "feat: an simple change");
g("checkout", "-q", "main");
expect(run(PROMOTE)).toBe(0);
});
diff --git a/.claude/hooks/test/setup-worktree.test.mjs b/.claude/hooks/test/setup-worktree.test.mjs
index f8951c3a..32dd0a66 100755
--- a/.claude/hooks/test/setup-worktree.test.mjs
+++ b/.claude/hooks/test/setup-worktree.test.mjs
@@ -38,8 +38,8 @@ const dispatch = ({
taskId = "",
name = "",
} = {}) => {
- const wp = taskId ? join(WB, taskId) : join(WB, "ops");
- const branch = taskId ? `${SS}/${taskId}` : `${SS}/ops`;
+ const wp = taskId ? join(WB, taskId) : join(WB, "simple");
+ const branch = taskId ? `${SS}/${taskId}` : `${SS}/simple`;
const prompt =
`ROLE: ${subagentType}\n` +
(taskId ? `TASK_ID: ${taskId}\n` : "") +
@@ -153,20 +153,20 @@ describe("setup-worktree session-branch topology (PreToolUse/Agent)", () => {
expect(existsSync(join(WB, "_session", ".git"))).toBe(true);
});
- test("developer on the <short>/ops branch derives the ops worktree", () => {
+ test("developer on the <short>/simple branch derives the simple worktree", () => {
spawnSync("node", [HOOK], {
input: JSON.stringify({
session_id: SESSION_ID,
tool_input: {
subagent_type: "developer",
name: "developer",
- prompt: `ROLE: developer\nWORKTREE_PATH: ${join(WB, "ops")}\nBRANCH_NAME: ${SS}/ops`,
+ prompt: `ROLE: developer\nWORKTREE_PATH: ${join(WB, "simple")}\nBRANCH_NAME: ${SS}/simple`,
},
}),
env,
encoding: "utf8",
});
- expect(existsSync(join(WB, "ops"))).toBe(true);
+ expect(existsSync(join(WB, "simple"))).toBe(true);
});
test("developer with WORKTREE_PATH but unresolvable task id is blocked (exit 2)", () => {
diff --git a/.claude/hooks/validate-on-stop.mjs b/.claude/hooks/validate-on-stop.mjs
index a2e0e807..8d32728c 100755
--- a/.claude/hooks/validate-on-stop.mjs
+++ b/.claude/hooks/validate-on-stop.mjs
@@ -7,7 +7,7 @@ import { git } from "./lib/git.mjs";
import { getFirstTaskId } from "./lib/teams.mjs";
import {
sessionBranch,
- opsWorktreePath,
+ simpleWorktreePath,
taskWorktreePath,
} from "./lib/topology.mjs";
import { runValidationSteps } from "./lib/validation.mjs";
@@ -22,19 +22,19 @@ try {
}
// Scope validation to the stopping subagent's OWN worktree: a per-ticket
-// developer-TASK-XXX validates <base>/TASK-XXX, a single-shot ops developer (on
-// the <short>/ops branch — rollback / migration) validates <base>/ops. Avoids the
+// developer-TASK-XXX validates <base>/TASK-XXX, a single-shot simple developer (on
+// the <short>/simple branch — rollback / migration) validates <base>/simple. Avoids the
// "shared brakes" failure where one ticket's broken state blocks an unrelated
// developer and N stops each re-validate every session worktree. Falls back to
// all session worktrees when the identity can't be resolved.
const ids = [ctx.agentName, ctx.agentType].filter(Boolean);
let taskId = ids.map(getFirstTaskId).find(Boolean) || "";
-// A single-shot ops developer runs on the shared <base>/ops worktree; its agent
+// A single-shot simple developer runs on the shared <base>/simple worktree; its agent
// name carries no TASK suffix, so it's recovered from the dispatch prompt below.
-let isOps = false;
+let isSimple = false;
// No suffixed agent name in this harness → recover the TASK_ID (or the single-shot
-// ops flow) from the dispatch prompt in the transcript, to scope validation to
+// simple flow) from the dispatch prompt in the transcript, to scope validation to
// this dev's worktree (not wt=all).
if (!taskId) {
const tp = payload.agent_transcript_path || payload.transcript_path;
@@ -49,8 +49,8 @@ if (!taskId) {
taskId = m[1];
break;
}
- if (/BRANCH_NAME[:=\s]+\S+\/ops\b/.test(line)) {
- isOps = true;
+ if (/BRANCH_NAME[:=\s]+\S+\/simple\b/.test(line)) {
+ isSimple = true;
}
}
} catch {
@@ -61,14 +61,14 @@ if (!taskId) {
const ownWorktree = taskId
? taskWorktreePath(ctx, taskId)
- : isOps
- ? opsWorktreePath(ctx)
+ : isSimple
+ ? simpleWorktreePath(ctx)
: "";
// Diff each worktree against session/<short>, not the repo's checked-out base
// branch, so validation sees a per-ticket developer's OWN change set. (A
-// single-shot ops developer is the exception: resolving-rollback-conflicts does
-// `git reset --hard <BASE_BRANCH>`, re-forking <short>/ops onto the default
+// single-shot simple developer is the exception: resolving-rollback-conflicts does
+// `git reset --hard <BASE_BRANCH>`, re-forking <short>/simple onto the default
// branch, so its diff against session/<short> can span unrelated files — accepted
// noise, since the rollback's whole point is to diverge from the session.)
// Empty base → validation.mjs falls back to the repo base branch (e.g. before the
diff --git a/.claude/rules/agent-output-format.md b/.claude/rules/agent-output-format.md
index a01d0814..251339ec 100644
--- a/.claude/rules/agent-output-format.md
+++ b/.claude/rules/agent-output-format.md
@@ -32,7 +32,7 @@ When the spawn prompt includes a `RETRY_FEEDBACK=...` block, the developer is on
Any other shape is treated by the orchestrator as `FAILED`.
-(The two single-shot **ops-mode** developer dispatches define their OWN contract in their skill — these supersede the line above for that dispatch only: `writing-migrations` emits `DONE: branch=<short>/ops migration=<filename> summary=<...>` or `NO_MIGRATION_NEEDED`; `resolving-rollback-conflicts` emits `DONE: branch=<short>/ops files=[<...>]`. The orchestrator parses these in their respective states, PD-MIG-DEV / STATE RB-DEV.)
+(The two single-shot skill-driven developer dispatches define their OWN contract in their skill — these supersede the line above for that dispatch only: `writing-migrations` emits `DONE: branch=<short>/simple migration=<filename> summary=<...>` or `NO_MIGRATION_NEEDED`; `resolving-rollback-conflicts` emits `DONE: branch=<short>/simple files=[<...>]`. The orchestrator parses these in their respective states, PD-MIG-DEV / STATE RB-DEV.)
## Merger agent
diff --git a/.claude/skills/resolving-rollback-conflicts/SKILL.md b/.claude/skills/resolving-rollback-conflicts/SKILL.md
index 1689f795..418a3e78 100644
--- a/.claude/skills/resolving-rollback-conflicts/SKILL.md
+++ b/.claude/skills/resolving-rollback-conflicts/SKILL.md
@@ -13,8 +13,8 @@ The conflict exists because a *later* session edited the same lines this rollbac
```
ROLE: developer
-WORKTREE_PATH: <WORKTREE_BASE>/ops
-BRANCH_NAME: <SESSION_SHORT_ID>/ops
+WORKTREE_PATH: <WORKTREE_BASE>/simple
+BRANCH_NAME: <SESSION_SHORT_ID>/simple
BASE_BRANCH: <the default branch, e.g. master — the promotion target>
FAILED_COMMIT: <short sha> ("<subject>")
COMMITS_TO_REVERT:
@@ -22,13 +22,13 @@ COMMITS_TO_REVERT:
- ...
```
-**Working directory is `<WORKTREE_PATH>`** — the shared `<base>/ops` worktree the `setup-worktree` hook creates for you. Every Bash call must `cd <WORKTREE_PATH> && …` (shell state is stateless between calls). Do NOT touch `$CLAUDE_PROJECT_DIR/src/...` — that's the base branch.
+**Working directory is `<WORKTREE_PATH>`** — the shared `<base>/simple` worktree the `setup-worktree` hook creates for you. Every Bash call must `cd <WORKTREE_PATH> && …` (shell state is stateless between calls). Do NOT touch `$CLAUDE_PROJECT_DIR/src/...` — that's the base branch.
## Output contract
Your very last line of output MUST be exactly one of:
-- `DONE: branch=<SESSION_SHORT_ID>/ops files=[<every file you touched, deduped>]`
+- `DONE: branch=<SESSION_SHORT_ID>/simple files=[<every file you touched, deduped>]`
- `FAILED: <one-line, plain-English reason — say what was confusing>`
The orchestrator's STATE RB-MERGE relies on those literal prefixes.
@@ -133,7 +133,7 @@ Then re-check `git diff --name-only HEAD^ HEAD`. If empty, apply the Outcome B l
Emit the output contract:
```
-DONE: branch=<SESSION_SHORT_ID>/ops files=[<every file you touched, deduped>]
+DONE: branch=<SESSION_SHORT_ID>/simple files=[<every file you touched, deduped>]
```
The orchestrator's STATE RB-MERGE will dispatch the single-shot merger to merge your branch back into the base.
diff --git a/.claude/skills/writing-migrations/SKILL.md b/.claude/skills/writing-migrations/SKILL.md
index 1c81614c..843d1f54 100644
--- a/.claude/skills/writing-migrations/SKILL.md
+++ b/.claude/skills/writing-migrations/SKILL.md
@@ -1,6 +1,6 @@
---
name: writing-migrations
-description: Generate Supabase SQL migrations at deploy time from the session branch diff. Load this when your developer dispatch asks you to generate the deploy-time migration (it points you at the shared <base>/ops worktree). This is NOT a feature ticket — the workflow below replaces the normal ticket rules: here you DO write SQL under supabase/migrations/, and you do not edit TS/TSX/CSS.
+description: Generate Supabase SQL migrations at deploy time from the session branch diff. Load this when your developer dispatch asks you to generate the deploy-time migration (it points you at the shared <base>/simple worktree). This is NOT a feature ticket — the workflow below replaces the normal ticket rules: here you DO write SQL under supabase/migrations/, and you do not edit TS/TSX/CSS.
---
# Writing Migrations (deploy-time round)
@@ -17,7 +17,7 @@ TS/TSX/CSS — the schema diff already comes from the session branch; you only
translate it to SQL.
Exit criterion: either a committed, idempotent migration whose delta is provably the net schema change, or an explicit `NO_MIGRATION_NEEDED` when there is no schema impact.
-Your worktree is `<WORKTREE_BASE>/ops` on `<SESSION_SHORT_ID>/ops`, forked from `session/<SESSION_SHORT_ID>` (`<WORKTREE_BASE>` =
+Your worktree is `<WORKTREE_BASE>/simple` on `<SESSION_SHORT_ID>/simple`, forked from `session/<SESSION_SHORT_ID>` (`<WORKTREE_BASE>` =
`/tmp/<$CLAUDE_PROJECT_DIR with every "/" replaced by "_">/<SESSION_ID>`). Every Bash call must `cd <WORKTREE_PATH> && …` (stateless shells).
## When to Use
@@ -129,7 +129,7 @@ positions 1..N of the recreated view match the old view exactly, the new column
### 6. Commit and hand off
-Commit the SQL on `<SESSION_SHORT_ID>/ops`:
+Commit the SQL on `<SESSION_SHORT_ID>/simple`:
```bash
cd <WORKTREE_PATH> && git add supabase/migrations && git commit -m "migration(<SESSION_SHORT_ID>): <slug>"
@@ -137,7 +137,7 @@ cd <WORKTREE_PATH> && git add supabase/migrations && git commit -m "migration(<S
Then stop and emit the output contract as your very last line — one of:
-- `DONE: branch=<SESSION_SHORT_ID>/ops migration=<filename> summary=<what the SQL does>`
+- `DONE: branch=<SESSION_SHORT_ID>/simple migration=<filename> summary=<what the SQL does>`
- `NO_MIGRATION_NEEDED` — only after computing the diff (step 1) and confirming no schema impact.
- `FAILED: <one-line reason>`
@@ -147,7 +147,7 @@ quality-reviewer (`MODE: migration-review`) and the merger.
For Postgres correctness you may load `Skill({skill: "supabase-postgres-best-practices"})`.
-**Checkpoint:** the migration is committed on `<SESSION_SHORT_ID>/ops` and the SubagentStop validation chain is green.
+**Checkpoint:** the migration is committed on `<SESSION_SHORT_ID>/simple` and the SubagentStop validation chain is green.
## Rationalizations
@@ -176,4 +176,4 @@ For Postgres correctness you may load `Skill({skill: "supabase-postgres-best-pra
- [ ] All statements are idempotent (`IF [NOT] EXISTS`).
- [ ] New tables have RLS enabled with real policies (never `USING (true)`).
- [ ] Affected views recreated via `CREATE OR REPLACE`, new column last, matching `03_views.sql`.
-- [ ] SQL committed on `<SESSION_SHORT_ID>/ops`; SubagentStop validation green — OR `NO_MIGRATION_NEEDED` reported with no file written.
+- [ ] SQL committed on `<SESSION_SHORT_ID>/simple`; SubagentStop validation green — OR `NO_MIGRATION_NEEDED` reported with no file written.
diff --git a/CLAUDE.md b/CLAUDE.md
index 1a55feb6..6d2e39d4 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -8,11 +8,16 @@ Once a plan is approved (`ExitPlanMode`), the main thread does not implement dir
Harness routing is the **default**. `#no-harness` (or "implement directly" / "without the agent team" / "skip harness") makes the main thread implement itself, no agents, even after plan approval. "no-harness for this session" keeps it off all session. Irrelevant under `make harness` (orchestrator always routes).
-## Routing: one pipeline for every change
+## Routing: SIMPLE vs COMPLEX
-The **chat-orchestrator** is the user-facing entry point. It routes, narrates progress, and never implements. There is **no SIMPLE-vs-COMPLEX triage**: every request that changes the CRM code or schema — a one-line label rename just as much as a new entity with relations — runs the **same pipeline** below. A tiny change is simply a one-ticket wave. The orchestrator only branches away from this pipeline for non-code operational intents: SETUP (project scoping), MODE-SWITCH (demo/real data), MEMORY (capture a pattern), ROLLBACK-CONFLICT (resolve a failed automatic revert), and RECOVERY (resume after an interruption).
+The **chat-orchestrator** is the user-facing entry point. It routes, narrates progress, and never implements. It classifies each code change:
-## The pipeline
+- **SIMPLE** — one cosmetic edit, OR one single-field change on an existing entity (schema + view + type + form + show), OR one list filter reusing existing components (no import, no relations, no new custom component). The orchestrator skips the planner and the wave: it dispatches ONE `developer` directly with the change request on the shared `<base>/simple` worktree, reviews only if the diff touched `supabase/`, then merges. No planner, no peer review otherwise.
+- **COMPLEX** — everything else (default). Runs the full pipeline below.
+
+SIMPLE vs COMPLEX is purely a routing decision the orchestrator owns — the `developer` itself has no modes. The orchestrator also branches away for non-code operational intents: SETUP, MODE-SWITCH, MEMORY, ROLLBACK-CONFLICT, RECOVERY.
+
+## The COMPLEX pipeline
planner (tickets JSON + waves) → developer per ticket (implements + commits in a worktree; no SQL migrations, deploy-time only) → quality-reviewer (code + security + QA) → merger (`git merge --no-ff` only; Stage A per ticket, then one `MODE: promote` to the base branch under `flock`) → documentator (appends to `MEMORY.md`). Agents run as **foreground** subagents in one synchronous turn; each agent's last line is an output contract the orchestrator parses (`.claude/rules/agent-output-format.md`).
@@ -20,7 +25,7 @@ planner (tickets JSON + waves) → developer per ticket (implements + commits in
chat-orchestrator (routes, narrates), planner, developer, quality-reviewer, merger, documentator. Models/roles: see each `.claude/agents/*.md`. **planner** and **quality-reviewer** run on opus; everything else is sonnet or haiku.
-The **developer** is a single agent with no modes: it implements the ticket in `TICKET_FILE` (peer-reviewed, writes ADRs for structural decisions, never writes SQL during tickets). Two session-level operations are handed to it as **skills** loaded on dispatch, run on the shared `<base>/ops` worktree: `writing-migrations` (deploy-time SQL generation) and `resolving-rollback-conflicts` (replay merge-commit reverts). It applies the **Ponytail** minimization ladder (full mode) on every change via an inline prompt directive — the only mechanism that reaches `Agent`-dispatched subagents. Ponytail is also installed natively in-repo as on-demand skills (`.claude/skills/ponytail*`) and `/ponytail*` commands for interactive use in the main session; these do not affect the dev agents.
+The **developer** is a single agent with no modes: it implements the ticket in `TICKET_FILE` (COMPLEX wave, peer-reviewed, writes ADRs for structural decisions, never writes SQL during tickets), or — for a SIMPLE dispatch — the change described inline via `CHANGE_REQUEST` (no ticket, no planner, on the shared `<base>/simple` worktree; it refuses with `FAILED: out of scope — needs COMPLEX flow` if the change needs a breakdown). Two session-level operations are handed to it as **skills** loaded on dispatch, run on the same `<base>/simple` worktree: `writing-migrations` (deploy-time SQL generation) and `resolving-rollback-conflicts` (replay merge-commit reverts). It applies the **Ponytail** minimization ladder (full mode) on every change via an inline prompt directive — the only mechanism that reaches `Agent`-dispatched subagents. Ponytail is also installed natively in-repo as on-demand skills (`.claude/skills/ponytail*`) and `/ponytail*` commands for interactive use in the main session; these do not affect the dev agents.
## Rules & hooks