T02 · Agent Memory Poisoning
- Location
scripts/cortex-review.js:128- Finding
Persistent Agent Memory Poisoning Through Untrusted Pathway Content
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is openly designed to create persistent self-modifying agent behavior, but it lacks enough scoping and safeguards for unattended use.
Install only if you deliberately want a persistent agent-behavior memory. Keep the brain directory private, review and back up pathways.json before enabling heartbeat or cron, avoid putting raw notes or untrusted pathway text into system/developer prompts, and require manual approval for pruning or for new pathways that will influence future actions.
scripts/cortex-review.js:128Persistent Agent Memory Poisoning Through Untrusted Pathway Content
A description-behavior mismatch is dangerous because users and orchestration systems may trust the declared purpose while the actual behavior differs, especially when the skill performs autonomous review and file mutation. Even if the mismatch here may stem from packaging or implementation drift, it can cause operators to enable the skill under false assumptions about what it really does and what state it persists.
The core design is self-modification: the agent is instructed to strengthen, weaken, decay, and prune behavioral pathways based on runtime outcomes, with persistent storage across sessions. Self-modifying behavior is inherently risky because it changes future decision-making in ways that may be hard to audit, can be influenced by adversarial or low-quality inputs, and may train away safety-relevant behaviors unless carefully constrained.
---
name: brainmd
description: "Neuroplastic self-modifying runtime for AI agents. Creates a file-based 'brain' that learns from interactions: reflexes (fast-path responses), habits (learned patterns), weighted pathways (reinforcement), and a cortex (self-review loop). Use when: setting up adaptive agent behavior, creating learning loops, building persistent behavioral memory, or making an agent that improves over time."
---
# brainmd
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
* Reflex: Timing decisions
* Should I notify the user right now?
*
* Self-modifying: thresholds adjust based on feedback.
*
* Usage:
* node timing.js check [urgency] — should I notify? (urgency 0.0-1.0)
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
* Reflex: Timing decisions
* Should I notify the user right now?
*
* Self-modifying: thresholds adjust based on feedback.
*
* Usage:
* node timing.js check [urgency] — should I notify? (urgency 0.0-1.0)
The README explicitly instructs users to run a periodic self-review loop that mutates weights and can prune pathways, but it does not clearly warn that this process will automatically modify persistent files and delete entries when weights hit zero. In a self-modifying agent skill, that omission is security-relevant because operators may enable unattended cron/heartbeat execution without understanding the persistence, mutation, and pruning behavior affecting agent state.
The skill explicitly instructs the agent to run shell and Node commands that read and mutate persistent files, but it declares no tool scope or allowed-tools restrictions. This creates an unnecessary trust gap: a broadly-invoked skill can gain shell-capable behavior without any explicit permission boundary, increasing the chance of unintended execution in sensitive workspaces.
The invocation guidance is extremely broad ('adaptive agent behavior', 'learning loops', 'persistent behavioral memory', 'making an agent that improves over time'), so the skill may be pulled into many ordinary sessions. Because the skill promotes self-modification and persistent behavioral state, overbroad activation materially increases the chance of inappropriate use, state poisoning, or unsafe autonomous changes.
The HEARTBEAT instructions tell the agent to run self-review and status commands automatically on every heartbeat and to record outcomes continuously, without clear limits or approval gates. In context, this is more dangerous than a normal broad trigger because it normalizes autonomous, repeated mutation of long-lived behavior files, which can amplify mistakes, entrench bad patterns, and create persistence from transient prompts or attacker-influenced interactions.
This code permanently removes entries from the pathways data store via delete data.pathways[id]. Although the file header and CLI usage mention that prune removes low-weight pathways, the destructive action itself has no confirmation prompt or cautionary warning that data will be deleted irreversibly.
No suspicious patterns detected.