---
name: lfo-job-bootstrap
description: Invoke at start of `lfo-bid-lifecycle` Phase 1 (or Rocky-typed "create job folder for {job_no} {name}") to scaffold a new job folder per LFCS Universal Project Folder Structure. Creates `Operations/Jobs/Upcoming/{job_no} - {name}/` with the canonical 11-folder skeleton + per-job CLAUDE.md (orientation pointer to orchestrator) + 00-brief.md (frontmatter template — populated by intake gate) + Job-Tracker.md stub + _Log.md (append-only one-liner per AI Team Protocol). Registers the new job in `state.json.active_bid_id` + writes audit-trail "job bootstrapped" entry.
model: claude-sonnet-4-6
phase: 1 (pre-intake) — invoked first in lfo-bid-lifecycle
invoked_by: `lfo-bid-lifecycle` Phase 1 step 1, OR Rocky-typed scaffold command
preconditions:
  - state.json.active_bid_id null OR matches the job_no being bootstrapped (resume case)
  - Operations/Jobs/Upcoming/ directory exists (created on vault init)
  - per-job CLAUDE.md template exists at `Codebase/lfcs-orchestrator/templates/per-job-CLAUDE-template.md` (skill creates if missing)
inputs:
  - job_no (e.g. "2632")
  - job_name (e.g. "Mack Civil - Riverside Pit")
  - hc_name (optional — populated by intake; can be TBC at bootstrap)
  - destination_status (default `Upcoming`; override to `Ongoing` only on resumed-from-precedent-import flow)
outputs:
  - `Operations/Jobs/{status}/{job_no} - {job_name}/` folder + canonical 11-folder skeleton
  - `00-brief.md` (frontmatter only — body populated by lfo-intake-gate)
  - `CLAUDE.md` (orientation pointer)
  - `Job-Tracker.md` (stub)
  - `_Log.md` (append-only)
  - `state.json.active_bid_id = {job_no}`
  - audit-trail entry
side_effects:
  - creates ~12 directories + 4 files per invocation
  - sets the active-bid lock in state.json (per CLAUDE.md §3.7)
  - never overwrites if folder already exists (refuses + surfaces)
authored_by: claude-code-orchestrator
created: 2026-05-10
---

# lfo-job-bootstrap

Per-bid scaffolding. Currently inlined in every `lfo-bid-lifecycle` invocation. Encapsulating it eliminates 5+ minutes of per-bid setup + standardises the folder shape.

## Why this exists

Every new bid needs the same 11-folder canonical skeleton + per-job CLAUDE.md + 00-brief.md frontmatter + state.json lock. Today this lives in lfo-bid-lifecycle Phase 1 prose. Three problems:
1. Easy to skip a folder when typing manually — drift across bids
2. Per-job CLAUDE.md template never centralised — each job re-invents
3. state.json lock + folder creation must be atomic (otherwise concurrent-bid race condition)

This skill fixes all three.

## Procedure

### 1. Pre-flight

- Read `state.json`. If `active_bid_id` is set AND ≠ job_no: REFUSE per CLAUDE.md §3.7 ("one active bid at a time"). Append to `queue.md` instead.
- Determine destination folder path: `Operations/Jobs/{status}/{job_no} - {job_name}/`
- Check folder exists:
  - Folder exists + has content → REFUSE (don't overwrite). Surface to Rocky: "Folder already exists at {path}. Resume existing bid or pick different job_no?"
  - Folder doesn't exist → proceed

### 2. Create canonical 11-folder skeleton

Per `Operations/Jobs/Upcoming/2626 - Mack Civil - Stormwater Pit EXA01A-08/` reference (note: vault uses "and" not "&" + sub-numbered tier-2):

```
{job_no} - {job_name}/
├── 01 - Contracts and POs/
│   ├── Head Contract/
│   ├── Purchase Orders/
│   └── Subcontract Agreements/
├── 02 - Scope and Pricing/
│   ├── 02a - Quotes and Estimates/
│   └── 02b - BOQ and Rate Schedules/
├── 03 - Plans and Specifications/
│   ├── 03a - Issued for Construction/
│   ├── 03b - Shop Drawings/
│   └── 03c - As-Built Drawings/
├── 04 - Programme and Scheduling/
├── 05 - Safety and Compliance/
│   ├── 05a - SWMS/
│   ├── 05b - JSAs/
│   ├── 05c - Inductions and Tickets/
│   └── 05d - Incident Reports/
├── 06 - Correspondence/
│   ├── 06a - Emails/
│   ├── 06b - RFIs/
│   └── 06c - Meeting Minutes/
├── 07 - Site Documents/
│   ├── 07a - Dockets/
│   ├── 07b - Inspection Records/
│   └── 07c - Site Photos/
├── 08 - Variations/
├── 09 - Invoicing and Payment Claims/
│   └── Payment Claims/
├── 10 - Subcontractors/
└── 11 - Handover and Closeout/
```

Each leaf folder gets a `.gitkeep` file (empty, 0 bytes) ONLY if vault `.gitignore` whitelists it. Default: skip `.gitkeep` per `feedback_lfcs_drive_no_gitkeep_no_md.md`.

### 3. Write 00-brief.md (frontmatter only)

```markdown
---
job_no: {job_no}
job_name: {job_name}
hc: TBC
end_client: TBC
site: TBC
postcode: TBC
scope: TBC (intake gate will fill)
design_maturity: TBC
outcome: in-progress
status: bidding
source: orchestrator-bootstrap
created: {iso-now}
purpose: Bid brief for {job_no} {job_name}. Intake gate populates body via lfo-intake-gate.
---

# {job_no} — {job_name}

(Intake gate will populate Quick metadata + lfo-precedent-finder signals + scope detail after Phase 1 priority chain runs.)
```

### 4. Write per-job CLAUDE.md (orientation pointer)

Read template at `Codebase/lfcs-orchestrator/templates/per-job-CLAUDE-template.md`. If missing, create from this body:

```markdown
# Per-job CLAUDE.md — {job_no}

This is the per-job context file for **{job_no} — {job_name}**.

## Orientation

- Orchestrator: `Codebase/lfcs-orchestrator/CLAUDE.md` (operating manual)
- This bid is an active orchestrator-driven bid; read the orchestrator CLAUDE.md first
- Scope, locked envelope, and assumptions log live at:
  - `00-brief.md` (this folder)
  - `_Internal/assumptions-log-{job_no}.md` (orchestrator-managed)

## Files in this folder

- `00-brief.md` — bid brief (HC, site, scope, outcome — populated by intake gate)
- `Job-Tracker.md` — Rocky's tracking notes (append-only)
- `_Log.md` — AI Team Protocol one-liner log
- `02 - Scope and Pricing/02b - BOQ and Rate Schedules/` — rate-buildup + BoQ artefacts
- `03 - Plans and Specifications/03a - Issued for Construction/` — IFC drawings

## Read order for any agent picking up this bid

1. `Codebase/lfcs-orchestrator/CLAUDE.md` — orchestrator manual
2. `Codebase/lfcs-orchestrator/standards/standing-context.md` — locked LFCS facts
3. This file (`{job_no}/CLAUDE.md`)
4. `00-brief.md`
5. `_Internal/assumptions-log-{job_no}.md` if exists
6. Most recent `_Internal/orchestrator-sessions/session-*-{job_no}.md` if exists

## Confidentiality

Per `Codebase/lfcs-orchestrator/CLAUDE.md` §3.2 + §3.4 — confidentiality seam in force. No external content without Rocky-typed authorisation per §6 trigger 6. BCS rules per §3.4 if blind comparison active.
```

### 5. Write Job-Tracker.md (stub)

```markdown
---
job_no: {job_no}
job_name: {job_name}
purpose: Rocky's append-only tracking notes for this bid (RFIs, decisions, contacts, programme notes).
created: {iso-now}
append_only: true
---

# Job Tracker — {job_no} {job_name}

(Rocky appends notes as bid progresses. Orchestrator may surface relevant entries during Phase 3-4 but never edits.)
```

### 6. Write _Log.md (append-only one-liner)

```markdown
{date} :: lfcs-orchestrator :: {job_no} job folder bootstrapped via lfo-job-bootstrap
```

### 7. Update state.json

Atomic write (temp + rename):
- `active_bid_id = {job_no}`
- `bid_started_at = {iso-now}`
- `bid_inbound_path = (set by caller — typically the inbound RFQ pack path)`
- `current_phase = phase-1-intake`

### 8. Audit-trail

Append to `_Internal/audit-trail/job-bootstraps-{date}.md`:
```
- {iso-now} :: {job_no} - {job_name} :: created at {path} :: by {session_id}
```

### 9. Surface to caller

Return:
```yaml
job_folder: {path}
brief_path: {path/00-brief.md}
state_locked: true
ready_for: phase-1-intake (lfo-intake-gate)
```

## Failure modes

- **Folder already exists with content:** REFUSE, surface, don't overwrite.
- **`state.json.active_bid_id` already set to different bid:** append new bid to `queue.md`. Do NOT bootstrap; surface "queued for after current bid hits Phase 7".
- **Disk full or path too long (Windows MAX_PATH):** STOP, surface, suggest shorter job_name.
- **Per-job CLAUDE.md template missing AND can't write to `templates/`:** continue with inline template; flag in session log.

## Notes

- This skill ENFORCES the LFCS Universal Project Folder Structure (per `lfcs-standards/folder-spec.md` referenced from opsman/AGENTS.md). Drift = scope-creep risk; standardisation pays dividends in cross-bid precedent matching.
- Folder names use "and" (not "&") + sub-numbered tier-2 (02a/02b/etc.) — vault convention. Drive shared folders use "&"; that's a separate naming domain (zip ingest preserves Drive convention).
- Future enhancement: detect if RFQ pack is provided + auto-populate 03a IFC drawings from the inbound path.
