agent-run-forensics
它能做什么
这项技能让智能体根据保存的会话记录回答关于自身过去工作的问题,而不是靠猜测。适合需要知道某个文件为何被修改、或测试是否真正通过的人。
适用场景
- ✓当你想知道智能体在早前会话中为什么修改了某个文件的时候。
- ✓当你在信任摘要之前,需要确认测试运行是否真的通过时。
- ✓当你想把智能体对自身工作的摘要与记录进行核对的时候。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agent-run-forensics/skills/agent-run-forensics/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查已记录的会话,告诉我 config.yaml 为什么被修改,以及测试是否真的通过了。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在已保存的会话中找到你指的那次运行,然后根据记录构建步骤和文件修改的时间线。它会在重复任何说法作为事实之前,先与记录逐条核对。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Agent Run Forensics
Portability: 3 stdlib Python CLIs and one hook. Read-only, no network, no model calls. Secrets in transcripts are redacted in every output, with no switch to turn that off.
Agents are confidently wrong about their own history. Asked "why did you change
config.yaml?", an agent answers from what it remembers, and memory drops the
parts that matter: the test run that failed, the file a sed -i one-liner
rewrote, the edit made after the last green run. The harness recorded all of it.
This skill makes the answer come from that recording.
The rule: when a question is about something that already happened, read the trace before answering.
Workflow
# 1 - Find the run (skip if the question is about this session: the hook gives you its path)
python scripts/trace_finder.py --since 7d --touched config.yaml
# 2 - Read it: what happened, in order, and which files changed
python scripts/trace_timeline.py --trace <path> --files # SILENT = changed, never named by the agent
python scripts/trace_timeline.py --trace <path> --grep timeout # or --errors, --file PATH, --around N
# 3 - Walk back from the step in question
python scripts/trace_timeline.py --trace <path> --why 9
# 4 - Before repeating any summary as fact, check it
python scripts/claim_checker.py --trace <path> --claim "passed:pytest" --claim "not-edited:config.yaml"
Step 3 prints two lists and you keep them apart in the answer:
| Label | Means | Example |
|---|---|---|
recorded |
The harness wrote it down when it happened | the command, its exit code, the agent's words in the same message |
inferred |
Derived now by a named rule | prior-write, read-before-write, retry-after-failure, target-seen-in-output |
Say "the trace shows" only for recorded edges. Name an inferred edge as inferred, with its rule. The agent's own stated reason is recorded as a claim, not as the cause.
Step 4 turns each sentence of a summary into a typed claim (ran:, not-run:,
passed:, failed:, edited:, not-edited:, read:). STALE means the tests
passed but files changed afterwards; PARTIAL means exit 0 came from the last
command of a pipe or ; chain. Exit 4 is a contradiction: correct the account first.
Hard rules
- No trace, no answer. If the finder returns nothing (exit 2), say the run is not recorded here. Do not reconstruct it.
- Cite steps. Every factual sentence about the run points at a step number.
- Recorded and inferred stay separate. Never merge them into one confident sentence.
- Shell effects are inferred unless the harness diff (
bashEditDiff) confirms them. A command's text says what it was meant to do, not what it did. - Exit 0 of a compound line is the last command's.
pytest | tee logpassing says nothing about pytest. - Quote no secrets. Outputs are redacted; do not paste raw transcript lines around the redaction.
Scripts
| Script | Role | Exit codes |
|---|---|---|
scripts/trace_finder.py |
Lists recorded sessions by repo, window, touched file, text | 0 found · 2 none · 3 bad input |
scripts/trace_timeline.py |
Numbered steps, --files table, --why STEP chain |
0 · 2 filter matched nothing · 3 |
scripts/claim_checker.py |
Typed claims vs the recording | 0 all supported · 2 weak · 3 · 4 contradicted |
All support --help, --sample and --output json. trace_core.py is the shared parser.
The plugin's UserPromptSubmit hook (hooks/forensics_hint.py) adds one line naming this
session's transcript when a prompt asks about past work; disable it with AGENT_RUN_FORENSICS_HOOK=0.
References and assets
references/trace_sources.md: where each harness records, what is in a record, retention and limits (7)references/recorded_vs_inferred.md: why self-reports are not evidence, and the inference rules (7)references/claim_verification.md: turning a summary into claims, verdicts, and how to correct an account (7)assets/forensic_answer_template.md: the shape of an answerassets/claims_example.txt: a claims file for--claims-file
常见问题
它会修改文件或发送数据吗?
不会。该技能只读,不使用网络,也不进行模型调用。
它会显示旧会话中的密钥吗?
不会。其输出中的密钥总是会被隐去,且无法关闭。
它如何找到早前的运行?
它可以按时间段或按被修改的文件来搜索最近的会话。
详情
作者的原始描述
Use when asked why an agent did something, what a past session or run changed, whether tests really passed, or to verify a session summary. Answers from the recorded transcript, not memory, with trace_finder.py, trace_timeline.py and claim_checker.py.
热度
- GitHub 星标
- 29k
- 排名
- #9527
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。