T02 · Agent Memory Poisoning
- Location
scripts/setup.sh:94- Finding
Persistent modification of Agent instructions enables autonomous cross-session execution
- Content
View full analysis
/dev/null; then ok "AGENTS.md 已包含写作规则" else cat >> "$AGENTS_FILE" << 'AGENTS_BLOCK' ## 微信公众号文章写作规则 ### 自动执行(不问人) - 选题调研(web_search) - 撰写大纲 - 生成初稿(spawn Writer 子代理,用 Opus 模型) - 评审打分(spawn Reviewer 子代理,用 Sonnet 模型) - 自动修改循环(最多2轮) - baoyu renderer 排版 (scripts/renderer/, default 主题) - 启动预览服务器 ... AGENTS_BLOCK ok "AGENTS.md 已追加写作规则" fi ``` ```bash HEARTBEAT_FILE="$WORKSPACE/HEARTBEAT.md" HB_MARKER="## 文章 Pipeline 检查" if [ -f "$HEARTBEAT_FILE" ] && grep -q "$HB_MARKER" "$HEARTBEAT_FILE" 2>/dev/null; then ok "HEARTBEAT.md 已包含 pipeline 检查" else cat >> "$HEARTBEAT_FILE" << 'HB_BLOCK' ## 文章 Pipeline 检查 每次心跳检查 ~/.wechat-article-writer/drafts/*/pipeline-state.json - 如果有 phase 不是 "done" 且不是等待人工的阶段 → 继续执行 - 如果 phase 是 "previewing_text" 或 "illustrating" → 不要自动继续,等用户 - 如果 pipeline 超过 24 小时没更新 → 提醒用户 HB_BLOCK ok "HEARTBEAT.md 已追加 pipeline 检查" fi ``` The corresponding state protocol further states: ```markdown ## Resume Protocol (MANDATORY at start of every turn) 1. Check if any `pipeline-state.json` exists with `phase` ≠ `done`/`blocked`. 2. If found, read it — this is your current task. 3. If `subagent_label` is set and `subagent_status` is `pending`: - Check via `subagents list`. ... 4. If no subagent pending → execute `pending_action`. ``` ### Technical Analysis The setup process appends durable workflow directives to workspace-level `AGENTS.md` and `HEARTBEAT.md` files. These are not ordinary Skill-local configuration files: they can influence Agent behavior ...[truncated 1955 chars]- Remediation
View remediation
