Skip to content

feat(autopilot): keep files across an autopilot's sessions - #555

Merged
kalaspuff merged 10 commits into
mainfrom
fctl/1290-give-an-autopilot-a-scratch-space-that-o
Nov 15, 2026
Merged

kalaspuff merged 10 commits into
mainfrom
fctl/1290-give-an-autopilot-a-scratch-space-that-o

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An autopilot's own session starts in a new sandbox at every handover, so it had nowhere to keep the scripts and drafts it relies on but its plan, which the spaghetti autopilot filled with watcher scripts and message drafts. Autopilots now keep files that outlast their sessions: fctl autopilot files put/get/list/rm, text only, at most 256 KB each, 4 MB and 100 files in all, stored in D1 (autopilot_files, migration 0062) and deleted with the project. Only its own session writes and removes them; whoever reads the autopilot reads them, on the Autopilot tab too.

  • Briefing and brief: the briefing now says to keep scripts and drafts in files and to name them in the plan rather than copy them in; a fresh session hears to go on from its plan, log and files (fctl autopilot files get --all, which writes them into the current directory and makes #! scripts executable, checking each name the control plane sends before it becomes a path); the brief has a files part listing them by name and size; and the near-handoff wake says to keep scripts there.
  • Room: the write checks the room in the same statement that writes the file, so two writes at once can't both take the last of it (a wasm test races two).
  • Log: a new file and a removed one get a line in its log ("Added watch.sh to its files"); rewrites don't, as a script may rewrite one often. The brief's log leaves those lines out, as it does plan updates.
  • Tab: an "Its files" card in the rail, under its plan, once it keeps any: each file opens in a dialog to read and copy.

I verified it with unit tests (validation, the gate, the briefing and brief), wasm tests of the D1 writes against the stand-in, a web test of the card, and in cargo xtask dev, where fake-claude's autopilot kept, listed, got back and removed files through its session's relay and the tab showed them.

Screenshots

The rail of the Autopilot tab with its files under its plan, in the light and dark themes (dev stack data):

The tab's rail in the light theme: direction, plan, Its files with reply-draft.md and watch-deploy.sh, and its sessions The same rail in the dark theme

A file opened from the card, on a computer and at a phone's width (390 px):

dark-dialog.png

The file dialog at a phone's width, the script wrapping

Worth confirming

  • Decision: people read the files but can't change or remove them; only the autopilot does, from its session. Someone who wants one gone steers it with a note.
  • Decision: text files only (no NUL characters), 256 KB each and 4 MB / 100 files in all. Binary files would need the attachments' Durable Object rather than D1 rows.
  • Decision: files stay while the project is off autopilot, like its plan and log, and go only with the project.
  • Decision: the card shows only once it keeps a file, so autopilots that never use it show nothing new.

Fixes #551

Related pull requests:

fctl session


Note

Medium risk. It adds a table (migration 0062), new API routes and CLI commands that store and serve autopilot files, and changes the briefing and brief that every autopilot session reads.

What it does. Lets an autopilot keep text files (up to 100, 256 KB each, 4 MB in all) that outlast its sessions, stored in D1 and managed with fctl autopilot files put/get/list/rm from its own session. People can read the files on the Autopilot tab but not change them. The briefing, brief and log are updated to point sessions at their files.

New migration. Migration 0062 adds the autopilot_files table, which is deleted with the project; it must run before the new routes are used.

fctl review's first look at 1f2d46b · 23 files, +1345 −65 · Review agent settings

fctl-sh Bot added 4 commits November 15, 2026 10:36
An autopilot's own session starts in a new sandbox at every handover, so
the scripts and drafts it relied on were lost unless it copied them into
its plan. It now keeps text files (fctl autopilot files put/get/list/rm,
256 KB each and 4 MB in all) that its next session gets back, its brief
lists them, and its briefing points scripts and drafts there.
An "Its files" card in the tab's rail lists the files it keeps across
its sessions once it keeps any, and opens each to read and copy.
The relay of an autopilot's session refuses a path with .. without
saying why, so fctl autopilot files put checks the name itself first.
@fctl-review

This comment has been minimized.

Comment thread crates/fctl/src/cmd/autopilot.rs Resolved
fctl-sh Bot added 4 commits November 15, 2026 11:00
A control plane that misbehaves could send a name with .. or an
absolute path, which fctl autopilot files get --all would have written
outside its directory. And a workspace's autopilot's card for those who
aren't its admins names its files among what they don't see.
…opilot-a-scratch-space-that-o

# Conflicts:
#	docs/llms.txt
kalaspuff pushed a commit to hyperstructure/design that referenced this pull request Nov 15, 2026
## Summary

Describes the Autopilot tab's new **Its files** card: the files an
autopilot keeps across its sessions (`fctl autopilot files`), listed by
name with their size and age in the rail under its plan once it keeps
any, each opening in a dialog to read and copy. It also covers the log
line for an added or removed file, the files' polling, and that they
stay while it's off and are a workspace's admins' to see for a
workspace's autopilot.

- hyperstructure/fctl#555

## Worth confirming

- **Decision:** no card while it keeps no files, rather than an empty
one explaining the feature.

[fctl session](https://app.fctl.sh/s/ses_01M7FBQH3QP9BMZTSAZ0KDMEAE)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** Documentation only, in one design doc.
>
> **What it does.** Documents the new *Its files* card on an autopilot's
tab: what it shows, how rows and the file dialog look, that only the
autopilot writes files, and how the log and polling treat them. It also
covers files in the edge cases, including the *What it does* card that
members who aren't admins see.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7FDWS16RCNSX3EGJKXAHA6V)'s first
look at
[`51f2ded`](51f2ded)
· 1 file, +19 −7 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
@fctl-review

This comment has been minimized.

Comment thread web/src/lib/api.ts Resolved
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Nov 15, 2026
…124)

## Summary

Autopilots on app.fctl.sh now keep files across their sessions (text
their own sessions write, such as scripts and drafts of messages, at
most 4 MB in all), so the privacy policy says what those files hold,
that they go to the autopilot's owner's Claude account as the rest of
what it keeps does, and that each stays until the autopilot removes it,
the project is deleted, or for as long as the project when it's off
autopilot. Its log's list of what it did now includes the files it added
and removed.

It should merge with the fctl pull request that adds the files, which
deploys them:

- hyperstructure/fctl#555

[fctl session](https://app.fctl.sh/s/ses_01M7FBQH3QP9BMZTSAZ0KDMEAE)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Low risk.** It only changes the privacy policy text and its updated
date, with no code involved.
>
> **What it does.** Adds an autopilot's kept files to the privacy page:
what is stored (text up to 4 MB, with name, size, timestamps and
last-writing session), who receives it, and how long it is kept. It also
says what happens to those files when an account is deleted: they stay
as written, record no account, and go when the autopilot removes them or
the project is deleted.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7FDW8XG23ZET9FT1C9C4TJQ)'s first
look at
[`97fef34`](97fef34)
· 1 file, +20 −10 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
@fctl-review

This comment has been minimized.

Comment thread crates/fctl/src/cmd/autopilot.rs Resolved
fctl autopilot files get NAME -o FILE --json printed the file and wrote
nothing; it now writes it, then prints what it wrote, as get --all does.
@kalaspuff
kalaspuff merged commit f2362ea into main Nov 15, 2026
13 checks passed
@kalaspuff
kalaspuff deleted the fctl/1290-give-an-autopilot-a-scratch-space-that-o branch November 15, 2026 11:53
kalaspuff pushed a commit that referenced this pull request Nov 15, 2026
…rts (#558)

## Summary

An autopilot can now attach files to the sessions it starts and steers
(`fctl run --attach`, `fctl send --attach`) and read the files sent in
the sessions it reads, with a new `fctl files list` / `fctl files get`
(for people too). Files like the .3mf and .stl models of the 3D printing
autopilot then pass from a person to one session, and from there to
another, without anyone attaching them again.

- **Relay:** the autopilot's `fctl` sends a file to fctl-agent in base64
as a new `AgentCall::ApiBytes`, and the host posts the bytes as they are
to a new runner endpoint, `POST /api/v1/runner/sessions/{id}/relay`. The
Worker routes them as the JSON relay does, as the autopilot's owner, but
streams the body in and the answer out, so a 20 MB file never goes into
wasm memory. Only uploads and downloads of files go this way
(`fctl_domain::autopilot::carries_files`), and the JSON relay refuses
them.
- **What it may do:** it uploads for a session it starts (`Gate::Open`)
or one it started (`Gate::Crew`), and reads the files of the sessions it
can read. `GET /api/v1/sessions/{id}/attachments` (new) lists a
session's files, leaving out those of an autopilot's messages fctl still
holds for room (#556). A held message that never goes hands its files
back as unsent uploads, which are deleted a day later.
- **Its instructions:** where its sandbox's `fctl` has `fctl files`, its
`~/AGENTS.md` tells it to attach files rather than publish screenshots
for its sessions. It still publishes to show people an image in what it
asks them.

I checked it with unit tests (the gate, which requests carry files,
fctl-agent passing them on only from an autopilot's own session, the
`~/AGENTS.md` text, picking files by name) and in `cargo xtask dev`.
There, the fake autopilot started a session with a 3 MB model attached.
It then downloaded a 19.5 MB file a person had sent that session and
attached it to another of its sessions. The sha256 matched at every
step. Its attempt to attach a file to a person's session was refused.

Runners a version behind keep working: their fctl-agent refuses
`ApiBytes`, and `fctl` says the runner needs a newer fctl. The
autopilot's `~/AGENTS.md` keeps telling it to publish screenshots until
its sandbox's `fctl` has `fctl files`. The session socket now takes
requests of up to 32 MiB (it was 8), enough for a 20 MB file in base64.

Crew sessions still send the autopilot no files, as Carl Oscar decided:
what one makes for another (a sliced .gcode.3mf, say) goes on its
branch, or as a screenshot it publishes, and the autopilot's
instructions say so.

## Worth confirming

- **Decision:** the autopilot reads the files of every session it can
read, people's sessions in its places too, as it already reads their
transcripts. It uploads only for sessions it starts or started.
- **Decision:** uploads and downloads add no line to the autopilot's
log. The message or session that sends the files gets its usual line.
- **Decision:** `fctl files get SESSION NAME` takes the newest file of
that name and writes it into the current directory (or `--dir`), but
over no file already there unless `--force`, as the names are whoever
sent the files'. `--all` takes the newest of each name, and an older one
is reached by its id.
- **Decision:** `AgentCall::ApiBytes` is a variant of its own, not
optional fields on `AgentCall::Api` as the issue suggested. An older
fctl-agent refuses an unknown variant, where it would silently drop new
fields and send an empty upload.
- **Assumption:** the name `fctl files` (the files sent in a session)
reads clearly beside `fctl autopilot files` (the autopilot's own text
files, from #555). The autopilot's instructions tell the two apart:
attachments go to its sessions, while its own files are what it keeps
for its next session.

Fixes #517

[fctl session](https://app.fctl.sh/s/ses_01M7FBVEK6V85B5J3NNR92Z2QB)

<!-- FCTL_REVIEW_SUMMARY -->
---

> [!NOTE]
> **Medium risk.** It adds a runner endpoint that streams file bodies to
the API as an autopilot's owner, a new `AgentCall::ApiBytes` variant
with its own permission gate, and raises the session socket request
limit from 8 to 32 MiB.
>
> **What it does.** Lets an autopilot attach files to the sessions it
starts and steers (`fctl run --attach`, `fctl send --attach`) and read
files in sessions it can read, through new `fctl files list` and `fctl
files get` commands. Files travel from the autopilot's `fctl` through
fctl-agent as base64 in `AgentCall::ApiBytes`, then through a new runner
relay endpoint to the API, and a new `GET
/api/v1/sessions/{id}/attachments` lists a session's files. Uploads are
allowed only for sessions the autopilot starts or started, while
downloads cover every session it can read. `fctl files get` downloads
into hidden part files, created as new files only, and puts them in
place once every download came, writing over no existing file unless
`--force`.
>
> **Permission gate.** The autopilot can read the files of every session
it can read, including people's sessions in its places, but upload only
to sessions it starts or started.
>
> <sub>[fctl
review](https://app.fctl.sh/s/ses_01M7FKG4NZ1MV4MBWA62K7KBRB)'s first
look at
[`a8071f1`](a8071f1)
· 32 files, +1564 −83 · [Review agent
settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub>

<!-- /FCTL_REVIEW_SUMMARY -->

---------

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.

Give an autopilot a scratch space that outlasts its sessions

1 participant