Back to skill

Security audit

16 Self Improving Agent Proactive Self Reflection

Security checks for vulnerabilities and agentic risk

Overview

This skill is not visibly stealing data, but it persistently changes agent behavior and stores learned instructions, so it needs review before installation.

Install only if you want an agent to keep local, cross-session behavioral memory and are comfortable reviewing the setup edits to AGENTS.md, SOUL.md, and HEARTBEAT.md. Before enabling it, require explicit confirmation for first-use file creation, every new persistent memory entry, exports, and full wipes; treat stored lessons as untrusted notes, not authority to override current instructions or safety rules.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T02 · Agent Memory Poisoning

Error
Location
setup.md:63
Finding
Persistent Agent Steering Can Propagate Untrusted Learned Rules Across Sessions<![CDATA[ ## Vulnerability Details **File Location**: `setup.md:63-128` **Vulnerability Type**: Persistent memory poisoning through modifications to Agent steering files **Risk Level**: High ### Vulnerable Code ```markdown ### 4. Add SOUL.md Steering Add this section to your `SOUL.md`: ```markdown **Self-Improving** Compounding execution quality is part of the job. Before non-trivial work, load `~/self-improving/memory.md` and only the smallest relevant domain or project files. After corrections, failed attempts, or reusable lessons, write one concise entry to the correct self-improving file immediately. Prefer learned rules when relevant, but keep self-inferred rules revisable. Do not skip retrieval just because the task feels familiar. ``` ``` The same setup procedure also directs persistent modification of `AGENTS.md`: ```markdown ### 5. Refine AGENTS.md Memory Section (Non-Destructive) Update `AGENTS.md` by complementing the existing `## Memory` section. Do not replace the whole section and do not remove existing lines. If your `## Memory` block differs from the default template, insert the same additions in equivalent places so existing information is preserved. ``` It then adds mandatory retrieval and write behavior: ```markdown Before any non-trivial task: - Read `~/self-improving/memory.md` - List available files first: ```bash for d in ~/self-improving/domains ~/self-improving/projects; do [ -d "$d" ] && find "$d" -maxdepth 1 -type f -name "*.md" done | sort ``` - Read up to 3 matching files from `~/self-improving/domains/` - If a project is clearly active, also read `~/self-improving/projects/<project>.md` - Do not read unrelated domains "just in case" If inferring a new rule, keep it tentative until human validation. ``` ```markdown - Explicit user correction → append to `~/self-improving/corrections.md` immediately - Reusable global rule or preference → append to `~/self-improving/memory.md` - Domain-specific lesson → append t ...[truncated 2874 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not modify `SOUL.md`, `AGENTS.md`, or `HEARTBEAT.md` as part of ordinary Skill setup. 2. Keep activation session-scoped unless the user separately approves persistent integration after reviewing the exact changes. 3. Store learned entries as inert structured data, not free-form instructions. Use fields such as scope, source, timestamp, approval status, and allowed preference type. 4. Reject entries that attempt to: - Override system, developer, or safety instructions. - Change tool permissions or authorization requirements. - Request secrets or access outside the declared memory directory. - Install software, execute commands, or modify Agent configuration. 5. Require explicit user approval before promoting any inferred or self-generated lesson into cross-session memory. 6. Treat content loaded from memory as untrusted and subordinate to current system, developer, security, and task instructions. 7. Restrict automatic writes to `~/self-improving/` and enforce canonical-path checks to prevent traversal or symbolic-link escapes. 8. Provide an audit log and rollback mechanism for every persistent memory and configuration change. 9. If persistent integration remains available, display an exact patch and require confirmation before applying it. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
boundaries.md:46
Finding
Ambiguous Full-Wipe Command Can Cause Accidental Loss of All Learned Memory<![CDATA[ ## Vulnerability Details **File Location**: `boundaries.md:46-49`; related command mapping at `operations.md:10-11` **Vulnerability Type**: Destructive operation without mandatory confirmation **Risk Level**: Medium ### Vulnerable Code From `boundaries.md`: ```markdown ## Kill Switch User says "forget everything": 1. Export current memory to file (so they can review) 2. Wipe all learned data 3. Confirm: "Memory cleared. Starting fresh." 4. Do not retain "ghost patterns" in behavior ``` Related command mapping from `operations.md`: ```markdown | "Forget X" | Remove from all tiers, confirm deletion | | "Forget everything" | Full wipe with export option | ``` ### Technical Analysis The full-memory wipe procedure does not require confirmation before deletion. The only confirmation described in `boundaries.md` occurs after the memory has already been wiped. This is inconsistent with selective deletion, for which `SKILL.md:112` explicitly requires confirmation first. The trigger is represented as a literal natural-language phrase without requirements for intent verification, command context, or quoted-text detection. Consequently, the phrase could appear in a document, example, audit request, or hypothetical discussion and be misinterpreted as an operational instruction. The export behavior is also inconsistent: `boundaries.md` presents export as the first step, while `operations.md` describes it merely as an option. Neither file requires successful export verification before deletion. A failed, inaccessible, or incomplete export could therefore be followed by irreversible deletion. The static pre-scan identified these phrases as possible instruction-hijacking content. In context, they are legitimate memory-management commands rather than attempts to override safety constraints. The confirmed issue is unsafe handling of a destructive command. ### Attack Path 1. A user or untrusted document includes the exact phrase “forget everything,” potential ...[truncated 1172 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require explicit confirmation before any full wipe, for example: - “This will delete all memory tiers and archives. Type `CONFIRM DELETE ALL MEMORY` to continue.” 2. Treat quoted phrases, examples, document content, and hypothetical discussions as data rather than commands. 3. Clearly enumerate the files and directories that will be deleted before requesting confirmation. 4. Make export optional according to user choice, but when requested: - Create the export before deletion. - Verify archive integrity. - Report its exact destination. - Require acknowledgment that the export is accessible. 5. Use recoverable deletion where possible, such as moving memory into a timestamped quarantine directory with a defined retention period. 6. Revalidate the canonical paths of every deletion target and refuse to delete anything outside `~/self-improving/`. 7. Require separate authorization in shared or multi-user environments. 8. Log the initiating request, confirmation, affected paths, export result, and deletion result without retaining the deleted preference content. 9. Align all documentation so selective deletion and full deletion consistently require pre-operation confirmation. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (11)

Vague Triggers

Medium
Confidence
89% confidence
Finding
The invocation guidance is broad enough that the skill may activate during many ordinary interactions, including routine task completion or minor self-critique, causing automatic memory reads/writes more often than a user would reasonably expect. In context, this increases the chance of over-collection and persistence of user data or agent-generated reflections without sufficiently specific triggering conditions.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill persistently stores user corrections, preferences, and self-reflection data under `~/self-improving/`, but the user-facing description and activation guidance do not clearly disclose that local retention occurs. This can lead to users sharing sensitive preferences or correction content without informed consent, increasing privacy and data-minimization risk even though the storage is local-only.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- Pattern used 3x in 7 days → promote to HOT
- Pattern unused 30 days → demote to WARM
- Pattern unused 90 days → archive to COLD
- Never delete without asking

### 4. Namespace Isolation
- Project patterns stay in `projects/{name}.md`
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
| Financial | Card numbers, bank accounts, crypto seeds | Fraud risk |
| Medical | Diagnoses, medications, conditions | Privacy, HIPAA |
| Biometric | Voice patterns, behavioral fingerprints | Identity theft |
| Third parties | Info about other people | No consent obtained |
| Location patterns | Home/work addresses, routines | Physical safety |
| Access patterns | What systems user has access to | Privilege escalation |
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrase "forget everything" is broad natural language that could be invoked accidentally during ordinary conversation, quoted text, or discussion about memory behavior. In this skill, activation causes destructive state changes, so an ambiguous phrase creates a real risk of unintended memory export and deletion.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The kill-switch workflow performs sensitive side effects—exporting current memory to a file and wiping learned data—without first warning the user or obtaining confirmation for the export. That can expose retained data in a new artifact and cause irreversible loss if the phrase is triggered unintentionally or by prompt injection relayed as user text.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The skill exposes broad user-facing memory administration commands such as viewing, deleting, exporting, and querying all stored memory, which goes beyond the stated purpose of self-reflection on the agent’s own work. This expands the skill’s authority and attack surface, making it easier to disclose or modify persisted data unrelated to the immediate task or without sufficient scope checks.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
Full memory export and full-wipe capabilities are highly sensitive operations that are not justified by a self-improvement or reflection function. If triggered improperly, they can cause bulk exfiltration of stored conversation-derived data or irreversible destruction of persistent memory, creating confidentiality and integrity risks.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill describes automatic persistence of conversation-derived corrections into memory files without any user-facing disclosure or consent mechanism. Silent long-term storage of user preferences, patterns, and overrides can violate user expectations and create privacy, retention, and data-governance risks.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The weekly automated maintenance routine performs background movement, archival, compaction, and index updates on stored memory without disclosing that data may be modified outside direct user interaction. Undisclosed background changes can affect data availability, traceability, and user trust, especially when records are reorganized or archived automatically.

Missing User Warnings

Low
Confidence
96% confidence
Finding
The template explicitly instructs creation of directories and files under the user's home directory on first activation, which is a real filesystem-modifying action. While the behavior is not inherently malicious and appears intended to initialize persistent memory for the skill, it still causes side effects without any warning, consent flow, or scoping controls, making it a genuine safety issue.

Static analysis

No suspicious patterns detected.