Skip to content

Commit 3bf0e67

Browse files
jpicklykclaude
andauthored
feat: MCP SDK 0.9.0 upgrade, cascade gate enforcement, session retrospective skill (#69)
## MCP Kotlin SDK 0.9.0 Upgrade - Upgrade from 0.8.4 to 0.9.0, adopt ClientConnection and kotlin-sdk-testing - Update McpToolAdapter and CurrentMcpServer for new SDK APIs - Add McpToolAdapterIntegrationTest using SDK test harness ## Cascade Gate Enforcement - Fix cascade-to-TERMINAL bypassing note schema gates — parent items with schema tags now require all required notes filled before auto-completing - Schema-free parents cascade freely (no behavior change) - Extract buildMissingNotesArray() and consolidate buildFilledKeys() usage in NoteSchemaJsonHelpers ## Session Retrospective Skill - Add session-retrospective skill for post-implementation analysis - Add run manifest tracking to workflow-orchestrator output style ## Documentation - Document local-first squash flow in /implement skill and CLAUDE.md Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cd64ffe commit 3bf0e67

File tree

12 files changed

+998
-57
lines changed

12 files changed

+998
-57
lines changed

.claude/skills/implement/SKILL.md

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,28 @@ review cleaner.
4747

4848
## Step 2 — Prepare the Branch
4949

50-
Sync main before any implementation begins.
50+
Sync local main before any implementation begins.
5151

5252
```bash
5353
git checkout main
5454
git pull origin main --tags
5555
```
5656

5757
**If NOT using worktree isolation** (orchestrator implements directly or dispatches
58-
a single non-isolated agent), create a working branch:
58+
a single non-isolated agent), create a local working branch:
5959

6060
```bash
6161
git checkout -b <branch-name>
6262
```
6363

64+
This branch stays local — it will be squash-merged into local `main` after
65+
review, not pushed directly to origin. See Step 6 for the squash-merge flow.
66+
6467
**If using worktree isolation**, skip branch creation — each worktree agent gets
65-
its own isolated branch automatically. See Worktree Isolation below.
68+
its own isolated branch automatically. See Worktree Isolation below. Worktree
69+
branches are also local-only and get squash-merged into `main` after review.
6670

67-
**Branch naming** (for manually created branches):
71+
**Branch naming** (for local working branches):
6872
- `feat/<short-description>` — feature-implementation items
6973
- `fix/<short-description>` — bug-fix items
7074
- `fix/<grouped-description>` — batch of related bug fixes
@@ -196,20 +200,21 @@ from. Automatically retrying hides these signals.
196200

197201
---
198202

199-
## Step 6 — Commit and PR
203+
## Step 6 — Commit and Squash-Merge to Main
204+
205+
After review passes, commit the changes and squash-merge into local `main`.
206+
PRs to GitHub are batched — multiple completed items accumulate on local `main`
207+
before a single PR is created.
200208

201-
After review passes, commit the changes and create a PR.
209+
### Commit on the working branch
202210

203-
**If using worktree isolation**, all commands in this step run from the worktree:
211+
**If using worktree isolation**, commit from the worktree:
204212
```bash
205213
git -C <worktree-path> add <specific-files>
206-
git -C <worktree-path> commit ...
207-
git -C <worktree-path> push origin <worktree-branch>
214+
git -C <worktree-path> commit -m "..."
208215
```
209216

210-
**If NOT using worktree isolation**, run from the working branch as normal.
211-
212-
### Commit
217+
**If NOT using worktree isolation**, commit on the local working branch as normal.
213218

214219
Stage only the files related to the implementation. Do not stage unrelated changes
215220
that happen to be in the working tree.
@@ -229,13 +234,31 @@ EOF
229234
**Commit types:** `feat` for features, `fix` for bugs, `refactor` for tech debt,
230235
`perf` for performance, `test` for test-only changes, `chore` for maintenance.
231236

232-
For batch work with multiple items in one branch, use a single commit or logical
233-
commits per item — whichever tells a clearer story in the git log.
237+
### Squash-merge into local main
234238

235-
### Push and PR
239+
After committing on the working branch (or worktree branch), squash-merge into
240+
local `main`:
236241

237242
```bash
238-
git push origin <branch-name>
243+
git checkout main
244+
git merge --squash <branch-name> # or: git merge --squash <worktree-branch>
245+
git commit -m "<type>(<scope>): <description>"
246+
git branch -D <branch-name> # delete the local working branch
247+
```
248+
249+
For worktree branches, use the branch name returned by the Agent tool. The
250+
worktree directory is cleaned up automatically after the branch is deleted.
251+
252+
Local `main` now has the squashed change. Repeat for more items — they accumulate.
253+
254+
### Push and PR (batched)
255+
256+
When ready to publish one or more accumulated changes to GitHub, create a PR
257+
branch from local `main`:
258+
259+
```bash
260+
git checkout -b <pr-branch-name> # e.g., feat/batch-validation-improvements
261+
git push -u origin <pr-branch-name>
239262
```
240263

241264
Create the PR:
@@ -263,6 +286,18 @@ EOF
263286
)"
264287
```
265288

289+
After the GitHub PR is merged, sync local main:
290+
```bash
291+
git checkout main
292+
git pull origin main
293+
git branch -D <pr-branch-name> # delete the local PR branch
294+
```
295+
296+
**When to create a PR** — use judgment:
297+
- After completing a logical unit of work (a feature, a batch of fixes)
298+
- When local `main` has accumulated enough changes to warrant publishing
299+
- The user may explicitly request a PR at any point
300+
266301
### Advance to terminal
267302

268303
After the PR is created:
@@ -283,11 +318,13 @@ When processing multiple items autonomously:
283318
2. **Parallel execution** — use worktree isolation for independent work streams.
284319
Sequential execution for items with dependency edges between them.
285320
3. **Per-item pipeline** — each worktree goes through Steps 4-6 independently:
286-
implementation → capture worktree metadata → simplify → review (in worktree) → PR
321+
implementation → capture worktree metadata → simplify → review (in worktree) → squash-merge to main
287322
4. **Track all worktrees** — maintain a table mapping item UUID → worktree path →
288-
branch → status (implementing / reviewing / PR created / failed)
289-
5. **Report at the end** — summarize all PRs created, any items that couldn't be
290-
processed, and any review failures that need user attention
323+
branch → status (implementing / reviewing / squash-merged / failed)
324+
5. **Squash-merge each** — after review passes, squash-merge each worktree branch
325+
into local `main`. Run the full test suite after each merge to catch integration issues.
326+
6. **Report at the end** — summarize items completed, any review failures, and whether
327+
a PR to GitHub is ready
291328

292329
If any item in the batch hits a review failure, continue processing other items
293330
and report all failures together at the end.
@@ -303,8 +340,8 @@ real branch that survives the agent's lifecycle.
303340

304341
**When to use worktrees:**
305342
- Parallel dispatch of multiple implementation agents (prevents file conflicts)
306-
- Any implementation dispatch where you need the changes on a reviewable branch
307-
- When you want the implementation agent to commit and push independently
343+
- Any implementation dispatch where you need the changes on an isolated branch
344+
- When you want the implementation agent to commit independently
308345

309346
**When NOT to use worktrees:**
310347
- Tasks that depend on each other's file changes (use sequential dispatch instead)
@@ -331,8 +368,8 @@ Agent(
331368

332369
### Worktree lifecycle
333370

334-
The worktree branch is the PR branch. Review and PR creation happen on that
335-
branch — do NOT merge worktree branches back before review.
371+
Review happens in the worktree. After review passes, squash-merge into local
372+
`main` — do NOT push worktree branches to origin.
336373

337374
```
338375
1. Orchestrator dispatches agent with isolation: "worktree"
@@ -342,7 +379,7 @@ branch — do NOT merge worktree branches back before review.
342379
5. Orchestrator spot-checks diffs: git -C <worktree-path> diff main --stat
343380
6. Orchestrator runs /simplify in the worktree (or dispatches agent to do so)
344381
7. Review agent dispatched INTO the worktree (reads files and runs tests there)
345-
8. PR created from the worktree branch
382+
8. After review passes: squash-merge worktree branch into local main
346383
9. Worktrees with no changes are automatically cleaned up
347384
```
348385

@@ -355,7 +392,7 @@ When an agent returns from worktree isolation, the Agent tool result includes:
355392
Record these alongside the MCP item ID. You need them for:
356393
- Running `git -C <path> diff main --name-only` to get the changed files list
357394
- Pointing the review agent at the correct directory
358-
- Pushing the branch and creating the PR
395+
- Squash-merging the branch into local `main` after review
359396

360397
### Parallel worktree validation
361398

@@ -365,11 +402,9 @@ When multiple agents return from parallel worktrees:
365402
2. Spot-check at least 2 diffs for insertion errors, scope violations, or
366403
unintended modifications
367404
3. Run each worktree's test suite independently (or delegate to review agents)
368-
4. Each worktree branch gets its own PR — do not merge them together unless
369-
the items were intentionally grouped
370-
371-
If items were grouped into a single working branch (Step 2), merge reviewed
372-
worktree branches into that branch sequentially AFTER review passes for each.
405+
4. Squash-merge each reviewed worktree branch into local `main` sequentially
406+
5. Run the full test suite after all merges to catch integration issues
407+
6. Delete worktree branches after successful squash-merge
373408

374409
---
375410

0 commit comments

Comments
 (0)