Skip to content

feat(evolve): tailor --recent for worktree workflows (merge sessions, repo_path, signal) - #670

Merged
baleen37 merged 21 commits into
mainfrom
lucky-voyage-lovelace
May 31, 2026
Merged

feat(evolve): tailor --recent for worktree workflows (merge sessions, repo_path, signal)#670
baleen37 merged 21 commits into
mainfrom
lucky-voyage-lovelace

Conversation

@baleen37

@baleen37 baleen37 commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

PR #669로 추가한 evolve --recent 멀티세션 검토를, 사용자의 실제 케이스(worktree 워크플로우)에 맞게 단순·범용적으로 개선하는 후속 작업입니다. evolve를 실제로 돌려 데이터에서 문제를 발견 → 가장 단순한 해법 → TDD/검증 사이클로 진행했습니다.

Changes

  • worktree 세션 병합: --recent가 cwd 디렉터리 하나가 아니라 <base> + 모든 <base>--worktrees-* 형제 transcript 디렉터리를 합쳐 세션을 모은다. bstack처럼 worktree마다 transcript가 쪼개지는 환경에서 "최근 여러 세션"이 worktree당 1개로 무력화되던 문제 해결 (실측 1→6 세션).
  • 캐시→repo_path 매핑: transcript가 skill을 캐시 경로로 기록해도, cwd repo의 plugins/*/skills/<name>/SKILL.md를 찾아 편집 가능한 repo_path로 제공하고 stale 비교도 그 본문 우선. 자기 repo skill을 upstream으로 보내지 않고 직접 고칠 수 있게 됨.
  • per-skill signal 요약 + 밀도순 정렬: 각 skill에 kind별 카운트 한 줄(interrupt/error/repeat 우선)을 더하고 개선 신호 밀도순 정렬 → LLM이 events 전부 안 읽고 어디부터 볼지 판단.
  • <task-notification> 노이즈 필터: 하네스 주입 Monitor/Task 알림을 user 이벤트에서 제외 (실측 user 이벤트 224→164).
  • 공유 세션 중복 집계 caveat, exit 2 설명 등 문서 보강.

Tests

  • BATS 27/27 통과 (worktree 병합/signal/repo_path/task-notification 테스트 추가, TDD)
  • code review Ready (Critical/Important 0), end-to-end 검증에서 실제 제안 1건 도출 + 공유 세션 신호 정확 구분
  • 단일세션 출력은 형태·키 불변 (하위 호환)

Summary by CodeRabbit

  • New Features

    • Added multi-session and worktree support for recent skill indexing across directory siblings.
    • Improved skill ranking based on improvement signal metrics (interrupts, errors, repeats).
  • Bug Fixes

    • Enhanced staleness detection with accurate hash comparison of skill documentation.
    • Filtered task notifications from user event tracking.
  • Tests

    • Added comprehensive test coverage for recent skill indexing scenarios.

Test User added 21 commits May 31, 2026 15:25
# Conflicts:
#	plugins/me/skills/evolve/SKILL.md
#	plugins/me/skills/evolve/scripts/build-index.ts
#	tests/me/evolve-build-index.bats
@baleen37
baleen37 enabled auto-merge (squash) May 31, 2026 09:38
@coderabbitai

coderabbitai Bot commented May 31, 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: 8f107713-7464-4ae3-9c1e-e6490eb3440b

📥 Commits

Reviewing files that changed from the base of the PR and between 323fa29 and d9f658c.

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

📝 Walkthrough

Walkthrough

The /me:evolve skill indexer is enhanced to aggregate skill indexing across multiple sessions in worktree directories, resolve editable repo skill paths, compute weighted improvement signals for prioritization, and filter task-notification pseudo-users from event streams.

Changes

Multi-session indexing enhancement

Layer / File(s) Summary
RecentSkill contract expansion with pseudo-user filtering
plugins/me/skills/evolve/scripts/build-index.ts, tests/me/evolve-build-index.bats
RecentSkill interface gains skill_path, optional repo_path, and signal fields. PSEUDO_USER_PREFIXES adds <task-notification> to exclude harness-injected payloads. Test validates only real user text is retained in events.
Repo-aware path resolution infrastructure
plugins/me/skills/evolve/scripts/build-index.ts
New findRepoRoot helper scans upward for plugins/ directory; repoSkillPath resolves editable SKILL.md paths from repo. Refactored currentBodyHash now accepts direct skill markdown path instead of base directory, enabling staleness detection against resolved paths.
Multi-session indexing: signal computation and worktree aggregation
plugins/me/skills/evolve/scripts/build-index.ts, tests/me/evolve-build-index.bats
buildRecentIndex computes weighted "improvement signal" (interrupt/error/repeat counts) and sorts by signal then event count. Transcript discovery now derives project base prefix (splitting --worktrees-... suffix) and aggregates .jsonl files across base and sibling worktree directories, enabling session merging. Skills enriched with repo_path and one-line signal display string.
Behavior documentation and CLI entrypoint
plugins/me/skills/evolve/SKILL.md, plugins/me/skills/evolve/scripts/build-index.ts
Documented --recent multi-session semantics and optional repo_path resolution, stale detection via SKILL.md body hash comparison, and Phase 1 subagent guidance for target_file/is_external_cache selection and avoiding stale:true proposals. CLI passes process.cwd() to buildRecentIndex for repo-root detection.

Sequence Diagram

sequenceDiagram
  participant CLI as --recent CLI
  participant Discover as recentSessionPaths
  participant BuildIndex as buildRecentIndex
  participant RepoRoot as findRepoRoot
  participant Skills as skill aggregation
  participant Sort as weighted sort
  
  CLI->>Discover: pass process.cwd()
  Discover->>Discover: derive projectBasePrefix<br/>(split --worktrees-... suffix)
  Discover->>Discover: aggregate .jsonl from base<br/>and sibling worktree dirs
  Discover-->>BuildIndex: collected transcript paths
  BuildIndex->>RepoRoot: locate plugins/ directory upward
  RepoRoot-->>BuildIndex: repo root path
  BuildIndex->>Skills: for each skill in transcripts
  Skills->>Skills: compute signal from<br/>interrupt/error/repeat counts
  Skills->>Skills: resolve repo_path via<br/>repoSkillPath (if skill in repo)
  Skills->>Skills: populate enriched fields<br/>(skill_path, repo_path, signal)
  Skills-->>BuildIndex: enriched skill objects
  BuildIndex->>Sort: sort by weighted signal<br/>then event count
  Sort-->>CLI: RecentIndex with merged<br/>worktree sessions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • baleen37/bstack#664: Introduces the foundational buildRecentIndex functionality that this PR extends with multi-session and repo-aware path resolution.
  • baleen37/bstack#666: Modifies skill-event parsing and buildEvents logic in the same build-index.ts file, overlapping with event aggregation and filtering concerns.
  • baleen37/bstack#665: Updates pseudo-user filtering for <task-notification> noise suppression in the same file, a shared concern with this PR's user-event handling.

Poem

🐰 Hops through worktrees with glee,
Sessions merge across sibling trees,
Signals weighted, paths resolved,
Task notifications dissolved—
Indexing chaos now evolved!

✨ 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 lucky-voyage-lovelace

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 07a16a0 into main May 31, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the lucky-voyage-lovelace branch May 31, 2026 09:38
baleen-release-app Bot pushed a commit that referenced this pull request May 31, 2026
# [17.18.0](v17.17.1...v17.18.0) (2026-05-31)

### Features

* **evolve:** tailor --recent for worktree workflows (merge sessions, repo_path, signal) ([#670](#670)) ([07a16a0](07a16a0))
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