Skip to content

Sign-in and sessions

People sign in to a hosted Felix with Google or GitHub. A signed-in person gets a session token, which clients send as Authorization: Bearer <token> exactly as they would the operator token. FELIX_API_TOKEN keeps working for automation and acts as an admin.

Caller Threads Approvals Traces, metrics, MCP endpoint, skill library changes
Member The threads they created. Anyone else’s thread answers 404, as if it did not exist. Those on their own threads; decisions are recorded under their id (github:<id> or google:<id>). No (403).
Admin Every thread. Every approval. Yes.
Operator token Every thread. Threads it creates have no owner, so only admins and the operator reach them. Every approval, recorded as operator. Yes.

Turning on bypass mode, which skips approval rules, also takes an admin, on a deployment that allows it (FELIX_ALLOW_BYPASS=on). Lists and search show a member only their own threads; a page can come back with fewer than its usual 100, and its cursor still pages on.

With sign-in on, each person also has long-term memories. On their own threads the model can propose one (remember) and look up accepted ones (recall); nothing is recalled until its owner accepts it, and only its owner sees it. GET /v1/memories lists them, POST /v1/memories/accept and /reject take { ids }, and DELETE /v1/memories/<id> forgets one. The rules are the terminal’s: see Memory.

Sign-in turns on when a provider’s client id and secret are set. Every setting is checked on the first request; a malformed one fails that request rather than letting the wrong people in.

Setting Required Meaning
FELIX_AUTH_KEY Yes 32 random bytes, base64 (openssl rand -base64 32). Seals the sign-in cookies, signs session tokens and seals stored connections. Changing it signs everyone out and disconnects everyone.
FELIX_AUTH_ORIGINS Yes Comma-separated origins a sign-in may return to, such as https://felix.example.com. Plain http only for localhost.
FELIX_AUTH_CALLBACK_PREFIX No Where the browser reaches the API, /api by default. The callbacks are <origin><prefix>/v1/auth/google/callback and …/github/callback.
FELIX_DEVICE_SIGN_IN No Signing in to the terminal with a GitHub code: member (the default) gives a member session even to an admin, full the person’s own role, off refuses it.
FELIX_LOGIN_TTL_SECONDS No How long a session lasts: 28800 (8 hours) by default, 60–86400. There is no refresh; signing in again renews it.

Create an OAuth client (type Web application) in Google Cloud, and add the Google callback for each origin as an authorized redirect URI.

Setting Meaning
FELIX_GOOGLE_CLIENT_ID, FELIX_GOOGLE_CLIENT_SECRET The OAuth client.
FELIX_GOOGLE_ACCOUNTS Who may sign in: JSON {"ada@example.com": {"role": "admin", "sub": "1093…"}, "bob@example.com": {}}. Only listed addresses get in, and only with a verified Google email. role is admin or member (the default). sub, the numeric Google account id, pins the address to one Google account, since an address on your own domain can be reissued to someone else; a refused sign-in’s log line names the id to pin.

Create a GitHub OAuth app (or a GitHub App with user authorization), set its callback to the GitHub callback, and enable the device flow if people will sign in from the terminal.

Setting Meaning
FELIX_GITHUB_CLIENT_ID, FELIX_GITHUB_CLIENT_SECRET The app.
FELIX_GITHUB_ORGS JSON {"acme": {"id": 1234567, "role": "member"}}: active members of these organizations get in. id is the organization’s numeric id (gh api orgs/acme --jq .id), so a renamed or re-registered organization does not let strangers in. A pending invitation is not membership. An organization that restricts third-party apps must approve the app first.
FELIX_GITHUB_ACCOUNTS JSON {"octocat": {"id": 583231, "role": "admin"}}: people let in by their numeric GitHub id (gh api users/octocat --jq .id), whether or not they are in an organization. The id decides; the login is only a label, since logins can be renamed and re-registered.

Set at least one of FELIX_GITHUB_ORGS and FELIX_GITHUB_ACCOUNTS. When a person qualifies more than once, admin wins.

A signed-in person can link their own GitHub or Google account on the Connections page (Manage → Connections), so tools act as them. Connections reuse the sign-in apps above: the same client id and secret, and FELIX_AUTH_KEY, FELIX_AUTH_ORIGINS and FELIX_AUTH_CALLBACK_PREFIX. They exist only where sign-in is configured, and need the THREADS binding. Each person’s connections are kept apart from everyone else’s: in THREADS, or, with FELIX_STORES=postgres, in their own Postgres table (see Stores in Postgres).

Setting Meaning
FELIX_GITHUB_CONNECT_SCOPES Space-separated scopes a GitHub connection asks for: repo read:org by default. A GitHub App ignores scopes and grants its own permissions instead. GitHub connections are offered wherever GitHub sign-in is on.
FELIX_GOOGLE_CONNECT_SCOPES Space-separated Google scopes, such as https://www.googleapis.com/auth/calendar.events. They decide which Google tools runs get. Without it, Google connections are not offered. openid email is always added, to name the account.

Connections return to a second callback, for every origin on FELIX_AUTH_ORIGINS: <origin><prefix>/v1/connections/github/callback on GitHub, and <origin><prefix>/v1/connections/google/callback, added as an authorized redirect URI on the Google client. A GitHub App takes it as another callback URL. A GitHub OAuth app has room for one callback only, and GitHub accepts any address beneath it on the same host, so set its callback to <origin><prefix>/v1/ to cover both sign-in and connections; an OAuth app serves one origin. A GitHub App that should keep working past eight hours needs expiring user tokens on, so Felix gets a refresh token.

What tools use it: a run on a thread a signed-in person owns gets github_get, a read-only call to GitHub’s REST API as the thread’s owner, when GitHub connections are offered. It runs in plan mode and can be turned off on the Agents page like any server tool. Admins choose which repositories the agent may change, and may limit its reads to them: see GitHub repositories. A run on a thread the operator token created has no owner, and no connection. A Google connection gives runs the calendar, Gmail and Drive tools its scopes allow: see Google.

How it works:

  • Connecting. The page calls POST /v1/connections/<provider>/start with { returnTo } and opens the consent address it answers. Its sealed state (10 minutes) names the person, so the connection lands with them; a short cookie set by the start must come back with it, so the address works only in the browser that asked. Google is asked for offline access with a consent screen, so it sends a refresh token. The provider returns to the callback, which sends the browser back with #felix_connect=ok or #felix_connect_error=<code>.
  • At rest. Tokens are sealed with AES-256-GCM under a key derived from FELIX_AUTH_KEY for this purpose alone, bound to the person and provider. No route returns a token. GET /v1/connections lists the account, scopes, and when it was connected and last used.
  • Refresh. A token within five minutes of expiry is refreshed first and the new tokens kept. When the provider refuses the refresh (the person revoked access, or it expired), the connection shows Stopped working and the person reconnects; an outage at the provider changes nothing.
  • Disconnecting. DELETE /v1/connections/<provider> forgets the connection, then withdraws it at the provider: GitHub’s authorization of the app for that account (so the next GitHub sign-in asks for consent again), Google’s grant to this client. That second step is best effort: the connection is gone here even when the provider cannot be reached.
  • Audit. connection_added, connection_removed and connection_refresh_failed, naming the provider and the account id and login, never a token.

Rotating FELIX_AUTH_KEY leaves every stored connection unreadable: each shows Stopped working, and everyone connects again.

Refusal Means
state_mismatch The return reached a browser that did not start it, or the connection was started again elsewhere. Start again.
access_denied The person declined at the provider.
invalid_grant The provider refused the code, often a reload of the return. Start again.
no_refresh_token Google sent no lasting access. Remove the app from the Google account’s third-party access, then connect again.
invalid_id_token, provider_unavailable, provider_config_error, storage_unavailable Google’s answer did not verify, the provider could not be reached, the app or its callback is misconfigured, or Felix could not keep the connection.

Admins keep the list of GitHub repositories the agent may use, on the GitHub page (Manage → GitHub) or with PUT /v1/github/repositories. Each repository is owner/repo with read or read & write access; up to 200. Members see the list but cannot change it. A save names the version it changes, so two admins editing at once cannot overwrite each other. The list takes effect at the next GitHub call of every run, including runs already going: a repository removed from the list stops being changed at once. It is kept in the THREADS binding, or in Postgres tables with FELIX_STORES=postgres; if it cannot be read, GitHub calls are refused rather than run without it.

The agent always acts as the person the conversation belongs to, through their own connection, so it reaches only what that person can on GitHub, and only on their conversations.

What the agent can do. On a person’s thread, when GitHub connections are offered and at least one repository is listed, runs get five tools:

Tool Does
github_create_issue Opens an issue (repo, title, body).
github_comment Comments on an issue or pull request (repo, number, body).
github_create_branch Creates a branch from another (from, by default the repository’s default branch). An existing branch is refused.
github_put_file Creates or replaces one text file, at most 1 MiB, on a branch as one commit, and answers the commit sha. Never on the default branch, and never in .git, an absolute path or a path with ... The branch must exist. Content identical to what is there writes nothing.
github_create_pull_request Opens a pull request from one branch (head) into another (base, by default the default branch), optionally as a draft.

Changes reach the default branch only through a pull request that a person merges on GitHub. Each tool checks, when it runs, that the repository is listed with read & write; one not listed at all is refused before anyone is asked to approve.

Granting write in a conversation. A change to a repository listed read is not refused: it waits for an approval under the rule github-write-grant, and the card says so. Approving it, which only an admin can do, lets the call run and makes that repository read & write in that conversation from then on; every later change there still asks, under the usual rule. Other conversations are unaffected. The GitHub page lists each grant under its repository, with who granted it and when, and an admin can Revoke it (DELETE /v1/github/grants); deleting the conversation takes its grants too. Grants are audited as github_write_granted and github_write_revoked. A repository not on the list cannot be granted. A renamed repository is refused rather than followed: list it under its new name. The tools can be turned off on the Agent page like any server tool, and plan mode refuses them.

Approvals. Every call to one of these tools waits for a person to approve it, on the conversation or in the attention line, and an approval covers that one call only. This holds with no approval rules configured, whatever the configured rules say, and in bypass mode: bypass skips the deployment’s own rules, but a GitHub write acts as a person somewhere outside this deployment, and that person, or an admin, should see each one before it happens. Without approvals storage (the THREADS binding), the write tools are not offered.

Restricting reads. With Only these repositories on (restrictReads), github_get reads only /repos/<owner>/<repo>/… of a listed repository, at either access, and the person’s own account: /user, /user/repos, /user/orgs and /rate_limit. Everything else, such as search, organizations and other people’s repositories, is refused with a pointer to the GitHub page. Off, github_get reads whatever the person’s connection can see.

Audit. github_repositories_changed (counts, and the repositories added, removed or changed); github_write for each change made (the person, the repository, the action, the issue or pull request number, branch or path, and the link); github_write_failed for one refused or failed (the action and an error code, such as not_listed, read_only, default_branch, forbidden, conflict or rate_limited). /health reports github: true where GitHub connections are offered.

  • Browser. The page sends the person to GET /v1/auth/<provider>/authorize?return_to=<page>. Felix keeps the flow (state, PKCE verifier and, for Google, a nonce) in a sealed cookie for 10 minutes and sends them to the provider. The provider sends them back to the callback, which checks the flow and the person, then returns them to their page with #felix_login=ok and a one-time cookie good for 60 seconds. The page calls POST /v1/auth/<provider>/exchange once to collect the session. A token never appears in a URL, and return_to must be on FELIX_AUTH_ORIGINS. A refusal comes back as #felix_login_error=<code>.
  • Terminal. felix login --server <url> uses GitHub’s device flow: POST /v1/auth/github/device gives a code to enter at github.com, and POST /v1/auth/github/token answers 428 until it has been entered. Starting device sign-ins is limited, on a best-effort basis, to 10 an hour per client address and 300 an hour in total, counted separately by each Worker instance.
  • Cross-site requests. A session is a bearer token the page sends itself, and the sign-in cookies only carry a sign-in in progress (SameSite=Lax for the flow, Strict for the hand-off), so nothing a browser attaches on its own authorizes a request. On top of that, Felix refuses any request other than GET, HEAD or OPTIONS that a browser marks as started by another site (Sec-Fetch-Site: cross-site), with 403 cross_site_request. The terminal and other clients that are not browsers do not send that header and are unaffected.
  • Who am I. GET /v1/auth/me returns the caller: {kind: "person", sub, role, idp, email?, login?, name?} or {kind: "operator", role: "admin"}. GET /v1/auth/methods says which providers are on.
Refusal Means
not_allowed That Google account is not on FELIX_GOOGLE_ACCOUNTS, its email is not verified, or it is not the pinned account.
not_a_member That GitHub account is not invited and not an active member of a configured organization.
org_access_restricted A configured organization restricts third-party apps and has not approved this one.
state_mismatch, sign_in_expired, expired_token The sign-in expired or was started in another window. Start again.
access_denied The person cancelled at the provider.
invalid_id_token, provider_unavailable, provider_config_error The provider’s answer could not be used, could not be reached, or the app is misconfigured.
Route Who Does
POST /v1/auth/logout A signed-in person Signs them out everywhere: every session they hold ends.
GET /v1/people Admins Everyone who has signed in: provider, role, first and last sign-in, and when their sessions were last ended.
POST /v1/people/<id>/revoke Admins Ends every session that person holds (github:<id> or google:<id>).
GET /v1/audit?cursor=&limit= Admins The audit log, newest first: sign-ins, refused sign-ins (with the provider and reason), ended sessions, connections added, removed and refused at refresh, approval decisions, thread deletions and mode changes, and skill library drafts, imports, publications and rejections. Each line names who did it and to what, never content such as a decision’s note. Kept 90 days.

GET /v1/audit?format=jsonl downloads every retained line, newest first, one JSON object per line, for a log system; each export is itself recorded (audit_exported).

A session issued before its person’s sessions were ended is refused. Each server instance re-reads that within 30 seconds, so an ending takes effect everywhere within 30 seconds (at once on the instance that made it). If the record cannot be read, sessions are refused rather than risk letting an ended one through. To keep someone out for good, also remove them from the deployment’s allowlist: ending sessions does not stop them signing in again. Likewise, a change to FELIX_GOOGLE_ACCOUNTS or FELIX_GITHUB_ACCOUNTS (removing someone, or changing a role) is read at sign-in, so it reaches a session already open only when that person signs in again; end their sessions to apply it at once. Rotating FELIX_AUTH_KEY ends every session at once. A sign-in in the same second as an ending is refused too; signing in again works a moment later.

Route Who Does
GET /v1/me/export A signed-in person Downloads felix-account.json: their record, every conversation they own with its messages, their memories (kept and forgotten), their connections (who to and with what access, never a token), their push preferences, their token use for the last 7 days, what Felix last suggested to them, their ratings of replies, the images in their Files (what each is, not its bytes), the approvals they asked for, the workflow runs they started, and the feedback they filed on library skills. Recorded as account_exported.
DELETE /v1/me A signed-in person Deletes their own data. The body must name the account: { "confirm": "github:<id>" }.
DELETE /v1/people/<id> Admins Deletes that person’s data, with the same confirm body.

In the web app, a signed-in person does both from Your data… in the account menu, and an admin deletes someone’s account from Delete account… on their row of the Activity page’s People; each asks for the account’s handle to be typed first. See the Web surface.

A deletion first ends the person’s sessions. It then deletes the conversations they own, with each one’s workspace, sandbox, kept outputs and images, along with their memories, connections, push subscriptions, token use, suggestions and preferences, the approvals they asked for, the workflow runs they started (with their outputs) and the feedback they filed on library skills. The people list keeps only their id and when their sessions ended, so a session they held never works again. The deletion is recorded in the audit log as person_deleted, with who did it and how many conversations went. Audit lines that name the person stay for their 90 days.

Copies in backups are not deleted: they remain until those backups expire (the newest FELIX_BACKUP_KEEP, 14 by default). Deleting someone does not stop them signing in again; remove them from the allowlist for that. Signing in again starts a new, empty account.