Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Commit b59aec6

Browse files
authored
feat: add /learn command to extract session learnings to scoped AGENTS.md files (anomalyco#10717)
1 parent d9e8b2b commit b59aec6

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.opencode/command/learn.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
description: Extract non-obvious learnings from session to AGENTS.md files to build codebase understanding
3+
---
4+
5+
Analyze this session and extract non-obvious learnings to add to AGENTS.md files.
6+
7+
AGENTS.md files can exist at any directory level, not just the project root. When an agent reads a file, any AGENTS.md in parent directories are automatically loaded into the context of the tool read. Place learnings as close to the relevant code as possible:
8+
9+
- Project-wide learnings → root AGENTS.md
10+
- Package/module-specific → packages/foo/AGENTS.md
11+
- Feature-specific → src/auth/AGENTS.md
12+
13+
What counts as a learning (non-obvious discoveries only):
14+
15+
- Hidden relationships between files or modules
16+
- Execution paths that differ from how code appears
17+
- Non-obvious configuration, env vars, or flags
18+
- Debugging breakthroughs when error messages were misleading
19+
- API/tool quirks and workarounds
20+
- Build/test commands not in README
21+
- Architectural decisions and constraints
22+
- Files that must change together
23+
24+
What NOT to include:
25+
26+
- Obvious facts from documentation
27+
- Standard language/framework behavior
28+
- Things already in an AGENTS.md
29+
- Verbose explanations
30+
- Session-specific details
31+
32+
Process:
33+
34+
1. Review session for discoveries, errors that took multiple attempts, unexpected connections
35+
2. Determine scope - what directory does each learning apply to?
36+
3. Read existing AGENTS.md files at relevant levels
37+
4. Create or update AGENTS.md at the appropriate level
38+
5. Keep entries to 1-3 lines per insight
39+
40+
After updating, summarize which AGENTS.md files were created/updated and how many learnings per file.
41+
42+
$ARGUMENTS

0 commit comments

Comments
 (0)