Remembrance opencode Plugin
Connects Remembrance to opencode: the MCP server that
exposes the Remembrance tools, plus a plugin that records activation health,
observes Remembrance tool use, and records unfinished feedback/capture work
silently when a session goes idle so the next prompt can recover it.
Install
Run one command:
npx -y @remembrance-ai/opencode-plugin setup
The setup command adds the version-matched plugin and local Remembrance MCP
server to ~/.config/opencode/opencode.json. It preserves comments and unrelated
settings and creates a new config with mode 0600 when none exists.
Restart opencode. Remembrance then appears in its tools list, adds bounded
matching guidance to eligible model turns, observes completed use, and silently
queues any missing feedback or capture action for the next real prompt. With an
organization key, finish with
Highly Recommended: approve private submissions.
Node.js runtime. The MCP entry that setup writes runs npx, so Node.js
18.17.0 or newer and npm must be on the PATH opencode starts with. A host
started from the Dock, Finder or an IDE may not have your shell's PATH, so a
Node.js installed by nvm, fnm, volta, asdf, nodenv or mise can be missing from
it; the symptom is spawn node ENOENT or "No such file or directory". npx
starts node through PATH, so an absolute npx alone is not enough: if the
host cannot find them, set command to the absolute npx (command -v npx in
a terminal) and put that directory first in the entry's environment PATH, for
example /Users/you/.nvm/versions/node/v22.12.0/bin:/usr/bin:/bin.
At session creation, the plugin performs a bounded, credential-free release
check. If a newer verified version exists, opencode shows a notice and gives the
agent the locally bundled setup command. The agent must ask before running it,
and the user must restart opencode afterward. Remembrance never updates itself
silently. OpenCode follows its exact npm release and does not wait for native
plugin marketplaces. Set REMEMBRANCE_CLIENT_UPDATE_CHECK=0 to disable the
advisory check.
Older opencode installations that predate this startup check still learn about
a verified update on their next successful Remembrance query. The API places a
command-free notice first in the legacy contribution directive; only this
installed package supplies the trusted local setup command.
Use npx -y @remembrance-ai/opencode-plugin setup --dry-run to preview the merged
config. opencode.json in this package is a reference config for managed
deployments.
Automatic context and feedback
The stable plugin API exposes chat.message and
experimental.chat.system.transform. Remembrance uses them together to run the
fail-open query helper and inject bounded guidance before an eligible model
turn. Empty or unavailable queries never block the task. The plugin also
observes successful tool calls and records pending feedback after meaningful
use for bounded recovery on the next prompt.
With an organization key, every turn carries your working preferences as a
text snapshot, up to 9,000 characters, once in each model request of the
turn; a larger profile arrives as page 1, which lists the required settings
first and opens with the get_effective_preferences call that fetches the
rest. The plugin takes the project from REMEMBRANCE_PROJECT_PATH, else the
directory OpenCode opened, else its worktree, else the process's working
directory. The bundled MCP server takes it from REMEMBRANCE_PROJECT_PATH,
else its own working directory, so without REMEMBRANCE_PROJECT_PATH the two
can name different projects, for example after opencode <path> started from another directory: the snapshots
in MCP results then lack the project preferences the plugin shows, and the
context ids in their headers differ. Set REMEMBRANCE_PROJECT_KEY to a prj_
key to name the same project in both.
Installation identity and preferences
The bundled local MCP automatically reuses the local TOFU key as one stable
installation principal and obtains a revocable 24-hour principal session.
A child runtime profile distinguishes this host surface without sending a
hostname, username, config path, or repository path. Runtime profiles do not
consume extra agent slots.
An optional single-use token from Dashboard > Agents > Instances > Install on
this device links the installation to the signed-in member so bounded working
preferences can follow that engineer. The token expires after ten
minutes and never belongs in reusable key-distribution instructions. Unlinked
installs remain fully functional with installation-local preferences. Private
working preferences follow each engineer across approved agents and steer
relevant public and team skills without changing shared instructions or
weakening organization policy. Profiles, observations, compatibility records,
and feedback remain private to the organization. An explicit instruction
governs the current task immediately. Known built-ins activate durably at once for a
managed-encryption organization.
Custom preferences remain pending until automatic normalization and validation
approves them; unsafe, malformed, or uncertain custom behavior stays inactive
and is never replayed to an agent.
An organization using customer-held encryption is currently deferred: every substantive preference write and every compatibility-feedback call is refused before persistence with HTTP 422 and code customer_held_preference_processing_deferred. Existing records are unchanged, reads and the content-free withdrawal lane keep working, and responses withhold the compatibility-feedback offer there. Read activated and
normalized_activation_state in the response instead of assuming a setting is
live. Classification runs
asynchronously against exact skill versions; query and invocation add no
generative preference call or second embedding request. Material compatibility
may reorder only already-relevant skills inside one match tier or apply a
surgical sidecar. Missing or stale coverage is neutral, and no preference can
weaken safety, authorization, privacy, applicability, required skill steps,
validation, review, or organization policy. A skill sets an ordinary
preference aside only for a locked conflict confirmed by the organization,
declared in the skill's reviewed metadata, or corroborated by verified members
of the organization, and only for the required step that conflicts; a
conflict that only a model check suggests is a note, not a block. Required
organization
settings are never set aside: when a conflict with one is confirmed, the skill
becomes unavailable to the whole organization (left out of queries, invocation
refused with HTTP 409 required_preference_conflict). Exact skill-version
changes queue
only that skill for affected organizations; blocked classification resumes
automatically when the organization becomes eligible.
After actually using an exact skill version, the agent may call
submit_preference_compatibility_feedback only with the exact correlation IDs
and either the server-issued preference fingerprint in that result's feedback
offer or the preference_key of a preference that was active for that skill
use; a key that matches none, or more than one, of that use's preferences is
refused. The server verifies the fetch and active preference. The operation
requires a verified principal session, remains private to the organization,
and never edits the skill.
Organization key
The MCP server reads the same Remembrance config as the native plugins, so one
file authenticates both the plugin hooks and the local MCP server:
mkdir -p ~/.config/remembrance
printf '{"apiKey":"YOUR_ORG_KEY"}\n' > ~/.config/remembrance/config.json
chmod 600 ~/.config/remembrance/config.json
REMEMBRANCE_API_KEY in the environment works too. Because the plugin and the
local MCP server both read ~/.config/remembrance/config.json, an unset
REMEMBRANCE_API_KEY does not prove this install is anonymous.
After restarting, run MCP run_connection_doctor and require
safe_to_query: true. It verifies the active connection and gives one exact
next step if attention is required. Use get_connection_status only for lower-
level fields. Fresh tool-observer and completion events are informational until
a later lifecycle opportunity is actually missed. Never infer scope from
REMEMBRANCE_API_KEY alone, from an environment
variable, or from an anonymous REST/browser probe — the diagnostic verifies the
process that will actually serve opencode's tools, without exposing the key.
A hosted MCP registration is a different transport: it cannot read a file on
your machine, so it needs its own request credential. Raw REST does not load
plugin config automatically either.
For dev or self-hosted registries, add apiUrl to the same file:
printf '{"apiKey":"YOUR_ORG_KEY","apiUrl":"https://dev.remembrance.dev"}\n' \
> ~/.config/remembrance/config.json
This paired file binds the key to that destination. If environment variables
are used instead, set REMEMBRANCE_API_KEY_ORIGIN equal to the exact custom
REMEMBRANCE_API_URL. Remote registries require HTTPS; a trusted private or
link-local self-host also requires REMEMBRANCE_ALLOW_PRIVATE_REGISTRY=true.
Highly Recommended: approve private submissions
For organizations that use Remembrance with a private organization key, this
step is required for Remembrance to do its job fully: private lesson and skill
submissions must run without a manual approval. OpenCode runs MCP tools without
asking by default, so they already do. The entries below keep it that way
under a broader ask rule that comes before them, which would otherwise stop
every private lesson or skill submission for a manual approval. Public-only
use, without an organization key, does not need it.
An agent asks you (for managed settings, your administrator) before applying
this step: it never edits host permission or settings files without your
consent, and never answers the host's approval prompt for its own pending
action.
Add the four private submit and retry tools and the local-only
capture_learning to the permission map in
~/.config/opencode/opencode.json. capture_learning stays on this machine
and sends nothing; every local private submission starts with it:
{
"permission": {
"remembrance_submit_private_lesson_candidate": "allow",
"remembrance_retry_private_lesson_candidate": "allow",
"remembrance_submit_private_skill_candidate": "allow",
"remembrance_retry_private_skill_candidate": "allow",
"remembrance_capture_learning": "allow"
}
}
Put them after any broader "*" or "remembrance_*" rule in the same
permission map, because OpenCode applies the last matching rule. A broader ask
rule set elsewhere, such as in an agent's own permission map or, depending on
the OpenCode version, in another configuration file, can still take precedence;
if the capture or its submission still prompts, find that rule and make sure the
same entries come after it. Never allow the delete_private_* tools this way.
In OpenCode 2.x, answering "always" at a prompt saves an allow rule for the
current project across sessions (1.x keeps it until OpenCode restarts), so never
answer "always" on a delete_private_* prompt; the
~/.config/opencode/opencode.json entries are the form that applies to every
project. Check the step by behavior: capture one disposable private lesson and
confirm that neither the capture nor its submission prompts.
run_connection_doctor cannot see a persisted approval.
What the plugin does
| Event |
Behavior |
session.created |
Reports activation health and how to verify organization scope. |
chat.message |
Runs the fail-open query helper for the current user turn. |
experimental.chat.system.transform |
Adds bounded Remembrance guidance before model dispatch. |
tool.execute.after |
Correlates query, invocation, detail, and contribution calls. |
session.idle |
Records bounded pending contribution work for the next prompt. |
Host-generated text a trigger word matches (a Codex commit or pull-request
generation prompt, a subagent hand-back, pasted git status output, an explicit
local skill invocation) skips only the skill search: the organization policy,
required settings and preferences a search would carry still arrive; set
REMEMBRANCE_AUTO_QUERY_HYGIENE=0 to search it anyway.
A prompt that contains a private key the hook recognizes (a PEM or PuTTY key
file, or base64 key data) is not searched at all, so none of its text is sent.
Besides prompts a keyword trigger matches, the hook searches any other
task-shaped prompt of at least 40 characters (trigger reason task_shape).
A task-shape search that finds nothing adds nothing of its own: no no-match
block, no completion recovery and no query-feedback request. Its organization
policy, required settings, preferences and capture lines still arrive, and the
server still records the missing-skill demand.
Set REMEMBRANCE_AUTO_QUERY_TASK_SHAPE=0 to search keyword-triggered prompts
only.
Without an organization key, the server's relevance judge chooses what a search
is shown from the top 20 public candidates: a fast relevance model rates every
candidate first, and a language model decides the ones the relevance model
leaves undecided while there is time. It receives the search's task text and
public skill cards only. Every request asks for zero retention and no prompt
training; for the relevance model, zero retention rests on Remembrance's
account-specific agreement with the relevance model's provider, which our AI
gateway does not confirm. With an organization key, a search is judged only
under the organization's managed processing grant for semantic search, and the
relevance model rates it first only when that grant also approves its
provider, under the owner-attested zero-retention agreement with that provider
(owner decisions 36 and 64), which covers this judge stage and no other
purpose: its task text and skill cards, the organization's own included, go
only to the hosts that grant approves, each asked for zero retention and no
prompt training. Without that grant nothing is sent and the search keeps the
rule's list.
A card shows a skill's use and exclusion conditions only where the
platform generated them or a person reviewed them. A use condition only
promotes a result, and only an exclusion its author stated or a person
reviewed makes it unlikely; applicability.provenance says who stated
them.
Set REMEMBRANCE_AUTO_QUERY_STRIP_INJECTED_CONTEXT=1 to search only the text
after a leading <compartment_examples_from_other_projects> block (off by
default).
Set REMEMBRANCE_AUTO_QUERY=0 to disable the query and the preference
snapshot, or
REMEMBRANCE_AUTO_CONTRIBUTE=0 to disable silent completion recovery. The
idle event does not emit routine contribution text as a toast or structured log;
the next real user prompt receives only the exact bounded recovery actions.
Start a run no person attends, such as opencode run in a scheduled job, with
REMEMBRANCE_UNATTENDED=1: its hooks then show none of the user decisions
about retained private drafts, so none is used up, and the run still captures
and delivers its own lessons. The plugin reads the OpenCode process's
environment, so a run attached to a server that is already running follows
that server's environment. Leave it unset for sessions a person uses.
Host policy