Skip to content

Commit 8584f7c

Browse files
brunogsaclaude
andcommitted
docs(workflow-tasks): add task 3 -- port worktree guard cross-tool
New backlog task: port the worktree force-remove safety guard and a one-step worktree setup/teardown to Gemini CLI and opencode (today both are Claude-Code-only). Embeds the verified research so it need not be re-derived: Gemini's BeforeTool hook shares Claude Code's stdin + exit-2 contract (guard ports near-verbatim); opencode needs a TypeScript tool.execute.before plugin and has a known subagent-bypass bug (anomalyco/opencode#5894). git-worktree-add already works for all three. Follows the new cross-tool config convention added to CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 3667597 commit 8584f7c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎workflow-tasks.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,22 @@
248248
**Where**: the `skill-creator` skill (plugin-provided or under `configs/ai-docs/claude/skills/` — check which first). Read its eval harness, understand what it checks (skill quality / frontmatter / progressive disclosure), run it against the user's existing skills.
249249

250250
**Deliverable**: explanation of what the evals check + how to run them + whether they're worth wiring into the user's skill-authoring loop.
251+
252+
---
253+
254+
## 3. [Task] Port the git-worktree safety guard cross-tool + easy worktree workflow
255+
256+
**Goal**: Make the parallel-session worktree workflow safe AND convenient across every agent CLI in use (Claude Code, opencode, Gemini CLI) — both the safety guard and one-step worktree setup/teardown — not just in Claude Code.
257+
258+
**Why**: configs in this repo should be cross-tool (see the project `CLAUDE.md` convention). The agents share one git repo; a guard that only fires in Claude Code leaves the repo exposed when opencode/Gemini does the work. `git-worktree-add` already works for all three (it's plain git), but the force-remove safety guard and the auto-isolation ergonomics are Claude-Code-only today.
259+
260+
**Verified findings (don't re-derive)**:
261+
- **Claude Code (done, task 4)**: `claude-git-guard.sh` now blocks `git worktree remove --force`; native `--worktree` + `worktree.baseRef=head` give one-step isolation with safe `ExitWorktree` teardown (refuses dirty/unpushed unless `discard_changes:true`).
262+
- **Gemini CLI**: its `BeforeTool` hook uses the SAME contract as Claude Code — reads `tool_input.command` from stdin, exits 2 to block. The guard likely ports near-verbatim, wired in `.gemini/settings.json`. VERIFY the exact JSON key path (Gemini may nest `tool_input.command` differently). No native worktree flag — use manual `git-worktree-add` or a community plugin.
263+
- **opencode**: NO stdin/exit-2 contract — the guard must be rewritten as a TypeScript `tool.execute.before` plugin that throws to block. KNOWN BUG (`sst/opencode#5894`): `tool.execute.before` does NOT intercept subagent tool calls → a guard-bypass hole; account for it. No native worktree flag; community plugins exist (`kdcokenny/opencode-worktree`, `felixAnhalt/opencode-worktree-session`).
264+
265+
**Easy-worktree piece (skill-based?)**: evaluate a single skill/alias that spins up + tears down a worktree safely for whichever tool is running — wrapping the existing `git-worktree-add` plus a teardown helper that refuses on dirty/unpushed (the safety the force-remove guard enforces). Decide: one shared skill vs per-tool wiring. Load `skill-creator` before authoring any `SKILL.md`.
266+
267+
**Cross-platform**: any path-based wiring needs both macOS (`/Users/...`) and Linux (`/home/...`) home-dir forms.
268+
269+
**Deliverable**: the worktree force-remove guard wired into Gemini CLI (`BeforeTool`) and opencode (TS plugin, subagent-bypass noted); a one-step safe worktree setup/teardown that works cross-tool (skill or alias); mirrored into `install.sh` if new deps/files land; verified cross-platform.

0 commit comments

Comments
 (0)