improve

A command that reviews recent coding-agent sessions to find mistakes, user corrections, and recurring problems. It saves the findings as a dated lessons-learned report.

In plain words
What is it for?
Use it to inspect recent sessions, collect bug fixes and problem-solving examples, and create a continuous-improvement report.
Why use it?
It turns scattered session history into a record of what went wrong and how the process could improve. This makes repeated failures easier to spot.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/basher83/agent-auditor/improve
Clone the repo
git clone --depth 1 https://github.com/basher83/agent-auditor

Made for: Claude Code.

Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 782 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.00782
Opus 5 $0.00005 $0.00391
Sonnet 5 $0.00002 $0.00156
Haiku 4.5 $0.00001 $0.00078

Measured yesterday against content hash 14c989a62289, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

improve scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/improve.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Continuous Improvement Analysis

You are analyzing recent Claude Code sessions to identify failures, corrections, and learning opportunities.

Configuration

Search window: ${1:-7} days back from today Output file: ai_docs/continuous-improvement/lessons-learned-<TODAY>.md (use ISO date format)

Task Instructions

Step 1: Calculate Date Range

Today's date is available in your <env> context. Calculate:

  • End date: Today
  • Start date: Today minus ${1:-7} days
  • Use ISO format (YYYY-MM-DD) for all date operations

Step 2: Search for Incidents (Multi-Strategy)

Execute the following searches in parallel for the calculated date range:

A) User Corrections (search_user_prompts) Search for these phrases indicating something went wrong:

  • "wrong"
  • "stop"
  • "why did you"
  • "not what I asked"
  • "no"
  • "what are you"

Use format: "index" first, then fetch full details only for relevant matches.

B) Problem-Solution Patterns (find_by_concept) Query for observations tagged with concept: "problem-solution"

C) Bug Fixes (find_by_type) Query for observations of type: "bugfix"

Step 3: Aggregate and Deduplicate

  • Collect all findings from the three search strategies
  • Note: This command does NOT deduplicate across previous reports
  • Include all incidents found in the time window
  • For each incident, capture:
    • Timestamp (ISO format with time if available)
    • Source (claude-mem URI or reference)
    • User correction (exact quote if from prompts)
    • Context (what was happening, what went wrong)

Step 4: Generate Report

Write the report to ai_docs/continuous-improvement/lessons-learned-<TODAY>.md:

Report structure:

# Lessons Learned - <DATE>

**Search Period:** Last ${1:-7} days (<START-DATE> to <END-DATE>)
**Report Generated:** <TODAY>
**Total Incidents Found:** <COUNT>

---

## Search Strategy

This report combines three search methods:
1. User correction phrases in prompts
2. Problem-solution concept observations
3. Bugfix type observations

---

## Incidents

### Incident 1: <Title/Summary>

**Timestamp:** YYYY-MM-DD HH:MM:SS

**Source:** <claude-mem URI or session reference>

**User Correction:** (if applicable)
> <exact quote>

**Context:**
<What was happening, what went wrong, what was learned>

---

### Incident 2: ...

[Continue for all incidents...]

---

## Search Results Summary

**Total searches performed:** 3 strategies

**Results by strategy:**
- User correction phrases: <COUNT> results
- Problem-solution concepts: <COUNT> results
- Bugfix observations: <COUNT> results

**Note:** This report shows ALL incidents in the time window. Manual reconciliation with existing lessons-learned files is required to identify truly new incidents.

Read the full file on GitHub · 121 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 121 lines · 9 tokens per session scan A 14c989a62289

Subscribe to this mod's changes

improve is a command published in the GitHub repository basher83/agent-auditor (5 stars, last pushed 6mo ago), licensed MIT. It adds 9 tokens to every session and 782 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.