Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"name": "work-system",
"source": "./plugins/work-system",
"description": "Generic task and worktree workflow system for Claude Code. Manage tasks as markdown files, run them in isolated git worktrees with a choice of worker agent (Claude, codex, or grok), and track progress across the define/kickoff/continue/status/close lifecycle.",
"version": "1.9.2"
"version": "1.9.3"
},
{
"name": "pr-flow",
Expand Down
2 changes: 1 addition & 1 deletion .claude/knowledge/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## Features
- `features/backfill-and-origin-metadata.md` — `/backfill-knowledge` significance bar + origin-reconstruction cascade
- `features/statusline-integration.md` — Status-line segments: plugins can't own `statusLine.command`; marker-block injection; the `[ks …]` + `[ws …]` two-segment coexistence and ws's never-block-on-network PR cache
- `features/herdr-kickoff-automation.md` — herdr `herdr-launch.sh`: `launch` (`/kickoff`) + `resume` (`/continue <task>` reopens an `/exit`-closed tab)
- `features/herdr-kickoff-automation.md` — herdr `herdr-launch.sh`: `launch` (`/kickoff` + `/adopt`) + `resume` (`/continue <task>` reopens an `/exit`-closed tab)
- `features/herdr-close-automation.md` — `/close` in herdr: cwd-tab teardown, plugin SessionEnd hook, the one TUI-exit primitive, detached self-exit onto idle
- `features/herdr-tab-glyphs.md` — Task-state glyphs (`○ ● ◇ ◆ ✓`) + main-root `◉` on herdr tab labels: `states` mode in the self-contained renderer, sync-vs-`--cached` PR refresh per caller, exact-cwd rename rules, soft pr-flow shim
- `features/kickoff-agent-selection.md` — `/kickoff` worker choice: single committed per-repo default (no global/fallback/ranking) else picker; `agent-registry.sh` as SoT; bounded model-aware grok probe (inconclusive→trust-auth); non-claude "document, don't fake" degradation; announce-not-prompt for external defaults
Expand Down
40 changes: 32 additions & 8 deletions .claude/knowledge/features/herdr-kickoff-automation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "herdr /kickoff + /continue-reopen Automation"
createdAt: 2026-06-24
updatedAt: 2026-07-21
updatedAt: 2026-07-23
createdFrom: "PR #17"
updatedFrom: "session: 2026-07-21 (fully-qualify kickoff's /continue)"
pluginVersion: 1.9.2
updatedFrom: "session: 2026-07-23 (adopt auto-launch reuses launch)"
pluginVersion: 1.9.3
prime: false
reindexedAt: 2026-07-12
---
Expand All @@ -14,7 +14,8 @@ reindexedAt: 2026-07-12
Inside a herdr session, `/kickoff` replaces its manual "open a terminal yourself"
block with an automated tab launch. The launch lives in one shared, testable
helper — `plugins/work-system/scripts/herdr-launch.sh` — with two subcommands:
`launch` (called from `skills/kickoff/SKILL.md` step 13) and `resume` (called from
`launch` (called from **both** `skills/kickoff/SKILL.md` step 13 and
`skills/adopt/SKILL.md` step 13 — see the adopt note below) and `resume` (called from
`skills/continue/SKILL.md`'s reopen path — the main session with a `<task>` arg, or
a *different* task's name given from inside a worktree). The helper is the source of
truth; this entry captures the durable design and one non-obvious gotcha.
Expand All @@ -23,10 +24,10 @@ truth; this entry captures the durable design and one non-obvious gotcha.

- **Encapsulate the launch in a script, not skill prose.** The deterministic
sequence (gate → `agent start` → robust pane-id parse → `pane move` → exit code)
lives in `herdr-launch.sh` so it can be `bash`-tested and reused (e.g. by a
future `/adopt` automation), per the project's helper-script convention and the
"prose skill logic drifts" memory. The skill only derives the label and branches
on the helper's `moved=yes|no` / exit code.
lives in `herdr-launch.sh` so it can be `bash`-tested and reused — realized in
work-system 1.9.3 by `/adopt` (see the adopt note below) — per the project's
helper-script convention and the "prose skill logic drifts" memory. The skill only
derives the label and branches on the helper's `moved=yes|no` / exit code.
- **Spawn the worker as argv, never type it into a shell.** The launch is
`herdr agent start "<label>" … -- <worker argv>`, which execs the worker binary
directly. As of work-system 1.9.0 the worker argv is **resolved from the chosen
Expand Down Expand Up @@ -113,6 +114,29 @@ truth; this entry captures the durable design and one non-obvious gotcha.
in all of this — every case above, plus the stdout contract, as regression
coverage the first round shipped without.

## `/adopt` auto-launch: reference kickoff's prose, don't duplicate it

work-system 1.9.3 gave `/adopt` the same in-herdr tab launch as `/kickoff`: after it
builds the worktree from an existing branch, `skills/adopt/SKILL.md` step 13 calls the
identical `herdr-launch.sh launch "$LABEL" "$WORKTREE" "$HERDR_WORKSPACE_ID" "$SELECTOR"`
(step 12 resolves the worker selector exactly as kickoff does — `/adopt` grew an
optional `[agent-selector]` arg for it). Two durable decisions:

- **One copy of the intricate branching.** The launch *helper* is already the single
source of truth for the mechanics, but the *skill prose* around it (the picker/announce
rules of step 12, and the exit-0-`moved`/exit-2/exit-3/non-zero result branching of
step 13) is stateful logic that drifts if copied — the "prose skill logic drifts"
memory. So adopt's steps **reference** `kickoff/SKILL.md` step 12/13 for that shared
logic and inline only the adopt-specific deltas, rather than a full paraphrase that
would silently diverge under later edits.
- **Adopt-specific deltas that must stay inline.** (1) The `LABEL` derives from the
*resolved* task name (prefix-stripped), because `/adopt` may **keep the original
branch name** rather than rename to `task/<name>` — deriving from the branch would
give a nonsense label. (2) The success/manual templates show `<current-branch-name>`
(the adopted branch, possibly not `task/<name>`), not kickoff's assumed `task/<name>`.
(3) The worktree path is built from the `<main-repo>` captured in adopt step 1, never a
possibly-drifted CWD (adopt runs in the main-repo session — its whole cwd-safety spine).

## `resume` mode: reopen a task tab a `/exit` closed

A kickoff tab runs Claude as its **root pane** (argv-exec above), so a clean `/exit`
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ entries are grouped per plugin, newest first.

## work-system

### 1.9.3 — 2026-07-24
- `/adopt` now auto-launches inside herdr, exactly like `/kickoff`: after it builds the worktree from an existing branch it opens the task's tab and starts the chosen worker there (outside herdr it prints the manual launch block unchanged). Reuses the shared `herdr-launch.sh launch` helper — no launch logic duplicated; the intricate result-branching and picker/announce rules stay a single source in `/kickoff`'s steps 12/13, which `/adopt` references. `/adopt` grew an optional `[agent-selector]` argument (`--fable`/`--opus`/`--sol`/`--grok`/`--codex`/`--agent <cli[:model]>`/`--pick`, same set as `/kickoff`); the branch is parsed position-independently from the selector. The tab label derives from the *resolved* task name, so it stays sensible when `/adopt` keeps the original branch name rather than renaming to `task/<name>`. READMEs and the `herdr-kickoff-automation` knowledge entry updated to cover both callers.

### 1.9.2 — 2026-07-21
- Fix: `/kickoff`-launched Claude workers no longer run the wrong `/continue`. The machine-generated launch prompt is now the plugin-qualified `/work-system:continue`, not the bare `/continue` — a Claude Code built-in/alias `/continue` can shadow the plugin skill (and plugin skills are only *guaranteed* reachable via their `plugin:skill` namespace), so a freshly-launched worker was running CC's own resume (nothing to resume in a new worktree → idle, TASK.md never loaded) instead of the work-system resume flow. Changed at all machine-invocation sites: `agent-registry.sh` `emit_argv` (the selector path), `herdr-launch.sh`'s legacy no-selector fallback, kickoff's outside-herdr manual block, and the README launch examples; `test_agent_registry.py` asserts the qualified form. Human-typed reopen instructions (`/work-system:continue <task>`) updated to match. **Deployment note:** `agent-registry.sh` / `herdr-launch.sh` run from the *plugin cache*, not the repo, so live launches only pick up this fix after a `/plugin` marketplace update + reload refreshes the cache.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Lightweight, native knowledge management for Claude Code projects. Three layers

### Work System

Generic task and worktree workflow system. Manage tasks as markdown files, work in isolated git worktrees, and track progress through the full lifecycle. `/kickoff` runs the repo's default worker agent (Claude, codex, or grok — a single committed per-project default), or, when none is set, shows a picker and offers to save your choice; override per run with flags like `--opus`/`--sol` or `--pick`. Inside a [herdr](plugins/work-system/README.md#herdr-integration) session it auto-opens a tab (named after the task, shortened for the sidebar and prefixed with the task's state glyph — `●` active, `◇` in review, `◆` approved, `✓` merged) with the worktree as cwd, starts the chosen worker, and — for a Claude worker — runs `/work-system:continue` for you (plugin-qualified, since a Claude Code built-in `/continue` shadows the bare skill); `/work-system:continue <task>` from the main session reopens that tab and resumes it if a stray `/exit` closed it; and `/close` tears the tab down again when the task is merged.
Generic task and worktree workflow system. Manage tasks as markdown files, work in isolated git worktrees, and track progress through the full lifecycle. `/kickoff` runs the repo's default worker agent (Claude, codex, or grok — a single committed per-project default), or, when none is set, shows a picker and offers to save your choice; override per run with flags like `--opus`/`--sol` or `--pick`. Inside a [herdr](plugins/work-system/README.md#herdr-integration) session it auto-opens a tab (named after the task, shortened for the sidebar and prefixed with the task's state glyph — `●` active, `◇` in review, `◆` approved, `✓` merged) with the worktree as cwd, starts the chosen worker, and — for a Claude worker — runs `/work-system:continue` for you (plugin-qualified, since a Claude Code built-in `/continue` shadows the bare skill); `/adopt` auto-opens the same tab once it has built the worktree from an existing branch; `/work-system:continue <task>` from the main session reopens that tab and resumes it if a stray `/exit` closed it; and `/close` tears the tab down again when the task is merged.

**Commands:** `/define`, `/kickoff`, `/adopt`, `/continue`, `/status`, `/close`, `/list`, `/statusline`

Expand Down
2 changes: 1 addition & 1 deletion plugins/work-system/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "work-system",
"description": "Generic task and worktree workflow system for Claude Code. Manage tasks as markdown files, run them in isolated git worktrees with a choice of worker agent (Claude, codex, or grok), and track progress across the define/kickoff/continue/status/close lifecycle.",
"version": "1.9.2",
"version": "1.9.3",
"author": {
"name": "gering"
},
Expand Down
33 changes: 22 additions & 11 deletions plugins/work-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,32 +188,37 @@ note into the worktree is an optional way to give them standing task guidance.
## herdr integration

When you run the work system inside a **herdr** session (herdr is a terminal
multiplexer for AI coding agents), `/kickoff` and `/close` automate the terminal
juggling you'd otherwise do by hand — `/kickoff` opens the task's tab, `/close`
tears it down. They activate when `HERDR_ENV=1`, a herdr workspace id is set, and
multiplexer for AI coding agents), `/kickoff`, `/adopt`, and `/close` automate the
terminal juggling you'd otherwise do by hand — `/kickoff` and `/adopt` open the
task's tab, `/close` tears it down. They activate when `HERDR_ENV=1`, a herdr workspace id is set, and
both `herdr` and `python3` are on `PATH`; if any prerequisite is missing or the
socket is unreachable they fall back to the plain, herdr-free behaviour, so you're
never left stranded. Outside herdr, every skill behaves exactly as documented above.

### `/kickoff` opens a named tab
### `/kickoff` and `/adopt` open a named tab

Inside herdr, `/kickoff` doesn't just create the worktree and print manual
instructions — it opens a new herdr **tab** in the *same* workspace, with the
worktree as its cwd, and starts the task there for you:
worktree as its cwd, and starts the task there for you. `/adopt` does exactly the
same once it has created the worktree from an existing branch — same helper, same
tab, same worker selection (`--opus`/`--sol`/`--grok`/`--pick`, or the repo default);
its tab label comes from the *resolved* task name, so it's sensible even when `/adopt`
keeps the original branch name rather than renaming it to `task/<name>`:

- The tab is **named after the task** (shortened for a readable sidebar — see
`skills/kickoff/SKILL.md` step 13 for the exact rule), so the sidebar shows one
clear entry per task instead of a wall of identical agents. The same short label
names the herdr agent (and, for a claude worker, the `-n` session); the
underlying `task/<name>` branch is unchanged, so the resume flow still resolves
the task.
names the herdr agent (and, for a claude worker, the `-n` session); the task's
branch — `task/<name>` from `/kickoff`, or the original branch `/adopt` kept — is
unchanged, so the resume flow still resolves the task.
- The chosen worker is launched directly as argv (`herdr agent start … --
<resolved worker command>`), so the real CLI process is what herdr's agent-state
detection sees. A claude worker gets `claude --model <m> -n "<label>" "/work-system:continue"`
and loads the task context automatically; a codex/grok worker gets a bootstrap
prompt (read `TASK.md`, drive the task to a PR) since they have no work-system skills.
- The new tab opens in the background (`--no-focus`), so your kickoff session
stays in front; switch to the tab when you're ready to work there.
- The new tab opens in the background (`--no-focus`), so the session you launched
from (`/kickoff` or `/adopt`, in the main repo) stays in front; switch to the tab
when you're ready to work there.

### `/close` tears down the task's tab

Expand Down Expand Up @@ -306,14 +311,20 @@ keep the plain label, since those are stable identities.
Already started work on a branch outside the work system? Use `/adopt` to bring it in:

```
> /adopt feature/dark-mode
> /adopt feature/dark-mode # repo default worker
> /adopt feature/dark-mode --opus # claude on opus
> /adopt feature/dark-mode --sol # codex on gpt-5.6-sol
> /adopt feature/dark-mode --pick # force the interactive picker
```

This will:
1. Analyze your branch's commit history and changed files
2. Generate a task file from that context
3. Optionally rename the branch to `task/<name>` for consistency
4. Create a worktree and set everything up
5. Inside a [herdr](#herdr-integration) session, open the task's tab and start the
chosen worker there (same auto-launch as `/kickoff`); outside herdr it prints the
manual launch command instead

After adoption, the standard workflow applies (`/continue`, `/status`, `/close`).

Expand Down
2 changes: 1 addition & 1 deletion plugins/work-system/scripts/herdr-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Two modes share one precondition/JSON-parse/output contract:
#
# launch (/kickoff) — spawn the chosen worker as ARGV via `agent start … --
# launch (/kickoff, /adopt) — spawn the chosen worker as ARGV via `agent start … --
# <worker-argv>`, then move it into its own background tab.
# The worker is the tab's ROOT pane, so a later clean /exit
# ends the pane and herdr closes the tab. Argv-exec
Expand Down
Loading
Loading