@dmsdc-ai/aigentry-deliberation 0.0.35 → 0.0.37

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.md CHANGED
@@ -33,7 +33,7 @@ MCP Deliberation Server — Multi-session AI deliberation with smart speaker ord
33
33
  원클릭 설치 — 어떤 프로젝트 환경에서든 동작합니다:
34
34
 
35
35
  ```bash
36
- npx @dmsdc-ai/aigentry-deliberation install
36
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install
37
37
  ```
38
38
 
39
39
  이 명령은:
@@ -62,7 +62,7 @@ cd aigentry-deliberation && npm install && node install.js
62
62
  ### 제거
63
63
 
64
64
  ```bash
65
- npx @dmsdc-ai/aigentry-deliberation uninstall
65
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install --uninstall
66
66
  ```
67
67
 
68
68
  MCP 서버 등록 해제 + 설치 파일 삭제 + 스킬 파일 정리까지 자동 처리됩니다.
@@ -87,7 +87,7 @@ open demo/forum/index.html
87
87
  MCP 연결 문제 자동 진단:
88
88
 
89
89
  ```bash
90
- npx @dmsdc-ai/aigentry-deliberation doctor
90
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-doctor
91
91
  ```
92
92
 
93
93
  Claude Code, Codex CLI, Gemini CLI의 MCP 설정을 자동 점검하고 문제를 진단합니다.
@@ -101,6 +101,7 @@ Claude Code, Codex CLI, Gemini CLI의 MCP 설정을 자동 점검하고 문제
101
101
  | `deliberation_synthesize` | Generate synthesis report |
102
102
  | `deliberation_status` | Check session status |
103
103
  | `deliberation_context` | Load project context |
104
+ | `deliberation_inject_context` | Inject structured context or external experiment history into an active session |
104
105
  | `deliberation_history` | View discussion history |
105
106
  | `deliberation_list_active` | List active sessions |
106
107
  | `deliberation_list` | List archived sessions |
@@ -137,6 +138,48 @@ Telepty-managed sessions are now routed through the telepty bus instead of raw P
137
138
  - `session_health` bus events are cached for operator visibility
138
139
  - `deliberation_synthesize` validates and emits typed `deliberation_completed` envelopes for downstream automation
139
140
 
141
+ ## Experiment Retrospectives
142
+
143
+ For autoresearch-style keep/discard reviews, inject a compact experiment bundle after the session starts instead of bloating `topic`.
144
+
145
+ Recommended rules:
146
+ - keep the injected JSON around `1.5KB` to `2KB`
147
+ - include only the last `3-5` relevant experiments
148
+ - keep `key_changes` to at most `3` scalar before/after pairs
149
+ - reference bulky artifacts (`results.tsv`, full `program.md`, JSONL logs) by path only
150
+
151
+ Example:
152
+
153
+ ```text
154
+ deliberation_start(...)
155
+ deliberation_inject_context(
156
+ session_id: "experiment-review-123",
157
+ speaker: "dustcraw",
158
+ context: "{\"past_experiments\":[{\"experiment_id\":\"dg-20260310-001\",\"signal_kind\":\"INTEREST_DRIFT\",\"patch_summary\":\"Raised relevanceThreshold from 0.30 to 0.35\",\"patch_kind\":\"config\",\"key_changes\":{\"relevanceThreshold\":{\"before\":0.3,\"after\":0.35}},\"score\":0.08,\"score_label\":\"promotion_rate_delta\",\"metric_name\":\"promotion_rate_delta\",\"metric_delta\":0.08,\"verdict\":\"positive\",\"followup_action\":\"kept\",\"reasoning\":\"Threshold raise reduced noise; promotion quality improved 8%\"}],\"experiment_count\":1,\"success_rate\":1.0}"
159
+ )
160
+ ```
161
+
162
+ If your synthesis needs an explicit experiment verdict, `structured` can now include `experiment_outcome`:
163
+
164
+ ```json
165
+ {
166
+ "summary": "Lower the blast radius and re-run with stricter constraints.",
167
+ "decisions": [
168
+ "Keep the experiment loop bounded to one editable file",
169
+ "Retry after restoring the failing test baseline"
170
+ ],
171
+ "actionable_tasks": [
172
+ { "id": 1, "task": "Tighten editable globs", "project": "aigentry-devkit", "priority": "high" }
173
+ ],
174
+ "experiment_outcome": {
175
+ "verdict": "modify",
176
+ "suggested_action": "iterate",
177
+ "confidence": 0.78,
178
+ "measurement_window_hours": 24
179
+ }
180
+ }
181
+ ```
182
+
140
183
  ## Speaker Ordering Strategies
141
184
 
142
185
  | Strategy | Description |
@@ -196,7 +239,7 @@ Inserts multi-AI verification gates at key [superpowers](https://github.com/obra
196
239
 
197
240
  **Fallback:** MCP 미설치 시 self-criticism 기반 자가 검증으로 대체 (Silver 등급). MCP 설치 시 멀티-AI 토론 (Gold 등급).
198
241
 
199
- **Install:** `npx @dmsdc-ai/aigentry-deliberation install` 실행 시 자동 설치됩니다.
242
+ **Install:** `npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install` 실행 시 자동 설치됩니다.
200
243
 
201
244
  수동 설치:
202
245
  ```bash
@@ -207,6 +250,12 @@ cp skills/deliberation-gate/SKILL.md ~/.claude/skills/deliberation-gate/SKILL.md
207
250
 
208
251
  ## What's New
209
252
 
253
+ ### v0.0.36
254
+ - **README refresh**: clarified the mandatory TUI speaker-selection flow and the confirmed-token handoff before `deliberation_start`
255
+ - **Telepty candidate docs**: documented active telepty session discovery with lightweight `session_id` + `host/pid` locators instead of heavy persisted process snapshots
256
+ - **Cross-project delivery docs**: clarified that active session lookup now resolves across project state directories, which unblocks cross-project `deliberation_respond` flows
257
+ - **Operator guidance**: documented telepty bus transport as the automation path and unmanaged/manual sessions as the fallback path
258
+
210
259
  ### v0.0.35
211
260
  - **Manual selection enforcement**: `deliberation_confirm_speakers` binds a fresh candidate snapshot to the exact user-picked speaker set before `deliberation_start`
212
261
  - **Telepty session candidates**: active telepty sessions appear in speaker discovery with lightweight host/pid locators
package/doctor.js CHANGED
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * Usage:
17
17
  * node doctor.js
18
- * npx @dmsdc-ai/aigentry-deliberation doctor
18
+ * npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-doctor
19
19
  */
20
20
 
21
21
  import fs from "node:fs";
@@ -209,7 +209,7 @@ function suggestFix(serverName, server, issue) {
209
209
  switch (issue) {
210
210
  case "path_missing":
211
211
  if (serverName === "deliberation" || serverName === "mcp-deliberation") {
212
- return `npx @dmsdc-ai/aigentry-deliberation install`;
212
+ return `npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install`;
213
213
  }
214
214
  if (serverName.includes("brain") || serverName.includes("aigentry-brain")) {
215
215
  return `npx @dmsdc-ai/aigentry-brain install`;
@@ -223,7 +223,7 @@ function suggestFix(serverName, server, issue) {
223
223
  case "temp_path": {
224
224
  const tempArg = (server.args || []).find((a) => isTempPath(a));
225
225
  if (serverName === "deliberation" || serverName === "mcp-deliberation") {
226
- return `npx @dmsdc-ai/aigentry-deliberation install # reinstall to permanent path`;
226
+ return `npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install # reinstall to permanent path`;
227
227
  }
228
228
  if (serverName.includes("brain") || serverName.includes("aigentry-brain")) {
229
229
  return `npx @dmsdc-ai/aigentry-brain install # reinstall to permanent path`;
@@ -357,7 +357,7 @@ function runDiagnostics() {
357
357
  if (mod.includes("aigentry-brain") || mod.includes("brain")) {
358
358
  fix = `npx @dmsdc-ai/aigentry-brain install # temporary path → reinstall to permanent path`;
359
359
  } else if (mod.includes("deliberation") || mod.includes("mcp-deliberation")) {
360
- fix = `npx @dmsdc-ai/aigentry-deliberation install # temporary path reinstall to permanent path`;
360
+ fix = `npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install # temporary path -> reinstall to permanent path`;
361
361
  } else {
362
362
  fix = `# temporary path (${mod}) — change to permanent path in MCP config`;
363
363
  }
@@ -387,7 +387,7 @@ function runDiagnostics() {
387
387
  } else {
388
388
  totalIssues++;
389
389
  console.log(` ❌ Server file not found: ${selfPath}`);
390
- console.log(` fix: npx @dmsdc-ai/aigentry-deliberation install`);
390
+ console.log(` fix: npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install`);
391
391
  }
392
392
 
393
393
  // Check node_modules
@@ -407,7 +407,7 @@ function runDiagnostics() {
407
407
  } catch {
408
408
  totalIssues++;
409
409
  console.log(` ❌ Syntax error detected`);
410
- console.log(` fix: npx @dmsdc-ai/aigentry-deliberation install`);
410
+ console.log(` fix: npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install`);
411
411
  }
412
412
 
413
413
  // ── Summary ──
package/index.js CHANGED
@@ -22,9 +22,10 @@ if (_cliArg === "--help" || _cliArg === "-h") {
22
22
  MCP Deliberation Server
23
23
 
24
24
  Usage:
25
- npx @dmsdc-ai/aigentry-deliberation install Install (register MCP server)
26
- npx @dmsdc-ai/aigentry-deliberation uninstall Uninstall
25
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install Install (preferred)
26
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install --uninstall
27
27
  npx @dmsdc-ai/aigentry-deliberation Run MCP server (stdio)
28
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-doctor Diagnose MCP wiring
28
29
 
29
30
  After installation, restart Claude Code to start using it.
30
31
  `);
@@ -143,10 +144,32 @@ const StructuredActionableTaskSchema = z.object({
143
144
  priority: z.enum(["high", "medium", "low"]).optional(),
144
145
  });
145
146
 
147
+ const StructuredExperimentOutcomeSchema = z.object({
148
+ verdict: z.enum(["keep", "discard", "modify"]),
149
+ confidence: z.number().min(0).max(1).optional(),
150
+ measurement_window_hours: z.number().nonnegative().optional(),
151
+ patches: z.array(z.unknown()).optional(),
152
+ suggested_action: z.enum(["advance", "revert", "iterate"]).optional(),
153
+ });
154
+
146
155
  const StructuredSynthesisSchema = z.object({
147
156
  summary: z.string(),
148
157
  decisions: z.array(z.string()),
149
158
  actionable_tasks: z.array(StructuredActionableTaskSchema),
159
+ experiment_outcome: StructuredExperimentOutcomeSchema.optional(),
160
+ });
161
+
162
+ const StructuredExecutionContractSchema = z.object({
163
+ version: z.literal("v1"),
164
+ source_session_id: z.string().min(1),
165
+ summary: z.string(),
166
+ tasks: z.array(StructuredActionableTaskSchema),
167
+ experiment_outcome: StructuredExperimentOutcomeSchema.nullable().optional(),
168
+ unresolved_questions: z.array(z.string()),
169
+ artifact_refs: z.array(z.string()),
170
+ generated_from: z.object({
171
+ structured_synthesis_hash: z.string().length(40),
172
+ }),
150
173
  });
151
174
 
152
175
  const TeleptyEnvelopeSchema = z.object({
@@ -179,6 +202,7 @@ const TeleptyDeliberationCompletedPayloadSchema = z.object({
179
202
  topic: z.string(),
180
203
  synthesis: z.string(),
181
204
  structured_synthesis: StructuredSynthesisSchema.nullable().optional(),
205
+ execution_contract: StructuredExecutionContractSchema.nullable().optional(),
182
206
  });
183
207
 
184
208
  const TELEPTY_ENVELOPE_PAYLOAD_SCHEMAS = {
@@ -500,6 +524,41 @@ function hashPromptText(value) {
500
524
  return createHash("sha1").update(String(value || "")).digest("hex");
501
525
  }
502
526
 
527
+ function sortJsonValue(value) {
528
+ if (Array.isArray(value)) {
529
+ return value.map(sortJsonValue);
530
+ }
531
+ if (value && typeof value === "object") {
532
+ return Object.keys(value)
533
+ .sort()
534
+ .reduce((acc, key) => {
535
+ acc[key] = sortJsonValue(value[key]);
536
+ return acc;
537
+ }, {});
538
+ }
539
+ return value;
540
+ }
541
+
542
+ function hashStructuredSynthesis(structured) {
543
+ return hashPromptText(JSON.stringify(sortJsonValue(structured || null)));
544
+ }
545
+
546
+ function buildExecutionContract({ state, structured }) {
547
+ if (!structured) return null;
548
+ return {
549
+ version: "v1",
550
+ source_session_id: state.id,
551
+ summary: structured.summary || "",
552
+ tasks: structured.actionable_tasks || [],
553
+ experiment_outcome: structured.experiment_outcome || null,
554
+ unresolved_questions: [],
555
+ artifact_refs: [],
556
+ generated_from: {
557
+ structured_synthesis_hash: hashStructuredSynthesis(structured),
558
+ },
559
+ };
560
+ }
561
+
503
562
  function createEnvelopeId(prefix = "env") {
504
563
  return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
505
564
  }
@@ -560,7 +619,11 @@ function buildTeleptyTurnRequestEnvelope({ state, speaker, turnId, turnPrompt, i
560
619
  });
561
620
  }
562
621
 
563
- function buildTeleptySynthesisEnvelope({ state, synthesis, structured }) {
622
+ function buildTeleptySynthesisEnvelope({ state, synthesis, structured, executionContract }) {
623
+ const derivedExecutionContract =
624
+ executionContract !== undefined
625
+ ? executionContract
626
+ : (structured ? buildExecutionContract({ state, structured }) : (state.execution_contract || null));
564
627
  return buildTeleptyEnvelope({
565
628
  session_id: state.id,
566
629
  project: state.project || getProjectSlug(),
@@ -576,6 +639,7 @@ function buildTeleptySynthesisEnvelope({ state, synthesis, structured }) {
576
639
  topic: state.topic,
577
640
  synthesis,
578
641
  structured_synthesis: structured || null,
642
+ execution_contract: derivedExecutionContract || null,
579
643
  },
580
644
  });
581
645
  }
@@ -2547,6 +2611,14 @@ tags: [deliberation]
2547
2611
  md += `## Synthesis\n\n${s.synthesis}\n\n---\n\n`;
2548
2612
  }
2549
2613
 
2614
+ if (s.structured_synthesis) {
2615
+ md += `## Structured Synthesis\n\n\`\`\`json\n${JSON.stringify(s.structured_synthesis, null, 2)}\n\`\`\`\n\n---\n\n`;
2616
+ }
2617
+
2618
+ if (s.execution_contract) {
2619
+ md += `## Execution Contract\n\n\`\`\`json\n${JSON.stringify(s.execution_contract, null, 2)}\n\`\`\`\n\n---\n\n`;
2620
+ }
2621
+
2550
2622
  md += `## Debate Log\n\n`;
2551
2623
  for (const entry of s.log) {
2552
2624
  md += `### ${entry.speaker} — Round ${entry.round}\n\n`;
@@ -4470,6 +4542,7 @@ async function runAutoHandoff(sessionId) {
4470
4542
  if (!loaded) return;
4471
4543
  loaded.synthesis = markdownSynthesis;
4472
4544
  loaded.structured_synthesis = structured;
4545
+ loaded.execution_contract = buildExecutionContract({ state: loaded, structured });
4473
4546
  loaded.status = "completed";
4474
4547
  loaded.current_speaker = "none";
4475
4548
  saveSession(loaded);
@@ -5012,6 +5085,7 @@ server.tool(
5012
5085
 
5013
5086
  loaded.synthesis = synthesis;
5014
5087
  loaded.structured_synthesis = structured || null;
5088
+ loaded.execution_contract = buildExecutionContract({ state: loaded, structured: structured || null });
5015
5089
  loaded.status = "completed";
5016
5090
  loaded.current_speaker = "none";
5017
5091
  saveSession(loaded);
@@ -5033,6 +5107,7 @@ server.tool(
5033
5107
  state,
5034
5108
  synthesis,
5035
5109
  structured,
5110
+ executionContract: state.execution_contract || null,
5036
5111
  });
5037
5112
 
5038
5113
  // Immediately force-close monitor terminal (including physical Terminal) on deliberation end
package/install.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Deliberation MCP Server — One-click installer
5
5
  *
6
6
  * Usage:
7
- * npx @dmsdc-ai/aigentry-deliberation install
7
+ * npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install
8
8
  * node install.js
9
9
  *
10
10
  * What it does:
@@ -261,7 +261,7 @@ if (args.includes("--help") || args.includes("-h")) {
261
261
  Deliberation MCP Server Installer
262
262
 
263
263
  Usage:
264
- npx @dmsdc-ai/aigentry-deliberation install
264
+ npx --yes --package @dmsdc-ai/aigentry-deliberation deliberation-install
265
265
  node install.js
266
266
 
267
267
  Options:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-deliberation",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "MCP Deliberation Server — Multi-session AI deliberation with smart speaker ordering and persona roles",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,6 +27,7 @@ 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)를 자동 라우팅 | 선택적* |
@@ -106,7 +107,57 @@ Claude/Codex를 포함해 MCP를 지원하는 임의 CLI들이 구조화된 토
106
107
  4. 각 세션을 `session_id`로 명시해 독립 진행
107
108
  5. 각각 `deliberation_synthesize`로 개별 종료
108
109
 
109
- ### C. 자동 진행 (스크립트)
110
+ ### C. 실험 회고 / keep-discard review
111
+ autoresearch 스타일 실험 루프를 검토할 때는 긴 컨텍스트를 `topic`에 섞지 말고, 시작 후 `deliberation_inject_context`로 compact bundle을 넣습니다.
112
+
113
+ 권장 규칙:
114
+ - inject payload는 `1.5KB ~ 2KB` 목표
115
+ - 최근 `3~5`개 실험만 포함
116
+ - `key_changes`는 최대 `3`개 scalar before/after만 유지
117
+ - 전체 `results.tsv` / 전체 `program.md`는 넣지 말고 artifact path만 남김
118
+
119
+ 예:
120
+ ```text
121
+ 1. deliberation_start(topic: "experiment retrospective / keep-discard review", ...)
122
+ 2. deliberation_inject_context(
123
+ session_id: "<session_id>",
124
+ speaker: "dustcraw",
125
+ context: JSON.stringify({
126
+ past_experiments: [{
127
+ experiment_id: "dg-20260310-001",
128
+ signal_kind: "INTEREST_DRIFT",
129
+ patch_summary: "Raised relevanceThreshold from 0.30 to 0.35",
130
+ patch_kind: "config",
131
+ key_changes: {
132
+ relevanceThreshold: { before: 0.30, after: 0.35 }
133
+ },
134
+ score: 0.08,
135
+ score_label: "promotion_rate_delta",
136
+ metric_name: "promotion_rate_delta",
137
+ metric_delta: 0.08,
138
+ verdict: "positive",
139
+ followup_action: "kept",
140
+ reasoning: "Threshold raise reduced noise; promotion quality improved 8%"
141
+ }],
142
+ experiment_count: 1,
143
+ success_rate: 1.0
144
+ })
145
+ )
146
+ 3. deliberation_route_turn(...) 반복
147
+ 4. deliberation_synthesize(..., structured: {
148
+ summary: "...",
149
+ decisions: ["..."],
150
+ actionable_tasks: [...],
151
+ experiment_outcome: {
152
+ verdict: "modify",
153
+ suggested_action: "iterate",
154
+ confidence: 0.78,
155
+ measurement_window_hours: 24
156
+ }
157
+ })
158
+ ```
159
+
160
+ ### D. 자동 진행 (스크립트)
110
161
  ```bash
111
162
  # 새 토론
112
163
  bash auto-deliberate.sh "저장소 전략"
@@ -118,7 +169,7 @@ bash auto-deliberate.sh "API 설계" 5
118
169
  bash auto-deliberate.sh --resume <session_id>
119
170
  ```
120
171
 
121
- ### D. 모니터링
172
+ ### E. 모니터링
122
173
  ```bash
123
174
  # 모든 활성 세션 모니터링
124
175
  bash deliberation-monitor.sh
@@ -130,14 +181,14 @@ bash deliberation-monitor.sh <session_id>
130
181
  bash deliberation-monitor.sh --tmux
131
182
  ```
132
183
 
133
- ### E. 브라우저 LLM 자동 연결 (CDP Auto-Activation)
184
+ ### F. 브라우저 LLM 자동 연결 (CDP Auto-Activation)
134
185
  - 브라우저 LLM speaker가 선택되면 CDP(Chrome DevTools Protocol)가 자동으로 활성화됩니다.
135
186
  - macOS에서는 Chrome이 실행되지 않은 경우 `--remote-debugging-port=9222`로 자동 실행을 시도합니다.
136
187
  - **Chrome이 이미 CDP 없이 실행 중인 경우**: Chrome을 완전히 종료한 후 다시 시도해야 합니다. (최초 1회만 필요)
137
188
  - CDP 연결 성공 시 모든 브라우저 speaker는 ⚡자동 모드로 동작합니다.
138
189
  - Windows/Linux에서는 사용자가 직접 Chrome을 `--remote-debugging-port=9222`로 실행해야 합니다.
139
190
 
140
- ### F. Chrome 확장 프로그램 사이드패널 지원
191
+ ### G. Chrome 확장 프로그램 사이드패널 지원
141
192
  - **Chrome 확장 프로그램 사이드패널 (chrome-extension:// URL)은 지원됩니다.**
142
193
  - Claude, ChatGPT, Gemini 등의 Chrome 확장 사이드패널도 CDP를 통해 deliberation 참가자로 사용 가능합니다.
143
194
  - 사이드패널은 title 기반 매칭으로 감지됩니다 (extension ID가 아닌 탭 제목으로 식별).