I need you to set up a 3-agent pipeline for identifying and validating novel off-label therapeutic applications for existing pharmacological compounds: pipeline_controller, discovery_scientist, and clinical_auditor.

- **pipeline_controller** orchestrates: each round it selects which hypothesis to pursue next, calls the discovery_scientist on that hypothesis, extracts the dossier file path from the discovery_scientist's reply, then calls the clinical_auditor on that path, decrements a counter, and loops. Does no analysis itself.
- **discovery_scientist** explores pharmacological databases and literature for the hypothesis it is given, writes a therapeutic application dossier, and records any new off-label potential interactions it notices along the way.
- **clinical_auditor** evaluates the dossier against clinical trial feasibility and safety criteria and persists the verdict.

I'm providing the following information:

<f1>
When you finish, briefly report to the pipeline_controller what you did.
</f1>

<f2>
Each round, before calling the discovery_scientist, read hypotheses.xml and select which hypothesis the discovery_scientist should work on:

1. Every hypothesis carries an `attempts` count and a clinical_auditor `score` (0-10). `score="0"` means the hypothesis is a toxicological or efficacy dead-end — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer hypotheses with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected hypothesis to the discovery_scientist. If hypotheses.xml holds no workable hypothesis, call the discovery_scientist with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring pharmacological data and literature, the moment you spot any potential new off-label interaction — even if you are unsure it holds — immediately append it to hypotheses.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility or toxicity before recording. Recording a hypothesis is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next hypothesis is selected.
</f3>

<f4>
After completing the audit, you must do two things:

1. Update the dossier file's Audit section

At the end of the dossier file, write or overwrite the `## Audit` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Audit

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension audit

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Literature references | pass/fail | ... |
| Impact description | pass/fail | ... |
| Mechanism analysis | pass/fail | ... |
| Modeling Protocol | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the dossier needs changes. If the hypothesis doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the hypothesis's status in hypotheses.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the explore → write → audit → improve loop: each round, select the next hypothesis, then alternate calls to the discovery_scientist and clinical_auditor agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next hypothesis, then call the discovery_scientist agent with it.
    2. Parse discovery_scientist's reply and extract the dossier file path.
    3. If a dossier path is present, call the clinical_auditor agent with prompt: "Please audit {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the clinical_auditor was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct hypotheses were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze pharmacological data, write dossiers, or do audits yourself — delegate everything to the two sub-agents.
- If discovery_scientist or clinical_auditor errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- discovery_scientist and clinical_auditor each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`hypotheses.xml`, `dossiers/`, `counter.txt`).
- You don't need to understand any pharmacological mechanisms — just pass file paths correctly.
</f5>

<f6>
You are participating in a drug repurposing research initiative targeting novel off-label therapeutic applications while screening for toxicological dead-ends.

Read the research guidelines first: ./research-guidelines.md
</f6>

<f7>
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.
</f7>

<f8>
This pharmacological library has been extensively studied for many years — any obvious secondary indications would have been commercialized long ago. So:

- Don't report applications that are obvious at a glance (e.g. "this NSAID reduces inflammation") — if it were that obvious, pharmaceutical companies would have patented it themselves
- Truly valuable novel applications hide in non-obvious receptor interactions, metabolic pathway overlaps, and tissue-specific secondary targets

**Writing the dossier**

Each hypothesis corresponds to its own dossier file at `dossiers/{id}-{slug}.md`, where `{id}` and `{slug}` come from the hypothesis's id and slug attributes in hypotheses.xml.

The dossier must contain four h2 sections in this fixed order:

- `## Dossier Title` — concise, clear therapeutic application title
- `## Impact Description` — what patient benefit it provides (disease progression halt, symptomatic relief, biomarker normalization, etc.)
- `## Short Description` — short writeup of the proposed mechanism of action, with pathway/receptor references
- `## Preclinical Evidence Details` — an in-silico or in-vitro modeling protocol the clinical_auditor can evaluate to verify the application

Do not modify or delete the `## Audit` section — the clinical_auditor overwrites that themselves.

If after investigation you find the hypothesis doesn't hold due to a toxicological dead-end, still briefly record your analysis and the reason for rejection in the dossier file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within approved pharmacological compounds, or withdrawn compounds with known safety profiles at lower doses |
| Literature references | Cited biochemical pathways, receptor affinities, and pharmacokinetic data must exactly match the latest reference databases |
| Impact description | Clinical benefit claim consistent with the dossier's own pharmacological analysis, no self-contradiction, no exaggeration |
| Mechanism analysis | Pinpoint specific molecular targets and explain why modulating them achieves the therapeutic effect |
| Modeling Protocol | End-to-end testing protocol demonstrating efficacy from the therapeutic perspective (must not require unavailable proprietary evaluation lines to simulate) |
| Reproducibility | Protocol can be evaluated end-to-end without manual assumption filling by the clinical_auditor; systemic applications must show therapeutic index viability within < 10,000 simulations and ≤ 100 patient profiles |
| Deduplication | Search clinicaltrials.gov, the compound's patent history, and public medical literature to confirm not already patented by others or already tested and failed officially |
| Amplification | The therapeutic effect must exceed the baseline of a generic placebo or standard-of-care treatment |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent pathways or AI-hallucinated binding affinities
- Impact description contradicts the dossier's own analysis
- Protocol simulates efficacy by ignoring known pharmacokinetic barriers (e.g., blood-brain barrier)
- Pharmacological references inconsistent with the latest reference databases
- Protocol is incomplete and requires the clinical_auditor to manually assemble the testing methodology
- Therapeutic effect is equivalent to standard-of-care baseline, with no significant improvement
</f9>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (pipeline_controller, discovery_scientist, clinical_auditor), which items should go in its prompt? Respond with a JSON object like {"pipeline_controller": ["f?"], "discovery_scientist": ["f?"], "clinical_auditor": ["f?"]}. No other output.

I need you to set up a 3-agent pipeline for identifying and validating novel off-label therapeutic applications for existing pharmacological compounds: pipeline_controller, discovery_scientist, and clinical_auditor.

- **pipeline_controller** orchestrates: each round it selects which hypothesis to pursue next, calls the discovery_scientist on that hypothesis, extracts the dossier file path from the discovery_scientist's reply, then calls the clinical_auditor on that path, decrements a counter, and loops. Does no analysis itself.
- **discovery_scientist** explores pharmacological databases and literature for the hypothesis it is given, writes a therapeutic application dossier, and records any new off-label potential interactions it notices along the way.
- **clinical_auditor** evaluates the dossier against clinical trial feasibility and safety criteria and persists the verdict.

I'm providing the following prompt fragments:

<f1>
When you finish, briefly report to the pipeline_controller what you did.
</f1>

<f2>
Each round, before calling the discovery_scientist, read hypotheses.xml and select which hypothesis the discovery_scientist should work on:

1. Every hypothesis carries an `attempts` count and a clinical_auditor `score` (0-10). `score="0"` means the hypothesis is a toxicological or efficacy dead-end — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer hypotheses with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected hypothesis to the discovery_scientist. If hypotheses.xml holds no workable hypothesis, call the discovery_scientist with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring pharmacological data and literature, the moment you spot any potential new off-label interaction — even if you are unsure it holds — immediately append it to hypotheses.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility or toxicity before recording. Recording a hypothesis is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next hypothesis is selected.
</f3>

<f4>
After completing the audit, you must do two things:

1. Update the dossier file's Audit section

At the end of the dossier file, write or overwrite the `## Audit` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Audit

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension audit

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Literature references | pass/fail | ... |
| Impact description | pass/fail | ... |
| Mechanism analysis | pass/fail | ... |
| Modeling Protocol | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the dossier needs changes. If the hypothesis doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the hypothesis's status in hypotheses.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the explore → write → audit → improve loop: each round, select the next hypothesis, then alternate calls to the discovery_scientist and clinical_auditor agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next hypothesis, then call the discovery_scientist agent with it.
    2. Parse discovery_scientist's reply and extract the dossier file path.
    3. If a dossier path is present, call the clinical_auditor agent with prompt: "Please audit {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the clinical_auditor was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct hypotheses were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze pharmacological data, write dossiers, or do audits yourself — delegate everything to the two sub-agents.
- If discovery_scientist or clinical_auditor errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- discovery_scientist and clinical_auditor each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`hypotheses.xml`, `dossiers/`, `counter.txt`).
- You don't need to understand any pharmacological mechanisms — just pass file paths correctly.
</f5>

<f6>
You are participating in a drug repurposing research initiative targeting novel off-label therapeutic applications while screening for toxicological dead-ends.

Read the research guidelines first: ./research-guidelines.md
</f6>

<f7>
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.
</f7>

<f8>
This pharmacological library has been extensively studied for many years — any obvious secondary indications would have been commercialized long ago. So:

- Don't report applications that are obvious at a glance (e.g. "this NSAID reduces inflammation") — if it were that obvious, pharmaceutical companies would have patented it themselves
- Truly valuable novel applications hide in non-obvious receptor interactions, metabolic pathway overlaps, and tissue-specific secondary targets

**Writing the dossier**

Each hypothesis corresponds to its own dossier file at `dossiers/{id}-{slug}.md`, where `{id}` and `{slug}` come from the hypothesis's id and slug attributes in hypotheses.xml.

The dossier must contain four h2 sections in this fixed order:

- `## Dossier Title` — concise, clear therapeutic application title
- `## Impact Description` — what patient benefit it provides (disease progression halt, symptomatic relief, biomarker normalization, etc.)
- `## Short Description` — short writeup of the proposed mechanism of action, with pathway/receptor references
- `## Preclinical Evidence Details` — an in-silico or in-vitro modeling protocol the clinical_auditor can evaluate to verify the application

Do not modify or delete the `## Audit` section — the clinical_auditor overwrites that themselves.

If after investigation you find the hypothesis doesn't hold due to a toxicological dead-end, still briefly record your analysis and the reason for rejection in the dossier file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within approved pharmacological compounds, or withdrawn compounds with known safety profiles at lower doses |
| Literature references | Cited biochemical pathways, receptor affinities, and pharmacokinetic data must exactly match the latest reference databases |
| Impact description | Clinical benefit claim consistent with the dossier's own pharmacological analysis, no self-contradiction, no exaggeration |
| Mechanism analysis | Pinpoint specific molecular targets and explain why modulating them achieves the therapeutic effect |
| Modeling Protocol | End-to-end testing protocol demonstrating efficacy from the therapeutic perspective (must not require unavailable proprietary evaluation lines to simulate) |
| Reproducibility | Protocol can be evaluated end-to-end without manual assumption filling by the clinical_auditor; systemic applications must show therapeutic index viability within < 10,000 simulations and ≤ 100 patient profiles |
| Deduplication | Search clinicaltrials.gov, the compound's patent history, and public medical literature to confirm not already patented by others or already tested and failed officially |
| Amplification | The therapeutic effect must exceed the baseline of a generic placebo or standard-of-care treatment |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent pathways or AI-hallucinated binding affinities
- Impact description contradicts the dossier's own analysis
- Protocol simulates efficacy by ignoring known pharmacokinetic barriers (e.g., blood-brain barrier)
- Pharmacological references inconsistent with the latest reference databases
- Protocol is incomplete and requires the clinical_auditor to manually assemble the testing methodology
- Therapeutic effect is equivalent to standard-of-care baseline, with no significant improvement
</f9>

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. `# pipeline_controller`). Output only the headered prompts, no preamble.


I need you to set up a 3-agent pipeline for identifying and validating novel off-label therapeutic applications for existing pharmacological compounds: pipeline_controller, discovery_scientist, and clinical_auditor.

- **pipeline_controller** orchestrates: each round it selects which hypothesis to pursue next, calls the discovery_scientist on that hypothesis, extracts the dossier file path from the discovery_scientist's reply, then calls the clinical_auditor on that path, decrements a counter, and loops. Does no analysis itself.
- **discovery_scientist** explores pharmacological databases and literature for the hypothesis it is given, writes a therapeutic application dossier, and records any new off-label potential interactions it notices along the way.
- **clinical_auditor** evaluates the dossier against clinical trial feasibility and safety criteria and persists the verdict.

I'm providing the following information:

<f1>
You drive the explore → write → audit → improve loop: each round, select the next hypothesis, then alternate calls to the discovery_scientist and clinical_auditor agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next hypothesis, then call the discovery_scientist agent with it.
    2. Parse discovery_scientist's reply and extract the dossier file path.
    3. If a dossier path is present, call the clinical_auditor agent with prompt: "Please audit {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the clinical_auditor was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct hypotheses were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze pharmacological data, write dossiers, or do audits yourself — delegate everything to the two sub-agents.
- If discovery_scientist or clinical_auditor errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- discovery_scientist and clinical_auditor each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`hypotheses.xml`, `dossiers/`, `counter.txt`).
- You don't need to understand any pharmacological mechanisms — just pass file paths correctly.
</f1>

<f2>
Each round, before calling the discovery_scientist, read hypotheses.xml and select which hypothesis the discovery_scientist should work on:

1. Every hypothesis carries an `attempts` count and a clinical_auditor `score` (0-10). `score="0"` means the hypothesis is a toxicological or efficacy dead-end — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer hypotheses with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected hypothesis to the discovery_scientist. If hypotheses.xml holds no workable hypothesis, call the discovery_scientist with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring pharmacological data and literature, the moment you spot any potential new off-label interaction — even if you are unsure it holds — immediately append it to hypotheses.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility or toxicity before recording. Recording a hypothesis is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next hypothesis is selected.
</f3>

<f4>
After completing the audit, you must do two things:

1. Update the dossier file's Audit section

At the end of the dossier file, write or overwrite the `## Audit` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Audit

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension audit

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Literature references | pass/fail | ... |
| Impact description | pass/fail | ... |
| Mechanism analysis | pass/fail | ... |
| Modeling Protocol | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the dossier needs changes. If the hypothesis doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the hypothesis's status in hypotheses.xml: increment attempts by 1, then update score.
</f4>

<f5>
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">`).
</f5>

<f6>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within approved pharmacological compounds, or withdrawn compounds with known safety profiles at lower doses |
| Literature references | Cited biochemical pathways, receptor affinities, and pharmacokinetic data must exactly match the latest reference databases |
| Impact description | Clinical benefit claim consistent with the dossier's own pharmacological analysis, no self-contradiction, no exaggeration |
| Mechanism analysis | Pinpoint specific molecular targets and explain why modulating them achieves the therapeutic effect |
| Modeling Protocol | End-to-end testing protocol demonstrating efficacy from the therapeutic perspective (must not require unavailable proprietary evaluation lines to simulate) |
| Reproducibility | Protocol can be evaluated end-to-end without manual assumption filling by the clinical_auditor; systemic applications must show therapeutic index viability within < 10,000 simulations and ≤ 100 patient profiles |
| Deduplication | Search clinicaltrials.gov, the compound's patent history, and public medical literature to confirm not already patented by others or already tested and failed officially |
| Amplification | The therapeutic effect must exceed the baseline of a generic placebo or standard-of-care treatment |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent pathways or AI-hallucinated binding affinities
- Impact description contradicts the dossier's own analysis
- Protocol simulates efficacy by ignoring known pharmacokinetic barriers (e.g., blood-brain barrier)
- Pharmacological references inconsistent with the latest reference databases
- Protocol is incomplete and requires the clinical_auditor to manually assemble the testing methodology
- Therapeutic effect is equivalent to standard-of-care baseline, with no significant improvement
</f6>

<f7>
When you finish, briefly report to the pipeline_controller what you did.
</f7>

<f8>
You are participating in a drug repurposing research initiative targeting novel off-label therapeutic applications while screening for toxicological dead-ends.

Read the research guidelines first: ./research-guidelines.md
</f8>

<f9>
This pharmacological library has been extensively studied for many years — any obvious secondary indications would have been commercialized long ago. So:

- Don't report applications that are obvious at a glance (e.g. "this NSAID reduces inflammation") — if it were that obvious, pharmaceutical companies would have patented it themselves
- Truly valuable novel applications hide in non-obvious receptor interactions, metabolic pathway overlaps, and tissue-specific secondary targets

**Writing the dossier**

Each hypothesis corresponds to its own dossier file at `dossiers/{id}-{slug}.md`, where `{id}` and `{slug}` come from the hypothesis's id and slug attributes in hypotheses.xml.

The dossier must contain four h2 sections in this fixed order:

- `## Dossier Title` — concise, clear therapeutic application title
- `## Impact Description` — what patient benefit it provides (disease progression halt, symptomatic relief, biomarker normalization, etc.)
- `## Short Description` — short writeup of the proposed mechanism of action, with pathway/receptor references
- `## Preclinical Evidence Details` — an in-silico or in-vitro modeling protocol the clinical_auditor can evaluate to verify the application

Do not modify or delete the `## Audit` section — the clinical_auditor overwrites that themselves.

If after investigation you find the hypothesis doesn't hold due to a toxicological dead-end, still briefly record your analysis and the reason for rejection in the dossier file.
</f9>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (pipeline_controller, discovery_scientist, clinical_auditor), which items should go in its prompt? Respond with a JSON object like {"pipeline_controller": ["f?"], "discovery_scientist": ["f?"], "clinical_auditor": ["f?"]}. No other output.

I need you to set up a 3-agent pipeline for identifying and validating novel off-label therapeutic applications for existing pharmacological compounds: pipeline_controller, discovery_scientist, and clinical_auditor.

- **pipeline_controller** orchestrates: each round it selects which hypothesis to pursue next, calls the discovery_scientist on that hypothesis, extracts the dossier file path from the discovery_scientist's reply, then calls the clinical_auditor on that path, decrements a counter, and loops. Does no analysis itself.
- **discovery_scientist** explores pharmacological databases and literature for the hypothesis it is given, writes a therapeutic application dossier, and records any new off-label potential interactions it notices along the way.
- **clinical_auditor** evaluates the dossier against clinical trial feasibility and safety criteria and persists the verdict.

I'm providing the following prompt fragments:

<f1>
You drive the explore → write → audit → improve loop: each round, select the next hypothesis, then alternate calls to the discovery_scientist and clinical_auditor agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next hypothesis, then call the discovery_scientist agent with it.
    2. Parse discovery_scientist's reply and extract the dossier file path.
    3. If a dossier path is present, call the clinical_auditor agent with prompt: "Please audit {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the clinical_auditor was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct hypotheses were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze pharmacological data, write dossiers, or do audits yourself — delegate everything to the two sub-agents.
- If discovery_scientist or clinical_auditor errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- discovery_scientist and clinical_auditor each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`hypotheses.xml`, `dossiers/`, `counter.txt`).
- You don't need to understand any pharmacological mechanisms — just pass file paths correctly.
</f1>

<f2>
Each round, before calling the discovery_scientist, read hypotheses.xml and select which hypothesis the discovery_scientist should work on:

1. Every hypothesis carries an `attempts` count and a clinical_auditor `score` (0-10). `score="0"` means the hypothesis is a toxicological or efficacy dead-end — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer hypotheses with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected hypothesis to the discovery_scientist. If hypotheses.xml holds no workable hypothesis, call the discovery_scientist with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring pharmacological data and literature, the moment you spot any potential new off-label interaction — even if you are unsure it holds — immediately append it to hypotheses.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility or toxicity before recording. Recording a hypothesis is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next hypothesis is selected.
</f3>

<f4>
After completing the audit, you must do two things:

1. Update the dossier file's Audit section

At the end of the dossier file, write or overwrite the `## Audit` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Audit

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension audit

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Literature references | pass/fail | ... |
| Impact description | pass/fail | ... |
| Mechanism analysis | pass/fail | ... |
| Modeling Protocol | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the dossier needs changes. If the hypothesis doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the hypothesis's status in hypotheses.xml: increment attempts by 1, then update score.
</f4>

<f5>
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">`).
</f5>

<f6>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within approved pharmacological compounds, or withdrawn compounds with known safety profiles at lower doses |
| Literature references | Cited biochemical pathways, receptor affinities, and pharmacokinetic data must exactly match the latest reference databases |
| Impact description | Clinical benefit claim consistent with the dossier's own pharmacological analysis, no self-contradiction, no exaggeration |
| Mechanism analysis | Pinpoint specific molecular targets and explain why modulating them achieves the therapeutic effect |
| Modeling Protocol | End-to-end testing protocol demonstrating efficacy from the therapeutic perspective (must not require unavailable proprietary evaluation lines to simulate) |
| Reproducibility | Protocol can be evaluated end-to-end without manual assumption filling by the clinical_auditor; systemic applications must show therapeutic index viability within < 10,000 simulations and ≤ 100 patient profiles |
| Deduplication | Search clinicaltrials.gov, the compound's patent history, and public medical literature to confirm not already patented by others or already tested and failed officially |
| Amplification | The therapeutic effect must exceed the baseline of a generic placebo or standard-of-care treatment |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent pathways or AI-hallucinated binding affinities
- Impact description contradicts the dossier's own analysis
- Protocol simulates efficacy by ignoring known pharmacokinetic barriers (e.g., blood-brain barrier)
- Pharmacological references inconsistent with the latest reference databases
- Protocol is incomplete and requires the clinical_auditor to manually assemble the testing methodology
- Therapeutic effect is equivalent to standard-of-care baseline, with no significant improvement
</f6>

<f7>
When you finish, briefly report to the pipeline_controller what you did.
</f7>

<f8>
You are participating in a drug repurposing research initiative targeting novel off-label therapeutic applications while screening for toxicological dead-ends.

Read the research guidelines first: ./research-guidelines.md
</f8>

<f9>
This pharmacological library has been extensively studied for many years — any obvious secondary indications would have been commercialized long ago. So:

- Don't report applications that are obvious at a glance (e.g. "this NSAID reduces inflammation") — if it were that obvious, pharmaceutical companies would have patented it themselves
- Truly valuable novel applications hide in non-obvious receptor interactions, metabolic pathway overlaps, and tissue-specific secondary targets

**Writing the dossier**

Each hypothesis corresponds to its own dossier file at `dossiers/{id}-{slug}.md`, where `{id}` and `{slug}` come from the hypothesis's id and slug attributes in hypotheses.xml.

The dossier must contain four h2 sections in this fixed order:

- `## Dossier Title` — concise, clear therapeutic application title
- `## Impact Description` — what patient benefit it provides (disease progression halt, symptomatic relief, biomarker normalization, etc.)
- `## Short Description` — short writeup of the proposed mechanism of action, with pathway/receptor references
- `## Preclinical Evidence Details` — an in-silico or in-vitro modeling protocol the clinical_auditor can evaluate to verify the application

Do not modify or delete the `## Audit` section — the clinical_auditor overwrites that themselves.

If after investigation you find the hypothesis doesn't hold due to a toxicological dead-end, still briefly record your analysis and the reason for rejection in the dossier file.
</f9>

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. `# pipeline_controller`). Output only the headered prompts, no preamble.


I need you to set up a 3-agent pipeline for an investigative journalism project: assignment_desk_chief, investigative_reporter, and defamation_counsel.

- **assignment_desk_chief** orchestrates: each round it selects which story idea to pursue next, calls the investigative_reporter on that idea, extracts the exposé draft file path from the investigative_reporter's reply, then calls the defamation_counsel on that path, decrements a counter, and loops. Does no analysis itself.
- **investigative_reporter** explores corporate document leaks for the idea it is given, writes an exposé draft, and records any new malfeasance angles it notices along the way.
- **defamation_counsel** evaluates the draft against libel risks and editorial standards, and persists the verdict.

I'm providing the following information:

<f1>
When you finish, briefly report to the assignment_desk_chief what you did.
</f1>

<f2>
Each round, before calling the investigative_reporter, read ideas.xml and select which idea the investigative_reporter should work on:

1. Every idea carries an `attempts` count and a counsel `score` (0-10). `score="0"` means the idea is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer ideas with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected idea to the investigative_reporter. If ideas.xml holds no workable idea, call the investigative_reporter with none and let it explore the documents and surface fresh ones.
</f2>

<f3>
While exploring the corporate documents, the moment you spot any potential new malfeasance angle — even if you are unsure it holds — immediately append it to ideas.xml (`score="none"`, `attempts="0"`). Don't wait until the investigation is finished to batch-record, and don't judge feasibility before recording. Recording an idea is not a commitment to publish it; it just keeps the lead from being forgotten. Whether it ever gets investigated is decided later, when the next idea is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the draft file's Legal Review section

At the end of the draft file, write or overwrite the `## Legal Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Legal Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Jurisdiction | pass/fail | ... |
| Source citations | pass/fail | ... |
| Impact description | pass/fail | ... |
| Factual basis | pass/fail | ... |
| Evidence trail | pass/fail | ... |
| Verifiability | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Severity | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the draft needs changes. If the idea doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the idea's status in ideas.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the investigate → draft → review → improve loop: each round, select the next idea, then alternate calls to the investigative_reporter and defamation_counsel agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next idea, then call the investigative_reporter agent with it.
    2. Parse investigative_reporter's reply and extract the draft file path.
    3. If a draft path is present, call the defamation_counsel agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the counsel was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct ideas were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze documents, write drafts, or do legal reviews yourself — delegate everything to the two sub-agents.
- If investigative_reporter or defamation_counsel errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- investigative_reporter and defamation_counsel each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`ideas.xml`, `drafts/`, `counter.txt`).
- You don't need to understand any corporate fraud — just pass file paths correctly.
</f5>

<f6>
You are participating in a high-stakes investigative journalism project focused on exposing corporate malfeasance.

Read the editorial and legal guidelines first: ./editorial-guidelines.md
</f6>

<f7>
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.
</f7>

<f8>
This corporation has been heavily scrutinized by regulators for many years — any obvious, overt fraud would have been prosecuted long ago. So:

- Don't report on superficial rumors (e.g. "an executive was rude in an email") — if it were that obvious, mainstream media would have run it already.
- Truly valuable exposés hide in non-obvious paper trails, shell companies, subtle accounting discrepancies, and boundary conditions of corporate law.

**Writing the draft**

Each idea corresponds to its own draft file at `drafts/{id}-{slug}.md`, where `{id}` and `{slug}` come from the idea's id and slug attributes in ideas.xml.

The draft must contain four h2 sections in this fixed order:

- `## Headline` — concise, hard-hitting title of the exposé
- `## Public Impact` — what damage the malfeasance causes (consumer harm, environmental disaster, market manipulation, etc.)
- `## Executive Summary` — short writeup of what's wrong, with specific document/email references
- `## Evidence Trail` — a step-by-step verifiable paper trail the counsel can review as-is to see the definitive proof

Do not modify or delete the `## Legal Review` section — the defamation_counsel overwrites that themselves.

If after investigation you find the idea doesn't hold, still briefly record your analysis and the reason for rejection in the draft file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Jurisdiction | Within the scope of actionable corporate malfeasance, or outside but directly affecting regulatory liability |
| Source citations | Cited documents, emails, quotes, and page numbers must exactly match the provided corporate document leak |
| Impact description | Public harm claim consistent with the draft's own evidence, no self-contradiction, no exaggeration |
| Factual basis | Pinpoint specific documents and explain exactly how they demonstrate malfeasance |
| Evidence trail | Step-by-step documentation proving the claims from an objective standpoint (must not rely on external hearsay to bridge gaps) |
| Verifiability | Evidence trail stands up strictly to legal scrutiny without the counsel having to manually assemble missing links; major claims must be verifiable within the provided primary sources |
| Deduplication | Search previous news coverage, court filings, and press releases to confirm not already reported by others or publicly disclosed by the corporation |
| Severity | The malfeasance must exceed the baseline of "routine corporate inefficiency or minor fines" |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent documents or AI-hallucinated quotes
- Impact description contradicts the draft's own analysis
- Evidence trail simulates the malfeasance using fabricated or external hearsay
- Source citations inconsistent with the provided corporate document leak
- Evidence trail is incomplete and requires the counsel to manually assemble the proof
- Malfeasance effect is equivalent to routine corporate inefficiency, with no severity or public harm
</f9>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (assignment_desk_chief, investigative_reporter, defamation_counsel), which items should go in its prompt? Respond with a JSON object like {"assignment_desk_chief": ["f?"], "investigative_reporter": ["f?"], "defamation_counsel": ["f?"]}. No other output.

I need you to set up a 3-agent pipeline for an investigative journalism project: assignment_desk_chief, investigative_reporter, and defamation_counsel.

- **assignment_desk_chief** orchestrates: each round it selects which story idea to pursue next, calls the investigative_reporter on that idea, extracts the exposé draft file path from the investigative_reporter's reply, then calls the defamation_counsel on that path, decrements a counter, and loops. Does no analysis itself.
- **investigative_reporter** explores corporate document leaks for the idea it is given, writes an exposé draft, and records any new malfeasance angles it notices along the way.
- **defamation_counsel** evaluates the draft against libel risks and editorial standards, and persists the verdict.

I'm providing the following prompt fragments:

<f1>
When you finish, briefly report to the assignment_desk_chief what you did.
</f1>

<f2>
Each round, before calling the investigative_reporter, read ideas.xml and select which idea the investigative_reporter should work on:

1. Every idea carries an `attempts` count and a counsel `score` (0-10). `score="0"` means the idea is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer ideas with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected idea to the investigative_reporter. If ideas.xml holds no workable idea, call the investigative_reporter with none and let it explore the documents and surface fresh ones.
</f2>

<f3>
While exploring the corporate documents, the moment you spot any potential new malfeasance angle — even if you are unsure it holds — immediately append it to ideas.xml (`score="none"`, `attempts="0"`). Don't wait until the investigation is finished to batch-record, and don't judge feasibility before recording. Recording an idea is not a commitment to publish it; it just keeps the lead from being forgotten. Whether it ever gets investigated is decided later, when the next idea is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the draft file's Legal Review section

At the end of the draft file, write or overwrite the `## Legal Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Legal Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Jurisdiction | pass/fail | ... |
| Source citations | pass/fail | ... |
| Impact description | pass/fail | ... |
| Factual basis | pass/fail | ... |
| Evidence trail | pass/fail | ... |
| Verifiability | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Severity | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the draft needs changes. If the idea doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the idea's status in ideas.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the investigate → draft → review → improve loop: each round, select the next idea, then alternate calls to the investigative_reporter and defamation_counsel agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next idea, then call the investigative_reporter agent with it.
    2. Parse investigative_reporter's reply and extract the draft file path.
    3. If a draft path is present, call the defamation_counsel agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the counsel was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct ideas were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze documents, write drafts, or do legal reviews yourself — delegate everything to the two sub-agents.
- If investigative_reporter or defamation_counsel errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- investigative_reporter and defamation_counsel each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`ideas.xml`, `drafts/`, `counter.txt`).
- You don't need to understand any corporate fraud — just pass file paths correctly.
</f5>

<f6>
You are participating in a high-stakes investigative journalism project focused on exposing corporate malfeasance.

Read the editorial and legal guidelines first: ./editorial-guidelines.md
</f6>

<f7>
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.
</f7>

<f8>
This corporation has been heavily scrutinized by regulators for many years — any obvious, overt fraud would have been prosecuted long ago. So:

- Don't report on superficial rumors (e.g. "an executive was rude in an email") — if it were that obvious, mainstream media would have run it already.
- Truly valuable exposés hide in non-obvious paper trails, shell companies, subtle accounting discrepancies, and boundary conditions of corporate law.

**Writing the draft**

Each idea corresponds to its own draft file at `drafts/{id}-{slug}.md`, where `{id}` and `{slug}` come from the idea's id and slug attributes in ideas.xml.

The draft must contain four h2 sections in this fixed order:

- `## Headline` — concise, hard-hitting title of the exposé
- `## Public Impact` — what damage the malfeasance causes (consumer harm, environmental disaster, market manipulation, etc.)
- `## Executive Summary` — short writeup of what's wrong, with specific document/email references
- `## Evidence Trail` — a step-by-step verifiable paper trail the counsel can review as-is to see the definitive proof

Do not modify or delete the `## Legal Review` section — the defamation_counsel overwrites that themselves.

If after investigation you find the idea doesn't hold, still briefly record your analysis and the reason for rejection in the draft file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Jurisdiction | Within the scope of actionable corporate malfeasance, or outside but directly affecting regulatory liability |
| Source citations | Cited documents, emails, quotes, and page numbers must exactly match the provided corporate document leak |
| Impact description | Public harm claim consistent with the draft's own evidence, no self-contradiction, no exaggeration |
| Factual basis | Pinpoint specific documents and explain exactly how they demonstrate malfeasance |
| Evidence trail | Step-by-step documentation proving the claims from an objective standpoint (must not rely on external hearsay to bridge gaps) |
| Verifiability | Evidence trail stands up strictly to legal scrutiny without the counsel having to manually assemble missing links; major claims must be verifiable within the provided primary sources |
| Deduplication | Search previous news coverage, court filings, and press releases to confirm not already reported by others or publicly disclosed by the corporation |
| Severity | The malfeasance must exceed the baseline of "routine corporate inefficiency or minor fines" |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent documents or AI-hallucinated quotes
- Impact description contradicts the draft's own analysis
- Evidence trail simulates the malfeasance using fabricated or external hearsay
- Source citations inconsistent with the provided corporate document leak
- Evidence trail is incomplete and requires the counsel to manually assemble the proof
- Malfeasance effect is equivalent to routine corporate inefficiency, with no severity or public harm
</f9>

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. `# assignment_desk_chief`). Output only the headered prompts, no preamble.


I need you to set up a 3-agent pipeline for an investigative journalism project: assignment_desk_chief, investigative_reporter, and defamation_counsel.

- **assignment_desk_chief** orchestrates: each round it selects which story idea to pursue next, calls the investigative_reporter on that idea, extracts the exposé draft file path from the investigative_reporter's reply, then calls the defamation_counsel on that path, decrements a counter, and loops. Does no analysis itself.
- **investigative_reporter** explores corporate document leaks for the idea it is given, writes an exposé draft, and records any new malfeasance angles it notices along the way.
- **defamation_counsel** evaluates the draft against libel risks and editorial standards, and persists the verdict.

I'm providing the following information:

<f1>
You drive the investigate → draft → review → improve loop: each round, select the next idea, then alternate calls to the investigative_reporter and defamation_counsel agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next idea, then call the investigative_reporter agent with it.
    2. Parse investigative_reporter's reply and extract the draft file path.
    3. If a draft path is present, call the defamation_counsel agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the counsel was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct ideas were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze documents, write drafts, or do legal reviews yourself — delegate everything to the two sub-agents.
- If investigative_reporter or defamation_counsel errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- investigative_reporter and defamation_counsel each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`ideas.xml`, `drafts/`, `counter.txt`).
- You don't need to understand any corporate fraud — just pass file paths correctly.
</f1>

<f2>
Each round, before calling the investigative_reporter, read ideas.xml and select which idea the investigative_reporter should work on:

1. Every idea carries an `attempts` count and a counsel `score` (0-10). `score="0"` means the idea is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer ideas with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected idea to the investigative_reporter. If ideas.xml holds no workable idea, call the investigative_reporter with none and let it explore the documents and surface fresh ones.
</f2>

<f3>
While exploring the corporate documents, the moment you spot any potential new malfeasance angle — even if you are unsure it holds — immediately append it to ideas.xml (`score="none"`, `attempts="0"`). Don't wait until the investigation is finished to batch-record, and don't judge feasibility before recording. Recording an idea is not a commitment to publish it; it just keeps the lead from being forgotten. Whether it ever gets investigated is decided later, when the next idea is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the draft file's Legal Review section

At the end of the draft file, write or overwrite the `## Legal Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Legal Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Jurisdiction | pass/fail | ... |
| Source citations | pass/fail | ... |
| Impact description | pass/fail | ... |
| Factual basis | pass/fail | ... |
| Evidence trail | pass/fail | ... |
| Verifiability | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Severity | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the draft needs changes. If the idea doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the idea's status in ideas.xml: increment attempts by 1, then update score.
</f4>

<f5>
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">`).
</f5>

<f6>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Jurisdiction | Within the scope of actionable corporate malfeasance, or outside but directly affecting regulatory liability |
| Source citations | Cited documents, emails, quotes, and page numbers must exactly match the provided corporate document leak |
| Impact description | Public harm claim consistent with the draft's own evidence, no self-contradiction, no exaggeration |
| Factual basis | Pinpoint specific documents and explain exactly how they demonstrate malfeasance |
| Evidence trail | Step-by-step documentation proving the claims from an objective standpoint (must not rely on external hearsay to bridge gaps) |
| Verifiability | Evidence trail stands up strictly to legal scrutiny without the counsel having to manually assemble missing links; major claims must be verifiable within the provided primary sources |
| Deduplication | Search previous news coverage, court filings, and press releases to confirm not already reported by others or publicly disclosed by the corporation |
| Severity | The malfeasance must exceed the baseline of "routine corporate inefficiency or minor fines" |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent documents or AI-hallucinated quotes
- Impact description contradicts the draft's own analysis
- Evidence trail simulates the malfeasance using fabricated or external hearsay
- Source citations inconsistent with the provided corporate document leak
- Evidence trail is incomplete and requires the counsel to manually assemble the proof
- Malfeasance effect is equivalent to routine corporate inefficiency, with no severity or public harm
</f6>

<f7>
When you finish, briefly report to the assignment_desk_chief what you did.
</f7>

<f8>
You are participating in a high-stakes investigative journalism project focused on exposing corporate malfeasance.

Read the editorial and legal guidelines first: ./editorial-guidelines.md
</f8>

<f9>
This corporation has been heavily scrutinized by regulators for many years — any obvious, overt fraud would have been prosecuted long ago. So:

- Don't report on superficial rumors (e.g. "an executive was rude in an email") — if it were that obvious, mainstream media would have run it already.
- Truly valuable exposés hide in non-obvious paper trails, shell companies, subtle accounting discrepancies, and boundary conditions of corporate law.

**Writing the draft**

Each idea corresponds to its own draft file at `drafts/{id}-{slug}.md`, where `{id}` and `{slug}` come from the idea's id and slug attributes in ideas.xml.

The draft must contain four h2 sections in this fixed order:

- `## Headline` — concise, hard-hitting title of the exposé
- `## Public Impact` — what damage the malfeasance causes (consumer harm, environmental disaster, market manipulation, etc.)
- `## Executive Summary` — short writeup of what's wrong, with specific document/email references
- `## Evidence Trail` — a step-by-step verifiable paper trail the counsel can review as-is to see the definitive proof

Do not modify or delete the `## Legal Review` section — the defamation_counsel overwrites that themselves.

If after investigation you find the idea doesn't hold, still briefly record your analysis and the reason for rejection in the draft file.
</f9>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (assignment_desk_chief, investigative_reporter, defamation_counsel), which items should go in its prompt? Respond with a JSON object like {"assignment_desk_chief": ["f?"], "investigative_reporter": ["f?"], "defamation_counsel": ["f?"]}. No other output.

I need you to set up a 3-agent pipeline for an investigative journalism project: assignment_desk_chief, investigative_reporter, and defamation_counsel.

- **assignment_desk_chief** orchestrates: each round it selects which story idea to pursue next, calls the investigative_reporter on that idea, extracts the exposé draft file path from the investigative_reporter's reply, then calls the defamation_counsel on that path, decrements a counter, and loops. Does no analysis itself.
- **investigative_reporter** explores corporate document leaks for the idea it is given, writes an exposé draft, and records any new malfeasance angles it notices along the way.
- **defamation_counsel** evaluates the draft against libel risks and editorial standards, and persists the verdict.

I'm providing the following prompt fragments:

<f1>
You drive the investigate → draft → review → improve loop: each round, select the next idea, then alternate calls to the investigative_reporter and defamation_counsel agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next idea, then call the investigative_reporter agent with it.
    2. Parse investigative_reporter's reply and extract the draft file path.
    3. If a draft path is present, call the defamation_counsel agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the counsel was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct ideas were explored, and any anomalies encountered.

**Calling rules**

- Do **not** analyze documents, write drafts, or do legal reviews yourself — delegate everything to the two sub-agents.
- If investigative_reporter or defamation_counsel errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- investigative_reporter and defamation_counsel each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`ideas.xml`, `drafts/`, `counter.txt`).
- You don't need to understand any corporate fraud — just pass file paths correctly.
</f1>

<f2>
Each round, before calling the investigative_reporter, read ideas.xml and select which idea the investigative_reporter should work on:

1. Every idea carries an `attempts` count and a counsel `score` (0-10). `score="0"` means the idea is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer ideas with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected idea to the investigative_reporter. If ideas.xml holds no workable idea, call the investigative_reporter with none and let it explore the documents and surface fresh ones.
</f2>

<f3>
While exploring the corporate documents, the moment you spot any potential new malfeasance angle — even if you are unsure it holds — immediately append it to ideas.xml (`score="none"`, `attempts="0"`). Don't wait until the investigation is finished to batch-record, and don't judge feasibility before recording. Recording an idea is not a commitment to publish it; it just keeps the lead from being forgotten. Whether it ever gets investigated is decided later, when the next idea is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the draft file's Legal Review section

At the end of the draft file, write or overwrite the `## Legal Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Legal Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Jurisdiction | pass/fail | ... |
| Source citations | pass/fail | ... |
| Impact description | pass/fail | ... |
| Factual basis | pass/fail | ... |
| Evidence trail | pass/fail | ... |
| Verifiability | pass/fail | ... |
| Deduplication | pass/fail | ... |
| Severity | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the draft needs changes. If the idea doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the idea's status in ideas.xml: increment attempts by 1, then update score.
</f4>

<f5>
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">`).
</f5>

<f6>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Jurisdiction | Within the scope of actionable corporate malfeasance, or outside but directly affecting regulatory liability |
| Source citations | Cited documents, emails, quotes, and page numbers must exactly match the provided corporate document leak |
| Impact description | Public harm claim consistent with the draft's own evidence, no self-contradiction, no exaggeration |
| Factual basis | Pinpoint specific documents and explain exactly how they demonstrate malfeasance |
| Evidence trail | Step-by-step documentation proving the claims from an objective standpoint (must not rely on external hearsay to bridge gaps) |
| Verifiability | Evidence trail stands up strictly to legal scrutiny without the counsel having to manually assemble missing links; major claims must be verifiable within the provided primary sources |
| Deduplication | Search previous news coverage, court filings, and press releases to confirm not already reported by others or publicly disclosed by the corporation |
| Severity | The malfeasance must exceed the baseline of "routine corporate inefficiency or minor fines" |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent documents or AI-hallucinated quotes
- Impact description contradicts the draft's own analysis
- Evidence trail simulates the malfeasance using fabricated or external hearsay
- Source citations inconsistent with the provided corporate document leak
- Evidence trail is incomplete and requires the counsel to manually assemble the proof
- Malfeasance effect is equivalent to routine corporate inefficiency, with no severity or public harm
</f6>

<f7>
When you finish, briefly report to the assignment_desk_chief what you did.
</f7>

<f8>
You are participating in a high-stakes investigative journalism project focused on exposing corporate malfeasance.

Read the editorial and legal guidelines first: ./editorial-guidelines.md
</f8>

<f9>
This corporation has been heavily scrutinized by regulators for many years — any obvious, overt fraud would have been prosecuted long ago. So:

- Don't report on superficial rumors (e.g. "an executive was rude in an email") — if it were that obvious, mainstream media would have run it already.
- Truly valuable exposés hide in non-obvious paper trails, shell companies, subtle accounting discrepancies, and boundary conditions of corporate law.

**Writing the draft**

Each idea corresponds to its own draft file at `drafts/{id}-{slug}.md`, where `{id}` and `{slug}` come from the idea's id and slug attributes in ideas.xml.

The draft must contain four h2 sections in this fixed order:

- `## Headline` — concise, hard-hitting title of the exposé
- `## Public Impact` — what damage the malfeasance causes (consumer harm, environmental disaster, market manipulation, etc.)
- `## Executive Summary` — short writeup of what's wrong, with specific document/email references
- `## Evidence Trail` — a step-by-step verifiable paper trail the counsel can review as-is to see the definitive proof

Do not modify or delete the `## Legal Review` section — the defamation_counsel overwrites that themselves.

If after investigation you find the idea doesn't hold, still briefly record your analysis and the reason for rejection in the draft file.
</f9>

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. `# assignment_desk_chief`). Output only the headered prompts, no preamble.


signal coordinator
pharmacovigilance analyst
regulatory safety reviewer

I need you to set up a 3-agent pipeline for pharmaceutical clinical-trial safety signal assessment: signal coordinator, pharmacovigilance analyst, and regulatory safety reviewer.

- **signal coordinator** orchestrates: each round it selects which candidate adverse-event signal to assess next, calls the pharmacovigilance analyst on that signal, extracts the assessment report file path from the pharmacovigilance analyst's reply, then calls the regulatory safety reviewer on that path, decrements a counter, and loops. Does no medical or statistical analysis itself.
- **pharmacovigilance analyst** examines the clinical-trial safety materials for the signal it is given, writes an assessment report file, and records any new potential adverse-event signals it notices along the way.
- **regulatory safety reviewer** evaluates the assessment report against FDA-style safety-review criteria and persists the verdict.

I'm providing the following information:

<f1>
When you finish, briefly report to the signal coordinator what you did.
</f1>

<f2>
Each round, before calling the pharmacovigilance analyst, read signals.xml and select which candidate signal the pharmacovigilance analyst should work on:

1. Every candidate signal carries an `attempts` count and a regulatory safety reviewer `score` (0-10). `score="0"` means the signal is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer candidate signals with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected candidate signal to the pharmacovigilance analyst. If signals.xml holds no workable signal, call the pharmacovigilance analyst with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring the clinical-trial safety materials, the moment you spot any potential new adverse-event signal — even if you are unsure it holds — immediately append it to signals.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility before recording. Recording a signal is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next candidate signal is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the assessment report file's Review section

At the end of the assessment report file, write or overwrite the `## Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Data references | pass/fail | ... |
| Safety impact description | pass/fail | ... |
| Causality analysis | pass/fail | ... |
| Evidence package | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Prior knowledge and duplication | pass/fail | ... |
| Clinical amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the assessment report needs changes. If the candidate signal doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the signal's status in signals.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the select → assess → review → improve loop: each round, select the next candidate signal, then alternate calls to the pharmacovigilance analyst and regulatory safety reviewer agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next candidate signal, then call the pharmacovigilance analyst agent with it.
    2. Parse pharmacovigilance analyst's reply and extract the assessment report file path.
    3. If a report path is present, call the regulatory safety reviewer agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the regulatory safety reviewer was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct candidate signals were assessed, and any anomalies encountered.

**Calling rules**

- Do **not** analyze clinical data, write assessment reports, or do safety reviews yourself — delegate everything to the two sub-agents.
- If pharmacovigilance analyst or regulatory safety reviewer errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- pharmacovigilance analyst and regulatory safety reviewer each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`signals.xml`, `signal-reports/`, `counter.txt`).
- You don't need to understand any safety signals — just pass file paths correctly.
</f5>

<f6>
You are participating in a blinded-but-operational pharmaceutical clinical-trial safety signal assessment exercise for an investigational therapy.

Read the assessment charter first: ./safety-assessment-charter.md
</f6>

<f7>
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.
</f7>

<f8>
This development program has already been monitored through routine clinical safety review for multiple study milestones — any obvious imbalance or trivial coding error would likely have been noticed already. So:

- Don't escalate observations that are obvious at a glance without clinical relevance (e.g. "one mild headache appears in the active arm") — if it were that simple, the study team would already have handled it through routine safety surveillance
- Truly valuable safety signals hide in non-obvious patterns: timing after exposure, dose relationship, seriousness gradients, recurrence on rechallenge, related lab/vital-sign shifts, subgroup concentration, or confounding that has not been adequately ruled out

**Writing the assessment report**

Each candidate signal corresponds to its own report file at `signal-reports/{id}-{slug}.md`, where `{id}` and `{slug}` come from the signal's id and slug attributes in signals.xml.

The report must contain four h2 sections in this fixed order:

- `## Signal Title` — concise, clear adverse-event signal title
- `## Potential Safety Impact` — what risk it may imply for participants, labeling, monitoring, dose modification, enrollment, or trial continuation
- `## Short Assessment` — short writeup of the evidence, with dataset/table/listing references and relevant subject-level details
- `## Evidence Details` — reproducible analysis steps, queries, tables, or code snippets the regulatory safety reviewer can run or inspect as-is to evaluate the signal

Do not modify or delete the `## Review` section — the regulatory safety reviewer overwrites that themselves.

If after investigation you find the candidate signal doesn't hold, still briefly record your analysis and the reason for rejection in the report file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within clinical-trial safety data for the investigational product, or outside core safety tables but directly affecting safety interpretation |
| Data references | Cited datasets, tables, listings, variable names, subject IDs, visit windows, and derivations must exactly match the current locked safety-review package |
| Safety impact description | Safety concern consistent with the report's own evidence, no self-contradiction, no exaggeration beyond observed clinical significance |
| Causality analysis | Pinpoint specific evidence supporting or weakening causality: temporality, dechallenge/rechallenge, biological plausibility, dose relationship, alternative etiologies, and concomitant medications |
| Evidence package | End-to-end analysis from the safety reviewer’s perspective, using available clinical datasets or listings without altering source data to manufacture an effect |
| Reproducibility | Analysis runs or can be independently verified without manual reconstruction by the regulatory safety reviewer; denominators, exposure windows, seriousness criteria, and MedDRA coding levels must be explicit |
| Prior knowledge and duplication | Search the investigator brochure, protocol safety sections, DSUR/IB updates, prior safety review memos, medical-monitor notes, and public labeling/literature to confirm whether the signal is already known, already adjudicated, or already mitigated |
| Clinical amplification | The observed pattern must exceed the baseline of nonspecific background adverse events expected in this population and study design |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent datasets, tables, variables, subject IDs, or AI-hallucinated clinical terms
- Safety impact description contradicts the report's own evidence
- Analysis simulates the signal by modifying source data or changing derivations without justification
- Data references inconsistent with the current locked safety-review package
- Evidence package is incomplete and requires the regulatory safety reviewer to manually assemble denominators, exposure windows, or subject narratives
- Observed effect is equivalent to nonspecific background noise, with no clinical or statistical amplification
</f9>

Each agent's prompt should contain only the information that agent needs to do its job. For each sub-agent (signal coordinator, pharmacovigilance analyst, regulatory safety reviewer), which items should go in its prompt? Respond with a JSON object like {"signal coordinator": ["f?"], "pharmacovigilance analyst": ["f?"], "regulatory safety reviewer": ["f?"]}. No other output.

I need you to set up a 3-agent pipeline for pharmaceutical clinical-trial safety signal assessment: signal coordinator, pharmacovigilance analyst, and regulatory safety reviewer.

- **signal coordinator** orchestrates: each round it selects which candidate adverse-event signal to assess next, calls the pharmacovigilance analyst on that signal, extracts the assessment report file path from the pharmacovigilance analyst's reply, then calls the regulatory safety reviewer on that path, decrements a counter, and loops. Does no medical or statistical analysis itself.
- **pharmacovigilance analyst** examines the clinical-trial safety materials for the signal it is given, writes an assessment report file, and records any new potential adverse-event signals it notices along the way.
- **regulatory safety reviewer** evaluates the assessment report against FDA-style safety-review criteria and persists the verdict.

I'm providing the following prompt fragments:

<f1>
When you finish, briefly report to the signal coordinator what you did.
</f1>

<f2>
Each round, before calling the pharmacovigilance analyst, read signals.xml and select which candidate signal the pharmacovigilance analyst should work on:

1. Every candidate signal carries an `attempts` count and a regulatory safety reviewer `score` (0-10). `score="0"` means the signal is dead — never select it again. `score="none"` means it has not been attempted yet.
2. Prefer candidate signals with `attempts="0"` and `score="none"` first.
3. Otherwise rank by UCB value: `UCB = score + 10 × √(ln(N) / attempts)`, where N is the sum of all attempts; a higher score with fewer attempts ranks first.
4. Pass the selected candidate signal to the pharmacovigilance analyst. If signals.xml holds no workable signal, call the pharmacovigilance analyst with none and let it explore and surface fresh ones.
</f2>

<f3>
While exploring the clinical-trial safety materials, the moment you spot any potential new adverse-event signal — even if you are unsure it holds — immediately append it to signals.xml (`score="none"`, `attempts="0"`). Don't wait until exploration is finished to batch-record, and don't judge feasibility before recording. Recording a signal is not a commitment to pursue it; it just keeps the lead from being forgotten. Whether it ever gets worked on is decided later, when the next candidate signal is selected.
</f3>

<f4>
After completing the review, you must do two things:

1. Update the assessment report file's Review section

At the end of the assessment report file, write or overwrite the `## Review` section (always keep exactly one; replace it if it already exists). Follow this structure:

```
## Review

**Score: X/10** (one-sentence reason)

### Fatal flaws (if any)
- 🔴 ...

### Per-dimension review

| Dimension | Verdict | Notes |
|-----------|---------|-------|
| Scope | pass/fail | ... |
| Data references | pass/fail | ... |
| Safety impact description | pass/fail | ... |
| Causality analysis | pass/fail | ... |
| Evidence package | pass/fail | ... |
| Reproducibility | pass/fail | ... |
| Prior knowledge and duplication | pass/fail | ... |
| Clinical amplification | pass/fail | ... |

### Improvement suggestions
Be precise about which part of the assessment report needs changes. If the candidate signal doesn't hold at all, explicitly recommend abandoning it.
```

2. Update the signal's status in signals.xml: increment attempts by 1, then update score.
</f4>

<f5>
You drive the select → assess → review → improve loop: each round, select the next candidate signal, then alternate calls to the pharmacovigilance analyst and regulatory safety reviewer agents.

Read the remaining-round count from `counter.txt`. If the file doesn't exist or the count ≤ 0, print "rounds exhausted" and stop.

Loop:

```
while counter > 0:
    1. Select the next candidate signal, then call the pharmacovigilance analyst agent with it.
    2. Parse pharmacovigilance analyst's reply and extract the assessment report file path.
    3. If a report path is present, call the regulatory safety reviewer agent with prompt: "Please review {path}".
    4. Decrement counter and write the new value back to counter.txt (whether or not the regulatory safety reviewer was called).
    5. Loop back to step 1.
```

After the loop, summarize: how many rounds ran, how many distinct candidate signals were assessed, and any anomalies encountered.

**Calling rules**

- Do **not** analyze clinical data, write assessment reports, or do safety reviews yourself — delegate everything to the two sub-agents.
- If pharmacovigilance analyst or regulatory safety reviewer errors out, append the error to `error-log.txt` (format: timestamp + agent name + error content), then continue with the next round.

Notes:
- pharmacovigilance analyst and regulatory safety reviewer each run in independent context per round; they do not pollute each other.
- All persistent state moves through files (`signals.xml`, `signal-reports/`, `counter.txt`).
- You don't need to understand any safety signals — just pass file paths correctly.
</f5>

<f6>
You are participating in a blinded-but-operational pharmaceutical clinical-trial safety signal assessment exercise for an investigational therapy.

Read the assessment charter first: ./safety-assessment-charter.md
</f6>

<f7>
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.
</f7>

<f8>
This development program has already been monitored through routine clinical safety review for multiple study milestones — any obvious imbalance or trivial coding error would likely have been noticed already. So:

- Don't escalate observations that are obvious at a glance without clinical relevance (e.g. "one mild headache appears in the active arm") — if it were that simple, the study team would already have handled it through routine safety surveillance
- Truly valuable safety signals hide in non-obvious patterns: timing after exposure, dose relationship, seriousness gradients, recurrence on rechallenge, related lab/vital-sign shifts, subgroup concentration, or confounding that has not been adequately ruled out

**Writing the assessment report**

Each candidate signal corresponds to its own report file at `signal-reports/{id}-{slug}.md`, where `{id}` and `{slug}` come from the signal's id and slug attributes in signals.xml.

The report must contain four h2 sections in this fixed order:

- `## Signal Title` — concise, clear adverse-event signal title
- `## Potential Safety Impact` — what risk it may imply for participants, labeling, monitoring, dose modification, enrollment, or trial continuation
- `## Short Assessment` — short writeup of the evidence, with dataset/table/listing references and relevant subject-level details
- `## Evidence Details` — reproducible analysis steps, queries, tables, or code snippets the regulatory safety reviewer can run or inspect as-is to evaluate the signal

Do not modify or delete the `## Review` section — the regulatory safety reviewer overwrites that themselves.

If after investigation you find the candidate signal doesn't hold, still briefly record your analysis and the reason for rejection in the report file.
</f8>

<f9>
Check the following dimensions one by one:

| Dimension | Requirement |
|-----------|-------------|
| Scope | Within clinical-trial safety data for the investigational product, or outside core safety tables but directly affecting safety interpretation |
| Data references | Cited datasets, tables, listings, variable names, subject IDs, visit windows, and derivations must exactly match the current locked safety-review package |
| Safety impact description | Safety concern consistent with the report's own evidence, no self-contradiction, no exaggeration beyond observed clinical significance |
| Causality analysis | Pinpoint specific evidence supporting or weakening causality: temporality, dechallenge/rechallenge, biological plausibility, dose relationship, alternative etiologies, and concomitant medications |
| Evidence package | End-to-end analysis from the safety reviewer’s perspective, using available clinical datasets or listings without altering source data to manufacture an effect |
| Reproducibility | Analysis runs or can be independently verified without manual reconstruction by the regulatory safety reviewer; denominators, exposure windows, seriousness criteria, and MedDRA coding levels must be explicit |
| Prior knowledge and duplication | Search the investigator brochure, protocol safety sections, DSUR/IB updates, prior safety review memos, medical-monitor notes, and public labeling/literature to confirm whether the signal is already known, already adjudicated, or already mitigated |
| Clinical amplification | The observed pattern must exceed the baseline of nonspecific background adverse events expected in this population and study design |

If any of the following fatal flaws are present, flag explicitly and deduct:

- References to nonexistent datasets, tables, variables, subject IDs, or AI-hallucinated clinical terms
- Safety impact description contradicts the report's own evidence
- Analysis simulates the signal by modifying source data or changing derivations without justification
- Data references inconsistent with the current locked safety-review package
- Evidence package is incomplete and requires the regulatory safety reviewer to manually assemble denominators, exposure windows, or subject narratives
- Observed effect is equivalent to nonspecific background noise, with no clinical or statistical amplification
</f9>

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. `# signal coordinator`). Output only the headered prompts, no preamble.