CPersona
v2.5.3Persistent AI memory in one SQLite file: 3-layer hybrid search, confidence scoring, 29 tools.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
pause_persistence
Pause write operations on this MCP server for an opt-in TTL window. While paused, every write tool — store, archive_episode, update_memory, delete_memory, delete_episode, delete_agent_data, lock_memory, unlock_memory, update_profile, import_memories, merge_memories, calibrate_threshold, set_recall_precision — returns a no-op response carrying `persisted: false`, `dry_run: true` and a `reason` (with the TTL remaining) instead of writing to the database. `persisted: false` is the authoritative signal: branch on it, not on an id. Where the success shape has an `id`, it reads `"no-persist"` (s…
| Parameter | Type | Description |
|---|---|---|
ttl_seconds | integer | TTL until automatic resume. Min 1, max 86400 (clamped). Default 1800. |
resume_persistence
Re-enable persistence immediately, clearing any active no-persist TTL. Returns was_active=true if persistence was paused before this call. **The flag is PROCESS-WIDE (response `scope`: "process"): on a streamable-HTTP deployment this re-enables writes for every connected session sharing the process, not just the caller's.**
persistence_status
Report whether persistence is currently paused and the TTL remaining (in seconds). The reported state is PROCESS-WIDE (response `scope`: "process"): on a streamable-HTTP deployment it reflects the one flag shared by every connected session, so `paused: true` may have been set by a different session.
get_operating_context
Read the server-served operating context (v2.5.1): the operator-owned doctrine distributed to every connected client. Without arguments returns the preview tier — context_revision, instructions_summary, project_id registry (+ enforce mode), @auto defaults, and doctrine section names. Pass section to fetch one section's full body. Read-only: the context is edited by the operator on the filesystem (~/.cpersona/operating-context.toml), never via MCP.
| Parameter | Type | Description |
|---|---|---|
section | string | Doctrine section name to fetch in full (from doctrine_sections). Empty = preview tier. |
store
Store a message in agent memory for future recall. Every response carries result — the one field to branch on: 'stored' (a new row was written; {ok:true, result:'stored', id:<row-id>, embedded:<bool>}, embedded true iff a local blob was persisted or the remote index push succeeded — false under EMBEDDING_MODE=none; the response also carries truncated:true when content exceeded the length cap and was shortened), 'skipped' (nothing written and nothing wrong: {ok:true, result:'skipped', reason:...}; the msg_id / content dedup branches echo the pre-existing row's id, the OR IGNORE fallback rea…
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier |
message * | object | ClotoMessage to store. Legacy source shapes are normalized server-side where unambiguous (e.g. lowercase type words, Rust serde externally-tagged dicts, bare 'user'/'assistant' strings); unknown shape… |
channel | string | Memory channel for context separation (e.g. 'chat', 'discord'). Default: '' (shared). |
project_id | string | v2.4.17 isolation axis. Optional — omit or pass '' to store in the global pool. Reads via γ semantics: a recall with project_id='X' returns 'X' rows + global pool. v2.5.1: pass '@auto' to resolve t… |
recall
Recall relevant memories using multi-strategy search (vector + FTS5 + keyword). Message content is returned as a preview tier by default — expand selected rows with get_contents(refs), or opt out wholesale with full_content=true. v2.5.2 additive: each scored message carries match_reason={signal, score, ...} where signal is the branch the ranking / quality gate keyed on (confidence > rsf > cosine > rrf) and the remaining keys (cosine / rrf / rsf) surface the internal per-retriever contributions present on that row. Unscored rows (cascade FTS/keyword) omit match_reason. A response carrying gat…
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier |
query * | string | Search query (empty returns recent memories) |
channel | string | Filter memories by channel (e.g. 'chat', 'discord'). Default: '' (all channels). |
deep | boolean | Deep recall — disable time and completion decay for exhaustive search |
exclude_contents | array | Normalized content strings to exclude from results (starts-with match). Used to prevent duplication with conversation context already known to the caller. |
full_content | boolean | v2.5.0 preview tier opt-out. By default message content longer than the preview cap (CPERSONA_RECALL_PREVIEW_CHARS, default 500) is returned as a pure prefix with content_truncated/content_len markers… |
limit | integer | Max memories to return (agent-facing cap; the library layer accepts up to the scan window for direct callers) |
project_id | string | v2.4.17 γ filter. Omit → no filter (all projects). '' → global pool only. 'X' → 'X' bucket ∪ global pool. Threaded through cascade / RRF / vector / FTS / keyword paths. v2.5.1: pass '@auto' t… |
source_id | string | v2.4.20 per-user source filter. Empty (default) = no filter. Non-empty = prefix match against json_extract(source, '$.id'), e.g. 'discord:12345' to restrict to one Discord user, or 'discord:' to scope… |
recall_with_context
Recall memories and merge with external conversation context. Automatically deduplicates, sorts chronologically, and returns a unified list. Replaces separate recall + manual merge in the caller. Content is preview-tiered by default — see recall's full_content / get_contents. Every external_context entry's content filters the recall (the caller already holds that text), but only role=user / role=assistant entries are merged into messages. When entries of other roles are present the response carries context_filter_only={roles:[...]} — those entries filtered the recall without appearing in t…
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent ID |
query * | string | Search query |
channel | string | Memory channel filter |
deep | boolean | Disable time decay |
external_context | array | Conversation history entries [{role, name?, user_id?, content, timestamp?}, ...] |
full_content | boolean | v2.5.0 preview tier opt-out — same semantics as in `recall`. |
limit | integer | Max recalled memories (agent-facing cap; the library layer accepts up to the scan window for direct callers) |
project_id | string | v2.4.17 γ filter — passed through to recall. Same semantics as in `recall`. v2.5.1: pass '@auto' to resolve this agent's default from the server's operating context (the resolution is echoed as res… |
source_id | string | v2.4.20 per-user source filter — passed through to recall. Same semantics as in `recall`. |
get_contents
Fetch full, untrimmed content for recall preview refs. Use after a preview-tier recall to expand only the rows that matter instead of opting the whole recall out with full_content=true.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier (ownership check — another agent's refs come back in `missing`) |
refs * | array | Refs from recall messages, e.g. ['mem:123', 'ep:45'] (max 20 per call) |
get_profile
Get the current profile for an agent.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier |
update_profile
Save a pre-computed agent profile to the database.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier |
profile * | string | Profile text to save (pre-computed by caller) |
archive_episode
Archive a conversation episode with pre-computed summary, keywords, and resolved status. All LLM processing is performed by the caller.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier |
summary * | string | Episode summary (pre-computed by caller) |
channel | string | v2.4.22 conversation-channel tag (e.g. a Discord channel id). Default '' (= unscoped). Channel-scoped recall returns episodes whose channel matches; this powers the per-channel episodic loop. |
history | array | Original conversation messages (used for start/end timestamp extraction; the episode embedding is computed from summary) |
keywords | string | Space-separated keywords (pre-computed by caller) |
project_id | string | v2.4.17 isolation axis. Omit or pass '' for the global pool. v2.5.1: pass '@auto' to resolve this agent's default from the server's operating context (the resolution is echoed as resolved_project_id;… |
resolved | boolean | Whether the topic was completed/concluded |
list_memories
List recent memories for an agent (for dashboard display).
| Parameter | Type | Description |
|---|---|---|
agent_id | string | Agent identifier (empty for all agents) |
limit | integer | Max memories to return |
project_id | string | v2.4.17 γ filter. Omit → no filter; '' → global pool only; 'X' → 'X' ∪ global pool. v2.5.1: pass '@auto' to resolve this agent's default from the server's operating context (the resolution is… |
list_episodes
List archived episodes for an agent (for dashboard display).
| Parameter | Type | Description |
|---|---|---|
agent_id | string | Agent identifier (empty for all agents) |
limit | integer | Max episodes to return |
project_id | string | v2.4.17 γ filter. Same semantics as list_memories. v2.5.1: pass '@auto' to resolve this agent's default from the server's operating context (the resolution is echoed as resolved_project_id; an unmapp… |
delete_agent_data
Delete ALL data (memories, profiles, episodes) for a specific agent. Used by kernel during agent deletion.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent ID whose data should be purged |
calibrate_threshold
Auto-calibrate the vector search threshold from the null (random-pair) cosine distribution. Samples random memory pairs and places the threshold ABOVE the null mean so unrelated pairs are rejected. method='separation' (default) learns the operating point from two populations — null pairs vs temporally-adjacent same-session positives (nearest-neighbour fallback when too few exist); method='percentile' uses a quantile of the null distribution (robust to anisotropic models such as bge-m3); method='zscore' uses mean + z*std. No labels used, purely statistical. Adapts to both embedding model and…
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent ID whose memories to sample |
method | string | 'separation' (default; two-population — learns the operating point from null pairs vs temporally-adjacent same-session positives, falling back to nearest-neighbour when too few exist), 'percentile',… |
percentile | number | Null-distribution quantile for method='percentile' (default: 0.95, higher = stricter) |
sample_size | integer | Number of embeddings to sample (default: 200) |
z_factor | number | Z-score multiplier for method='zscore' (default: 1.0, higher = stricter) |
set_recall_precision
Set an agent's recall precision (knob 3) and recalibrate its quality gate. precision = strict | balanced | lenient maps to a specificity weight beta of 2.0 / 1.0 / 0.5 in the gate separation objective (sensitivity + beta*specificity): strict sits the gate higher (fewer contaminants, more misses), lenient lower (fewer misses, more contaminants). A raw beta > 0 overrides the named level; an empty precision with beta <= 0 clears the per-agent override and returns the agent to the global CPERSONA_RECALL_PRECISION default. The gate is recalibrated at the new beta immediately and persisted, so the c…
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent whose precision to set |
beta | number | Raw specificity weight; overrides the named precision when > 0. |
precision | string | strict / balanced / lenient. Empty (with beta <= 0) clears the override. |
get_recall_precision
Read an agent's effective recall precision (knob 3) — the read-back companion to set_recall_precision. Returns the resolved specificity weight (beta) and its named precision level (strict / balanced / lenient, or 'custom' for a raw beta), and flags whether the value is a per-agent override or the global CPERSONA_RECALL_PRECISION default (overridden + global_precision / global_beta). Read-only: it never recalibrates and never persists, so a UI can load the current setting, let the user edit it, and write it back instead of the control being write-only.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent whose precision to read |
delete_memory
Delete a single memory by ID. Ownership is enforced when agent_id is provided.
| Parameter | Type | Description |
|---|---|---|
memory_id * | integer | Memory ID to delete |
agent_id | string | Agent ID for ownership verification (injected by kernel) |
delete_episode
Delete a single episode by ID. Ownership is enforced when agent_id is provided.
| Parameter | Type | Description |
|---|---|---|
episode_id * | integer | Episode ID to delete |
agent_id | string | Agent ID for ownership verification (injected by kernel) |
update_memory
Update memory content by ID. Rejects if memory is locked. Ownership enforced when agent_id provided. The new content passes through the same sanitizer as store: it is capped at the content length limit (the response carries truncated:true when the cap bit) and [Memory from ...] annotations are stripped, so content consisting only of those is refused rather than written as an empty row.
| Parameter | Type | Description |
|---|---|---|
content * | string | New content for the memory |
memory_id * | integer | Memory ID to update |
agent_id | string | Agent ID for ownership verification |
lock_memory
Lock a memory to prevent deletion and editing. Ownership enforced when agent_id provided.
| Parameter | Type | Description |
|---|---|---|
memory_id * | integer | Memory ID to lock |
agent_id | string | Agent ID for ownership verification |
unlock_memory
Unlock a memory to allow deletion and editing. Ownership enforced when agent_id provided.
| Parameter | Type | Description |
|---|---|---|
memory_id * | integer | Memory ID to unlock |
agent_id | string | Agent ID for ownership verification |
get_queue_status
Get the status of the background task queue (pending tasks, retry config).
export_memories
Export memories, episodes, and profiles to a JSONL file for backup or portability.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent identifier (empty string to export all agents) |
output_path * | string | File path for the JSONL output |
include_embeddings | boolean | Include embedding BLOBs as base64 (default false, usually not needed) |
import_memories
Import memories, episodes, and profiles from a JSONL file. Idempotent via msg_id deduplication.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | Path to the JSONL file to import |
dry_run | boolean | Count records without writing to DB (preview mode) |
target_agent_id | string | Remap all records to this agent ID (empty to use original agent_id from file) |
merge_memories
Merge memories, episodes, and profiles from one agent into another. Atomic one-shot equivalent of export→import without intermediate files. Strategy 'skip' deduplicates by msg_id (memories) and summary (episodes).
| Parameter | Type | Description |
|---|---|---|
source_agent_id * | string | Agent ID to merge FROM |
target_agent_id * | string | Agent ID to merge INTO |
dry_run | boolean | Preview merge without writing to DB |
mode | string | Merge mode: 'copy' (preserve source) or 'move' (delete source after merge) |
strategy | string | Merge strategy: 'skip' (default) — skip duplicates, keep target's version |
check_health
Check memory database health (25-check registry, each issue tagged with severity critical/warn/info). Detects contamination, duplicates, oversized content, embedding issues, FTS integrity (count + content-level), schema version/object drift (missing UNIQUE indexes or FTS triggers), SQLite file integrity, project_id naming drift, invalid JSON/timestamps, timestamp format drift, stale tasks, missing profiles, empty content, invalid/anonymous sources. Returns storage stats incl. project_id/channel distributions. Set fix=true to auto-repair (agent-scoped, locked-safe); critical file-integrity find…
| Parameter | Type | Description |
|---|---|---|
agent_id | string | Agent ID to check (empty = all agents) |
checks | array | Registry check names to run (empty = all). See cpersona.checks.HEALTH_CHECK_NAMES. |
fix | boolean | Auto-fix detected issues |
deep_check
Deep heuristic analysis of memory data quality. Detects issues requiring recovery or judgment (anonymous sources, short/trivial content, stale profiles, orphaned episodes, stale threshold calibration, embedding-space near-duplicate pairs as merge candidates). fix=true applies repairs for: anonymous_source, short_content. Report-only (fix is accepted and ignored): stale_profile, orphaned_episodes, calibration_staleness, near_duplicate — apply those decisions via merge_memories / delete_memory / calibrate_threshold / update_profile. Use checks parameter to select specific checks.
| Parameter | Type | Description |
|---|---|---|
agent_id * | string | Agent ID to check (required) |
checks | array | Checks to run (empty = all). Options: anonymous_source, short_content, stale_profile, orphaned_episodes, calibration_staleness, near_duplicate |
fix | boolean | Apply repairs (default: dry-run preview only) |
migrate_channel_axis
Re-channel bridge-type memories to their concrete channel (knob2 v2 default flip prep). Memories the kernel filed under the bridge type ('discord') are rewritten to the concrete channel recovered from the stored session_id ('{channel_id}:{user_id}:{chunk}' | '{channel_id}:shared' → channel_id), so per-channel recall can match them. Non-destructive (only the channel column changes) and idempotent (re-running is a no-op once moved). dry_run=true (default) reports the recoverable count, the channels that would be recovered, and an unrecoverable bucket (channel='discord' rows with no snowflake s…
| Parameter | Type | Description |
|---|---|---|
agent_id | string | Agent ID to migrate (empty = all agents) |
dry_run | boolean | Preview counts only, no mutation (default: true) |
globalize_unrecoverable | boolean | Also move channel='discord' rows with no snowflake session_id to channel='' (global). Default false. |