@dmsdc-ai/aigentry-deliberation 0.0.38 → 0.0.40

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-deliberation",
3
- "version": "0.0.38",
4
- "description": "MCP Deliberation Server Multi-session AI deliberation with smart speaker ordering and persona roles",
3
+ "version": "0.0.40",
4
+ "description": "MCP server for structured multi-AI discussions deliberate across Claude, GPT, Gemini and more before committing to decisions",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -43,6 +43,8 @@
43
43
  "selectors/**",
44
44
  "skills/**",
45
45
  "public/**",
46
+ "lib/**",
47
+ "examples/**",
46
48
  "LICENSE",
47
49
  "README.md"
48
50
  ],
@@ -66,10 +68,14 @@
66
68
  "ai",
67
69
  "multi-agent",
68
70
  "debate",
71
+ "discussion",
72
+ "consensus",
69
73
  "claude",
70
74
  "chatgpt",
71
75
  "gemini",
72
- "codex"
76
+ "codex",
77
+ "model-context-protocol",
78
+ "structured-output"
73
79
  ],
74
80
  "devDependencies": {
75
81
  "vitest": "^4.0.18"
@@ -27,10 +27,13 @@ Claude/Codex를 포함해 MCP를 지원하는 임의 CLI들이 구조화된 토
27
27
  | `deliberation_speaker_candidates` | 참가 가능한 speaker 후보 목록 조회 | 불필요 |
28
28
  | `deliberation_list_active` | 진행 중인 모든 세션 목록 | 불필요 |
29
29
  | `deliberation_status` | 토론 상태 조회 | 선택적* |
30
+ | `deliberation_inject_context` | 외부 실험 결과/추가 컨텍스트 주입 | 선택적 |
30
31
  | `deliberation_context` | 프로젝트 컨텍스트 로드 | 불필요 |
31
32
  | `deliberation_browser_llm_tabs` | 브라우저 LLM 탭 목록 (웹 기반 LLM 참여용) | 불필요 |
32
33
  | `deliberation_route_turn` | 현재 차례 speaker의 transport(CLI/browser_auto/manual)를 자동 라우팅 | 선택적* |
34
+ | `deliberation_run_until_blocked` | CLI/browser_auto/telepty_bus를 자동 진행하다 막히는 지점에서 중단 | 선택적 |
33
35
  | `deliberation_respond` | 현재 차례의 응답 제출 | 선택적* |
36
+ | `deliberation_ingest_remote_reply` | 원격 머신 reply를 명시적 source metadata와 함께 semantic ingest | 선택적 |
34
37
  | `deliberation_history` | 전체 토론 기록 조회 | 선택적* |
35
38
  | `deliberation_synthesize` | 합성 보고서 생성 및 토론 완료 | 선택적* |
36
39
  | `deliberation_list` | 과거 토론 아카이브 목록 | 불필요 |
@@ -63,9 +66,11 @@ Claude/Codex를 포함해 MCP를 지원하는 임의 CLI들이 구조화된 토
63
66
  - CLI speaker → `deliberation_cli_auto_turn`으로 실제 CLI 실행
64
67
  - browser_auto → CDP로 자동 전송/수집
65
68
  - clipboard/manual → 클립보드 준비 + 사용자 안내
69
+ - 완전 자동으로 여러 턴을 밀고 싶으면 `deliberation_run_until_blocked`를 사용합니다. 이 도구는 `cli_respond`, `browser_auto`, `telepty_bus`를 연속 실행하고, 수동 transport 또는 self-turn에서 멈춥니다.
66
70
  3. **NEVER** — 오케스트레이터(자기 자신)가 다른 speaker를 대신하여 `deliberation_respond`에 응답을 작성하지 마세요. 이것은 "역할극"이며 실제 deliberation이 아닙니다. MCP 서버가 이를 감지하고 차단합니다.
67
71
  4. **NEVER** — `deliberation_respond`를 직접 호출하지 마세요 (자기 자신의 응답 제외). 다른 speaker의 턴은 반드시 `deliberation_route_turn` 또는 `deliberation_cli_auto_turn`/`deliberation_browser_auto_turn`을 통해 진행합니다.
68
72
  5. **MUST** — 자기 자신(오케스트레이터 역할의 claude)이 speaker인 경우에만 직접 `deliberation_respond`로 응답을 제출할 수 있습니다.
73
+ 6. **MUST** — 원격 머신/세션에서 들어온 응답을 semantic reply로 반영할 때는 raw bus event를 해석하지 말고 `deliberation_ingest_remote_reply`를 사용하세요. transport trace와 semantic ingest를 섞지 마세요.
69
74
 
70
75
  ## 워크플로우
71
76
 
@@ -94,7 +99,9 @@ Claude/Codex를 포함해 MCP를 지원하는 임의 CLI들이 구조화된 토
94
99
  5. **`deliberation_route_turn` 호출 (필수)** → 현재 차례 speaker transport 자동 결정 및 실행
95
100
  - CLI speaker → `deliberation_cli_auto_turn`이 실제 CLI를 실행하고 응답 수집
96
101
  - browser_auto → CDP로 자동 전송/수집
102
+ - telepty_bus → structured `turn_request` publish + remote self-submit 대기
97
103
  - 자기 자신(claude)이 speaker → 직접 `deliberation_respond`로 응답 제출
104
+ - 여러 턴을 한 번에 진행하려면 `deliberation_run_until_blocked(session_id)` 사용
98
105
  6. 반복 후 `deliberation_synthesize(session_id)` → 합성 완료
99
106
  7. 구현이 필요하면 `deliberation-executor` 스킬로 handoff
100
107
  예: "session_id {id} 합의안 구현해줘"
@@ -106,7 +113,71 @@ Claude/Codex를 포함해 MCP를 지원하는 임의 CLI들이 구조화된 토
106
113
  4. 각 세션을 `session_id`로 명시해 독립 진행
107
114
  5. 각각 `deliberation_synthesize`로 개별 종료
108
115
 
109
- ### C. 자동 진행 (스크립트)
116
+ ### C. 실험 회고 / keep-discard review
117
+ autoresearch 스타일 실험 루프를 검토할 때는 긴 컨텍스트를 `topic`에 섞지 말고, 시작 후 `deliberation_inject_context`로 compact bundle을 넣습니다.
118
+
119
+ 권장 규칙:
120
+ - inject payload는 `1.5KB ~ 2KB` 목표
121
+ - 최근 `3~5`개 실험만 포함
122
+ - `key_changes`는 최대 `3`개 scalar before/after만 유지
123
+ - 전체 `results.tsv` / 전체 `program.md`는 넣지 말고 artifact path만 남김
124
+
125
+ 예:
126
+ ```text
127
+ 1. deliberation_start(topic: "experiment retrospective / keep-discard review", ...)
128
+ 2. deliberation_inject_context(
129
+ session_id: "<session_id>",
130
+ speaker: "dustcraw",
131
+ context: JSON.stringify({
132
+ past_experiments: [{
133
+ experiment_id: "dg-20260310-001",
134
+ signal_kind: "INTEREST_DRIFT",
135
+ patch_summary: "Raised relevanceThreshold from 0.30 to 0.35",
136
+ patch_kind: "config",
137
+ key_changes: {
138
+ relevanceThreshold: { before: 0.30, after: 0.35 }
139
+ },
140
+ score: 0.08,
141
+ score_label: "promotion_rate_delta",
142
+ metric_name: "promotion_rate_delta",
143
+ metric_delta: 0.08,
144
+ verdict: "positive",
145
+ followup_action: "kept",
146
+ reasoning: "Threshold raise reduced noise; promotion quality improved 8%"
147
+ }],
148
+ experiment_count: 1,
149
+ success_rate: 1.0
150
+ })
151
+ )
152
+ 3. deliberation_route_turn(...) 반복
153
+ 4. deliberation_synthesize(..., structured: {
154
+ summary: "...",
155
+ decisions: ["..."],
156
+ actionable_tasks: [...],
157
+ experiment_outcome: {
158
+ verdict: "modify",
159
+ suggested_action: "iterate",
160
+ confidence: 0.78,
161
+ measurement_window_hours: 24
162
+ }
163
+ })
164
+ ```
165
+
166
+ 원격 reply를 semantic turn으로 넣어야 할 때:
167
+
168
+ ```text
169
+ deliberation_ingest_remote_reply(
170
+ session_id: "<session_id>",
171
+ speaker: "<speaker>",
172
+ turn_id: "<pending_turn_id>",
173
+ content: "<reply markdown>",
174
+ source_machine_id: "peer-01",
175
+ source_session_id: "remote-gemini-001",
176
+ transport_scope: "remote_mcp"
177
+ )
178
+ ```
179
+
180
+ ### D. 자동 진행 (스크립트)
110
181
  ```bash
111
182
  # 새 토론
112
183
  bash auto-deliberate.sh "저장소 전략"
@@ -118,7 +189,7 @@ bash auto-deliberate.sh "API 설계" 5
118
189
  bash auto-deliberate.sh --resume <session_id>
119
190
  ```
120
191
 
121
- ### D. 모니터링
192
+ ### E. 모니터링
122
193
  ```bash
123
194
  # 모든 활성 세션 모니터링
124
195
  bash deliberation-monitor.sh
@@ -130,14 +201,14 @@ bash deliberation-monitor.sh <session_id>
130
201
  bash deliberation-monitor.sh --tmux
131
202
  ```
132
203
 
133
- ### E. 브라우저 LLM 자동 연결 (CDP Auto-Activation)
204
+ ### F. 브라우저 LLM 자동 연결 (CDP Auto-Activation)
134
205
  - 브라우저 LLM speaker가 선택되면 CDP(Chrome DevTools Protocol)가 자동으로 활성화됩니다.
135
206
  - macOS에서는 Chrome이 실행되지 않은 경우 `--remote-debugging-port=9222`로 자동 실행을 시도합니다.
136
207
  - **Chrome이 이미 CDP 없이 실행 중인 경우**: Chrome을 완전히 종료한 후 다시 시도해야 합니다. (최초 1회만 필요)
137
208
  - CDP 연결 성공 시 모든 브라우저 speaker는 ⚡자동 모드로 동작합니다.
138
209
  - Windows/Linux에서는 사용자가 직접 Chrome을 `--remote-debugging-port=9222`로 실행해야 합니다.
139
210
 
140
- ### F. Chrome 확장 프로그램 사이드패널 지원
211
+ ### G. Chrome 확장 프로그램 사이드패널 지원
141
212
  - **Chrome 확장 프로그램 사이드패널 (chrome-extension:// URL)은 지원됩니다.**
142
213
  - Claude, ChatGPT, Gemini 등의 Chrome 확장 사이드패널도 CDP를 통해 deliberation 참가자로 사용 가능합니다.
143
214
  - 사이드패널은 title 기반 매칭으로 감지됩니다 (extension ID가 아닌 탭 제목으로 식별).
@@ -182,3 +253,36 @@ bash deliberation-monitor.sh --tmux
182
253
 
183
254
  - **deliberation-gate**: superpowers 워크플로우 통합 스킬. brainstorming/code-review/debugging 의사결정 지점에 멀티-AI 검증 게이트를 삽입합니다. `~/.claude/skills/deliberation-gate/SKILL.md`에 설치.
184
255
  - **deliberation-executor**: deliberation 합의안을 실제 코드 구현으로 전환하는 실행 전용 스킬.
256
+
257
+ ## Data Model: Canonical Roles
258
+
259
+ Deliberation produces two complementary data artifacts after synthesis:
260
+
261
+ | Artifact | Role | Consumers |
262
+ |----------|------|-----------|
263
+ | `structured_synthesis` | **Human + reasoning canonical** | Human reviewers, LLM context, decision history |
264
+ | `execution_contract` | **Automation canonical** | inbox-watcher, devkit, registry, orchestrator agents |
265
+
266
+ ### structured_synthesis (Human Canonical)
267
+ Rich context for human review. Contains:
268
+ - `summary`: natural language overview
269
+ - `decisions`: reasoning and rationale
270
+ - `actionable_tasks`: full task descriptions with context
271
+ - `experiment_outcome`: optional verdict (keep/discard/modify)
272
+
273
+ ### execution_contract (Automation Canonical)
274
+ Minimal, deterministic task list for machines. Contains:
275
+ - `version`: contract schema version (currently "v1")
276
+ - `source_session_id`: originating deliberation session
277
+ - `summary`: brief summary for log context
278
+ - `tasks`: flattened actionable task list (same shape as `actionable_tasks`)
279
+ - `generated_from.structured_synthesis_hash`: SHA-1 provenance hash
280
+
281
+ **Rule**: Automation consumers MUST prefer `execution_contract` when present.
282
+ Fall back to `structured_synthesis` only when `execution_contract` is `null`.
283
+
284
+ ### Archive Outputs
285
+ When a deliberation completes:
286
+ 1. **Markdown archive**: `~/.local/lib/mcp-deliberation/state/{project}/archive/deliberation-{ts}-{slug}.md`
287
+ 2. **Contract sidecar**: `~/.local/lib/mcp-deliberation/state/{project}/archive/deliberation-{ts}-{slug}.contract.json`
288
+ 3. **Telepty envelope**: `deliberation_completed` event with both artifacts in payload