@jeiemgi/cckit 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +21 -8
  3. package/README.md +119 -20
  4. package/bin/cckit +42 -16
  5. package/cckit.config.json +1 -1
  6. package/commands/kit-doctor.md +3 -1
  7. package/commands/kit-update.md +9 -4
  8. package/kit.config.schema.json +25 -0
  9. package/package.json +1 -1
  10. package/scripts/annotate-setup.sh +7 -2
  11. package/scripts/capture-project-ids.sh +23 -10
  12. package/scripts/init-upgrade-test.sh +35 -1
  13. package/scripts/init.sh +43 -7
  14. package/scripts/kit-doctor.sh +185 -7
  15. package/scripts/kit-version-check-test.sh +36 -0
  16. package/scripts/kit-version-check.sh +19 -4
  17. package/scripts/kit-wire.sh +4 -1
  18. package/scripts/knowledge-lint.sh +4 -1
  19. package/scripts/lib/board-view-test.sh +54 -0
  20. package/scripts/lib/board-view.sh +80 -0
  21. package/scripts/lib/captain-test.sh +18 -0
  22. package/scripts/lib/captain.sh +92 -5
  23. package/scripts/lib/config-path-test.sh +47 -0
  24. package/scripts/lib/config-path.sh +29 -0
  25. package/scripts/lib/copilot.sh +9 -9
  26. package/scripts/lib/effort-dispatch-test.sh +25 -0
  27. package/scripts/lib/effort-flows-test.sh +55 -0
  28. package/scripts/lib/effort-metrics-test.sh +57 -0
  29. package/scripts/lib/effort-metrics.sh +19 -5
  30. package/scripts/lib/effort-ops-test.sh +110 -3
  31. package/scripts/lib/effort-ops.sh +480 -50
  32. package/scripts/lib/effort-parity-test.sh +128 -0
  33. package/scripts/lib/effort-slug-test.sh +87 -0
  34. package/scripts/lib/effort-slug.sh +104 -0
  35. package/scripts/lib/effort.sh +91 -1
  36. package/scripts/lib/gh-project-test.sh +95 -0
  37. package/scripts/lib/gh-project.sh +22 -7
  38. package/scripts/lib/git-remote-test.sh +57 -0
  39. package/scripts/lib/git-remote.sh +21 -0
  40. package/scripts/lib/kit-config-test.sh +37 -0
  41. package/scripts/lib/kit-config.sh +38 -13
  42. package/scripts/lib/kit-engine-test.sh +9 -0
  43. package/scripts/lib/kit-events.sh +5 -3
  44. package/scripts/lib/kit-gc-test.sh +88 -0
  45. package/scripts/lib/kit-gc.sh +136 -19
  46. package/scripts/lib/kit-local.sh +8 -1
  47. package/scripts/lib/kit-operate.sh +17 -2
  48. package/scripts/lib/next.sh +3 -3
  49. package/scripts/lib/plan-next-test.sh +87 -0
  50. package/scripts/lib/plan-next.sh +212 -0
  51. package/scripts/lib/project-scan.sh +7 -1
  52. package/scripts/lib/worktree-start.sh +12 -3
  53. package/scripts/lib/zsh-safety-test.sh +73 -0
  54. package/scripts/portable-test.sh +62 -20
  55. package/scripts/setup-labels.sh +13 -2
  56. package/scripts/showcase.sh +13 -4
  57. package/scripts/status-test.sh +63 -0
  58. package/scripts/status.sh +12 -4
  59. package/scripts/task-sync.sh +79 -10
  60. package/skills/kit-autopilot/SKILL.md +5 -0
  61. package/skills/{docs-writer → kit-docs-writer}/SKILL.md +2 -2
  62. package/skills/kit-effort-close/SKILL.md +52 -104
  63. package/skills/kit-effort-new/SKILL.md +40 -112
  64. package/skills/kit-effort-pr/SKILL.md +6 -2
  65. package/skills/kit-effort-start/SKILL.md +44 -46
  66. package/skills/kit-next/SKILL.md +4 -0
  67. package/skills/kit-plan-next/SKILL.md +82 -0
  68. package/skills/kit-task-start/SKILL.md +44 -55
  69. package/templates/CLAUDE.md.tmpl +1 -1
  70. package/templates/agents/auto-dev.md +1 -1
  71. package/templates/hooks/mempal_session_start.sh.tmpl +36 -2
  72. package/templates/rules/effort-model.md +43 -6
  73. package/templates/rules/mempalace.md +1 -0
  74. package/templates/rules/plan-next.md +58 -0
  75. package/templates/rules/task-management.md +1 -1
@@ -7,10 +7,11 @@ when_to_use: When starting a new unit of work (a "plan"/effort) that decomposes
7
7
  # kit-effort-new
8
8
 
9
9
  Plugin-direct skill — runs straight from `${CLAUDE_PLUGIN_ROOT}` (no per-project `scripts/` checkout
10
- needed). Helpers are sourced from the plugin; the verb logic lives in `scripts/lib/effort.sh`
11
- (`effort_link_sub`), never re-authored inline (kit-engine-boundary #1/#2). Repo + board config come
12
- from `load_kit_config` (`$KIT_REPO`, `KIT_PROJECTS_V2`). Reads `.claude/kit.config.json` from the
13
- working directory.
10
+ needed). It is a **thin caller** of the shared creation core `effort_new` (`scripts/lib/effort-ops.sh`)
11
+ — the exact function `cckit effort new` runs — so the skill and the verb produce structurally
12
+ identical efforts (effort #98). No creation logic is re-authored inline (kit-engine-boundary #1/#2).
13
+ Repo + board config come from `load_kit_config` (`$KIT_REPO`, `KIT_PROJECTS_V2`). Reads
14
+ `.claude/kit.config.json` from the working directory.
14
15
 
15
16
  Creates the **parent issue** (the plan) + **N native sub-issues** for one effort. See
16
17
  `rules/effort-model.md` for the model and the parent-issue template. GitHub is the single source of
@@ -22,7 +23,7 @@ truth — the parent issue IS the plan (no separate plan file).
22
23
  | ------------ | -------- | ------------------------------------------------------------------------------------------- |
23
24
  | Title | ✓ | The human **name only** (no `[Effort]`/number prefix) — the skill composes the board title. Concise, no jargon (`effort_title_lint`) |
24
25
  | Role | ✓ | `tech-lead` / `frontend` / … → `role:<role>` label + board Role field |
25
- | Flow | optional | Controlled-vocab flow (`EFFORT_FLOWS`) → `[Flow]` title tag + `flow:<flow>` label |
26
+ | Flow | optional | Controlled-vocab flow (`effort.flows` in the project config; `EFFORT_FLOWS` env overrides) → `[Flow]` title tag + `flow:<flow>` label |
26
27
  | Goal | ✓ | 1–2 lines — `## Goal` |
27
28
  | Scope | ✓ | The sub-issue DAG — `## Scope` (mark each parallel \| sequential) |
28
29
  | For agents | ✓ | Exact file paths / entry points — `## For agents` |
@@ -34,120 +35,47 @@ truth — the parent issue IS the plan (no separate plan file).
34
35
 
35
36
  ## Execution
36
37
 
38
+ This skill is a **thin caller** of the shared creation core `effort_new`
39
+ (`scripts/lib/effort-ops.sh`) — the SAME function `cckit effort new` runs (effort #98). The core owns
40
+ body composition, the `ctx/kind/priority/role/flow` label set, per-sub title lint, native sub-issue
41
+ links, `blocked_by` edges, and the board add. There is no second implementation here.
42
+
37
43
  ```bash
38
44
  source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
39
- [[ "$KIT_PROJECTS_V2" == "true" ]] && { source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids; }
40
- source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/role-identity.sh" 2>/dev/null || true
41
- source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort.sh"
42
- source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort-metrics.sh" # effort_ctx_bucket
43
-
44
- # TITLE = the human NAME only; the board title is composed as "[Effort] <N> · [<FLOW>] <TITLE>"
45
- # (N is injected after creation — it's the issue's own number). FLOW is an optional controlled-vocab tag.
46
- FLOW_TAG=""; [[ -n "${FLOW:-}" ]] && FLOW_TAG="[$FLOW] "
47
-
48
- # 0. Guard the title content BEFORE creating anything: concise, no jargon, valid flow tag.
49
- # Lint with a placeholder number — the rule is about the NAME, not the (not-yet-assigned) N.
50
- effort_title_lint "[Effort] 0 · ${FLOW_TAG}${TITLE}" \
51
- || { echo "✗ fix the effort title (above) before creating — concise / no-jargon / valid flow" >&2; return 1; }
52
-
53
- # 1. Compose the parent body (the 4 sections) + an optional ## Relations chain.
54
- RELATIONS=""
55
- if [[ -n "${DEPENDS_ON:-}" ]]; then
56
- RELATIONS=$'\n\n## Relations\n'
57
- for d in ${DEPENDS_ON//,/ }; do d="${d#\#}"; RELATIONS+="- Depends on #$d"$'\n'; done
58
- fi
59
- PARENT_BODY=$(cat <<EOF
60
- ## Goal
61
-
62
- $GOAL
63
-
64
- ## Scope
65
-
66
- $SCOPE
67
-
68
- ## For agents
69
-
70
- $FOR_AGENTS
71
-
72
- ## Verification
73
-
74
- $VERIFICATION$RELATIONS
75
- EOF
76
- )
77
-
78
- # 2. Create the parent issue (the plan). kind:task is the effort default unless overridden. Labels
79
- # add `ctx:*` (session weight, first-pass from the sub count; refined at kit-effort-start) + an
80
- # optional `flow:<flow>` tag.
81
- SUBCOUNT=$(printf '%s\n' "$SUBS" | grep -c . 2>/dev/null || echo 1); [[ "$SUBCOUNT" -ge 1 ]] || SUBCOUNT=1
82
- CTX="$(effort_ctx_bucket 1 "$SUBCOUNT")"
83
- FLOW_LABEL=""; [[ -n "${FLOW:-}" ]] && FLOW_LABEL=",flow:$(printf '%s' "$FLOW" | tr '[:upper:]' '[:lower:]')"
84
- PARENT_URL=$(gh issue create --repo "$KIT_REPO" \
85
- --title "[Effort] PLACEHOLDER · ${FLOW_TAG}${TITLE}" \
86
- --body "$PARENT_BODY" \
87
- --label "$CTX,kind:task,priority:${PRIORITY:-p1},role:$ROLE$FLOW_LABEL" \
88
- ${MILESTONE:+--milestone "$MILESTONE"})
89
- PARENT_NUM=$(basename "$PARENT_URL")
90
- # Inject the real effort id (== the issue number) into the title now that we have it.
91
- gh issue edit "$PARENT_NUM" --repo "$KIT_REPO" --title "[Effort] $PARENT_NUM · ${FLOW_TAG}${TITLE}" >/dev/null
92
- echo "✓ parent #$PARENT_NUM — $PARENT_URL"
93
-
94
- # 2b. Native dependency edges from DEPENDS_ON — the visible board chain.
95
- if [[ -n "${DEPENDS_ON:-}" ]]; then
96
- for d in ${DEPENDS_ON//,/ }; do d="${d#\#}"; effort_set_blocked_by "$PARENT_NUM" "$d"; done
97
- fi
98
-
99
- # 3. Add the parent to the board, set Status=Todo + Role (if Projects v2 is enabled).
45
+ # Board + role helpers must be loaded BEFORE effort_new so its (guarded) board add can run.
100
46
  if [[ "$KIT_PROJECTS_V2" == "true" ]]; then
101
- PARENT_NODE=$(gh api "repos/$KIT_REPO/issues/$PARENT_NUM" --jq .node_id)
102
- PARENT_ITEM=$(project_add_item "$PARENT_NODE" 2>/dev/null || echo "")
103
- if [[ -n "$PARENT_ITEM" ]]; then
104
- project_set_single_select "$PARENT_ITEM" "$STATUS_FIELD_ID" "$STATUS_OPT_TODO"
105
- ROLE_OPT=$(role_option_id "$ROLE" 2>/dev/null || echo "")
106
- [[ -n "$ROLE_OPT" ]] && project_set_single_select "$PARENT_ITEM" "$ROLE_FIELD_ID" "$ROLE_OPT"
107
- fi
47
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids
48
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/role-identity.sh" 2>/dev/null || true
108
49
  fi
109
-
110
- # 4. Create each sub-issue, link it natively under the parent, add it to the board.
111
- # SUBS is a newline-delimited list of "name :: one-line description". The skill numbers them
112
- # 1..k and composes the "[Effort <parent>] <M> · <name>" title (effort-model.md), linting each.
113
- # Sub-issue bodies are intentionally short: the parent carries the narrative.
114
- SUB_M=0
115
- printf '%s\n' "$SUBS" | while IFS= read -r line; do
116
- [[ -z "$line" ]] && continue
117
- SUB_M=$((SUB_M + 1))
118
- SUB_NAME="${line%% :: *}"
119
- SUB_DESC="${line#* :: }"; [[ "$SUB_DESC" == "$line" ]] && SUB_DESC=""
120
- SUB_TITLE="[Effort $PARENT_NUM] $SUB_M · $SUB_NAME"
121
- effort_title_lint "$SUB_TITLE" \
122
- || { echo " ✗ sub title fails the rule (above) — rename and re-run: $SUB_TITLE" >&2; continue; }
123
- SUB_URL=$(gh issue create --repo "$KIT_REPO" \
124
- --title "$SUB_TITLE" \
125
- --body "$SUB_DESC
126
-
127
- Sub-issue of #$PARENT_NUM (effort)." \
128
- --label "kind:task,priority:${PRIORITY:-p1},role:$ROLE" \
129
- ${MILESTONE:+--milestone "$MILESTONE"})
130
- SUB_NUM=$(basename "$SUB_URL")
131
- echo " ✓ sub #$SUB_NUM — $SUB_TITLE"
132
-
133
- # Native parent/child link via the sub-issues REST API (child DB id, not number).
134
- effort_link_sub "$PARENT_NUM" "$SUB_NUM"
135
-
136
- # Board: add sub, Status=Todo + Role.
137
- if [[ "$KIT_PROJECTS_V2" == "true" ]]; then
138
- SUB_NODE=$(gh api "repos/$KIT_REPO/issues/$SUB_NUM" --jq .node_id)
139
- SUB_ITEM=$(project_add_item "$SUB_NODE" 2>/dev/null || echo "")
140
- if [[ -n "$SUB_ITEM" ]]; then
141
- project_set_single_select "$SUB_ITEM" "$STATUS_FIELD_ID" "$STATUS_OPT_TODO"
142
- ROLE_OPT=$(role_option_id "$ROLE" 2>/dev/null || echo "")
143
- [[ -n "$ROLE_OPT" ]] && project_set_single_select "$SUB_ITEM" "$ROLE_FIELD_ID" "$ROLE_OPT"
144
- fi
145
- fi
146
- done
147
-
50
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort.sh"
51
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort-metrics.sh" # effort_ctx_bucket
52
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort-ops.sh" # effort_new — the shared creation core
53
+
54
+ # TITLE = the human NAME only (no "[Effort]"/number prefix). The core composes the board title
55
+ # "[Effort] <N> · [<FLOW>] <TITLE>", fills the four sections, applies labels, and lints the parent +
56
+ # every sub title up front (a bad name aborts before anything is created — no half-effort).
57
+
58
+ # SUBS is a newline-delimited list of "name :: one-line description"; pass each line as a positional
59
+ # sub spec. The core numbers them 1..k and composes the "[Effort <parent>] <M> · <name>" title.
60
+ SUB_ARGS=()
61
+ while IFS= read -r line; do [[ -n "$line" ]] && SUB_ARGS+=("$line"); done <<< "$SUBS"
62
+
63
+ # effort_new echoes the parent number on stdout (progress goes to stderr) — capture it for the hint.
64
+ PARENT_NUM=$(effort_new \
65
+ ${FLOW:+--flow "$FLOW"} \
66
+ --role "$ROLE" \
67
+ --priority "${PRIORITY:-p1}" \
68
+ --goal "$GOAL" --scope "$SCOPE" --for-agents "$FOR_AGENTS" --verification "$VERIFICATION" \
69
+ ${DEPENDS_ON:+--depends-on "$DEPENDS_ON"} \
70
+ ${MILESTONE:+--milestone "$MILESTONE"} \
71
+ "$TITLE" "${SUB_ARGS[@]}")
148
72
  echo "✓ effort #$PARENT_NUM created — next: /kit-effort-start $PARENT_NUM"
149
73
  ```
150
74
 
75
+ > The block above is intentionally short: all creation logic lives in `effort_new`. If you need to
76
+ > change what an effort looks like (body, labels, lint, board), change the core — both the skill and
77
+ > the verb move together.
78
+
151
79
  ## Output
152
80
 
153
81
  - Parent issue URL + number (the plan)
@@ -30,6 +30,7 @@ this PR is where humans review the result. The title carries `[#N]` (the effort
30
30
  source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
31
31
  [[ "$KIT_PROJECTS_V2" == "true" ]] && { source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids; }
32
32
  source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/role-identity.sh" 2>/dev/null || true
33
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort.sh" # effort_pr_title + effort_pr_title_check (the shared composer)
33
34
  BASE="${KIT_BASE_BRANCH:-main}"
34
35
 
35
36
  # 1. Parse the parent effort number from the branch (effort/<N>-<slug>).
@@ -89,11 +90,14 @@ $(role_signature "$ROLE" 2>/dev/null || true)
89
90
  EOF
90
91
  )
91
92
 
92
- # 6. Create the PR. Title: [Role] [#N] <title> — the [#N] effort id is mandatory.
93
+ # 6. Create the PR. Title composed by the ONE shared composer (same as `cckit effort pr`), then the
94
+ # mandatory-[#N] check — refuse rather than open an id-less PR.
95
+ PR_TITLE=$(effort_pr_title "$NUM" "$TITLE" "$ROLE_DISPLAY")
96
+ effort_pr_title_check "$PR_TITLE" "$NUM" || { echo "✗ PR title lacks the [#$NUM] effort id — aborting"; exit 1; }
93
97
  URL=$(gh pr create --repo "$KIT_REPO" \
94
98
  --base "$BASE" \
95
99
  --head "$BRANCH" \
96
- --title "[$ROLE_DISPLAY] [#$NUM] $TITLE" \
100
+ --title "$PR_TITLE" \
97
101
  --body "$PR_BODY" \
98
102
  ${LABELS:+--label "$LABELS"} \
99
103
  ${MILESTONE:+--milestone "$MILESTONE"} \
@@ -1,85 +1,83 @@
1
1
  ---
2
2
  name: kit-effort-start
3
- description: Start an effort — create the `effort/<N>-<slug>` integration branch + isolated worktree from the base branch and mark the parent issue In Progress on the board. Sub-issues later branch from this effort branch or commit directly on it.
3
+ description: Start an effort — thin caller of `cckit effort start <N>`. Creates the `effort/<N>-<slug>` integration branch + isolated bootstrapped worktree from the base branch, then marks the parent issue In Progress on the board. Sub-issues later branch from this effort branch or commit directly on it.
4
4
  when_to_use: After `/kit-effort-new`, to begin building an effort. The effort branch is the single integration branch for the whole effort — its sub-issues merge into it, and exactly one PR opens from it (`/kit-effort-pr`). See rules/effort-model.md.
5
5
  ---
6
6
 
7
7
  # kit-effort-start
8
8
 
9
- Plugin-direct skill — runs straight from `${CLAUDE_PLUGIN_ROOT}` (no per-project `scripts/` checkout
10
- needed). Helpers are sourced from the plugin; repo state (`gh`, `git`, the board) is the project
11
- you're standing in. Respects `KIT_BASE_BRANCH` (default `main`) so the same code serves any project.
12
- Reads `.claude/kit.config.json` from the working directory.
9
+ Thin caller over the ONE canonical effort-start mechanic: the `cckit effort start` verb →
10
+ `effort_start` (`${CLAUDE_PLUGIN_ROOT}/scripts/lib/effort-ops.sh`). The verb logic lives there,
11
+ never inline here (kit-engine-boundary #1/#2 — same single-implementation principle as the PR
12
+ title composer, #121). The dispatcher loads the project config first (#151), so `KIT_REPO` /
13
+ `KIT_BASE_BRANCH` come from `.claude/kit.config.json` of the project you're standing in. The verb
14
+ owns ALL of the mechanics:
15
+
16
+ - resolving `<N|slug>` to the parent effort issue (slug handles work too)
17
+ - fresh fetch of the base branch + branch `effort/<N>-<slug>` — always `effort/`, regardless of
18
+ the parent's `kind:` label (branch-naming.md)
19
+ - the isolated worktree at `.claude/worktrees/effort+<N>-<slug>` (reused if the branch already
20
+ exists; the dir name encodes #N so `kit-gc` won't wipe it while the issue is open)
21
+ - **bootstrap** (`wt_bootstrap`): copies gitignored `.env.local*` + project ids, assigns a
22
+ per-worktree dev PORT, installs deps (`KIT_WT_INSTALL=0` opts out)
23
+ - the live-session **collision guard**: refuses to disturb a worktree a live session is sitting in
13
24
 
14
25
  ## Inputs
15
26
 
16
27
  | Field | Required | Notes |
17
28
  | ------------ | -------- | -------------------------------------------------------------- |
18
- | Issue number | ✓ | The **parent** effort issue `N` |
29
+ | Issue number | ✓ | The **parent** effort issue `N` (or its slug handle) |
19
30
  | Slug | optional | Short kebab-case suffix; defaults to a slug of the issue title |
20
31
 
21
- > **One effort = one branch = one worktree** (effort-model.md). The branch is `effort/<N>-<slug>`
22
- > and the worktree is `.claude/worktrees/effort+<N>-<slug>`. Sub-issues either commit directly on
23
- > this branch (sequential — one commit per sub-issue, that commit's diff IS the sub's work record)
24
- > or use their own file-disjoint `sub/<N><letter>-<slug>` worktrees off this branch and merge in.
25
- > Exactly ONE PR opens from `effort/<N>` (`/kit-effort-pr`).
32
+ > **One effort = one branch = one worktree** (effort-model.md). Sub-issues either commit directly
33
+ > on this branch (sequential — one commit per sub-issue, that commit's diff IS the sub's work
34
+ > record) or use their own file-disjoint `sub/<N><letter>-<slug>` worktrees off this branch and
35
+ > merge in. Exactly ONE PR opens from `effort/<N>` (`/kit-effort-pr`).
26
36
 
27
37
  ## Execution
28
38
 
29
39
  ```bash
30
- source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
31
- [[ "$KIT_PROJECTS_V2" == "true" ]] && { source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids; }
32
- BASE="${KIT_BASE_BRANCH:-main}" # branch off the integration branch (override per project)
33
-
34
- NUM=""; SLUG_OVERRIDE=""
35
- for a in "$@"; do
36
- [[ -z "$NUM" ]] && NUM="$a" || SLUG_OVERRIDE="$a"
37
- done
38
- [[ -n "$NUM" ]] || { echo "✗ kit-effort-start: parent issue number required"; exit 1; }
40
+ cckit effort start <N> # or: cckit effort start <N> <slug-override>
41
+ # cckit not on PATH? "${CLAUDE_PLUGIN_ROOT}/bin/cckit" effort start <N>
42
+ ```
39
43
 
40
- META=$(gh issue view "$NUM" --repo "$KIT_REPO" --json title,labels,projectItems)
41
- TITLE=$(echo "$META" | jq -r .title)
44
+ The last stdout line is machine-readable — `<worktree-path>|<branch>|<parent-issue>` — then ALL
45
+ effort work continues **inside the worktree**:
42
46
 
43
- if [[ -n "$SLUG_OVERRIDE" ]]; then SLUG="$SLUG_OVERRIDE"; else
44
- SLUG=$(echo "$TITLE" | sed -E 's/^\[[^]]+\][[:space:]]*//' \
45
- | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-|-$//g' | cut -c1-40)
46
- fi
47
+ ```bash
48
+ cd <worktree-path> # sub-issues merge into effort/<N>-<slug>
49
+ ```
47
50
 
48
- # The integration branch is ALWAYS effort/<N>-<slug> (branch-naming.md), regardless of the
49
- # parent's kind:* label. The worktree dir still encodes #N so kit-gc protects it while #N is open.
50
- BRANCH="effort/$NUM-$SLUG"
51
- WT_DIR=".claude/worktrees/effort+${NUM}-${SLUG}"
51
+ ### Board step (additive — the verb does not touch the board)
52
52
 
53
- git fetch origin "$BASE" --quiet
54
- if git worktree list --porcelain | grep -q "/effort+${NUM}-${SLUG}$"; then
55
- echo "✓ Worktree already exists: $WT_DIR (branch $BRANCH)"
56
- else
57
- git worktree add -B "$BRANCH" "$WT_DIR" "origin/$BASE"
58
- fi
53
+ Mark the parent effort In Progress when Projects v2 is enabled:
59
54
 
55
+ ```bash
56
+ NUM=<parent-issue> # third field of the verb's machine-readable line
57
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
60
58
  if [[ "$KIT_PROJECTS_V2" == "true" ]]; then
61
- ITEM_ID=$(echo "$META" | jq -r --arg t "$KIT_PROJECT_TITLE" '.projectItems[]? | select(.title==$t) | .id')
59
+ source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids
60
+ ITEM_ID=$(project_find_item_by_issue "$NUM")
62
61
  [[ -n "$ITEM_ID" ]] && project_set_single_select "$ITEM_ID" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_PROGRESS"
63
62
  fi
64
-
65
- echo "→ cd $WT_DIR # ALL effort work happens here; sub-issues merge into $BRANCH"
66
- echo "✓ Worktree $WT_DIR on branch $BRANCH (from $BASE) — effort #$NUM In Progress"
67
- echo " Next: build the sub-issues, then /kit-effort-pr $NUM"
68
63
  ```
69
64
 
70
65
  ## Output
71
66
 
72
- - Worktree path + `effort/<N>-<slug>` branch — **work continues inside the worktree** (`cd $WT_DIR`)
67
+ - Worktree path + `effort/<N>-<slug>` branch — **work continues inside the worktree**
73
68
  - Parent issue #N now In Progress on the board (if Projects v2 is on)
74
69
  - Reminder that exactly one PR opens from this branch (`/kit-effort-pr <N>`)
75
70
 
76
71
  ## Rules
77
72
 
73
+ - **Engine boundary** — the start mechanic lives in `effort_start`; this skill only runs the verb
74
+ and does the board step. Never re-implement `git worktree add` / bootstrap / guards here.
78
75
  - The integration branch is **always** `effort/<N>-<slug>` (branch-naming.md, effort-model.md) —
79
76
  never `task/` or `feat/` for the parent.
80
- - Branch from the base branch (`KIT_BASE_BRANCH`) only — never from a feature branch.
81
- - **Worktree always** — one branch per worktree, never share a checkout. The `effort+<N>-<slug>`
82
- worktree-dir name encodes #N so `kit-gc` won't wipe it while the issue is open.
77
+ - Branch from the base branch (`KIT_BASE_BRANCH`) only — never from a feature branch; the verb
78
+ enforces this.
79
+ - **Worktree always** — one branch per worktree, never share a checkout.
83
80
  - Sub-issue branches are `sub/<N><letter>-<slug>` off THIS branch and **never open their own PR to
84
81
  the base branch** — they merge into `effort/<N>`.
85
- - Don't re-run for the parent if its worktree already exists — the skill reuses it.
82
+ - Safe to re-run for the parent: the verb reuses an existing branch/worktree and refuses to
83
+ disturb one a live session owns.
@@ -16,6 +16,10 @@ metadata:
16
16
 
17
17
  Answer one question fast: **what should I work on right now, and how do I start it?**
18
18
 
19
+ > Planning the work that doesn't exist yet is a different question. For "given where we are, what
20
+ > should we build next?" use `/kit-plan-next` (`cckit plan-next`) — it inventories the kit's current
21
+ > capabilities and proposes next efforts. `kit-next` orders the issues that already exist.
22
+
19
23
  ## Pick up the next issue
20
24
 
21
25
  ```
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: kit-plan-next
3
+ description: >
4
+ Forward planning from the current state: run `cckit plan-next` to inventory what the kit can
5
+ already do (skills, verbs, rules, docs) and propose what to build next — grounded in that
6
+ inventory — then hand a chosen item off into `/kit-effort-new`. The proposed plan always carries a
7
+ mandatory docs + README step.
8
+ when_to_use: >
9
+ When you ask "given where we are, what should we build next?" — at the start of a chapter of work,
10
+ after closing an effort, or when triaging a backlog against the kit's current capabilities. Not
11
+ for ordering issues that already exist (that is `/kit-next` / `cckit plan`), and not for scoping an
12
+ effort you have already chosen (go straight to `/kit-effort-new`).
13
+ metadata:
14
+ version: 1.0.0
15
+ ---
16
+
17
+ # kit-plan-next — what to build next, grounded in current state
18
+
19
+ Answer one question: **given everything the kit can already do, what is the highest-value next
20
+ effort?** This wraps the `cckit plan-next` verb (the engine — never re-author its logic here;
21
+ kit-engine-boundary) and turns its proposals into a scoped effort via `/kit-effort-new`.
22
+
23
+ The verb introspects the CURRENT capability surface at runtime, so the plan is always consistent
24
+ with what ships today — planning pre-grounded in current docs/skills/rules means the executing agent
25
+ burns fewer tokens rediscovering context.
26
+
27
+ ## CRITICAL — context-anxiety rule
28
+
29
+ The plan `cckit plan-next` emits is **human / orchestrator-facing only**. NEVER paste it (or the
30
+ inventory) into a monitored model's prompt or context, and never wire it into an agent's context
31
+ automatically. Read it yourself, decide with the human, and hand only the CHOSEN item to
32
+ `/kit-effort-new`. See `rules/plan-next.md`.
33
+
34
+ ## 1. Get the forward plan
35
+
36
+ ```
37
+ cckit plan-next
38
+ ```
39
+
40
+ Prints the current capabilities (skills / commands / rules / docs counts + samples) and a ranked,
41
+ grounded set of proposals. Rank 1 is **always** the mandatory docs + README step (docs-always rule —
42
+ it is never dropped, even for a tiny change). Append `--llm` for TOON rows `{rank,area,proposal,next}`
43
+ if you need to reason over the proposals structurally — but keep that output out of any monitored
44
+ context.
45
+
46
+ Run it from the cckit repo for a full inventory, or from a host project where the kit is installed —
47
+ there it degrades gracefully to whatever capability dirs exist (host docs only) and never crashes.
48
+
49
+ ## 2. Choose with the human
50
+
51
+ Surface the proposals as a short, visual summary — lead with the human-meaningful outcome of each
52
+ item (its `proposal`), not the verb noise. Confirm which one to pursue. Do not invent scope beyond
53
+ what the inventory supports.
54
+
55
+ ## 3. Hand off to /kit-effort-new
56
+
57
+ Once an item is chosen, scope it into an effort:
58
+
59
+ ```
60
+ /kit-effort-new
61
+ ```
62
+
63
+ Carry the chosen proposal into the effort's **Goal**, decompose it into sub-issues in **Scope**, and
64
+ **always include the mandatory docs + README sub-issue** — the planner surfaces it on every plan and
65
+ `/kit-effort-new` must preserve it (docs are part of "done," never a follow-up).
66
+
67
+ ## Output
68
+
69
+ - The current-capability inventory (counts + samples per area).
70
+ - A ranked, grounded proposal table — rank 1 is always docs + README.
71
+ - A chosen item handed to `/kit-effort-new` as a new effort (Goal / Scope / For agents / Verification).
72
+
73
+ ## Rules
74
+
75
+ - **Engine boundary** — the planning logic lives in `scripts/lib/plan-next.sh` (`plan_next`); this
76
+ skill only runs the verb and routes the result. Never re-implement the inventory or proposals here.
77
+ - **Docs are mandatory** — every plan carries a docs + README step; the effort you scope must keep it.
78
+ - **Context-anxiety** — planner output never enters a monitored model's context; it informs the
79
+ human/orchestrator's decision only.
80
+ - **Don't plan what exists** — for ordering already-created issues use `/kit-next` or `cckit plan`;
81
+ for scoping an item you've already chosen go straight to `/kit-effort-new`.
82
+ - Scrub secrets from anything pasted into the resulting effort body (trace hygiene).
@@ -1,76 +1,65 @@
1
1
  ---
2
2
  name: kit-task-start
3
- description: Start work on a GitHub issue — branch from the base branch (optionally an isolated worktree associated with the issue), mark the issue In Progress on the board (if enabled), switch to the branch.
4
- when_to_use: When beginning work on a tracked issue. Always run before editing files. Replaces ad-hoc `git checkout -b`.
3
+ description: Start work on a GitHub issue — thin caller of `cckit start <N>`. Creates an isolated, bootstrapped worktree + `<kind>/<N>-<slug>` branch from the base branch and marks the issue In Progress on the board (if enabled). Worktree-first — there is no in-place mode.
4
+ when_to_use: When beginning work on a tracked issue. Always run before editing files. Replaces ad-hoc `git checkout -b` and hand-rolled `git worktree add`.
5
5
  ---
6
6
 
7
7
  # kit-task-start
8
8
 
9
- Plugin-direct skill — runs straight from `${CLAUDE_PLUGIN_ROOT}` (no per-project `scripts/`
10
- checkout needed). Helpers are sourced from the plugin; repo state (`gh`, `git`, the board) is
11
- the project you're standing in. Reads `.claude/kit.config.json` from the working directory.
9
+ Thin caller over the ONE canonical start mechanic: the `cckit start` verb → `wt_start`
10
+ (`${CLAUDE_PLUGIN_ROOT}/scripts/lib/worktree-start.sh`). The verb logic lives there, never inline
11
+ here (kit-engine-boundary #1/#2 — same single-implementation principle as the PR title composer,
12
+ #121). The verb owns ALL of the mechanics:
13
+
14
+ - fresh fetch of the base branch (`KIT_BASE_BRANCH`, default `main`) + branch `<kind>/<N>-<slug>`
15
+ (kind derived from the issue's `kind:` label)
16
+ - the isolated worktree at `.claude/worktrees/<kind>+<N>-<slug>` (reused if it already exists;
17
+ the dir name encodes issue #N so `kit-gc` won't wipe it while the issue is open)
18
+ - **bootstrap** (`wt_bootstrap`): copies gitignored `.env.local*` + project ids into the worktree,
19
+ assigns a per-worktree dev PORT, installs deps (`KIT_WT_INSTALL=0` opts out)
20
+ - the **claim precheck** (#124): warns when the issue is already In Progress on the board —
21
+ another session may own it
22
+ - the live-session **collision guard**: never disturbs a worktree a live session is sitting in
23
+ - the board update: issue → In Progress (when Projects v2 is enabled)
12
24
 
13
25
  ## Inputs
14
26
 
15
- | Field | Required | Notes |
16
- | ------------ | -------- | ----------------------------------------------------------- |
17
- | Issue number | ✓ | `123` |
18
- | Slug | optional | Short kebab suffix; defaults to a slug of the issue title |
19
- | `--worktree` | optional | Isolated worktree instead of switching the main tree. **Required for parallel / sub-agent work.** Dir `<kind>+<N>-<slug>` encodes issue **#N**, so `kit-gc` won't wipe it while the issue is open. |
27
+ | Field | Required | Notes |
28
+ | ------------ | -------- | --------------------------------------------------------- |
29
+ | Issue number | ✓ | `123` |
30
+ | Slug | optional | Short kebab suffix; defaults to a slug of the issue title |
20
31
 
21
- Read the issue to derive the **kind** label — the branch prefix matches it.
32
+ **Worktree-first, always.** Every start gets its own isolated worktree — one branch per worktree,
33
+ never a shared checkout. This is what makes parallel / sub-agent work safe and keeps a read-only
34
+ base checkout untouched.
22
35
 
23
36
  ## Execution
24
37
 
25
38
  ```bash
26
- source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-config.sh" && load_kit_config
27
- [[ "$KIT_PROJECTS_V2" == "true" ]] && { source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/gh-project.sh"; load_project_ids; }
28
- BASE="${KIT_BASE_BRANCH:-main}" # branch off the integration branch (override per project)
29
-
30
- NUM=""; SLUG_OVERRIDE=""; WORKTREE=0
31
- for a in "$@"; do
32
- case "$a" in
33
- --worktree) WORKTREE=1 ;;
34
- *) [[ -z "$NUM" ]] && NUM="$a" || SLUG_OVERRIDE="$a" ;;
35
- esac
36
- done
37
- META=$(gh issue view "$NUM" --repo "$KIT_REPO" --json title,labels,projectItems)
38
- TITLE=$(echo "$META" | jq -r .title)
39
- KIND=$(echo "$META" | jq -r '.labels[].name' | grep '^kind:' | head -1 | cut -d: -f2)
40
- [[ -z "$KIND" ]] && KIND="task"
39
+ cckit start <N> # or: cckit start <N> <slug-override>
40
+ # cckit not on PATH? "${CLAUDE_PLUGIN_ROOT}/bin/cckit" start <N>
41
+ ```
41
42
 
42
- if [[ -n "$SLUG_OVERRIDE" ]]; then SLUG="$SLUG_OVERRIDE"; else
43
- SLUG=$(echo "$TITLE" | sed -E 's/^\[[^]]+\][[:space:]]*//' \
44
- | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-|-$//g' | cut -c1-40)
45
- fi
46
- BRANCH="$KIND/$NUM-$SLUG"
43
+ The last stdout line is machine-readable — `<worktree-path>|<branch>|<issue-number>` — then work
44
+ continues **inside the worktree**:
47
45
 
48
- git fetch origin "$BASE" --quiet
49
- if [[ "$WORKTREE" -eq 1 ]]; then
50
- # Worktree dir encodes the issue: <kind>+<N>-<slug> -> kit-gc protects it while #N is open.
51
- WT_DIR=".claude/worktrees/${KIND}+${NUM}-${SLUG}"
52
- if git worktree list --porcelain | grep -q "/${KIND}+${NUM}-${SLUG}$"; then
53
- echo "✓ Worktree already exists: $WT_DIR (branch $BRANCH)"
54
- else
55
- git worktree add -B "$BRANCH" "$WT_DIR" "origin/$BASE"
56
- fi
57
- echo "→ cd $WT_DIR # work happens here; one branch per worktree"
58
- else
59
- [[ -n "$(git status --porcelain)" ]] && { echo "✗ Working tree not clean — or use --worktree."; exit 1; }
60
- git checkout -B "$BRANCH" "origin/$BASE"
61
- fi
46
+ ```bash
47
+ cd <worktree-path> # one branch per worktree; never edit the main checkout
48
+ ```
62
49
 
63
- if [[ "$KIT_PROJECTS_V2" == "true" ]]; then
64
- ITEM_ID=$(echo "$META" | jq -r --arg t "$KIT_PROJECT_TITLE" '.projectItems[]? | select(.title==$t) | .id')
65
- [[ -n "$ITEM_ID" ]] && project_set_single_select "$ITEM_ID" "$STATUS_FIELD_ID" "$STATUS_OPT_IN_PROGRESS"
66
- fi
50
+ ## Output
67
51
 
68
- echo "✓ Branch $BRANCH (from $BASE) — issue #$NUM In Progress"
69
- ```
52
+ - Worktree path + `<kind>/<N>-<slug>` branch (from the base branch) — work happens in the worktree
53
+ - Issue #N In Progress on the board (when Projects v2 is on)
70
54
 
71
55
  ## Rules
72
56
 
73
- - Never start from a non-base branch (trunk-based) · never start with a dirty tree (in-place mode) — or use `--worktree`
74
- - **Parallel / sub-agent work MUST use `--worktree`** — one branch per worktree, never share a checkout. The worktree↔issue association keeps `kit-gc` from wiping in-progress work.
75
- - If the issue has no `role:` label, fail loudly and ask for triage
76
- - Never skip the board status update when Projects v2 is enabled
57
+ - **Engine boundary** — the start mechanic lives in `wt_start`; this skill only runs the verb.
58
+ Never re-implement `git worktree add` / `git checkout -B` / bootstrap / board steps here.
59
+ - Worktree-first: parallel / sub-agent work MUST each get their own worktree via the verb —
60
+ never share a checkout, never fall back to an in-place branch switch.
61
+ - Never start from a non-base branch (trunk-based) — the verb always branches from a fresh
62
+ `origin/<base>`.
63
+ - If the issue has no `role:` label, fail loudly and ask for triage before starting.
64
+ - Heed the claim-precheck warning: if the verb reports the issue is already In Progress, confirm
65
+ no other session owns it before continuing.
@@ -71,7 +71,7 @@ Every issue lands on `main` through a Pull Request. No direct commits to `main`.
71
71
  | Step | Skill | What it does |
72
72
  | ----------------- | ------------------ | ------------------------------------------------------- |
73
73
  | 1. Pick an issue | `/kit-task-sync` | See the open board, choose what's unblocked |
74
- | 2. Start work | `/kit-task-start <N>` | Branch `<kind>/<N>-<slug>` from main + mark In Progress |
74
+ | 2. Start work | `/kit-task-start <N>` | Isolated worktree + branch `<kind>/<N>-<slug>` from the base + mark In Progress |
75
75
  | 3. Do the work | — | Code, write plans, etc. |
76
76
  | 4. Open PR | `/kit-task-pr <N>` | Commit + push + open PR with template/labels/milestone |
77
77
  | 5. Review + merge | `/kit-task-pr-merge` | Squash-merge PR, switch to main, pull |
@@ -5,7 +5,7 @@ description: Autonomous GitHub coding agent. Triggered in CI when a maintainer l
5
5
  when_to_use: Not summoned interactively — runs in CI (a GitHub Actions workflow) on `issues: labeled` with `agent:auto`. Documented here so the workflow prompt and humans share one source of truth for its charter.
6
6
  tools: [Bash, Read, Edit, Write, Glob, Grep]
7
7
  skills:
8
- - kit-task-start # Branch <kind>/<N>-<slug> from the integration branch
8
+ - kit-task-start # Isolated worktree + branch <kind>/<N>-<slug> from the integration branch (via `cckit start`)
9
9
  - kit-task-pr # Commit + push + open PR with labels/milestone
10
10
  - agent-skills:github-navigator # gh CLI operations
11
11
  ---
@@ -1,8 +1,42 @@
1
1
  #!/usr/bin/env bash
2
2
  # SessionStart hook — load MemPalace wake-up context for this project (wing={{WING}}).
3
- # Scaffolded by claude-kit. stdout is injected into the session context by Claude Code.
3
+ # Scaffolded by cckit. stdout is injected into the session context by Claude Code.
4
4
  # Safe no-op if the `mempalace` CLI is not installed.
5
+ #
5
6
  # NOTE: uses `wake-up --wing` on purpose, NOT `mempalace hook run --hook session-start` —
6
7
  # `hook run` derives the wing implicitly and can file into the wrong wing; `--wing` is explicit.
8
+ #
9
+ # HEADER SCOPING: `mempalace wake-up` scopes the L1 *body* to --wing, but its L0 identity
10
+ # *header* is read from the single global ~/.mempalace/identity.txt and ignores the wing
11
+ # (see mempalace layers.py Layer0). To give this wing its own header, drop a per-wing
12
+ # identity file next to this hook:
13
+ # .claude/mempal-identity.{{WING}}.txt (preferred) or .claude/mempal-identity.txt
14
+ # When present it replaces the global L0 block; absent → mempalace output is passed through
15
+ # unchanged (no regression).
7
16
  command -v mempalace >/dev/null 2>&1 || exit 0
8
- mempalace wake-up --wing {{WING}} 2>/dev/null || true
17
+
18
+ _wake="$(mempalace wake-up --wing {{WING}} 2>/dev/null)" || exit 0
19
+
20
+ # Locate an optional per-wing identity header (relative to this hook's own dir).
21
+ _dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
22
+ _id=""
23
+ for _cand in "$_dir/../mempal-identity.{{WING}}.txt" "$_dir/../mempal-identity.txt"; do
24
+ [ -s "$_cand" ] && { _id="$_cand"; break; }
25
+ done
26
+
27
+ # No per-wing identity, or output not in the expected L0/L1 shape → pass through verbatim.
28
+ if [ -z "$_id" ] || ! printf '%s\n' "$_wake" | grep -q '^## L1'; then
29
+ printf '%s\n' "$_wake"
30
+ exit 0
31
+ fi
32
+
33
+ # Replace the global L0 block (between the "====" rule and the first "## L1") with our header.
34
+ awk -v idfile="$_id" '
35
+ BEGIN { while ((getline line < idfile) > 0) id = id line "\n" }
36
+ !sep && /^=+$/ { print; sep=1; printf "%s\n", id; inl0=1; next }
37
+ inl0 && /^## L1/ { inl0=0 }
38
+ inl0 { next }
39
+ { print }
40
+ ' <<EOF
41
+ $_wake
42
+ EOF