@tienne/gestalt 0.5.1 → 0.6.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 (81) hide show
  1. package/README.backup.md +442 -0
  2. package/README.ko.md +466 -0
  3. package/README.md +310 -293
  4. package/dist/package.json +9 -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 +4 -1
  24. package/dist/src/cli/commands/interview.d.ts.map +1 -1
  25. package/dist/src/cli/commands/interview.js +55 -2
  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 +3 -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/server.d.ts.map +1 -1
  37. package/dist/src/mcp/server.js +12 -1
  38. package/dist/src/mcp/server.js.map +1 -1
  39. package/dist/src/mcp/tools/agent-passthrough.d.ts +7 -0
  40. package/dist/src/mcp/tools/agent-passthrough.d.ts.map +1 -0
  41. package/dist/src/mcp/tools/agent-passthrough.js +49 -0
  42. package/dist/src/mcp/tools/agent-passthrough.js.map +1 -0
  43. package/dist/src/recording/filename-generator.d.ts +18 -0
  44. package/dist/src/recording/filename-generator.d.ts.map +1 -0
  45. package/dist/src/recording/filename-generator.js +60 -0
  46. package/dist/src/recording/filename-generator.js.map +1 -0
  47. package/dist/src/recording/gif-generator.d.ts +21 -0
  48. package/dist/src/recording/gif-generator.d.ts.map +1 -0
  49. package/dist/src/recording/gif-generator.js +121 -0
  50. package/dist/src/recording/gif-generator.js.map +1 -0
  51. package/dist/src/recording/recording-dir.d.ts +5 -0
  52. package/dist/src/recording/recording-dir.d.ts.map +1 -0
  53. package/dist/src/recording/recording-dir.js +13 -0
  54. package/dist/src/recording/recording-dir.js.map +1 -0
  55. package/dist/src/recording/resume-detector.d.ts +10 -0
  56. package/dist/src/recording/resume-detector.d.ts.map +1 -0
  57. package/dist/src/recording/resume-detector.js +14 -0
  58. package/dist/src/recording/resume-detector.js.map +1 -0
  59. package/dist/src/recording/segment-merger.d.ts +27 -0
  60. package/dist/src/recording/segment-merger.d.ts.map +1 -0
  61. package/dist/src/recording/segment-merger.js +65 -0
  62. package/dist/src/recording/segment-merger.js.map +1 -0
  63. package/dist/src/recording/terminal-recorder.d.ts +31 -0
  64. package/dist/src/recording/terminal-recorder.d.ts.map +1 -0
  65. package/dist/src/recording/terminal-recorder.js +111 -0
  66. package/dist/src/recording/terminal-recorder.js.map +1 -0
  67. package/package.json +9 -3
  68. package/review-agents/performance-reviewer/AGENT.md +31 -0
  69. package/review-agents/quality-reviewer/AGENT.md +31 -0
  70. package/review-agents/security-reviewer/AGENT.md +32 -0
  71. package/role-agents/architect/AGENT.md +30 -0
  72. package/role-agents/backend-developer/AGENT.md +30 -0
  73. package/role-agents/designer/AGENT.md +30 -0
  74. package/role-agents/devops-engineer/AGENT.md +30 -0
  75. package/role-agents/frontend-developer/AGENT.md +30 -0
  76. package/role-agents/product-planner/AGENT.md +30 -0
  77. package/role-agents/qa-engineer/AGENT.md +30 -0
  78. package/role-agents/researcher/AGENT.md +30 -0
  79. package/role-agents/technical-writer/AGENT.md +212 -0
  80. package/skills/agent/SKILL.md +102 -0
  81. package/skills/execute/SKILL.md +274 -6
package/README.md CHANGED
@@ -3,349 +3,381 @@
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>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="./README.ko.md">한국어</a>
13
18
  </p>
14
19
 
15
20
  ---
16
21
 
17
- ## Prerequisites
22
+ ## What is Gestalt?
18
23
 
19
- - **Node.js >= 20.0.0** (22.x recommended)
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.
20
25
 
21
- ```bash
22
- node --version # v20.x.x 이상이어야 합니다
23
- ```
26
+ > **Prerequisites:** Node.js >= 20.0.0. Use `nvm install 22 && nvm use 22` if needed.
24
27
 
25
- Node 18 이하에서는 MCP SDK의 ES2024 기능 호환성 문제로 실행이 실패합니다. [nvm](https://github.com/nvm-sh/nvm) 사용 시:
28
+ ---
29
+
30
+ ## See it in action
31
+
32
+ > **30 seconds to a structured execution plan** — no API key needed.
26
33
 
27
34
  ```bash
28
- nvm install 22
29
- nvm use 22
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
30
43
  ```
31
44
 
32
- ## Installation
45
+ _(Demo coming soon.)_
33
46
 
34
- ### Claude Plugin (Recommended)
47
+ ---
35
48
 
36
- Claude Code 마켓플레이스를 통해 설치하면 MCP 서버, Skill, Agent, CLAUDE.md가 자동 구성된다.
49
+ ## Why Gestalt?
37
50
 
38
- ```bash
39
- # 1. 마켓플레이스 등록 (최초 1회)
40
- /plugin marketplace add tienne/gestalt
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.
41
52
 
42
- # 2. 플러그인 설치
43
- /plugin install gestalt@gestalt
44
- ```
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.
45
54
 
46
- 플러그인 설치 포함되는 항목:
55
+ ### The Five Gestalt Principles
47
56
 
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 사용 가이드 자동 주입 |
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
54
62
 
55
- 설치 바로 사용 가능:
63
+ > "The whole is greater than the sum of its parts." — Aristotle
56
64
 
57
- ```bash
58
- /interview "사용자 인증 시스템" # 요구사항 인터뷰 시작
59
- /spec # 인터뷰 완료 후 Spec 생성
60
- /execute # Spec 기반 실행 계획 수립 및 실행
61
- ```
65
+ ### How does Passthrough Mode work?
62
66
 
63
- ### Claude Code MCP
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.
64
68
 
65
- ```bash
66
- claude mcp add gestalt -- npx -y @tienne/gestalt
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
67
86
  ```
68
87
 
69
- ### npx (No Install)
88
+ `ANTHROPIC_API_KEY` is not required. All LLM work is handled by Claude Code.
70
89
 
71
- ```bash
72
- npx -y @tienne/gestalt
73
- ```
90
+ ---
74
91
 
75
- ### Global Install
92
+ ## Installation
76
93
 
77
- ```bash
78
- npm install -g @tienne/gestalt
79
- gestalt
80
- ```
94
+ ### Option 1: Claude Code Plugin (Recommended)
81
95
 
82
- ## How It Works
96
+ Bundles the MCP server, slash-command skills, Gestalt agents, and project context — pre-configured in a single install.
83
97
 
98
+ ```bash
99
+ # Step 1: Add to marketplace (one-time setup)
100
+ /plugin marketplace add tienne/gestalt
101
+
102
+ # Step 2: Install the plugin
103
+ /plugin install gestalt@gestalt
84
104
  ```
85
- Interview → Spec → Execute → Evaluate → Evolve
86
-
87
- Lateral Thinking (resilience)
88
-
89
- Human Escalation (if exhausted)
90
- ```
91
105
 
92
- ### 1. Interview
106
+ What you get out of the box:
107
+
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 |
93
114
 
94
- Gestalt 원리가 라운드의 질문 방향을 가이드하여 **모호성 점수(ambiguity score) 0.2 이하**로 떨어질 때까지 요구사항을 명확화한다.
115
+ > **Requires Node.js >= 20.0.0** use [nvm](https://github.com/nvm-sh/nvm) if needed: `nvm install 22 && nvm use 22`
95
116
 
96
- - 프로젝트 유형 자동 감지 (greenfield / brownfield)
97
- - 5가지 Gestalt 원리 기반 동적 질문 선택 알고리즘
98
- - 차원별 가중치 기반 모호성 점수 산출
99
- - 모순 감지 시 Continuity 원리 자동 개입 + 페널티 부여
117
+ ---
100
118
 
101
- ### 2. Spec Generation
119
+ ### Option 2: Claude Code Desktop
102
120
 
103
- 완료된 인터뷰에서 **구조화된 프로젝트 스펙**을 생성한다. 2-Call Passthrough 패턴으로 동작.
121
+ Open your Claude Code Desktop settings and add to `settings.json` (or `claude_desktop_config.json`):
104
122
 
105
- ```
106
- Call 1: specContext 요청 → systemPrompt + specPrompt + 전체 인터뷰 라운드 반환
107
- Call 2: caller가 생성한 Spec JSON 제출 → Zod 검증 후 저장
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "gestalt": {
127
+ "command": "npx",
128
+ "args": ["-y", "@tienne/gestalt"]
129
+ }
130
+ }
131
+ }
108
132
  ```
109
133
 
110
- Spec 구성요소: `goal`, `constraints`, `acceptanceCriteria`, `ontologySchema` (entities + relations), `gestaltAnalysis`
134
+ Restart Claude Code Desktop. The MCP tools become available immediately. Slash commands require the plugin or manual skills setup.
111
135
 
112
- ### 3. Execute (Planning)
136
+ ---
113
137
 
114
- Gestalt 4원리를 **고정 순서**로 적용하여 실행 계획을 수립한다.
138
+ ### Option 3: Claude Code CLI
115
139
 
116
- | Step | Principle | 역할 |
117
- |:---:|---|---|
118
- | 1 | **Figure-Ground** | AC를 essential(figure) / supplementary(ground)로 분류 |
119
- | 2 | **Closure** | AC를 원자적 태스크로 분해 (암묵적 하위 태스크 포함) |
120
- | 3 | **Proximity** | 관련 태스크를 도메인/기능 영역별로 그룹핑 |
121
- | 4 | **Continuity** | DAG 검증 — 순환 의존, 그룹 간 충돌 확인, 위상 정렬 |
140
+ ```bash
141
+ # Via the claude CLI
142
+ claude mcp add gestalt -- npx -y @tienne/gestalt
143
+ ```
122
144
 
123
- 결과물: `ExecutionPlan` (classifiedACs, atomicTasks, taskGroups, dagValidation, criticalPath)
145
+ Or edit `~/.claude/settings.json` directly:
124
146
 
125
- ### 4. Execute (Execution) + Drift Detection
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "gestalt": {
151
+ "command": "npx",
152
+ "args": ["-y", "@tienne/gestalt"]
153
+ }
154
+ }
155
+ }
156
+ ```
126
157
 
127
- 위상 정렬 순서대로 태스크를 실행하며, **Similarity 원리**를 활용하여 유사 패턴의 완료된 태스크를 참조 컨텍스트로 제공한다.
158
+ ---
128
159
 
129
- 태스크 완료 시 **Drift Detection**이 자동 실행된다:
160
+ ## Usage: Full Pipeline
130
161
 
131
- - **3차원 가중합**: Goal(50%) + Constraint(30%) + Ontology(20%)
132
- - Jaccard 기반 키워드 유사도 측정
133
- - Threshold(기본 0.3) 초과 시 `retrospectiveContext` 반환
162
+ ### Step 1 Interview
134
163
 
135
- ### 5. Evaluate (2-Stage)
164
+ Start with any topic. A single rough sentence is enough.
136
165
 
137
- | Stage | 이름 | 방식 | 실패 시 |
138
- |:---:|---|---|---|
139
- | 1 | **Structural** | lint → build → test 자동 검증 | Contextual 스킵 (short-circuit) |
140
- | 2 | **Contextual** | LLM 기반 완료 조건(AC) 검증 + goalAlignment | Evolution Loop 진입 |
166
+ ```bash
167
+ /interview "I want to build a checkout flow with Stripe"
168
+ ```
141
169
 
142
- 성공 조건: `overallScore 0.85` && `goalAlignment 0.80`
170
+ Gestalt conducts a multi-round interview. Each round targets a specific ambiguity dimension:
143
171
 
144
- ### 6. Evolution Loop
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?
145
177
 
146
- Evaluate 실패 3가지 경로로 자동 복구를 시도한다:
178
+ The interview continues until the **ambiguity score reaches ≤ 0.2**:
147
179
 
148
- **Flow A — Structural Fix** (structural 실패 시)
149
180
  ```
150
- evolve_fixfixTasks 제출 re-evaluate
181
+ Round 1 ambiguity: 0.72 (lots of unknowns)
182
+ Round 4 → ambiguity: 0.45 (getting clearer)
183
+ Round 8 → ambiguity: 0.19 ✓ ready for Spec
151
184
  ```
152
185
 
153
- **Flow B — Contextual Evolution** (contextual 점수 미달 시)
154
- ```
155
- evolve → evolve_patch(specPatch) → evolve_re_execute(impacted tasks) → re-evaluate
156
- ```
186
+ ---
157
187
 
158
- Spec Patch 범위: 완료 조건(AC) + constraints 자유 수정, ontology 추가/변경만, **goal 변경 금지**
188
+ ### Step 2 Spec Generation
159
189
 
160
- **Flow C Lateral Thinking** (stagnation 감지 시 자동 분기)
190
+ When the ambiguity score reaches 0.2, run:
161
191
 
162
- evolve 호출 시 stagnation이 감지되면 즉시 종료하는 대신 **Lateral Thinking Persona**로 자동 분기한다. (아래 섹션 참조)
192
+ ```bash
193
+ /spec
194
+ ```
163
195
 
164
- **종료 조건:**
196
+ Generates a structured **Spec** — a validated JSON document that drives the rest of the pipeline:
165
197
 
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 모두 실패 |
198
+ ```
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
204
+ ```
174
205
 
175
- ## Gestalt Principles
206
+ ---
176
207
 
177
- Each letter in the logo represents a core Gestalt principle used throughout the system:
208
+ ### Step 3 Execute (Planning + Execution)
178
209
 
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 |
210
+ Transforms the Spec into a dependency-aware execution plan and runs it:
186
211
 
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).
212
+ ```bash
213
+ /execute
214
+ ```
188
215
 
189
- ## Lateral Thinking Personas
216
+ **Planning phase** applies 4 Gestalt principles in a fixed sequence:
190
217
 
191
- Evolution Loop에서 stagnation이 감지되면 패턴을 분류하고 매칭되는 persona를 활성화한다:
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 |
192
224
 
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 |
225
+ **Execution phase** runs tasks in topological order. After each task, **drift detection** checks alignment with the Spec:
199
226
 
200
- 4개 persona를 순차적으로 시도한다. 모두 실패하면 **Human Escalation**을 트리거하여 사용자에게 actionable suggestions를 제공한다.
227
+ - 3-dimensional score: Goal (50%) + Constraint (30%) + Ontology (20%)
228
+ - Jaccard similarity-based measurement
229
+ - Auto-triggers a retrospective when drift exceeds threshold
201
230
 
202
- ## Role Agent System
231
+ ---
203
232
 
204
- **8개의 내장 Role Agent**가 Execute Phase에서 다중 관점을 제공한다.
233
+ ### Step 4 Evaluate
205
234
 
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 | 리서치 및 분석 전문가 |
235
+ Execution triggers a 2-stage evaluation:
216
236
 
217
- ### 동작 방식
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 |
218
241
 
219
- Execute Phase에서 태스크마다 2단계로 진행된다:
242
+ **Success condition:** `score 0.85` AND `goalAlignment ≥ 0.80`
220
243
 
221
- 1. **Role Match** — 태스크의 도메인 키워드와 매칭되는 Role Agent를 동적으로 선택
222
- 2. **Role Consensus** — 선택된 Agent들의 관점을 수집하고, 충돌을 해소하여 통합 가이던스 생성
244
+ ---
223
245
 
224
- ### Custom Agent 생성
246
+ ### Step 5 — Evolve
225
247
 
226
- `ges_create_agent` 도구로 **인터뷰 결과를 기반으로 커스텀 Role Agent를 생성**할 있다:
248
+ When evaluation fails, the Evolution Loop engages. Three recovery flows are available:
227
249
 
250
+ **Flow A — Structural Fix** (when lint/build/test fails)
251
+ ```
252
+ evolve_fix → submit fix tasks → re-evaluate
228
253
  ```
229
- # 1. 인터뷰 완료 후 agent creation context 요청
230
- ges_create_agent({ action: "start", sessionId: "<id>" })
231
- → systemPrompt + creationPrompt + agentMdSchema 반환
232
254
 
233
- # 2. AGENT.md 콘텐츠 생성 제출
234
- ges_create_agent({ action: "submit", sessionId: "<id>", agentContent: "---\nname: ..." })
235
- agents/{name}/AGENT.md 파일 생성
255
+ **Flow B Contextual Evolution** (when AC score is too low)
256
+ ```
257
+ evolve patch Spec (ACs/constraints) re-execute impacted tasks → re-evaluate
236
258
  ```
237
259
 
238
- 커스텀 Agent는 `agents/` 디렉토리에 저장되며, 동일 이름의 내장 Agent를 override할 있다.
260
+ Spec patch scope: ACs and constraints are freely editable; ontology can be extended; **goal is immutable**.
239
261
 
240
- ### AGENT.md 포맷
262
+ **Flow C — Lateral Thinking** (when stagnation is detected)
241
263
 
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
- ---
264
+ Gestalt rotates through lateral thinking personas rather than terminating:
251
265
 
252
- System prompt 내용 (Markdown)
253
- ```
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 |
254
272
 
255
- ## MCP Tools
273
+ When all 4 personas are exhausted, the session terminates with **Human Escalation** — a structured list of actionable suggestions for manual resolution.
256
274
 
257
- 5 MCP tools exposed in passthrough mode (no API key required):
275
+ **Termination conditions:**
258
276
 
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 |
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 |
266
285
 
267
- ## Skill System
286
+ ---
268
287
 
269
- `skills/` 디렉토리의 SKILL.md 파일로 파이프라인 단계의 동작을 정의한다.
288
+ ### Step 6 Code Review
270
289
 
271
- | Skill | Description |
272
- |---|---|
273
- | `interview` | 인터뷰 프로세스 — 4단계 (start → iterate → score → complete) |
274
- | `spec` | Spec 생성 프로세스 — 2-Call Passthrough 패턴 |
275
- | `execute` | 실행 계획 수립 — 4단계 Planning + Execution + Evaluation |
290
+ When evolution finishes, code review starts automatically:
276
291
 
277
- ### SKILL.md 포맷
292
+ ```
293
+ review_start → agents submit perspectives → consensus → auto-fix
294
+ ```
278
295
 
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
- ---
296
+ 9 built-in **Role Agents** provide multi-perspective review:
289
297
 
290
- Skill documentation (Markdown)
291
- ```
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 |
292
309
 
293
- 커스텀 Skill은 `skills/` 디렉토리에 추가하면 **chokidar hot-reload**로 자동 로드된다.
310
+ 3 built-in **Review Agents** run focused code analysis:
294
311
 
295
- ## Multi-provider LLM
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 |
296
317
 
297
- Agent System의 **FiguralRouter**가 에이전트의 tier에 따라 다른 LLM provider를 라우팅한다:
318
+ Use any agent outside the pipeline with `/agent`:
298
319
 
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) |
320
+ ```bash
321
+ # List all available agents
322
+ /agent
304
323
 
305
- 이를 위해 `@anthropic-ai/sdk`와 `openai` SDK가 모두 포함되어 있다. Passthrough 모드에서는 caller가 LLM 호출을 하므로 이 라우팅이 적용되지 않는다.
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
+ ```
306
329
 
307
- ## Event Sourcing
330
+ Generate custom Role Agents from interview results:
308
331
 
309
- 모든 세션 활동은 **SQLite WAL 모드 이벤트 스토어**에 기록된다.
332
+ ```
333
+ # Step 1: Get agent creation context
334
+ ges_create_agent → action: "start", sessionId: "<id>"
335
+ → returns agentContext (systemPrompt, creationPrompt, schema)
310
336
 
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
337
+ # Step 2: Submit the generated AGENT.md content
338
+ ges_create_agent → action: "submit", sessionId: "<id>", agentContent: "..."
339
+ → creates agents/{name}/AGENT.md
340
+ ```
316
341
 
317
- 완전한 audit trail로 세션 히스토리 재생 및 사후 분석이 가능하다.
342
+ ---
318
343
 
319
- ## CLI Commands
344
+ ### Alternative: CLI Direct Mode
345
+
346
+ Requires `ANTHROPIC_API_KEY`. Runs Gestalt directly from the terminal without Claude Code:
320
347
 
321
348
  ```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)
329
- ```
349
+ # Start an interactive interview
350
+ npx @tienne/gestalt interview "my topic"
330
351
 
331
- ### TUI Dashboard
352
+ # Generate Spec from a completed session
353
+ npx @tienne/gestalt spec <session-id>
332
354
 
333
- `gestalt monitor` 명령으로 터미널 기반 대시보드를 실행한다:
355
+ # List all sessions
356
+ npx @tienne/gestalt status
334
357
 
335
- - **Session List** — 진행 중인 세션 목록 및 상태
336
- - **Interview Monitor** — 실시간 인터뷰 진행 상황 + Gestalt 원리 표시
337
- - **Evolution Tracker** — Evolution Loop 진행, Drift 수치 게이지
338
- - **Task DAG Tree** 태스크 의존성 관계 시각화
339
- - **Spec Viewer** — 생성된 Spec 조회
340
- - **Event Log** — 실시간 이벤트 로그
358
+ # Generate gestalt.json config
359
+ npx @tienne/gestalt setup
360
+
361
+ # Start the MCP server manually
362
+ npx @tienne/gestalt serve
363
+ ```
364
+
365
+ ---
341
366
 
342
367
  ## Configuration
343
368
 
344
- Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE autocompletion support.
369
+ Generate a `gestalt.json` with IDE autocompletion support:
370
+
371
+ ```bash
372
+ npx @tienne/gestalt setup
373
+ ```
345
374
 
346
375
  ```json
347
376
  {
348
377
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
378
+ "llm": {
379
+ "model": "claude-sonnet-4-20250514"
380
+ },
349
381
  "interview": {
350
382
  "ambiguityThreshold": 0.2,
351
383
  "maxRounds": 10
@@ -358,85 +390,70 @@ Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE aut
358
390
  }
359
391
  ```
360
392
 
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
393
+ **Config priority** (highest → lowest): code overrides → shell env vars → `.env` → `gestalt.json` → built-in defaults
368
394
 
369
- Invalid values trigger a warning and fall back to defaults.
395
+ Invalid values emit a warning and fall back to defaults.
370
396
 
371
397
  ### Environment Variables
372
398
 
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 등) |
399
+ | Variable | Config Path | Default | Description |
400
+ |----------|-------------|---------|-------------|
401
+ | `ANTHROPIC_API_KEY` | `llm.apiKey` | `""` | Required only for CLI direct mode |
402
+ | `GESTALT_MODEL` | `llm.model` | `claude-sonnet-4-20250514` | LLM model (provider-backed mode) |
403
+ | `GESTALT_AMBIGUITY_THRESHOLD` | `interview.ambiguityThreshold` | `0.2` | Interview completion threshold |
404
+ | `GESTALT_MAX_ROUNDS` | `interview.maxRounds` | `10` | Max interview rounds |
405
+ | `GESTALT_DRIFT_THRESHOLD` | `execute.driftThreshold` | `0.3` | Task drift detection threshold |
406
+ | `GESTALT_EVOLVE_SUCCESS_THRESHOLD` | `execute.successThreshold` | `0.85` | Evolution success score |
407
+ | `GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLD` | `execute.goalAlignmentThreshold` | `0.80` | Goal alignment threshold |
408
+ | `GESTALT_DB_PATH` | `dbPath` | `~/.gestalt/events.db` | SQLite event store path |
409
+ | `GESTALT_SKILLS_DIR` | `skillsDir` | `skills` | Custom skills directory |
410
+ | `GESTALT_AGENTS_DIR` | `agentsDir` | `agents` | Custom agents directory |
411
+ | `GESTALT_LOG_LEVEL` | `logLevel` | `info` | Log level (`debug`/`info`/`warn`/`error`) |
395
412
 
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`)는 이 모드에서 동작한다.
413
+ ---
403
414
 
404
- ### N-Call Passthrough Pattern
415
+ ## Architecture
405
416
 
406
- All MCP tools follow a consistent **N-Call Passthrough Pattern**:
417
+ ![Gestalt Architecture](./docs/architecture.png)
418
+ _(Diagram coming soon.)_
407
419
 
408
420
  ```
409
- Call 1: Context 요청 → systemPrompt + actionPrompt 반환
410
- Call N: Caller가 LLM으로 결과 생성 → 제출 및 검증
421
+ Claude Code (you)
422
+
423
+ ▼ MCP / stdio transport
424
+ ┌──────────────────────────────────┐
425
+ │ Gestalt MCP Server │
426
+ │ │
427
+ │ Interview Engine │
428
+ │ ├─ GestaltPrincipleSelector │
429
+ │ ├─ AmbiguityScorer │
430
+ │ └─ SessionManager │
431
+ │ │
432
+ │ Spec Generator │
433
+ │ └─ PassthroughSpecGenerator │
434
+ │ │
435
+ │ Execute Engine │
436
+ │ ├─ DAG Validator │
437
+ │ ├─ DriftDetector │
438
+ │ ├─ EvaluationEngine │
439
+ │ └─ ExecuteSessionManager │
440
+ │ │
441
+ │ Resilience Engine │
442
+ │ ├─ StagnationDetector │
443
+ │ ├─ LateralThinkingPersonas │
444
+ │ └─ HumanEscalation │
445
+ │ │
446
+ │ Agent System │
447
+ │ ├─ RoleAgentRegistry │
448
+ │ ├─ RoleMatchEngine │
449
+ │ └─ RoleConsensusEngine │
450
+ │ │
451
+ │ EventStore (SQLite WAL) │
452
+ └──────────────────────────────────┘
411
453
  ```
412
454
 
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**
455
+ ---
439
456
 
440
457
  ## License
441
458
 
442
- MIT
459
+ MIT © [tienne](https://github.com/tienne)