Repository navigation
docs: add fctl's Automation page, and what limited tokens keep - #40
Merged
kalaspuff merged 2 commits intoOct 22, 2026
Merged
Conversation
fctl's docs gain docs/automation.md (hyperstructure/fctl#207): access tokens limited to what they are for, and review agents from GitHub Actions. It renders at /docs/automation/, beside the CLI. The privacy policy says what app.fctl.sh keeps of an access token's limits and of what a session's agent may do on GitHub, and that the task being written keeps the GitHub access chosen for it.
kalaspuff
pushed a commit
to hyperstructure/fctl
that referenced
this pull request
Oct 22, 2026
Access tokens can now be limited to what they are for, and every session
says what its agent may do on GitHub: **push** (as before), **comment**
(review, comment, label and resolve review threads, no pushes) or
**read**. That covers review agents started from CI that read and
comment but can't push, and planner agents that only read.
## What changed
**What a session's agent may do on GitHub** (`GithubAccess`: `push` >
`comment` > `read`)
- A session asks for a level as it starts
(`CreateSessionRequest.github_access`, `fctl run --github`, a new picker
beside model and effort in the task boxes). It gets at most what its
project allows (`ProjectSettings.github_access`, `fctl projects set
--github`, **Agents on GitHub** in project settings) and what the token
that starts it allows. If it asks for nothing, it gets the most they
allow; if it asks for more, it's refused with the reason.
- GitHub enforces it, not the agent. The session's GitHub token carries
the level's permissions (`fctl_domain::repos::permissions`):
- comment: `pull_requests` and `issues` write, `contents` read, no
`workflows`;
- read: one read-only token for every repository.
- Lowering a project's level reaches running sessions with their next
token (within the hour), the same way removing a repository does.
- fctl-agent pushes nothing for these sessions, moves no work onto
session branches, and tells Claude what it may do instead of how to
push. The transcript says so as the session starts.
- **Resolving review threads.** GitHub only lets tokens that can write
contents (and therefore push) resolve review threads. So an agent that
comments runs `fctl resolve PRRT_…` in its sandbox, a new agent call
like `fctl memory`. The control plane checks the thread is on a pull
request in a repository the session may write to, then resolves it with
a token of its own for that one repository, which it revokes at once and
never hands out. `~/AGENTS.md` tells comment agents how, with the
GraphQL query that lists a pull request's threads.
- The session page shows a **Comments only** / **Read only** chip beside
the status and an **On GitHub** row in the details. Changes says "kept
in the sandbox" rather than "not pushed yet". `fctl show` prints the
level too.
**Limited access tokens**
- A token can be limited three ways (`tokens.scope`,
`fctl_domain::limits::Limits`):
- what it does: `read` (as a viewer), `run` (as an editor: start and
steer sessions, stop and resume its own, keep memory) or `full`;
- where: some workspaces (including projects made later) and/or some
projects;
- the most its sessions' agents may do on GitHub.
- A limited token reaches projects and sessions only. One rule in the
router (`limits::allows`) refuses everything else before any handler
runs: the account, Claude connections, workspaces' people and settings,
other tokens, admin. A token handed to CI therefore can't mint itself
another one.
- Its roles are capped in `access.rs`. A session whose agent may do more
on GitHub than the token allows is read-only to that token, with an
error that says why. Lists filter its places in SQL, so pages stay full.
WebSocket rechecks apply its limits, and it can't open the dashboard
feed. Limits hold however the token is sent, as a bearer token or in a
cookie.
- `GET /auth/me` shows a limited token only whose it is and the token
itself.
- Sessions started by a limited token don't auto-follow, since every
finished CI review would otherwise notify its owner.
- **Web:** Settings has a new **Access tokens** section, separate from
**Devices**. Its dialog asks the three questions plus expiry, shows in a
sentence what the token will do before it's created, and shows the
secret once with a ready-to-run example.
- **CLI:** `fctl token NAME --access run -p web -w acme --github comment
--days 90`; `fctl tokens` lists tokens and what each does; `fctl tokens
revoke NAME|ID`. `fctl whoami` describes the token in use. Account
commands refuse limited tokens clearly instead of showing an empty
account.
**Docs:** a new [Automation](docs/automation.md) guide: tokens, GitHub
access, a GitHub Actions workflow for review agents (one session per
pull request, messaged on new commits), forks and other security
caveats, and other recipes (triage, nightly maintenance, planning,
dashboards, the API). Also updated: architecture (Access tokens, GitHub
access), CLI, security, self-hosting, and [ADR
0037](docs/adr/0037-access-tokens-and-sessions-limit-what-agents-do-on-github.md).
## Compatibility
- Migration `0024` adds `tokens.scope` and `sessions.github_access`.
NULL means today's behavior, so existing tokens and sessions don't
change.
- New fields are optional, and the new agent call is a new variant.
- An older **control plane** ignores token limits and `--github`. `fctl
token` revokes a token made without the limits it asked for, and `fctl
run --github` stops a session started without the level it asked for;
both say why.
- Older **hosts and agents** ignore a session's level. Their agents try
to push, and GitHub refuses.
- An older agent answers `fctl resolve` with "did not understand the
request".
## Verification
- **Unit tests:**
- domain: the router rule, role caps, the GitHub level decision,
permission sets, stored-limits round trip and fail-closed parsing, the
read-only token plan, thread GraphQL parsing, keeping the project
setting when an update omits it;
- agent: prompts for each level, `~/AGENTS.md`, a comment agent pushing
and moving nothing, the stale write token dropped;
- CLI: token descriptions;
- web: token form logic, start choices, the composer picker, the draft,
"kept in the sandbox".
- `cargo xtask check --quick` passes: fmt, types, Clippy for host and
wasm, all Rust tests, 561 web tests.
- **End to end on `cargo xtask dev`** with the CLI:
- **Read token:** reads sessions and logs; refused `run`, `token`,
`tokens`, `projects create`, `admin` and memory writes with "it only
reads projects and sessions"; `claude status` says it can't see the
account.
- **Run token, one project, comment cap:**
- its sessions default to comment, and `--github push` is refused;
- it doesn't see the other project (`Project not found`), and doesn't
follow its sessions;
- it can message and stop its own sessions, but can't message, resume or
stop a pushing session ("…may at most comment on GitHub, and this
session's agent may push: the token only reads it").
- **Workspace token:** sees that workspace's projects.
- **Validation:** blank or unknown places are refused.
- **Cookie:** the read token sent as a cookie is still limited.
- **Project cap:** `fctl projects set --github read` refuses `--github
push` ("This project's agents may at most read on GitHub"), defaults new
sessions to read, and an earlier session now shows "reads only".
- **Agent side:** a comment session on a public repository got the
comment-only system prompt, the transcript line, and the "Review
threads" section in `~/AGENTS.md`.
- `fctl resolve` went sandbox → fctl-agent → host → control plane, which
answered "No GitHub App is configured" (the dev stack has none);
malformed thread ids are refused.
- A read session's agent refuses `fctl resolve` locally.
- Screenshots via Playwright against the dev stack, both themes, desktop
and phone.
**Not verified:** resolving a thread against real GitHub. The dev stack
has no GitHub App, and GitHub doesn't document which App permission
`resolveReviewThread` needs. Several community reports say `contents:
write`, which is what the control plane's token gets; one more report
saw the same error but didn't try `contents: write`. If GitHub refuses,
the agent gets GitHub's message and is told to name the threads in its
reply instead.
## Screenshots
At 36a1395, from the dev stack.
Settings → Access tokens, each with a sentence that says what it does
(light):

The new token dialog, for review agents in one project (light and dark),
and on a phone:
| Light | Dark | Phone |
|---|---|---|
| 
| 
| 
|
The token, once (masked here), with a command that uses it:

The task box's new **On GitHub** list (desktop, light), and on a phone
(dark), where it is a symbol in the joined model/effort control:
| Desktop | Phone |
|---|---|
| 
| 
|
A session whose agent only comments: the chip beside its status, **On
GitHub** in its details, and its commit "kept in the sandbox":
| Light | Dark |
|---|---|
| 
| 
|
A project's **Agents on GitHub** setting (dark):

## Related
- hyperstructure/fctl-site#40 adds the Automation page to fctl.sh/docs
and updates the privacy policy (what tokens and drafts keep). It must
merge **after** this one, once fctl's CI has pinned a docs commit that
has `docs/automation.md`.
Session: https://app.fctl.sh/s/ses_01M5HPGZ4R0NQCXSMFR659JEHJ
---------
Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
…great-to-be-able-to-create-a
kalaspuff
approved these changes
Oct 22, 2026
kalaspuff
deleted the
fctl/133-it-would-be-great-to-be-able-to-create-a
branch
October 22, 2026 13:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds fctl's new Automation guide to fctl.sh/docs, and updates the privacy policy for limited access tokens (hyperstructure/fctl#207).
hyperstructure/fctl#207 is merged and fctl's CI pinned it (
fctl-docs.refat 9ced8ea), which this branch now has frommain, so the build finds the page: ready to merge. hyperstructure/fctl#209, which follows #207, changes these docs' wording only; the next pin brings it.What changed
scripts/docs.mjs:docs/automation.mdrenders at/docs/automation/, after the CLI in the navigation. It covers access tokens limited to what they are for, what agents may do on GitHub (push, comment, read), and review agents from GitHub Actions. Links from other pages to it now stay on the site. The 404 page's suggestions test lists it too.legal/privacy.md(updatedis already today):Verification
FCTL_DOCS_DIR=<fctl at fctl/133-…> npm run buildrenders 9 docs pages./docs/automation/links to/docs/architecture/#access-tokensand/docs/cli/, and the nav lists it on every page.npm run check: no new findings (the two!importantwarnings in 404.html and 500.html are on main too).node --test scripts/*.test.mjs: 13 pass.Session: https://app.fctl.sh/s/ses_01M5HPGZ4R0NQCXSMFR659JEHJ