@tienne/gestalt 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.backup.md +442 -0
- package/README.ko.md +487 -0
- package/README.md +324 -286
- package/dist/package.json +10 -3
- package/dist/review-agents/performance-reviewer/AGENT.md +31 -0
- package/dist/review-agents/quality-reviewer/AGENT.md +31 -0
- package/dist/review-agents/security-reviewer/AGENT.md +32 -0
- package/dist/role-agents/architect/AGENT.md +30 -0
- package/dist/role-agents/backend-developer/AGENT.md +30 -0
- package/dist/role-agents/designer/AGENT.md +30 -0
- package/dist/role-agents/devops-engineer/AGENT.md +30 -0
- package/dist/role-agents/frontend-developer/AGENT.md +30 -0
- package/dist/role-agents/product-planner/AGENT.md +30 -0
- package/dist/role-agents/qa-engineer/AGENT.md +30 -0
- package/dist/role-agents/researcher/AGENT.md +30 -0
- package/dist/role-agents/technical-writer/AGENT.md +212 -0
- package/dist/skills/agent/SKILL.md +102 -0
- package/dist/skills/execute/SKILL.md +274 -6
- package/dist/src/agent/role-agent-registry.d.ts +4 -2
- package/dist/src/agent/role-agent-registry.d.ts.map +1 -1
- package/dist/src/agent/role-agent-registry.js +12 -3
- package/dist/src/agent/role-agent-registry.js.map +1 -1
- package/dist/src/cli/commands/interview.d.ts +5 -1
- package/dist/src/cli/commands/interview.d.ts.map +1 -1
- package/dist/src/cli/commands/interview.js +15 -3
- package/dist/src/cli/commands/interview.js.map +1 -1
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +4 -2
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/core/config.d.ts +3 -0
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +4 -0
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/types.d.ts +28 -0
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/mcp/schemas.d.ts +3 -0
- package/dist/src/mcp/schemas.d.ts.map +1 -1
- package/dist/src/mcp/schemas.js +2 -0
- package/dist/src/mcp/schemas.js.map +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +12 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/agent-passthrough.d.ts +7 -0
- package/dist/src/mcp/tools/agent-passthrough.d.ts.map +1 -0
- package/dist/src/mcp/tools/agent-passthrough.js +49 -0
- package/dist/src/mcp/tools/agent-passthrough.js.map +1 -0
- package/dist/src/mcp/tools/interview-passthrough.d.ts.map +1 -1
- package/dist/src/mcp/tools/interview-passthrough.js +26 -1
- package/dist/src/mcp/tools/interview-passthrough.js.map +1 -1
- package/dist/src/mcp/tools/interview.d.ts.map +1 -1
- package/dist/src/mcp/tools/interview.js +26 -1
- package/dist/src/mcp/tools/interview.js.map +1 -1
- package/dist/src/recording/agg-converter.d.ts +25 -0
- package/dist/src/recording/agg-converter.d.ts.map +1 -0
- package/dist/src/recording/agg-converter.js +80 -0
- package/dist/src/recording/agg-converter.js.map +1 -0
- package/dist/src/recording/agg-installer.d.ts +6 -0
- package/dist/src/recording/agg-installer.d.ts.map +1 -0
- package/dist/src/recording/agg-installer.js +50 -0
- package/dist/src/recording/agg-installer.js.map +1 -0
- package/dist/src/recording/asciinema-installer.d.ts +6 -0
- package/dist/src/recording/asciinema-installer.d.ts.map +1 -0
- package/dist/src/recording/asciinema-installer.js +50 -0
- package/dist/src/recording/asciinema-installer.js.map +1 -0
- package/dist/src/recording/asciinema-recorder.d.ts +26 -0
- package/dist/src/recording/asciinema-recorder.d.ts.map +1 -0
- package/dist/src/recording/asciinema-recorder.js +52 -0
- package/dist/src/recording/asciinema-recorder.js.map +1 -0
- package/dist/src/recording/cast-generator.d.ts +7 -0
- package/dist/src/recording/cast-generator.d.ts.map +1 -0
- package/dist/src/recording/cast-generator.js +72 -0
- package/dist/src/recording/cast-generator.js.map +1 -0
- package/dist/src/recording/filename-generator.d.ts +19 -0
- package/dist/src/recording/filename-generator.d.ts.map +1 -0
- package/dist/src/recording/filename-generator.js +67 -0
- package/dist/src/recording/filename-generator.js.map +1 -0
- package/dist/src/recording/gif-generator.d.ts +21 -0
- package/dist/src/recording/gif-generator.d.ts.map +1 -0
- package/dist/src/recording/gif-generator.js +121 -0
- package/dist/src/recording/gif-generator.js.map +1 -0
- package/dist/src/recording/recording-dir.d.ts +5 -0
- package/dist/src/recording/recording-dir.d.ts.map +1 -0
- package/dist/src/recording/recording-dir.js +13 -0
- package/dist/src/recording/recording-dir.js.map +1 -0
- package/dist/src/recording/recording-orchestrator.d.ts +50 -0
- package/dist/src/recording/recording-orchestrator.d.ts.map +1 -0
- package/dist/src/recording/recording-orchestrator.js +98 -0
- package/dist/src/recording/recording-orchestrator.js.map +1 -0
- package/dist/src/recording/resume-detector.d.ts +10 -0
- package/dist/src/recording/resume-detector.d.ts.map +1 -0
- package/dist/src/recording/resume-detector.js +14 -0
- package/dist/src/recording/resume-detector.js.map +1 -0
- package/dist/src/recording/segment-merger.d.ts +27 -0
- package/dist/src/recording/segment-merger.d.ts.map +1 -0
- package/dist/src/recording/segment-merger.js +65 -0
- package/dist/src/recording/segment-merger.js.map +1 -0
- package/dist/src/recording/terminal-recorder.d.ts +31 -0
- package/dist/src/recording/terminal-recorder.d.ts.map +1 -0
- package/dist/src/recording/terminal-recorder.js +111 -0
- package/dist/src/recording/terminal-recorder.js.map +1 -0
- package/dist/src/scripts/postinstall.d.ts +2 -0
- package/dist/src/scripts/postinstall.d.ts.map +1 -0
- package/dist/src/scripts/postinstall.js +27 -0
- package/dist/src/scripts/postinstall.js.map +1 -0
- package/package.json +10 -3
- package/review-agents/performance-reviewer/AGENT.md +31 -0
- package/review-agents/quality-reviewer/AGENT.md +31 -0
- package/review-agents/security-reviewer/AGENT.md +32 -0
- package/role-agents/architect/AGENT.md +30 -0
- package/role-agents/backend-developer/AGENT.md +30 -0
- package/role-agents/designer/AGENT.md +30 -0
- package/role-agents/devops-engineer/AGENT.md +30 -0
- package/role-agents/frontend-developer/AGENT.md +30 -0
- package/role-agents/product-planner/AGENT.md +30 -0
- package/role-agents/qa-engineer/AGENT.md +30 -0
- package/role-agents/researcher/AGENT.md +30 -0
- package/role-agents/technical-writer/AGENT.md +212 -0
- package/skills/agent/SKILL.md +102 -0
- package/skills/execute/SKILL.md +274 -6
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent
|
|
3
|
+
version: "1.0.0"
|
|
4
|
+
description: "Invoke a Gestalt agent directly for any task — no pipeline required"
|
|
5
|
+
triggers:
|
|
6
|
+
- "agent"
|
|
7
|
+
- "use agent"
|
|
8
|
+
- "invoke agent"
|
|
9
|
+
- "run agent"
|
|
10
|
+
inputs:
|
|
11
|
+
name:
|
|
12
|
+
type: string
|
|
13
|
+
required: false
|
|
14
|
+
description: "Agent name (e.g. architect, security-reviewer). Omit to list all available agents."
|
|
15
|
+
task:
|
|
16
|
+
type: string
|
|
17
|
+
required: false
|
|
18
|
+
description: "Task or question for the agent to perform"
|
|
19
|
+
outputs:
|
|
20
|
+
- response
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Agent Skill
|
|
24
|
+
|
|
25
|
+
Invoke any Gestalt Role or Review agent directly, outside the Gestalt pipeline.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# List all available agents
|
|
31
|
+
/agent
|
|
32
|
+
|
|
33
|
+
# Run a Role Agent
|
|
34
|
+
/agent architect "review the module boundaries in this codebase"
|
|
35
|
+
/agent backend-developer "is this REST API design consistent?"
|
|
36
|
+
/agent qa-engineer "what edge cases am I missing for this login flow?"
|
|
37
|
+
/agent frontend-developer "review this React component for accessibility issues"
|
|
38
|
+
|
|
39
|
+
# Run a Review Agent
|
|
40
|
+
/agent security-reviewer "check this authentication code for vulnerabilities"
|
|
41
|
+
/agent performance-reviewer "are there any N+1 queries or memory leaks here?"
|
|
42
|
+
/agent quality-reviewer "review this for readability and maintainability"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Agent Groups
|
|
46
|
+
|
|
47
|
+
**Role Agents** — domain specialists for consultation and advice:
|
|
48
|
+
|
|
49
|
+
| Agent | Domain |
|
|
50
|
+
|-------|--------|
|
|
51
|
+
| `architect` | System design, scalability, design patterns |
|
|
52
|
+
| `backend-developer` | API, database, authentication, server |
|
|
53
|
+
| `frontend-developer` | UI, React, accessibility |
|
|
54
|
+
| `designer` | UX/UI, design systems, interaction |
|
|
55
|
+
| `qa-engineer` | Testing, edge cases, quality |
|
|
56
|
+
| `devops-engineer` | CI/CD, infrastructure, monitoring |
|
|
57
|
+
| `product-planner` | Requirements, roadmap, user stories |
|
|
58
|
+
| `researcher` | Analysis, benchmarks, best practices |
|
|
59
|
+
|
|
60
|
+
**Review Agents** — code review specialists:
|
|
61
|
+
|
|
62
|
+
| Agent | Focus |
|
|
63
|
+
|-------|-------|
|
|
64
|
+
| `security-reviewer` | Injection, XSS, auth vulnerabilities, secrets |
|
|
65
|
+
| `performance-reviewer` | Memory leaks, N+1 queries, bundle size, async |
|
|
66
|
+
| `quality-reviewer` | Readability, SOLID, error handling, DRY |
|
|
67
|
+
|
|
68
|
+
## Instructions
|
|
69
|
+
|
|
70
|
+
### Listing agents
|
|
71
|
+
|
|
72
|
+
When called without a `name` argument:
|
|
73
|
+
|
|
74
|
+
1. Call `ges_agent({ action: "list" })` to retrieve all available agents
|
|
75
|
+
2. Display the results grouped as **Role Agents** and **Review Agents**
|
|
76
|
+
3. For each agent, show name, description, and key domains
|
|
77
|
+
4. Suggest example invocations based on common use cases
|
|
78
|
+
|
|
79
|
+
### Running an agent
|
|
80
|
+
|
|
81
|
+
When called with a `name` and `task`:
|
|
82
|
+
|
|
83
|
+
1. Call `ges_agent({ action: "get", name: "<agent-name>" })` to retrieve the agent definition
|
|
84
|
+
2. If the agent is not found, list available agents and ask the user to choose one
|
|
85
|
+
3. Adopt the agent's `systemPrompt` as your active persona for this response
|
|
86
|
+
4. Perform the task from that agent's specialist perspective
|
|
87
|
+
5. Follow the output format defined in the agent's system prompt (severity levels, structured findings, etc.)
|
|
88
|
+
|
|
89
|
+
### Agent name only, no task
|
|
90
|
+
|
|
91
|
+
When a `name` is provided but no `task`:
|
|
92
|
+
|
|
93
|
+
1. Call `ges_agent({ action: "get", name: "<agent-name>" })` to retrieve the agent
|
|
94
|
+
2. Display the agent's description, domains, and what it can help with
|
|
95
|
+
3. Prompt the user to provide a specific task or question
|
|
96
|
+
|
|
97
|
+
### Partial name matching
|
|
98
|
+
|
|
99
|
+
If the provided name doesn't exactly match (e.g. "security" instead of "security-reviewer"):
|
|
100
|
+
|
|
101
|
+
1. Call `ges_agent({ action: "list" })` to get all agent names
|
|
102
|
+
2. Find the closest match and confirm with the user before proceeding
|
package/skills/execute/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: execute
|
|
3
|
-
version: "1.
|
|
3
|
+
version: "1.1.0"
|
|
4
4
|
description: "Gestalt-driven execution planner that transforms a Spec into a validated ExecutionPlan"
|
|
5
5
|
triggers:
|
|
6
6
|
- "execute"
|
|
@@ -17,14 +17,43 @@ outputs:
|
|
|
17
17
|
|
|
18
18
|
# Execute Skill
|
|
19
19
|
|
|
20
|
-
This skill transforms a validated Spec specification into a concrete, dependency-aware Execution Plan
|
|
20
|
+
This skill transforms a validated Spec specification into a concrete, dependency-aware Execution Plan, executes it with multi-perspective Role Agent guidance, and validates the result through a 2-stage evaluation pipeline.
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Full Pipeline
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Planning → Execution → Evaluate → (Evolve if needed)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Phase 1 — Planning
|
|
23
29
|
|
|
24
30
|
1. **Figure-Ground** (Step 1): Classify acceptance criteria as essential (figure) or supplementary (ground), assign priority levels
|
|
25
|
-
2. **Closure** (Step 2): Decompose ACs into atomic tasks,
|
|
26
|
-
3. **Proximity** (Step 3): Group related
|
|
27
|
-
4. **Continuity** (Step 4): Validate the dependency DAG —
|
|
31
|
+
2. **Closure** (Step 2): Decompose ACs into atomic tasks, including implicit sub-tasks
|
|
32
|
+
3. **Proximity** (Step 3): Group related tasks by domain into logical task groups
|
|
33
|
+
4. **Continuity** (Step 4): Validate the dependency DAG — no cycles, clear topological order
|
|
34
|
+
|
|
35
|
+
### Phase 2 — Execution
|
|
36
|
+
|
|
37
|
+
Run tasks in topological order. For each task:
|
|
38
|
+
|
|
39
|
+
1. **Role Match** (optional but recommended): identify which Role Agents are relevant to this task
|
|
40
|
+
2. **Role Consensus**: collect multi-perspective guidance from matched agents
|
|
41
|
+
3. **Execute Task**: perform the task using the role guidance
|
|
42
|
+
|
|
43
|
+
### Phase 3 — Evaluate
|
|
44
|
+
|
|
45
|
+
After all tasks complete, run a 2-stage evaluation:
|
|
46
|
+
|
|
47
|
+
- **Stage 1 (Structural)**: run lint → build → test — short-circuits if any fail
|
|
48
|
+
- **Stage 2 (Contextual)**: LLM validates each AC + goal alignment
|
|
49
|
+
|
|
50
|
+
Success condition: `score ≥ 0.85` AND `goalAlignment ≥ 0.80`
|
|
51
|
+
|
|
52
|
+
### Phase 4 — Evolve (when evaluation fails)
|
|
53
|
+
|
|
54
|
+
- **Flow A — Structural Fix**: fix lint/build/test failures → re-evaluate
|
|
55
|
+
- **Flow B — Contextual Evolution**: patch Spec ACs/constraints → re-execute impacted tasks → re-evaluate
|
|
56
|
+
- **Flow C — Lateral Thinking**: when stagnation detected, rotate through Multistability / Simplicity / Reification / Invariance personas
|
|
28
57
|
|
|
29
58
|
## Passthrough Mode
|
|
30
59
|
|
|
@@ -82,3 +111,242 @@ API 키 없이 MCP 서버 실행 시 자동 활성화. LLM 작업을 caller가
|
|
|
82
111
|
- 각 단계 결과는 이전 단계 데이터와 교차 검증됨
|
|
83
112
|
- Continuity 단계에서는 서버 측 DAG 검증이 추가로 수행됨
|
|
84
113
|
- 모든 AC가 분류되어야 하고, 모든 Task가 그룹에 포함되어야 함
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Phase 2 — Execution
|
|
118
|
+
|
|
119
|
+
### `execute_start` — 실행 시작
|
|
120
|
+
|
|
121
|
+
`plan_complete` 이후 호출. 태스크 목록을 받아 실행 준비.
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{ "action": "execute_start", "sessionId": "..." }
|
|
125
|
+
```
|
|
126
|
+
→ `{ status, sessionId, executionPlan, message }`
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### Role Agent 플로우 (태스크당, 선택적)
|
|
131
|
+
|
|
132
|
+
태스크 내용과 관련된 Role Agent가 있을 경우 role_match → role_consensus 순으로 호출해 guidance를 받는다. 문서 작성, 보안, 성능, 아키텍처 등 전문 영역이 필요한 태스크에 특히 유효하다.
|
|
133
|
+
|
|
134
|
+
**`role_match` — 관련 에이전트 매칭 (2-Call)**
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
// Call 1: 매칭 컨텍스트 요청
|
|
138
|
+
{ "action": "role_match", "sessionId": "..." }
|
|
139
|
+
```
|
|
140
|
+
→ `{ matchContext }` — 어떤 에이전트가 적합한지 판단하기 위한 프롬프트
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
// Call 2: 매칭 결과 제출
|
|
144
|
+
{
|
|
145
|
+
"action": "role_match",
|
|
146
|
+
"sessionId": "...",
|
|
147
|
+
"matchResult": [
|
|
148
|
+
{ "agentName": "technical-writer", "domain": ["documentation"], "relevanceScore": 0.9, "reasoning": "..." },
|
|
149
|
+
{ "agentName": "architect", "domain": ["architecture"], "relevanceScore": 0.7, "reasoning": "..." }
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
→ `{ perspectivePrompts }` — 각 에이전트별 관점 생성 프롬프트
|
|
154
|
+
|
|
155
|
+
**`role_consensus` — 다중 관점 합의 (2-Call)**
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
// Call 1: 각 에이전트 관점 수집 후 제출
|
|
159
|
+
{
|
|
160
|
+
"action": "role_consensus",
|
|
161
|
+
"sessionId": "...",
|
|
162
|
+
"perspectives": [
|
|
163
|
+
{ "agentName": "technical-writer", "perspective": "...", "confidence": 0.9 },
|
|
164
|
+
{ "agentName": "architect", "perspective": "...", "confidence": 0.8 }
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
→ `{ synthesisContext }` — 관점 통합 프롬프트
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
// Call 2: 합성된 합의 제출
|
|
172
|
+
{
|
|
173
|
+
"action": "role_consensus",
|
|
174
|
+
"sessionId": "...",
|
|
175
|
+
"consensus": {
|
|
176
|
+
"consensus": "통합된 가이드라인",
|
|
177
|
+
"conflictResolutions": ["...", "..."],
|
|
178
|
+
"perspectives": [...]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
→ `{ roleGuidance }` — execute_task 시 참조할 최종 guidance
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### `execute_task` — 태스크 실행 결과 제출
|
|
187
|
+
|
|
188
|
+
role_match/role_consensus로 얻은 `roleGuidance`를 참조해 태스크를 수행한 후 결과 제출.
|
|
189
|
+
`allTasksCompleted === true`가 될 때까지 반복.
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"action": "execute_task",
|
|
194
|
+
"sessionId": "...",
|
|
195
|
+
"taskResult": {
|
|
196
|
+
"taskId": "task-0",
|
|
197
|
+
"status": "completed",
|
|
198
|
+
"output": "태스크 수행 결과 요약",
|
|
199
|
+
"artifacts": ["path/to/file.ts"]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
→ `{ status, nextTaskId?, allTasksCompleted, driftResult? }`
|
|
204
|
+
|
|
205
|
+
`driftResult`가 반환되면 Spec과의 drift 경고 — 계속 진행하되 다음 태스크에서 방향 보정.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Phase 3 — Evaluate
|
|
210
|
+
|
|
211
|
+
모든 태스크 완료 후 3-Call 평가 진행.
|
|
212
|
+
|
|
213
|
+
**Call 1 — Structural 단계 시작**
|
|
214
|
+
```json
|
|
215
|
+
{ "action": "evaluate", "sessionId": "..." }
|
|
216
|
+
```
|
|
217
|
+
→ `{ stage: "structural", structuralContext }` — lint/build/test 실행 지시
|
|
218
|
+
|
|
219
|
+
**Call 2 — Structural 결과 제출**
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"action": "evaluate",
|
|
223
|
+
"sessionId": "...",
|
|
224
|
+
"structuralResult": {
|
|
225
|
+
"commands": [
|
|
226
|
+
{ "name": "lint", "command": "pnpm run lint", "exitCode": 0, "output": "" },
|
|
227
|
+
{ "name": "build", "command": "pnpm run build", "exitCode": 0, "output": "" },
|
|
228
|
+
{ "name": "test", "command": "pnpm run test", "exitCode": 0, "output": "360 tests passed" }
|
|
229
|
+
],
|
|
230
|
+
"allPassed": true
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
→ structural 실패 시 `{ stage: "structural_failed", evolveContext }` → Evolve Flow A 진입
|
|
235
|
+
→ structural 통과 시 `{ stage: "contextual", evaluationContext }` — AC별 LLM 검증 지시
|
|
236
|
+
|
|
237
|
+
**Call 3 — Contextual 결과 제출**
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"action": "evaluate",
|
|
241
|
+
"sessionId": "...",
|
|
242
|
+
"evaluationResult": {
|
|
243
|
+
"verifications": [
|
|
244
|
+
{ "acIndex": 0, "satisfied": true, "evidence": "...", "gaps": [] }
|
|
245
|
+
],
|
|
246
|
+
"overallScore": 0.92,
|
|
247
|
+
"goalAlignment": 0.88,
|
|
248
|
+
"recommendations": []
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
→ `{ status: "completed" }` (score ≥ 0.85, goalAlignment ≥ 0.80)
|
|
253
|
+
→ 미달 시 `{ evolveContext }` → Evolve Flow B 진입
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Phase 4 — Evolve
|
|
258
|
+
|
|
259
|
+
### Flow A — Structural Fix
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
// 1. Fix context 요청
|
|
263
|
+
{ "action": "evolve_fix", "sessionId": "..." }
|
|
264
|
+
→ fixContext 반환
|
|
265
|
+
|
|
266
|
+
// 2. Fix 수행 후 결과 제출
|
|
267
|
+
{
|
|
268
|
+
"action": "evolve_fix",
|
|
269
|
+
"sessionId": "...",
|
|
270
|
+
"fixTasks": [
|
|
271
|
+
{ "taskId": "fix-0", "failedCommand": "pnpm run lint", "errorOutput": "...", "fixDescription": "...", "artifacts": [] }
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// 3. Re-evaluate (Phase 3 반복)
|
|
276
|
+
{ "action": "evaluate", "sessionId": "..." }
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Flow B — Contextual Evolution
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
// 1. Evolution context 요청
|
|
283
|
+
{ "action": "evolve", "sessionId": "..." }
|
|
284
|
+
→ evolveContext (또는 terminateReason으로 종료)
|
|
285
|
+
|
|
286
|
+
// 2. Spec patch 제출 (AC/constraints 수정, goal 변경 불가)
|
|
287
|
+
{
|
|
288
|
+
"action": "evolve_patch",
|
|
289
|
+
"sessionId": "...",
|
|
290
|
+
"specPatch": {
|
|
291
|
+
"acceptanceCriteria": ["수정된 AC..."],
|
|
292
|
+
"constraints": ["추가 제약조건..."]
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
→ { impactedTaskIds, reExecuteContext }
|
|
296
|
+
|
|
297
|
+
// 3. 영향받은 태스크 재실행 (allTasksCompleted까지 반복)
|
|
298
|
+
{
|
|
299
|
+
"action": "evolve_re_execute",
|
|
300
|
+
"sessionId": "...",
|
|
301
|
+
"reExecuteTaskResult": { "taskId": "task-3", "status": "completed", "output": "...", "artifacts": [] }
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// 4. Re-evaluate
|
|
305
|
+
{ "action": "evaluate", "sessionId": "..." }
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Flow C — Lateral Thinking (stagnation 감지 시 자동 분기)
|
|
309
|
+
|
|
310
|
+
`evolve` 호출 시 stagnation/oscillation/hard_cap이 감지되면 자동으로 lateral thinking persona로 전환.
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
// evolve 호출 → lateralContext 반환
|
|
314
|
+
{ "action": "evolve", "sessionId": "..." }
|
|
315
|
+
→ { status: "lateral_thinking", lateralContext: { persona, pattern, lateralPrompt, ... } }
|
|
316
|
+
|
|
317
|
+
// Lateral result 제출
|
|
318
|
+
{
|
|
319
|
+
"action": "evolve_lateral_result",
|
|
320
|
+
"sessionId": "...",
|
|
321
|
+
"lateralResult": {
|
|
322
|
+
"persona": "multistability",
|
|
323
|
+
"specPatch": { "acceptanceCriteria": [...] },
|
|
324
|
+
"description": "관점 전환으로 요구사항 재구성"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Re-execute + Re-evaluate (Flow B와 동일)
|
|
329
|
+
|
|
330
|
+
// 다음 persona 요청 (점수 미달 시)
|
|
331
|
+
{ "action": "evolve_lateral", "sessionId": "..." }
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
| Stagnation 패턴 | Persona | 전략 |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| hard_cap | Multistability | 다른 각도로 보기 |
|
|
337
|
+
| oscillation | Simplicity | 단순하게 줄이기 |
|
|
338
|
+
| no_drift | Reification | 빠진 조각 채우기 |
|
|
339
|
+
| diminishing_returns | Invariance | 성공 패턴 복제 |
|
|
340
|
+
|
|
341
|
+
4개 persona 소진 → `human_escalation` 반환으로 세션 종료.
|
|
342
|
+
|
|
343
|
+
### 종료 조건
|
|
344
|
+
|
|
345
|
+
| 조건 | 트리거 |
|
|
346
|
+
|------|--------|
|
|
347
|
+
| `success` | score ≥ 0.85 AND goalAlignment ≥ 0.80 |
|
|
348
|
+
| `stagnation` | 2회 연속 delta < 0.05 |
|
|
349
|
+
| `oscillation` | 2회 연속 점수 역전 |
|
|
350
|
+
| `hard_cap` | structural 3회 + contextual 3회 실패 |
|
|
351
|
+
| `caller` | `{ action: "evolve", terminateReason: "caller" }` |
|
|
352
|
+
| `human_escalation` | 4개 lateral persona 소진 |
|