mission-controller intelligence-analyst red-team-adversary field-tactician security-auditor

I need you to set up a 5-agent pipeline that develops covert intelligence operations by planning high-level geopolitical threat assessments and ground-level field tactics in parallel, with each side informing the other. A mission arrives as a natural-language directive in `mission_brief.md`. The pipeline alternates between revising the strategic analysis (risk thresholds, geopolitical dynamics, operational constraints) and revising the tactics (a logistical field plan that executes within those parameters).

The five agents:

- **mission-controller** orchestrates the run by alternating one assessment step with one tactical step and tracking progress. It does no intelligence gathering, tactical planning, or reviewing itself.
- **assessment loop** — the **intelligence-analyst** writes the geopolitical threat assessment to `ASSESSMENT.md`; the **red-team-adversary** judges it. The intelligence-analyst reads `TACTICS.md` on each revision pass to incorporate logistical realities and field constraints.
- **tactics loop** — the **field-tactician** writes the ground-level logistical and tactical plan to `TACTICS.md`; the **security-auditor** judges them. The field-tactician reads `ASSESSMENT.md` on each revision pass to align the operation with the latest strategic and geopolitical claims.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `mission_brief.md` — the original operational directive, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing plan per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/ASSESSMENT.md` — the threat assessment for that plan. intelligence-analyst writes; red-team-adversary reviews; field-tactician and security-auditor read it.
- `plans/{id}-{slug}/TACTICS.md` — the field tactics and logistics for that plan. field-tactician writes; security-auditor reviews; intelligence-analyst and red-team-adversary read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The mission-controller reads those scores to drive the loops.

Each plan develops independently. Cross-read between ASSESSMENT.md and TACTICS.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The mission-controller round-robins across the K plans: each plan gets one assessment step plus one tactical step per full cycle.

Within each plan, neither threat assessment nor field tactics finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Strategic assessments may tighten after seeing the plan's logistical field realities; tactics may adapt after seeing the plan's assessment's refined risk thresholds.

I'm providing the following information:

<f1>
Keep `TACTICS.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page brief; record only the final operational state and move iteration-by-iteration planning history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if everything is bold, nothing is.
</f1>

<f2>
You orchestrate the run; you never analyze intel, plan tactics, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest assessment/tactics scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one assessment step (intelligence-analyst, then red-team-adversary) and one tactical step (field-tactician, then security-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `ASSESSMENT.md` / `TACTICS.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking strategic assessment may need to revise once the field-tactician reports actual ground realities. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 assessment + 10 tactics per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved operational flaw, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f2>

<f3>
You are planning a covert intelligence operation, which may involve infiltration, extraction, sabotage, reconnaissance, or a combination. The original operational directive is given as a natural-language statement in `mission_brief.md`; read it before starting your part.
</f3>

<f4>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this route is a death trap, but I'm telling you it is" is still a failing plan, not a passing one.
</f4>

<f5>
Produce the threat assessment for the plan the mission-controller has assigned you to this round, and write it to that plan's `ASSESSMENT.md` (under `plans/{id}-{slug}/ASSESSMENT.md`). A complete analysis covers four kinds of claim, each justified with concrete intelligence or historical precedent.

- **Risk Thresholds** — upper bounds on acceptable casualties, operational exposure, or diplomatic fallout; lower bounds on the required intelligence yield or strategic impact.
- **Geopolitical Dynamics** — regional alliances, rivalries, surveillance grid overlaps, faction symmetries, or decomposability into localized, independent sub-operations. State what holds, where, and under which assumptions.
- **Operational Constraints** — absolute limits every operational phase must preserve (e.g., no lethal force, strict extraction windows, absolute deniability). The tactical plan must satisfy them; the security-auditor will check with `wargame.py`.
- **Timeline & Escalation** — worst-case time to target, expected timeline variations given randomized enemy patrols, or risk escalation rates if the operation is prolonged.

Ground your claims against the plan's `TACTICS.md` if it has reported logistics. A predicted exposure risk that is grossly off from the tactician's wargamed numbers means either the assessment needs revision or the tactics contain a flaw — diagnose which side has the issue and state it. Be concrete. "The maximum time to target is strictly bounded by the 4-hour satellite blind spot" is fine; "the target area has some guards that might delay us" is not. Do not read or aggregate across other plans' files.
</f5>

<f6>
When you finish, briefly report to the mission-controller: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f6>

<f7>
Match the analytical tool to the geopolitical and operational context; do not force an ill-suited one. The list below is useful in threat assessment.

| Tool | Suitable for |
|---|---|
| Threat Matrix Analysis / Worst-case Modeling | High-risk environments; establishing hard limits on exposure vs. potential payoff |
| Vulnerability Scoring | Target infrastructure; certifying a facility's weakest point for infiltration |
| Network Analysis / Link Analysis | Counter-terrorism or political nodes; identifying key figures for maximum disruption |
| Resource Allocation Optimization | Logistically strained operations; greedy deployment of finite surveillance assets |
| Game Theoretic Equilibria | Counter-intelligence; predicting rival agency or local faction counter-moves |
| Probabilistic Risk Assessment | Unpredictable patrol routes; high-probability bounds on extraction success or cover blowout |
| Operational Redlining | Categorical impossibilities; proving a direct approach is non-viable to justify a complex heuristic |
| Contingency Sensitivity Analysis | Fluid environments; assessing the stability of the mission if critical intel or initial assets are compromised |
</f7>

<f8>
You operate on the plan the mission-controller has assigned you to this round. Read `mission_brief.md`, your assigned plan's `PLAN.md`, and your assigned plan's `ASSESSMENT.md`, then structure the logistical plan:

- Detail every asset, team composition, equipment loadout, and timeline precisely as the mission requires. Define the primary objective and every constraint exactly as the brief states. Lay out the logistics, check operational viability, and define both the insertion route and exfiltration point.
- Make the implementation verifiable against the plan's `ASSESSMENT.md`. If the assessment states a maximum exposure threshold R, your tactical plan must utilize routes and gear that keep risk below R. If the assessment states an operational constraint (e.g., deniability), your output must strictly enforce it.
- Wargame the operational plan yourself and trace it through to completion — do not stop mid-operation. If a tactical bottleneck is found, resolve the root cause; do not bury fatal flaws under assumptions of "adapt on the fly".
- Sanity-check the logistics against the plan's `ASSESSMENT.md`. An extraction window that requires 4 hours should not be squeezed into a 2.5-hour timeframe; an exposure limit the assessment says holds should hold.

Write the tactical plan and its logistics up in your assigned plan's `TACTICS.md`. Do not read or write any other plan's files.
</f8>

<f9>
Review your assigned plan's `TACTICS.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the plan's `ASSESSMENT.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the reported logistical plan for anomalies, unreasonable risk profiles, or operational violations stated directly in `mission_brief.md` or in the plan's `PLAN.md`.
- Open the plan's `ASSESSMENT.md`. For every risk threshold and operational constraint the assessment claims, write a procedural script (`wargame.py`) under the plan's directory to simulate the timeline and loadout: does the tactical plan satisfy the constraints, stay within the risk threshold, and achieve the required intel yield? Run it. Name any asset or route that violates.
- Read the tactical plan and spot-check it for fatal flaws — unused gear, dead-end extraction routes, logic that contradicts the chosen infiltration method. A flaw that silently compromises cover is worse than an abort criterion.
- Treat the plan as finished only when every parameter holds, every assessment-claimed constraint holds, and the timeline is consistent with the assessment's thresholds — not merely when the logistics superficially seem plausible.
- Check the length of the plan's `TACTICS.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `TACTICS.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f9>

<f10>
Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results. If you want "above and beyond" behavior, explicitly request it rather than relying on the model to infer this from vague prompts.

Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.

Topology rule: Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they'd be confused, Claude will be too.

- Be specific about the desired output format and constraints.
- Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.
</f10>

<f11>
You operate on the plan the mission-controller has assigned you to this round. Your threat assessment lives in that plan's `ASSESSMENT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the red-team-adversary as a loop, alternating with that plan's tactics loop, while the mission-controller round-robins across plans.

- If your assigned plan's `ASSESSMENT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `ASSESSMENT.md` already exists, it carries the red-team-adversary's `<review>` block. Read that feedback. Then open the plan's `TACTICS.md` and look at the latest reported logistics — they may invalidate, sharpen, or motivate revisions to your strategic claims. Revise the plan's `ASSESSMENT.md` in place to address every reviewer point raised and to incorporate any empirical evidence that changes your analysis. Don't discard the previous assessment and start over, and don't leave a flagged vulnerability unaddressed.
- Do not read or touch other plans' files.
</f11>

<f12>
Review your assigned plan's `ASSESSMENT.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the logistics reported in the plan's `TACTICS.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the assessment correctly describe the geopolitical and operational context stated in `mission_brief.md` under the framing set by the plan's `PLAN.md`? Check definitions, asset types, constraint interpretations.
- **Analytical Soundness** — for each claim, walk through the justification or intelligence precedent. Flag hand-waving assumptions about enemy capabilities. Verify cited threat thresholds apply under the stated operational parameters.
- **Empirical Grounding** — open the plan's `TACTICS.md`. If the tactician reports expected detection rates or timeframes, do they fall within the assessment's predicted risk thresholds? A worst-case scenario that is overly pessimistic by orders of magnitude means the constraints are too rigid; adjust them, or note explicitly that the threshold is only a baseline.

Be brief and specific. Do not write the assessment yourself — only review. If a claim is wrong or strategically flawed, say which one and why.
</f12>

<f13>
You operate on the plan the mission-controller has assigned you to this round. Your field logistics and tactical plans live in that plan's `TACTICS.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the security-auditor as a loop, alternating with that plan's assessment loop, while the mission-controller round-robins across plans.

- If your assigned plan's `TACTICS.md` does not exist yet, this is the first pass for that plan: produce the tactical operations from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `TACTICS.md` already exists, it carries the security-auditor's `<review>` block. Read that feedback. Then open the plan's `ASSESSMENT.md` and check whether the latest assessment introduces risk thresholds, constraints, or structural limits your current operations don't yet respect — for example a tighter exposure bound your routes currently fail, or an operational constraint your equipment violates. Revise the plan's `TACTICS.md` in place to address every reviewer point and to align with the latest strategic parameters. Don't discard the previous logistics and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f13>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (mission-controller, intelligence-analyst, red-team-adversary, field-tactician, security-auditor), which items should go in its prompt? Respond with a JSON object like {"mission-controller": ["f?"], "intelligence-analyst": ["f?"], "red-team-adversary": ["f?"], "field-tactician": ["f?"], "security-auditor": ["f?"]}. No other output.

I need you to set up a 5-agent pipeline that develops covert intelligence operations by planning high-level geopolitical threat assessments and ground-level field tactics in parallel, with each side informing the other. A mission arrives as a natural-language directive in `mission_brief.md`. The pipeline alternates between revising the strategic analysis (risk thresholds, geopolitical dynamics, operational constraints) and revising the tactics (a logistical field plan that executes within those parameters).

The five agents:

- **mission-controller** orchestrates the run by alternating one assessment step with one tactical step and tracking progress. It does no intelligence gathering, tactical planning, or reviewing itself.
- **assessment loop** — the **intelligence-analyst** writes the geopolitical threat assessment to `ASSESSMENT.md`; the **red-team-adversary** judges it. The intelligence-analyst reads `TACTICS.md` on each revision pass to incorporate logistical realities and field constraints.
- **tactics loop** — the **field-tactician** writes the ground-level logistical and tactical plan to `TACTICS.md`; the **security-auditor** judges them. The field-tactician reads `ASSESSMENT.md` on each revision pass to align the operation with the latest strategic and geopolitical claims.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `mission_brief.md` — the original operational directive, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing plan per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/ASSESSMENT.md` — the threat assessment for that plan. intelligence-analyst writes; red-team-adversary reviews; field-tactician and security-auditor read it.
- `plans/{id}-{slug}/TACTICS.md` — the field tactics and logistics for that plan. field-tactician writes; security-auditor reviews; intelligence-analyst and red-team-adversary read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The mission-controller reads those scores to drive the loops.

Each plan develops independently. Cross-read between ASSESSMENT.md and TACTICS.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The mission-controller round-robins across the K plans: each plan gets one assessment step plus one tactical step per full cycle.

Within each plan, neither threat assessment nor field tactics finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Strategic assessments may tighten after seeing the plan's logistical field realities; tactics may adapt after seeing the plan's assessment's refined risk thresholds.

I'm providing the following prompt fragments:

<f1>
Keep `TACTICS.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page brief; record only the final operational state and move iteration-by-iteration planning history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if everything is bold, nothing is.
</f1>

<f2>
You orchestrate the run; you never analyze intel, plan tactics, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest assessment/tactics scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one assessment step (intelligence-analyst, then red-team-adversary) and one tactical step (field-tactician, then security-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `ASSESSMENT.md` / `TACTICS.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking strategic assessment may need to revise once the field-tactician reports actual ground realities. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 assessment + 10 tactics per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved operational flaw, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f2>

<f3>
You are planning a covert intelligence operation, which may involve infiltration, extraction, sabotage, reconnaissance, or a combination. The original operational directive is given as a natural-language statement in `mission_brief.md`; read it before starting your part.
</f3>

<f4>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this route is a death trap, but I'm telling you it is" is still a failing plan, not a passing one.
</f4>

<f5>
Produce the threat assessment for the plan the mission-controller has assigned you to this round, and write it to that plan's `ASSESSMENT.md` (under `plans/{id}-{slug}/ASSESSMENT.md`). A complete analysis covers four kinds of claim, each justified with concrete intelligence or historical precedent.

- **Risk Thresholds** — upper bounds on acceptable casualties, operational exposure, or diplomatic fallout; lower bounds on the required intelligence yield or strategic impact.
- **Geopolitical Dynamics** — regional alliances, rivalries, surveillance grid overlaps, faction symmetries, or decomposability into localized, independent sub-operations. State what holds, where, and under which assumptions.
- **Operational Constraints** — absolute limits every operational phase must preserve (e.g., no lethal force, strict extraction windows, absolute deniability). The tactical plan must satisfy them; the security-auditor will check with `wargame.py`.
- **Timeline & Escalation** — worst-case time to target, expected timeline variations given randomized enemy patrols, or risk escalation rates if the operation is prolonged.

Ground your claims against the plan's `TACTICS.md` if it has reported logistics. A predicted exposure risk that is grossly off from the tactician's wargamed numbers means either the assessment needs revision or the tactics contain a flaw — diagnose which side has the issue and state it. Be concrete. "The maximum time to target is strictly bounded by the 4-hour satellite blind spot" is fine; "the target area has some guards that might delay us" is not. Do not read or aggregate across other plans' files.
</f5>

<f6>
When you finish, briefly report to the mission-controller: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f6>

<f7>
Match the analytical tool to the geopolitical and operational context; do not force an ill-suited one. The list below is useful in threat assessment.

| Tool | Suitable for |
|---|---|
| Threat Matrix Analysis / Worst-case Modeling | High-risk environments; establishing hard limits on exposure vs. potential payoff |
| Vulnerability Scoring | Target infrastructure; certifying a facility's weakest point for infiltration |
| Network Analysis / Link Analysis | Counter-terrorism or political nodes; identifying key figures for maximum disruption |
| Resource Allocation Optimization | Logistically strained operations; greedy deployment of finite surveillance assets |
| Game Theoretic Equilibria | Counter-intelligence; predicting rival agency or local faction counter-moves |
| Probabilistic Risk Assessment | Unpredictable patrol routes; high-probability bounds on extraction success or cover blowout |
| Operational Redlining | Categorical impossibilities; proving a direct approach is non-viable to justify a complex heuristic |
| Contingency Sensitivity Analysis | Fluid environments; assessing the stability of the mission if critical intel or initial assets are compromised |
</f7>

<f8>
You operate on the plan the mission-controller has assigned you to this round. Read `mission_brief.md`, your assigned plan's `PLAN.md`, and your assigned plan's `ASSESSMENT.md`, then structure the logistical plan:

- Detail every asset, team composition, equipment loadout, and timeline precisely as the mission requires. Define the primary objective and every constraint exactly as the brief states. Lay out the logistics, check operational viability, and define both the insertion route and exfiltration point.
- Make the implementation verifiable against the plan's `ASSESSMENT.md`. If the assessment states a maximum exposure threshold R, your tactical plan must utilize routes and gear that keep risk below R. If the assessment states an operational constraint (e.g., deniability), your output must strictly enforce it.
- Wargame the operational plan yourself and trace it through to completion — do not stop mid-operation. If a tactical bottleneck is found, resolve the root cause; do not bury fatal flaws under assumptions of "adapt on the fly".
- Sanity-check the logistics against the plan's `ASSESSMENT.md`. An extraction window that requires 4 hours should not be squeezed into a 2.5-hour timeframe; an exposure limit the assessment says holds should hold.

Write the tactical plan and its logistics up in your assigned plan's `TACTICS.md`. Do not read or write any other plan's files.
</f8>

<f9>
Review your assigned plan's `TACTICS.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the plan's `ASSESSMENT.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the reported logistical plan for anomalies, unreasonable risk profiles, or operational violations stated directly in `mission_brief.md` or in the plan's `PLAN.md`.
- Open the plan's `ASSESSMENT.md`. For every risk threshold and operational constraint the assessment claims, write a procedural script (`wargame.py`) under the plan's directory to simulate the timeline and loadout: does the tactical plan satisfy the constraints, stay within the risk threshold, and achieve the required intel yield? Run it. Name any asset or route that violates.
- Read the tactical plan and spot-check it for fatal flaws — unused gear, dead-end extraction routes, logic that contradicts the chosen infiltration method. A flaw that silently compromises cover is worse than an abort criterion.
- Treat the plan as finished only when every parameter holds, every assessment-claimed constraint holds, and the timeline is consistent with the assessment's thresholds — not merely when the logistics superficially seem plausible.
- Check the length of the plan's `TACTICS.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `TACTICS.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f9>

<f10>
Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results. If you want "above and beyond" behavior, explicitly request it rather than relying on the model to infer this from vague prompts.

Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.

Topology rule: Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they'd be confused, Claude will be too.

- Be specific about the desired output format and constraints.
- Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.
</f10>

<f11>
You operate on the plan the mission-controller has assigned you to this round. Your threat assessment lives in that plan's `ASSESSMENT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the red-team-adversary as a loop, alternating with that plan's tactics loop, while the mission-controller round-robins across plans.

- If your assigned plan's `ASSESSMENT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `ASSESSMENT.md` already exists, it carries the red-team-adversary's `<review>` block. Read that feedback. Then open the plan's `TACTICS.md` and look at the latest reported logistics — they may invalidate, sharpen, or motivate revisions to your strategic claims. Revise the plan's `ASSESSMENT.md` in place to address every reviewer point raised and to incorporate any empirical evidence that changes your analysis. Don't discard the previous assessment and start over, and don't leave a flagged vulnerability unaddressed.
- Do not read or touch other plans' files.
</f11>

<f12>
Review your assigned plan's `ASSESSMENT.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the logistics reported in the plan's `TACTICS.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the assessment correctly describe the geopolitical and operational context stated in `mission_brief.md` under the framing set by the plan's `PLAN.md`? Check definitions, asset types, constraint interpretations.
- **Analytical Soundness** — for each claim, walk through the justification or intelligence precedent. Flag hand-waving assumptions about enemy capabilities. Verify cited threat thresholds apply under the stated operational parameters.
- **Empirical Grounding** — open the plan's `TACTICS.md`. If the tactician reports expected detection rates or timeframes, do they fall within the assessment's predicted risk thresholds? A worst-case scenario that is overly pessimistic by orders of magnitude means the constraints are too rigid; adjust them, or note explicitly that the threshold is only a baseline.

Be brief and specific. Do not write the assessment yourself — only review. If a claim is wrong or strategically flawed, say which one and why.
</f12>

<f13>
You operate on the plan the mission-controller has assigned you to this round. Your field logistics and tactical plans live in that plan's `TACTICS.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the security-auditor as a loop, alternating with that plan's assessment loop, while the mission-controller round-robins across plans.

- If your assigned plan's `TACTICS.md` does not exist yet, this is the first pass for that plan: produce the tactical operations from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `TACTICS.md` already exists, it carries the security-auditor's `<review>` block. Read that feedback. Then open the plan's `ASSESSMENT.md` and check whether the latest assessment introduces risk thresholds, constraints, or structural limits your current operations don't yet respect — for example a tighter exposure bound your routes currently fail, or an operational constraint your equipment violates. Revise the plan's `TACTICS.md` in place to address every reviewer point and to align with the latest strategic parameters. Don't discard the previous logistics and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f13>

Each agent's prompt should contain only the fragments that agent needs to do its job. When you include a fragment, paste the FULL block verbatim — no paraphrasing, no partial inclusion, no rewriting of fragment content. Brief connective text between fragments (e.g., "Then: ...", "Note: ...") is fine. Format: one markdown section per role, with the role name as an h1 header (e.g. `# mission-controller`). Output only the headered prompts, no preamble.


I need you to set up a 5-agent pipeline that develops covert intelligence operations by planning high-level geopolitical threat assessments and ground-level field tactics in parallel, with each side informing the other. A mission arrives as a natural-language directive in `mission_brief.md`. The pipeline alternates between revising the strategic analysis (risk thresholds, geopolitical dynamics, operational constraints) and revising the tactics (a logistical field plan that executes within those parameters).

The five agents:

- **mission-controller** orchestrates the run by alternating one assessment step with one tactical step and tracking progress. It does no intelligence gathering, tactical planning, or reviewing itself.
- **assessment loop** — the **intelligence-analyst** writes the geopolitical threat assessment to `ASSESSMENT.md`; the **red-team-adversary** judges it. The intelligence-analyst reads `TACTICS.md` on each revision pass to incorporate logistical realities and field constraints.
- **tactics loop** — the **field-tactician** writes the ground-level logistical and tactical plan to `TACTICS.md`; the **security-auditor** judges them. The field-tactician reads `ASSESSMENT.md` on each revision pass to align the operation with the latest strategic and geopolitical claims.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `mission_brief.md` — the original operational directive, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing plan per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/ASSESSMENT.md` — the threat assessment for that plan. intelligence-analyst writes; red-team-adversary reviews; field-tactician and security-auditor read it.
- `plans/{id}-{slug}/TACTICS.md` — the field tactics and logistics for that plan. field-tactician writes; security-auditor reviews; intelligence-analyst and red-team-adversary read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The mission-controller reads those scores to drive the loops.

Each plan develops independently. Cross-read between ASSESSMENT.md and TACTICS.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The mission-controller round-robins across the K plans: each plan gets one assessment step plus one tactical step per full cycle.

Within each plan, neither threat assessment nor field tactics finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Strategic assessments may tighten after seeing the plan's logistical field realities; tactics may adapt after seeing the plan's assessment's refined risk thresholds.

I'm providing the following information:

<f1>
You operate on the plan the mission-controller has assigned you to this round. Read `mission_brief.md`, your assigned plan's `PLAN.md`, and your assigned plan's `ASSESSMENT.md`, then structure the logistical plan:

- Detail every asset, team composition, equipment loadout, and timeline precisely as the mission requires. Define the primary objective and every constraint exactly as the brief states. Lay out the logistics, check operational viability, and define both the insertion route and exfiltration point.
- Make the implementation verifiable against the plan's `ASSESSMENT.md`. If the assessment states a maximum exposure threshold R, your tactical plan must utilize routes and gear that keep risk below R. If the assessment states an operational constraint (e.g., deniability), your output must strictly enforce it.
- Wargame the operational plan yourself and trace it through to completion — do not stop mid-operation. If a tactical bottleneck is found, resolve the root cause; do not bury fatal flaws under assumptions of "adapt on the fly".
- Sanity-check the logistics against the plan's `ASSESSMENT.md`. An extraction window that requires 4 hours should not be squeezed into a 2.5-hour timeframe; an exposure limit the assessment says holds should hold.

Write the tactical plan and its logistics up in your assigned plan's `TACTICS.md`. Do not read or write any other plan's files.
</f1>

<f2>
Match the analytical tool to the geopolitical and operational context; do not force an ill-suited one. The list below is useful in threat assessment.

| Tool | Suitable for |
|---|---|
| Threat Matrix Analysis / Worst-case Modeling | High-risk environments; establishing hard limits on exposure vs. potential payoff |
| Vulnerability Scoring | Target infrastructure; certifying a facility's weakest point for infiltration |
| Network Analysis / Link Analysis | Counter-terrorism or political nodes; identifying key figures for maximum disruption |
| Resource Allocation Optimization | Logistically strained operations; greedy deployment of finite surveillance assets |
| Game Theoretic Equilibria | Counter-intelligence; predicting rival agency or local faction counter-moves |
| Probabilistic Risk Assessment | Unpredictable patrol routes; high-probability bounds on extraction success or cover blowout |
| Operational Redlining | Categorical impossibilities; proving a direct approach is non-viable to justify a complex heuristic |
| Contingency Sensitivity Analysis | Fluid environments; assessing the stability of the mission if critical intel or initial assets are compromised |
</f2>

<f3>
You operate on the plan the mission-controller has assigned you to this round. Your field logistics and tactical plans live in that plan's `TACTICS.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the security-auditor as a loop, alternating with that plan's assessment loop, while the mission-controller round-robins across plans.

- If your assigned plan's `TACTICS.md` does not exist yet, this is the first pass for that plan: produce the tactical operations from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `TACTICS.md` already exists, it carries the security-auditor's `<review>` block. Read that feedback. Then open the plan's `ASSESSMENT.md` and check whether the latest assessment introduces risk thresholds, constraints, or structural limits your current operations don't yet respect — for example a tighter exposure bound your routes currently fail, or an operational constraint your equipment violates. Revise the plan's `TACTICS.md` in place to address every reviewer point and to align with the latest strategic parameters. Don't discard the previous logistics and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f3>

<f4>
Review your assigned plan's `ASSESSMENT.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the logistics reported in the plan's `TACTICS.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the assessment correctly describe the geopolitical and operational context stated in `mission_brief.md` under the framing set by the plan's `PLAN.md`? Check definitions, asset types, constraint interpretations.
- **Analytical Soundness** — for each claim, walk through the justification or intelligence precedent. Flag hand-waving assumptions about enemy capabilities. Verify cited threat thresholds apply under the stated operational parameters.
- **Empirical Grounding** — open the plan's `TACTICS.md`. If the tactician reports expected detection rates or timeframes, do they fall within the assessment's predicted risk thresholds? A worst-case scenario that is overly pessimistic by orders of magnitude means the constraints are too rigid; adjust them, or note explicitly that the threshold is only a baseline.

Be brief and specific. Do not write the assessment yourself — only review. If a claim is wrong or strategically flawed, say which one and why.
</f4>

<f5>
You orchestrate the run; you never analyze intel, plan tactics, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest assessment/tactics scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one assessment step (intelligence-analyst, then red-team-adversary) and one tactical step (field-tactician, then security-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `ASSESSMENT.md` / `TACTICS.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking strategic assessment may need to revise once the field-tactician reports actual ground realities. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 assessment + 10 tactics per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved operational flaw, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f5>

<f6>
Produce the threat assessment for the plan the mission-controller has assigned you to this round, and write it to that plan's `ASSESSMENT.md` (under `plans/{id}-{slug}/ASSESSMENT.md`). A complete analysis covers four kinds of claim, each justified with concrete intelligence or historical precedent.

- **Risk Thresholds** — upper bounds on acceptable casualties, operational exposure, or diplomatic fallout; lower bounds on the required intelligence yield or strategic impact.
- **Geopolitical Dynamics** — regional alliances, rivalries, surveillance grid overlaps, faction symmetries, or decomposability into localized, independent sub-operations. State what holds, where, and under which assumptions.
- **Operational Constraints** — absolute limits every operational phase must preserve (e.g., no lethal force, strict extraction windows, absolute deniability). The tactical plan must satisfy them; the security-auditor will check with `wargame.py`.
- **Timeline & Escalation** — worst-case time to target, expected timeline variations given randomized enemy patrols, or risk escalation rates if the operation is prolonged.

Ground your claims against the plan's `TACTICS.md` if it has reported logistics. A predicted exposure risk that is grossly off from the tactician's wargamed numbers means either the assessment needs revision or the tactics contain a flaw — diagnose which side has the issue and state it. Be concrete. "The maximum time to target is strictly bounded by the 4-hour satellite blind spot" is fine; "the target area has some guards that might delay us" is not. Do not read or aggregate across other plans' files.
</f6>

<f7>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this route is a death trap, but I'm telling you it is" is still a failing plan, not a passing one.
</f7>

<f8>
Keep `TACTICS.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page brief; record only the final operational state and move iteration-by-iteration planning history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if everything is bold, nothing is.
</f8>

<f9>
When you finish, briefly report to the mission-controller: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f9>

<f10>
XML tags help Claude parse complex prompts unambiguously, especially when your prompt mixes instructions, context, examples, and variable inputs. Wrapping each type of content in its own tag (e.g. `<instructions>`, `<context>`, `<input>`) reduces misinterpretation.

Best practices:
- Use consistent, descriptive tag names across your prompts.
- Nest tags when content has a natural hierarchy (documents inside `<documents>`, each inside `<document index="n">`).
</f10>

<f11>
You are planning a covert intelligence operation, which may involve infiltration, extraction, sabotage, reconnaissance, or a combination. The original operational directive is given as a natural-language statement in `mission_brief.md`; read it before starting your part.
</f11>

<f12>
You operate on the plan the mission-controller has assigned you to this round. Your threat assessment lives in that plan's `ASSESSMENT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the red-team-adversary as a loop, alternating with that plan's tactics loop, while the mission-controller round-robins across plans.

- If your assigned plan's `ASSESSMENT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `ASSESSMENT.md` already exists, it carries the red-team-adversary's `<review>` block. Read that feedback. Then open the plan's `TACTICS.md` and look at the latest reported logistics — they may invalidate, sharpen, or motivate revisions to your strategic claims. Revise the plan's `ASSESSMENT.md` in place to address every reviewer point raised and to incorporate any empirical evidence that changes your analysis. Don't discard the previous assessment and start over, and don't leave a flagged vulnerability unaddressed.
- Do not read or touch other plans' files.
</f12>

<f13>
Review your assigned plan's `TACTICS.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the plan's `ASSESSMENT.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the reported logistical plan for anomalies, unreasonable risk profiles, or operational violations stated directly in `mission_brief.md` or in the plan's `PLAN.md`.
- Open the plan's `ASSESSMENT.md`. For every risk threshold and operational constraint the assessment claims, write a procedural script (`wargame.py`) under the plan's directory to simulate the timeline and loadout: does the tactical plan satisfy the constraints, stay within the risk threshold, and achieve the required intel yield? Run it. Name any asset or route that violates.
- Read the tactical plan and spot-check it for fatal flaws — unused gear, dead-end extraction routes, logic that contradicts the chosen infiltration method. A flaw that silently compromises cover is worse than an abort criterion.
- Treat the plan as finished only when every parameter holds, every assessment-claimed constraint holds, and the timeline is consistent with the assessment's thresholds — not merely when the logistics superficially seem plausible.
- Check the length of the plan's `TACTICS.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `TACTICS.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f13>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (mission-controller, intelligence-analyst, red-team-adversary, field-tactician, security-auditor), which items should go in its prompt? Respond with a JSON object like {"mission-controller": ["f?"], "intelligence-analyst": ["f?"], "red-team-adversary": ["f?"], "field-tactician": ["f?"], "security-auditor": ["f?"]}. No other output.

I need you to set up a 5-agent pipeline that develops covert intelligence operations by planning high-level geopolitical threat assessments and ground-level field tactics in parallel, with each side informing the other. A mission arrives as a natural-language directive in `mission_brief.md`. The pipeline alternates between revising the strategic analysis (risk thresholds, geopolitical dynamics, operational constraints) and revising the tactics (a logistical field plan that executes within those parameters).

The five agents:

- **mission-controller** orchestrates the run by alternating one assessment step with one tactical step and tracking progress. It does no intelligence gathering, tactical planning, or reviewing itself.
- **assessment loop** — the **intelligence-analyst** writes the geopolitical threat assessment to `ASSESSMENT.md`; the **red-team-adversary** judges it. The intelligence-analyst reads `TACTICS.md` on each revision pass to incorporate logistical realities and field constraints.
- **tactics loop** — the **field-tactician** writes the ground-level logistical and tactical plan to `TACTICS.md`; the **security-auditor** judges them. The field-tactician reads `ASSESSMENT.md` on each revision pass to align the operation with the latest strategic and geopolitical claims.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `mission_brief.md` — the original operational directive, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing plan per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/ASSESSMENT.md` — the threat assessment for that plan. intelligence-analyst writes; red-team-adversary reviews; field-tactician and security-auditor read it.
- `plans/{id}-{slug}/TACTICS.md` — the field tactics and logistics for that plan. field-tactician writes; security-auditor reviews; intelligence-analyst and red-team-adversary read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The mission-controller reads those scores to drive the loops.

Each plan develops independently. Cross-read between ASSESSMENT.md and TACTICS.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The mission-controller round-robins across the K plans: each plan gets one assessment step plus one tactical step per full cycle.

Within each plan, neither threat assessment nor field tactics finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Strategic assessments may tighten after seeing the plan's logistical field realities; tactics may adapt after seeing the plan's assessment's refined risk thresholds.

I'm providing the following prompt fragments:

<f1>
You operate on the plan the mission-controller has assigned you to this round. Read `mission_brief.md`, your assigned plan's `PLAN.md`, and your assigned plan's `ASSESSMENT.md`, then structure the logistical plan:

- Detail every asset, team composition, equipment loadout, and timeline precisely as the mission requires. Define the primary objective and every constraint exactly as the brief states. Lay out the logistics, check operational viability, and define both the insertion route and exfiltration point.
- Make the implementation verifiable against the plan's `ASSESSMENT.md`. If the assessment states a maximum exposure threshold R, your tactical plan must utilize routes and gear that keep risk below R. If the assessment states an operational constraint (e.g., deniability), your output must strictly enforce it.
- Wargame the operational plan yourself and trace it through to completion — do not stop mid-operation. If a tactical bottleneck is found, resolve the root cause; do not bury fatal flaws under assumptions of "adapt on the fly".
- Sanity-check the logistics against the plan's `ASSESSMENT.md`. An extraction window that requires 4 hours should not be squeezed into a 2.5-hour timeframe; an exposure limit the assessment says holds should hold.

Write the tactical plan and its logistics up in your assigned plan's `TACTICS.md`. Do not read or write any other plan's files.
</f1>

<f2>
Match the analytical tool to the geopolitical and operational context; do not force an ill-suited one. The list below is useful in threat assessment.

| Tool | Suitable for |
|---|---|
| Threat Matrix Analysis / Worst-case Modeling | High-risk environments; establishing hard limits on exposure vs. potential payoff |
| Vulnerability Scoring | Target infrastructure; certifying a facility's weakest point for infiltration |
| Network Analysis / Link Analysis | Counter-terrorism or political nodes; identifying key figures for maximum disruption |
| Resource Allocation Optimization | Logistically strained operations; greedy deployment of finite surveillance assets |
| Game Theoretic Equilibria | Counter-intelligence; predicting rival agency or local faction counter-moves |
| Probabilistic Risk Assessment | Unpredictable patrol routes; high-probability bounds on extraction success or cover blowout |
| Operational Redlining | Categorical impossibilities; proving a direct approach is non-viable to justify a complex heuristic |
| Contingency Sensitivity Analysis | Fluid environments; assessing the stability of the mission if critical intel or initial assets are compromised |
</f2>

<f3>
You operate on the plan the mission-controller has assigned you to this round. Your field logistics and tactical plans live in that plan's `TACTICS.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the security-auditor as a loop, alternating with that plan's assessment loop, while the mission-controller round-robins across plans.

- If your assigned plan's `TACTICS.md` does not exist yet, this is the first pass for that plan: produce the tactical operations from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `TACTICS.md` already exists, it carries the security-auditor's `<review>` block. Read that feedback. Then open the plan's `ASSESSMENT.md` and check whether the latest assessment introduces risk thresholds, constraints, or structural limits your current operations don't yet respect — for example a tighter exposure bound your routes currently fail, or an operational constraint your equipment violates. Revise the plan's `TACTICS.md` in place to address every reviewer point and to align with the latest strategic parameters. Don't discard the previous logistics and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f3>

<f4>
Review your assigned plan's `ASSESSMENT.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the logistics reported in the plan's `TACTICS.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the assessment correctly describe the geopolitical and operational context stated in `mission_brief.md` under the framing set by the plan's `PLAN.md`? Check definitions, asset types, constraint interpretations.
- **Analytical Soundness** — for each claim, walk through the justification or intelligence precedent. Flag hand-waving assumptions about enemy capabilities. Verify cited threat thresholds apply under the stated operational parameters.
- **Empirical Grounding** — open the plan's `TACTICS.md`. If the tactician reports expected detection rates or timeframes, do they fall within the assessment's predicted risk thresholds? A worst-case scenario that is overly pessimistic by orders of magnitude means the constraints are too rigid; adjust them, or note explicitly that the threshold is only a baseline.

Be brief and specific. Do not write the assessment yourself — only review. If a claim is wrong or strategically flawed, say which one and why.
</f4>

<f5>
You orchestrate the run; you never analyze intel, plan tactics, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest assessment/tactics scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one assessment step (intelligence-analyst, then red-team-adversary) and one tactical step (field-tactician, then security-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `ASSESSMENT.md` / `TACTICS.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking strategic assessment may need to revise once the field-tactician reports actual ground realities. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 assessment + 10 tactics per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved operational flaw, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f5>

<f6>
Produce the threat assessment for the plan the mission-controller has assigned you to this round, and write it to that plan's `ASSESSMENT.md` (under `plans/{id}-{slug}/ASSESSMENT.md`). A complete analysis covers four kinds of claim, each justified with concrete intelligence or historical precedent.

- **Risk Thresholds** — upper bounds on acceptable casualties, operational exposure, or diplomatic fallout; lower bounds on the required intelligence yield or strategic impact.
- **Geopolitical Dynamics** — regional alliances, rivalries, surveillance grid overlaps, faction symmetries, or decomposability into localized, independent sub-operations. State what holds, where, and under which assumptions.
- **Operational Constraints** — absolute limits every operational phase must preserve (e.g., no lethal force, strict extraction windows, absolute deniability). The tactical plan must satisfy them; the security-auditor will check with `wargame.py`.
- **Timeline & Escalation** — worst-case time to target, expected timeline variations given randomized enemy patrols, or risk escalation rates if the operation is prolonged.

Ground your claims against the plan's `TACTICS.md` if it has reported logistics. A predicted exposure risk that is grossly off from the tactician's wargamed numbers means either the assessment needs revision or the tactics contain a flaw — diagnose which side has the issue and state it. Be concrete. "The maximum time to target is strictly bounded by the 4-hour satellite blind spot" is fine; "the target area has some guards that might delay us" is not. Do not read or aggregate across other plans' files.
</f6>

<f7>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this route is a death trap, but I'm telling you it is" is still a failing plan, not a passing one.
</f7>

<f8>
Keep `TACTICS.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page brief; record only the final operational state and move iteration-by-iteration planning history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if everything is bold, nothing is.
</f8>

<f9>
When you finish, briefly report to the mission-controller: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f9>

<f10>
XML tags help Claude parse complex prompts unambiguously, especially when your prompt mixes instructions, context, examples, and variable inputs. Wrapping each type of content in its own tag (e.g. `<instructions>`, `<context>`, `<input>`) reduces misinterpretation.

Best practices:
- Use consistent, descriptive tag names across your prompts.
- Nest tags when content has a natural hierarchy (documents inside `<documents>`, each inside `<document index="n">`).
</f10>

<f11>
You are planning a covert intelligence operation, which may involve infiltration, extraction, sabotage, reconnaissance, or a combination. The original operational directive is given as a natural-language statement in `mission_brief.md`; read it before starting your part.
</f11>

<f12>
You operate on the plan the mission-controller has assigned you to this round. Your threat assessment lives in that plan's `ASSESSMENT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the red-team-adversary as a loop, alternating with that plan's tactics loop, while the mission-controller round-robins across plans.

- If your assigned plan's `ASSESSMENT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `mission_brief.md` and the plan's `PLAN.md`.
- If the plan's `ASSESSMENT.md` already exists, it carries the red-team-adversary's `<review>` block. Read that feedback. Then open the plan's `TACTICS.md` and look at the latest reported logistics — they may invalidate, sharpen, or motivate revisions to your strategic claims. Revise the plan's `ASSESSMENT.md` in place to address every reviewer point raised and to incorporate any empirical evidence that changes your analysis. Don't discard the previous assessment and start over, and don't leave a flagged vulnerability unaddressed.
- Do not read or touch other plans' files.
</f12>

<f13>
Review your assigned plan's `TACTICS.md` against `mission_brief.md`, against the plan's `PLAN.md`, and against the plan's `ASSESSMENT.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the reported logistical plan for anomalies, unreasonable risk profiles, or operational violations stated directly in `mission_brief.md` or in the plan's `PLAN.md`.
- Open the plan's `ASSESSMENT.md`. For every risk threshold and operational constraint the assessment claims, write a procedural script (`wargame.py`) under the plan's directory to simulate the timeline and loadout: does the tactical plan satisfy the constraints, stay within the risk threshold, and achieve the required intel yield? Run it. Name any asset or route that violates.
- Read the tactical plan and spot-check it for fatal flaws — unused gear, dead-end extraction routes, logic that contradicts the chosen infiltration method. A flaw that silently compromises cover is worse than an abort criterion.
- Treat the plan as finished only when every parameter holds, every assessment-claimed constraint holds, and the timeline is consistent with the assessment's thresholds — not merely when the logistics superficially seem plausible.
- Check the length of the plan's `TACTICS.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `TACTICS.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f13>

Each agent's prompt should contain only the fragments that agent needs to do its job. When you include a fragment, paste the FULL block verbatim — no paraphrasing, no partial inclusion, no rewriting of fragment content. Brief connective text between fragments (e.g., "Then: ...", "Note: ...") is fine. Format: one markdown section per role, with the role name as an h1 header (e.g. `# mission-controller`). Output only the headered prompts, no preamble.


showrunner narrative-architect plot-hole-critic scene-writer continuity-auditor

I need you to set up a 5-agent pipeline that develops feature film scripts by alternating between high-level narrative structure outlining and concrete scene-by-scene dialogue generation, with each side informing the other. A story concept arrives as a natural-language statement in `premise.md`. The pipeline alternates between revising the outline (act structures, character arcs, pacing) and revising the script (concrete scenes and dialogue that achieve those narrative beats).

The five agents:

- **showrunner** orchestrates the run by alternating one outlining step with one script-writing step and tracking progress. It does no plotting, writing, or reviewing itself.
- **outline loop** — the **narrative-architect** writes the structural blueprint to `OUTLINE.md`; the **plot-hole-critic** judges it. The narrative-architect reads `SCRIPT.md` on each revision pass to incorporate discoveries about character voice and scene dynamics.
- **script loop** — the **scene-writer** writes scene descriptions and dialogue to `SCRIPT.md`; the **continuity-auditor** judges them. The scene-writer reads `OUTLINE.md` on each revision pass to align the scenes with the latest structural mandates.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `premise.md` — the original story concept, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing story variation (or pitch angle) per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/OUTLINE.md` — the narrative structure for that plan. Narrative-architect writes; plot-hole-critic reviews; scene-writer and continuity-auditor read it.
- `plans/{id}-{slug}/SCRIPT.md` — the scenes and dialogue for that plan. Scene-writer writes; continuity-auditor reviews; narrative-architect and plot-hole-critic read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The showrunner reads those scores to drive the loops.

Each plan develops independently. Cross-read between OUTLINE.md and SCRIPT.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The showrunner round-robins across the K plans: each plan gets one outline step plus one script step per full cycle.

Within each plan, neither the outline nor the script finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. The outline may shift after seeing how a plan's drafted scenes actually flow; the script may be rewritten after seeing the plan's outline tighten character arcs.

I'm providing the following information:

<f1>
Keep `SCRIPT.md` focused. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a 12-page script sequence; record only the current draft state and move earlier draft history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if every action line is bold, nothing is.
</f1>

<f2>
You orchestrate the run; you never plot, write scenes, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest outline/script scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one outline step (narrative-architect, then plot-hole-critic) and one script step (scene-writer, then continuity-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `OUTLINE.md` / `SCRIPT.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking outline may need to revise once the drafted scenes reveal the actual pacing. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 outline + 10 script per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved error, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f2>

<f3>
You are working on a feature film scriptwriting project, which may span various genres like drama, thriller, comedy, or a blend. The core story concept is given as a natural-language statement in `premise.md`; read it before starting your part.
</f3>

<f4>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this dialogue is highly unnatural, but I'm telling you it is" is still a failing draft, not a passing one.
</f4>

<f5>
Produce the structural outline for the plan the showrunner has assigned you to this round, and write it to that plan's `OUTLINE.md` (under `plans/{id}-{slug}/OUTLINE.md`). A complete outline covers four kinds of structural claims, each justified with narrative logic or character psychology.

- **Act Structure & Pacing** — the major milestones: inciting incident, plot point one, midpoint reversal, all is lost, and climax. Define what happens and the pacing required.
- **Character Arcs** — the protagonist's ghost (past trauma), core lie, active pursuit, and ultimate realization or tragic fall. State how relationships evolve, where, and why.
- **Thematic Core & Motifs** — recurring visual, verbal, or emotional elements that every written scene must preserve (e.g., a specific color palette, a recurring philosophical debate). The script's output should satisfy them; the continuity-auditor will check with a script.
- **Tone & Genre Conventions** — emotional atmosphere (e.g., neo-noir dread, slapstick energy), specific genre tropes deployed, or expectations purposefully subverted.

Ground your claims against the plan's `SCRIPT.md` if it has existing scenes. A predicted character arc that feels completely detached from the actual dialogue means either the outline needs revision or the script is poorly characterized — diagnose which side has the issue and state it. Be concrete. "The midpoint culminates in a betrayal that changes the hero's goal to revenge" is fine; "the story has some interesting twists that may help" is not. Do not read or aggregate across other plans' files.
</f5>

<f6>
When you finish, briefly report to the showrunner: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f6>

<f7>
Match the narrative tool to the story premise; do not force an ill-suited one. The list below is useful in high-level outlining.

| Tool | Suitable for |
|---|---|
| The Hero's Journey (Monomyth) | Epic fantasy, sci-fi, adventure; clear call to action and literal returning home |
| Save the Cat! Beat Sheet | Four-quadrant Hollywood films, action-comedy; strict pacing and identifiable milestones |
| Dan Harmon's Story Circle | Episodic character growth, contained journeys; entering an unfamiliar world and paying a heavy price |
| Non-linear / Rashomon Structure | Mystery, psychological thrillers; subjective truths and fragmented timelines |
| Three-Act / Five-Act Paradigm | Traditional drama, tragic plays; escalating tension and classical catharsis |
| Ensemble / Multi-strand Weaving | Interlocking character dramas (e.g., Magnolia, Crash); unified thematic resonance across distinct subplots |
| MacGuffin / Ticking Clock | Action, heist, thriller; driving urgent momentum and limiting character deliberation |
| Character Foil / Mirroring | Thematic depth; ensuring the antagonist perfectly reflects the protagonist's internal flaws |
</f7>

<f8>
You operate on the plan the showrunner has assigned you to this round. Read `premise.md`, your assigned plan's `PLAN.md`, and your assigned plan's `OUTLINE.md`, then write the screenplay pages:

- Include standard formatting. Create proper sluglines (scene headings), action descriptions, character names, and dialogue exactly as the tone dictates. Write the scenes completely, pacing the dialogue and action, and revealing character through subtext.
- Make the script testable against the plan's `OUTLINE.md`. If the outline demands a specific midpoint reversal, your scenes must dramatize it effectively. If the outline dictates a thematic motif, your scenes must include it.
- Read through the written scenes yourself and visualize them to completion — do not leave placeholder text like `[Insert argument here]`. If a transition is clunky, find and fix the root cause; do not ignore jarring jumps in time or location.
- Sanity-check the pages against the plan's `OUTLINE.md`. A relationship that is supposed to be coldly estranged should not feature warm banter; a plot beat the outline says happens must actually happen on the page.

Write the scenes and action up in your assigned plan's `SCRIPT.md`. Do not read or write any other plan's files.
</f8>

<f9>
Review your assigned plan's `SCRIPT.md` against `premise.md`, against the plan's `PLAN.md`, and against the plan's `OUTLINE.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the written scenes for anomalies, wooden dialogue, or tone violations stated directly in `premise.md` or in the plan's `PLAN.md`.
- Open the plan's `OUTLINE.md`. For every major beat and motif the outline claims, write a check into a separate `verify.py` script under the plan's directory (using basic text parsing) to ensure formatting conventions are met, character names are present, and specific required locations or thematic keywords actually appear in the scene output. Run it. Name any character or scene that violates the outline's requirements.
- Read the written pages and spot-check them for continuity bugs — unused characters, dead-end dialogue threads, or actions that contradict the established setting. A continuity error that silently confuses the audience is worse than a mere typo.
- Treat the sequence as finished only when every character arc progresses properly, every thematic motif holds, and the pacing is consistent with the outline's structure — not merely when the scenes are grammatically correct.
- Check the length of the plan's `SCRIPT.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `SCRIPT.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f9>

<f10>
Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results. If you want "above and beyond" behavior, explicitly request it rather than relying on the model to infer this from vague prompts.

Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.

Topology rule: Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they'd be confused, Claude will be too.

- Be specific about the desired output format and constraints.
- Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.
</f10>

<f11>
You operate on the plan the showrunner has assigned you to this round. Your structural outline lives in that plan's `OUTLINE.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the plot-hole-critic as a loop, alternating with that plan's script loop, while the showrunner round-robins across plans.

- If your assigned plan's `OUTLINE.md` does not exist yet, this is the first pass for that plan: produce the outline from scratch based on `premise.md` and the plan's `PLAN.md`.
- If the plan's `OUTLINE.md` already exists, it carries the plot-hole-critic's `<review>` block. Read that feedback. Then open the plan's `SCRIPT.md` and look at the actual written scenes — they may invalidate, sharpen, or motivate revisions to your structural claims (e.g., characters have unexpected chemistry, requiring a new subplot). Revise the plan's `OUTLINE.md` in place to address every reviewer point raised and to incorporate any discoveries that change your structure. Don't discard the previous outline and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f11>

<f12>
Review your assigned plan's `OUTLINE.md` against `premise.md`, against the plan's `PLAN.md`, and against the actual tone and flow of the pages in the plan's `SCRIPT.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the outline correctly expand on the premise stated in `premise.md` under the unique angle set by the plan's `PLAN.md`? Check setting definitions, character rosters, and core conflict translation.
- **Narrative Soundness** — for each structural claim, walk through the story logic. Flag hand-waving plot holes. Verify character motivations make sense under the stated circumstances.
- **Empirical grounding** — open the plan's `SCRIPT.md`. If scenes are drafted, do they actually reflect the outline's promised emotional depth? A dramatic climax that feels completely unearned on the page is a signal the buildup is too weak; tighten the structural prerequisites, or note explicitly that the current beat description is only a placeholder.

Be brief and specific. Do not write the outline yourself — only review. If a structural beat is weak, say which one and why.
</f12>

<f13>
You operate on the plan the showrunner has assigned you to this round. Your screenplay pages live in that plan's `SCRIPT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the continuity-auditor as a loop, alternating with that plan's outline loop, while the showrunner round-robins across plans.

- If your assigned plan's `SCRIPT.md` does not exist yet, this is the first pass for that plan: write the scenes from scratch based on `premise.md` and the plan's `PLAN.md`.
- If the plan's `SCRIPT.md` already exists, it carries the continuity-auditor's `<review>` block. Read that feedback. Then open the plan's `OUTLINE.md` and check whether the latest outline introduces new beats, motifs, or character arcs your current pages don't yet respect — for example, a much darker midpoint climax your scenes are completely missing, or a thematic element your dialogue ignores. Revise the plan's `SCRIPT.md` in place to address every reviewer point and to align with the latest outline. Don't discard the previous draft and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f13>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (showrunner, narrative-architect, plot-hole-critic, scene-writer, continuity-auditor), which items should go in its prompt? Respond with a JSON object like {"showrunner": ["f?"], "narrative-architect": ["f?"], "plot-hole-critic": ["f?"], "scene-writer": ["f?"], "continuity-auditor": ["f?"]}. No other output.

I need you to set up a 5-agent pipeline that develops feature film scripts by alternating between high-level narrative structure outlining and concrete scene-by-scene dialogue generation, with each side informing the other. A story concept arrives as a natural-language statement in `premise.md`. The pipeline alternates between revising the outline (act structures, character arcs, pacing) and revising the script (concrete scenes and dialogue that achieve those narrative beats).

The five agents:

- **showrunner** orchestrates the run by alternating one outlining step with one script-writing step and tracking progress. It does no plotting, writing, or reviewing itself.
- **outline loop** — the **narrative-architect** writes the structural blueprint to `OUTLINE.md`; the **plot-hole-critic** judges it. The narrative-architect reads `SCRIPT.md` on each revision pass to incorporate discoveries about character voice and scene dynamics.
- **script loop** — the **scene-writer** writes scene descriptions and dialogue to `SCRIPT.md`; the **continuity-auditor** judges them. The scene-writer reads `OUTLINE.md` on each revision pass to align the scenes with the latest structural mandates.

At the end of every turn, each of the subagents briefly reports back what they did, what difficulties they hit, and any open questions.

The pipeline hands work off through plan-namespaced files:

- `premise.md` — the original story concept, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing story variation (or pitch angle) per directory, K plans total, given as input (read-only). All four domain agents read the PLAN.md of the plan they are currently assigned to.
- `plans/{id}-{slug}/OUTLINE.md` — the narrative structure for that plan. Narrative-architect writes; plot-hole-critic reviews; scene-writer and continuity-auditor read it.
- `plans/{id}-{slug}/SCRIPT.md` — the scenes and dialogue for that plan. Scene-writer writes; continuity-auditor reviews; narrative-architect and plot-hole-critic read it.

Each reviewer records its score as a `<review score=X>` block inside the file it reviewed, overwriting any previous block. The showrunner reads those scores to drive the loops.

Each plan develops independently. Cross-read between OUTLINE.md and SCRIPT.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The showrunner round-robins across the K plans: each plan gets one outline step plus one script step per full cycle.

Within each plan, neither the outline nor the script finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. The outline may shift after seeing how a plan's drafted scenes actually flow; the script may be rewritten after seeing the plan's outline tighten character arcs.

I'm providing the following prompt fragments:

<f1>
Keep `SCRIPT.md` focused. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a 12-page script sequence; record only the current draft state and move earlier draft history into a separate `CHANGELOG.md`. Bold text must not exceed 5% of the file: if every action line is bold, nothing is.
</f1>

<f2>
You orchestrate the run; you never plot, write scenes, or review yourself — you only dispatch the right agent at the right time.

- **Init** — discover the K plan directories under `plans/{id}-{slug}/`. Create `STATE.md` with `iter: 0`, `current_plan_idx: 0`, and a per-plan record holding each plan's id, last side, and latest outline/script scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, dispatch one outline step (narrative-architect, then plot-hole-critic) and one script step (scene-writer, then continuity-auditor); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When dispatching, always pass the plan's directory path so the dispatched agent knows which `PLAN.md` / `OUTLINE.md` / `SCRIPT.md` to operate on.
- Neither side terminates early on its own score within a plan; even a perfect-looking outline may need to revise once the drafted scenes reveal the actual pacing. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K dispatches (10 outline + 10 script per plan, summed across K plans). After the cap, stop and summarize per plan.
- Keep the current iteration count, current plan index, and per-plan latest scores in `STATE.md`, accurate after each dispatch. Read each score from the relevant plan's reviewer `<review score=X>` block. Commit progress after each step.
- Read each agent's brief narrative reply on return. If an agent reports an unresolved error, append it to `error-log.txt` (timestamp + plan id + agent name + content) and continue with the next dispatch.
</f2>

<f3>
You are working on a feature film scriptwriting project, which may span various genres like drama, thriller, comedy, or a blend. The core story concept is given as a natural-language statement in `premise.md`; read it before starting your part.
</f3>

<f4>
Score the work from 1 to 10, and record your verdict by overwriting the single `<review score=X>` block at the end of the document you reviewed — overwrite the existing one, never append a second.

Score strictly on real merit. Do not give any credit for a piece of work merely being honest about its own shortcomings — "this dialogue is highly unnatural, but I'm telling you it is" is still a failing draft, not a passing one.
</f4>

<f5>
Produce the structural outline for the plan the showrunner has assigned you to this round, and write it to that plan's `OUTLINE.md` (under `plans/{id}-{slug}/OUTLINE.md`). A complete outline covers four kinds of structural claims, each justified with narrative logic or character psychology.

- **Act Structure & Pacing** — the major milestones: inciting incident, plot point one, midpoint reversal, all is lost, and climax. Define what happens and the pacing required.
- **Character Arcs** — the protagonist's ghost (past trauma), core lie, active pursuit, and ultimate realization or tragic fall. State how relationships evolve, where, and why.
- **Thematic Core & Motifs** — recurring visual, verbal, or emotional elements that every written scene must preserve (e.g., a specific color palette, a recurring philosophical debate). The script's output should satisfy them; the continuity-auditor will check with a script.
- **Tone & Genre Conventions** — emotional atmosphere (e.g., neo-noir dread, slapstick energy), specific genre tropes deployed, or expectations purposefully subverted.

Ground your claims against the plan's `SCRIPT.md` if it has existing scenes. A predicted character arc that feels completely detached from the actual dialogue means either the outline needs revision or the script is poorly characterized — diagnose which side has the issue and state it. Be concrete. "The midpoint culminates in a betrayal that changes the hero's goal to revenge" is fine; "the story has some interesting twists that may help" is not. Do not read or aggregate across other plans' files.
</f5>

<f6>
When you finish, briefly report to the showrunner: what you did, what difficulties you hit (or didn't resolve), and any open questions.
</f6>

<f7>
Match the narrative tool to the story premise; do not force an ill-suited one. The list below is useful in high-level outlining.

| Tool | Suitable for |
|---|---|
| The Hero's Journey (Monomyth) | Epic fantasy, sci-fi, adventure; clear call to action and literal returning home |
| Save the Cat! Beat Sheet | Four-quadrant Hollywood films, action-comedy; strict pacing and identifiable milestones |
| Dan Harmon's Story Circle | Episodic character growth, contained journeys; entering an unfamiliar world and paying a heavy price |
| Non-linear / Rashomon Structure | Mystery, psychological thrillers; subjective truths and fragmented timelines |
| Three-Act / Five-Act Paradigm | Traditional drama, tragic plays; escalating tension and classical catharsis |
| Ensemble / Multi-strand Weaving | Interlocking character dramas (e.g., Magnolia, Crash); unified thematic resonance across distinct subplots |
| MacGuffin / Ticking Clock | Action, heist, thriller; driving urgent momentum and limiting character deliberation |
| Character Foil / Mirroring | Thematic depth; ensuring the antagonist perfectly reflects the protagonist's internal flaws |
</f7>

<f8>
You operate on the plan the showrunner has assigned you to this round. Read `premise.md`, your assigned plan's `PLAN.md`, and your assigned plan's `OUTLINE.md`, then write the screenplay pages:

- Include standard formatting. Create proper sluglines (scene headings), action descriptions, character names, and dialogue exactly as the tone dictates. Write the scenes completely, pacing the dialogue and action, and revealing character through subtext.
- Make the script testable against the plan's `OUTLINE.md`. If the outline demands a specific midpoint reversal, your scenes must dramatize it effectively. If the outline dictates a thematic motif, your scenes must include it.
- Read through the written scenes yourself and visualize them to completion — do not leave placeholder text like `[Insert argument here]`. If a transition is clunky, find and fix the root cause; do not ignore jarring jumps in time or location.
- Sanity-check the pages against the plan's `OUTLINE.md`. A relationship that is supposed to be coldly estranged should not feature warm banter; a plot beat the outline says happens must actually happen on the page.

Write the scenes and action up in your assigned plan's `SCRIPT.md`. Do not read or write any other plan's files.
</f8>

<f9>
Review your assigned plan's `SCRIPT.md` against `premise.md`, against the plan's `PLAN.md`, and against the plan's `OUTLINE.md`. Operate strictly on the assigned plan's files; do not look at other plans.

- Inspect the written scenes for anomalies, wooden dialogue, or tone violations stated directly in `premise.md` or in the plan's `PLAN.md`.
- Open the plan's `OUTLINE.md`. For every major beat and motif the outline claims, write a check into a separate `verify.py` script under the plan's directory (using basic text parsing) to ensure formatting conventions are met, character names are present, and specific required locations or thematic keywords actually appear in the scene output. Run it. Name any character or scene that violates the outline's requirements.
- Read the written pages and spot-check them for continuity bugs — unused characters, dead-end dialogue threads, or actions that contradict the established setting. A continuity error that silently confuses the audience is worse than a mere typo.
- Treat the sequence as finished only when every character arc progresses properly, every thematic motif holds, and the pacing is consistent with the outline's structure — not merely when the scenes are grammatically correct.
- Check the length of the plan's `SCRIPT.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `SCRIPT.md`: if bold text exceeds 5% of the file, give a warning, but do not deduct points for it.
</f9>

<f10>
Claude responds well to clear, explicit instructions. Being specific about your desired output can help enhance results. If you want "above and beyond" behavior, explicitly request it rather than relying on the model to infer this from vague prompts.

Think of Claude as a brilliant but new employee who lacks context on your norms and workflows. The more precisely you explain what you want, the better the result.

Topology rule: Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they'd be confused, Claude will be too.

- Be specific about the desired output format and constraints.
- Provide instructions as sequential steps using numbered lists or bullet points when the order or completeness of steps matters.
</f10>

<f11>
You operate on the plan the showrunner has assigned you to this round. Your structural outline lives in that plan's `OUTLINE.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the plot-hole-critic as a loop, alternating with that plan's script loop, while the showrunner round-robins across plans.

- If your assigned plan's `OUTLINE.md` does not exist yet, this is the first pass for that plan: produce the outline from scratch based on `premise.md` and the plan's `PLAN.md`.
- If the plan's `OUTLINE.md` already exists, it carries the plot-hole-critic's `<review>` block. Read that feedback. Then open the plan's `SCRIPT.md` and look at the actual written scenes — they may invalidate, sharpen, or motivate revisions to your structural claims (e.g., characters have unexpected chemistry, requiring a new subplot). Revise the plan's `OUTLINE.md` in place to address every reviewer point raised and to incorporate any discoveries that change your structure. Don't discard the previous outline and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f11>

<f12>
Review your assigned plan's `OUTLINE.md` against `premise.md`, against the plan's `PLAN.md`, and against the actual tone and flow of the pages in the plan's `SCRIPT.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the outline correctly expand on the premise stated in `premise.md` under the unique angle set by the plan's `PLAN.md`? Check setting definitions, character rosters, and core conflict translation.
- **Narrative Soundness** — for each structural claim, walk through the story logic. Flag hand-waving plot holes. Verify character motivations make sense under the stated circumstances.
- **Empirical grounding** — open the plan's `SCRIPT.md`. If scenes are drafted, do they actually reflect the outline's promised emotional depth? A dramatic climax that feels completely unearned on the page is a signal the buildup is too weak; tighten the structural prerequisites, or note explicitly that the current beat description is only a placeholder.

Be brief and specific. Do not write the outline yourself — only review. If a structural beat is weak, say which one and why.
</f12>

<f13>
You operate on the plan the showrunner has assigned you to this round. Your screenplay pages live in that plan's `SCRIPT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the continuity-auditor as a loop, alternating with that plan's outline loop, while the showrunner round-robins across plans.

- If your assigned plan's `SCRIPT.md` does not exist yet, this is the first pass for that plan: write the scenes from scratch based on `premise.md` and the plan's `PLAN.md`.
- If the plan's `SCRIPT.md` already exists, it carries the continuity-auditor's `<review>` block. Read that feedback. Then open the plan's `OUTLINE.md` and check whether the latest outline introduces new beats, motifs, or character arcs your current pages don't yet respect — for example, a much darker midpoint climax your scenes are completely missing, or a thematic element your dialogue ignores. Revise the plan's `SCRIPT.md` in place to address every reviewer point and to align with the latest outline. Don't discard the previous draft and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f13>

Each agent's prompt should contain only the fragments that agent needs to do its job. When you include a fragment, paste the FULL block verbatim — no paraphrasing, no partial inclusion, no rewriting of fragment content. Brief connective text between fragments (e.g., "Then: ...", "Note: ...") is fine. Format: one markdown section per role, with the role name as an h1 header (e.g. `# showrunner`). Output only the headered prompts, no preamble.