feat: add /coding:self-improve command#64
Merged
Merged
Conversation
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 ranked proposals, routed 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).
There was a problem hiding this comment.
PR Review Report
PR: feat: add /coding:self-improve command (#64)
Branch: feature/self-improve → master
Diff: 3 files, +99 lines
Selector Mode Traceability
- Candidates: 9 rules matched by Step 4b-i glob filter
- Applicable: 5 rules selected by Step 4c-sel
- Skipped:
changelog/conventional-prefix-required→ bullet uses validfeat:prefixchangelog/preamble-frozen→## Unreleasedplaced after preamble, not inside itreadme/user-facing-not-agent-context→ single terse operational line, not user-facing duplicationagent-cmd/scripts-in-claude-dir→ no scripts used
Ast-grep funnel: Toolchain unavailable — ast-grep present at /usr/bin/ast-grep, but /tmp/pr-review-findings.json could not be written (worktree access restriction). Step 4a skipped.
Must Fix (Critical)
None — no security vulnerabilities, no concurrency bugs, no context violations in the diff.
Should Fix (Important)
-
agent-cmd/command-frontmatter(MUST) — Missing required frontmatter fieldscommands/self-improve.md:1-2- The frontmatter has
descriptionbut is missingallowed-toolsandargument-hint, which are required perdocs/agent-command-development-guide.md§Required frontmatter. - Fix: Add
allowed-tools(listing the tools the command may invoke) andargument-hint(e.g.,""for a no-arg command).
-
agent-cmd/command-thin(MUST) — Inline analysis logic in command bodycommands/self-improve.md- The command does substantive Phase 1 analysis (steps 1–6: session review, repetition detection, keep-forever test, routing logic) rather than delegating to an agent. Per the guide: "Business logic: None" belongs in the agent, not the command.
- Acknowledged: The command documents why inline is necessary ("sub-agent runs in a fresh context that cannot see this session"), but the business logic is still present. Consider extracting the analysis into
agents/self-improve-assistant.mdand having the command invoke it, or explicitly documenting this as a documented exception to the rule with a<!-- @exception -->marker.
-
agent-cmd/gap-driven-feedback(SHOULD) — No gap reportingcommands/self-improve.md- The command depends on external documentation (CLAUDE.md, agents, skills, commands) that may be incomplete, but does not surface gaps as feedback to the user. Per the rule, incomplete documentation should produce a gap report pointing to the missing source.
- Fix: If any referenced artifact (e.g., a skill path, an agent name) is not found during Phase 1, include a "
⚠️ DOCUMENTATION GAPS" section in the output.
Nice to Have (Optional)
agent-cmd/no-user-prompts(MUST) — Phase 2 approval gatecommands/self-improve.mdPhase 2- Phase 2 says "On approval:" and waits for the user to select proposals before editing. This technically triggers the no-user-prompts rule.
- Context: This is the Pattern 2 "Analyze + apply" shape from the guide (§Command structure templates), which explicitly includes "Ask for confirmation before commit." The two-phase design (report then apply) and the "at most two proposals" cap provide meaningful blast-radius control. This is an intentional pattern, not an oversight.
- Recommendation: Accept as-is given the architectural justification, or add
<!-- @exception: two-phase design requires approval gate -->if the audit rule is strict.
Concerns from Plan
| Concern | Status |
|---|---|
| security: blast radius of proposed changes scoped | Addressed — command limits to "at most two" proposals, edits are smallest-change, Phase 2 is explicit-approval-only |
| security: two-phase design validates proposals before execution | Addressed — Phase 1 is read-only; Phase 2 requires explicit user selection before any edit |
| correctness: "stays inline" cannot be delegated | Addressed — command explicitly prevents delegation ("do not delegate it to an agent") |
| correctness: "at most two" and "nothing worth keeping" default enforced | Addressed — explicitly stated in command documentation |
{
"verdict": "request-changes",
"summary": "The self-improve command is well-scoped with solid blast-radius controls (two-phase, at-most-two cap, inline-only), but has two must-fix violations: missing required frontmatter fields (allowed-tools, argument-hint) and inline analysis logic that should live in an agent per the command-agent separation principle.",
"comments": [
{
"file": "commands/self-improve.md",
"line": 1,
"severity": "critical",
"message": "agent-cmd/command-frontmatter (MUST): Missing required frontmatter fields `allowed-tools` and `argument-hint`. Only `description` is present. Add both per docs/agent-command-development-guide.md §Required frontmatter."
},
{
"file": "commands/self-improve.md",
"line": 1,
"severity": "major",
"message": "agent-cmd/command-thin (MUST): Command body contains substantive Phase 1 analysis logic (session review, repetition detection, keep-forever test, routing) rather than delegating to an agent. Per the guide: 'Business logic: None' belongs in the agent. The inline justification is documented but the logic is still present. Consider extracting to agents/self-improve-assistant.md or adding an explicit exception marker."
},
{
"file": "commands/self-improve.md",
"line": 1,
"severity": "major",
"message": "agent-cmd/gap-driven-feedback (SHOULD): Command depends on external artifacts (CLAUDE.md, agents, skills, commands) that may be incomplete but does not report gaps. If a referenced artifact is not found, include a '⚠️ DOCUMENTATION GAPS' section pointing to the missing source per the rule's feedback loop pattern."
},
{
"file": "commands/self-improve.md",
"line": 67,
"severity": "nit",
"message": "agent-cmd/no-user-prompts (MUST): Phase 2 says 'On approval:' and waits for user selection before editing, which technically triggers the no-user-prompts rule. Context: this is the Pattern 2 'Analyze + apply' shape from the guide which explicitly includes a confirmation gate. The two-phase design and at-most-two cap provide meaningful blast-radius control. Consider adding an exception marker if accepting as-is."
}
],
"concerns_addressed": [
"security: blast radius of proposed changes scoped — addressed by 'at most two' cap and explicit Phase 2 approval",
"security: two-phase design validates proposals before execution — Phase 1 is read-only; Phase 2 requires explicit selection",
"correctness: 'stays inline' cannot be delegated — explicitly documented in command",
"correctness: 'at most two' and 'nothing worth keeping' default enforced — explicitly documented"
]
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
/coding:self-improve— an inline, session-scoped command that reviews the current conversation and proposes at most two durable, evidence-backed improvements to the Claude Code environment (memory/CLAUDE.mdrules, commands, agents, skills).Design
Nothing worth keeping this session.— optimizes for one or two keepers, not idea volume.Files
commands/self-improve.md— the command (self-contained; no personal paths)README.md— commands table rowCHANGELOG.md—## Unreleasedfeat bulletSibling to the
audit-*commands, on the friction-removal side.