@ulysses-ai/create-workspace 0.13.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/bin/create.mjs +79 -0
  4. package/lib/git.mjs +26 -0
  5. package/lib/init.mjs +129 -0
  6. package/lib/payload.mjs +44 -0
  7. package/lib/prompts.mjs +113 -0
  8. package/lib/scaffold.mjs +84 -0
  9. package/lib/upgrade.mjs +42 -0
  10. package/package.json +43 -0
  11. package/template/.claude/agents/aside-researcher.md +48 -0
  12. package/template/.claude/agents/implementer.md +39 -0
  13. package/template/.claude/agents/researcher.md +40 -0
  14. package/template/.claude/agents/reviewer.md +47 -0
  15. package/template/.claude/hooks/_utils.mjs +196 -0
  16. package/template/.claude/hooks/_utils.test.mjs +99 -0
  17. package/template/.claude/hooks/post-compact.mjs +7 -0
  18. package/template/.claude/hooks/pre-compact.mjs +34 -0
  19. package/template/.claude/hooks/repo-write-detection.mjs +107 -0
  20. package/template/.claude/hooks/session-end.mjs +91 -0
  21. package/template/.claude/hooks/session-start.mjs +150 -0
  22. package/template/.claude/hooks/subagent-start.mjs +44 -0
  23. package/template/.claude/hooks/workspace-update-check.mjs +42 -0
  24. package/template/.claude/hooks/worktree-create.mjs +53 -0
  25. package/template/.claude/lib/session-frontmatter.mjs +265 -0
  26. package/template/.claude/lib/session-frontmatter.test.mjs +242 -0
  27. package/template/.claude/recipes/migrate-from-notion.md +120 -0
  28. package/template/.claude/rules/agent-rules.md.skip +32 -0
  29. package/template/.claude/rules/cloud-infrastructure.md.skip +15 -0
  30. package/template/.claude/rules/coherent-revisions.md +24 -0
  31. package/template/.claude/rules/documentation.md.skip +13 -0
  32. package/template/.claude/rules/git-conventions.md +34 -0
  33. package/template/.claude/rules/honest-pushback.md +56 -0
  34. package/template/.claude/rules/local-dev-environment.md.skip +60 -0
  35. package/template/.claude/rules/memory-guidance.md +26 -0
  36. package/template/.claude/rules/product-integrity.md.skip +24 -0
  37. package/template/.claude/rules/scope-guard.md.skip +22 -0
  38. package/template/.claude/rules/superpowers-workflow.md.skip +22 -0
  39. package/template/.claude/rules/token-economics.md.skip +31 -0
  40. package/template/.claude/rules/work-item-tracking.md +90 -0
  41. package/template/.claude/rules/workspace-structure.md +69 -0
  42. package/template/.claude/scripts/add-repo-to-session.mjs +78 -0
  43. package/template/.claude/scripts/cleanup-work-session.mjs +108 -0
  44. package/template/.claude/scripts/create-work-session.mjs +124 -0
  45. package/template/.claude/scripts/migrate-open-work.mjs +91 -0
  46. package/template/.claude/scripts/migrate-session-layout.mjs +236 -0
  47. package/template/.claude/scripts/migrate-session-layout.test.mjs +144 -0
  48. package/template/.claude/scripts/trackers/github-issues.mjs +170 -0
  49. package/template/.claude/scripts/trackers/github-issues.test.mjs +190 -0
  50. package/template/.claude/scripts/trackers/interface.mjs +25 -0
  51. package/template/.claude/scripts/trackers/interface.test.mjs +40 -0
  52. package/template/.claude/settings.json +107 -0
  53. package/template/.claude/skills/aside/SKILL.md +125 -0
  54. package/template/.claude/skills/braindump/SKILL.md +96 -0
  55. package/template/.claude/skills/build-docs-site/SKILL.md +323 -0
  56. package/template/.claude/skills/build-docs-site/checklists/framing.md +221 -0
  57. package/template/.claude/skills/build-docs-site/checklists/pitfalls.md +228 -0
  58. package/template/.claude/skills/build-docs-site/checklists/review.md +130 -0
  59. package/template/.claude/skills/build-docs-site/scripts/bulk-fill-migration.py +393 -0
  60. package/template/.claude/skills/build-docs-site/scripts/forbidden-word-grep.mjs +159 -0
  61. package/template/.claude/skills/build-docs-site/scripts/leak-grep.mjs +328 -0
  62. package/template/.claude/skills/build-docs-site/templates/custom.css.tmpl +212 -0
  63. package/template/.claude/skills/build-docs-site/templates/docusaurus.config.ts.tmpl +95 -0
  64. package/template/.claude/skills/build-docs-site/templates/primitives/Arrow.tsx +87 -0
  65. package/template/.claude/skills/build-docs-site/templates/primitives/Box.tsx +90 -0
  66. package/template/.claude/skills/build-docs-site/templates/primitives/DiagramContainer.tsx +46 -0
  67. package/template/.claude/skills/build-docs-site/templates/primitives/Region.tsx +68 -0
  68. package/template/.claude/skills/build-docs-site/templates/primitives/SectionTitle.tsx +42 -0
  69. package/template/.claude/skills/build-docs-site/templates/primitives/tokens.ts +67 -0
  70. package/template/.claude/skills/build-docs-site/templates/sidebars.ts.tmpl +89 -0
  71. package/template/.claude/skills/build-docs-site/templates/spec.md.tmpl +119 -0
  72. package/template/.claude/skills/complete-work/SKILL.md +369 -0
  73. package/template/.claude/skills/handoff/SKILL.md +98 -0
  74. package/template/.claude/skills/maintenance/SKILL.md +116 -0
  75. package/template/.claude/skills/pause-work/SKILL.md +98 -0
  76. package/template/.claude/skills/promote/SKILL.md +77 -0
  77. package/template/.claude/skills/release/SKILL.md +126 -0
  78. package/template/.claude/skills/setup-tracker/SKILL.md +117 -0
  79. package/template/.claude/skills/start-work/SKILL.md +234 -0
  80. package/template/.claude/skills/sync-work/SKILL.md +73 -0
  81. package/template/.claude/skills/workspace-init/SKILL.md +420 -0
  82. package/template/.claude/skills/workspace-update/SKILL.md +108 -0
  83. package/template/.mcp.json +12 -0
  84. package/template/CLAUDE.md.tmpl +32 -0
  85. package/template/_gitignore +28 -0
  86. package/template/workspace.json.tmpl +15 -0
@@ -0,0 +1,420 @@
1
+ ---
2
+ name: workspace-init
3
+ description: First-time workspace initialization. Clones repos, installs template components, extracts team knowledge from documentation sources and Claude chat history, activates rules, configures user identity. Run once after scaffolding with --init.
4
+ ---
5
+
6
+ # Workspace Init
7
+
8
+ Guided initialization for a newly scaffolded workspace. Clones repos, installs template components from the `.workspace-update/` payload, extracts team knowledge from documentation sources and prior Claude chat history, populates shared context, formalizes existing worktrees as work sessions, and configures the workspace for use.
9
+
10
+ This skill runs once. After completion, it sets `workspace.initialized: true` in workspace.json.
11
+
12
+ ## Prerequisites
13
+
14
+ - `.workspace-update/` payload directory must exist (staged by `npx @ulysses-ai/create-workspace --init`)
15
+ - If no `.workspace-update/` payload exists, report: "No update payload found. Run `npx @ulysses-ai/create-workspace --init` to stage the template."
16
+ - `workspace.json` must exist
17
+
18
+ ## Gate
19
+
20
+ If `workspace.json` has `"initialized": true` AND `.workspace-update/` exists with `"action": "init"` in `.workspace-update/.manifest.json`, warn: "Workspace is already initialized. Did you mean to run `npx @ulysses-ai/create-workspace --upgrade` instead?" Do not proceed unless the user explicitly confirms they want to re-initialize.
21
+
22
+ If `workspace.json` has `"initialized": true` and no `.workspace-update/` payload exists, report: "Workspace already initialized. Use /workspace-update for template updates, or /maintenance to check integrity."
23
+
24
+ ## Branching
25
+
26
+ Workspace-init creates a branch for all its work:
27
+ ```bash
28
+ git checkout -b chore/workspace-init
29
+ ```
30
+ All commits go on this branch. After completion, the user reviews and squash-merges to main.
31
+
32
+ ## Flow
33
+
34
+ ### Step 1: Inventory
35
+
36
+ Scan the workspace for existing content that needs organizing:
37
+ - CLAUDE.md.bak — pre-existing CLAUDE.md (old config, rules, preferences)
38
+ - .mcp.json or .mcp.json.bak — external service configs
39
+ - Non-standard directories and files at root — anything not part of the template structure
40
+ - Existing auto-memory files in `~/.claude/projects/` for this project path
41
+ - Existing git worktrees (branches checked out in separate directories)
42
+ - Any files at workspace root that aren't: CLAUDE.md, workspace.json, .gitignore
43
+
44
+ Present the inventory as a table.
45
+
46
+ ### Step 2: Read workspace.json and clone repos
47
+
48
+ Read `workspace.json` and list the configured repos.
49
+
50
+ For each repo in `workspace.json`:
51
+ - Check if `repos/{name}` already exists
52
+ - If missing: ask "Clone {name} from {remote}? [Y/n]"
53
+ - If confirmed: `git clone {remote} repos/{name}`
54
+ - If exists: report "repos/{name} already present"
55
+
56
+ ### Step 3: Identify documentation sources
57
+
58
+ Ask the user:
59
+
60
+ "Where does your project documentation live? (Select all that apply)"
61
+ - Notion pages (will need MCP access to extract)
62
+ - Confluence / wiki
63
+ - Markdown files in the repo
64
+ - Google Docs
65
+ - Claude chat history from prior sessions on this project
66
+ - Other: ___
67
+ - No external documentation
68
+
69
+ This determines whether documentation extraction is part of the plan.
70
+
71
+ **Important:** If the user indicates a source, ask: "Has any content already been extracted from this source? (e.g., rules or context files already pulled down from Notion)" Check `shared-context/` and `.claude/rules/` for files that appear to contain extracted content. If content already exists from a source, mark it as "already extracted" and skip re-fetching unless the user explicitly wants a refresh.
72
+
73
+ ### Step 4: Present the plan
74
+
75
+ Based on inventory, repos, and documentation sources, formulate a numbered plan. Present it before executing:
76
+
77
+ ```
78
+ "Here's what I found and my proposed plan:
79
+
80
+ Step 1: ✓ Inventory (done — {N} items found)
81
+ Step 2: ✓ Repos cloned
82
+ Step 3: ✓ Documentation sources identified
83
+ Step 4: ✓ Plan (this step)
84
+ Step 5: Install template components from payload
85
+ Step 6: Activate optional rules
86
+ Step 7: Extract content from documentation sources
87
+ Step 8: Scan Claude chat history
88
+ Step 9: Preserve local preferences from CLAUDE.md.bak
89
+ Step 10: Create locked team knowledge
90
+ Step 11: Formalize existing worktrees as work sessions
91
+ Step 12: Set up issue tracker
92
+ Step 13: Configure user identity
93
+ Step 14: Clean root directory
94
+ Step 15: Clean up payload and pre-migration artifacts
95
+ Step 16: Verify — self-contradiction check
96
+ Step 17: Set up workspace remote
97
+ Step 18: Mark initialized, report
98
+
99
+ Adjust this plan, reorder, skip steps, or add things?"
100
+ ```
101
+
102
+ Adapt the plan to what was actually found. Only include relevant steps. Wait for user confirmation.
103
+
104
+ ### Step 5: Install template components from payload
105
+
106
+ Read `.workspace-update/.manifest.json` to confirm this is an `"action": "init"` payload. **Capture the `templateVersion` now** — you'll need it for Step 18 after the payload is deleted.
107
+
108
+ Install components from `.workspace-update/.claude/` to `.claude/`. For each component directory — skills, hooks, agents, rules, scripts:
109
+
110
+ 1. List files in `.workspace-update/.claude/{component}/`
111
+ 2. For each file:
112
+ - If the file does not exist locally: "Install {file}? [Y/n]"
113
+ - If the file exists locally and differs: "Template has {file} but you have a local version. Show diff? [y/N]" — let the user decide
114
+ - If the file exists locally and matches: skip silently
115
+
116
+ Also install these top-level files from the payload:
117
+ - **`.claude/settings.json`** — Merge payload settings into existing file. Preserve user-added settings, add missing entries.
118
+ - **`.gitignore`** — Merge: add lines from payload not already present.
119
+ - **`CLAUDE.md`** — Generate from `.workspace-update/CLAUDE.md.tmpl`, substituting `{{project-name}}` with the workspace name. If the existing CLAUDE.md has user-added content beyond the bootstrap template, preserve it.
120
+
121
+ **Commit:** `git commit -m "feat: install template components from payload"`
122
+
123
+ ### Step 6: Activate optional rules
124
+
125
+ List all `.md.skip` files in `.claude/rules/`:
126
+ - For each: ask "Activate {rule-name}? {brief description} [y/N]"
127
+ - If yes: rename `{name}.md.skip` to `{name}.md`
128
+ - If no: leave as-is
129
+
130
+ **Commit (if any activated):** `git commit -m "feat: activate selected optional rules"`
131
+
132
+ ### Step 7: Extract content from documentation sources
133
+
134
+ For each documentation source identified in Step 3:
135
+
136
+ **Before fetching from any source, check if content was already extracted:**
137
+ - Scan `shared-context/` and `.claude/rules/` for files that reference the source (e.g., files mentioning Notion page IDs, Confluence URLs, etc.)
138
+ - If found: "Content from {source} appears to already be in {files}. Skip re-fetching? [Y/n]"
139
+ - If the user confirms skip: move on to the next source
140
+ - If the user wants a refresh: proceed with extraction but note which files will be updated
141
+
142
+ For sources that need extraction:
143
+ - Check .claude/recipes/ for relevant migration recipes
144
+ - Attempt to access the source (MCP tools, file reads, etc.)
145
+ - **Track access failures** — if a source is unreachable, note it but don't stop
146
+ - For rules/conventions found: write to `.claude/rules/{rule-name}.md`
147
+ - For project context/decisions: stage for Step 10 (locked knowledge)
148
+ - For handoffs/active work: write to `shared-context/{user}/` as ephemeral
149
+
150
+ **Commit:** `git commit -m "feat: extract rules and context from documentation sources"`
151
+
152
+ ### Step 8: Scan Claude chat history
153
+
154
+ Search for prior Claude Code conversation logs related to this project. Chat history lives in `~/.claude/projects/` organized by project path.
155
+
156
+ **Discovery:**
157
+ 1. Identify the project path(s) that map to this workspace — check the current directory path and any known previous paths (from CLAUDE.md.bak or workspace config)
158
+ 2. List available conversation logs:
159
+ ```bash
160
+ ls -la ~/.claude/projects/{project-path}/
161
+ ```
162
+ 3. Read conversation metadata to identify relevant sessions
163
+
164
+ **Build a processing manifest** before reading any content. Auto-compaction could happen at any point during this step, so the manifest ensures progress survives:
165
+
166
+ Write `workspace-scratchpad/chat-history-manifest.json`:
167
+ ```json
168
+ {
169
+ "projectPaths": ["{path1}", "{path2}"],
170
+ "sessions": [
171
+ { "id": "{session-id}", "path": "{file-path}", "status": "pending" },
172
+ ...
173
+ ],
174
+ "synthesized": []
175
+ }
176
+ ```
177
+
178
+ **Process each session:**
179
+ 1. Read the session log
180
+ 2. Extract: key decisions made, architectural choices, patterns established, unresolved questions, work in progress at the time
181
+ 3. Update the manifest entry status to "processed"
182
+ 4. Synthesize findings into shared context:
183
+ - Decisions and architecture → stage for locked context (Step 10)
184
+ - Work-in-progress context → `shared-context/{user}/` as ephemeral handoffs
185
+ - Patterns and conventions → candidate rules for `.claude/rules/`
186
+
187
+ Present a summary: "Found {N} prior sessions. Extracted {M} decisions, {K} handoffs, {P} convention candidates."
188
+
189
+ Let the user review and approve what gets kept.
190
+
191
+ **Commit:** `git commit -m "feat: synthesize context from Claude chat history"`
192
+
193
+ Remove the manifest after processing:
194
+ ```bash
195
+ rm -f workspace-scratchpad/chat-history-manifest.json
196
+ ```
197
+
198
+ ### Step 9: Preserve local preferences
199
+
200
+ Read CLAUDE.md.bak for non-documentation content worth keeping:
201
+ - Local coding conventions → `.claude/rules/` (new rule files)
202
+ - Project-specific notes → `shared-context/locked/` or `shared-context/{user}/`
203
+ - Repo paths → verify they match workspace.json
204
+
205
+ **Commit:** `git commit -m "feat: preserve local preferences as rules and context"`
206
+
207
+ ### Step 10: Create locked team knowledge
208
+
209
+ Combine content from Steps 7, 8, 9, and existing auto-memory into locked context:
210
+ - For each piece of stable knowledge: write to `shared-context/locked/{topic}.md`
211
+ - Keep locked context lean — target <10KB total
212
+ - One topic per file, proper frontmatter
213
+ - Only lock what the team needs every session. Everything else is ephemeral.
214
+
215
+ **Commit:** `git commit -m "feat: create locked team knowledge"`
216
+
217
+ ### Step 11: Formalize existing worktrees as work sessions
218
+
219
+ Check for existing git worktrees that represent in-progress work:
220
+
221
+ ```bash
222
+ # For each repo in workspace.json:
223
+ git -C repos/{repo} worktree list
224
+ ```
225
+
226
+ Also check for any existing `work-sessions/*/` folders:
227
+ ```bash
228
+ ls work-sessions/ 2>/dev/null
229
+ ```
230
+
231
+ For each active worktree or session folder found:
232
+ 1. Determine the session name from the branch name or directory name
233
+ 2. Ask: "Found worktree for branch `{branch}` at `{path}`. Formalize as work session '{suggested-name}'? [Y/n]"
234
+ 3. If confirmed, invoke `node .claude/scripts/create-work-session.mjs --session-name {name} --branch {branch} --repo {repo} --user {user}` to set up the standard layout. For existing worktrees that are already on the right branch, the script will refuse — in that case, move the worktree manually under `work-sessions/{name}/workspace/repos/{repo}/` using `git -C repos/{repo} worktree move`, then write the `work-sessions/{name}/workspace/session.md` tracker by hand with the helper (from inside the worktree so the initial commit lands on the session branch).
235
+ 4. **Search Claude chat history for sessions that touched this branch** — scan conversation logs for commits or file edits on this branch, and synthesize what was being worked on into the session.md body
236
+ 5. Ask the user to describe the current state and next steps, add to the tracker body
237
+
238
+ 6. If declined: leave the worktree as-is, report it in the final summary
239
+
240
+ **Commit:** `git commit -m "feat: formalize existing worktrees as work sessions"`
241
+
242
+ ### Step 12: Set up issue tracker
243
+
244
+ Ask: "Want to link this workspace to an issue tracker? This enables atomic assignment for `/start-work` and real-time status across the team. (GitHub Issues recommended if your workspace repo is on GitHub.)"
245
+
246
+ - **Yes:** invoke `/setup-tracker` — it handles the full flow (pick backend, configure `workspace.json`, initialize labels, create milestones).
247
+ - **No:** skip. Tracking stays disabled; `/start-work` falls back to describe-the-work mode.
248
+
249
+ The user can run `/setup-tracker` anytime later. This step replaces the old "Populate open-work.md" step — there is no longer a local tracker file. Work items live in the configured tracker from day one.
250
+
251
+ If you discovered candidate work items during earlier steps (bugs in braindumps, TODOs in chat history, in-progress worktrees from Step 11), surface them now as a list:
252
+
253
+ "Found {N} candidate work items during init. Once a tracker is configured, create issues for them via `/start-work` → 'Something new'? The list:
254
+ - ..."
255
+
256
+ Do NOT batch-create issues automatically — the user should review and prune the list.
257
+
258
+ ### Step 13: Configure user identity
259
+
260
+ Ask: "What name should be used for your user-scoped context? [{system-username}]"
261
+ Save to `.claude/settings.local.json`:
262
+ ```json
263
+ {
264
+ "workspace": {
265
+ "user": "{name}"
266
+ }
267
+ }
268
+ ```
269
+
270
+ ### Step 14: Clean root directory
271
+
272
+ The workspace root should contain ONLY template structure: CLAUDE.md, workspace.json, .gitignore, and the standard directories (`.claude/`, `shared-context/`). The `repos/`, `work-sessions/`, and `workspace-scratchpad/` directories are lazy-created the first time something writes to them — they won't exist yet unless a repo has already been cloned.
273
+
274
+ Move everything else to `workspace-scratchpad/unmigrated/`:
275
+
276
+ ```bash
277
+ mkdir -p workspace-scratchpad/unmigrated
278
+ ```
279
+
280
+ For each non-template item at root:
281
+ - Move to `workspace-scratchpad/unmigrated/{name}`
282
+ - This includes old directories, stray files, MCP data directories, IDE configs
283
+
284
+ Report: "Moved {N} items to workspace-scratchpad/unmigrated/: {list}."
285
+
286
+ **Commit:** `git commit -m "chore: clean root — move non-template items to unmigrated"`
287
+
288
+ ### Step 15: Clean up payload and pre-migration artifacts
289
+
290
+ - **Delete `.workspace-update/` directory entirely**
291
+ - **Remove any `@.workspace-update/` lines from CLAUDE.md**
292
+ - .mcp.json → back up and move to unmigrated
293
+ - CLAUDE.md.bak → remove (content extracted)
294
+ - Any other pre-migration artifacts → clean up or move to unmigrated
295
+
296
+ **Commit:** `git commit -m "chore: clean up payload and pre-migration artifacts"`
297
+
298
+ ### Step 16: Verify — self-contradiction check
299
+
300
+ Read EVERY created and activated file:
301
+ - Every `.claude/rules/*.md` (not .skip)
302
+ - Every `shared-context/locked/*.md`
303
+ - Every `shared-context/{user}/*.md`
304
+
305
+ Check for:
306
+ - References to removed services or files
307
+ - References to `.workspace-update/` (should be gone)
308
+ - Contradictions between rules
309
+ - Stale template preamble text
310
+ - References to external sources as if still authoritative after migration
311
+
312
+ Fix ALL issues found. This step must not be rushed.
313
+
314
+ **Commit:** `git commit -m "fix: resolve self-contradictions from init"`
315
+
316
+ ### Step 17: Set up workspace remote
317
+
318
+ Check if the workspace git repo already has a remote:
319
+ ```bash
320
+ git remote -v
321
+ ```
322
+
323
+ **If a remote already exists:** Report "Remote already configured: {url}" and skip to the next step.
324
+
325
+ **If no remote but a team workspace repo already exists** (e.g., a teammate already initialized and pushed):
326
+ - Ask: "Does a workspace repo already exist that you want to connect to? Provide the URL, or say 'create new'."
327
+ - If URL provided:
328
+ ```bash
329
+ git remote add origin {url}
330
+ git fetch origin
331
+ ```
332
+ Then rebase the init branch onto the remote's main:
333
+ ```bash
334
+ git rebase origin/main
335
+ ```
336
+ If conflicts arise (e.g., shared-context differs between your init and what's already committed), STOP and present them. These are legitimate merge decisions — your extracted content vs what your teammate committed. Help the user resolve each conflict:
337
+ - For shared-context files: the remote version likely has the teammate's extractions. Merge both perspectives or keep the more complete version.
338
+ - For rules: if both sides activated different optional rules, keep both.
339
+ - For CLAUDE.md: use the remote version (it's the established one), add any local customizations the user wants.
340
+
341
+ **If no remote and creating new:**
342
+ - Detect the org from project repo remotes in workspace.json
343
+ - Ask: "Create workspace repo as `{org}/workspace-{project}`? Or provide a different name/URL."
344
+ - Create via `gh repo create {org}/{name} --private` and add as remote
345
+ - Do NOT push yet — user merges the branch first
346
+
347
+ ### Step 18: Mark initialized and report
348
+
349
+ Update workspace.json:
350
+ - Set `initialized: true`
351
+ - Set `templateVersion` to the version captured from `.manifest.json` in Step 5
352
+
353
+ **Commit:** `git commit -m "chore: mark workspace as initialized"`
354
+
355
+ **Final report:**
356
+
357
+ ```
358
+ "Workspace initialized. Restart Claude Code for all rules and hooks to take effect. Then run /start-work to begin.
359
+
360
+ Branch: chore/workspace-init
361
+
362
+ Summary:
363
+ - {N} repos cloned
364
+ - {R} rules created/activated
365
+ - {P} template components installed
366
+ - {M} locked context files ({size}KB / 10KB target)
367
+ - {K} user context files
368
+ - {H} prior chat sessions scanned, {D} decisions extracted
369
+ - {W} existing worktrees formalized as work sessions
370
+ - {L} items moved to workspace-scratchpad/unmigrated/
371
+ - {V} self-contradictions found and fixed
372
+ - Template version: {version}
373
+ - Remote: {status}
374
+
375
+ Issues encountered:
376
+ - {list every expected behavior that failed}
377
+
378
+ If no issues: "No issues encountered."
379
+
380
+ Active work sessions (formalized from existing worktrees):
381
+ - {list each with branch, repo, and description}
382
+
383
+ Items in workspace-scratchpad/unmigrated/:
384
+ - {list each item with a one-line description}
385
+
386
+ Review the branch:
387
+ git log --oneline chore/workspace-init
388
+ git diff main..chore/workspace-init
389
+
390
+ Then merge:
391
+ git checkout main
392
+ git merge --squash chore/workspace-init
393
+ git commit -m 'chore: workspace initialization'
394
+ git push origin main
395
+
396
+ This session is done. Start a fresh Claude Code session and run /start-work to begin."
397
+ ```
398
+
399
+ ## Execution Rules
400
+
401
+ - Present the plan upfront. Don't ask permission at every micro-step.
402
+ - Execute confidently. Report after each major step completes.
403
+ - Commit after each major step — granular history on the branch.
404
+ - Ask the user only for decisions that require judgment.
405
+ - **Capture the `templateVersion` from `.manifest.json` early** (Step 5) before the payload is deleted in Step 15.
406
+ - **Root directory cleanliness is non-negotiable.** Non-template items go to unmigrated.
407
+ - **Every expected behavior that fails must be reported.**
408
+ - **Don't suggest starting work at the end.** Tell the user to restart Claude Code and run /start-work in a fresh session.
409
+ - The verification step (Step 16) is mandatory — read every file, check thoroughly.
410
+ - **Build manifests before long operations.** Chat history scanning (Step 8) and worktree formalization (Step 11) can be interrupted by auto-compaction. Write a manifest to `workspace-scratchpad/` before starting so progress survives.
411
+ - **Never re-fetch content that already exists.** Always check shared-context and rules for existing extractions before accessing external sources.
412
+ - This skill is idempotent — safe to run if interrupted and restarted.
413
+
414
+ ## Notes
415
+ - One topic per file, proper frontmatter, coherent content
416
+ - Keep locked context under 10KB
417
+ - The branch allows the user to review, adjust, or redo individual steps before merging
418
+ - Documentation sources are first-class — always ask, always confirm access, always report failures
419
+ - Chat history scanning uses a manifest to survive auto-compaction
420
+ - Existing worktrees are formalized with session markers, trackers, and linked chat history
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: workspace-update
3
+ description: Apply a staged template update to an initialized workspace. The CLI stages a payload in .workspace-update/; this skill processes it. Runs maintenance audit before and after.
4
+ ---
5
+
6
+ # Workspace Update
7
+
8
+ Apply a staged template update to an initialized workspace. The CLI (`npx @ulysses-ai/create-workspace --upgrade`) stages the payload in `.workspace-update/`. This skill reads and applies it. Runs a maintenance audit before updating and verifies integrity after.
9
+
10
+ ## Prerequisites
11
+
12
+ - `workspace.json` must have `initialized: true`
13
+ - If not initialized, report: "Workspace not initialized. Run /workspace-init first."
14
+ - `.workspace-update/` payload directory must exist (staged by `npx @ulysses-ai/create-workspace --upgrade`)
15
+ - If no `.workspace-update/` payload exists, report: "No update payload found. Run `npx @ulysses-ai/create-workspace --upgrade` to stage the template."
16
+ - Read `.workspace-update/.manifest.json` for `fromVersion`, `toVersion`, and `action`
17
+ - If `action` is `"init"`, report: "This payload is for initial setup. Run /workspace-init instead."
18
+
19
+ ## Flow
20
+
21
+ ### Step 1: Pre-update health check
22
+
23
+ Run `/maintenance audit` (read-only) to surface existing issues. Report findings briefly but **always continue to Step 2 immediately** — do not stop to ask about audit results. The audit is informational, not a gate. Any issues found will be included in the post-update report (Step 5) alongside the update results.
24
+
25
+ ### Step 2: Compare current vs payload
26
+
27
+ For each component directory in `.workspace-update/.claude/` (skills, hooks, agents, rules, recipes), compare files against the corresponding `.claude/{component}/` directory locally:
28
+
29
+ - **New files:** present in `.workspace-update/.claude/{component}/` but not in `.claude/{component}/`
30
+ - **Updated files:** present in both but contents differ
31
+ - **Unchanged files:** present in both with identical contents
32
+ - **Removed files:** present in `.claude/{component}/` locally but not in `.workspace-update/.claude/{component}/`
33
+
34
+ Report with version info from the manifest:
35
+ ```
36
+ "Template update: v{fromVersion} → v{toVersion}. {N} new files, {M} updated files, {R} removed files, {K} unchanged."
37
+ ```
38
+
39
+ If everything is unchanged and there are no new or removed files, report: "Workspace is up to date (template v{toVersion}). No changes needed."
40
+
41
+ ### Step 2b: Historical .gitignore safety check
42
+
43
+ Workspaces created before v0.5.1 are vulnerable to a destructive symlink bug in the old layout. The v0.8.0 layout removes the symlink entirely, so new workspaces are not vulnerable — but a workspace being upgraded from a pre-v0.8.0 version may still have the bad `.gitignore` pattern left over.
44
+
45
+ Check the workspace `.gitignore` for the `repos/` trailing-slash pattern:
46
+ ```bash
47
+ grep -E '^repos/$' .gitignore
48
+ ```
49
+
50
+ If found, rewrite it in place to `repos` (no trailing slash). Also check for any tracked `repos` symlink that was already committed:
51
+ ```bash
52
+ git ls-files | grep -E '^repos$'
53
+ ```
54
+ If found, untrack it: `git rm --cached repos`.
55
+
56
+ Commit the fix **before** applying other template updates. This runs ahead of Step 3 because applying other updates while the bug is still present could itself trigger the destruction on workspaces that still have the old layout.
57
+
58
+ ### Step 3: Selective update
59
+
60
+ For each change, ask before applying:
61
+
62
+ - **New file:** "Add {file}? [Y/n]"
63
+ - **Updated file (no local mods):** "Update {file} to latest template? [Y/n]"
64
+ - **Updated file (locally modified):** "Template updated {file} but you have local changes. Show diff? [y/N]" — let user decide
65
+ - **Removed in template:** "Template removed {file}. Delete locally? [y/N]" — conservative default
66
+ - **Hook migration (.sh to .mjs):** Detect old `.sh` hooks in `.claude/hooks/` that have `.mjs` replacements in the payload. Offer: "Hook {name}.sh has a .mjs replacement in the update. Replace and update settings.json commands? [Y/n]" — this is a one-time migration for workspaces upgrading from pre-0.2.0
67
+
68
+ Also handle these non-component files from the payload:
69
+
70
+ - **settings.json:** Merge payload values into existing `.claude/settings.json` — do not overwrite user customizations. Add new keys, update hook commands if hooks were migrated, preserve user-added entries.
71
+ - **CLAUDE.md:** If `.workspace-update/CLAUDE.md.tmpl` exists, regenerate `CLAUDE.md` from the template. Preserve any user-added sections not present in the template.
72
+ - **.gitignore:** Merge new entries from the payload into the existing `.gitignore` — do not remove user-added lines.
73
+
74
+ ### Step 4: Update version
75
+
76
+ Read `toVersion` from `.workspace-update/.manifest.json` and update `templateVersion` in `workspace.json` to match.
77
+
78
+ ### Step 5: Post-update verification
79
+
80
+ Run `/maintenance audit` again to verify the update didn't introduce:
81
+ - Broken references (new skills not in CLAUDE.md, removed rules still referenced)
82
+ - Contradictions between updated rules and existing shared context
83
+ - Structural mismatches
84
+
85
+ Report: "Post-update verification: {N} issues found" or "Post-update verification clean."
86
+
87
+ ### Step 6: Cleanup
88
+
89
+ Delete the `.workspace-update/` directory entirely. The payload has been fully processed and is no longer needed.
90
+
91
+ ### Step 7: Commit
92
+
93
+ ```bash
94
+ git add -A
95
+ git commit -m "chore: update workspace from template v{fromVersion} to v{toVersion}"
96
+ ```
97
+
98
+ Report: "Workspace updated to v{toVersion}. Restart Claude Code if rules or hooks changed."
99
+
100
+ ## Notes
101
+
102
+ - The CLI (`npx @ulysses-ai/create-workspace --upgrade`) stages the payload. This skill processes it.
103
+ - Never overwrites without asking
104
+ - Preserves local modifications and custom content
105
+ - Can be run multiple times safely (idempotent) — if `.workspace-update/` doesn't exist, it reports no payload and exits
106
+ - Initial setup is handled by `npx @ulysses-ai/create-workspace --init` + `/workspace-init` — this skill is for subsequent updates only
107
+ - The `.sh` to `.mjs` hook migration is a one-time transition for workspaces created before hooks moved to JavaScript
108
+ - The maintenance audits are read-only and non-blocking — they surface issues but don't prevent the update
@@ -0,0 +1,12 @@
1
+ {
2
+ "mcpServers": {
3
+ "playwright": {
4
+ "command": "npx",
5
+ "args": [
6
+ "@playwright/mcp@latest",
7
+ "--output-dir",
8
+ "workspace-scratchpad/playwright"
9
+ ]
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,32 @@
1
+ ## Workspace: {{project-name}}
2
+
3
+ This is a claude-workspace. All conventions are defined in .claude/rules/.
4
+
5
+ ## Quick Reference
6
+ - This root is the launcher — all work happens in workspace worktrees at `work-sessions/{name}/workspace/`
7
+ - `/start-work` to create or resume a work session
8
+ - Each session is a self-contained folder at `work-sessions/{name}/` containing the worktree, nested project worktrees, and the session tracker
9
+ - From root: only `local-only-*` and `workspace-scratchpad/` are writable
10
+ - Shared memory lives in `shared-context/`
11
+
12
+ ## Workspace Config
13
+ @workspace.json
14
+
15
+ ## Team Knowledge (always loaded)
16
+ @shared-context/locked/
17
+
18
+ ## Skills
19
+ - `/workspace-init` — first-time workspace setup (clone repos, install template, activate rules)
20
+ - `/start-work [handoff|blank]` — begin a work session
21
+ - `/handoff [name]` — save workstream state
22
+ - `/braindump [name]` — capture discussion/reasoning
23
+ - `/aside [--quick] <thought>` — capture a drive-by idea without interrupting current work
24
+ - `/pause-work` — suspend work, push, draft PR
25
+ - `/complete-work` — finalize branch, release notes, real PR
26
+ - `/promote` — move personal memory to shared context
27
+ - `/release [version]` — combine unreleased notes into versioned doc
28
+ - `/sync-work` — push branches without ceremony
29
+ - `/workspace-update` — apply template updates (runs maintenance before/after)
30
+ - `/setup-tracker` — wire this workspace to an issue tracker (GitHub Issues shipped; others pluggable)
31
+ - `/maintenance [audit|cleanup]` — workspace health checks and cleanup
32
+ - `/build-docs-site` — build a comprehensive Docusaurus documentation site for a project
@@ -0,0 +1,28 @@
1
+ # Source clones — cloned separately per user and not part of the workspace repo
2
+ # NOTE: no trailing slash. The same pattern covers both this top-level repos/
3
+ # and the real repos/ directory nested inside each work-session's workspace
4
+ # worktree, where project worktrees live as siblings.
5
+ repos
6
+
7
+ # Work sessions — the folder is local-only at the workspace root.
8
+ # Session content (tracker, specs, plans) lives inside each session's
9
+ # workspace worktree at the top of the session branch, not on main.
10
+ work-sessions/
11
+
12
+ # Disposable workspace-scoped scratchpad (session log, hook debug output)
13
+ workspace-scratchpad/
14
+
15
+ # Personal overrides
16
+ .claude/settings.local.json
17
+ .claude/.active-session.json
18
+
19
+ # Local-only convention (rules, context)
20
+ .claude/rules/local-only-*
21
+ shared-context/**/local-only-*
22
+
23
+ # IDE
24
+ .idea/
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
@@ -0,0 +1,15 @@
1
+ {
2
+ "workspace": {
3
+ "name": "{{project-name}}",
4
+ "templateVersion": "0.0.0",
5
+ "scratchpadDir": "workspace-scratchpad",
6
+ "workSessionsDir": "work-sessions",
7
+ "sharedContextDir": "shared-context",
8
+ "releaseNotesDir": "release-notes",
9
+ "subagentContextMaxBytes": 10240,
10
+ "greeting": "Welcome back to {{project-name}}.",
11
+ "releaseMode": "per-repo",
12
+ "tracker": null
13
+ },
14
+ "repos": {}
15
+ }