Expand description
The trusty-memory daemon: one resident process, one Unix socket.
Why: Claude Code and other MCP-aware clients reach trusty-memory through the
Model Context Protocol, and the daemon owns redb’s exclusive write lock, so
every client has to go through it rather than open the store itself (#1078).
trusty-memory serve --stdio is the canonical integration: it forwards each
JSON-RPC request to the running daemon and never opens redb.
#6286 (ADR-0032) retired the HTTP half. The daemon bound
127.0.0.1:7070, walked to :7079 when that was taken, published the
winner in an http_addr discovery file, and served forty axum routes plus
an /sse broadcast. It now serves trusty_common::daemon_socket_path’s
hardened Unix socket and nothing else; trusty-console is the workspace’s
only HTTP surface.
What: transport::uds::serve is the daemon body, and AppState carries
the shared PalaceRegistry, the on-disk data root and a lazily-initialised
embedder.
Test: cargo test -p trusty-memory — transport::uds::tests for the wire,
tests/serve_stdio_e2e.rs for the bridge end to end.
Re-exports§
pub use activity::ActivityEntry;pub use activity::ActivityFilter;pub use activity::ActivityLog;pub use activity::ActivitySource;pub use attribution::CreatorInfo;pub use attribution::CreatorSource;pub use transport::serve;pub use transport::socket_path;pub use mcp_service::MemoryMcpService;pub use tools::MemoryMcpServer;
Modules§
- activity
- Persistent activity log for the trusty-memory daemon (issue #96).
- attribution
- Drawer creator-attribution tag helpers.
- authz
- Minimal authorization seam for privileged operations (issue #1714).
- bm25_
backfill - Lossless BM25 backfill for a palace’s existing drawers.
- bm25_
index - Persistent per-palace BM25 index — the in-process owner of a palace’s lexical corpus.
- bm25_
lane - In-process BM25 lexical lane — one resident index per hot palace.
- bm25_
repair - Runtime repair for palaces whose BM25 coverage is known to be broken.
- bootstrap
- Knowledge-graph bootstrap helpers.
- chat
- The chat surface: a streaming completion and the tool loop behind it.
- client
- The one way anything in this crate calls the running daemon (#6286).
- commands
- Per-subcommand handlers for the
trusty-memorybinary. - console_
metrics - MCP
console_metricstool handler for trusty-memory. - discovery
- Automatic project alias discovery.
- dream_
scheduler - Autonomous Dreamer scheduler — spawns per-palace dream loops on daemon startup.
- fd_
metrics - File-descriptor usage and limit reporting for the
/healthendpoint. - hook_
emit - Cross-process hook activity emit.
- idle_
evict - Idle-to-disk eviction ticker — periodically drops cold palace handles.
- kg_
extract - Deterministic KG triple extraction from drawer content.
- kg_
write - The one entry point for asserting a caller-supplied KG triple.
- mcp_
service ServiceDescriptorimpl for the trusty-memory MCP service.- messaging
- Inter-project messaging primitive (issue #99).
- openrpc
- OpenRPC 1.3.2 service description for
trusty-memory-mcp. - palace_
id_ derive - Default palace-ID derivation from project identity (issue #1217).
- project_
root - Project-root detection, palace-slug derivation, and
.trusty-tools/pin file management (issue #88 + Phase 1 of the.trusty-tools/convention). - prompt_
facts - Prompt-facts surface: hot KG predicates exposed via a per-message tool.
- prompt_
log - Enriched-prompt logger for the UserPromptSubmit / SessionStart hooks (issue #105).
- service
MemoryService— pure business-logic facade overAppState.- session_
store_ cache - LRU-bounded cache of per-palace
ChatSessionStorehandles (issue #4639). - startup_
scan - Startup-time single-pass pin-file scanner.
- tools
- MCP tool surface for trusty-memory.
- transport
- How the daemon is reachable, and what it answers.
- ui_
assets - The embedded Svelte SPA, kept in the binary with nothing serving it yet (#6286).
- wordnet_
pos - Part-of-speech membership lookup backed by Princeton WordNet 3.1.
- worker_
liveness - Live worker-occupancy gauge for the palace open/write path (issue #4001).
Structs§
- AppState
- Shared application state passed to every request handler.
Enums§
- Daemon
Event - Live daemon events broadcast to connected SSE subscribers.
- Daemon
Readiness - Two-phase daemon readiness state (issues #910/#911, revised by #1970).
- Hook
Type - Hook type — labels the Claude Code hook that triggered a submission.
- Injection
Kind - Injection kind — labels what the hook actually injected (or attempted).
Constants§
- HOOK_
PROMPT_ EXCERPT_ CHARS - Maximum bytes retained in the trigger-prompt excerpt embedded on a
HookFiredevent.
Functions§
- handle_
message - Handle a single MCP JSON-RPC message and produce its response.
- hook_
prompt_ excerpt - Reduce a triggering prompt to the short excerpt embedded on a
HookFiredactivity event. - is_
data_ dir_ override_ active - Return
truewhen a non-default data directory is in effect. - resolve_
palace_ registry_ dir - Resolve the directory that actually holds the per-palace subdirectories.