sw-learn

sw-learn is a skill for Claude Code, Codex from Obsidian-Owl/specwright. It costs 40 tokens per session (1,986 once invoked), scanned A, original, MIT.

A learning review for a completed unit of coding work. It examines failures, quality-check findings, design decisions, and supporting records to identify reusable practices.

In plain words
What is it for?
Use it after a work unit to review what happened, curate patterns, and promote approved lessons into project practices or agent memory.
Why use it?
It turns lessons from one task into guidance for future work instead of leaving them buried in logs or conversations. The user chooses which lessons become lasting project knowledge.

Skill for Claude CodeCodex

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 skills/obsidian-owl/specwright/sw-learn
Any agent
npx skills add Obsidian-Owl/specwright --skill sw-learn
Clone the repo
git clone --depth 1 https://github.com/Obsidian-Owl/specwright

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sw-learn

README.md
[![agentmods](https://agentmods.dev/badge/skills/obsidian-owl/specwright/sw-learn.svg)](https://agentmods.dev/skills/obsidian-owl/specwright/sw-learn)
Your own site
<a href="https://agentmods.dev/skills/obsidian-owl/specwright/sw-learn"><img src="https://agentmods.dev/badge/skills/obsidian-owl/specwright/sw-learn.svg" alt="Measured on agentmods" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,986 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.00040 $0.01986
Opus 5 $0.00020 $0.00993
Sonnet 5 $0.00008 $0.00397
Haiku 4.5 $0.00004 $0.00199

Measured 4d ago against content hash 49d29d640b77, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sw-learn 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 4d ago.

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.

core/skills/sw-learn/SKILL.md · 150 lines

How it starts

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

Specwright Learn

Goal

Extract reusable knowledge from the current work unit. Build failures, gate findings, and architecture decisions contain valuable patterns. Surface them, let the user curate, and promote the best ones so future work benefits.

Inputs

  • {worktreeStateRoot}/session.json -- selected work for this worktree
  • {repoStateRoot}/work/{selectedWork.id}/workflow.json -- current work unit (should be shipped)
  • {workDir}/evidence/ -- gate evidence files
  • {workDir}/implementation-rationale.md -- curated build-time reasoning when present
  • {workDir}/review-packet.md -- reviewer-facing audit synthesis when present
  • {workDir}/plan.md -- architecture decisions
  • {workArtifactsRoot}/{selectedWork.id}/approvals.md -- approval lineage for the work
  • {projectArtifactsRoot}/CONSTITUTION.md -- existing practices
  • {projectArtifactsRoot}/learnings/ -- prior work unit learnings (for retrospective)
  • Git log for the work unit's commits

Outputs

  • Learnings presented to user in categories
  • User-approved patterns promoted to one of:
    • {projectArtifactsRoot}/CONSTITUTION.md (new practice rule)
    • Auto-memory MEMORY.md (compact pattern entry, loaded every session)
    • {projectArtifactsRoot}/patterns.md (reusable pattern library)
  • {projectArtifactsRoot}/learnings/{work-id}.json -- written when any finding is promoted OR when gateCalibration data is available. When only calibration is present (no promoted findings), write with an empty findings array.

Constraints

Stage boundary (LOW freedom):

  • Follow protocols/stage-boundary.md.
  • You capture learnings and promote patterns. You NEVER start new work units, run builds, or create PRs.
  • It is not a core workflow stage and never claims top-level work ownership.
  • After learnings are captured, STOP and present the handoff:
    • If more work units pending: "Run /sw-build to start the next unit."
    • If no more units: "All work units complete. Learnings captured."

Discovery (HIGH freedom):

  • Scan evidence files, git log, plan.md, implementation-rationale.md, review-packet.md, and approval lineage for patterns worth remembering.
  • Look for: what broke, what was hard, what worked well.
  • Check as-built notes for discovered behaviors per protocols/build-quality.md.
  • If commands.test:integration is configured in config.json: check gate-build evidence for the integration tier. If it was SKIP or absent, surface as a learning candidate ("No integration tests ran"). Skip this check when no integration tier is configured.
  • MUST record gateCalibration for every gate that ran, even if all PASS with 0 findings. Populate from evidence files automatically. falsePositives array only populated when user explicitly labels a finding as false positive during presentation (dismissal alone does not count). Format per protocols/evidence.md#verdict-rendering.

Read the full file on GitHub · 150 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. 4d ago First seen · 150 lines · 40 tokens per session scan A 49d29d640b77

Subscribe to this mod's changes

sw-learn is a skill published in the GitHub repository Obsidian-Owl/specwright (9 stars, last pushed 4mo ago), licensed MIT. It adds 40 tokens to every session and 1,986 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

rust-skills

Rust best practices — 179 rules across 14 categories for idiomatic, optimized Rust code.

martineserios/thebrana · 23 tokens

new-skill

Scaffold a new brooks-lint analysis skill so it passes npm run validate and npm run evals on the first try — generates skills/{name}/SKILL.md (with the mandatory "Do NOT trigger for:" clause and a Process section citing guide step ranges) plus skills/{name}/{name}-guide.md (sequentially numbered steps), then appends…

hyhmrright/brooks-lint · 145 tokens

cco-task

Organize work by task, track tokens/cost per task, and keep a small patchable execution state that is re-injected after /compact (SKILL.state-style) — start a task, patch its state, list tasks, or mark the active one done. Pairs with /cco-pack to load minimal context per task.

egorfedorov/claude-context-optimizer · 70 tokens

cco-templates

Manage context templates for common task types.

egorfedorov/claude-context-optimizer · 11 tokens

discuss

Use when exploring a feature idea before committing, or revisiting a parked one. Triggers — "/engineer.discuss", "/engineer.discuss ", "I have an idea about", "should we build", "let's think about".

swingerman/engineer · 54 tokens

prompt-tuning

Tune a prompt, or anything whose quality is measured by non-deterministic model output, without chasing noise - a noise baseline before the first edit, medians over repeated runs, enforcement AFTER generation rather than in the wording. Use when iterating on prompts or model-judged output.

jjanczur/tyran · 58 tokens