ag-learn
Use this skill to turn agent mistakes, repeated friction, or useful workflow discoveries into better skills.
Constants
LEARN_ROOT: $HOME/.llm/skills/learn
LEARN_ARCHIVE: $HOME/.llm/skills/learn/.archive
SKILL_TOKEN: ag-learn
Core Workflow
- Identify the learning source: current session, named session, merged PR, pasted evidence, or review window.
- For default/current-session learning, read
./references/session-forensics.md and scan the active rollout JSONL before choosing the final learning focus.
- Treat the user's immediate complaint as a seed, not the whole evidence boundary.
- Include earlier same-session mistakes, interruptions, corrections, and explicit skill invocations when they are related or explain why the immediate complaint happened.
- If the user names a narrower source such as a PR, pasted evidence, or review window, scan that source and any current-session turns that led to the request.
- Inspect enough durable evidence to understand the friction.
- Good evidence: transcript excerpts, rollout JSONL, PR comments, diffs, logs, generated artifacts, command output, saved learn notes.
- If transcript forensics are needed, read
./references/session-forensics.md.
- Rank candidate learnings by prominence before choosing what to save or apply.
- Prefer issues that recur across the session, required user correction, caused rework, or crossed skill boundaries.
- Do not choose only the most recent failure unless the requested source is explicitly narrow.
- Collapse timebound incidents into the durable workflow gap behind them. For example, "one PR had stale mergeability" should become a reusable finalization rule only if the evidence shows a general GitHub-state handling gap.
- De-prioritize one-off environmental flakes, temporary CI behavior, and already-fixed implementation details unless they reveal a reusable skill gap.
- Decide whether the issue should change a skill.
- Optimize an existing skill when the workflow already has a clear home.
- Propose a new skill when repeated work has no clean home.
- Use
none when the lesson is too situational or not skill-shaped.
- Read the target skill or shortcut source before judging the gap.
- For skill changes, follow
$sc and edit only the canonical source tree.
- For
trigger:<shortcut> cases, resolve the shortcut through $dev.shortcuts before classifying the mistake.
- Produce 1-3 high-signal improvements. Do not pad with weak lessons.
- When the user asks to scan an entire conversation or session, include a short candidate-friction ranking in the saved note coverage so the selected issues are auditable.
- If a selected improvement is already covered by an existing skill, report it as already addressed and do not create a duplicate proposed change.
- Save a learn note only when the user asks for persistence, the finding should be reused, or the run is review/code/formal mode.
- Before creating or updating any saved note under
LEARN_ROOT, read ./references/templates.md.
- Saved notes must follow the durable note template from
templates.md; the compact output format below is only for the user-facing summary.
- Before reporting the saved path, verify the note contains
## Evidence Inspected, ## Coverage, ## Known Gaps, at least one ## [number] Improvement Opportunity, and ### Routing.
Modes
- Default/current session: use the Core Workflow, including the active rollout scan in
./references/session-forensics.md.
steering: read ./references/steering-mode.md; inventory user directives and corrections across the current conversation, group recurring behavioral patterns, and derive reusable steering principles.
review [time interval] [path]: read ./references/review-mode.md.
code: read ./references/code-mode.md.
- Evidence-based skill optimization: use the Core Workflow to inspect evidence, rank friction, and select improvements; route canonical edits, validation, packaging, and sync through
$sc.
- Formal saved note or durable routing: read
./references/templates.md.
- Session lookup, parent/fork tracing, or ledger logging: read
./references/session-forensics.md and ./references/ledger.md; use $ag-ledger and $dev.llm-session as needed.
Output
The compact numbered format below is for chat summaries only. Do not use it as the saved-note file format.
For each improvement, keep the user-facing summary compact:
1. [short title]
Evidence: [durable evidence checked]
Skill gap: [what the skill should have made easier or prevented]
Target: [existing skill, proposed skill, or none]
Proposed change: [implementation-ready change, or n/a]
Promote: [yes|no]
When saving a note, write it under LEARN_ROOT with a filename containing the literal ag-learn token. Verify the saved path exists before reporting it.
Archive Learning
When the user archives a learning, move it to LEARN_ARCHIVE.
1---2name: ag-learn3description: Improve skills from agent friction or derive steering principles from user corrections.4---56# ag-learn78Use this skill to turn agent mistakes, repeated friction, or useful workflow discoveries into better skills.910## Constants1112- `LEARN_ROOT`: `$HOME/.llm/skills/learn`13- `LEARN_ARCHIVE`: `$HOME/.llm/skills/learn/.archive`14- `SKILL_TOKEN`: `ag-learn`1516## Core Workflow17181. Identify the learning source: current session, named session, merged PR, pasted evidence, or review window.192. For default/current-session learning, read `./references/session-forensics.md` and scan the active rollout JSONL before choosing the final learning focus.20 - Treat the user's immediate complaint as a seed, not the whole evidence boundary.21 - Include earlier same-session mistakes, interruptions, corrections, and explicit skill invocations when they are related or explain why the immediate complaint happened.22 - If the user names a narrower source such as a PR, pasted evidence, or review window, scan that source and any current-session turns that led to the request.233. Inspect enough durable evidence to understand the friction.24 - Good evidence: transcript excerpts, rollout JSONL, PR comments, diffs, logs, generated artifacts, command output, saved learn notes.25 - If transcript forensics are needed, read `./references/session-forensics.md`.264. Rank candidate learnings by prominence before choosing what to save or apply.27 - Prefer issues that recur across the session, required user correction, caused rework, or crossed skill boundaries.28 - Do not choose only the most recent failure unless the requested source is explicitly narrow.29 - Collapse timebound incidents into the durable workflow gap behind them. For example, "one PR had stale mergeability" should become a reusable finalization rule only if the evidence shows a general GitHub-state handling gap.30 - De-prioritize one-off environmental flakes, temporary CI behavior, and already-fixed implementation details unless they reveal a reusable skill gap.315. Decide whether the issue should change a skill.32 - Optimize an existing skill when the workflow already has a clear home.33 - Propose a new skill when repeated work has no clean home.34 - Use `none` when the lesson is too situational or not skill-shaped.356. Read the target skill or shortcut source before judging the gap.36 - For skill changes, follow `$sc` and edit only the canonical source tree.37 - For `trigger:<shortcut>` cases, resolve the shortcut through `$dev.shortcuts` before classifying the mistake.387. Produce 1-3 high-signal improvements. Do not pad with weak lessons.39 - When the user asks to scan an entire conversation or session, include a short candidate-friction ranking in the saved note coverage so the selected issues are auditable.40 - If a selected improvement is already covered by an existing skill, report it as already addressed and do not create a duplicate proposed change.418. Save a learn note only when the user asks for persistence, the finding should be reused, or the run is review/code/formal mode.42 - Before creating or updating any saved note under `LEARN_ROOT`, read `./references/templates.md`.43 - Saved notes must follow the durable note template from `templates.md`; the compact output format below is only for the user-facing summary.44 - Before reporting the saved path, verify the note contains `## Evidence Inspected`, `## Coverage`, `## Known Gaps`, at least one `## [number] Improvement Opportunity`, and `### Routing`.4546## Modes4748- Default/current session: use the Core Workflow, including the active rollout scan in `./references/session-forensics.md`.49- `steering`: read `./references/steering-mode.md`; inventory user directives and corrections across the current conversation, group recurring behavioral patterns, and derive reusable steering principles.50- `review [time interval] [path]`: read `./references/review-mode.md`.51- `code`: read `./references/code-mode.md`.52- Evidence-based skill optimization: use the Core Workflow to inspect evidence, rank friction, and select improvements; route canonical edits, validation, packaging, and sync through `$sc`.53- Formal saved note or durable routing: read `./references/templates.md`.54- Session lookup, parent/fork tracing, or ledger logging: read `./references/session-forensics.md` and `./references/ledger.md`; use `$ag-ledger` and `$dev.llm-session` as needed.5556## Output5758The compact numbered format below is for chat summaries only. Do not use it as the saved-note file format.5960For each improvement, keep the user-facing summary compact:6162```markdown631. [short title]64Evidence: [durable evidence checked]65Skill gap: [what the skill should have made easier or prevented]66Target: [existing skill, proposed skill, or none]67Proposed change: [implementation-ready change, or n/a]68Promote: [yes|no]69```7071When saving a note, write it under `LEARN_ROOT` with a filename containing the literal `ag-learn` token. Verify the saved path exists before reporting it.7273## Archive Learning7475When the user archives a learning, move it to `LEARN_ARCHIVE`.