Skip to content

feat(evolve): add --skill flag for cross-project skill review - #672

Merged
baleen37 merged 3 commits into
mainfrom
witty-summit-kepler
Jun 1, 2026
Merged

feat(evolve): add --skill flag for cross-project skill review#672
baleen37 merged 3 commits into
mainfrom
witty-summit-kepler

Conversation

@baleen37

@baleen37 baleen37 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

/me:evolve could only review skills used in the current project + worktree siblings. Skills exercised mostly in other repos (e.g. research, used while exploring real codebases, not in this meta repo) never surfaced. This adds a --skill <name> mode that scans all projects, and fixes a stale-detection bug it exposed.

Changes

  • --skill <name> flag — scans the entire ~/.claude/projects/ tree for sessions that actually invoked the skill (by the Base directory for this skill: injection, not a bare path mention), capped to the most recent N, filtered to that skill. Cross-project, unlike --recent.
  • ARGUMENTS stale bugfix — when a slash command is invoked with arguments, the injected body gains a trailing ARGUMENTS: … block. That tail was hashed with the body, so an identical skill body was misjudged stale (dropped, events emptied) whenever called with args. stripBaseDirLine now strips it. This affected --recent too. (Verified: research went from dropped (stale), events=0 to stale:false, events=91.)
  • research SKILL.md — multi-session review surfaced one research-specific signal: a live backoffice URL bug where research ran but the user redirected to browser inspection. Added a Depth Selection row + Red Flag routing live UI/page bugs to me:browse first.
  • evolve Phase 1 guidance — added cross-skill target selection: a correction firing under skill X may expose a gap owned by a related skill Y; target the skill whose contract would have prevented it.

Tests

  • bats tests/me/evolve-build-index.bats — 33 passing (27 existing + 6 new: ARGUMENTS regression, --skill cross-project/filter/exit codes).

Summary by CodeRabbit

Release Notes

  • New Features

    • Added --skill <name> option to /me:evolve command for cross-project skill analysis with --recent filtering support.
  • Bug Fixes

    • Improved stale detection logic to prevent false positives when injected content or arguments differ.
  • Documentation

    • Enhanced /me:evolve command documentation with exit-code semantics and cross-skill targeting guidance.
    • Updated research skill documentation with best practices for live UI debugging.
  • Tests

    • Added comprehensive test coverage for new --skill mode and edge cases.

Test User added 3 commits June 1, 2026 12:55
`--recent` only scans the current project + worktree siblings, so skills
exercised mostly in other repos (e.g. `research`) never surface. `--skill
<name>` scans the entire ~/.claude/projects tree for sessions that actually
invoked the skill (by the `Base directory for this skill:` injection, not a
bare path mention), capped to the most recent N, filtered to that skill.

Also fixes a stale-detection bug this exposed: when a slash command is
invoked with arguments, the injected body gains a trailing `ARGUMENTS: …`
block. That tail was hashed along with the body, so an *identical* skill
body was misjudged stale (dropped, events emptied) whenever it had been
called with args. stripBaseDirLine now strips the ARGUMENTS tail too. This
affected `--recent` as well, not just `--skill`.

Tests: +6 (ARGUMENTS regression, --skill cross-project/filter/exit codes).
Multi-session review (--skill research) surfaced session 9277012e: research
was launched to investigate a frontend bug at a live backoffice URL, and the
user immediately interrupted with "mcp chrome 써봐" — wanting the running page
inspected, not the source read. Add a Depth Selection row routing live UI/page
bugs to `me:browse` before code, and a matching Red Flag.
A correction that fires while skill X is running may expose a gap that
belongs to a *related* skill Y (the one carrying the missing responsibility),
not X. Phase 1 now instructs the analyst to ask "which skill's contract would
have prevented this?" and target that skill — preferring to fix the owning
skill's trigger/body over special-casing the skill that merely happened to be
active. Resolve the related skill's own repo_path as the editable target.
@baleen37
baleen37 enabled auto-merge (squash) June 1, 2026 04:45
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4bcbe9fe-313d-483e-b1a7-a75385d43c9b

📥 Commits

Reviewing files that changed from the base of the PR and between 71ae569 and 098754c.

📒 Files selected for processing (4)
  • plugins/me/skills/evolve/SKILL.md
  • plugins/me/skills/evolve/scripts/build-index.ts
  • plugins/me/skills/research/SKILL.md
  • tests/me/evolve-build-index.bats

📝 Walkthrough

Walkthrough

The PR extends the /me:evolve build-index command to analyze a skill across all projects via --skill <name>, normalizes stale-detection hashing to ignore dynamically-appended transcript markers, and adds guidance to the research skill about inspecting live UIs before reading code.

Changes

Cross-project skill analysis and --recent normalization

Layer / File(s) Summary
Stale-detection hash normalization for --recent
plugins/me/skills/evolve/scripts/build-index.ts, plugins/me/skills/evolve/SKILL.md
The stripBaseDirLine function now removes both "Base directory for this skill:" lines and trailing ARGUMENTS: blocks from injected transcript bodies so that stale comparison ignores these dynamic additions. Documentation clarifies that normalized body-equivalence is used to determine staleness, decoupling it from argument presence or content.
Documentation for --skill mode and refined semantics
plugins/me/skills/evolve/SKILL.md
The SKILL.md documents the new --skill <name> flag for analyzing a skill across ~/.claude/projects, clarifies Phase 0 exit-code 2 to include invalid-argument cases (empty --skill, disallowed --dry-run), documents --recent/--session incompatibility, extends --skill behavior description (session identification, filtering, staleness), and adds "related SKILL.md (cross-skill)" targeting with updated "Nearest resolution" rules.
Helper functions for skill session discovery
plugins/me/skills/evolve/scripts/build-index.ts
New functions transcriptInvokesSkill and skillSessionPaths enable cross-project skill analysis: the former detects whether a transcript invokes a specific skill by pattern-matching "Base directory for this skill: …/skills/", and the latter scans ~/.claude/projects to collect and return the N most recently modified matching session paths.
Argument parsing and validation for --skill
plugins/me/skills/evolve/scripts/build-index.ts
The parseArgs function adds a --skill <name> parameter and validates that it is not combined with --session, not empty, and not used when no matching sessions exist (exit code 14). The main entry point branches on opts.skill: when set, it collects sessions via skillSessionPaths, builds an index with buildRecentIndex, and filters the output to include only the requested skill.
Test coverage for --skill and --recent features
tests/me/evolve-build-index.bats
Six new tests validate the features: one verifies that trailing ARGUMENTS: blocks in --recent mode are ignored for stale comparison, two test multi-project session collection and skill filtering when using --skill, and three verify exit codes for edge cases (no matching sessions return 14, empty --skill returns 2, and combining --skill with --session returns 2).

Research skill guidance refinement

Layer / File(s) Summary
Live UI inspection guidance for bug investigation
plugins/me/skills/research/SKILL.md
The research skill documentation adds an explicit recommendation to inspect the running UI/page (via me:browse) before reading source code when investigating live UI/page bugs, and flags the anti-pattern of reading code first when troubleshooting bugs at a live URL/UI.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • baleen37/bstack#664: Both PRs touch the /me:evolve implementation in plugins/me/skills/evolve/scripts/build-index.ts and SKILL.md, where #664 introduces the initial transcript-based evolution tool and this PR extends its --skill/--recent indexing and stale-hash logic.
  • baleen37/bstack#669: Both PRs update stale-hash normalization in build-index.ts for --recent/indexing workflows, with direct alignment on multi-session stale-detection handling and transcript body stripping logic.
  • baleen37/bstack#670: Both PRs modify build-index.ts's stale-detection and skill filtering flow; the main PR adds ARGUMENTS: stripping while the retrieved PR handles repo_path remapping and hash normalization in the same area.

Poem

🐰 Cross-project skills now bloom with care,
Stale transcripts stripped of markers fair,
A rabbit hops through projects wide,
Finding skills with --skill as guide,
And researchers browse live first—with flair!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch witty-summit-kepler

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@baleen37
baleen37 merged commit e214e29 into main Jun 1, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the witty-summit-kepler branch June 1, 2026 04:46
baleen-release-app Bot pushed a commit that referenced this pull request Jun 1, 2026
# [17.19.0](v17.18.1...v17.19.0) (2026-06-01)

### Features

* **evolve:** add --skill flag for cross-project skill review ([#672](#672)) ([e214e29](e214e29))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant