T05 · Unauthorized Access and Privilege Escalation
- Location
optimize.py:263- Finding
Optimization Operations Can Rewrite Agent Instruction and Tool Configuration Files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a memory cleanup tool, but its apply mode can rewrite persistent agent instruction and tool files with limited safeguards.
Review carefully before installing. Use dry-run first, inspect the proposed changes, and only run --apply on trusted workspaces after backing up files. Avoid using it on repositories that may contain symlinks or untrusted AGENTS.md/TOOLS.md content, because apply mode can rewrite files that influence future agent behavior.
optimize.py:263Optimization Operations Can Rewrite Agent Instruction and Tool Configuration Files
optimize.py:48Workspace-Controlled Symbolic Links Can Redirect Optimizer Writes Outside the Workspace
The skill explicitly advertises analyzing and auto-fixing memory files, including deduplication and reorganization, but does not clearly warn that these operations can alter or remove user data. In a memory-management context, this is genuinely risky because fuzzy matching and automated restructuring can produce incorrect merges, delete important context, or corrupt long-lived agent state if applied without strong safeguards.
The Auto-Fix feature is presented as a convenience capability without prominent disclosure of destructive or irreversible outcomes, even though deduplication, re-indexing, and reorganization inherently rewrite memory artifacts. Because these files may contain critical agent context, a mistaken auto-fix can silently degrade behavior, erase provenance, or lose information that is difficult to reconstruct.
The script's code is purely read/analyze/report oriented: it scans markdown files, computes issues, and optionally writes a report file. The message at L571 tells the user to run python3 optimize.py --apply to fix issues, which implies a companion fixer capability not present in this file and creates an intent/documentation mismatch within the user-facing behavior of this tool.
This code file performs direct file modifications through _write_file when --apply is used, including deduplication, reindexing, stale-entry archiving, and structure fixes. Although dry-run mode is the default and status is printed, there is no explicit confirmation step before destructive overwrites, and backups are not enabled by default.
The manifest advertises broad capabilities to analyze agent memory files, detect issues, generate reports, and auto-fix problems without defining scope, limits, or when modification is permitted. In an agent ecosystem, vague capability claims can cause overbroad invocation and unexpected access to sensitive memory data or unintended modification behavior.
The description states the skill can 'auto-fix common issues' but does not warn that it may modify user data or require confirmation. This is dangerous because memory files may contain important agent state, and silent or poorly scoped auto-fixes can corrupt, delete, or rewrite information in ways that are hard to detect or recover from.
This code performs a file write using the user-provided --output path, which can overwrite an existing file, but the only disclosure appears after the write completes. There is no pre-write confirmation, warning comment/docstring near the operation, or other advance notice in this file that a filesystem modification will occur.