# equipo

An Oficina app: a coordinator and a team of AI specialists for running your own apps. The design is on the `design` branch.

<!-- COPY APPROVED BY DELEGATION (Luna pass, 2026-11-01, house rules). -->

## Local startup

Create `.env.local` with the values below. Generate the instance key once with
`openssl rand -hex 32` and keep that value across restarts.

```sh
EQUIPO_ORIGIN=http://127.0.0.1:8824
EQUIPO_INSTANCE_KEY=replace-with-your-generated-key
EQUIPO_OWNERS=you@example.com
EQUIPO_ALLOW_LOGGED_MAIL=1
```

Run `./run.sh`. It builds the app when needed and stores its data in `equipo.db`.
Owners are seeded on the first boot only when the database has no team. With
logged mail enabled, sign-in links are written to the local log. The environment
file, database and `.local` build directory are ignored.

For disposable sample data, run
`CGO_ENABLED=0 go run ./tools/drive -db "$TMPDIR/equipo-drive.db"`.
The path must be unused. Open the sign-in link it prints and confirm it in your
browser. The drive listens on `127.0.0.1:8824` and removes its database when you
stop it with Ctrl-C.


## Deploying

Deploy Equipo to account `oficina` on the flagship console:
[https://console.carloku.com/a/oficina](https://console.carloku.com/a/oficina).
Project account labels do not change the deployment target.

Before the first boot, configure app `equipo` in account `oficina`:

- Use `carlos env set` for `EQUIPO_ORIGIN`, the confirmed HTTPS origin people
  will use, and `EQUIPO_OWNERS`, the comma-separated owner addresses. Owners
  are seeded only when the database has no team. Use People to change the
  roster after the first boot.
- Use `carlos env set` for `EQUIPO_ASSISTANT_HOSTS`, the comma-separated
  origins of the Base instances whose operations the Assistant may call, for
  example `https://base.example.com`. A person's Base registers one of them as
  its host; Equipo calls no other address. Unset, nobody can register one.
- Use `carlos secrets set` for `EQUIPO_INSTANCE_KEY`. Generate it once and keep
  it stable across releases and restarts. CARLOS seals app secrets and delivers
  them to the process as environment variables.
- Enable the app's email sender with `carlos email enable`. CARLOS verifies the
  sending domain through SES and delivers `CARLOS_SMTP_HOST`,
  `CARLOS_SMTP_FROM`, `CARLOS_SMTP_PORT`, `CARLOS_SMTP_USER` and
  `CARLOS_SMTP_PASS`. Equipo reads these platform settings for sign-in mail.

Leave `EQUIPO_ALLOW_LOGGED_MAIL` unset in production. It is for local use and
writes sign-in links to the log. Equipo makes no provider calls and needs no
CARLOS CLI credentials at runtime. The human operator uses their own CARLOS CLI
access to deploy.

Confirm the target architecture before building. Start from a clean, reviewed
commit and run:

```sh
make release
```

This builds `releases/equipo-linux-arm64` with CGO disabled and stamps the value
from `git rev-parse --short HEAD` into the binary. Tracked changes block the
build. For an amd64 target, use `make release RELEASE_GOARCH=amd64` and deploy
`releases/equipo-linux-amd64` instead.

Confirm that your CLI targets the flagship console. Run this command for the
default arm64 build:

```sh
carlos deploy --app equipo --account oficina --channel edge --timeout 5m ./releases/equipo-linux-arm64
```

With `EQUIPO_EXECUTION_ENABLED=1`, add `--swap hold` (before the binary path). Only one
process may own execution, so the old build must stop before the new one starts;
without it the new build exits with "This record changed" and the rollout stops.

`EQUIPO_EXECUTION_MARKER_PATH` is the execution witness. It must sit
outside the database's directory, on storage that survives a database
restore on its own. On CARLOS, that is the instance's own directory, for
example `/data/instances/<instance host>/execution/witness`. If the witness
is lost or disagrees with the database (a restored snapshot, a replaced
box), Equipo still starts, but execution comes up quarantined. Every action
that was in flight is marked uncertain, and no new work is admitted. An
owner reviews the uncertain actions and releases execution at Settings,
Recovery (`/settings/recovery`). Equipo never resumes on its own after a
lost witness.

Equipo also answers `GET /api/team`, the readiness probe Alta reads before
it activates a team instance in Home's directory. Equipo has no Home roster
mode, so the probe answers in the seeded mode: the configured
`EQUIPO_HOME_CONSUMER_ID`, and whether an active owner exists. It carries
no address, and answers 404 without Oficina ID.


Keep the flags before the binary path. After deployment, poll `GET /api/version`
on the deployed origin until the process reports the stamped commit. The
router's `X-Carlos-Version` header does not confirm the running process version.
A successful local build does not confirm a successful deployment.

After deployment, complete these checks:

1. Sign in as a configured owner. Add a second roster member and an account
   label. Create App, Website and Repository projects, including one with only
   a repository. Refresh and restart the app, then check that the data persists.
2. Sign in as the member. Check shared visibility and denied owner edits. Open
   every empty destination and the phone Work index.
3. Confirm that no runner is enrolled, no execution job exists, and Equipo made
   no provider or CARLOS credential request. Record acceptance in the normal
   review record.

4. Walk the app once with normal motion, with reduced motion turned off, and
   note any browser console error. The automated walk uses reduced motion.
