Skip to content

chore(claude): modernize setup + enable parallel worktree agents#154

Merged
stid merged 3 commits into
masterfrom
chore/claude-setup-worktrees
May 23, 2026
Merged

chore(claude): modernize setup + enable parallel worktree agents#154
stid merged 3 commits into
masterfrom
chore/claude-setup-worktrees

Conversation

@stid

@stid stid commented May 23, 2026

Copy link
Copy Markdown
Owner

Context

Audited the project's Claude Code setup against current (May 2026) best practices and wired up a git-worktree workflow so multiple agents can work on different features in parallel. The existing setup was already mature; these are targeted gap-fixes, not a rewrite.

Changes

Area Before After
Parallel-worktree config permissions/hooks/output style all gitignored — new worktrees start blind tracked .claude/settings.json (auto-inherited) + .worktreeinclude copies local hooks/env into each worktree
Skills 2 loose .md files Claude Code 2.x never loaded migrated to .claude/skills/<name>/SKILL.md (confirmed loading)
Context7 MCP mandated in CLAUDE.md but not pinned .mcp.json pins it project-wide
CLAUDE.md 580 lines 179 lines; history/usage/dir-map moved to docs/active/wasm-migration-history.md
Subagent isolation isolation: worktree on wasm-engine-verifier
Worktree workflow undocumented new docs/active/parallel-agents.md

Design notes

  • Hooks stay gitignored on purpose. The .gitignore documents that active hooks are kept local so fork PRs can't inject auto-executing code. Committed settings.json carries only permissions + output style; .worktreeinclude copies the maintainer's local hooks into worktrees without committing them.
  • Bash(rm:*) deliberately excluded from the committed allowlist (kept in local settings.local.json). A blanket recursive-delete grant is a poor default for teammates and auto-spawned worktree agents.
  • Skill files moved via git mv to preserve history.

Using parallel agents

claude --worktree feature-name   # isolated session on its own branch + worktree

See docs/active/parallel-agents.md for config inheritance and cleanup.

Verification

  • yarn lint ✅ · yarn type-check ✅ · yarn test:ci ✅ (685 passed, 18 skipped — WASM benchmark/parity skip without a loaded module, as documented) · yarn lint:md:fix ✅ (0 errors)
  • Skills engine-parity-check + wasm-optimization now appear in the loaded-skills list (were absent before)
  • Version bumped 4.42.6 → 4.42.7

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Parallel session support with isolated worktree execution (including subagent isolation).
  • Documentation

    • Reworked developer guide into a Dual-Engine CPU Guide with stricter conventions, workflows, and WASM guidance.
    • Added docs on parallel-agent workflows and a WASM dual-engine migration history.
  • Chores

    • App version bumped to 4.42.7.
    • Updated execution permissions, worktree handling/ignore behavior, MCP server endpoint, and PR review tooling config.

Review Change Stack

- Add tracked .claude/settings.json (permissions + outputStyle) so config
  reaches parallel worktrees/teammates; hooks stay local for fork safety
- Add .worktreeinclude to copy local settings/hooks/.env into new worktrees;
  gitignore .claude/worktrees/
- Migrate skills to .claude/skills/<name>/SKILL.md so they actually load
  (flat .md files were never discovered by Claude Code 2.x)
- Add .mcp.json pinning Context7 for the whole project
- Trim CLAUDE.md 580->179 lines; move history/usage/dir-map to
  docs/active/wasm-migration-history.md; add docs/active/parallel-agents.md
- isolation: worktree on wasm-engine-verifier subagent
- Bump version 4.42.6 -> 4.42.7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0e74432-6577-4e2d-b759-b3e1f7383eca

📥 Commits

Reviewing files that changed from the base of the PR and between 2c811e9 and 54984ce.

📒 Files selected for processing (2)
  • CLAUDE.md
  • docs/active/wasm-migration-history.md
✅ Files skipped from review due to trivial changes (1)
  • docs/active/wasm-migration-history.md

📝 Walkthrough

Walkthrough

This PR adds worktree-based parallel-agent infrastructure and copying rules, configures MCP/tool permissions, rewrites the developer guide into a Dual-Engine CPU Guide, adds parallel-agent and WASM migration docs, and bumps APP_VERSION to 4.42.7.

Changes

Parallel Agent Infrastructure & Developer Guide

Layer / File(s) Summary
Worktree & Tool Configuration
.claude/agents/wasm-engine-verifier.md, .claude/settings.json, .mcp.json, .gitignore, .worktreeinclude
Agent isolation via isolation: worktree frontmatter, MCP server context7 entry, explicit tool/command allowlist in .claude/settings.json, .claude/worktrees/ ignored in .gitignore, and .worktreeinclude rules to copy local setup artifacts into new worktrees.
Parallel Agents Usage Guide
docs/active/parallel-agents.md
Documentation for --worktree usage (named/auto/PR checkout), file isolation via .worktreeinclude, hook copying behavior and security rationale, cleanup workflows, subagent isolation with frontmatter, concurrency limits, and optional Agent Teams note.
Dual-Engine CPU Developer Guide
CLAUDE.md
Reframes and rewrites CLAUDE.md as a Dual-Engine CPU Guide: stricter development rules (no any, logging conventions, version bump), updated Quick Start and yarn build/test commands, WASM tuning/perf guidance, standardized pre-commit checklist, key code patterns, and refreshed quick references.
WASM Architecture & Migration History
docs/active/wasm-migration-history.md
Adds chronological WASM dual-engine migration history, May 2026 speed-first update, current architecture (JSEngine/WasmEngine/DualEngine, shared JS memory), TypeScript engine-switching snippet, WASM project layout, and next priority tasks.
Release Version Update
src/version.ts
Bump APP_VERSION from 4.42.6 to 4.42.7.
CodeRabbit Auto-Review Config
.coderabbit.yaml
Adds CodeRabbit v2 config to enable auto line-by-line reviews on master with high-level summaries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Soft hops through worktrees wide and neat,
Docs and configs aligned, tidy and sweet,
WASM and JS engines ready to play,
Version bumped, developers on their way,
Claude Code pairs dance in parallel beat.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: modernizing Claude Code setup and enabling parallel worktree agents, which aligns with the changeset's core objectives of updating configuration, adding worktree support, and documenting the new workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/claude-setup-worktrees

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/active/wasm-migration-history.md (1)

68-86: 💤 Low value

Consider demonstrating LoggingService in documentation examples.

The code example uses console.log on lines 80 and 84. While this is standard for documentation examples, given the project's strict "no console.log" guideline and emphasis on LoggingService, these examples could reinforce the preferred pattern.

📚 Optional refinement to demonstrate preferred pattern
 import { DualEngine } from './src/core/cpu-engines';
+import { LoggingService } from './src/services/logging/LoggingService';

 const dualEngine = new DualEngine(bus, 'JS'); // Start with JS engine
 await dualEngine.initialize();

 // Switch to WASM for performance
 await dualEngine.switchEngine('WASM');

 // Get performance comparison
 const comparison = await dualEngine.compareEngines();
-console.log(`WASM is ${comparison.speedup}x faster!`);
+LoggingService.info(`WASM is ${comparison.speedup}x faster!`);

 // Listen for engine switches
 dualEngine.onEngineSwitch((event) => {
-    console.log(`Switched from ${event.from} to ${event.to}`);
+    LoggingService.info(`Switched from ${event.from} to ${event.to}`);
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/active/wasm-migration-history.md` around lines 68 - 86, Replace the
console.log calls in the DualEngine example with the project's LoggingService
usage: import or obtain a logger (e.g., LoggingService or getLogger) and use it
to log the engine comparison and engine-switch events; update the snippet to
create/obtain a logger before calling dualEngine.initialize() and replace
console.log in the comparison output and the onEngineSwitch handler with
logger.info/debug calls, referencing DualEngine, initialize, switchEngine,
compareEngines, and onEngineSwitch so readers know where to integrate logging.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLAUDE.md`:
- Line 15: Update the version reference in CLAUDE.md: change the string
"current: 4.42.0" to "current: 4.42.7" so it matches the bumped version in
src/version.ts and the PR description; search for the exact text "current:
4.42.0" in CLAUDE.md and replace it with "current: 4.42.7".

---

Nitpick comments:
In `@docs/active/wasm-migration-history.md`:
- Around line 68-86: Replace the console.log calls in the DualEngine example
with the project's LoggingService usage: import or obtain a logger (e.g.,
LoggingService or getLogger) and use it to log the engine comparison and
engine-switch events; update the snippet to create/obtain a logger before
calling dualEngine.initialize() and replace console.log in the comparison output
and the onEngineSwitch handler with logger.info/debug calls, referencing
DualEngine, initialize, switchEngine, compareEngines, and onEngineSwitch so
readers know where to integrate logging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b441284d-5026-4cd4-bdc2-8fdddc01f836

📥 Commits

Reviewing files that changed from the base of the PR and between 00c9189 and 8989480.

📒 Files selected for processing (11)
  • .claude/agents/wasm-engine-verifier.md
  • .claude/settings.json
  • .claude/skills/engine-parity-check/SKILL.md
  • .claude/skills/wasm-optimization/SKILL.md
  • .gitignore
  • .mcp.json
  • .worktreeinclude
  • CLAUDE.md
  • docs/active/parallel-agents.md
  • docs/active/wasm-migration-history.md
  • src/version.ts

Comment thread CLAUDE.md Outdated
stid and others added 2 commits May 23, 2026 16:51
Dashboard default left auto-review off, so PRs only got a summary with
status "Review skipped". Version-control the setting so reviews run and
the behavior is explicit/reproducible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- CLAUDE.md: drop hardcoded "4.42.0" from version rule (version.ts is the
  single source of truth) — fixes the stale version reference
- wasm-migration-history.md: use loggingService.info(source, message) in the
  DualEngine example instead of console.log, matching the project convention
  (CodeRabbit's suggested LoggingService.info(msg) had the wrong signature;
  the real API is the loggingService singleton with a (source, message) arg)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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