Skip to content
Back to skills

Lesson Learn

ASecurity

Run an evidence-based retrospective over agent session logs (Claude Code and Codex) for a date range or project, and propose ranked environment improvements. Use when asked to learn from past sessions, find repeated corrections, or audit missed sub-agent dispatch. Not for: reviewing a diff, diagnosing one failure, or applying fixes. Output: a ranked report with session-id evidence and proposed issues.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsgobashnode

Works with

  • claude code

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add hmj1026/dhpk --skill lesson-learn --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lesson Learn?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lesson Learn
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hmj1026-lesson-learn-dhpk/badge)](https://www.skillsdirectory.com/skills/hmj1026-lesson-learn-dhpk)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: lesson-learn
description: 'Run an evidence-based retrospective over agent session logs (Claude Code and Codex) for a date range or project, and propose ranked environment improvements. Use when asked to learn from past sessions, find repeated corrections, or audit missed sub-agent dispatch. Not for: reviewing a diff, diagnosing one failure, or applying fixes. Output: a ranked report with session-id evidence and proposed issues.'
argument-hint: '--since=<YYYY-MM-DD> --until=<YYYY-MM-DD> [--project=<dir>]'
allowed-tools: 'Bash(node ${CLAUDE_SKILL_DIR}/scripts/extract.js:*), Read, Grep, Glob, Write, Agent'
disable-model-invocation: true
metadata:
  dhpk-capability-id: dhpk.skill.lesson-learn
  dhpk-name-style: portable-skill
  dhpk-invocation-class: explicit-only
  dhpk-next:
    PASS: none
    FAIL: none
    BLOCKED: none
    NOT_RUN: none
    UNAVAILABLE: none
---

# Lesson Learn

Find what the user had to correct, repeat, or remind the agent about, and turn
each repeated pattern into one proposed change to the agent's environment:
steering files, checks, skills, agents, or tools. Every finding cites the
sessions it came from.

## Workflow

1. **Scope.** Take `--since`, `--until`, and an optional project. Ask for the
   report directory if the repository has no `docs/evidence/`.
2. **Extract.** Run
   `node ${CLAUDE_SKILL_DIR}/scripts/extract.js --since=<d> --until=<d> [--project=<dir>] --out=<scratch-dir>`.
   It streams Claude Code transcripts and Codex rollouts, skips claude-mem
   observer sessions, redacts secrets, and writes `sessions.jsonl` and
   `candidates.jsonl`. Record its JSON summary. The ratio is candidates per
   transcript record; if it is above 5%, report that and narrow the window
   before classifying. `--project` matches the Claude project dir name, a Claude
   dir name ending in `-<project>`, or the Codex cwd basename; zero matches
   print a warning on stderr. Guard Blocks use the date of the first refusal
   in the selected project scope. Other candidates use the transcript file's
   modification time. The session total includes transcripts selected by
   either rule.
3. **Classify.** Follow [`references/classify-protocol.md`](references/classify-protocol.md):
   split candidates into at most 8 batches for fast read-only sub-agents, then
   send doubtful clusters to one stronger verifier. Without a sub-agent tool,
   classify the batches yourself in sequence and label the report
   `dispatch: inline-sequential`.
4. **Rank.** Group findings by [`references/categories.md`](references/categories.md).
   Rank by occurrences × sessions affected × cost (rework, lost turns). A
   finding seen in one session only is listed as an observation, not a
   proposal.
5. **Report.** Write the report (Markdown plus a JSON sidecar) to the agreed
   directory. Each proposal names the target file or mechanism, the change,
   and at least two evidence rows: `host / project / session id / timestamp /
   redacted excerpt`.
6. **Propose issues.** List the issues you would open. Stop and wait for the
   user to approve them. Only after approval, create each with
   `gh issue create --label needs-triage`.

## When NOT to Use

- Reviewing a finished change: use `diff-review` or `change-verdict`.
- Diagnosing one reproducible failure: use `failure-diagnose`.
- Applying a fix: proposals become issues; implementation is a separate task.

## Output

`Scope → extraction summary → ranked proposals (category, target, change,
evidence rows) → observations → proposed issues awaiting approval`.
Quote only redacted excerpts. Report extraction skips and any batch that was
not classified as `NOT_RUN`.

### Guard Block Recovery

Under the extraction summary, report the Guard Block total and affected
session count from `guardBlocks`. Build one Markdown table from
`guardBlocks.byReason`, with one row per reason and these columns:

| Reason | Guard Blocks | Recovered | Re-blocked | Abandoned | Unmatched | Recovery turns total | Recovery turns median |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |

Use the same columns each month. Recovery turns count the assistant turns
from the refusal to the first successful read within the five-turn window.
Show `—` for a `null` median. Copy `guardBlocks` unchanged into the JSON
sidecar, including zero totals and `null` medians. Use the same per-reason
totals for any Guard Block counts in the report.

## Verification

- [ ] The extraction summary (sessions, candidates, ratio, skipped) is in the report.
- [ ] Every proposal has at least two evidence rows from distinct sessions.
- [ ] No unredacted secret, token, or email appears in the report.
- [ ] No issue was created before the user approved the list.

Files in this skill

  • SKILL.md4.6 KB
  • references/categories.md1.8 KB
  • references/classify-protocol.md1.5 KB
  • scripts/extract.js10.8 KB
  • scripts/lib/guard-blocks.js7.3 KB
  • scripts/lib/read-targets.js11.6 KB
  • scripts/lib/transcript-reader.js12.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.