# LFCS Job Tracker

## When to use

Rocky says: "where's [job] at", "status [job]", "am I over budget", or `/lfcs-job-tracker [job]`.

## Procedure

1. If Rocky named a job (number or substring), match it against folder names. Otherwise list ongoing jobs and ask which.
2. Read `<job>/00-brief.md` for `contract_price`, `type`, `start_date`, `target_completion`.
3. Read `<job>/Job-Tracker.md` — if absent, look for `Job Tracker - <job>.xlsx`. If `.xlsx`:
   - Use `python3.12` (system Python, NOT the cron venv's Python 3.11 which lacks `openpyxl`)
   - Read the `Labor Hours` sheet for today's hours rows; `Materials Receipts` for materials
   - All-hours-zero in the Excel is a real finding — report it as such, don't treat as read error
4. Read `<job>/04 - Programme and Scheduling/programme-24wk.md` — current week number.
5. Read `<job>/_strategy.md` if exists — note any open profit-lever flags.

## Output format

Compact table. Example:

```
🔧 01-2275 Hornsby (hybrid, $324K, Wk 4 of 24)

| | |
|---|---|
| Hours to date | 187 / 1,200 (15.6%) |
| Costs to date | $42,870 / target $200K |
| Materials in | $18,400 |
| Variance | -$2,100 vs week-target (slightly ahead) |
| Float remaining | 3.0 wks |
| Top open: | A1 sub-base, A6 Connolly delivery |
```

Last line gives the WATCH/ON-TRACK/OVER call:
- ON TRACK if variance within 5%
- WATCH if 5-15%
- OVER if >15%

## Pitfalls

- Job-Tracker.md tables sometimes use $ and , — strip both before parsing.
- If a number can't be parsed, show the raw cell with a "(see file)" note rather than guess.
- If the job is `Upcoming` not `Ongoing`, reply with the brief summary instead of progress numbers ("starts [date], 0 hours logged yet").

## Verification

After replying:
1. Hours-to-date and Costs-to-date totals must be ≤ contract_price; if not, flag "🚨 OVER CONTRACT" before any other line.
2. Re-parse the Job-Tracker.md table headers — if any expected column (Date/Person/Hours/Cost) is missing, abort with "Job-Tracker.md schema drift" rather than report misleading numbers.
3. Variance call (ON TRACK / WATCH / OVER) must be consistent with the variance % shown — sanity-check before sending.
