---
name: gaps-pattern-library
description: Pattern-matching detector library for orchestrator gap-watch skill. Each rule has trigger, what-it-catches, mitigation. Append-only as new patterns surface.
authored_by: claude-code-orchestrator
created: 2026-05-08
append_only: true
---

# Gaps Pattern Library

The orchestrator's `lfo-gap-watch` skill matches each rule below against (a) the prompt drafted for the worker, (b) the worker's output, and (c) Rocky's stated intent. Rules fire when the pattern matches AND the mitigation hasn't already been applied.

## Bootstrap rules (G1–G5) — derived from 2630 gaps log 2026-05-08

---

### G1 — Standard Exclusions Library not applied

**Detect when:** worker about to produce exclusions list AND no exclusions skeleton in `_Internal/exclusions/exclusions-{job}.md` from `lfo-standard-exclusions-apply` skill.

**What goes wrong if missed:** worker reconstructs exclusions per-job from `_methodology_Exclusion_Library` job-category rows, missing the cross-cutting "LFCS scope is narrow → these always exclude" pattern. Result: ~$97k of always-out items (Hilti chemicals, joint materials, falsework engineering, blinding labour, FRC waterproofing, adverse weather standby) baked into first-pass.

**Mitigation:** orchestrator runs Phase 2 (`lfo-standard-exclusions-apply`) BEFORE relaying any first-pass take-off prompt. Block worker prompts in Phase 3 step 5 until the exclusions skeleton exists.

**Source:** `_Internal/2630-gaps-log.md` — Standard LFCS exclusions not applied.

---

### G2 — Site exposure category inferred from drawing-spec, not Rocky-confirmed

**Detect when:** worker output references "tidal", "saltwater", "marine immersion", "MHW/MSL/ISLW" in a context where the inference came from drawing material spec (stainless reo, marine cement, sulphate-resistant footings) rather than from Q-2 intake-gate answer.

**What goes wrong if missed:** worker auto-applies tidal classification (saltwater +5% materials uplift, tidal-window scheduling, tidal-marine productivity) for a coastal-air-above-tide-line site. Drawings spec marine durability margin against airborne salt; doesn't mean slab is in tidal zone. 2630 example: $X in tidal-only loadings stripped at rev 4.

**Mitigation:** intake gate Q-2 enforces Rocky-input. If worker output infers tidal from drawing-spec, orchestrator strips inference + relays correction: "site_exposure is `coastal-air` per intake envelope. Strip saltwater +5% uplift, strip tidal-window assumption, revert to standard productivity."

**Source:** `_Internal/2630-gaps-log.md` — Site exposure category not confirmed.

---

### G3 — Labour rate from methodology default, not Rocky-confirmed

**Detect when:** worker output uses $85/hr base from `_methodology_Rate_Templates` row `labour-rate-baseline-fr-85` OR any other methodology default WITHOUT the intake envelope's `labour.blended_rate_aud_per_hr` being applied.

**What goes wrong if missed:** worker prices on $85/hr base when Rocky locked $95/hr blended (or whatever the per-job rate is). 10-12% under on labour-heavy lines.

**Mitigation:** intake gate Q-3 enforces Rocky-input. Orchestrator pre-pends envelope to first-pass prompt + explicitly: "use labour.blended_rate_aud_per_hr = $X from intake envelope. Do not default to Rate Card V1.7 $85 base."

**Source:** `_Internal/2630-gaps-log.md` — Labour rate not confirmed.

---

### G4 — Margin + contingency formula or ordering wrong

**Detect when:** worker first-pass output applies (a) wrong multiplier (1.165 / 1.10 / 1.15 only — not 1.265 final), (b) wrong sequencing (labour using margin-then-cont; materials using cont-then-margin), (c) collapsed multiplier without per-category sequence preserved.

**What goes wrong if missed:** under-loading by ~10% on labour or ~15% on materials. 2630 rev 1/2/3 hit this exactly — $1.87M instead of correctly-loaded total.

**Mitigation:** intake gate Q-4 captures the formula in envelope. Orchestrator includes the explicit reminder in first-pass prompt:
> "Apply margin_contingency from intake envelope. Labour: direct × 1.10 cont × 1.15 margin (cont-then-margin). Materials: direct × 1.15 margin × 1.10 cont (margin-then-cont). Same final 1.265, distinct ordering per category. Show both direct and loaded views per line on internal output."

**Source:** `_Internal/2630-gaps-log.md` — Margin and contingency build-up rules not in methodology.

---

### G5 — Override captured but missing reason_codes / rationale

**Detect when:** worker session-log writes an override row to `Bid Line Item Overrides` AND `reason_codes` is empty OR `free_text_rationale` is blank/<2 sentences.

**What goes wrong if missed:** override loses calibration value. `lfcs-feedback-aggregator` diversity criteria can't fire on rows missing reason_codes domain coverage.

**Mitigation:** orchestrator post-checks every override write. Drafts a follow-up prompt to worker if reason_codes empty: "override row {id} missing reason_codes. Re-prompt Rocky/Liam/Hus for the 1-3 reason-code multi-tag from 9 domains: SCOPE-SHIFT / RATE-BASIS / PRELIM-VISIBILITY / STRUCTURAL-ADD / STRUCTURAL-DEDUCT / POSTURE-MISMATCH / BOILERPLATE-CARRY / PRODUCTIVITY-CALIBRATION / LOSS-CATEGORY."

**Source:** `lfcs-pricing-agent/CLAUDE.md` §4.2 step 3 + Stage 4 § 3.1.

---

## Open patterns — to add as they surface

Append below as new patterns are confirmed by Rocky during lessons-write (Phase 7).

| ID | Title | Status |
|---|---|---|
| G6 | BCS-metadata in worker-readable artefacts | applied 2026-05-10 (PR-005) |
| G7 | exclusion-default contradicts drawing/spec | applied 2026-05-10 (PR-005) |
| G8 | magnitude-variance-acceptance threshold | applied 2026-05-10 (PR-005) |

---

### G6 — BCS-metadata in worker-readable artefacts (applied 2026-05-10 from PR-005, evidence n=2)

**Detect when:** any worker-readable file (per-job CLAUDE.md, 00-brief.md, exclusions skeleton, orch-to-pricer.md, handoff bus messages, state.json beyond opaque comparator_handle) contains:
- regex `comparator|Comparator|COMPARATOR`
- regex `(Liam|Hus).{0,30}(quote|estimate)` (author + word "quote/estimate")
- filename matches `*Comparator*`, `*_v-CW*`, `*-blind-compare-*`, `*supersession*`
- presence of `_internal_quarantined_for_session_id` references
- schema labels like `pre.IFC.posture.split`, `scope.split.delta`

**What goes wrong if missed:** anchoring bias breaks BCS independence; sessions abort-on-breach. Two consecutive sessions on bid 2627 (d58cec3f + 09c7347d) aborted on this exact failure 2026-05-08.

**Mitigation:** refuse-to-write block in `lfo-prompt-pricing` and `lfo-blind-driver` skills BEFORE any worker-readable file persistence. Whitelist > blacklist for path control. If G6 fires in retry mode, invoke `lfo-bcs-rotate-and-sweep` for Path-D recovery.

**Severity:** block (do NOT relay until resolved)

**Source:** session-d58cec3f-2627 + session-09c7347d-2627 (2026-05-08 BCS breaches).

---

### G7 — exclusion-default contradicts drawing/spec (applied 2026-05-10 from PR-005, evidence n=1+)

**Detect when:** any standard-exclusion-library default value (cure period, joint spec, concrete grade, reo grade, formwork class) contradicts a value parsed from BoQ-from-drawings or pavement-spec output.

Example pattern (from session-80b1f893-2627 line 92): exclusions A7 says 14-day cure but spec §10.1.1 says 7-day.

**What goes wrong if missed:** over- or under-pricing on a recurring exclusion line; carries forward to next bid if not caught.

**Mitigation:** insert "spec-overrides-default reminder" line in first-pass prompt before relay. If contradiction is material (>$5k pricing impact), surface to Rocky in the assumptions log under `## Mid-bid additions` section.

**Severity:** correct (append correction inline, relay)

**Source:** session-80b1f893-2627 line 92 (cure-period correction).

---

### G8 — magnitude-variance-acceptance threshold (applied 2026-05-10 from PR-005)

**Detect when:** Phase 3 sealed bottom-up total deviates from §7 magnitude estimate by >X%.

**Codification:** ±10% = auto-accept (not flagged); >±10% = Rocky flag at sanity-check entry.

**What goes wrong if missed:** without threshold, every variance (even 6%) gets flagged → noise; very large variances (e.g. 30%) might slip through if §7 magnitude was stale.

**Mitigation:** track delta_pct in session log; auto-include in sanity-check signal if >10%; suppress flag if ≤10%.

**Severity:** flag (informational; not blocking)

**Source:** session-80b1f893-2627 lines 73, 118 (6% variance manually flagged).

---

## Pattern format (template for new entries)

```markdown
### G{N} — <short title>

**Detect when:** <conditions on prompt / output / Rocky intent>

**What goes wrong if missed:** <concrete failure + magnitude if known>

**Mitigation:** <orchestrator action — block / strip / re-prompt / surface>

**Source:** <log file or session reference>
```

Each new rule must reference a specific real-world session where the gap occurred (no speculative rules — only reactive ones drawn from observed misses).
