tlc-claude-code 2.8.0 → 2.9.1

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,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.
@@ -158,54 +158,101 @@ 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:
164
174
 
165
175
  ```bash
166
176
  tmux new-session -d -s <task-id> -c $(pwd)
167
- tmux send-keys -t <task-id> "/opt/homebrew/bin/codex --full-auto '<prompt>'" Enter
177
+ tmux send-keys -t <task-id> "/opt/homebrew/bin/codex --dangerously-bypass-approvals-and-sandbox '<prompt>'" Enter
168
178
  ```
169
179
 
170
- ### Step O4: Report and Free
180
+ ### Step O4: Report and Monitor
171
181
 
172
- After dispatching all tasks, report:
182
+ After dispatching all tasks, report the initial state:
173
183
 
174
184
  ```
175
185
  Dispatched N tasks to orchestrator:
176
186
  ses_abc123 Task 1: Create schema codex running
177
- ses_def456 Task 2: Add validation codex running
187
+ ses_def456 Task 2: Add validation codex running
178
188
 
179
- Run /tlc:status to check progress.
180
- I'm free — what would you like to work on?
189
+ Monitoring for completion...
181
190
  ```
182
191
 
183
- **STOP HERE.** Do not write code. Do not execute inline mode. Claude is the PM, not the coder.
192
+ **Do NOT stop here. Do NOT say "I'm free". Enter the monitoring loop immediately.**
184
193
 
185
- ### Step O5: Monitor (When User Asks)
194
+ ### Step O5: Auto-Monitor Loop (Mandatory)
186
195
 
187
- When the user asks for status or agents complete, check:
196
+ After dispatching, poll all sessions every 30 seconds until all reach terminal states. This loop runs automatically — do not wait for the user to ask.
188
197
 
189
- ```bash
190
- # Check all sessions
191
- curl -s http://localhost:3100/sessions | node -e "
192
- const d=require('fs').readFileSync('/dev/stdin','utf8');
193
- JSON.parse(d).forEach(s=>console.log(s.id, s.status, s.project));
194
- "
195
-
196
- # Check specific session output (inside container)
197
- docker exec tlc-agent-runner tmux capture-pane -t <session_id> -p -S -20
198
+ ```
199
+ Poll cycle:
200
+ 1. For each dispatched session, check: GET /sessions/:id/status (or tmux capture-pane)
201
+ 2. Classify each session:
202
+ - completed → ready for merge-back
203
+ - stuck → send Enter once, re-check next cycle. After 3 attempts, ask user: "Session stuck. Retry or cancel?"
204
+ - budget_exhausted → ask user: "Budget exhausted. Re-dispatch or skip?"
205
+ - crashed / errored log error, mark task as failed, continue with others
206
+ - timed_out log timeout, mark task as failed
207
+ - running → continue monitoring
208
+ 3. When ANY session completes, report immediately: "✅ ses_abc123 Task 1 complete"
209
+ 4. When ALL dispatched sessions reach terminal states, exit the loop
198
210
  ```
199
211
 
200
- Auto-approve any prompts found in tmux sessions:
212
+ **Use Bash `sleep 30` between poll cycles. Do not use background tasks for this — poll sequentially in the main conversation so results are visible.**
201
213
 
202
- ```bash
203
- docker exec tlc-agent-runner tmux send-keys -t <session_id> Enter
214
+ Surface progress at natural milestones:
215
+ - When a session completes: one-line status update
216
+ - When all sessions in a parallel batch complete: summary + trigger next batch
217
+ - When a session fails: immediate report with error details
218
+
219
+ ### Step O5a: Dispatch Dependent Tasks
220
+
221
+ When a batch of tasks completes, check the dependency graph for newly unblocked tasks. Dispatch them immediately without asking.
222
+
223
+ ```
224
+ Example:
225
+ Tasks 1+2 dispatched (parallel, no deps)
226
+ Task 1 completes → check if any task depends only on Task 1 → dispatch it
227
+ Task 2 completes → check if remaining tasks are unblocked → dispatch them
228
+ Tasks 3+4 now unblocked → dispatch immediately
229
+ ...continue until all tasks dispatched and completed
204
230
  ```
205
231
 
232
+ ### Step O5b: Auto Merge-Back
233
+
234
+ When all tasks in the phase complete (or all non-failed tasks complete):
235
+
236
+ 1. Pull all commits from container worktrees to the host phase branch
237
+ 2. Run the full test suite: `cd server && npx vitest run` (or project's test command)
238
+ 3. If tests pass → continue to Step O5c
239
+ 4. If tests fail → report failures, attempt auto-fix (one round), re-run tests
240
+
241
+ ### Step O5c: Auto Review + PR
242
+
243
+ After tests pass:
244
+
245
+ 1. Run auto-review (same checks as Step 10 in Inline Mode)
246
+ 2. If review passes → push branch and create PR (ask user before pushing per project rules)
247
+ 3. If review fails → fix issues, re-run tests, re-review (max 3 iterations)
248
+
206
249
  ### Step O6: Cleanup
207
250
 
208
- When all tasks complete, remove `.tlc/.build-routing-active` and report results.
251
+ After PR is created (or phase completes):
252
+ - Remove `.tlc/.build-routing-active`
253
+ - Remove `.tlc/.active-sessions.json`
254
+ - Mark completed tasks `[x]` in PLAN.md
255
+ - Report final summary
209
256
 
210
257
  ## INLINE MODE
211
258
 
@@ -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
 
@@ -187,6 +187,18 @@ Before reading or writing phase artifacts, normalize the requested phase argumen
187
187
 
188
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
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
+
190
202
  ## CodeDB Acceleration
191
203
 
192
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.
@@ -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.
@@ -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
 
@@ -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
 
@@ -19,7 +19,13 @@ If no phase specified, shows overall test status.
19
19
  - If no manifest exists, fall back to current-repo-only status
20
20
  2. **Detect test framework** (Vitest, Jest, pytest, etc.)
21
21
  3. **Run the test suite**
22
- 4. **Report results** with next action
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
23
29
 
24
30
  When workspace mode is active, include a one-line summary such as:
25
31
 
@@ -44,9 +50,22 @@ Test Status
44
50
  ───────────
45
51
  [TLC] 142 tests | [CORE] 38 tests | [SA] 67 tests
46
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
+
47
58
  Ready for: /tlc:verify in the active repo
48
59
  ```
49
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
+
50
69
  **Some failing:**
51
70
  ```
52
71
  Test Status
@@ -17,6 +17,18 @@ Verify the phase automatically from its plan acceptance criteria, then leave onl
17
17
 
18
18
  If no phase number, auto-detect current phase.
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: 'verify', prompt, project })`
26
+ 3. Report to user: "Dispatched verify 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
  ## Process
21
33
 
22
34
  ### Step 1: Load the Phase Plan
@@ -19,6 +19,18 @@ This is the "I pushed, now babysit CI for me" command.
19
19
  /tlc:watchci 3 # max 3 fix attempts (default: 5)
20
20
  ```
21
21
 
22
+ ## Background Dispatch
23
+
24
+ When the orchestrator is available (`curl -sf http://localhost:3100/health`), dispatch this command to a background agent session instead of running inline.
25
+
26
+ 1. Check orchestrator health
27
+ 2. If available: package the full skill prompt with project context (branch, changed files, current phase) and dispatch via `skill-dispatcher.dispatch({ skill: 'watchci', prompt, project })`
28
+ 3. Report to user: "Dispatched watchci to background session ses_XXXX. Results will appear when complete."
29
+ 4. When session completes, capture result via `skill-dispatcher.captureResult()` and display summary
30
+ 5. If orchestrator unavailable, fall back to inline execution (existing behavior below)
31
+
32
+ Override: `--inline` flag forces inline execution even when orchestrator is available.
33
+
22
34
  ## Process
23
35
 
24
36
  ### Step 1: Find the Active Run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "2.8.0",
3
+ "version": "2.9.1",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc-claude-code": "./bin/install.js",
@@ -1,5 +1,17 @@
1
1
  const fs = require('fs/promises');
2
2
 
3
+ const ACTIONABLE_MONITOR_STATES = new Map([
4
+ ['stuck', { suggestedAction: 'retry' }],
5
+ ['budget_exhausted', { suggestedAction: 'retry' }],
6
+ ]);
7
+
8
+ const FAILURE_MONITOR_STATES = new Map([
9
+ ['crashed', 'session crashed and needs investigation'],
10
+ ['errored', 'session errored and needs investigation'],
11
+ ['loop_detected', 'session entered a loop and needs investigation'],
12
+ ['timed_out', 'session timed out and needs investigation'],
13
+ ]);
14
+
3
15
  async function readActiveSessions(activeSessionsPath) {
4
16
  try {
5
17
  const raw = await fs.readFile(activeSessionsPath, 'utf8');
@@ -18,6 +30,19 @@ async function writeActiveSessions(activeSessionsPath, sessions) {
18
30
  await fs.writeFile(activeSessionsPath, JSON.stringify(sessions, null, 2));
19
31
  }
20
32
 
33
+ function getNormalizedStatus(payload) {
34
+ if (!payload || typeof payload !== 'object') {
35
+ return null;
36
+ }
37
+
38
+ const monitorState = payload.monitorState
39
+ || payload.monitor?.state
40
+ || payload.metadata?.monitorState
41
+ || null;
42
+
43
+ return String(monitorState || payload.status || '').trim().toLowerCase() || null;
44
+ }
45
+
21
46
  async function checkCompletions({
22
47
  activeSessionsPath,
23
48
  orchestratorUrl,
@@ -28,12 +53,14 @@ async function checkCompletions({
28
53
  return {
29
54
  completions: [],
30
55
  failures: [],
56
+ actionable: [],
31
57
  stillRunning: 0,
32
58
  };
33
59
  }
34
60
 
35
61
  const completions = [];
36
62
  const failures = [];
63
+ const actionable = [];
37
64
  const remainingSessions = [];
38
65
 
39
66
  let orchestratorReachable = true;
@@ -51,13 +78,14 @@ async function checkCompletions({
51
78
  }
52
79
 
53
80
  const payload = await response.json();
81
+ const status = getNormalizedStatus(payload);
54
82
 
55
- if (payload.status === 'completed') {
83
+ if (status === 'completed') {
56
84
  completions.push(session);
57
85
  continue;
58
86
  }
59
87
 
60
- if (payload.status === 'failed') {
88
+ if (status === 'failed') {
61
89
  failures.push({
62
90
  ...session,
63
91
  ...(payload.reason ? { reason: payload.reason } : {}),
@@ -65,6 +93,26 @@ async function checkCompletions({
65
93
  continue;
66
94
  }
67
95
 
96
+ if (ACTIONABLE_MONITOR_STATES.has(status)) {
97
+ actionable.push({
98
+ ...session,
99
+ status,
100
+ actionable: true,
101
+ suggestedAction: ACTIONABLE_MONITOR_STATES.get(status).suggestedAction,
102
+ });
103
+ continue;
104
+ }
105
+
106
+ if (FAILURE_MONITOR_STATES.has(status)) {
107
+ failures.push({
108
+ ...session,
109
+ status,
110
+ actionable: false,
111
+ failureReason: FAILURE_MONITOR_STATES.get(status),
112
+ });
113
+ continue;
114
+ }
115
+
68
116
  remainingSessions.push(session);
69
117
  } catch (error) {
70
118
  if (!orchestratorReachable) {
@@ -82,6 +130,7 @@ async function checkCompletions({
82
130
  return {
83
131
  completions: [],
84
132
  failures: [],
133
+ actionable: [],
85
134
  stillRunning: -1,
86
135
  error: 'orchestrator unreachable',
87
136
  };
@@ -92,6 +141,7 @@ async function checkCompletions({
92
141
  return {
93
142
  completions,
94
143
  failures,
144
+ actionable,
95
145
  stillRunning: remainingSessions.length,
96
146
  };
97
147
  }