Agent 错误记忆与自纠正
agent-agent-mistakes
构建智能体(agent)记忆模式以防止重复犯错 —— 运用会话重放(session replay)、错误跟踪以及自我纠正的知识库。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- agent-agent-mistakes
- context
- inline
- arguments
- [ "agent_name", "error_sources" ]
- description
- Build agent memory patterns that prevent the same mistakes — using session replay, error tracking, and a self-correcting knowledge base.
- when_to_use
- Use when the user wants to stop their AI agent from making the same mistakes repeatedly. Examples: 'make agents learn from mistakes', 'build error memory for agents', 'agent self-correction system', 'stop agents repeating errors', 'agent mistake tracker', 'build a memory that prevents agent errors'
- argument-hint
- [agent_name] [error_sources]
02 资源文件 1
03 SKILL.md 正文
Agent-Agent Mistakes — Stop Agents Repeating Errors
Build a self-correcting memory system so your agent never makes the same mistake twice. Based on Garry Tan's framework for agent error prevention.
Goal
Agents accumulate error patterns, learn from session failures, and consult a mistake memory before repeating actions.
Inputs
$agent_name: Name of the agent to instrument (e.g. "hermes", "ao-primary")$error_sources: Comma-separated sources to monitor for errors (e.g. "session_replays, cron_outputs, slack_threads")
Steps
1. Set Up Error Capture
Create a memory file at memory/agent-errors.md tracking all agent mistakes.
Success criteria: memory/agent-errors.md exists and is git-tracked.
Why this works despite .gitignore ignoring memory/: the repo's .gitignore ignores memory/ as a whole (it's machine-specific runtime), but memory/agent-errors.md is allow-listed with !memory/agent-errors.md so git add memory/agent-errors.md works normally. The exception is intentional: this file is the cross-machine mistake registry, not a runtime artifact — losing it loses the whole skill's value. Do not generalize the exception to other memory/* files; they remain machine-specific.
2. Instrument Session Replay
After every agent session, extract error patterns:
- Failed tool calls (timeout, permission denied, not found)
- User corrections (things the agent had to be steered on)
- Context-ceiling spirals (long sessions that produced no output)
- Fabricated responses (confabulated IDs, fake confirmations)
Success criteria: Session logs are being reviewed and patterns extracted.
3. Build the Error Memory
For each unique error pattern, add an entry to memory/agent-errors.md:
## Error: [short name]
**First seen**: YYYY-MM-DD
**Occurrences**: N
**Root cause**: What the agent got wrong
**Prevention**: What the agent should do instead
**Trigger phrase**: Phrases that indicate this error is happening again
Success criteria: At least 3 error patterns documented.
4. Pre-Action Verify (verify-before-upstream-claim gate)
Before any claim that involves:
- An upstream repo's current state (language, file layout, branch, default branch, CI status)
- A local path on this machine (file, directory, binary, command output)
- A thread, channel, or message on a connected platform
run the actual verification command in the same turn and cite its output. Do not fill the gap from training-data memory of what the project used to be in a prior architecture, and do not say "I can't fetch that" for tools the runtime exposes (Slack MCP, Playwright MCP, gh api, web_extract).
See references/2026-06-25-verify-before-upstream-claim.md for the worked example, the three failure modes from that thread, and the paste-able pre-flight gate.
5. Track Error Recurrence
If an error from the memory is repeated, increment its occurrence count and add a new timeline entry.
Success criteria: memory/agent-errors.md shows decreasing recurrence for documented errors.
Anti-Patterns (worked examples in references/)
- 2026-06-25 verify-before-upstream-claim — three failures in one Slack thread: hallucinated a
~/.hermes/agent-orchestrator/Python folder that didn't exist, assumed upstream's TS→Go rewrite also rewrote the user's TS fork, and said "I can't fetch Slack URLs" whenmcp_slack_conversations_replieswas sitting right there. Seereferences/2026-06-25-verify-before-upstream-claim.md.
04 同仓库更多 Skills
disk-reclaim-playbook
Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.
claudea-bench
Compare `claudea` and normal `claude` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.
pr
Alias for the canonical pr-lifecycle PR workflow skill (/pr-workflow, /prw).
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
pr-report
This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, /pr-report, or wants per-PR summary with delta files/lines. Generates a structured report for one or more open PRs covering purpose, files changed, +/− line counts, /code-standards + /thermo review findings, /ponytail simplification opportunities, file-overlap combination candidates, and /green status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.