tlc-claude-code 2.6.1 → 2.8.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.
@@ -22,7 +22,24 @@ Run a comprehensive audit of the codebase against TLC coding standards.
22
22
  /tlc:audit
23
23
  ```
24
24
 
25
- ## Process
25
+ ## CodeDB Acceleration
26
+
27
+ 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.
28
+
29
+ Use the broadest CodeDB query that covers the audit pass before reading files manually.
30
+
31
+ | Tool | Usage |
32
+ |------|-------|
33
+ | `codedb_tree` | Analyze folder structure, including file counts per folder and nesting depth. |
34
+ | `codedb_search` | Scan for violation patterns such as hardcoded URLs `https?://`, magic strings, and `process.env` usage outside config. |
35
+ | `codedb_symbol` | Check JSDoc coverage on exported functions before doing line-by-line review. |
36
+ | `codedb_bundle` | Batch the audit checks into one call to reduce repeated repository scans. |
37
+
38
+ Use CodeDB results to narrow any follow-up reads to the specific files or folders with likely violations.
39
+
40
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
41
+
42
+ ## Process
26
43
 
27
44
  ### Step 1: Load Audit Module
28
45
 
@@ -145,7 +145,23 @@ The existing autofix instructions below are the Inline Mode instructions and sho
145
145
  /tlc:autofix
146
146
  ```
147
147
 
148
- ## Process
148
+ ## CodeDB Acceleration
149
+
150
+ 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.
151
+
152
+ Use CodeDB to narrow the failing area before opening files or proposing a fix.
153
+
154
+ | Tool | Usage |
155
+ |------|-------|
156
+ | `codedb_symbol` | Find test function definitions quickly for the failing cases. |
157
+ | `codedb_deps` | Trace imports and dependents of the broken module before editing. |
158
+ | `codedb_hot` | Focus repair work on recently modified files that likely caused the failure. |
159
+
160
+ Use these results to choose the smallest verified fix path before rerunning tests.
161
+
162
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
163
+
164
+ ## Process
149
165
 
150
166
  ### Step 1: Run Tests
151
167
 
@@ -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
 
@@ -395,6 +395,36 @@ This is the core TLC command. Tests before code, one task at a time.
395
395
  /tlc:build <phase_number> --agents 5 # Limit parallel agents to 5
396
396
  ```
397
397
 
398
+ ## Phase Resolution
399
+
400
+ Before loading plans, normalize the phase argument:
401
+
402
+ 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`).
403
+ 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.
404
+ 3. If the prefix is unknown, stop with:
405
+ `Unknown prefix FOO. Known: TLC, CORE, SA`
406
+ 4. If no workspace manifest exists:
407
+ - Prefixed cross-repo IDs return an error
408
+ - Unprefixed IDs still work in the current repo for backward compatibility
409
+
410
+ Use `{PHASE_ID}` for artifact lookup and keep `{phase_number}` as the numeric/local branch component when needed.
411
+
412
+ ## CodeDB Acceleration
413
+
414
+ 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.
415
+
416
+ Use CodeDB to inspect nearby code and conventions before creating files or implementing the next step.
417
+
418
+ | Tool | Usage |
419
+ |------|-------|
420
+ | `codedb_outline` | Inspect files adjacent to the task area for existing patterns, exports, and interfaces. |
421
+ | `codedb_search` | Find similar implementations to follow as the reference path for new work. |
422
+ | `codedb_tree` | Verify the target directory structure before creating or moving files. |
423
+
424
+ Use these queries to keep new work aligned with surrounding modules and repository layout.
425
+
426
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
427
+
398
428
  ## Process
399
429
 
400
430
  ### Step 0: Create Phase Branch (Mandatory)
@@ -427,7 +457,12 @@ fi
427
457
 
428
458
  ### Step 1: Load Plans
429
459
 
430
- Read all `.planning/phases/{phase}-*-PLAN.md` files for this phase.
460
+ Read the phase plan using prefixed matching first:
461
+
462
+ - Preferred: `.planning/phases/{PREFIX}-{N}-PLAN.md`
463
+ - Backward-compatible fallback: `.planning/phases/{N}-PLAN.md`
464
+
465
+ Do not use the old ambiguous glob `.planning/phases/{phase}-*-PLAN.md` for primary lookup.
431
466
 
432
467
  ### Step 1a: Auto-Parallel Detection
433
468
 
@@ -138,6 +138,22 @@ 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
+ ## CodeDB Acceleration
142
+
143
+ 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.
144
+
145
+ Prefer a single batched pass to map source files, test files, and exported surfaces before deeper inspection.
146
+
147
+ | Tool | Usage |
148
+ |------|-------|
149
+ | `codedb_tree` | Identify all source files and test files across the repository. |
150
+ | `codedb_outline` | Find exported functions and signatures per file to compare against existing tests. |
151
+ | `codedb_bundle` | Batch the tree and outline queries into one call for faster coverage mapping. |
152
+
153
+ Use the returned file and symbol lists to focus manual review on untested or high-risk modules.
154
+
155
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
156
+
141
157
  ## Process
142
158
 
143
159
  ### 1. Detect Test Framework
@@ -149,6 +149,21 @@ 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
+ ## CodeDB Acceleration
153
+
154
+ 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.
155
+
156
+ Use structure and module outlines to ground the discussion in the code that the current phase actually touches.
157
+
158
+ | Tool | Usage |
159
+ |------|-------|
160
+ | `codedb_outline` | Inspect modules relevant to the phase being discussed, including exports and interfaces. |
161
+ | `codedb_tree` | Understand folder organization in the affected area before making recommendations. |
162
+
163
+ Use CodeDB output to support tradeoff analysis and keep the discussion tied to concrete files.
164
+
165
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
166
+
152
167
  ## Process
153
168
 
154
169
  ### Step 1: Scan Context First
@@ -166,6 +166,25 @@ After observability scaffolding, inspect the project's CI/CD posture:
166
166
  - Report: `"CI/CD OK"`
167
167
  - Include detected platform and workflow file paths in the summary
168
168
 
169
+ ### 6b. Register CodeDB MCP Server
170
+
171
+ If `codedb` is installed (`command -v codedb`), create `.mcp.json` in the project root (if it doesn't already exist):
172
+
173
+ ```json
174
+ {
175
+ "mcpServers": {
176
+ "codedb": {
177
+ "command": "codedb",
178
+ "args": ["mcp", "."]
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ This gives Claude Code sub-millisecond code search, symbol lookup, and project tree — 1600x fewer tokens than grep/read.
185
+
186
+ If `codedb` is not installed, skip silently (it's optional infrastructure from tlc-core).
187
+
169
188
  ### 7. If Tests Already Exist
170
189
 
171
190
  - Skip framework setup
@@ -173,13 +173,42 @@ 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
+ ## CodeDB Acceleration
191
+
192
+ 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.
193
+
194
+ Start with structure and interface discovery before breaking work into tasks or estimating scope.
195
+
196
+ | Tool | Usage |
197
+ |------|-------|
198
+ | `codedb_tree` | Understand the project structure before creating the task breakdown. |
199
+ | `codedb_outline` | Inspect key modules for existing patterns, exports, and interfaces to follow. |
200
+
201
+ Use the CodeDB snapshot to anchor the plan in the actual repository layout instead of assumptions.
202
+
203
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
204
+
176
205
  ## Process
177
206
 
178
207
  ### Step 1: Load Context
179
208
 
180
209
  Read:
181
210
  - `.planning/ROADMAP.md` - phase goal
182
- - `.planning/phases/{N}-DISCUSSION.md` - implementation preferences
211
+ - `.planning/phases/{PHASE_ID}-DISCUSSION.md` - implementation preferences
183
212
  - `PROJECT.md` - tech stack, constraints
184
213
 
185
214
  ### Step 2: Research (if needed)
@@ -189,7 +218,7 @@ For phases requiring external knowledge:
189
218
  - Check best practices
190
219
  - Identify patterns
191
220
 
192
- Create `.planning/phases/{N}-RESEARCH.md` with findings.
221
+ Create `.planning/phases/{PHASE_ID}-RESEARCH.md` with findings.
193
222
 
194
223
  ### Step 3: Break Into Tasks
195
224
 
@@ -255,10 +284,10 @@ Use `/tlc:claim` to claim a task, `/tlc:release` to release one.
255
284
 
256
285
  ### Step 4: Create Plan File
257
286
 
258
- Create `.planning/phases/{N}-PLAN.md`:
287
+ 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`.
259
288
 
260
289
  ```markdown
261
- # Phase {N}: {Name} - Plan
290
+ # Phase {PHASE_ID}: {Name} - Plan
262
291
 
263
292
  ## Overview
264
293
 
@@ -365,7 +394,7 @@ If the result is `true`:
365
394
  fs
366
395
  });
367
396
  console.log(JSON.stringify(r));
368
- " ".planning/phases/{N}-PLAN.md" 2>/dev/null
397
+ " ".planning/phases/{PHASE_ID}-PLAN.md" 2>/dev/null
369
398
  ```
370
399
  2. Report results: "GitHub: Created N issues, updated M, linked to project board"
371
400
  3. If sync fails, warn but do not block: "GitHub sync failed: [reason]. Plan saved locally. Run `/tlc:issues sync` to retry."
@@ -398,7 +427,7 @@ Allow refinement if needed.
398
427
  ### Step 6: Save and Continue
399
428
 
400
429
  ```
401
- Plan saved to .planning/phases/{N}-PLAN.md
430
+ Plan saved to .planning/phases/{PHASE_ID}-PLAN.md
402
431
 
403
432
  Ready to build?
404
433
  1) Yes, run /tlc:build (writes tests first)
@@ -15,6 +15,22 @@ It also runs:
15
15
  - After any multi-file change
16
16
  - Before recommending a commit or push
17
17
 
18
+ ## CodeDB Acceleration
19
+
20
+ 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.
21
+
22
+ Use dependency and recency data first so the completeness check covers the full blast radius of recent edits.
23
+
24
+ | Tool | Usage |
25
+ |------|-------|
26
+ | `codedb_deps` | Find all files that import or otherwise reference the changed modules. |
27
+ | `codedb_hot` | Identify recently changed files that should be treated as the primary focus area. |
28
+ | `codedb_search` | Verify registration patterns such as command arrays, route tables, and exports. |
29
+
30
+ Use the results to confirm registry updates, parallel-system changes, and downstream references before declaring done.
31
+
32
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
33
+
18
34
  ## Process
19
35
 
20
36
  ### Step 1: Inventory What Was Changed
@@ -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,7 +17,23 @@ Same fixes as `/tlc:cleanup` but:
17
17
  /tlc:refactor
18
18
  ```
19
19
 
20
- ## Process
20
+ ## CodeDB Acceleration
21
+
22
+ 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.
23
+
24
+ Use symbol, usage, and dependency lookups before editing so each refactor step accounts for its full impact.
25
+
26
+ | Tool | Usage |
27
+ |------|-------|
28
+ | `codedb_symbol` | Find all definitions of the symbols being refactored. |
29
+ | `codedb_word` | Find all usages of identifiers across the codebase before renaming or extracting them. |
30
+ | `codedb_deps` | Trace the file-level impact of moves so imports and references stay consistent. |
31
+
32
+ Use the CodeDB output to build safer preview steps and reduce missed follow-up edits.
33
+
34
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
35
+
36
+ ## Process
21
37
 
22
38
  ### Step 1: Create or Resume Session
23
39
 
@@ -72,16 +72,25 @@ Same checks as `/tlc:review`:
72
72
  *Automated review by [TLC](https://github.com/jurgencalleja/TLC)*
73
73
  ```
74
74
 
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
- ```
75
+ ### Step 5: Post Review
76
+
77
+ ```bash
78
+ # Submit approval review first
79
+ if ! gh pr review <number> --approve --body "<review_markdown>" 2>/tmp/pr-review-err; then
80
+ if grep -q "Can not approve your own pull request" /tmp/pr-review-err; then
81
+ gh pr comment <number> --body "<review_markdown>"
82
+ echo "Posted as comment (self-owned PR — GitHub blocks self-approval)"
83
+ else
84
+ cat /tmp/pr-review-err
85
+ fi
86
+ fi
87
+
88
+ # Post as PR comment directly when comment-only mode is needed
89
+ gh pr comment <number> --body "<review_markdown>"
90
+
91
+ # Or request changes as a formal review
92
+ gh pr review <number> --request-changes --body "<review_markdown>"
93
+ ```
85
94
 
86
95
  ## Example Output
87
96
 
@@ -174,6 +174,22 @@ 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
+ ## CodeDB Acceleration
178
+
179
+ 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.
180
+
181
+ Run the security and change-impact queries early so the manual review starts from the highest-risk files.
182
+
183
+ | Tool | Usage |
184
+ |------|-------|
185
+ | `codedb_search` | Scan for security patterns such as credentials, SQL injection, XSS, and `eval`. |
186
+ | `codedb_deps` | Check whether changed files have unreviewed dependents elsewhere in the codebase. |
187
+ | `codedb_hot` | Identify recently changed files that deserve extra review focus. |
188
+
189
+ Use these results to prioritize findings, coverage checks, and any follow-up file reads.
190
+
191
+ If CodeDB is unavailable, fall back to Grep/Glob/Read.
192
+
177
193
  ## Process
178
194
 
179
195
  ### Step 1: Load Router State (Persistent)
@@ -12,9 +12,20 @@ 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. **Report results** with next action
23
+
24
+ When workspace mode is active, include a one-line summary such as:
25
+
26
+ ```text
27
+ [TLC] 142 tests | [CORE] 38 tests | [SA] 67 tests
28
+ ```
18
29
 
19
30
  ## Output Examples
20
31
 
@@ -27,6 +38,15 @@ Test Status
27
38
  Ready for: /tlc:verify
28
39
  ```
29
40
 
41
+ **Workspace-wide:**
42
+ ```
43
+ Test Status
44
+ ───────────
45
+ [TLC] 142 tests | [CORE] 38 tests | [SA] 67 tests
46
+
47
+ Ready for: /tlc:verify in the active repo
48
+ ```
49
+
30
50
  **Some failing:**
31
51
  ```
32
52
  Test Status
@@ -198,6 +198,14 @@ If no roadmap exists:
198
198
 
199
199
  ### Step 2: Find The Active Phase
200
200
 
201
+ Before matching phase artifacts, determine the current repo prefix:
202
+
203
+ 1. Try workspace-aware discovery first:
204
+ - Load `/workspace/Tools/.tlc-workspace.json` when available, or discover the nearest manifest via `server/lib/workspace-manifest.js`
205
+ - Use the current repo path plus the manifest to resolve the repo prefix (`TLC`, `CORE`, `SA`, etc.)
206
+ 2. If no manifest is available, scan `.planning/phases/` for existing prefixed artifacts such as `TLC-108-PLAN.md` and infer the current repo prefix from those filenames
207
+ 3. If neither manifest nor prefixed files are available, fall back to legacy unprefixed detection
208
+
201
209
  From the roadmap, identify:
202
210
 
203
211
  - The current phase marked as in progress, current, or active
@@ -206,18 +214,22 @@ From the roadmap, identify:
206
214
 
207
215
  Extract:
208
216
 
209
- - Phase number
217
+ - Phase number / phase ID
210
218
  - Phase name
211
219
  - Task count if the roadmap or plan exposes it
212
220
  - Completed task count if available
213
221
 
214
222
  ### Step 3: Check Artifacts In The Same Pass
215
223
 
216
- For the active phase `N`, check:
224
+ For the active phase, build the preferred prefixed ID `{PREFIX}-{N}` when a prefix is known. Check artifacts in this order:
217
225
 
218
- - Discussion: `.planning/phases/{N}-DISCUSSION.md`
219
- - Plan: `.planning/phases/{N}-PLAN.md`
220
- - Verification: `.planning/phases/{N}-VERIFIED.md`
226
+ - Discussion: `.planning/phases/{PREFIX}-{N}-DISCUSSION.md`, then legacy `.planning/phases/{N}-DISCUSSION.md`
227
+ - Plan: `.planning/phases/{PREFIX}-{N}-PLAN.md`, then legacy `.planning/phases/{N}-PLAN.md`
228
+ - Verification: `.planning/phases/{PREFIX}-{N}-VERIFIED.md`, then legacy `.planning/phases/{N}-VERIFIED.md`
229
+
230
+ Phase file pattern matching must accept both:
231
+ - Prefixed: `{PREFIX}-{N}-PLAN.md`, `{PREFIX}-{N}-DISCUSSION.md`, `{PREFIX}-{N}-VERIFIED.md`
232
+ - Legacy: `{N}-PLAN.md`, `{N}-DISCUSSION.md`, `{N}-VERIFIED.md`
221
233
 
222
234
  If the plan exists, inspect it to determine build state:
223
235
 
@@ -228,16 +240,20 @@ If the plan exists, inspect it to determine build state:
228
240
  Use these state rules:
229
241
 
230
242
  1. No discussion file:
231
- Run `/tlc:discuss {N}`
243
+ Run `/tlc:discuss {PHASE_ID}`
232
244
  2. Discussion exists, no plan:
233
- Run `/tlc:plan {N}`
245
+ Run `/tlc:plan {PHASE_ID}`
234
246
  3. Plan exists and phase is not fully built:
235
- Run `/tlc:build {N}`
247
+ Run `/tlc:build {PHASE_ID}`
236
248
  4. Build complete, no verification file:
237
- Run `/tlc:verify {N}`
249
+ Run `/tlc:verify {PHASE_ID}`
238
250
  5. Verification exists or all phases are complete:
239
251
  Suggest release, but do not auto-run it
240
252
 
253
+ Backward compatibility:
254
+ - If prefixed artifacts exist, prefer them everywhere in status output and auto-run commands
255
+ - If no prefixed artifacts exist and no workspace manifest is found, continue using legacy unprefixed phase IDs
256
+
241
257
  ## Output Format
242
258
 
243
259
  Normal output must stay within 3-5 lines.
@@ -245,9 +261,9 @@ Normal output must stay within 3-5 lines.
245
261
  Use this pattern:
246
262
 
247
263
  ```text
248
- TLC v{version} | Phase {N}: {Name} | {done}/{total} tasks done
264
+ TLC v{version} | Phase {PHASE_ID}: {Name} | {done}/{total} tasks done
249
265
  Next: {action summary}
250
- Running /tlc:{command} {N}...
266
+ Running /tlc:{command} {PHASE_ID}...
251
267
  ```
252
268
 
253
269
  If there is nothing safe to auto-run:
@@ -288,7 +304,7 @@ Auto-run:
288
304
  Auto-run:
289
305
 
290
306
  ```text
291
- /tlc:plan {N}
307
+ /tlc:plan {PHASE_ID}
292
308
  ```
293
309
 
294
310
  ### Planned, Not Built
@@ -296,7 +312,7 @@ Auto-run:
296
312
  Auto-run:
297
313
 
298
314
  ```text
299
- /tlc:build {N}
315
+ /tlc:build {PHASE_ID}
300
316
  ```
301
317
 
302
318
  Use the next incomplete task from the plan in the status line when available.
@@ -306,7 +322,7 @@ Use the next incomplete task from the plan in the status line when available.
306
322
  Auto-run:
307
323
 
308
324
  ```text
309
- /tlc:verify {N}
325
+ /tlc:verify {PHASE_ID}
310
326
  ```
311
327
 
312
328
  ### All Complete
@@ -322,9 +338,9 @@ Run /tlc:complete or /tlc:new-milestone
322
338
  ## Example
323
339
 
324
340
  ```text
325
- TLC v2.4.2 | Phase 8: Auth System | 3/5 tasks done
341
+ TLC v2.4.2 | Phase TLC-8: Auth System | 3/5 tasks done
326
342
  Next: build task 4 (JWT middleware)
327
- Running /tlc:build 8...
343
+ Running /tlc:build TLC-8...
328
344
  ```
329
345
 
330
346
  ## Summary
@@ -72,6 +72,30 @@ else
72
72
  fi
73
73
  fi
74
74
 
75
+ # ─── CodeDB (codebase awareness) ─────────────────────
76
+ if command -v codedb >/dev/null 2>&1; then
77
+ if curl -sf --max-time 1 "http://localhost:7719/health" > /dev/null 2>&1; then
78
+ echo "codedb: running"
79
+ else
80
+ codedb serve "$PROJECT_DIR" > /dev/null 2>&1 &
81
+ echo "codedb: started indexing $PROJECT_DIR"
82
+ fi
83
+ # Ensure .mcp.json exists for Claude Code MCP discovery
84
+ if [ ! -f "$PROJECT_DIR/.mcp.json" ]; then
85
+ cat > "$PROJECT_DIR/.mcp.json" <<'MCPEOF'
86
+ {
87
+ "mcpServers": {
88
+ "codedb": {
89
+ "command": "codedb",
90
+ "args": ["mcp", "."]
91
+ }
92
+ }
93
+ }
94
+ MCPEOF
95
+ echo "codedb: created .mcp.json"
96
+ fi
97
+ fi
98
+
75
99
  # ─── Memory System Init ─────────────────────────────
76
100
  mkdir -p "$PROJECT_DIR/.tlc/memory/team/decisions" \
77
101
  "$PROJECT_DIR/.tlc/memory/team/gotchas" \