Sandbox v2 filesystem

Status: partially implemented. Local filesystem extraction and remote adapter wiring are complete. Remote filesystem operations, project-template seeding, and the remaining integrations are not implemented. Project-user execution remains highly experimental and incomplete.

Problem

With agent.tools.bash.provider=http-v2, Bash runs on a remote VM. Git tools, project-context loading, skills, and attachment handling still depend on Sidekick's local filesystem. File tools now select a remote adapter when v2 Bash is enabled, but its filesystem client methods are stubs. They fail rather than fall back to local files.

The local and remote filesystems must not be treated as interchangeable. In particular, the local virtual path /data/project does not exist on the VM.

Direction

Keep project working files on the VM. Route agent-facing filesystem operations through the sandbox API when v2 is configured. Transfer inputs and outputs explicitly; do not bidirectionally synchronize project directories.

Files Location Preparation or transfer
Project working files and command outputs Project user's VM home, under data/project/ Seed project templates; migrate existing files explicitly; download outputs for delivery
Project templates Sidekick's templates/project/ Copy missing files into the VM project directory without overwriting existing files
Session scratch files VM, under ~/.agents/ No synchronization back to Sidekick; exact session layout remains open
Incoming attachments Sidekick initially; VM copy for tool access Upload for the relevant session under ~/.agents/
Skills repositories Shared VM /data/skills/; local checkouts for Sidekick discovery and prompts Sandbox daemon clones and refreshes configured repositories on the VM
Knowledge repositories Shared VM /data/global/; local checkouts for Sidekick Sandbox daemon clones and refreshes configured repositories on the VM

Background processes can modify working files between commands. Keeping those files authoritative on the VM avoids competing local copies and synchronization conflicts. Shared network storage is not required.

Backend selection

Sidekick's configuration, persisted sessions, and other internal state remain local. This change concerns agent-facing workspace operations, not every filesystem access in Sidekick.

Paths and permissions

Here, ~ denotes the project user's home. Filesystem requests must use the agreed home-relative or daemon-resolved absolute paths; shell tilde expansion must not be assumed for API paths.

There are no mounts in v2. Do not recreate host mounts, create a global /data/project alias, or invent a separate filesystem root per project.

Project templates and AGENTS.md

The existing local setup supports optional templates under ${agent.working-directory}/templates/project/. There is no checked-in AGENTS.md template. Existing project files are not overwritten, and all threads in a channel share the same project workspace.

For v2, copy the project template into ~/data/project/ before loading project context or running tools. Copy missing files and create their parent directories; preserve existing files, including AGENTS.md. Template preparation must be safe to repeat.

Project-context loading must read ~/data/project/AGENTS.md through the selected filesystem backend and retain the existing per-turn snapshot behavior. A missing file means empty project context. Remote failures must not silently substitute local instructions.

The next implementation slice covers project templates only. Session work-template copying is deferred.

Skills and knowledge repositories

Knowledge repositories are configured in config/knowledge.json; skills repositories are configured in config/extensions.json. Both are cloned and refreshed, not created from templates.

For v2, Sidekick requests the sandbox daemon to clone or refresh these repositories from inside the VM. Do not upload Sidekick's local checkout directories. Sidekick still needs its local checkouts for discovery and prompt assembly; agreement between local and VM revisions remains to be specified.

Private-repository operations need an authentication mechanism that keeps credentials outside the sandbox boundary. Do not store credentials inside the VM, where model-driven commands could discover them. Sidekick-local SSH-key paths cannot be passed as though they identify files there.

Migration from v1

Required integration

Implementation order

  1. Completed: extract local workspace operations behind WorkspaceFilesystem.
  2. Completed: share the v2 sandbox client between Bash and the remote filesystem adapter, and wire backend selection. Remote filesystem methods remain stubs.
  3. Add daemon-side project-home resolution and the remote operations needed to seed project templates into ~/data/project/ without overwriting files.
  4. Route project-context loading through the selected backend.
  5. Implement the remaining remote filesystem operations and daemon-managed skills/knowledge repository preparation.
  6. Add attachment uploads and output downloads; route Git and reply attachment delivery to the remote project files.
  7. Update prompt and skill path generation, and provide an explicit migration for existing files and path references.

Open decisions

Existing execution behavior is documented in bash.md. This document distinguishes the implemented filesystem seam and remote wiring from the remaining v2 work.