10. Architecture PRDs

10.4 Chinwag Local Web App & Command Center

chinwag ui --open

PRD-0039 & CHWG-0203: Customer-first local web application compiled into the chinwag CLI for active tasks, self-healing CI runs, code diff and visual previews, credit usage, and zero-knowledge Slack/GitHub/Linear notifications.

10.4 Chinwag Local Web App & Command Center

chinwag ui --open

PRD Metadata (PRD-0039 / CHWG-0203):

  • Status: IN FLIGHT — CUSTOMER-FIRST CLEAN PRODUCT REDESIGN (03 · ⚡ IN FLIGHT)
  • Live Board Ticket: CHWG-0203 on GitHub Projects v2 (github.com/orgs/emunlabs/projects/1)
  • Invariants Enforced: ADR-002 · ADR-003 · INV-LOOPBACK-HARDEN-01 · INV-SLACK-ZK-01 · INV-VERIFY-BEFORE-DECRYPT-01 · INV-NEVER-STOP-FOR-APPROVAL-01
  • Author & Assignee: Brian Spector (Emun Labs, Inc., 1401 Lavaca St STE 81335, Austin, TX 78701) · @ARCHITECT · @RUST · @TYPE · @QA

1. Product Philosophy: Customer-First Clarity, Invisible Security (ADR-002 & ADR-003)

The Chinwag Local Web App (chinwag ui --open) is a clean, cross-platform web interface compiled directly into the chinwag Rust binary and served locally on the developer's or engineering manager's machine.

  1. Designed Strictly Around Customer Jobs-to-be-Done:
    • Every navigation item, card, and action button speaks plain, Linear/Slack-grade product language focused on the customer's own repositories, pull requests, CI builds, and team velocity.
    • Internal protocol codes, cryptographic primitive names, and underlying provider plumbing remain invisible by default—tucked cleanly inside an optional [✓ Verified · View Security Receipt ▸] drawer only when an engineer or auditor chooses to inspect a signature or hash.
  2. One Cross-Platform Local Web Application (ADR-003):
    • Ships as a zero-dependency static web application embedded inside the chinwag binary with Day-1 parity across macOS, Linux, and Windows WSL2.
  3. Zero-Knowledge Local Custody (ADR-002 & INV-SLACK-ZK-01):
    • Cloud Notification Bridge: Delivers 4-state Slack, GitHub, and Linear build/task cards containing strictly non-sensitive status metadata (0 repository file paths, 0 source code lines, 0 raw logs).
    • Local Workstation Decryption: Source diffs, CI failure logs, and visual previews are unsealed and rendered strictly on the developer's local machine when clicking [Open Locally ↗] from Slack, GitHub, or Linear (https://chinwag.sh/open#...). Zero inbound ports, VPNs, or tunnels are ever required.

2. Split-Trust Local & Cloud Architecture

flowchart LR
  subgraph Cloud["Zero-Knowledge Cloud Notification Bridge (0 Source Code / 0 File Paths)"]
    Slack["Slack / Linear / GitHub\n(4-State Live Status Card)"]
    Bridge["Chinwag Notification Bridge\n(Status Metadata Only · INV-SLACK-ZK-01)"]
    Bounce["https://chinwag.sh/open\n#task=CHWG-0203 (URL Fragment Only)"]
    Slack <-->|"Status & Timing Metadata Only"| Bridge
    Slack -->|"URL #fragment (Never Sent to Server)"| Bounce
  end

  subgraph Local["Developer Workstation Local App (chinwag ui --open)"]
    Browser["Chinwag Local Web App\n(Midnight & Daylight Themes)"]
    Guard["5-Layer Localhost Security Guard\nHost Match + Same-Origin + CSRF + 30s Stream Ticket"]
    Engine["Local Chinwag CLI Server\nLocal Diff Rendering & Signature Verification"]
    Repo["Customer Git Repository & Tasks\n(100% Local Source Custody)"]
    Bounce -->|"250ms Local Ping -> Instant Deep-Link"| Browser
    Browser <-->|"Local REST & Live Event Stream"| Guard
    Guard --> Engine
    Engine <--> Repo
  end

Five-Layer Localhost Security Guard (INV-LOOPBACK-HARDEN-01)

Every local HTTP request passes five automatic browser-isolation checks inside chinwag ui so no external website visited in the browser can probe or invoke the local server:

  1. Exact Numeric Host Verification (421 Misdirected Request): Rejects DNS-rebinding requests whose Host header does not match the bound numeric loopback address byte-for-byte.
  2. Fetch Metadata & Origin Isolation (403 Forbidden): Rejects cross-site requests where Sec-Fetch-Site is not same-origin.
  3. Double-Submit Cookie + Header CSRF Token (403 Forbidden): Requires both a port-bound HttpOnly; SameSite=Strict cookie and matching X-Chinwag-Local-CSRF header on every API call.
  4. Single-Use 30s Event-Stream Ticket: Mints a short-lived 128-bit single-use ticket (POST /api/bus/stream-ticket, TTL = 30s) before opening the live EventSource stream.
  5. Zero-CDN Content Security Policy: Serves all fonts, stylesheets, and scripts locally from the chinwag binary with default-src 'none'; script-src 'self'; connect-src 'self'; frame-ancestors 'none'.

3. Core Customer Views (chinwag ui --open)

  1. Active Work & Board (Default View):
    • In-Flight Tasks: Live cards showing the GitHub Issue or Linear ticket title, assigned coding agents (Solo, Pair, or Triad), elapsed time vs. DORA benchmark, and sub-issue checklist progress (3/4 Surfaces Complete).
    • Shipped While You Worked: Completed tasks that passed all automated CI, visual geometry, and cross-model review gates, with 1-click [View Diff & Preview] and [Revert Commit].
    • Team & Agent Composer: Natural @agent and #issue message bar with zero CLI flags or raw cryptographic hashes exposed in the UI.
  2. CI & Self-Healing Builds:
    • Live build timeline showing <2s CI failure wakeups, deduplicated matrix root-cause cards, automated fix diffs, and re-run verification status.
  3. Diffs & Visual Previews:
    • Side-by-side syntax-highlighted code diffs and 1440×900 desktop / 390×844 mobile visual screenshots, with cryptographic signature details tucked inside a clean collapsible [✓ Verified · View Security Receipt ▸] drawer.
  4. Velocity & Time Saved:
    • Engineering throughput, First-Pass CI Green rate, 7-day commit survival, and cumulative Net Hours Saved synced bi-directionally with GitHub Projects v2 and Linear.
  5. Usage, Credits & Team Settings:
    • Organization Credit Pool balance, per-workflow credit consumption (CI Remediation, Cross-Model Pair / Triad, Visual & Copy Gate), saved CI runner minutes, and 1-click audit export.

4. Mechanized Delivery Slices on the Project Board (CHWG-0203)

  1. Slice 1 (#CHWG-0203.1 — 5-Layer Localhost Security Server & Live Event Stream): Ship the hardened local HTTP/SSE server (421 Host guard, double-submit CSRF cookie, 30s single-use stream tickets, and zero-CDN CSP headers).
  2. Slice 2 (#CHWG-0203.2 — Customer-First Local Web App & Diff/Preview Inspector): Build the embedded cross-platform web interface (Midnight & Daylight themes) using plain customer-facing product language, zero vendor/stack leaks, and progressive security receipt drawers.
  3. Slice 3 (#CHWG-0203.3 — Zero-Knowledge Slack/GitHub/Linear Bridge & #fragment Deep-Link): Ship 4-state status notifications (INV-SLACK-ZK-01) and https://chinwag.sh/open local deep-link routing.
  4. Slice 4 (#CHWG-0203.4 — Desktop & Mobile Visual Geometry Verification): Verify 0.0px horizontal overflow, WCAG AA/AAA contrast, and zero jargon/vendor leaks via chinwag-ci ui-gate.