---
name: lfo-prompt-pricing
description: Draft prompts for each lfcs-pricing worker workflow step. Pre-pend intake envelope. Run gap-watch on every prompt before relay. Output is a markdown block Rocky pastes into the worker session.
model: claude-sonnet-4-6
phase: 3
invoked_by: orchestrator after Phase 2 closes; runs once per worker step
preconditions:
  - intake_envelope sealed
  - exclusions skeleton exists
inputs:
  - workflow step name (e.g. "drawing-extract", "boq-parse", "bid-prep", "phase-0-grill", "first-pass", "sanity-check-open", "submission-build")
  - any prior worker output relevant to this step
outputs:
  - drafted prompt (markdown block) ready for Rocky to paste
side_effects:
  - log every relayed prompt to `_Internal/orchestrator-sessions/session-{uuid}.md`
authored_by: claude-code-orchestrator
created: 2026-05-08
---

# lfo-prompt-pricing

Draft the worker prompt for the named workflow step. Pre-pend intake envelope. Run `lfo-gap-watch` on the prompt before output. Log to session.

## Standard prompt sequence

For one bid, the orchestrator drafts these prompts in order. Each is an independent invocation of this skill.

### Step 1 — drawing-extract

```markdown
<INTAKE-ENVELOPE — copied from session log>

Run `lfcs-drawing-extract-text` on:
- <list of PDF paths>

Then `lfcs-drawing-extract-vision` (Opus 4.7) on the dense structural sheets:
- <list of structural-only PDFs>

Output: `Drawing-Index.md` per CLAUDE.md §4.1 step 4 + Drawing Elements rows in Airtable.

Skip vision pass on civil/landscape sheets unless flagged for vision-required content.
```

### Step 2 — boq-parse

```markdown
<INTAKE-ENVELOPE>

Run `lfcs-boq-parse` on:
- <BoQ xlsx path>

Output: `boq-normalised.json` + quantities-at-a-glance markdown table appended to `00-brief.md`.

If no BoQ supplied: skip; orchestrator notes take-off-from-drawings regime in envelope addendum.
```

### Step 3 — bid-prep

```markdown
<INTAKE-ENVELOPE>

Run `lfcs-bid-prep-doc`. Read sections 6–10 (ADDED items, cross-refs, Rate-Only carve-outs, OPTION items, cranage assumption).

Cross-check intake envelope scope (Q-1) against drawing scope. Surface any gaps as RFI candidates.

Output: `00-Bid-Prep.md`.
```

### Step 4 — phase-0-grill

```markdown
<INTAKE-ENVELOPE>

Run `lfcs-pre-grill`. The 6 intake-gate answers are LOCKED above — DO NOT re-ask them. Skip Q-A0 (cost basis), Q-A4–A7 (margin/contingency/weather/exposure — all locked).

Continue with: Q-A1/A2/A3 supply (concrete/reo/cast-ins detail), Q-B1 access, Q-C QA, Q-D1/D2 programme, Q-E productivity, Q-F1 commercial posture, Q-F4 format, Q-G sanity flags.

Abort if any answer is TBC. Save `02b/Pre-Pricing-Grill-{date}.md` Rocky-signed.
```

### Step 5 — first-pass

```markdown
<INTAKE-ENVELOPE>

Run first-pass priced take-off.

Apply margin formula from envelope:
- Labour: direct × 1.10 contingency × 1.15 margin (cont-then-margin) = 1.265 loaded
- Materials (LFCS-purchased): direct × 1.15 margin × 1.10 contingency (margin-then-cont) = 1.265 loaded
- Same final 1.265, distinct ordering per category. Show direct AND loaded views per line on internal output.

Standard exclusions skeleton already seeded at `_Internal/exclusions/exclusions-{job}.md`. Layer bid-specific Detailed Exclusions / Assumptions / Inclusions on top after take-off.

Use labour rate $<labour.blended_rate_aud_per_hr>/hr from envelope. Do not default to Rate Card V1.7 $85 base.

Adverse weather posture: <adverse_weather.posture> per envelope. <If include: "Apply $<allowance> prelim allowance.">

LAFHA: <lafha.in_or_out>. <If in: "Apply $<rate>/day allowance line.">

Site exposure: <site_exposure>. <If coastal-air: "Do NOT apply saltwater consumables uplift. Drawings may spec marine durability — that's design margin against airborne salt, not immersion.">

Output: priced take-off with per-line direct + loaded views, total ex GST, exclusions cross-reference.
```

### Step 6 — sanity-check-open

```markdown
<INTAKE-ENVELOPE>

Open `OverrideCaptureSession` per CLAUDE.md §4.2 with:
- bid_record_id: <id>
- agent_id: lfcs-pricing
- participants: <Rocky + Liam (or +Hus)>
- capture_mode: typed

Display the bid line items table side-by-side. Per line: original_rate_ex_gst, qty, unit, complexity_factors, source_methodology_template, original_qty.

Capture every verbal override via `session.capture_override(...)` with:
- bid_line_item_id, original_rate, override_rate
- reason_codes (1-3 from 9 domains)
- reviewer_type (Trades-Internal-Rocky / Trades-Internal-Liam / Trades-Internal-Hasibul)
- reviewer_name
- free_text_rationale (1-3 sentences — REQUIRED)

Each capture writes Bid Line Item Overrides + _Internal_Audit_Trail + session-{uuid}.md + per-job _audit/overrides-log-{date}.md.

On session close: stamp ended_at + write transcript_summary.
```

### Step 7 — submission-build (only after Rocky-confirmed authorisation)

```markdown
<INTAKE-ENVELOPE>

ROCKY-AUTHORISED FOR EXTERNAL SEND — captured at <timestamp> in session <session_id>.

Run submission build per CLAUDE.md §4.3:
- Format from grill Q-F4: <lump-sum-letter | boq-response | both>
- Skill: <lfcs-loo-builder | lfcs-boq-response-builder>
- operator_of_record: <Liam Fitzgerald | Hus | Rocky>
- company: LF Construction Services Pty Ltd

Run Layer 1 sanitise, then Layer 2 verify (independent). Fail-closed contract: if L2 fails, delete artefact + log _Internal_Sanitisation_Log.verified_by_human=NEVER. Do NOT retry.

Human verification gate: <operator> opens Drive preview, confirms Author=human + no agent terms in body. Sets verified_by_human=true.

Drive upload via `lfcs-drive-upload.sh`. Auto-share with mcloughlinmichael.r@gmail.com Editor no-notify. Email send to <recipient>.

Update Bids.Status=Submitted + Submitted_Date + final_submitted_total_ex_gst + final_authored_by.
```

## Procedure

1. Read the requested step name + any prior worker output (last 50 lines of relevant context).
2. Pull the matching template above. Substitute `<INTAKE-ENVELOPE>` with the envelope from session log.
3. Substitute step-specific placeholders from envelope and from prior context.
4. **Run gap-watch.** Apply `lfo-gap-watch` to the drafted prompt. If any rule fires, append the correction-clause to the prompt before relay.
5. Output the prompt as a single markdown block. Add a wrapper:
   > "PASTE INTO WORKER SESSION (lfp). When worker output returns, paste back any line you'd like me to review."
6. Log the relayed prompt to `_Internal/orchestrator-sessions/session-{uuid}.md` under `## Relayed prompts` (one heading per step, append-only).

## Failure modes

- Step name not in the standard list above → orchestrator drafts a custom prompt + flags Rocky to confirm before relay.
- Worker output came back empty or errored → orchestrator surfaces to Rocky; does NOT silently retry the same prompt.
- Envelope changed mid-session (e.g. Q-3 labour rate updated): re-issue the affected step with new envelope; mark prior step output as superseded in session log.
