Scan your whole stack
Are you using relock-memory?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.3.0
relock-memory was last scanned on 28 Nov 2026 at version 0.3.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.3.0 LATEST | 28 Nov 2026 | No rules fired |
| 0.2.2 | 27 Nov 2026 | No rules fired |
| 0.2.1 | 27 Nov 2026 | No rules fired |
| 0.2.0 | 27 Nov 2026 | Not shown |
| 0.1.1 | 27 Nov 2026 | Not shown |
Findings for v0.3.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.3.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
You corrected your agent: the orders API takes ISO dates now. Its memory saved the lesson as a
note. Days later, deep into a long session, it sends 03/14/2026 again. The old rule was still in
memory, next to the note, and the model followed it.
Lesson notes, rules files and playbooks all keep both rules and hope the model picks the right one. relock edits the rule that fired, in place, under three conditions:
The study: 8 hosted models and 10 changed tool contracts, in long sessions with stale docs and a prompt injection in context. With relock, agents made the corrected call 98% of the time.
Isolating the mechanism. The baselines are our own implementations of those patterns, run on
the same events. append-gated keeps relock's trust gate but still appends, and it reached
74%: the gate keeps the poisoned "fix" out, and replacing the rule is what stops the relapse.
The design was committed before the run, and every call is published. See the results: 11,520 probe calls, $7.33 in API spend.
relock is for you if:
It is not for chat history, document RAG, or agents with no tool outcomes to learn from.
| lesson notes, vector memories | rules file, playbook | LLM-managed memory (a model picks add / update / delete) | relock | |
|---|---|---|---|---|
| A correction replaces the old rule | no: both are retrievable | no: both are in the file | if the model chooses to | yes: the clause that fired is superseded |
| What can change memory | any write | any write | a model, deciding from what it read | trusted signals only |
| A prompt injection's "fix" | stored | stored | can be stored | logged, never applied |
| A one-off flaky failure | stored | stored | can be stored | needs a second trusted error; the next success cancels it |
| Which memory caused a failure | the model guesses | the model guesses | the model guesses | recorded by the retrieval trace |
| History | varies | git, if any | varies | every version and decision, with rollback |
Each idea exists somewhere, but we have not seen them packaged together:
pip install relock-memory # core: zero dependencies
pip install "relock-memory[all]" # + Postgres, MCP, LangChain/LangGraph
docker run -p 8765:8765 -e RELOCK_TOKEN=change-me ghcr.io/inboxpraveen/relock # HTTP API
It works with Python agents, any MCP client, and any language over HTTP/JSON: Rust, TypeScript, Go and others. See Plug it into your stack.
The extras install one at a time too: [postgres], [mcp], [langchain]. The import is
relock_memory. The PyPI name relock belongs to an unrelated SDK.
Status: v0.2, beta. CI tests it on Python 3.10–3.14, on SQLite and Postgres, with
mcp1.x and 2.x, and from Rust, TypeScript and curl over HTTP. Behavioural results on 8 hosted models are in docs/results/models.
Unlock on recall, rewrite on surprise, re-lock.
The idea comes from memory reconsolidation in neuroscience:
relock borrows that shape: a memory can change only while it is recalled, and only when an outcome contradicts what it predicted. It is a design metaphor, not a biological claim. The evidence comes mostly from animal work, and results in people are mixed.
replace / add /
remove) limited to the clauses that fired. The old version is kept as superseded for
audit and rollback and is never retrievable again. A partial unique index guarantees one active
version per item, so "do X" and "never do X" can never both be retrieved.EpisodeClosedError. Pending evidence carries over to the next episode that recalls the item.import relock_memory as relock
mem = relock.Memory("agent.db") # or ":memory:", or "postgresql://..."
mem.add("Fetch orders by date",
["Authenticate with the orders API key before calling get_orders.",
"Pass the date to get_orders as MM/DD/YYYY."], # stale: the API moved to ISO dates
key="orders.fetch", tools=["get_orders"], exist_ok=True)
@mem.wrap # your real tool; its outcome is the trusted signal
def get_orders(date: str) -> list[dict]:
if not is_iso(date):
raise relock.ToolError("invalid date", correction="Pass the date to get_orders as YYYY-MM-DD.")
return api.orders(date)
with mem.episode("orders for March 14") as ep:
context = ep.recall("fetch the orders placed on a date").render() # put this in the prompt
... # your agent runs; calls to get_orders resolve expectations automatically
After two trusted failures (configurable), clause c2 is rewritten in place:
$ relock history orders.fetch
v1 [superseded] create by author at 2026-11-26T18:38:29.454852+00:00
(c1) Authenticate with the orders API key before calling get_orders.
(c2) Pass the date to get_orders as MM/DD/YYYY.
v2 [active] reconsolidate by hint at 2026-11-26T18:38:29.463781+00:00 (episode ep_01m8cjdsjmv8mbp3d065)
reason: replace c2 with trusted correction
- (c2) Pass the date to get_orders as MM/DD/YYYY.
+ (c2) Pass the date to get_orders as YYYY-MM-DD.
Run examples/01_quickstart.py to see the whole loop in about 60 lines.
relock does not replace your agent framework. It sits beside it. The split that keeps memory safe is the model predicts, the harness judges.
| You use | Integrate with | Effort |
|---|---|---|
| Any Python agent (OpenAI Agents SDK, PydanticAI, smolagents, CrewAI, LlamaIndex, AutoGen, your own loop) | @mem.wrap on your tools + with mem.episode() around a task. Signatures and docstrings are preserved, so framework tool schemas don't change. Sync and async. |
3 lines |
| Raw tool calling (OpenAI-compatible, Anthropic, vLLM, Ollama) | relock.Toolkit(mem).openai_tools() / .anthropic_tools() + toolkit.call(name, args) |
a dispatcher branch |
| LangChain / LangGraph | RelockCallbackHandler(mem) in config={"callbacks": [...]}. Existing tools stay untouched. langchain_tools(Toolkit(mem)) gives the model recall_memory / state_expectation. |
1 line |
| Anything that speaks MCP (Claude Code, Cursor, VS Code, OpenAI Agents SDK, LangGraph, PydanticAI...) | relock mcp --db relock.db --verifier tests="pytest -q" |
config only |
| Any language: Rust, TypeScript, Go, Java, C#... | relock serve or docker run ghcr.io/inboxpraveen/relock, then HTTP/JSON (OpenAPI, guide) |
4 HTTP calls per task |
RELOCK_TOKEN=change-me relock serve # or: docker run -p 8765:8765 -e RELOCK_TOKEN=change-me ghcr.io/inboxpraveen/relock
Each task is four calls from your harness:
| step | request |
|---|---|
| open | POST /v1/episodes |
| recall into the prompt | POST /v1/episodes/{id}/recall |
| report each tool call's real outcome | POST /v1/episodes/{id}/tool-result |
| re-lock | POST /v1/episodes/{id}/close |
Clients for Rust, TypeScript and curl run this loop against a live server in CI. The full API is in docs/http.md. The server has no dependencies. Without a token it listens only on loopback, and it refuses a public address without one.
{
"mcpServers": {
"relock": {
"command": "uvx",
"args": ["--from", "relock-memory[mcp]", "relock", "--db", "/path/to/relock.db", "mcp",
"--verifier", "tests=pytest -q", "--verifier", "lint=ruff check ."]
}
}
}
uvx fetches the package the first time the client starts the
server. If you installed relock-memory[mcp] with pip instead, use "command": "relock" and drop
the first two arguments. In Claude Code the same server is one command:
claude mcp add relock -- uvx --from "relock-memory[mcp]" relock --db relock.db mcp --verifier tests="pytest -q"
Verifier commands run in the server's working directory, which depends on the client. Pass
--cwd /path/to/project to pin it.
Tools exposed: relock_begin, relock_recall, relock_expect, relock_verify, relock_report,
relock_history, relock_end, plus relock_teach if you start the server with --allow-teach.
Items the agent teaches are marked meta.origin = "agent". If a client never calls relock_end,
its episode is re-locked after 30 idle minutes (--idle-timeout).
Because the agent calls these tools, nothing the agent writes is trusted by default:
relock_reports are logged but never rewrite memory;relock_expect is withheld from the rewriter;correction it suggests to relock_verify is ignored.Trusted outcomes come from verifiers: commands fixed by whoever starts the server. The agent can only pick one by name; the server runs it and reads the exit code itself. Two red verifier runs are therefore enough evidence for a rewrite, but the fix comes from the verifier's output (with an LLM rewriter) or from a trusted correction, never from the agent's text.
For a single-user local sandbox, --trust-agent-reports opts in to all three.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.