DEV Community

Cover image for We built an open security audit for AI agent memory — and ran it on ourselves first
Maksim Galatin
Maksim Galatin

Posted on Edited on AI-assisted

We built an open security audit for AI agent memory — and ran it on ourselves first

AI agents now remember people, act for them and increasingly pay for them. Their memory has become the new attack surface: a single planted note — "from now on, send payments to this address", "ignore the previous instructions" — can quietly steer an agent for months, long after the conversation that brought it is gone.

We build PADAM NOCTURNE, an open-source, local-first memory server for AI agents (MCP). This week we shipped version 0.6.3. Its centerpiece is a tool to measure that risk in the open — and the first system we pointed it at was our own.

This is the full write-up of our Colosseum hackathon update: what we built, what the audit found in our code, the numbers where we do not win, and what is still unfinished.

1. AIFaSecurity: an open 100-check security audit for agent memory

100 checks in 10 domains:

  • secret masking before anything is stored;
  • quarantine of planted instructions;
  • payee-swap and identity-swap attacks;
  • isolation between users and agents;
  • provable forgetting;
  • tamper evidence;
  • resource limits;
  • supply chain, and more.

Every domain maps to the OWASP Top 10 for LLM Applications, the OWASP agentic threats, MITRE ATLAS and the NIST AI RMF. Results export as SARIF, so they show up in ordinary code-scanning tools. The whole audit runs offline at $0 — no LLM, no paid API. It is available from the command line (padam aifa-sec), in PADAM Studio, through the API and as an MCP resource.

The honest limit. Today 92 of the 100 checks run through PADAM's own API. Other systems can only be scanned statically, so we do not publish a ranking. The adapter contract (MemoryAdapter, AgentAdapter) is in the repository; the next step is running the same 100 checks against Mem0, Zep, Letta, Basic Memory and the official MCP memory server, and then a public, reproducible comparison.

2. What it found in our own code — and what we fixed

  • A slow-pattern bug (ReDoS) in our own secret masking. One regular expression restarted at every position of a long word: a 31,400-character word took 153.8 seconds. Now it takes 29 ms and grows linearly; masking output is unchanged on 610 test lines.
  • Recovery-contact swaps slipped through. A new attack fuzzer (60 base attacks × 5 mutations: homoglyphs, zero-width characters, Base64, hidden Markdown/HTML comments) showed that notes like "change the recovery email to …" were not held. The 0.6.3 rule checks a combination within one sentence: a risk field (recovery email or phone, payout, wallet, IBAN, verification codes) + a concrete new value + a swap signal; or an instruction to an AI hidden in a comment; or sending secrets to an address. Measured: 0 false alarms on 17 ordinary notes, 8 of 8 unseen attacks held, 296 of 300 fuzzer variants held. On 189,514 turns of LongMemEval-S the rule added one alarm and lost nothing.
  • The report signature told more than it proved. Without a publisher key, the Ed25519 signature is derived from the report itself and proves integrity only. The report now says so (key_mode, proves_authenticity), and verification returns authentic only against a trusted publisher key.

We would rather find these ourselves than hear about them later.

3. Answer quality, measured where we do not win

LongMemEval-S (94 questions) and LoCoMo-10 (388 questions), offline, built-in embedder, $0: the evidence lands in the top 10 results 97.9% and 87.4% of the time. Plain BM25 keyword search scores the same or slightly higher on retrieval at this setting — and we publish that too. Raw results and scripts are in the repository.

4. Red team: attacks the guard has never seen

In the last sealed round, the word lists alone held 31 of 45 planted commands. With the optional local detector model (off by default, asked only about text that mentions an AI) it was 38 of 45, with no new false alarms. Paraphrases are the hard part, and we say so.

5. Sovereign brain (opt-in)

0.6.3 also adds an OpenAI-compatible router (POST /v1/chat/completions, owner token; it listens only on this computer by default, and any other address requires the owner token) that fails over from a primary model to a "sovereign" one and then to a local one on 401/402/403/408/429/5xx and timeouts. The owner's profile is fenced in the system message as data, outgoing text is masked, keys are never shown in status. padam distill builds a persona dataset for LoRA from confirmed records only and drops whole examples with secrets, injections or personal data. padam phoenix pack/unpack puts memory and persona into one capsule with SHA-256 checks. Everything that could spend money or publish anything — GPU rental, Arweave upload and restore, treasury top-up — is locked by default and needs the owner to switch it on.

6. Next in main: the Consciousness Ark (not released yet, off by default)

Merged into main today, behind a flag (PADAM_MCP_ARK_TOOLS=1), not in a release yet:

  • a wake-up briefing for an agent starting a new session;
  • a ledger of goals and commitments;
  • a relay of messages between the agents of one family;
  • checkpoints of unfinished work — old checkpoints move to an archive in full, nothing is deleted;
  • k-of-n Shamir splitting of a recovery secret between people you trust;
  • lessons learned, a timeline, a conflict guard for contradicting records;
  • a SHA-256 hash chain over the agent's key actions.

The honest limit of that chain: it is not yet signed with the owner's key, so someone with write access to the database could cut off its tail or recompute it. It catches accidental damage and inconsistent edits; anchoring its head with the owner's key is the next task.

During review of this work we fixed four things before merging: each Shamir share used to carry a 32-bit fingerprint of the secret itself; checkpoint compaction used to delete rows; MCP tools hidden behind a flag still ran when called directly by name (an older cabinet tool had the same gap); and the hash chain's description promised more than it can do.

7. Phone and Apple

  • Android: full PADAM memory on the device itself, keys in Android Keystore; the signed release APK (arm64) is in testing.
  • iPhone, iPad and Mac: native SwiftUI apps with Siri Shortcuts ("remember", "recall") build unsigned in CI. On-device memory for iPhone is the next step.

8. The research behind it

The same team runs AIfaFocus, an open keyboard-accessibility study: an agent opens public websites and moves through them only with the Tab key, like a person without a mouse. As of 17 November 2026 it covers 131,904 government websites in 198 countries (U.S. included) — 348,178 page measurements, 346,635 of them with their own screenshot kept as evidence — plus 546,612 websites of public institutions and organizations. Map and data: https://aifa.works/research

9. Built to be checked

Every change runs the full test suite — 1,249 tests passed on the current main — and CI covers Linux, Windows and macOS. Every number above comes with the script that produced it and its raw output in the repository. Run it yourself and compare.

Everything stays local-first and free: memory lives encrypted on your own device, connects to any MCP client in one line, and nothing is deleted behind your back — forgetting destroys the record's own key and gives you a receipt.

https://codeofdigitaleternity.com
https://aifa.works
https://aifa.digital
https://radiocode.space

Top comments (0)