| 1 | # Equipo |
| 2 | |
| 3 | One instance belongs to one team. Members share projects and work. |
| 4 | Read `docs/superpowers/specs/2026-11-01-equipo-design.md` and the current |
| 5 | controller brief before changing behavior. Task dispatch instructions take |
| 6 | precedence over generic workflows. |
| 7 | |
| 8 | ## Model text and authority |
| 9 | |
| 10 | 1. Model-written text is never the person's words. A tapped option the model |
| 11 | wrote is a choice among model text, not a statement by the person. |
| 12 | 2. A change never authorises its own merge. Evidence the candidate can edit |
| 13 | (its own checks, its own diff) is never trusted. |
| 14 | 3. Untrusted text enters a prompt only quoted, under a label naming its source. |
| 15 | 4. Anything an agent writes that leaves the system or opens in a browser needs |
| 16 | the person's tap or a standing project setting they chose, plus deterministic |
| 17 | checks. A private tailnet limits readers; it does not stop a page sending |
| 18 | data elsewhere. |
| 19 | 5. A sandbox that runs agent-chosen code has no network. Dependencies come |
| 20 | from a mirror. |
| 21 | |
| 22 | ## Data and authority |
| 23 | |
| 24 | - Never use `scope.Owned` or `scope.OwnedBy` for shared team records. |
| 25 | - Derive `Actor` from the verified session, never a submitted form field. |
| 26 | - Check the current roster inside each write transaction. Removal and role |
| 27 | changes must affect existing sessions immediately. Lookup errors deny access. |
| 28 | - Use the transaction handle throughout a transaction. Append the audit event |
| 29 | there too, with no credentials in it. |
| 30 | - Never bind requests onto GORM models. Read allowed fields explicitly and use |
| 31 | `.Select` for updates. |
| 32 | - Keep migrations additive. App tables belong in `Models` and `Schema`; |
| 33 | framework sessions, auth and proof tables belong only in `BootSchema`. |
| 34 | - An unknown count must remain unknown. Never turn a query error into zero. |
| 35 | - `NewStore` grants no authority. Execution is off unless |
| 36 | `EQUIPO_EXECUTION_ENABLED=1`; runner dispatch uses only the gated paths. |
| 37 | |
| 38 | ## Boot and interface |
| 39 | |
| 40 | Require `EQUIPO_ORIGIN` and `EQUIPO_INSTANCE_KEY`. Require a mail channel: |
| 41 | CARLOS mail submission (`CARLOS_MAIL=submit`, set only by the CARLOS agent), or |
| 42 | both `CARLOS_SMTP_HOST` and `CARLOS_SMTP_FROM`, unless local logged mail is |
| 43 | explicitly enabled with `EQUIPO_ALLOW_LOGGED_MAIL=1`. Logged mail is |
| 44 | allowed only on loopback or a staging origin. Build the sender with `equipo.Mailer` (`mail.FromCarlos`) only on |
| 45 | the serve path, never in a seed or one-shot, which has no control socket. |
| 46 | `EQUIPO_OWNERS` is enforced by bootstrap only when the database has no team. |
| 47 | Never log credentials or sign-in links in production. |
| 48 | |
| 49 | Production upgrades: an agent runs `scripts/upgrade-thin.sh <version> --execute` (and its rollback) itself, then tells Paul. With a green staging run and no waiver it needs no one's go (Paul, 2026-11-20). A waiver is Paul's decision; once he approves one, the agent still runs the upgrade, not Paul (Paul, 2026-11-22). The cutover scripts and anything needing the owner's sign-in (enrolment links, revoking machines) stay with Paul. |
| 50 | |
| 51 | The page renderer is not in the instance (it would pass the platform's 256 MiB ship cap). A release whose `renderer.tar.gz` changed is published before staging with `scripts/publish-renderer.sh publish <the runner release directory>`: the archive and its `SOURCES` on the forge, under the tag linked into the runner. Staging downloads and checks it (`publish-renderer.sh check`) before it installs anything, and refuses an unpublished one. Self-serve installs fetch it from there. |
| 52 | |
| 53 | Use Rastrillo v0.45.0 APIs from the pinned module cache. Resolve activation, |
| 54 | open one database, construct the app, clear `opts.DBPath`, then serve. |
| 55 | The database closes on shutdown and on failed app construction. |
| 56 | |
| 57 | Use the day theme and sidebar shell. Link tokens.css and theme.css. Keep |
| 58 | vendored static files byte-identical and put app styling in equipo.css. |
| 59 | The sign-in door (`internal/equipo/door`, Home's smart-door spec) is |
| 60 | estilo's door around rastrillo's one-way screen; `static/estilo/` is |
| 61 | estilo's, byte for byte. |
| 62 | Use the attribute grammar, token colors, scriptless forms and phone index |
| 63 | navigation. Do not add a split screen or an authentication bypass. |
| 64 | |
| 65 | ## Copy and verification |
| 66 | |
| 67 | App-owned runtime strings live only in `internal/equipo/copy.go`. Mark changed |
| 68 | entries pending with `python3 scripts/copy-status.py pending` (bounded JSON |
| 69 | stdin: candidate root and keys). The trusted-base `.equipo/copy.json` contract |
| 70 | extracts changed values independently of markers. When an owner enables |
| 71 | "Copy can accept on my behalf" for this project, Copy reviews structured |
| 72 | strings and the runner applies the result and invokes `accept` only for the |
| 73 | reviewed changed keys, with matching server records and exact text hashes. |
| 74 | Engineering never invokes `accept` or writes acceptance markers. With the |
| 75 | setting off, Copy does not run and pending copy still blocks release. |
| 76 | `regenerate` repairs pending bookkeeping; `verify` checks without writing. |
| 77 | The release gate remains `make copy-release-check`. Owner edits and imports |
| 78 | teach only that delegating owner's Copy notes; forge diffs never teach. |
| 79 | Use plain words, no em dashes and no exclamation marks. Leave README prose |
| 80 | unchanged unless the task explicitly authorizes reviewed or flagged draft copy. |
| 81 | |
| 82 | Write a failing test before implementation. Observe each guard fail by |
| 83 | breaking the behavior it protects, then restore it. Record the commands and |
| 84 | results in the controller report. |
| 85 | |
| 86 | `make ci` is the shared local and CI gate: build, vet, formatting, staticcheck, |
| 87 | govulncheck, gitleaks, budgets, tests, migration check and performance. Keep |
| 88 | `.amadan/ci` and `.amadan/ci.d/` delegating to the same Make targets. Follow the |
| 89 | controller's narrower gate list for individual tasks. Builds use `CGO_ENABLED=0`. |
| 90 | |
| 91 | Never merge, push the default branch, or deploy autonomously. Human deployment |
| 92 | uses a versioned release. Keep scratch under on-disk `$TMPDIR`, leave Go caches |
| 93 | at their defaults, bind local servers to `127.0.0.1`, and clean up processes |
| 94 | and scratch before handing back. |
| 95 | |