T02 · Agent Memory Poisoning
- Location
SKILL.md:61- Finding
Persistent Daily Memory Writes Without Explicit User Confirmation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 61-89
Vulnerability Type: Persistent agent memory poisoning through unconfirmed writes
Risk Level: MediumVulnerable Code Snippet:
markdown | Session note | Daily memory / learnings file | — | | Workflow rule | `AGENTS.md` | ✓ | | Tool gotcha | `TOOLS.md` | ✓ | | Voice / boundary pattern | `SOUL.md` | ✓ | | User preference | `USER.md` or long-term memory | ✓ | | Missing capability | Skill discovery (see above) | ✓ | - For any ✓ row: show the diff and ask "append to <file>? [y/N]" before writing. Never silently mutate durable files. 3. **Promote** to durable file only if **all** hold: - **Recurring** — ≥2 occurrences (user saying "Nth time" / "又错了" is proof) - **High-value** — non-trivial consequence (broken CI, lost work, wrong user output), not style nits - **Broadly reusable** — class of situations, not one specific file/PR - **Rule-preventable** — a future-you reading the rule would avoid it - If any fails, keep in daily memory only. ## File Locations Resolve durable files in this order — first hit wins: | File | Lookup order | |---|---| | `AGENTS.md` | `./AGENTS.md` → `~/.claude/AGENTS.md` | | `TOOLS.md` | `./TOOLS.md` → `~/.claude/TOOLS.md` | | `SOUL.md` | `./SOUL.md` → `~/.claude/SOUL.md` | | `USER.md` | `~/.claude/USER.md` (always user-scoped) | | Daily memory | `~/.claude/memory/YYYY-MM-DD.md` (auto-create if missing) | If none exists and a write is approved, create at the project-root path (or `~/.claude/` for `USER.md`) and tell the user "creating new file `<path>`."Technical Analysis
The skill treats user corrections, failures, and workflow observations as material that can be converted into persistent lessons. Although writes to files such as
AGENTS.md,TOOLS.md,SOUL.md, andUSER.mdrequire a displayed diff and explicit confirmation, the session-not ...[truncated 1835 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit user confirmation before every persistent write, including daily-memory and session-note files.
- Display the exact destination path and a complete proposed diff before requesting approval.
- Default confirmation prompts to denial and perform no write when the response is absent or ambiguous.
- Treat all conversation-derived lesson content as untrusted data. Remove imperative instructions, executable commands, URLs, secrets, credentials, and unrelated personal information before persistence.
- Record provenance with each approved entry, including the source session, creation time, and whether the content originated from the user, a tool, or the agent's inference.
- Separate short-lived session notes from memory loaded automatically in future sessions. Prefer an ephemeral store unless the user explicitly requests persistence.
- Add review, expiration, and deletion mechanisms so users can inspect and remove stored lessons.
- Revise the routing table so the daily-memory row also requires confirmation, and replace “keep in daily memory only” with “offer to save in daily memory after presenting a sanitized diff.”
