Skip to content
Apothem
CLI reference

migrate-workspace

CLI reference for the apothem migrate-workspace command.

Migrate a legacy per-harness workspace into the shared .apothem layout.

Synopsis

apothem migrate-workspace [--project PATH] [--dry-run]
                          [--quiet|-q] [--verbose|-v]
                          [--format plain|json] [--json] [--no-color]

migrate-workspace collapses a legacy per-harness data home (.apothem/<harness>/...) and a legacy .plans/ tree into the single shared .apothem/{plans,memory,learning,contexts} working directory. The base is the resolved --project root when supplied, otherwise the current working directory (the project-local default).

Per-harness memory, contexts, and learning stores union-merge into the shared store by id; learning signals concatenate-dedup; a conflicting record (same id, different body) is skipped, never overwritten. A legacy .plans/ tree moves under .apothem/plans/. Every consumed source is backed up first. The migration is idempotent — re-running on an already-migrated tree is a no-op.

Options

OptionDescription
--project PATHProject root for project-scope adapters that materialize into a project tree rather than a user-scope configuration directory.
--dry-runDetect the legacy layout and report what would migrate without writing.
--quiet, -qSuppress informational output; only errors are emitted.
--verbose, -vEmit additional diagnostic output.
--format plain|jsonOutput format (default: plain).
--jsonShorthand for --format json.
--no-colorDisable ANSI color codes in output.
-h, --helpShow help and exit.

JSON output

The --json envelope carries the migration outcome. On a completed migration status is success and the payload reports the merged record counts, whether a .plans/ tree was relocated, the backup root, and any skipped conflicts. A --dry-run invocation instead reports legacy_layout_detected.

{
  "command": "migrate-workspace",
  "status": "success",
  "base": "/home/example/project",
  "migrated": true,
  "backup_root": "/home/example/project/.apothem/.backups/01J9Z…",
  "memory_merged": 12,
  "contexts_merged": 4,
  "learning_merged": 7,
  "conflicts": [],
  "plans_moved": true,
  "notes": []
}

When no legacy layout is present, migrated is false and nothing is written. The --dry-run envelope omits the outcome counts and reports detection only:

{
  "command": "migrate-workspace",
  "base": "/home/example/project",
  "dry_run": true,
  "legacy_layout_detected": false
}

Examples

apothem migrate-workspace
apothem migrate-workspace --project .
apothem migrate-workspace --dry-run --json

Exit codes

CodeMeaning
0Migration completed, or no legacy layout was found (nothing to migrate)
1Expected error — a validation or project-root error, or a migration failure

See also

On this page