# Initrix auth.md

Initrix runs AI coding work for a team on its members' own computers. Lab holds
projects, conversations and jobs; Compute holds the connected computers. Agents
reach Initrix through its remote MCP server, `https://api.initrix.dev/mcp`.

This file says how an agent can ask for access on behalf of an existing
Initrix user. It follows the WorkOS auth.md profile
(https://workos.com/auth-md/docs/apps). The machine-readable source of truth is
the protected resource metadata below.

## Discovery

- Protected resource metadata (RFC 9728): https://api.initrix.dev/.well-known/oauth-protected-resource
  lists two authorization servers: WorkOS AuthKit, then `https://api.initrix.dev/agent-auth`.
- Authorization server metadata for agent registration (RFC 8414), with the
  `agent_auth` block: https://api.initrix.dev/.well-known/oauth-authorization-server/agent-auth
- A request to `https://api.initrix.dev/mcp` without a token answers 401 with
  `WWW-Authenticate: Bearer resource_metadata="https://api.initrix.dev/.well-known/oauth-protected-resource/mcp"`.
  That document is for MCP clients that sign in with OAuth (for example
  `claude mcp add --transport http initrix https://api.initrix.dev/mcp`) and lists only
  AuthKit. Agents using this file start from the documents above.

## Supported registration types

| type | supported | notes |
| --- | --- | --- |
| `service_auth` | yes | User claimed, by email. Send the user's Initrix email as `login_hint`. No credential is issued until that user signs in to Initrix and approves. |
| `anonymous` | no | Initrix does not accept agents without a user. |
| `identity_assertion` | no | Provider-verified identity (ID-JAG) is not accepted in this version. |

Initrix never creates an account for an agent. A `login_hint` that is not
an Initrix user can never be approved, and only the user it names can approve
it: a person signed in to any other account is refused.

## Flow

1. `POST https://api.initrix.dev/agent-auth/agent/identity` with JSON `{"type": "service_auth", "login_hint": "<email>"}`.
   The reply carries `claim_token` (keep it secret), `claim_token_expires`,
   `post_claim_scopes`, and a `claim` block with `user_code`,
   `verification_uri`, `expires_in` and `interval`.
2. Show the user the `verification_uri` and the six-digit `user_code`. They
   sign in to Initrix as usual, check the request, type the code and approve.
   Initrix never sends the code by email.
3. Poll `POST https://api.initrix.dev/agent-auth/oauth2/token` (form-encoded)
   `grant_type=urn:workos:agent-auth:grant-type:claim&claim_token=<clm_...>`
   no faster than `interval` seconds. Until the user approves the answer is
   `authorization_pending`; polling faster answers `slow_down`; a closed
   window answers `expired_token`.
4. On approval the reply is an `access_token` (Bearer, one hour) plus an
   `identity_assertion` and `assertion_expires`. Use the access token on
   `https://api.initrix.dev/mcp` in the `Authorization` header.
   The claim token works for that one successful poll only; after it, use
   the assertion.
5. When the access token expires, exchange the assertion:
   `grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=<identity_assertion>&resource=https://api.initrix.dev/mcp`
   (`resource` is required). No refresh token is ever issued.
6. If the code expired or was mistyped too often, `POST https://api.initrix.dev/agent-auth/agent/identity/claim`
   with `{"claim_token": "<clm_...>", "email": "<the same email>"}` for a new code and link.
7. Revoke an access token with `POST https://api.initrix.dev/agent-auth/oauth2/revoke`
   (`token=<access_token>&token_type_hint=access_token`). The user can revoke
   the whole connection at any time in Initrix Settings → Agents; after that
   the access tokens and the assertion are refused.

## Scopes

An approved agent gets exactly these, read-only:

- `lab:read`: list projects and conversations, read messages, jobs and job
  progress, under the same membership rules as the website.
- `compute:read`: see the user's connected computers, shared folders and
  whether a computer is ready to run work.

No other permission can be requested or granted through auth.md in this
version. Nothing an agent does through it can send, run, change or spend.

## Limits

Registrations are rate limited per source and overall; a refused request
answers 429 with `Retry-After`, and so does minting more than 10 access
tokens a minute for one approval. A code lives 10 minutes and allows five
wrong tries; after that the poll answers `expired_token` until you ask for a
new code. An approval lasts 30 days, and a user has at most 10 active ones.

## Links

- How to connect an agent: https://initrix.dev/agents
- Agent skill: https://initrix.dev/agents/initrix/SKILL.md
- Plans and pricing: https://initrix.dev/plans
- Terms: https://initrix.dev/terms
- Privacy: https://initrix.dev/privacy
- Contact, including integration problems: https://initrix.dev/contact
