05 · End-to-End Example — Requirement to Delivery
One feature, walked the whole way through: a user request → cc-plan session → human review → cc-worker session → delivered code, plus the Tab / Detach / Clone shortcuts used along the way.
Scenario
Add "export / import role configurations" to CC Mode Switcher — a button that exports the current roles.yaml + models.yaml (with secrets redacted) as a single JSON, and a paired button that imports the same JSON back, asking before clobbering existing roles.
Step 0 · Workspace ready
- Open the project directory: 📂 in the toolbar → pick your
cc-mode-switcher/checkout. (The path is remembered; next time the app remembers.) - The Switcher tab loads. You should see
PlanandWorkerin the roles table, each bound to a model.
Step 1 · Plan session — write plan_output.md
1.1 Open a Plan tab
- Click the
Planrow to select it. - Click ▶ Start Selected Role in the toolbar.
A new internal xterm tab opens in the right pane. The bootstrap script is sourced automatically; you see the ✓ available: cc-plan banner.
1.2 Type cc-plan
The shell function runs, exports the env, and execs claude. After a moment you're inside the Claude Code REPL with the Plan prompt active.
1.3 Send the planning prompt
Type (or paste) the planning prompt:
You are this project's architect, in Plan mode. Your only output is a plan
document — do not write implementation code.
Requirement: add Export / Import for role configurations. The user wants to
share a role setup with a teammate (or back it up before editing), without
leaking API keys.
Constraints:
- Export = both ~/.cc-mode-switcher/models.yaml and ~/.cc-mode-switcher/roles.yaml
combined into a single JSON file.
- API keys in models.yaml must be redacted in the export.
- Import = read the JSON, show a diff against the current state, ask for
confirmation before overwriting any role / model.
- The UI goes in the Settings panel.
First read the relevant code ( src/..., configs, package.json ), then write
the plan to .cc-delivery/plan_output.md using this project's standard plan
template (background / current state / approach incl. rejected alternatives /
task breakdown with files / out of scope / acceptance criteria / risks).
Anything uncertain becomes an OPEN QUESTION — don't guess.The Plan session reads the codebase, asks you for clarifications if needed, and eventually writes .cc-delivery/plan_output.md ending in PLANNER_READY: <one-line summary>. It also sets .cc-delivery/status.md.lock.owner = "planner" on its way out so Worker knows the plan is fresh.
1.4 Human review
Open .cc-delivery/plan_output.md in your editor (or cat it in another terminal). Check:
- Does the task breakdown make sense? Are the file lists accurate?
- Are the
OPEN QUESTIONs reasonable? Make calls on each. - Are
Out of scopeitems things you'd actually want to defer? - Are
Acceptance criteriatestable?
If yes: flip the Status: line to approved. If no: send a follow-up message in the Plan session asking for a revision — it stays in draft until you approve.
Step 2 · Clone the Plan tab for parallel reference
You want to keep the Plan tab open while Worker runs, for cross-checking. Clone it:
- Focus the Plan tab (click in its xterm).
- Press
Cmd+T→ a new tab opens, same cwd, same role, same snapshotted settings. Now you have two Plan tabs.
Cmd+Tclones the active tab, reusing the snapshotted cwd / role / settings. Edit the role config later and the clones don't change — they're frozen at the moment of creation.
Close the original Plan tab (right-click → Close, or ✕). Now you have one Plan tab open with the plan file loaded in another terminal.
Step 3 · Detach for a bigger window
Right-click the Plan tab → Detach. The tab detaches into its own BrowserWindow with title cc-mode-switcher | 🧠 Plan(GLM-5.3). You can drag it to a second monitor, resize freely, and it stays in sync (any output that arrives after detach replays from the ring buffer).
Step 4 · Worker session — implement
4.1 Open a Worker tab
- Click the
Workerrow in the roles table. - Press
Cmd+N→ role picker → pickWorker(orOption+TifWorkeris already selected).
A new internal xterm tab opens with the Worker bootstrap. Type cc-worker.
4.2 Worker reads the plan and proceeds
The Worker prompt enforces:
- Read
.cc-delivery/plan_output.md— if missing, abort withWORKER_NO_PLAN:. - Check
.cc-delivery/status.md.lock.owner— if non-empty and not"worker", abort withWORKER_BLOCKED: lock held by <owner>. Otherwise acquire the lock. - Implement, file by file. Refresh
status.md.lock.heartbeat_atbefore long writes. - Append a one-line receipt per milestone to
.cc-delivery/worker_output.md(schema:## <task-id> — done|in_progress|blocked @ <ISO>). - Release the lock (
status.md.lock.owner: "") and end withWORKER_DONE:.
You don't need to babysit — the four-layer isolation guarantees it can't edit the plan file, can't enable Superpowers, and the tools it's allowed to use are scoped to what the plan said to touch.
4.3 Mid-flight gap
Worker hits one of the OPEN QUESTIONs in the plan (say, "redaction format: *** vs <REDACTED> vs full omission?"). It:
- Stops the current task.
- Appends a
blockedreceipt to.cc-delivery/worker_output.md:## T2 — blocked @ 2026-08-20T11:00:00+08:00 T2 (redaction): plan asks how to redact apiKey in export. Suggesting `***REDACTED***` (matches conventions in similar tools). Awaiting Planner / human call. - Tells you in the chat.
- Waits.
You reply: "Use ***REDACTED***. Continue." Worker resumes.
Step 5 · Verify
Worker says WORKER_DONE: export/import shipped; lock released. You verify:
- The new buttons appear in Settings → Export / Import.
- Export → produces a JSON with
apiKey: "***REDACTED***"for every model. - Import → with a teammate's export → shows diff, prompts before overwriting.
- Existing roles / models are intact if you cancel the import.
.cc-delivery/status.md.lock.owner === ""(Worker released the lock).
Step 6 · Tidy up
- Close the Worker tab (right-click → Close).
- The detached Plan tab stays open for reference — close it whenever.
~/.cc-delivery/plan_output.md+status.md+worker_output.mdstay on disk as the audit trail of this delivery.
Shortcuts used
| Shortcut | When | What it does |
|---|---|---|
▶ Start Selected Role | toolbar | Start the role selected in the left pane |
Option+T | anywhere in the workspace | Same — new internal tab with selected role |
Cmd+T | xterm focus | Clone the active tab (same cwd + role snapshot) |
Cmd+N | xterm focus | Open the role picker |
| Right-click tab → Detach | tab UI | Pop the tab into its own window |
⚙️ Settings → Reset Roles | settings | Restore default Plan + Worker (keeps models + prompt files) |
Variations
- External terminal: same flow, but
▶ Open in Terminal(in the Launch Panel) opens Terminal.app instead of an internal tab. Thecc-<role>aliases work the same way. - Multiple parallel Workers: open as many Worker tabs as you want — they all see the same
plan_output.md, each appends toworker_output.mdwith its own task-id prefix. Thestatus.mdlock is advisory (honor-system mutex) — only one Worker should hold it at a time. Don't run them on overlapping files at the same time. - Custom roles: add a
test-runnerrole (read + Bash + test paths only), asecurity-auditrole (read + Grep + Glob only), etc. Each one is just another row in the table.
