@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
@@ -1,56 +1,56 @@
1
1
  # Honest Pushback
2
2
 
3
- Do not agree with the user just to be agreeable. Do not keep trying things that aren't working. Do not assume when you can verify. Challenge assumptions, flag concerns, and push back when something seems wrong, costly, or misguided — even if the user is enthusiastic about it.
3
+ Do not agree to be agreeable. Do not keep trying things that aren't working. Do not assume
4
+ when you can verify. Challenge assumptions and flag concerns even when the user is
5
+ enthusiastic.
4
6
 
5
- ## What This Means
7
+ ## What this means
6
8
 
7
- - If an approach has obvious downsides, say so before implementing
8
- - If a design decision contradicts an earlier one, flag the contradiction
9
+ - If an approach has obvious downsides, say so before implementing.
10
+ - If a decision contradicts an earlier one, name the contradiction.
9
11
  - If scope is creeping, name it: "This started as X but is becoming Y. Split?"
10
- - If you don't know something, say so — don't fabricate confidence
11
- - If the user's idea is good, a simple "that works" is enough — don't embellish with praise
12
- - If you made a mistake, own it plainly — don't bury it in hedging language
12
+ - If you don't know, say so — don't fabricate confidence.
13
+ - If the idea is good, "that works" is enough. No embellishment.
14
+ - If you made a mistake, own it plainly. No hedging.
13
15
 
14
- ## No Retry Loops
16
+ ## No retry loops
15
17
 
16
- When a fix attempt fails, do not immediately try a variation of the same approach. If you have tried a solution and it produced the same error or unexpected result twice, stop and:
18
+ If a fix produced the same error or an unexpected result twice, stop. Do not try a variation
19
+ of the same approach. Instead:
17
20
 
18
- 1. **State what you expected vs what happened.** Be specific — not "it didn't work" but "expected 200, got 403 with message X."
19
- 2. **Identify what you don't understand.** What assumption is failing? Why is the result surprising?
20
- 3. **Research the specific issue.** Read documentation, search for the error message, check source code. Use web search if local sources don't explain it.
21
- 4. **Present your findings.** Tell the user what you learned and what you now think the actual cause is. Propose a solution based on understanding, not guessing.
21
+ 1. **State expected vs actual**, specifically — not "it didn't work" but "expected 200, got
22
+ 403 with message X".
23
+ 2. **Name the failing assumption.** What is surprising, and why?
24
+ 3. **Research it.** Read the docs, search the error, read the source. Use web search if local
25
+ sources don't explain it.
26
+ 4. **Report what you learned** and propose a fix based on understanding, not guessing.
22
27
 
23
- This prevents cycling through variations of the same broken approach, wasting tokens on trial-and-error when reading the docs would take one turn, and the user having to say "stop and actually research this."
28
+ This stops the cycle of trying broken variations when reading the docs would take one turn.
24
29
 
25
- ## Verify, Don't Assume
30
+ ## Verify, don't assume
26
31
 
27
- When evidence is available to confirm or deny an assumption, check it before proceeding. Do not guess at system state, data values, error causes, or behavior when you can verify directly.
32
+ When evidence is available, check it before proceeding. Logs, the database, the actual UI,
33
+ runtime state, a real API call — whichever settles the question. If the logs aren't verbose
34
+ enough, add instrumentation, run it, read the output, remove it.
28
35
 
29
- Sources to check before assuming:
30
- - **Logs** — application logs, server logs, build output. If they aren't verbose enough, add instrumentation or debug logging temporarily, run the operation, read the output, then remove the logging.
31
- - **Database** — query the actual data instead of assuming what's there.
32
- - **UI/browser** — test the actual behavior instead of predicting what the user will see. Use browser tools, take screenshots, inspect network requests.
33
- - **Runtime state** — add a console.log, print statement, or debugger breakpoint. Run it. Read the output.
34
- - **API responses** — make the actual call instead of assuming the response shape.
36
+ The tell is reaching for "I think the issue is…", "probably", or "likely" about something
37
+ you could check in one step. Reasoning about what a function returns when you could call it
38
+ is the same mistake.
35
39
 
36
- **Before checking, ask the user:** "I want to verify {what} by {how}. Should I go ahead, or do you want me to just check without asking each time?"
40
+ **Ask once**, then stop asking: "I want to verify {what} by {how}. Go ahead, or should I
41
+ just check without asking each time?" If the user says just check, verify proactively for
42
+ the rest of the session. Asking once is polite; asking every time is friction.
37
43
 
38
- If the user says to just check: remember this preference and verify proactively for the rest of the session without asking. The goal is productivity — asking once is polite, asking every time is friction.
44
+ Use judgment — don't over-verify the trivial.
39
45
 
40
- **When this applies:**
41
- - You're about to say "I think the issue is..." when you could check
42
- - You're reasoning about what a function returns when you could call it
43
- - You're guessing at database state when you could query it
44
- - You're predicting UI behavior when you could test it
45
- - You catch yourself writing "probably" or "likely" about something verifiable
46
+ ## What this does not mean
46
47
 
47
- ## What This Does NOT Mean
48
-
49
- - Don't be contrarian for the sake of it — push back when there's substance, not as a personality trait
50
- - Don't refuse to execute — voice the concern, then follow the user's decision
51
- - Don't lecture — state the issue once, clearly, and move on
52
- - Don't over-verify trivial things — use judgment about what's worth checking
48
+ Don't be contrarian as a personality trait; push back where there is substance. Don't refuse
49
+ to execute — voice the concern, then follow the user's decision. Don't lecture: state it
50
+ once and move on.
53
51
 
54
52
  ## Why
55
53
 
56
- Sycophantic AI wastes time, erodes trust, and lets bad decisions through unchallenged. Retry loops burn tokens and frustrate everyone. Assumptions that could be verified in one step lead to cascading wrong decisions. A useful collaborator tells you when something is off, stops when something isn't working, checks when it can check, and figures out why before trying again.
54
+ Sycophancy wastes time and lets bad decisions through. Retry loops burn tokens. Assumptions
55
+ that could have been checked cascade into wrong decisions. A useful collaborator says when
56
+ something is off, stops when it isn't working, and finds out why before trying again.
@@ -1,109 +1,62 @@
1
- # Memory Guidance
1
+ # Memory and Placement Guidance
2
2
 
3
- Guide Claude's auto-memory system for this workspace.
3
+ Where durable content goes, and what each destination costs.
4
4
 
5
- ## What to Auto-Remember
5
+ ## Where durable content goes
6
6
 
7
- When working in this workspace, pay attention to and save memories about:
8
- - Architecture decisions and their rationale
9
- - Patterns that caused bugs or confusion
10
- - User corrections about project conventions
11
- - External system URLs, credentials locations, API quirks
12
- - Workarounds for tooling issues
7
+ Eight destinations, ordered cheapest first. Work down and stop at the first that genuinely
8
+ fits. The right column is what every session pays, forever, for the choice.
13
9
 
14
- ## What NOT to Auto-Remember
10
+ | destination | for | always-loaded cost |
11
+ |---|---|---|
12
+ | nowhere | already covered, or true only today | zero |
13
+ | `.claude/rules/*.md` with `paths:` | an instruction that applies only to certain files | zero until a match is read |
14
+ | a skill | a procedure with steps, invoked on demand | its `description` line |
15
+ | auto-memory | machine-local preference or correction; not shared, not reviewable | one `MEMORY.md` line |
16
+ | `team-member/{user}/` | one person's working context | one index line, that user |
17
+ | `shared/` | team-visible reference, looked up when relevant | one index line |
18
+ | `shared/locked/` | canonical team truth | **the whole file, every session** |
19
+ | `.claude/rules/*.md` (no `paths:`) | an instruction that must hold in every session | **the whole file, every session** |
15
20
 
16
- - Temporary debugging state
17
- - File contents (re-read them instead)
18
- - Anything already captured in a workspace-context file
19
- - Anything documented in .claude/rules/
21
+ **`nowhere` is the most common correct answer.** A second copy in a second location is
22
+ worse than none — they drift, and the reader cannot tell which is current.
20
23
 
21
- ## Session-Scoped vs Cross-Session
24
+ The two bold rows tax every session in this workspace, and anything shipped in the template
25
+ taxes every downstream workspace too. Reach them only after the cheaper rows are actually
26
+ ruled out. Prefer `paths:` for anything domain-specific: a rule about migration scripts does
27
+ not need to be in context while editing documentation.
22
28
 
23
- When a work session is active:
24
- - Decisions and progress from this session → update the session tracker body at `work-sessions/{name}/workspace/session.md` (consumed by /complete-work)
25
- - Patterns, corrections, and insights that apply beyond this session → auto-memory (persists across all sessions)
26
- - Don't duplicate: if something is already in the session tracker, don't also save it to auto-memory
27
-
28
- ## Workspace-Context Frontmatter
29
-
30
- Every workspace-context file should have YAML frontmatter. The fields below are conventions, not all required.
31
-
32
- **Standard fields:**
33
-
34
- - `state` — `locked` (team truth) or `ephemeral` (working context). Locked files live under `shared/locked/`; ephemeral files live elsewhere under `shared/` or `team-member/{user}/`.
35
- - `lifecycle` — for ephemeral files: `active` (still relevant) or `resolved` (handled, kept for record).
36
- - `type` — kind of content: `reference`, `braindump`, `handoff`, `research`, `design`, `index`, `canonical`, `promoted`.
37
- - `priority` — for locked files only: `critical` (always loaded into canonical) or `reference` (eligible for trim/stub under canonical budget pressure). Default when absent is `critical`. See `build-workspace-context.mjs` for selection semantics.
38
- - `topic` — kebab-case slug matching the filename (after the type prefix, when one is present).
39
- - `author` — username scope owner. Required for `team-member/{user}/` files.
40
- - `updated` — ISO date of last meaningful edit. `/maintenance` flags stale `lifecycle: active` files based on this.
41
-
42
- **Index-feeding field:**
43
-
44
- - `description` — one-line summary, used verbatim by `workspace-context/index.md` and per-user team-member indexes. When omitted, the index falls back to the first sentence of the body, then the filename slug (with the `braindump_`/`handoff_`/`research_` prefix stripped). Adding a `description:` to a file with a weak fallback is the cheapest way to improve the index.
45
-
46
- **Optional confidence marker:**
47
-
48
- - `confidence` — `high` | `medium` | `low`. Apply to research, design, and exploration files where the conclusions might still shift. Skip on locked files (locked = high by definition) and on workflow artifacts like handoffs and braindumps. The frontmatter integrity check in `/maintenance` validates the value if present.
49
-
50
- **Example for a research file:**
51
-
52
- ```yaml
53
- ---
54
- state: ephemeral
55
- lifecycle: active
56
- type: research
57
- topic: vector-search-evaluation
58
- description: Evaluation of FAISS for workspace-context — concluded NL index is sufficient at our scale.
59
- author: alex
60
- confidence: medium
61
- updated: 2026-04-25
62
- ---
63
- ```
64
-
65
- ## Workspace-Context Auto-Generated Files
66
-
67
- A single generator at `.claude/scripts/build-workspace-context.mjs` produces three artifacts in one pass:
68
-
69
- - `workspace-context/index.md` — navigation catalog of everything under `shared/` (locked files first, then the rest). Imported by the workspace-level `CLAUDE.md`.
70
- - `workspace-context/canonical.md` — verbatim concatenation of `shared/locked/*.md` so team truths are loaded into every session prompt. Also imported by `CLAUDE.md`.
71
- - `workspace-context/team-member/{user}/index.md` — per-user navigation catalog, one per team member. Imported by each user's gitignored `CLAUDE.local.md`.
72
-
73
- Gitignored files (e.g. anything matching `local-only-*`) are excluded automatically, and `workspace-context/.indexignore` adds path-prefix excludes for tracked files that shouldn't appear in the shared index (e.g. archived release notes).
74
-
75
- When `workspace-context/canonical.md` exceeds `workspace.canonicalBudgetBytes` (default 40960), the builder honors per-file `priority` and section-level `<!-- canonical:trim --> ... <!-- canonical:end-trim -->` markers to fit: `priority: reference` files are trimmed first, then stubbed, while `priority: critical` files are always included in full. `/maintenance` audits the budget and offers a triage flow when over.
29
+ **Before writing to either bold row, state the cost:**
76
30
 
77
31
  ```bash
78
- node .claude/scripts/build-workspace-context.mjs --check --root . # exits 1 if any artifact is stale or missing
79
- node .claude/scripts/build-workspace-context.mjs --write --root . # regenerate all three
32
+ node .claude/scripts/context-footprint.mjs --root . --add <bytes> --as <destination>
80
33
  ```
81
34
 
82
- `/maintenance` checks staleness in audit mode and regenerates in cleanup mode. Hand edits to `index.md`, `canonical.md`, or any `team-member/{user}/index.md` are overwritten — update source files (or their `description:` frontmatter) instead.
83
-
84
- ## What Belongs in Canonical
85
-
86
- Canonical content is loaded verbatim into every session prompt. It frames how Claude reads the rest of the conversation, so the bar for what goes in is narrower than the bar for `shared/` (root) or `team-member/{user}/`. The principle: canonical should describe what *is* and what *to do*, not what *to think*.
35
+ ## The canonical test
87
36
 
88
- **Belongs in canonical (`shared/locked/`):**
37
+ Canonical describes what *is* and what *to do*, never what *to think*.
89
38
 
90
- - **Facts about the system** — current architecture, supported targets, naming conventions, where things live, what's published.
91
- - **Hard constraints** — "must work on Windows and macOS," "PRs only, no direct push to main," "this directory is gitignored." Constraints scope the solution space without prejudging which solution to pick.
92
- - **Process rules** — workflow discipline that applies regardless of the task. Branch protection, release cadence, mandatory review gates.
93
- - **Settled-rejection guardrails** — "we evaluated approach X, rejected because Y, do not propose this again." Saves Claude from spending tokens re-proposing already-evaluated options. The guardrail must include the *why*, so future-Claude can recognize when an edge case actually warrants revisiting the rejection.
94
- - **Meta-principles for debiasing** — explicit reminders to widen evaluation, like the dogfood-bias risk doc. Anti-shading by design.
39
+ > If Claude read this for the first time during a session about an unrelated topic, would it
40
+ > (a) help frame the problem correctly, or (b) push it toward a particular answer to a
41
+ > question that hasn't been asked yet?
95
42
 
96
- **Does NOT belong in canonical:**
43
+ (a) is canonical. (b) is `shared/` at most, more often `team-member/{user}/`. Pre-loaded
44
+ conclusions don't read as opinions to Claude — they read as ground truth, and they frame
45
+ what Claude considers before the question is asked.
97
46
 
98
- - **Opinions on open technical questions** — "library X is better than Y for this kind of problem," "approach A is preferred over B." These shape Claude's reasoning starting point so it begins from the conclusion rather than reasoning toward it. If the team has a strong preference, write it as a constraint ("use X, not Y") with the reason — or keep it in `shared/` (root) where it is reference material but not always-loaded.
99
- - **Conclusions Claude might be asked to question** — "we believe the architecture is correct," "feature Z is the right shape." If a topic is the subject of ongoing design work, locking a conclusion biases the discussion before it starts.
100
- - **Personal preferences** — what one contributor finds elegant or annoying. Belongs in `team-member/{user}/`.
101
- - **Status snapshots that age fast** — sprint-current priorities, "we're working on X this week." `project-status.md` is the bounded exception for high-level project status; finer-grained "what's in flight" lives in the tracker.
47
+ ## Auto-memory specifically
102
48
 
103
- **The test before promoting to canonical:**
49
+ Save: architecture decisions and their rationale, patterns that caused bugs, user
50
+ corrections about project conventions, external URLs and API quirks, tooling workarounds.
104
51
 
105
- > If Claude read this for the first time during a session about an unrelated topic, would it (a) help frame the problem correctly, or (b) push Claude toward a particular answer to a question that hasn't been asked yet?
52
+ Don't save: temporary debugging state, file contents (re-read them), anything already in a
53
+ workspace-context file or a rule.
106
54
 
107
- (a) is canonical. (b) is `shared/` (root) at most, more often `team-member/{user}/`.
55
+ When work is in flight, its decisions and progress go in the lifecycle's own state — the
56
+ session tracker body at `work-sessions/{name}/workspace/session.md` (session model) or the
57
+ chat drawer at `workspace-scratchpad/chats/{chat}/` (task model) — which `/complete-work`
58
+ consumes. Auto-memory is for what outlives the work. Never both.
108
59
 
109
- The distinction matters because pre-loaded conclusions in always-loaded context don't read like opinions to Claude — they read like ground truth. A reference doc Claude *finds* during research is weighed against the question; a canonical doc loaded before the question is asked frames what Claude considers in the first place. `/release` and `/promote` should apply this test before locking content.
60
+ For the full routing procedure, the frontmatter schema, the generator invocations, and the
61
+ belongs/doesn't-belong lists behind the canonical test, invoke the `context-placement`
62
+ skill.
@@ -12,7 +12,7 @@ Activate this rule if the superpowers plugin is installed.
12
12
  ## Specs and Plans
13
13
 
14
14
  - Specs and plans live in the active worktree during development
15
- - They are ephemeral — consumed by /complete-work into release notes, then removed
15
+ - They are ephemeral — consumed by /complete-work into the PR body, then removed
16
16
  - If a spec/plan already exists for the current branch, version it: `-v2`, `-v3`, etc.
17
17
 
18
18
  ## Execution
@@ -1,90 +1,48 @@
1
1
  # Work Item Tracking
2
2
 
3
- When a workspace has an issue tracker configured, all work items — bugs, features, chores — live in that tracker. Skills and scripts read and write the tracker through the adapter at `.claude/scripts/trackers/{type}.mjs`. There is no local file that mirrors the tracker's state.
3
+ When a workspace has a tracker configured, **all work items — bugs, features, chores — live
4
+ in that tracker.** There is no local file mirroring its state. Skills reach it through
5
+ `createTracker()` from `.claude/scripts/trackers/interface.mjs`; that module is the source of
6
+ truth for the available methods, and the four skills that use it (`start-work`, `pause-work`,
7
+ `complete-work`, `setup-tracker`) each carry the exact calls they make.
4
8
 
5
9
  ## Why external-first
6
10
 
7
- - **Atomic assignment.** Two teammates can't accidentally start the same ticket — the tracker is the source of truth for "who has this."
8
- - **Real-time state.** Status changes propagate to the whole team the moment they happen, not after a commit + push.
9
- - **Tool parity.** Humans and Claude see the same list of tickets in the same place.
11
+ Two people can't start the same ticket — the tracker is the source of truth for who has what.
12
+ Status changes reach the whole team the moment they happen rather than after a push. And
13
+ humans and Claude read the same list in the same place.
10
14
 
11
15
  ## Configuration
12
16
 
13
- `workspace.json` → `workspace.tracker`:
14
-
15
- ```json
16
- {
17
- "workspace": {
18
- "tracker": {
19
- "type": "github-issues",
20
- "repo": "your-org/your-workspace"
21
- }
22
- }
23
- }
24
- ```
25
-
26
- - `type` — identifies the adapter module at `.claude/scripts/trackers/{type}.mjs`. Only `github-issues` ships in the template; others are additive.
27
- - `repo` — adapter-specific. For `github-issues`, the owner/name slug of the repo where issues live. `"auto"` resolves to the workspace's own git remote.
28
-
29
- Absence of `workspace.tracker` means tracking is disabled. Skills handle this by falling back to a blank/describe-the-work flow — they do not fabricate a local mirror.
30
-
31
- ## Adapter interface (for Claude)
32
-
33
- Import from `.claude/scripts/trackers/interface.mjs`:
34
-
35
- ```javascript
36
- import { createTracker, AlreadyAssignedError } from '.claude/scripts/trackers/interface.mjs';
37
-
38
- const tracker = createTracker(workspace.tracker);
39
-
40
- const mine = await tracker.listAssignedToMe(); // Issue[]
41
- const open = await tracker.listUnassigned(); // Issue[]
42
- const issue = await tracker.claim('gh:42'); // throws AlreadyAssignedError on contention
43
- const created = await tracker.createIssue({ title, body, labels: ['feat', 'P2'], milestone: 'Backlog' });
44
- await tracker.comment('gh:42', 'paused here; see branch X');
45
- await tracker.closeIssue('gh:42', { comment: 'shipped in PR #99' });
46
-
47
- // Setup-time: idempotent milestone / label creation
48
- await tracker.ensureLabels(); // creates bug/feat/chore/P1/P2/P3 if absent
49
- await tracker.ensureMilestone({ title: 'Backlog', description: 'Triage later' });
50
- ```
51
-
52
- All skills that touch work items use this interface. Adapters are not called directly.
17
+ `workspace.json` → `workspace.tracker`: `{ "type": "github-issues", "repo": "owner/name" }`.
18
+ `type` names the adapter at `.claude/scripts/trackers/{type}.mjs`; only `github-issues` ships.
19
+ `repo` is adapter-specific — for GitHub, the slug where issues live, or `"auto"` to resolve
20
+ from the git remote. No `workspace.tracker` means tracking is disabled, and skills fall back
21
+ to a blank describe-the-work flow rather than fabricating a local mirror.
53
22
 
54
23
  ## Session linkage
55
24
 
56
- When `/start-work` links a session to a tracker issue, the session tracker's frontmatter gets:
57
-
58
- ```yaml
59
- workItem: gh:42
60
- ```
61
-
62
- The value is the adapter-prefixed issue ID. This survives adapter swaps — replacing the GitHub adapter with a Linear adapter later doesn't require re-linking session trackers (though the prefix changes for *new* sessions).
25
+ `/start-work` records the adapter-prefixed issue ID in session frontmatter as `workItem: gh:42`.
26
+ The prefix makes it self-describing across adapter swaps.
63
27
 
64
28
  ## When to create issues
65
29
 
66
- - **User describes new work during `/start-work`** → skill calls `createIssue` after session creation.
67
- - **Bug or feature discovered mid-session** → Claude proactively asks "Create an issue for this? [Y/n]"; if yes, calls `createIssue` and links the session (if it's scoped to this session) or leaves it unassigned (if it's a future concern).
68
- - **Never during braindumps or handoffs** — those are discussion artifacts, not work items. Action items can later graduate to issues during `/start-work`.
69
-
70
- ## When NOT to maintain local state
71
-
72
- - Do not create, write to, or read `workspace-context/open-work.md`. That file is deprecated.
73
- - Do not write ticket state into `session.md` frontmatter beyond the `workItem:` pointer. Status, assignment, milestone, and labels live in the tracker.
74
- - Do not cache issue bodies locally. Always fetch via `tracker.getIssue(id)` when the content is needed.
75
-
76
- ## Skill behavior
30
+ - **Work described during `/start-work`** → create the issue, then claim it.
31
+ - **A bug or feature found mid-session** → ask "Create an issue for this? [Y/n]". Link it to
32
+ the session if it is in scope; leave it unassigned if it is a future concern.
33
+ - **Never during braindumps or handoffs.** Those are discussion artifacts. Action items can
34
+ graduate to issues later, at `/start-work`.
77
35
 
78
- Skills that interact with the tracker:
36
+ ## What not to do
79
37
 
80
- - **`/setup-tracker`** — configures `workspace.json` → `tracker` block, calls `ensureLabels()`.
81
- - **`/start-work`** — fetches assigned-to-me first; falls back to unassigned; claims atomically on pick. Records `workItem:` in session tracker.
82
- - **`/pause-work`** — comments the pause capture on the linked issue.
83
- - **`/complete-work`** — closes the linked issue after PRs merge, with a final comment linking them.
84
- - **`/workspace-init`** — prompts to run `/setup-tracker` at the end of init. Does not pre-populate tickets.
38
+ - Do not create, read, or write `workspace-context/open-work.md`. It is deprecated.
39
+ - Do not put ticket state in session frontmatter beyond the `workItem:` pointer. Status,
40
+ assignment, labels and milestone live in the tracker.
41
+ - Do not cache issue bodies locally. Fetch with `tracker.getIssue(id)` when you need one.
85
42
 
86
- ## What this rule does NOT do
43
+ ## Boundaries
87
44
 
88
- - Does not prescribe a specific tracker type. Adapter choice is per workspace.
89
- - Does not prescribe label or milestone schemas beyond the six standard labels (`bug`, `feat`, `chore`, `P1`, `P2`, `P3`) created by `ensureLabels()`. Teams with existing trackers can skip label creation during setup.
90
- - Does not replace tracker-native features (comments, reactions, linked PRs) — use the tracker's UI for those.
45
+ Adapter choice is per workspace; this rule prescribes no particular tracker. Beyond the six
46
+ labels `ensureLabels()` creates (`bug`, `feat`, `chore`, `P1`, `P2`, `P3`), it prescribes no
47
+ schema — teams with an existing tracker skip label creation. Tracker-native features like
48
+ comments, reactions and linked PRs stay in the tracker's own UI.
@@ -1,137 +1,79 @@
1
1
  # Workspace Structure
2
2
 
3
- This workspace follows the claude-workspace convention. All paths are relative to the workspace root.
3
+ All paths are relative to the workspace root. Two work lifecycles coexist, selected for new work by `workspace.sessionModel` in `workspace.json`: **task** (the forward path — one issue, one branch, one worktree per touched repo, chat at the root) and **session** (supported — a self-contained `work-sessions/{name}/` folder per effort with a workspace worktree and a `session.md` tracker).
4
4
 
5
5
  ## Directory Layout
6
6
 
7
- | Directory | Purpose | Tracked in git? |
8
- |-----------|---------|-----------------|
9
- | `repos/` | Source clones of project repositories (one per repo, stays on default branch) | No (gitignored, lazy) |
10
- | `work-sessions/` | Per-session folders — one folder per active or paused work session | No (gitignored entirely at the launcher) |
11
- | `work-sessions/{name}/workspace/` | Workspace worktree for this session, on the session branch | Yes — on the session branch, not on main |
12
- | `work-sessions/{name}/workspace/session.md` | Unified session tracker at the top of the session branch (frontmatter = machine state, body = human content) | Yes — on the session branch |
13
- | `work-sessions/{name}/workspace/design-*.md` | Specs for this session — consumed into release notes by /complete-work | Yes — on the session branch |
14
- | `work-sessions/{name}/workspace/plan-*.md` | Plans for this session — consumed into release notes by /complete-work | Yes — on the session branch |
15
- | `work-sessions/{name}/workspace/goal-*.md` | Goal artifacts for /goal-driven multi-phase work — consumed into release notes by /complete-work | Yes — on the session branch |
16
- | `work-sessions/{name}/workspace/research-*.md` | Phase-output research artifacts produced by goal-driven sessions — consumed into release notes by /complete-work | Yes — on the session branch |
17
- | `work-sessions/{name}/workspace/crossref-*.md` | Phase-output crossref artifacts produced by goal-driven sessions — consumed into release notes by /complete-work | Yes — on the session branch |
18
- | `work-sessions/{name}/workspace/repos/` | Real directory holding nested project worktrees for this session | No (gitignored) |
19
- | `work-sessions/{name}/workspace/repos/{repo}/` | Project worktree nested inside the workspace worktree | No (gitignored) |
20
- | `workspace-context/` | Team knowledge and per-user context | Yes |
21
- | `workspace-context/shared/` | Team-visible content — handoffs, braindumps, research, references | Yes |
22
- | `workspace-context/shared/locked/` | Canonical team truths — auto-concatenated into `canonical.md` and loaded into every session | Yes |
23
- | `workspace-context/team-member/{user}/` | Per-user working context — default destination for personal captures | Yes |
24
- | `workspace-context/index.md` | Auto-generated navigation catalog of `shared/` (locked first, then ephemerals) | Yes |
25
- | `workspace-context/canonical.md` | Auto-generated verbatim concatenation of `shared/locked/*.md` | Yes |
26
- | `workspace-context/team-member/{user}/index.md` | Auto-generated per-user navigation catalog | Yes |
27
- | `workspace-context/.indexignore` | Path prefixes to exclude from `index.md` (e.g., archived release notes) | Yes |
28
- | `workspace-context/release-notes/` | Per-branch release-note artifacts — `unreleased/` and `archive/` | Yes |
29
- | `workspace-scratchpad/` | Disposable workspace-scoped files — session log, hook debug output | No (gitignored, lazy) |
30
- | `CLAUDE.md` | Workspace launcher prompt — imports `canonical.md` and `index.md` | Yes |
31
- | `CLAUDE.local.md` | Per-user prompt — imports `team-member/{user}/index.md` | No (gitignored) |
32
- | `.claude/` | Claude Code configuration — rules, agents, skills, hooks, scripts, lib | Yes (except settings.local.json) |
33
-
34
- Session content (tracker, specs, plans) lives at the top of each session's workspace worktree. It is tracked on the session branch, not on main. Pushing the session branch carries durable session thinking across machines. When `/complete-work` finalizes the session, it synthesizes the content into release notes and removes the files from the branch before the final PR so main's top level stays free of session artifacts.
7
+ | Path | Purpose | Tracked? |
8
+ |------|---------|----------|
9
+ | `repos/{repo}/` | Source clones (always on the default branch) | No |
10
+ | `repos/{repo}/.claude/worktrees/{slug}/` | Task worktree for a project repo (`{slug}` = branch with `/` → `-`) | No |
11
+ | `.claude/worktrees/{slug}/` | Task worktree for the workspace repo (`--repo .`) — Claude Code's native worktree location; the two converge | No |
12
+ | `work-sessions/{name}/workspace/…` | Session lifecycle: workspace worktree, nested project worktrees at `workspace/repos/{repo}/`, `session.md` + artifacts (`design/plan/goal/research/crossref-*.md`) on top | Session branch |
13
+ | `workspace-context/` | Team knowledge: `shared/` (ephemerals), `shared/locked/` (canonical truths), `team-member/{user}/` (per-user) | Yes |
14
+ | `workspace-context/index.md`, `canonical.md`, `team-member/{user}/index.md` | Auto-generated catalogs (`canonical.md` = verbatim `shared/locked/`; `.indexignore` excludes paths) — regenerate with `build-workspace-context.mjs`, never hand-edit | Yes |
15
+ | `workspace-scratchpad/` | Machine-local, regenerable: session log, hook debug output, chat records `chats/{chat}.json`, chat drawers `chats/{chat}/` (task-lifecycle designs, plans, braindumps, research in progress) | No |
16
+ | `CLAUDE.md`, `CLAUDE.local.md`, `.claude/` | Launcher prompt (imports `canonical.md` + `index.md`); per-user prompt; rules, agents, skills, hooks, scripts | All but `CLAUDE.local.md`, `settings.local.json`, `.claude/.active-session.json`, and `.claude/worktrees/` |
35
17
 
36
18
  ## Workspace-Context Levels
37
19
 
38
- Three layers, in increasing trust order:
39
-
40
20
  | Level | Path | What lives there | How it gets there |
41
- |-------|------|-----------------|--------------------|
42
- | Personal | `team-member/{user}/` | Per-user braindumps, handoffs, research notes | Default destination for `/braindump`, `/handoff`, `/aside` |
43
- | Shared | `shared/` (root) | Team-visible ephemerals — cross-team handoffs, post-release leftovers, references | Explicit choice via `--scope shared` or `/promote` |
44
- | Canonical | `shared/locked/` | Promoted truths — naming conventions, post-release discipline, project status | Promoted by `/release` (or `/promote` with explicit locked target) |
45
-
46
- Canonical content is verbatim-loaded into every session via `CLAUDE.md` → `@workspace-context/canonical.md`. Personal content is loaded only for the active user via the gitignored `CLAUDE.local.md`.
21
+ |-------|------|------------------|-------------------|
22
+ | Personal | `team-member/{user}/` | Per-user braindumps, handoffs, research | Default for `/braindump`, `/handoff`, `/aside` (session lifecycle / no drawer; task-lifecycle chats default to the chat drawer) |
23
+ | Shared | `shared/` | Team-visible ephemerals | Explicit `--scope shared` or `/promote` |
24
+ | Canonical | `shared/locked/` | Promoted truths — conventions, discipline, status | `/promote` (locked target) |
47
25
 
48
- Inflight session state lives inside the session worktree at `work-sessions/{name}/workspace/session.md`, not in `workspace-context/`. Workspace-context is for knowledge that outlives any individual session.
26
+ Canonical loads verbatim into every session (`CLAUDE.md` → `@workspace-context/canonical.md`); personal only for the active user (`CLAUDE.local.md`). Inflight work state (session tracker, chat drawer) never lives in `workspace-context/` — that is for knowledge that outlives any single effort.
49
27
 
50
28
  ## Dynamic context loading (hooks)
51
29
 
52
- Two hooks extend static `CLAUDE.md` loading with context that varies per session and per invocation:
53
-
54
- - **`session-start.mjs`** (`SessionStart` hook): reads the active session pointer from `workspace-scratchpad/` and injects the current session's name, branch, linked work item, and shared context catalog into Claude's context. The injection is conditional — if no session is active, or if the relevant fields are absent from the session frontmatter, nothing is added. This avoids noise in non-session contexts (e.g., a quick launcher query).
55
-
56
- - **`subagent-start.mjs`** (`SubagentStart` hook): reads every file under `workspace-context/shared/locked/` and injects their content into subagent context. A `subagentContextMaxBytes` field in `workspace.json` (default 10240) acts as a byte-budget fallback — if the total locked content exceeds the budget, files are truncated in reverse-priority order rather than silently dropped. This ensures subagents that never load `CLAUDE.md` still receive canonical team truths.
30
+ - **`session-start.mjs`** (`SessionStart`): injects the workspace name, a `Chat record:` line naming this chat's record, and a `Workspace root:` line with the launcher's absolute path (git-derived roots land on the source clone from inside a task worktree); with an active session pointer, also the session's name, branch, work item, and shared-context catalog.
31
+ - **`subagent-start.mjs`** (`SubagentStart`): gives subagents the canonical truths they miss (subagents do not load `CLAUDE.md`) — locked files under `workspace.subagentInlineMaxBytes` (8192) are inlined with frontmatter stripped, larger ones become pointers, and past `workspace.subagentContextMaxBytes` (32768) the largest demote first. Gitignored and `local-only-*` files are excluded.
57
32
 
58
- Both hooks are at `.claude/hooks/session-start.mjs` and `.claude/hooks/subagent-start.mjs`. They are registered as Node.js scripts — cross-platform, no shell dependency.
33
+ Both are Node.js scripts — cross-platform, no shell dependency.
59
34
 
60
35
  ## Spec and Plan Locations — MANDATORY OVERRIDE
61
36
 
62
- **Specs, plans, and goal artifacts MUST be written at the top of the active session's workspace worktree, not to `docs/superpowers/` or any other location.**
63
-
64
- - Specs: `design-{topic}.md` at the top of `work-sessions/{session-name}/workspace/`
65
- - Plans: `plan-{topic}.md` at the top of `work-sessions/{session-name}/workspace/`
66
- - Goals: `goal-{topic}.md` at the top of `work-sessions/{session-name}/workspace/`, with goal-native phase outputs as `research-{topic}.md` and `crossref-{topic}.md` siblings. See `goal-driven-work.md` for the schema and when to reach for `/goal`.
67
-
68
- From inside the worktree, these are plain top-level files (`design-{topic}.md`, `plan-{topic}.md`, `goal-{topic}.md`) sitting alongside `CLAUDE.md` and `workspace.json`. They are tracked on the session branch and travel with the branch on `git push`.
69
-
70
- This overrides any default paths specified by external skills (e.g., Superpowers brainstorming defaults to `docs/superpowers/specs/`). Those skills state that user preferences override their defaults — this rule IS that override. Do not create `docs/superpowers/` directories. Do not write specs, plans, or goal artifacts anywhere other than the top of the active worktree.
37
+ **Specs, plans, and goal artifacts MUST be written to the current lifecycle's work area, not to `docs/superpowers/` or any other location.**
71
38
 
72
- If a spec/plan/goal already exists for the current session, version it: `design-{topic}-v2.md`, `design-{topic}-v3.md`.
39
+ - Session: top of the session worktree — `design-{topic}.md`, `plan-{topic}.md`, `goal-{topic}.md`, plus goal-native `research-*.md`/`crossref-*.md` siblings. On the session branch; stripped before the final PR.
40
+ - Task: the chat drawer `workspace-scratchpad/chats/{chat}/` — same artifact names. Machine-local; `/complete-work` promotes what deserves to survive into `workspace-context/`.
73
41
 
74
- `/complete-work` reads specs, plans, and goal artifacts (including `research-*.md` and `crossref-*.md` phase outputs) from the worktree to synthesize release notes, then removes them in a dedicated commit before the final PR so main's tree stays pristine.
42
+ This overrides external skills' default paths (e.g., Superpowers' `docs/superpowers/specs/`) — those skills defer to user preferences, and this rule IS that override. Never create `docs/superpowers/` directories. Version an existing artifact: `design-{topic}-v2.md`.
75
43
 
76
44
  ## File Naming Conventions
77
45
 
78
- - Session folders: `work-sessions/{session-name}/`
79
- - Workspace worktrees: `work-sessions/{session-name}/workspace/`
80
- - Project worktrees: `work-sessions/{session-name}/workspace/repos/{repo-name}/`
81
- - Session trackers: `work-sessions/{session-name}/workspace/session.md`
82
- - Specs: `design-{topic}.md` (top of worktree)
83
- - Plans: `plan-{topic}.md` (top of worktree)
84
- - Goals: `goal-{topic}.md` (top of worktree)
85
- - Goal-native research outputs: `research-{topic}.md` (top of worktree)
86
- - Goal-native crossref outputs: `crossref-{topic}.md` (top of worktree)
87
-
88
- For ephemeral content under `shared/` and `team-member/{user}/`, the filename prefix signals the type:
46
+ Ephemeral files under `shared/` and `team-member/{user}/` carry a type prefix:
89
47
 
90
48
  | Skill | Filename prefix |
91
49
  |-------|-----------------|
92
50
  | `/braindump` | `braindump_{topic}.md` |
93
51
  | `/handoff` | `handoff_{topic}.md` |
94
- | `/aside` (full mode, dispatches researcher) | `research_{topic}.md` |
95
- | `/aside --quick` | `braindump_{topic}.md` (with `variant: aside` in frontmatter) |
52
+ | `/aside` (full) / `--quick` | `research_{topic}.md` / `braindump_{topic}.md` (`variant: aside`) |
96
53
  | `/promote` | preserves source prefix |
97
- | `/release` | strips prefix when locking — `shared/locked/` files use bare names since location signals the type |
98
54
 
99
- Local-only personal drafts get an additional `local-only-` prefix (e.g., `local-only-braindump_x.md`) which keeps them gitignored until promoted.
55
+ Local-only drafts add a `local-only-` prefix to stay gitignored until promoted.
100
56
 
101
57
  ## Rules
102
58
 
103
- - The workspace root stays on main — it is the launcher, not the workspace.
104
- - All real work happens in workspace worktrees at `work-sessions/{name}/workspace/`.
105
- - Session content (tracker, specs, plans) is written from inside the worktree and committed on the session branch. Writes from the launcher cannot reach files that live inside a worktree's git-path space.
106
- - Source clones at `repos/{repo-name}/` stay on their default branch — never checkout a feature branch there.
107
- - `workspace-scratchpad/` is for disposable files only — session log, hook debug output, temporary pointers.
108
- - Project worktrees are nested inside the workspace worktree's real `repos/` directory — no symlink.
109
- - Hand edits to `index.md`, `canonical.md`, or any per-user `team-member/{user}/index.md` are overwritten by `build-workspace-context.mjs`. Update source files (or their `description:` frontmatter) instead.
59
+ - The workspace root stays on its default branch — it is the launcher, not a worktree.
60
+ - All real work happens in worktrees — `work-sessions/{name}/workspace/` (session) or a `.claude/worktrees/{slug}/` location (task). Source clones at `repos/{repo}/` never take a feature branch.
61
+ - Session content commits to the session branch; task work to task worktrees; drawer writes need no commit (gitignored, machine-local).
62
+ - `workspace-scratchpad/` is machine-local and regenerable — losing it costs a re-derivation, not the work. Not all of it is disposable: `session-log.jsonl` is real history no other file carries.
63
+ - Hand edits to auto-generated catalogs are overwritten by `build-workspace-context.mjs` — update the source files (or their `description:` frontmatter) instead.
110
64
 
111
65
  ## Per-repo commands
112
66
 
113
- Per-repo test, lint, and build commands belong in `repos/{repo}/CLAUDE.md` under a `## Commands` section. This scopes Claude's command invocations to the specific repo rather than triggering monorepo-wide runs that may time out or produce irrelevant output. The `/workspace-init` skill scaffolds a blank `repos/{repo}/CLAUDE.md` stub with a `## Commands` placeholder — fill it in once the repo is cloned.
67
+ Per-repo test, lint, and build commands belong in `repos/{repo}/CLAUDE.md` under `## Commands`, scoping invocations to that repo instead of the whole monorepo. `/workspace-init` scaffolds the stub.
114
68
 
115
69
  ## Explore before editing
116
70
 
117
- Before modifying files in a large or unfamiliar codebase, use read-only tools to map the affected surface. The workflow: dispatch a researcher-type subagent to read, grep, and navigate the codebase; have it return a summary of the affected files, callers, and dependencies; then edit only after the map is established.
118
-
119
- The `researcher.md` agent enforces this pattern mechanically via `disallowedTools: [Edit, Write, Bash]` — it can read and search but cannot change anything. Use it for initial exploration, then hand the findings back to the main agent for the actual edit. This avoids partial edits that break callers, catches ripple effects before they happen, and keeps the edit surface as small as possible.
120
-
121
- ## Launching Claude from a project worktree
122
-
123
- Claude can be launched from any directory, and it walks up the filesystem loading every `CLAUDE.md` it finds. This means starting `claude` from `work-sessions/{name}/workspace/repos/{repo}/` loads both the per-repo conventions (from `repos/{repo}/CLAUDE.md`, if it exists) and the full workspace conventions (from the workspace `CLAUDE.md` further up the tree) — all without extra configuration.
71
+ Before editing an unfamiliar codebase, map the affected surface first — typically a `researcher.md` subagent dispatch (`disallowedTools: [Edit, Write, Bash]`) returning affected files, callers, and dependencies. Edit only after the map is established.
124
72
 
125
- For repo-focused work — debugging a single service, reviewing a specific module, running targeted tests — launching from the project worktree gives Claude a tighter codebase context. It sees the repo's own file tree first and reaches workspace-level conventions by traversal. The session hooks still fire (they read from `workspace-scratchpad/`, which is always relative to the workspace root), and `session.md` and all session artifacts remain at the workspace worktree top.
73
+ ## Launching Claude inside a worktree
126
74
 
127
- This is purely a launch-point choice; no workspace configuration changes are needed to enable it.
75
+ A git worktree is a context boundary: `CLAUDE.md` discovery stops at the worktree's root, and gitignored content (`repos/`, `local-only-*`, `workspace-scratchpad/`) is absent from it. So a chat launched inside a project worktree — a session's `workspace/repos/{repo}/` or a task's `repos/{repo}/.claude/worktrees/{slug}/` — sees only that repo's own `CLAUDE.md`, not the workspace conventions or hooks. Keep the chat at the workspace root and reach worktrees by path; launch inside one only for deliberately isolated, repo-only work.
128
76
 
129
77
  ## Grep vs LSP
130
78
 
131
- Two complementary search strategies cover different parts of the navigation surface:
132
-
133
- - **Grep / Ripgrep** — searches file content as text. Fast, requires no server, and works across any file type. Use for free-text pattern search: finding a string literal, locating config values, scanning comments, searching across heterogeneous files. The downside: no language awareness — a search for `_toMs` matches comments, string literals, and variable names alike, producing false positives that require manual filtering.
134
-
135
- - **LSP tools (`mcp__lsp__*`)** — powered by a running Language Server Protocol server that has indexed the codebase. LSP understands the language's type system and scope rules, so `find-all-references` on `_toMs` returns only actual symbol usages, not textual coincidences. Go-to-definition, rename-symbol, and callers/callees are accurate even across files and module boundaries. The tradeoff: requires a running LSP MCP server configured in `.mcp.json`.
136
-
137
- The practical rule: reach for Grep first when you don't know where to look or when the pattern is not a symbol. Switch to LSP when you have a specific symbol and need precise cross-file navigation — especially before refactoring or understanding a call graph. The `researcher.md` agent lists the LSP tool among its allowed tools; activating LSP requires adding the appropriate language server to `.mcp.json` (see the MCP servers step in `/workspace-init`).
79
+ **Grep/Ripgrep** searches content as text — fast, no server, but no language awareness, so symbol searches surface false positives. **LSP** (`mcp__lsp__*`) understands types and scope — find-all-references returns only real usages — but needs an LSP MCP server in `.mcp.json`. Grep when you don't know where to look; LSP for precise navigation of a specific symbol.