Self-improving AI memory system that learns from sessions. Stores learnings in skill-specific MEMORY.md files. Supports cross-platform Claude Code and non-Claude environments. Smart merging preserves user learnings during marketplace updates. Activates for reflect, remember, learn from session, memory, self-improvement, AI memory, correction patterns, skill learning, persistent memory.
/plugin marketplace add anton-abyzov/specweave/plugin install sw@specweaveThis skill inherits all available tools. When active, it can use any tool Claude has access to.
MEMORY.mdThe Reflect system enables continual learning across sessions. Instead of starting from zero every conversation, Claude learns from corrections, successful patterns, and user preferences - persisting knowledge in skill-specific MEMORY.md files.
Session 1: User corrects button style → Reflect captures learning → saves to frontend skill
Session 2: Claude uses correct button style without being reminded
Session 3+: Knowledge compounds, Claude gets smarter over time
Each skill has its own MEMORY.md file storing learned patterns:
# Claude Code Environment
~/.claude/plugins/marketplaces/specweave/plugins/specweave/skills/
├── architect/
│ ├── SKILL.md # Skill definition
│ └── MEMORY.md # User learnings for this skill
├── frontend/
│ ├── SKILL.md
│ └── MEMORY.md # Frontend-specific learnings
├── tech-lead/
│ ├── SKILL.md
│ └── MEMORY.md
└── ...
# Non-Claude Environment (project-local)
.specweave/plugins/specweave/skills/
├── architect/
│ ├── SKILL.md
│ └── MEMORY.md
└── ...
# Category Memory (fallback for non-skill learnings)
.specweave/memory/ # Project learnings
├── component-usage.md
├── api-patterns.md
├── testing.md
├── deployment.md
└── general.md
~/.specweave/memory/ # Global learnings (all projects)
| Platform | Skills Location | Detection |
|---|---|---|
| macOS/Linux | ~/.claude/plugins/marketplaces/specweave/... | CLAUDE_CODE=1 or marketplace exists |
| Windows | %APPDATA%\Claude\plugins\marketplaces\specweave\... | Same detection |
| Non-Claude | .specweave/plugins/specweave/skills/ | Fallback when Claude Code not detected |
When running specweave refresh-marketplace or specweave init --refresh:
.memory-backups/)User Memory + Default Memory → Merged Memory
│ │ │
│ │ └── Both preserved, deduped
│ └── New patterns from marketplace
└── Your corrections (ALWAYS kept)
Every LLM session starts from zero:
This manifests as:
Reflect analyzes sessions and persists learnings in skill-specific MEMORY.md files:
# frontend skill's MEMORY.md
# Skill Memory: frontend
> Auto-generated by SpecWeave Reflect v4.0
> Last updated: 2026-01-06T10:30:00Z
> Skill: frontend
## Learned Patterns
### LRN-20260106-A1B2 (correction, high)
**Content**: Always use `<Button variant='primary'>` from `@/components/ui/button` for primary actions. Never create custom button styles.
**Context**: User corrected button component usage in settings page
**Triggers**: button, primary, action, component
**Added**: 2026-01-06
**Source**: session:2026-01-06
Key benefit: Learnings are stored with the skill they apply to, automatically loaded when that skill activates.
Reflect identifies signals in conversation and captures FULL context:
⚠️ CRITICAL: Context Must Include the PROBLEM, Not Just the Fix
When a user explains a problem like:
User: "When I use voice control, it always gives me 'command not recognized'"
The system MUST capture:
DO NOT store just: "always command not recognized" ← This loses all meaning!
Corrections (High Confidence)
User: "No, don't use that button. Use our <Button variant='primary'> component."
→ CONTEXT: User corrected button component usage in settings page
→ LEARNING: Always use Button component with variant='primary' from design system
→ SKILL: frontend (auto-detected)
→ CONFIDENCE: high
Rules (High Confidence)
User: "Always use the logger module instead of console.log"
→ CONTEXT: User established logging convention for the project
→ LEARNING: Use logger module for all logging, never console.log
→ SKILL: tech-lead (auto-detected)
→ CONFIDENCE: high
Problem Reports (High Confidence) - NEW!
User: "The detector skill doesn't recognize commands when I use voice input"
→ CONTEXT: Voice dictation causes command parsing issues
→ LEARNING: Voice input mangles command syntax - recommend typing or clipboard
→ SKILL: detector (explicit skill name detected!)
→ CONFIDENCE: high
Approvals (Medium Confidence)
User: "Perfect! That's exactly how our API patterns should look."
→ CONTEXT: User approved API response structure pattern
→ LEARNING: Continue using this API pattern structure with status, data, error fields
→ SKILL: backend (auto-detected)
→ CONFIDENCE: medium
Learnings are routed using a priority-based detection system:
If the user mentions a skill by name, route directly to that skill:
"the detector skill doesn't work" → detector skill
"increment-planner has a bug" → increment-planner skill
"service-connect is failing" → service-connect skill
Detection pattern: (the\s+)?(\w+[-\w]*)\s+(skill|command|agent)
If no explicit skill is mentioned, use keyword matching:
| Skill | Keywords |
|---|---|
architect | architecture, system design, adr, microservices, api design, schema |
tech-lead | code review, best practices, refactoring, technical debt, solid |
qa-lead | test strategy, qa, quality gates, regression, tdd, bdd |
security | security, owasp, authentication, authorization, encryption |
frontend | react, vue, component, ui, css, tailwind, button, form |
backend | api, endpoint, route, rest, graphql, server, middleware |
database | database, sql, query, schema, migration, prisma, postgres |
testing | test, spec, mock, vitest, jest, playwright, cypress |
devops | docker, kubernetes, ci/cd, pipeline, deploy, github actions |
infrastructure | terraform, iac, aws, azure, gcp, serverless |
performance | performance, optimization, profiling, caching, latency |
docs-writer | documentation, readme, api docs, technical writing |
If no skill matches, route to category memory (.specweave/memory/{category}.md)
Each learning is structured:
interface Learning {
id: string; // LRN-YYYYMMDD-XXXX
timestamp: string; // ISO 8601
type: 'correction' | 'rule' | 'approval';
confidence: 'high' | 'medium' | 'low';
content: string; // The actual learning
context?: string; // What triggered it
triggers: string[]; // Keywords for matching
source: string; // session:YYYY-MM-DD
}
Learnings are written to skill-specific MEMORY.md files:
# Skill Memory: frontend
> Auto-generated by SpecWeave Reflect v4.0
> Last updated: 2026-01-06T10:30:00Z
> Skill: frontend
## Learned Patterns
### LRN-20260106-A1B2 (correction, high)
**Content**: Always use `<Button variant='primary'>` from design system
**Context**: User corrected button usage
**Triggers**: button, primary, component
**Added**: 2026-01-06
**Source**: session:2026-01-06
### LRN-20260105-C3D4 (rule, high)
**Content**: Use PascalCase for component files: `UserProfile.tsx`
**Triggers**: component, naming, file, tsx
**Added**: 2026-01-05
**Source**: session:2026-01-05
After completing work, manually trigger reflection:
# Reflect on current session (auto-detects skills)
/sw:reflect
# Reflect targeting a specific skill
/sw:reflect --skill frontend
# Reflect with focus prompt
/sw:reflect "Focus on the database query patterns we discussed"
Route learnings directly to a skill:
# Add learning to frontend skill
/sw:reflect --skill frontend "Always use shadcn Button component"
# Add learning to testing skill
/sw:reflect --skill testing "Use vi.fn() not jest.fn() with Vitest"
# Add learning to architect skill
/sw:reflect --skill architect "Prefer event-driven over request-response"
# List all skills with memory counts
/sw:reflect-status
# View specific skill's learnings
cat ~/.claude/plugins/marketplaces/specweave/plugins/specweave/skills/frontend/MEMORY.md
/sw:reflect-status)When generating the reflect status dashboard, follow this enhanced format:
Show reflection enabled status, auto-reflect, dates, thresholds.
CRITICAL: This section must clearly show WHAT each category learns.
For each memory file in .specweave/memory/:
- or - ✗→✓)■ for filled, □ for empty)Format:
Project Skills (.specweave/memory/):
• general.md 12 learnings ■■■■■■□□□□ 40%
└─ Project conventions, file organization, tooling preferences
• testing.md 8 learnings ■■■■□□□□□□ 27%
└─ Test patterns, mocking, framework usage (Vitest, Playwright)
Category Descriptions (use these exact descriptions):
| File | Description |
|---|---|
general.md | Project conventions, file organization, tooling preferences |
testing.md | Test patterns, mocking, framework usage (Vitest, Playwright) |
api-patterns.md | API design, endpoint patterns, REST/GraphQL conventions |
database.md | Query patterns, schema design, ORM usage, migrations |
git.md | Commit messages, branching, Git workflows |
logging.md | Logger usage, log levels, structured logging |
component-usage.md | UI component patterns, styling, component composition |
deployment.md | Deploy commands, CI/CD, service configuration |
security.md | Auth patterns, validation, secrets management |
structure.md | File/module organization, import patterns |
Show last modified file and extract recent learnings with confidence levels.
Show available commands with context-aware hints (e.g., "already on" when enabled).
End with a plain English summary like:
The reflection system is actively learning from your corrections. Auto-reflection
is enabled, so learnings will be automatically captured when you end sessions.
You have 30 learnings across 5 categories with recent activity in general
project rules and API patterns.
Enable auto-reflection on session end:
# Enable automatic reflection (via stop hook)
/sw:reflect-on
# Disable automatic reflection
/sw:reflect-off
# Check reflection status
/sw:reflect-status
When enabled, the stop hook automatically:
specweave refresh-marketplace.memory-backups/| Scenario | Result |
|---|---|
| User has learning, marketplace doesn't | User learning preserved |
| Marketplace has learning, user doesn't | Learning added |
| Both have similar learning | User's version kept (deduplication) |
| Both have different learnings | Both kept |
Learnings are considered duplicates if:
In ~/.claude/settings.json:
{
"reflect": {
"enabled": true,
"autoReflect": false,
"confidenceThreshold": "medium",
"maxLearningsPerSession": 10,
"maxLearningsPerSkill": 50
}
}
In .specweave/config.json:
{
"reflect": {
"enabled": true,
"autoReflect": true,
"categories": [
"component-usage",
"api-patterns",
"testing",
"deployment",
"security",
"database"
]
}
}
| Level | Signal Type | Example | Action |
|---|---|---|---|
| High | Explicit correction | "No, use X instead of Y" | Auto-add to skill memory |
| High | Explicit rule | "Always do X" | Auto-add to skill memory |
| Medium | Approval/confirmation | "Perfect!" | Add with lower priority |
| Low | Observation | Pattern worked well | Queue for review |
When a learning doesn't match any skill, it goes to category memory:
| Category | Description | Triggers |
|---|---|---|
component-usage | UI component patterns | button, component, ui, style |
api-patterns | API design and endpoints | api, endpoint, route, rest |
database | Query patterns, schema | query, database, sql, schema |
testing | Test patterns and coverage | test, spec, coverage, mock |
deployment | Deploy commands and config | deploy, wrangler, vercel, ci |
security | Auth, validation, secrets | auth, security, validation |
structure | File/module organization | file, path, import, module |
general | Everything else | (fallback) |
Category memory location:
.specweave/memory/{category}.md~/.specweave/memory/{category}.mdWhen /sw:auto runs with reflection enabled:
1. Start auto session
↓
2. Claude executes tasks
↓
3. User makes corrections (if any)
↓
4. Session completes (all tasks done)
↓
5. Stop hook triggers
↓
6. Reflect analyzes transcript
↓
7. Skills auto-detected from learnings
↓
8. MEMORY.md files updated per skill
↓
9. Session ends with summary
import {
// Path resolution
getSkillsDirectory,
getSkillMemoryPath,
listSkills,
skillExists,
isClaudeCodeEnvironment,
// Memory operations
readMemoryFile,
writeMemoryFile,
addLearning,
mergeMemoryFiles,
// Reflection management
detectSkill,
processSignals,
reflectOnSkill,
getSkillLearnings,
getReflectionStats,
} from 'specweave/core/reflection';
// Add learning to a skill
reflectOnSkill('frontend', [
{ content: 'Use Button component from design system', type: 'correction' }
]);
// Get all learnings for a skill
const learnings = getSkillLearnings('frontend');
// Get stats across all skills
const stats = getReflectionStats();
console.log(`Total learnings: ${stats.totalLearnings}`);
Good corrections (high signal):
"Never use that approach. Always use X because..."
"Don't create custom components. We have a design system..."
"Wrong pattern. The correct way is..."
Weak corrections (low signal):
"Hmm, maybe try something else?"
"That doesn't look quite right"
Strong approval (captured):
"Perfect! That's exactly how we do it."
"This is the right pattern, well done."
"Yes, always follow this approach."
Neutral (not captured):
"OK"
"Sure"
"Proceed"
.specweave/memory/{category}.md~/.specweave/memory//sw:reflect-clear - Clear all learnings/sw:reflect-clear --skill frontend - Clear specific skill/sw:reflect-clear --learning LRN-XXX - Remove specific learning/sw:reflect-status# Claude Code
ls ~/.claude/plugins/marketplaces/specweave/plugins/specweave/skills/
# Non-Claude
ls .specweave/plugins/specweave/skills/
.specweave/logs/reflect/Force routing to specific skill:
/sw:reflect --skill frontend "Use Button component"
# View backup
ls ~/.claude/plugins/.../skills/frontend/.memory-backups/
# Restore from backup
cp ~/.claude/plugins/.../skills/frontend/.memory-backups/MEMORY-2026-01-05T10-30-00.md \
~/.claude/plugins/.../skills/frontend/MEMORY.md
If you have learnings in the old centralized format:
To manually migrate old learnings:
# View old centralized memory
cat .specweave/memory/component-usage.md
# Add to specific skill
/sw:reflect --skill frontend "Learning content from old file"
Reflect v4.0 enables correct once, apply everywhere:
No embeddings. No vector databases. Just markdown files that compound knowledge, organized by skill.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.