5. Architecture decisions to settle early
Write each as a short ADR (context, options, decision, consequences). A recommended default is given; override it if the repository or toolchain argues otherwise.
| ADR | Question | Recommended default |
|---|---|---|
| 0001 | Minimum macOS version and toolchain | Current macOS minus one major; decide from what is installed |
| 0002 | Blueprint / object format | JSON with canonical serialization, explicit schemaVersion, migrations from day one |
| 0003 | How custom logic runs when the catalog is not enough, given that arbitrary Swift must not be evaluated in the main process | A ladder: (1) declarative actions plus a small typed expression language; (2) scripts in a separate constrained process with no ambient file/network access; (3) real Swift generation only in the Tier C export |
| 0004 | SQLite access layer | One well-maintained library or a thin wrapper; no ORM magic |
| 0005 | Satellite architecture and signing | Prebuilt host that embeds the renderer/runtime so a satellite runs without PRISM open; manifest and data kept where they do not invalidate the signature, or the bundle is re-signed (ad hoc locally). Document exactly what Gatekeeper will do with a locally published app |
| 0006 | App Sandbox for PRISM itself | Decide explicitly: sandboxing constrains writing .app bundles and spawning workers. Record the trade-off and the real process-level controls used instead |
| 0007 | IPC between PRISM and satellites | XPC or an authenticated local transport; never an unauthenticated local HTTP server. Needed only for cross-app features, not for a satellite to launch |
| 0008 | Agent design | One coordinating agent with typed tools; "roles" are sections of its instructions, not separate running models. Add subagents only for measured gains |
Also write docs/security/threat-model.md covering: generated code, malicious imported files, prompt injection, compromised components, credential exfiltration, cross-app access, local service impersonation, resource exhaustion, unsafe shell execution.