AI Execution Protocol
Define **execution modes** for AI-assisted work in the Prox OS monorepo. Modes prevent oversized vibe-coding sessions from burning context, time, and credits on
Purpose
Define execution modes for AI-assisted work in the Prox OS monorepo. Modes prevent oversized vibe-coding sessions from burning context, time, and credits on unbounded refactors.
Canonical companions:
- cost-gate.md — S / M / L / XL classification
- task-splitting-protocol.md — slice rules
- prompt-templates.md — copy-paste user prompts
- ../rfcs/README.md — RFC workflow
- ../adr/README.md — ADR workflow
AGENTS.md enforces this at the repository level.
When to Enter Triage First
Enter Triage Mode (Mode 0) before editing implementation files when:
- The user has not said "go ahead", "proceed", or named a specific slice.
- The task touches architecture, migration, API, database, auth, permissions, window manager, Spaces, app contract, monorepo layout, or docs-wide rewrites.
- cost-gate.md trigger words appear in any language.
Mode 0: Preflight / Triage
Purpose: Assess cost and risk. Do not modify code unless the user explicitly asked for a direct patch on an S task.
Required output:
Task Level: S / M / L / XL
Estimated Scope:
Likely Files / Packages:
Risk Areas:
Needs RFC: Yes / No
Needs Task Split: Yes / No
Recommended First Slice:
Blocked Questions:
Proceed / Wait:Rules:
| Level | Action |
|---|---|
| S | May proceed with a focused patch after confirming scope. |
| M | Short plan, then patch. |
| L | Task split required; implement one slice per user confirmation. |
| XL | RFC or Plan required; no implementation until explicit approval. |
If the user says "analyze only", "direction first", or "do not change code", stay in Triage or Plan.
Mode 1: RFC
Purpose: Design cross-cutting or long-lived changes before code.
Triggers: See ../rfcs/README.md.
RFC must include: Status, Owner, Created, Related Packages, Context, Goals, Non-goals, Current Architecture, Proposal, Alternatives, Risks, Migration Plan, Task Breakdown, Acceptance Criteria, Implementation Notes.
Rule: Do not open implementation PRs for XL work without an Accepted RFC (or explicit user waiver documented in chat).
Mode 2: Plan
Purpose: Turn an RFC or large request into ordered slices.
Required phases:
Phase 1: Minimal Safe Change
Phase 2: Core Implementation
Phase 3: Integration
Phase 4: Verification
Phase 5: Docs SyncEach phase must specify:
Goal
Allowed Files
Forbidden Changes
Expected Diff Size
Validation Command
Rollback StrategyMode 3: Patch
Purpose: Execute one approved slice.
Default limits:
Max files changed: 8
Max packages touched: 2
No architecture rewrite
No unrelated cleanup
No opportunistic refactor
No docs-wide rewrite
Stop if scope expandsIf limits are insufficient, stop and output:
Scope expansion detected.
Reason:
New files/packages needed:
Recommended next slice:
Waiting for user confirmation.Mode 4: Verify
Purpose: Validate an existing change without adding features.
Allowed:
- Run or recommend
pnpm typecheck,pnpm lint,pnpm arch:check,pnpm check:cjk, targeted builds/tests. - Fix blocking compile/type errors introduced by the slice.
- Check acceptance criteria from RFC or slice definition.
Forbidden:
- New features, redesigns, scope expansion, unrelated doc rewrites.
Output format:
Verification Summary
Passed
Failed
Fixed
Remaining Risks
Recommended Next StepMode 5: Docs Sync
Purpose: Update documentation for a completed implementation.
Rules:
- Only docs tied to the change.
- No unrelated chapter rewrites.
- Record RFC deviations in Implementation Notes.
- Run
pnpm docs:syncwhen the public docs site must reflectdocs/changes.
Prox OS-Specific Guardrails
These areas inherit default risk from cost-gate.md:
- State: Zustand for local OS/window/Space state; TanStack Query for remote data — see ../architecture/state-model.md.
- UI boundary:
packages/os-uihas no business state, API, i18n, Query, or Zustand. - Apps: No deep imports from
apps/os-shell/src/shell/**orwindow-manager/**inpackages/os-apps. - Registry: New apps update
registry.ts, types, renderers, icons — Cmd+K picks up registry viacommandPaletteApps.ts.