triflux 10.23.0 → 10.25.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.
Files changed (59) hide show
  1. package/README.ko.md +281 -258
  2. package/README.md +277 -442
  3. package/bin/triflux.mjs +96 -4
  4. package/hub/lib/staged-file-detect.mjs +43 -0
  5. package/hub/lib/tfx-route-args.mjs +87 -0
  6. package/hub/team/agent-map.json +2 -0
  7. package/hub/team/backend.mjs +44 -6
  8. package/hub/team/claude-daemon-control.mjs +160 -0
  9. package/hub/team/claude-native-bridge.mjs +574 -0
  10. package/hub/team/claude-session-projection.mjs +65 -0
  11. package/hub/team/cli/commands/start/index.mjs +4 -0
  12. package/hub/team/cli/commands/start/parse-args.mjs +20 -0
  13. package/hub/team/cli/commands/start/start-headless.mjs +12 -0
  14. package/hub/team/headless-bridge-session.mjs +17 -0
  15. package/hub/team/headless.mjs +400 -50
  16. package/hud/constants.mjs +6 -0
  17. package/hud/hud-qos-status.mjs +11 -3
  18. package/hud/renderers.mjs +5 -11
  19. package/package.json +4 -2
  20. package/scripts/__tests__/install-mcp-gateway-startup.test.mjs +343 -0
  21. package/scripts/__tests__/mcp-guard-engine-http-headers.test.mjs +49 -3
  22. package/scripts/__tests__/mcp-guard-engine-policy-sync.test.mjs +203 -0
  23. package/scripts/__tests__/mcp-guard-engine-stdio-sync.test.mjs +171 -0
  24. package/scripts/__tests__/mcp-guard-engine-sync-http-headers.test.mjs +47 -1
  25. package/scripts/__tests__/mcp-guard-engine-watch-http-headers.test.mjs +3 -4
  26. package/scripts/__tests__/mcp-guard-engine.test.mjs +87 -2
  27. package/scripts/__tests__/tfx-route-bash-node-parity.test.mjs +169 -0
  28. package/scripts/__tests__/tfx-route-node-entry.test.mjs +403 -0
  29. package/scripts/__tests__/tfx-route-phase1-modules.test.mjs +268 -0
  30. package/scripts/codex-mcp-gateway-sync.mjs +1 -1
  31. package/scripts/headless-guard.mjs +16 -8
  32. package/scripts/install-mcp-gateway-startup.mjs +501 -0
  33. package/scripts/lib/agent-json.mjs +27 -0
  34. package/scripts/lib/async.mjs +174 -0
  35. package/scripts/lib/cli-agy.mjs +62 -0
  36. package/scripts/lib/cli-claude.mjs +78 -0
  37. package/scripts/lib/cli-codex.mjs +199 -0
  38. package/scripts/lib/cli-gemini.mjs +67 -0
  39. package/scripts/lib/env.mjs +14 -0
  40. package/scripts/lib/hub.mjs +48 -0
  41. package/scripts/lib/mcp-gateway-servers.mjs +70 -0
  42. package/scripts/lib/mcp-guard-engine.mjs +524 -25
  43. package/scripts/lib/mcp-manifest.mjs +2 -2
  44. package/scripts/lib/pid.mjs +63 -0
  45. package/scripts/lib/quota.mjs +47 -0
  46. package/scripts/lib/team.mjs +75 -0
  47. package/scripts/lib/timeout.mjs +66 -0
  48. package/scripts/lib/tmp.mjs +26 -0
  49. package/scripts/lib/toml.mjs +113 -0
  50. package/scripts/mcp-gateway-config.mjs +2 -31
  51. package/scripts/mcp-gateway-ensure.mjs +24 -6
  52. package/scripts/mcp-gateway-start.mjs +16 -59
  53. package/scripts/mcp-safety-guard.mjs +3 -1
  54. package/scripts/preflight-cache.mjs +79 -9
  55. package/scripts/setup.mjs +40 -7
  56. package/scripts/sync-hub-mcp-settings.mjs +353 -28
  57. package/scripts/tfx-route.mjs +289 -0
  58. package/scripts/tfx-route.sh +138 -18
  59. package/CLAUDE.md +0 -175
package/README.ko.md CHANGED
@@ -8,381 +8,404 @@
8
8
  </picture>
9
9
  </p>
10
10
 
11
+ <h3 align="center">Claude Code, Codex, Gemini를 위한 CLI-first 멀티 모델 오케스트레이션</h3>
12
+
11
13
  <p align="center">
12
- <strong>Consensus Intelligence 기반 Tri-CLI 오케스트레이션</strong><br>
13
- <em>Claude + Codex + Gemini 13개 공개 코어 스킬, 11개 호환 alias, 자연어 라우팅, 교차 모델 리뷰.</em>
14
+ 작업 라우팅, 에이전트 조율, 로컬/원격 팀 실행, Codex/Gemini/Claude 실행 경로를<br>
15
+ 감사 가능한 guard 뒤에 묶는 하나의 front door입니다.
14
16
  </p>
15
17
 
16
18
  <p align="center">
17
19
  <a href="https://www.npmjs.com/package/triflux"><img src="https://img.shields.io/npm/v/triflux?style=flat-square&color=FFAF00&label=npm" alt="npm version"></a>
18
20
  <a href="https://www.npmjs.com/package/triflux"><img src="https://img.shields.io/npm/dm/triflux?style=flat-square&color=F5C242" alt="npm downloads"></a>
19
21
  <a href="https://github.com/tellang/triflux/stargazers"><img src="https://img.shields.io/github/stars/tellang/triflux?style=flat-square&color=FFAF00" alt="GitHub stars"></a>
20
- <img src="https://img.shields.io/badge/skills-13_core-F5C242?style=flat-square" alt="13개 코어 스킬">
21
- <sub>+ 11 호환 alias</sub>
22
+ <img src="https://img.shields.io/badge/skill_files-33-F5C242?style=flat-square" alt="33 skill files">
23
+ <sub>deprecated 호환 alias 11개는 전면 표면이 아닙니다</sub>
24
+ <img src="https://img.shields.io/badge/node-%3E%3D18-374151?style=flat-square" alt="Node >= 18">
22
25
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-374151?style=flat-square" alt="License: MIT"></a>
23
26
  </p>
24
27
 
25
28
  <p align="center">
26
- <img alt="triflux 데모" src="docs/assets/demo-multi.gif" width="680">
29
+ <img alt="triflux demo" src="docs/assets/demo-multi.gif" width="680">
27
30
  </p>
28
31
 
29
32
  <p align="center">
30
- <a href="#빠른-시작">빠른 시작</a> ·
31
- <a href="#tri-cli-합의-엔진">Tri-CLI 합의 엔진</a> ·
32
- <a href="#전체-13개-코어-스킬-호환-alias-포함">전체 13개 스킬</a> ·
33
- <a href="#아키텍처">아키텍처</a> ·
34
- <a href="#deep-vs-light">Deep vs Light</a> ·
35
- <a href="#보안">보안</a>
33
+ <a href="#빠른-시작">빠른 시작</a> &middot;
34
+ <a href="#현재-표면">현재 표면</a> &middot;
35
+ <a href="#권장-워크플로우">권장 워크플로우</a> &middot;
36
+ <a href="#아키텍처">아키텍처</a> &middot;
37
+ <a href="#운영">운영</a> &middot;
38
+ <a href="#보안과-guard">보안</a>
36
39
  </p>
37
40
 
38
41
  ---
39
42
 
43
+ ## triflux란?
44
+
45
+ triflux는 **Claude Code plugin + npm CLI**입니다. Claude, Codex, Gemini를
46
+ 오가며 AI 코딩 작업을 라우팅하되, 임의 셸 명령이나 오래된 skill alias가 제어면이
47
+ 되지 않도록 현재 표면을 정리합니다.
48
+
49
+ 현재 설계는 예전 README보다 단순합니다.
50
+
51
+ - **`/tfx-auto`가 Claude Code skill의 표준 front door입니다.** quick/deep/consensus/parallel/retry 동작은 플래그로 표현합니다.
52
+ - **`tfx`는 셸 CLI입니다.** setup, doctor, Hub, MCP, team/swarm, handoff 같은 운영 작업을 담당합니다.
53
+ - **호환 alias는 남아 있지만 전면 API가 아닙니다.** 마이그레이션 표는 [`docs/legacy-skill-aliases.md`](https://github.com/tellang/triflux/blob/main/docs/legacy-skill-aliases.md)로 분리했습니다.
54
+ - **호스트 로컬 Codex harness는 패키지 범위 밖입니다.** 예를 들어 `~/.codex/skills/tfx-harness`는 특정 머신에서 워크플로우를 추천할 수 있지만, 이 저장소/npm/Claude plugin에 포함되지 않습니다.
55
+
56
+ ---
57
+
40
58
  ## 빠른 시작
41
59
 
42
- **Claude Code** (권장) — Claude Code 세션 안에서 실행:
60
+ ### 1. 설치
43
61
 
44
- ```
62
+ Claude Code plugin:
63
+
64
+ ```text
45
65
  /plugin marketplace add tellang/triflux
46
66
  /plugin install triflux@tellang
47
67
  ```
48
68
 
49
- **npm**:
69
+ npm:
50
70
 
51
71
  ```bash
52
72
  npm install -g triflux
53
73
  ```
54
74
 
55
- `tfx setup`으로 환경을 설정하세요.
56
-
57
- ### 사용법
75
+ 터미널에서 setup/doctor를 실행합니다.
58
76
 
59
77
  ```bash
60
- # Deep 기본값 — 3자 합의로 실행
61
- /tfx-research "React 19 Server Actions best practices"
62
- /tfx-review
63
- /tfx-plan "add JWT auth middleware"
64
-
65
- # Quick opt-out — 단일 모델로 빠르게 실행
66
- /tfx-review --quick
67
- /tfx-plan "add JWT auth middleware" --quick
78
+ tfx setup
79
+ tfx doctor
80
+ ```
68
81
 
69
- # Debate 3개의 독립적인 의견을 확보
70
- /tfx-debate "Redis vs PostgreSQL LISTEN/NOTIFY for real-time events"
82
+ 자동화에서는 `tfx doctor --json`을 사용하세요.
71
83
 
72
- # Persistence 또는 단일 진입점에서 직접 호출
73
- /tfx-auto "implement full auth flow with tests" --retry ralph
84
+ ### 2. 현재 권장 front door 사용
74
85
 
75
- # Team Multi-CLI 병렬 오케스트레이션
76
- /tfx-multi "refactor auth + update UI + add tests"
86
+ Claude Code slash skill:
77
87
 
78
- # Remote — setup, spawn, attach, resume를 하나의 표면으로
79
- /tfx-remote setup # 인터랙티브 호스트 설정 위저드 (Tailscale + SSH)
80
- /tfx-remote spawn ultra4 "보안 리뷰 실행" # 원격 호스트에서 세션 실행
88
+ ```text
89
+ /tfx-auto "이 변경 리뷰해줘" --mode consensus
90
+ /tfx-auto "인증 플로우 구현하고 테스트까지" --mode deep --retry ralph
91
+ /tfx-auto "이 PRD를 격리 shard로 나눠 실행" --parallel swarm --mode consensus --isolation worktree
92
+ /tfx-remote spawn ryzen5-7600 "보안 리뷰 실행"
93
+ /tfx-doctor
81
94
  ```
82
95
 
83
- ---
84
-
85
- ## v10.11.0의 새로운 기능
86
-
87
- **triflux v10.11.0**은 **하나의 front door + 플래그 기반 라우팅**으로 정리됩니다. 자연어 입력은 계속 지원되고, Phase 3/4에서 legacy 표면은 `tfx-auto`와 `tfx-remote` 뒤로 접히며, 기존 스킬명은 thin alias로 계속 동작합니다.
96
+ 셸 CLI:
88
97
 
89
- ### v10.11.0 주요 특징
98
+ ```bash
99
+ tfx list
100
+ tfx hub ensure
101
+ tfx mcp list
102
+ tfx handoff --target remote --output .omx/handoff.md
103
+ tfx swarm preflight docs/prd/example.md --json
104
+ tfx codex-team "auth 리팩터링 + 테스트 추가"
105
+ ```
90
106
 
91
- - **자연어 라우팅** "리뷰해줘"라고 말하면 `/tfx-review`가 자동 호출. 기본은 Deep이고 `--quick`으로 빠른 경로를 명시
92
- - **교차 모델 리뷰** Claude가 작성하면 Codex가 리뷰, Codex가 작성하면 Claude 리뷰. 동일 모델 self-approve 차단. 커밋 전 미검증 파일 nudge
93
- - **정확한 카탈로그** 33개 스킬 파일 기준 `13 public core + 11 compatibility alias + 9 internal helper`
94
- - **Phase 3** — `--retry ralph`, `--retry auto-escalate`, `--lead codex`, `--max-iterations N`, 4단계 `DEFAULT_ESCALATION_CHAIN`
95
- - **Phase 4** — `tfx-auto --shape debate|panel|consensus`, `tfx-remote` 단일 진입점, `tfx-psmux-rules`는 `.claude/rules/tfx-psmux.md`로 이동
96
- - **하위 호환성 유지** — `tfx-persist`, `tfx-debate`, `tfx-multi`, `tfx-remote-spawn` 같은 기존 이름은 thin alias로 계속 지원
107
+ > deep, consensus, team, swarm 경로는 관련 CLI와 터미널 multiplexer가 필요합니다.
108
+ > 먼저 `tfx doctor`를 실행하면 Codex/Gemini/Claude, psmux/tmux, Hub, MCP,
109
+ > profile, stale skill 문제를 번에 확인할 있습니다.
97
110
 
98
- ### v8 기반 (계속 유지)
111
+ ---
99
112
 
100
- - **Tri-Debate Engine** — 3개 CLI가 독립 분석 후 Anti-Herding, 교차 검증, 합의 점수 산출
101
- - **Deep/Light 변형** — 모든 기능에 토큰 효율적인 Light 모드와 정밀한 Deep 모드를 제공
102
- - **Consensus Gate** — Deep 스킬은 3개 CLI 중 2개 이상의 동의 요구
103
- - **Expert Panel** — `tfx-panel`을 통한 가상 전문가 시뮬레이션
104
- - **Hub IPC** Named Pipe 및 HTTP MCP 브리지를 활용한 상주형 Hub 서버
105
- - **psmux / Windows 네이티브** — `tmux`(WSL)와 `psmux`(Windows Terminal) 하이브리드 지원
113
+ ## 현재 표면
114
+
115
+ ### 명령
116
+
117
+ `tfx` CLI의 주요 명령은 다음과 같습니다.
118
+
119
+ | 명령 | 용도 |
120
+ | --- | --- |
121
+ | `tfx setup` | scripts, HUD, hooks, MCP, profile 동기화. `--dry-run` 지원. |
122
+ | `tfx doctor` | 설치 상태 진단/복구. `--fix`, `--reset`, `--diagnose`, `--json` 지원. |
123
+ | `tfx mcp` | MCP registry 대상을 `list`, `sync`, `add`, `remove`. |
124
+ | `tfx hub` | 로컬 MCP 메시지 버스 시작/중지/보장/상태 확인. |
125
+ | `tfx list` | 설치된 package/user skill 목록. |
126
+ | `tfx handoff` | 현재 컨텍스트를 로컬/원격 이어받기 프롬프트로 직렬화. |
127
+ | `tfx schema` | CLI와 Hub delegator schema 출력. |
128
+ | `tfx multi` | tmux/psmux + Hub 기반 로컬 multi-agent team 실행. |
129
+ | `tfx swarm` | PRD 기반 worktree 격리 swarm의 plan/preflight/run/list. |
130
+ | `tfx synapse` | swarm registry와 lease 상태 확인. |
131
+ | `tfx codex-team` | Codex lead team mode 편의 wrapper. |
132
+ | `tfx notion-read` | MCP client를 통해 Notion 페이지를 Markdown으로 변환. |
133
+ | `tfx why` | 특정 경로의 마지막 커밋 intent trailer 조회. |
134
+ | `tfx update` | 최신 stable/dev 패키지로 업데이트. |
135
+ | `tfx version` | 버전 정보 출력. |
136
+ | `tfx-profile` | Codex/Gemini profile 관리용 편의 binary. |
137
+
138
+ 정확한 인자 계약은 `tfx schema <command>`로 확인합니다.
139
+
140
+ ### Claude Code skill
141
+
142
+ 패키지에는 **33개 skill 파일**이 들어 있습니다. 크게 나누면 다음과 같습니다.
143
+
144
+ - **표준 진입점**: `tfx-auto`, `tfx-remote`, `tfx-doctor`, `tfx-setup`,
145
+ `tfx-profile`, `tfx-hub`, `tfx-hooks`, `tfx-ship`, `tfx-wt`.
146
+ - **작업 helper**: `tfx-plan`, `tfx-review`, `tfx-qa`, `tfx-research`,
147
+ `tfx-analysis`, `tfx-find`, `tfx-index`, `tfx-interview`, `tfx-prune`,
148
+ `tfx-forge`, `merge-worktree`, `star-prompt`.
149
+ - **deprecated 호환 alias**: 11개 legacy 이름은 전환용 shim입니다. 새 문서와 새 프롬프트에서는 위 표준 진입점을 우선 사용하세요.
150
+
151
+ ### 표준 플래그 맵
152
+
153
+ 대부분의 옛 skill 이름은 이제 명시적인 `tfx-auto` 플래그로 표현할 수 있습니다.
154
+
155
+ | 의도 | 표준 형태 |
156
+ | --- | --- |
157
+ | 빠른 단일 lane 작업 | `/tfx-auto "작업" --mode quick` |
158
+ | 더 깊은 계획/실행/검증 루프 | `/tfx-auto "작업" --mode deep` |
159
+ | 지속 retry 루프 | `/tfx-auto "작업" --retry ralph` |
160
+ | consensus 리뷰 | `/tfx-auto "작업" --mode consensus` |
161
+ | debate 또는 panel 보고 | `/tfx-auto "작업" --mode consensus --shape debate|panel` |
162
+ | 로컬 병렬 작업 | `/tfx-auto "작업" --parallel N --mode deep` 또는 shell `tfx multi ...` |
163
+ | PRD/worktree swarm | `/tfx-auto "작업" --parallel swarm --mode consensus --isolation worktree` 또는 shell `tfx swarm ...` |
164
+ | CLI lane 강제 | `/tfx-auto "작업" --cli codex|gemini|claude` |
165
+
166
+ ### 제어 표면의 경계
167
+
168
+ triflux를 디버그하거나 확장할 때는 아래 표면을 나눠서 봐야 합니다.
169
+
170
+ | 표면 | 기준 위치 | npm/plugin 포함 여부 |
171
+ | --- | --- | --- |
172
+ | 공개 CLI/runtime | `bin/`, `scripts/`, `hub/`, `hooks/`, `skills/` | 포함 |
173
+ | publish mirror | `packages/triflux/` | 포함. root runtime 파일과 일치해야 함 |
174
+ | Claude plugin metadata | `.claude-plugin/` | 포함. npm package 내용을 가리킴 |
175
+ | Codex-local harness 실험 | `~/.codex/skills/*` | 미포함 |
176
+ | legacy alias | `skills/<alias>/` + `docs/legacy-skill-aliases.md` | 포함되지만 deprecated 상태 |
177
+
178
+ 로컬 Codex harness가 workflow를 추천해도 이는 해당 머신의 routing 조언일 뿐입니다.
179
+ 패키지의 계약은 위의 CLI, Claude skill, hook, Hub 표면입니다.
106
180
 
107
181
  ---
108
182
 
109
- ## Tri-CLI 합의 엔진
183
+ ## 권장 워크플로우
110
184
 
111
- <p align="center">
112
- <img src="docs/assets/consensus-flow.svg" alt="Tri-CLI Consensus 플로우" width="680">
113
- </p>
185
+ ### 직접 구현/리뷰
114
186
 
115
- triflux의 핵심 혁신입니다. 단일 모델을 맹신하는 대신, 모든 Deep 스킬은 다음 과정을 거칩니다:
116
-
117
- ```
118
- Phase 1: Independent Analysis (Anti-Herding)
119
- ├─ Claude Opus → Analysis A (격리 실행, 상호 참조 없음)
120
- ├─ Codex CLI → Analysis B (격리 실행, 상호 참조 없음)
121
- └─ Gemini CLI → Analysis C (격리 실행, 상호 참조 없음)
122
-
123
- Phase 2: Cross-Validation
124
- ├─ 3개 소스의 모든 발견 사항을 비교
125
- ├─ 2/3 이상 동의 → CONSENSUS (합의)
126
- └─ 1/3만 동의 → DISPUTED (이의, 해결 필요)
127
-
128
- Phase 3: Resolution (합의율 < 70%일 경우)
129
- ├─ 각 CLI가 반대 의견을 검토
130
- ├─ 근거를 들어 수용 또는 반박
131
- └─ 미해결 → 사용자가 최종 판단
187
+ ```text
188
+ /tfx-auto "실패하는 auth 테스트 고쳐줘" --risk-tier medium
189
+ /tfx-auto "SQL과 trust-boundary 중심으로 PR 리뷰" --mode consensus
132
190
  ```
133
191
 
134
- **결과**: 단일 모델 리뷰 대비 오탐(false positive) 87% 감소 (Calimero 합의 연구 기반).
135
-
136
- Phase 4 이후에는 `tfx-auto`가 하나의 front door 역할을 맡습니다. legacy 스킬명은 그대로 받아들이되, 실제 의미는 플래그로 표현됩니다:
137
-
138
- - `--retry ralph` / `--retry auto-escalate` (Phase 3)
139
- - `--lead codex` / `--no-claude-native` (Phase 3)
140
- - `--shape debate|panel|consensus` (Phase 4)
141
-
142
- ---
143
-
144
- ## 전체 13개 코어 스킬 (호환 alias 포함)
145
-
146
- ### 리서치
192
+ 검증 강도를 명시하려면 `--risk-tier low|medium|high`, 모드를 이미 알고 있으면
193
+ `--mode quick|deep|consensus`를 사용합니다.
147
194
 
148
- | 스킬 | 상태 | 설명 |
149
- |------|------|------|
150
- | `tfx-index` | Core | 프로젝트 인덱싱과 컨텍스트 압축 |
195
+ ### 끝까지 완료 루프
151
196
 
152
- 내부 라우팅 helper: `tfx-research`, `tfx-find`
153
-
154
- ### 분석 및 계획
197
+ ```text
198
+ /tfx-auto "마이그레이션 끝내고 검증까지" --mode deep --retry ralph --max-iterations 10
199
+ ```
155
200
 
156
- | 스킬 | 상태 | 설명 |
157
- |------|------|------|
158
- | _독립 공개 표면 없음_ | — | 분석, 계획, 인터뷰는 내부 helper로 라우팅 |
201
+ `--retry ralph`는 retry state machine과 stuck detector를 사용합니다. 루프 상한이
202
+ 필요하면 `--max-iterations`를 지정하세요.
159
203
 
160
- 내부 라우팅 helper: `tfx-analysis`, `tfx-plan`, `tfx-interview`
204
+ ### consensus/debate/panel 출력
161
205
 
162
- ### 실행
206
+ ```text
207
+ /tfx-auto "Postgres LISTEN/NOTIFY vs Redis Streams" --mode consensus --shape debate
208
+ /tfx-auto "마이그레이션 전략 리뷰" --mode consensus --shape panel
209
+ ```
163
210
 
164
- | 스킬 | 상태 | 설명 |
165
- |------|------|------|
166
- | `tfx-auto` | Core | 플래그 기반 라우팅과 legacy surface folding을 담당하는 통합 CLI 오케스트레이터 |
211
+ 참여 lane은 설정된 Claude/Codex/Gemini입니다. 어떤 lane이 없으면 결과에 partial/degraded 상태가 드러나야 합니다.
167
212
 
168
- 호환 alias: `tfx-autopilot`, `tfx-fullcycle`, `tfx-multi`, `tfx-persist`, `tfx-swarm`
213
+ ### 로컬 또는 PRD swarm
169
214
 
170
- ### 리뷰 및 QA
215
+ ```text
216
+ # 로컬 team mode
217
+ tfx multi "auth 리팩터링 + UI 수정 + 테스트 추가"
171
218
 
172
- | 스킬 | 상태 | 설명 |
173
- |------|------|------|
174
- | _독립 공개 표면 없음_ | — | 리뷰, QA, 정리는 내부 helper로 라우팅 |
219
+ # worktree 격리 PRD swarm
220
+ tfx swarm preflight docs/prd/my-feature.md --json
221
+ tfx swarm run docs/prd/my-feature.md
222
+ ```
175
223
 
176
- 내부 라우팅 helper: `tfx-review`, `tfx-qa`, `tfx-prune`
224
+ swarm은 격리 worktree와 file lease를 사용합니다. 큰 PRD는 실행 전에 preflight로 host,
225
+ CLI profile, lease 충돌을 먼저 확인하세요.
177
226
 
178
- ### 토론 및 의사결정
227
+ ### 원격 세션
179
228
 
180
- | 스킬 | 상태 | 설명 |
181
- |------|------|------|
182
- | _독립 active 표면 없음_ | — | debate, consensus, panel은 이제 `tfx-auto --mode consensus`의 출력 shape로 통합 |
229
+ ```text
230
+ /tfx-remote setup
231
+ /tfx-remote spawn ryzen5-7600 "보안 리뷰 실행"
232
+ /tfx-remote list
233
+ /tfx-remote attach <session>
234
+ /tfx-remote send <session> "수정 계속 진행"
235
+ ```
183
236
 
184
- 호환 alias: `tfx-consensus`, `tfx-debate`, `tfx-panel`
237
+ `tfx-remote`는 setup/spawn/list/attach/send/resume/probe/kill 흐름을 하나로 묶은 Claude skill 표면입니다.
185
238
 
186
- ### 지속 실행 및 라우팅
239
+ ### 컨텍스트 저장/이어받기
187
240
 
188
- | 스킬 | 상태 | 설명 |
189
- |------|------|------|
190
- | `tfx-hooks` | Core | Claude Code hook priority 관리 |
191
- | `tfx-profile` | Core | Codex/Gemini CLI 프로필 관리 |
241
+ ```bash
242
+ tfx handoff --target remote --decision "README는 canonical 중심, alias는 docs로 분리" --output .omx/handoff.md
243
+ ```
192
244
 
193
- 내부 라우팅 helper: `tfx-ralph`
245
+ 세션을 끝내거나 다른 host/agent가 이어받아야 할 때 사용합니다.
194
246
 
195
- ### 오케스트레이션
247
+ ---
196
248
 
197
- | 스킬 | 상태 | 설명 |
198
- |------|------|------|
199
- | `tfx-hub` | Core | MCP 메시지 버스 관리 |
200
- | `merge-worktree` | Core | swarm 결과용 worktree merge helper |
249
+ ## 아키텍처
201
250
 
202
- Swarm 실행은 `tfx-auto --parallel swarm` 과 `tfx swarm` CLI로 노출된다.
251
+ <p align="center">
252
+ <img src="docs/assets/architecture.svg" alt="triflux architecture" width="680">
253
+ </p>
203
254
 
204
- ### 원격
255
+ ```mermaid
256
+ graph TD
257
+ User([User / Claude Code / shell]) --> Skills[Claude skills]
258
+ User --> CLI[tfx CLI]
259
+ Skills --> Auto[/tfx-auto]
260
+ Skills --> Remote[/tfx-remote]
261
+ CLI --> Hub[triflux Hub]
262
+ CLI --> Team[tfx multi / swarm]
263
+ Auto --> Route[tfx-route.sh + guards]
264
+ Team --> Hub
265
+ Remote --> Hub
266
+ Route --> Codex[Codex CLI]
267
+ Route --> Gemini[Gemini CLI]
268
+ Route --> Claude[Claude Code]
269
+ Hub --> MCP[MCP registry + bridge]
270
+ Hub --> Store[(SQLite or memory store)]
271
+ Hub --> Dashboard[HUD / monitor]
272
+ ```
205
273
 
206
- | 스킬 | 상태 | 설명 |
207
- |------|------|------|
208
- | `tfx-remote` | Core | setup, spawn, list, attach, send, resume, probe, rules를 묶는 원격 command family |
274
+ 일반적인 라우팅 경로는 다음과 같습니다.
209
275
 
210
- 호환 alias: `tfx-remote-spawn`, `tfx-remote-setup`, `tfx-psmux-rules` Phase 4에서 `.claude/rules/tfx-psmux.md`로 이동
276
+ 1. Claude Code prompt 또는 명시적 skill 호출.
277
+ 2. keyword/routing hook이 context를 추가하거나 skill을 고릅니다.
278
+ 3. `tfx-auto`가 intent를 mode, retry, parallelism, risk tier, 대상 CLI lane으로 정규화합니다.
279
+ 4. `tfx-route.sh`, Hub worker, 또는 `tfx` CLI가 실제 Codex/Gemini/Claude 기반 작업을 실행합니다.
280
+ 5. Hub가 team message, lease, retry, handoff, status surface를 기록합니다.
211
281
 
212
- ### 메타
282
+ ### Hub
213
283
 
214
- | 스킬 | 상태 | 설명 |
215
- |------|------|------|
216
- | `tfx-forge` | Active | 대화형 스킬 생성 |
217
- | `tfx-setup` | Active | 초기 설정 마법사 |
218
- | `tfx-doctor` | Active | 진단 및 자동 복구 |
219
- | `tfx-ship` | Active | ship workflow orchestration |
220
- | `tfx-wt` | Active | Windows Terminal 탭/패인 제어 |
221
- | `star-prompt` | Active | postinstall GitHub star prompt |
284
+ Hub는 team, remote session, MCP tool, status surface를 위한 로컬 메시지 버스입니다.
285
+ localhost에 bind하며 pipe/HTTP transport를 사용합니다.
222
286
 
223
- ---
287
+ ```bash
288
+ tfx hub ensure
289
+ tfx hub status --json
290
+ tfx hub stop
291
+ ```
224
292
 
225
- ## Deep vs Light
293
+ macOS에서 test나 Hub 시작이 `node` localhost port를 열면 방화벽 팝업이 뜰 수 있습니다.
294
+ 문서 작업에는 필요 없고, 실제 Hub/team/MCP workflow가 필요할 때만 환경 정책에 맞게 허용하세요.
226
295
 
227
- 모든 도메인에서 두 가지 모드를 제공합니다:
296
+ ### Guard
228
297
 
229
- <p align="center">
230
- <img src="docs/assets/deep-vs-light.svg" alt="Deep vs Light 비교" width="680">
231
- </p>
298
+ triflux는 위험한 실행을 관리된 경로 뒤에 둡니다.
232
299
 
233
- Phase 매핑:
300
+ - CLI 호출은 `tfx-route.sh`, Hub worker, `tfx` CLI를 통과해야 합니다.
301
+ - 직접 `codex exec` / `gemini -y` 경로는 설치된 workflow에서 guard됩니다.
302
+ - psmux/Windows Terminal 흐름은 임의 `wt.exe`/`psmux send-keys`가 아니라 관리 API와 규칙을 사용합니다.
234
303
 
235
- - `--mode deep` 는 Phase 2의 직접적인 Light → Deep 스위치
236
- - `--retry ralph` / `--retry auto-escalate` 는 Phase 3의 persistence / escalation 시맨틱
237
- - `--shape consensus|debate|panel` 은 Phase 4의 consensus output shape 라우팅
304
+ ### Profile과 모델 라우팅
238
305
 
239
- | 항목 | Light | Deep |
240
- |------|-------|------|
241
- | **CLI** | 단일 (주로 Codex) | 3자 (Claude + Codex + Gemini) |
242
- | **토큰** | 3K-15K | 20K-80K |
243
- | **속도** | 수 초 | 수 분 |
244
- | **정확도** | 양호 (단일 관점) | 우수 (합의 검증 완료) |
245
- | **편향** | 발생 가능 | Anti-Herding으로 제거 |
246
- | **적합한 상황** | 빠른 작업, 익숙한 패턴 | 중요한 의사결정, 미지의 영역 |
306
+ Codex/Gemini profile은 `tfx-profile` 또는 `tfx setup`으로 관리합니다. 이미 profile이
307
+ 소유한 model/effort 값을 launcher script에 중복 하드코딩하지 마세요.
247
308
 
248
309
  ---
249
310
 
250
- ## 아키텍처
311
+ ## 운영
251
312
 
252
- <p align="center">
253
- <img src="docs/assets/architecture.svg" alt="triflux 아키텍처" width="680">
254
- </p>
255
-
256
- <details>
257
- <summary>인터랙티브 다이어그램 (GitHub 전용)</summary>
313
+ ### 진단
258
314
 
259
- ```mermaid
260
- graph TD
261
- User([사용자 / Claude Code]) <-->|Skills & Slash Commands| TFX[tfx Skills Layer]
262
- TFX <-->|Consensus Engine| CONSENSUS[tfx-consensus]
263
-
264
- subgraph "Tri-CLI Consensus"
265
- CONSENSUS -->|Independent| CLAUDE[Claude Opus/Sonnet]
266
- CONSENSUS -->|Independent| CODEX[Codex CLI]
267
- CONSENSUS -->|Independent| GEMINI[Gemini CLI]
268
- CLAUDE --> MERGE[Cross-Validation]
269
- CODEX --> MERGE
270
- GEMINI --> MERGE
271
- MERGE --> GATE{Consensus >= 70%?}
272
- GATE -->|Yes| OUTPUT[검증된 출력]
273
- GATE -->|No| RESOLVE[Resolution Round]
274
- RESOLVE --> MERGE
275
- end
276
-
277
- TFX <-->|Named Pipe / HTTP| HUB[triflux Hub 서버]
278
-
279
- subgraph "오케스트레이션 Hub"
280
- HUB <--> STORE[(SQLite 저장소)]
281
- HUB <--> DASH[QoS 대시보드]
282
- HUB <--> DELEGATOR[Delegator 서비스]
283
- end
284
-
285
- HUB -.->|MCP Bridge| External[외부 MCP 클라이언트]
315
+ ```bash
316
+ tfx doctor
317
+ tfx doctor --json
318
+ tfx doctor --fix
319
+ tfx doctor --diagnose
286
320
  ```
287
321
 
288
- </details>
322
+ `doctor`는 CLI, profile, hook, skill, Hub, MCP registry, route script sync,
323
+ stale team, 로컬 설정 drift를 확인합니다.
289
324
 
290
- ---
325
+ ### MCP registry
291
326
 
292
- ## 빠른 시작
327
+ ```bash
328
+ tfx mcp list
329
+ tfx mcp sync
330
+ tfx mcp add context7 --url https://mcp.context7.com/mcp
331
+ tfx mcp remove context7
332
+ ```
293
333
 
294
- **Claude Code** (권장) Claude Code 세션 안에서 실행:
334
+ registry가 관리 대상 MCP 설정의 source of truth입니다. Drift 디버깅이 아니라면
335
+ Codex/Gemini/Claude MCP 파일을 직접 수정하지 마세요.
295
336
 
296
- ```
297
- /plugin marketplace add tellang/triflux
298
- /plugin install triflux@tellang
299
- ```
337
+ ### State snapshot
300
338
 
301
- **npm**:
339
+ Hub 시작 시 `~/.codex/`, `~/.gemini/` 일부 상태를 ignored `references/*-snapshots/`
340
+ 폴더에 best-effort daily snapshot으로 저장할 수 있습니다. 수동 helper:
302
341
 
303
342
  ```bash
304
- npm install -g triflux
343
+ npm run snapshot:codex
344
+ npm run snapshot:gemini
345
+ npm run snapshot:all
305
346
  ```
306
347
 
307
- `tfx setup`으로 환경을 설정하세요.
348
+ ### Release/mirror check
308
349
 
309
- ### 사용법
350
+ 패키지 내용에 영향이 있는 저장소 변경은 ship 전에 release gate를 통과시킵니다.
310
351
 
311
352
  ```bash
312
- # Deep 기본값 — 3자 합의로 실행
313
- /tfx-research "React 19 Server Actions best practices"
314
- /tfx-review
315
- /tfx-plan "add JWT auth middleware"
316
-
317
- # Quick opt-out — 단일 모델로 빠르게 실행
318
- /tfx-review --quick
319
- /tfx-plan "add JWT auth middleware" --quick
320
-
321
- # Debate — 3개의 독립적인 의견을 확보
322
- /tfx-debate "Redis vs PostgreSQL LISTEN/NOTIFY for real-time events"
323
-
324
- # Persistence — front door에서 직접 호출 가능
325
- /tfx-auto "implement full auth flow with tests" --retry ralph --max-iterations 10
326
-
327
- # Team — Multi-CLI 병렬 오케스트레이션
328
- /tfx-multi "refactor auth + update UI + add tests"
329
-
330
- # Remote — 단일 진입점
331
- /tfx-remote spawn ultra4 "보안 리뷰 실행"
353
+ npm run gen:skill-docs
354
+ npm run gen:skill-manifest
355
+ npm run release:check-sync
356
+ npm run release:check-mirror
357
+ npm run lint
332
358
  ```
333
- > **참고**: Deep 스킬과 `tfx-auto --mode consensus`, `--retry ralph`, `--shape ...` 경로는 완전한 Tri-CLI 합의(Tier 1)를 위해 **psmux**(또는 tmux), **triflux Hub**, **Codex CLI**, **Gemini CLI**가 필요합니다. 전제조건이 충족되지 않으면 Tier 3(Claude 단독, single-model) 모드로 자동 전환됩니다. `tfx doctor`로 환경을 확인하세요.
334
- >
335
- > **Serena 참고**: Serena MCP는 stateful합니다. 따라서 **같은 프로젝트**를 다루는 에이전트끼리만 하나의 Serena 인스턴스를 공유하는 것이 안전합니다. 서로 다른 프로젝트를 병렬로 작업할 때는 Serena 인스턴스를 분리하세요. Serena가 `No active project`를 보고하면 Codex Serena 설정의 `--project-from-cwd`(또는 `--project <path>`)를 확인하고 `tfx doctor`를 다시 실행하세요.
336
359
 
337
- ---
360
+ `packages/triflux`는 일부 runtime folder의 npm publish mirror입니다. mirror 대상 파일을
361
+ 수정했다면 동기화 상태를 확인하세요.
338
362
 
339
- ## 리서치 기반
363
+ ---
340
364
 
341
- v8 스킬 체계는 Claude Code 생태계 내 37개 클론 저장소를 종합 역분석한 결과를 토대로 설계되었습니다:
365
+ ## 플랫폼 지원
342
366
 
343
- | 프로젝트 | Stars | 채택한 핵심 인사이트 |
344
- |----------|-------|---------------------|
345
- | everything-claude-code | 114K | 직관 기반 학습 패턴 |
346
- | Superpowers | 93K | TDD 강제화, 조합형 스킬 |
347
- | oh-my-openagent | 44K | 카테고리 라우팅, Hashline 편집 |
348
- | SuperClaude | 22K | index-repo 94% 토큰 절감, 전문가 패널 |
349
- | oh-my-claudecode | 15K | Ralph 지속 실행, CCG tri-model |
350
- | ruflo | 28K | 60개 이상의 에이전트 오케스트레이션 |
351
- | Exa MCP | 3.7K | 뉴럴 검색, 하이라이트 추출 |
352
- | Brave Search MCP | — | 독립 인덱스, Goggles 재순위 |
353
- | Tavily MCP | — | Deep Research 파이프라인 |
367
+ | 플랫폼 | Multiplexer | 참고 |
368
+ | --- | --- | --- |
369
+ | macOS | tmux | 지원. 일부 흐름은 `gtimeout` 같은 timeout provider 필요. |
370
+ | Linux | tmux | 지원. |
371
+ | Windows | psmux + Windows Terminal | 관리된 psmux/WT 경로로 지원. psmux 기본 shell은 PowerShell. |
354
372
 
355
- 5개 언어(EN/CN/RU/JP/UA) 리서치를 통해 고유 패턴을 발굴했습니다: WeChat 연동(CN), Discord 모바일 브리지(JP), GigaCode 국산 대안(RU), 커뮤니티 주도 로컬라이제이션 등.
373
+ agent/launcher가 따라야 하는 엄격한 Windows/psmux 규칙은 `AGENTS.md`와
374
+ `.claude/rules/tfx-psmux.md`를 보세요.
356
375
 
357
376
  ---
358
377
 
359
- ## 보안
378
+ ## 보안과 Guard
360
379
 
361
- - **Hub 토큰 인증** — `TFX_HUB_TOKEN`을 이용한 보안 IPC (Bearer Auth)
362
- - **Localhost 전용** Hub가 기본적으로 `127.0.0.1`에만 바인딩
363
- - **CORS 잠금** QoS 대시보드에 대한 엄격한 오리진 검사
364
- - **인젝션 방어** `psmux` `tmux` 실행 시 쉘 명령어 새니타이징
365
- - **합의 기반 검증** Deep 스킬이 3자 합의를 통해 단일 모델 환각을 방지
380
+ | 계층 | 보호 |
381
+ | --- | --- |
382
+ | Hub token auth | 설정된 경우 Hub API에 로컬 bearer token 적용. |
383
+ | Localhost binding | Hub 기본 bind는 `127.0.0.1`. |
384
+ | MCP registry guard | 지원하지 않거나 stale한 MCP record를 관리형 HTTP entry로 교체. |
385
+ | Headless guard | 비관리 Codex/Gemini headless 실행 경로 차단. |
386
+ | Safety guard | psmux/SSH/WT 셸 민감 흐름 sanitizing. |
387
+ | Consensus reporting | deep/consensus workflow는 degraded/disputed 결과를 명시해야 함. |
366
388
 
367
389
  ---
368
390
 
369
- ## 플랫폼 지원
370
-
371
- - **Linux / macOS**: 네이티브 `tmux` 통합
372
- - **Windows**: **psmux** (PowerShell Multiplexer) + Windows Terminal 네이티브
391
+ ## 개발
373
392
 
374
- ---
375
-
376
- ## QoS 대시보드
393
+ ```bash
394
+ npm ci
395
+ npm test
396
+ npm run lint
397
+ npm run release:check-sync
398
+ npm run release:check-mirror
399
+ ```
377
400
 
378
- `http://localhost:27888/dashboard`에서 오케스트레이션 상태를 모니터링할 수 있습니다.
401
+ 기여자 메모:
379
402
 
380
- - **AIMD 배치 사이징** 작업 성공률에 따라 병렬 작업 수를 자동 조절
381
- - **토큰 절약량** Claude 토큰 절약량을 실시간 추적
382
- - **합의 메트릭** CLI 합의율을 추적
403
+ - deprecated alias 세부사항은 main README에 다시 늘어놓지 말고 [`docs/legacy-skill-aliases.md`](https://github.com/tellang/triflux/blob/main/docs/legacy-skill-aliases.md)를 갱신하세요.
404
+ - Codex-local 실험은 패키지 경계를 의도적으로 바꾸는 경우가 아니라면 `~/.codex/skills` 아래에 둡니다.
405
+ - docs-only 변경은 보통 `npm run lint`, release sync check 같은 targeted check로 충분합니다. full integration test는 Hub 서버와 localhost listener를 띄울 수 있습니다.
383
406
 
384
407
  ---
385
408
 
386
409
  <p align="center">
387
- <sub>MIT License · Made by <a href="https://github.com/tellang">tellang</a></sub>
410
+ <sub>MIT License &middot; Made by <a href="https://github.com/tellang">tellang</a></sub>
388
411
  </p>