# Qzotic Command — mobile practice app and read-only gateway

## Delivered in this package
- Responsive phone/desktop dashboard: Overview, Portfolio, Ledger, Luxzia, System.
- Browser-only practice records, journal entries and reminder-window exercises. No operational data is seeded. Practice entries last for the browser session and are cleared on reload.
- PWA manifest, home-screen icons and static-shell service worker. No live snapshots/tokens are cached. On a private hosted Site, login may be needed to load shell assets; offline practice depends on browser support and a prior successful cache. A native App Store build is not included.
- Mac gateway source: authenticated WebSocket snapshots, bearer-authenticated read-only diagnostics POST plus asynchronous job polling, strict allowed origins, rate limits, TLS required for nonloopback access, restricted static paths and no arbitrary execution routes.
- Bundled prior core source under ecosystem_source for reference. Do not replace your already migrated modules merely to install the dashboard.

## Practice on your phone
Open the private deployed URL in your phone's browser using the owning ChatGPT account. For iPhone: Share → Add to Home Screen. Android: browser menu → Install app or Add to Home screen. The practice app works without your Mac; figures are illustrative and never operational records. The website is private, not an App Store release or public product launch.

## Mac gateway installation (optional, live business actions remain disabled)
Extract the package and open Terminal in its folder:

```bash
bash backend/install_mac.sh /Users/bpa/ForesixaQuant
/Users/bpa/ForesixaQuant/mobile_gateway/.venv/bin/python /Users/bpa/ForesixaQuant/mobile_gateway/backend/consigliere_server.py --root /Users/bpa/ForesixaQuant --create-access
```

Installer keeps the existing consigliere_server.py; it installs the repaired gateway separately in mobile_gateway. It installs the pinned aiohttp dependency into a separate virtual environment, runs tests, and does not start the server or touch operational database records. --create-access creates mobile_access.json privately and refuses to overwrite it. Never upload that file. The mobile token is separate from HMAC signing keys.

To inspect the gateway locally on your Mac, with the mobile token already created:

```bash
/Users/bpa/ForesixaQuant/mobile_gateway/.venv/bin/python /Users/bpa/ForesixaQuant/mobile_gateway/backend/consigliere_server.py --root /Users/bpa/ForesixaQuant
```

Default loopback server is for local inspection. Its practice dashboard is available at http://127.0.0.1:8765. The hosted dashboard requires HTTPS/WSS for connected mode. Nonloopback gateway use requires a certificate trusted by the phone, configured --cert/--key, an explicit network bind address and allowed --origin values. Do not open router ports or expose this gateway publicly. A trusted private remote-access deployment is not provisioned here. Mac must remain awake and connected for its live data to be available. Same-Wi-Fi access and remote access each require host-network configuration and actual phone tests; neither is assumed complete.

The allowed hosted origin is https://qzotic-command.qzotic-creative-tale.chatgpt.site. Supply it using --origin when deploying a private reachable HTTPS gateway. Bearer token can be copied locally from mobile_access.json into the dashboard's System connection form; never place it in URLs or upload it to chat. Tokens remain in browser memory only. Disconnect or reload to clear them. A root/same-user compromise is outside this simple local authentication boundary.

## Connection behavior
WebSocket first message authenticates the session; unauthenticated clients get no snapshot. Snapshots use read-only SQLite access, expose budgets as strings and research topic counts only. Private journal notes and transaction rows aren't sent. No mock data is substituted on connection failure. Connected mode shows last-update time and disconnected state. Decimal strings are padded to six places without conversion to JavaScript floating point; integer cents format using BigInt.

Run read-only gateway diagnostics uses POST /api/diagnostics, returns a job ID, and polls status. It runs the shipped read-only SQLite integrity function. It deliberately does not execute the existing system_diagnostic.py, which has not been reviewed. No trading, IRS submission, autonomous remediation, notification sending or research writes are accessible from the gateway. Future access to such actions requires separately reviewed permission/outcome controls.

## Verification and open dependencies
- Seven Node decimal-formatting/escaping checks and JS syntax checks.
- Thirteen isolated backend tests: authentication, origin rejection, snapshots, unchanged DB bytes, WebSocket authentication, forbidden commands, diagnostic jobs, CORS, missing DB, research alias conflict and static-path limits.
- Managed browser-control skill was unavailable in the build environment. Visual/browser QA, home-screen installation, TLS certificate/phone trust, real WebSocket connectivity and Mac host execution remain unverified. CSS uses responsive layouts at 350, 560, 800 and 1100px, but code inspection does not establish rendered accessibility or device compatibility.
- No remote private connection service, native signing credentials, App Store/TestFlight release, unattended host service or notification scheduler is provisioned. This is a practice app plus a connection-ready source package, not enterprise-wide production clearance.

Do not claim measured performance from the practice chart or fictional budgets. Source-level test success is not proof of tax/regulatory compliance or zero defects.
