diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af1710..16f1ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Please choose versions by [Semantic Versioning](http://semver.org/). * MINOR version when you add functionality in a backwards-compatible manner, and * PATCH version when you make backwards-compatible bug fixes. +## Unreleased + +- **feat: add `/coding:self-improve` command** — reviews the current session and proposes at most two durable, evidence-backed improvements to the Claude Code environment (memory/`CLAUDE.md` rules, commands, agents, skills). Two-phase: Report (read-only, ≤2 proposals ranked, routes each by scope) → Apply (only after explicit approval). Default outcome is "nothing worth keeping this session." Stays inline (analyzes the parent conversation; cannot be delegated to a sub-agent). Sibling to the audit-* commands, on the friction-removal side. + ## v0.27.0 - **feat: add factory rule `go-factory/main-holds-only-boot-lifecycle-config` (SHOULD)** to `docs/go-factory-pattern.md`. New §11 "The main.go / factory boundary" states the complementary positive rule to §6.2/§8: `main.go Run` keeps only boot errors, lifecycle (`defer`), and config branching — every pure-composition value (including `run.Func` server/consumer wiring) belongs in a factory. Adds the "pass-through test", tightens §4.3 ("no additional logic" limits statement *kind*, not *count* — multi-statement router wiring is fine), fixes the §8 example which previously modeled router assembly in main, and adds a Summary bullet. Regenerates `rules/index.json` (judgment-tier, trigger `**/main.go`) and surfaces the rule in `go-factory-pattern-assistant`. diff --git a/README.md b/README.md index c35a69f..09d3f5f 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Commit with changelog and version bump: | `/coding:audit-agent [file]` | Audit agent against Agent & Command Development Guide | | `/coding:audit-skill [path]` | Audit skill directory against Claude Code Skill Writing Guide | | `/coding:audit-slash-command [file]` | Audit slash command against Agent & Command Development Guide | +| `/coding:self-improve` | Review THIS session; propose ≤2 durable improvements to memory/commands/agents/skills (inline, two-phase) | | `/coding:vscode [dir]` | Open VS Code in directory | | `/coding:intellij [dir]` | Open IntelliJ IDEA in directory | diff --git a/commands/self-improve.md b/commands/self-improve.md new file mode 100644 index 0000000..6990ff7 --- /dev/null +++ b/commands/self-improve.md @@ -0,0 +1,94 @@ +--- +description: Review THIS session and propose at most two durable improvements to the Claude Code environment (memory/CLAUDE.md rules, commands, agents, skills). Default outcome is "nothing worth keeping." +--- + +# Self Improve + +You tune the environment, not the project. This session is the evidence. + +**This command must stay inline** — it analyzes the parent conversation, and a +sub-agent runs in a fresh context that cannot see this session. Do not delegate +it to an agent. + +Your output is almost always **zero or one** change. Two is the ceiling. A run +that concludes "nothing worth keeping this session" is a success. + +The environment accretes commands, agents, and rules over time. Every new +artifact costs maintenance forever. Adding one is the expensive move — justify +it or don't. + +--- + +## Phase 1 — Report (read-only) + +### 1. What ran +List the skills, slash commands, and agents actually used this session. Note +which caused friction (retries, wrong output, needed correction). + +### 2. Find repetition or cost +Scan the transcript for: +- the same instruction given 2+ times (this session or clearly a habit) +- a correction the user made that was general, not one-off +- a preventable mistake that cost real back-and-forth +- a workflow reinvented from scratch that a tool already half-covers + +Ignore anything that happened once with no cost. One-offs never graduate. + +### 3. Keep-forever test +For each candidate, both must hold or discard it: +- **Recurrence:** plausibly recurs in 3+ future sessions? +- **Evidence:** you can cite a verbatim quote + where it happened. + +Discard silently: one-offs, "nice to have," anything you can't quote. + +### 4. Prefer editing over creating +Does an existing rule / command / agent / skill almost cover this? If yes, +propose a small edit to it. Only propose a NEW artifact when nothing existing +is close. + +### 5. Route the fix by scope +| The fix is a… | It belongs in… | +|---|---| +| Global preference / habit | your global Claude memory (global `CLAUDE.md`) | +| Project convention | that project's `CLAUDE.md` | +| The exact same prompt, retyped | a slash command | +| An independent responsibility | an agent | +| Reusable multi-step capability with scripts/state | a skill | + +### 6. Output +Short. Max two proposals, ranked. + +**Session in one line:** + +Per proposal: +- **Change:** what, and where (exact target file / artifact) +- **Evidence:** verbatim quote(s) + how often +- **Edit or new:** if new, why nothing existing fit +- **Diff sketch:** the concrete line(s) to add or change + +Then **Rejected** — one line each for dropped candidates and why. + +If nothing clears the bar, say exactly: "Nothing worth keeping this session." Stop. + +--- + +## Phase 2 — Apply (only after explicit approval) + +Do NOT edit in Phase 1. Wait for the user to pick which proposals to accept. + +On approval: +1. Read the target file before editing. +2. Smallest change that captures the rule. No prose bloat. +3. Memory/CLAUDE.md rules: match the existing terse, imperative bullet style. +4. Report what changed, one line per file. + +Never edit beyond the approved proposals. Never expand scope while applying. + +--- + +## Principles +- Default to zero. Two is the ceiling. +- Edit existing before creating new. +- No quote, no proposal. +- Fix the cause (missing rule/tool), not the symptom (one bad turn). +- Every permanent rule you add, someone maintains forever.