OpenProgram Docs

Move projects while retaining history

Conversations live under the user directory, grouped by stable project id. No chat records are written into working folders.

~/.openprogram/
  projects/
    projects.json                    # registry / location / identity
    <project-id>/                    # project settings
  sessions/
    index.json                       # rebuildable listing
    locations.json                   # legacy compatibility
    projects/
      <project-id>/
        <session-id>/                # complete session Git repository
        .file-recovery/<session-id>/ # external rewind data
    <legacy-session-id>/             # existing default sessions
  memory/                            # memory store, unchanged
<working folder>/.openprogram/project.json  # versioned random identity token

What happens to the folder

SituationHistoryNew tasksWhat the App does
Moved or renamed, also while closedKeptRun at the new pathToken found in the bounded search: location updates. Id, title, conversations and archive state stay; chat files do not move. Outside the search: reopen or Locate once.
Drive disconnectedReadableBlockedStays in the sidebar. "Working folder unavailable. Read history now; reconnect before running tasks." Files and attachments referring to them wait for reconnection and identity check. If app storage itself is offline, history is unavailable too.
Copied, original still thereSeparateRunOpening the copy registers a new project with a fresh token.
Copied then original deletedKeptRunOne candidate: treated as a move, also across drives. It cannot be told apart from a move.
Several copies foundKeptBlockedExplicit Locate.
Another folder at the old pathKeptBlocked["The folder at this location has changed." Locate the original or confirm a replacement. A location registered to another project is never taken over.
Legacy conversation, source drive offlineUnavailableBlockedRegistration stays. "This legacy conversation has not migrated. Reconnect the original drive to finish." Never an empty session in its place.

Where projects appear

ProjectSidebarPicker and management
Unarchived conversationsshownshown
No conversationhiddenshown
All archivedhiddenshown, archived count separate

Derived from the current valid session set; session_count is not the predicate. Registration removal, archiving, permanent conversation deletion and working-folder deletion are distinct and never cascade into working files.

Repair

MechanismRule
DiscoveryAt startup, project-list requests, file or execution access, Locate and opening a folder; never idle. Registered parents or their nearest surviving ancestor, up to 3 levels and 4,000 entries. Excludes home and its ancestors, hidden and dependency directories, directory symlinks. Incomplete or multiple matches do not relocate.
Project listAnswers from memory: the parsed registry and the conversation index. It shows the location the registry records and touches no project folder, so its cost does not grow with the number of projects and a deleted folder costs nothing; no search, no registry lock, off the event loop.
Check behind the listAfter the reply, in the background, one run at a time and at most every 10 seconds; a listing inside that interval queues one run for its end. A folder in place costs one folder check and one marker read; all missing projects share one bounded walk. A changed state (folder moved, deleted or back, a deferred migration settled) is recorded and broadcast as projects_changed, and every page lists again.
A change made elsewhereCreating, renaming, moving or hiding a project from any connection broadcasts projects_changed as soon as the change is stored, before the requester gets its reply: a requester that hangs up at once (the CLI, a script, an agent) still reaches the others. Every open page lists again without a reload. An open project menu re-lists in place and keeps its scroll position.
A re-list with no answerChanges nothing: the project menu keeps its rows, and the file panel's folder-unavailable notice keeps its message and repair buttons.
Opening a subfolderA folder with no token, whose nearest token ancestor belongs to a project missing from its recorded place, moves that project to the ancestor (reattach_enclosing_project). Home and its ancestors are never read.
Sibling movesWhen one project is found, other missing projects under the same old parent are tried under the new parent, and outer parents while names agree (follow_sibling_moves). Only where a project's own token is found: one Locate repairs a moved directory.
Where repair is offeredProject menu, Projects page and file tree, from lib/projects/project-location.ts. Identity differs at the recorded path, or a legacy record cannot be verified (a cloud-synced folder can change inode): one click confirms after showing the path. Locate opens the picker.
File tree refreshOpen folders re-list when the window regains focus, at most every 3 seconds, no size recount, through the same location check.
After migrationA waiting project opens when the retry reports every session done or deleted. A journal row whose workdir copy is gone but whose published directory holds the session metadata is done.
Identity, markers and relocation rules
  • The list reads no folder: a file-system call gives up the interpreter lock and waits a 5 ms switch interval to get it back while another thread computes. A folder check and marker read per project (800 calls for 126 projects) answers in 6 ms alone, 4 seconds beside one busy thread, 14 beside two.
  • The check behind the list looks for dead conversation references in the published registry without its lock and takes the lock only to write a change, so a turn binding its conversation never waits on a pass that finds nothing. The walk for missing projects starts only when one is missing.
  • Registered ids stay, including path-derived ones. New projects get UUIDs after checking canonical paths; collisions retry, never merge. Session ids are globally unique, names are display only. Location records carry path, revision and token.
  • Ordinary edits and location checks never write a marker. Registration and Locate create it atomically, refuse symlinked or malformed metadata, and do not overwrite another project's. Marker is identity, not authorization: permissions are revalidated at the new path.
  • Legacy records with a matching device/inode at the recorded path upgrade once; others need Locate once. Device/inode and native bookmarks are not used afterwards. Git remote equality is not proof.
  • Automatic relocation needs a matching token and one unambiguous location. Manual Locate allows a replacement after showing old and new paths. Both recheck revision, permissions and ownership at commit. Legacy placement repairs use a durable journal and show "Updating location" until complete.
Execution and references
  • History reads need no working folder. New tasks are blocked with no fallback to HOME, server cwd or session workdir. Running subprocesses are not retargeted; later file operations revalidate. Worktrees are checked separately.
  • Historical messages, authorization snapshots and rewind manifests are not rewritten. New file references are project id plus relative path; unavailable legacy paths stay unavailable. Rewind targeting a missing old location reports it and creates nothing.
  • Project location overrides stale work_dir. Additional directories and source_folders inside the old root are rebased by relative suffix and revalidated; external ones keep absolute paths and their own checks. Missing required directories block dependent operations with a repair option.
  • Memory text and history stay; permanently deleting a source conversation removes or marks its link, without creating a copy. Archived sources stay accessible.
Migration and deletion
  • Every session writer quiesces first: model tasks, fork children, jobs, checkpoints, attachment writers. Initial migration runs before execution; a reconnecting legacy source needs the same boundary, never a hidden move during reads.
  • All writers (CLI, worker, fork children, rewind) share an interprocess lock keyed by session id and re-read revision and location after acquiring it. On timeout, defer; never kill tasks or copy concurrently. Migration holds it exclusively. Mixed-version writes to one profile are unsupported; older processes stop through lifecycle management first.
  • Journal source, destination, identities, inventory. Copy to private staging, verify content and unchanged source, durably publish session and recovery data, atomically publish placement, then clean. Publication failure never allows source deletion. Resume without overwriting conflicts.
  • Messages, Git history, branches, recovery backups and stored attachments are verified together. Deletion is serialized with migration, with durable intent so recovery cannot resurrect. One authoritative writable location.
  • Indexes rebuild from both layouts; a temporarily unavailable migrating session is never pruned as empty. During migration: "Migrating conversations · Tasks start after completion."
Comparison with other tools
  • Adopted: application-owned storage as Claude Code, Codex and DeepSeek Harness have; grouping by project, with stable ids instead of path encodings; id separate from roots as in Codex and OpenCode; Locate from GitHub Desktop. OpenProgram keeps Git session repositories, branches and recovery instead of JSONL.
  • Not adopted: DeepSeek's immutable workspace path; platform bookmarks and events as required identity (Apple, Windows, inotify).
  • Evidence: Codex storage and cwd matching filter on recorded cwd; DeepSeek storage and workspace membership validate real paths against an immutable header cwd. The Claude Code native distribution embeds JavaScript selecting ~/.claude/projects/encoded-path/session-id.jsonl, from local inspection.
Implementation status

Implemented. In openprogram/state/store/project/: identity.py, discovery.py, location.py, project_store.py; execution guard openprogram/runtime/conversation/session_settings/workdir.py. UI: apps/web/lib/projects/project-location.ts, apps/web/components/files/project-location-notice.tsx. Tests: tests/component/store/test_project_portable_identity.py. Acceptance covers rename and restart, parent moves, copy then delete, destinations outside discovery, simultaneous copies, conflicting markers, incomplete discovery, read-only or symlinked metadata, failure at each migration stage, wrong-directory refusal, no idle scanning.

Last updated · 2026-11-25