uctm 1.5.2 → 1.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uctm",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Universal Claude Task Manager — SDD-based task pipeline subagent system for Claude Code CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "bin/",
11
11
  "lib/",
12
12
  "agents/",
13
+ "references/",
13
14
  ".agent/",
14
15
  ".claude-plugin/",
15
16
  "skills/"
@@ -0,0 +1,200 @@
1
+ # Agent Flow — Main Claude Orchestration Guide
2
+
3
+ > **All agent invocations are performed by Main Claude.**
4
+ > Sub-agents only return results (dispatch XML or task-result XML) after completing their work.
5
+ > Main Claude receives return values and invokes the next agent.
6
+
7
+ ---
8
+
9
+ ## Pipeline Flow
10
+
11
+ ```
12
+ [] tag detected → invoke specifier
13
+
14
+ Check specifier return value
15
+
16
+ ├─ Assumed (direct) → specifier creates Requirement.md + PLAN.md + TASK-00
17
+ │ → returns builder dispatch XML
18
+ │ → execute § direct procedure
19
+
20
+ └─ Delegated (pipeline/full) → specifier creates Requirement.md only
21
+ → returns planner dispatch XML
22
+ → execute § planner-driven procedure
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Direct Mode (Specifier Assumes Planner)
28
+
29
+ ```
30
+ 1. Invoke specifier → creates Requirement.md + PLAN.md + TASK-00 + returns builder dispatch XML
31
+ 2. ⛔ STOP — Present summary to user and WAIT for approval (do NOT invoke builder)
32
+ 3. Invoke builder (dispatch XML as prompt) — includes self-check
33
+ 4. Invoke verifier+committer (builder result as prompt) — verify then commit in one spawn
34
+ ```
35
+
36
+ > Verifier+Committer combined: single spawn performs verification, then creates result.md and git commit.
37
+
38
+ ---
39
+
40
+ ## Pipeline Mode (Separate Planner Invocation)
41
+
42
+ ```
43
+ 1. Invoke specifier+planner (single spawn) → creates Requirement.md + PLAN.md + TASK-NN + determines execution-mode
44
+ 2. ⛔ STOP — Present Requirement.md + PLAN.md + TASK list and WAIT for approval
45
+ 3. For each TASK (ascending order):
46
+ a. Invoke builder (per-TASK dispatch XML as prompt)
47
+ b. Invoke verifier+committer (builder result as prompt) — verify then commit in one spawn
48
+ c. If incomplete TASKs remain, continue to next TASK
49
+ ```
50
+
51
+ > Specifier+Planner combined: specifier.md role first (Requirement.md), then planner.md role (PLAN.md + TASKs) in one spawn.
52
+ > Each TASK must complete the full builder → verifier+committer cycle before the next TASK starts.
53
+
54
+ ---
55
+
56
+ ## Full Mode (With Scheduler)
57
+
58
+ ```
59
+ 1. Invoke specifier+planner (single spawn) → Requirement.md + PLAN.md + TASKs + execution-mode: full
60
+ 2. ⛔ STOP — Present Requirement.md + PLAN.md + TASK list and WAIT for approval
61
+ 3. Invoke scheduler → DAG analysis + READY TASK + returns builder dispatch XML
62
+ 4. Invoke builder (dispatch XML as prompt) → implementation
63
+ 5. Invoke verifier+committer (builder result as prompt) → verify then commit in one spawn
64
+ 6. If incomplete TASKs remain, return to step 3
65
+ ```
66
+
67
+ Parallel execution: When scheduler returns multiple READY TASKs, invoke builders concurrently.
68
+
69
+ ---
70
+
71
+ ## Resuming Existing WORK
72
+
73
+ Resume pipeline for a WORK that already has PLAN.md + TASKs:
74
+
75
+ ```
76
+ 1. Read last line of works/{WORK_ID}/work_{WORK_ID}.log to determine current state
77
+ Key rule: *_START = interrupted (redo that step), *_DONE = completed (move to next)
78
+
79
+ - COMMITTER_DONE — TASK-NN → TASK-NN completed, resume from next TASK
80
+ - COMMITTER_START — TASK-NN → interrupted, redo verifier+committer for TASK-NN
81
+ - VERIFIER_DONE — TASK-NN → verified, resume with committer for TASK-NN
82
+ - VERIFIER_START — TASK-NN → interrupted, redo verifier+committer for TASK-NN
83
+ - BUILDER_DONE — TASK-NN → built, resume with verifier+committer for TASK-NN
84
+ - BUILDER_START — TASK-NN → interrupted, redo builder for TASK-NN
85
+ - PLANNER_DONE → planning done, start first TASK
86
+ - PLANNER_START → interrupted, redo specifier+planner
87
+ - SPECIFIER_DONE → specifier done, redo planner
88
+ - SPECIFIER_START → interrupted, redo specifier+planner
89
+ - No log file → start from scratch
90
+
91
+ 2. For each remaining TASK:
92
+ a. Invoke builder → implementation
93
+ b. Invoke verifier+committer → verify then commit in one spawn
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Combined Agent Invocation
99
+
100
+ ### Specifier+Planner (single spawn)
101
+
102
+ - Model: opus
103
+ - Prompt: "Role 1 — Specifier (specifier.md): create Requirement.md. Role 2 — Planner (planner.md): create PLAN.md + TASKs. Execute sequentially. Each role sends its own START/DONE callback + activity log."
104
+ - Returns: Requirement.md + PLAN.md + TASK files + execution-mode
105
+
106
+ ### Verifier+Committer (single spawn)
107
+
108
+ - Model: haiku
109
+ - Prompt: "Role 1 — Verifier (verifier.md): verify build/lint/test. Role 2 — Committer (committer.md): create result.md + git commit. If verification FAILS, skip Role 2. Each role sends its own START/DONE callback + activity log."
110
+ - On PASS: verification result + commit hash
111
+ - On FAIL: verification failure only (no commit)
112
+
113
+ ---
114
+
115
+ ## Agent Role Summary
116
+
117
+ | Agent | Role | Model | Combined With |
118
+ |-------|------|-------|---------------|
119
+ | specifier | Requirement analysis | opus | + planner (pipeline/full) |
120
+ | planner | PLAN + TASK decomposition | opus | combined into specifier spawn |
121
+ | scheduler | DAG management + dispatch | haiku | standalone |
122
+ | builder | Code implementation | sonnet | standalone |
123
+ | verifier | Build/lint/test verification | haiku | + committer |
124
+ | committer | Result report + git commit | haiku | combined into verifier spawn |
125
+
126
+ ---
127
+
128
+ ## Sub-agent Spawn Count by Mode
129
+
130
+ | Mode | Spec+Plan | Scheduler | Builder | Veri+Commit | Total |
131
+ |------|:---------:|:---------:|:-------:|:-----------:|:-----:|
132
+ | direct | 1 (assumed) | — | 1 | 1 | **3** |
133
+ | pipeline (N TASKs) | 1 (combined) | — | N | N | **1 + 2N** |
134
+ | full (N TASKs) | 1 (combined) | 1 | N | N | **2 + 2N** |
135
+
136
+ **Before vs After (6 TASKs):**
137
+
138
+ | | Before | After | Reduction |
139
+ |---|:---:|:---:|:---:|
140
+ | Spawns | 2 + 3×6 = 20 | 2 + 2×6 = 14 | **-30%** |
141
+
142
+ ---
143
+
144
+ ## Approval Gates (CRITICAL)
145
+
146
+ > **MUST STOP and wait for explicit user approval before invoking the next agent.**
147
+ > Do NOT proceed until the user says "approve", "승인", "proceed", "go ahead", or equivalent.
148
+ > The only exception is auto mode — when the user's original message contains "auto" or "자동으로".
149
+
150
+ | Mode | Approvals | Timing | What to show user |
151
+ |------|:---------:|--------|-------------------|
152
+ | direct | 1 | After Specifier completes | Requirement.md + PLAN.md + TASK-00.md summary |
153
+ | pipeline/full | 1 | After Specifier+Planner completes | Requirement.md + PLAN.md + TASK list |
154
+ | auto-approve | 0 | — | Skip all approval gates |
155
+
156
+ > Note: pipeline/full now has **1 approval** (not 2), since specifier and planner run in one spawn.
157
+
158
+ **How to request approval:**
159
+ 1. Present a summary of what the specifier+planner created (files, scope, execution-mode)
160
+ 2. Ask: "Proceed?" or equivalent
161
+ 3. **WAIT for user response** — do NOT invoke builder until approved
162
+
163
+ ---
164
+
165
+ ## References Directory Passing (REQUIRED)
166
+
167
+ Main Claude MUST pass the references directory path to every sub-agent invocation.
168
+ This allows sub-agents to locate their reference files regardless of installation method (npm or plugin).
169
+
170
+ **How to pass:**
171
+ - Prepend `REFERENCES_DIR={absolute_path}` at the top of the prompt for every Task tool call
172
+ - For npm installations: use `.claude/references` (default, resolved from project root)
173
+ - For plugin installations: derive from the skill's "Base directory" (`{base_dir}/../../references`)
174
+
175
+ **Example:**
176
+ ```
177
+ REFERENCES_DIR=C:/Users/me/.claude/plugins/cache/uc-taskmanager/abc123/references
178
+
179
+ <dispatch to="builder" ...>
180
+ ...
181
+ </dispatch>
182
+ ```
183
+
184
+ If REFERENCES_DIR is not available (e.g., npm installation without plugin), sub-agents fall back to `.claude/references/`.
185
+
186
+ ---
187
+
188
+ ## Context Handoff (Sliding Window)
189
+
190
+ | Distance | Level | Content |
191
+ |----------|-------|---------|
192
+ | Previous | FULL | what + why + caution + incomplete |
193
+ | 2 steps back | SUMMARY | what 1-2 lines |
194
+ | 3+ steps | DROP | Not passed |
195
+
196
+ ---
197
+
198
+ ## Reference Loading
199
+
200
+ Each sub-agent reads its own reference files from `{REFERENCES_DIR}/` at startup. Main Claude does NOT read reference files — only `agent-flow.md`.
@@ -0,0 +1,93 @@
1
+ # Context Handoff Policy
2
+
3
+ Sliding window context transfer rules between agents.
4
+
5
+ ## Sliding Window
6
+
7
+ | Step Distance | Detail Level | Rule |
8
+ |---------------|-------------|------|
9
+ | Immediate (1 step) | `FULL` | All 4 fields transmitted |
10
+ | 2 steps back | `SUMMARY` | `what` field only, 1-3 lines |
11
+ | 3+ steps back | `DROP` | Omitted |
12
+
13
+ ## Context-Handoff 4 Fields
14
+
15
+ | Field | FULL | SUMMARY | Content |
16
+ |-------|:----:|:-------:|---------|
17
+ | `what` | ✅ | ✅ | Summary of changes/verification (2-5 lines) |
18
+ | `why` | ✅ | ❌ | Decision rationale (2-4 lines) |
19
+ | `caution` | ✅ | ❌ | Caveats, conditional completion (1-3 lines) |
20
+ | `incomplete` | ✅ | ❌ | Incomplete items (1-2 lines, "None" if empty) |
21
+
22
+ ## Pipeline Stage Input/Output
23
+
24
+ ### Builder
25
+
26
+ Input: TASK spec + dependent TASK result.md context-handoff (sliding window)
27
+
28
+ Output:
29
+ ```xml
30
+ <task-result status="PASS|FAIL">
31
+ <context-handoff from="builder" detail-level="FULL">
32
+ <what>Changes made</what><why>Rationale</why><caution>Caveats</caution><incomplete>Incomplete items</incomplete>
33
+ </context-handoff>
34
+ </task-result>
35
+ ```
36
+
37
+ ### Verifier
38
+
39
+ Input: TASK spec + Builder context-handoff (FULL)
40
+
41
+ Output:
42
+ ```xml
43
+ <task-result status="PASS|FAIL">
44
+ <context-handoff from="verifier" detail-level="FULL">
45
+ <what>Verification results</what><why>Judgment rationale</why><caution>Manual checks needed</caution><incomplete>Items that could not be verified</incomplete>
46
+ </context-handoff>
47
+ </task-result>
48
+ ```
49
+
50
+ ### Committer
51
+
52
+ Input: Verifier context-handoff (FULL) + Builder context-handoff (SUMMARY)
53
+
54
+ Processing:
55
+ 1. Verify builder completed successfully (check context-handoff status)
56
+ 2. Write result.md + git commit
57
+
58
+ Output: → `{REFERENCES_DIR}/file-content-schema.md` § 4 reference
59
+
60
+ ## Inter-TASK Dependency Transfer
61
+
62
+ - Immediate dependent TASK: context-handoff **FULL** (all 4 fields)
63
+ - 2 steps back: **SUMMARY** (what only)
64
+ - 3+ steps back: **DROP**
65
+
66
+ ## Scheduler Dispatch
67
+
68
+ ```xml
69
+ <!-- Verifier: Builder FULL -->
70
+ <dispatch to="verifier">
71
+ <context-handoff from="builder" detail-level="FULL">...</context-handoff>
72
+ </dispatch>
73
+
74
+ <!-- Committer: Verifier FULL + Builder SUMMARY -->
75
+ <dispatch to="committer">
76
+ <context-handoff from="verifier" detail-level="FULL">...</context-handoff>
77
+ <context-handoff from="builder" detail-level="SUMMARY"><what>...</what></context-handoff>
78
+ </dispatch>
79
+
80
+ <!-- Next TASK Builder: dependency distance applied -->
81
+ <dispatch to="builder" task="TASK-YY">
82
+ <previous-results>
83
+ <context-handoff from="prev-task" task="TASK-XX" detail-level="FULL">...</context-handoff>
84
+ <context-handoff from="prev-prev-task" task="TASK-WW" detail-level="SUMMARY"><what>...</what></context-handoff>
85
+ </previous-results>
86
+ </dispatch>
87
+ ```
88
+
89
+ ## Committer Retry
90
+
91
+ 1. Failure cause: verification FAIL / No files changed
92
+ 2. Re-dispatch to builder
93
+ 3. Maximum 2 retries (3 attempts total). 3 failures → TASK FAILED, pipeline halted
@@ -0,0 +1,198 @@
1
+ # File Content Schema
2
+
3
+ Single source of truth for pipeline artifact file formats.
4
+
5
+ ## COMPLIANCE
6
+
7
+ | Generated File | Reference Section | Violation Consequence |
8
+ |----------------|-------------------|----------------------|
9
+ | `PLAN.md` | § 1 | `parsePlanMd()` parsing failure, scheduler inoperable |
10
+ | `TASK-XX.md` | § 2 | `parseTaskFilename()` DB registration missed |
11
+ | `TASK-XX_result.md` | § 3 | context-handoff missing |
12
+ | `TASK-XX_result.md` (direct) | § 4 | result.md recognition failure |
13
+
14
+ ---
15
+
16
+ ## § 0. Requirement.md
17
+
18
+ Path: `works/{WORK_ID}/Requirement.md`
19
+
20
+ ```markdown
21
+ # Requirement — WORK-NN
22
+
23
+ ## Original Request
24
+ > User's exact input
25
+
26
+ ## Functional Requirements
27
+ - FR-01: ...
28
+ - FR-02: ...
29
+
30
+ ## Non-Functional Requirements
31
+ - NFR-01: ...
32
+
33
+ ## Acceptance Criteria
34
+ - [ ] Verifiable criteria
35
+ ```
36
+
37
+ Created by: Specifier (mandatory for all requests)
38
+
39
+ ---
40
+
41
+ ## § 1. PLAN.md
42
+
43
+ Path: `works/{WORK_ID}/PLAN.md`
44
+
45
+ ```markdown
46
+ # WORK-01: {title}
47
+
48
+ > Created: {YYYY-MM-DD}
49
+ > Requirement: {REQ-XXX | user request text}
50
+ > Execution-Mode: {direct | pipeline | full}
51
+ > Project: {project name}
52
+ > Tech Stack: {stack}
53
+ > Language: {lang_code}
54
+ > Status: PLANNED
55
+
56
+ ## Goal
57
+ {1-2 sentences}
58
+
59
+ ## Task Dependency Graph
60
+ {ASCII diagram}
61
+
62
+ ## Tasks
63
+
64
+ ### TASK-00: {title}
65
+ - **Depends on**: (none)
66
+ - **Scope**: {description}
67
+ - **Files**:
68
+ - `path/to/file` — {description}
69
+
70
+ ### TASK-01: {title}
71
+ - **Depends on**: TASK-00
72
+ ```
73
+
74
+ Title format: `# WORK-NN: title` — `# PLAN WORK-NN:` is prohibited (`parsePlanMd()` error)
75
+
76
+ ---
77
+
78
+ ## § 2. TASK-XX.md
79
+
80
+ Path: `works/{WORK_ID}/TASK-XX.md`
81
+
82
+ > `parseTaskFilename()` regex: `/^TASK-(\d+)\.md$/` — WORK prefix prohibited
83
+
84
+ ```markdown
85
+ # TASK-XX: {title}
86
+
87
+ ## WORK
88
+ {WORK_ID}: {WORK title}
89
+
90
+ ## Dependencies
91
+ - TASK-YY (required)
92
+
93
+ ## Scope
94
+ {description}
95
+
96
+ ## Files
97
+ | Path | Action | Description |
98
+ |------|--------|-------------|
99
+ | `src/file.ts` | CREATE | description |
100
+
101
+ ## Acceptance Criteria
102
+ - [ ] {criterion}
103
+
104
+ ## Verify
105
+ ```bash
106
+ {verification commands}
107
+ ```
108
+ ```
109
+
110
+ ---
111
+
112
+ ## § 3. TASK-XX_result.md (full / pipeline)
113
+
114
+ Path: `works/{WORK_ID}/TASK-XX_result.md`
115
+
116
+ ```markdown
117
+ # TASK-XX Result
118
+
119
+ > WORK: {WORK_ID} — {title}
120
+ > Completed: {YYYY-MM-DD HH:MM}
121
+ > Status: **DONE**
122
+
123
+ {## Summary | ## 요약 | ## サマリー}
124
+ {1-2 lines}
125
+
126
+ {## Completed Checklist | ## 완료 체크리스트 | ## 完了チェックリスト}
127
+ - [x] {item}
128
+
129
+ {## Verification Results | ## 검증 결과 | ## 検証結果}
130
+ - Build: ✅
131
+ - Lint: ✅
132
+ - Tests: ✅ (N passed)
133
+
134
+ {## Files Changed | ## 변경 파일 | ## 変更ファイル}
135
+ ### Created
136
+ - `path` — {description}
137
+
138
+ {## Issues Encountered | ## 발생 이슈 | ## 発生した問題}
139
+ None
140
+
141
+ {## Notes for Subsequent Tasks | ## 후속 TASK 참고사항 | ## 後続タスクへの注記}
142
+ None
143
+
144
+ {## Context Handoff | ## 컨텍스트 핸드오프 | ## コンテキスト引き継ぎ}
145
+
146
+ ### Builder Context (SUMMARY)
147
+ {builder what field 1-3 lines}
148
+
149
+ ### Verifier Context (FULL)
150
+ {verifier context-handoff 4 fields}
151
+ ```
152
+
153
+ | Section | en | ko | ja |
154
+ |---------|----|----|-----|
155
+ | Summary | `## Summary` | `## 요약` | `## サマリー` |
156
+ | Completed Checklist | `## Completed Checklist` | `## 완료 체크리스트` | `## 完了チェックリスト` |
157
+ | Verification Results | `## Verification Results` | `## 검증 결과` | `## 検証結果` |
158
+ | Files Changed | `## Files Changed` | `## 변경 파일` | `## 変更ファイル` |
159
+ | Issues Encountered | `## Issues Encountered` | `## 발생 이슈` | `## 発生した問題` |
160
+ | Notes for Subsequent Tasks | `## Notes for Subsequent Tasks` | `## 후속 TASK 참고사항` | `## 後続タスクへの注記` |
161
+ | Context Handoff | `## Context Handoff` | `## 컨텍스트 핸드오프` | `## コンテキスト引き継ぎ` |
162
+
163
+ ---
164
+
165
+ ## § 4. TASK-XX_result.md (direct mode)
166
+
167
+ ```markdown
168
+ # TASK-00 Result
169
+
170
+ > WORK: WORK-NN — {title}
171
+ > Completed: {YYYY-MM-DD HH:MM}
172
+ > Execution-Mode: direct
173
+ > Status: **DONE**
174
+
175
+ ## Summary
176
+ {1 line}
177
+
178
+ ## Files Changed
179
+ - `{path}` — {description}
180
+
181
+ ## Verification
182
+ - Build: PASS (self-check)
183
+ - Lint: PASS (self-check)
184
+ ```
185
+
186
+ ---
187
+
188
+ ## § 5. File Naming Rules
189
+
190
+ | Type | Format | Created By |
191
+ |------|--------|------------|
192
+ | Requirement | `Requirement.md` | specifier |
193
+ | WORK plan | `PLAN.md` | planner / specifier |
194
+ | TASK plan | `TASK-NN.md` | planner / specifier |
195
+ | TASK result | `TASK-NN_result.md` | committer |
196
+ | Activity log | `work_WORK-NN.log` | all agents (append) |
197
+
198
+ `WORK-NN-TASK-NN.md` format prohibited → `parseTaskFilename()` cannot recognize it.
@@ -0,0 +1,31 @@
1
+ # ref-cache Protocol
2
+
3
+ ## Overview
4
+
5
+ ref-cache is a mechanism to avoid redundant file reads across sub-agent invocations within a pipeline.
6
+ Reference files are passed between agents via `<ref-cache>` XML elements instead of being re-read from disk each time.
7
+
8
+ ## Protocol (4 Steps)
9
+
10
+ 1. **Check** if `<ref-cache>` exists in the received dispatch XML
11
+ 2. For each required reference file:
12
+ - If present in ref-cache → **SKIP file read**, use cached content
13
+ - If absent from ref-cache → Read from `{REFERENCES_DIR}/{filename}.md` and add to ref-cache
14
+ 3. On task completion, include the merged `<ref-cache>` in the returned task-result XML
15
+ 4. **Backward compatibility**: If dispatch contains no `<ref-cache>`, read all reference files normally (existing behavior)
16
+
17
+ ## ref-cache XML Format
18
+
19
+ See `xml-schema.md` § 4 for the full schema.
20
+
21
+ ```xml
22
+ <ref-cache>
23
+ <ref key="file-content-schema">...content...</ref>
24
+ <ref key="shared-prompt-sections">...content...</ref>
25
+ <!-- one <ref> per loaded reference file -->
26
+ </ref-cache>
27
+ ```
28
+
29
+ ## Chain Propagation
30
+
31
+ See `agent-flow.md` § ref-cache Chain Propagation for how ref-cache flows between agents in the pipeline.
@@ -0,0 +1,312 @@
1
+ # Shared Prompt Sections
2
+
3
+ Common reusable sections. Each agent references these via `cache_control` markers.
4
+
5
+ ---
6
+
7
+ ## § 1. Output Language Rule
8
+
9
+ ```
10
+ Priority: PLAN.md > Language: → CLAUDE.md ## Language → en (default)
11
+
12
+ On dispatch: pass resolved language code in <context><language> field
13
+ Section headers (##) are also written in the resolved language (refer to language mapping table)
14
+ ```
15
+
16
+ ---
17
+
18
+ ## § 2. Build and Lint Commands
19
+
20
+ ```bash
21
+ # Auto-detect Build (execute only if script exists)
22
+ if [ -f "package.json" ]; then
23
+ if node -e "const p=JSON.parse(require('fs').readFileSync('package.json','utf8')); process.exit(p.scripts&&p.scripts.build?0:1)" 2>/dev/null; then
24
+ npm run build 2>&1 || bun run build 2>&1 || yarn build 2>&1
25
+ fi
26
+ elif [ -f "Cargo.toml" ]; then
27
+ cargo build 2>&1
28
+ elif [ -f "go.mod" ]; then
29
+ go build ./... 2>&1
30
+ elif [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then
31
+ python -m py_compile $(find . -maxdepth 3 -name "*.py" -not -path "*/venv/*" 2>/dev/null) 2>&1
32
+ elif [ -f "Makefile" ]; then
33
+ make build 2>&1 || make 2>&1
34
+ fi
35
+
36
+ # Auto-detect Lint (execute only if script exists)
37
+ if [ -f "package.json" ]; then
38
+ if node -e "const p=JSON.parse(require('fs').readFileSync('package.json','utf8')); process.exit(p.scripts&&p.scripts.lint?0:1)" 2>/dev/null; then
39
+ npm run lint 2>&1 || bun run lint 2>&1 || true
40
+ fi
41
+ elif [ -f "pyproject.toml" ]; then
42
+ ruff check . 2>&1 || python -m flake8 . 2>&1 || true
43
+ fi
44
+ ```
45
+
46
+ - If build/lint scripts do not exist → **skip (treat as N/A)**.
47
+ - On build/lint failure, always fix before reporting.
48
+
49
+ ---
50
+
51
+ ## § 3. WORK and TASK File Path Patterns
52
+
53
+ ```
54
+ works/{WORK_ID}/
55
+ ├─ Requirement.md # Created by Specifier (mandatory)
56
+ ├─ PLAN.md
57
+ ├─ TASK-00.md # No WORK prefix
58
+ ├─ TASK-00_result.md # Separator: underscore
59
+ └─ TASK-01.md ...
60
+ ```
61
+
62
+ - WORK ID: `WORK-NN` (e.g., `WORK-03`)
63
+ - TASK ID: `TASK-NN` (e.g., `TASK-00`) — WORK prefix must NOT be included
64
+
65
+ ---
66
+
67
+ ## § 4. File System Discovery Scripts
68
+
69
+ ```
70
+ # Find latest WORK with incomplete TASKs
71
+ # Use Glob tool: pattern "works/WORK-*/" → list all WORK directories (sorted)
72
+ # For each WORK (descending), read last line of works/WORK-NN/work_WORK-NN.log
73
+ # - No log file → not started
74
+ # - Last line contains "COMMITTER_DONE" with last TASK number → check if more TASKs remain
75
+ # First WORK that is not fully completed is the active WORK
76
+
77
+ # List all WORKs
78
+ # Use Glob tool: pattern "works/WORK-*/"
79
+
80
+ # WORK/TASK status from activity log (last line)
81
+ # Read last line of works/${WORK_ID}/work_${WORK_ID}.log
82
+ # Format: [timestamp] EVENT — description
83
+ #
84
+ # Key rule: *_START without matching *_DONE = interrupted, must REDO that step
85
+ #
86
+ # COMMITTER_DONE — TASK-NN → TASK-NN completed, next TASK is TASK-(NN+1)
87
+ # COMMITTER_START — TASK-NN → committer interrupted, redo verifier+committer for TASK-NN
88
+ # VERIFIER_DONE — TASK-NN → TASK-NN verified, needs committer
89
+ # VERIFIER_START — TASK-NN → verifier interrupted, redo verifier+committer for TASK-NN
90
+ # BUILDER_DONE — TASK-NN → TASK-NN builder done, needs verifier+committer
91
+ # BUILDER_START — TASK-NN → builder interrupted, redo builder for TASK-NN
92
+ # PLANNER_DONE → planning done, start first TASK
93
+ # PLANNER_START → planner interrupted, redo specifier+planner
94
+ # SPECIFIER_DONE → specifier done, needs planner
95
+ # SPECIFIER_START → specifier interrupted, redo specifier+planner
96
+ # No log file → start from scratch
97
+ ```
98
+
99
+ ---
100
+
101
+ ## § 5. Task Result XML Format
102
+
103
+ ```xml
104
+ <task-result work="{WORK_ID}" task="{TASK_ID}" agent="{agent}" status="{PASS|FAIL}">
105
+ <summary>{1-2 line summary}</summary>
106
+ <files-changed>
107
+ <file action="{created|modified|deleted}" path="{path}">{description}</file>
108
+ </files-changed>
109
+ <verification>
110
+ <check name="{type}" status="{PASS|FAIL|N/A}">{details}</check>
111
+ </verification>
112
+ <notes>{notes for next steps}</notes>
113
+ </task-result>
114
+ ```
115
+
116
+ ---
117
+
118
+ ## § 7. PLAN.md Required Meta-Information — 7 Fields
119
+
120
+ → `{REFERENCES_DIR}/file-content-schema.md` § 1 reference
121
+
122
+ | Field | Required | Description |
123
+ |-------|----------|-------------|
124
+ | `> Created:` | ✅ | YYYY-MM-DD |
125
+ | `> Requirement:` | ✅ | `REQ-XXX` or user request text |
126
+ | `> Execution-Mode:` | ✅ | `direct` / `pipeline` / `full` |
127
+ | `> Project:` | ✅ | Project name |
128
+ | `> Tech Stack:` | ✅ | Detected tech stack |
129
+ | `> Language:` | ✅ | Language code (`ko`, `en`, etc.) |
130
+ | `> Status:` | ✅ | Always starts as `PLANNED` |
131
+
132
+ ---
133
+
134
+ ## § 8. WORK-LIST.md Update Rules
135
+
136
+ File: `works/WORK-LIST.md`
137
+
138
+ **Format:**
139
+ ```
140
+ LAST_WORK_ID: WORK-XX
141
+
142
+ | WORK | 제목 | 상태 | 생성일 | 완료일 |
143
+ |------|------|------|--------|--------|
144
+ | WORK-NN | ... | IN_PROGRESS | YYYY-MM-DD | |
145
+ | WORK-MM | ... | DONE | YYYY-MM-DD | YYYY-MM-DD |
146
+ ```
147
+
148
+ | Status | Meaning | Trigger |
149
+ |--------|---------|---------|
150
+ | `IN_PROGRESS` | WORK is being executed | specifier creates WORK |
151
+ | `DONE` | All TASKs completed, awaiting review/push | committer completes last TASK |
152
+ | `COMPLETED` | Archived to _COMPLETED/ | push merge (Main Claude batch processes all DONE) |
153
+
154
+ Rules:
155
+ - `LAST_WORK_ID` header tracks the highest WORK ID ever created
156
+ - **specifier**: on WORK creation, add IN_PROGRESS row + update `LAST_WORK_ID`
157
+ - **committer**: when last TASK is completed, change `IN_PROGRESS` → `DONE` and fill completion date (do NOT move folder or remove row)
158
+ - **Main Claude** (push procedure): move all DONE WORKs to `works/_COMPLETED/`, remove their rows from WORK-LIST.md
159
+
160
+ ---
161
+
162
+ ## § 9. Locale Detection
163
+
164
+ ```
165
+ 1. Use Grep tool: pattern "Language:\s*[a-z]{2}" path="CLAUDE.md" → extract language code
166
+ 2. If not found, ask user for language
167
+ 3. If not found, auto-detect system locale via Bash:
168
+ - Windows: powershell -c "[CultureInfo]::CurrentCulture.TwoLetterISOLanguageName"
169
+ - Linux/Mac: locale | grep LANG
170
+ - Fallback: "en"
171
+ ```
172
+
173
+ ---
174
+
175
+ ## § 10. Callback & Activity Log
176
+
177
+ ### 10-1. Callback (CE7)
178
+
179
+ Each agent sends START/DONE/FAILED events to the server via CE7 API.
180
+
181
+ **Activation condition:** Only when `CALLBACK_URL` is available. Check in order:
182
+ 1. Dispatch XML `<callback-url>` element (passed from Main Claude)
183
+ 2. Prompt text containing `CALLBACK_URL=...` line
184
+ 3. If neither found → **skip all callbacks**
185
+
186
+ **How to resolve CALLBACK_URL and CALLBACK_TOKEN:**
187
+
188
+ The runner injects callback info directly into the prompt:
189
+ ```
190
+ POST {CALLBACK_URL}
191
+ Authorization: Bearer {CALLBACK_TOKEN}
192
+ ```
193
+ The first agent (specifier) extracts these and passes them via dispatch XML to subsequent agents.
194
+
195
+ **When to send:**
196
+ - **START**: At the very beginning of agent execution (after STARTUP)
197
+ - **DONE**: At the very end, before returning task-result XML
198
+ - **FAILED**: On unrecoverable failure, before returning FAIL task-result
199
+
200
+ **How to send** (single curl command):
201
+ ```bash
202
+ curl -s --connect-timeout 3 --max-time 5 -X POST "$CALLBACK_URL" \
203
+ -H "Authorization: Bearer $CALLBACK_TOKEN" \
204
+ -H "Content-Type: application/json" \
205
+ -d '{"stage":"BUILDER","event":"START","workId":"WORK-09","taskId":"TASK-01"}' \
206
+ 2>/dev/null || true
207
+ ```
208
+
209
+ - `--connect-timeout 3`: 연결 대기 최대 3초
210
+ - `--max-time 5`: 전체 요청 최대 5초
211
+ - `|| true`: 실패해도 agent 실행 계속
212
+
213
+ **Include docs (actual file content, not references):**
214
+ - specifier DONE: `"docs": {"requirementContent": "<Requirement.md content>"}`
215
+ - planner DONE: `"docs": {"planContent": "<PLAN.md content>"}`
216
+ - builder START: `"docs": {"taskContent": "<TASK-NN.md content>"}`
217
+ - committer DONE: `"docs": {"resultContent": "<TASK-NN_result.md content>"}`
218
+
219
+ **Token usage** (DONE event only, optional):
220
+ ```json
221
+ {"inputTokens": 1234, "outputTokens": 567, "cacheCreationTokens": 890, "cacheReadTokens": 456}
222
+ ```
223
+
224
+ Callback failure must NOT block agent execution. Always continue.
225
+
226
+ ### 10-2. Activity Log
227
+
228
+ Each agent records start/end to `works/{WORK_ID}/work_{WORK_ID}.log`.
229
+
230
+ **All WORKs** — no CALLBACK_URL condition.
231
+
232
+ **Timestamp:** Run `date -u +"%Y-%m-%dT%H:%M:%SZ"` via Bash tool to get the real UTC time. Do NOT use dummy/placeholder timestamps.
233
+
234
+ **Format:**
235
+ ```
236
+ [2026-03-30T14:30:00Z] AGENT_EVENT — description
237
+ ```
238
+
239
+ **How to write:** Use Bash `echo "[timestamp] EVENT — description" >> works/{WORK_ID}/work_{WORK_ID}.log`
240
+
241
+ **Required entries per agent (START and DONE only):**
242
+ ```
243
+ [{timestamp}] SPECIFIER_START — WORK-NN specifier started
244
+ [{timestamp}] SPECIFIER_DONE — WORK-NN specifier completed
245
+ [{timestamp}] BUILDER_START — TASK-NN implement
246
+ [{timestamp}] BUILDER_DONE — TASK-NN complete
247
+ [{timestamp}] VERIFIER_START — TASK-NN verification
248
+ [{timestamp}] VERIFIER_DONE — TASK-NN verified
249
+ [{timestamp}] COMMITTER_START — TASK-NN commit
250
+ [{timestamp}] COMMITTER_DONE — TASK-NN committed
251
+ ```
252
+
253
+ Do NOT write INIT, REF, PLAN, DISPATCH or other intermediate entries. Only START and DONE per agent role.
254
+
255
+ ---
256
+
257
+ ## § 11. Project Discovery
258
+
259
+ ```
260
+ # 1. Check CLAUDE.md language setting
261
+ Use Grep tool: pattern "Language:\s*[a-z]{2}" path="CLAUDE.md"
262
+
263
+ # 2. Tech stack (read first 50/30/20/10 lines if file exists)
264
+ Use Read tool: "package.json" (limit=50)
265
+ Use Read tool: "pyproject.toml" (limit=30)
266
+ Use Read tool: "Cargo.toml" (limit=20)
267
+ Use Read tool: "go.mod" (limit=10)
268
+
269
+ # 3. Structure (when needed)
270
+ Use Glob tool: pattern "**/*.{md,json,toml}" (exclude node_modules)
271
+ ```
272
+
273
+ ---
274
+
275
+ ## § 12. Bash Command Rules
276
+
277
+ Bash commands MUST follow these rules for permission compatibility.
278
+
279
+ **MANDATORY:**
280
+ - One simple command per Bash call — NO compound commands (`&&`, `||`, `;`, `|`)
281
+ - NO `cd` — Bash tool cwd is always the project root. Never use `cd dir &&`, `cd dir ;`, or `cd dir` in any form. Use relative paths from project root
282
+ - NO multi-line scripts — split into separate Bash calls
283
+ - NO sub-shell expansions in arguments — e.g., `$(date ...)` inside `printf`
284
+ - Use relative paths from project root (e.g., `works/WORK-01/`) — NO absolute paths
285
+ - Use `git add file`, `git commit -m "msg"` — NO `git -C path` flag
286
+
287
+ **For file operations, prefer dedicated tools over Bash:**
288
+ - Read files → `Read` tool (NOT `cat`)
289
+ - Write/append files → `Write` tool (NOT `echo >>` or `printf >>`)
290
+ - Edit files → `Edit` tool (NOT `sed -i`)
291
+ - Search files → `Grep` tool (NOT `grep`)
292
+ - Find files → `Glob` tool (NOT `find`)
293
+
294
+ **Activity log example:**
295
+ ```
296
+ WRONG: printf '[%s]_%s\n' "$(date ...)" "INIT" >> work.log
297
+ RIGHT: Use Write tool to append a line to the log file
298
+ ```
299
+
300
+ **Git example:**
301
+ ```
302
+ WRONG: cd /path/to/project && git add file && git commit -m "msg"
303
+ RIGHT: git add file (one call)
304
+ git commit -m "msg" (next call)
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Version
310
+
311
+ - Created: 2026-03-10
312
+ - Updated: 2026-03-28
@@ -0,0 +1,26 @@
1
+ # Work Activity Log
2
+
3
+ Records agent start/end events in `works/{WORK_ID}/work_{WORK_ID}.log`.
4
+
5
+ ## Rules
6
+
7
+ 1. **Timestamp**: Run `date -u +"%Y-%m-%dT%H:%M:%SZ"` via Bash to get real UTC time. Never use dummy values.
8
+ 2. **Write method**: Use `Edit` tool to append. Do NOT use Bash for log writes.
9
+ 3. **Entries**: Only START and DONE per agent role. No intermediate stages.
10
+
11
+ ## Format
12
+
13
+ ```
14
+ [YYYY-MM-DDTHH:MM:SSZ] AGENT_EVENT — description
15
+ ```
16
+
17
+ ## Required Entries
18
+
19
+ | Agent | START | DONE |
20
+ |-------|-------|------|
21
+ | specifier | `SPECIFIER_START — WORK-NN specifier started` | `SPECIFIER_DONE — WORK-NN specifier completed` |
22
+ | planner | `PLANNER_START — WORK-NN planner started` | `PLANNER_DONE — WORK-NN planner completed` |
23
+ | scheduler | `SCHEDULER_START — WORK-NN scheduler started` | `SCHEDULER_DONE — WORK-NN scheduler completed` |
24
+ | builder | `BUILDER_START — TASK-NN implement` | `BUILDER_DONE — TASK-NN complete` |
25
+ | verifier | `VERIFIER_START — TASK-NN verification` | `VERIFIER_DONE — TASK-NN verified` |
26
+ | committer | `COMMITTER_START — TASK-NN commit` | `COMMITTER_DONE — TASK-NN committed` |
@@ -0,0 +1,120 @@
1
+ # Agent Communication XML Schema
2
+
3
+ XML communication format definition for uc-taskmanager agents.
4
+
5
+ ---
6
+
7
+ ## 1. Dispatch Format (Dispatcher → Receiver)
8
+
9
+ ```xml
10
+ <dispatch to="{receiver}" work="{WORK_ID}" task="{TASK_ID}" execution-mode="{direct|pipeline|full}">
11
+ <ref-cache> <!-- optional -->
12
+ <ref key="shared-prompt-sections">{file content}</ref>
13
+ <ref key="file-content-schema">{file content}</ref>
14
+ <ref key="xml-schema">{file content}</ref>
15
+ <ref key="context-policy">{file content}</ref>
16
+ <ref key="work-activity-log">{file content}</ref>
17
+ </ref-cache>
18
+ <references-dir>{absolute path to references directory}</references-dir>
19
+ <context>
20
+ <project>{project name}</project>
21
+ <language>{lang_code}</language>
22
+ <plan-file>works/{WORK_ID}/PLAN.md</plan-file>
23
+ </context>
24
+ <task-spec>
25
+ <file>works/{WORK_ID}/TASK-XX.md</file>
26
+ <title>{title}</title>
27
+ <action>{implement|verify|commit|plan|route}</action>
28
+ <description>{optional}</description>
29
+ </task-spec>
30
+ <previous-results>
31
+ <result task="{TASK_ID}" status="{PASS|FAIL|SKIP}">{summary}</result>
32
+ </previous-results>
33
+ <cache-hint sections="{section1},{section2}"/>
34
+ </dispatch>
35
+ ```
36
+
37
+ | Attribute | Value |
38
+ |-----------|-------|
39
+ | `to` | builder, verifier, committer, planner, scheduler, specifier |
40
+ | `task` | `TASK-NN` — WORK prefix must NOT be included |
41
+ | `execution-mode` | direct / pipeline / full (defaults to full if omitted) |
42
+
43
+ ---
44
+
45
+ ## 2. Task Result Format (Receiver → Dispatcher)
46
+
47
+ ```xml
48
+ <task-result work="{WORK_ID}" task="{TASK_ID}" agent="{agent}" status="{PASS|FAIL}">
49
+ <summary>{1-2 line summary}</summary>
50
+ <files-changed>
51
+ <file action="{created|modified|deleted}" path="{path}">{description}</file>
52
+ </files-changed>
53
+ <verification>
54
+ <check name="{type}" status="{PASS|FAIL|N/A}">{output}</check>
55
+ </verification>
56
+ <notes>{notes}</notes>
57
+ <ref-cache> <!-- optional -->
58
+ <ref key="shared-prompt-sections">{file content}</ref>
59
+ <ref key="file-content-schema">{file content}</ref>
60
+ <ref key="xml-schema">{file content}</ref>
61
+ <ref key="context-policy">{file content}</ref>
62
+ <ref key="work-activity-log">{file content}</ref>
63
+ </ref-cache>
64
+ </task-result>
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 3. Context-Handoff Element
70
+
71
+ ```xml
72
+ <context-handoff from="{agent}" detail-level="{FULL|SUMMARY|DROP}">
73
+ <what>{changes/verification details}</what>
74
+ <why>{decision rationale}</why> <!-- FULL only -->
75
+ <caution>{caveats}</caution> <!-- FULL only -->
76
+ <incomplete>{incomplete items}</incomplete> <!-- FULL only -->
77
+ </context-handoff>
78
+ ```
79
+
80
+ | detail-level | Included Fields |
81
+ |:---:|---|
82
+ | `FULL` | what, why, caution, incomplete |
83
+ | `SUMMARY` | what only (1-3 lines) |
84
+ | `DROP` | Element omitted |
85
+
86
+ ---
87
+
88
+ ## 4. ref-cache Element Definition
89
+
90
+ `<ref-cache>` is an optional container element that carries pre-loaded reference file contents within dispatch and task-result XML. When present, receiving agents MUST use these contents instead of reading files from disk.
91
+
92
+ ### Structure
93
+
94
+ ```xml
95
+ <ref-cache>
96
+ <ref key="{filename-without-extension}">{full file content}</ref>
97
+ ...
98
+ </ref-cache>
99
+ ```
100
+
101
+ | Element | Required | Description |
102
+ |---------|----------|-------------|
103
+ | `<ref-cache>` | Optional | Container for cached reference files. Omit entirely if no cache is available. |
104
+ | `<ref key="...">` | — | Individual reference file. `key` is the filename without extension (e.g., `shared-prompt-sections`). |
105
+
106
+ ### Recognized Keys
107
+
108
+ | Key | Corresponding File |
109
+ |-----|--------------------|
110
+ | `shared-prompt-sections` | `{REFERENCES_DIR}/shared-prompt-sections.md` |
111
+ | `file-content-schema` | `{REFERENCES_DIR}/file-content-schema.md` |
112
+ | `xml-schema` | `{REFERENCES_DIR}/xml-schema.md` |
113
+ | `context-policy` | `{REFERENCES_DIR}/context-policy.md` |
114
+ | `work-activity-log` | `{REFERENCES_DIR}/work-activity-log.md` |
115
+
116
+ ### Backward Compatibility
117
+
118
+ - Dispatch or task-result XML without `<ref-cache>` is fully valid — agents fall back to reading files from `REFERENCES_DIR`.
119
+ - Agents that do not yet support ref-cache simply ignore the element and read files normally.
120
+ - Partial ref-cache (only some keys present) is allowed — missing keys are read from disk.