USRCP — User Context Protocol

v0.2.8
io.github.frank-bot07/usrcp Checked 3 days ago Published 1 month ago

Encrypted local ledger of structured user state, shared across every MCP-aware AI tool.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

usrcp_handoff

Load a concise startup context packet for the human user when switching AI interfaces: relevant projects, facts with review status and recent work. Call at session start and refresh before consequential work; another agent may have updated the plan.

ParameterTypeDescription
domain *string
max_charsinteger

usrcp_get_state

Query the user's identity, preferences, active projects, domain context, and recent interaction timeline from their USRCP State Ledger. Use this at the start of a session to understand who the user is and what they've been working on across all AI platforms.

ParameterTypeDescription
callerstringIdentifying name of the calling agent/platform
scopesarrayWhich facets of user state to retrieve
timeline_domainsarrayFilter timeline to specific domains (e.g., ['coding', 'writing'])
timeline_last_nnumberNumber of recent timeline events to retrieve
timeline_sincestringISO 8601 timestamp — retrieve timeline events after this time

usrcp_append_event

Record an interaction event to the user's USRCP State Ledger. Call this when a meaningful interaction completes — a task finished, a decision made, a file created, a bug fixed. This builds the user's cross-platform interaction history.

ParameterTypeDescription
domain *stringSemantic domain: coding, writing, research, design, personal, health, finance, etc.
intent *stringWhat the user was trying to accomplish
outcome *stringHow the interaction resolved
summary *stringConcise summary of what happened
artifactsarrayReferences to outputs (files, commits, URLs)
detailobjectStructured detail blob — varies by domain
idempotency_keystringClient-generated key to prevent duplicate writes on retry
platformstringPlatform this event originated from (e.g., 'claude_code', 'cursor')
session_idstringSession identifier to group related events
tagsarrayFreeform tags for filtering and search

usrcp_update_identity

Update the user's core identity in the USRCP State Ledger. Use when you learn new information about the user — their role, expertise, or communication preferences.

ParameterTypeDescription
callerstringIdentifying name of the calling agent/platform
communication_stylestringHow the user prefers AI to communicate
display_namestringUser's display name
expected_versionintegerOptional: version from a prior read. If the stored version differs, the update is rejected with VERSION_CONFLICT. Use for read-modify-write flows.
expertise_domainsarrayUser's expertise areas and levels
rolesarrayUser's roles (e.g., ['founder', 'software_engineer'])

usrcp_update_preferences

Update the user's global preferences in the USRCP State Ledger. These preferences apply across all AI platforms.

ParameterTypeDescription
callerstringIdentifying name of the calling agent/platform
customobjectCustom key-value preferences
expected_versionintegerOptional: version from a prior read. If the stored version differs, the update is rejected with VERSION_CONFLICT.
languagestringPreferred language code (e.g., 'en')
output_formatstringPreferred output format
timezonestringIANA timezone (e.g., 'America/Los_Angeles')
verbositystringPreferred verbosity level

usrcp_update_domain_context

Store or update domain-scoped context in the USRCP State Ledger. Use this to persist domain-specific knowledge that should be available to any agent working in that domain (e.g., coding preferences, writing style notes, research topics).

ParameterTypeDescription
context *objectKey-value context to merge into the domain (e.g., { preferred_framework: 'nextjs', css: 'tailwind' })
domain *stringDomain name (e.g., 'coding', 'writing', 'research', 'design')
callerstringIdentifying name of the calling agent/platform
expected_versionintegerOptional: version from a prior read (0 = domain does not yet exist). If the stored version differs, the update is rejected with VERSION_CONFLICT.

usrcp_search_timeline

Search the user's interaction timeline by keyword. Useful for finding past interactions, decisions, or context about specific topics.

ParameterTypeDescription
query *stringSearch query — matches against summary, intent, and tags
callerstringIdentifying name of the calling agent/platform
domainstringFilter to a specific domain
limitnumberMax results

usrcp_manage_project

Create or update a project in the user's USRCP State Ledger. Projects track what the user is actively working on across platforms.

ParameterTypeDescription
domain *stringProject domain (coding, writing, research, etc.)
name *stringHuman-readable project name
project_id *stringStable handle for the project (the upsert key). Stored as an opaque HMAC — the id itself is never persisted or synced in the clear — so any string is safe. The human-readable title goes in `name`.
summary *stringBrief project description or current state
callerstringIdentifying name of the calling agent/platform
statusstringProject status

usrcp_audit_log

View the USRCP audit log — every read, write, search, and delete operation recorded with timestamps, agent identity, and scopes accessed.

ParameterTypeDescription
limitnumberNumber of audit log entries to retrieve

usrcp_rotate_key

Rotate the master encryption key. IRREVERSIBLE: replaces the on-disk master key and re-encrypts every row. DO NOT call this on your own initiative — only when the user has explicitly asked to rotate, or to respond to a confirmed key-compromise event. Rate-limited to once per 24h by default; rows that fail MAC verification under the current key are NOT silently dropped (the call will return an error and refuse to advance unless force_skip_damaged=true).

ParameterTypeDescription
force_rate_limitbooleanBypass the 24h rate limit (USRCP_ROTATE_KEY_MIN_INTERVAL_HOURS). Set true only when the user has explicitly asked to rotate again sooner.
force_skip_damagedbooleanProceed even when rows fail to decrypt under the current key. Those rows become permanently unreadable. Set true only after taking a snapshot and confirming the data loss is acceptable.
new_passphrasestringNew passphrase for key derivation. If omitted, generates a random key (dev mode).

usrcp_set_fact

Store a free-form fact in a domain namespace. Use for data the fixed schema doesn't model (habits, relationships, recurring tasks, mood, goals, etc.). Upserts one row per (domain, namespace, key) — re-calling with the same key overwrites. All values are encrypted with the domain-scoped key.

ParameterTypeDescription
domain *stringSemantic domain (coding, personal, health, etc.)
key *stringKey within the namespace (e.g., 'morning_routine')
namespace *stringNamespace within the domain (e.g., 'habits', 'relationships')
value *Free-form value — any JSON-serializable data
callerstringIdentifying name of the calling agent/platform
expected_versionintegerOptional: version from a prior read (0 = fact does not yet exist). If the stored version differs, the write is rejected with VERSION_CONFLICT.

usrcp_get_facts

Read schemaless facts. If `key` is provided, returns a single fact; otherwise lists all facts in the domain (optionally filtered by namespace).

ParameterTypeDescription
domain *stringDomain to read from
keystringOptional: fetch a single fact by key (namespace required if set)
namespacestringOptional: filter by namespace

usrcp_status

Get the status and statistics of the local USRCP ledger — total events, domains, platforms, and projects.