## 1. Philosophy & Design Rationale

### 1.1 The Inversion

The web's default interface is HTML/CSS/DOM for human visual consumption. Agents reverse-engineer meaning via screenshots, DOM parsing, accessibility trees, or CDP.

**APP inverts this:** the canonical representation of a page is a structured, typed JSON **Page Manifest** describing:

1. Current **state** (what is true on this page now)
2. Available **actions** (what can be done next)
3. **Navigation** (where else the agent can go)
4. Optional **presentation hints** (how a renderer should display it to humans)

Agents consume the manifest natively. Humans consume it through a Renderer.

**Two audiences, one source of truth.**

### 1.2 Design Pillars

| Pillar | Rule | Rationale |
|---|---|---|
| Typed, not marked-up | Values carry `type` + `value` | Eliminates agent type-guessing |
| Diffs over dumps | Mutating responses prefer JSON Patch | Cuts payload ~95% for typical actions |
| Same-origin actions | POST only to origin that served the page | Reuses browser security model |
| Presentation is optional | Agents MUST ignore `/present` | Keeps agent path lean |
| Explicit side effects | Every action declares `side_effect` | Enables confirmation UX & policy |
| Fail loud | Every failure has a const error code | Agents branch without NLP |

### 1.3 Non-Goals

APP **MUST NOT** attempt to:

- Replace general-purpose RPC (use MCP/OpenAPI for that)
- Stream token-by-token LLM output (out of scope; use SSE/WebSocket separately)
- Encode full CSS layout engines in JSON
- Carry authentication secrets inside manifests
- Support cross-origin action execution without an explicit future extension

---

