---
name: lfo-precedent-finder
description: Match the current job's scope/HC/site/complexity against past LFCS jobs. Surface most-similar precedents with similarity scores and per-question decisions taken on those jobs. Used by the orchestrator's autonomous-answering priority chain (step 3) to auto-decide intake questions before falling through to methodology, web research, or educated assumption.
model: claude-sonnet-4-6
phase: 1 (autonomous intake) and ad-hoc when a question needs precedent
invoked_by: orchestrator at any priority-chain decision point
preconditions:
  - orchestrator session log open
  - current job's scope items + HC name + site location + design maturity already inferred from RFQ / drawings / 00-brief.md
inputs:
  - current_job_no
  - current_scope_items (subset of: formwork / steel-fix / concrete / curing / other)
  - current_hc (e.g. TCE, Mack Civil, Solutions Plus, Vaughan Civil, Girvan Group, ...)
  - current_site_postcode (string, e.g. "2540")
  - current_site_type (e.g. bridge / seawall / wwtp-slab / stormwater-pit / commercial-slab / refurb)
  - current_design_maturity (Full IFC / 90% Design / 60% Concept / Tender / Other)
  - question (the specific intake question being answered, e.g. "labour rate" / "site exposure" / "LAFHA" / "adverse weather" / "margin posture")
outputs:
  - precedent_list — array of { job_no, similarity_score 0-100, decision_text, source_path, evidence_snippet }
  - top_precedent_decision — best-matching precedent's decision for this question (or null)
  - confidence — integer 0-100 derived from top similarity_score and consistency across precedents
side_effects:
  - reads job folders read-only
  - appends precedent-search summary to orchestrator session log under heading `## Precedent search — question: <question>`
authored_by: claude-code-orchestrator
created: 2026-05-08
---

# lfo-precedent-finder

Find past LFCS jobs most similar to the current bid. Read their decisions on the specific intake question. Return the top precedent's answer + a confidence score the orchestrator can compare against the 60% threshold for "auto-decide vs flag-for-Rocky."

## Why this exists

The autonomous-answering priority chain (orchestrator CLAUDE.md §5.0) has 6 steps. Step 3 is "past job precedent." This skill is the implementation of step 3. Without it, the orchestrator would fall straight through to step 4 (methodology Airtable lookup) and lose the strongest signal we have — Rocky's recorded decisions on similar jobs.

Worked example: question = "LAFHA in or out for current job 2631?". Step 1 (standing-context) gives the rule (Sydney crew on remote site → IN). Step 2 (lessons-learned) gives the labour-rate / margin / exposure lessons but no LAFHA-specific lesson. Step 3 (this skill) checks past jobs with similar HC + site type. 2629 Erskine Park (TCE, WWTP-slab, similar postcode region) had LAFHA OUT because Botany→Erskine Park is 47 min — within commuting range. Top similarity 85, decision OUT, confidence 90. Orchestrator auto-decides OUT and logs the precedent in `assumptions-log-2631.md`.

## Procedure

### 1. Read job folders (read-only)

Glob targets:
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Upcoming/*/CLAUDE.md`
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Upcoming/*/00-brief.md`
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Upcoming/*/00-Bid-Prep.md`
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Upcoming/*/02 - Scope and Pricing/02b - BOQ and Rate Schedules/Pre-Pricing-Grill-*.md`
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Upcoming/*/02 - Scope and Pricing/02b - BOQ and Rate Schedules/2*-Pre-Pricing-Grill_v-CC*.pdf` (PDF variants)
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Lost Jobs/*/...` (same patterns)
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Ongoing Jobs/*/...` (when populated)
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Completed Jobs/*/...` (when populated)
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Awarded/*/...` (alternate naming, if Rocky uses it)
- `HQ-Vault/11_OpsMan_LFCS/Operations/Jobs/Closed/*/...` (alternate naming, if Rocky uses it)
- `HQ-Vault/11_OpsMan_LFCS/_Internal/orchestrator-sessions/session-*.md` for prior intake envelopes
- `HQ-Vault/11_OpsMan_LFCS/_Internal/assumptions-log-*.md` for prior auto-decisions

Glob defensively under `Operations/Jobs/**` rather than hardcoding folder names — Rocky's folder taxonomy may shift.

### 2. Compute similarity score per past job

Weighted sum, max 100:

| Signal | Weight | Match rule |
|---|---|---|
| HC exact match | +30 | TCE→TCE, Mack→Mack, Solutions+→Solutions+ |
| HC category match | +15 | Both tier-2-civil (Mack, TCE), or both head-civil (Vaughan, TCE) |
| Scope items exact match | +25 | Same subset of {formwork, steel-fix, concrete, curing} |
| Scope items partial overlap | +12 | ≥2 items in common but not exact |
| Site postcode region match | +15 | Same Sydney metro 2xxx, same Central Coast 22xx-23xx, same Illawarra 25xx, same Newcastle 22xx-23xx |
| Site type match | +15 | bridge→bridge, seawall→seawall, wwtp-slab→wwtp-slab, stormwater-pit→stormwater-pit |
| Design maturity match | +10 | Full IFC→Full IFC; 90%→90%; etc. |
| Past job has answer for THIS question (Pre-Pricing-Grill or assumptions-log) | +5 bonus | adds to subtotal — gates whether the precedent is usable |

Discard self (current job_no must not match itself).

### 3. Filter to top 3 precedents

Keep precedents with `similarity_score ≥ 40`. Sort descending. If fewer than 1 precedent ≥40, return `precedent_list: []` and `top_precedent_decision: null` and let the orchestrator fall through to priority-chain step 4 or 5.

### 4. Per question, extract the decision from the top precedent

Question-to-source mapping:

| Question | Where to look |
|---|---|
| labour rate | Pre-Pricing-Grill answer to Q-A0 / Q-A0.1; Bid record `_internal_first_pass_labour_rate_blended` field; Rate Buildup xlsx labour cell |
| LAFHA | Pre-Pricing-Grill Q-6 answer; assumptions-log entry; if both absent, derive from Botany→site Google Maps drive time |
| site exposure | 00-brief site description; drawing review notes; Pre-Pricing-Grill Q-G7 answer |
| adverse weather posture | Bid Notes field; exclusions list (look for #37-equivalent); Pre-Pricing-Grill Q-A6 (if present) |
| margin / contingency | Rate Buildup xlsx loaded multiplier; assumptions-log; CLAUDE.md §1.5 default 1.265 fallback |
| scope confirmation | 00-brief `Trades scope` line; Pre-Pricing-Grill Q-1; CLAUDE.md per-job context |
| posture (defensible / aggressive) | Pre-Pricing-Grill Q-F1 answer; assumptions-log |

For each candidate precedent, attempt extraction in order. If extraction fails (file unreadable, field missing), drop to next precedent. If all top-3 fail, return empty.

### 5. Compute confidence

Base confidence from top similarity:

| Top similarity | Decision present | Base confidence |
|---|---|---|
| ≥80 | yes | 90 |
| 60–79 | yes | 75 |
| 40–59 | yes | 60 |
| <40 | n/a | n/a — return null |

Modifiers:

- All top-3 precedents agree on decision: **+10**
- Top-3 precedents disagree (e.g. 2 say IN, 1 says OUT): **−15**
- Source is a Pre-Pricing-Grill PDF signed off by Rocky: **+5**
- Source is unsigned draft / inferred from Bid Buildup: **−5**

Cap at 100. Floor at 30. If final confidence <60, mark `flag_for_rocky: true` so the orchestrator surfaces this question to Rocky despite having a precedent.

### 6. Output structure

```yaml
precedent_list:
  - job_no: 2629
    similarity_score: 85
    decision_text: "LAFHA OUT — Botany→Erskine Park 47 min one-way (Google Maps 2026-04-21)"
    source_path: "Operations/Jobs/Upcoming/2629 - TCE - Erskine Park WWTP Slab/02 - Scope and Pricing/02b - BOQ and Rate Schedules/Pre-Pricing-Grill_v-CC.pdf"
    evidence_snippet: "Q-6 LAFHA: OUT — Sydney crew commuting daily, drive 47 min one-way, no overnight stay"
  - job_no: 2626
    similarity_score: 60
    decision_text: "LAFHA OUT — Mascot site, full Sydney metro"
    source_path: "Operations/Jobs/Upcoming/2626 - Mack Civil - Stormwater Pit EXA01A-08/CLAUDE.md"
    evidence_snippet: "Mascot site, no LAFHA"
top_precedent_decision: "LAFHA OUT (47 min commute from Botany — Erskine Park precedent)"
confidence: 90
flag_for_rocky: false
```

### 7. Log to orchestrator session

Append a precedent-search summary block (one per question answered):

```
## Precedent search — question: LAFHA (current job 2631)
- Searched: 4 jobs
- Top match: 2629 Erskine Park (similarity 85, TCE + WWTP slab + Sydney metro)
- Decision: LAFHA OUT — Botany→site 47 min via Google Maps
- All-precedent agreement: yes (2/2 with decision present, both OUT)
- Confidence: 90% (auto-decide; not flagged for Rocky)
- Logged to: _Internal/assumptions-log-2631.md row 3
```

## Failure modes

- **No precedents ≥40:** return empty list + null decision. Orchestrator falls through to priority chain step 4 (methodology) or step 5 (web research). NOT a stop-and-ask trigger by itself.
- **Top precedent's grill PDF unreadable or decision absent:** drop precedent, try next. If top-3 all fail, treat as "no precedents."
- **Top-3 disagree by >25% on decision (e.g. one says LAFHA IN at $300/day, two say OUT):** apply −15 confidence modifier. If resulting confidence <60, the orchestrator must flag for Rocky per `flag_for_rocky=true`.
- **Read-only constraint:** never write to job folders. Only orchestrator session log + assumptions log get appends.
- **Folder taxonomy drift:** if Rocky introduces `Awarded/` / `Closed/` / `Ongoing Jobs/` / `Completed Jobs/` etc., glob picks them up automatically — do NOT hardcode list above as exhaustive. The list in step 1 is illustrative.

## Notes

- Skill is read-only. All writes go through the orchestrator session log + assumptions log per CLAUDE.md §3.6 append-only contract.
- Similarity weights are v1 — calibrate after 5 bids' worth of precedent searches. Track in lessons-learned if a high-similarity precedent gives a wrong answer.
- Currently `Operations/Jobs/Upcoming/` and `Operations/Jobs/Lost Jobs/` are populated. As more outcomes accumulate, the precedent pool grows and confidence on auto-decided questions should rise.
- This skill is the LFCS analogue of "show me how we handled this last time" — it codifies the decision rather than re-asking Rocky every bid.
