Improve plan

From TentacleOpera/switchboard · View interactive version

Improve plan is an AI agent skill from the GitHub repository TentacleOpera/switchboard. Use this workflow to strengthen an existing feature plan in a single fluid pass.

How to use this skill

Skill file

Improve Plan

Use this workflow to strengthen an existing feature plan in a single fluid pass.

Critical Constraints

> Superseded: <original conclusion or approach>

> Reason: <why it was wrong or inferior>

> Replaced with: <new conclusion or approach>

Never silently delete a conclusion and write a new one in its place. The callout is the audit trail — without it, the change is a protocol violation.

Never transcribe a session directive into the plan file — not as a note, a caveat, or an explanation of what this run did or did not do. It binds you, not the reader. Written down it inverts: a later coder reads a constraint on the planner as an instruction to itself, and follows the document over the live dispatch that contradicts it.

Target is a feature? Use improve-feature instead

If the target file is under .switchboard/features/ or contains an auto-generated <!-- BEGIN SUBTASKS ... --> block, this is a feature, not a single plan. Stop and use the improve-feature workflow — it improves every subtask and is authorised to restructure the set (merge/delete/rewrite/split). This improve-plan workflow is for a single plan and is deliberately non-destructive, which is the wrong contract for a feature.

Steps

  1. Load the plan
  1. Assess scope — flag if split needed. Before strengthening, check whether the plan covers 3+ distinct deliverables or 2+ independently-shippable phases. If so, surface that in chat and recommend splitting (write separate plan files for each deliverable/phase) or promoting to a feature via create-feature-from-plans — do not silently strengthen a mega-plan. This skill is single-plan and non-destructive, so it cannot retroactively split mid-improve; the recommendation is the action, the user decides. If the plan is genuinely single-scope, proceed to step 3.
  1. Improve the plan

Required Sections (in order):

1. ## Goal - 1-2 sentences summarizing the objective, followed by any core problem, background, or root-cause analysis (always preserve and do not drop existing analysis)

2. ## Metadata

3. ## User Review Required

### Project Pinning

When creating or updating a plan, include **Project:** <name> in the Metadata section if a project is active or the user named one. The workspace/repo name is NOT a project — never pin it (the importer silently drops workspace-name pins to unassigned). If no project is active and the user didn't name one, omit the line — never ask the user which project to use. See AGENTS.md "Plan Project Pinning" for the full protocol.

4. ## Complexity Audit

Recommended format (parser is flexible):

```markdown

## Complexity Audit

### Routine

### Complex / Risky

```

5. ## Edge-Case & Dependency Audit

6. ## Dependencies

7. ## Adversarial Synthesis

8. ## Proposed Changes

9. ## Verification Plan

10. ## Outstanding Questions (OPTIONAL — include ONLY when something is genuinely unresolved; omit the heading entirely otherwise)

```markdown

## Outstanding Questions

```

1. Is it verifiable? If the answer is in the code, the schema, the git history, or the

board, go and read it. A question you could have answered by grepping is not a decision.

2. Is it already decided? Search the contents of .switchboard/plans/, not the

titles — the same idea is often filed under different vocabulary (a design filed under

"streams" will not match a search for "steps"). If a sibling plan settles it, cite that

plan and proceed. If a sibling plan contradicts it, the sibling's premise wins and the

conflict belongs in that plan, not as a fresh question here.

3. Is the premise true? Confirm the thing you are asking about actually exists and

behaves as you assume. Most rejected questions were asking about behaviour that was

never there.

4. Is it in scope? A question about work this plan does not do is scope drift. Drop it.

stated decision, questions generated while drafting it are yours to resolve from that

statement — putting them back to the operator is a loop with no exit.

fact in the repo picks between them. Everything else you decide, record as a stated

assumption in the plan body, and move on.

Complexity Criteria:

Scoring Guide:

  1. Challenge the approach (architecture review) — ALWAYS run; NEVER gate on complexity

Self-assessed complexity is unreliable: the most dangerous plans are the ones an agent under-scores ("this looks small"). So this step runs on every plan regardless of the Complexity score, and BEFORE the execution-level critique in the next step.

Begin by answering in one line: does this plan embody a real approach/design choice, or is it a purely mechanical change (typo, copy, config, single-call bugfix) with no design surface?

Two candidates are mandatory in every set: (i) the smallest change that satisfies the ## Goal as written, and (ii) keep the current spec unchanged. Both must be stated and, if rejected, rejected with a reason. Without them the set contains only mechanisms, “best of the set” can only ratchet upward, and supersede has no downward gear — which is how a plan acquires machinery its Goal never asked for.

A supersede may not widen the Goal. If the replacement is more general than what it replaces — it serves more callers, more cases, or more shapes — the callout's Reason line MUST quote the ## Goal clause that requires the generality. If no Goal text requires it, you may not supersede: flag the observation in chat and leave the narrower approach in place. “The old spec only covered case A, and case B exists” is an observation, not a licence — case B may already be served by something simpler, or may not need serving at all. Preserving the Goal verbatim (see CONTENT PRESERVATION) protects it from being narrowed; this rule protects it from being overruled by a later section, which is the same defect from the other side.

  1. Run the internal adversarial review
  1. Consistency pass — read the plan against its own Goal before you write it back

The last thing you do before writing: re-read ## Goal, then read ## Proposed Changes as if you were the coder who will build only from it. Every mechanism in Proposed Changes must trace to a Goal clause, or be explicitly marked out of Goal scope. Where the two disagree, the Goal wins — correct Proposed Changes, not the Goal (the Goal is factual context and is preserved verbatim; see CONTENT PRESERVATION).

State the outcome in one line in chat: "Goal and Proposed Changes are consistent", or name each divergence and what you did about it.

This step exists because the pipeline has no other check for it. Every downstream gate — review, contract suites, the goal verdict — asks whether the CODE matches the PLAN. None asks whether the plan matches itself, so a plan that specifies two incompatible things passes every gate and the contradiction is only discovered after a coder has built the wrong half. This is the cheapest place in the chain to catch it, and the only place that catches it before the work is done.

Measured case, 2026-09-21 — plan 9bb74844 (A Seat Says submit and a Lead Says accept 3). Its ## Goal read "Two verbs, no identity arguments, no UUIDs — accept 3: a lead: subtask 3 is accepted." A later improve pass superseded the resolution mechanism with a generalised ordered-candidate rule covering non-feature callers, recorded in a fully protocol-compliant callout. The coder implemented the superseded section faithfully; six CRITICAL findings followed, every one a property of machinery the Goal never asked for. The Goal was preserved verbatim throughout and no rule was broken. A non-feature caller holds one card, so the pre-existing bare accept already served it — the surplus needed ownerSeat/ownerSince to be populated and stably ordered, which on a live board they are not.

  1. Update the original plan file

Unattended runs

When the dispatching prompt says this run is unattended (it carries an `UNATTENDED IMPROVER

CONTRACT:` block), these override the defaults above. They apply only on that signal — an

attended, single-plan improve is unchanged, and asking the user is still correct there.

decision or external research, append it to the plan's ## Outstanding Questions section,

state the assumption you are proceeding under, and finish the work.

rename or delete any other file in .switchboard/plans/. Other workers are concurrently

improving sibling plans in this same directory; touching their files will destroy their work.

record that under ## Outstanding Questions as a [user] item. Do not write the split files,

and do not invoke create-feature-from-plans.

after dispatch as your completion signal; later writes arrive after the card is already done.

Post-Review Board State

  1. Trigger Model: This improve-plan workflow is triggered automatically when a card arrives in the "PLAN REVIEWED" column (which has autobanEnabled: true and role: 'planner'). The card is already in the "PLAN REVIEWED" column when this workflow runs. Do NOT instruct the user to move it there.
  2. Review Complete: After completing the adversarial review and plan update, the card stays in the "PLAN REVIEWED" column. The activity light clears on the next plan-file edit. The user advances the card to the next pipeline stage (e.g. dispatches a coder) manually when ready.
  3. Plan Metadata: Do NOT write a **Plan ID:** line — it is never parsed. The importer assigns the ID (a fresh UUID, or a feature's filename UUID) and keys plan identity by the file path; a hand-written Plan ID is ignored and drifts from the real DB-assigned one.
  4. Feature Relationships: Feature relationships are carried by **Feature:** <feature-plan-id> and **Project:** <name> lines written directly in each plan .md — the plan watcher applies these on import with apply-if-empty semantics. If you restructured plans into a feature during review, recommend invoking the create-feature-from-plans skill (which runs create-feature.js to handle DB update, subtask linking, feature file write, and board refresh atomically) AFTER the review is finished and the user has approved. Do NOT invoke it mid-review.

The Superseded Callout — Format Specification

Placement: Inline, at the location of the original conclusion being corrected.

Format:

> **Superseded:** <original conclusion, approach, or code snippet>
> **Reason:** <concise explanation of why it was wrong or inferior>
> **Replaced with:** <new conclusion or approach>

Rules:

  1. The **Superseded:** line must contain the original text (or a faithful summary if it was long). Do not paraphrase in a way that hides what was actually said.
  2. The **Reason:** line is mandatory. A correction without a stated reason is a silent deletion with extra steps.
  3. The **Replaced with:** line must immediately follow. If the replacement is long (e.g. a code block), it may continue below the callout.
  4. Multiple corrections in the same plan are fine — each gets its own callout.
  5. The callout replaces the original text in the document body. Do not leave the original text outside the callout AND inside it — that duplicates the contradiction.

Example:

> **Superseded:** Use a polling loop with 500ms interval to detect file changes.
> **Reason:** Polling wastes CPU and introduces up to 500ms latency. The codebase already has a file watcher utility (`src/utils/watcher.ts`) that uses native FS events.
> **Replaced with:** Use `watchFileChanges()` from `src/utils/watcher.ts` — subscribes to native FS events, zero polling overhead, sub-10ms latency.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.