uctm 1.0.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.
package/README.md ADDED
@@ -0,0 +1,951 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/Claude_Code-Subagents-6b5ce7?style=for-the-badge&logo=anthropic&logoColor=white" />
3
+ <img src="https://img.shields.io/badge/Language_Agnostic-Any_Stack-27ae60?style=for-the-badge" />
4
+ <img src="https://img.shields.io/badge/License-GPLv3-f5a623?style=for-the-badge" />
5
+ </p>
6
+
7
+ # uc-taskmanager
8
+
9
+ **Universal Claude Task Manager** — A general-purpose task pipeline subagent system for Claude Code CLI.
10
+
11
+ **[한국어 문서 (Korean)](README_KO.md)**
12
+
13
+ ---
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ npm install -g uctm
19
+ cd your-project
20
+ uctm init
21
+ ```
22
+
23
+ Then start Claude Code and use pipeline tags:
24
+
25
+ ```
26
+ claude
27
+ > [new-feature] Add a hello world feature
28
+ ```
29
+
30
+ That's it. The router analyzes your request, plans the work, and executes through isolated subagent pipelines.
31
+
32
+ ---
33
+
34
+ ## Why This Project Exists
35
+
36
+ The pitfalls of **vibe coding** with AI agents are already well known. You hand your brain to the AI, the code gets written, but nothing remains — no requirements, no execution plan, no design rationale. The software you built cannot be maintained because it was never truly *yours* to begin with.
37
+
38
+ **SDD (Specification-Driven Development)** flips the value hierarchy:
39
+
40
+ > Code is no longer the asset.
41
+ > **Requirements → Architecture → Design** — these are the real assets now.
42
+ > Code is just the output.
43
+
44
+ uc-taskmanager was built to solve this. When you provide a requirement as input, the system:
45
+
46
+ 1. **Plans** — creates an execution plan with dependency graphs
47
+ 2. **Decomposes** — breaks the plan into concrete TASKs
48
+ 3. **Executes** — runs each TASK through isolated Claude AI subagents (build → verify → commit)
49
+ 4. **Accumulates** — every requirement, plan, and result is preserved as a traceable artifact
50
+
51
+ Each step runs in an **isolated subagent pipeline**, so your context stays clean and every decision is documented.
52
+
53
+ ### The Bigger Picture
54
+
55
+ This agent is designed to work with an **SDD-based requirement management and automated development system** — a server application that links requirement management → automated development → plans and artifacts. The full system architecture is documented in [`docs/spec_SDD_with_ucagent_requirement.md`](docs/spec_SDD_with_ucagent_requirement.md). Use it as a reference to build your own system tailored to your needs.
56
+
57
+ ### A Note on Language
58
+
59
+ I'm Korean, so you'll find Korean scattered throughout the codebase — all technical documents (design specs, agent prompts, commit messages) are written in Korean. Modern translation tools handle Korean well, so this shouldn't be a barrier. Use your preferred translator and you'll have no trouble understanding the internals.
60
+
61
+ ### What This Took
62
+
63
+ I built this agent and the accompanying SDD requirement management system in roughly **one calendar month — about 2 weeks of actual development time** (8 hours/day). Ideas become reality. The technical and time barriers that once stopped you have fallen. This is the age of AI agents.
64
+
65
+ **Good luck. Build something great.**
66
+
67
+ This project is open source. Use it freely, share your ideas, and let's push this forward together.
68
+
69
+ ---
70
+
71
+ Six subagents work across any project and any language, automatically handling **request routing → task decomposition → dependency management → code implementation → verification → commit**.
72
+
73
+ ```
74
+ "[new-feature] Build a user authentication feature"
75
+ → router decides WORK, planner creates WORK-01 with 5 TASKs, pipeline executes
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Usage
81
+
82
+ ### Trivial Fix (direct mode)
83
+
84
+ ```
85
+ > [bugfix] Fix typo in login error message
86
+ ```
87
+
88
+ Router selects `execution-mode: direct` → handles entirely in its own session. No subagent spawned. Creates WORK-NN directory + PLAN + result.md + commit.
89
+
90
+ ### Quick Task (pipeline mode)
91
+
92
+ ```
93
+ > [bugfix] Fix the login button not responding on mobile
94
+ ```
95
+
96
+ Router selects `execution-mode: pipeline` → creates PLAN, delegates to builder → verifier → committer. Router context stays clean.
97
+
98
+ ### Complex Feature (WORK)
99
+
100
+ #### 1. Create WORK (Planning)
101
+
102
+ ```
103
+ > [new-feature] Build a user authentication feature. Plan it.
104
+ ```
105
+
106
+ The planner analyzes the project and creates WORK-01:
107
+
108
+ ```
109
+ WORK-01: User Authentication
110
+
111
+ WORK-01: TASK-00: Project initialization ← no dependencies
112
+ WORK-01: TASK-01: DB schema design ← TASK-00
113
+ WORK-01: TASK-02: JWT auth API ← TASK-01
114
+ WORK-01: TASK-03: User CRUD ← TASK-02
115
+ WORK-01: TASK-04: Tests + documentation ← TASK-03
116
+
117
+ Do you approve this plan?
118
+ ```
119
+
120
+ #### 2. Execute WORK
121
+
122
+ ```
123
+ > Run WORK-01 pipeline
124
+ ```
125
+
126
+ The scheduler executes WORK-01's TASKs in dependency order.
127
+
128
+ #### 3. Add to Existing WORK
129
+
130
+ If WORK-01 is IN_PROGRESS, the router asks:
131
+ > "WORK-01 (User Authentication) is in progress. Add as a new TASK or create a new WORK?"
132
+
133
+ #### 4. Check Status
134
+
135
+ ```
136
+ > WORK list
137
+ ```
138
+
139
+ ```
140
+ WORK Status
141
+ WORK-01: User Authentication ✅ 5/5 completed
142
+ WORK-02: Payment Integration 🔄 2/4 in progress
143
+ WORK-03: Admin Dashboard ⬜ 0/6 pending
144
+ ```
145
+
146
+ #### 5. Auto Mode / Resume
147
+
148
+ ```
149
+ > Run WORK-02 automatically
150
+ > Resume WORK-02
151
+ ```
152
+
153
+ #### 6. Run a Specific TASK
154
+
155
+ Skip to a specific TASK within a WORK (e.g., retry after a failure):
156
+
157
+ ```
158
+ > Run WORK-02: TASK-02
159
+ ```
160
+
161
+ The scheduler reads the TASK file directly and dispatches builder → verifier → committer.
162
+
163
+ #### 7. Force WORK Creation (Skip Complexity Check)
164
+
165
+ Use the `[new-work]` tag to always create a new WORK regardless of complexity:
166
+
167
+ ```
168
+ > [new-work] Refactor the auth module
169
+ ```
170
+
171
+ #### 8. Handle Failure / Retry
172
+
173
+ If a TASK fails during the pipeline, the scheduler retries up to 3 times automatically.
174
+ If it still fails, you can inspect the result file and retry manually:
175
+
176
+ ```
177
+ > WORK-02: TASK-01 failed. Retry it.
178
+ ```
179
+
180
+ Or fix the issue and re-run:
181
+
182
+ ```
183
+ > Fix the issue in src/auth.ts, then retry WORK-02: TASK-01
184
+ ```
185
+
186
+ #### 9. Add a TASK to an In-Progress WORK
187
+
188
+ ```
189
+ > [enhancement] Add rate limiting to the auth API
190
+ ```
191
+
192
+ If WORK-02 is `IN_PROGRESS`, the router asks:
193
+ > "WORK-02 (Auth Module) is in progress. Add as a new TASK, or create a new WORK?"
194
+
195
+ #### 10. Check Individual TASK Status
196
+
197
+ ```
198
+ > Show WORK-02 progress
199
+ > What's the status of WORK-03: TASK-02?
200
+ ```
201
+
202
+ The scheduler reads `PROGRESS.md` and `result.md` files to report current state.
203
+
204
+ ---
205
+
206
+ ## The `[]` Tag System
207
+
208
+ Prefix your request with a `[]` tag to trigger the pipeline:
209
+
210
+ | Tag | Meaning |
211
+ |-----|---------|
212
+ | `[new-feature]` | New feature |
213
+ | `[enhancement]` | Enhancement |
214
+ | `[bugfix]` | Bug fix |
215
+ | `[new-work]` | Always create new WORK (skip complexity check) |
216
+
217
+ No `[]` tag = handled directly without pipeline.
218
+
219
+ To register this rule in your project, add the following to your `CLAUDE.md`:
220
+
221
+ ```markdown
222
+ ## Agent 호출 규칙
223
+
224
+ `[]` 태그로 시작하는 요청 → router 에이전트 호출 (WORK 파이프라인 시작)
225
+ ```
226
+
227
+ This ensures Claude automatically delegates `[]`-tagged requests to the router agent without manual invocation.
228
+
229
+ ---
230
+
231
+ ## Installation
232
+
233
+ ### npm (Recommended)
234
+
235
+ ```bash
236
+ npm install -g uctm
237
+
238
+ # Per-project (copies agents + config + updates CLAUDE.md)
239
+ cd your-project
240
+ uctm init
241
+
242
+ # Global (copies agents to ~/.claude/agents/)
243
+ uctm init --global
244
+
245
+ # Update agents after upgrading uctm
246
+ uctm update
247
+ ```
248
+
249
+ ### Manual
250
+
251
+ ```bash
252
+ git clone https://github.com/UCJung/uc-taskmanager-claude-agent.git /tmp/uc-tm
253
+ mkdir -p .claude/agents
254
+ cp /tmp/uc-tm/agents/*.md .claude/agents/
255
+ rm -rf /tmp/uc-tm
256
+ git add .claude/agents/ && git commit -m "chore: add uc-taskmanager agents"
257
+ ```
258
+
259
+ ### Verify
260
+
261
+ ```bash
262
+ claude
263
+ > /agents
264
+ # router, planner, scheduler, builder, verifier, committer → confirm all 6
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Concept: Three Execution Modes
270
+
271
+ The **router** analyzes every `[]`-tagged request and selects one of three `execution-mode` values:
272
+
273
+ ```
274
+ User Request
275
+
276
+
277
+ ┌────────┐
278
+ │ router │ ── no [] tag ──▶ handle directly (no pipeline)
279
+ └───┬────┘
280
+ │ [] tag detected
281
+
282
+ Assess complexity → execution-mode
283
+ (reads .agent/router_rule_config.json if present)
284
+
285
+ ├─ direct (no build/test required)
286
+ │ ▼
287
+ │ Router handles everything — no subagent overhead
288
+ │ Creates WORK-NN/PLAN.md + result.md + commit (0 extra sessions)
289
+
290
+ ├─ pipeline (build/test required, single domain, sequential)
291
+ │ ▼
292
+ │ router → builder → verifier → committer
293
+ │ Router creates PLAN, dispatches 3 subagents
294
+
295
+ └─ full (multi-domain / complex DAG / new module / 5+ tasks)
296
+
297
+ router → planner → scheduler → [builder → verifier → committer] × N
298
+ (full planning + multi-task pipeline)
299
+ ```
300
+
301
+ All three modes output to `works/WORK-NN/` and guarantee `result.md` + `COMMITTER DONE` callback.
302
+
303
+ ### WORK (Multi-Task, full mode)
304
+
305
+ A two-level hierarchy for complex features:
306
+
307
+ ```
308
+ WORK (unit of work) A single goal. The unit requested by the user.
309
+ └── TASK (unit of task) An individual execution unit to achieve the WORK.
310
+ └── result Completion proof. Auto-generated after verification.
311
+ ```
312
+
313
+ ### pipeline mode (Single Task, Delegated)
314
+
315
+ Subagent-delegated path for moderate single tasks. Router stays clean.
316
+
317
+ ```
318
+ router → builder(sonnet) → verifier(haiku) → committer(haiku)
319
+ ```
320
+
321
+ ### direct mode (Trivial)
322
+
323
+ Router handles everything in its own context. No subagent sessions spawned.
324
+
325
+ ```
326
+ router: Analyze → Implement → Self-verify → Commit → result.md
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Pipeline
332
+
333
+ ### WORK Pipeline (Complex)
334
+
335
+ ```
336
+ router planner scheduler builder verifier committer
337
+ ┌────────┐ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
338
+ │Request │────▶│Create │────▶│Dependency │────▶│Code │────▶│Build/Test│────▶│Result │
339
+ │Analysis │ │WORK/TASK │ │DAG + Order│ │Implement │ │Verify │ │→ git │
340
+ └────────┘ └─────────┘ └──────────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘
341
+ │ │ │
342
+ └── Retry on fail┘ │
343
+ (max 3 times) │
344
+ Next TASK loop ◀┘
345
+ ```
346
+
347
+ ### pipeline mode (Simple → Delegated)
348
+
349
+ ```
350
+ router builder verifier committer
351
+ ┌────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
352
+ │PLAN │─────▶│Code │────▶│Build/Test│────▶│Result │
353
+ │+TASK │ │Implement │ │Verify │ │→ git │
354
+ └────────┘ └──────────┘ └──────────┘ └──────────┘
355
+ (context clean) (sonnet) (haiku) (haiku)
356
+ ```
357
+
358
+ ### direct mode (Trivial)
359
+
360
+ ```
361
+ router
362
+ ┌──────────────────────────────────────────────────┐
363
+ │ Analyze → Implement → Self-check → Commit → result│
364
+ └──────────────────────────────────────────────────┘
365
+ (no build/test required — no subagent overhead, 0 extra sessions)
366
+ ```
367
+
368
+ ### Agents
369
+
370
+ | Agent | Role | Model | Permission | MCP |
371
+ |-------|------|-------|------------|-----|
372
+ | **router** | `[]` tag detection, execution-mode판정(direct/pipeline/full), PLAN생성, WORK-LIST관리 | **opus** | read + dispatch | Serena(direct 코드수정), sequential-thinking(복잡도판정) |
373
+ | **planner** | Create WORK + decompose TASKs + generate PLAN.md(Execution-Mode:full) + pre-create progress templates | **opus** | read-only | Serena(코드베이스탐색), sequential-thinking(TASK분해) |
374
+ | **scheduler** | Manage DAG for a specific WORK + run pipeline with sliding window context | **haiku** | read + dispatch | — |
375
+ | **builder** | Code implementation + progress.md checkpoint recording | **sonnet** | full access | Serena(심볼단위탐색/편집) |
376
+ | **verifier** | Progress gate (Status=COMPLETED) → build/lint/test verification (read-only) | **haiku** | read + execute | — |
377
+ | **committer** | Gate check (progress.md) → write result.md → git commit → COMMITTER DONE callback | **haiku** | read + write + git | — |
378
+
379
+ ---
380
+
381
+ ## File Structure
382
+
383
+ ```
384
+ works/
385
+ ├── WORK-LIST.md ← Master list of all WORKs (managed by router)
386
+ ├── WORK-01/ ← "User Authentication"
387
+ │ ├── PLAN.md ← Plan + dependency graph
388
+ │ ├── PROGRESS.md ← Progress tracking (auto-updated)
389
+ │ ├── TASK-00.md ← Task specification
390
+ │ ├── TASK-00_progress.md ← Real-time checkpoint (builder writes)
391
+ │ ├── TASK-00_result.md ← Completion report (committer writes)
392
+ │ ├── TASK-01.md
393
+ │ └── ...
394
+ └── WORK-02/
395
+ └── ...
396
+ ```
397
+
398
+ ### File Naming Convention
399
+
400
+ | File | Naming Rule |
401
+ |------|-------------|
402
+ | Task spec | `TASK-NN.md` (no prefix) |
403
+ | Progress checkpoint | `TASK-NN_progress.md` (underscore separator) |
404
+ | Completion report | `TASK-NN_result.md` |
405
+ | Plan | `PLAN.md` |
406
+ | Work progress | `PROGRESS.md` |
407
+
408
+ ### WORK-LIST.md
409
+
410
+ The router maintains `works/WORK-LIST.md` as the master index:
411
+
412
+ | WORK ID | Title | Status | Created |
413
+ |---------|-------|--------|---------|
414
+ | WORK-01 | User Authentication | COMPLETED | 2026-03-01 |
415
+ | WORK-02 | Payment Integration | IN_PROGRESS | 2026-03-05 |
416
+
417
+ | Status | Meaning |
418
+ |--------|---------|
419
+ | `IN_PROGRESS` | TASKs in progress — not yet pushed |
420
+ | `COMPLETED` | All TASKs committed + git push done |
421
+
422
+ - **IN_PROGRESS**: router checks this before creating new WORKs
423
+ - **COMPLETED**: updated at `git push` time — **not by agents**
424
+
425
+ #### git push Procedure
426
+
427
+ When you ask Claude to push (`"push this"`, `"git push"`), Claude handles the full sequence automatically:
428
+
429
+ ```
430
+ 1. Open works/WORK-LIST.md
431
+ 2. Find all IN_PROGRESS WORKs
432
+ 3. Change status → COMPLETED, update date
433
+ 4. git add works/WORK-LIST.md
434
+ 5. git commit -m "chore: update WORK-LIST — WORK-XX COMPLETED"
435
+ 6. git push
436
+ ```
437
+
438
+ > **Agents (builder / committer / scheduler) never update WORK-LIST to COMPLETED.**
439
+ > COMPLETED is only set at push time. If an agent outputs `🎉 WORK complete!`, that is a status message — not a WORK-LIST update.
440
+
441
+ ---
442
+
443
+ ## Tips
444
+
445
+ ### Keep CLAUDE.md Up to Date
446
+
447
+ The language setting and project context live in `CLAUDE.md`. Agents read this on every invocation — keeping it accurate reduces back-and-forth.
448
+
449
+ ### Use `[]` Tags Consistently
450
+
451
+ Requests without `[]` tags are handled directly by Claude without routing. If you want guaranteed pipeline behavior, always use a tag.
452
+
453
+ ### Parallel TASKs
454
+
455
+ The planner creates dependency-aware TASK graphs. Independent TASKs (same `blockedBy` set) can be dispatched concurrently by the scheduler — mention it when approving:
456
+
457
+ ```
458
+ > Approve. Run independent tasks in parallel.
459
+ ```
460
+
461
+ ### Resume After Context Reset
462
+
463
+ If Claude loses context mid-pipeline, you can always resume:
464
+
465
+ ```
466
+ > Resume WORK-02 from where it stopped
467
+ ```
468
+
469
+ The scheduler reads `PROGRESS.md` to determine the last completed TASK and continues.
470
+
471
+ ---
472
+
473
+ ## Example Session
474
+
475
+ ```
476
+ User: [new-feature] Build a comment feature for the blog system.
477
+
478
+ Claude: [router → WORK path]
479
+ Complexity: 4+ files, DB schema change, multiple modules
480
+ → Creating new WORK
481
+
482
+ Claude: [planner]
483
+ Project analysis
484
+ Tech Stack: Next.js + Prisma + PostgreSQL
485
+ Existing code: Post CRUD done, Auth done
486
+
487
+ WORK-03: Comment Feature
488
+
489
+ WORK-03: TASK-00: Comment model + migration ← no dependencies
490
+ WORK-03: TASK-01: Comment CRUD API ← TASK-00
491
+ WORK-03: TASK-02: Nested comments (self-relation) ← TASK-01
492
+ WORK-03: TASK-03: Frontend comment component ← TASK-00 (parallelizable)
493
+ WORK-03: TASK-04: Integration + notifications ← TASK-02, TASK-03
494
+
495
+ Do you approve?
496
+
497
+ User: Approve. Run automatically.
498
+
499
+ Claude: [scheduler → auto mode]
500
+ WORK-03: TASK-00 → builder → verifier ✅ → committer [a1b2c3d]
501
+ WORK-03: TASK-01 → builder → verifier ✅ → committer [d4e5f6g]
502
+ WORK-03: TASK-02 → builder → verifier ✅ → committer [h7i8j9k]
503
+ WORK-03: TASK-03 → builder → verifier ✅ → committer [l0m1n2o]
504
+ WORK-03: TASK-04 → builder → verifier ✅ → committer [p3q4r5s]
505
+
506
+ 🎉 WORK-03 completed! 5 tasks, 5 commits
507
+ ```
508
+
509
+ ---
510
+
511
+ ## Why This Approach?
512
+
513
+ ### Agent File Design
514
+
515
+ All agent files (`agents/*.md`) are written with a single principle: **core content only, no decoration**. Descriptions, emphasis markers, and redundant examples have been removed. The result is ~1,600 lines total across all agents — less than half the original size — while covering the same functional scope.
516
+
517
+ Each agent file follows a consistent four-section structure:
518
+
519
+ ```
520
+ ## 1. 역할 (Role)
521
+ Agent's purpose and responsibility declaration.
522
+ Single paragraph stating what the agent is and what it owns.
523
+
524
+ ## 2. 수행업무 (Responsibilities)
525
+ Flat table of owned tasks.
526
+ | 업무 (Task) | 설명 (Description) |
527
+
528
+ ## 3. 업무수행단계 및 내용 (Execution Steps)
529
+ Step-by-step procedure for each task listed in § 2.
530
+ Always starts with a STARTUP block listing required files to read on boot.
531
+ References file formats via file-content-schema.md (single source of truth).
532
+ References inter-agent communication via xml-schema.md.
533
+
534
+ ## 4. 제약사항 및 금지사항 (Constraints and Prohibitions)
535
+ Immutable rules the agent must always follow.
536
+ Written as a flat prohibition/constraint list.
537
+ ```
538
+
539
+ `file-content-schema.md` is the single authoritative definition for all file formats (PLAN.md, TASK.md, progress.md, result.md). Agents reference it instead of embedding format specs inline — eliminating duplication across 6 agent files.
540
+
541
+ ### WORK ID Assignment Strategy
542
+
543
+ WORK IDs are assigned based on a **filesystem-first approach**:
544
+
545
+ 1. **Filesystem Source**: The planner scans `works/` directory to find existing WORK directories and determines the next WORK ID based on the latest directory found.
546
+ 2. **MEMORY.md NOT used**: Project memory (MEMORY.md) is never referenced for WORK numbering. Only the filesystem is the authoritative source.
547
+ 3. **Consistency Check**: The router validates WORK ID consistency by checking both the filesystem and WORK-LIST.md before dispatching to the planner.
548
+
549
+ This ensures:
550
+ - No duplicate WORK IDs even if MEMORY.md is stale or corrupted
551
+ - Reliable resumption across sessions
552
+ - Clear traceability: WORK-NN directly corresponds to `works/WORK-NN/`
553
+
554
+ ### Context Isolation
555
+
556
+ Each subagent runs in an independent context. Even if the builder creates 50 files using 20,000 tokens, the scheduler only receives a 3-line summary.
557
+
558
+ ```
559
+ scheduler's context after 5 TASKs:
560
+
561
+ PLAN.md (loaded once) ~500 tokens
562
+ WORK-01: TASK-00 result: "20 files, PASS" ~200 tokens
563
+ WORK-01: TASK-01 result: "15 files, PASS" ~200 tokens
564
+ WORK-01: TASK-02 result: "8 files, PASS" ~200 tokens
565
+ WORK-01: TASK-03 result: "12 files, PASS" ~200 tokens
566
+ WORK-01: TASK-04 result: "5 files, PASS" ~200 tokens
567
+ ────────────────────────────────────────
568
+ Total: ~1,500 tokens (stays flat)
569
+ ```
570
+
571
+ ### Single Session vs uc-taskmanager
572
+
573
+ | | Single Session | uc-taskmanager |
574
+ |---|---|---|
575
+ | Context per TASK | All code + logs stacked | Summary only (~200 tokens) |
576
+ | After 10 TASKs | 50K~100K tokens, quality degrades | ~3K tokens, quality stable |
577
+ | Failure recovery | Start over | Resume from last result file |
578
+ | Tracking | Scroll chat history | File-based (PLAN.md, result.md) |
579
+ | Verification | Manual | Automated (build/lint/test) |
580
+
581
+ ### Router Rule Config (`.agent/router_rule_config.json`)
582
+
583
+ The router reads `.agent/router_rule_config.json` from the project root to determine routing criteria. If the file is absent, the router uses its built-in defaults.
584
+
585
+ **File location:**
586
+ ```
587
+ {project-root}/.agent/router_rule_config.json
588
+ ```
589
+
590
+ **JSON structure:**
591
+ ```json
592
+ {
593
+ "$schema": "http://uc-taskmanager.local/schemas/router-rules/v1.0.json",
594
+ "version": "1.1.0",
595
+ "description": "Router execution-mode decision criteria. Customize per project.",
596
+ "decision_flow": [
597
+ "1. build_test_required? → false → direct",
598
+ "2. single_domain + sequential DAG → pipeline",
599
+ "3. any full_conditions met → full"
600
+ ],
601
+ "rules": {
602
+ "direct": {
603
+ "criteria": {
604
+ "build_test_required": false,
605
+ "note": "File/line count irrelevant. If no build/test needed → direct (text edits, config changes, simple substitutions)"
606
+ }
607
+ },
608
+ "pipeline": {
609
+ "criteria": {
610
+ "build_test_required": true,
611
+ "single_domain_only": true,
612
+ "max_tasks": 5,
613
+ "dag_complexity": "sequential"
614
+ }
615
+ },
616
+ "full": {
617
+ "criteria": {
618
+ "any_of": [
619
+ "task_count > 5",
620
+ "dag_complexity == complex (2+ dependency levels)",
621
+ "multi_domain == true (BE + FE simultaneously)",
622
+ "new_module == true (design → implement → verify multi-phase)",
623
+ "partial_rollback_needed == true"
624
+ ]
625
+ }
626
+ }
627
+ },
628
+ "customization_guide": {
629
+ "doc-heavy projects (md edits)": "Widen direct scope. Most build_test_required=false cases → direct",
630
+ "code-heavy projects": "Center on pipeline/full. Simple bug fixes → pipeline, multi-domain → full",
631
+ "max_tasks tuning": "Adjust pipeline max_tasks between 3–7 based on team size or context limits"
632
+ }
633
+ }
634
+ ```
635
+
636
+ **Key fields:**
637
+ | Field | Description |
638
+ |-------|-------------|
639
+ | `rules.direct.criteria.build_test_required` | `false` → router handles entirely without spawning subagents |
640
+ | `rules.pipeline.criteria.max_tasks` | Max task count before escalating to full (default: 5) |
641
+ | `rules.pipeline.criteria.dag_complexity` | `sequential` only; complex DAG → escalates to full |
642
+ | `rules.full.criteria.any_of` | List of conditions — any match triggers full mode |
643
+
644
+ **Fallback behavior:** If `.agent/router_rule_config.json` is absent or malformed, the router falls back to its built-in defaults (equivalent to the structure above).
645
+
646
+ **Per-project customization example:**
647
+
648
+ For a documentation-heavy project where most changes are text edits:
649
+ ```json
650
+ {
651
+ "rules": {
652
+ "direct": {
653
+ "criteria": { "build_test_required": false }
654
+ },
655
+ "pipeline": {
656
+ "criteria": { "max_tasks": 3, "single_domain_only": true, "dag_complexity": "sequential" }
657
+ }
658
+ }
659
+ }
660
+ ```
661
+
662
+ For a monorepo with strict build requirements:
663
+ ```json
664
+ {
665
+ "rules": {
666
+ "pipeline": {
667
+ "criteria": { "max_tasks": 7 }
668
+ },
669
+ "full": {
670
+ "criteria": {
671
+ "any_of": ["task_count > 7", "multi_domain == true"]
672
+ }
673
+ }
674
+ }
675
+ }
676
+ ```
677
+
678
+ ### Three Execution Modes
679
+
680
+ The router matches effort to complexity via `execution-mode`:
681
+ - **direct**: 1-line typo fix — 0 extra sessions, Router handles everything. Committer session overhead (~12,500 tokens) completely eliminated.
682
+ - **pipeline**: Moderate fix — delegated to builder → verifier → committer, router context stays clean
683
+ - **full**: Complex features — full planning, decomposition, and tracking
684
+
685
+ All three modes output to `works/WORK-NN/` with identical artifact structure (PLAN.md + result.md + COMMITTER DONE callback), ensuring Runner integration works regardless of mode.
686
+
687
+ ### Structured Agent Communication
688
+
689
+ Instead of ambiguous natural language prompts, agents communicate using structured XML format:
690
+
691
+ **Dispatch Format** (Caller → Receiver):
692
+ ```xml
693
+ <dispatch to="builder" work="WORK-03" task="TASK-00" execution-mode="pipeline">
694
+ <context>
695
+ <project>uc-taskmanager</project>
696
+ <language>ko</language>
697
+ <plan-file>works/WORK-03/PLAN.md</plan-file>
698
+ </context>
699
+ <task-spec>
700
+ <file>works/WORK-03/TASK-00.md</file>
701
+ <title>공통 시스템 프롬프트 섹션 식별 및 XML 스키마 설계</title>
702
+ <action>implement</action>
703
+ </task-spec>
704
+ <cache-hint sections="output-language-rule,build-commands"/>
705
+ </dispatch>
706
+ ```
707
+
708
+ **Result Format** (Receiver → Caller):
709
+ ```xml
710
+ <task-result work="WORK-03" task="TASK-00" agent="builder" status="PASS">
711
+ <summary>Created shared-prompt-sections.md and xml-schema.md</summary>
712
+ <files-changed>
713
+ <file action="created" path="agents/shared-prompt-sections.md">Common sections with cache_control</file>
714
+ </files-changed>
715
+ <verification>
716
+ <check name="file_existence" status="PASS">Both files created</check>
717
+ </verification>
718
+ </task-result>
719
+ ```
720
+
721
+ **Benefits**:
722
+ - **Clarity**: Explicit XML structure eliminates ambiguous natural language ("Pass the context" ← confusing vs. `<context>` ← explicit)
723
+ - **Lower Output Tokens**: Agents don't generate clarification questions; receivers parse XML directly
724
+ - **Prompt Caching**: Common sections (Output Language Rule, Build Commands) are marked with Anthropic API `cache_control`, saving up to **90% on repeated tokens**
725
+ - **Scalability**: Cache hit rates improve with WORK count (5 TASKs at ~0.03 tokens/token vs 2K+ tokens without cache)
726
+
727
+ See `agents/xml-schema.md` for complete format, and `agents/shared-prompt-sections.md` for cacheable sections.
728
+
729
+ ### Sliding Window Context Transfer
730
+
731
+ Each subagent starts with an empty context — the cost of isolation. The **sliding window** system minimizes token waste when passing context between agents and across dependent TASKs.
732
+
733
+ **Rule**: the further back, the less detail:
734
+
735
+ | Distance | Detail Level | Content |
736
+ |----------|-------------|---------|
737
+ | Immediate predecessor | `FULL` | what + why + caution + incomplete |
738
+ | 2 steps back | `SUMMARY` | what only (1–3 lines) |
739
+ | 3+ steps back | `DROP` | not transmitted |
740
+
741
+ Each agent outputs a **context-handoff** — a structured reasoning document, not just a result log:
742
+
743
+ ```xml
744
+ <context-handoff from="builder" detail-level="FULL">
745
+ <what>auth.ts modified — added JWT silent refresh logic</what>
746
+ <why>Previous code returned 401 immediately on expiry. Silent refresh improves UX.</why>
747
+ <caution>Coupled to session.ts setSession(). Changes there may cause side effects.</caution>
748
+ <incomplete>Unit tests not written. Verifier should check.</incomplete>
749
+ </context-handoff>
750
+ ```
751
+
752
+ **Result responsibility shift**: builder focuses on implementation only, writing a `progress.md` checkpoint. The **committer** synthesizes builder + verifier context-handoffs into the final `result.md`. This prevents result files from being skipped when builder is context-pressured.
753
+
754
+ **Estimated token savings**: ~48% on a 3-TASK dependency chain vs. the naive approach of passing full results forward.
755
+
756
+ See `docs/spec_sliding-window-context.md` for full design details.
757
+
758
+ ### External System Callback (Optional)
759
+
760
+ uc-taskmanager is generic by default. To integrate with an external system (e.g., a CI/CD backend), add callback URLs to `CLAUDE.md`:
761
+
762
+ ```markdown
763
+ ## Task Callbacks
764
+ TaskCallback: http://localhost:3000/api/v1/runner/{{executionId}}/task-result
765
+ ProgressCallback: http://localhost:3000/api/v1/runner/{{executionId}}/task-progress
766
+ CallbackToken: <your-token>
767
+ ```
768
+
769
+ - **No config** → works as-is, no external calls made
770
+ - **TaskCallback** → committer POSTs result after each TASK commit
771
+ - **ProgressCallback** → builder POSTs checkpoint after each progress.md update
772
+ - Callback failures are non-fatal — a warning is printed and the pipeline continues
773
+
774
+ See `docs/spec_callback-integration.md` for payload schema and implementation guide.
775
+
776
+ ---
777
+
778
+ ## Output Language
779
+
780
+ Output language is resolved from **CLAUDE.md** in your project. No manual configuration needed after first setup.
781
+
782
+ ```
783
+ 1. Check CLAUDE.md for "Language: xx"
784
+ ├─ Found → use that language
785
+ └─ Not found ↓
786
+
787
+ 2. Ask: "Would you like to set the output language? (e.g., ko, en, ja)"
788
+ ├─ User specifies → write to CLAUDE.md + use it
789
+ └─ User declines ↓
790
+
791
+ 3. Auto-detect system locale → write to CLAUDE.md as default
792
+ ```
793
+
794
+ Once set, stored in CLAUDE.md and never asked again. Priority: `PLAN.md > CLAUDE.md > en`
795
+
796
+ By default, **all output** including git commit messages and code comments uses the configured language:
797
+
798
+ | Item | Default | Override |
799
+ |------|---------|----------|
800
+ | PLAN.md / TASK descriptions | Language | — |
801
+ | Result reports | Language | — |
802
+ | Git commit messages (title/body) | Language | `CommitLanguage: en` |
803
+ | Code comments | Language | `CommentLanguage: en` |
804
+ | Commit type prefix (`feat`, `fix`...) | Always English | — |
805
+ | File names, paths, commands | Always English | — |
806
+
807
+ ### Per-Category Override
808
+
809
+ Add to CLAUDE.md to override specific categories:
810
+
811
+ ```markdown
812
+ ## Language
813
+ ko
814
+ CommitLanguage: en
815
+ CommentLanguage: en
816
+ ```
817
+
818
+ This gives you `ko` for plans/reports but `en` for commits and code comments — useful for open-source projects or global teams.
819
+
820
+ ---
821
+
822
+ ## Customization
823
+
824
+ Place a file with the same name in `.claude/agents/` to override.
825
+
826
+ | What | File | Section |
827
+ |------|------|---------|
828
+ | Routing criteria | `router.md` | 3-2. Execution-Mode 결정 |
829
+ | Approval policy | `scheduler.md` | Phase 1: User Approval |
830
+ | Commit message format | `committer.md` | Step 3: Stage + Commit |
831
+ | Verification steps | `verifier.md` | Verification Pipeline |
832
+ | Task granularity | `planner.md` | Task Decomposition Rules |
833
+ | Build/lint commands | `builder.md` + `verifier.md` | Self-Check / Step 1-2 |
834
+ | Output language | `planner.md` | Output Language Rule |
835
+
836
+ ---
837
+
838
+ ## Supported Stacks
839
+
840
+ Auto-detected from project files. No configuration needed.
841
+
842
+ | File | Stack |
843
+ |------|-------|
844
+ | `package.json` | Node.js / TypeScript / React / NestJS / Next.js |
845
+ | `pyproject.toml` / `setup.py` | Python / FastAPI / Django |
846
+ | `Cargo.toml` | Rust |
847
+ | `go.mod` | Go |
848
+ | `build.gradle` / `pom.xml` | Java / Kotlin |
849
+ | `Gemfile` | Ruby |
850
+ | `Makefile` | Generic |
851
+
852
+ ---
853
+
854
+ ## Repository Structure
855
+
856
+ ```
857
+ uc-taskmanager/
858
+ ├── package.json ← npm package config (uctm)
859
+ ├── bin/cli.mjs ← CLI entry point (uctm init/update)
860
+ ├── lib/ ← CLI implementation (constants, init, update)
861
+ ├── README.md ← English (default)
862
+ ├── README_KO.md ← Korean
863
+ ├── CLAUDE.md ← Project-level Claude instructions (push procedure, language, agent call rules)
864
+ ├── LICENSE
865
+ ├── agents/ ← Distribution: copy these to install
866
+ │ ├── router.md ← execution-mode routing (direct/pipeline/full)
867
+ │ ├── planner.md ← Create WORK + decompose TASKs
868
+ │ ├── scheduler.md ← Run pipeline per WORK (sliding window dispatch)
869
+ │ ├── builder.md ← Code implementation + progress.md checkpoint
870
+ │ ├── verifier.md ← Verification based on context-handoff (read-only)
871
+ │ ├── committer.md ← Gate check → result.md → git commit
872
+ │ ├── agent-flow.md ← Main Claude orchestration flow (direct/pipeline/full)
873
+ │ ├── context-policy.md ← Sliding window context transfer policy
874
+ │ ├── xml-schema.md ← Agent communication XML schema
875
+ │ ├── shared-prompt-sections.md ← Cacheable common sections (output language, build commands)
876
+ │ ├── file-content-schema.md ← File format schema (PLAN.md, TASK.md, result.md)
877
+ │ └── work-activity-log.md ← Activity log rules (log_work function, STAGE table)
878
+ ├── .agent/ ← Per-project configuration
879
+ │ └── router_rule_config.json ← Router execution-mode decision criteria
880
+ ├── docs/ ← Design specifications
881
+ │ ├── spec_pipeline-architecture.md ← Pipeline structure & agent roles (v1.2)
882
+ │ ├── spec_pipeline-architecture_v1.1.md ← Pipeline architecture spec v1.1
883
+ │ ├── spec_sliding-window-context.md ← Sliding window context design
884
+ │ ├── spec_callback-integration.md ← External system callback integration
885
+ │ ├── pipeline-architecture-visual.html ← Interactive pipeline visualization
886
+ │ └── sliding-window-context-visual.html ← Interactive sliding window visualization
887
+ ├── _TODO/ ← Pending tasks and experiments
888
+ │ └── bash-cli-pipeline-automation.md ← Server automation via claude -p (verified)
889
+ └── works/ ← WORK directories (auto-generated)
890
+ ├── WORK-LIST.md ← Master index
891
+ ├── WORK-01/ ← all modes output here (direct/pipeline/full)
892
+ └── ...
893
+ ```
894
+
895
+ ---
896
+
897
+ ## Requirements
898
+
899
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code)
900
+ - Git initialized (`git init`)
901
+ - No other dependencies.
902
+
903
+ ---
904
+
905
+ ## Optional: MCP Configuration
906
+
907
+ ### Serena MCP — Symbol-Level Code Navigation
908
+
909
+ Special thanks to the [Oraios](https://github.com/oraios) team for building and open-sourcing [Serena](https://github.com/oraios/serena). Their symbol-level code navigation tools make a real difference in reducing token usage and improving edit precision for AI agents.
910
+
911
+ The **builder** agent integrates with [Serena MCP](https://github.com/oraios/serena) for symbol-level code exploration. When Serena is available, builder follows this exploration hierarchy instead of reading entire files:
912
+
913
+ | Step | Tool | Purpose |
914
+ |------|------|---------|
915
+ | 1 | `list_dir` | Directory structure (replaces `find`) |
916
+ | 2 | `get_symbols_overview` | File symbol map before any file read |
917
+ | 3 | `find_symbol(depth=1)` | Class/module method list |
918
+ | 4 | `find_symbol(include_body=true)` | Precise body read for target symbol only |
919
+ | 5 | `find_referencing_symbols` | Impact analysis before editing |
920
+ | 6 | `Read` | Last resort when above tools are insufficient |
921
+
922
+ This reduces read tokens by 30–50% on large codebases by reading only the symbols needed, not entire files.
923
+
924
+ #### Disable Auto Browser Launch
925
+
926
+ Serena opens a web dashboard in your browser on every startup. To disable this, add `--open-web-dashboard False` to your `~/.claude.json`:
927
+
928
+ ```json
929
+ {
930
+ "mcpServers": {
931
+ "serena": {
932
+ "command": "uvx",
933
+ "args": [
934
+ "--from", "git+https://github.com/oraios/serena",
935
+ "serena", "start-mcp-server",
936
+ "--context", "ide-assistant",
937
+ "--project", ".",
938
+ "--open-web-dashboard", "False"
939
+ ]
940
+ }
941
+ }
942
+ }
943
+ ```
944
+
945
+ The dashboard is still available at `http://localhost:PORT` — it just won't auto-open on startup.
946
+
947
+ ---
948
+
949
+ ## License
950
+
951
+ GPL-3.0