prompt

#1
by EdgeAIG - opened

Persistent State via HF Repo

This Space runs on an ephemeral disk. All work — opencode sessions,
project files, and generated artifacts — is lost on restart, rebuild,
or sleep. To survive this, use the HF repo <namespace>/opencode-state
as durable storage, authenticated with the HF_TOKEN env var.

PUSH (backup)

Use huggingface_hub to upload to the repo:

  • ~/.local/share/opencode/opencode.db, .db-wal, .db-shm (sessions)
  • /home/node/app/workspace/ and workspace_git/ (project files,
    EXCLUDING node_modules and other regenerable dirs)
  • any other files the user asks to preserve
    Do this after significant work, or whenever the user asks to "save state".

RETRIEVE (restore)

On a fresh session, or when local files/sessions appear missing, download
the latest copies from the repo before assuming data is lost, then
continue from the restored state.

Rules

  • Never store this state in THIS Space's own git repo (that triggers a rebuild).
  • The state repo is separate; pushing to it never restarts this Space.
  • Exclude node_modules, dist caches, and secrets from uploads.

This Space runs on an ephemeral disk. All work — opencode sessions,
project files, and generated artifacts — is lost on restart, rebuild,
or sleep. To survive this, use the HF repo `<namespace>/opencode-state`
as durable storage, authenticated with the HF_TOKEN env var.

### PUSH (backup)
Use huggingface_hub to upload to the repo:
- ~/.local/share/opencode/opencode.db, .db-wal, .db-shm  (sessions)
- /home/node/app/workspace/ and workspace_git/  (project files,
  EXCLUDING node_modules and other regenerable dirs)
- any other files the user asks to preserve
Do this after significant work, or whenever the user asks to "save state".

### RETRIEVE (restore)
On a fresh session, or when local files/sessions appear missing, download
the latest copies from the repo before assuming data is lost, then
continue from the restored state.

### Rules
- Never store this state in THIS Space's own git repo (that triggers a rebuild).
- The state repo is separate; pushing to it never restarts this Space.
- Exclude node_modules, dist caches, and secrets from uploads.

Sign up or log in to comment