Architecture Decision Records

Use 000-template.md. Accepted initial decisions:

  • 001-go-module-layout.md — one Go module at the repository root until independent release/versioning is justified.
  • 002-messenger-envelope-v1.md — strict, bounded envelope structure; cryptographic verification and authorization remain separate. Amended 2026-10-17: the closed set gains execution.started and execution.output (ADR-009).
  • 003-local-status-ipc.md — foreground Mio status service over bounded, same-UID-authenticated Linux Unix-socket IPC; amended 2026-10-16 so that an flock on scoprad.lock serves as the single-daemon lock, and again so that the default state directory is the persistent $XDG_STATE_HOME/scopra (~/.local/state/scopra).
  • 004-workspace-validation.md — canonical workspace paths; rejection of the filesystem root, home directories, and other protected directories; owner-only roots; filesystem-identity fingerprint v1 and revalidation.
  • 005-workspace-registry-storage.md — version 1 workspaces.json in a directory the caller owns exclusively; no duplicate or overlapping workspaces and none containing the registry; atomic writes and fail-closed reads. Amended 2026-10-16: Mio opens the registry at startup and refuses to serve if it is unusable, and no workspace may contain or lie inside the registry directory.
  • 006-local-workspace-commands.md — workspace.add, workspace.list, and workspace.remove over IPC v1 with typed error replies and ID-cursor paging that fits each page in one frame; same-UID authorization for registration only, on the local socket only. A 2026-10-17 note records ADR-011's qualification for local runs.
  • 007-execution-request-v1.md — the strict execution.request payload: exact keys, no nulls, transmitted text preserved exactly, shell false only, a workspace-relative working directory, explicit workspace access, network none only, sanity-bounded limits, and a request window of at most one hour. The canonical form and action hash remain a follow-up. Amended 2026-10-16 so that the executable, working directory, and reason also reject the line and paragraph separators U+2028 and U+2029.
  • 008-canonical-execution-request.md — the canonical form of a whole version 1 execution request (RFC 8785 JCS, computed from the decoded value) and its action hash: lowercase hex SHA-256 over the label scopra/execution.request/v1 and a newline, then the canonical bytes. Mio always recomputes the hash. Includes two normative test vectors.
  • 009-execution-lifecycle-messages.md — Mio's execution states, plus four payloads: execution.started and execution.output (both new types that amend ADR-002's closed set), execution.result (exactly once, with exact keys for each state), and execution.cancel. Output travels as base64url chunks numbered in one sequence across both streams, and results carry only metadata. It also defines the error codes, and the keys that make repeated messages idempotent. Fully implemented in packages/protocol as of 2026-10-17.
  • 010-hollow-rootless-podman.md — Hollow runs each execution in one rootless Podman container, never as a native process. It requires Podman 4.0 or later, cgroups v2 delegation, and a configured image pinned by digest with no default. It fixes the exact podman run argument vector: no network, no capabilities, no-new-privileges, a read-only root, the workspace as the only (CSV-quoted) mount, an empty environment, explicit limits with no swap, output passed straight to Mio and never logged, and an entrypoint override that keeps the argument vector exact. SELinux labels are disabled rather than the workspace relabelled. Implementation is planned in four increments; the argument builder, the preflight check, the runner, and Mio's wiring are implemented against a fake Podman, and no real Podman host has run them yet. An amendment adds the scoprad --sandbox-image setting and a runner (with timeout, cancellation, preflight, and leftover cleanup) tested against a fake Podman, both now implemented, and splits the runner into parts buildable here against a fake Podman, plus verification on a real host.
  • 011-local-execution.md — local execution over the Mio socket: the user's own action, contained in Hollow, with no grant or approval because nothing is delegated. It qualifies ADR-006's execution sentence for local runs only. Mio builds the full ADR-007 request with local principals taken from the peer credentials. The reply is streamed as started, output (base64url, at most 32 KiB), and result frames, with a 30-second write deadline, cancellation on disconnect, and at most 4 concurrent runs. The ADR also covers the scopra run command and its exit statuses. Amended 2026-10-17: ADR-013 adds a bounded metadata-only journal of answered runs, with no output and no command line.
  • 012-systemd-user-service.md — Mio runs as a systemd user service, never a root service. scopra service install writes one unit whose ExecStart is the durable configuration (absolute scoprad, explicit --state-dir, optional digest-pinned --sandbox-image), then enables and starts it; uninstall reverses that and status is read-only. The unit requests Delegate=cpu cpuset io memory pids, and the installer probes Podman in a transient user service with the same delegation. The unit cannot use NoNewPrivileges, ProtectHome, or ProtectSystem, because rootless Podman needs its setuid helpers and the workspace under the home directory. Installs are atomic and fail closed, refuse foreign units, and restore the previous unit when systemd rejects the change. It settles ADR-010's deferred question: there is no separate config file or environment variable.
  • 013-run-journal.md — Mio keeps a bounded, metadata-only journal of answered runs at <state-dir>/runs.jsonl (1000 entries and 1 MiB, owner-only 0600, atomic rotation, torn tail discarded, other corruption refuses startup) and serves it read-only over execution.logs; scopra logs renders it as text or schema-v1 JSON. It stores no command line, arguments, path, or output, and a journal that cannot be opened stops Mio, while a failed append stops later runs. Output capture is deferred to its own ADR.
  • 014-open-source-no-pricing.md — Scopra is released under the MIT License, with no pricing model: no paid tiers, subscriptions, usage-based billing, plan limits, feature gates, trials, or account requirements. Contributions are inbound under the same terms, third-party material keeps its own license (see NOTICE), and the plan's billing item and the PRD's implied tiers are removed.
  • 015-documentation-site.md — the documentation site is generated from the repository's Markdown by a standard-library Go program (tools/docsite), committed as static HTML in apps/docs-site/public, and served by Vercel with no build step. Links are rewritten at build time and an unresolvable link fails the build; TestCommittedSiteIsUpToDate fails when the committed site no longer matches the docs. Chosen over a Node static-site generator and over downloading a Go toolchain during the deploy, because Vercel's build image has no Go and the project keeps one dependency-free toolchain.
  • 016-one-command-installer.md — installing Scopra is one copy-paste command: a POSIX install.sh published with the documentation site downloads the release, verifies its SHA-256 against the release's checksums.txt, and hands the terminal to scopra install, a Go TUI built on a new standard-library internal/tui package. The script never uses sudo, never evaluates downloaded text, and writes only inside a temporary directory; the installer opens /dev/tty so that curl … | sh can still be interactive, runs the Podman preflight in a transient delegated user service (and checks the current context for --no-service), changes nothing until confirmed, copies binaries atomically, and calls scopra service install rather than duplicating the unit. --yes is the non-interactive path, and a missing terminal without it stops instead of installing silently. Linux only, because containment requires Linux namespaces and cgroups. Amended 2026-10-17 by ADR-017: a missing prerequisite can be installed by the interface, after it prints the exact command and the user presses y.
  • 017-opt-in-prerequisite-provisioning.md — the installer may install a missing prerequisite (today, Podman) with the distribution's own package manager, and only on request: the checks screen offers f, a confirmation screen prints every argument vector, y runs them, and Enter, n, or Escape cancels. The plan is derived from /etc/os-release and a fixed table (never guessed, never a shell), sudo is used only when it exists and the process is not root, and the terminal is handed to the child so the installer never sees a password. --yes never provisions; an unknown system keeps the manual instructions. Cgroup delegation is also provisioned opt-in with a staged systemd drop-in. The installer and doctor test Podman in a transient delegated user service; a no-service install additionally checks the current process context. Rechecks use actual results, never a guessed relogin remedy, and an already-installed drop-in is not offered again.

Required follow-up ADRs cover device identity, relay transport/reconnect, containment backend, canonical execution requests, audit integrity, MCP authorization, output/redaction, token revocation, and update signing.