triflux 4.2.3 → 4.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/bin/tfx-doctor.mjs +1 -1
  2. package/bin/tfx-setup.mjs +1 -1
  3. package/bin/triflux.mjs +2 -14
  4. package/hub/server.mjs +3 -2
  5. package/hub/team/native.mjs +58 -47
  6. package/hub/workers/delegator-mcp.mjs +17 -5
  7. package/package.json +62 -62
  8. package/scripts/lib/mcp-filter.mjs +34 -8
  9. package/scripts/setup.mjs +21 -16
  10. package/scripts/tfx-route.sh +14 -8
  11. package/scripts/token-snapshot.mjs +561 -561
  12. package/skills/tfx-auto/SKILL.md +1 -1
  13. package/skills/tfx-codex/SKILL.md +1 -1
  14. package/skills/tfx-gemini/SKILL.md +1 -1
  15. package/skills/tfx-hub/SKILL.md +4 -1
  16. package/skills/tfx-multi/SKILL.md +177 -378
  17. package/skills/tfx-multi/references/agent-wrapper-rules.md +81 -0
  18. package/skills/tfx-multi/references/thorough-pipeline.md +66 -0
  19. package/skills/tfx-workspace/evals/evals.json +79 -0
  20. package/skills/tfx-workspace/iteration-1/benchmark.json +162 -0
  21. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/eval_metadata.json +11 -0
  22. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/grading.json +9 -0
  23. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/outputs/analysis.md +154 -0
  24. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/timing.json +5 -0
  25. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/grading.json +9 -0
  26. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/outputs/analysis.md +126 -0
  27. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/timing.json +5 -0
  28. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/eval_metadata.json +11 -0
  29. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/grading.json +9 -0
  30. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/outputs/analysis.md +119 -0
  31. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/timing.json +5 -0
  32. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/grading.json +9 -0
  33. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/outputs/analysis.md +115 -0
  34. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/timing.json +5 -0
  35. package/skills/tfx-workspace/iteration-1/hub-start-sequence/eval_metadata.json +10 -0
  36. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/grading.json +8 -0
  37. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/outputs/analysis.md +86 -0
  38. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/timing.json +5 -0
  39. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/grading.json +8 -0
  40. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/outputs/analysis.md +81 -0
  41. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/timing.json +5 -0
  42. package/skills/tfx-workspace/iteration-1/multi-team-creation/eval_metadata.json +12 -0
  43. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/grading.json +10 -0
  44. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/outputs/analysis.md +316 -0
  45. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/timing.json +5 -0
  46. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/grading.json +10 -0
  47. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/outputs/analysis.md +352 -0
  48. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/timing.json +5 -0
  49. package/skills/tfx-workspace/iteration-1/review.html +1325 -0
  50. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/eval_metadata.json +12 -0
  51. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/grading.json +10 -0
  52. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/outputs/analysis.md +97 -0
  53. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/timing.json +5 -0
  54. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/grading.json +10 -0
  55. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/outputs/analysis.md +94 -0
  56. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/timing.json +5 -0
  57. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/eval_metadata.json +12 -0
  58. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/grading.json +10 -0
  59. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/outputs/analysis.md +209 -0
  60. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/timing.json +5 -0
  61. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/grading.json +10 -0
  62. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/outputs/analysis.md +193 -0
  63. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/timing.json +5 -0
  64. package/skills/tfx-workspace/iteration-2/benchmark.json +62 -0
  65. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/eval_metadata.json +13 -0
  66. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/grading.json +11 -0
  67. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/outputs/analysis.md +382 -0
  68. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/timing.json +5 -0
  69. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/grading.json +11 -0
  70. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/outputs/analysis.md +333 -0
  71. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/timing.json +5 -0
  72. package/skills/tfx-workspace/iteration-2/review.html +1325 -0
  73. package/skills/tfx-workspace/skill-snapshot/tfx-auto/SKILL.md +217 -0
  74. package/skills/tfx-workspace/skill-snapshot/tfx-auto-codex/SKILL.md +77 -0
  75. package/skills/tfx-workspace/skill-snapshot/tfx-codex/SKILL.md +65 -0
  76. package/skills/tfx-workspace/skill-snapshot/tfx-doctor/SKILL.md +94 -0
  77. package/skills/tfx-workspace/skill-snapshot/tfx-gemini/SKILL.md +82 -0
  78. package/skills/tfx-workspace/skill-snapshot/tfx-hub/SKILL.md +133 -0
  79. package/skills/tfx-workspace/skill-snapshot/tfx-multi/SKILL.md +426 -0
  80. package/skills/tfx-workspace/skill-snapshot/tfx-setup/SKILL.md +101 -0
  81. package/scripts/psmux-steering-prototype.sh +0 -368
@@ -0,0 +1,193 @@
1
+ # Routing Analysis: `/tfx-auto 프론트엔드 리팩터링하고 보안 리뷰도 해줘`
2
+
3
+ ## 1. Mode Selection
4
+
5
+ **Selected mode: AUTO**
6
+
7
+ The input `/tfx-auto 프론트엔드 리팩터링하고 보안 리뷰도 해줘` uses the `tfx-auto` trigger directly with a free-form natural language task description. It does not match any command shortcut keyword (e.g., `implement`, `cleanup`, `analyze`), and it does not use the manual `N:agent_type` prefix syntax.
8
+
9
+ Per the SKILL.md mode table:
10
+
11
+ | Input pattern | Mode | Triage |
12
+ |---|---|---|
13
+ | `/tfx-auto "리팩터링 + UI"` | 자동 (auto) | Codex 분류 → Opus 분해 |
14
+
15
+ This request falls exactly into the **auto mode** pattern.
16
+
17
+ ---
18
+
19
+ ## 2. Triage Trigger
20
+
21
+ Triage **IS triggered** because the mode is auto (not a command shortcut, not manual).
22
+
23
+ The triage proceeds in two steps:
24
+
25
+ ### Step 1 — Codex Classification
26
+ ```
27
+ codex exec --full-auto --skip-git-repo-check
28
+ ```
29
+ Input: `"프론트엔드 리팩터링하고 보안 리뷰도 해줘"`
30
+
31
+ Expected output JSON:
32
+ ```json
33
+ {
34
+ "parts": [
35
+ { "description": "프론트엔드 리팩터링", "agent": "codex" },
36
+ { "description": "보안 리뷰", "agent": "codex" }
37
+ ]
38
+ }
39
+ ```
40
+
41
+ ### Step 2 — Opus Inline Decomposition
42
+ Opus receives the classified parts and decomposes them into a structured subtask graph:
43
+
44
+ ```json
45
+ {
46
+ "graph_type": "INDEPENDENT",
47
+ "subtasks": [
48
+ {
49
+ "id": "st-1",
50
+ "description": "프론트엔드 코드 리팩터링",
51
+ "scope": "frontend source files",
52
+ "agent": "executor",
53
+ "mcp_profile": "implement",
54
+ "depends_on": [],
55
+ "context_output": "refactor-summary",
56
+ "context_input": null
57
+ },
58
+ {
59
+ "id": "st-2",
60
+ "description": "보안 리뷰 수행",
61
+ "scope": "전체 코드베이스 또는 프론트엔드",
62
+ "agent": "security-reviewer",
63
+ "mcp_profile": "review",
64
+ "depends_on": [],
65
+ "context_output": "security-review-report",
66
+ "context_input": null
67
+ }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ The two tasks ("리팩터링" and "보안 리뷰") are **semantically independent**: refactoring does not depend on the security review and vice versa, so `graph_type` resolves to `INDEPENDENT`.
73
+
74
+ If Codex classification fails, Opus performs both classification and decomposition directly (fallback path per SKILL.md §트리아지).
75
+
76
+ ---
77
+
78
+ ## 3. Task Decomposition into Subtasks
79
+
80
+ The request contains two distinct tasks:
81
+
82
+ | # | Description | Agent | MCP Profile |
83
+ |---|---|---|---|
84
+ | st-1 | 프론트엔드 리팩터링 | `executor` | `implement` |
85
+ | st-2 | 보안 리뷰 | `security-reviewer` | `review` |
86
+
87
+ Agent assignments follow the SKILL.md agent mapping table:
88
+ - Refactoring → `executor` → Codex, MCP: `implement`
89
+ - Security review → `security-reviewer` → Codex (review mode), MCP: `review`
90
+
91
+ ---
92
+
93
+ ## 4. Subtask Count >= 2 → Delegation to tfx-multi
94
+
95
+ **Subtask count = 2, which satisfies `>= 2`.**
96
+
97
+ Per SKILL.md §멀티 태스크 라우팅:
98
+
99
+ > 트리아지 결과 서브태스크가 2개 이상이면 tfx-multi Native Teams 모드로 자동 전환한다.
100
+
101
+ The skill **automatically delegates to tfx-multi Phase 3**, skipping tfx-multi's own Phase 2 (triage) since triage has already been completed by tfx-auto.
102
+
103
+ The handoff logic:
104
+ ```
105
+ if subtasks.length >= 2:
106
+ → tfx-multi Phase 3 실행 (트리아지 결과 재사용)
107
+ → TeamCreate → TaskCreate × N → Agent 래퍼 spawn (Phase 3a~3c)
108
+ → Phase 4 결과 수집 → Phase 5 정리
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 5. Exact Sequence of Actions
114
+
115
+ ```
116
+ [Step 1] Mode detection
117
+ Input: "/tfx-auto 프론트엔드 리팩터링하고 보안 리뷰도 해줘"
118
+ → No command shortcut match
119
+ → No N:agent_type prefix
120
+ → Mode = AUTO, triage = ENABLED
121
+
122
+ [Step 2] Triage — Codex classification
123
+ codex exec --full-auto --skip-git-repo-check
124
+ Prompt: "프론트엔드 리팩터링하고 보안 리뷰도 해줘"
125
+ Output: { parts: [ {description: "프론트엔드 리팩터링", agent: "codex"},
126
+ {description: "보안 리뷰", agent: "codex"} ] }
127
+
128
+ [Step 3] Triage — Opus inline decomposition
129
+ Input: classified parts from Step 2
130
+ Output: {
131
+ graph_type: "INDEPENDENT",
132
+ subtasks: [
133
+ { id: "st-1", description: "프론트엔드 리팩터링", agent: "executor",
134
+ mcp_profile: "implement", depends_on: [] },
135
+ { id: "st-2", description: "보안 리뷰", agent: "security-reviewer",
136
+ mcp_profile: "review", depends_on: [] }
137
+ ]
138
+ }
139
+
140
+ [Step 4] Subtask count check
141
+ subtasks.length = 2 → >= 2 condition TRUE
142
+ → Delegate to tfx-multi Phase 3 (skip tfx-multi Phase 2)
143
+
144
+ [Step 5] tfx-multi Phase 3a — TeamCreate
145
+ Create a Native Teams session with the decomposed subtask list
146
+
147
+ [Step 6] tfx-multi Phase 3b — TaskCreate × 2
148
+ Task 1: "프론트엔드 리팩터링" → executor / implement
149
+ Task 2: "보안 리뷰" → security-reviewer / review
150
+
151
+ [Step 7] tfx-multi Phase 3c — Agent wrapper spawn (parallel, INDEPENDENT graph)
152
+ Bash("bash ~/.claude/scripts/tfx-route.sh executor '프론트엔드 리팩터링' implement",
153
+ run_in_background=true)
154
+ Bash("bash ~/.claude/scripts/tfx-route.sh security-reviewer '보안 리뷰' review",
155
+ run_in_background=true)
156
+ Both tasks run concurrently because graph_type = INDEPENDENT (no depends_on).
157
+
158
+ [Step 8] tfx-multi Phase 4 — Result collection
159
+ Await both background tasks.
160
+ Parse exit codes and extract OUTPUT sections.
161
+ On timeout (exit 124): use PARTIAL OUTPUT.
162
+ On failure (exit ≠ 0): Claude fallback → Agent(subagent_type="oh-my-claudecode:executor", model="sonnet")
163
+
164
+ [Step 9] tfx-multi Phase 5 — Cleanup & report
165
+ Produce final report in tfx-auto format:
166
+ ## tfx-auto 완료
167
+ **모드**: auto | **그래프**: INDEPENDENT | **레벨**: 0
168
+ | # | 서브태스크 | Agent | CLI | MCP | 레벨 | 상태 | 시간 |
169
+ |---|---|---|---|---|---|---|---|
170
+ | 1 | 프론트엔드 리팩터링 | executor | codex | implement | 0 | ✓ | Xs |
171
+ | 2 | 보안 리뷰 | security-reviewer | codex | review | 0 | ✓ | Ys |
172
+ ### 워커 1: 프론트엔드 리팩터링
173
+ (리팩터링 결과 요약)
174
+ ### 워커 2: 보안 리뷰
175
+ (보안 리뷰 결과 요약)
176
+ ### Token Savings Report
177
+ (node ~/.claude/scripts/token-snapshot.mjs report {session-id})
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Summary
183
+
184
+ | Item | Value |
185
+ |---|---|
186
+ | Mode | AUTO |
187
+ | Triage triggered | Yes (Codex classification → Opus decomposition) |
188
+ | Graph type | INDEPENDENT |
189
+ | Subtask count | 2 |
190
+ | Delegation to tfx-multi | Yes (Phase 3 entry, skipping Phase 2) |
191
+ | Execution style | Parallel (both tasks run concurrently via run_in_background=true) |
192
+ | st-1 agent/MCP | executor / implement |
193
+ | st-2 agent/MCP | security-reviewer / review |
@@ -0,0 +1,5 @@
1
+ {
2
+ "total_tokens": 17584,
3
+ "duration_ms": 58178,
4
+ "total_duration_seconds": 58.2
5
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "metadata": {
3
+ "skill_name": "tfx-multi-refactored",
4
+ "skill_path": "C:/Users/SSAFY/Desktop/Projects/cli/triflux/skills/tfx-multi",
5
+ "executor_model": "claude-sonnet-4-6",
6
+ "analyzer_model": "claude-opus-4-6",
7
+ "timestamp": "2026-03-19T11:00:00Z",
8
+ "evals_run": [3],
9
+ "runs_per_configuration": 1
10
+ },
11
+ "runs": [
12
+ {
13
+ "eval_id": 3, "eval_name": "multi-team-creation-refactored", "configuration": "with_skill", "run_number": 1,
14
+ "result": {"pass_rate": 1.0, "passed": 6, "failed": 0, "total": 6, "time_seconds": 120.6, "tokens": 23431, "tool_calls": 6, "errors": 0},
15
+ "expectations": [
16
+ {"text": "Creates TeamCreate with tfx- prefix", "passed": true, "evidence": "TeamCreate({ team_name: 'tfx-<hex6>' })"},
17
+ {"text": "Creates 3 TaskCreate calls", "passed": true, "evidence": "3x TaskCreate"},
18
+ {"text": "Spawns 3 Agent wrappers with bypassPermissions", "passed": true, "evidence": "3x Agent({ mode: bypassPermissions })"},
19
+ {"text": "Uses tfx-route.sh inside wrappers", "passed": true, "evidence": "Direct CLI calls forbidden"},
20
+ {"text": "Includes Phase 5 TeamDelete", "passed": true, "evidence": "Always executed"},
21
+ {"text": "References agent-wrapper-rules.md", "passed": true, "evidence": "Provided interrupt protocol + timeout values"}
22
+ ]
23
+ },
24
+ {
25
+ "eval_id": 3, "eval_name": "multi-team-creation-refactored", "configuration": "without_skill", "run_number": 1,
26
+ "result": {"pass_rate": 0.83, "passed": 5, "failed": 1, "total": 6, "time_seconds": 133.1, "tokens": 27382, "tool_calls": 4, "errors": 0},
27
+ "expectations": [
28
+ {"text": "Creates TeamCreate with tfx- prefix", "passed": true, "evidence": "TeamCreate with tfx-<6chars>"},
29
+ {"text": "Creates 3 TaskCreate calls", "passed": true, "evidence": "3x TaskCreate"},
30
+ {"text": "Spawns 3 Agent wrappers with bypassPermissions", "passed": true, "evidence": "bypassPermissions in all"},
31
+ {"text": "Uses tfx-route.sh inside wrappers", "passed": true, "evidence": "Direct CLI prohibited"},
32
+ {"text": "Includes Phase 5 TeamDelete", "passed": true, "evidence": "Mandatory"},
33
+ {"text": "References agent-wrapper-rules.md", "passed": false, "evidence": "OLD has no reference file structure"}
34
+ ]
35
+ }
36
+ ],
37
+ "run_summary": {
38
+ "with_skill": {
39
+ "pass_rate": {"mean": 1.0, "stddev": 0.0, "min": 1.0, "max": 1.0},
40
+ "time_seconds": {"mean": 120.6, "stddev": 0.0, "min": 120.6, "max": 120.6},
41
+ "tokens": {"mean": 23431, "stddev": 0, "min": 23431, "max": 23431}
42
+ },
43
+ "without_skill": {
44
+ "pass_rate": {"mean": 0.83, "stddev": 0.0, "min": 0.83, "max": 0.83},
45
+ "time_seconds": {"mean": 133.1, "stddev": 0.0, "min": 133.1, "max": 133.1},
46
+ "tokens": {"mean": 27382, "stddev": 0, "min": 27382, "max": 27382}
47
+ },
48
+ "delta": {
49
+ "pass_rate": "+0.17",
50
+ "time_seconds": "-12.5",
51
+ "tokens": "-3951"
52
+ }
53
+ },
54
+ "notes": [
55
+ "Refactored version (177 lines + 2 reference files) vs original (426 lines monolith)",
56
+ "Token savings: 3,951 fewer tokens (-14.4%) — the model loads less context upfront",
57
+ "Time savings: 12.5s faster (-9.4%) — despite reading 3 files vs 1",
58
+ "Progressive disclosure works: the model correctly loaded reference files only when relevant",
59
+ "Reference files provided additional value: interrupt protocol details, timeout values, technical reasoning for tfx-route.sh requirement",
60
+ "Core routing accuracy is identical — all 5 functional assertions pass in both versions"
61
+ ]
62
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "eval_id": 3,
3
+ "eval_name": "multi-team-creation-refactored",
4
+ "prompt": "/tfx-multi 인증 리팩터링 + UI 개선 + 보안 리뷰",
5
+ "assertions": [
6
+ "Creates exactly one TeamCreate with tfx- prefix naming",
7
+ "Creates 3 TaskCreate calls (one per subtask)",
8
+ "Spawns 3 Agent wrappers with mode: bypassPermissions",
9
+ "Uses tfx-route.sh inside Agent wrapper (not direct codex/gemini)",
10
+ "Includes Phase 5 cleanup (TeamDelete)",
11
+ "References agent-wrapper-rules.md for detailed rules (new skill only)"
12
+ ]
13
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "expectations": [
3
+ {"text": "Creates exactly one TeamCreate with tfx- prefix naming", "passed": true, "evidence": "TeamCreate({ team_name: 'tfx-<6chars>' })"},
4
+ {"text": "Creates 3 TaskCreate calls (one per subtask)", "passed": true, "evidence": "3x TaskCreate with subject, description, metadata"},
5
+ {"text": "Spawns 3 Agent wrappers with mode: bypassPermissions", "passed": true, "evidence": "mode: bypassPermissions in all Agent calls"},
6
+ {"text": "Uses tfx-route.sh inside Agent wrapper (not direct codex/gemini)", "passed": true, "evidence": "Direct codex exec / gemini -y -p explicitly prohibited"},
7
+ {"text": "Includes Phase 5 cleanup (TeamDelete)", "passed": true, "evidence": "TeamDelete mandatory, 30s wait, force cleanup fallback"},
8
+ {"text": "References agent-wrapper-rules.md for detailed rules", "passed": false, "evidence": "OLD version has all rules inline in SKILL.md (426 lines), no reference file structure"}
9
+ ],
10
+ "summary": {"passed": 5, "failed": 1, "total": 6, "pass_rate": 0.83}
11
+ }
@@ -0,0 +1,382 @@
1
+ # tfx-multi Routing Accuracy Analysis
2
+
3
+ **Input:** `/tfx-multi 인증 리팩터링 + UI 개선 + 보안 리뷰`
4
+ **Skill Definition:** SKILL.md (tfx-multi v3)
5
+ **Analysis Type:** DRY RUN — no commands executed
6
+
7
+ ---
8
+
9
+ ## Phase 0: Preflight Checks
10
+
11
+ The skill specifies that in **auto mode** (no `N:agent` prefix, no `--agents` flag), Phase 0 (preflight) and Phase 2 (triage) run **concurrently in parallel**. Preflight does NOT block Phase 2.
12
+
13
+ The single combined Bash preflight check would be:
14
+
15
+ ```bash
16
+ Bash(
17
+ command: "curl -sf http://127.0.0.1:27888/status >/dev/null && test -f ~/.claude/scripts/tfx-route.sh && echo 'preflight: ok' || echo 'preflight: FAIL'",
18
+ description: "Hub status + tfx-route.sh existence check"
19
+ )
20
+ ```
21
+
22
+ **What is verified:**
23
+ 1. Hub is running and healthy at `http://127.0.0.1:27888/status` (not `/health` alone — `/status` is the required endpoint per policy)
24
+ 2. `~/.claude/scripts/tfx-route.sh` exists on the filesystem
25
+
26
+ **Output policy:** Lead only surfaces a one-line summary (e.g., `preflight: ok (route/hub)`). Individual Bash logs are not surfaced to the user unless preflight fails.
27
+
28
+ **Failure conditions that would be reported:**
29
+ - `tfx-route.sh` missing → advise running `tfx setup`
30
+ - Hub not running or unhealthy → advise starting Hub
31
+ - Required CLI (codex/gemini) not installed → the affected subtask would be reassigned to a claude worker
32
+
33
+ **Timing:** Preflight runs **simultaneously** with Phase 2 triage (Codex classification). Agent spawn begins at Phase 3, which waits for Phase 2 output. If preflight fails, Agent spawn is aborted.
34
+
35
+ ---
36
+
37
+ ## Phase 1: Input Parsing
38
+
39
+ **Raw input string:** `인증 리팩터링 + UI 개선 + 보안 리뷰`
40
+
41
+ **Parsing decision tree:**
42
+
43
+ | Check | Result |
44
+ |-------|--------|
45
+ | Is ARGUMENTS empty/whitespace? | No → proceed |
46
+ | Does input match `N:agent_type`? | No (no colon-separated numeric prefix) |
47
+ | Does input contain `--tmux` or `--psmux`? | No → not mux mode |
48
+ | Does input contain `--agents`? | No → not manual agent-list mode |
49
+ | Does input contain `--thorough`? | No → `--quick` mode (default) |
50
+ | Does input match a control command (`status`, `stop`, `kill`, `attach`, `list`, `send`)? | No → not a control command |
51
+
52
+ **Conclusion:** Input is parsed as **auto mode** with `--quick` (default). The full task string `인증 리팩터링 + UI 개선 + 보안 리뷰` is forwarded to Phase 2 triage.
53
+
54
+ Control commands would have dispatched directly to:
55
+ ```bash
56
+ Bash("node bin/triflux.mjs multi {cmd}")
57
+ ```
58
+ ...but that path is not taken here.
59
+
60
+ ---
61
+
62
+ ## Phase 2: Triage — Decomposition into Subtasks
63
+
64
+ Since this is auto mode, triage follows the **Codex classification → Opus decomposition** path.
65
+
66
+ ### Step 2a: Codex Classification (free, runs in parallel with preflight)
67
+
68
+ ```bash
69
+ Bash(
70
+ command: "codex exec --full-auto --skip-git-repo-check '다음 작업을 분석하고 각 부분에 적합한 agent를 분류하라.\n\n agent 선택:\n - codex: 코드 구현/수정/분석/리뷰/디버깅/설계 (기본값)\n - gemini: 문서/UI/디자인/멀티모달\n - claude: 코드베이스 탐색/테스트 실행/검증 (최후 수단)\n\n 모든 역할은 Codex/Gemini 우선 배정:\n - explore, verifier, test-engineer, qa-tester 포함 전 역할이 Codex/Gemini로 라우팅\n - Codex/Gemini 미설치 시에만 claude-native(sonnet/haiku) fallback\n - claude 타입은 최후 수단으로만 사용\n\n 작업: 인증 리팩터링 + UI 개선 + 보안 리뷰\n\n JSON만 출력:\n { \"parts\": [{ \"description\": \"...\", \"agent\": \"codex|gemini|claude\" }] }'"
71
+ )
72
+ ```
73
+
74
+ **Expected Codex JSON output (predicted):**
75
+ ```json
76
+ {
77
+ "parts": [
78
+ { "description": "인증 리팩터링", "agent": "codex" },
79
+ { "description": "UI 개선", "agent": "gemini" },
80
+ { "description": "보안 리뷰", "agent": "codex" }
81
+ ]
82
+ }
83
+ ```
84
+
85
+ Rationale per skill's agent selection rules:
86
+ - `인증 리팩터링` — code refactoring → **codex** (코드 구현/수정)
87
+ - `UI 개선` — UI/design improvement → **gemini** (UI/디자인/멀티모달)
88
+ - `보안 리뷰` — code review/analysis → **codex** (리뷰/분석)
89
+
90
+ **Fallback:** If Codex classification fails, Opus (the Lead orchestrator) directly classifies and decomposes without the Codex step.
91
+
92
+ ### Step 2b: Inline Decomposition
93
+
94
+ Opus maps the Codex output to the subtasks array:
95
+
96
+ ```
97
+ assignments = [
98
+ { cli: "codex", subtask: "인증 리팩터링", role: "executor" },
99
+ { cli: "gemini", subtask: "UI 개선", role: "designer" },
100
+ { cli: "codex", subtask: "보안 리뷰", role: "reviewer" }
101
+ ]
102
+ ```
103
+
104
+ Role mapping rationale:
105
+ - `인증 리팩터링` → implementation task → role: `executor`
106
+ - `UI 개선` → design/UI improvement → role: `designer`
107
+ - `보안 리뷰` → code review → role: `reviewer`
108
+
109
+ **Note:** `--quick` mode is the default (no `--thorough` flag detected), so **Phase 2.5 (Plan) and Phase 2.6 (PRD) are skipped entirely**. Execution proceeds directly to Phase 3.
110
+
111
+ ---
112
+
113
+ ## Phase 3: Exact Tool Call Parameters
114
+
115
+ ### Step 3a: TeamCreate
116
+
117
+ ```
118
+ TeamCreate({
119
+ team_name: "tfx-" + Date.now().toString(36).slice(-6), // e.g., "tfx-m7x2p1"
120
+ description: "tfx-multi: 인증 리팩터링 + UI 개선 + 보안 리뷰"
121
+ })
122
+ ```
123
+
124
+ `teamName` (e.g., `"tfx-m7x2p1"`) is stored and reused throughout all subsequent calls.
125
+
126
+ ### Step 3b: TaskCreate (one per subtask)
127
+
128
+ **TaskCreate #1 — 인증 리팩터링:**
129
+ ```
130
+ TaskCreate({
131
+ subject: "인증 리팩터링",
132
+ description: "CLI: codex, 역할: executor\n\n인증 관련 코드를 리팩터링하고 구조를 개선한다.",
133
+ metadata: { cli: "codex", role: "executor" }
134
+ })
135
+ → taskId_1 = <created task id>
136
+ → agentName_1 = "codex-worker-1"
137
+ ```
138
+
139
+ **TaskCreate #2 — UI 개선:**
140
+ ```
141
+ TaskCreate({
142
+ subject: "UI 개선",
143
+ description: "CLI: gemini, 역할: designer\n\nUI 컴포넌트 및 사용자 인터페이스를 개선한다.",
144
+ metadata: { cli: "gemini", role: "designer" }
145
+ })
146
+ → taskId_2 = <created task id>
147
+ → agentName_2 = "gemini-worker-1"
148
+ ```
149
+
150
+ **TaskCreate #3 — 보안 리뷰:**
151
+ ```
152
+ TaskCreate({
153
+ subject: "보안 리뷰",
154
+ description: "CLI: codex, 역할: reviewer\n\n코드베이스의 보안 취약점을 검토하고 리뷰한다.",
155
+ metadata: { cli: "codex", role: "reviewer" }
156
+ })
157
+ → taskId_3 = <created task id>
158
+ → agentName_3 = "codex-worker-2"
159
+ ```
160
+
161
+ runQueue after Step 3b:
162
+ ```
163
+ [
164
+ { taskId: taskId_1, agentName: "codex-worker-1", cli: "codex", subtask: "인증 리팩터링", role: "executor" },
165
+ { taskId: taskId_2, agentName: "gemini-worker-1", cli: "gemini", subtask: "UI 개선", role: "designer" },
166
+ { taskId: taskId_3, agentName: "codex-worker-2", cli: "codex", subtask: "보안 리뷰", role: "reviewer" }
167
+ ]
168
+ ```
169
+
170
+ ### Step 3c: Agent Slim Wrapper Spawns (codex and gemini items)
171
+
172
+ All three assignments in this input have `cli` of `"codex"` or `"gemini"`, so **all three go through Step 3c** (slim wrapper Agent spawn). None take the Step 3d (claude direct) path.
173
+
174
+ **Agent #1 — codex-worker-1 (인증 리팩터링):**
175
+ ```
176
+ Agent({
177
+ name: "codex-worker-1",
178
+ team_name: teamName, // e.g., "tfx-m7x2p1"
179
+ mode: "bypassPermissions",
180
+ run_in_background: true,
181
+ prompt: buildSlimWrapperPrompt("codex", {
182
+ subtask: "인증 리팩터링",
183
+ role: "executor",
184
+ teamName: teamName,
185
+ taskId: taskId_1,
186
+ agentName: "codex-worker-1",
187
+ leadName: "team-lead",
188
+ mcp_profile: <resolved mcp_profile>
189
+ })
190
+ })
191
+ ```
192
+
193
+ The slim wrapper prompt (generated by `hub/team/native.mjs:buildSlimWrapperPrompt()`) instructs the agent to:
194
+ 1. `TaskUpdate(taskId_1, status: "in_progress")` — claim
195
+ 2. `SendMessage(to: "team-lead", "작업 시작: codex-worker-1")` — turn boundary
196
+ 3. `Bash(command: "bash ~/.claude/scripts/tfx-route.sh executor '인증 리팩터링' <mcp_profile>", timeout: 1140000)` — execute via tfx-route.sh (1080s + 60s = 1140s = 1,140,000ms; executor role → default timeout)
197
+ 4. `SendMessage(to: "team-lead", "결과: <요약>")` — result boundary
198
+ 5. Await lead feedback; re-execute (Step 3) if directed
199
+ 6. On final completion: `TaskUpdate(taskId_1, status: "completed", metadata: {result: "success"|"failed"})` + `SendMessage`
200
+
201
+ **Agent #2 — gemini-worker-1 (UI 개선):**
202
+ ```
203
+ Agent({
204
+ name: "gemini-worker-1",
205
+ team_name: teamName,
206
+ mode: "bypassPermissions",
207
+ run_in_background: true,
208
+ prompt: buildSlimWrapperPrompt("gemini", {
209
+ subtask: "UI 개선",
210
+ role: "designer",
211
+ teamName: teamName,
212
+ taskId: taskId_2,
213
+ agentName: "gemini-worker-1",
214
+ leadName: "team-lead",
215
+ mcp_profile: <resolved mcp_profile>
216
+ })
217
+ })
218
+ ```
219
+
220
+ Internal slim wrapper execution:
221
+ ```bash
222
+ bash ~/.claude/scripts/tfx-route.sh designer 'UI 개선' <mcp_profile>
223
+ ```
224
+ Timeout: 1140000ms (1080s default + 60s buffer).
225
+
226
+ **Agent #3 — codex-worker-2 (보안 리뷰):**
227
+ ```
228
+ Agent({
229
+ name: "codex-worker-2",
230
+ team_name: teamName,
231
+ mode: "bypassPermissions",
232
+ run_in_background: true,
233
+ prompt: buildSlimWrapperPrompt("codex", {
234
+ subtask: "보안 리뷰",
235
+ role: "reviewer",
236
+ teamName: teamName,
237
+ taskId: taskId_3,
238
+ agentName: "codex-worker-2",
239
+ leadName: "team-lead",
240
+ mcp_profile: <resolved mcp_profile>
241
+ })
242
+ })
243
+ ```
244
+
245
+ Internal slim wrapper execution:
246
+ ```bash
247
+ bash ~/.claude/scripts/tfx-route.sh reviewer '보안 리뷰' <mcp_profile>
248
+ ```
249
+ Timeout: 3660000ms (reviewer role maps to "review" profile → 3600s + 60s buffer = 3,660,000ms).
250
+
251
+ > Note on Bash timeout: `getRouteTimeout(role, mcpProfile)` determines the timeout. The `reviewer` role with a `review`-type profile yields **3600s** (not the default 1080s), resulting in a 3,660,000ms Bash timeout. The `executor` and `designer` roles use the default 1080s, giving 1,140,000ms.
252
+
253
+ ### Step 3d: Claude Direct Agent (not applicable here)
254
+
255
+ No subtasks have `cli == "claude"` in this input. Step 3d is **not executed**.
256
+
257
+ ### Step 3e: User Notification
258
+
259
+ After all three Agent spawns:
260
+ ```
261
+ "팀 '{teamName}' 생성 완료.
262
+ Codex/Gemini 워커가 슬림 래퍼 Agent로 네비게이션에 등록되었습니다.
263
+ Shift+Down으로 다음 워커로 전환 (마지막→리드 wrap). Shift+Tab으로 이전 워커 전환."
264
+ ```
265
+
266
+ ---
267
+
268
+ ## Phase 4: Result Collection
269
+
270
+ Phase 4 runs after all background Agent processes complete (or are awaited by the Lead).
271
+
272
+ **Step 1:** Lead awaits completion signals from all three background Agents.
273
+
274
+ **Step 2:** `team_task_list` is queried as the **single truth source**:
275
+ ```bash
276
+ Bash("node hub/bridge.mjs team-task-list --team tfx-m7x2p1")
277
+ ```
278
+
279
+ **Step 3:** For each task in the list:
280
+ - If `status == "completed"` AND `metadata.result == "failed"` → the task is retried using a Claude fallback worker (Step 3d pattern)
281
+ - If `status == "completed"` AND `metadata.result == "success"` → accepted as done
282
+
283
+ **Step 4:** After any fallback retries, `team-task-list` is queried again to confirm final state.
284
+
285
+ **Step 5:** `send-message` events and `result(task.result)` topic events are used only as **progress observation channels** — they do NOT determine the final outcome. Only `team_task_list` state is authoritative.
286
+
287
+ **Final report (example):**
288
+ ```markdown
289
+ ## tfx-multi 실행 결과
290
+
291
+ | # | Worker | CLI | 작업 | 상태 |
292
+ |---|--------|-----|------|------|
293
+ | 1 | codex-worker-1 | codex | 인증 리팩터링 | completed |
294
+ | 2 | gemini-worker-1 | gemini | UI 개선 | completed |
295
+ | 3 | codex-worker-2 | codex | 보안 리뷰 | completed |
296
+ ```
297
+
298
+ ---
299
+
300
+ ## Phase 5: Cleanup (TeamDelete)
301
+
302
+ Phase 5 is **mandatory** regardless of success or failure. It runs after Phase 4 result collection.
303
+
304
+ **Cleanup sequence:**
305
+
306
+ 1. Wait up to **30 seconds** for all background Agent processes to complete.
307
+ 2. If any Agent is still running after 30s, stop waiting and proceed with cleanup anyway.
308
+ 3. Call TeamDelete:
309
+ ```
310
+ TeamDelete(teamName) // e.g., TeamDelete("tfx-m7x2p1")
311
+ ```
312
+ 4. If TeamDelete fails (active members still present):
313
+ - Call `forceCleanupTeam(teamName)` (force cleanup utility)
314
+ - If that also fails → instruct user to manually run:
315
+ ```bash
316
+ rm -rf ~/.claude/teams/tfx-m7x2p1/ ~/.claude/tasks/tfx-m7x2p1/
317
+ ```
318
+ 5. Output the final summary report (from Phase 4).
319
+
320
+ **Why this is mandatory:** Without TeamDelete, `~/.claude/teams/{teamName}/` persists on disk and the OMC hook continuously detects "team executing," causing an infinite detection loop.
321
+
322
+ ---
323
+
324
+ ## Key Boolean Flags
325
+
326
+ ### `mode: "bypassPermissions"` in Agent calls
327
+
328
+ **YES — included in all three Agent spawns.**
329
+
330
+ The skill explicitly states (Phase 3c):
331
+ > **[필수] `mode: "bypassPermissions"` — 모든 Agent spawn에 반드시 포함한다.**
332
+ > 이 설정이 없으면 워커가 Bash 실행 시 사용자 승인을 요청하여 자동 실행이 중단된다.
333
+ > Codex/Gemini 래퍼, Claude 워커 모두 동일하게 적용한다.
334
+
335
+ All three `Agent({...})` calls in this analysis include `mode: "bypassPermissions"`.
336
+
337
+ ### `tfx-route.sh` usage inside Agent wrappers
338
+
339
+ **YES — all slim wrapper Agents use `tfx-route.sh` exclusively.**
340
+
341
+ The skill explicitly prohibits direct CLI invocation:
342
+ > **[금지] Lead 또는 Agent 래퍼가 `gemini -y -p "..."` 또는 `codex exec "..."`를 직접 호출하면 안 된다.**
343
+
344
+ The required form inside each slim wrapper Agent is:
345
+ ```bash
346
+ bash ~/.claude/scripts/tfx-route.sh {role} '{subtask}' {mcp_profile}
347
+ ```
348
+
349
+ This ensures that model specification (`-m gemini-3.1-pro-preview`), MCP filters, team bridge integration (`TFX_TEAM_*` env vars), Windows-compatible paths, timeouts, and post-processing (token tracking, issue logging) are all properly applied.
350
+
351
+ The three concrete `tfx-route.sh` invocations in this session:
352
+ ```bash
353
+ # codex-worker-1
354
+ bash ~/.claude/scripts/tfx-route.sh executor '인증 리팩터링' <mcp_profile>
355
+
356
+ # gemini-worker-1
357
+ bash ~/.claude/scripts/tfx-route.sh designer 'UI 개선' <mcp_profile>
358
+
359
+ # codex-worker-2
360
+ bash ~/.claude/scripts/tfx-route.sh reviewer '보안 리뷰' <mcp_profile>
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Summary Table
366
+
367
+ | Phase | Action | Key Parameters / Notes |
368
+ |-------|--------|------------------------|
369
+ | 0 | Preflight (parallel with Phase 2) | `curl http://127.0.0.1:27888/status` + `test -f ~/.claude/scripts/tfx-route.sh` |
370
+ | 1 | Input parsed as **auto mode, --quick** | No `N:agent`, no `--tmux`, no `--thorough`, no control command |
371
+ | 2a | Codex classification | Task: `인증 리팩터링 + UI 개선 + 보안 리뷰` → codex / gemini / codex |
372
+ | 2b | Subtask array | 3 items: executor/designer/reviewer |
373
+ | 3a | TeamCreate | `team_name: "tfx-<6chars>"`, `description: "tfx-multi: 인증 리팩터링 + UI 개선 + 보안 리뷰"` |
374
+ | 3b | 3x TaskCreate | subjects: 인증 리팩터링, UI 개선, 보안 리뷰 |
375
+ | 3c | 3x Agent (slim wrapper) | `mode: "bypassPermissions"`, `run_in_background: true`, uses `tfx-route.sh` internally |
376
+ | 3d | 0x Agent (claude direct) | Not applicable — no `cli: "claude"` assignments |
377
+ | 4 | Result collection | `node hub/bridge.mjs team-task-list --team {teamName}` as truth source |
378
+ | 5 | TeamDelete | Mandatory; max 30s wait; force cleanup fallback if needed |
379
+
380
+ ---
381
+
382
+ *Analysis generated by DRY RUN — no commands were executed.*
@@ -0,0 +1,5 @@
1
+ {
2
+ "total_tokens": 27382,
3
+ "duration_ms": 133145,
4
+ "total_duration_seconds": 133.1
5
+ }