Skip to content

feat: keep the floor's draft and count a project's other repositories - #117

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/58-the-prompt-that-s-written-in-the-compose
Oct 20, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/58-the-prompt-that-s-written-in-the-compose

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

The floor's composer now keeps what you write there. If you leave the page, reload it or close the tab, the task comes back with its project, its attached files and the caret where you left it. And wherever the app names a project's GitHub repository, it now also says how many more its agents may use: hyperstructure/fctl (+3 more), or hyperstructure/fctl (+entire org) when they may read every repository of the account.

The draft on the floor

  • Where it's kept. The words, the project and the caret go to localStorage under fctl:draft:<user id>. The floor reads that as it opens, so the text is there on the first paint.
  • Files. Attached files go to IndexedDB (database fctl-drafts), stored as they are. localStorage holds about 5 MB of text per site, and a file would go in as base64, a third bigger, so a single Retina screenshot often wouldn't fit.
    • A file that doesn't fit in IndexedDB either (some private windows, a full disk) stays only while the page is open. Coming back to the floor within the app keeps it; a reload doesn't.
  • No second upload. Files that finished uploading aren't uploaded again when you come back to the floor within the app: useAttachments(…, { keep }) holds on to finished uploads.
    • After a reload they upload again. The server deletes unused uploads after a day, as before.
  • When it's forgotten.
    • Each person has their own draft.
    • The session that starts with a draft forgets it. The floor opens the session page once the draft's files are gone from the browser, which takes milliseconds and never more than a second, so reloading right away can't bring the draft back.
    • Signing out, or deleting the account, forgets every draft in the browser.
  • Docs. docs/getting-started.md describes this. The privacy policy on fctl.sh lists what app.fctl.sh keeps in your browser, so it changes too: docs(legal): say the browser keeps the task being written on the floor fctl-site#27.

A project's other repositories

  • Protocol. Project gets two fields, both computed in PROJECT_SELECT from project_repos:

    • other_repos: how many repositories its agents may use besides repo, named one by one.
    • all_repos_of: the account of an owner-wide grant.

    Both are optional. Older CLIs ignore them. When an older control plane leaves them out, the app shows the primary repository alone, as before.

  • Where it shows.

    • The floor's composer, next to the project picker and in the picker's list.
    • The workspace's projects.
    • The command palette.
    • The project's header.
    • fctl projects list (--json includes both fields).

    Each says hyperstructure/fctl (+3 more) or hyperstructure/fctl (+entire org). A project without a primary repository says 2 repositories or hyperstructure (entire org).

  • The project header. It used to count an owner-wide grant as one more repository: +2 repositories for fctl-site with hyperstructure/fctl and hyperstructure/*. It now says (+entire org) and still links to the Repositories tab. It reads the counts from the project instead of fetching the repository list, and changing a repository refreshes the project and the project lists.

  • Narrow layouts. Next to the picker, the label gives way before the picker does. The repository's name truncates, and the count stays. The label is a small grid whose narrowest is the count alone.

A personal account's octocat/* reads "+entire org" as well, because the project list doesn't know whether the account is an organization.

How I verified it

  • Unit tests.

    • web/src/lib/repos.test.ts and fctl_domain::repos::summary.
    • web/src/lib/draft.test.ts.
    • web/src/components/session/attachments.test.tsx:
      • kept files come back ready, without a second upload;
      • stored files upload again;
      • uploads that didn't finish start again;
      • removed files are forgotten;
      • a failed start puts the files and their uploads back.
    • web/src/components/session/start.test.tsx: the session page opens once onStarted is done.

    cargo xtask check --quick passes.

  • End to end, with cargo xtask dev and Playwright in Chromium:

    1. Wrote a task, picked a project, and attached an image and a text file.
    2. Went to a project page and back: the text, files, project and caret were back, with no new uploads.
    3. Reloaded: everything came back from storage, and the files uploaded again.
    4. Removed a file and reloaded: it stayed gone.
    5. Started the session: the draft was gone from the floor and from storage (three runs).
    6. A draft of files alone came back with its own project, ahead of the project picked last.
    7. Signing out emptied both stores.
  • Repository labels, against projects seeded with repositories in the local D1 (the dev instance has no GitHub App), at 768, 800, 900 and 1440 px wide and in both themes.

Screenshots

At 3350b8e, with dev data: Playground lists hyperstructure/fctl and three more repositories; Docs site lists hyperstructure/fctl-site, hyperstructure/fctl and hyperstructure/*.

The floor's composer, light, 1440 px:

Before After
Before: the floor's composer names hyperstructure/fctl After: hyperstructure/fctl (+3 more)

The project picker, dark:

Before After
Before: the picker's projects with their primary repositories After: (+3 more) for Playground, (+entire org) for Docs site

The project's header for Docs site, light:

Before After
Before: +2 repositories After: (+entire org)

The workspace's projects, light:

After: the workspace's projects with (+3 more) and (+entire org)

A draft after reloading the page, dark: its text, an image, a text file and its project are back.

After: a draft with an image and a text file, back after a reload

At 900 px, where the sidebar leaves the composer little room: the repository's name truncates, and the picker and the count stay whole. Light.

After: hyperstructur… (+entire org) next to the whole picker

Made in fctl session https://app.fctl.sh/s/ses_01M5C0HS3G1V7X00D3AM9FBV7G

fctl-sh Bot added 2 commits October 20, 2026 07:14
Projects in lists now carry other_repos (repositories named besides the
primary one) and all_repos_of (the account of an owner-wide grant). The
floor's composer, its project picker, the workspace's projects, the
command palette, the project's header and fctl projects list say
hyperstructure/fctl (+3 more), or (+entire org) when agents may read
every repository of the account.
…tarts with it

The floor's composer keeps its draft in this browser: the words, the
project and the caret in localStorage, the attached files in IndexedDB
(localStorage holds only a few megabytes of text). Leaving the page and
coming back, reloading it or reopening the tab brings the draft back;
files uploaded while the page was open come back ready instead of
uploading again, and a file that doesn't fit in the browser's storage
stays for as long as the page is open. Each person has their own draft,
the session that starts with it forgets it, and signing out or deleting
the account forgets every draft in the browser.

The floor's repository label keeps the project picker whole where space
is short: the repository's name gives way first, and the count stays.
@kalaspuff
kalaspuff merged commit e9d5b89 into main Oct 20, 2026
5 of 6 checks passed
@kalaspuff
kalaspuff deleted the fctl/58-the-prompt-that-s-written-in-the-compose branch October 20, 2026 08:50
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Oct 20, 2026
#27)

app.fctl.sh will keep the task you are writing on the floor in your
browser: the words, the project you chose for it and the files you
attach. They stay until a session starts with the task or you sign out,
so leaving the page doesn't lose it (hyperstructure/fctl#117). The
privacy policy's "Cookies and browser storage" section lists what the
app keeps in your browser, so this pull request adds the draft to it and
bumps `updated`.

Nothing changes on the server. Files attached to the floor's composer
are uploaded as they were before, and uploads no session uses are
deleted after a day.

Merge it together with hyperstructure/fctl#117. Neither needs the other
to build.

Made in fctl session
https://app.fctl.sh/s/ses_01M5C0HS3G1V7X00D3AM9FBV7G

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit that referenced this pull request Oct 23, 2026
The task box on a project's Sessions tab now keeps what you write in it,
as the Agent Floor's has since #117. Leave the page, reload it or close
the tab, and the task comes back with the model, effort level and GitHub
access you picked, the files you attached and the caret where you left
it. It stays until a session starts with it or a schedule is set up with
it. Each project keeps its own draft, apart from the Agent Floor's and
other projects'.

This also fixes a bug on `main`. Going straight from one project's page
to another that was already loaded kept the first project's text in the
second one's box, where Start would have started it in the wrong
project.

## How

- **`@/lib/draft`.** Drafts have ids (`draftId`). The home page's is the
person's id, as before, so drafts written before this change come back.
A project's is `<person>:<project id>`. Text is in localStorage under
`fctl:draft:<id>`, files in IndexedDB under `<id>/<file key>`. The
separator is `:` because a `/` would put a project's files inside the
home page's key range. Starting a session forgets that one draft;
signing out still forgets them all.
- **`useKeepDraft`** (`web/src/components/session/start.tsx`) is what
the home page's form did inline. It saves the draft as it changes, as
the box loses the focus (with the caret) and as the form goes, puts the
caret back, and forgets the draft once a session starts with it. Both
forms use it.
- **The project page's form** moves out of `Sessions` into its own
`StartForm`, keyed by the project's id. Without the key, React keeps the
form's state when you go from one project's page to another that is
already loaded, because the route's component stays mounted. That is how
the text carried over.
- **Schedule** forgets the project's draft once the schedule is set up,
as on the Agent Floor.
- **Docs.** `docs/getting-started.md` says project pages keep their task
too.

The privacy policy on fctl.sh lists what app.fctl.sh keeps in the
browser. hyperstructure/fctl-site#51 adds project pages' tasks. Merge it
together with this one, or after it.

## Verification

- **Unit tests.**
- `web/src/lib/draft.test.ts`: each project's draft is kept apart from
the home page's and the others'. Forgetting one leaves the rest, and
signing out forgets them all.
- `web/src/components/session/start.test.tsx`: `useKeepDraft` keeps a
draft as it changes, keeps one of files alone and forgets one with
neither words nor files. It keeps the caret and puts it back, keeps
nothing once a session starts, and leaves other drafts alone. Each of
these tests fails when the line it covers is broken.
- **`cargo xtask check web`** passes: Biome, TypeScript, 681 tests and
the production build.
- **End to end**, with `cargo xtask dev` and Playwright in Chromium,
with two projects, Playground and Second:
1. I wrote a task in Playground, picked Haiku and attached an image. I
went to the Agent Floor, where the box was empty with no files, and
wrote there. Back in Playground, all of it was there.
2. Second's box started empty. Going straight between Playground and
Second kept each one's text.
3. After a reload, Playground's text, model and image came back, the
image from IndexedDB. The Agent Floor had its own draft and no files.
4. Starting a session from Playground emptied its box, also after a
reload. Second's and the Agent Floor's drafts stayed.
5. In Second, Schedule then Cancel kept the draft. Schedule then Set up
schedule forgot it.
6. The Agent Floor still keeps its words, file and selection, and a
session started there forgets its draft but not Second's.
7. Without `key={project.id}`, step 2 fails: Second's text shows in
Playground's box.
- **On `main`**, step 2 shows the bug (Playground's text appears in
Second's box), and Playground's text is gone after a visit to the Agent
Floor.

## Recordings

At 0365e7b, dark theme, 1280 × 720 shown at 960 px. Each writes a task
in Playground and attaches a picture, goes to the Agent Floor, and comes
back to Playground.

| Before | After |
|---|---|
| ![Before: back in Playground, the box is
empty](https://app.fctl.sh/api/v1/published/y3DMixftX4c5Y4EM98uaIGqAyC72zr9nz96LTePxnRM/before-draft.webp)
| ![After: back in Playground, the task and its picture are
there](https://app.fctl.sh/api/v1/published/pOqwDUQhxXBxl3MutUcG6heK31QX6JUOXy0dGdSLGx1/after-draft.webp)
|

Made in fctl session
https://app.fctl.sh/s/ses_01M5NC3YGDDG8BZZMRARNZFWS4

---------

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.

1 participant