@tienne/gestalt 0.1.1 → 0.5.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 (218) hide show
  1. package/CLAUDE.md +175 -6
  2. package/README.md +381 -14
  3. package/dist/benchmarks/runners/passthrough-benchmark-runner.d.ts +94 -0
  4. package/dist/benchmarks/runners/passthrough-benchmark-runner.d.ts.map +1 -0
  5. package/dist/benchmarks/runners/passthrough-benchmark-runner.js +454 -0
  6. package/dist/benchmarks/runners/passthrough-benchmark-runner.js.map +1 -0
  7. package/dist/benchmarks/scenarios/api-gateway.scenario.d.ts +3 -0
  8. package/dist/benchmarks/scenarios/api-gateway.scenario.d.ts.map +1 -0
  9. package/dist/benchmarks/scenarios/api-gateway.scenario.js +115 -0
  10. package/dist/benchmarks/scenarios/api-gateway.scenario.js.map +1 -0
  11. package/dist/benchmarks/scenarios/auth-system.scenario.d.ts +3 -0
  12. package/dist/benchmarks/scenarios/auth-system.scenario.d.ts.map +1 -0
  13. package/dist/benchmarks/scenarios/auth-system.scenario.js +114 -0
  14. package/dist/benchmarks/scenarios/auth-system.scenario.js.map +1 -0
  15. package/dist/benchmarks/scenarios/dashboard.scenario.d.ts +3 -0
  16. package/dist/benchmarks/scenarios/dashboard.scenario.d.ts.map +1 -0
  17. package/dist/benchmarks/scenarios/dashboard.scenario.js +110 -0
  18. package/dist/benchmarks/scenarios/dashboard.scenario.js.map +1 -0
  19. package/dist/benchmarks/types.d.ts +148 -0
  20. package/dist/benchmarks/types.d.ts.map +1 -0
  21. package/dist/benchmarks/types.js +2 -0
  22. package/dist/benchmarks/types.js.map +1 -0
  23. package/dist/package.json +61 -0
  24. package/dist/schemas/gestalt.schema.json +98 -0
  25. package/dist/src/agent/parser.d.ts.map +1 -1
  26. package/dist/src/agent/parser.js +2 -0
  27. package/dist/src/agent/parser.js.map +1 -1
  28. package/dist/src/agent/passthrough-generator.d.ts +27 -0
  29. package/dist/src/agent/passthrough-generator.d.ts.map +1 -0
  30. package/dist/src/agent/passthrough-generator.js +133 -0
  31. package/dist/src/agent/passthrough-generator.js.map +1 -0
  32. package/dist/src/agent/registry.d.ts +1 -0
  33. package/dist/src/agent/registry.d.ts.map +1 -1
  34. package/dist/src/agent/registry.js +4 -1
  35. package/dist/src/agent/registry.js.map +1 -1
  36. package/dist/src/agent/role-agent-registry.d.ts +18 -0
  37. package/dist/src/agent/role-agent-registry.d.ts.map +1 -0
  38. package/dist/src/agent/role-agent-registry.js +62 -0
  39. package/dist/src/agent/role-agent-registry.js.map +1 -0
  40. package/dist/src/agent/role-consensus-engine.d.ts +9 -0
  41. package/dist/src/agent/role-consensus-engine.d.ts.map +1 -0
  42. package/dist/src/agent/role-consensus-engine.js +35 -0
  43. package/dist/src/agent/role-consensus-engine.js.map +1 -0
  44. package/dist/src/agent/role-match-engine.d.ts +14 -0
  45. package/dist/src/agent/role-match-engine.d.ts.map +1 -0
  46. package/dist/src/agent/role-match-engine.js +46 -0
  47. package/dist/src/agent/role-match-engine.js.map +1 -0
  48. package/dist/src/agent/role-prompt-generator.d.ts +10 -0
  49. package/dist/src/agent/role-prompt-generator.d.ts.map +1 -0
  50. package/dist/src/agent/role-prompt-generator.js +22 -0
  51. package/dist/src/agent/role-prompt-generator.js.map +1 -0
  52. package/dist/src/cli/commands/interview.js +2 -2
  53. package/dist/src/cli/commands/interview.js.map +1 -1
  54. package/dist/src/cli/commands/monitor.d.ts +2 -0
  55. package/dist/src/cli/commands/monitor.d.ts.map +1 -0
  56. package/dist/src/cli/commands/monitor.js +13 -0
  57. package/dist/src/cli/commands/monitor.js.map +1 -0
  58. package/dist/src/cli/commands/setup.d.ts +2 -0
  59. package/dist/src/cli/commands/setup.d.ts.map +1 -0
  60. package/dist/src/cli/commands/setup.js +20 -0
  61. package/dist/src/cli/commands/setup.js.map +1 -0
  62. package/dist/src/cli/commands/spec.js +2 -2
  63. package/dist/src/cli/commands/spec.js.map +1 -1
  64. package/dist/src/cli/commands/status.d.ts.map +1 -1
  65. package/dist/src/cli/commands/status.js +3 -3
  66. package/dist/src/cli/commands/status.js.map +1 -1
  67. package/dist/src/cli/index.d.ts.map +1 -1
  68. package/dist/src/cli/index.js +16 -1
  69. package/dist/src/cli/index.js.map +1 -1
  70. package/dist/src/core/config.d.ts +80 -17
  71. package/dist/src/core/config.d.ts.map +1 -1
  72. package/dist/src/core/config.js +141 -31
  73. package/dist/src/core/config.js.map +1 -1
  74. package/dist/src/core/constants.d.ts +2 -2
  75. package/dist/src/core/constants.d.ts.map +1 -1
  76. package/dist/src/core/constants.js +2 -2
  77. package/dist/src/core/constants.js.map +1 -1
  78. package/dist/src/core/errors.d.ts +3 -0
  79. package/dist/src/core/errors.d.ts.map +1 -1
  80. package/dist/src/core/errors.js +6 -0
  81. package/dist/src/core/errors.js.map +1 -1
  82. package/dist/src/core/types.d.ts +83 -3
  83. package/dist/src/core/types.d.ts.map +1 -1
  84. package/dist/src/core/version.d.ts +10 -0
  85. package/dist/src/core/version.d.ts.map +1 -0
  86. package/dist/src/core/version.js +89 -0
  87. package/dist/src/core/version.js.map +1 -0
  88. package/dist/src/events/types.d.ts +16 -1
  89. package/dist/src/events/types.d.ts.map +1 -1
  90. package/dist/src/events/types.js +19 -0
  91. package/dist/src/events/types.js.map +1 -1
  92. package/dist/src/execute/passthrough-engine.d.ts +44 -2
  93. package/dist/src/execute/passthrough-engine.d.ts.map +1 -1
  94. package/dist/src/execute/passthrough-engine.js +245 -10
  95. package/dist/src/execute/passthrough-engine.js.map +1 -1
  96. package/dist/src/execute/repository.d.ts.map +1 -1
  97. package/dist/src/execute/repository.js +24 -0
  98. package/dist/src/execute/repository.js.map +1 -1
  99. package/dist/src/execute/session.d.ts +6 -1
  100. package/dist/src/execute/session.d.ts.map +1 -1
  101. package/dist/src/execute/session.js +60 -0
  102. package/dist/src/execute/session.js.map +1 -1
  103. package/dist/src/mcp/schemas.d.ts +513 -9
  104. package/dist/src/mcp/schemas.d.ts.map +1 -1
  105. package/dist/src/mcp/schemas.js +102 -0
  106. package/dist/src/mcp/schemas.js.map +1 -1
  107. package/dist/src/mcp/server.d.ts.map +1 -1
  108. package/dist/src/mcp/server.js +253 -38
  109. package/dist/src/mcp/server.js.map +1 -1
  110. package/dist/src/mcp/tools/benchmark-passthrough.d.ts +3 -0
  111. package/dist/src/mcp/tools/benchmark-passthrough.d.ts.map +1 -0
  112. package/dist/src/mcp/tools/benchmark-passthrough.js +95 -0
  113. package/dist/src/mcp/tools/benchmark-passthrough.js.map +1 -0
  114. package/dist/src/mcp/tools/create-agent-passthrough.d.ts +5 -0
  115. package/dist/src/mcp/tools/create-agent-passthrough.d.ts.map +1 -0
  116. package/dist/src/mcp/tools/create-agent-passthrough.js +59 -0
  117. package/dist/src/mcp/tools/create-agent-passthrough.js.map +1 -0
  118. package/dist/src/mcp/tools/execute-passthrough.d.ts.map +1 -1
  119. package/dist/src/mcp/tools/execute-passthrough.js +126 -0
  120. package/dist/src/mcp/tools/execute-passthrough.js.map +1 -1
  121. package/dist/src/mcp/tools/review-passthrough.d.ts +6 -0
  122. package/dist/src/mcp/tools/review-passthrough.d.ts.map +1 -0
  123. package/dist/src/mcp/tools/review-passthrough.js +134 -0
  124. package/dist/src/mcp/tools/review-passthrough.js.map +1 -0
  125. package/dist/src/mcp/tools/status.d.ts +2 -1
  126. package/dist/src/mcp/tools/status.d.ts.map +1 -1
  127. package/dist/src/mcp/tools/status.js +81 -26
  128. package/dist/src/mcp/tools/status.js.map +1 -1
  129. package/dist/src/resilience/lateral.d.ts +17 -0
  130. package/dist/src/resilience/lateral.d.ts.map +1 -0
  131. package/dist/src/resilience/lateral.js +62 -0
  132. package/dist/src/resilience/lateral.js.map +1 -0
  133. package/dist/src/resilience/prompts.d.ts +5 -0
  134. package/dist/src/resilience/prompts.d.ts.map +1 -0
  135. package/dist/src/resilience/prompts.js +130 -0
  136. package/dist/src/resilience/prompts.js.map +1 -0
  137. package/dist/src/resilience/stagnation-detector.d.ts +19 -0
  138. package/dist/src/resilience/stagnation-detector.d.ts.map +1 -0
  139. package/dist/src/resilience/stagnation-detector.js +38 -0
  140. package/dist/src/resilience/stagnation-detector.js.map +1 -0
  141. package/dist/src/resilience/types.d.ts +39 -0
  142. package/dist/src/resilience/types.d.ts.map +1 -0
  143. package/dist/src/resilience/types.js +17 -0
  144. package/dist/src/resilience/types.js.map +1 -0
  145. package/dist/src/review/agent-matcher.d.ts +15 -0
  146. package/dist/src/review/agent-matcher.d.ts.map +1 -0
  147. package/dist/src/review/agent-matcher.js +61 -0
  148. package/dist/src/review/agent-matcher.js.map +1 -0
  149. package/dist/src/review/context-collector.d.ts +7 -0
  150. package/dist/src/review/context-collector.d.ts.map +1 -0
  151. package/dist/src/review/context-collector.js +44 -0
  152. package/dist/src/review/context-collector.js.map +1 -0
  153. package/dist/src/review/passthrough-engine.d.ts +53 -0
  154. package/dist/src/review/passthrough-engine.d.ts.map +1 -0
  155. package/dist/src/review/passthrough-engine.js +257 -0
  156. package/dist/src/review/passthrough-engine.js.map +1 -0
  157. package/dist/src/review/report-generator.d.ts +7 -0
  158. package/dist/src/review/report-generator.d.ts.map +1 -0
  159. package/dist/src/review/report-generator.js +82 -0
  160. package/dist/src/review/report-generator.js.map +1 -0
  161. package/dist/src/tui/components/TUIApp.d.ts +20 -0
  162. package/dist/src/tui/components/TUIApp.d.ts.map +1 -0
  163. package/dist/src/tui/components/TUIApp.js +84 -0
  164. package/dist/src/tui/components/TUIApp.js.map +1 -0
  165. package/dist/src/tui/hooks/event-store-reader.d.ts +28 -0
  166. package/dist/src/tui/hooks/event-store-reader.d.ts.map +1 -0
  167. package/dist/src/tui/hooks/event-store-reader.js +143 -0
  168. package/dist/src/tui/hooks/event-store-reader.js.map +1 -0
  169. package/dist/src/tui/hooks/useEventStorePoller.d.ts +12 -0
  170. package/dist/src/tui/hooks/useEventStorePoller.d.ts.map +1 -0
  171. package/dist/src/tui/hooks/useEventStorePoller.js +86 -0
  172. package/dist/src/tui/hooks/useEventStorePoller.js.map +1 -0
  173. package/dist/src/tui/screens/DashboardScreen.d.ts +4 -0
  174. package/dist/src/tui/screens/DashboardScreen.d.ts.map +1 -0
  175. package/dist/src/tui/screens/DashboardScreen.js +132 -0
  176. package/dist/src/tui/screens/DashboardScreen.js.map +1 -0
  177. package/dist/src/tui/screens/DebugScreen.d.ts +4 -0
  178. package/dist/src/tui/screens/DebugScreen.d.ts.map +1 -0
  179. package/dist/src/tui/screens/DebugScreen.js +40 -0
  180. package/dist/src/tui/screens/DebugScreen.js.map +1 -0
  181. package/dist/src/tui/screens/EvolutionScreen.d.ts +4 -0
  182. package/dist/src/tui/screens/EvolutionScreen.d.ts.map +1 -0
  183. package/dist/src/tui/screens/EvolutionScreen.js +136 -0
  184. package/dist/src/tui/screens/EvolutionScreen.js.map +1 -0
  185. package/dist/src/tui/screens/HUDPanel.d.ts +4 -0
  186. package/dist/src/tui/screens/HUDPanel.d.ts.map +1 -0
  187. package/dist/src/tui/screens/HUDPanel.js +13 -0
  188. package/dist/src/tui/screens/HUDPanel.js.map +1 -0
  189. package/dist/src/tui/screens/InterviewScreen.d.ts +4 -0
  190. package/dist/src/tui/screens/InterviewScreen.d.ts.map +1 -0
  191. package/dist/src/tui/screens/InterviewScreen.js +103 -0
  192. package/dist/src/tui/screens/InterviewScreen.js.map +1 -0
  193. package/dist/src/tui/screens/LogScreen.d.ts +4 -0
  194. package/dist/src/tui/screens/LogScreen.d.ts.map +1 -0
  195. package/dist/src/tui/screens/LogScreen.js +83 -0
  196. package/dist/src/tui/screens/LogScreen.js.map +1 -0
  197. package/dist/src/tui/screens/SessionListScreen.d.ts +4 -0
  198. package/dist/src/tui/screens/SessionListScreen.d.ts.map +1 -0
  199. package/dist/src/tui/screens/SessionListScreen.js +71 -0
  200. package/dist/src/tui/screens/SessionListScreen.js.map +1 -0
  201. package/dist/src/tui/screens/SpecViewerScreen.d.ts +4 -0
  202. package/dist/src/tui/screens/SpecViewerScreen.d.ts.map +1 -0
  203. package/dist/src/tui/screens/SpecViewerScreen.js +73 -0
  204. package/dist/src/tui/screens/SpecViewerScreen.js.map +1 -0
  205. package/dist/src/tui/widgets/DriftMeter.d.ts +15 -0
  206. package/dist/src/tui/widgets/DriftMeter.d.ts.map +1 -0
  207. package/dist/src/tui/widgets/DriftMeter.js +27 -0
  208. package/dist/src/tui/widgets/DriftMeter.js.map +1 -0
  209. package/dist/src/tui/widgets/GestaltPrincipleBar.d.ts +9 -0
  210. package/dist/src/tui/widgets/GestaltPrincipleBar.d.ts.map +1 -0
  211. package/dist/src/tui/widgets/GestaltPrincipleBar.js +35 -0
  212. package/dist/src/tui/widgets/GestaltPrincipleBar.js.map +1 -0
  213. package/dist/src/tui/widgets/TaskDAGTree.d.ts +15 -0
  214. package/dist/src/tui/widgets/TaskDAGTree.d.ts.map +1 -0
  215. package/dist/src/tui/widgets/TaskDAGTree.js +54 -0
  216. package/dist/src/tui/widgets/TaskDAGTree.js.map +1 -0
  217. package/package.json +11 -3
  218. package/schemas/gestalt.schema.json +98 -0
package/CLAUDE.md CHANGED
@@ -8,13 +8,14 @@
8
8
  - **Interview Engine**: 게슈탈트 원리 기반 Q&A로 모호성 점수를 0.2 이하로 낮춤
9
9
  - **Spec Generator**: 완료된 인터뷰에서 구조화된 프로젝트 스펙(Spec) 생성
10
10
  - **Execute Engine**: 게슈탈트 5원리를 실행 전략으로 사용, Spec→ExecutionPlan 변환 (Figure-Ground→Closure→Proximity→Continuity)
11
+ - **Resilience Engine**: Stagnation 감지 → Lateral Thinking Personas → Human Escalation
11
12
  - **MCP Server**: stdio transport로 Claude Code 등 AI 에이전트와 통합
12
13
  - **Skill System**: SKILL.md 기반 확장, chokidar hot-reload 지원
13
14
  - **Event Store**: better-sqlite3 WAL 모드 이벤트 소싱
14
15
 
15
16
  ## Tech Stack
16
17
  TypeScript 5.x / ESM / pnpm / vitest
17
- Dependencies: @anthropic-ai/sdk, @modelcontextprotocol/sdk, better-sqlite3, zod, chokidar, commander, gray-matter
18
+ Dependencies: @anthropic-ai/sdk, @modelcontextprotocol/sdk, better-sqlite3, zod, chokidar, commander, gray-matter, dotenv
18
19
 
19
20
  ## Key Commands
20
21
  ```bash
@@ -23,25 +24,93 @@ pnpm run serve # Start MCP server
23
24
  pnpm tsx bin/gestalt.ts interview "topic" # Interactive interview
24
25
  pnpm tsx bin/gestalt.ts spec <session-id> # Generate spec
25
26
  pnpm tsx bin/gestalt.ts status # Check sessions
27
+ pnpm tsx bin/gestalt.ts setup # Generate gestalt.json config
26
28
  ```
27
29
 
30
+ ## Configuration
31
+
32
+ 설정값은 다음 우선순위로 merge된다 (높→낮):
33
+ 1. `loadConfig(overrides)` — 코드에서 직접 전달
34
+ 2. Shell 환경변수 (`export GESTALT_*`)
35
+ 3. `.env` 파일 (dotenv)
36
+ 4. `gestalt.json` 파일
37
+ 5. 기본값
38
+
39
+ ### gestalt.json
40
+ `gestalt setup` 명령어로 생성. JSON Schema로 IDE 자동완성 지원.
41
+
42
+ ```json
43
+ {
44
+ "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
45
+ "llm": { "apiKey": "", "model": "claude-sonnet-4-20250514" },
46
+ "interview": { "ambiguityThreshold": 0.2, "maxRounds": 10 },
47
+ "execute": { "driftThreshold": 0.3, "successThreshold": 0.85, "goalAlignmentThreshold": 0.80 },
48
+ "dbPath": ".gestalt/gestalt.db",
49
+ "logLevel": "info"
50
+ }
51
+ ```
52
+
53
+ ### GestaltConfig 구조 (nested)
54
+
55
+ ```typescript
56
+ interface GestaltConfig {
57
+ llm: { apiKey: string; model: string };
58
+ interview: { ambiguityThreshold: number; maxRounds: number };
59
+ execute: { driftThreshold: number; successThreshold: number; goalAlignmentThreshold: number };
60
+ dbPath: string;
61
+ skillsDir: string;
62
+ agentsDir: string;
63
+ logLevel: 'debug' | 'info' | 'warn' | 'error';
64
+ }
65
+ ```
66
+
67
+ ### 환경변수 매핑
68
+
69
+ | 환경변수 | Config 경로 | 기본값 |
70
+ |----------|-------------|--------|
71
+ | `ANTHROPIC_API_KEY` | `llm.apiKey` | `""` |
72
+ | `GESTALT_MODEL` | `llm.model` | `"claude-sonnet-4-20250514"` |
73
+ | `GESTALT_AMBIGUITY_THRESHOLD` | `interview.ambiguityThreshold` | `0.2` |
74
+ | `GESTALT_MAX_ROUNDS` | `interview.maxRounds` | `10` |
75
+ | `GESTALT_DRIFT_THRESHOLD` | `execute.driftThreshold` | `0.3` |
76
+ | `GESTALT_EVOLVE_SUCCESS_THRESHOLD` | `execute.successThreshold` | `0.85` |
77
+ | `GESTALT_EVOLVE_GOAL_ALIGNMENT_THRESHOLD` | `execute.goalAlignmentThreshold` | `0.80` |
78
+ | `GESTALT_DB_PATH` | `dbPath` | `"~/.gestalt/events.db"` |
79
+ | `GESTALT_SKILLS_DIR` | `skillsDir` | `"skills"` |
80
+ | `GESTALT_AGENTS_DIR` | `agentsDir` | `"agents"` |
81
+ | `GESTALT_LOG_LEVEL` | `logLevel` | `"info"` |
82
+
83
+ 잘못된 설정값은 경고를 출력하고 기본값으로 fallback한다 (에러를 throw하지 않음).
84
+
28
85
  ## MCP Tools
29
86
  - `ges_interview`: action=[start|respond|score|complete]
30
87
  - `ges_generate_spec`: sessionId, force?
31
- - `ges_execute`: action=[start|plan_step|plan_complete|execute_start|execute_task|evaluate|status|evolve_fix|evolve|evolve_patch|evolve_re_execute]
88
+ - `ges_execute`: action=[start|plan_step|plan_complete|execute_start|execute_task|evaluate|status|evolve_fix|evolve|evolve_patch|evolve_re_execute|evolve_lateral|evolve_lateral_result|role_match|role_consensus]
89
+ - `ges_create_agent`: action=[start|submit] — 인터뷰 기반 커스텀 Role Agent 생성
32
90
  - `ges_status`: sessionId?
33
91
 
34
92
  ## MCP Passthrough Mode
35
93
 
36
94
  API 키(`ANTHROPIC_API_KEY`) 없이 MCP 서버 실행 시 자동 활성화. LLM 호출을 서버가 하지 않고, caller(Claude Code 등)에게 위임한다.
37
95
 
38
- ### 설정 (claude_desktop_config.json / settings.json)
96
+ ### 설치 방법
97
+
98
+ **Claude Plugin (Recommended)**
99
+ ```bash
100
+ # 1. 마켓플레이스 등록 (최초 1회)
101
+ /plugin marketplace add tienne/gestalt
102
+
103
+ # 2. 플러그인 설치
104
+ /plugin install gestalt@gestalt
105
+ ```
106
+
107
+ **MCP 직접 설정** (claude_desktop_config.json / settings.json)
39
108
  ```json
40
109
  {
41
110
  "mcpServers": {
42
111
  "gestalt": {
43
112
  "command": "npx",
44
- "args": ["tsx", "bin/gestalt.ts", "serve"]
113
+ "args": ["-y", "@tienne/gestalt"]
45
114
  }
46
115
  }
47
116
  }
@@ -173,9 +242,104 @@ ges_execute({ action: "evaluate", sessionId: "<id>" })
173
242
  ```
174
243
 
175
244
  **Spec Patch 범위**: L1(AC)+L2(constraints) 자유, L3(ontology) 추가/변경만, L4(goal) 금지
176
- **종료 조건**: success(≥0.85, ≥0.80), stagnation, oscillation, hard_cap(3+3), caller
245
+ **종료 조건**: success(≥0.85, ≥0.80), stagnation, oscillation, hard_cap(3+3), caller, human_escalation
177
246
  **Caller 종료**: `ges_execute({ action: "evolve", sessionId: "<id>", terminateReason: "caller" })`
178
247
 
248
+ **Flow C: Lateral Thinking** (evolution stagnation/oscillation/hard_cap 감지 시 자동 분기)
249
+
250
+ evolve 호출 시 non-success termination이 감지되면 즉시 종료하는 대신 lateral thinking persona로 자동 분기한다.
251
+
252
+ ```
253
+ // 1. evolve 호출 → lateralContext 자동 반환 (stagnation 시)
254
+ ges_execute({ action: "evolve", sessionId: "<id>" })
255
+ → { status: "lateral_thinking", lateralContext: { persona, pattern, systemPrompt, lateralPrompt, ... } }
256
+
257
+ // 2. Lateral result 제출 (caller가 persona 관점으로 specPatch 생성)
258
+ ges_execute({
259
+ action: "evolve_lateral_result",
260
+ sessionId: "<id>",
261
+ lateralResult: {
262
+ persona: "multistability",
263
+ specPatch: { acceptanceCriteria: [...], constraints: [...] },
264
+ description: "관점 전환으로 요구사항 재구성"
265
+ }
266
+ })
267
+ → impactedTaskIds + reExecuteContext 반환
268
+
269
+ // 3. Impacted tasks 재실행 (기존 action 재사용)
270
+ ges_execute({ action: "evolve_re_execute", sessionId: "<id>", reExecuteTaskResult: {...} })
271
+ → 반복...
272
+
273
+ // 4. Re-evaluate
274
+ ges_execute({ action: "evaluate", sessionId: "<id>" })
275
+
276
+ // 5. 다음 persona 요청 (점수 미달 시)
277
+ ges_execute({ action: "evolve_lateral", sessionId: "<id>" })
278
+ → 다음 lateralContext (or humanEscalation if 4개 persona 소진)
279
+ ```
280
+
281
+ **Stagnation Pattern → Persona 매핑**:
282
+ | Pattern | Persona | 전략 |
283
+ |---|---|---|
284
+ | spinning (hard_cap) | Multistability | 다른 각도로 보기 |
285
+ | oscillation | Simplicity | 단순하게 줄이기 |
286
+ | no_drift (delta≈0) | Reification | 빠진 조각 채우기 |
287
+ | diminishing_returns (delta↓) | Invariance | 성공 패턴 복제하기 |
288
+
289
+ **Human Escalation**: 4개 persona 모두 소진 시 `humanEscalation` 반환 (triedPersonas, bestScore, suggestions 포함). session은 `status: 'failed'`, `terminationReason: 'human_escalation'`으로 종료.
290
+
291
+ ### Interview → Agent 생성 플로우
292
+
293
+ `ges_interview`로 요구사항을 수집한 뒤, `ges_create_agent`로 커스텀 Role Agent AGENT.md 파일을 자동 생성한다.
294
+
295
+ **Step 1: Agent Context 요청**
296
+ ```
297
+ ges_create_agent({ action: "start", sessionId: "<완료된 인터뷰 sessionId>" })
298
+ ```
299
+ → `agentContext` 반환 (systemPrompt, creationPrompt, existingAgents, agentMdSchema)
300
+
301
+ **Step 2: AGENT.md 생성 및 제출**
302
+ ```
303
+ ges_create_agent({
304
+ action: "submit",
305
+ sessionId: "<id>",
306
+ agentContent: "---\nname: security-expert\ntier: standard\npipeline: execute\nrole: true\ndomain: [\"oauth\", \"jwt\"]\ndescription: \"보안 전문가\"\n---\n\nSystem prompt...",
307
+ cwd: "/path/to/project" // 선택, 기본값 process.cwd()
308
+ })
309
+ ```
310
+ → agents/{name}/AGENT.md 파일 생성, parseAgentMd() 검증, AGENT_CREATED 이벤트 기록
311
+
312
+ **규칙**:
313
+ - 인터뷰 세션이 `completed` 상태여야 함
314
+ - `role: true` 필수 (Role Agent 전용)
315
+ - 동일 이름 에이전트 존재 시 override + 안내 메시지
316
+
317
+ ### Role Agent System 플로우
318
+
319
+ 태스크 실행 시 관련 Role Agent를 자동 매칭하여 다중 관점 합의를 수행한다.
320
+
321
+ **Step 1: Role Match (2-Call)**
322
+ ```
323
+ // Call 1: 매칭 컨텍스트 요청
324
+ ges_execute({ action: "role_match", sessionId: "<id>" })
325
+ → matchContext 반환
326
+
327
+ // Call 2: 매칭 결과 제출
328
+ ges_execute({ action: "role_match", sessionId: "<id>", matchResult: [...] })
329
+ → perspectivePrompts 반환
330
+ ```
331
+
332
+ **Step 2: Role Consensus (2-Call)**
333
+ ```
334
+ // Call 1: 각 에이전트 관점 제출
335
+ ges_execute({ action: "role_consensus", sessionId: "<id>", perspectives: [...] })
336
+ → synthesisContext 반환
337
+
338
+ // Call 2: 합성된 합의 제출
339
+ ges_execute({ action: "role_consensus", sessionId: "<id>", consensus: {...} })
340
+ → roleGuidance 반환 → execute_task 수행 시 참조
341
+ ```
342
+
179
343
  ### 핵심 규칙
180
344
  - `action: "respond"` 시 `generatedQuestion` **필수**, `ambiguityScore` 선택
181
345
  - ambiguityScore 차원: `goalClarity`, `constraintClarity`, `successCriteria`, `priorityClarity` (필수), `contextClarity` (선택)
@@ -189,11 +353,16 @@ ges_execute({ action: "evaluate", sessionId: "<id>" })
189
353
  - `src/interview/` — InterviewEngine, AmbiguityScorer, SessionManager
190
354
  - `src/spec/` — SpecGenerator, SpecExtractor
191
355
  - `src/execute/` — ExecuteEngine, DAG Validator, ExecuteSessionManager
356
+ - `src/resilience/` — Stagnation Detector, Lateral Thinking Personas, Human Escalation
192
357
  - `src/skills/` — SkillRegistry, parser
358
+ - `src/agent/` — AgentRegistry, FiguralRouter, multi-provider LLM, RoleAgentRegistry, PassthroughAgentGenerator
359
+ - `src/registry/` — BaseRegistry 추상 클래스
193
360
  - `src/mcp/` — MCP 서버 + 툴 핸들러
194
361
  - `src/events/` — EventStore (SQLite)
195
362
  - `src/llm/` — Anthropic SDK adapter
196
- - `src/cli/` — commander 기반 CLI
363
+ - `src/cli/` — commander 기반 CLI (interview, spec, status, setup)
364
+ - `schemas/` — JSON Schema (gestalt.schema.json)
365
+ - `role-agents/` — 내장 Role Agent 정의 (architect, frontend-developer 등 8개)
197
366
 
198
367
  ## Conventions
199
368
  - MCP 서버에서 `console.log` 사용 금지 → stderr(`log()` 유틸)
package/README.md CHANGED
@@ -1,19 +1,60 @@
1
- # @tienne/gestalt
1
+ <p align="center">
2
+ <img src="assets/logo.svg" alt="Gestalt" width="600" />
3
+ </p>
2
4
 
3
- Gestalt psychology-driven AI development harness. Transforms scattered requirements into structured, validated specifications through interactive interviews.
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.
8
+ </p>
9
+
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
+ <a href="https://www.npmjs.com/package/@tienne/gestalt"><img src="https://img.shields.io/npm/v/@tienne/gestalt" alt="npm version" /></a>
13
+ </p>
14
+
15
+ ---
4
16
 
5
17
  ## Installation
6
18
 
7
- ### Claude Code (Recommended)
19
+ ### Claude Plugin (Recommended)
20
+
21
+ Claude Code 마켓플레이스를 통해 설치하면 MCP 서버, Skill, Agent, CLAUDE.md가 자동 구성된다.
22
+
23
+ ```bash
24
+ # 1. 마켓플레이스 등록 (최초 1회)
25
+ /plugin marketplace add tienne/gestalt
26
+
27
+ # 2. 플러그인 설치
28
+ /plugin install gestalt@gestalt
29
+ ```
30
+
31
+ 플러그인 설치 시 포함되는 항목:
32
+
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 사용 가이드 자동 주입 |
39
+
40
+ 설치 후 바로 사용 가능:
41
+
42
+ ```bash
43
+ /interview "사용자 인증 시스템" # 요구사항 인터뷰 시작
44
+ /spec # 인터뷰 완료 후 Spec 생성
45
+ /execute # Spec 기반 실행 계획 수립 및 실행
46
+ ```
47
+
48
+ ### Claude Code MCP
8
49
 
9
50
  ```bash
10
- claude mcp add gestalt -- npx @tienne/gestalt
51
+ claude mcp add gestalt -- npx -y @tienne/gestalt
11
52
  ```
12
53
 
13
54
  ### npx (No Install)
14
55
 
15
56
  ```bash
16
- npx @tienne/gestalt
57
+ npx -y @tienne/gestalt
17
58
  ```
18
59
 
19
60
  ### Global Install
@@ -23,17 +64,243 @@ npm install -g @tienne/gestalt
23
64
  gestalt
24
65
  ```
25
66
 
67
+ ## How It Works
68
+
69
+ ```
70
+ Interview → Spec → Execute → Evaluate → Evolve
71
+
72
+ Lateral Thinking (resilience)
73
+
74
+ Human Escalation (if exhausted)
75
+ ```
76
+
77
+ ### 1. Interview
78
+
79
+ Gestalt 원리가 각 라운드의 질문 방향을 가이드하여 **모호성 점수(ambiguity score)가 0.2 이하**로 떨어질 때까지 요구사항을 명확화한다.
80
+
81
+ - 프로젝트 유형 자동 감지 (greenfield / brownfield)
82
+ - 5가지 Gestalt 원리 기반 동적 질문 선택 알고리즘
83
+ - 차원별 가중치 기반 모호성 점수 산출
84
+ - 모순 감지 시 Continuity 원리 자동 개입 + 페널티 부여
85
+
86
+ ### 2. Spec Generation
87
+
88
+ 완료된 인터뷰에서 **구조화된 프로젝트 스펙**을 생성한다. 2-Call Passthrough 패턴으로 동작.
89
+
90
+ ```
91
+ Call 1: specContext 요청 → systemPrompt + specPrompt + 전체 인터뷰 라운드 반환
92
+ Call 2: caller가 생성한 Spec JSON 제출 → Zod 검증 후 저장
93
+ ```
94
+
95
+ Spec 구성요소: `goal`, `constraints`, `acceptanceCriteria`, `ontologySchema` (entities + relations), `gestaltAnalysis`
96
+
97
+ ### 3. Execute (Planning)
98
+
99
+ Gestalt 4원리를 **고정 순서**로 적용하여 실행 계획을 수립한다.
100
+
101
+ | Step | Principle | 역할 |
102
+ |:---:|---|---|
103
+ | 1 | **Figure-Ground** | AC를 essential(figure) / supplementary(ground)로 분류 |
104
+ | 2 | **Closure** | AC를 원자적 태스크로 분해 (암묵적 하위 태스크 포함) |
105
+ | 3 | **Proximity** | 관련 태스크를 도메인/기능 영역별로 그룹핑 |
106
+ | 4 | **Continuity** | DAG 검증 — 순환 의존, 그룹 간 충돌 확인, 위상 정렬 |
107
+
108
+ 결과물: `ExecutionPlan` (classifiedACs, atomicTasks, taskGroups, dagValidation, criticalPath)
109
+
110
+ ### 4. Execute (Execution) + Drift Detection
111
+
112
+ 위상 정렬 순서대로 태스크를 실행하며, **Similarity 원리**를 활용하여 유사 패턴의 완료된 태스크를 참조 컨텍스트로 제공한다.
113
+
114
+ 매 태스크 완료 시 **Drift Detection**이 자동 실행된다:
115
+
116
+ - **3차원 가중합**: Goal(50%) + Constraint(30%) + Ontology(20%)
117
+ - Jaccard 기반 키워드 유사도 측정
118
+ - Threshold(기본 0.3) 초과 시 `retrospectiveContext` 반환
119
+
120
+ ### 5. Evaluate (2-Stage)
121
+
122
+ | Stage | 이름 | 방식 | 실패 시 |
123
+ |:---:|---|---|---|
124
+ | 1 | **Structural** | lint → build → test 자동 검증 | Contextual 스킵 (short-circuit) |
125
+ | 2 | **Contextual** | LLM 기반 완료 조건(AC) 검증 + goalAlignment | Evolution Loop 진입 |
126
+
127
+ 성공 조건: `overallScore ≥ 0.85` && `goalAlignment ≥ 0.80`
128
+
129
+ ### 6. Evolution Loop
130
+
131
+ Evaluate 실패 시 3가지 경로로 자동 복구를 시도한다:
132
+
133
+ **Flow A — Structural Fix** (structural 실패 시)
134
+ ```
135
+ evolve_fix → fixTasks 제출 → re-evaluate
136
+ ```
137
+
138
+ **Flow B — Contextual Evolution** (contextual 점수 미달 시)
139
+ ```
140
+ evolve → evolve_patch(specPatch) → evolve_re_execute(impacted tasks) → re-evaluate
141
+ ```
142
+
143
+ Spec Patch 범위: 완료 조건(AC) + constraints 자유 수정, ontology 추가/변경만, **goal 변경 금지**
144
+
145
+ **Flow C — Lateral Thinking** (stagnation 감지 시 자동 분기)
146
+
147
+ evolve 호출 시 stagnation이 감지되면 즉시 종료하는 대신 **Lateral Thinking Persona**로 자동 분기한다. (아래 섹션 참조)
148
+
149
+ **종료 조건:**
150
+
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 모두 실패 |
159
+
160
+ ## Gestalt Principles
161
+
162
+ Each letter in the logo represents a core Gestalt principle used throughout the system:
163
+
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 |
171
+
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).
173
+
174
+ ## Lateral Thinking Personas
175
+
176
+ Evolution Loop에서 stagnation이 감지되면 패턴을 분류하고 매칭되는 persona를 활성화한다:
177
+
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 |
184
+
185
+ 4개 persona를 순차적으로 시도한다. 모두 실패하면 **Human Escalation**을 트리거하여 사용자에게 actionable suggestions를 제공한다.
186
+
187
+ ## Role Agent System
188
+
189
+ **8개의 내장 Role Agent**가 Execute Phase에서 다중 관점을 제공한다.
190
+
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 | 리서치 및 분석 전문가 |
201
+
202
+ ### 동작 방식
203
+
204
+ Execute Phase에서 각 태스크마다 2단계로 진행된다:
205
+
206
+ 1. **Role Match** — 태스크의 도메인 키워드와 매칭되는 Role Agent를 동적으로 선택
207
+ 2. **Role Consensus** — 선택된 Agent들의 관점을 수집하고, 충돌을 해소하여 통합 가이던스 생성
208
+
209
+ ### Custom Agent 생성
210
+
211
+ `ges_create_agent` 도구로 **인터뷰 결과를 기반으로 커스텀 Role Agent를 생성**할 수 있다:
212
+
213
+ ```
214
+ # 1. 인터뷰 완료 후 agent creation context 요청
215
+ ges_create_agent({ action: "start", sessionId: "<id>" })
216
+ → systemPrompt + creationPrompt + agentMdSchema 반환
217
+
218
+ # 2. AGENT.md 콘텐츠 생성 후 제출
219
+ ges_create_agent({ action: "submit", sessionId: "<id>", agentContent: "---\nname: ..." })
220
+ → agents/{name}/AGENT.md 파일 생성
221
+ ```
222
+
223
+ 커스텀 Agent는 `agents/` 디렉토리에 저장되며, 동일 이름의 내장 Agent를 override할 수 있다.
224
+
225
+ ### AGENT.md 포맷
226
+
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
+ ---
236
+
237
+ System prompt 내용 (Markdown)
238
+ ```
239
+
26
240
  ## MCP Tools
27
241
 
28
- Gestalt exposes 4 MCP tools in passthrough mode (no API key required):
242
+ 5 MCP tools exposed in passthrough mode (no API key required):
29
243
 
30
244
  | Tool | Description |
31
245
  |---|---|
32
246
  | `ges_interview` | Gestalt-driven requirement interview (start, respond, score, complete) |
33
- | `ges_generate_spec` | Generate a structured Spec from completed interview |
34
- | `ges_execute` | Execute Spec via Gestalt planning pipeline (plan, execute, evaluate, evolve) |
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) |
35
250
  | `ges_status` | Check session status |
36
251
 
252
+ ## Skill System
253
+
254
+ `skills/` 디렉토리의 SKILL.md 파일로 각 파이프라인 단계의 동작을 정의한다.
255
+
256
+ | Skill | Description |
257
+ |---|---|
258
+ | `interview` | 인터뷰 프로세스 — 4단계 (start → iterate → score → complete) |
259
+ | `spec` | Spec 생성 프로세스 — 2-Call Passthrough 패턴 |
260
+ | `execute` | 실행 계획 수립 — 4단계 Planning + Execution + Evaluation |
261
+
262
+ ### SKILL.md 포맷
263
+
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
+ ---
274
+
275
+ Skill documentation (Markdown)
276
+ ```
277
+
278
+ 커스텀 Skill은 `skills/` 디렉토리에 추가하면 **chokidar hot-reload**로 자동 로드된다.
279
+
280
+ ## Multi-provider LLM
281
+
282
+ Agent System의 **FiguralRouter**가 에이전트의 tier에 따라 다른 LLM provider를 라우팅한다:
283
+
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) |
289
+
290
+ 이를 위해 `@anthropic-ai/sdk`와 `openai` 두 SDK가 모두 포함되어 있다. Passthrough 모드에서는 caller가 LLM 호출을 하므로 이 라우팅이 적용되지 않는다.
291
+
292
+ ## Event Sourcing
293
+
294
+ 모든 세션 활동은 **SQLite WAL 모드 이벤트 스토어**에 기록된다.
295
+
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
301
+
302
+ 완전한 audit trail로 세션 히스토리 재생 및 사후 분석이 가능하다.
303
+
37
304
  ## CLI Commands
38
305
 
39
306
  ```bash
@@ -42,19 +309,119 @@ gestalt serve # Start MCP server (explicit)
42
309
  gestalt interview "topic" # Interactive interview
43
310
  gestalt spec <session-id> # Generate Spec from interview
44
311
  gestalt status # List all sessions
312
+ gestalt setup # Generate gestalt.json config file
313
+ gestalt monitor # TUI dashboard (real-time session monitoring)
45
314
  ```
46
315
 
47
- ## How It Works
316
+ ### TUI Dashboard
317
+
318
+ `gestalt monitor` 명령으로 터미널 기반 대시보드를 실행한다:
319
+
320
+ - **Session List** — 진행 중인 세션 목록 및 상태
321
+ - **Interview Monitor** — 실시간 인터뷰 진행 상황 + Gestalt 원리 표시
322
+ - **Evolution Tracker** — Evolution Loop 진행, Drift 수치 게이지
323
+ - **Task DAG Tree** — 태스크 의존성 관계 시각화
324
+ - **Spec Viewer** — 생성된 Spec 조회
325
+ - **Event Log** — 실시간 이벤트 로그
326
+
327
+ ## Configuration
328
+
329
+ Run `gestalt setup` to generate a `gestalt.json` configuration file with IDE autocompletion support.
330
+
331
+ ```json
332
+ {
333
+ "$schema": "./node_modules/@tienne/gestalt/schemas/gestalt.schema.json",
334
+ "interview": {
335
+ "ambiguityThreshold": 0.2,
336
+ "maxRounds": 10
337
+ },
338
+ "execute": {
339
+ "driftThreshold": 0.3,
340
+ "successThreshold": 0.85,
341
+ "goalAlignmentThreshold": 0.80
342
+ }
343
+ }
344
+ ```
48
345
 
49
- 1. **Interview** - Gestalt principles guide requirement clarification until ambiguity score drops below 0.2
50
- 2. **Spec** - Structured specification generated with goal, constraints, acceptance criteria, and ontology
51
- 3. **Execute** - 4-phase planning (Figure-Ground, Closure, Proximity, Continuity) produces a dependency-aware execution plan
52
- 4. **Evaluate** - 2-stage verification (structural + contextual) with evolution loop for iterative improvement
346
+ Configuration is loaded with the following priority (highest lowest):
53
347
 
54
- ## Passthrough Mode
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
353
+
354
+ Invalid values trigger a warning and fall back to defaults.
355
+
356
+ ### Environment Variables
357
+
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 등) |
380
+
381
+ ### Passthrough Mode
55
382
 
56
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.
57
384
 
385
+ ### Provider-backed Mode
386
+
387
+ `ANTHROPIC_API_KEY`를 설정하면 Gestalt가 직접 LLM 호출을 수행한다. CLI 명령어(`gestalt interview`, `gestalt spec`)는 이 모드에서 동작한다.
388
+
389
+ ### N-Call Passthrough Pattern
390
+
391
+ All MCP tools follow a consistent **N-Call Passthrough Pattern**:
392
+
393
+ ```
394
+ Call 1: Context 요청 → systemPrompt + actionPrompt 반환
395
+ Call N: Caller가 LLM으로 결과 생성 → 제출 및 검증
396
+ ```
397
+
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**
424
+
58
425
  ## License
59
426
 
60
427
  MIT