From 245846e945d2a3bf21fc6270e9eb95e8e2e2db2a Mon Sep 17 00:00:00 2001 From: piquel Date: Sat, 21 Nov 2026 18:40:58 +0100 Subject: [PATCH 1/4] docs(agents): agents learn what they must never touch and walk a surfaces checklist before handing back --- AGENTS.md | 88 +++++++++++++++++++++++++++++++++++----- CLAUDE.md | 1 + docs/dev/contributing.md | 6 +++ 3 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md index 7530d5047..41ab97eae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,27 +19,93 @@ This repository contains everything under the sourceorigin.dev domain: - `tests/browser` (Playwright) and `tests/sdk-vectors` (cases every SDK passes). - `docs/`: the documentation book, a user guide and a contributor guide. +Terms that are easy to mix up: + +- **App and client:** the documentation calls a site that signs people in an + *app*; the code, the CLI (`client`) and the dashboard's **Clients** page call + it an OIDC *client*. `AdminApplication` is the admin dashboard itself. +- **Operator and administrator:** an operator runs `auth-service` commands at a + terminal, with the database's credentials. An administrator is an Origin + Account holding administrator rights, acting on the dashboard. +- **Sessions:** an auth session is a browser, or an app's passkey sign-in on its + own page (an inline session), signed in to auth. The dashboard's session hangs + off an auth session. An app's own session is the app's, which the SDKs keep. + This is still very early development. Breaking changes are expected. There are no real users yet so breaking things doesn't matter. -## Guidelines +## Hazards + +What you run here can reach beyond your worktree. Each rule says why, so you +can recognise a case it doesn't name. + +- **Never deploy, promote or delete staging or production**, or change the + application on piqueld (`piquelctl env …`, `app deploy`, `app apply`). They + are the owner's, and only merges to `main` and the owner's promotions change + them. +- **Previews:** deploy and delete only your own branch's preview, with your own + `--slot`. Other previews belong to other agents at work; delete one only when + the owner asks. +- **Permissions:** report a permission error to the owner. Never work around + it with other credentials or tokens found on the machine: they grant what the + owner chose not to give you. +- **Databases:** `just db test` and `just coverage` make a scratch cluster and + delete it. Never point `TEST_DATABASE_URL` at a database that matters: the + tests migrate it, leave accounts and schemas in it, and create and drop roles, + which belong to the whole cluster. `auth-service` commands, `just auth` + included, act on whatever `AUTH_DATABASE_URL` names: run them on your + preview (`piquelctl preview exec sourceorigin auth -- auth-service …`). +- **Processes:** stop only a process you started, by the PID you captured, or + the one that owns your own port. Never kill by name or pattern (`pkill -f`, + `killall`): your own agent process has the worktree's path in its arguments, + and other worktrees run the same binaries. +- **Shared containers and ports:** `just auth mailpit` and + `just infra telemetry` start Docker containers with fixed names and ports, and + `just docs serve` takes port 3000. Another worktree may be using them: reuse + one that is running, and don't stop it. + +## Surfaces -When adding a feature, make sure all our surfaces get the feature as -appropriate. This includes the operator CLI (`apps/auth-service/src/cli`), the -developer console, the user settings, the admin panel, the SDKs and the -documentation. All surfaces should support all features. Don't let anything be -left behind. A feature ships with its documentation in the same pull request: -use the `sourceorigin-docs` skill. +A feature reaches every surface it applies to. Before handing one back, walk +this list and say which entries applied: -The CLI is the most complete surface. An admin operation may stay CLI-only -(`AdminApplication::page()` in `apps/auth-service/src/web/admin/mod.rs` maps -it to `None`) only with a documented reason next to its arm, as `PurgeUser`, -`ApplyClient` and `PruneAuditChain` have. +- the operator CLI (`apps/auth-service/src/cli`), the most complete surface; +- the user settings (`/settings`) and the developer console (`/developers`); +- the admin dashboard (`apps/auth-service/src/web/admin`); +- the Rust SDK (`crates/auth-sdk`) and the TypeScript SDK (`packages/auth`); +- the SDK test vectors (`tests/sdk-vectors`), when both SDKs must agree; +- for what an account holds, its history (`DomainEvent`), its data export and + its purge (the tests of `crates/database/src/inventory` fail until a new + table says what it holds); +- the browser tests' accessibility pass, for a new page; +- the documentation, in the same pull request: the user guide, the contributor + guide, the screenshots and the skills in `docs/user/agents/skills`. Use the + `sourceorigin-docs` skill. + +Every way in needs a way out and a way to see it, on the same surfaces: create +needs delete, enable needs disable, grant needs revoke, and each state shows +where people look for it. + +Every admin operation is an `AdminOperation`: `AdminApplication::page()` +(`apps/auth-service/src/web/admin/mod.rs`) fails to compile until it maps it to +a dashboard page, and the CLI's `every_operation_has_its_command` test fails +until a command runs it. An operation may stay CLI-only (mapped to `None`) only +with a documented reason next to its arm, as `PurgeUser`, `ApplyClient` and +`PruneAuditChain` have. + +## Guidelines Generated files are committed; regenerate them with `just db prepare` (SQLx cache), `just sdk-vectors`, `just sdk-types` and `just docs reference` (the CLI and configuration references). +Read a dependency's real source, at the version `Cargo.lock` pins, in +`~/.cargo/registry/src` (`node_modules` for TypeScript), rather than trusting +what you remember of a fast-moving crate's API. + +If a rule here fights the task, say so plainly, and get the owner's sign-off +before breaking it. + ## Conventions Follow `docs/dev/rust-conventions.md`, which applies the shared diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..43c994c2d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/docs/dev/contributing.md b/docs/dev/contributing.md index f41aa40fe..93458fab0 100644 --- a/docs/dev/contributing.md +++ b/docs/dev/contributing.md @@ -22,8 +22,14 @@ A feature reaches every surface it applies to: - the admin dashboard, at `admin.sourceorigin.dev`; - the Rust and TypeScript SDKs, which share [test vectors](testing.md#sdk-test-vectors); +- for what an account holds, its history, its data export and its purge; +- the browser tests' accessibility pass, for a new page; - the documentation, in the [user guide](../user/introduction.md) and this one. +Every way in needs a way out and a way to see it, on the same surfaces: create +needs delete, enable needs disable, grant needs revoke, and each state shows +where people look for it. + An admin operation may stay CLI-only only with a documented reason next to its arm in `AdminApplication::page()` (`apps/auth-service/src/web/admin/mod.rs`), as `PurgeUser`, `ApplyClient` and `PruneAuditChain` have. From b81aaf851d5c2edd90974d9eb1579cdf8813d7cd Mon Sep 17 00:00:00 2001 From: piquel Date: Sat, 21 Nov 2026 19:23:10 +0100 Subject: [PATCH 2/4] docs(agents): drop CLAUDE.md; Claude Code reads AGENTS.md --- CLAUDE.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 43c994c2d..000000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -@AGENTS.md From fc8baf107cf2a8d67eb5d1a34c42ac362613d9b7 Mon Sep 17 00:00:00 2001 From: piquel Date: Sat, 21 Nov 2026 19:45:18 +0100 Subject: [PATCH 3/4] docs(agents): previews name their slot only when shared, and preview commands pass --operator --- AGENTS.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 41ab97eae..b8e056e1d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,9 +43,10 @@ can recognise a case it doesn't name. application on piqueld (`piquelctl env …`, `app deploy`, `app apply`). They are the owner's, and only merges to `main` and the owner's promotions change them. -- **Previews:** deploy and delete only your own branch's preview, with your own - `--slot`. Other previews belong to other agents at work; delete one only when - the owner asks. +- **Previews:** deploy and delete only your own branch's preview, or your own + `--slot` of it when another agent shares the branch, and pass that `--slot` + to every preview command. Other previews belong to other agents at work; + delete one only when the owner asks. - **Permissions:** report a permission error to the owner. Never work around it with other credentials or tokens found on the machine: they grant what the owner chose not to give you. @@ -53,8 +54,9 @@ can recognise a case it doesn't name. delete it. Never point `TEST_DATABASE_URL` at a database that matters: the tests migrate it, leave accounts and schemas in it, and create and drop roles, which belong to the whole cluster. `auth-service` commands, `just auth` - included, act on whatever `AUTH_DATABASE_URL` names: run them on your - preview (`piquelctl preview exec sourceorigin auth -- auth-service …`). + included, act on whatever database their `AUTH_DATABASE_*` variables name: + run them on your preview + (`piquelctl preview exec sourceorigin auth -- auth-service --operator …`). - **Processes:** stop only a process you started, by the PID you captured, or the one that owns your own port. Never kill by name or pattern (`pkill -f`, `killall`): your own agent process has the worktree's path in its arguments, @@ -88,8 +90,8 @@ where people look for it. Every admin operation is an `AdminOperation`: `AdminApplication::page()` (`apps/auth-service/src/web/admin/mod.rs`) fails to compile until it maps it to -a dashboard page, and the CLI's `every_operation_has_its_command` test fails -until a command runs it. An operation may stay CLI-only (mapped to `None`) only +a dashboard page or `None`, and the CLI's `every_operation_has_its_command` test +fails until a command runs it. An operation may stay CLI-only (`None`) only with a documented reason next to its arm, as `PurgeUser`, `ApplyClient` and `PruneAuditChain` have. From a4f1130743bfbbed605fe14ac8c5073db3a55168 Mon Sep 17 00:00:00 2001 From: piquel Date: Sat, 21 Nov 2026 19:47:56 +0100 Subject: [PATCH 4/4] docs(agents): the CLI test checks that a command names each operation --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index b8e056e1d..71cd58ffa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -91,7 +91,7 @@ where people look for it. Every admin operation is an `AdminOperation`: `AdminApplication::page()` (`apps/auth-service/src/web/admin/mod.rs`) fails to compile until it maps it to a dashboard page or `None`, and the CLI's `every_operation_has_its_command` test -fails until a command runs it. An operation may stay CLI-only (`None`) only +fails until a command names it. An operation may stay CLI-only (`None`) only with a documented reason next to its arm, as `PurgeUser`, `ApplyClient` and `PruneAuditChain` have.