@ulysses-ai/create-workspace 0.17.0-beta.0 → 0.18.0-beta.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 (45) hide show
  1. package/README.md +3 -3
  2. package/package.json +1 -1
  3. package/template/.claude/hooks/_utils.mjs +1 -1
  4. package/template/.claude/hooks/repo-write-detection.mjs +161 -64
  5. package/template/.claude/hooks/session-start.mjs +35 -1
  6. package/template/.claude/hooks/subagent-start.mjs +89 -22
  7. package/template/.claude/lib/session-frontmatter.mjs +28 -0
  8. package/template/.claude/rules/coherent-revisions.md +1 -1
  9. package/template/.claude/rules/forge-operations.md +37 -93
  10. package/template/.claude/rules/git-conventions.md +16 -11
  11. package/template/.claude/rules/goal-driven-work.md +8 -416
  12. package/template/.claude/rules/honest-pushback.md +37 -37
  13. package/template/.claude/rules/memory-guidance.md +43 -90
  14. package/template/.claude/rules/superpowers-workflow.md.skip +1 -1
  15. package/template/.claude/rules/work-item-tracking.md +30 -72
  16. package/template/.claude/rules/workspace-structure.md +36 -94
  17. package/template/.claude/scripts/build-workspace-context.mjs +61 -16
  18. package/template/.claude/scripts/chat-record.mjs +282 -0
  19. package/template/.claude/scripts/cleanup-work-session.mjs +257 -68
  20. package/template/.claude/scripts/context-footprint.mjs +282 -0
  21. package/template/.claude/scripts/forges/github.mjs +45 -0
  22. package/template/.claude/scripts/forges/gitlab.mjs +3 -2
  23. package/template/.claude/scripts/forges/interface.mjs +12 -0
  24. package/template/.claude/scripts/generate-claude-local.mjs +21 -2
  25. package/template/.claude/scripts/migrate-sessions.mjs +1571 -0
  26. package/template/.claude/scripts/migrate-to-workspace-context.mjs +7 -2
  27. package/template/.claude/scripts/task-worktree.mjs +525 -0
  28. package/template/.claude/scripts/workspace-diagnostics.mjs +654 -0
  29. package/template/.claude/skills/braindump/SKILL.md +11 -4
  30. package/template/.claude/skills/build-docs-site/SKILL.md +5 -5
  31. package/template/.claude/skills/build-docs-site/templates/spec.md.tmpl +1 -1
  32. package/template/.claude/skills/complete-work/SKILL.md +229 -219
  33. package/template/.claude/skills/context-placement/SKILL.md +199 -0
  34. package/template/.claude/skills/goal-driven-work/SKILL.md +459 -0
  35. package/template/.claude/skills/handoff/SKILL.md +11 -4
  36. package/template/.claude/skills/maintenance/SKILL.md +7 -0
  37. package/template/.claude/skills/migrate-sessions/SKILL.md +70 -0
  38. package/template/.claude/skills/pause-work/SKILL.md +9 -1
  39. package/template/.claude/skills/release/SKILL.md +44 -108
  40. package/template/.claude/skills/start-work/SKILL.md +89 -7
  41. package/template/.claude/skills/workspace-init/SKILL.md +3 -1
  42. package/template/.claude/skills/workspace-update/SKILL.md +4 -0
  43. package/template/CLAUDE.md.tmpl +19 -2
  44. package/template/_gitignore +9 -0
  45. package/template/workspace.json.tmpl +3 -2
@@ -11,7 +11,7 @@ Save structured workstream state to workspace-context. Usable anytime, any numbe
11
11
  - `/handoff {name}` — create or update a named handoff
12
12
  - `/handoff` (no param) — analyze session and suggest name(s)
13
13
 
14
- ## Session-Aware Behavior
14
+ ## Lifecycle-Aware Behavior
15
15
 
16
16
  When called within an active work session (the active-session pointer at `.claude/.active-session.json` exists inside the current worktree):
17
17
 
@@ -26,9 +26,16 @@ When called within an active work session (the active-session pointer at `.claud
26
26
  git commit -m "handoff: update {session-name} tracker"
27
27
  ```
28
28
 
29
- When called from the workspace root (no active session):
30
- - Only `local-only-*` files are writable from the root
31
- - Suggest starting a work session first, or use the helper with `--local-only`
29
+ Under the task model — `workspace.sessionModel` is `"task"` in `workspace.json` AND the SessionStart hook injected a `Chat record:` line (`{chat}` is its name):
30
+
31
+ - Default behavior: write `handoff_{topic}.md` directly into that chat's drawer at `workspace-scratchpad/chats/{chat}/` — the drawer sits outside `workspace-context/`, so `capture-context.mjs` is not involved
32
+ - No commit for drawer writes: the drawer is gitignored and machine-local; `/complete-work` lists it and asks what to promote into `workspace-context/`
33
+
34
+ When called from the workspace root with no active session — every other case, including a `sessionModel: "session"` workspace (the `Chat record:` line is injected in every chat, so it alone does not select the drawer):
35
+
36
+ - Use `--local-only` so the captured file is gitignored (the root only allows local-only writes), landing in `team-member/{user}/`
37
+ - If the task model applies but the `Chat record:` line is absent, say the drawer destination is unavailable for that reason
38
+ - Suggest starting work (`/start-work`) first if the handoff is about actionable work
32
39
 
33
40
  The flows below apply when NOT in an active work session, or when the user explicitly asks for a standalone handoff file.
34
41
 
@@ -44,6 +44,10 @@ For each workspace-context `.md` file and each `work-sessions/*/workspace/sessio
44
44
  - Worktrees whose branch has already been merged? (cleanup candidates)
45
45
  - Workspace repo on expected branch?
46
46
  - Orphan worktree records in project repos — run `git -C repos/{repo} worktree list` for each repo and flag any `prunable` markers. These usually come from a workspace-first teardown (the unsafe order) leaving stale admin records behind. Suggest `git worktree prune` on the affected repo.
47
+ - Task-model state (gh:146), three checks:
48
+ - **Unrecorded task worktrees** — list `repos/*/.claude/worktrees/*` and `.claude/worktrees/*`, read each candidate's branch (`git -C "{path}" rev-parse --abbrev-ref HEAD`), and keep only those on a task-prefixed branch (`feature/`, `bugfix/`, `chore/`) — Claude Code's own worktrees carry other branch names, so the prefix filter skips them without guessing a name convention. Cross-reference the chat records (`node .claude/scripts/chat-record.mjs --root . --list`): a task-prefixed worktree no record entry claims is *unrecorded* — it may be a legitimate no-tracker task (those are never recorded), so present it and ask before suggesting `node .claude/scripts/task-worktree.mjs --root . --remove --repo "{repo}" --branch "{branch}"`.
49
+ - **Stale record entries** — a record task entry whose worktree is gone (neither `repos/{repo}/.claude/worktrees/{slug}/` nor, for `repo: "."`, `.claude/worktrees/{slug}/` exists). Suggest `node .claude/scripts/chat-record.mjs --root . --remove-task --chat "{chat}" --work-item "{workItem}" --repo "{repo}"` (omit `--repo` when the entry has none).
50
+ - **Merged but never completed** — a recorded task branch that already merged. Judge merged-ness by the forge's merged PRs for that repo, matching on head branch — never `git branch --merged`, which a squash merge (never an ancestor) silently misses. `/complete-work` never ran. Suggest running `/complete-work` for that branch (detection from the chat record finds it).
47
51
 
48
52
  ### 5. Workspace-context auto-file integrity
49
53
 
@@ -126,6 +130,9 @@ When stale candidates are found, surface them as warnings in the output format a
126
130
  - Ephemeral files not updated in 7+ days — suggest resolve, update, or archive
127
131
  - `work-sessions/{name}/` folders whose worktrees are gone — suggest cleanup
128
132
  - Session trackers whose branches have been merged — suggest `/complete-work` post-flight cleanup
133
+ - Unrecorded task-prefixed worktrees (no chat-record entry claims them; may be no-tracker tasks) — ask, then suggest `task-worktree.mjs --remove`
134
+ - Chat-record task entries whose worktree is gone — suggest `chat-record.mjs --remove-task`
135
+ - Recorded task branches already merged (per the forge's merged PRs, not `git branch --merged`) — suggest `/complete-work`
129
136
  - Braindumps that overlap significantly — suggest merging (e.g., "workspace-branching.md and persistent-work-sessions.md cover the same topic")
130
137
  - Handoffs referencing deleted branches — suggest resolve or remove
131
138
 
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: migrate-sessions
3
+ description: Migrate this workspace from the session lifecycle to the task lifecycle — inventory old work sessions, decide each one with the operator, finish or archive them, and switch workspace.json to the task model. Runs only inside the current workspace; never deletes anything.
4
+ ---
5
+
6
+ # Migrate Sessions
7
+
8
+ Drain a workspace's accumulated session entries and switch new work to the task lifecycle. The script is `.claude/scripts/migrate-sessions.mjs`; this skill is the operator procedure around it.
9
+
10
+ **Scope rule, before anything else: this skill acts only on the workspace it is run in.** Never read, inventory, or act on any other workspace or directory — even if asked to "do them all." Each workspace runs its own migration from its own root, by its own operator, on its own schedule.
11
+
12
+ **Run from the launcher root only** — the workspace root itself, never a session folder or any other worktree. The script refuses a linked-worktree `--root` on its own (one exception, the Switch step below), and it refuses to back up or archive the session that hosts the current chat, so there is no way to drain the session you are sitting in from inside it.
13
+
14
+ ## 1. Inventory
15
+
16
+ ```bash
17
+ node .claude/scripts/migrate-sessions.mjs --inventory
18
+ ```
19
+
20
+ Read-only. Present the stderr table plus each session's proposal with its reasons and warnings. Say plainly that the proposals are proposals — evidence and a starting point, not decisions. Pay particular attention to the per-remote state shown per worktree (`same`, `ahead +N`, `behind -N`, `diverged +N/-M`, `not-fetched`, `unknown`) and to `unbacked` warnings: they change what Finish and Archive mean for that session. Entries shown as `foreign` (symlinked) are never acted on — surface them for manual reconciliation.
21
+
22
+ ## 2. Decide per session, with the operator — one at a time
23
+
24
+ For each session, lay out its evidence and ask the operator which way to go. Never infer the decision from the proposal. The options:
25
+
26
+ - **Finish** (typical for MERGEABLE) — resume the session with `/start-work`, then run `/complete-work`; its own merge confirmation applies there. But if the inventory shows a **diverged** remote for that session, say so *before* the operator chooses Finish: `/complete-work`'s plain push will be rejected, and pushing the rewritten history needs `--force-with-lease` — which you run only on the operator's explicit yes naming the branch. Never force silently.
27
+ - **Archive** (typical for ABANDONED, a broken shell, or a MERGEABLE the operator gives up on) — take it out of the active lifecycle without destroying anything. Two steps, each its own decision:
28
+ 1. **Offer a backup.** Archiving keeps everything on this machine; a backup adds an off-machine copy of the session's commits, and it is what makes a later deletion safe. It creates `drain/{session}/…` tags and pushes them to the resolved remote(s) — tags may land in a public repository, so show the plan first: `node .claude/scripts/migrate-sessions.mjs --backup --session {name} --dry-run` (add `--remote <name>` to aim somewhere other than the resolved default). It lists, per tip, the tag, the remote, and which tips a remote branch or tag already holds exactly, with no side effects. On the operator's yes, run it without `--dry-run` and show the tags it created. Declining is fine — the archive still keeps everything locally. A repo with no remote at all is refused by backup; say so.
29
+ 2. **Archive after an explicit yes naming the session:** `node .claude/scripts/migrate-sessions.mjs --archive --session {name}`. The whole session folder moves to `{sessions}/.archived/{name}--{timestamp}/` and git's worktree links are repaired to follow it — every commit, uncommitted edit, untracked or ignored file, and embedded repository comes along. If the move or the repair fails, the session is put back and the result says whether every link was verified. The session's branches stay checked out in the archived worktrees, so a new task cannot reuse those branch names until the archive is deleted. The archive refuses, touching nothing, when a directory in the folder cannot be read, when the folder holds a worktree of a repository outside this workspace, or when it holds a submodule checkout (its link cannot be repaired) — surface the reason; for a submodule the options are Finish or Keep. Relay any `warnings` (relative symlinks that pointed outside the session no longer resolve after the move).
30
+ - **Keep** (typical for ACTIVE, and the only sane answer for UNKNOWN) — leave it; it completes later under the session lifecycle.
31
+
32
+ Unbacked commits (present on no remote) are safe in an archive — they are only ever at risk when someone deletes one. Say so when you archive such a session, and offer the backup.
33
+
34
+ ## 3. Switch — never write the launcher's tracked `workspace.json` directly
35
+
36
+ The switch procedure:
37
+
38
+ 1. Create a workspace task worktree for the change:
39
+ ```bash
40
+ node .claude/scripts/task-worktree.mjs --root . --create --repo . --branch chore/enable-task-model
41
+ ```
42
+ 2. Run the switch against that worktree (the one mode that accepts a linked-worktree root — it only edits `workspace.json`):
43
+ ```bash
44
+ node .claude/scripts/migrate-sessions.mjs --enable-task-model --root .claude/worktrees/chore-enable-task-model
45
+ ```
46
+ 3. Commit there, open a PR through the workspace's normal flow, and pull the launcher after merge. The launcher root never commits to its default branch.
47
+
48
+ The switch output reports `remainingSessions: null` when run from the worktree — the real remaining-sessions list comes from a separate `--inventory` at the launcher root. Remaining sessions are fine either way: they keep resuming and completing under the session lifecycle after the switch.
49
+
50
+ ## 4. Verify
51
+
52
+ Re-run `--inventory` at the launcher root and report what remains and why — kept sessions, anything the operator deferred, foreign entries, or an empty list.
53
+
54
+ ## 5. Afterwards
55
+
56
+ The first new piece of work starts with `/start-work` under the task lifecycle.
57
+
58
+ ## Deleting an archive — the operator's call, never this skill's
59
+
60
+ Archives are meant to be kept until the operator has looked at them. When the operator asks to delete one, first show them — for the whole archive, not just its top level — everything that deletion would destroy, per worktree (list them with `git -C {repo} worktree list --porcelain` in the workspace repo and each `repos/{name}`, filtered to paths under the archive):
61
+
62
+ - commits no remote holds: `git -C {worktree} log --oneline --branches --not --remotes` and whether a `drain/*` tag covers the tip;
63
+ - uncommitted, untracked and ignored files: `git -C {worktree} status --porcelain --ignored`;
64
+ - edits hidden from status: `git -C {worktree} ls-files -v` — any lowercase tag (assume-unchanged) or `S` (skip-worktree) whose file differs from the index;
65
+ - per-worktree refs that die with the worktree: `git -C {worktree} for-each-ref refs/worktree refs/bisect`;
66
+ - an operation in progress: `MERGE_HEAD`, `rebase-merge`, `rebase-apply` under `git -C {worktree} rev-parse --git-dir`;
67
+ - embedded repositories (any `.git` directory under the archive) and their unpushed branches;
68
+ - files in the archive outside the worktrees (e.g. beside `workspace/`).
69
+
70
+ Only on their explicit yes naming the archive: remove the worktrees deepest-first (`git -C {repo} worktree remove --force {path}`), delete each branch they confirm (`git -C {repo} branch -D {branch}`), then delete the archive folder. Nothing in this workspace does this automatically.
@@ -28,7 +28,15 @@ This is a coherent rewrite of the Progress section, not an append (coherent-revi
28
28
 
29
29
  ### Step 3: Update frontmatter status and post pause comment on tracker
30
30
 
31
- Use the session-frontmatter helper to set `status: paused` in the tracker's frontmatter.
31
+ Set `status: paused` in the tracker's frontmatter. `.claude/lib/session-frontmatter.mjs` is
32
+ a library, not a CLI — running it with flags does nothing and exits 2:
33
+
34
+ ```bash
35
+ node --input-type=module -e '
36
+ import { updateSessionFile } from "./.claude/lib/session-frontmatter.mjs";
37
+ updateSessionFile("session.md", { status: "paused" });
38
+ '
39
+ ```
32
40
 
33
41
  If the session tracker has a `workItem:` field AND `workspace.tracker` is configured, post a pause comment on the linked issue via the adapter:
34
42
 
@@ -1,151 +1,87 @@
1
1
  ---
2
2
  name: release
3
- description: Prepend a new CHANGELOG.md entry per project repo by synthesizing unreleased branch notes. Deletes consumed branch notes and synthesizes workspace-context into canonical (locked) entries. Use at release time.
3
+ description: Cut a versioned release of one project repo — bump the version, merge it through a PR, tag it, and publish a forge release whose notes are generated from merged PRs. No release-notes files.
4
4
  ---
5
5
 
6
6
  # Release
7
7
 
8
- Synthesize unreleased branch notes (in the **workspace** repo) into a concise, user-facing entry at the top of each project repo's `CHANGELOG.md`. Delete the consumed branch notes from the workspace. Bump the project repo's `package.json` version. In parallel, promote resolved workspace-context into canonical (locked) team knowledge.
8
+ Cut a versioned release of one project repo. The version bump travels through a PR like any other change; the tag marks the merge commit; the forge generates the release notes from merged PR titles. The workspace keeps no release-notes files of its own.
9
9
 
10
10
  ## Why this shape
11
11
 
12
- Branch notes are detailed dogfood-retrospective artifacts that should not bloat public project repos. By keeping them in the workspace repo until release time, the project repo stays lean — it only ever sees code commits and `CHANGELOG.md` entries. A single `CHANGELOG.md` with one concise entry per version is what users of a published package actually want. Branch notes remain the input format for `/complete-work` (they capture per-session detail at the right moment), but they live in the workspace and are consumed-then-deleted by `/release`.
13
-
14
- Versions are bumped here, not in `/complete-work`, because version semantics describe what shipped — accumulated changes since the last release — not the timing of any individual feature merge.
12
+ Release notes come from the forge. GitHub's generated notes (merged PR titles) are what users of a published release actually read; the detail behind each PR already lives in the issue and the PR body, so duplicating it into workspace files buys nothing. Projects that use changesets, semantic-release, or their own release tooling simply don't use this skill. A repo's `CHANGELOG.md`, if it has one, is historical — this skill never writes it.
15
13
 
16
14
  ## Parameters
17
- - `/release {version}` — create a release entry for a specific version
15
+
16
+ - `/release {version}` — release a specific version
18
17
  - `/release` — ask for the version
19
18
 
20
19
  ## Flow
21
20
 
22
21
  **Step 1: Determine version and repo**
23
- If no version parameter: ask "What version is this release? (e.g., 1.2.0)"
24
-
25
- Check `workspace.json` for `releaseMode`:
26
- - **per-repo** (default): ask which repo to release
27
- - **workspace**: process all repos together
28
- - **ask**: "Process all repos together or individually?"
29
22
 
30
- **Release-notes base directory.** Read `workspace.releaseNotesDir` from `workspace.json` (default `workspace-context/release-notes` if the field is absent). Throughout this skill `{releaseNotesDir}` refers to that resolved value; every branch-note path is `{releaseNotesDir}/unreleased/{repo}/…`. Never use a bare `release-notes/`.
23
+ Ask which repo to release — read `repos` from `workspace.json` and default to the entry with `"primary": true`. If no version was given, ask the bump kind (patch/minor/major) after showing the merged PRs since the last tag, so the operator can judge the impact:
31
24
 
32
- **Step 2: Read unreleased notes**
33
- Branch notes live in the **workspace** repo, written there by `/complete-work`. For each target repo, list the workspace's unreleased subdirectory for that project:
34
25
  ```bash
35
- ls {releaseNotesDir}/unreleased/{repo}/
26
+ git -C repos/{repo} describe --tags --abbrev=0
36
27
  ```
37
- Read all `branch-release-notes-*.md` and `branch-release-questions-*.md` files.
38
28
 
39
- If no unreleased files exist for a target repo: "No unreleased notes found for {repo}. Nothing to release."
29
+ Then call the forge adapter's `prList` with a merged-after search bounded by that tag's date (e.g. `merged:>{date}`). Pre-v1.0 breaking changes are a minor bump.
40
30
 
41
- The frontmatter `repo:` field on each branch-notes file confirms which project repo the notes belong to — match that to the directory name as a sanity check. Notes mismatched on `repo:` are a sign of manual file moves; surface to the user.
31
+ **Step 2: Preflight the tag**
42
32
 
43
- **Step 3: Group and organize**
44
- Group notes by `type:` frontmatter (feature, fix, chore). Within each group, order chronologically by date. This ordering drives bullet sequence in the synthesized entry.
33
+ If `v{version}` already exists on origin, stop and ask — reuse it, investigate with `forge.releaseView`, or pick another version. Never force-push a tag.
45
34
 
46
- **Step 4: Handle questions**
47
- Present all open questions from `branch-release-questions-*.md` files:
48
- "These questions are still open from development. For each one:"
49
- - **Answer** — provide the answer, remove from questions
50
- - **Defer** — keep as a "Known issues" sub-bullet in the CHANGELOG entry
51
- - **Discard** — no longer relevant
35
+ ```bash
36
+ git -C repos/{repo} ls-remote --exit-code origin refs/tags/v{version}
37
+ ```
52
38
 
53
- **Step 5: Synthesize the CHANGELOG entry**
39
+ **Step 3: Bump on a branch**
54
40
 
55
- Read the current `repos/{repo}/CHANGELOG.md` (if it exists) so the new entry matches the existing voice and structure. If no CHANGELOG exists, create one with a short header explaining that entries are written for package users, not contributors.
41
+ Create a task worktree for the release branch:
56
42
 
57
- Prepend a new section at the top of the changelog body (after the header, before any existing version entries). Write it user-facing — what shipped, not how it shipped:
43
+ ```bash
44
+ node .claude/scripts/task-worktree.mjs --root . --create --repo "{repo}" --branch "release/v{version}"
45
+ ```
58
46
 
59
- ```markdown
60
- ## v{version} — {YYYY-MM-DD}
47
+ If the repo has a `package.json` with a `version`, set it to `{version}` (edit the JSON; keep formatting) and update `package-lock.json`'s top-level version fields if that file is present. Commit `chore: release v{version}`. If the repo has no version file, skip the commit — step 5 tags the current default-branch head instead.
61
48
 
62
- - {Concise bullet per meaningful change. Features, fixes, and chores interleaved
63
- by significance, not by category. Each bullet is one sentence or short paragraph
64
- in plain user-facing language: "the CLI now supports X", "corrected Y behavior
65
- on Z", not "we decided" or "the team merged." Deduplicate related items.
66
- Write from scratch per the coherent-revisions rule.}
49
+ **Step 4: Merge**
67
50
 
68
- ### Known issues
69
- - {Deferred questions from Step 4, if any. Omit this subsection when empty.}
70
- ```
51
+ Push the branch and open a PR through the forge adapter — per-repo `createForge({ ...ws.workspace?.forge, repo: '{owner}/{name}' })` with head `release/v{version}`. Ask `Merge? [Y/n]`, then merge (squash, delete branch).
71
52
 
72
- The entry stays short. If a change needs more detail, reference the repo's docs or a dedicated design doc — do not inline session-level retrospection into the public changelog.
53
+ **Step 5: Tag and publish**
73
54
 
74
- **Step 6: Delete consumed branch notes from the workspace**
75
- ```bash
76
- rm {releaseNotesDir}/unreleased/{repo}/branch-release-*
77
- # If the directory is now empty, remove it too:
78
- rmdir {releaseNotesDir}/unreleased/{repo} 2>/dev/null || true
79
- ```
80
- The branch notes were an intermediate capture; their content is now in the CHANGELOG entry and their raw form in git history. They do not survive into the project repo.
55
+ Pull the merge, tag it, push the tag, and publish the forge release:
81
56
 
82
- **Step 7: Commit the CHANGELOG entry to the project repo**
83
57
  ```bash
84
- cd repos/{repo}
85
- git add CHANGELOG.md
86
- git commit -m "docs: v{version} changelog entry"
58
+ git -C repos/{repo} pull --ff-only
59
+ git -C repos/{repo} tag v{version}
60
+ git -C repos/{repo} push origin v{version}
87
61
  ```
88
- This commit lands on the project repo's source clone (which stays on its default branch). The user pushes it when ready — `/release` does not push automatically.
89
62
 
90
- **Step 7b: Bump package.json version (project repo)**
91
- If the project repo has a `package.json` with a `version` field, update it to match the release version:
92
- ```bash
93
- cd repos/{repo}
94
- # Update "version": "..." in package.json to the release version
95
- git add package.json
96
- git commit -m "chore: bump version to v{version}"
63
+ ```js
64
+ await forge.releaseCreate({ tag: 'v{version}', repo, generateNotes: true });
97
65
  ```
98
- Skip this step if the repo has no package.json or no version field.
99
66
 
100
- **Step 7c: Commit the consumed-notes deletion in the workspace**
67
+ If the repo has `.github/workflows/publish.yml`, find and watch its run with `workflowRunFind` / `workflowRunWatch` — retry the find up to 5 times with 3 s backoff (the run may not be registered the moment the tag lands). A failed run is reported to the operator, not thrown.
68
+
69
+ **Step 6: Tear down and report**
70
+
71
+ Remove the release worktree:
72
+
101
73
  ```bash
102
- # From the workspace root
103
- git add {releaseNotesDir}/unreleased/
104
- git commit -m "release: consume {repo} branch notes for v{version}"
74
+ node .claude/scripts/task-worktree.mjs --root . --remove --repo "{repo}" --branch "release/v{version}" --delete-branch
105
75
  ```
106
- Workspace and project repos have separate commits — they are separate git histories.
107
-
108
- **Step 8: Consume project-scoped specs**
109
- Project-scoped specs and plans in `workspace-context/team-member/{user}/` (ongoing) that are fully covered by this release:
110
- - Consume into the CHANGELOG entry (their content is now captured there)
111
- - Remove the source files
112
- - If partially covered: rewrite the spec to reflect only what remains unimplemented
113
-
114
- **Step 9: Synthesize workspace-context for canonical promotion**
115
- Process ephemeral workspace-context entries:
116
-
117
- 1. List all ephemeral entries with `lifecycle: resolved` (across `shared/` and any `team-member/{user}/`).
118
- 2. For each, determine:
119
- - Does an existing locked entry cover this topic? → Merge into it (enrich)
120
- - Are there related resolved entries? → Combine into a new locked entry
121
- - Is it stale/fully consumed by release notes? → Archive or delete
122
- - Is it unresolvable but still valuable? → Move to `team-member/{user}/` ongoing or keep at `shared/` root ephemeral
123
- 3. For merged/new locked entries:
124
- - Set `state: locked`, `type: synthesized` (or `type: reference` for clean truths)
125
- - Write to `workspace-context/shared/locked/{bare-name}.md` — locked files use bare names (location signals the type), so strip any `braindump_/handoff_/research_` prefix when promoting
126
- - Write concise, focused content — team truths, not session history
127
- 4. Regenerate auto-files so `canonical.md` and `index.md` reflect the new locked content:
128
- ```bash
129
- node .claude/scripts/build-workspace-context.mjs --write --root .
130
- ```
131
- 5. Commit:
132
- ```bash
133
- git add workspace-context/
134
- git commit -m "release: synthesize workspace-context for v{version}"
135
- ```
136
-
137
- **Step 10: Report**
138
- "Release v{version} complete for {repo}. {N} branch notes consumed into CHANGELOG.md. {M} context entries synthesized into {K} locked entries."
76
+
77
+ Report the PR, the tag, the release URL, and the publish status.
78
+
79
+ **Step 7: Update workspace release state**
80
+
81
+ If the workspace keeps release state in `workspace-context/` (for example a current-release line in a status file under `shared/locked/`), offer to update it — through a workspace task worktree and PR, never on the launcher.
139
82
 
140
83
  ## Notes
141
84
 
142
- - Release entries live in `CHANGELOG.md` at the project repo root — one file, one concise entry per version. No `release-notes/v*.md`, no `release-notes/archive/`.
143
- - Branch notes live in the WORKSPACE at `{releaseNotesDir}/unreleased/{repo}/` (resolved from `workspace.json` → `workspace.releaseNotesDir`, default `workspace-context/release-notes`). `/complete-work` writes them; `/release` consumes and deletes them. They never reach project repos.
144
- - Versions are bumped here, not in `/complete-work`. This keeps the version semantics aligned with what actually shipped (accumulated changes since last release).
145
- - The public repo stays lean. Detailed per-branch retrospection exists in workspace git history (the consumed-notes commit) but is not surfaced as standalone files in either repo.
146
- - Context synthesis happens in the WORKSPACE repo — Step 7c (consumed-notes) and Step 9 (workspace-context synthesis) are separate workspace commits.
147
- - Per-repo is the default — each project repo has its own release cadence.
148
- - The coherent-revisions rule applies: write the CHANGELOG entry from scratch, don't concatenate branch notes.
149
- - Tagging happens in `/complete-work`, not here. When the session branch starts with `release/`, `/complete-work` tags the merge commit on the project repo's default branch and pushes the tag, which triggers `.github/workflows/publish.yml` to publish to npm. `/release` produces the synthesis (CHANGELOG entry + version bump + consumed-notes deletion); `/complete-work` does the push, PR, merge, and tag.
150
- - Do not run `npm publish` locally. The publish workflow is the only path that exercises OIDC trusted publishing — local publish requires 2FA OTP and bypasses that. If the workflow fails, investigate via `gh run view`; do not fall back to local publish.
151
- - Recovery from a failed publish. Transient failure: rerun via `gh run rerun {run_id}`. Content failure: delete the tag (`git push origin --delete v{version} && git tag -d v{version}`), then redo the release in a new release session — `/start-work`, then `/release v{version}`, then `/complete-work`. Once a version is published to npm, that version is committed on the registry; bump and start a new release.
85
+ - Never run `npm publish` locally. The publish workflow is the only path that exercises OIDC trusted publishing; a local publish requires a 2FA OTP and bypasses it. If the workflow fails, investigate via `gh run view` — do not fall back to a local publish.
86
+ - Recovery from a failed publish: transient failures rerun via `gh run rerun {run_id}`; content failures mean deleting the tag and redoing the release. Once a version is published to a registry, that version number is committed — bump and release a new version instead.
87
+ - Pre-v1.0 breaking changes are a minor bump, not major.
@@ -5,6 +5,8 @@ description: Begin or resume a work session. Creates a self-contained work-sessi
5
5
 
6
6
  # Start Work
7
7
 
8
+ Two lifecycles share this skill. `workspace.sessionModel` in `workspace.json` selects for new work: `"task"` routes new work to **Flow: Task** (session model v2 — no session folder, no `session.md`); absent or `"session"` keeps the existing flows below, unchanged. Resuming an existing `work-sessions/` session always uses the existing Resume flow regardless of the setting.
9
+
8
10
  Begin or resume a persistent work session. Each session lives in its own `work-sessions/{name}/` folder containing one workspace worktree, nested project worktrees, and a unified `session.md` tracker. Sessions can run in parallel from separate terminals.
9
11
 
10
12
  ## Parameters
@@ -13,6 +15,55 @@ Begin or resume a persistent work session. Each session lives in its own `work-s
13
15
  - `/start-work handoff` — list shared context to resume from
14
16
  - `/start-work all` — list active sessions across all users (for shared debugging or multi-user workspaces)
15
17
 
18
+ ## Flow: Task (session model v2)
19
+
20
+ New work as a task: one tracker issue, one branch, one worktree per repo the work touches. This flow creates no `work-sessions/` folder, no `session.md`, and seeds no task list — the issue, the branch, and the chat record are the entire state. The chat stays at the workspace root — `{launcher-root}`, the absolute path on the `Workspace root:` line the SessionStart hook injects (at /start-work time you are normally already there); the worktrees are reached by path.
21
+
22
+ If `workspace.tracker` is absent, say tracking is off and skip step 1 — but still ask for the type (`bug` / `feat` / `chore`) and a one-line description, because the type picks the branch prefix — then continue with steps 2–6. Tell the user plainly what that costs: without a tracker there is no `workItem`, the task is not recorded on the chat record, and `/complete-work` cannot find it from the launcher. It is completed either by running `/complete-work` from inside the worktree (cwd detection) or by opening the PR by hand.
23
+
24
+ 1. **Identify or create the tracker issue and claim it** — the same adapter calls as Flow: Blank steps 3–6:
25
+
26
+ ```javascript
27
+ import { createTracker } from './.claude/scripts/trackers/interface.mjs';
28
+ import { readFileSync } from 'node:fs';
29
+ const ws = JSON.parse(readFileSync('workspace.json', 'utf-8'));
30
+ const tracker = createTracker(ws.workspace.tracker);
31
+ const assigned = await tracker.listAssignedToMe();
32
+ const candidates = assigned.length > 0 ? assigned : await tracker.listUnassigned();
33
+ ```
34
+
35
+ Present the list as Flow: Blank step 4 does. When the pick came from the unassigned fallback, claim it atomically and re-fetch on `ALREADY_ASSIGNED` exactly as Blank step 5 shows; for "something new", create and self-assign per Blank step 6:
36
+
37
+ ```javascript
38
+ const newIssue = await tracker.createIssue({
39
+ title: description,
40
+ body: `Created at /start-work by ${user}.`,
41
+ labels: [type, priority],
42
+ milestone: milestone || null,
43
+ });
44
+ await tracker.claim(newIssue.id);
45
+ ```
46
+
47
+ Remember `workItem: {issue.id}`.
48
+
49
+ 2. **Pick repo(s)** — the same numbered multi-select as Blank step 7 (e.g. `1,3` or `all`), defaulting to the repo marked `"primary": true` under `repos` in `workspace.json`, falling back to the first entry when none is marked. The list also offers the **workspace repo itself**, shown as `workspace (this repo)` and addressed as `.`. Include it when the task changes anything tracked in the workspace repo — `workspace-context/`, the workspace's own `.claude/` (rules, hooks, scripts, skills), or, in a dogfood workspace, mirrors of template changes. Steps 4 and 5 take `.` like any other repo name (`--repo "."`).
50
+
51
+ 3. **Propose the branch** — `{prefix}/{slug}` with the prefix from type (`feature/`, `bugfix/`, `chore/`), per the branch-naming step in Flow: Blank.
52
+
53
+ 4. **Create one worktree per repo the work touches:**
54
+ ```bash
55
+ node .claude/scripts/task-worktree.mjs --root . --create --repo "{repo}" --branch "{branch}"
56
+ ```
57
+ The script fetches origin best-effort (offline is fine) before choosing the base. A project repo's worktree lands at `repos/{repo}/.claude/worktrees/{slug}/` — Claude Code's native worktree location — based on `origin/{defaultBranch}` when that ref exists, and never tracking it. For `.` the worktree lands at `.claude/worktrees/{slug}/` — the same native location, one level up — based on the workspace origin's HEAD (falling back to `main`); the workspace's own `.gitignore` already covers the path.
58
+
59
+ 5. **Record the task on this chat's record** (only when a `workItem` exists — see the no-tracker note above):
60
+ ```bash
61
+ node .claude/scripts/chat-record.mjs --root . --add-task --chat "{chat}" --work-item "{workItem}" --branch "{branch}" --repo "{repo}"
62
+ ```
63
+ `{chat}` is the name from the `Chat record:` line the SessionStart hook injected into this conversation. If there is no such line, say so and skip recording rather than guessing a name.
64
+
65
+ 6. **Tell the user where the work happens:** the worktree path(s) above — edits belong there, not in the source clones at `repos/{repo}/`. Work continues from this chat by path. A chat started inside a **project** worktree would not load the workspace's conventions or hooks (a worktree is a context boundary), so staying here is the default. A `.` worktree does load a copy of the workspace's `CLAUDE.md`/`.claude/` — but with the worktree as root, so its chat records land in the worktree's own scratchpad rather than the launcher's; the task still belongs to this chat.
66
+
16
67
  ## Flow: No Parameter
17
68
 
18
69
  1. Read the current user from `.claude/settings.local.json` → `workspace.user`. If unset, behave as `/start-work all` (no user filter). If the user invoked `/start-work all`, also skip filtering.
@@ -40,7 +91,7 @@ Begin or resume a persistent work session. Each session lives in its own `work-s
40
91
  - Workspace: `work-sessions/{name}/workspace/`
41
92
  - For each repo in `repos:` frontmatter: `work-sessions/{name}/workspace/repos/{repo}/`
42
93
  - If any are missing, recreate from the branch
43
- 3. The session-start hook automatically registers each chat in the session tracker's `chatSessions` frontmatter when Claude opens in a worktree. Verify the current chat is registered — if not (e.g., the hook didn't fire), add an entry manually via the session-frontmatter helper.
94
+ 3. The session-start hook automatically registers each chat in the session tracker's `chatSessions` frontmatter when Claude opens in a worktree. Verify the current chat is registered — if not (e.g., the hook didn't fire), append an entry using the invocation shown under "Create work session" below (the helper is an importable library, not a CLI).
44
95
 
45
96
  Each `chatSessions` entry has this shape:
46
97
  ```yaml
@@ -55,7 +106,7 @@ Begin or resume a persistent work session. Each session lives in its own `work-s
55
106
  4. Update the tracker `status:` to `active` if it was `paused`
56
107
  5. Restore the task list from `## Tasks` per the `task-list-mirroring` rule:
57
108
  ```bash
58
- cd work-sessions/{name}/workspace
109
+ cd "work-sessions/{name}/workspace"
59
110
  node .claude/scripts/sync-tasks.mjs --read session.md
60
111
  ```
61
112
  Pass the parsed `todos` array to `TodoWrite` so the live UI matches the durable state. If the section is missing (legacy session predating this feature), seed it first via `--write` with an empty `todos` array — the helper will insert the bookends.
@@ -165,9 +216,40 @@ The script creates:
165
216
  - Active-session pointer at `work-sessions/{session-name}/workspace/.claude/.active-session.json`
166
217
  - Copies `settings.local.json` into the worktree if it exists at the workspace root
167
218
 
168
- If a `workItem:` was set in step 5 or 6, write it into the tracker's frontmatter via the session-frontmatter helper after creation. This is what `/pause-work` and `/complete-work` use to locate the linked issue.
219
+ If a `workItem:` was set in step 5 or 6, write it into the tracker's frontmatter after
220
+ creation. `/pause-work` and `/complete-work` both use this to locate the linked issue, and
221
+ a session created without it looks fine until one of them silently cannot find the ticket.
222
+
223
+ `.claude/lib/session-frontmatter.mjs` is a **library, not a CLI** — running it with flags
224
+ does nothing and exits 2. Import it:
225
+
226
+ ```bash
227
+ cd "work-sessions/{session-name}/workspace"
228
+ node --input-type=module -e '
229
+ import { updateSessionFile, readSessionFields } from "./.claude/lib/session-frontmatter.mjs";
230
+ updateSessionFile("session.md", { workItem: "{workItem}" });
231
+ console.log("workItem =", readSessionFields("session.md").workItem);
232
+ '
233
+ ```
234
+
235
+ Read the value back, as above, and confirm it before moving on — this write has failed
236
+ silently before (gh:143).
237
+
238
+ Register this chat in the tracker's `chatSessions` frontmatter. For new sessions, the session-start hook has already fired (before /start-work was invoked) but the session folder didn't exist yet. Find the current chat's UUID from the most recently modified `.jsonl` file in
239
+ `~/.claude/projects/{project-path}/` and append the entry with the same library:
240
+
241
+ ```bash
242
+ node --input-type=module -e '
243
+ import { updateSessionFile, readSessionFields } from "./.claude/lib/session-frontmatter.mjs";
244
+ const existing = readSessionFields("session.md").chatSessions || [];
245
+ updateSessionFile("session.md", {
246
+ chatSessions: [...existing, { id: "{uuid}", names: [], started: new Date().toISOString(), ended: null }],
247
+ });
248
+ '
249
+ ```
169
250
 
170
- Register this chat in the tracker's `chatSessions` frontmatter. For new sessions, the session-start hook has already fired (before /start-work was invoked) but the session folder didn't exist yet. Find the current chat's UUID from the most recently modified `.jsonl` file in `~/.claude/projects/{project-path}/` and add the entry manually via the session-frontmatter helper. Subsequent chats on this session will be registered automatically by the hook.
251
+ Append — never replace: the list is the session'"'"'s whole chat history. Subsequent chats are
252
+ registered automatically by the hook.
171
253
 
172
254
  The tracker already reflects the correct state — assignment happened in step 5 or 6 via `adapter.claim()`. Do not write to any local file mirror. There is no `open-work.md`.
173
255
 
@@ -177,7 +259,7 @@ After session creation, seed the `## Tasks` section in the new tracker so `TodoW
177
259
 
178
260
  ```bash
179
261
  # Build the seed from inside the worktree so the helper resolves workspace.json correctly.
180
- cd work-sessions/{session-name}/workspace
262
+ cd "work-sessions/{session-name}/workspace"
181
263
  echo '{"todos": []}' | node .claude/scripts/sync-tasks.mjs --write session.md
182
264
  ```
183
265
 
@@ -199,7 +281,7 @@ The auto-commit at the end of "Capture prior conversation context" picks up the
199
281
 
200
282
  ### Capture prior conversation context
201
283
 
202
- If brainstorming, spec writing, or design discussion happened in this conversation before `/start-work` was called, that reasoning needs to be captured into the session tracker body. Otherwise it will be lost when the conversation ends and `/complete-work` will produce thin release notes.
284
+ If brainstorming, spec writing, or design discussion happened in this conversation before `/start-work` was called, that reasoning needs to be captured into the session tracker body. Otherwise it will be lost when the conversation ends and `/complete-work` will write a thin PR body.
203
285
 
204
286
  Check: has the current conversation included substantive discussion (design decisions, requirements exploration, approach selection) before this point?
205
287
 
@@ -208,7 +290,7 @@ If yes:
208
290
  2. Write the summary into `work-sessions/{session-name}/workspace/session.md`'s body, in a `## Pre-session context` or `## Progress` section
209
291
  3. Auto-commit from inside the worktree so the capture lands on the session branch:
210
292
  ```bash
211
- cd work-sessions/{session-name}/workspace
293
+ cd "work-sessions/{session-name}/workspace"
212
294
  git add session.md
213
295
  git commit -m "chore: capture pre-session discussion for {session-name}"
214
296
  ```
@@ -56,6 +56,8 @@ For each repo in `workspace.json`:
56
56
  - If confirmed: `git clone {remote} repos/{name}`
57
57
  - If exists: report "repos/{name} already present"
58
58
 
59
+ While workspace.json is open, confirm the work lifecycle. `workspace.sessionModel` selects where `/start-work` routes new work: `"task"` (one tracker issue + one branch + one worktree per touched repo; recommended for new workspaces) or `"session"` (self-contained `work-sessions/{name}/` folders; the template default — keep it for teams already mid-flight on sessions). Ask: "Which lifecycle should new work use — task (recommended for a new workspace) or session (default)?" and write the answer to `workspace.sessionModel` only if it differs from the current value. Never flip an existing non-default value silently.
60
+
59
61
  ### Step 3: Identify documentation sources
60
62
 
61
63
  Ask the user:
@@ -447,6 +449,6 @@ This session is done. Start a fresh Claude Code session and run /start-work to b
447
449
  - Documentation sources are first-class — always ask, always confirm access, always report failures
448
450
  - Chat history scanning uses a manifest to survive auto-compaction
449
451
  - Existing worktrees are formalized with session markers, trackers, and linked chat history
450
- - **Subdirectory launch:** Once initialized, `claude` can be launched from `work-sessions/{name}/workspace/repos/{repo}/` instead of the workspace root. Claude walks up the filesystem loading every `CLAUDE.md` it finds, so starting from inside a project worktree loads both the per-repo conventions and the workspace conventions automatically. This is useful for repo-focused tasks — no configuration change needed, just a different launch point.
452
+ - **Launch point:** Launch `claude` from the workspace root. A worktree is a context boundary — `CLAUDE.md` discovery stops at its root and gitignored content is absent — so a chat started inside a project worktree (a session's `work-sessions/{name}/workspace/repos/{repo}/` or a task's `repos/{repo}/.claude/worktrees/{slug}/`) loads only that repo's own `CLAUDE.md`, without the workspace conventions or hooks. That is occasionally what you want for isolated, repo-only work; for normal work, stay at the root and reach worktrees by path.
451
453
  - **Skills are on-demand, not pre-loaded:** Skills are invoked explicitly by name (`/skill-name`) when needed; they are not loaded at session start. The `.skip` mechanism in `.claude/rules/` provides the analogous progressive-disclosure pattern for rules — a `.md.skip` file is present but inactive; rename it to `.md` to activate, rename it back to deactivate. Step 6 of this skill walks through the activation choices.
452
454
  - **`scope:` for path-scoped skills:** The `scope:` frontmatter field (shown as a commented-out example at the top of this file) restricts a skill so it activates only when the working directory is inside the declared path. Removing the `#` prefix from the example line turns this skill into a path-scoped skill — useful when you want a repo-specific skill available only from inside that repo's worktree.
@@ -119,6 +119,10 @@ git commit -m "chore: update workspace from template v{fromVersion} to v{toVersi
119
119
 
120
120
  Report: "Workspace updated to v{toVersion}. Restart Claude Code if rules or hooks changed."
121
121
 
122
+ ### Step 8: Session-model migration nudge
123
+
124
+ After the update is applied, if the sessions directory (`workspace.workSessionsDir`, default `work-sessions/`) has entries and `workspace.sessionModel` is not `"task"`, append one line to the report: "This workspace still has {N} session(s) under the session model — `/migrate-sessions` can inventory and drain them and switch to the task model whenever you're ready." Suggest only; the operator decides whether and when.
125
+
122
126
  ## Notes
123
127
 
124
128
  - The CLI (`npx @ulysses-ai/create-workspace --upgrade`) stages the payload. This skill processes it.
@@ -8,6 +8,7 @@ This is a claude-workspace. All conventions are defined in .claude/rules/.
8
8
  - Each session is a self-contained folder at `work-sessions/{name}/` containing the worktree, nested project worktrees, and the session tracker
9
9
  - From root: only `local-only-*` and `workspace-scratchpad/` are writable
10
10
  - Team knowledge lives in `workspace-context/`
11
+ - Run `/rename` to label this chat before `/clear` — keeps the chat findable in your CLI history after the context is wiped
11
12
 
12
13
  ## Workspace Config
13
14
  @workspace.json
@@ -25,11 +26,27 @@ This is a claude-workspace. All conventions are defined in .claude/rules/.
25
26
  - `/braindump [name]` — capture discussion/reasoning
26
27
  - `/aside [--quick] <thought>` — capture a drive-by idea without interrupting current work
27
28
  - `/pause-work` — suspend work, push, draft PR
28
- - `/complete-work` — finalize branch, release notes, real PR
29
+ - `/complete-work` — finalize the work — rebase, PR, merge, close the issue
29
30
  - `/promote` — move personal memory to shared context
30
- - `/release [version]` — combine unreleased notes into versioned doc
31
+ - `/release [version]` — cut a versioned release: bump, tag, forge release with generated notes
31
32
  - `/sync-work` — push branches without ceremony
32
33
  - `/workspace-update` — apply template updates (runs maintenance before/after)
33
34
  - `/setup-tracker` — wire this workspace to an issue tracker (GitHub Issues shipped; others pluggable)
34
35
  - `/maintenance [audit|cleanup]` — workspace health checks and cleanup
35
36
  - `/build-docs-site` — build a comprehensive Docusaurus documentation site for a project
37
+
38
+ ## Compact Instructions
39
+
40
+ When auto-compacting context, preserve in the summary:
41
+ - Decisions made in this session and their rationale
42
+ - Constraints and conventions established or confirmed
43
+ - Active task list state and the next concrete step
44
+ - File paths touched and the nature of the change
45
+ - Errors hit and what was tried
46
+
47
+ Drop from the summary:
48
+ - Verbose tool output already reflected in committed code
49
+ - Exploratory reads that did not lead to a change
50
+ - Conversational asides
51
+
52
+ Files in `workspace-context/`, the session tracker (`session.md`) or chat drawer (`workspace-scratchpad/chats/{chat}/`), and any `design-*.md`/`plan-*.md` survive compaction — they're on disk. Re-read them on demand instead of trying to keep their contents in summary.
@@ -17,6 +17,10 @@ workspace-scratchpad/
17
17
  .claude/.active-session.json
18
18
  CLAUDE.local.md
19
19
 
20
+ # Worktrees of the workspace repo itself — task worktrees (repo ".") and
21
+ # Claude Code's native worktrees both live under .claude/worktrees/
22
+ .claude/worktrees/
23
+
20
24
  # Local-only convention — machine-local state, any depth
21
25
  local-only-*
22
26
 
@@ -26,3 +30,8 @@ local-only-*
26
30
  # OS
27
31
  .DS_Store
28
32
  Thumbs.db
33
+
34
+ # Per-user workspace-context indexes are generated per machine and read only
35
+ # through CLAUDE.local.md, which is itself gitignored — no mechanism reads
36
+ # another user's index. Regenerated by build-workspace-context.mjs on demand.
37
+ workspace-context/team-member/*/index.md