# PagePoint AI Context

Last regenerated: 2026-07-10

This file is the quick-start briefing for AI context recovery. It summarizes current state only. The Engineering Portal remains the permanent documentation source.

## Project Status

Current development phase: PPSM service appliance foundation, with PPOE runtime kept stable.

Current sprint: PPSM Service Appliance.

Overall project health: Good. The PPOE is operating, PPSM is running as a service appliance, DNS/DHCP ownership has moved to PPSM appliance services, and the Engineering Portal is now local-source-backed and published at `engineering.pagepoint.io`.

## Current Priorities

1. Stabilize PPSM touchscreen and service workflows.
2. Implement phone provisioning around a health-report-first ADB workflow.
3. Keep PPOE runtime stable while continuing operator UI refinements.
4. Define isolated time-source strategy for logs, audits, diagnostics, and provisioning records.
5. Keep Engineering Portal and `AI_CONTEXT.md` current after meaningful engineering work.

## Recently Completed

- Moved Engineering Portal source into `C:\PagePoint\engineering-portal`.
- Published Engineering Portal through Cloudflare Pages project `pagepoint-engineering-portal`.
- Added `Current Sprint`, `Current Context`, `Engineering Principles`, and PPSM emergency Wi-Fi runbook pages.
- Established SSH key access aliases: `pagepoint-oe` and `pagepoint-sm`.
- Fixed PPOE live phone client tracking:
  - PPOE prunes stale sockets after 15 seconds without heartbeat/status.
  - PPOE `/health` exposes connected phone clients and count.
  - PPSM reports phone count from PPOE health using source `PPOE_HEALTH`.
- Synced SM time to OE after finding SM about 15 minutes slow.
- Applied PPSM emergency-only Wi-Fi policy:
  - `netplan-wlan0-PagePoint` autoconnect disabled.
  - `wlan0` dormant.
  - former Wi-Fi address `192.168.50.110` inactive.
  - wired SM `192.168.50.2` healthy.

## Architecture Summary

PagePoint is split into two independent appliances.

PPOE: PagePoint Operations Engine. It owns live paging, stored message playback, sequence playback, operator phone UI, audio routing, zone control, relay control, traffic control, runtime state, phone Socket.IO connections, and receiver communications.

PPSM: PagePoint Service Module. It owns service workflows: phone provisioning, APK updates, USB import, message validation/deployment, DNS/DHCP infrastructure, Android validation responder, diagnostics, backups, log collection, site notes, touchscreen service UI, and installer Service Portal.

Major boundary: PPOE operates. PPSM maintains. PPSM must never be required for live paging, message playback, sequence execution, audio routing, or relay control.

## Current Decisions

- PPOE owns operations.
- PPSM owns maintenance.
- Maintenance must never interfere with operational paging.
- DNS/DHCP belong to PPSM appliance-level services, not the PPSM Node process.
- PPSM normal operation is wired-only at `192.168.50.2`.
- PPSM Wi-Fi profile is retained only for intentional emergency access.
- PPOE is authoritative for live phone count.
- PPSM displays phone count from PPOE health.
- Live/runtime TTS is excluded from PPOE.
- PPSM Version 1 assumes externally generated audio.
- Future PPSM content compilation from structured text is possible but not Version 1 runtime behavior.
- Cloudflare is a publishing target only; local portal source is canonical.
- `AI_CONTEXT.md` is regenerated for quick AI recovery; it is not permanent history.

## Current UI

Operator UI: Phone-based PPOE UI with role selection, top status bar, phone/battery/Wi-Fi indicators, message-first workflow, Launch Pad/zone controls, all-call, live paging, stored messages, sequence controls, traffic controls, Find Phones, and All Cancel. LP buttons are evolving into Launch Pad Status Cards. Direction: remove bottom status bar, taller top status bar, improved typography, centered LP label/countdown/current sequence message, retained progress bar.

PPSM UI: Touchscreen service panel for quick service status and actions. It shows health, PPOE status, network status, display status, USB state, phone count, jobs, and quick actions. PagePoint Service Portal remains the installer/admin surface for keyboard-heavy workflows.

## Known Issues

- Isolated PagePoint network has no reliable NTP source. OE and SM can be manually aligned, but a formal time-source strategy is still open.
- Local PPOE backup folder is behind the live OE source in some areas. Avoid bulk-overwriting it without review.
- PPSM Service Portal and touch modals remain framework-level for many future actions.
- Phone provisioning implementation is still pending actual Ulefone Armor X12 ADB validation.
- OE passwordless sudo is not configured; SM passwordless sudo works.
- `iperf3`, `jq`, `dig`, `ethtool`, and `iw` are not installed on OE/SM yet.
- PPSM service stop can hang until killed; this has happened before and should be addressed.

## Next Recommended Work

1. Define and implement PagePoint time-source strategy.
2. Install baseline diagnostic tools on OE and SM, especially `iperf3`.
3. Test phone disconnect/reconnect behavior and confirm count updates within about 15 seconds.
4. Start phone provisioning implementation with read-only health report first.
5. Resolve PPSM service shutdown behavior so restarts do not require SIGKILL.

## Files Changed

Important local files changed recently:

- `engineering-portal/src/AI_CONTEXT.md`
- `engineering-portal/src/index.html`
- `engineering-portal/src/pages/current-context.html`
- `engineering-portal/src/pages/engineering-principles.html`
- `engineering-portal/src/pages/networking.html`
- `engineering-portal/src/pages/ppsm.html`
- `engineering-portal/src/pages/ppsm-emergency-wifi.html`
- `engineering-portal/src/pages/decisions.html`
- `engineering-portal/src/pages/roadmap.html`
- `engineering-portal/package.json`
- `ppsm/ppsm.js`
- `ppsm/src/api/index.js`
- `ppsm/src/core/healthModel.js`
- `ppsm/src/modules/ppoeClient.js`

Important deployed appliance files changed recently:

- OE: `/home/paul/pagepoint/server.js`
- SM: `/opt/pagepoint/ppsm/ppsm.js`
- SM: `/opt/pagepoint/ppsm/src/api/index.js`
- SM: `/opt/pagepoint/ppsm/src/core/healthModel.js`

## Decision References

New or updated decision references during this session:

- Decision 007: Engineering Portal source lives inside PagePoint.
- Decision 008: PPSM normal operation is wired-only.
- Decision 009: PPOE is authoritative for live phone count.
- Open Decision 010: PagePoint needs an isolated time-source strategy.

## Recovery Commands

Portal publish:

```powershell
cd C:\PagePoint\engineering-portal
npm.cmd run build
npx.cmd wrangler pages deploy .\dist --project-name pagepoint-engineering-portal
```

Device access:

```powershell
ssh pagepoint-oe
ssh pagepoint-sm
```
