sw-adopt
Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Specwright health check. Validates shared config, anchor docs, workflow and session state, commands, gates, and hooks. May backfill shipped PR metadata when it can prove the mapping safely.
Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers.
Initializes Specwright in a project. Detects stack, asks about practices, creates constitution and charter, configures quality gates and hooks.
Shows current Specwright state for this worktree, the attached work, repo-wide active works, gate results, and lock status. Supports --reset, --cleanup, and --repair {unitId}.
Periodic codebase health check. Analyzes architecture, complexity, consistency, and debt across the full codebase. Produces persistent findings in AUDIT.md.
TDD implementation of one work unit. Delegates test writing to the tester agent and implementation to the executor agent. Commits per task.
| name | sw-adopt |
| description | Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency. |
| argument-hint | <work-id> |
| allowed-tools | ["Read","Write","Bash","Glob"] |
Attach an existing work to the current worktree without creating split-brain ownership. This skill attaches only the current worktree session.
attachedWorkId when re-adopting the already-selected work{worktreeStateRoot}/session.json for the current worktree{repoStateRoot}/work/{workId}/workflow.jsonsession.json files discovered via git worktree list --porcelain{worktreeStateRoot}/session.json for the current worktree onlyworkflow.json.attachment pointing at the current
worktree when adoption succeedsScope (LOW freedom):
/sw-adopt is the explicit same-work adoption flow. It must not silently run
during /sw-design, /sw-plan, /sw-build, /sw-verify, or /sw-ship./sw-adopt never rewrites another worktree's session.json./sw-adopt.Target resolution (LOW freedom):
session.json.attachedWorkId as a fallback.{repoStateRoot}/work/{workId}./sw-design.Ownership validation (LOW freedom):
session.json files to determine live-versus-dead session
state for the target work.workId./sw-adopt does
not perform remote session surgery.Branch consistency (LOW freedom):
building, verifying, or shipping,
validate branch consistency against workflow.json.branch.Mutation boundary (LOW freedom):
session.json and the target
work's workflow.json.workflow.json.attachment to the current worktree,
refresh workflow.json.branch from the current worktree branch, and refresh
liveness timestamps.protocols/state.md -- live ownership, attachment validation, subordinate rulesprotocols/context.md -- logical roots and session discoveryprotocols/git.md -- recorded branch context| Condition | Action |
|---|---|
| No target work resolves | STOP: "Pass a work ID or run /sw-design first." |
| Target work does not exist | STOP with a missing-work error |
| Current session is subordinate | STOP: "Subordinate helper sessions cannot adopt work." |
| Another live top-level worktree owns the target work | STOP with live-owner guidance |
| Recorded branch mismatch for in-flight work | STOP with branch-consistency guidance |