# LFCS EOD Summary

## When to use

Rocky says: "EOD summary", "today's summary", "wrap up", or `/lfcs-eod-summary`.
Also runs at 17:00 daily via cron.

## Procedure

For each active job — check BOTH `lfcs.jobs_root/Ongoing Jobs/` AND `lfcs.jobs_root/Upcoming/` (jobs with `start_date` within ±7 days are active; also check jobs manually flagged as active). A job in `Upcoming/` that has started site work is still active — do not skip it.

1. Read today's diary file: `<job>/07 - Site Documents/07d - Daily Diary/YYYY-MM-DD.md`. If missing → flag "no diary entries today" but still continue.
2. Read `<job>/Job-Tracker.md` — count today's hours rows added, materials rows added, costs running total.
3. Run docket check (see docket-check reference).
4. Read `<job>/06 - Correspondence/06b - RFIs/_REGISTER.md` — count Cat A still pending.
5. Read `<job>/04 - Programme and Scheduling/programme-24wk.md` — what's planned for tomorrow.

## Output format

Tight 5-7 line summary per job. Use **🔴 red-text** (Telegram `‎` + bold) for CRITICAL flags — missing docket is always CRITICAL.

Docket missing example (note red highlight on the docket line):
```
🔧 EOD 2026-05-03 — Hornsby (01-2275):
• 🕐 Hours today: None logged — Job-Tracker blank
• 📸 Photos today: None
• 📦 Materials in: None recorded
• 📋 Docket: 🔴 MISSING — no signed docket = no invoice line
• 📅 Tomorrow: Confirm if work occurred today; get docket signed
• 🔴 Chase: Rocky — did you work today? If yes, send hours + docket photo now
```

Docket OK example (happy path):
```
🔧 EOD 2026-04-30 — Hornsby (01-2275):
• Diary: 1 entry, 3 photos saved to 07b
• 🕐 Hours: Tomek 8.0h, Filip 8.0h, Rocky 6.0h (total $1,624)
• 📦 Materials in: 30 sheets formply, SL72 mesh starter pack
• 📋 Docket: ✅ signed (07a/2026-04-30-signed.jpg)
• 📅 Tomorrow: Stair forming Day 2; pump confirmed for Fri
• ⚠️ RFIs: 4 Cat A still pending (sub-base, pump, mix, induction)
```

## Pitfalls

- **No diary file for today ≠ no activity.** If `<job>/07 - Site Documents/07d - Daily Diary/YYYY-MM-DD.md` does not exist at all, do not silently suppress the EOD summary. Check `<job>/Job-Tracker.md` for hours/materials rows added today — if any exist, produce the full summary with those figures. If neither diary NOR tracker rows exist, still deliver a summary line flagging uncertainty ("Diary not filed — did site work occur today?") and include the docket check result.
- **Job may live in both Ongoing AND Upcoming.** Always search using `search_files` with a broad path (`/home/ccuser/opsman-work/Jobs/`) and a date pattern first — do not hardcode the subfolder path. Read the FIRST matching file found, not a later copy.
- Don't repeat info Rocky already saw earlier today. Just deltas.
- On the cron-fired version (17:00 daily): if no activity at all AND no docket at risk, reply with one line ("No site activity today. [Reason if known.]") rather than a long empty template.
- Leverage the docket-check skill — don't reimplement.
- If multiple ongoing jobs, summarise each separately, separated by blank line.

## Non-working days (weekends, public holidays)

If today has no diary entry AND no hours logged AND no docket — the job may still have an **open at-risk docket from the last working day**. Before going silent:

1. Check `<job>/07 - Site Documents/07a - Dockets/` for any `*-signed.*` files.
2. If the most recent docket is from a recent working day and is missing → surface it in the EOD summary as a CRITICAL flag, even though "today" has no activity.
3. The summary format on a silent weekend day becomes:
   ```
   🔧 EOD — [Job name] | [Today, e.g. Sat 2 May]
   • No site activity today (weekend). Last site day: Fri 1 May.
   • ⏱ Last day hours: [who] [hours] — logged in Job-Tracker
   • 📋 🚨 DOCKET MISSING — 01 May not photographed. No signed docket = no invoice line.
   • 📅 Next on: Mon [date]
   • ⚠️ Chase: [client contact] for retro docket sign-off
   ```
4. Only suppress the summary if: no docket from any recent working day is missing AND no other open items exist.

## Verification

After replying:
1. Reply ≤ 7 lines per active job. If longer, trim before sending.
2. Each numeric in the summary (hours, $) must trace back to a specific row in `Job-Tracker.md` — if you can't cite the row, mark "(unverified)" rather than guess.
3. Cron-fired version: confirm the trigger fired at ~17:00 Sydney time by checking `~/.hermes/cron/` last-run log; if late by >30 min, append a note to today's diary.
4. On a weekend/holiday silent day: confirm you checked for the last working day's docket before suppressing. If the last docket is missing → do NOT suppress, surface the CRITICAL flag.
