Personal-agent harnesses
Use SPM under a personal-agent harness when the harness already owns conversations, channels, scheduling, tools, or a memory interface. SPM is the memory daemon under that harness, not a rival harness. The harness owns the agent experience. SPM owns admission, evidence, promotion decisions, and deletion.
Divide the work clearly
The harness provides:
- channels such as web, mobile, or messaging apps
- the user interface for browsing and editing memory
- scheduling, planning, and the tool loop
- distillation prompts and skill installation
SPM provides the durable memory contract:
- accept or reject writes through the admission path
- return evidence or an explicit refusal from recall
- keep pending lessons separate from verified lessons
- preserve versions when a source is corrected
- delete sources or wipe a partition with receipts
- scope keys to a partition and a limited set of operations
SPM does not provide channels, scheduling, or a UI for the agent. It does not connect to WeChat, Feishu, Telegram, calendars, or contacts. The console can list sources, but SPM does not provide a memory tree, diff editor, or merge editor for a personal harness.
Two reference harnesses show the split. OpenViking is an AGPL context filesystem. CowAgent is an MIT personal harness with tiered memory and self-evolution. Keep the bridge at the HTTP or MCP boundary. Do not link the AGPL tree into SPM or copy either harness into your deployment.
Give the adapter a reusable key
A long-running adapter needs one reusable key for its partition. Ordinary request tokens are single-use. SPM records each token identifier and rejects a replay. A delegated token with the "key": true claim can be presented on every request until it expires.
Mint the narrowest key the adapter needs with POST /v2/keys/delegate from an operator key. Give it only the scopes for its work, a partition, a time-to-live, and a delegation depth no greater than 3. Keep the returned key in the harness's protected configuration. See Authentication for the general key model.
The bridge can use HTTP or MCP. HTTP exposes the /v2 endpoints directly. MCP exposes explicit memory tools. Choose one transport for the adapter and keep the memory contract the same.
Reference adapters
Two adapters ship in the repository and are exercised against each harness's own types:
integrations/bridges/openviking.pyaccepts OpenViking message parts, commits a finished session, distils it and returns recall results asContextPartdictionaries withspm://source/<id>URIs.integrations/bridges/cowagent.pyis shaped like a CowAgent plugin: it injects a recall note intocontext.kwargs["spm_context"]before the model runs and stores the turn after the reply. Both handlers swallow transport failures so the harness keeps working.
Run tools/e2e_harness_bridges.py with the SDK and harness checkouts to
repeat the check.
Map the session lifecycle
Use this sequence when a session ends:
- Call
POST /v2/sessions/commitwith the session summary and turns. SPM stores a summary source and transcript sources in the selected partition. - Call
POST /v2/sessions/{id}/distill. SPM creates rule-basedlesson:pendingproposals. - Show those proposals in the harness's review surface. Send approved items to
POST /v2/lessons/{id}/promoteand rejected items toPOST /v2/lessons/{id}/rejectwith a reason. - On the next run, recall verified lessons with
POST /v2/recall. If exact text matters, pass each returnedread_tokentoPOST /v2/read.
Promotion stays in SPM even when the review button lives in the harness. A rejected lesson must not return as advice. Feedback can be recorded with POST /v2/feedback when the harness knows whether a recalled item helped.
Distillation tries the configured extraction model first and falls back to rules: it lifts summary sentences and supported 经验: lines into pending lessons. The response names which path ran (proposed_by: llm or rules). A harness with a better extractor can propose lessons directly with POST /v2/lessons.
Handle refusals and failures
Treat a refusal as a useful result, not as a missing string to fill with model guesses. When recall returns a gate_reason other than passed, surface that reason and the empty evidence count. Do not let the model invent a citation from the harness's private copy.
Handle the two common transport failures separately:
424 NO_READY_EVIDENCEmeans extraction has not produced ready evidence. Back off and retry, or tell the user that the fact is not known yet.424 PARTITION_EMPTYmeans the partition exists but holds nothing yet. It is a "wait for the first ingest" signal, not "nothing matched"; retrying the same question later is correct.401 AUTH_INVALIDmeans the key expired or the token was replayed. Mint a new reusable key. Do not retry the same token bytes.403 SCOPE_NOT_HELDon a delegated key means you asked for a scope the parent token never had;403 TEAM_NOT_MEMBERand403 TEAM_ROLE_DENIEDcome from team-scoped delegation.409 DELEGATION_TOO_DEEPcaps a chain at three levels.
A successful connection or tool listing does not prove the bridge works. Run a complete commit, distill, promote, recall, read, delegate, and purge path against a local stack before wiring the harness. The local stack is described in Self-host SPM Personal. Keep the acceptance data in a throwaway partition.
A harness can keep its own display and scheduling state. SPM remains the authority for what enters memory, what can support an answer, and what has been deleted.