# Dispatch Spot Current Operating Manual

Version introduced: v392
Updated: v409
Status: Active compact operating manual
Location: `Project Documentation/00_CURRENT_OPERATING_MANUAL.md`

## Purpose

This manual is the compact current working guide for Dispatch Spot build cycles. It exists because the project documentation grew across many build periods and too many historical notes were sitting beside current rules.

Use this manual to keep build cycles fast, predictable, and safe. Historical documents are still preserved, but this manual and the active build rules control current work.

## Required reading order before every build

1. Current user prompt and stated server baseline.
2. `Project Documentation/Active/DISPATCH_SPOT_BUILD_RULES.md`.
3. `Project Documentation/00_CURRENT_OPERATING_MANUAL.md`.
4. `Project Documentation/06_CONSOLIDATED_ACTIVE_PRODUCT_ARCHITECTURE_MANUAL_V394.md`.
5. `Project Documentation/Active/DISPATCH_SPOT_DOCUMENTATION_SOURCE_OF_TRUTH.md`.
6. `Project Documentation/Active/DISPATCH_SPOT_SUPERSEDED_GUIDANCE_REGISTER.md`.
7. `Project Documentation/01_PREVIOUS_CHAT_REQUIREMENTS_REGISTER.md`.
8. `Project Documentation/Architecture/ROLE_WORKSPACE_ARCHITECTURE_AND_SUPER_ADMIN_ADMINISTRATION_REQUIREMENTS.md` before deeper Super Admin, subscription, workspace-type, driver, broker, shipper/customer, internal load-board, or internal operations work.
9. `Project Documentation/Architecture/SUPER_ADMIN_CONTROL_CENTER_INFORMATION_ARCHITECTURE_PLAN.md` before major Super Admin control-center, provider, subscription, phone-system, support, or platform-setting work.
10. `Project Documentation/Active/PROJECT_HANDOFF.md` latest entry.
10. Relevant active module standard or architecture document inside `Project Documentation/`.
11. Historical v-numbered documents only when needed for context.

When touching documentation placement, cleanup, or root-file behavior, also review:

- `Project Documentation/07_CONTROLLED_DOCUMENTATION_RELOCATION_MANIFEST_V395.md`;
- `Project Documentation/08_DOCUMENTATION_REFERENCE_SWEEP_AND_COMPACTNESS_PASS_V396.md`;
- `Project Documentation/04_ROOT_DOCUMENTATION_INVENTORY_MANIFEST_V393.md` if checking how an old root file was classified.

If documents disagree, the current user correction and the active build rules win. Older historical notes must not override current placement, settings, language, or build procedure rules.

## Build-cycle procedure

Every build cycle must follow this sequence:

1. Start from the user-stated current baseline.
2. Unzip and modify only the latest uploaded canonical source package.
3. Review placement before changing code or documents.
4. Build the smallest safe package that advances the requested track.
5. Do not weaken previous feature scope just to make a page easier to build.
6. Update documentation inside `Project Documentation/` only where it improves the current source of truth.
7. Run available validation.
8. Package a single canonical zip.
9. Provide the established response format.
10. Provide the next copy/paste check-in prompt.

## Version and package naming

Use this package naming pattern:

```text
dispatchspot-canonical-source-only-v###.zip
```

Rules:

- The package version must match the next sequential version requested or implied by the user.
- The zip must unpack directly into the app root.
- Do not nest the source inside another project folder.
- Exclude `.next`, `node_modules`, logs, caches, generated build output, nested work folders, and duplicate extracted source trees.

## WHM command format

The WHM command must be easy to copy/paste and must visibly prove that the package unzipped.

Required pattern when Prisma schema does not change:

```bash
cd /home/dispatchspot/app.dispatchspot.com
export PATH=/opt/cpanel/ea-nodejs22/bin:$PATH
ls -lh dispatchspot-canonical-source-only-v###.zip
unzip -o dispatchspot-canonical-source-only-v###.zip
npm run dispatchspot:deploy-cleanup
npm run dispatchspot:preflight
npm run build
npm run dispatchspot:postbuild-restart
```

Required pattern when Prisma schema changes:

```bash
cd /home/dispatchspot/app.dispatchspot.com
export PATH=/opt/cpanel/ea-nodejs22/bin:$PATH
ls -lh dispatchspot-canonical-source-only-v###.zip
unzip -o dispatchspot-canonical-source-only-v###.zip
npm run dispatchspot:deploy-cleanup
npx prisma generate
npx prisma db push
npm run dispatchspot:preflight
npm run build
npm run dispatchspot:postbuild-restart
```

Do not use `unzip -q`. Quiet unzip hides the extraction output and breaks the confirmation step.

## Deployment restart and chunk-load rule

As of v399.1, every normal WHM deployment command should clear old Next build output before `npm run build` and restart the running Node process after a successful build.

Reason: Next App Router pages load compiled JavaScript chunks. If the server process, browser cache, and `.next` output are out of sync, the browser can show `ChunkLoadError` before a page renders. This is a deployment synchronization problem, not a normal user-facing feature.

Required safeguards:

- use visible `unzip -o`, never `unzip -q`;
- run `npm run dispatchspot:deploy-cleanup` before build;
- run `npm run dispatchspot:postbuild-restart` after build;
- refresh the browser after the restart.

## Required response format after each build

Every package response must use this order:

1. Version title.
2. Download link.
3. Decision, when a decision was required.
4. What changed.
5. What’s Visible, broken down by role/location.
6. Build validation.
7. WHM command with visible unzip output.
8. Rule Check.
9. Next check-in prompt.

Do not replace `What changed` with `What’s Visible`. They are separate sections.

## Required Rule Check format

```text
Rule Check

- User surface stayed clean: Yes/No
- Settings/configuration stayed in Workspace Settings: Yes/No
- CORI page stayed AI/action-focused: Yes/No
- Technical/provider details hidden from normal users: Yes/No
- Simple language used: Yes/No
- Prisma schema changed: Yes/No
- Documentation source-of-truth updated if needed: Yes/No
```

If any answer is `No`, the next package must correct the issue before adding more features.

## Placement rules

| Item | Correct location |
| --- | --- |
| Daily dispatch work | Dispatch Board and relevant record pages |
| Load record search and corrections | Loads |
| Paperwork proof, PODs, BOLs, rate confirmations, and file linking | Paperwork |
| Invoice and unpaid-load follow-up | Billing Records |
| Financial explanation and executive money briefing | CORI Financial |
| General AI conversation | Ask CORI |
| Daily executive operations briefing | CORI Briefing on `/dashboard` |
| Email briefing, drafts, work cards, and final send approval | CORI Mail |
| User preferences, notification preferences, phone capture, opt-ins | Workspace Settings |
| Provider setup, SMTP, Twilio, QuickBooks, Stripe, maps, OAuth/API keys | `/company/integrations` |
| Tenant-wide support, monitoring, deep platform readiness, plan oversight | Super Admin |
| Historical build records | Documentation archive, not normal user pages |

## Operational page rule

Operational pages are for doing the work. They must not become settings pages, diagnostic pages, roadmap pages, provider setup pages, or internal documentation pages.

Before adding content to any normal user-facing page, ask:

1. Does this help the user complete the job of this page right now?
2. Is this a setting, preference, credential, opt-in, provider test, or admin support concern?
3. Could this confuse a normal dispatcher, carrier, driver, broker, or workspace admin?

If the answer points to setup or configuration, move it to Workspace Settings, Workspace Integrations, or Super Admin.


## v393 documentation inventory rule

v393 classified all root-level Markdown, HTML, and README documentation files in:

```text
Project Documentation/04_ROOT_DOCUMENTATION_INVENTORY_MANIFEST_V393.md
```

Use that manifest before moving, consolidating, or relying on any root documentation file. Do not treat root `README*.txt`, root `.html` mirrors, or v-numbered build-history notes as current instruction unless the active source-of-truth documents explicitly promote them.

## v394 consolidated architecture manual rule

v394 created the consolidated active product/architecture manual:

```text
Project Documentation/06_CONSOLIDATED_ACTIVE_PRODUCT_ARCHITECTURE_MANUAL_V394.md
```

Use that manual as the first active architecture summary before opening scattered root architecture files. Older root architecture and module-standard files remain preserved, but day-to-day build decisions should follow the consolidated manual unless a newer user correction or build rule changes it.

## Documentation rules

Documentation now lives inside the controlled folder:

```text
Project Documentation/
```

Do not create new standalone root documentation files. The root `README.md` is only a pointer to `Project Documentation/`.

Historical records must be preserved inside the correct documentation subfolder:

- active control docs: `Project Documentation/Active/`
- active module standards: `Project Documentation/Active/Module Standards/`
- architecture sources: `Project Documentation/Architecture/`
- build history: `Project Documentation/Build History/`
- superseded guidance: `Project Documentation/Superseded/`
- duplicate/retired scaffold notes: `Project Documentation/Duplicates or Retired Scaffolds/`
- HTML mirrors: `Project Documentation/HTML Mirrors/`

When deploying v395 or later over an older package, remember that unzip does not delete old root files. Use the v395 cleanup script when instructed.

## Previous chat requirement rule

Before changing architecture, navigation, CORI behavior, billing, subscriptions, notifications, build process, or documentation process, check the previous-chat requirements register:

```text
Project Documentation/01_PREVIOUS_CHAT_REQUIREMENTS_REGISTER.md
```

If an old request is not represented in current documentation, update the relevant active document instead of relying on memory.

## Current high-priority product requirements from previous chats

These are active requirements until the user changes them:

- Preserve the originally planned feature set when possible; do not disable or shrink features just to make a build easier.
- Keep Super Admin inside the existing `/admin` area and develop it directly alongside Workspace Admin capability.
- Every workspace must have a subscription; Super Admin must manage plans, limits, add-ons, entitlements, billing state, and feature access.
- Platform subscriptions use Stripe; dispatcher service billing can use separate Stripe flows; carrier/company broker payments can remain factoring or Net 30 workflows.
- `/dashboard` is CORI Briefing, not a short KPI dashboard.
- CORI Briefing must provide specific executive-assistant detail, including exact truck, load, driver, customer, paperwork, and billing identifiers on first mention.
- Ask CORI remains a separate general-purpose surface.
- CORI Financial is a separate financial briefing surface.
- Routes must begin with load + truck + driver and support CORI-assisted route planning.
- Normal user surfaces must use plain work language and avoid internal/provider/build terms.
- The left sidebar should become cleaner, grouped, and SaaS-like with reduced first-page complexity.

## Validation expectations

Run `npm run dispatchspot:preflight` for every package.

Run `npm run build` locally only when dependencies are available in the sandbox. If dependencies are not available, state that local Next build was not run and provide the WHM build command.

If Prisma schema changes, include `npx prisma generate` and `npx prisma db push` in the WHM command. If Prisma schema does not change, do not include those commands.

## Artifact failure handling

If a download link or artifact fails, rebuild the archive with a fresh file handle and provide a corrected package. Do not change the established build response format while correcting the artifact.


## v396 documentation compactness rule

The active procedure should not be repeated in long historical sections. If an active document becomes bloated with older protocol notes, archive the old material in `Project Documentation/Build History/` and keep the active file compact.

Markdown controls when Markdown and HTML both exist. Regenerate or update HTML mirrors only after the Markdown source is correct.


## v397 previous-chat cross-check rule

When the user asks to review previous Dispatch Spot chats, or when a major module/architecture direction might depend on earlier conversations, compare the previous-chat requirements register against the consolidated active architecture manual by module.

Use:

- `Project Documentation/01_PREVIOUS_CHAT_REQUIREMENTS_REGISTER.md`;
- `Project Documentation/06_CONSOLIDATED_ACTIVE_PRODUCT_ARCHITECTURE_MANUAL_V394.md`;
- `Project Documentation/09_PREVIOUS_CHAT_REQUIREMENTS_CROSS_CHECK_V397.md` when auditing previous-chat coverage;
- relevant active module standards and handoff notes.

If a durable requirement is missing, add it to the register or consolidated manual. Do not leave important requirements only in memory, chat history, or historical build notes.


## v398 product re-entry status

The v391-v398 documentation cleanup track is complete enough for normal product feature work to resume.

Before each new feature build, continue using the reading order in this manual and the source-of-truth document. Do not create new documentation-only cycles unless the user asks, a contradiction is found, or the feature changes durable rules.

v399 completed CORI Mail send-review and audit visibility hardening.

Recommended next product track: notification digest/email trigger behavior. v400 completed the first digest preview/send behavior and v401 added digest history/readiness polish.

## v400 notification digest placement reminder

Notification digest/email-trigger controls are settings/delivery-management behavior. Place them in Workspace Settings > Notifications, not on `/notifications`.

Keep `/notifications` limited to alert review actions: read/unread, hide/show, and work-record links.

Future WHM commands should continue the v399.1 hardened pattern: visible unzip, deploy cleanup, preflight, build, post-build restart.

## v401 notification digest history reminder

Digest history, last-send status, and retry guidance belong in Workspace Settings > Notifications because they are notification delivery-management details. Keep provider setup and provider tests in Workspace Integrations. Keep /notifications alert/action-only.


## v403 notification scheduler rule

Notification digest scheduler/webhook execution must remain protected and server-side. Automatic digest sends require:

- `DISPATCH_SPOT_NOTIFICATION_AUTO_DIGEST_ENABLED=true`
- `DISPATCH_SPOT_NOTIFICATION_DIGEST_WEBHOOK_SECRET`
- a protected caller using `x-dispatchspot-scheduler-secret` or `Authorization: Bearer <secret>`
- connected company email in Workspace Integrations
- saved user email alert/digest preferences
- duplicate-send guards

Manual trigger checks in Workspace Settings > Notifications must report readiness only. They must not auto-send.


## v406 Operating Note

Future WHM commands should continue to include deploy cleanup and post-build restart. Notification scheduler cron guidance may be documented and shown only in Super Admin administrative surfaces, with secret values hidden. After v406, broad notification work should pause unless a defect appears.

## v407 workspace parity and subscription planning rule

After v406, the notification track is complete enough to pause unless testing reveals a defect.

The next active planning source is:

```text
Project Documentation/Architecture/WORKSPACE_PARITY_AND_MEMBERSHIP_SUBSCRIPTION_TRIAL_PLAN.md
```

Use it before changing registration, workspace type behavior, subscription/trial behavior, entitlement gates, add-ons, role-workspace navigation, or Super Admin subscription/workspace oversight.

The Dispatcher Workspace is the maturity benchmark. Future Broker, Company/Fleet, Driver, Carrier/Owner-Operator, and Shipper/Customer surfaces should match its quality and clarity while staying role-specific.


## v409 role-workspace planning rule

Before major Super Admin expansion, subscription/trial architecture, workspace-type changes, broker workspace work, driver workspace work, shipper/customer portal work, internal load-board work, or internal operations workspace work, review:

```text
Project Documentation/Architecture/ROLE_WORKSPACE_ARCHITECTURE_AND_SUPER_ADMIN_ADMINISTRATION_REQUIREMENTS.md
```

Super Admin work must be based on the things each workspace actually needs: what is paid, what is an owned interface, what each role can see/do, what CORI may do, what integrations are required, and what Super Admin must control, bill, limit, support, and audit.

## v410 planning note — subscription/trial/workspace-type changes

Before changing registration, sign-up UI, Prisma subscription/workspace models, trial gates, plan visibility, Driver Workspace ownership, invited portals, broker distribution, internal load-board access, or Stripe handoff, review:

`Project Documentation/Architecture/MEMBERSHIP_SUBSCRIPTION_TRIAL_WORKSPACE_TYPE_ARCHITECTURE.md`

Do not treat every login as a separate paying workspace. Drivers and many portals are owned interfaces under a paid workspace by default.
