core/skills/sw-learn/SKILL.md
Captures patterns and learnings from the current work unit. Reviews build failures, gate findings, and architecture decisions. Applies objective promotion criteria autonomously — patterns.md is the artifact.
npx skillsauth add obsidian-owl/specwright sw-learnInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
{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){projectArtifactsRoot}/CONSTITUTION.md (new practice rule){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.Stage boundary (LOW freedom):
protocols/stage-boundary.md./sw-build to start the next unit."Discovery (HIGH freedom):
implementation-rationale.md,
review-packet.md, and approval lineage for patterns worth remembering.protocols/build-quality.md.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.protocols/evidence.md#verdict-rendering.Curation (MEDIUM freedom):
protocols/decision.md CURATION criteria autonomously:
pattern tag per protocols/backlog.mdPromotion (LOW freedom):
protocols/learning-lifecycle.md.{projectArtifactsRoot}/patterns.md (create if missing). Also write a compact one-liner to auto-memory (dual-write rule per protocol).{projectArtifactsRoot}/TESTING.md (if it exists). The testing category maps here. Add new boundary classifications, mock allowances, or test infrastructure notes discovered during build. If TESTING.md does not exist, fall back to patterns.md.Retrospective (MEDIUM freedom):
Persistence (LOW freedom):
{projectArtifactsRoot}/learnings/{work-id}.json when any finding is promoted OR when gateCalibration data is available (mandatory per protocols/evidence.md#verdict-rendering). When only calibration is present, write with an empty findings array.{ workId, timestamp, findings: [{ category, source, description, proposedRule, disposition }] }Landscape update (MEDIUM freedom):
{projectArtifactsRoot}/LANDSCAPE.md exists: identify affected modules from evidence, implementation-rationale.md, review-packet.md, and plan artifacts, re-scan those modules, merge updates. Show diff, user approves. Update Snapshot: timestamp.Audit resolution (MEDIUM freedom):
{projectArtifactsRoot}/AUDIT.md exists: check if work unit's changed files overlap with open finding locations. If finding is addressed, move to ## Resolved with work unit ID. User approves.Enrichment (MEDIUM freedom):
protocols/insights.md. Silently skip if unavailable or stale.Auto-memory (MEDIUM freedom):
protocols/learning-lifecycle.md. If auto-memory directory doesn't exist or system prompt doesn't mention auto-memory, silently fall back to patterns.md only.State cleanup (LOW freedom):
shipped. If it is
anything else (e.g. building, verifying), STOP with:
"State cleanup requires status 'shipped'. Current status: {status}. Complete the current build cycle before running /sw-learn."protocols/state.md before other mutations.protocols/state.md read-modify-write sequence.{worktreeStateRoot}/session.json.attachedWorkId to null.workUnits, gates, and shipped
history for future retrospectives./sw-learn.shipped → (none) transition defined in protocols/state.md.protocols/stage-boundary.md -- scope, termination, and handoffprotocols/decision.md -- autonomous decision framework (CURATION heuristics)protocols/context.md -- anchor doc loadingprotocols/state.md -- workflow state reading and cleanup transitionprotocols/insights.md -- session pattern enrichmentprotocols/learning-lifecycle.md -- promotion targets and auto-memory formatprotocols/landscape.md -- codebase reference document formatprotocols/audit.md -- codebase health findings formatprotocols/backlog.md -- backlog item format and write targetsprotocols/build-quality.md -- as-built notes and discovered behaviorsprotocols/approvals.md -- approval lineage consumptionprotocols/review-packet.md -- reviewer packet consumptionprotocols/evidence.md#verdict-rendering -- gate calibration data recording| Condition | Action |
|-----------|--------|
| No completed work unit | "Nothing to learn from. Complete a build cycle first." |
| No evidence files | Skip evidence scanning, focus on git log and plan |
| User dismisses all learnings | Calibration data still written (mandatory). Findings array empty. |
| Insights unavailable/stale | Silently skip enrichment per protocols/insights.md |
| Auto-memory unavailable | Silently fall back to patterns.md only |
testing
Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency.
testing
Orchestrates quality gates for the current work unit. Runs enabled gates in dependency order, produces an aggregate evidence report with gate handoff.
tools
Syncs the local repository by fetching all remotes, updating the base branch, and removing stale local branches that are not protected by live sessions or helper worktrees.
data-ai
Shows current Specwright state for this worktree, the attached work, repo-wide active works, gate results, and lock status. Supports --reset, --cleanup, and --repair {unitId}.