@tienne/gestalt 0.5.0 → 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 (83) hide show
  1. package/README.backup.md +442 -0
  2. package/README.ko.md +466 -0
  3. package/README.md +315 -283
  4. package/dist/bin/gestalt.js +8 -0
  5. package/dist/bin/gestalt.js.map +1 -1
  6. package/dist/package.json +9 -3
  7. package/dist/review-agents/performance-reviewer/AGENT.md +31 -0
  8. package/dist/review-agents/quality-reviewer/AGENT.md +31 -0
  9. package/dist/review-agents/security-reviewer/AGENT.md +32 -0
  10. package/dist/role-agents/architect/AGENT.md +30 -0
  11. package/dist/role-agents/backend-developer/AGENT.md +30 -0
  12. package/dist/role-agents/designer/AGENT.md +30 -0
  13. package/dist/role-agents/devops-engineer/AGENT.md +30 -0
  14. package/dist/role-agents/frontend-developer/AGENT.md +30 -0
  15. package/dist/role-agents/product-planner/AGENT.md +30 -0
  16. package/dist/role-agents/qa-engineer/AGENT.md +30 -0
  17. package/dist/role-agents/researcher/AGENT.md +30 -0
  18. package/dist/role-agents/technical-writer/AGENT.md +212 -0
  19. package/dist/skills/agent/SKILL.md +102 -0
  20. package/dist/skills/execute/SKILL.md +274 -6
  21. package/dist/src/agent/role-agent-registry.d.ts +4 -2
  22. package/dist/src/agent/role-agent-registry.d.ts.map +1 -1
  23. package/dist/src/agent/role-agent-registry.js +12 -3
  24. package/dist/src/agent/role-agent-registry.js.map +1 -1
  25. package/dist/src/cli/commands/interview.d.ts +4 -1
  26. package/dist/src/cli/commands/interview.d.ts.map +1 -1
  27. package/dist/src/cli/commands/interview.js +55 -2
  28. package/dist/src/cli/commands/interview.js.map +1 -1
  29. package/dist/src/cli/index.d.ts.map +1 -1
  30. package/dist/src/cli/index.js +3 -2
  31. package/dist/src/cli/index.js.map +1 -1
  32. package/dist/src/core/config.d.ts +3 -0
  33. package/dist/src/core/config.d.ts.map +1 -1
  34. package/dist/src/core/config.js +4 -0
  35. package/dist/src/core/config.js.map +1 -1
  36. package/dist/src/core/types.d.ts +28 -0
  37. package/dist/src/core/types.d.ts.map +1 -1
  38. package/dist/src/mcp/server.d.ts.map +1 -1
  39. package/dist/src/mcp/server.js +12 -1
  40. package/dist/src/mcp/server.js.map +1 -1
  41. package/dist/src/mcp/tools/agent-passthrough.d.ts +7 -0
  42. package/dist/src/mcp/tools/agent-passthrough.d.ts.map +1 -0
  43. package/dist/src/mcp/tools/agent-passthrough.js +49 -0
  44. package/dist/src/mcp/tools/agent-passthrough.js.map +1 -0
  45. package/dist/src/recording/filename-generator.d.ts +18 -0
  46. package/dist/src/recording/filename-generator.d.ts.map +1 -0
  47. package/dist/src/recording/filename-generator.js +60 -0
  48. package/dist/src/recording/filename-generator.js.map +1 -0
  49. package/dist/src/recording/gif-generator.d.ts +21 -0
  50. package/dist/src/recording/gif-generator.d.ts.map +1 -0
  51. package/dist/src/recording/gif-generator.js +121 -0
  52. package/dist/src/recording/gif-generator.js.map +1 -0
  53. package/dist/src/recording/recording-dir.d.ts +5 -0
  54. package/dist/src/recording/recording-dir.d.ts.map +1 -0
  55. package/dist/src/recording/recording-dir.js +13 -0
  56. package/dist/src/recording/recording-dir.js.map +1 -0
  57. package/dist/src/recording/resume-detector.d.ts +10 -0
  58. package/dist/src/recording/resume-detector.d.ts.map +1 -0
  59. package/dist/src/recording/resume-detector.js +14 -0
  60. package/dist/src/recording/resume-detector.js.map +1 -0
  61. package/dist/src/recording/segment-merger.d.ts +27 -0
  62. package/dist/src/recording/segment-merger.d.ts.map +1 -0
  63. package/dist/src/recording/segment-merger.js +65 -0
  64. package/dist/src/recording/segment-merger.js.map +1 -0
  65. package/dist/src/recording/terminal-recorder.d.ts +31 -0
  66. package/dist/src/recording/terminal-recorder.d.ts.map +1 -0
  67. package/dist/src/recording/terminal-recorder.js +111 -0
  68. package/dist/src/recording/terminal-recorder.js.map +1 -0
  69. package/package.json +9 -3
  70. package/review-agents/performance-reviewer/AGENT.md +31 -0
  71. package/review-agents/quality-reviewer/AGENT.md +31 -0
  72. package/review-agents/security-reviewer/AGENT.md +32 -0
  73. package/role-agents/architect/AGENT.md +30 -0
  74. package/role-agents/backend-developer/AGENT.md +30 -0
  75. package/role-agents/designer/AGENT.md +30 -0
  76. package/role-agents/devops-engineer/AGENT.md +30 -0
  77. package/role-agents/frontend-developer/AGENT.md +30 -0
  78. package/role-agents/product-planner/AGENT.md +30 -0
  79. package/role-agents/qa-engineer/AGENT.md +30 -0
  80. package/role-agents/researcher/AGENT.md +30 -0
  81. package/role-agents/technical-writer/AGENT.md +212 -0
  82. package/skills/agent/SKILL.md +102 -0
  83. package/skills/execute/SKILL.md +274 -6
package/README.md CHANGED
@@ -3,334 +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
- ## Installation
22
+ ## What is Gestalt?
18
23
 
19
- ### Claude Plugin (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
- Claude Code 마켓플레이스를 통해 설치하면 MCP 서버, Skill, Agent, CLAUDE.md가 자동 구성된다.
26
+ > **Prerequisites:** Node.js >= 20.0.0. Use `nvm install 22 && nvm use 22` if needed.
22
27
 
23
- ```bash
24
- # 1. 마켓플레이스 등록 (최초 1회)
25
- /plugin marketplace add tienne/gestalt
28
+ ---
26
29
 
27
- # 2. 플러그인 설치
28
- /plugin install gestalt@gestalt
29
- ```
30
+ ## See it in action
30
31
 
31
- 플러그인 설치 포함되는 항목:
32
+ > **30 seconds to a structured execution plan** — no API key needed.
32
33
 
33
- | 항목 | 내용 |
34
- |------|------|
35
- | **MCP Tools** | `ges_interview`, `ges_generate_spec`, `ges_execute`, `ges_create_agent`, `ges_status` |
36
- | **Skills** | `/interview`, `/spec`, `/execute` (slash command) |
37
- | **Agents** | 5개 Gestalt Agent + 8개 Role Agent |
38
- | **CLAUDE.md** | 프로젝트 컨텍스트 및 MCP 사용 가이드 자동 주입 |
34
+ ```bash
35
+ # Start a Gestalt-driven requirements interview
36
+ /interview "user authentication system"
39
37
 
40
- 설치 바로 사용 가능:
38
+ # Once the interview is done, generate a structured Spec
39
+ /spec
41
40
 
42
- ```bash
43
- /interview "사용자 인증 시스템" # 요구사항 인터뷰 시작
44
- /spec # 인터뷰 완료 후 Spec 생성
45
- /execute # Spec 기반 실행 계획 수립 및 실행
41
+ # Transform the Spec into a validated execution plan and run it
42
+ /execute
46
43
  ```
47
44
 
48
- ### Claude Code MCP
45
+ _(Demo coming soon.)_
49
46
 
50
- ```bash
51
- claude mcp add gestalt -- npx -y @tienne/gestalt
52
- ```
47
+ ---
53
48
 
54
- ### npx (No Install)
49
+ ## Why Gestalt?
55
50
 
56
- ```bash
57
- npx -y @tienne/gestalt
58
- ```
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.
59
52
 
60
- ### Global Install
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.
61
54
 
62
- ```bash
63
- npm install -g @tienne/gestalt
64
- gestalt
65
- ```
55
+ ### The Five Gestalt Principles
66
56
 
67
- ## How It Works
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
68
 
69
69
  ```
70
- Interview Spec → Execute → Evaluate → Evolve
71
-
72
- Lateral Thinking (resilience)
73
-
74
- Human Escalation (if exhausted)
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
75
86
  ```
76
87
 
77
- ### 1. Interview
88
+ `ANTHROPIC_API_KEY` is not required. All LLM work is handled by Claude Code.
78
89
 
79
- Gestalt 원리가 각 라운드의 질문 방향을 가이드하여 **모호성 점수(ambiguity score)가 0.2 이하**로 떨어질 때까지 요구사항을 명확화한다.
90
+ ---
80
91
 
81
- - 프로젝트 유형 자동 감지 (greenfield / brownfield)
82
- - 5가지 Gestalt 원리 기반 동적 질문 선택 알고리즘
83
- - 차원별 가중치 기반 모호성 점수 산출
84
- - 모순 감지 시 Continuity 원리 자동 개입 + 페널티 부여
92
+ ## Installation
85
93
 
86
- ### 2. Spec Generation
94
+ ### Option 1: Claude Code Plugin (Recommended)
87
95
 
88
- 완료된 인터뷰에서 **구조화된 프로젝트 스펙**을 생성한다. 2-Call Passthrough 패턴으로 동작.
96
+ Bundles the MCP server, slash-command skills, Gestalt agents, and project context — pre-configured in a single install.
89
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
90
104
  ```
91
- Call 1: specContext 요청 → systemPrompt + specPrompt + 전체 인터뷰 라운드 반환
92
- Call 2: caller가 생성한 Spec JSON 제출 → Zod 검증 후 저장
93
- ```
94
105
 
95
- Spec 구성요소: `goal`, `constraints`, `acceptanceCriteria`, `ontologySchema` (entities + relations), `gestaltAnalysis`
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 |
114
+
115
+ > **Requires Node.js >= 20.0.0** — use [nvm](https://github.com/nvm-sh/nvm) if needed: `nvm install 22 && nvm use 22`
116
+
117
+ ---
96
118
 
97
- ### 3. Execute (Planning)
119
+ ### Option 2: Claude Code Desktop
98
120
 
99
- Gestalt 4원리를 **고정 순서**로 적용하여 실행 계획을 수립한다.
121
+ Open your Claude Code Desktop settings and add to `settings.json` (or `claude_desktop_config.json`):
100
122
 
101
- | Step | Principle | 역할 |
102
- |:---:|---|---|
103
- | 1 | **Figure-Ground** | AC를 essential(figure) / supplementary(ground)로 분류 |
104
- | 2 | **Closure** | AC를 원자적 태스크로 분해 (암묵적 하위 태스크 포함) |
105
- | 3 | **Proximity** | 관련 태스크를 도메인/기능 영역별로 그룹핑 |
106
- | 4 | **Continuity** | DAG 검증 — 순환 의존, 그룹 간 충돌 확인, 위상 정렬 |
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "gestalt": {
127
+ "command": "npx",
128
+ "args": ["-y", "@tienne/gestalt"]
129
+ }
130
+ }
131
+ }
132
+ ```
107
133
 
108
- 결과물: `ExecutionPlan` (classifiedACs, atomicTasks, taskGroups, dagValidation, criticalPath)
134
+ Restart Claude Code Desktop. The MCP tools become available immediately. Slash commands require the plugin or manual skills setup.
109
135
 
110
- ### 4. Execute (Execution) + Drift Detection
136
+ ---
111
137
 
112
- 위상 정렬 순서대로 태스크를 실행하며, **Similarity 원리**를 활용하여 유사 패턴의 완료된 태스크를 참조 컨텍스트로 제공한다.
138
+ ### Option 3: Claude Code CLI
113
139
 
114
- 매 태스크 완료 시 **Drift Detection**이 자동 실행된다:
140
+ ```bash
141
+ # Via the claude CLI
142
+ claude mcp add gestalt -- npx -y @tienne/gestalt
143
+ ```
115
144
 
116
- - **3차원 가중합**: Goal(50%) + Constraint(30%) + Ontology(20%)
117
- - Jaccard 기반 키워드 유사도 측정
118
- - Threshold(기본 0.3) 초과 시 `retrospectiveContext` 반환
145
+ Or edit `~/.claude/settings.json` directly:
119
146
 
120
- ### 5. Evaluate (2-Stage)
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "gestalt": {
151
+ "command": "npx",
152
+ "args": ["-y", "@tienne/gestalt"]
153
+ }
154
+ }
155
+ }
156
+ ```
121
157
 
122
- | Stage | 이름 | 방식 | 실패 시 |
123
- |:---:|---|---|---|
124
- | 1 | **Structural** | lint → build → test 자동 검증 | Contextual 스킵 (short-circuit) |
125
- | 2 | **Contextual** | LLM 기반 완료 조건(AC) 검증 + goalAlignment | Evolution Loop 진입 |
158
+ ---
126
159
 
127
- 성공 조건: `overallScore ≥ 0.85` && `goalAlignment ≥ 0.80`
160
+ ## Usage: Full Pipeline
128
161
 
129
- ### 6. Evolution Loop
162
+ ### Step 1 — Interview
130
163
 
131
- Evaluate 실패 3가지 경로로 자동 복구를 시도한다:
164
+ Start with any topic. A single rough sentence is enough.
132
165
 
133
- **Flow A — Structural Fix** (structural 실패 시)
134
- ```
135
- evolve_fix → fixTasks 제출 → re-evaluate
166
+ ```bash
167
+ /interview "I want to build a checkout flow with Stripe"
136
168
  ```
137
169
 
138
- **Flow B Contextual Evolution** (contextual 점수 미달 시)
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**:
179
+
139
180
  ```
140
- evolveevolve_patch(specPatch) evolve_re_execute(impacted tasks) → 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
141
184
  ```
142
185
 
143
- Spec Patch 범위: 완료 조건(AC) + constraints 자유 수정, ontology 추가/변경만, **goal 변경 금지**
186
+ ---
144
187
 
145
- **Flow CLateral Thinking** (stagnation 감지 시 자동 분기)
188
+ ### Step 2 Spec Generation
146
189
 
147
- evolve 호출 stagnation이 감지되면 즉시 종료하는 대신 **Lateral Thinking Persona**로 자동 분기한다. (아래 섹션 참조)
190
+ When the ambiguity score reaches 0.2, run:
148
191
 
149
- **종료 조건:**
192
+ ```bash
193
+ /spec
194
+ ```
150
195
 
151
- | 조건 | 설명 |
152
- |---|---|
153
- | `success` | score ≥ 0.85, goalAlignment ≥ 0.80 |
154
- | `stagnation` | 2회 연속 delta < 0.05 |
155
- | `oscillation` | 2회 연속 점수 진동 (up↔down) |
156
- | `hard_cap` | structural 3회 + contextual 3회 실패 |
157
- | `caller` | 사용자 수동 종료 |
158
- | `human_escalation` | Lateral Thinking 4개 persona 모두 실패 |
196
+ Generates a structured **Spec** — a validated JSON document that drives the rest of the pipeline:
159
197
 
160
- ## Gestalt Principles
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
+ ```
161
205
 
162
- Each letter in the logo represents a core Gestalt principle used throughout the system:
206
+ ---
207
+
208
+ ### Step 3 — Execute (Planning + Execution)
163
209
 
164
- | Principle | Role in Gestalt |
165
- |-----------|----------------|
166
- | **Closure** | Finds implicit requirements that aren't explicitly stated |
167
- | **Proximity** | Groups related requirements and tasks by domain |
168
- | **Continuation** | Validates dependency chains and execution order (DAG) |
169
- | **Similarity** | Identifies repeating patterns across requirements |
170
- | **Figure & Ground** | Separates core (figure) from supporting (ground) requirements |
210
+ Transforms the Spec into a dependency-aware execution plan and runs it:
171
211
 
172
- > 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
+ ```
173
215
 
174
- ## Lateral Thinking Personas
216
+ **Planning phase** applies 4 Gestalt principles in a fixed sequence:
175
217
 
176
- 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 |
177
224
 
178
- | Stagnation Pattern | Persona | Strategy |
179
- |--------------------|---------|----------|
180
- | Spinning (hard cap) | **Multistability** | See from a different angle |
181
- | Oscillation | **Simplicity** | Simplify and converge |
182
- | No drift | **Reification** | Fill in missing pieces |
183
- | Diminishing returns | **Invariance** | Replicate success patterns |
225
+ **Execution phase** runs tasks in topological order. After each task, **drift detection** checks alignment with the Spec:
184
226
 
185
- 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
186
230
 
187
- ## Role Agent System
231
+ ---
188
232
 
189
- **8개의 내장 Role Agent**가 Execute Phase에서 다중 관점을 제공한다.
233
+ ### Step 4 Evaluate
190
234
 
191
- | Agent | Domain | Description |
192
- |---|---|---|
193
- | `architect` | system design, scalability | 시스템 아키텍처 전문가 |
194
- | `backend-developer` | api, database, server | 백엔드 개발 전문가 |
195
- | `frontend-developer` | ui, react, css, accessibility | 프론트엔드 개발 전문가 |
196
- | `designer` | ux, ui, design system | UX/UI 디자인 전문가 |
197
- | `devops-engineer` | ci/cd, infra, monitoring | DevOps/인프라 전문가 |
198
- | `product-planner` | roadmap, user story, metrics | 제품 기획 전문가 |
199
- | `qa-engineer` | testing, quality, automation | QA/테스트 전문가 |
200
- | `researcher` | analysis, data, benchmarks | 리서치 및 분석 전문가 |
235
+ Execution triggers a 2-stage evaluation:
201
236
 
202
- ### 동작 방식
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 |
203
241
 
204
- Execute Phase에서 태스크마다 2단계로 진행된다:
242
+ **Success condition:** `score 0.85` AND `goalAlignment ≥ 0.80`
205
243
 
206
- 1. **Role Match** — 태스크의 도메인 키워드와 매칭되는 Role Agent를 동적으로 선택
207
- 2. **Role Consensus** — 선택된 Agent들의 관점을 수집하고, 충돌을 해소하여 통합 가이던스 생성
244
+ ---
208
245
 
209
- ### Custom Agent 생성
246
+ ### Step 5 — Evolve
210
247
 
211
- `ges_create_agent` 도구로 **인터뷰 결과를 기반으로 커스텀 Role Agent를 생성**할 있다:
248
+ When evaluation fails, the Evolution Loop engages. Three recovery flows are available:
212
249
 
250
+ **Flow A — Structural Fix** (when lint/build/test fails)
251
+ ```
252
+ evolve_fix → submit fix tasks → re-evaluate
213
253
  ```
214
- # 1. 인터뷰 완료 후 agent creation context 요청
215
- ges_create_agent({ action: "start", sessionId: "<id>" })
216
- → systemPrompt + creationPrompt + agentMdSchema 반환
217
254
 
218
- # 2. AGENT.md 콘텐츠 생성 제출
219
- ges_create_agent({ action: "submit", sessionId: "<id>", agentContent: "---\nname: ..." })
220
- 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
221
258
  ```
222
259
 
223
- 커스텀 Agent는 `agents/` 디렉토리에 저장되며, 동일 이름의 내장 Agent를 override할 있다.
260
+ Spec patch scope: ACs and constraints are freely editable; ontology can be extended; **goal is immutable**.
224
261
 
225
- ### AGENT.md 포맷
262
+ **Flow C — Lateral Thinking** (when stagnation is detected)
226
263
 
227
- ```yaml
228
- ---
229
- name: security-expert # 에이전트 이름 (kebab-case)
230
- tier: standard # frugal | standard | frontier
231
- pipeline: execute # interview | spec | execute | evaluate
232
- role: true # Role Agent 필수
233
- domain: ["oauth", "jwt"] # 도메인 키워드 목록
234
- description: "보안 전문가" # 한줄 설명
235
- ---
264
+ Gestalt rotates through lateral thinking personas rather than terminating:
236
265
 
237
- System prompt 내용 (Markdown)
238
- ```
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 |
239
272
 
240
- ## MCP Tools
273
+ When all 4 personas are exhausted, the session terminates with **Human Escalation** — a structured list of actionable suggestions for manual resolution.
241
274
 
242
- 5 MCP tools exposed in passthrough mode (no API key required):
275
+ **Termination conditions:**
243
276
 
244
- | Tool | Description |
245
- |---|---|
246
- | `ges_interview` | Gestalt-driven requirement interview (start, respond, score, complete) |
247
- | `ges_generate_spec` | Generate a structured Spec from completed interview (2-Call) |
248
- | `ges_execute` | Execute Spec via Gestalt pipeline (plan, execute, evaluate, evolve, lateral thinking, role agents) |
249
- | `ges_create_agent` | Create custom Role Agent from completed interview (2-Call: start, submit) |
250
- | `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 |
251
285
 
252
- ## Skill System
286
+ ---
253
287
 
254
- `skills/` 디렉토리의 SKILL.md 파일로 파이프라인 단계의 동작을 정의한다.
288
+ ### Step 6 Code Review
255
289
 
256
- | Skill | Description |
257
- |---|---|
258
- | `interview` | 인터뷰 프로세스 — 4단계 (start → iterate → score → complete) |
259
- | `spec` | Spec 생성 프로세스 — 2-Call Passthrough 패턴 |
260
- | `execute` | 실행 계획 수립 — 4단계 Planning + Execution + Evaluation |
290
+ When evolution finishes, code review starts automatically:
261
291
 
262
- ### SKILL.md 포맷
292
+ ```
293
+ review_start → agents submit perspectives → consensus → auto-fix
294
+ ```
263
295
 
264
- ```yaml
265
- ---
266
- name: interview
267
- version: "1.0.0"
268
- description: "Gestalt-driven interview"
269
- triggers: ["interview", "clarify requirements"]
270
- inputs:
271
- topic: { type: string, required: true }
272
- outputs: [session, ambiguityScore]
273
- ---
296
+ 9 built-in **Role Agents** provide multi-perspective review:
274
297
 
275
- Skill documentation (Markdown)
276
- ```
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 |
277
309
 
278
- 커스텀 Skill은 `skills/` 디렉토리에 추가하면 **chokidar hot-reload**로 자동 로드된다.
310
+ 3 built-in **Review Agents** run focused code analysis:
279
311
 
280
- ## 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 |
281
317
 
282
- Agent System의 **FiguralRouter**가 에이전트의 tier에 따라 다른 LLM provider를 라우팅한다:
318
+ Use any agent outside the pipeline with `/agent`:
283
319
 
284
- | Tier | Provider | Model Example | Use Case |
285
- |---|---|---|---|
286
- | `frugal` | OpenAI | gpt-4o-mini | 반복적/저비용 태스크 (proximity-worker) |
287
- | `standard` | Anthropic | claude-sonnet | 일반 태스크 (closure-completer, ground-mapper) |
288
- | `frontier` | Anthropic | claude-opus | 고품질 판단 (continuity-judge) |
320
+ ```bash
321
+ # List all available agents
322
+ /agent
289
323
 
290
- 이를 위해 `@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
+ ```
291
329
 
292
- ## Event Sourcing
330
+ Generate custom Role Agents from interview results:
293
331
 
294
- 모든 세션 활동은 **SQLite WAL 모드 이벤트 스토어**에 기록된다.
332
+ ```
333
+ # Step 1: Get agent creation context
334
+ ges_create_agent → action: "start", sessionId: "<id>"
335
+ → returns agentContext (systemPrompt, creationPrompt, schema)
295
336
 
296
- - Interview 이벤트: session started/completed, question asked, response recorded, ambiguity scored
297
- - Execute 이벤트: planning steps, task completed, drift measured
298
- - Evaluate 이벤트: structural/contextual results, short-circuit
299
- - Evolution 이벤트: spec patched, lateral thinking, human escalation
300
- - 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
+ ```
301
341
 
302
- 완전한 audit trail로 세션 히스토리 재생 및 사후 분석이 가능하다.
342
+ ---
303
343
 
304
- ## CLI Commands
344
+ ### Alternative: CLI Direct Mode
345
+
346
+ Requires `ANTHROPIC_API_KEY`. Runs Gestalt directly from the terminal without Claude Code:
305
347
 
306
348
  ```bash
307
- gestalt # Start MCP server (default)
308
- gestalt serve # Start MCP server (explicit)
309
- gestalt interview "topic" # Interactive interview
310
- gestalt spec <session-id> # Generate Spec from interview
311
- gestalt status # List all sessions
312
- gestalt setup # Generate gestalt.json config file
313
- gestalt monitor # TUI dashboard (real-time session monitoring)
314
- ```
349
+ # Start an interactive interview
350
+ npx @tienne/gestalt interview "my topic"
315
351
 
316
- ### TUI Dashboard
352
+ # Generate Spec from a completed session
353
+ npx @tienne/gestalt spec <session-id>
317
354
 
318
- `gestalt monitor` 명령으로 터미널 기반 대시보드를 실행한다:
355
+ # List all sessions
356
+ npx @tienne/gestalt status
319
357
 
320
- - **Session List** — 진행 중인 세션 목록 및 상태
321
- - **Interview Monitor** — 실시간 인터뷰 진행 상황 + Gestalt 원리 표시
322
- - **Evolution Tracker** — Evolution Loop 진행, Drift 수치 게이지
323
- - **Task DAG Tree** 태스크 의존성 관계 시각화
324
- - **Spec Viewer** — 생성된 Spec 조회
325
- - **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
+ ---
326
366
 
327
367
  ## Configuration
328
368
 
329
- 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
+ ```
330
374
 
331
375
  ```json
332
376
  {
333
377
  "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
378
+ "llm": {
379
+ "model": "claude-sonnet-4-20250514"
380
+ },
334
381
  "interview": {
335
382
  "ambiguityThreshold": 0.2,
336
383
  "maxRounds": 10
@@ -343,85 +390,70 @@ Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE aut
343
390
  }
344
391
  ```
345
392
 
346
- Configuration is loaded with the following priority (highest → lowest):
347
-
348
- 1. Code overrides (`loadConfig(overrides)`)
349
- 2. Shell environment variables (`GESTALT_*`)
350
- 3. `.env` file
351
- 4. `gestalt.json`
352
- 5. Built-in defaults
393
+ **Config priority** (highest → lowest): code overrides → shell env vars → `.env` → `gestalt.json` → built-in defaults
353
394
 
354
- Invalid values trigger a warning and fall back to defaults.
395
+ Invalid values emit a warning and fall back to defaults.
355
396
 
356
397
  ### Environment Variables
357
398
 
358
- | Variable | Config Path | Default |
359
- |---|---|---|
360
- | `ANTHROPIC_API_KEY` | `llm.apiKey` | `""` |
361
- | `GESTALT_MODEL` | `llm.model` | `claude-sonnet-4-20250514` |
362
- | `GESTALT_AMBIGUITY_THRESHOLD` | `interview.ambiguityThreshold` | `0.2` |
363
- | `GESTALT_MAX_ROUNDS` | `interview.maxRounds` | `10` |
364
- | `GESTALT_DRIFT_THRESHOLD` | `execute.driftThreshold` | `0.3` |
365
- | `GESTALT_EVOLVE_SUCCESS_THRESHOLD` | `execute.successThreshold` | `0.85` |
366
- | `GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLD` | `execute.goalAlignmentThreshold` | `0.80` |
367
- | `GESTALT_DB_PATH` | `dbPath` | `~/.gestalt/events.db` |
368
- | `GESTALT_SKILLS_DIR` | `skillsDir` | `skills` |
369
- | `GESTALT_AGENTS_DIR` | `agentsDir` | `agents` |
370
- | `GESTALT_LOG_LEVEL` | `logLevel` | `info` |
371
-
372
- ## Operating Modes
373
-
374
- Gestalt supports two operating modes:
375
-
376
- | Mode | API Key | LLM Calls | Use Case |
377
- |---|---|---|---|
378
- | **Passthrough** (default) | Not needed | Caller (e.g., Claude Code) | MCP 통합 환경에서 권장 |
379
- | **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`) |
380
412
 
381
- ### Passthrough Mode
382
-
383
- 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.
384
-
385
- ### Provider-backed Mode
386
-
387
- `ANTHROPIC_API_KEY`를 설정하면 Gestalt가 직접 LLM 호출을 수행한다. CLI 명령어(`gestalt interview`, `gestalt spec`)는 이 모드에서 동작한다.
413
+ ---
388
414
 
389
- ### N-Call Passthrough Pattern
415
+ ## Architecture
390
416
 
391
- All MCP tools follow a consistent **N-Call Passthrough Pattern**:
417
+ ![Gestalt Architecture](./docs/architecture.png)
418
+ _(Diagram coming soon.)_
392
419
 
393
420
  ```
394
- Call 1: Context 요청 → systemPrompt + actionPrompt 반환
395
- 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
+ └──────────────────────────────────┘
396
453
  ```
397
454
 
398
- | Tool | Pattern | Calls |
399
- |---|---|---|
400
- | `ges_interview` | Multi-Call | start → (respond + score) × N → complete |
401
- | `ges_generate_spec` | 2-Call | specContext 요청 → spec JSON 제출 |
402
- | `ges_execute` | Multi-Call | plan (4-step) → execute → evaluate (2-stage) → evolve |
403
- | `ges_create_agent` | 2-Call | agentContext 요청 → agentContent 제출 |
404
-
405
- ## Benchmarks
406
-
407
- `pnpm bench`로 파이프라인 벤치마크를 실행할 수 있다. 3개의 시나리오가 Interview → Spec → Execute → Evaluate 전체 파이프라인을 통과한다.
408
-
409
- ```bash
410
- pnpm bench # 전체 시나리오 실행
411
- pnpm bench -s auth-system # 특정 시나리오만 실행
412
- pnpm bench -o benchmarks/results # 결과 출력 디렉토리 지정
413
- ```
414
-
415
- ### Latest Results
416
-
417
- | Scenario | Tasks | Completion | Score | Goal Alignment | ACs |
418
- |----------|-------|------------|-------|----------------|-----|
419
- | auth-system | 7 | 100% | 0.92 | 0.90 | 5/5 |
420
- | dashboard | 6 | 100% | 0.88 | 0.85 | 4/4 |
421
- | api-gateway | 8 | 100% | 0.95 | 0.92 | 5/5 |
422
-
423
- **Average Score: 0.92 | Average Goal Alignment: 0.89**
455
+ ---
424
456
 
425
457
  ## License
426
458
 
427
- MIT
459
+ MIT © [tienne](https://github.com/tienne)