From a360e1d964ffbf0d6b7632071d761a6975d80679 Mon Sep 17 00:00:00 2001 From: Terry Li Date: Mon, 2 Mar 2026 12:33:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Add=20/lfg-ext=20command=20=E2=80=94=20exte?= =?UTF-8?q?rnal=20delegate=20LFG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new /lfg-ext command that runs the full CE planning and review pipeline but replaces /ce:work swarm with external tools (Codex, Gemini CLI, OpenCode) running in parallel git worktrees. Key differences from /slfg: - Uses external tools instead of Claude Task agents → preserves Max20 budget - Delegates run in isolated worktrees via worktree-manager.sh - Includes tool availability check with graceful /slfg fallback - Plan must be committed before worktree creation (worktrees see git history only, not the working tree) - OpenCode sandbox restriction documented (writes outside worktree blocked) Validated on a real Rust feature implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude-plugin/marketplace.json | 4 +- .../.claude-plugin/plugin.json | 4 +- plugins/compound-engineering/CHANGELOG.md | 8 ++ plugins/compound-engineering/README.md | 3 +- .../compound-engineering/commands/lfg-ext.md | 98 +++++++++++++++++++ 5 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 plugins/compound-engineering/commands/lfg-ext.md diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index a6aea30c..5da771f5 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -11,8 +11,8 @@ "plugins": [ { "name": "compound-engineering", - "description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 29 specialized agents, 22 commands, and 20 skills.", - "version": "2.38.1", + "description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 29 specialized agents, 23 commands, and 20 skills.", + "version": "2.39.0", "author": { "name": "Kieran Klaassen", "url": "https://github.com/kieranklaassen", diff --git a/plugins/compound-engineering/.claude-plugin/plugin.json b/plugins/compound-engineering/.claude-plugin/plugin.json index e659557f..82c2bd9b 100644 --- a/plugins/compound-engineering/.claude-plugin/plugin.json +++ b/plugins/compound-engineering/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "compound-engineering", - "version": "2.38.1", - "description": "AI-powered development tools. 29 agents, 22 commands, 20 skills, 1 MCP server for code review, research, design, and workflow automation.", + "version": "2.39.0", + "description": "AI-powered development tools. 29 agents, 23 commands, 20 skills, 1 MCP server for code review, research, design, and workflow automation.", "author": { "name": "Kieran Klaassen", "email": "kieran@every.to", diff --git a/plugins/compound-engineering/CHANGELOG.md b/plugins/compound-engineering/CHANGELOG.md index e7664980..5b7ddb04 100644 --- a/plugins/compound-engineering/CHANGELOG.md +++ b/plugins/compound-engineering/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to the compound-engineering plugin will be documented in thi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.39.0] - 2026-03-02 + +### Added + +- **`/lfg-ext` command** — LFG variant that delegates execution to external tools (Codex, Gemini CLI, OpenCode) running in parallel git worktrees instead of CE swarm agents. Token-efficient alternative to `/slfg` for teams that have external AI coding tools installed or want to preserve Claude Max20 budget for planning and review. Includes tool availability check with graceful fallback to `/slfg`, worktree isolation via the CE `git-worktree` skill's `worktree-manager.sh`, and a decision table for when to use `/lfg-ext` vs `/slfg`. Validated against a real Rust feature implementation. + +--- + ## [2.38.1] - 2026-03-01 ### Fixed diff --git a/plugins/compound-engineering/README.md b/plugins/compound-engineering/README.md index 33a4ea15..edc90fe4 100644 --- a/plugins/compound-engineering/README.md +++ b/plugins/compound-engineering/README.md @@ -7,7 +7,7 @@ AI-powered development tools that get smarter with every use. Make each unit of | Component | Count | |-----------|-------| | Agents | 29 | -| Commands | 22 | +| Commands | 23 | | Skills | 20 | | MCP Servers | 1 | @@ -91,6 +91,7 @@ Core workflow commands use `ce:` prefix to unambiguously identify them as compou |---------|-------------| | `/lfg` | Full autonomous engineering workflow | | `/slfg` | Full autonomous workflow with swarm mode for parallel execution | +| `/lfg-ext` | LFG with external delegates (Codex/Gemini/OpenCode) in parallel worktrees — token-efficient alternative to /slfg | | `/deepen-plan` | Enhance plans with parallel research agents for each section | | `/changelog` | Create engaging changelogs for recent merges | | `/create-agent-skill` | Create or edit Claude Code skills | diff --git a/plugins/compound-engineering/commands/lfg-ext.md b/plugins/compound-engineering/commands/lfg-ext.md new file mode 100644 index 00000000..e723a5ed --- /dev/null +++ b/plugins/compound-engineering/commands/lfg-ext.md @@ -0,0 +1,98 @@ +--- +name: lfg-ext +description: LFG with external delegates (Codex/Gemini/OpenCode) in parallel worktrees — token-efficient alternative to /slfg +argument-hint: "[feature description]" +disable-model-invocation: true +--- + +External-delegate LFG. Uses CE for planning and review; replaces `/ce:work` swarm with external tools running in isolated git worktrees. Saves Max20 tokens while maintaining parallel execution. + +Run these steps in order. Do not stop between steps — complete every step through to the end. + +## Phase 1: Plan + +1. `/ce:plan $ARGUMENTS` +2. `/compound-engineering:deepen-plan` +3. **Commit the plan** — worktrees only see committed git history, not the working tree. Uncommitted plan files are invisible to delegates. + + ```bash + git add docs/plans/ && git commit -m "plan: " + ``` + +## Phase 2: Decompose + +4. Read the generated plan. Identify tasks that target **different files/modules with no shared state**. + + Good signal: tasks write to non-overlapping files. + Bad signal: tasks share a model, schema, config, or any single file — don't force it, fall back to `/slfg` or sequential `/ce:work`. + + Aim for 2–4 parallel streams. More rarely helps. + +## Phase 3: External Swarm + +5. **Create one worktree per task** using the CE worktree manager: + + ```bash + bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create + ``` + + The script handles `.env` file copying, `.gitignore` management, and directory setup automatically. + +6. **Check which external tools are available:** + + ```bash + command -v codex && echo "codex: available" || echo "codex: not installed" + command -v gemini && echo "gemini: available" || echo "gemini: not installed" + command -v opencode && echo "opencode: available" || echo "opencode: not installed" + ``` + + Use whichever tools are available. If none are installed, fall back to `/slfg` instead. + +7. **Launch all delegates in parallel** — one per worktree, all backgrounded simultaneously. + + Assign tasks to tools by type: + + | Task type | Preferred tool | Command | + |-----------|----------------|---------| + | Multi-file, repo navigation, test loops | **Codex** | `cd .worktrees/ && codex exec --full-auto ""` | + | Algorithmic, isolated logic | **Gemini CLI** | `cd .worktrees/ && gemini -p "" --yolo` | + | Bulk ops, boilerplate, routine refactoring | **OpenCode** | `cd .worktrees/ && opencode run --title "" "<prompt>"` | + + Each delegate prompt must include: + - Absolute file paths (let the delegate read — don't inline file contents) + - Constraints: "don't modify X", "keep existing patterns" + - Verification: "run `npm test` / `bin/rails test` / `pytest` to verify" + - "Implement fully. No stubs, no TODOs, no simplified versions." + + ⚠️ **OpenCode note:** OpenCode's sandbox only allows writes inside its worktree and `/tmp`. Tasks that write outside the repo (config files, global tooling) must use Codex instead. + +8. **Wait for all delegates to complete.** + +## Phase 4: Merge + +9. For each worktree — review scope before merging: + + ```bash + git diff --stat <task-branch> # check for unexpected file changes + git merge <task-branch> + bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh cleanup + ``` + + Merge conflicts mean tasks weren't fully independent. Resolve manually, then continue. + +## Phase 5: Review & Ship + +10. `/ce:review` +11. `/compound-engineering:resolve_todo_parallel` + +--- + +## When to use vs /slfg + +| Signal | Use | +|--------|-----| +| Max20 pool healthy, want fully hands-off | `/slfg` | +| Max20 constrained, or tasks decompose cleanly by file | `/lfg-ext` | +| Tasks share files or state | `/slfg` or sequential `/ce:work` | +| Want Codex repo navigation or Gemini algorithmic strength | `/lfg-ext` | +| No external tools installed | `/slfg` | From 514db4b93d568734778ade7fb7b47f4face00bc3 Mon Sep 17 00:00:00 2001 From: Terry Li <terry@terryli.dev> Date: Mon, 2 Mar 2026 13:06:08 +0800 Subject: [PATCH 2/2] fix(lfg-ext): reorder tool check before worktree creation, clarify jargon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move tool availability check (Phase 2) before worktree creation (Phase 3) so we fail fast if no delegates are available - Remove "Max20" jargon — replaced with "Claude token budget" in description - Drop OpenCode from delegate table (too setup-specific; Codex+Gemini cover all cases) - Add note explaining why /feature-video is omitted 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --- .../compound-engineering/commands/lfg-ext.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/plugins/compound-engineering/commands/lfg-ext.md b/plugins/compound-engineering/commands/lfg-ext.md index e723a5ed..520235f6 100644 --- a/plugins/compound-engineering/commands/lfg-ext.md +++ b/plugins/compound-engineering/commands/lfg-ext.md @@ -1,11 +1,11 @@ --- name: lfg-ext -description: LFG with external delegates (Codex/Gemini/OpenCode) in parallel worktrees — token-efficient alternative to /slfg +description: LFG with external delegates (Codex/Gemini CLI) in parallel worktrees — preserves Claude token budget while maintaining parallel execution argument-hint: "[feature description]" disable-model-invocation: true --- -External-delegate LFG. Uses CE for planning and review; replaces `/ce:work` swarm with external tools running in isolated git worktrees. Saves Max20 tokens while maintaining parallel execution. +External-delegate LFG. Uses CE for planning and review; replaces `/ce:work` swarm with external AI tools running in isolated git worktrees. Preserves Claude token budget for planning and review where it adds the most value. Run these steps in order. Do not stop between steps — complete every step through to the end. @@ -19,9 +19,18 @@ Run these steps in order. Do not stop between steps — complete every step thro git add docs/plans/ && git commit -m "plan: <feature>" ``` -## Phase 2: Decompose +## Phase 2: Check tools & decompose -4. Read the generated plan. Identify tasks that target **different files/modules with no shared state**. +4. **Check which external tools are available:** + + ```bash + command -v codex && echo "codex: available" || echo "codex: not installed" + command -v gemini && echo "gemini: available" || echo "gemini: not installed" + ``` + + If neither is installed, **stop here and run `/slfg` instead** — there's no point creating worktrees without delegates to fill them. + +5. Read the generated plan. Identify tasks that target **different files/modules with no shared state**. Good signal: tasks write to non-overlapping files. Bad signal: tasks share a model, schema, config, or any single file — don't force it, fall back to `/slfg` or sequential `/ce:work`. @@ -30,7 +39,7 @@ Run these steps in order. Do not stop between steps — complete every step thro ## Phase 3: External Swarm -5. **Create one worktree per task** using the CE worktree manager: +6. **Create one worktree per task** using the CE worktree manager: ```bash bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh create <task-branch> @@ -38,16 +47,6 @@ Run these steps in order. Do not stop between steps — complete every step thro The script handles `.env` file copying, `.gitignore` management, and directory setup automatically. -6. **Check which external tools are available:** - - ```bash - command -v codex && echo "codex: available" || echo "codex: not installed" - command -v gemini && echo "gemini: available" || echo "gemini: not installed" - command -v opencode && echo "opencode: available" || echo "opencode: not installed" - ``` - - Use whichever tools are available. If none are installed, fall back to `/slfg` instead. - 7. **Launch all delegates in parallel** — one per worktree, all backgrounded simultaneously. Assign tasks to tools by type: @@ -56,7 +55,6 @@ Run these steps in order. Do not stop between steps — complete every step thro |-----------|----------------|---------| | Multi-file, repo navigation, test loops | **Codex** | `cd .worktrees/<branch> && codex exec --full-auto "<prompt>"` | | Algorithmic, isolated logic | **Gemini CLI** | `cd .worktrees/<branch> && gemini -p "<prompt>" --yolo` | - | Bulk ops, boilerplate, routine refactoring | **OpenCode** | `cd .worktrees/<branch> && opencode run --title "<title>" "<prompt>"` | Each delegate prompt must include: - Absolute file paths (let the delegate read — don't inline file contents) @@ -64,8 +62,6 @@ Run these steps in order. Do not stop between steps — complete every step thro - Verification: "run `npm test` / `bin/rails test` / `pytest` to verify" - "Implement fully. No stubs, no TODOs, no simplified versions." - ⚠️ **OpenCode note:** OpenCode's sandbox only allows writes inside its worktree and `/tmp`. Tasks that write outside the repo (config files, global tooling) must use Codex instead. - 8. **Wait for all delegates to complete.** ## Phase 4: Merge @@ -85,14 +81,16 @@ Run these steps in order. Do not stop between steps — complete every step thro 10. `/ce:review` 11. `/compound-engineering:resolve_todo_parallel` +> Note: `/lfg-ext` omits `/feature-video` — external delegates don't produce a reviewable PR automatically, so a video walkthrough isn't meaningful until you've raised one manually. + --- ## When to use vs /slfg | Signal | Use | |--------|-----| -| Max20 pool healthy, want fully hands-off | `/slfg` | -| Max20 constrained, or tasks decompose cleanly by file | `/lfg-ext` | +| Want fully hands-off, token cost not a concern | `/slfg` | +| Token budget constrained, or tasks decompose cleanly by file | `/lfg-ext` | | Tasks share files or state | `/slfg` or sequential `/ce:work` | | Want Codex repo navigation or Gemini algorithmic strength | `/lfg-ext` | | No external tools installed | `/slfg` |