# PARALLEL DISPATCH RULES -- RAM Router

**Scope:** Scheduling rules for the 11 research disciplines and the per-phase parallelism the router permits. Specifies which components/phases run in true parallel, which run in conditional-parallel-subset mode, and how capacity-bound deferrals are handled without silent dropping.

**Non-negotiables this file enforces:**
- Multi-method default (>= 2 disciplines per claim; single-method is a closed-list exception).
- No discipline silently dropped under capacity pressure.
- Research Auditor is non-removable from every selected set.
- Parallel disciplines do NOT see each other's intermediate state.
- Warrant-based stopping (a deferred discipline means S6 does NOT stop on that claim).

**Double hyphens only (`--`).**

---

## 1. The 11 inherited disciplines

From the Librarian plugin, RAM inherits 11 research disciplines as callable methods:

1. systematic-review
2. scoping-review
3. realist-review
4. qualitative-synthesis
5. content-analysis
6. discourse-analysis
7. historiography
8. comparative-analysis
9. secondary-data-analysis
10. competitive-intelligence
11. research-auditor -- **non-removable meta-method; present in every baseline discipline set**

These are METHODS invoked per claim, not routes. The `DISCIPLINE_SELECTION_MATRIX.md` returns a SET of disciplines per claim based on claim-type x fitness-requirement x monoculture-flags.

---

## 2. True parallel vs conditional-parallel posture

Per Phase 2 architecture: the RAM orchestration is multi-method parallel dispatch with claim-level triangulation. Whether that is true 11-way parallel or conditional-parallel depends on runtime capacity.

**Default posture:** conditional-parallel. RAM never requires all 11 disciplines to run simultaneously on a single claim; it requires the matrix-selected SET to run, in parallel, up to a capacity ceiling K_disciplines, with deferred disciplines logged and carried into a follow-up pass. This is a commitment to multi-method invocation, not to maximum-simultaneity.

**Upgrade path:** if the runtime host supports higher parallelism, K_disciplines can be raised. RAM never degrades the commitment below K_disciplines = 2 (because that would collapse multi-method into single-method with Research Auditor).

---

## 3. Capacity ceilings (K parameters)

| Symbol | Meaning | Default | Lower bound | Upper bound |
|---|---|---|---|---|
| K_retrieval | Max claims whose S1 / S2 / S7 inner pipelines run in parallel | 4 | 1 | 8 |
| K_claims | Max claims whose S3 orchestration runs simultaneously | 4 | 1 | 8 |
| K_disciplines | Max disciplines in parallel per claim at S3 (and parallel inversion classes at S8) | 6 | 2 | 11 |
| K_adversarial | Max claims whose S8 adversarial pass runs in parallel | 4 | 1 | 8 |
| K_subinquiry_depth | Max recursion depth for contradiction-driven sub-inquiries | 2 | 2 | 2 |

Operator may override K_disciplines at the `/ram-research --k-disciplines <int>` argument. The command file rejects K_disciplines < 2.

Runtime may dynamically lower K values on load pressure. The router responds by scheduling deferred work into a follow-up dispatch cycle, NEVER by dropping.

---

## 4. Phase-level parallelism

### 4.1 Phase 1 -- Claim-Typing (S5)

**Parallelism:** none. S5 is sequential on the single question.

**Rationale:** S5 is the keystone; typing must be globally consistent across the claim set. Parallel typing of sub-questions would lose the stacked-intent invariant.

### 4.2 Phase 2 -- Retrieval / Integrity / Fitness (S1 / S2 / S7)

**Across claims:** parallel up to K_retrieval.

**Within a claim:**
- S1 dispatches queries in parallel across the four corpus surfaces (english-peer, non-english, practitioner, indigenous). The router ensures CARE gate runs PER RECORD, not just per corpus.
- S2 applies the three integrity screens in parallel per source (retraction / AI-contamination / publication-bias). The screens are independent.
- S7 scores (claim, source) pairs in parallel per source. S7 Step 8 (batch reconciliation of D3 lineage independence at set level) is the ONE serial checkpoint per claim before handoff to S3.

**Critical scheduling:**
- S1 -> S2 is per-record serial (S2 must screen a record before it enters S7 input).
- S2 -> S7 is per-record serial (S7 must consult S2 integrity flags).
- S1 -> S7 serially only in that S7 requires source records.
- Across records within a claim, the chain can run in parallel.

### 4.3 Phase 3 -- Multi-Method Orchestration (S3)

**Across claims:** parallel up to K_claims.

**Within a claim:** the selected discipline subset runs in parallel up to K_disciplines.

**Invariants:**
- Disciplines do NOT see each other's intermediate state. S3 dispatches each discipline against the SAME fitness-verified source set; no pipelining.
- Research Auditor is always in the set. If K_disciplines forces deferral, Research Auditor is NEVER the deferred discipline.
- If `|selected_set| > K_disciplines`: top-K by fitness-match score run first, remainder deferred with `CAPACITY_BOUND` ledger entry. Deferred disciplines run in a follow-up dispatch pass once capacity recovers.
- If `|selected_set| < 2` (would collapse to single method): halt. Either expand the set or file SINGLE_METHOD_EXCEPTION with closed-list trigger.

**Claim-level triangulation** happens AFTER all disciplines return (or are capacity-bound deferred with a PARTIAL_DISCIPLINE_COVERAGE flag).

### 4.4 Phase 4 -- Adversarial Pass (S8)

**Across claims:** parallel up to K_adversarial.

**Within a claim:** the four inversion classes (IC-1..IC-4) run in parallel up to K_disciplines (shared capacity ceiling).

**Overlap with Phase 3:** see Section 6.

**Invariants:**
- S8 adversarial queries go through S1 with `pass=adversarial` flag. S1 / S2 screens are NOT relaxed for adversarial-pass sources.
- Per-class saturation is computed per class per claim, not aggregate. A run-level "coverage average" is forbidden (per S8 Section 2).
- Meta-anomalies (unchallengeable claims) halt further S8 work on that claim and route to the Surprise Register.

### 4.5 Phase 5 -- Warrant (S6)

**Parallelism:** none at the S6 level. S6 is a single-skill gate.

**Internal parallelism within S6:** yield monitoring (Phase 2 of S6) and scope-drift detection (Phase 3 of S6) use the same input snapshot and can be computed in parallel (the skill permits this explicitly).

### 4.6 Phase 6 -- Output (S4)

**Parallelism:** S4 can render per-claim axes in parallel up to K_claims (axis computations are independent per claim). Surprise Register render and Search Ledger render are serial after all claim axes are computed.

---

## 5. Discipline-subset-selection matrix (semantic structure)

The authoritative matrix lives at `ram/references/orchestration/DISCIPLINE_SELECTION_MATRIX.md`. This file describes its structural properties as the router understands them.

### 5.1 Return type

The matrix ALWAYS returns a SET, never a single discipline.

### 5.2 Selection inputs (per claim)

- `claim_type` in {descriptive, causal, predictive, normative, interpretive, UNTYPABLE}.
- `fitness_requirements` (load-bearing properties, disqualifiers, discipline tags).
- `monoculture_flags`.
- `run_context.monoculture_risk` level.

### 5.3 Baseline sets (illustrative; matrix is authoritative)

| Claim type | Baseline set |
|---|---|
| Descriptive | {scoping-review, content-analysis, secondary-data-analysis, research-auditor} |
| Causal | {systematic-review, realist-review, secondary-data-analysis, research-auditor} |
| Predictive | {secondary-data-analysis, comparative-analysis, scoping-review, research-auditor} |
| Normative | {discourse-analysis, comparative-analysis, historiography, research-auditor} |
| Interpretive | {qualitative-synthesis, discourse-analysis, content-analysis, research-auditor} |

### 5.4 Overlays

- **Fitness-requirement overlay:** if load-bearing properties include `mechanism-context coupling` -> add realist-review; if `out-of-sample calibration history` -> add secondary-data-analysis; if `thickness + reflexivity` -> add qualitative-synthesis.
- **Debiasing overlay:** if `monoculture_risk: nontrivial` OR the claim touches non-Western / practitioner / non-English knowledge -> ensure historiography OR comparative-analysis is in the set.

### 5.5 Single-method exception protocol (closed allowed-trigger list)

Per `ram/skills/multi-method-orchestrator/references/SINGLE_METHOD_EXCEPTION_PROTOCOL.md`. The router enforces the closed list; the trigger rationales "most efficient," "best-fit," "obvious," "user preference," "time budget," "cost" are ALL REJECTED as invalid triggers.

The allowed triggers are narrow and load-bearing. The router MUST see one of them in the SINGLE_METHOD_EXCEPTION filing; otherwise the router declines and forces set expansion.

---

## 6. Phase 3 / Phase 4 overlap scheduling

Phase 3 (S3 orchestration) and Phase 4 (S8 adversarial pass) have a structural two-phase overlap:

### 6.1 S8 Phase A (skeptic frame identification) in parallel with S3

S8 Phase A (identify the authentic skeptic frame per claim) needs only:
- `claim_id`, `claim_type`, `claim_text`, `discipline_tags`.

None of these require S3's triangulation record. Therefore S8 Phase A can run in parallel with S3 Phase 3 (parallel invocation) and Phase 4 (claim-level triangulation).

**Scheduling:** router dispatches S8 Phase A concurrently with S3 per claim. If a claim's S8 Phase A surfaces a meta-anomaly (unchallengeable claim), the router writes the Surprise Register entry and allows S3 to complete for documentation but marks the claim's S8 state as `meta-anomaly` without running S8 Phase B onward.

### 6.2 S8 Phase B onward waits for S3's contradictions

S8 Phase B (authentic inversion query generation) benefits from knowing S3's contradictions, because the adversarial pass should focus on disturbed regions where S3 found disagreement.

**Scheduling:** S8 Phase B waits for S3 Phase 4 (contradiction writes to Surprise Register) before generating queries. S8 then factors S3's contradictions into its IC-1..IC-4 query set.

**Effective overlap window:** about 40-60% of S8's runtime can overlap S3, depending on claim complexity.

### 6.3 Sub-inquiry triggered by S8

When S8 surfaces a contradiction that triggers a sub-inquiry:

1. Sub-inquiry opens at the Surprise Register.
2. Router re-dispatches a narrowed Phase 2/3/4 loop scoped to the disturbed region (per S6 continuation directive).
3. Sub-inquiry recursion depth is capped at 2 (K_subinquiry_depth). Deeper -> escalate to operator.

---

## 7. Capacity-bound deferral protocol

When `|selected_set|` > K_disciplines at S3 for a claim, OR when inversion classes exceed K_disciplines at S8 for a claim:

1. Top-K by fitness-match score run in the current dispatch cycle.
2. The remainder are written to the ledger with `CAPACITY_BOUND` entry naming the deferred disciplines (or inversion classes) and the reason.
3. The claim's triangulation record (S3) carries `PARTIAL_DISCIPLINE_COVERAGE: true` and the S8 output carries equivalent partial-coverage flags.
4. S6 MUST NOT emit STOP while any claim has `PARTIAL_DISCIPLINE_COVERAGE: true`.
5. A follow-up dispatch pass re-runs the deferred disciplines once capacity recovers.
6. The follow-up pass writes its own triangulation records; S3 merges them into the claim's record set with `merged_follow_up: true` metadata.

**Invariant:** no discipline is silently dropped. A dropped discipline without a CAPACITY_BOUND ledger entry is a defect class.

---

## 8. Cross-claim parallelism vs within-claim parallelism

The router exposes two orthogonal parallelism axes:

- **Cross-claim parallelism** (K_retrieval, K_claims, K_adversarial): claims run independently up to the ceiling. This maximizes throughput across multi-claim questions.
- **Within-claim parallelism** (K_disciplines): disciplines (or inversion classes) run in parallel within a single claim up to the ceiling. This maximizes triangulation independence.

Both axes obey the capacity-bound deferral protocol (Section 7). Neither axis is allowed to silently degrade the multi-method default.

**Worst-case runtime analysis:** a 5-claim stacked-intent question with K_disciplines = 6 and matrix-selected sets averaging 4 disciplines per claim = up to 20 parallel discipline invocations per phase (5 claims x 4 disciplines). At K_claims = 4 and K_disciplines = 6, the router dispatches 4 claims x 6 disciplines = 24 parallel invocation slots per cycle, with 1 claim deferred to the next cycle. Two cycles cover the full question.

---

## 9. Scheduling invariants (router audits at each phase boundary)

1. Every claim's S3 run has a discipline SET (size >= 2) or a filed SINGLE_METHOD_EXCEPTION.
2. Research Auditor is in every S3 discipline SET.
3. No discipline appears as "dropped" without a matching CAPACITY_BOUND ledger entry.
4. Disciplines did not share intermediate state (structural parallel invocation).
5. S8 ran on every claim (no skips).
6. S8 adversarial queries went through S1 with `pass=adversarial` tag; S2 was NOT relaxed.
7. Sub-inquiry recursion depth did not exceed 2.
8. S6 did not emit STOP on any claim with `PARTIAL_DISCIPLINE_COVERAGE: true` or open sub-inquiry.
9. Follow-up dispatch cycles actually ran (not deferred-and-forgotten).

---

## 10. Failure modes under parallelism (and countermeasures)

| Failure | Detection | Response |
|---|---|---|
| Silent discipline drop under capacity pressure | Ledger discipline count < selected_set count AND no CAPACITY_BOUND entry | REOPEN Phase 3 (S3 step 2.4 violation); rerun with explicit deferrals |
| S3 masks S5 by silently re-typing from discipline finding | S3 output shows claim_type differs from S5 output AND no CLAIM_TYPE_REVISION Surprise Register entry | Halt, force S3 to emit CLAIM_TYPE_REVISION and re-route to S5 |
| Cross-discipline state leakage (disciplines see each other) | Suspicious agreement with low entropy across rubrics | Halt, audit parallel invocation wiring, restart Phase 3 |
| S8 runs sequentially with S3 (no overlap) | Total runtime exceeds expected by 60%+ | Audit scheduler; fix the overlap dispatch rule in this file |
| Capacity-bound follow-up pass never runs | Ledger shows CAPACITY_BOUND entries without matching `merged_follow_up: true` records at run_close | Halt; force follow-up dispatch before S6 re-evaluates |
| Sub-inquiry recursion exceeds depth 2 | Depth counter exceeded | Escalate to operator per S6 RECURSION_DEPTH_REACHED event |

---

## 11. Calibration notes

- K_disciplines = 6 is the runtime default because the five claim-type baseline sets top out at 4-5 disciplines + research-auditor + 1-2 overlay additions. K = 6 covers the common case; K = 11 covers the degenerate case (multiple overlays on a maximally complex claim).
- K_claims = 4 is the runtime default because stacked-intent questions typically produce 2-3 claims; a 5-claim maximum (per S5 Phase 3 halt rule) fits in two dispatch cycles.
- K_subinquiry_depth = 2 is hard-coded; deeper recursion runs into infinite-reset failure modes (per S6 Section 7.3).

Phase 6 prototyping (smoke tests) should record actual parallel degree achieved per phase and flag any silent degradation. This is the operational input to the 11-way-parallel-vs-conditional-parallel decision Phase 2A flagged as unresolved.

---

End of PARALLEL_DISPATCH_RULES.md.
