permit coordinator
impact assessor
agency scientific reviewer
mitigation planner
compliance inspector

I need you to set up a 5-agent pipeline that supports environmental impact permitting for a proposed infrastructure project by developing ecological impact claims and mitigation plans in parallel, with each side informing the other. A project arrives as a natural-language description in `project.md`. The pipeline alternates between revising the impact assessment (affected resources, significance findings, regulatory exposure, uncertainty) and revising the mitigation package (avoidance, minimization, compensation, monitoring, and enforceable commitments).

The five agents:

- **permit coordinator** orchestrates the run by alternating one impact-assessment step with one mitigation-planning step and tracking progress. It does no ecological assessment, mitigation design, or reviewing itself.
- **impact assessment loop** — the **impact assessor** writes the ecological impact analysis to `IMPACT.md`; the **agency scientific reviewer** judges it. The impact assessor reads `MITIGATION.md` on each revision pass to incorporate the proposed avoidance, minimization, restoration, and monitoring measures.
- **mitigation loop** — the **mitigation planner** writes the mitigation plan and implementation record to `MITIGATION.md`; the **compliance inspector** judges them. The mitigation planner reads `IMPACT.md` on each revision pass to align the plan with the latest impact findings and regulatory concerns.

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:

- `project.md` — the original proposed project description, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing permitting approach, route alternative, construction method, or impact strategy 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}/IMPACT.md` — the ecological impact analysis for that plan. Impact assessor writes; agency scientific reviewer reviews; mitigation planner and compliance inspector read it.
- `plans/{id}-{slug}/MITIGATION.md` — the mitigation plan, commitments, and implementation checks for that plan. Mitigation planner writes; compliance inspector reviews; impact assessor and agency scientific reviewer read it.

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

Each plan develops independently. Cross-read between IMPACT.md and MITIGATION.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The permit coordinator round-robins across the K plans: each plan gets one impact-assessment step plus one mitigation-planning step per full cycle.

Within each plan, neither ecological impact analysis nor mitigation planning finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Impact findings may tighten after seeing the plan's proposed mitigation commitments; mitigation may correct after seeing the plan's refined findings on habitat, species, hydrology, construction windows, or cumulative effects.

I'm providing the following information:

<f1>
Keep `MITIGATION.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page note; record only the final state and move iteration-by-iteration 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 perform ecological assessment, mitigation planning, or reviewing yourself — you only assign 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 impact/mitigation scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, assign one impact-assessment step (impact assessor, then agency scientific reviewer) and one mitigation-planning step (mitigation planner, then compliance inspector); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When assigning work, always pass the plan's directory path so the assigned agent knows which `PLAN.md` / `IMPACT.md` / `MITIGATION.md` to operate on.
- Neither side terminates early on its own score within a plan; even a strong-looking impact analysis may need to revise once the mitigation plan makes concrete commitments. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K assignments (10 impact-assessment + 10 mitigation-planning assignments 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 assignment. 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 assignment.
</f2>

<f3>
You are working on environmental impact permitting for a proposed infrastructure project, such as a roadway, bridge, transmission line, rail improvement, port facility, utility corridor, or stormwater project. The original project description is given as a natural-language statement in `project.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 does not support a permit yet, but I am telling you it does not" is still a failing result, not a passing one.
</f4>

<f5>
Produce the ecological impact analysis for the plan the permit coordinator has assigned you to this round, and write it to that plan's `IMPACT.md` (under `plans/{id}-{slug}/IMPACT.md`). A complete analysis covers four kinds of claim, each justified with field evidence, agency guidance, literature, accepted modeling practice, or a clearly stated professional judgment.

- **Impact bounds and significance thresholds** — quantified estimates for acres of wetland or riparian impact, stream linear feet affected, habitat fragmentation, tree removal, impervious surface increase, pollutant load changes, noise or lighting effects, construction-period disturbance, and uncertainty ranges. State applicable significance thresholds where available.
- **Resource and exposure structure** — affected habitat types, listed species or critical habitat, migratory bird or bat use, aquatic resources, floodplain and stormwater pathways, invasive-species vectors, seasonal construction constraints, and whether impacts are direct, indirect, cumulative, temporary, or permanent.
- **Regulatory invariants and permit conditions** — requirements every compliant alternative must preserve, such as no net loss of regulated wetlands where required, maintenance of fish passage, adherence to in-water work windows, erosion-control performance, minimum buffer widths, compensatory mitigation ratios, tribal or cultural-resource avoidance buffers, and monitoring obligations. The compliance inspector will check these in a plan-level `compliance_matrix.md`.
- **Risk, uncertainty, and persistence** — likelihood of recovery after construction, expected duration of effects, climate or hydrologic sensitivity, uncertainty in survey coverage, probability of agency challenge, and whether adaptive management is needed.

Ground your claims against the plan's `MITIGATION.md` if it has reported commitments, schedules, or monitoring results. If a predicted impact remains grossly inconsistent with the proposed mitigation — for example, the analysis claims unavoidable loss of a wetland that the mitigation plan now avoids by redesign — diagnose whether the impact analysis needs revision or the mitigation plan is unsupported, and state it. Be concrete. "Permanent fill affects 0.42 acre of palustrine emergent wetland and triggers a 1.5:1 compensatory mitigation requirement" is useful; "there may be some wetland issues" is not. Do not read or aggregate across other plans' files.
</f5>

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

<f7>
Match the assessment method to the resource and regulatory question; do not force an ill-suited one. The list below is useful in ecological impact permitting.

| Tool | Suitable for |
|---|---|
| Wetland delineation and functional assessment | Clean Water Act jurisdiction, acreage of permanent and temporary wetland impact, mitigation ratios |
| Habitat suitability or species occurrence modeling | Listed species, sensitive habitat, seasonal use, survey-gap risk |
| Before-after-control-impact reasoning | Construction disturbance, restoration monitoring, separating project effects from background variation |
| Hydrologic and stormwater modeling | Floodplain alteration, runoff volume, peak discharge, pollutant load, erosion risk |
| Connectivity and fragmentation analysis | Wildlife movement corridors, riparian continuity, culvert or crossing effects |
| Noise, vibration, lighting, and human-disturbance screening | Nesting birds, bats, aquatic species, residential and recreational receptors |
| Cumulative-effects assessment | Interaction with past, present, and reasonably foreseeable projects in the same watershed or habitat corridor |
| Regulatory applicability matrix | NEPA/CEQA-type review, Clean Water Act Sections 401/404, Endangered Species Act consultation, state wetlands, coastal-zone, floodplain, and stormwater permits |
| Uncertainty and adaptive-management analysis | Incomplete surveys, climate-sensitive resources, monitoring triggers, contingency actions |
</f7>

<f8>
You operate on the plan the permit coordinator has assigned you to this round. Read `project.md`, your assigned plan's `PLAN.md`, and your assigned plan's `IMPACT.md`, then prepare the mitigation package:

- Include every required mitigation component. Identify each impact the plan must address, define the avoidance and minimization measures, specify compensatory mitigation where needed, assign responsible parties, set construction timing restrictions, describe monitoring methods, define success criteria, and list contingency actions if performance standards are not met.
- Make the mitigation plan testable against the plan's `IMPACT.md`. If the impact analysis states a wetland mitigation ratio, your plan should provide enough credits, restoration acreage, or in-lieu fee documentation to satisfy it. If the impact analysis states an invariant such as maintaining fish passage or respecting a nesting-season exclusion window, your plan should include a concrete commitment that satisfies it.
- Work the plan through to a complete permitting package — do not stop at a conceptual promise. If a measure is infeasible, find and document the root cause and propose a compliant alternative; do not hide gaps under vague phrases such as "best management practices will be used."
- Sanity-check the plan against the `IMPACT.md`. A buffer that must be 100 feet should not be listed as 50 feet; a compensatory mitigation requirement the impact analysis says applies should be met or explicitly justified with agency authority.

Write the mitigation plan and its implementation evidence in your assigned plan's `MITIGATION.md`. Do not read or write any other plan's files.
</f8>

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

- Inspect the reported mitigation commitments for anomalies, infeasible schedules, missing responsible parties, unreasonable restoration ratios, or permit-condition violations stated directly in `project.md` or in the plan's `PLAN.md`.
- Open the plan's `IMPACT.md`. For every threshold, invariant, mitigation ratio, timing restriction, buffer requirement, monitoring obligation, or resource-specific condition the impact analysis claims, write a check into a separate `compliance_matrix.md` under the plan's directory: does the mitigation plan satisfy the condition, provide the required compensatory mitigation, meet the monitoring standard, and avoid the prohibited impact? Complete it. Name any commitment or resource that fails.
- Read the mitigation plan and spot-check it for defects — missing quantities, undefined performance standards, inconsistent construction windows, monitoring without triggers, contingency measures without funding, or commitments that contradict the selected project approach. A gap that silently leaves the permit unenforceable is worse than a visible disagreement.
- Treat the result as finished only when every stated permit condition holds, every impact-analysis invariant holds, and the mitigation commitments are consistent with the impact analysis's thresholds — not merely when the document sounds plausible.
- Check the length of the plan's `MITIGATION.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `MITIGATION.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 permit coordinator has assigned you to this round. Your ecological impact analysis lives in that plan's `IMPACT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the agency scientific reviewer as a loop, alternating with that plan's mitigation loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `IMPACT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `IMPACT.md` already exists, it carries the agency scientific reviewer's `<review>` block. Read that feedback. Then open the plan's `MITIGATION.md` and look at the latest reported commitments, quantities, schedules, and monitoring standards — they may invalidate, sharpen, or motivate revisions to your impact findings. Revise the plan's `IMPACT.md` in place to address every reviewer point raised and to incorporate any mitigation evidence that changes your analysis. Don't discard the previous analysis 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 `IMPACT.md` against `project.md`, against the plan's `PLAN.md`, and against the commitments reported in the plan's `MITIGATION.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the impact analysis correctly describe the proposed project in `project.md` under the framing set by the plan's `PLAN.md`? Check footprint assumptions, construction methods, resource definitions, direct versus indirect impact categories, and regulatory triggers.
- **Scientific soundness** — for each claim, walk through the evidence, method, or citation. Flag unsupported professional judgments, stale surveys, missing seasonal constraints, and methods that do not apply under the stated assumptions.
- **Mitigation grounding** — open the plan's `MITIGATION.md`. If the mitigation plan reports avoidance commitments, compensatory credits, monitoring standards, or construction restrictions, do they match the impact analysis's predicted effects and significance findings? A mitigation ratio or restoration target that is off by orders of magnitude is a signal that the impact calculation is weak, the mitigation is inadequate, or both; identify which.

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

<f13>
You operate on the plan the permit coordinator has assigned you to this round. Your mitigation plan and its implementation record live in that plan's `MITIGATION.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the compliance inspector as a loop, alternating with that plan's impact assessment loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `MITIGATION.md` does not exist yet, this is the first pass for that plan: produce the mitigation package from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `MITIGATION.md` already exists, it carries the compliance inspector's `<review>` block. Read that feedback. Then open the plan's `IMPACT.md` and check whether the latest analysis introduces thresholds, invariants, mitigation ratios, timing restrictions, or resource-specific commitments your current plan doesn't yet satisfy — for example a higher wetland compensation ratio, a stricter in-water work window, or a habitat-connectivity requirement your plan violates. Revise the plan's `MITIGATION.md` in place to address every reviewer point and to align with the latest impact analysis. Don't discard the previous plan 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 (permit coordinator, impact assessor, agency scientific reviewer, mitigation planner, compliance inspector), which items should go in its prompt? Respond with a JSON object like {"permit coordinator": ["f?"], "impact assessor": ["f?"], "agency scientific reviewer": ["f?"], "mitigation planner": ["f?"], "compliance inspector": ["f?"]}. No other output.

I need you to set up a 5-agent pipeline that supports environmental impact permitting for a proposed infrastructure project by developing ecological impact claims and mitigation plans in parallel, with each side informing the other. A project arrives as a natural-language description in `project.md`. The pipeline alternates between revising the impact assessment (affected resources, significance findings, regulatory exposure, uncertainty) and revising the mitigation package (avoidance, minimization, compensation, monitoring, and enforceable commitments).

The five agents:

- **permit coordinator** orchestrates the run by alternating one impact-assessment step with one mitigation-planning step and tracking progress. It does no ecological assessment, mitigation design, or reviewing itself.
- **impact assessment loop** — the **impact assessor** writes the ecological impact analysis to `IMPACT.md`; the **agency scientific reviewer** judges it. The impact assessor reads `MITIGATION.md` on each revision pass to incorporate the proposed avoidance, minimization, restoration, and monitoring measures.
- **mitigation loop** — the **mitigation planner** writes the mitigation plan and implementation record to `MITIGATION.md`; the **compliance inspector** judges them. The mitigation planner reads `IMPACT.md` on each revision pass to align the plan with the latest impact findings and regulatory concerns.

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:

- `project.md` — the original proposed project description, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing permitting approach, route alternative, construction method, or impact strategy 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}/IMPACT.md` — the ecological impact analysis for that plan. Impact assessor writes; agency scientific reviewer reviews; mitigation planner and compliance inspector read it.
- `plans/{id}-{slug}/MITIGATION.md` — the mitigation plan, commitments, and implementation checks for that plan. Mitigation planner writes; compliance inspector reviews; impact assessor and agency scientific reviewer read it.

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

Each plan develops independently. Cross-read between IMPACT.md and MITIGATION.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The permit coordinator round-robins across the K plans: each plan gets one impact-assessment step plus one mitigation-planning step per full cycle.

Within each plan, neither ecological impact analysis nor mitigation planning finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Impact findings may tighten after seeing the plan's proposed mitigation commitments; mitigation may correct after seeing the plan's refined findings on habitat, species, hydrology, construction windows, or cumulative effects.

I'm providing the following prompt fragments:

<f1>
Keep `MITIGATION.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page note; record only the final state and move iteration-by-iteration 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 perform ecological assessment, mitigation planning, or reviewing yourself — you only assign 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 impact/mitigation scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, assign one impact-assessment step (impact assessor, then agency scientific reviewer) and one mitigation-planning step (mitigation planner, then compliance inspector); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When assigning work, always pass the plan's directory path so the assigned agent knows which `PLAN.md` / `IMPACT.md` / `MITIGATION.md` to operate on.
- Neither side terminates early on its own score within a plan; even a strong-looking impact analysis may need to revise once the mitigation plan makes concrete commitments. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K assignments (10 impact-assessment + 10 mitigation-planning assignments 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 assignment. 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 assignment.
</f2>

<f3>
You are working on environmental impact permitting for a proposed infrastructure project, such as a roadway, bridge, transmission line, rail improvement, port facility, utility corridor, or stormwater project. The original project description is given as a natural-language statement in `project.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 does not support a permit yet, but I am telling you it does not" is still a failing result, not a passing one.
</f4>

<f5>
Produce the ecological impact analysis for the plan the permit coordinator has assigned you to this round, and write it to that plan's `IMPACT.md` (under `plans/{id}-{slug}/IMPACT.md`). A complete analysis covers four kinds of claim, each justified with field evidence, agency guidance, literature, accepted modeling practice, or a clearly stated professional judgment.

- **Impact bounds and significance thresholds** — quantified estimates for acres of wetland or riparian impact, stream linear feet affected, habitat fragmentation, tree removal, impervious surface increase, pollutant load changes, noise or lighting effects, construction-period disturbance, and uncertainty ranges. State applicable significance thresholds where available.
- **Resource and exposure structure** — affected habitat types, listed species or critical habitat, migratory bird or bat use, aquatic resources, floodplain and stormwater pathways, invasive-species vectors, seasonal construction constraints, and whether impacts are direct, indirect, cumulative, temporary, or permanent.
- **Regulatory invariants and permit conditions** — requirements every compliant alternative must preserve, such as no net loss of regulated wetlands where required, maintenance of fish passage, adherence to in-water work windows, erosion-control performance, minimum buffer widths, compensatory mitigation ratios, tribal or cultural-resource avoidance buffers, and monitoring obligations. The compliance inspector will check these in a plan-level `compliance_matrix.md`.
- **Risk, uncertainty, and persistence** — likelihood of recovery after construction, expected duration of effects, climate or hydrologic sensitivity, uncertainty in survey coverage, probability of agency challenge, and whether adaptive management is needed.

Ground your claims against the plan's `MITIGATION.md` if it has reported commitments, schedules, or monitoring results. If a predicted impact remains grossly inconsistent with the proposed mitigation — for example, the analysis claims unavoidable loss of a wetland that the mitigation plan now avoids by redesign — diagnose whether the impact analysis needs revision or the mitigation plan is unsupported, and state it. Be concrete. "Permanent fill affects 0.42 acre of palustrine emergent wetland and triggers a 1.5:1 compensatory mitigation requirement" is useful; "there may be some wetland issues" is not. Do not read or aggregate across other plans' files.
</f5>

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

<f7>
Match the assessment method to the resource and regulatory question; do not force an ill-suited one. The list below is useful in ecological impact permitting.

| Tool | Suitable for |
|---|---|
| Wetland delineation and functional assessment | Clean Water Act jurisdiction, acreage of permanent and temporary wetland impact, mitigation ratios |
| Habitat suitability or species occurrence modeling | Listed species, sensitive habitat, seasonal use, survey-gap risk |
| Before-after-control-impact reasoning | Construction disturbance, restoration monitoring, separating project effects from background variation |
| Hydrologic and stormwater modeling | Floodplain alteration, runoff volume, peak discharge, pollutant load, erosion risk |
| Connectivity and fragmentation analysis | Wildlife movement corridors, riparian continuity, culvert or crossing effects |
| Noise, vibration, lighting, and human-disturbance screening | Nesting birds, bats, aquatic species, residential and recreational receptors |
| Cumulative-effects assessment | Interaction with past, present, and reasonably foreseeable projects in the same watershed or habitat corridor |
| Regulatory applicability matrix | NEPA/CEQA-type review, Clean Water Act Sections 401/404, Endangered Species Act consultation, state wetlands, coastal-zone, floodplain, and stormwater permits |
| Uncertainty and adaptive-management analysis | Incomplete surveys, climate-sensitive resources, monitoring triggers, contingency actions |
</f7>

<f8>
You operate on the plan the permit coordinator has assigned you to this round. Read `project.md`, your assigned plan's `PLAN.md`, and your assigned plan's `IMPACT.md`, then prepare the mitigation package:

- Include every required mitigation component. Identify each impact the plan must address, define the avoidance and minimization measures, specify compensatory mitigation where needed, assign responsible parties, set construction timing restrictions, describe monitoring methods, define success criteria, and list contingency actions if performance standards are not met.
- Make the mitigation plan testable against the plan's `IMPACT.md`. If the impact analysis states a wetland mitigation ratio, your plan should provide enough credits, restoration acreage, or in-lieu fee documentation to satisfy it. If the impact analysis states an invariant such as maintaining fish passage or respecting a nesting-season exclusion window, your plan should include a concrete commitment that satisfies it.
- Work the plan through to a complete permitting package — do not stop at a conceptual promise. If a measure is infeasible, find and document the root cause and propose a compliant alternative; do not hide gaps under vague phrases such as "best management practices will be used."
- Sanity-check the plan against the `IMPACT.md`. A buffer that must be 100 feet should not be listed as 50 feet; a compensatory mitigation requirement the impact analysis says applies should be met or explicitly justified with agency authority.

Write the mitigation plan and its implementation evidence in your assigned plan's `MITIGATION.md`. Do not read or write any other plan's files.
</f8>

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

- Inspect the reported mitigation commitments for anomalies, infeasible schedules, missing responsible parties, unreasonable restoration ratios, or permit-condition violations stated directly in `project.md` or in the plan's `PLAN.md`.
- Open the plan's `IMPACT.md`. For every threshold, invariant, mitigation ratio, timing restriction, buffer requirement, monitoring obligation, or resource-specific condition the impact analysis claims, write a check into a separate `compliance_matrix.md` under the plan's directory: does the mitigation plan satisfy the condition, provide the required compensatory mitigation, meet the monitoring standard, and avoid the prohibited impact? Complete it. Name any commitment or resource that fails.
- Read the mitigation plan and spot-check it for defects — missing quantities, undefined performance standards, inconsistent construction windows, monitoring without triggers, contingency measures without funding, or commitments that contradict the selected project approach. A gap that silently leaves the permit unenforceable is worse than a visible disagreement.
- Treat the result as finished only when every stated permit condition holds, every impact-analysis invariant holds, and the mitigation commitments are consistent with the impact analysis's thresholds — not merely when the document sounds plausible.
- Check the length of the plan's `MITIGATION.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `MITIGATION.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 permit coordinator has assigned you to this round. Your ecological impact analysis lives in that plan's `IMPACT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the agency scientific reviewer as a loop, alternating with that plan's mitigation loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `IMPACT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `IMPACT.md` already exists, it carries the agency scientific reviewer's `<review>` block. Read that feedback. Then open the plan's `MITIGATION.md` and look at the latest reported commitments, quantities, schedules, and monitoring standards — they may invalidate, sharpen, or motivate revisions to your impact findings. Revise the plan's `IMPACT.md` in place to address every reviewer point raised and to incorporate any mitigation evidence that changes your analysis. Don't discard the previous analysis 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 `IMPACT.md` against `project.md`, against the plan's `PLAN.md`, and against the commitments reported in the plan's `MITIGATION.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the impact analysis correctly describe the proposed project in `project.md` under the framing set by the plan's `PLAN.md`? Check footprint assumptions, construction methods, resource definitions, direct versus indirect impact categories, and regulatory triggers.
- **Scientific soundness** — for each claim, walk through the evidence, method, or citation. Flag unsupported professional judgments, stale surveys, missing seasonal constraints, and methods that do not apply under the stated assumptions.
- **Mitigation grounding** — open the plan's `MITIGATION.md`. If the mitigation plan reports avoidance commitments, compensatory credits, monitoring standards, or construction restrictions, do they match the impact analysis's predicted effects and significance findings? A mitigation ratio or restoration target that is off by orders of magnitude is a signal that the impact calculation is weak, the mitigation is inadequate, or both; identify which.

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

<f13>
You operate on the plan the permit coordinator has assigned you to this round. Your mitigation plan and its implementation record live in that plan's `MITIGATION.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the compliance inspector as a loop, alternating with that plan's impact assessment loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `MITIGATION.md` does not exist yet, this is the first pass for that plan: produce the mitigation package from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `MITIGATION.md` already exists, it carries the compliance inspector's `<review>` block. Read that feedback. Then open the plan's `IMPACT.md` and check whether the latest analysis introduces thresholds, invariants, mitigation ratios, timing restrictions, or resource-specific commitments your current plan doesn't yet satisfy — for example a higher wetland compensation ratio, a stricter in-water work window, or a habitat-connectivity requirement your plan violates. Revise the plan's `MITIGATION.md` in place to address every reviewer point and to align with the latest impact analysis. Don't discard the previous plan 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. `# permit coordinator`). Output only the headered prompts, no preamble.


I need you to set up a 5-agent pipeline that supports environmental impact permitting for a proposed infrastructure project by developing ecological impact claims and mitigation plans in parallel, with each side informing the other. A project arrives as a natural-language description in `project.md`. The pipeline alternates between revising the impact assessment (affected resources, significance findings, regulatory exposure, uncertainty) and revising the mitigation package (avoidance, minimization, compensation, monitoring, and enforceable commitments).

The five agents:

- **permit coordinator** orchestrates the run by alternating one impact-assessment step with one mitigation-planning step and tracking progress. It does no ecological assessment, mitigation design, or reviewing itself.
- **impact assessment loop** — the **impact assessor** writes the ecological impact analysis to `IMPACT.md`; the **agency scientific reviewer** judges it. The impact assessor reads `MITIGATION.md` on each revision pass to incorporate the proposed avoidance, minimization, restoration, and monitoring measures.
- **mitigation loop** — the **mitigation planner** writes the mitigation plan and implementation record to `MITIGATION.md`; the **compliance inspector** judges them. The mitigation planner reads `IMPACT.md` on each revision pass to align the plan with the latest impact findings and regulatory concerns.

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:

- `project.md` — the original proposed project description, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing permitting approach, route alternative, construction method, or impact strategy 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}/IMPACT.md` — the ecological impact analysis for that plan. Impact assessor writes; agency scientific reviewer reviews; mitigation planner and compliance inspector read it.
- `plans/{id}-{slug}/MITIGATION.md` — the mitigation plan, commitments, and implementation checks for that plan. Mitigation planner writes; compliance inspector reviews; impact assessor and agency scientific reviewer read it.

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

Each plan develops independently. Cross-read between IMPACT.md and MITIGATION.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The permit coordinator round-robins across the K plans: each plan gets one impact-assessment step plus one mitigation-planning step per full cycle.

Within each plan, neither ecological impact analysis nor mitigation planning finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Impact findings may tighten after seeing the plan's proposed mitigation commitments; mitigation may correct after seeing the plan's refined findings on habitat, species, hydrology, construction windows, or cumulative effects.

I'm providing the following information:

<f1>
You operate on the plan the permit coordinator has assigned you to this round. Read `project.md`, your assigned plan's `PLAN.md`, and your assigned plan's `IMPACT.md`, then prepare the mitigation package:

- Include every required mitigation component. Identify each impact the plan must address, define the avoidance and minimization measures, specify compensatory mitigation where needed, assign responsible parties, set construction timing restrictions, describe monitoring methods, define success criteria, and list contingency actions if performance standards are not met.
- Make the mitigation plan testable against the plan's `IMPACT.md`. If the impact analysis states a wetland mitigation ratio, your plan should provide enough credits, restoration acreage, or in-lieu fee documentation to satisfy it. If the impact analysis states an invariant such as maintaining fish passage or respecting a nesting-season exclusion window, your plan should include a concrete commitment that satisfies it.
- Work the plan through to a complete permitting package — do not stop at a conceptual promise. If a measure is infeasible, find and document the root cause and propose a compliant alternative; do not hide gaps under vague phrases such as "best management practices will be used."
- Sanity-check the plan against the `IMPACT.md`. A buffer that must be 100 feet should not be listed as 50 feet; a compensatory mitigation requirement the impact analysis says applies should be met or explicitly justified with agency authority.

Write the mitigation plan and its implementation evidence in your assigned plan's `MITIGATION.md`. Do not read or write any other plan's files.
</f1>

<f2>
Match the assessment method to the resource and regulatory question; do not force an ill-suited one. The list below is useful in ecological impact permitting.

| Tool | Suitable for |
|---|---|
| Wetland delineation and functional assessment | Clean Water Act jurisdiction, acreage of permanent and temporary wetland impact, mitigation ratios |
| Habitat suitability or species occurrence modeling | Listed species, sensitive habitat, seasonal use, survey-gap risk |
| Before-after-control-impact reasoning | Construction disturbance, restoration monitoring, separating project effects from background variation |
| Hydrologic and stormwater modeling | Floodplain alteration, runoff volume, peak discharge, pollutant load, erosion risk |
| Connectivity and fragmentation analysis | Wildlife movement corridors, riparian continuity, culvert or crossing effects |
| Noise, vibration, lighting, and human-disturbance screening | Nesting birds, bats, aquatic species, residential and recreational receptors |
| Cumulative-effects assessment | Interaction with past, present, and reasonably foreseeable projects in the same watershed or habitat corridor |
| Regulatory applicability matrix | NEPA/CEQA-type review, Clean Water Act Sections 401/404, Endangered Species Act consultation, state wetlands, coastal-zone, floodplain, and stormwater permits |
| Uncertainty and adaptive-management analysis | Incomplete surveys, climate-sensitive resources, monitoring triggers, contingency actions |
</f2>

<f3>
You operate on the plan the permit coordinator has assigned you to this round. Your mitigation plan and its implementation record live in that plan's `MITIGATION.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the compliance inspector as a loop, alternating with that plan's impact assessment loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `MITIGATION.md` does not exist yet, this is the first pass for that plan: produce the mitigation package from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `MITIGATION.md` already exists, it carries the compliance inspector's `<review>` block. Read that feedback. Then open the plan's `IMPACT.md` and check whether the latest analysis introduces thresholds, invariants, mitigation ratios, timing restrictions, or resource-specific commitments your current plan doesn't yet satisfy — for example a higher wetland compensation ratio, a stricter in-water work window, or a habitat-connectivity requirement your plan violates. Revise the plan's `MITIGATION.md` in place to address every reviewer point and to align with the latest impact analysis. Don't discard the previous plan 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 `IMPACT.md` against `project.md`, against the plan's `PLAN.md`, and against the commitments reported in the plan's `MITIGATION.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the impact analysis correctly describe the proposed project in `project.md` under the framing set by the plan's `PLAN.md`? Check footprint assumptions, construction methods, resource definitions, direct versus indirect impact categories, and regulatory triggers.
- **Scientific soundness** — for each claim, walk through the evidence, method, or citation. Flag unsupported professional judgments, stale surveys, missing seasonal constraints, and methods that do not apply under the stated assumptions.
- **Mitigation grounding** — open the plan's `MITIGATION.md`. If the mitigation plan reports avoidance commitments, compensatory credits, monitoring standards, or construction restrictions, do they match the impact analysis's predicted effects and significance findings? A mitigation ratio or restoration target that is off by orders of magnitude is a signal that the impact calculation is weak, the mitigation is inadequate, or both; identify which.

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

<f5>
You orchestrate the run; you never perform ecological assessment, mitigation planning, or reviewing yourself — you only assign 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 impact/mitigation scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, assign one impact-assessment step (impact assessor, then agency scientific reviewer) and one mitigation-planning step (mitigation planner, then compliance inspector); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When assigning work, always pass the plan's directory path so the assigned agent knows which `PLAN.md` / `IMPACT.md` / `MITIGATION.md` to operate on.
- Neither side terminates early on its own score within a plan; even a strong-looking impact analysis may need to revise once the mitigation plan makes concrete commitments. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K assignments (10 impact-assessment + 10 mitigation-planning assignments 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 assignment. 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 assignment.
</f5>

<f6>
Produce the ecological impact analysis for the plan the permit coordinator has assigned you to this round, and write it to that plan's `IMPACT.md` (under `plans/{id}-{slug}/IMPACT.md`). A complete analysis covers four kinds of claim, each justified with field evidence, agency guidance, literature, accepted modeling practice, or a clearly stated professional judgment.

- **Impact bounds and significance thresholds** — quantified estimates for acres of wetland or riparian impact, stream linear feet affected, habitat fragmentation, tree removal, impervious surface increase, pollutant load changes, noise or lighting effects, construction-period disturbance, and uncertainty ranges. State applicable significance thresholds where available.
- **Resource and exposure structure** — affected habitat types, listed species or critical habitat, migratory bird or bat use, aquatic resources, floodplain and stormwater pathways, invasive-species vectors, seasonal construction constraints, and whether impacts are direct, indirect, cumulative, temporary, or permanent.
- **Regulatory invariants and permit conditions** — requirements every compliant alternative must preserve, such as no net loss of regulated wetlands where required, maintenance of fish passage, adherence to in-water work windows, erosion-control performance, minimum buffer widths, compensatory mitigation ratios, tribal or cultural-resource avoidance buffers, and monitoring obligations. The compliance inspector will check these in a plan-level `compliance_matrix.md`.
- **Risk, uncertainty, and persistence** — likelihood of recovery after construction, expected duration of effects, climate or hydrologic sensitivity, uncertainty in survey coverage, probability of agency challenge, and whether adaptive management is needed.

Ground your claims against the plan's `MITIGATION.md` if it has reported commitments, schedules, or monitoring results. If a predicted impact remains grossly inconsistent with the proposed mitigation — for example, the analysis claims unavoidable loss of a wetland that the mitigation plan now avoids by redesign — diagnose whether the impact analysis needs revision or the mitigation plan is unsupported, and state it. Be concrete. "Permanent fill affects 0.42 acre of palustrine emergent wetland and triggers a 1.5:1 compensatory mitigation requirement" is useful; "there may be some wetland issues" 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 does not support a permit yet, but I am telling you it does not" is still a failing result, not a passing one.
</f7>

<f8>
Keep `MITIGATION.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page note; record only the final state and move iteration-by-iteration 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 permit coordinator: 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 working on environmental impact permitting for a proposed infrastructure project, such as a roadway, bridge, transmission line, rail improvement, port facility, utility corridor, or stormwater project. The original project description is given as a natural-language statement in `project.md`; read it before starting your part.
</f11>

<f12>
You operate on the plan the permit coordinator has assigned you to this round. Your ecological impact analysis lives in that plan's `IMPACT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the agency scientific reviewer as a loop, alternating with that plan's mitigation loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `IMPACT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `IMPACT.md` already exists, it carries the agency scientific reviewer's `<review>` block. Read that feedback. Then open the plan's `MITIGATION.md` and look at the latest reported commitments, quantities, schedules, and monitoring standards — they may invalidate, sharpen, or motivate revisions to your impact findings. Revise the plan's `IMPACT.md` in place to address every reviewer point raised and to incorporate any mitigation evidence that changes your analysis. Don't discard the previous analysis and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f12>

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

- Inspect the reported mitigation commitments for anomalies, infeasible schedules, missing responsible parties, unreasonable restoration ratios, or permit-condition violations stated directly in `project.md` or in the plan's `PLAN.md`.
- Open the plan's `IMPACT.md`. For every threshold, invariant, mitigation ratio, timing restriction, buffer requirement, monitoring obligation, or resource-specific condition the impact analysis claims, write a check into a separate `compliance_matrix.md` under the plan's directory: does the mitigation plan satisfy the condition, provide the required compensatory mitigation, meet the monitoring standard, and avoid the prohibited impact? Complete it. Name any commitment or resource that fails.
- Read the mitigation plan and spot-check it for defects — missing quantities, undefined performance standards, inconsistent construction windows, monitoring without triggers, contingency measures without funding, or commitments that contradict the selected project approach. A gap that silently leaves the permit unenforceable is worse than a visible disagreement.
- Treat the result as finished only when every stated permit condition holds, every impact-analysis invariant holds, and the mitigation commitments are consistent with the impact analysis's thresholds — not merely when the document sounds plausible.
- Check the length of the plan's `MITIGATION.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `MITIGATION.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 (permit coordinator, impact assessor, agency scientific reviewer, mitigation planner, compliance inspector), which items should go in its prompt? Respond with a JSON object like {"permit coordinator": ["f?"], "impact assessor": ["f?"], "agency scientific reviewer": ["f?"], "mitigation planner": ["f?"], "compliance inspector": ["f?"]}. No other output.

I need you to set up a 5-agent pipeline that supports environmental impact permitting for a proposed infrastructure project by developing ecological impact claims and mitigation plans in parallel, with each side informing the other. A project arrives as a natural-language description in `project.md`. The pipeline alternates between revising the impact assessment (affected resources, significance findings, regulatory exposure, uncertainty) and revising the mitigation package (avoidance, minimization, compensation, monitoring, and enforceable commitments).

The five agents:

- **permit coordinator** orchestrates the run by alternating one impact-assessment step with one mitigation-planning step and tracking progress. It does no ecological assessment, mitigation design, or reviewing itself.
- **impact assessment loop** — the **impact assessor** writes the ecological impact analysis to `IMPACT.md`; the **agency scientific reviewer** judges it. The impact assessor reads `MITIGATION.md` on each revision pass to incorporate the proposed avoidance, minimization, restoration, and monitoring measures.
- **mitigation loop** — the **mitigation planner** writes the mitigation plan and implementation record to `MITIGATION.md`; the **compliance inspector** judges them. The mitigation planner reads `IMPACT.md` on each revision pass to align the plan with the latest impact findings and regulatory concerns.

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:

- `project.md` — the original proposed project description, read-only. All four domain agents read it.
- `plans/{id}-{slug}/PLAN.md` — one pre-existing permitting approach, route alternative, construction method, or impact strategy 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}/IMPACT.md` — the ecological impact analysis for that plan. Impact assessor writes; agency scientific reviewer reviews; mitigation planner and compliance inspector read it.
- `plans/{id}-{slug}/MITIGATION.md` — the mitigation plan, commitments, and implementation checks for that plan. Mitigation planner writes; compliance inspector reviews; impact assessor and agency scientific reviewer read it.

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

Each plan develops independently. Cross-read between IMPACT.md and MITIGATION.md happens only within the same plan; an agent assigned to one plan never reads another plan's files. The permit coordinator round-robins across the K plans: each plan gets one impact-assessment step plus one mitigation-planning step per full cycle.

Within each plan, neither ecological impact analysis nor mitigation planning finishes first. Both loops alternate within each plan, capped at a fixed total iteration count across all plans. Impact findings may tighten after seeing the plan's proposed mitigation commitments; mitigation may correct after seeing the plan's refined findings on habitat, species, hydrology, construction windows, or cumulative effects.

I'm providing the following prompt fragments:

<f1>
You operate on the plan the permit coordinator has assigned you to this round. Read `project.md`, your assigned plan's `PLAN.md`, and your assigned plan's `IMPACT.md`, then prepare the mitigation package:

- Include every required mitigation component. Identify each impact the plan must address, define the avoidance and minimization measures, specify compensatory mitigation where needed, assign responsible parties, set construction timing restrictions, describe monitoring methods, define success criteria, and list contingency actions if performance standards are not met.
- Make the mitigation plan testable against the plan's `IMPACT.md`. If the impact analysis states a wetland mitigation ratio, your plan should provide enough credits, restoration acreage, or in-lieu fee documentation to satisfy it. If the impact analysis states an invariant such as maintaining fish passage or respecting a nesting-season exclusion window, your plan should include a concrete commitment that satisfies it.
- Work the plan through to a complete permitting package — do not stop at a conceptual promise. If a measure is infeasible, find and document the root cause and propose a compliant alternative; do not hide gaps under vague phrases such as "best management practices will be used."
- Sanity-check the plan against the `IMPACT.md`. A buffer that must be 100 feet should not be listed as 50 feet; a compensatory mitigation requirement the impact analysis says applies should be met or explicitly justified with agency authority.

Write the mitigation plan and its implementation evidence in your assigned plan's `MITIGATION.md`. Do not read or write any other plan's files.
</f1>

<f2>
Match the assessment method to the resource and regulatory question; do not force an ill-suited one. The list below is useful in ecological impact permitting.

| Tool | Suitable for |
|---|---|
| Wetland delineation and functional assessment | Clean Water Act jurisdiction, acreage of permanent and temporary wetland impact, mitigation ratios |
| Habitat suitability or species occurrence modeling | Listed species, sensitive habitat, seasonal use, survey-gap risk |
| Before-after-control-impact reasoning | Construction disturbance, restoration monitoring, separating project effects from background variation |
| Hydrologic and stormwater modeling | Floodplain alteration, runoff volume, peak discharge, pollutant load, erosion risk |
| Connectivity and fragmentation analysis | Wildlife movement corridors, riparian continuity, culvert or crossing effects |
| Noise, vibration, lighting, and human-disturbance screening | Nesting birds, bats, aquatic species, residential and recreational receptors |
| Cumulative-effects assessment | Interaction with past, present, and reasonably foreseeable projects in the same watershed or habitat corridor |
| Regulatory applicability matrix | NEPA/CEQA-type review, Clean Water Act Sections 401/404, Endangered Species Act consultation, state wetlands, coastal-zone, floodplain, and stormwater permits |
| Uncertainty and adaptive-management analysis | Incomplete surveys, climate-sensitive resources, monitoring triggers, contingency actions |
</f2>

<f3>
You operate on the plan the permit coordinator has assigned you to this round. Your mitigation plan and its implementation record live in that plan's `MITIGATION.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the compliance inspector as a loop, alternating with that plan's impact assessment loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `MITIGATION.md` does not exist yet, this is the first pass for that plan: produce the mitigation package from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `MITIGATION.md` already exists, it carries the compliance inspector's `<review>` block. Read that feedback. Then open the plan's `IMPACT.md` and check whether the latest analysis introduces thresholds, invariants, mitigation ratios, timing restrictions, or resource-specific commitments your current plan doesn't yet satisfy — for example a higher wetland compensation ratio, a stricter in-water work window, or a habitat-connectivity requirement your plan violates. Revise the plan's `MITIGATION.md` in place to address every reviewer point and to align with the latest impact analysis. Don't discard the previous plan 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 `IMPACT.md` against `project.md`, against the plan's `PLAN.md`, and against the commitments reported in the plan's `MITIGATION.md` (if any). Operate strictly on the assigned plan's files; do not look at other plans.

- **Faithfulness** — does the impact analysis correctly describe the proposed project in `project.md` under the framing set by the plan's `PLAN.md`? Check footprint assumptions, construction methods, resource definitions, direct versus indirect impact categories, and regulatory triggers.
- **Scientific soundness** — for each claim, walk through the evidence, method, or citation. Flag unsupported professional judgments, stale surveys, missing seasonal constraints, and methods that do not apply under the stated assumptions.
- **Mitigation grounding** — open the plan's `MITIGATION.md`. If the mitigation plan reports avoidance commitments, compensatory credits, monitoring standards, or construction restrictions, do they match the impact analysis's predicted effects and significance findings? A mitigation ratio or restoration target that is off by orders of magnitude is a signal that the impact calculation is weak, the mitigation is inadequate, or both; identify which.

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

<f5>
You orchestrate the run; you never perform ecological assessment, mitigation planning, or reviewing yourself — you only assign 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 impact/mitigation scores.
- **Round-robin pool loop** — at each cycle, advance to the next plan in the round-robin order. For that plan, assign one impact-assessment step (impact assessor, then agency scientific reviewer) and one mitigation-planning step (mitigation planner, then compliance inspector); then move to the next plan. After all K plans have each had one cycle, loop back to the first plan.
- When assigning work, always pass the plan's directory path so the assigned agent knows which `PLAN.md` / `IMPACT.md` / `MITIGATION.md` to operate on.
- Neither side terminates early on its own score within a plan; even a strong-looking impact analysis may need to revise once the mitigation plan makes concrete commitments. The pool keeps cycling even after individual plans look done.
- Cap the total at 20 × K assignments (10 impact-assessment + 10 mitigation-planning assignments 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 assignment. 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 assignment.
</f5>

<f6>
Produce the ecological impact analysis for the plan the permit coordinator has assigned you to this round, and write it to that plan's `IMPACT.md` (under `plans/{id}-{slug}/IMPACT.md`). A complete analysis covers four kinds of claim, each justified with field evidence, agency guidance, literature, accepted modeling practice, or a clearly stated professional judgment.

- **Impact bounds and significance thresholds** — quantified estimates for acres of wetland or riparian impact, stream linear feet affected, habitat fragmentation, tree removal, impervious surface increase, pollutant load changes, noise or lighting effects, construction-period disturbance, and uncertainty ranges. State applicable significance thresholds where available.
- **Resource and exposure structure** — affected habitat types, listed species or critical habitat, migratory bird or bat use, aquatic resources, floodplain and stormwater pathways, invasive-species vectors, seasonal construction constraints, and whether impacts are direct, indirect, cumulative, temporary, or permanent.
- **Regulatory invariants and permit conditions** — requirements every compliant alternative must preserve, such as no net loss of regulated wetlands where required, maintenance of fish passage, adherence to in-water work windows, erosion-control performance, minimum buffer widths, compensatory mitigation ratios, tribal or cultural-resource avoidance buffers, and monitoring obligations. The compliance inspector will check these in a plan-level `compliance_matrix.md`.
- **Risk, uncertainty, and persistence** — likelihood of recovery after construction, expected duration of effects, climate or hydrologic sensitivity, uncertainty in survey coverage, probability of agency challenge, and whether adaptive management is needed.

Ground your claims against the plan's `MITIGATION.md` if it has reported commitments, schedules, or monitoring results. If a predicted impact remains grossly inconsistent with the proposed mitigation — for example, the analysis claims unavoidable loss of a wetland that the mitigation plan now avoids by redesign — diagnose whether the impact analysis needs revision or the mitigation plan is unsupported, and state it. Be concrete. "Permanent fill affects 0.42 acre of palustrine emergent wetland and triggers a 1.5:1 compensatory mitigation requirement" is useful; "there may be some wetland issues" 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 does not support a permit yet, but I am telling you it does not" is still a failing result, not a passing one.
</f7>

<f8>
Keep `MITIGATION.md` lean. Its body — everything except the `<review>` block — must stay under 3000 words (~20KB), about a four-page note; record only the final state and move iteration-by-iteration 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 permit coordinator: 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 working on environmental impact permitting for a proposed infrastructure project, such as a roadway, bridge, transmission line, rail improvement, port facility, utility corridor, or stormwater project. The original project description is given as a natural-language statement in `project.md`; read it before starting your part.
</f11>

<f12>
You operate on the plan the permit coordinator has assigned you to this round. Your ecological impact analysis lives in that plan's `IMPACT.md`. You may be invoked on the same plan more than once — within each plan the pipeline runs you and the agency scientific reviewer as a loop, alternating with that plan's mitigation loop, while the permit coordinator round-robins across plans.

- If your assigned plan's `IMPACT.md` does not exist yet, this is the first pass for that plan: produce the analysis from scratch based on `project.md` and the plan's `PLAN.md`.
- If the plan's `IMPACT.md` already exists, it carries the agency scientific reviewer's `<review>` block. Read that feedback. Then open the plan's `MITIGATION.md` and look at the latest reported commitments, quantities, schedules, and monitoring standards — they may invalidate, sharpen, or motivate revisions to your impact findings. Revise the plan's `IMPACT.md` in place to address every reviewer point raised and to incorporate any mitigation evidence that changes your analysis. Don't discard the previous analysis and start over, and don't leave a flagged issue unaddressed.
- Do not read or touch other plans' files.
</f12>

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

- Inspect the reported mitigation commitments for anomalies, infeasible schedules, missing responsible parties, unreasonable restoration ratios, or permit-condition violations stated directly in `project.md` or in the plan's `PLAN.md`.
- Open the plan's `IMPACT.md`. For every threshold, invariant, mitigation ratio, timing restriction, buffer requirement, monitoring obligation, or resource-specific condition the impact analysis claims, write a check into a separate `compliance_matrix.md` under the plan's directory: does the mitigation plan satisfy the condition, provide the required compensatory mitigation, meet the monitoring standard, and avoid the prohibited impact? Complete it. Name any commitment or resource that fails.
- Read the mitigation plan and spot-check it for defects — missing quantities, undefined performance standards, inconsistent construction windows, monitoring without triggers, contingency measures without funding, or commitments that contradict the selected project approach. A gap that silently leaves the permit unenforceable is worse than a visible disagreement.
- Treat the result as finished only when every stated permit condition holds, every impact-analysis invariant holds, and the mitigation commitments are consistent with the impact analysis's thresholds — not merely when the document sounds plausible.
- Check the length of the plan's `MITIGATION.md`: if it exceeds 20KB, give a warning, but do not deduct points for it.
- Check the bold ratio of the plan's `MITIGATION.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. `# permit coordinator`). Output only the headered prompts, no preamble.