Skip to content

Commit dd11b7b

Browse files
0xranxclaude
andcommitted
Add self-improving skill to base-agent foundation layer
Lightweight persistent learning: when the agent gets corrected, hits unexpected failures, or discovers project patterns, it records learnings to .learnings/*.md files. Future sessions read these automatically. No hooks, no dependencies, no jsonl parsing — just a SKILL.md that teaches the agent to write and read markdown files. All briefs inherit this through base-agent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c9dee3c commit dd11b7b

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

  • briefs/base-agent/skills/self-improving
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: self-improving
3+
description: >
4+
Learn from corrections, mistakes, and discoveries during conversations.
5+
When the user corrects you, when something fails unexpectedly, or when
6+
you discover a project-specific pattern worth remembering — record it
7+
as a learning so future sessions benefit automatically.
8+
---
9+
10+
# Self-Improving
11+
12+
You have a persistent learning system. Use it to get smarter over time.
13+
14+
## When to Record a Learning
15+
16+
Record a learning when ANY of these happen:
17+
18+
1. **User corrects you** — "no, use X instead of Y", "don't do that", "that's wrong"
19+
2. **Something fails unexpectedly** — a build error, test failure, or runtime crash reveals a project-specific gotcha
20+
3. **You discover a non-obvious pattern** — the codebase has a convention that isn't documented anywhere
21+
4. **User expresses a preference** — "I prefer X", "always do Y in this project", "never use Z"
22+
23+
Do NOT record:
24+
- Generic programming knowledge (you already know this)
25+
- Things already documented in CLAUDE.md or project docs
26+
- Trivial one-time fixes
27+
28+
## How to Record
29+
30+
Create a markdown file in `.learnings/` at the project root:
31+
32+
```bash
33+
# File naming: YYYY-MM-DD-short-description.md
34+
.learnings/2026-03-20-use-pnpm-not-npm.md
35+
```
36+
37+
Each learning file follows this format:
38+
39+
```markdown
40+
# Use pnpm, not npm
41+
42+
**Context**: Ran `npm install` and got lockfile conflicts.
43+
**Correction**: This project uses pnpm exclusively. The `pnpm-lock.yaml` is the source of truth.
44+
**Rule**: Always use `pnpm` for install, add, and run commands. Never use `npm` or `yarn`.
45+
```
46+
47+
Keep it short — 3-5 lines. One learning per file.
48+
49+
## How to Read Learnings
50+
51+
At the start of every conversation, check if `.learnings/` exists. If it does, read all files in it before starting work. These are hard-won lessons from previous sessions — respect them.
52+
53+
```
54+
.learnings/
55+
├── 2026-03-18-api-auth-requires-bearer.md
56+
├── 2026-03-19-tests-need-env-setup.md
57+
└── 2026-03-20-use-pnpm-not-npm.md
58+
```
59+
60+
## Anti-patterns
61+
62+
- Don't create duplicate learnings — check existing files first
63+
- Don't record learnings that contradict CLAUDE.md — CLAUDE.md wins
64+
- Don't flood with trivial entries — quality over quantity
65+
- Don't modify existing learnings unless the user explicitly corrects one

0 commit comments

Comments
 (0)