tlc-claude-code 2.7.0 → 2.9.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 (30) hide show
  1. package/.claude/commands/tlc/audit.md +12 -0
  2. package/.claude/commands/tlc/autofix.md +12 -0
  3. package/.claude/commands/tlc/build.md +35 -4
  4. package/.claude/commands/tlc/cleanup.md +13 -1
  5. package/.claude/commands/tlc/coverage.md +12 -0
  6. package/.claude/commands/tlc/discuss.md +12 -0
  7. package/.claude/commands/tlc/docs.md +13 -1
  8. package/.claude/commands/tlc/edge-cases.md +13 -1
  9. package/.claude/commands/tlc/plan.md +32 -6
  10. package/.claude/commands/tlc/preflight.md +12 -0
  11. package/.claude/commands/tlc/progress.md +41 -15
  12. package/.claude/commands/tlc/refactor.md +12 -0
  13. package/.claude/commands/tlc/review-pr.md +32 -11
  14. package/.claude/commands/tlc/review.md +12 -0
  15. package/.claude/commands/tlc/security.md +13 -1
  16. package/.claude/commands/tlc/status.md +42 -3
  17. package/.claude/commands/tlc/tlc.md +32 -16
  18. package/.claude/commands/tlc/verify.md +12 -0
  19. package/.claude/commands/tlc/watchci.md +12 -0
  20. package/package.json +1 -1
  21. package/scripts/renumber-phases.js +283 -0
  22. package/scripts/renumber-phases.test.js +305 -0
  23. package/server/lib/orchestration/completion-checker.js +52 -2
  24. package/server/lib/orchestration/completion-checker.test.js +64 -0
  25. package/server/lib/orchestration/session-status.js +28 -4
  26. package/server/lib/orchestration/session-status.test.js +44 -1
  27. package/server/lib/orchestration/skill-dispatcher.js +270 -0
  28. package/server/lib/orchestration/skill-dispatcher.test.js +449 -0
  29. package/server/lib/workspace-manifest.js +138 -0
  30. package/server/lib/workspace-manifest.test.js +179 -0
@@ -22,6 +22,18 @@ Run a comprehensive audit of the codebase against TLC coding standards.
22
22
  /tlc:audit
23
23
  ```
24
24
 
25
+ ## Background Dispatch
26
+
27
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
28
+
29
+ 1. Check orchestrator health
30
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'audit', prompt, project })`
31
+ 3. Report to user: "Dispatched audit to background session ses_XXXX. Results will appear when complete."
32
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
33
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
34
+
35
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
36
+
25
37
  ## CodeDB Acceleration
26
38
 
27
39
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -145,6 +145,18 @@ The existing autofix instructions below are the Inline Mode instructions and sho
145
145
  /tlc:autofix
146
146
  ```
147
147
 
148
+ ## Background Dispatch
149
+
150
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
151
+
152
+ 1. Check orchestrator health
153
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'autofix', prompt, project })`
154
+ 3. Report to user: "Dispatched autofix to background session ses_XXXX. Results will appear when complete."
155
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
156
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
157
+
158
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
159
+
148
160
  ## CodeDB Acceleration
149
161
 
150
162
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -117,7 +117,7 @@ Claude is the **project manager**. Claude reads the plan, breaks tasks into smal
117
117
 
118
118
  ### Step O1: Read the Plan
119
119
 
120
- Read `.planning/phases/{N}-PLAN.md`. Extract each task's goal, files, acceptance criteria, and test cases.
120
+ Read `.planning/phases/{PHASE_ID}-PLAN.md`, falling back to legacy `.planning/phases/{N}-PLAN.md` when no prefixed file exists. Extract each task's goal, files, acceptance criteria, and test cases.
121
121
 
122
122
  ### Step O2: Check Orchestrator Health
123
123
 
@@ -158,6 +158,16 @@ fs.writeFileSync(path, JSON.stringify(existing, null, 2));
158
158
  "
159
159
  ```
160
160
 
161
+ After dispatching, monitor each session to completion with `completion-checker` and react to the returned monitor state:
162
+
163
+ - When a session completes, call `skill-dispatcher.captureResult()` to collect its output before merge-back
164
+ - `stuck` -> ask the user: `Session stuck. Retry or cancel?`
165
+ - `budget_exhausted` -> ask the user: `Budget exhausted. Re-dispatch or skip?`
166
+ - `completed` -> proceed with merge-back
167
+ - `crashed` / `errored` -> report the error, skip that task, and continue with remaining tasks
168
+
169
+ Treat `completion-checker` as the source of truth for whether a session should merge, pause for user input, or be skipped.
170
+
161
171
  ### Step O3-fallback: Direct Dispatch (No Orchestrator)
162
172
 
163
173
  If orchestrator is down, dispatch directly via tmux on the host:
@@ -173,13 +183,15 @@ After dispatching all tasks, report:
173
183
 
174
184
  ```
175
185
  Dispatched N tasks to orchestrator:
176
- ses_abc123 Task 1: Create schema codex running
177
- ses_def456 Task 2: Add validation codex running
186
+ ses_abc123 Task 1: Create schema codex running monitor=running
187
+ ses_def456 Task 2: Add validation codex running monitor=running
178
188
 
179
189
  Run /tlc:status to check progress.
180
190
  I'm free — what would you like to work on?
181
191
  ```
182
192
 
193
+ Include each session's current monitor state in the status display. When available, prefer the same session-status formatting used by orchestration status views so monitor values stay consistent across commands.
194
+
183
195
  **STOP HERE.** Do not write code. Do not execute inline mode. Claude is the PM, not the coder.
184
196
 
185
197
  ### Step O5: Monitor (When User Asks)
@@ -395,6 +407,20 @@ This is the core TLC command. Tests before code, one task at a time.
395
407
  /tlc:build <phase_number> --agents 5 # Limit parallel agents to 5
396
408
  ```
397
409
 
410
+ ## Phase Resolution
411
+
412
+ Before loading plans, normalize the phase argument:
413
+
414
+ 1. If the argument is prefixed, such as `CORE-3`, discover the workspace manifest with `server/lib/workspace-manifest.js`, resolve the prefix to a repo, and run the build in that repo directory (for example `../tlc-core`).
415
+ 2. If the argument is unprefixed, such as `108`, resolve it to the current repo prefix when the workspace manifest exists, producing `TLC-108` in this repo.
416
+ 3. If the prefix is unknown, stop with:
417
+ `Unknown prefix FOO. Known: TLC, CORE, SA`
418
+ 4. If no workspace manifest exists:
419
+ - Prefixed cross-repo IDs return an error
420
+ - Unprefixed IDs still work in the current repo for backward compatibility
421
+
422
+ Use `{PHASE_ID}` for artifact lookup and keep `{phase_number}` as the numeric/local branch component when needed.
423
+
398
424
  ## CodeDB Acceleration
399
425
 
400
426
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -443,7 +469,12 @@ fi
443
469
 
444
470
  ### Step 1: Load Plans
445
471
 
446
- Read all `.planning/phases/{phase}-*-PLAN.md` files for this phase.
472
+ Read the phase plan using prefixed matching first:
473
+
474
+ - Preferred: `.planning/phases/{PREFIX}-{N}-PLAN.md`
475
+ - Backward-compatible fallback: `.planning/phases/{N}-PLAN.md`
476
+
477
+ Do not use the old ambiguous glob `.planning/phases/{phase}-*-PLAN.md` for primary lookup.
447
478
 
448
479
  ### Step 1a: Auto-Parallel Detection
449
480
 
@@ -25,7 +25,19 @@ Automatically fix all coding standards violations. No prompts - just fixes every
25
25
  /tlc:cleanup
26
26
  ```
27
27
 
28
- ## Process
28
+ ## Background Dispatch
29
+
30
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
31
+
32
+ 1. Check orchestrator health
33
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'cleanup', prompt, project })`
34
+ 3. Report to user: "Dispatched cleanup to background session ses_XXXX. Results will appear when complete."
35
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
36
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
37
+
38
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
39
+
40
+ ## Process
29
41
 
30
42
  ### Step 1: Inject Standards
31
43
 
@@ -138,6 +138,18 @@ The existing coverage instructions below are the Inline Mode instructions and sh
138
138
  - When joining a project to understand test gaps
139
139
  - After "vibe coding" a feature without tests
140
140
 
141
+ ## Background Dispatch
142
+
143
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
144
+
145
+ 1. Check orchestrator health
146
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'coverage', prompt, project })`
147
+ 3. Report to user: "Dispatched coverage to background session ses_XXXX. Results will appear when complete."
148
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
149
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
150
+
151
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
152
+
141
153
  ## CodeDB Acceleration
142
154
 
143
155
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -149,6 +149,18 @@ This command is not a blank-page brainstorming prompt. The agent should do the i
149
149
 
150
150
  If no phase number, auto-detect current phase from `.planning/ROADMAP.md`.
151
151
 
152
+ ## Background Dispatch (Research Only)
153
+
154
+ When the orchestrator is available, dispatch Step 1 (Scan Context) to a background agent for fast research, then continue the interview inline with the results.
155
+
156
+ 1. Check orchestrator health
157
+ 2. If available: dispatch a research agent via `skill-dispatcher.dispatch({ skill: 'discuss-research', prompt: 'Scan the codebase for phase context: read ROADMAP, PROJECT.md, relevant code, recent changes. Return structured context as JSON.' })`
158
+ 3. When research agent completes, capture result and inject as context for Step 2 (Expand Before Asking)
159
+ 4. Steps 2+ (the actual interview) always run inline - they need user interaction
160
+ 5. If orchestrator unavailable, run Step 1 inline as before
161
+
162
+ Override: `--inline` flag forces all steps inline.
163
+
152
164
  ## CodeDB Acceleration
153
165
 
154
166
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -187,7 +187,19 @@ Once set up, GitHub Actions automatically:
187
187
 
188
188
  2. **You don't need to manually maintain docs.** Just push code.
189
189
 
190
- ## Process
190
+ ## Background Dispatch
191
+
192
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
193
+
194
+ 1. Check orchestrator health
195
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'docs', prompt, project })`
196
+ 3. Report to user: "Dispatched docs to background session ses_XXXX. Results will appear when complete."
197
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
198
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
199
+
200
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
201
+
202
+ ## Process
191
203
 
192
204
  ### Step 1: Run Setup (Once)
193
205
 
@@ -147,7 +147,19 @@ The existing edge-case generation instructions below are the Inline Mode instruc
147
147
 
148
148
  If no arguments, prompts for target.
149
149
 
150
- ## Process
150
+ ## Background Dispatch
151
+
152
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
153
+
154
+ 1. Check orchestrator health
155
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'edge-cases', prompt, project })`
156
+ 3. Report to user: "Dispatched edge-cases to background session ses_XXXX. Results will appear when complete."
157
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
158
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
159
+
160
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
161
+
162
+ ## Process
151
163
 
152
164
  ### Step 1: Identify Target
153
165
 
@@ -173,6 +173,32 @@ The existing planning instructions below are the Inline Mode instructions and sh
173
173
 
174
174
  If no phase number, auto-detect current phase from ROADMAP.md.
175
175
 
176
+ ## Phase Resolution
177
+
178
+ Before reading or writing phase artifacts, normalize the requested phase argument:
179
+
180
+ 1. If the user passes a prefixed ID such as `CORE-3`, discover the workspace manifest via `server/lib/workspace-manifest.js` and resolve the target repo from the prefix.
181
+ 2. If the user passes an unprefixed ID such as `108`, resolve it to the current repo prefix when the workspace manifest is available, producing `TLC-108` in this repo.
182
+ 3. If the user passes an unknown prefix, stop with:
183
+ `Unknown prefix FOO. Known: TLC, CORE, SA`
184
+ 4. If no workspace manifest exists:
185
+ - Prefixed cross-repo IDs return an error because repo resolution is unavailable
186
+ - Unprefixed IDs still work in the current repo for backward compatibility
187
+
188
+ When a prefixed ID resolves to another repo, operate in that repo's directory (for example `CORE-3` resolves via the manifest and runs against `../tlc-core`).
189
+
190
+ ## Background Dispatch (Research Only)
191
+
192
+ When the orchestrator is available, dispatch research (architecture scan, existing patterns, stack analysis) to a background agent before creating the plan inline.
193
+
194
+ 1. Check orchestrator health
195
+ 2. If available: dispatch research agent via `skill-dispatcher.dispatch({ skill: 'plan-research', prompt: 'Scan project structure, existing patterns, tech stack, and recent changes. Return structured context for planning.' })`
196
+ 3. When research completes, inject results into Step 1 (Load Context)
197
+ 4. Steps 2+ (task breakdown, plan creation) always run inline - they need user review
198
+ 5. If orchestrator unavailable, run all steps inline as before
199
+
200
+ Override: `--inline` flag forces all steps inline.
201
+
176
202
  ## CodeDB Acceleration
177
203
 
178
204
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -194,7 +220,7 @@ If CodeDB is unavailable, fall back to Grep/Glob/Read.
194
220
 
195
221
  Read:
196
222
  - `.planning/ROADMAP.md` - phase goal
197
- - `.planning/phases/{N}-DISCUSSION.md` - implementation preferences
223
+ - `.planning/phases/{PHASE_ID}-DISCUSSION.md` - implementation preferences
198
224
  - `PROJECT.md` - tech stack, constraints
199
225
 
200
226
  ### Step 2: Research (if needed)
@@ -204,7 +230,7 @@ For phases requiring external knowledge:
204
230
  - Check best practices
205
231
  - Identify patterns
206
232
 
207
- Create `.planning/phases/{N}-RESEARCH.md` with findings.
233
+ Create `.planning/phases/{PHASE_ID}-RESEARCH.md` with findings.
208
234
 
209
235
  ### Step 3: Break Into Tasks
210
236
 
@@ -270,10 +296,10 @@ Use `/tlc:claim` to claim a task, `/tlc:release` to release one.
270
296
 
271
297
  ### Step 4: Create Plan File
272
298
 
273
- Create `.planning/phases/{N}-PLAN.md`:
299
+ Create `.planning/phases/{PHASE_ID}-PLAN.md` using the repo prefix when available, for example `TLC-{N}-PLAN.md`. If no workspace manifest or prefixed artifacts exist, fall back to legacy `{N}-PLAN.md`.
274
300
 
275
301
  ```markdown
276
- # Phase {N}: {Name} - Plan
302
+ # Phase {PHASE_ID}: {Name} - Plan
277
303
 
278
304
  ## Overview
279
305
 
@@ -380,7 +406,7 @@ If the result is `true`:
380
406
  fs
381
407
  });
382
408
  console.log(JSON.stringify(r));
383
- " ".planning/phases/{N}-PLAN.md" 2>/dev/null
409
+ " ".planning/phases/{PHASE_ID}-PLAN.md" 2>/dev/null
384
410
  ```
385
411
  2. Report results: "GitHub: Created N issues, updated M, linked to project board"
386
412
  3. If sync fails, warn but do not block: "GitHub sync failed: [reason]. Plan saved locally. Run `/tlc:issues sync` to retry."
@@ -413,7 +439,7 @@ Allow refinement if needed.
413
439
  ### Step 6: Save and Continue
414
440
 
415
441
  ```
416
- Plan saved to .planning/phases/{N}-PLAN.md
442
+ Plan saved to .planning/phases/{PHASE_ID}-PLAN.md
417
443
 
418
444
  Ready to build?
419
445
  1) Yes, run /tlc:build (writes tests first)
@@ -15,6 +15,18 @@ It also runs:
15
15
  - After any multi-file change
16
16
  - Before recommending a commit or push
17
17
 
18
+ ## Background Dispatch
19
+
20
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
21
+
22
+ 1. Check orchestrator health
23
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'preflight', prompt, project })`
24
+ 3. Report to user: "Dispatched preflight to background session ses_XXXX. Results will appear when complete."
25
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
26
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
27
+
28
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
29
+
18
30
  ## CodeDB Acceleration
19
31
 
20
32
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -31,26 +31,40 @@ No project found.
31
31
  Run /tlc:new-project to start, or /tlc:init to add TLC to existing code.
32
32
  ```
33
33
 
34
- ### Step 2: Parse Roadmap
34
+ ### Step 2: Detect Workspace Scope
35
35
 
36
- Read `.planning/ROADMAP.md` and identify:
36
+ Try to discover a workspace manifest via `server/lib/workspace-manifest.js`.
37
+
38
+ - If a manifest exists, switch to workspace-wide progress mode
39
+ - Use the manifest `workspace` name in the header
40
+ - Iterate all repos declared in the manifest, listing the current repo first
41
+ - Repos whose paths do not exist on disk must be shown as `[not cloned]`
42
+ - If no manifest exists, fall back to single-repo mode
43
+
44
+ ### Step 3: Parse Roadmap
45
+
46
+ In single-repo mode, read `.planning/ROADMAP.md` and identify:
37
47
  - Total phases
38
48
  - Completed phases (marked `[x]` or `[completed]`)
39
49
  - Current phase (marked `[>]` or `[current]`)
40
50
  - Pending phases
41
51
 
42
- ### Step 3: Check Current Phase State
52
+ In workspace-wide mode, do the same per repo and produce a compact repo summary such as:
53
+
54
+ `TLC: Phase TLC-108 (3/10) | CORE: Phase CORE-1b (idle) | SA: Phase SA-105f (complete)`
55
+
56
+ ### Step 4: Check Current Phase State
43
57
 
44
58
  For the current/next phase, check what exists:
45
59
 
46
60
  | File | Meaning |
47
61
  |------|---------|
48
- | `{N}-DISCUSSION.md` | Discussed |
49
- | `{N}-PLAN.md` | Planned |
50
- | `{N}-TESTS.md` | Tests written |
51
- | `{N}-VERIFIED.md` | Human verified |
62
+ | `{PREFIX}-{N}-DISCUSSION.md` or `{N}-DISCUSSION.md` | Discussed |
63
+ | `{PREFIX}-{N}-PLAN.md` or `{N}-PLAN.md` | Planned |
64
+ | `{PREFIX}-{N}-TESTS.md` or `{N}-TESTS.md` | Tests written |
65
+ | `{PREFIX}-{N}-VERIFIED.md` or `{N}-VERIFIED.md` | Human verified |
52
66
 
53
- ### Step 4: Run Tests
67
+ ### Step 5: Run Tests
54
68
 
55
69
  Execute test suite and capture:
56
70
  - Total tests
@@ -58,7 +72,7 @@ Execute test suite and capture:
58
72
  - Failing
59
73
  - Skipped
60
74
 
61
- ### Step 5: Present Status
75
+ ### Step 6: Present Status
62
76
 
63
77
  ```
64
78
  Project: My App
@@ -82,6 +96,18 @@ Tests: 47 total | 45 passing | 2 failing
82
96
  Suggested: /tlc:build 4
83
97
  ```
84
98
 
99
+ When workspace-wide mode is active, prefer a compact workspace summary:
100
+
101
+ ```
102
+ Workspace: tlc-platform
103
+
104
+ TLC: Phase TLC-108 (3/10) | CORE: Phase CORE-1b (idle) | SA: Phase SA-105f (complete)
105
+
106
+ [TLC] Tests: 142 total | [CORE] Tests: 38 total | [SA] Tests: 67 total
107
+
108
+ Next: /tlc in the active repo, or /tlc:build TLC-108
109
+ ```
110
+
85
111
  ### Step 5b: Team Status (Multi-User)
86
112
 
87
113
  If task markers (`[>@user]`, `[x@user]`) exist in PLAN.md, show team activity:
@@ -99,17 +125,17 @@ Parse `[>@user]` and `[x@user]` markers from current phase PLAN.md to build this
99
125
 
100
126
  If no markers exist, skip this section (single-user mode).
101
127
 
102
- ### Step 6: Suggest Next Action
128
+ ### Step 7: Suggest Next Action
103
129
 
104
130
  Based on state:
105
131
 
106
132
  | State | Suggestion |
107
133
  |-------|------------|
108
- | No discussion | `/tlc:discuss {N}` |
109
- | Discussed, no plan | `/tlc:plan {N}` |
110
- | Planned, no tests | `/tlc:build {N}` |
111
- | Tests failing | Fix failures, then `/tlc:build {N}` |
112
- | Tests passing, not verified | `/tlc:verify {N}` |
134
+ | No discussion | `/tlc:discuss {PHASE_ID}` |
135
+ | Discussed, no plan | `/tlc:plan {PHASE_ID}` |
136
+ | Planned, no tests | `/tlc:build {PHASE_ID}` |
137
+ | Tests failing | Fix failures, then `/tlc:build {PHASE_ID}` |
138
+ | Tests passing, not verified | `/tlc:verify {PHASE_ID}` |
113
139
  | Verified | Move to next phase |
114
140
  | All phases done | `/tlc:complete` |
115
141
 
@@ -17,6 +17,18 @@ Same fixes as `/tlc:cleanup` but:
17
17
  /tlc:refactor
18
18
  ```
19
19
 
20
+ ## Background Dispatch
21
+
22
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
23
+
24
+ 1. Check orchestrator health
25
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'refactor', prompt, project })`
26
+ 3. Report to user: "Dispatched refactor to background session ses_XXXX. Results will appear when complete."
27
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
28
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
29
+
30
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
31
+
20
32
  ## CodeDB Acceleration
21
33
 
22
34
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -18,7 +18,19 @@ Review a GitHub/GitLab pull request for TLC compliance.
18
18
  /tlc:review-pr # Review current PR (if on PR branch)
19
19
  ```
20
20
 
21
- ## Process
21
+ ## Background Dispatch
22
+
23
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
24
+
25
+ 1. Check orchestrator health
26
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'review-pr', prompt, project })`
27
+ 3. Report to user: "Dispatched review-pr to background session ses_XXXX. Results will appear when complete."
28
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
29
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
30
+
31
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
32
+
33
+ ## Process
22
34
 
23
35
  ### Step 1: Fetch PR Information
24
36
 
@@ -72,16 +84,25 @@ Same checks as `/tlc:review`:
72
84
  *Automated review by [TLC](https://github.com/jurgencalleja/TLC)*
73
85
  ```
74
86
 
75
- ### Step 5: Post Review
76
-
77
- ```bash
78
- # Post as PR comment
79
- gh pr comment <number> --body "<review_markdown>"
80
-
81
- # Or submit as review
82
- gh pr review <number> --approve --body "<review_markdown>"
83
- gh pr review <number> --request-changes --body "<review_markdown>"
84
- ```
87
+ ### Step 5: Post Review
88
+
89
+ ```bash
90
+ # Submit approval review first
91
+ if ! gh pr review <number> --approve --body "<review_markdown>" 2>/tmp/pr-review-err; then
92
+ if grep -q "Can not approve your own pull request" /tmp/pr-review-err; then
93
+ gh pr comment <number> --body "<review_markdown>"
94
+ echo "Posted as comment (self-owned PR — GitHub blocks self-approval)"
95
+ else
96
+ cat /tmp/pr-review-err
97
+ fi
98
+ fi
99
+
100
+ # Post as PR comment directly when comment-only mode is needed
101
+ gh pr comment <number> --body "<review_markdown>"
102
+
103
+ # Or request changes as a formal review
104
+ gh pr review <number> --request-changes --body "<review_markdown>"
105
+ ```
85
106
 
86
107
  ## Example Output
87
108
 
@@ -174,6 +174,18 @@ TLC automatically uses ALL providers configured for the `review` capability in `
174
174
  /tlc:review --base dev # Review vs different base branch
175
175
  ```
176
176
 
177
+ ## Background Dispatch
178
+
179
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
180
+
181
+ 1. Check orchestrator health
182
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'review', prompt, project })`
183
+ 3. Report to user: "Dispatched review to background session ses_XXXX. Results will appear when complete."
184
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
185
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
186
+
187
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
188
+
177
189
  ## CodeDB Acceleration
178
190
 
179
191
  When CodeDB is available (`.mcp.json` has a `codedb` server), use these tools in the scan/search steps below. If CodeDB is unavailable, fall back to Grep/Glob/Read.
@@ -16,7 +16,19 @@ Run security audit on project dependencies and display vulnerabilities.
16
16
  /tlc:security
17
17
  ```
18
18
 
19
- ## Process
19
+ ## Background Dispatch
20
+
21
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
22
+
23
+ 1. Check orchestrator health
24
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'security', prompt, project })`
25
+ 3. Report to user: "Dispatched security to background session ses_XXXX. Results will appear when complete."
26
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
27
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
28
+
29
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
30
+
31
+ ## Process
20
32
 
21
33
  ### Step 1: Detect Package Manager
22
34
 
@@ -12,9 +12,26 @@ If no phase specified, shows overall test status.
12
12
 
13
13
  ## Process
14
14
 
15
- 1. **Detect test framework** (Vitest, Jest, pytest, etc.)
16
- 2. **Run the test suite**
17
- 3. **Report results** with next action
15
+ 1. **Detect workspace scope**
16
+ - Try `server/lib/workspace-manifest.js`
17
+ - If a workspace manifest exists, gather test status for every repo in the manifest with the current repo listed first
18
+ - Repos missing on disk show `[not cloned]`
19
+ - If no manifest exists, fall back to current-repo-only status
20
+ 2. **Detect test framework** (Vitest, Jest, pytest, etc.)
21
+ 3. **Run the test suite**
22
+ 4. **Check active background agent sessions**
23
+ - Read `.tlc/.active-sessions.json` when present
24
+ - Query live session state for each active background session
25
+ - Use the shared `session-status` display functions for formatting session rows
26
+ - Show each running background agent with: skill name, elapsed time, session ID, and monitor state
27
+ - Mark stuck or errored sessions with `[!]`
28
+ 5. **Report results** with next action
29
+
30
+ When workspace mode is active, include a one-line summary such as:
31
+
32
+ ```text
33
+ [TLC] 142 tests | [CORE] 38 tests | [SA] 67 tests
34
+ ```
18
35
 
19
36
  ## Output Examples
20
37
 
@@ -27,6 +44,28 @@ Test Status
27
44
  Ready for: /tlc:verify
28
45
  ```
29
46
 
47
+ **Workspace-wide:**
48
+ ```
49
+ Test Status
50
+ ───────────
51
+ [TLC] 142 tests | [CORE] 38 tests | [SA] 67 tests
52
+
53
+ Background Agents:
54
+ [TLC] review ses_abc123 2m30s running
55
+ [TLC] watchci ses_def456 15m running
56
+ [CORE] build ses_ghi789 5m stuck [!]
57
+
58
+ Ready for: /tlc:verify in the active repo
59
+ ```
60
+
61
+ When active background sessions exist, always include a `Background Agents:` section after the test summary. Prefer session-status formatting helpers so the output stays aligned with other orchestration views.
62
+
63
+ Alerting rules:
64
+
65
+ - Show `[!]` for `stuck` sessions
66
+ - Show `[!]` for `errored` sessions
67
+ - Include the monitor state verbatim (`running`, `stuck`, `budget_exhausted`, `crashed`, etc.)
68
+
30
69
  **Some failing:**
31
70
  ```
32
71
  Test Status