# VCC Build Prompt — DispatchWithAutomation PWA

Paste the block below into the Claude Code session running at the VPS (VCC, in tmux). It drives an
autonomous, dev-first, phase-by-phase build that only stops when it genuinely needs you.

Authored from DL 2026-07-27. Companion docs already on the VPS:
`docs/MDD_dispatch_automation.md`, `docs/adr/ADR-117…123`, `docs/dispatch_automation_build_spec.md`.

---

```
You are the 360LM VPS Claude session (VCC). Build the "DispatchWithAutomation" PWA — the
evolution of the existing `dispatch` module — to completion, dev-first, phase by phase.
All design + decisions are already made and documented. Do NOT re-plan or re-interview.

## READ FIRST (authoritative, already on this VPS)
1. /var/www/360lm/docs/MDD_dispatch_automation.md        (the design doc, 22 sections)
2. /var/www/360lm/docs/dispatch_automation_build_spec.md (Q0 answers + §19 decisions + Phase 0→3 plan + schema outline)
3. /var/www/360lm/docs/adr/ADR-117 … ADR-123            (the 7 governing ADRs)
4. /var/www/dispatch/MDD_dispatch.md                     (SUPERSEDED — read only for the existing `dispatch` schema base to reuse/extend)

## GOVERNANCE — do these before any build step
- Read parallel_sessions.md; register as a PWA session; before touching any conflict zone
  (DB_MIGRATIONS, DB_GRANTS, DOCKER_SHARED, TRAEFIK) claim the lock(s) alphabetically, release after.
- Run vcc_checklist.md (A–V) before the first Edit/Write.
- Dev-first ALWAYS (lm360), never direct prod DDL (ADR-015). Prod promotion is a separate, GATED step.
- Follow every ADR the MDD §17 lists (esp. ADR-013 single-file, ADR-001 ?next=, ADR-081 safe-bottom,
  ADR-105 proxy JWT, ADR-075 RPC errors, ADR-100 theme navy-classic). Commit messages cite the ADR.
- Update dbt_dispatch.md after EACH completed step (house cadence).

## WHAT TO BUILD — follow dispatch_automation_build_spec.md exactly
Phase 0 (foundations): fold the dir-anomaly (/var/www/dispatch → /var/www/360lm/dispatch, retire the
  standalone dispatch-pwa container+router — TRAEFIK+DOCKER_SHARED window); fix ADR-001 ?next= and
  ADR-081 safe-bottom; author migrate_dispatch_v2.sql (all new tables + shipment_final DELETE-guard +
  shipment_current view + pg_trgm) dev-first.
Phase 1 (MVP): shiprocket-proxy (ADR-117) + intake (Excel AI-map + manual) + store consolidation w/
  approval (ADR-121) + rules engine (ADR-119) with the MANDATORY replay-test harness before auto-book
  + tracking backbone (ADR-118) + MIS & client reports (ADR-123) + retention/deletion (ADR-120) + roles.
Phase 2: direct-courier verification (BD/Delhivery auto, DTDC persistent-session CAPTCHA relay,
  Xpressbees manual worklist) + NDR surface/deep-link/log + proof-of-delivery (call logs + photo→PPTX,
  Recce pattern).
Phase 3: extra booking_points (360DL Shiprocket, Blue Dart direct API) + carrier scorecard + retire timex-dashboard.
Verify EACH phase: web_anon HTTPS roundtrip + Playwright specs + vcc_checklist §V. CiC walkthrough per house norm.

## AUTONOMY — keep going; stop ONLY for these
Proceed continuously through Phase 0→3 without pausing for confirmation between steps or phases.
STOP and ask ONLY when:
  (a) a decision is genuinely required that is NOT already answered in the MDD / ADRs / build-spec;
  (b) you judge a different/stronger model tier is warranted for a hard step — say so and pause;
  (c) a PROD-promotion step needs the owner's go-ahead (dev build is autonomous; prod is gated);
  (d) a required INPUT is missing — specifically:
      • [SATISFIED 2026-07-27 — staged at /opt/shiprocket-proxy-src/, 53 .py + README] the proven
        TIMEX Python toolchain (the shiprocket-proxy basis). Only re-request if that dir is missing.
      • Shiprocket credentials are not present as a VPS Docker secret (the OWNER places these —
        never ask me/you to enter them; run the proxy against dev/mock until provided).
Otherwise: do not stop, do not ask "shall I continue" — just build, verify, log, and move on.

Model note: use the strongest available model for the schema, proxy, and rules-engine work.
```

---

## Two inputs the VPS build will need from the owner (VCC will pause for them)
1. **~~Transfer the DL TIMEX toolchain~~ — DONE 2026-07-27.** The proven Python modules (booking,
   tracking/CAPTCHA, report/ETD incl. `parse_loose_date` + the DELIVERED/UNDELIVERED fix, master
   sync, NDR) are staged at **`/opt/shiprocket-proxy-src/`** (53 `.py` + README, root-only). Creds,
   `.env`, `auth_state` sessions, and PII campaign data were deliberately excluded (see #2 + README).
2. **Place Shiprocket credentials on the VPS as a Docker secret** — the owner does this
   (credential-entry boundary; the assistant never enters creds). Until then the proxy runs
   against dev/mock.
