opencastle 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/bin/cli.mjs +6 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +24 -2
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/agent-plugin.d.ts +119 -0
- package/dist/cli/agent-plugin.d.ts.map +1 -0
- package/dist/cli/agent-plugin.js +449 -0
- package/dist/cli/agent-plugin.js.map +1 -0
- package/dist/cli/agent-plugin.test.d.ts +2 -0
- package/dist/cli/agent-plugin.test.d.ts.map +1 -0
- package/dist/cli/agent-plugin.test.js +227 -0
- package/dist/cli/agent-plugin.test.js.map +1 -0
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +99 -26
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +2 -20
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +3 -111
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/copy.d.ts +0 -8
- package/dist/cli/copy.d.ts.map +1 -1
- package/dist/cli/copy.js +0 -21
- package/dist/cli/copy.js.map +1 -1
- package/dist/cli/dispatcher.test.js +2 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +2 -0
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +2 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.test.js +36 -24
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts +8 -0
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +130 -13
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/layers.test.js +2 -2
- package/dist/cli/layers.test.js.map +1 -1
- package/dist/cli/legacy-install.test.js +8 -1
- package/dist/cli/legacy-install.test.js.map +1 -1
- package/dist/cli/lesson-command.test.d.ts +2 -0
- package/dist/cli/lesson-command.test.d.ts.map +1 -0
- package/dist/cli/lesson-command.test.js +100 -0
- package/dist/cli/lesson-command.test.js.map +1 -0
- package/dist/cli/lesson.d.ts +0 -9
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +212 -276
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/lessons.d.ts +134 -0
- package/dist/cli/lessons.d.ts.map +1 -0
- package/dist/cli/lessons.js +493 -0
- package/dist/cli/lessons.js.map +1 -0
- package/dist/cli/lessons.test.d.ts +2 -0
- package/dist/cli/lessons.test.d.ts.map +1 -0
- package/dist/cli/lessons.test.js +214 -0
- package/dist/cli/lessons.test.js.map +1 -0
- package/dist/cli/pack-plugins.d.ts +8 -0
- package/dist/cli/pack-plugins.d.ts.map +1 -0
- package/dist/cli/pack-plugins.js +70 -0
- package/dist/cli/pack-plugins.js.map +1 -0
- package/dist/cli/plugin-command.test.d.ts +2 -0
- package/dist/cli/plugin-command.test.d.ts.map +1 -0
- package/dist/cli/plugin-command.test.js +114 -0
- package/dist/cli/plugin-command.test.js.map +1 -0
- package/dist/cli/plugin.d.ts +30 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +291 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/promote-command.test.d.ts +2 -0
- package/dist/cli/promote-command.test.d.ts.map +1 -0
- package/dist/cli/promote-command.test.js +151 -0
- package/dist/cli/promote-command.test.js.map +1 -0
- package/dist/cli/promote.d.ts +12 -0
- package/dist/cli/promote.d.ts.map +1 -0
- package/dist/cli/promote.js +364 -0
- package/dist/cli/promote.js.map +1 -0
- package/dist/cli/secret-scan.d.ts +21 -0
- package/dist/cli/secret-scan.d.ts.map +1 -0
- package/dist/cli/secret-scan.js +114 -0
- package/dist/cli/secret-scan.js.map +1 -0
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +9 -0
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/team-commands.test.js +2 -2
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +18 -0
- package/dist/cli/update.js.map +1 -1
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts +2 -0
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js +32 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js.map +1 -0
- package/package.json +2 -1
- package/src/cli/adapters/single-file-base.ts +23 -2
- package/src/cli/agent-plugin.test.ts +267 -0
- package/src/cli/agent-plugin.ts +469 -0
- package/src/cli/baseline.ts +99 -26
- package/src/cli/convoy/gates.ts +9 -142
- package/src/cli/copy.ts +0 -25
- package/src/cli/dispatcher.test.ts +2 -2
- package/src/cli/docs-accuracy.test.ts +2 -0
- package/src/cli/doctor.ts +2 -0
- package/src/cli/fixtures/lessons-template-1.0.md +70 -0
- package/src/cli/init.test.ts +37 -24
- package/src/cli/layers.test.ts +2 -2
- package/src/cli/layers.ts +144 -14
- package/src/cli/legacy-install.test.ts +11 -1
- package/src/cli/lesson-command.test.ts +117 -0
- package/src/cli/lesson.ts +215 -266
- package/src/cli/lessons.test.ts +254 -0
- package/src/cli/lessons.ts +540 -0
- package/src/cli/pack-plugins.ts +70 -0
- package/src/cli/plugin-command.test.ts +125 -0
- package/src/cli/plugin.ts +309 -0
- package/src/cli/promote-command.test.ts +170 -0
- package/src/cli/promote.ts +371 -0
- package/src/cli/secret-scan.ts +154 -0
- package/src/cli/sync-check.ts +9 -0
- package/src/cli/team-commands.test.ts +2 -2
- package/src/cli/update.ts +20 -0
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/researcher.agent.md +1 -1
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +10 -66
- package/src/orchestrator/customizations/README.md +2 -1
- package/src/orchestrator/customizations/logs/README.md +1 -1
- package/src/orchestrator/plugins/agent-plugins.test.ts +34 -0
- package/src/orchestrator/plugins/astro/mcp.json +9 -0
- package/src/orchestrator/plugins/astro/plugin.json +21 -0
- package/src/orchestrator/plugins/chrome-devtools/mcp.json +13 -0
- package/src/orchestrator/plugins/chrome-devtools/plugin.json +21 -0
- package/src/orchestrator/plugins/cloudflare/mcp.json +9 -0
- package/src/orchestrator/plugins/cloudflare/plugin.json +21 -0
- package/src/orchestrator/plugins/contentful/mcp.json +13 -0
- package/src/orchestrator/plugins/contentful/plugin.json +21 -0
- package/src/orchestrator/plugins/convex/mcp.json +15 -0
- package/src/orchestrator/plugins/convex/plugin.json +21 -0
- package/src/orchestrator/plugins/coolify/mcp.json +13 -0
- package/src/orchestrator/plugins/coolify/plugin.json +25 -0
- package/src/orchestrator/plugins/cypress/plugin.json +21 -0
- package/src/orchestrator/plugins/drizzle/plugin.json +21 -0
- package/src/orchestrator/plugins/expo/mcp.json +9 -0
- package/src/orchestrator/plugins/expo/plugin.json +21 -0
- package/src/orchestrator/plugins/figma/mcp.json +9 -0
- package/src/orchestrator/plugins/figma/plugin.json +21 -0
- package/src/orchestrator/plugins/hetzner/plugin.json +24 -0
- package/src/orchestrator/plugins/jira/mcp.json +9 -0
- package/src/orchestrator/plugins/jira/plugin.json +21 -0
- package/src/orchestrator/plugins/linear/mcp.json +9 -0
- package/src/orchestrator/plugins/linear/plugin.json +21 -0
- package/src/orchestrator/plugins/netlify/mcp.json +13 -0
- package/src/orchestrator/plugins/netlify/plugin.json +21 -0
- package/src/orchestrator/plugins/nextjs/mcp.json +13 -0
- package/src/orchestrator/plugins/nextjs/plugin.json +21 -0
- package/src/orchestrator/plugins/notion/mcp.json +9 -0
- package/src/orchestrator/plugins/notion/plugin.json +21 -0
- package/src/orchestrator/plugins/nx/mcp.json +14 -0
- package/src/orchestrator/plugins/nx/plugin.json +21 -0
- package/src/orchestrator/plugins/playwright/mcp.json +13 -0
- package/src/orchestrator/plugins/playwright/plugin.json +21 -0
- package/src/orchestrator/plugins/prisma/mcp.json +14 -0
- package/src/orchestrator/plugins/prisma/plugin.json +21 -0
- package/src/orchestrator/plugins/resend/mcp.json +13 -0
- package/src/orchestrator/plugins/resend/plugin.json +24 -0
- package/src/orchestrator/plugins/sanity/mcp.json +9 -0
- package/src/orchestrator/plugins/sanity/plugin.json +21 -0
- package/src/orchestrator/plugins/sentry/mcp.json +12 -0
- package/src/orchestrator/plugins/sentry/plugin.json +24 -0
- package/src/orchestrator/plugins/slack/mcp.json +13 -0
- package/src/orchestrator/plugins/slack/plugin.json +24 -0
- package/src/orchestrator/plugins/strapi/mcp.json +13 -0
- package/src/orchestrator/plugins/strapi/plugin.json +21 -0
- package/src/orchestrator/plugins/stripe/mcp.json +9 -0
- package/src/orchestrator/plugins/stripe/plugin.json +21 -0
- package/src/orchestrator/plugins/supabase/mcp.json +9 -0
- package/src/orchestrator/plugins/supabase/plugin.json +21 -0
- package/src/orchestrator/plugins/teams/plugin.json +24 -0
- package/src/orchestrator/plugins/trello/mcp.json +13 -0
- package/src/orchestrator/plugins/trello/plugin.json +25 -0
- package/src/orchestrator/plugins/turborepo/plugin.json +21 -0
- package/src/orchestrator/plugins/vercel/mcp.json +9 -0
- package/src/orchestrator/plugins/vercel/plugin.json +21 -0
- package/src/orchestrator/plugins/vitest/plugin.json +21 -0
- package/src/orchestrator/skill-config-links.test.ts +2 -1
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
- package/src/orchestrator/skills/memory-merger/SKILL.md +17 -21
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +44 -23
- package/src/orchestrator/skills/self-improvement/SKILL.md +30 -15
- /package/src/orchestrator/plugins/astro/{SKILL.md → skills/astro-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/chrome-devtools/{SKILL.md → skills/browser-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cloudflare/{SKILL.md → skills/cloudflare-platform/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/contentful/{SKILL.md → skills/contentful-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/convex/{SKILL.md → skills/convex-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/coolify/{SKILL.md → skills/coolify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cypress/{SKILL.md → skills/cypress-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/drizzle/{SKILL.md → skills/drizzle-orm/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/expo/{SKILL.md → skills/expo-development/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/figma/{SKILL.md → skills/figma-design/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/hetzner/{SKILL.md → skills/hetzner-cloud/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/jira/{SKILL.md → skills/jira-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/linear/{SKILL.md → skills/linear-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/netlify/{SKILL.md → skills/netlify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nextjs/{SKILL.md → skills/nextjs-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/notion/{SKILL.md → skills/notion-knowledge-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nx/{SKILL.md → skills/nx-workspace/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/playwright/{SKILL.md → skills/playwright-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/prisma/{SKILL.md → skills/prisma-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/resend/{SKILL.md → skills/resend-email/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sanity/{SKILL.md → skills/sanity-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sentry/{SKILL.md → skills/sentry-monitoring/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/slack/{SKILL.md → skills/slack-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/strapi/{SKILL.md → skills/strapi-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/stripe/{SKILL.md → skills/stripe-payments/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/supabase/{SKILL.md → skills/supabase-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/teams/{SKILL.md → skills/teams-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/trello/{SKILL.md → skills/trello-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/turborepo/{SKILL.md → skills/turborepo-monorepo/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vercel/{SKILL.md → skills/vercel-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vitest/{SKILL.md → skills/vitest-testing/SKILL.md} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory-merger
|
|
3
|
-
description: "Reviews mature
|
|
3
|
+
description: "Reviews mature lessons in .opencastle/lessons/, rewrites them as permanent rules in skill/instruction files, archives graduated lessons with opencastle lesson archive. Use when graduating lessons into skills, promoting validated lessons, updating skills from past learnings, archiving mature lessons, codifying repeated patterns, or cleaning up a crowded lessons index."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Memory Merger
|
|
@@ -12,8 +12,8 @@ Combined signals to identify merge candidates.
|
|
|
12
12
|
|
|
13
13
|
| Criterion | Signal / Threshold |
|
|
14
14
|
|-----------|--------------------|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
15
|
+
| Volume | More than 50 lessons in `.opencastle/lessons/` |
|
|
16
|
+
| Reference count | Referenced 3+ times across sessions |
|
|
17
17
|
| Age | >60 days and still relevant |
|
|
18
18
|
| Category cluster | 5+ lessons in same category |
|
|
19
19
|
| Severity | Marked `high` or blocking |
|
|
@@ -21,19 +21,19 @@ Combined signals to identify merge candidates.
|
|
|
21
21
|
|
|
22
22
|
## Workflow (numbered)
|
|
23
23
|
|
|
24
|
-
1. Scan
|
|
24
|
+
1. Scan `.opencastle/lessons/` for candidate lessons (frequency, severity, age — `added:` in each file).
|
|
25
25
|
2. Map each candidate to target file, section.
|
|
26
26
|
3. Draft exact edit (concise rule or example).
|
|
27
27
|
4. Apply edit with attribution comment.
|
|
28
|
-
5. Archive
|
|
29
|
-
6.
|
|
28
|
+
5. Archive the lesson with `opencastle lesson archive`.
|
|
29
|
+
6. Run validation checks.
|
|
30
30
|
|
|
31
31
|
## Merge Protocol
|
|
32
32
|
|
|
33
33
|
### 3 — Draft Edit
|
|
34
34
|
|
|
35
35
|
```
|
|
36
|
-
Lesson:
|
|
36
|
+
Lesson: <id> — [title]
|
|
37
37
|
Target: [file path]
|
|
38
38
|
Section: [section name]
|
|
39
39
|
Edit: [exact text]
|
|
@@ -42,30 +42,26 @@ Strategies: add rule, add anti-pattern, add code example, expand existing rule,
|
|
|
42
42
|
|
|
43
43
|
### 4 — Apply & Attribute
|
|
44
44
|
|
|
45
|
-
Edit target file; add `<!-- Merged from
|
|
45
|
+
Edit target file; add `<!-- Merged from <id> -->` attribution inline.
|
|
46
46
|
|
|
47
47
|
### 5 — Archive
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```markdown
|
|
52
|
-
### LES-XXX: [title] → Merged to `[target]` on YYYY-MM-DD
|
|
49
|
+
```sh
|
|
50
|
+
opencastle lesson archive <id> --into <target file>
|
|
53
51
|
```
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
The lesson keeps its file, is marked archived with where it went, and moves to the index's **Archived** section — out of the list agents read before work. Never edit `LESSONS-LEARNED.md` by hand: it is rewritten from the lesson files.
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Update `## Index by Category` in `LESSONS-LEARNED.md` to mark archived lessons.
|
|
55
|
+
**Never delete lessons** — archive for traceability.
|
|
60
56
|
|
|
61
57
|
### Automating the scan
|
|
62
58
|
|
|
63
59
|
```sh
|
|
64
|
-
#
|
|
65
|
-
rg -
|
|
60
|
+
# Lessons referenced 3+ times across sessions (ids are LES-NNN or YYYY-MM-DD-title)
|
|
61
|
+
rg -o '"lessons_added":\[[^]]*\]' .opencastle/logs/events.ndjson | rg -o '"[A-Za-z0-9-]+"' | sort | uniq -c | awk '$1 >= 3'
|
|
66
62
|
|
|
67
|
-
#
|
|
68
|
-
rg
|
|
63
|
+
# Oldest lessons first — candidates once past 60 days
|
|
64
|
+
rg -H '^added:' .opencastle/lessons/ | sort -t'"' -k2 | head -20
|
|
69
65
|
```
|
|
70
66
|
|
|
71
67
|
## Quality Gates (validation checkpoints)
|
|
@@ -77,7 +73,7 @@ rg "retry.*LES-[0-9]+" .opencastle/logs/events.ndjson | rg -o "LES-[0-9]+" | sor
|
|
|
77
73
|
|
|
78
74
|
## Anti-Patterns
|
|
79
75
|
|
|
80
|
-
- Merge too eagerly — must meet 3+
|
|
76
|
+
- Merge too eagerly — must meet 3+ references or 60+ day threshold
|
|
81
77
|
- Copy verbatim — rewrite as rules/guidelines, not incident reports
|
|
82
78
|
- Merge conflicting lessons — resolve conflict first
|
|
83
79
|
- Create new files for merged content — merge INTO existing files only
|
|
@@ -2,35 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Lesson Categories & Severity
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The values `opencastle lesson` accepts. Anything else is refused.
|
|
6
6
|
|
|
7
7
|
## Categories
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
9
|
+
| `--category` | When to use |
|
|
10
|
+
|--------------|-------------|
|
|
11
|
+
| `task-management` | Issue trackers, task status, boards |
|
|
12
|
+
| `jira` | Jira specifically: fields, transitions, JQL |
|
|
13
|
+
| `mcp-tools` | An MCP server's tools, parameters or quirks |
|
|
14
|
+
| `codebase-tool` | Search, refactoring and code-intelligence tools |
|
|
15
|
+
| `terminal` | Shell, quoting, CLI flags, environment |
|
|
16
|
+
| `framework` | The app framework and its build |
|
|
17
|
+
| `cms` | Content models, queries, publishing |
|
|
18
|
+
| `database` | Migrations, policies, queries |
|
|
19
|
+
| `git` | Branches, history, merges, hooks |
|
|
20
|
+
| `deployment` | Hosting, environment variables, caching, rollback |
|
|
21
|
+
| `browser-testing` | Browser automation, screenshots, breakpoints |
|
|
22
|
+
| `general` | Workflow, delegation, review — anything above does not cover |
|
|
21
23
|
|
|
22
24
|
## Severity
|
|
23
25
|
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `low` | Nice-to-know; minor efficiency improvement |
|
|
26
|
+
| `--severity` | Criteria |
|
|
27
|
+
|--------------|----------|
|
|
28
|
+
| `high` | Blocks a task, loses data, or causes significant rework |
|
|
29
|
+
| `medium` | Wastes five minutes or more |
|
|
30
|
+
| `low` | Nice to know; minor efficiency improvement |
|
|
30
31
|
|
|
31
|
-
##
|
|
32
|
+
## What a lesson file looks like
|
|
32
33
|
|
|
34
|
+
`opencastle lesson` writes `.opencastle/lessons/<id>.md`:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
---
|
|
38
|
+
id: "2026-10-02-always-quote-shell-variables"
|
|
39
|
+
title: "Always quote shell variables"
|
|
40
|
+
category: "terminal"
|
|
41
|
+
severity: "medium"
|
|
42
|
+
added: "2026-10-02"
|
|
43
|
+
citations:
|
|
44
|
+
- "scripts/clean.sh:12"
|
|
45
|
+
verified: "2026-10-02"
|
|
46
|
+
fingerprints:
|
|
47
|
+
scripts/clean.sh: "3f2a9c1b7d4e"
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
**Problem:** Unquoted variables break on paths with spaces.
|
|
51
|
+
|
|
52
|
+
**Wrong approach:** `rm -rf $DIR/old`
|
|
53
|
+
|
|
54
|
+
**Correct approach:** `rm -rf "$DIR/old"`
|
|
33
55
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
56
|
+
|
|
57
|
+
Lessons recorded before this format keep their `LES-NNN` ids.
|
|
@@ -1,56 +1,71 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: self-improvement
|
|
3
|
-
description: "
|
|
3
|
+
description: "Records lessons with the opencastle lesson CLI, one file each in .opencastle/lessons/; searches past lessons for matching errors; re-verifies lessons whose cited code changed; proposes skill updates when retry patterns exceed thresholds. Use when consulting or updating lessons, after task failures, when capturing retrospective insights, when a retry succeeds, or when doctor reports a lesson's citation changed."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Self-Improvement Protocol
|
|
7
7
|
|
|
8
8
|
## Core Rule
|
|
9
9
|
|
|
10
|
-
**Retry with different approach and it works →
|
|
10
|
+
**Retry with different approach and it works → record a lesson immediately.** Lessons live in `.opencastle/lessons/`, one Markdown file each; `.opencastle/LESSONS-LEARNED.md` is the index of them every agent reads first.
|
|
11
11
|
|
|
12
12
|
## Writing a Lesson
|
|
13
13
|
|
|
14
|
-
> **⛔ HARD GATE — Use the CLI.
|
|
14
|
+
> **⛔ HARD GATE — Use the CLI. Never write in `LESSONS-LEARNED.md`: it is rewritten from `lessons/` by every sync.**
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
opencastle lesson --title "Short descriptive title" --category general --severity high \
|
|
18
18
|
--problem "What was observed" --wrong "Failing approach" --correct "Working solution" \
|
|
19
|
-
--why "Root cause"
|
|
19
|
+
--why "Root cause" --cite src/lib/payments.ts:42
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Required: `--title`, `--category`, `--severity`, `--problem` · Optional: `--wrong`, `--correct`, `--why`
|
|
22
|
+
Required: `--title`, `--category`, `--severity`, `--problem` · Optional: `--wrong`, `--correct`, `--why`, `--cite` (repeatable)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
`--cite` names the code the lesson is about, relative to the project root. When that code changes, `doctor` says the lesson may no longer hold — cite whenever the lesson is about a specific file.
|
|
25
|
+
|
|
26
|
+
The command prints the new lesson's id (`2026-10-02-short-descriptive-title`). It refuses a lesson that would commit a credential, and a citation that does not exist.
|
|
27
|
+
|
|
28
|
+
After writing: if the lesson reveals a gap in a skill or instruction file, update that file too (prevents the pitfall at source).
|
|
25
29
|
|
|
26
30
|
## Workflow
|
|
27
31
|
|
|
28
|
-
1. Search
|
|
32
|
+
1. Search past lessons for matching entries or similar errors (below).
|
|
29
33
|
2. Attempt task with conservative flags/options informed by lessons.
|
|
30
34
|
3. On failure: retry with modified approach (up to threshold); capture error details, context.
|
|
31
|
-
4. On success: run `opencastle lesson` to record working approach.
|
|
32
|
-
5. Verify:
|
|
33
|
-
6. If lesson indicates needed skill/instruction update: draft change; propose a PR.
|
|
35
|
+
4. On success: run `opencastle lesson` to record the working approach.
|
|
36
|
+
5. Verify: the command printed an id, and `.opencastle/lessons/<id>.md` holds the title, category and severity you gave. If malformed → fix the flags and run it again, then delete the bad file.
|
|
37
|
+
6. If the lesson indicates a needed skill/instruction update: draft the change; propose a PR.
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
Search the lessons themselves, not the index — the index has titles only:
|
|
36
40
|
|
|
37
41
|
```bash
|
|
38
|
-
rg "
|
|
42
|
+
rg -i "CRON_SECRET" .opencastle/lessons/ || true
|
|
39
43
|
```
|
|
40
44
|
|
|
45
|
+
## When code a lesson cites has changed
|
|
46
|
+
|
|
47
|
+
`doctor` names it: `<id> cites <file>, which has changed since it was verified`. Read the lesson against the code now:
|
|
48
|
+
|
|
49
|
+
| Still true? | Run |
|
|
50
|
+
|-------------|-----|
|
|
51
|
+
| Yes, file unchanged in substance | `opencastle lesson verify <id>` |
|
|
52
|
+
| Yes, but the code moved | `opencastle lesson verify <id> --cite <new/path.ts>` |
|
|
53
|
+
| No longer applies | `opencastle lesson archive <id> --into <file that now covers it>` |
|
|
54
|
+
|
|
41
55
|
## Categories & Severity
|
|
42
56
|
|
|
43
|
-
Valid `--category` and `--severity` values
|
|
57
|
+
Valid `--category` and `--severity` values: [LESSON-CATEGORIES.md](LESSON-CATEGORIES.md).
|
|
44
58
|
|
|
45
59
|
## Quality Rules
|
|
46
60
|
|
|
47
61
|
- Include exact error messages, commands, tool parameters
|
|
48
62
|
- Always fill both `--wrong` and `--correct` — the contrast is what makes the lesson usable
|
|
49
|
-
- One lesson per
|
|
63
|
+
- One lesson per command; code blocks mandatory for commands
|
|
64
|
+
- Never paste a token, key or password — describe it ("the Stripe test key in `.env`")
|
|
50
65
|
|
|
51
66
|
## Anti-Patterns
|
|
52
67
|
|
|
53
|
-
Never duplicate an existing lesson · Never defer
|
|
68
|
+
Never duplicate an existing lesson · Never defer recording to end of session · Never edit `LESSONS-LEARNED.md` by hand
|
|
54
69
|
|
|
55
70
|
## Agent Memory
|
|
56
71
|
|
|
File without changes
|
/package/src/orchestrator/plugins/chrome-devtools/{SKILL.md → skills/browser-testing/SKILL.md}
RENAMED
|
File without changes
|
/package/src/orchestrator/plugins/cloudflare/{SKILL.md → skills/cloudflare-platform/SKILL.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/orchestrator/plugins/linear/{SKILL.md → skills/linear-task-management/SKILL.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/orchestrator/plugins/notion/{SKILL.md → skills/notion-knowledge-management/SKILL.md}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/orchestrator/plugins/playwright/{SKILL.md → skills/playwright-testing/SKILL.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/orchestrator/plugins/trello/{SKILL.md → skills/trello-task-management/SKILL.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|