@tienne/gestalt 0.5.1 → 0.7.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 (119) hide show
  1. package/README.backup.md +442 -0
  2. package/README.ko.md +487 -0
  3. package/README.md +324 -286
  4. package/dist/package.json +10 -3
  5. package/dist/review-agents/performance-reviewer/AGENT.md +31 -0
  6. package/dist/review-agents/quality-reviewer/AGENT.md +31 -0
  7. package/dist/review-agents/security-reviewer/AGENT.md +32 -0
  8. package/dist/role-agents/architect/AGENT.md +30 -0
  9. package/dist/role-agents/backend-developer/AGENT.md +30 -0
  10. package/dist/role-agents/designer/AGENT.md +30 -0
  11. package/dist/role-agents/devops-engineer/AGENT.md +30 -0
  12. package/dist/role-agents/frontend-developer/AGENT.md +30 -0
  13. package/dist/role-agents/product-planner/AGENT.md +30 -0
  14. package/dist/role-agents/qa-engineer/AGENT.md +30 -0
  15. package/dist/role-agents/researcher/AGENT.md +30 -0
  16. package/dist/role-agents/technical-writer/AGENT.md +212 -0
  17. package/dist/skills/agent/SKILL.md +102 -0
  18. package/dist/skills/execute/SKILL.md +274 -6
  19. package/dist/src/agent/role-agent-registry.d.ts +4 -2
  20. package/dist/src/agent/role-agent-registry.d.ts.map +1 -1
  21. package/dist/src/agent/role-agent-registry.js +12 -3
  22. package/dist/src/agent/role-agent-registry.js.map +1 -1
  23. package/dist/src/cli/commands/interview.d.ts +5 -1
  24. package/dist/src/cli/commands/interview.d.ts.map +1 -1
  25. package/dist/src/cli/commands/interview.js +15 -3
  26. package/dist/src/cli/commands/interview.js.map +1 -1
  27. package/dist/src/cli/index.d.ts.map +1 -1
  28. package/dist/src/cli/index.js +4 -2
  29. package/dist/src/cli/index.js.map +1 -1
  30. package/dist/src/core/config.d.ts +3 -0
  31. package/dist/src/core/config.d.ts.map +1 -1
  32. package/dist/src/core/config.js +4 -0
  33. package/dist/src/core/config.js.map +1 -1
  34. package/dist/src/core/types.d.ts +28 -0
  35. package/dist/src/core/types.d.ts.map +1 -1
  36. package/dist/src/mcp/schemas.d.ts +3 -0
  37. package/dist/src/mcp/schemas.d.ts.map +1 -1
  38. package/dist/src/mcp/schemas.js +2 -0
  39. package/dist/src/mcp/schemas.js.map +1 -1
  40. package/dist/src/mcp/server.d.ts.map +1 -1
  41. package/dist/src/mcp/server.js +12 -1
  42. package/dist/src/mcp/server.js.map +1 -1
  43. package/dist/src/mcp/tools/agent-passthrough.d.ts +7 -0
  44. package/dist/src/mcp/tools/agent-passthrough.d.ts.map +1 -0
  45. package/dist/src/mcp/tools/agent-passthrough.js +49 -0
  46. package/dist/src/mcp/tools/agent-passthrough.js.map +1 -0
  47. package/dist/src/mcp/tools/interview-passthrough.d.ts.map +1 -1
  48. package/dist/src/mcp/tools/interview-passthrough.js +26 -1
  49. package/dist/src/mcp/tools/interview-passthrough.js.map +1 -1
  50. package/dist/src/mcp/tools/interview.d.ts.map +1 -1
  51. package/dist/src/mcp/tools/interview.js +26 -1
  52. package/dist/src/mcp/tools/interview.js.map +1 -1
  53. package/dist/src/recording/agg-converter.d.ts +25 -0
  54. package/dist/src/recording/agg-converter.d.ts.map +1 -0
  55. package/dist/src/recording/agg-converter.js +80 -0
  56. package/dist/src/recording/agg-converter.js.map +1 -0
  57. package/dist/src/recording/agg-installer.d.ts +6 -0
  58. package/dist/src/recording/agg-installer.d.ts.map +1 -0
  59. package/dist/src/recording/agg-installer.js +50 -0
  60. package/dist/src/recording/agg-installer.js.map +1 -0
  61. package/dist/src/recording/asciinema-installer.d.ts +6 -0
  62. package/dist/src/recording/asciinema-installer.d.ts.map +1 -0
  63. package/dist/src/recording/asciinema-installer.js +50 -0
  64. package/dist/src/recording/asciinema-installer.js.map +1 -0
  65. package/dist/src/recording/asciinema-recorder.d.ts +26 -0
  66. package/dist/src/recording/asciinema-recorder.d.ts.map +1 -0
  67. package/dist/src/recording/asciinema-recorder.js +52 -0
  68. package/dist/src/recording/asciinema-recorder.js.map +1 -0
  69. package/dist/src/recording/cast-generator.d.ts +7 -0
  70. package/dist/src/recording/cast-generator.d.ts.map +1 -0
  71. package/dist/src/recording/cast-generator.js +72 -0
  72. package/dist/src/recording/cast-generator.js.map +1 -0
  73. package/dist/src/recording/filename-generator.d.ts +19 -0
  74. package/dist/src/recording/filename-generator.d.ts.map +1 -0
  75. package/dist/src/recording/filename-generator.js +67 -0
  76. package/dist/src/recording/filename-generator.js.map +1 -0
  77. package/dist/src/recording/gif-generator.d.ts +21 -0
  78. package/dist/src/recording/gif-generator.d.ts.map +1 -0
  79. package/dist/src/recording/gif-generator.js +121 -0
  80. package/dist/src/recording/gif-generator.js.map +1 -0
  81. package/dist/src/recording/recording-dir.d.ts +5 -0
  82. package/dist/src/recording/recording-dir.d.ts.map +1 -0
  83. package/dist/src/recording/recording-dir.js +13 -0
  84. package/dist/src/recording/recording-dir.js.map +1 -0
  85. package/dist/src/recording/recording-orchestrator.d.ts +50 -0
  86. package/dist/src/recording/recording-orchestrator.d.ts.map +1 -0
  87. package/dist/src/recording/recording-orchestrator.js +98 -0
  88. package/dist/src/recording/recording-orchestrator.js.map +1 -0
  89. package/dist/src/recording/resume-detector.d.ts +10 -0
  90. package/dist/src/recording/resume-detector.d.ts.map +1 -0
  91. package/dist/src/recording/resume-detector.js +14 -0
  92. package/dist/src/recording/resume-detector.js.map +1 -0
  93. package/dist/src/recording/segment-merger.d.ts +27 -0
  94. package/dist/src/recording/segment-merger.d.ts.map +1 -0
  95. package/dist/src/recording/segment-merger.js +65 -0
  96. package/dist/src/recording/segment-merger.js.map +1 -0
  97. package/dist/src/recording/terminal-recorder.d.ts +31 -0
  98. package/dist/src/recording/terminal-recorder.d.ts.map +1 -0
  99. package/dist/src/recording/terminal-recorder.js +111 -0
  100. package/dist/src/recording/terminal-recorder.js.map +1 -0
  101. package/dist/src/scripts/postinstall.d.ts +2 -0
  102. package/dist/src/scripts/postinstall.d.ts.map +1 -0
  103. package/dist/src/scripts/postinstall.js +27 -0
  104. package/dist/src/scripts/postinstall.js.map +1 -0
  105. package/package.json +10 -3
  106. package/review-agents/performance-reviewer/AGENT.md +31 -0
  107. package/review-agents/quality-reviewer/AGENT.md +31 -0
  108. package/review-agents/security-reviewer/AGENT.md +32 -0
  109. package/role-agents/architect/AGENT.md +30 -0
  110. package/role-agents/backend-developer/AGENT.md +30 -0
  111. package/role-agents/designer/AGENT.md +30 -0
  112. package/role-agents/devops-engineer/AGENT.md +30 -0
  113. package/role-agents/frontend-developer/AGENT.md +30 -0
  114. package/role-agents/product-planner/AGENT.md +30 -0
  115. package/role-agents/qa-engineer/AGENT.md +30 -0
  116. package/role-agents/researcher/AGENT.md +30 -0
  117. package/role-agents/technical-writer/AGENT.md +212 -0
  118. package/skills/agent/SKILL.md +102 -0
  119. package/skills/execute/SKILL.md +274 -6
package/README.md CHANGED
@@ -3,349 +3,402 @@
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <strong>Gestalt psychology-driven AI development harness</strong><br/>
7
- Transforms scattered requirements into structured, validated specifications through interactive interviews.
6
+ <strong>Gestalt AI Development Harness</strong><br/>
7
+ Turn vague requirements into structured, executable plans right inside Claude Code.
8
8
  </p>
9
9
 
10
10
  <p align="center">
11
- <a href="https://github.com/tienne/gestalt/actions/workflows/ci.yml"><img src="https://github.com/tienne/gestalt/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
12
11
  <a href="https://www.npmjs.com/package/@tienne/gestalt"><img src="https://img.shields.io/npm/v/@tienne/gestalt" alt="npm version" /></a>
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
13
+ <a href="https://github.com/tienne/gestalt/actions/workflows/ci.yml"><img src="https://github.com/tienne/gestalt/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
13
14
  </p>
14
15
 
16
+ <p align="center">
17
+ <a href="./README.ko.md">한국어</a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## What is Gestalt?
23
+
24
+ Gestalt is an MCP (Model Context Protocol) server that runs inside Claude Code. It conducts structured requirement interviews, generates a validated **Spec** (a JSON document capturing your goal, constraints, and acceptance criteria), and transforms that Spec into a dependency-aware execution plan — all without a separate API key.
25
+
26
+ > **Prerequisites:** Node.js >= 20.0.0. Use `nvm install 22 && nvm use 22` if needed.
27
+
15
28
  ---
16
29
 
17
- ## Prerequisites
30
+ ## See it in action
18
31
 
19
- - **Node.js >= 20.0.0** (22.x recommended)
32
+ > **30 seconds to a structured execution plan** — no API key needed.
20
33
 
21
34
  ```bash
22
- node --version # v20.x.x 이상이어야 합니다
35
+ # Start a Gestalt-driven requirements interview
36
+ /interview "user authentication system"
37
+
38
+ # Once the interview is done, generate a structured Spec
39
+ /spec
40
+
41
+ # Transform the Spec into a validated execution plan and run it
42
+ /execute
23
43
  ```
24
44
 
25
- Node 18 이하에서는 MCP SDK의 ES2024 기능 호환성 문제로 실행이 실패합니다. [nvm](https://github.com/nvm-sh/nvm) 사용 시:
45
+ _(Demo coming soon.)_
26
46
 
27
- ```bash
28
- nvm install 22
29
- nvm use 22
47
+ ---
48
+
49
+ ## Why Gestalt?
50
+
51
+ Vague requirements are the primary source of implementation drift. When the goal isn't precise, Claude fills in gaps with assumptions — and those assumptions diverge from intent as the project grows.
52
+
53
+ Gestalt addresses this at the source. Before any code is written, it runs a structured interview guided by **Gestalt psychology principles** to reduce ambiguity to a measurable threshold (≤ 0.2). The result is a **Spec**: a validated JSON document that serves as the single source of truth for planning and execution.
54
+
55
+ ### The Five Gestalt Principles
56
+
57
+ - **Closure** — Finds what's missing; fills in implicit requirements
58
+ - **Proximity** — Groups related features and tasks by domain
59
+ - **Similarity** — Identifies repeating patterns across requirements
60
+ - **Figure-Ground** — Separates MVP (figure) from nice-to-have (ground)
61
+ - **Continuity** — Validates dependency chains; detects contradictions
62
+
63
+ > "The whole is greater than the sum of its parts." — Aristotle
64
+
65
+ ### How does Passthrough Mode work?
66
+
67
+ Gestalt runs as an **MCP server**. Claude Code acts as the LLM: Gestalt returns prompts and context, and Claude Code does the reasoning. The server makes no API calls.
68
+
69
+ ```
70
+ You (in Claude Code)
71
+
72
+ ▼ /interview "topic"
73
+ Gestalt MCP Server
74
+ (returns context + prompts)
75
+
76
+
77
+ Claude Code executes the prompts
78
+ (generates questions, scores, plans)
79
+
80
+
81
+ Gestalt MCP Server
82
+ (validates, stores state, advances)
83
+
84
+ ▼ repeat until ambiguity ≤ 0.2
85
+ Final Spec → Execution Plan
30
86
  ```
31
87
 
88
+ `ANTHROPIC_API_KEY` is not required. All LLM work is handled by Claude Code.
89
+
90
+ ---
91
+
32
92
  ## Installation
33
93
 
34
- ### Claude Plugin (Recommended)
94
+ ### Option 1: Claude Code Plugin (Recommended)
35
95
 
36
- Claude Code 마켓플레이스를 통해 설치하면 MCP 서버, Skill, Agent, CLAUDE.md가 자동 구성된다.
96
+ Bundles the MCP server, slash-command skills, Gestalt agents, and project context — pre-configured in a single install.
37
97
 
38
98
  ```bash
39
- # 1. 마켓플레이스 등록 (최초 1회)
99
+ # Step 1: Add to marketplace (one-time setup)
40
100
  /plugin marketplace add tienne/gestalt
41
101
 
42
- # 2. 플러그인 설치
102
+ # Step 2: Install the plugin
43
103
  /plugin install gestalt@gestalt
44
104
  ```
45
105
 
46
- 플러그인 설치 포함되는 항목:
106
+ What you get out of the box:
47
107
 
48
- | 항목 | 내용 |
49
- |------|------|
50
- | **MCP Tools** | `ges_interview`, `ges_generate_spec`, `ges_execute`, `ges_create_agent`, `ges_status` |
51
- | **Skills** | `/interview`, `/spec`, `/execute` (slash command) |
52
- | **Agents** | 5 Gestalt Agent + 8개 Role Agent |
53
- | **CLAUDE.md** | 프로젝트 컨텍스트 MCP 사용 가이드 자동 주입 |
108
+ | Item | Details |
109
+ |------|---------|
110
+ | **MCP Tools** | `ges_interview`, `ges_generate_spec`, `ges_execute`, `ges_create_agent`, `ges_agent`, `ges_status` |
111
+ | **Slash Commands** | `/interview`, `/spec`, `/execute`, `/agent` |
112
+ | **Agents** | 5 Gestalt pipeline agents + 9 Role agents + 3 Review agents |
113
+ | **CLAUDE.md** | Project context and MCP usage guide auto-injected |
54
114
 
55
- 설치 바로 사용 가능:
115
+ > **Requires Node.js >= 20.0.0** — use [nvm](https://github.com/nvm-sh/nvm) if needed: `nvm install 22 && nvm use 22`
56
116
 
57
- ```bash
58
- /interview "사용자 인증 시스템" # 요구사항 인터뷰 시작
59
- /spec # 인터뷰 완료 Spec 생성
60
- /execute # Spec 기반 실행 계획 수립 및 실행
117
+ ---
118
+
119
+ ### Option 2: Claude Code Desktop
120
+
121
+ Open your Claude Code Desktop settings and add to `settings.json` (or `claude_desktop_config.json`):
122
+
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "gestalt": {
127
+ "command": "npx",
128
+ "args": ["-y", "@tienne/gestalt"]
129
+ }
130
+ }
131
+ }
61
132
  ```
62
133
 
63
- ### Claude Code MCP
134
+ Restart Claude Code Desktop. The MCP tools become available immediately. Slash commands require the plugin or manual skills setup.
135
+
136
+ ---
137
+
138
+ ### Option 3: Claude Code CLI
64
139
 
65
140
  ```bash
141
+ # Via the claude CLI
66
142
  claude mcp add gestalt -- npx -y @tienne/gestalt
67
143
  ```
68
144
 
69
- ### npx (No Install)
145
+ Or edit `~/.claude/settings.json` directly:
70
146
 
71
- ```bash
72
- npx -y @tienne/gestalt
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "gestalt": {
151
+ "command": "npx",
152
+ "args": ["-y", "@tienne/gestalt"]
153
+ }
154
+ }
155
+ }
73
156
  ```
74
157
 
75
- ### Global Install
158
+ ---
159
+
160
+ ## Usage: Full Pipeline
161
+
162
+ ### Step 1 — Interview
163
+
164
+ Start with any topic. A single rough sentence is enough.
76
165
 
77
166
  ```bash
78
- npm install -g @tienne/gestalt
79
- gestalt
167
+ /interview "I want to build a checkout flow with Stripe"
80
168
  ```
81
169
 
82
- ## How It Works
170
+ Gestalt conducts a multi-round interview. Each round targets a specific ambiguity dimension:
171
+
172
+ - **Closure** — What's missing? What did you assume but not say?
173
+ - **Proximity** — Which features belong together?
174
+ - **Similarity** — Are there repeating patterns across requirements?
175
+ - **Figure-Ground** — What's the core MVP vs. what's optional?
176
+ - **Continuity** — Any contradictions or conflicts?
177
+
178
+ The interview continues until the **ambiguity score reaches ≤ 0.2**:
83
179
 
84
180
  ```
85
- Interview Spec Execute Evaluate → Evolve
86
-
87
- Lateral Thinking (resilience)
88
-
89
- Human Escalation (if exhausted)
181
+ Round 1ambiguity: 0.72 (lots of unknowns)
182
+ Round 4 → ambiguity: 0.45 (getting clearer)
183
+ Round 8 → ambiguity: 0.19 ✓ ready for Spec
90
184
  ```
91
185
 
92
- ### 1. Interview
186
+ ---
93
187
 
94
- Gestalt 원리가 각 라운드의 질문 방향을 가이드하여 **모호성 점수(ambiguity score)가 0.2 이하**로 떨어질 때까지 요구사항을 명확화한다.
188
+ ### Step 2 Spec Generation
95
189
 
96
- - 프로젝트 유형 자동 감지 (greenfield / brownfield)
97
- - 5가지 Gestalt 원리 기반 동적 질문 선택 알고리즘
98
- - 차원별 가중치 기반 모호성 점수 산출
99
- - 모순 감지 시 Continuity 원리 자동 개입 + 페널티 부여
190
+ When the ambiguity score reaches 0.2, run:
100
191
 
101
- ### 2. Spec Generation
192
+ ```bash
193
+ /spec
194
+ ```
102
195
 
103
- 완료된 인터뷰에서 **구조화된 프로젝트 스펙**을 생성한다. 2-Call Passthrough 패턴으로 동작.
196
+ Generates a structured **Spec** a validated JSON document that drives the rest of the pipeline:
104
197
 
105
198
  ```
106
- Call 1: specContext 요청 systemPrompt + specPrompt + 전체 인터뷰 라운드 반환
107
- Call 2: caller가 생성한 Spec JSON 제출 Zod 검증 저장
199
+ goal Clear, unambiguous project objective
200
+ constraints Technical and business constraints
201
+ acceptanceCriteria → Measurable, verifiable success conditions
202
+ ontologySchema → Entity-relationship model (entities + relations)
203
+ gestaltAnalysis → Key findings per Gestalt principle
108
204
  ```
109
205
 
110
- Spec 구성요소: `goal`, `constraints`, `acceptanceCriteria`, `ontologySchema` (entities + relations), `gestaltAnalysis`
206
+ ---
207
+
208
+ ### Step 3 — Execute (Planning + Execution)
111
209
 
112
- ### 3. Execute (Planning)
210
+ Transforms the Spec into a dependency-aware execution plan and runs it:
113
211
 
114
- Gestalt 4원리를 **고정 순서**로 적용하여 실행 계획을 수립한다.
212
+ ```bash
213
+ /execute
214
+ ```
115
215
 
116
- | Step | Principle | 역할 |
117
- |:---:|---|---|
118
- | 1 | **Figure-Ground** | AC를 essential(figure) / supplementary(ground)로 분류 |
119
- | 2 | **Closure** | AC를 원자적 태스크로 분해 (암묵적 하위 태스크 포함) |
120
- | 3 | **Proximity** | 관련 태스크를 도메인/기능 영역별로 그룹핑 |
121
- | 4 | **Continuity** | DAG 검증 — 순환 의존, 그룹 간 충돌 확인, 위상 정렬 |
216
+ **Planning phase** applies 4 Gestalt principles in a fixed sequence:
122
217
 
123
- 결과물: `ExecutionPlan` (classifiedACs, atomicTasks, taskGroups, dagValidation, criticalPath)
218
+ | Step | Principle | What it does |
219
+ |:---:|-----------|-------------|
220
+ | 1 | **Figure-Ground** | Classifies acceptance criteria (ACs) as critical (figure) vs. supplementary (ground) |
221
+ | 2 | **Closure** | Decomposes ACs into atomic tasks, including implicit ones |
222
+ | 3 | **Proximity** | Groups related tasks by domain into logical task groups |
223
+ | 4 | **Continuity** | Validates the dependency DAG — no cycles, clear topological order |
124
224
 
125
- ### 4. Execute (Execution) + Drift Detection
225
+ **Execution phase** runs tasks in topological order. After each task, **drift detection** checks alignment with the Spec:
126
226
 
127
- 위상 정렬 순서대로 태스크를 실행하며, **Similarity 원리**를 활용하여 유사 패턴의 완료된 태스크를 참조 컨텍스트로 제공한다.
227
+ - 3-dimensional score: Goal (50%) + Constraint (30%) + Ontology (20%)
228
+ - Jaccard similarity-based measurement
229
+ - Auto-triggers a retrospective when drift exceeds threshold
128
230
 
129
- 매 태스크 완료 시 **Drift Detection**이 자동 실행된다:
231
+ ---
130
232
 
131
- - **3차원 가중합**: Goal(50%) + Constraint(30%) + Ontology(20%)
132
- - Jaccard 기반 키워드 유사도 측정
133
- - Threshold(기본 0.3) 초과 시 `retrospectiveContext` 반환
233
+ ### Step 4 Evaluate
134
234
 
135
- ### 5. Evaluate (2-Stage)
235
+ Execution triggers a 2-stage evaluation:
136
236
 
137
- | Stage | 이름 | 방식 | 실패 시 |
138
- |:---:|---|---|---|
139
- | 1 | **Structural** | lint → build → test 자동 검증 | Contextual 스킵 (short-circuit) |
140
- | 2 | **Contextual** | LLM 기반 완료 조건(AC) 검증 + goalAlignment | Evolution Loop 진입 |
237
+ | Stage | Method | On failure |
238
+ |:---:|-------|-----------|
239
+ | 1 | **Structural** runs lint → build → test | Short-circuits; skips Stage 2 |
240
+ | 2 | **Contextual** LLM validates each AC + goal alignment | Enters Evolution Loop |
141
241
 
142
- 성공 조건: `overallScore ≥ 0.85` && `goalAlignment ≥ 0.80`
242
+ **Success condition:** `score ≥ 0.85` AND `goalAlignment ≥ 0.80`
143
243
 
144
- ### 6. Evolution Loop
244
+ ---
245
+
246
+ ### Step 5 — Evolve
145
247
 
146
- Evaluate 실패 3가지 경로로 자동 복구를 시도한다:
248
+ When evaluation fails, the Evolution Loop engages. Three recovery flows are available:
147
249
 
148
- **Flow A — Structural Fix** (structural 실패 )
250
+ **Flow A — Structural Fix** (when lint/build/test fails)
149
251
  ```
150
- evolve_fix → fixTasks 제출 → re-evaluate
252
+ evolve_fix → submit fix tasks → re-evaluate
151
253
  ```
152
254
 
153
- **Flow B — Contextual Evolution** (contextual 점수 미달 )
255
+ **Flow B — Contextual Evolution** (when AC score is too low)
154
256
  ```
155
- evolve → evolve_patch(specPatch) → evolve_re_execute(impacted tasks) → re-evaluate
257
+ evolve → patch Spec (ACs/constraints) → re-execute impacted tasks → re-evaluate
156
258
  ```
157
259
 
158
- Spec Patch 범위: 완료 조건(AC) + constraints 자유 수정, ontology 추가/변경만, **goal 변경 금지**
159
-
160
- **Flow C — Lateral Thinking** (stagnation 감지 시 자동 분기)
260
+ Spec patch scope: ACs and constraints are freely editable; ontology can be extended; **goal is immutable**.
161
261
 
162
- evolve 호출 stagnation이 감지되면 즉시 종료하는 대신 **Lateral Thinking Persona**로 자동 분기한다. (아래 섹션 참조)
262
+ **Flow C Lateral Thinking** (when stagnation is detected)
163
263
 
164
- **종료 조건:**
264
+ Gestalt rotates through lateral thinking personas rather than terminating:
165
265
 
166
- | 조건 | 설명 |
167
- |---|---|
168
- | `success` | score 0.85, goalAlignment 0.80 |
169
- | `stagnation` | 2회 연속 delta < 0.05 |
170
- | `oscillation` | 2회 연속 점수 진동 (up↔down) |
171
- | `hard_cap` | structural 3회 + contextual 3회 실패 |
172
- | `caller` | 사용자 수동 종료 |
173
- | `human_escalation` | Lateral Thinking 4개 persona 모두 실패 |
174
-
175
- ## Gestalt Principles
266
+ | Stagnation Pattern | Persona | Strategy |
267
+ |--------------------|---------|---------|
268
+ | Hard cap hit | **Multistability** | See from a different angle |
269
+ | Oscillating scores | **Simplicity** | Strip down and converge |
270
+ | No progress (no drift) | **Reification** | Fill in what's missing |
271
+ | Diminishing returns | **Invariance** | Replicate what worked |
176
272
 
177
- Each letter in the logo represents a core Gestalt principle used throughout the system:
273
+ When all 4 personas are exhausted, the session terminates with **Human Escalation** — a structured list of actionable suggestions for manual resolution.
178
274
 
179
- | Principle | Role in Gestalt |
180
- |-----------|----------------|
181
- | **Closure** | Finds implicit requirements that aren't explicitly stated |
182
- | **Proximity** | Groups related requirements and tasks by domain |
183
- | **Continuation** | Validates dependency chains and execution order (DAG) |
184
- | **Similarity** | Identifies repeating patterns across requirements |
185
- | **Figure & Ground** | Separates core (figure) from supporting (ground) requirements |
275
+ **Termination conditions:**
186
276
 
187
- > For a deep dive into how each principle maps to interview strategies, ambiguity scoring, and the dynamic principle selection algorithm, see [Gestalt 5원리 상세 문서](docs/gestalt-principles.md).
277
+ | Condition | Trigger |
278
+ |-----------|---------|
279
+ | `success` | score ≥ 0.85 AND goalAlignment ≥ 0.80 |
280
+ | `stagnation` | 2 consecutive rounds with delta < 0.05 |
281
+ | `oscillation` | 2 consecutive score reversals |
282
+ | `hard_cap` | 3 structural + 3 contextual failures |
283
+ | `caller` | Manual termination |
284
+ | `human_escalation` | All 4 lateral personas exhausted |
188
285
 
189
- ## Lateral Thinking Personas
286
+ ---
190
287
 
191
- Evolution Loop에서 stagnation이 감지되면 패턴을 분류하고 매칭되는 persona를 활성화한다:
288
+ ### Step 6 Code Review
192
289
 
193
- | Stagnation Pattern | Persona | Strategy |
194
- |--------------------|---------|----------|
195
- | Spinning (hard cap) | **Multistability** | See from a different angle |
196
- | Oscillation | **Simplicity** | Simplify and converge |
197
- | No drift | **Reification** | Fill in missing pieces |
198
- | Diminishing returns | **Invariance** | Replicate success patterns |
290
+ When evolution finishes, code review starts automatically:
199
291
 
200
- 4개 persona를 순차적으로 시도한다. 모두 실패하면 **Human Escalation**을 트리거하여 사용자에게 actionable suggestions를 제공한다.
292
+ ```
293
+ review_start → agents submit perspectives → consensus → auto-fix
294
+ ```
201
295
 
202
- ## Role Agent System
296
+ 9 built-in **Role Agents** provide multi-perspective review:
203
297
 
204
- **8개의 내장 Role Agent**가 Execute Phase에서 다중 관점을 제공한다.
298
+ | Agent | Domain |
299
+ |-------|--------|
300
+ | `architect` | System design, scalability |
301
+ | `frontend-developer` | UI, React, accessibility |
302
+ | `backend-developer` | API, database, server |
303
+ | `devops-engineer` | CI/CD, infrastructure, monitoring |
304
+ | `qa-engineer` | Testing, quality, automation |
305
+ | `designer` | UX/UI, design systems |
306
+ | `product-planner` | Roadmap, user stories, metrics |
307
+ | `researcher` | Analysis, data, benchmarks |
308
+ | `technical-writer` | Documentation, API docs, guides, README |
205
309
 
206
- | Agent | Domain | Description |
207
- |---|---|---|
208
- | `architect` | system design, scalability | 시스템 아키텍처 전문가 |
209
- | `backend-developer` | api, database, server | 백엔드 개발 전문가 |
210
- | `frontend-developer` | ui, react, css, accessibility | 프론트엔드 개발 전문가 |
211
- | `designer` | ux, ui, design system | UX/UI 디자인 전문가 |
212
- | `devops-engineer` | ci/cd, infra, monitoring | DevOps/인프라 전문가 |
213
- | `product-planner` | roadmap, user story, metrics | 제품 기획 전문가 |
214
- | `qa-engineer` | testing, quality, automation | QA/테스트 전문가 |
215
- | `researcher` | analysis, data, benchmarks | 리서치 및 분석 전문가 |
310
+ 3 built-in **Review Agents** run focused code analysis:
216
311
 
217
- ### 동작 방식
312
+ | Agent | Focus |
313
+ |-------|-------|
314
+ | `security-reviewer` | Injection, XSS, auth vulnerabilities, secrets |
315
+ | `performance-reviewer` | Memory leaks, N+1 queries, bundle size, async |
316
+ | `quality-reviewer` | Readability, SOLID, error handling, DRY |
218
317
 
219
- Execute Phase에서 태스크마다 2단계로 진행된다:
318
+ Use any agent outside the pipeline with `/agent`:
220
319
 
221
- 1. **Role Match** — 태스크의 도메인 키워드와 매칭되는 Role Agent를 동적으로 선택
222
- 2. **Role Consensus** 선택된 Agent들의 관점을 수집하고, 충돌을 해소하여 통합 가이던스 생성
320
+ ```bash
321
+ # List all available agents
322
+ /agent
223
323
 
224
- ### Custom Agent 생성
324
+ # Run a specific agent on any task
325
+ /agent architect "review the module boundaries in this codebase"
326
+ /agent security-reviewer "check this authentication code for vulnerabilities"
327
+ /agent technical-writer "write a README for this module"
328
+ ```
225
329
 
226
- `ges_create_agent` 도구로 **인터뷰 결과를 기반으로 커스텀 Role Agent를 생성**할 있다:
330
+ Generate custom Role Agents from interview results:
227
331
 
228
332
  ```
229
- # 1. 인터뷰 완료 후 agent creation context 요청
230
- ges_create_agent({ action: "start", sessionId: "<id>" })
231
- → systemPrompt + creationPrompt + agentMdSchema 반환
333
+ # Step 1: Get agent creation context
334
+ ges_create_agentaction: "start", sessionId: "<id>"
335
+ returns agentContext (systemPrompt, creationPrompt, schema)
232
336
 
233
- # 2. AGENT.md 콘텐츠 생성 후 제출
234
- ges_create_agent({ action: "submit", sessionId: "<id>", agentContent: "---\nname: ..." })
235
- → agents/{name}/AGENT.md 파일 생성
337
+ # Step 2: Submit the generated AGENT.md content
338
+ ges_create_agentaction: "submit", sessionId: "<id>", agentContent: "..."
339
+ creates agents/{name}/AGENT.md
236
340
  ```
237
341
 
238
- 커스텀 Agent는 `agents/` 디렉토리에 저장되며, 동일 이름의 내장 Agent를 override할 수 있다.
239
-
240
- ### AGENT.md 포맷
241
-
242
- ```yaml
243
- ---
244
- name: security-expert # 에이전트 이름 (kebab-case)
245
- tier: standard # frugal | standard | frontier
246
- pipeline: execute # interview | spec | execute | evaluate
247
- role: true # Role Agent 필수
248
- domain: ["oauth", "jwt"] # 도메인 키워드 목록
249
- description: "보안 전문가" # 한줄 설명
250
342
  ---
251
343
 
252
- System prompt 내용 (Markdown)
253
- ```
254
-
255
- ## MCP Tools
256
-
257
- 5 MCP tools exposed in passthrough mode (no API key required):
344
+ ### Alternative: CLI Direct Mode
258
345
 
259
- | Tool | Description |
260
- |---|---|
261
- | `ges_interview` | Gestalt-driven requirement interview (start, respond, score, complete) |
262
- | `ges_generate_spec` | Generate a structured Spec from completed interview (2-Call) |
263
- | `ges_execute` | Execute Spec via Gestalt pipeline (plan, execute, evaluate, evolve, lateral thinking, role agents) |
264
- | `ges_create_agent` | Create custom Role Agent from completed interview (2-Call: start, submit) |
265
- | `ges_status` | Check session status |
346
+ Requires `ANTHROPIC_API_KEY`. Runs Gestalt directly from the terminal without Claude Code:
266
347
 
267
- ## Skill System
348
+ ```bash
349
+ # Start an interactive interview
350
+ npx @tienne/gestalt interview "my topic"
268
351
 
269
- `skills/` 디렉토리의 SKILL.md 파일로 파이프라인 단계의 동작을 정의한다.
352
+ # Record the session as a GIF
353
+ npx @tienne/gestalt interview "my topic" --record
270
354
 
271
- | Skill | Description |
272
- |---|---|
273
- | `interview` | 인터뷰 프로세스 — 4단계 (start → iterate → score → complete) |
274
- | `spec` | Spec 생성 프로세스 — 2-Call Passthrough 패턴 |
275
- | `execute` | 실행 계획 수립 — 4단계 Planning + Execution + Evaluation |
355
+ # Generate Spec from a completed session
356
+ npx @tienne/gestalt spec <session-id>
276
357
 
277
- ### SKILL.md 포맷
358
+ # List all sessions
359
+ npx @tienne/gestalt status
278
360
 
279
- ```yaml
280
- ---
281
- name: interview
282
- version: "1.0.0"
283
- description: "Gestalt-driven interview"
284
- triggers: ["interview", "clarify requirements"]
285
- inputs:
286
- topic: { type: string, required: true }
287
- outputs: [session, ambiguityScore]
288
- ---
361
+ # Generate gestalt.json config
362
+ npx @tienne/gestalt setup
289
363
 
290
- Skill documentation (Markdown)
364
+ # Start the MCP server manually
365
+ npx @tienne/gestalt serve
291
366
  ```
292
367
 
293
- 커스텀 Skill은 `skills/` 디렉토리에 추가하면 **chokidar hot-reload**로 자동 로드된다.
368
+ #### Recording an interview session
294
369
 
295
- ## Multi-provider LLM
370
+ Add `--record` (or `-r`) to capture the terminal session as a GIF:
296
371
 
297
- Agent System의 **FiguralRouter**가 에이전트의 tier에 따라 다른 LLM provider를 라우팅한다:
372
+ ```bash
373
+ npx @tienne/gestalt interview "my topic" --record
374
+ ```
298
375
 
299
- | Tier | Provider | Model Example | Use Case |
300
- |---|---|---|---|
301
- | `frugal` | OpenAI | gpt-4o-mini | 반복적/저비용 태스크 (proximity-worker) |
302
- | `standard` | Anthropic | claude-sonnet | 일반 태스크 (closure-completer, ground-mapper) |
303
- | `frontier` | Anthropic | claude-opus | 고품질 판단 (continuity-judge) |
376
+ When the interview completes, a GIF is written to the current directory:
304
377
 
305
- 이를 위해 `@anthropic-ai/sdk`와 `openai` 두 SDK가 모두 포함되어 있다. Passthrough 모드에서는 caller가 LLM 호출을 하므로 이 라우팅이 적용되지 않는다.
378
+ ```
379
+ user-auth-interview-20260327.gif
380
+ ```
306
381
 
307
- ## Event Sourcing
382
+ The filename is generated by the LLM from the interview topic (kebab-case) plus a `YYYYMMDD` date stamp. No external binaries are required — recording uses `gifencoder` and `jimp` only.
308
383
 
309
- 모든 세션 활동은 **SQLite WAL 모드 이벤트 스토어**에 기록된다.
384
+ **Resuming an interrupted session:** If a session is interrupted mid-recording, restarting the same session automatically detects the `.frames` file and continues where it left off. Temporary frame data is stored at `.gestalt/recordings/{sessionId}.frames` and deleted once the GIF is written.
310
385
 
311
- - Interview 이벤트: session started/completed, question asked, response recorded, ambiguity scored
312
- - Execute 이벤트: planning steps, task completed, drift measured
313
- - Evaluate 이벤트: structural/contextual results, short-circuit
314
- - Evolution 이벤트: spec patched, lateral thinking, human escalation
315
- - Agent 이벤트: role match/consensus, agent created
386
+ ---
316
387
 
317
- 완전한 audit trail로 세션 히스토리 재생 및 사후 분석이 가능하다.
388
+ ## Configuration
318
389
 
319
- ## CLI Commands
390
+ Generate a `gestalt.json` with IDE autocompletion support:
320
391
 
321
392
  ```bash
322
- gestalt # Start MCP server (default)
323
- gestalt serve # Start MCP server (explicit)
324
- gestalt interview "topic" # Interactive interview
325
- gestalt spec <session-id> # Generate Spec from interview
326
- gestalt status # List all sessions
327
- gestalt setup # Generate gestalt.json config file
328
- gestalt monitor # TUI dashboard (real-time session monitoring)
393
+ npx @tienne/gestalt setup
329
394
  ```
330
395
 
331
- ### TUI Dashboard
332
-
333
- `gestalt monitor` 명령으로 터미널 기반 대시보드를 실행한다:
334
-
335
- - **Session List** — 진행 중인 세션 목록 및 상태
336
- - **Interview Monitor** — 실시간 인터뷰 진행 상황 + Gestalt 원리 표시
337
- - **Evolution Tracker** — Evolution Loop 진행, Drift 수치 게이지
338
- - **Task DAG Tree** — 태스크 의존성 관계 시각화
339
- - **Spec Viewer** — 생성된 Spec 조회
340
- - **Event Log** — 실시간 이벤트 로그
341
-
342
- ## Configuration
343
-
344
- Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE autocompletion support.
345
-
346
396
  ```json
347
397
  {
348
398
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
399
+ "llm": {
400
+ "model": "claude-sonnet-4-20250514"
401
+ },
349
402
  "interview": {
350
403
  "ambiguityThreshold": 0.2,
351
404
  "maxRounds": 10
@@ -358,85 +411,70 @@ Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE aut
358
411
  }
359
412
  ```
360
413
 
361
- Configuration is loaded with the following priority (highest → lowest):
362
-
363
- 1. Code overrides (`loadConfig(overrides)`)
364
- 2. Shell environment variables (`GESTALT_*`)
365
- 3. `.env` file
366
- 4. `gestalt.json`
367
- 5. Built-in defaults
414
+ **Config priority** (highest → lowest): code overrides → shell env vars → `.env` → `gestalt.json` → built-in defaults
368
415
 
369
- Invalid values trigger a warning and fall back to defaults.
416
+ Invalid values emit a warning and fall back to defaults.
370
417
 
371
418
  ### Environment Variables
372
419
 
373
- | Variable | Config Path | Default |
374
- |---|---|---|
375
- | `ANTHROPIC_API_KEY` | `llm.apiKey` | `""` |
376
- | `GESTALT_MODEL` | `llm.model` | `claude-sonnet-4-20250514` |
377
- | `GESTALT_AMBIGUITY_THRESHOLD` | `interview.ambiguityThreshold` | `0.2` |
378
- | `GESTALT_MAX_ROUNDS` | `interview.maxRounds` | `10` |
379
- | `GESTALT_DRIFT_THRESHOLD` | `execute.driftThreshold` | `0.3` |
380
- | `GESTALT_EVOLVE_SUCCESS_THRESHOLD` | `execute.successThreshold` | `0.85` |
381
- | `GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLD` | `execute.goalAlignmentThreshold` | `0.80` |
382
- | `GESTALT_DB_PATH` | `dbPath` | `~/.gestalt/events.db` |
383
- | `GESTALT_SKILLS_DIR` | `skillsDir` | `skills` |
384
- | `GESTALT_AGENTS_DIR` | `agentsDir` | `agents` |
385
- | `GESTALT_LOG_LEVEL` | `logLevel` | `info` |
386
-
387
- ## Operating Modes
388
-
389
- Gestalt supports two operating modes:
390
-
391
- | Mode | API Key | LLM Calls | Use Case |
392
- |---|---|---|---|
393
- | **Passthrough** (default) | Not needed | Caller (e.g., Claude Code) | MCP 통합 환경에서 권장 |
394
- | **Provider-backed** | `ANTHROPIC_API_KEY` 필요 | Gestalt가 직접 호출 | 독립 실행 (CLI 등) |
420
+ | Variable | Config Path | Default | Description |
421
+ |----------|-------------|---------|-------------|
422
+ | `ANTHROPIC_API_KEY` | `llm.apiKey` | `""` | Required only for CLI direct mode |
423
+ | `GESTALT_MODEL` | `llm.model` | `claude-sonnet-4-20250514` | LLM model (provider-backed mode) |
424
+ | `GESTALT_AMBIGUITY_THRESHOLD` | `interview.ambiguityThreshold` | `0.2` | Interview completion threshold |
425
+ | `GESTALT_MAX_ROUNDS` | `interview.maxRounds` | `10` | Max interview rounds |
426
+ | `GESTALT_DRIFT_THRESHOLD` | `execute.driftThreshold` | `0.3` | Task drift detection threshold |
427
+ | `GESTALT_EVOLVE_SUCCESS_THRESHOLD` | `execute.successThreshold` | `0.85` | Evolution success score |
428
+ | `GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLD` | `execute.goalAlignmentThreshold` | `0.80` | Goal alignment threshold |
429
+ | `GESTALT_DB_PATH` | `dbPath` | `~/.gestalt/events.db` | SQLite event store path |
430
+ | `GESTALT_SKILLS_DIR` | `skillsDir` | `skills` | Custom skills directory |
431
+ | `GESTALT_AGENTS_DIR` | `agentsDir` | `agents` | Custom agents directory |
432
+ | `GESTALT_LOG_LEVEL` | `logLevel` | `info` | Log level (`debug`/`info`/`warn`/`error`) |
395
433
 
396
- ### Passthrough Mode
397
-
398
- Gestalt runs in passthrough mode by default: it returns prompts and context to the calling LLM (e.g., Claude Code) instead of making its own API calls. No `ANTHROPIC_API_KEY` needed.
399
-
400
- ### Provider-backed Mode
401
-
402
- `ANTHROPIC_API_KEY`를 설정하면 Gestalt가 직접 LLM 호출을 수행한다. CLI 명령어(`gestalt interview`, `gestalt spec`)는 이 모드에서 동작한다.
434
+ ---
403
435
 
404
- ### N-Call Passthrough Pattern
436
+ ## Architecture
405
437
 
406
- All MCP tools follow a consistent **N-Call Passthrough Pattern**:
438
+ ![Gestalt Architecture](./docs/architecture.png)
439
+ _(Diagram coming soon.)_
407
440
 
408
441
  ```
409
- Call 1: Context 요청 → systemPrompt + actionPrompt 반환
410
- Call N: Caller가 LLM으로 결과 생성 → 제출 및 검증
442
+ Claude Code (you)
443
+
444
+ ▼ MCP / stdio transport
445
+ ┌──────────────────────────────────┐
446
+ │ Gestalt MCP Server │
447
+ │ │
448
+ │ Interview Engine │
449
+ │ ├─ GestaltPrincipleSelector │
450
+ │ ├─ AmbiguityScorer │
451
+ │ └─ SessionManager │
452
+ │ │
453
+ │ Spec Generator │
454
+ │ └─ PassthroughSpecGenerator │
455
+ │ │
456
+ │ Execute Engine │
457
+ │ ├─ DAG Validator │
458
+ │ ├─ DriftDetector │
459
+ │ ├─ EvaluationEngine │
460
+ │ └─ ExecuteSessionManager │
461
+ │ │
462
+ │ Resilience Engine │
463
+ │ ├─ StagnationDetector │
464
+ │ ├─ LateralThinkingPersonas │
465
+ │ └─ HumanEscalation │
466
+ │ │
467
+ │ Agent System │
468
+ │ ├─ RoleAgentRegistry │
469
+ │ ├─ RoleMatchEngine │
470
+ │ └─ RoleConsensusEngine │
471
+ │ │
472
+ │ EventStore (SQLite WAL) │
473
+ └──────────────────────────────────┘
411
474
  ```
412
475
 
413
- | Tool | Pattern | Calls |
414
- |---|---|---|
415
- | `ges_interview` | Multi-Call | start → (respond + score) × N → complete |
416
- | `ges_generate_spec` | 2-Call | specContext 요청 → spec JSON 제출 |
417
- | `ges_execute` | Multi-Call | plan (4-step) → execute → evaluate (2-stage) → evolve |
418
- | `ges_create_agent` | 2-Call | agentContext 요청 → agentContent 제출 |
419
-
420
- ## Benchmarks
421
-
422
- `pnpm bench`로 파이프라인 벤치마크를 실행할 수 있다. 3개의 시나리오가 Interview → Spec → Execute → Evaluate 전체 파이프라인을 통과한다.
423
-
424
- ```bash
425
- pnpm bench # 전체 시나리오 실행
426
- pnpm bench -s auth-system # 특정 시나리오만 실행
427
- pnpm bench -o benchmarks/results # 결과 출력 디렉토리 지정
428
- ```
429
-
430
- ### Latest Results
431
-
432
- | Scenario | Tasks | Completion | Score | Goal Alignment | ACs |
433
- |----------|-------|------------|-------|----------------|-----|
434
- | auth-system | 7 | 100% | 0.92 | 0.90 | 5/5 |
435
- | dashboard | 6 | 100% | 0.88 | 0.85 | 4/4 |
436
- | api-gateway | 8 | 100% | 0.95 | 0.92 | 5/5 |
437
-
438
- **Average Score: 0.92 | Average Goal Alignment: 0.89**
476
+ ---
439
477
 
440
478
  ## License
441
479
 
442
- MIT
480
+ MIT © [tienne](https://github.com/tienne)