agentleFS
carlkiblercarlkibler/agent-skills/skills/agent-log-forensics/SKILL.md

agent-log-forensics

Skill6 starsChanged 4 months agoMITView on GitHub

Analyze Claude/Codex logs for behavior patterns, repeated friction, and Toolsmith gaps.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this when the goal is not one bug fix, but making the human+agent system smarter after observing real sessions.

    line 15
  2. Distinctive:

    Default to the last 7 days unless the user names a different range.

    line 39
  3. Distinctive:

    Prefer Toolsmith's built-in scanner when it is installed (optional.

    line 41
  4. Very specific:

    If the scanner is not installed yet, say that and fall back to a lightweight count of recent ~/.claude/projects//*.jsonl and …

    line 49
  5. Distinctive:

    Do not paste raw user prompts or full transcript content.

    line 53
  6. Distinctive:

    Prefer counts, categories, tool names, workspace basenames, and short sanitized examples.

    line 55
  7. Distinctive:

    Treat shell commands with secrets as sensitive snippets.

    line 56
  8. Distinctive:

    After listing findings, do one further pass:

    line 98
  9. Very specific:

    Use scripts/collect_toolsmith_scan.py (relative to this skill directory, via uv run) to run local and remote Toolsmith scans and write a …

    line 127
  10. Very specific:

    Use remote-host-verifier when comparing a command across local and remote hosts.

    line 133
  11. Very specific:

    Use skill-creator when turning findings into new skills.

    line 134
  12. Very specific:

    Use status-copy-trust-audit when confusing CLI output appears repeatedly in logs.

    line 135

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Agent Log Forensics

Use this when the goal is not one bug fix, but making the human+agent system smarter after observing real sessions.

Third-order stance: skip the obvious "agent forgot tool" answer. Ask what hidden loop, missing affordance, brittle instruction, or human workaround made the tool forgettable in the first place. Prefer new mental paths over more reminders.

When to Use

  • The user asks whether agents are using a tool, skill, MCP server, or workflow
  • The user wants "lost opportunities" where agents should have used better tools
  • The user asks for patterns in interactions, repeated frustrations, jank, or productivity bottlenecks
  • The user asks "why did that take so many turns?", "why did you struggle?", or "how do we level this up?"
  • You need to turn observed behavior into new user-level skills, scripts, or project instructions

When NOT to Use

  • One isolated transcript or pasted error is enough
  • The user asks for a narrow code change unrelated to agent behavior
  • Logs may contain sensitive data and the user did not ask for forensic analysis

<process>

Phase 1: Scope the Observation Window

Default to the last 7 days unless the user names a different range. Include remote hosts only when the user names them (an SSH alias they use).

Prefer Toolsmith's built-in scanner when it is installed (optional; skip if absent):

toolsmith scan-agent-logs --days 7 --max-examples 12
toolsmith opportunities --days 7 --max-examples 8
toolsmith scan-agent-logs --days 7 --remote <ssh-host> --max-examples 12

If the scanner is not installed yet, say that and fall back to a lightweight count of recent ~/.claude/projects/**/*.jsonl and ~/.codex/sessions/**/*.jsonl files rather than dumping raw prompts.

Phase 2: Preserve Privacy

  • Do not paste raw user prompts or full transcript content.
  • Redact home paths, secrets, tokens, keys, cookies, project-private filenames when they look sensitive.
  • Prefer counts, categories, tool names, workspace basenames, and short sanitized examples.
  • Treat shell commands with secrets as sensitive snippets.

Phase 3: Classify Findings

Create five sections:

  1. Tool adoption — registered vs actually called, by agent/client, with evidence counts.
  2. Lost opportunities — where the agent used a worse tool. Separate hard misses from candidates.
  3. Behavior/productivity themes — repeated user frustrations, recurring workflow patterns, and quality gaps.
  4. Shadow workflows — places the human manually intervened, re-ran commands, pasted exact instructions, or corrected the agent after loops. Treat these as highest-value skill/script candidates.
  5. Silence anomalies — expected logs, tool calls, or telemetry are missing. Lack of evidence can mean broken instrumentation, not success.

For Toolsmith, classify:

  • Hard miss: native Read/Edit/Write, cat, nl, or broad sed -n on >200-line files.
  • Candidate: apply_patch on a large file after a search/read could have used anchors, but may still be acceptable.
  • Positive adoption: file_skeleton, find_and_anchor, get_function, anchored_read, anchored_edit, symbol_replace.

Phase 4: Convert Observations Into Improvements

For each repeated pattern, propose one of:

  • Skill — when judgment, sequencing, or cross-tool behavior matters.
  • Script — when the action is deterministic and repeatable.
  • Project instruction — when it is repo-specific and should activate automatically.
  • Tool/MCP improvement — when missing affordances prevent agents from doing the right thing.

Use this table:

SignalBetter artifact
Same review checklist repeatedSkill
Same shell command chain repeatedScript
Same repo-specific gotcha repeatedCLAUDE.md / AGENTS.md update
Agents know the right thing but forgetPrompt snippet / guardrail
Agents cannot inspect evidence cheaplyToolsmith/MCP feature
User manually intervenes after agent loopsSkill or deterministic helper that removes the human bridge
Expected telemetry is silentLogging/instrumentation fix before drawing conclusions
Same failure appears across projectsUser-level skill plus project opt-out, not per-repo copy-paste

Phase 5: Third-order Synthesis

After listing findings, do one further pass:

  • First-order: what tool or skill should have been used?
  • Second-order: why did the agent not choose it under real pressure?
  • Third-order: what new path would make the better behavior feel inevitable, delightful, or weirdly obvious next time?

Name the proposed path in memorable language, for example "shadow workflow collector", "silence detector", "release exit-door drill", or "jank weather report".

Phase 6: Write the Report

Store reports in:

  • Temporary artifacts: a scratch dir such as ${TMPDIR:-/tmp}/agent-log-forensics/
  • Durable reports: the user's notes vault or repo docs if the user asks or the work should guide future sessions

Include:

  • Date range and hosts
  • What was scanned
  • Adoption verdict
  • Lost-opportunity examples, sanitized
  • Skills/scripts/tools to add next
  • Third-order ideas worth trying even if they sound whimsical
  • Follow-up observation plan
</process><scripts>

Use scripts/collect_toolsmith_scan.py (relative to this skill directory, via uv run) to run local and remote Toolsmith scans and write a combined Markdown report. Pass --notes-dir <dir> to choose the output location (the script default is ~/dev/agent-notes/; pass the user's notes dir or a temp dir instead).

</scripts><interlocks>
  • Use remote-host-verifier when comparing a command across local and remote hosts.
  • Use skill-creator when turning findings into new skills.
  • Use status-copy-trust-audit when confusing CLI output appears repeatedly in logs.
  • For a broad synthesis pass before writing new skills, use a strongest-tier in-session subagent (outside CLIs only after asking the user; see the second-opinions policy).
</interlocks>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.