/lets:take-taskfrom lets
Claims a tracker task, sets it to in_progress, creates or switches to a branch, and saves a per-branch task-state file. Handles uncommitted changes and team worktree switching.
Ships in lets. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Claim a tracker task and prepare the working environment.
IMPORTANT: If the spec below invokes any deferred tool (e.g.
AskUserQuestion), you MUST load and call it as specified. Never skip the call, never substitute a default answer of your own — the tool invocation is part of the contract. This is critical.
Multiple flows need "claim task + prepare branch": /lets:start, mid-session task switch, direct "візьми таск X". Centralizing ensures consistent branch naming, worktree handling, and session ref saving.
Tracker protocol: Skill(skill: "lets:protocol-tracker") before this and any later lets-tracker block here, unless its text is in your current context.
show task=<task-id>
Verify task exists. Then claim it (set-status is a state change - HARD-FAIL loud if the binding can't run; do NOT proceed to branch setup on a failed claim):
set-status task=<task-id> status=in_progress
Team worktree - lets worktree info --json reports a top-level team: this worktree belongs to a standing team and moves between tasks through lets worktree switch. Skip the generic question below and go to Step 2T. No team -> continue here.
Before switching branches, check for uncommitted changes:
git status --short
If changes exist and branch switch is needed, ask user:
AskUserQuestion(
questions=[{
question: "Uncommitted changes on current branch. What to do?",
header: "Uncommitted",
options: [
{ label: "Stash", description: "git stash, switch branch, remind to pop later" },
{ label: "Commit first", description: "Commit changes, then switch branch" },
{ label: "Stay", description: "Skip branch switch - work on current branch" }
],
multiSelect: false
}]
)
Handle response:
git stash, proceed with branch switch, remind to git stash pop later.task state file for the current branch; do NOT stop before it, or detect-task//lets:done are left with a claim but no boundary file).If staying on current branch (worktree, already correct) or no changes - skip this step.
Busy writer first. Before anything else, run ListAgents. A busy agent of THIS session that writes in this tree stops the switch: a group agent of .lets/cache/delegated-run-*.json with isolation: null listed running, or a Member: id of this lead session in the team file that ListAgents lists running and whose spawn brief .lets/cache/member-<team>-<name>.md ("You are (lets:) of team ") names lets:implementer - every team agent is classified by its spawn brief, never by the roster (/lets:team spawn may run any role under any name); a brief that is missing, unreadable or names no role counts as a writer, never as read-only -> stop: "{name} is still working in this tree - wait for its report, or stop it (/lets:team dismiss <name>, or the run's Stop), then /lets:start again"; nothing is switched. A brief naming any other role is read-only. The same agent idle -> one line "{name} is idle and keeps {branch}'s context - dismiss it before its next brief", continue. Isolated implementers and read-only roles never block.
Read ${CLAUDE_PLUGIN_ROOT}/protocol/worktrees.md before this step unless its text is in your current context (standing-team worktree, park never stash).
A team worktree never stashes. git status --short; changes present -> list them, and list separately every NEW path a park would need to name - untracked (git ls-files --others --exclude-standard) and staged additions (git diff --cached --diff-filter=ACR --name-only HEAD). Ignored files are never parked; they stay on disk. Then:
AskUserQuestion(
questions=[{
question: "Uncommitted changes on {branch} before switching to {task-id}. What to do?",
header: "Uncommitted",
options: [
{ label: "Commit first", description: "Commit them with /lets:commit, then switch" },
{ label: "Park", description: "Commit them as wip(<id>): park on this branch; unparked when you come back" },
{ label: "Stay", description: "Skip the switch - keep working on {branch}" }
],
multiSelect: false
}]
)
--include names only the paths the user confirmed; an unconfirmed new path makes the switch refuse (untracked_present, nothing touched) - say so, and let the user confirm it or remove it.No changes -> the switch below directly. The switch, from the team worktree:
lets worktree switch --task '<task-id>' --title-file .lets/cache/title-<session6>.txt --plugin-root "${CLAUDE_PLUGIN_ROOT}" --json
# Park: add --park and one --include '<path>' per confirmed new path
(The title file is written as in Step 4, with the Write tool.) Render the result:
ok=true -> "Switched to {branch}" (created -> "cut from {base}", with the staleness warning when base_stale); park -> name the park commit; unpark -> unparked (the parked changes are staged again), parked_pushed / parked_unverified / parked_kept (the park stays a commit - say why).warn step in steps[] -> print its message as one line, on success and on refusal - a convention_* / adapter_missing / board_not_in_main_checkout line names a naming declaration the tracker convention could not use, and the fix. Never drop one.error.kind and error.message, and "would have switched to {planned.branch}" when planned is set (a refusal never moved the tree), change nothing, stop: dirty_worktree, index_unmerged, operation_in_progress, detached_head (exit 14 - the tree must be sorted out first), untracked_present (list new_paths, back to the Park question), no_remote_base, target_is_merge_branch, remote_ambiguous (several remotes and none is the merge-branch's upstream or origin - set the upstream, then /lets:start again), base_ref_missing (no remote configured and no local merge branch - create it, then /lets:start again), session_held (another live session owns this task's boundary (error.message names it) - switch from it, after it ends, or pick another task), convention_declaration_invalid (a naming declaration cannot be read - fix the line it names, or pass --branch).already_on_target -> "already on it - nothing to switch; the tail below and Step 5 run".task_state_failed -> the worktree IS on {branch} - say so, then show error.remediation (the command that records the task from the session owning the line).lets worktree switch wrote the target branch's task-state (task, start, session through the session guard, orc carried from the old branch), so Step 5's own session write is skipped on this path. Its tail still runs on the new branch, passing only what switch did not write:
# {ORC_FLAG} as in Step 5: --orc '<name>' when args carried orc="<name>", else empty
lets worktree task-state set --clear-origin {ORC_FLAG} --json
It clears origin: and applies a requested orchestrator binding (an explicit --orc wins over the carried one). A failure is Step 5's one-line report - never hidden. Then rewrite the team file's ## 7. Current task section (.lets/teams/<team>.md; the lead is its only writer): replace only the task-specific content - the task as Title (id), its branch, the phase, the next step, and Resume artefacts: - and KEEP every existing line of the five forms of templates/team.md ## 7 - Member: <name> = <agentId> lets:<role> (lead <session6>), Member: <name> = gone (lead <session6>), Dismissed: <name> (lead <session6>), Reports: <dir> (lead <session6>), Members asked: (lead <session6>) - as it is, other lead sessions' lines too (they are history; readers filter by this lead session), so a member dismissed on the previous task stays dismissed, a member spawned on it keeps its id, the round's report directory stays known and the Members question is not asked twice. Then Step 6.
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
If in a worktree ($GIT_DIR contains worktrees/):
lets worktree switch, not from the current branch.lets worktree info --json --task-candidate --plugin-root "${CLAUDE_PLUGIN_ROOT}". task_candidate.source=created (the adapter's branch: / worktree-branch: shape, default worktree-<task-id>-<slug>) is this branch's task: confirm it with the user via the tracker's show verb. Any other result is an attached or externally named branch (e.g. feature/foo): rely on the task-id passed as the skill argument - never guess an id from the name by eye. No lets binary: the shapes are the ones detect-task Step 1 lists..task carries origin: branch or origin: dir). lets worktree adopt guessed the id from the branch or directory name. When take-task did NOT receive the id as its argument, confirm with the user that the derived id is the task, and when Step 1's show returned in_progress (before this claim) warn in one line that it may already be claimed in another worktree. An explicit id argument supersedes the guess with no question, so unattended --flow / --auto spawns never stop here. Step 5 clears origin:.If in main repo ($GIT_DIR is .git):
Branch naming: the active tracker convention names the branch, and Go renders it. Write the task title with the Write tool to .lets/cache/title-<session6>.txt (6 = first chars of $CLAUDE_CODE_SESSION_ID; the title is untrusted text and never typed into a shell), then:
lets worktree branch-name --task '<task-id>' --title-file .lets/cache/title-<session6>.txt --plugin-root "${CLAUDE_PLUGIN_ROOT}" --json
Use branch (e.g. feature/proj-ch15-fix-proxy-config; a board file can declare feature/PWA-45122-fix-login). Print each warn step's message from steps[] as one line - it names a naming declaration the convention could not use, and the fix. ok=false with convention_declaration_invalid -> show error.message and error.remediation, stop. No lets binary: the documented default feature/<task-id>-<slug> (slug: lowercase, spaces to hyphens, special chars removed, max 50 chars).
Check current state:
git checkout <branch>AskUserQuestion(
questions=[{
question: "How do you want to work on this task?",
header: "Workspace",
options: [
{ label: "Branch (Recommended)", description: "Regular feature branch in current repo" },
{ label: "Worktree", description: "Separate directory for parallel work in another terminal" },
{ label: "Stay on current branch", description: "Skip branch creation. On {LETS_MERGE_BRANCH}: /lets:done pushes + closes (no PR). On a custom branch: normal PR flow." }
],
multiSelect: false
}]
)
Handle response:
lets worktree base --json from the main checkout - Go fetches with its own deadline and applies the one base policy (the verb /lets:team run N1 uses); print each warn step of steps[] as one line (a stale fetch, local commits not in the base, no remote configured);ok=false (31 no_remote_base / remote_ambiguous, 13 base_ref_missing, or any other) -> show error.message and error.remediation, stop: nothing was cut; the task stays claimed (Step 1);ok=true -> git checkout --no-track -b <branch> <base_resolution.sha> (a sha cut gives the branch no upstream, like every implicit cut). When that sha is not HEAD, git carries uncommitted changes that do not conflict and refuses on a conflict (a local change or an untracked file the base would overwrite) -> show git's message as is, stop; never a stash, a reset or a -f to get past it;lets binary -> say the base policy needs the lets binary (/lets:update), stop; never fall back to the local {LETS_MERGE_BRANCH}.Skill(skill: "lets:worktree", args: "create <task-id> --title-file .lets/cache/title-<session6>.txt") (the id, not a name: the worktree command renders the adapter's worktree-branch: name from it), then relay how the new session opens - the worktree command's own output names it (a terminal command, or a cmux / tmux / Orca pane already running /lets:start <task-id>).
Stop here - the worktree session continues in a separate terminal or pane.git checkout -b; stay on the current branch (could be $LETS_MERGE_BRANCH or any pre-existing branch). Print one line:
"Staying on {current branch}. No new branch created."
If HEAD == $LETS_MERGE_BRANCH, append: " Trunk-mode: /lets:done will push + close (no PR — same-source-target)."
Continue to Step 5 (the .task state file is saved as usual).Write the per-branch task-state file .lets/sessions/.task-<branch-slug>: task: (identity), start: (task boundary - preserved across resume of the same task, reset on a new/changed task or when the recorded SHA is no longer an ancestor of HEAD), and session: <sha> <session-id> (this session's boundary, always refreshed); origin: is cleared (the id is now confirmed) and every other line - orc: included - is kept. lets worktree task-state owns the file (merge-write under a lock, validated values); without the binary, an atomic tmp+mv rewrite keeps the other lines too. <task-id> is the claimed id.
LETS_PROJECT_ROOT=$(git rev-parse --show-toplevel)
BRANCH=$(git branch --show-current); BRANCH_SLUG=$(echo "$BRANCH" | tr '/' '-')
mkdir -p "$LETS_PROJECT_ROOT/.lets/sessions"
TASK_FILE="$LETS_PROJECT_ROOT/.lets/sessions/.task-${BRANCH_SLUG}"
HEAD_SHA=$(git rev-parse HEAD)
CLAIMED_ID="<task-id>"; SID="$CLAUDE_CODE_SESSION_ID"
PREV_TASK=""; PREV_START=""
if [ -f "$TASK_FILE" ]; then
PREV_TASK=$(sed -n 's/^task: //p' "$TASK_FILE" | head -1)
PREV_START=$(sed -n 's/^start: //p' "$TASK_FILE" | head -1)
fi
# Preserve start: only when resuming the SAME task AND the recorded SHA is still an ancestor of HEAD.
if [ "$PREV_TASK" = "$CLAIMED_ID" ] && [ -n "$PREV_START" ] && git merge-base --is-ancestor "$PREV_START" HEAD 2>/dev/null; then
START="$PREV_START"
else
START="$HEAD_SHA"
fi
if command -v lets >/dev/null 2>&1; then
# {ORC_FLAG}: --orc '<name>' when args carried orc="<name>" and this is not the merge-branch (single-quoted, '\'' escaping); else empty
lets worktree task-state set --task "$CLAIMED_ID" --start "$START" --session-sha "$HEAD_SHA" --session-id "$SID" --clear-origin {ORC_FLAG} --create --json
else
tmp=$(mktemp "${TASK_FILE}.XXXX")
{
[ -f "$TASK_FILE" ] && grep -v -e '^task: ' -e '^start: ' -e '^session: ' -e '^origin: ' "$TASK_FILE"
echo "task: $CLAIMED_ID"
echo "start: $START"
echo "session: $HEAD_SHA $SID"
} > "$tmp" && mv -f "$tmp" "$TASK_FILE"
fi
On ok=false surface error.message - the claim succeeded but the boundary file did not, so /lets:done cannot measure the task until it is fixed. session_held (exit 35) -> "another live session owns this task's boundary (error.message names it) - the task is claimed, its boundary is not; run /lets:start in that session or after it ends".
orc="<name>" in the args, from detect-task's --orc strip). Pass it as {ORC_FLAG}; Go validates the name and a refusal is one line with nothing written. A trunk-mode claim (HEAD is {LETS_MERGE_BRANCH}) ignores it with one line - the merge-branch never carries a binding. When the envelope reports rebound.from, say in one line that this branch moved from that orchestrator to the new one.
orc= present, not trunk-mode, not a team worktree), read this session's own name with lets peers who --session "$CLAUDE_CODE_SESSION_ID" --json (self.name, repo_slug). When self.name is empty or differs from <repo_slug>-<task-id>, print ONE line: "Name this session: /rename <repo_slug>- - the orchestrator addresses workers by name." Never rename and never block; no binary or a failed call -> say nothing. (A worker an orchestrator launched through Orca cannot be given --name at launch - Orca takes no agent arguments.) A team worktree (lets worktree info --json reports a team - the Step 2T path) never gets this line: its session is the team's lead, named by the team file's lead_name, and /lets:start's team_lead hint owns that name - a rename to <repo_slug>-<task-id> would make team_lead read other and lose the lead at disband.If the branch already existed (continuing a multi-session task):
show task=<task-id>
comment-list task=<task-id>
Read the full description and ALL comments — they hold the multi-session context. Present: "Resuming {task title} ({task-id}). Last session: {summary from the latest tracker comment}"
Also surface the most recent session snapshot for this branch (the file trail /lets:start full-mode reads - the quick <task-id> path skips Step 1, so read it here):
LETS_PROJECT_ROOT=$(git rev-parse --show-toplevel)
BRANCH_SLUG=$(git branch --show-current | tr '/' '-')
# Task-id-named snapshot first (artifact-path naming, lets-05c4s); legacy {TS}-{branch}.md as fallback.
LATEST_SNAP=$(ls -t "$LETS_PROJECT_ROOT/.lets/sessions/"*"-<task-id>-snapshot"*.md 2>/dev/null | head -1)
[ -z "$LATEST_SNAP" ] && LATEST_SNAP=$(ls -t "$LETS_PROJECT_ROOT/.lets/sessions/"*"-${BRANCH_SLUG}"*.md 2>/dev/null | head -1)
If $LATEST_SNAP is non-empty, Read it and fold its ### Remaining + NEXT STEP into the "Last session: ..." line. If empty, rely on the tracker's comments alone (fresh branch - no snapshot yet).
When triggered standalone (not via /lets:start):
Task claimed: **{task title}** (`{task-id}`)
Branch: {branch-name}
┌─ LETS ────────────────────────────────────────────┐
│ Plan? /lets:plan · --fast · plan-workflow │
│ Check? /lets:check │
└───────────────────────────────────────────────────┘
When invoked by /lets:start OR /lets:done (via Skill tool) - skip this output, the calling command has its own. Per CLAUDE.md "Internal invocation = no box".
set-status task=<id> status=in_progress claimUser-facing skill. Auto-triggers on "take task X", "візьми таск". Primary consumer: /lets:start.
See: grep -r "take-task" commands/ for command references.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub restarter/lets-workflow --plugin lets20 skills in this plugin
/actor-fetch-personalityInternal skill for commands. Fetch and validate personality from URL or file path for Actor agent. Do not trigger on user conversation - only when commands need personality loading./agent-reportInternal skill for commands. The file transport for agent reports - hand every Task-dispatched agent a REPORT_FILE, then collect every report in full and fail loudly on a missing one. Do not trigger on user conversation - only when a command dispatches agents./apply-fixesInternal skill for commands. Apply a review's verified fixes to the working tree when nothing needs deciding - the --fix flag of /lets:check, /lets:review and /lets:handoff, and the final pass of /lets:review-round. Do not trigger on user conversation - only when one of those commands runs with --fix or reaches its final pass./artifact-pathInternal skill for commands. Resolve a unique, task-scoped, collision-safe path for an artifact written under .lets/ (plans, reviews, session snapshots, hand-off briefs, per-run agent report directories). Do not trigger on user conversation - only when a command is about to write an artifact./backlog-workflowDynamic Workflow asset for /lets:backlog review --workflow. Not auto-triggered - a workflow script invoked via scriptPath by /lets:backlog. Holds the off-context ideate -> cluster fan-out over the backlog./commitThis skill should be used when committing code changes - "commit", "git commit", "закоміть", "зроби коміт", "/lets:commit". Enforces the project's commit convention (default conventional commits), tracker task linking, and the gate level (`LETS_GATES`). In a LETS project, ALWAYS prefer this over generic commit skills (e.g. commit-commands:commit) — /lets:commit is authoritative. Triggers on any commit in any context.Other plugins' skills for the same job