agent-comms
SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a…
Scaffolding worktree lifecycle, diagnostics, and recovery. TRIGGER when: debugging worktree isolation, recovering a stuck worktree, or managing task isolation. SKIP: ordinary branch/commit/merge operations (use git-operations).
$ npx -y skills add komluk/scaffolding --skill worktree-management --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/worktree-managementContext preview
The summary Claude sees to decide when to auto-load this skill.
Scaffolding worktree lifecycle, diagnostics, and recovery. TRIGGER when: debugging worktree isolation, recovering a stuck worktree, or managing task isolation. SKIP: ordinary branch/commit/merge operations (use git-operations).
name: worktree-management description: "Scaffolding worktree lifecycle, diagnostics, and recovery. TRIGGER when: debugging worktree isolation, recovering a stuck worktree, or managing task isolation. SKIP: ordinary branch/commit/merge operations (use git-operations)."
Scaffolding.tool-specific worktree lifecycle management, diagnostics, and recovery procedures.
Live worktrees: !`git worktree list 2>/dev/null || true`
Other agents (developer, architect) do NOT commit. The worktree flow is: 1. Agent writes code/tests in worktree 2. **gitops** commits, merges to main, pushes, cleans up
If a worktree has no new commits after an agent finishes, the changes are uncommitted — gitops must commit them BEFORE merge.
When Agent Teams is enabled (`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`, see `docs/agent-teams.md`), multiple writer teammates may run concurrently. The worktree model makes this safe ONLY if both hold:
`.scaffolding/worktrees/{task_id[:12]}` AND its OWN unique `SCAFFOLDING_TASK_ID`. No two writers share a working tree or a `/tmp/scaffolding-mtime-${TASK_ID}.json` staleness store — sharing would trip `file-staleness-check.sh` between them and produce unattributable interleaved changes.
branches to main ONE AT A TIME through the `merging`→`merged` states below. Parallel work is allowed; parallel committing/merging is not — only one merge is ever in flight.
create_worktree() --> agent executes (no commit) --> gitops: commit
--> gitops: merge_to_main() --> gitops: push --> gitops: cleanup| Status | Meaning | |--------|---------| | `ready` | Created, waiting for task execution | | `merging` | Merge in progress | | `merged` | Successfully merged to main | | `conflict` | Merge conflict detected | | `cleanup` | Being removed | | `removed` | Fully cleaned up |
| Resource | Path | |----------|------| | Worktrees directory | `.scaffolding/worktrees/` | | Worktree metadata | `.scaffolding/worktrees/{task_id[:12]}/worktree.json` | | Branch naming | `scaffolding/{task_id[:12]}` |
git worktree list ls -la .scaffolding/worktrees/
for d in .scaffolding/worktrees/*/; do
changes=$(cd "$d" && git status --porcelain 2>/dev/null | wc -l)
if [ "$changes" -gt 0 ]; then
echo "UNCOMMITTED: $d ($changes files)"
fi
donegit worktree remove --force .scaffolding/worktrees/{task_id[:12]}
git branch -D scaffolding/{task_id[:12]}
rm -rf .scaffolding/worktrees/{task_id[:12]}
git worktree prunecd .scaffolding/worktrees/{task_id[:12]}
git add -A && git stash
cd /project/root && git stash popAfter a merge or discard finishing action, clean up the worktree:
git worktree remove .scaffolding/worktrees/{task_id[:12]} 2>/dev/null
rm -rf .scaffolding/worktrees/{task_id[:12]}
git worktree pruneNote: Only needed for **merge** and **discard** actions. PR and keep actions leave the worktree intact.
Spec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 36 skills, 19 commands, 15 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.
Repo: komluk/scaffolding
SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a…
3-tier markdown memory protocol (shared/agent/conversation) for cross-session knowledge. TRIGGER when: reading or writing agent memory files, choosing which…
RESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new API endpoints, defining error…
Optimize Claude Code context-window usage for accuracy and cost. TRIGGER when: hitting context limits, structuring prompts for an agent, or trimming what gets…
Schema design, index strategy, migration safety, and query analysis. TRIGGER when: designing tables or indexes, writing a migration, or diagnosing a slow…