small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs workspaces.md

workspaces #

a session's workspace is the directory its python kernel, run jobs, memory, skills and AGENTS.md resolve against. /cd in the tui moves a session to another folder; the folder picker browses through the daemon, so it only ever offers folders the daemon itself can see (and works the same once the daemon is remote).

locations #

every workspace is a location (src/albedo/harness/location.gleam):

  • local: a plain absolute path, stored exactly as it always was. no prefix anywhere, on the wire or on screen. ~ (the daemon's home) parses as local too; whether a folder exists is the caller's question.
  • remote: [user@]host:/abs/path (an IPv6 host in brackets). a text is remote when it does not start with / or ~ and the part before the first : holds no /. user and host start with a letter or digit, so neither is ever an ssh option. the path must be absolute and is normalised (//, ., .., trailing slash), so one remote directory has one key. a stored remote path is always absolute: host:~ and host:~/x given to create or move a session are resolved against that host's home (one probe over ssh, bounded, kernel.md) and stored absolute; an unreachable host refuses with ssh's words.

session info carries the parsed location beside the workspace string:

{"workspace": "mayer@chernobog:/home/mayer/proj/albedo",
 "location": {"host": "chernobog", "user": "mayer",
              "path": "/home/mayer/proj/albedo", "label": "chernobog"}}
{"workspace": "/Users/dawn/proj", "location":
 {"host": null, "user": null, "path": "/Users/dawn/proj", "label": null}}

label is how clients show the host: the alias, with user@ dropped when it is the user ssh -G <host> reports (local config only, no network), cached per host for the daemon's life. without ssh the user stays.

a remote session's python kernel and run jobs run on its host (kernel.md, "remote kernels"). what is only a key works as it is: the work ledger and paperclips scope, workspace links, recent folders, session search by cwd, family moves. what the daemon itself reads from a workspace goes through the location, and never looks for a remote path on its own disk:

  • /workspaces accepts remote location values such as host:/abs and host:~ too (see browsing).
  • AGENTS.md, SYSTEM.md and the other instruction files, and project skills, are read from a daemon-side mirror of the remote workspace's project files ($ALBEDO_HOME/mirror/<digest>/: root *.md, .agents/*.md, .albedo/*.md, and the .agents/skills and .albedo/skills trees, at most 512 files and 8 MiB, each read up to one byte past the 1 MiB instruction limit). one gather over ssh fills it, at most every 5 s, and the local readers read it as the workspace, so the same rules apply. a skill's location is its mirror path. while the host is out of reach only the home directories count, and the instructions warn and the skills catalog diagnoses project … skipped: can't reach chernobog: ….
  • memory is a daemon-side file keyed by the workspace string, so a remote workspace gets its own. the kernel's memory object reaches it through the memory host route wherever the kernel runs (memory.read, .save, .append, .journal, .documents; synchronous over the kernel's host_now), so a remote session's notes land in the daemon's $ALBEDO_HOME/memories, never the host's.

linked workspaces #

a workspace can be linked with others that hold the same project, such as one repository checked out here and on chernobog. links are peers: every member keeps writing its own memory and work items, and reads cover the whole group.

harness/links owns the shared schema and group readers. The links extension's ledger owns revision tracking and guarded membership mutations. Its service checks requests and notifies affected sessions after a commit.

  • storage: workspace_links(workspace, grp) in the daemon's sqlite. linking two workspaces merges their groups; unlinking one takes only that row out, and a group left with one member is dropped. nothing else changes, so unlinking (or linking again) loses and repeats nothing.
  • memory: the snapshot a session opens with shows its own memory, then each linked member's under ## linked workspace <location>, within the same 8000-character budget. It is not in the system prompt: the conversation opens with a user line asking for the notes and the snapshot as the model's own reply in <memory.md> (loop.prompt_of), after the system prompt and the rest of the workspace's context, so the model reads it in its own voice and a memory that changed leaves everything before it cached. memory.read() is this workspace's file only; grep and search cover the group, a linked file named [<location>] memory.md. save, append and journal write here.
  • work ledger: list, get, update and delete reach every member's items, an update or delete stays in the item's own workspace, and create files under this one. each item carries workspace; the /work page says where an item from another member was filed.
  • vents are one ledger for every workspace already, so links change nothing there.
  • the model is told it is linked (the links context, naming each member, and marking one whose folder is gone).
  • linking or unlinking queues a note in every open session of every workspace it touches, worded for that side ("linked this workspace with X" / "unlinked X" / "unlinked this workspace from Y, Z"). a link note carries the newly linked members' memory as a new session's snapshot holds it (albedo_memory:linked), so a session that opened before the link reads the same text without rebuilding its prompt and losing its prompt cache; its snapshot catches up at the next rebuild. open means the session has a live actor (and so a cached composition); any other session composes its snapshot afresh when it opens. live reads (grep, search, the work ledger) follow the group on every call anyway.
  • a member's folder is checked where it is: a local one on the daemon's disk, a remote one with one exists gather on its host over the shared ControlMaster (folders.exists). a host that does not answer is never read as a gone folder. every member is checked at once, so slow hosts wait side by side. the /link page waits up to 5 s for a host and then says why (connecting, sign in, unreachable, with ssh's words); the session-start context takes only a recent probe, starting one in the background, so opening a session never waits on a host.
  • /link (user only for changes) lists the members: this one here, a member whose folder no longer exists gone, a remote one whose host can't say as above. add <workspace> takes what a session can be created in (an existing local directory, or host:/abs / host:~/x) and refuses this workspace and one already linked; remove <workspace> takes a listed one, this one included (leaving the group). a gone member stays, read as before, until it is removed.

a worktree or jj workspace of the same repository is not linked by itself yet; that and suggesting links from shared history are later work.

the tui shows a remote workspace as label:path, the path relative to that host's own home once a listing or probe reported it, as scp reads it (the home itself is label:~, a path outside it stays absolute): the chat header reads ✦ albedo on chernobog:proj/albedo, folds only the path, keeps the host in every layout that shows a place, and colors the host with a stable hue derived from its label, lifted to the theme's contrast. the host goes faint while the session's kernel boots or reattaches (the status line says connecting to chernobog… with an animated face, the same one the picker shows beside a host still warming, picked by the host's label, or copying the kernel to chernobog… while albedo is staged there) and takes the error color once it is lost (the port owner gave up and forgot the kernel, so the status line says the next turn starts a fresh one), from the session status's kernel.link (kernel.md). recent folders and the sessions view lead remote entries with their host.

moving a session #

PATCH /sessions/{session_id}?view=configuration changes workspace under the observed If-Match validator. Its result distinguishes committed desired state from application outcomes. the session must be idle and the target an existing absolute directory, or a remote location (stored canonically; an absolute one isn't checked until a kernel boots there, a ~ one is resolved over ssh first). PUT /sessions/{session_id} creates a new session with the same location forms. the kernel is dropped (python variables start fresh), the transcript stays, and a note records the move.

every descendant of the session (children, their children; open or closed) whose workspace was the same folder follows it. an idle descendant moves at once; a running one moves when its current turn ends. descendants that were working somewhere else keep their own folder. if the session itself cannot move, nobody moves.

after a move the tui offers linking the folder the session left, as a notice to paste: /link add <folder as stored> (absolute, user@ kept, so the link lands on the key that folder's memory and work items use). a later move replaces it, and a move away from a folder that went missing offers nothing. it does not check whether the two are already linked; /link add refuses that.

moving a session to another daemon #

/cd host:/path on a host that runs a reachable albedo daemon will offer to move the whole session there (the question and the activation are later pieces of this work). this section is the transfer underneath it. daemon/transfers.gleam owns it; HTTP routes are in http_transfers.gleam and the OpenAPI transfers tag.

  • what moves: the session and every same-workspace descendant (as a local /cd moves them), with all their durable rows, the images their history, pinned prompt and cells name, their shell captures, their saved kernel state (best effort: a target that cannot restore it starts a fresh namespace, and a started cell is never run again), the workspace's memory.md and journal, the workspace's work items and the sessions' own vents. credentials, daemon settings, caches, links and live processes stay. webhook secrets and a discord bot token move with their session's rows. nothing is kept in sync afterwards.
  • who declares it: every owner of a table says, once, whether a transfer carries it: the daemon core in daemon/transfer.gleam, each extension in its own transfer.gleam, registered with extension.transfer (installed extensions count whether or not they are enabled). a transfer.Table names the table, a version, a filter over the transfer_scope(id) and transfer_workspace(path) views (and transfer_images(hash), the hashes every owner's images names), and the tables its rows depend on; a transfer.Excluded gives a one-line reason. an owner may also carry files (Adapter.files), and an owner whose rows act for a session (a schedule, a hook, a bot) lists, disarms and refuses them for a move (bindings, disarm, occurrences, refuse; see finish and moved below). test/harness/transfer_coverage_test.py fails for a table that nobody declared, so a new table cannot be left behind silently.
  • export (POST /transfers/{id}/export, source): the client picks the transfer id; a repeat returns the same manifest and another session under the same id is 409 transfer_conflict. every session in scope must be idle (409 session_busy otherwise: a turn finishes on the source first). one read snapshot streams each table to $ALBEDO_HOME/transfers/<id>/export/<n>.seg a row at a time (transfer/codec.gleam, albedo_transfer_codec.erl): a length-prefixed row of typed cells, BLOBs as raw bytes, hashed with SHA-256 as written, nothing held beyond one row. a row over 32 MiB is refused, naming its table. the manifest lists every segment with owner, name, version, columns, rows, bytes and digest, plus the origin (this home's identity file), the sessions and the highest transcript position exported.
  • staging (PUT /transfers/{id}/import with that manifest, target): refused before any byte arrives when an owner or table is unknown here (422 transfer_unsupported), a table's version differs (422 transfer_version, naming the extension and both versions), the target's table lacks a column the source sent, a session in scope already lives here (409 session_exists), or the disk is short: the target needs the transfer's bytes x 1.2 plus 1 GiB free (507 transfer_space, naming both numbers). one staged transfer of any size is admitted; another beside it must keep all inactive staging within 4 GiB (507 transfer_quota).
  • chunks: GET .../export/segments/{n}?offset= reads at most 512 KiB; PUT .../import/segments/{n}?offset= writes them. a repeat of bytes already there is accepted, a gap or different bytes are 409 segment_conflict, and GET /transfers/{id}/import says how much of each segment arrived.
  • ready (POST /transfers/{id}/import/ready): checks every segment's length, framing and digest. one that fails is deleted and named (409 segment_invalid, segment 3 (core/transcript): …) to be sent again. a ready import is still inactive: no session row, turn, schedule, hook or bot exists for it until activation.
  • destination: staging names it, PUT /transfers/{id}/import?workspace=/abs (required); it is part of the staged intent, so the same manifest into another workspace is 409 transfer_conflict. every owner lists the columns holding a workspace path (Adapter.workspaces): a cell equal to the source workspace, or a path under it, becomes the destination on import.
  • activation (POST /transfers/{id}/import/activate, 202, then poll GET /transfers/{id}/import): ready -> importing -> installing -> active. it runs in its own process, one per transfer, and a repeat answers the status without applying anything twice, and one that lands while the worker is on its last step makes it read the row again; before ready it is 409 transfer_state. rows go in bounded batches (256 rows or 1 MiB), each its own short commit among the target's other writes, so a large import never holds the writer other sessions use. the imported sessions are inert until the last commit: their rows carry stage='importing' (conversation.Importing) from the batch that inserts them, and conversation.read_info, the session lists (the agents' too), pending-input recovery and mail delivery skip that stage, as do the schedule due scan, webhook intake and the discord manager, so nothing lists, opens, admits, fires or delivers to a partial import.
    • before any row: one pass over every row segment refuses the import when a row's unique key (shifted and rewritten columns aside) already exists here, sending it back to ready with error transfer_collision naming the table and nothing applied. the same pass finds the highest number of each sequence the import brings.
    • offsets: one per sequence (transfer.Sequence): Transcript is the target's highest transcript.seq, RowId(t) table t's highest rowid (both counting sqlite_sequence). each source number n becomes n + offset; zero, negatives and NULL are sentinels and stay. the commit that records the offsets raises sqlite_sequence past every number the import brings, so rows other sessions add meanwhile land above them; a RowId table must be AUTOINCREMENT (transfer_unsupported otherwise). owners declare Shifts for number columns and Rewrites for payloads that embed numbers. the core shifts transcript positions in transcript, transcript_calls, transcript_quarantine, submission_events, continuation_markers, operations.committed_seq, shell_commands.history_seq, session_profile_renames.through_seq and provider_requests.seq, and its own ids in pending_inputs.seq and provider_requests.id; its payloads embed no positions.
    • references: a nullable column declared ON DELETE SET NULL whose row this daemon lacks becomes NULL, as on a delete (mail.sender for a letter from a session that stayed behind). a root that was another session's child arrives as a root.
    • receipt: the transfers row's activation holds the offsets, the segment and byte cursor, what was lost and the last error. each batch advances it in its own transaction, so a crash resumes from the last committed batch when the daemon starts (transfers.resume), and a failed batch keeps its state with error set for a retry to resume.
    • installing: each owner's install(scope, origin, staged) places its files, still inert: the core copies shell captures to shell-output/<session>/<id> and kernel state to kernels/<session>.state (a state it cannot place is reported in lost as python namespace); memory imports its snapshot. installs must repeat nothing they finished, since a crash here runs them again; one that fails leaves the import installing with the error and nothing live.
    • live: one commit sets the sessions idle, at the top of the activity order, and the receipt active with lost. then the staged segments are deleted; the receipt and its manifest stay.
  • cancel (DELETE /transfers/{id}/import, 202, poll until cancelled): before any row it only drops the files. once rows went in it removes them in batches, last segment first, each row by its primary or first unique key (one row equal in every column for a table without one), leaving shared content-addressed rows. refused (409 transfer_state) from installing on.
  • retention: a transfer's receipt is one transfers row per role. inactive staging and exports untouched for seven days are removed at startup and when another transfer is staged. once activation commits, its segments are deleted and only the receipt and manifest stay.

the move driver #

the source daemon drives a move (daemon/moves.gleam, routes in http_moves.gleam), so a client that closes does not stop it and the tui and web only read its progress.

  • preflight (GET /transfers/preflight?session_id=&target=host:/abs) answers within about ten seconds and is available: false with words for a person rather than an error: the session already moved, a session in scope mid-turn, ssh's own words from the host probe (can't reach gone: ssh: connect to host gone port 22: Connection refused), no daemon on the host, or a daemon there on another transfer protocol (vassago runs transfer protocol 0, this daemon 1; update albedo on vassago). a daemon from before moves has no GET /transfers/protocol and counts as 0. last it asks the target (POST /transfers/runs-there, through the relay) whether each session in scope can run there: the target has the session's profile and that profile offers its model (child_models.fits, the lists a spawn would read). runs_there answers per session {session_id, name, ok, profile, model, reason, alternatives}, where alternatives are the target's other profiles offering the model. one that can't and has no alternative makes the move unavailable with its reason (vassago has no claude profile: sign in there first, vassago's claude profile does not list claude-opus-4); one with alternatives leaves the pick to the client. a cold model list can make this answer take up to the target's first fetch (8 s) more.
  • the relay: the driver probes the host as a remote kernel does (the same ControlMaster and staged bundle) and runs one ssh to it with the probe's relay command, albedo_transfer_relay.py from the bundle. the relay reads daemon.json from the host's $ALBEDO_HOME (default ~/.albedo) and forwards framed calls to that loopback daemon with its token, so the token never leaves the host or reaches a command line. frames are 4-byte big-endian lengths: a hello, then a JSON header (its optional timeout, in seconds, bounds the call there; 60 s otherwise) and the raw body each way per call.
  • the move (POST /sessions/{id}/move with {transfer_id, target}, 202; a repeat answers it as it stands, another session or target under the id is 409 transfer_conflict, a second move of a session in flight or at its checklist 409 move_in_progress) is one moves row. its optional profiles (session id to the target's profile) is part of the move: a repeat with another mapping is 409 transfer_conflict, and one naming a session outside the move 422 profile_unavailable. its driver goes checking (connecting over ssh, starting the relay and asking the protocol again, then waiting for every session in scope to be at rest; reason names each wait, and the session mid-turn), exporting (the export, then staging it there with ?workspace= the destination), copying (each segment from where the target's status says it ends, progress after every chunk), activating (activate, then polling the import until it is active; nothing is activated before the target says ready; a ready import is first checked as preflight checks it, the mapping applied, and a session that can't run there fails the move with profile_unavailable naming it. the activation body repeats what each session runs on and the mapping; the target checks again before anything applies (422 profile_unavailable) and switches those sessions' profile and protocol in the commit that makes them live) and checklist. GET /transfers/{id} reads it. a target out of reach (a laptop asleep, wifi gone) is retried with backoff up to every 30 s for as long as it takes, reason saying so; a host that can't run albedo's python (host_unsupported) ends the move; a step the target fails (a 5xx, a segment to send again) is retried five times; a refusal ends the move as failed with the target's code and detail. a daemon that restarts starts a driver for every unfinished move from its recorded state (moves.resume); one driver per move holds a claim.
  • checklist: once the target is live the move lists in bindings what would still act for its sessions here, as each owner reports it through transfer.Adapter.bindings (the core names no extension table): each schedule and heartbeat (prompt and cadence), each webhook (name, old_url here and new_url, its url on the target, read from the route the owner names in the binding's locate; null when the target has none) and each enabled discord bot (name and channels). the move waits there for a person; the sessions here stay live, and their representations carry move_pending ({transfer_id, host}) until it finishes. a restart leaves it waiting (resume skips it). the bot's copy on the target is armed by the target's discord manager as soon as the import is live, so both run until finish.
  • finish (POST /transfers/{id}/finish, 200 with the move): lists the bindings again (anything armed since joins the list), has each owner disarm its own not yet disarmed (Adapter.disarm: schedules deleted, the webhook answering 410 session_moved with its new_url for good, the bot turned off and stopped), then reports what the sessions ran here since their export (moves.since, set as exporting begins) to the target through the relay (POST /transfers/{id}/import/occurrences): schedules as they fired (move_occurrences, written by the due scan while a move is under way), event letters by id, and what each owner reports (Adapter.occurrences: webhook events by event id). the target keeps them in transfer_occurrences (a schedule's id shifted to its id there) and its due scan, webhook intake (answering the source's delivery id) and discord delivery skip them; there is no exactly-once claim. nothing to report needs no connection. last, one commit marks the sessions moved and the move active. a binding that fails is failed with its error, and a target out of reach is target_unreachable; either leaves the move at checklist with error set, and a repeat goes on from there. once active a repeat answers the move.
  • moved: every session in scope then has sessions.moved ({host, workspace, transfer_id, at}), shown as moved in session representations, and refuses new input with 409 session_moved naming the host; the session actor refuses every submission (session.Moved) however it comes. the actor holds that in memory, never asking the store per submission: it reads sessions.moved once as it starts, after moves.watch registers it, and finish tells a live one as it commits. its history stays readable here. what still reaches it is refused once per binding with a note in its transcript naming the new home, and that binding is disarmed so nothing loops or logs. the core hands each refusal to the owners as a transfer.Arrival (moves.refuse) and the one that brought it disarms it (Adapter.refuse), answering what to name the first time: a schedule that comes due is deleted (registry's due scan); a webhook delivery answers 410 and marks its hook (moved_to, moved_noted), later ones only get the 410; a discord letter turns the session's bot off here. every refused letter is settled with the refusal as its last_error. a letter from another agent (task, request, message, answer) from a session here goes on to the target (below); one whose sender moved too is settled and not written back. notes go through daemon/session_notes.gleam: a loaded session's actor appends its own, otherwise the row is written directly.

mail and handles after a move #

the source can always reach the target over its own ssh; the target usually can't reach the source (a laptop asleep). so the source drives both directions (daemon/forwarding.gleam, over daemon/relays.gleam, the relay the move driver uses, sharing the host's ControlMaster).

  • family stubs: as the import goes live the driver sends the target, for each moved session, the relatives that stay here (its parent, its children and siblings outside the move) with the names it says them by (POST /transfers/{id}/import/family). the target keeps them in family_remote with the source's identity and host. here the moved sessions' rows stay, with sessions.moved as their locator. so "parent" and family names resolve to the same session ids on both sides (family.locate); nothing is discovered beyond what the move recorded.
  • to a moved session (push): a letter from a session here to a moved one is stored and settled here, as delivered from now, and queued in mail_outbox for the move's target. one pusher per target sends what waits (POST /mail/forwarded, batches of 50) and stops when nothing does; the target admits each letter once by its id (a resend is acknowledged again without a copy) and keeps where its sender lives in mail_remote, so the letter shows session="<id>" and a reply goes back. a full inbox there is retried; a refusal bounces. a target out of reach is retried with backoff up to every 30 s, and mail_peers records since when: the receipt (status: queued, forwarding) and mail.open() say queued for vassago, unreachable since ….
  • from a moved session (pull): a letter there to a relative here (by stub, or to a session that wrote to it) waits in the target's mail_outbox for the source's identity. while sessions here are related to sessions moved to a target (family, or they wrote to one), the source keeps one call open to it, POST /mail/forwarded/collect, which the target answers as soon as a letter waits, or empty after five minutes, and the source calls again at once, acknowledging what it admitted in that call (a lost acknowledgement means a resend, admitted once). a dropped connection (sleep, wifi, a killed ssh) is reopened with backoff; the registry's tick restarts a collector that stopped and wakes pushers with letters waiting. delivery is immediate rather than polled, and idle costs one held connection. the relay takes a per-call timeout for it.
  • answers: a forwarded request counts as delivered when it was sent, and the answer as written when it arrives, so a reply from there closes the request on the side that opened it; mail.open() on the target also lists requests it sent here until a letter from here answers.
  • a day: a letter that waits a day (scaled by ALBEDO_TEST_TIME_SCALE) bounces to its sender as a letter from its recipient, not delivered: <name> on <host> (<id>): vassago was out of reach for a day (or did not collect it for a day), which closes an open request.
  • handles: here agents.get(<moved id>) answers a handle as before; messages, search_messages, cancel, close and switch are authorized here as before and then run on the target (POST /extensions/agents/sessions/{id}/{op} through a relay). on the target a handle on a relative left here answers, but every call on it is refused: <name> lives on <host>, which this daemon can't reach; ask from there.
  • not planned: forwarding the source's own inbound bindings (a hook url, a bot) to the target; finish still disarms them. it could be a later feature.

next step, not built yet: a new session whose folder is picked on another host that runs a reachable daemon (the TUI's and the web's New Session) should ask the same question and, on yes, create the session directly on that daemon and open it there, rather than creating it here with a remote kernel. ana asked for this; today New Session always creates it here.

browsing #

GET /workspaces lists recent workspaces. With location, it lists child folders and canonical parent, home, and host state. include=preview adds repository facts, language shares, and a bounded two-level file tree. The HTTP contract and OpenAPI define the requests and responses.

Locations are absolute paths, daemon-relative ~ paths, or remote [user@]host:/abs and [user@]host:~/x paths. Remote browsing gathers one snapshot over SSH after the host probe. Local and remote snapshots use the same folder and VCS readers. The nearest enclosing repository wins; a colocated .jj takes precedence over .git. VCS commands have short deadlines, and unavailable optional facts do not discard the folder listing.

include=files adds the directory's files after its directories, with kind, size and ignored. Ignored marks come from one git ls-files --others --ignored --exclude-standard --directory in the directory (vcs.ignored): an ignored directory is listed once as name/, so a child is ignored when its name, or its name and /, is listed. A jj checkout without git has no git to ask and marks nothing (null); a colocated one asks git. Remotely the list gather runs the same command (files: true makes it find the checkout and run its plans).

Language shares use tracked file sizes and the bundled GitHub Linguist data. The tree shows tracked or changed paths, excluding ignored build output. Browsing jj uses --ignore-working-copy and does not create a snapshot.

GET /sessions/{session_id}/files?path=<path> (capability file_reading) reads one text file for a client to open, on the machine the session's workspace is on: folders.read_file reads a local one on the daemon and a remote one through the same gather (route file). path is absolute there, relative to the workspace, ~/... locally, or the host:/path spelling the answer uses; the answer is {path, size, modified_at, text}. Over 1 MiB (or a JSON answer past the 1 MiB response limit) is 413 file_too_large, binary or non-UTF-8 content 415 file_not_text, and a missing file or a directory 404 file_not_found.

changes #

GET /sessions/{session_id}/changes?base=uncommitted|upstream (capability checkout_changes) is the diff client's view of a checkout: every file the working copy changes against a base, with its diff. daemon/changes.gleam owns it; the HTTP contract is in the API docs. It runs its commands in two or three batches, each batch side by side: albedo_changes.erl locally (stderr dropped, stdout cut at 4 MiB, exit status and timeout told apart), or one gather route run per batch on a remote host after a repo gather finds the checkout. Every batch shares one 15 s deadline (a diff of a large tree takes longer than the 2 s browsing questions get); missing it is 504.

  • git: git status --porcelain=v2 --branch -z --untracked-files=all gives HEAD, branch, upstream and the untracked files; upstream also tries merge-base HEAD with @{upstream}, origin/HEAD and origin/main at once and takes the first that answers. Then git diff -M --raw --numstat -z <base> lists the files and counts and git diff -M <base> gives the patch, split per file by its diff --git line; untracked files are read here (a head of at most 256 KiB each, 1 MiB in all, lines counted up to 64 MiB) and shown as git shows a new file. An unborn HEAD compares with the empty tree.
  • jj colocated with git: jj resolves the base (@'s first parent, or fork_point(trunk() | @)) with --ignore-working-copy, then git diffs the files on disk against it. jj keeps git's index at @- with new files added intent-to-add, so this is @ as it is now, including edits jj has not snapshotted; a file git does not know yet is reported added, since jj tracks it at its next snapshot. Stale only if @- itself moved since jj last ran.
  • jj without git: jj diff --git with --ignore-working-copy, so the answer is as fresh as jj's last snapshot (any jj command the agent or person runs). Nothing here snapshots, because that would write an operation on every poll.

The ETag hashes the encoded answer, so a 304 still computes the whole diff: on this repository with 26 changed files that is about 50–90 ms locally.

GET /hosts lists recent, SSH-config and plain known_hosts targets in order with cached probe state (skipping hashed entries, wildcards and raw IPs). POST /hosts/{host}/probe starts or joins a probe. Clients poll GET /hosts?target=<host> until it completes, including targets absent from SSH config and session history. SSH sign-in remains an explicit operator action.

the picker #

/cd opens it full screen; /cd <path> moves at once. an empty query lists recent folders (the workspaces of your sessions, local and remote, ranked by how often and how recently they were used). typing a path lists that folder's directories, filtered by the last segment. tab enters the highlighted folder, shift+tab goes up, enter moves there, esc goes back. the same picker replaces the plain text box shown when a session's workspace has gone missing.

the query takes scp syntax for another host, so a host is picked like a folder (cli/internal/tui/folder_picker.go, parseQuery):

  • chernobog: lists that host's home, chernobog:proj/ and chernobog:~/proj/ browse under it, chernobog:/srv/ from its root. everything after the last slash filters, as locally. the listing comes from /workspaces with location; its canonical path and home fold rows to chernobog:proj/albedo.
  • hosts complete from GET /hosts (recent first, then ssh config and known_hosts), with the hosts of the sessions already listed as a fallback. an empty query lists known hosts under their own hosts rule below the recent folders; a bare word filters the recent folders as before and adds the hosts whose name it starts under hosts, so cher offers chernobog: without turning a local filter fuzzy. text with an @ and no : can only be user@host: it lists hosts alone, fuzzy on the host part, and the typed user goes with the completion. tab or enter on a host completes to host:.
  • highlighting a remote row (a recent remote folder, a host, a folder in a remote listing), or typing a remote listing, warms its host once per picker: POST /hosts/{host}/probe, then GET /hosts?target={host} every 750 ms until the probe settles. Host resources expose step: "staging" while SSH copies the kernel bundle, and null otherwise. The picker shows "copying the kernel" during staging and "connecting" during other probe work. The row shows it quietly: faint while warming, plain once ready, the probe's detail in the error style when unreachable or unsupported, sign in · ctrl+l when it needs a person. ctrl+l runs the same ssh -M -fN handoff a refused turn offers (kernel.md, "signing in"), with the control_path the probe answered, then warms the host again. repositories and the preview of a remote row wait for ready; until then the pane shows the host's state, and when ready its os, arch and ~.
  • enter never picks a dead host: on an unreachable, unsupported or needs-auth host it stays and says why in the footer.

in the sessions view, ctrl+f (or ~ or / typed into an empty search) opens the same picker to browse sessions by folder: enter starts a new session in the highlighted folder instead of moving one. in either mode → steps into the highlighted folder's sessions, where enter opens one and ← goes back.

the preview keeps its sessions on screen: the tree fits around a third of the pane kept for them, showing fewer children per directory, then only the top level, then fewer top entries, and the sessions fill whatever the tree leaves.