crewship memory
Access memory FTS5 indexes on the local filesystem without a running server. Useful for development, debugging, and scripting.Subcommands
search
FTS5 search across memory with scope control.| Flag | Short | Default | Description |
|---|---|---|---|
--path | -p | (required) | Base path (meaning depends on scope) |
--scope | -S | agent | agent, crew, workspace, or all |
--limit | -l | 10 | Maximum results per scope |
--format | -F | table | Output format: table or json |
status
Show memory index statistics.health
Print the 5-metric memory health score for the caller’s workspace. Hits the running server (requirescrewship 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.
| Flag | Description |
|---|---|
--crew | Scope to a single crew by slug or ID. Omit for workspace-aggregate. |
--format flag is honoured (table, json, yaml).
Example:
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).hybrid
Search workspace memory through the server’s hybrid engine — full-text chunks plus episodic journal recall, merged and ranked. Unlikesearch (local filesystem FTS), this requires a login token and works from any machine.
| Flag | Default | Description |
|---|---|---|
--limit | 10 | Maximum hits. |
--scope | (all visible) | own (agent-only) or crew_shared (crew-bound). |
--crew | Crew slug or id for crew_shared scope. |
versions (server API)
Thememory 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.
log
List thememory_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.
| Flag | Default | Description |
|---|---|---|
--limit <n> | 20 | Max rows. Clamped to 1000 by the local query (this command reads the DB directly, no server involved). |
--format | json | json (pretty-printed) or text (one row per line, git-log–style: <sha-12> <ts> <bytes> B <writtenBy>). |
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.0— blob found and streamed1— version not found or read error2— 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.
| Flag | Default | Description |
|---|---|---|
--blob-root | {CREWSHIP_DATA_DIR}/memory/versions (or ~/.crewship/memory/versions) | Content-addressed blob store root. Match what the server wrote to. |
--user | $USER (falls back to cli) | writtenBy for the new audit row. Use a real operator id for compliance trails. |
--tier | learned | Tier label for the new audit row: agent / crew / workspace / pins / learned. |
--force | false | Skip the “canonical path must stay inside the data dir” guard. Use only when a workspace’s memory dir lives outside the standard tree. |
.., and any target whose absolute form does not start with {blob-root}/.. (the data dir, one level above versions).
Scope and Path Resolution
The meaning of--path depends on the selected scope:
| Scope | --path should point to |
|---|---|
agent | Agent .memory/ dir or agent dir (auto-appends .memory/) |
crew | Crew root dir (resolves to <path>/shared/.memory/) |
workspace | Workspace memory dir (e.g. ~/.crewship/memory/<workspace-id>) |
all | Crew root dir (searches agent + crew) |