@ulysses-ai/create-workspace 0.16.0-beta.1 → 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 (53) hide show
  1. package/README.md +5 -5
  2. package/lib/init.mjs +19 -0
  3. package/package.json +1 -1
  4. package/template/.claude/hooks/_utils.mjs +1 -1
  5. package/template/.claude/hooks/repo-write-detection.mjs +161 -64
  6. package/template/.claude/hooks/session-end.mjs +68 -2
  7. package/template/.claude/hooks/session-start.mjs +35 -1
  8. package/template/.claude/hooks/subagent-start.mjs +89 -22
  9. package/template/.claude/lib/session-frontmatter.mjs +28 -0
  10. package/template/.claude/rules/coherent-revisions.md +1 -1
  11. package/template/.claude/rules/config-review.md.skip +29 -0
  12. package/template/.claude/rules/forge-operations.md +51 -0
  13. package/template/.claude/rules/git-conventions.md +16 -11
  14. package/template/.claude/rules/goal-driven-work.md +8 -403
  15. package/template/.claude/rules/honest-pushback.md +37 -37
  16. package/template/.claude/rules/memory-guidance.md +43 -90
  17. package/template/.claude/rules/superpowers-workflow.md.skip +1 -1
  18. package/template/.claude/rules/work-item-tracking.md +30 -72
  19. package/template/.claude/rules/workspace-structure.md +49 -69
  20. package/template/.claude/scripts/build-workspace-context.mjs +61 -16
  21. package/template/.claude/scripts/chat-record.mjs +282 -0
  22. package/template/.claude/scripts/cleanup-work-session.mjs +363 -36
  23. package/template/.claude/scripts/context-footprint.mjs +282 -0
  24. package/template/.claude/scripts/forges/github.mjs +255 -0
  25. package/template/.claude/scripts/forges/gitlab.mjs +20 -0
  26. package/template/.claude/scripts/forges/interface.mjs +125 -0
  27. package/template/.claude/scripts/generate-claude-local.mjs +21 -2
  28. package/template/.claude/scripts/migrate-sessions.mjs +1571 -0
  29. package/template/.claude/scripts/migrate-to-workspace-context.mjs +7 -2
  30. package/template/.claude/scripts/task-worktree.mjs +525 -0
  31. package/template/.claude/scripts/workspace-diagnostics.mjs +654 -0
  32. package/template/.claude/settings.json +5 -13
  33. package/template/.claude/skills/braindump/SKILL.md +11 -4
  34. package/template/.claude/skills/build-docs-site/SKILL.md +5 -5
  35. package/template/.claude/skills/build-docs-site/templates/spec.md.tmpl +1 -1
  36. package/template/.claude/skills/complete-work/SKILL.md +255 -215
  37. package/template/.claude/skills/context-placement/SKILL.md +199 -0
  38. package/template/.claude/skills/goal-driven-work/SKILL.md +459 -0
  39. package/template/.claude/skills/handoff/SKILL.md +11 -4
  40. package/template/.claude/skills/maintenance/SKILL.md +39 -6
  41. package/template/.claude/skills/migrate-sessions/SKILL.md +70 -0
  42. package/template/.claude/skills/pause-work/SKILL.md +33 -8
  43. package/template/.claude/skills/release/SKILL.md +44 -108
  44. package/template/.claude/skills/start-work/SKILL.md +89 -7
  45. package/template/.claude/skills/workspace-init/SKILL.md +34 -0
  46. package/template/.claude/skills/workspace-update/SKILL.md +4 -0
  47. package/template/.claudeignore +3 -0
  48. package/template/CLAUDE.md.tmpl +20 -2
  49. package/template/CODEBASE.md.tmpl +13 -0
  50. package/template/_gitignore +9 -0
  51. package/template/repo-claude.md.tmpl +10 -0
  52. package/template/workspace.json.tmpl +5 -3
  53. package/template/.claude/hooks/worktree-create.mjs +0 -53
@@ -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,99 +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
- ## Spec and Plan Locations — MANDATORY OVERRIDE
28
+ ## Dynamic context loading (hooks)
51
29
 
52
- **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.**
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.
53
32
 
54
- - Specs: `design-{topic}.md` at the top of `work-sessions/{session-name}/workspace/`
55
- - Plans: `plan-{topic}.md` at the top of `work-sessions/{session-name}/workspace/`
56
- - 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`.
33
+ Both are Node.js scripts — cross-platform, no shell dependency.
57
34
 
58
- 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`.
35
+ ## Spec and Plan Locations — MANDATORY OVERRIDE
59
36
 
60
- 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.**
61
38
 
62
- 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/`.
63
41
 
64
- `/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`.
65
43
 
66
44
  ## File Naming Conventions
67
45
 
68
- - Session folders: `work-sessions/{session-name}/`
69
- - Workspace worktrees: `work-sessions/{session-name}/workspace/`
70
- - Project worktrees: `work-sessions/{session-name}/workspace/repos/{repo-name}/`
71
- - Session trackers: `work-sessions/{session-name}/workspace/session.md`
72
- - Specs: `design-{topic}.md` (top of worktree)
73
- - Plans: `plan-{topic}.md` (top of worktree)
74
- - Goals: `goal-{topic}.md` (top of worktree)
75
- - Goal-native research outputs: `research-{topic}.md` (top of worktree)
76
- - Goal-native crossref outputs: `crossref-{topic}.md` (top of worktree)
77
-
78
- 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:
79
47
 
80
48
  | Skill | Filename prefix |
81
49
  |-------|-----------------|
82
50
  | `/braindump` | `braindump_{topic}.md` |
83
51
  | `/handoff` | `handoff_{topic}.md` |
84
- | `/aside` (full mode, dispatches researcher) | `research_{topic}.md` |
85
- | `/aside --quick` | `braindump_{topic}.md` (with `variant: aside` in frontmatter) |
52
+ | `/aside` (full) / `--quick` | `research_{topic}.md` / `braindump_{topic}.md` (`variant: aside`) |
86
53
  | `/promote` | preserves source prefix |
87
- | `/release` | strips prefix when locking — `shared/locked/` files use bare names since location signals the type |
88
54
 
89
- 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.
90
56
 
91
57
  ## Rules
92
58
 
93
- - The workspace root stays on main — it is the launcher, not the workspace.
94
- - All real work happens in workspace worktrees at `work-sessions/{name}/workspace/`.
95
- - 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.
96
- - Source clones at `repos/{repo-name}/` stay on their default branch — never checkout a feature branch there.
97
- - `workspace-scratchpad/` is for disposable files only — session log, hook debug output, temporary pointers.
98
- - Project worktrees are nested inside the workspace worktree's real `repos/` directory — no symlink.
99
- - 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.
64
+
65
+ ## Per-repo commands
66
+
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.
68
+
69
+ ## Explore before editing
70
+
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.
72
+
73
+ ## Launching Claude inside a worktree
74
+
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.
76
+
77
+ ## Grep vs LSP
78
+
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.