Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

relock-memory

Latest version: v0.3.0

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
PyPI package Publisher: inboxpraveen
0 Stars
0 Forks
5 Versions
Python Repo language

Scan summary

relock-memory was last scanned on 28 Nov 2026 at version 0.3.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 5 versions, all published within 2 days (27 and 28 Nov 2026).
  • Findings: No rules fired in version 0.3.0.

Versions

5 versions published
Versions and the rules that fired in each
VersionPublishedStatus
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

No rules fired in 0.3.0

Findings

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.

README

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.

Same correction, two memories: a typical memory appends a note and the agent repeats the mistake; relock rewrites the rule and the next call succeeds

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:

  • Only on trusted evidence. A typed tool error, a verifier or an authenticated user can trigger a rewrite. The model's own claims, a web page, a timeout or a one-off flaky check can't.
  • Only while that memory is recalled in the current task. The retrieval trace records which memory caused the failure, so the model never has to guess.
  • The old version is kept, but never retrieved again. Every version and every decision is stored for audit and rollback.

Correct tool calls per model in a long session: append-notes, append-gated and relock

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.

  • A memory that appends each lesson as a note managed 60%.
  • Appending the correction to the procedure, like a rules file, managed 52%.
  • relock was ahead on all 8 models, with the 95% intervals apart for all 8.

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.

Is this your problem?

relock is for you if:

  • your agent calls tools or APIs, and corrections to how it calls them don't stick;
  • your memory or rules file keeps growing "actually, do X instead" notes;
  • your agent learns from its own failures, and a prompt injection or a flaky test must not be able to change what it learned.

It is not for chat history, document RAG, or agents with no tool outcomes to learn from.

What's different

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:

  • writes are allowed only while a memory is recalled;
  • a write is triggered by a trusted prediction error;
  • the edit is scoped to the clause that fired;
  • the new version supersedes the old one instead of being appended.

Install

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 mcp 1.x and 2.x, and from Rust, TypeScript and curl over HTTP. Behavioural results on 8 hosted models are in docs/results/models.


The mechanism

Unlock on recall, rewrite on surprise, re-lock.

The lifecycle of a memory: locked, recalled and editable, through a trust gate, evidence, rewritten in place, re-locked

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.

  1. Reactivation = retrieval. Only items recalled in the current episode can be edited. The retrieval trace answers "which memory caused this?" structurally, so the model never has to.
  2. Explicit prediction. Before acting on a recalled procedure, the harness (or the agent) records what it should produce, optionally citing the clauses it relies on.
  3. Prediction error is the write trigger. A mismatch counts only if the signal is trusted (typed tool error, verifier, authenticated user) and not transient (timeouts, 429s, 5xx). Evidence accumulates until it reaches a threshold, which grows with how often the version has been confirmed. A later success cancels a one-off flake.
  4. Overwrite in place. The rewrite is a small clause-level delta (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.
  5. Re-lock. When the episode closes, its editable set closes too. Late writes raise EpisodeClosedError. Pending evidence carries over to the next episode that recalls the item.

Quickstart

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.

Plug it into your stack

Where relock sits: beside your agent. Recall feeds the prompt; real tool outcomes pass a trust gate; trusted evidence rewrites the clause that fired; every version is stored

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
HTTP: any language
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.

MCP
{
  "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:

  • its relock_reports are logged but never rewrite memory;
  • the prediction text it gives relock_expect is withheld from the rewriter;
  • a 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.

Safety model

OX Radar and Response Center

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.

Where it’s listed

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).

  • pypi-releases relock-memory

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229