From cafleet
Resolves the base directory for CAFleet scratch, audit, and figure files using git rev-parse and user confirmation. Internal skill for consumer skills only.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cafleet:cafleet-base-dirThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The `cafleet-base-dir` skill is the single authoritative resolver for every CAFleet scratch / audit / figure path. The resolution outcome (`${BASE}`) is the only legitimate root for those writes. Consuming skills MUST NOT compute `${BASE}` independently and MUST NOT fall back to `/tmp` when resolution returns the `<unset>` sentinel.
The cafleet-base-dir skill is the single authoritative resolver for every CAFleet scratch / audit / figure path. The resolution outcome (${BASE}) is the only legitimate root for those writes. Consuming skills MUST NOT compute ${BASE} independently and MUST NOT fall back to /tmp when resolution returns the <unset> sentinel.
/tmp/claude-code remains a perfectly valid resolved ${BASE} when this skill explicitly selects it via the AskUserQuestion branch — only bypassing base-dir to write to /tmp without its consent is forbidden.
This skill resolves ${BASE} using only git rev-parse --show-toplevel (Bash) and AskUserQuestion. It writes nothing at resolution time. Claude's job is to (a) pick the task-scope branch (Step 0) when the consuming skill operates on a per-task folder, otherwise the shared-root branch (Step 1); and (b) drive AskUserQuestion (Step 2) only when Step 1 reaches branch 3 (CWD is $HOME or under ~/.claude).
When the consuming skill operates on a per-task folder, it picks the task-folder path itself (the resolver is general-purpose and does NOT enumerate or special-case any bucket name — researches/, design-docs/, etc. are all consumer-side conventions). Resolve as follows:
git rev-parse --show-toplevel (Bash) from the CWD. A non-zero exit or empty output means "no .git ancestor" → STOP and tell the user to cd to the repo root and retry.$ARGUMENTS to the task-folder path per the consumer's convention (table below) BEFORE proceeding. The task-folder path may be relative or absolute... escape) → STOP ("refusing to create a task folder outside the repo").${BASE} = <unset> (the absolute-path-arg branch); create nothing.${BASE} = the absolute task folder. The folder is created lazily on the first consumer write (the Write tool auto-creates parent directories), so there is no resolution-time write. Audit files such as ${BASE}/prompts/<role>-<UTC-compact>.md land under the task folder rather than at the repo root.The consuming skill is responsible for passing a task-folder path that is the actual task folder, not a child file path — this procedure does no slug-folding or filename-stripping.
Consumer contract — canonicalize ARGUMENTS to the task-folder path before resolving. The procedure is deliberately general: it does not strip trailing filenames (e.g. /design-doc.md, /report.md) and does not strip leading bucket prefixes (e.g. design-docs/, researches/). It treats <task-folder>/ as the task folder exactly as supplied (created lazily on the first consumer write). Each consuming skill MUST canonicalize $ARGUMENTS against its own convention BEFORE running Step 0:
| Consumer | Canonical task-folder path form | Canonicalization steps |
|---|---|---|
The cafleet-design-doc-create / cafleet-design-doc-execute / cafleet-design-doc-interview skills | design-docs/<slug> | (1) strip trailing /design-doc.md if present; (2) strip leading design-docs/ if present; (3) prepend design-docs/. Absolute paths: apply ONLY step 1 (strip a trailing /design-doc.md); skip the bucket strip/prepend (steps 2–3) — the absolute path is used verbatim as the task folder (the trailing-filename strip stops a child file path from becoming a directory named after the file). |
The cafleet-research-report / cafleet-research-presentation skills | researches/<topic-slug> | (1) strip trailing /report.md (or other known per-topic filenames) if present; (2) strip leading researches/ if present; (3) prepend researches/. Absolute paths: apply ONLY step 1 (strip a trailing /report.md); skip the bucket strip/prepend (steps 2–3) — the absolute path is used verbatim as the task folder. |
Skipping canonicalization resolves the wrong BASE — a directory literally named design-doc.md (or report.md, etc.) instead of the intended task folder.
When the consuming skill has no per-task folder convention (the shared-root case):
$HOME. Let claude_subdir = $HOME/.claude.$HOME itself nor claude_subdir (~/.claude) nor any directory under ~/.claude → ${BASE} is the CWD itself (the working directory, not the repo root). Done. (Only $HOME exactly and the ~/.claude subtree fall through to Step 2 — an ordinary project elsewhere under $HOME resolves here.)$HOME exactly, or ~/.claude / any directory under it) → go to Step 2 with candidates [/tmp/claude-code, <CWD>].Present the candidates via AskUserQuestion ("Select the base directory for output files:"):
/tmp/claude-code (recommended) → ${BASE} = /tmp/claude-code${CWD} → ${BASE} = ${CWD} (the CWD literal from the candidates list)Other (free text) → ${BASE} = user input (resolve against ${CWD} if relative)The chosen value is ${BASE}. Nothing is persisted; if the skill reloads in the same $HOME / ~/.claude CWD, this branch re-prompts.
Every CAFleet member, every consumer skill, and every Director MUST follow this protocol for scratch / audit / figure / spawn-prompt-render writes:
Every write under ${BASE} or an explicit consumer-supplied absolute target. Scratch (pre-spawn renders of spawn prompts at ${BASE}/prompts/<role>-<UTC-compact>.md, working notes), audit files, figure artifacts, and any other ephemeral output MUST land under ${BASE} or under a consumer-supplied absolute path — e.g., the design-doc directory delivered to spawned members via [INSERT abs design-doc directory], or the research folder delivered via [INSERT abs research folder]. Never /tmp unless ${BASE} itself is /tmp/claude-code (which is a legitimate base-dir choice).
${BASE} == <unset> is a hard stop, not a fallback. If ${BASE} is the literal sentinel <unset> (absolute-path argument branch), any code that tries to compute a path from ${BASE} MUST abort with Error: BASE is <unset>; refusing to fall back to /tmp. The loud failure is the safety net for sites that forgot to guard explicitly.
Members never re-resolve BASE. The Director's spawn-prompt substitution delivers ${BASE} to each spawned member as a literal absolute path baked into the spawn prompt. Members MUST use that literal path verbatim. Members DO load this skill at startup (per their role file's Load at Startup block) to pick up the no-bypass write protocol and the <unset> sentinel contract — but they MUST NOT run the resolution procedure (Steps 0–2) or otherwise derive a new ${BASE} of their own. Re-resolving would invite drift if the Director's resolved BASE changed mid-session.
Missing-BASE-line anchorless status. If a member's spawn prompt is missing the BASE: line entirely (an expected outcome when the Director resolved ${BASE} = <unset>), the member treats the audit-file feature as disabled and emits a single CAFleet message back to the Director as a parens-free anchorless status (per skills/cafleet-design-doc/coordination.md § Anchorless Status):
audit-disabled no BASE in spawn prompt
The phrasing deliberately omits parentheses so a Director reading the broker log does not misinterpret it as a malformed <verb> (<pointer>) hop. The member MUST NOT fall back to /tmp.
<unset> sentinelcafleet-base-dir is the only producer of BASE=<unset> — the literal string "<unset>" (case-sensitive), returned by the absolute-path-arg branch (Step 0). A consumer with ${BASE} == <unset> follows the No-bypass write protocol above: guard every audit-file write with an explicit ${BASE} != <unset> check at the call site (a guarded skip is the intended path — no silent no-op, no /tmp fallback); omit the BASE: line entirely from spawn prompts (never write the literal BASE: <unset>), so the member's existence-check treats audit-files as disabled; and loud-error on any unguarded Path(BASE) / … computation (the abort string in item 2).
npx claudepluginhub himkt/cafleet --plugin cafleetSets up and manages .claude/.scratch workspace for temporary drafts, experiments, and gitignored files with organization, best practices, and promotion workflows.
Creates isolated git worktrees with smart directory selection and safety verification. Use when starting feature work needing branch isolation.
Generates the /process orchestrator command for a repo by writing .claude/commands/process.md that reads process-template.json and walks through configured workflow steps.