Skip to main content

crewship memory

Access memory FTS5 indexes on the local filesystem without a running server. Useful for development, debugging, and scripting.

Subcommands

FTS5 search across memory with scope control.
Flags: Examples:

status

Show memory index statistics.
Example:

health

Print the 5-metric memory health score for the caller’s workspace. Hits the running server (requires crewship login and a workspace context) — unlike search/status/reindex which read local FTS indexes, health calls GET /api/v1/memory/health, which recomputes fresh on every request from five aggregate SQL queries. The persisted memory_health_snapshots table is for trend graphs, not for this command.
Flags: The global --format flag is honoured (table, json, yaml, ndjson). Example:
The 77/100 is colour-coded — red below 50, yellow 50–74, green 75 and above. The colour is applied via terminal escape codes; in pipes (| cat or --format json) it disappears. See Episodic memory — health scoring for what each metric measures and the weighted-composite formula.

reindex

Rebuild FTS5 index from markdown files. Signal-aware (responds to SIGINT/SIGTERM).
Example:
Returns non-zero exit code if all reindex operations fail.

hybrid

Search workspace memory through the server’s hybrid engine — full-text chunks plus episodic journal recall, merged and ranked. Unlike search (local filesystem FTS), this requires a login token and works from any machine.

versions (server API)

The memory versions group mirrors log/show/restore over the running server’s API — use these from any machine; the direct-DB commands below only work on the server host. The workspace comes from the auth context.
restore requires OWNER/ADMIN, prompts for confirmation (--yes skips), and the server confines <canonical-path> to its configured memory root. list columns: SHA256, WRITTEN, BYTES, WRITTEN BY. --limit defaults to 20 and the server clamps it to 1–1000.

Projection state — “nothing here” vs “we could not look”

list leads with a projection state whenever it changes how the list should be read. An empty version history has two completely different meanings and they used to print the same empty table: Recorded paths are agent:<slug>/… or crew:<crew_id>/… ending in AGENT.md, CREW.md, pins.md, learned-*.md, or daily/*.md. Everything else — lessons.md, PERSONA.md, peers/* — is unrecorded and has its own history surface; the reason text names it. The state and its reason are printed above the table in human output and carried verbatim in --format json:
A server predating this field answers without it. The CLI reads that as recorded — the state every path had when the only writers were recording ones — so an older server is never reported as having versioning switched off.

log

List the memory_versions audit chain for a path, newest-first. Reads the local DB directly (openAdminDB — same DB the server uses) rather than going through the API; that means it works without a running server but the binary must run on the same host as the data dir.
<path> is the audit-trail identifier the consolidator + approve flow record under. For canonical learned files this is crew:<crew_id>/learned-YYYY-MM-DD.md (see internal/consolidate.canonicalAuditPath); for pins it’s crew:<crew_id>/pins.md. Empty result prints no versions for <ws> @ <path> to stderr and exits 0.

show

Print the raw content of one historical version to stdout. The canonical file on disk is not touched — this is the “preview without restoring” path.
Stdout = raw blob bytes (pipe-friendly). Stderr carries status/errors. Exit codes:
  • 0 — blob found and streamed
  • 1 — version not found or read error
  • 2 — invalid usage

restore

Atomically replace the canonical memory file at <canonical-path> with the content of version <sha>, then write a fresh memory_versions row so the chain stays forward-only — history is never rewritten.
The path guard rejects empty strings, any path containing .., and any target whose absolute form does not start with {blob-root}/.. (the data dir, one level above versions).

export

Write memory out as a portable OKF bundle — markdown with YAML frontmatter, readable and git-friendly. Goes through the server, so it works from any machine the CLI can reach.
OWNER/ADMIN only — the bundle contains every private note the agent holds. The same export is available in the dashboard: an agent’s Memory tab has an Export button that downloads the bundle. Import has no UI equivalent — see Memory Portability.

import

Read a memory directory produced by another harness, map it onto Crewship’s tiers, and write it in. Recognises crewship, okf, nanoclaw and openclaw layouts.
--apply requires OWNER/ADMIN, the same as export — it writes into the context an agent reasons from. Imported documents pass through the same guards an agent’s own writes do: a closed allowlist of paths, per-file size ceilings, secret and prompt-injection scanning, and symlink-safe confinement. Refusals are listed per document and the command exits non-zero; a failed document does not stop the rest. Full mapping table and limits: Memory Portability.

Scope and Path Resolution

The meaning of --path depends on the selected scope: