Skip to content

feat: let projects span several repositories or a whole organization - #36

Merged
kalaspuff merged 9 commits into
mainfrom
fctl/8-can-you-implement-https-github-com-hyper
Oct 18, 2026
Merged

kalaspuff merged 9 commits into
mainfrom
fctl/8-can-you-implement-https-github-com-hyper

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #17.

A project was one repository: its sessions got a GitHub token for that repository alone, so an agent couldn't change a service and its client library together, read a private dependency (npm ci here needs hyperstructure/design), or work across an organization. A project now keeps its primary repository and can list more from the same GitHub account, each read only or read and write, or let agents read every repository the GitHub App can reach (owner/*).

What changed

  • Protocol (fctl-proto): RepoAccess and RepoGrant; ProjectSpec.repos (with unavailable for repositories the session has no token for); a read-only token next to the existing one (SessionCredentials.github_read, and github_read on the credential messages); GitState.repos with RepoGitState. All are optional, so older hosts and agents ignore them and keep working on the primary repository.
  • Control plane: migration 0006_project_repos.sql and GET/POST/DELETE /api/v1/projects/{id}/repos. Only maintainers can change the list. Repositories are checked against GitHub and stored under GitHub's names. A session gets two tokens, refreshed together: one that can write to the primary and writable repositories, and one that can only read the read-only ones (unscoped for owner/*). All of a project's repositories belong to one account, so one installation mints both. Owner-wide grants are read-only, and a new primary repository must be on the same account.
  • Agent: the credential helper picks the token per repository from the path git sends (credential.useHttpPath). gh gets the token that can write, and the system prompt says how to use the read-only one. The prompt lists the repositories and tells Claude to clone them into ~/repos/<owner>/<name> and work on the session branch. After each turn, fctl-agent finds those clones, moves work done on a writable clone's default branch onto the session branch, pushes it, and looks up each repository's pull request.
  • CLI: fctl projects repos list|add|remove (with --json). fctl projects show lists the other repositories, and fctl logs shows git state per repository.
  • Web: a Repositories tab on the project page. Everyone can see it; maintainers add, change and remove repositories, with suggestions from the GitHub App. The session rail and transcript show changes, pushes and pull requests per repository. The project tabs now scroll sideways on phones, where five don't fit.
  • Docs: security.md and the self-hosting guide say which tokens reach a sandbox and what they can do. Also the CLI reference, getting started, architecture, and ADR 0009.

Decisions

  • The open question: a listed repository that leaves the installation is skipped, not fatal. The session leaves it out of its tokens, posts a notice saying what to fix, and tells Claude it is unavailable. One stale entry shouldn't stop all of a project's sessions. An unreachable primary repository still fails the session, now with a clear message instead of five retries.
  • Agents get write access only to repositories named one by one; owner/* is read-only.
  • Repositories have their own tab rather than a section inside Settings. Settings is one form with one Save button, whereas repositories change one at a time, like members and secrets. A tab also lets editors see what agents can reach.
  • A project lists at most 100 repositories: each one is named in the system prompt, and GitHub mints tokens for at most 500.
  • Changes apply to sessions that start afterwards. A running session loses a removed repository at its next token refresh, within the hour.

Verification

  • Unit tests: grant parsing, the one-account rule, token plans and matching clones (fctl-domain); wire compatibility of specs, credentials and git state (fctl-proto); the credential helper through git credential fill, which fails without useHttpPath; a session with writable and read-only clones of local repositories standing in for GitHub, where work moves to the session branch and is pushed only where writable (fctl-agent); per-repository changes (web).
  • cargo xtask check --quick passes. The web checks ran against a local stand-in for @hyperstructure/design, because this session's token couldn't reach that private repository, which is the case this issue is about.
  • End to end with cargo xtask dev:
    • Added, updated and removed repositories with the CLI and the API, including the rejections: another account, owner/* with write, and the primary repository again.
    • Set the primary repository through PATCH /projects.
    • Ran a session; the agent got the repository list. I cloned octocat/Hello-World into the sandbox's ~/repos and committed on master. After the next turn, fctl-agent moved the commit onto the session branch and reported it per repository in fctl logs, fctl show and the session page.
    • Checked the pages in both themes and at phone width, with approximate design tokens.
  • Not covered: minting real tokens through a GitHub App, and real pushes and pull requests (the dev host doesn't push). The agent tests cover the push path.

Notes

  • cargo xtask dev fails on a fresh state on main. Its bootstrap posts the dev Claude token to /me/claude (the route is /me/claude/token), and that token is shorter than the 40 characters add_token requires. I patched both locally to run the stack and left them out of this pull request.
  • Projects now also store which repositories agents may use and who added each one, alongside the members and secrets they already store. I don't think fctl-site's privacy policy needs a change, but I couldn't read it from this session.

Session: https://app.fctl.sh/s/ses_01M564ZKEN3DWD0JH6Z2BJ72KM

fctl-sh Bot and others added 9 commits October 18, 2026 00:27
A project can list repositories besides its primary one, each read or
write, or grant read access to every repository of its account that the
GitHub App reaches. All of them belong to one account, so one installation
mints a session's tokens: one that can write (the primary repository and
the writable ones) and a read-only one, refreshed together.

- proto: RepoAccess and RepoGrant; ProjectSpec.repos, the read token
  (SessionCredentials.github_read and the credential messages), and
  GitState.repos with RepoGitState. All optional, so older hosts and
  agents keep working on the primary repository.
- domain: parsing grants, the one-account rule, token plans, matching
  clones to grants.
- control: the project_repos table, GET/POST/DELETE
  /projects/{id}/repos, tokens per access level. A listed repository the
  installation no longer reaches is left out with a notice; an
  unreachable primary repository fails the session.
- agent: a credential helper that picks the token per repository
  (credential.useHttpPath); clones under ~/repos/<owner>/<name> are
  found after each turn, work in writable ones is kept on the session
  branch and pushed, and their pull requests are tracked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`fctl projects repos list|add|remove` (with --json), the client methods
behind them, the other repositories in `fctl projects show`, and one line
per repository for git state in `fctl logs`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tops

The final state skips `gh` lookups. With pull requests tracked per
repository, the ones found after the last turn now carry over to the
branches they belong to, instead of disappearing from the state the
session page shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A Repositories tab on the project page lists the primary repository
  and the others. Maintainers add them (with suggestions from the GitHub
  App), change their access and remove them; everyone sees them, and the
  header counts them.
- The session page's rail shows changes, pushes and the pull request per
  repository, and the transcript's git milestones get one line per
  repository.
- The project tabs scroll sideways on phones, where five don't fit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
security.md and the self-hosting guide say which GitHub tokens reach a
sandbox and what they can do; the CLI reference and getting started show
`fctl projects repos`; the architecture describes the credential helper,
on-demand clones and per-repository branches; ADR 0007 records the
decisions, including leaving out a listed repository the GitHub App no
longer reaches instead of failing the session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A repository added by an old name comes back under its new one, which can
be the project's primary repository or one it lists already.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts with sandbox limits (#31), fctl in sandboxes and agent-named
sessions (#33) and claude.ai connectors (#32):

- The system prompt takes the repositories' paths and the sandbox's size;
  AGENTS.md and the size line from main stay as they are.
- The supervisor keeps both new fields and functions; the spec keeps
  `grants` and `session_wants` and passes main's adjusted settings.
- ADR 0007 is main's (agents name their sessions); the repositories ADR
  becomes 0008.
- The project page keeps main's start button and sandbox hint next to the
  Repositories tab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts with attachments (#35):

- The project_repos migration becomes 0006: 0004 and 0005 have shipped.
- The repositories ADR becomes 0009, after attachments' 0008.
- fctl-agent's Paths keeps both ~/repos and ~/attachments; a fresh resume
  sends the task's files and says the other repositories need cloning
  again.
- The project page keeps the attachment imports beside the repository ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kalaspuff
kalaspuff merged commit e991d16 into main Oct 18, 2026
4 of 5 checks passed
@kalaspuff
kalaspuff deleted the fctl/8-can-you-implement-https-github-com-hyper branch October 18, 2026 01:25
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Oct 18, 2026
)

app.fctl.sh will let people choose a commit email in Settings → Profile
(hyperstructure/fctl#55, for hyperstructure/fctl#15). The commits in the
sessions they start then end with a `Co-authored-by` trailer that has
their name and that address: everyone who can read the repository sees
it, and GitHub uses it to link the commits to their account. That
changes what app.fctl.sh stores and who receives it, so the privacy
policy says so:

- **What we collect → Your account**: the commit email, if you set one.
- **Why we use it**: crediting you in commits when you set a commit
email (contract, with the rest of running the service).
- **Who else receives it → GitHub**: the `Co-authored-by` line, that a
project's maintainers can turn it off, who sees it (everyone, for a
public repository), and what GitHub does with it.
- **How long we keep it**: until you remove it or delete your account.
Commits already made keep it; they are part of the repository's history,
which its owners control.
- **Your rights → Correct it**: Profile is where to change it.

`updated` already says 2026-10-18.

**Merge this when hyperstructure/fctl#55 ships** (its release redeploys
app.fctl.sh), so the policy and the app change together. It is opt-in:
no address reaches a commit until someone sets one.

Refs hyperstructure/fctl#15

## Verification

Rendered `legal/privacy.md` with the site's `scripts/markdown.mjs`: the
four changed passages come out as list items and a table row as
expected.

## Also noticed, not changed here

"What we collect → GitHub" says agents "work with short-lived tokens
limited to one repository per session". Since projects can span several
repositories (fctl 0.2, hyperstructure/fctl#36), a session's tokens
cover the project's repositories, or every repository of an account when
the project grants that. That sentence needs its own change.

Session: https://app.fctl.sh/s/ses_01M56GAEEHP8WBMTPQ9ZY9VVA0

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Projects that span several repositories or a whole organization

1 participant