@unson/brainbase-mcp 0.1.0 → 0.2.2

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.
@@ -154,10 +154,16 @@ export interface ValueDemo {
154
154
  };
155
155
  answer: string;
156
156
  sampleResult: string;
157
+ resultKind: 'local_context_sample';
158
+ agentConnection: 'not_verified';
159
+ realVerification: string;
157
160
  valueExplanation: string;
158
161
  operationalization: OperationalizationPlan;
159
162
  nextStep: string;
160
- completionSignal: 'needs_seed' | 'first_value_demo_ready';
163
+ completionSignal: 'needs_seed' | 'cli_sample_ready';
164
+ onboardingComplete: false;
165
+ humanValueStatus: 'not_observed';
166
+ actualAgentPrompt: string;
161
167
  }
162
168
  export declare function buildAgentOnboardingProtocol(): AgentOnboardingProtocol;
163
169
  export declare function buildValueDemo(input: ValueDemoInput): ValueDemo;
@@ -168,7 +174,7 @@ export declare function buildConnectorRecommendations(input: RecommendationInput
168
174
  export declare function renderAgentProtocol(format: OnboardingFormat): string;
169
175
  export declare function renderConnectorRecommendations(input: RecommendationInput, format: OnboardingFormat): string;
170
176
  export declare function renderSourceDiagnosis(input: SourceDiagnosisInput, format: OnboardingFormat): string;
171
- export declare function renderValueDemo(input: ValueDemoInput, format: OnboardingFormat): string;
177
+ export declare function renderValueDemo(input: ValueDemoInput, format: OnboardingFormat, details?: boolean): string;
172
178
  export declare function renderCandidateDrafts(input: CandidateInput, format: OnboardingFormat): string;
173
179
  export declare function renderLocalOnboardingPlan(input: LocalOnboardingPlanInput, format: OnboardingFormat): string;
174
180
  export declare function parseOnboardingFormat(value: string | undefined): OnboardingFormat;
@@ -41,12 +41,12 @@ export function buildAgentOnboardingProtocol() {
41
41
  },
42
42
  {
43
43
  id: 'first_value_demo',
44
- title: 'First value demo',
44
+ title: 'CLI preview and actual agent value check',
45
45
  questions: [
46
- 'Run brainbase onboard:demo with the real request the user chose.',
47
- 'Show the try-this prompt, sample result, and what the user did not have to explain again.',
48
- 'Treat the useful output, not ready=true or connector readiness, as the onboarding completion signal.',
49
- 'After showing the useful output, report the remaining operationalization actions instead of calling onboarding done.'
46
+ 'Optionally run brainbase onboard:demo to preview which saved context should be used.',
47
+ 'Install the MCP config after user approval and restart the selected agent.',
48
+ 'Send the real request through that agent and require get_context/search evidence.',
49
+ 'Ask the user whether the actual answer was useful. A CLI sample or synthetic evaluator is not onboarding completion.'
50
50
  ]
51
51
  },
52
52
  {
@@ -72,7 +72,10 @@ export function buildAgentOnboardingProtocol() {
72
72
  'brainbase onboard:init',
73
73
  'brainbase onboard:seed --name "<name>" --value "<what should not be re-explained>" --project "<current project>" --relationship "<person>|<role>|<context>"',
74
74
  'brainbase onboard:projects --name "<project>" --goal "<goal>" --status "<status>" --role "<your role>"',
75
- 'brainbase onboard:demo --scenario "<real request that should now work>"',
75
+ 'brainbase onboard:install --target codex --dry-run',
76
+ 'Restart the selected agent, then send the real request and require Brainbase get_context/search.',
77
+ 'Ask the user whether the actual answer was useful.',
78
+ 'brainbase onboard:demo --scenario "<optional local preview>"',
76
79
  'brainbase onboard:skills --target codex',
77
80
  'brainbase onboard:routines --target codex --cwd <brainbase-checkout>',
78
81
  'brainbase onboard:install --target codex --dry-run',
@@ -82,16 +85,17 @@ export function buildAgentOnboardingProtocol() {
82
85
  completionCheck: [
83
86
  'Personal OS directory exists.',
84
87
  'The approved self, work, and person context are saved locally.',
85
- 'brainbase onboard:demo returns a try-this prompt, sample result, and useful answer for the selected real request.',
86
- 'The user can see what they did not have to explain again.',
88
+ 'The CLI sample, if used, is labeled as a preview rather than an onboarding completion signal.',
87
89
  'The completion report lists public skills, ohayo/oyasumi/retro routines, real MCP config merge, source allowlists, and MCP get_context/search verification as unfinished operationalization work.',
88
90
  'The selected MCP client has a Brainbase config snippet merged into its real config after user approval.',
91
+ 'A fresh agent session used Brainbase get_context/search for the real request.',
92
+ 'The user personally confirmed that the actual agent answer was useful.',
89
93
  'Source diagnosis is optional follow-up work, but source allowlist/import/candidate review must be explicitly completed or deferred.'
90
94
  ]
91
95
  };
92
96
  }
93
97
  export function buildValueDemo(input) {
94
- const scenario = input.scenario?.trim() || 'Draft the first message or working note that should use my saved Brainbase context.';
98
+ const scenario = input.scenario?.trim() || '保存した文脈を使って、次に進めるメモを作って';
95
99
  const seeded = seededAreas(input.os);
96
100
  const missing = Object.entries(seeded)
97
101
  .filter(([, value]) => !value)
@@ -119,8 +123,9 @@ export function buildValueDemo(input) {
119
123
  dataDir: input.os.dataDir,
120
124
  firstValueReady: ready
121
125
  });
126
+ const actualAgentPrompt = `Brainbaseのget_contextとsearchを使い、保存済み文脈を根拠に「${scenario}」へ回答してください。使った前提と未確認事項を分けてください。`;
122
127
  return {
123
- goal: 'Show one useful answer from the context the user just saved before any setup follow-up.',
128
+ goal: '実エージェント接続前に、保存した文脈から作れる出力をプレビューする。',
124
129
  ready,
125
130
  missing,
126
131
  scenario,
@@ -139,12 +144,18 @@ export function buildValueDemo(input) {
139
144
  },
140
145
  answer: sampleResult,
141
146
  sampleResult,
147
+ resultKind: 'local_context_sample',
148
+ agentConnection: 'not_verified',
149
+ realVerification: 'MCP設定を実際のエージェントへ反映した後、同じ依頼をCodex / Claude Codeへ送って実際の応答を確認します。',
142
150
  valueExplanation,
143
151
  operationalization,
144
152
  nextStep: ready
145
- ? 'Do not stop here. Use the operationalization checklist below to install skills, register routines with confirmation, merge MCP config, decide source allowlists, and verify MCP get_context/search.'
146
- : `First save the minimum missing memo: ${missing.map(missingLabel).join(', ')}.`,
147
- completionSignal: ready ? 'first_value_demo_ready' : 'needs_seed'
153
+ ? 'MCP設定を反映して新しいエージェントを開き、実際の回答を確認した後、本人が役立ったかを判断します。'
154
+ : `まず最小文脈を保存します: ${missing.map(missingLabel).join(', ')}。`,
155
+ completionSignal: ready ? 'cli_sample_ready' : 'needs_seed',
156
+ onboardingComplete: false,
157
+ humanValueStatus: 'not_observed',
158
+ actualAgentPrompt
148
159
  };
149
160
  }
150
161
  export function buildSourceDiagnosis(input) {
@@ -495,45 +506,46 @@ export function renderSourceDiagnosis(input, format) {
495
506
  ''
496
507
  ].join('\n');
497
508
  }
498
- export function renderValueDemo(input, format) {
509
+ export function renderValueDemo(input, format, details = false) {
499
510
  const demo = buildValueDemo(input);
500
511
  if (format === 'json') {
501
512
  return `${JSON.stringify(demo, null, 2)}\n`;
502
513
  }
503
- return [
504
- '# Brainbase First Value Demo',
514
+ const lines = [
515
+ '# Brainbase 文脈プレビュー',
505
516
  '',
506
517
  demo.goal,
507
518
  '',
508
- `- Ready: ${String(demo.ready)}`,
509
- `- Completion signal: ${demo.completionSignal}`,
510
- `- Missing: ${demo.missing.length === 0 ? 'none' : demo.missing.map(missingLabel).join(', ')}`,
519
+ `- 状態: ${demo.ready ? '準備済み' : '要設定'}`,
520
+ `- プレビュー状態: ${demo.completionSignal}`,
521
+ `- 不足: ${demo.missing.length === 0 ? 'なし' : demo.missing.map(missingLabel).join(', ')}`,
511
522
  '',
512
- '## Try This Now',
523
+ '## 今すぐ試す',
513
524
  demo.tryPrompt,
514
525
  '',
515
- '## Sample Result',
526
+ '## サンプル結果',
527
+ 'これはCLIが保存済み文脈から組み立てたサンプルです。実際のエージェント応答ではありません。',
528
+ 'このサンプルだけでは初回価値の達成になりません。',
529
+ '- 実エージェント接続: 未確認',
530
+ `- 実応答の確認方法: ${demo.realVerification}`,
531
+ '',
516
532
  demo.sampleResult,
517
533
  '',
518
- '## What Changed',
534
+ '## 反映された文脈',
519
535
  demo.valueExplanation,
520
536
  '',
521
- '## Operationalization Still Pending',
522
- demo.operationalization.goal,
523
- '',
524
- '### Completed',
525
- ...demo.operationalization.completed.map((item) => `- ${item}`),
526
- '',
527
- '### Next Actions',
528
- ...demo.operationalization.pending.map((item) => `- ${item.title}: \`${item.command}\` (${item.safety})`),
529
- '',
530
- '### Recommended Order',
531
- ...demo.operationalization.recommendedOrder.map((item, index) => `${index + 1}. ${item}`),
532
- '',
533
- '## Next Step',
537
+ '## 次に実行',
538
+ demo.ready
539
+ ? `\`brainbase onboard:install --target codex --dir ${shellArg(input.os.dataDir)} --dry-run\``
540
+ : `\`brainbase onboard:start --dir ${shellArg(input.os.dataDir)} --target codex\``,
534
541
  demo.nextStep,
542
+ ...(demo.ready ? ['', '## 実エージェントへ送る依頼', demo.actualAgentPrompt, '', '回答後、本人に役立ったかを確認してください。'] : []),
535
543
  ''
536
- ].join('\n');
544
+ ];
545
+ if (details) {
546
+ lines.push('## まだ残っている運用化', demo.operationalization.goal, '', '### 完了済み', ...demo.operationalization.completed.map((item) => `- ${item}`), '', '### 次の操作', ...demo.operationalization.pending.map((item) => `- ${item.title}: \`${item.command}\` (${item.safety})`), '', '### 推奨順序', ...demo.operationalization.recommendedOrder.map((item, index) => `${index + 1}. ${item}`), '');
547
+ }
548
+ return lines.join('\n');
537
549
  }
538
550
  export function renderCandidateDrafts(input, format) {
539
551
  const candidateSet = buildCandidateDrafts(input);
@@ -685,7 +697,7 @@ function seededAreas(os) {
685
697
  }
686
698
  function selfContext(os) {
687
699
  return [
688
- ...(os.graph.owner?.name ? [`Owner: ${os.graph.owner.name}`] : []),
700
+ ...(os.graph.owner?.name ? [`本人: ${os.graph.owner.name}`] : []),
689
701
  ...(os.graph.owner?.summary ? [os.graph.owner.summary] : []),
690
702
  ...os.personalKg
691
703
  .filter((entry) => entry.type === 'self' || entry.type === 'value' || entry.type === 'judgment')
@@ -696,7 +708,7 @@ function workContext(os) {
696
708
  return [
697
709
  ...os.graph.entities
698
710
  .filter((entity) => entity.type === 'project')
699
- .map((entity) => entity.summary ? `${entity.name}: ${entity.summary}` : entity.name),
711
+ .map((entity) => entity.name),
700
712
  ...os.personalKg
701
713
  .filter((entry) => entry.type === 'work' || entry.type === 'experience')
702
714
  .map((entry) => entry.text)
@@ -723,27 +735,43 @@ function relationshipTerms(name) {
723
735
  function normalizeForMatch(value) {
724
736
  return value.toLowerCase().replace(/\s+/g, '');
725
737
  }
738
+ function shellArg(value) {
739
+ return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : JSON.stringify(value);
740
+ }
726
741
  function buildReadySampleResult(input) {
727
742
  const projectLine = input.work[0] ?? '保存済みの仕事メモ';
728
743
  const ownerLine = input.self[0] ?? 'あなたの進め方';
729
744
  const relationshipLine = input.selectedRelationship
730
- ? `${input.selectedRelationship.person}${input.selectedRelationship.role ? `(${input.selectedRelationship.role})` : ''}には、${input.selectedRelationship.context}を前提に相談します。`
745
+ ? `${input.selectedRelationship.person}${input.selectedRelationship.role ? `(${input.selectedRelationship.role})` : ''}には、「${input.selectedRelationship.context}」という関係を前提に相談します。`
731
746
  : '特定の相談相手が未指定なので、まず保存済みの仕事メモから次の一手を整理します。';
732
747
  const decisionLine = input.decisions[0]
733
748
  ? `判断基準: ${input.decisions[0].decision}`
734
749
  : '追加の判断基準はまだないので、次に動ける形へ絞ります。';
750
+ const decisionCriterion = input.decisions[0]?.decision ?? '保存済みの前提を崩さず、次の一手を小さく決める';
751
+ const recipient = input.selectedRelationship
752
+ ? `${input.selectedRelationship.person}さん`
753
+ : '次の判断者';
735
754
  return [
736
755
  `「${input.scenario}」への回答例:`,
737
756
  '',
738
757
  `次に進める作業は、${projectLine}を前提に一つのメモへ整理することです。`,
739
- `進め方は、${ownerLine}を崩さず、説明を足しすぎない形にします。`,
758
+ `進め方は、${ownerLine.replace(/^本人: /u, '')}さんの前提を崩さず、説明を足しすぎない形にします。`,
740
759
  relationshipLine,
741
760
  decisionLine,
742
761
  '',
743
762
  'そのまま送れる最初のアウトプット:',
744
- input.selectedRelationship
745
- ? `${input.selectedRelationship.person}さんに確認したい論点を、背景説明ではなく「次に判断したいこと」と「相談したいこと」に分けて出します。`
746
- : '保存済みの仕事メモから、今日進める作業と追加で確認したい一点だけを出します。'
763
+ '',
764
+ '次に判断したいこと:',
765
+ `- ${projectLine}について、「${decisionCriterion}」を満たす進め方を一つ選ぶ。`,
766
+ '',
767
+ '相談したいこと:',
768
+ `- ${recipient}に、${projectLine}を進める条件、懸念、判断期限を確認する。`,
769
+ '',
770
+ '未確認事項:',
771
+ '- 期限、最終承認者、判断前に追加で必要な情報。',
772
+ '',
773
+ '次の行動:',
774
+ `- ${recipient}へこのメモを送り、回答後に実行案を一つへ絞る。`
747
775
  ].join('\n');
748
776
  }
749
777
  function buildValueExplanation(input) {
@@ -762,7 +790,7 @@ function buildValueExplanation(input) {
762
790
  }
763
791
  function buildMissingDemoAnswer(missing) {
764
792
  return [
765
- 'まだ最初の価値体験はできません。',
793
+ 'まだ接続前プレビューを作れません。',
766
794
  `足りない最小メモ: ${missing.map(missingLabel).join(', ')}。`,
767
795
  'まず、あなたが毎回説明したくないことを一つだけ保存してから、同じプロンプトをもう一度試します。'
768
796
  ].join('\n');
@@ -6,76 +6,79 @@ export function buildOperationalizationPlan(input = {}) {
6
6
  const skillsTarget = target === 'claude' ? 'claude' : target === 'codex' ? 'codex' : 'portable';
7
7
  const routinesTarget = target === 'claude' ? 'claude' : 'codex';
8
8
  return {
9
- goal: 'Keep onboarding open until the first value demo is followed by the operating setup the user still needs.',
9
+ goal: 'CLIプレビュー後、実エージェントで本人が初回価値を確認するまでを順に完了する。',
10
10
  completed: input.firstValueReady
11
11
  ? [
12
- 'Initial approved context is seeded locally.',
13
- 'doctor can report the first value demo as ready.',
14
- 'onboard:demo produced a prompt, sample result, and plain-language value explanation.'
12
+ '承認した最小文脈をローカルへ保存済み。',
13
+ 'doctorでCLI文脈プレビューの準備完了を確認可能。',
14
+ 'onboard:demoを実行した場合も、確認できるのはローカルCLIサンプルだけ。'
15
15
  ]
16
16
  : [
17
- 'Personal OS setup has started.'
17
+ 'Personal OSの準備を開始済み。'
18
18
  ],
19
19
  pending: [
20
20
  {
21
21
  id: 'public-skills',
22
- title: 'Place the public Brainbase onboarding skills',
22
+ title: '公開Brainbaseオンボーディングスキルを配置する',
23
23
  status: 'pending',
24
24
  command: `brainbase onboard:skills --target ${skillsTarget}`,
25
- why: 'Agents need the public onboarding, source import, candidate review, and daily routine instructions available where they run.',
26
- safety: 'Generation is dry-run by default; write files only with an explicit --out path and do not overwrite existing SKILL.md files.'
25
+ why: 'エージェントが実行環境で、オンボーディング、参照元取込、候補レビュー、日次ルーティンの手順を使えるようにします。',
26
+ safety: '標準はプレビューです。明示的な --out 指定時だけ書き込み、既存のSKILL.mdを上書きしません。'
27
27
  },
28
28
  {
29
29
  id: 'routines',
30
- title: 'Register ohayo / oyasumi / retro routines',
30
+ title: 'ohayo / oyasumi / retroルーティンを登録する',
31
31
  status: 'pending',
32
32
  command: `brainbase onboard:routines --target ${routinesTarget} --cwd ${commandArg(cwd)}`,
33
- why: 'The operating loop is not active until the morning, end-of-day, and weekly retrospective routines are scheduled.',
34
- safety: 'Register routines paused or confirmation-gated first; generated definitions alone do not create a live scheduler.'
33
+ why: '朝、終業時、週次振り返りの予定を登録して初めて運用ループが動きます。',
34
+ safety: '最初は一時停止または確認付きで登録します。定義生成だけではスケジュール済みになりません。'
35
35
  },
36
36
  {
37
37
  id: 'mcp-config',
38
- title: 'Merge the Brainbase MCP config into the real agent config',
38
+ title: 'Brainbase MCP設定を実際のエージェント設定へ反映する',
39
39
  status: 'pending',
40
40
  command: `brainbase onboard:install --target ${installTarget} --dir ${commandArg(dataDir)} --dry-run`,
41
- why: 'A dry-run snippet proves the config shape, but the agent cannot call Brainbase until the real Codex / Claude / CodeCode config is updated.',
42
- safety: 'Keep dry-run as preview only; merge into live config after user approval and restart the target agent.'
41
+ why: 'プレビューは設定形式の確認に留まり、実設定を更新するまでエージェントはBrainbaseを呼べません。',
42
+ safety: 'プレビュー確認後、利用者の承認を得て実設定へ反映し、対象エージェントを再起動します。'
43
43
  },
44
44
  {
45
45
  id: 'source-allowlist',
46
- title: 'Decide source allowlists, import, and candidate review',
46
+ title: '参照許可範囲、取込、候補レビューを決める',
47
47
  status: 'pending',
48
48
  command: 'brainbase onboard:diagnose-sources --email <provider> --calendar <provider> --drive <provider> --drive-folder <folder-id> --tasks <tool>',
49
- why: 'Mail, calendar, drive, files, and tasks are optional follow-up sources and need explicit allowlists before import.',
50
- safety: 'Keep imported material under sources/ and promote only reviewed candidates into approved local memory.'
49
+ why: 'メール、カレンダー、ドライブ、ファイル、タスクは任意の追加参照元であり、取込前に明示的な許可範囲が必要です。',
50
+ safety: '取込素材はsources/に置き、レビュー済み候補だけを承認済みローカル記憶へ昇格します。'
51
51
  },
52
52
  {
53
53
  id: 'verification',
54
- title: 'Verify doctor and MCP get_context / search',
54
+ title: 'doctorとMCP get_context / searchで確認する',
55
55
  status: 'pending',
56
56
  command: `brainbase doctor --dir ${commandArg(dataDir)}`,
57
- why: 'Onboarding is operational only when doctor and the MCP tools show the approved context from a fresh agent session.',
58
- safety: 'Check get_context/search after config merge instead of assuming command generation was enough.'
57
+ why: '新しいエージェントセッションでdoctorとMCPツールが承認済み文脈を示して初めて運用可能です。',
58
+ safety: 'コマンド生成だけで完了扱いせず、設定反映後にget_context/searchを確認します。'
59
59
  }
60
60
  ],
61
61
  recommendedOrder: [
62
- 'Install or write public skills for the target agent.',
63
- 'Generate ohayo / oyasumi / retro routines and register them paused or confirmation-gated.',
64
- 'Merge the Brainbase MCP snippet into the real Codex / Claude / CodeCode config and restart the agent.',
65
- 'Decide source allowlists and run import / candidate review only where more context is needed.',
66
- 'Run doctor, then verify MCP get_context and search from a fresh agent session.'
62
+ 'Brainbase MCP設定を実際のCodex / Claude / CodeCode設定へ反映し、エージェントを再起動する。',
63
+ '新しいエージェントで現実の依頼を送り、MCP get_contextとsearchを使った実回答を確認する。',
64
+ '利用者本人に役立ったかを確認する。役立たなければ不足文脈だけを追加して再試行する。',
65
+ '対象エージェントへ公開スキルを配置する。',
66
+ '必要になった時だけohayo / oyasumi / retroを確認付きで登録する。',
67
+ '追加文脈が必要な場合だけ参照許可範囲を決め、取込と候補レビューを行う。',
68
+ 'doctorを実行し、新しいエージェントセッションでMCP get_contextとsearchを確認する。'
67
69
  ],
68
70
  safetyRules: [
69
- 'Do not write live config, scheduler entries, or canonical facts without user approval.',
70
- 'Do not treat generated skills, generated routines, or MCP dry-run snippets as completed installation.',
71
- 'Do not ask users to paste OAuth tokens, passwords, API keys, or refresh tokens into chat.',
72
- 'Source imports stay local-first and reviewed before canonical promotion.'
71
+ '利用者の承認なしに実設定、スケジュール、正本ファクトを書き込みません。',
72
+ '生成したスキル、ルーティン、MCPプレビューをインストール完了扱いしません。',
73
+ 'OAuthトークン、パスワード、APIキー、更新トークンをチャットへ貼るよう求めません。',
74
+ '参照元の取込はローカル優先とし、正本化前にレビューします。'
73
75
  ],
74
76
  completionCheck: [
75
- 'The user has seen the first value output.',
76
- 'The completion report names all still-pending operationalization actions.',
77
- 'The target agent can call Brainbase MCP get_context/search after real config merge.',
78
- 'Source allowlists and candidate review are either completed or explicitly deferred.'
77
+ '実際のエージェントがBrainbase MCP get_context/searchを使って現実の依頼へ回答済み。',
78
+ '利用者本人がその回答を役立つと確認済み。',
79
+ '完了報告に残っている運用設定をすべて記載済み。',
80
+ '実設定反映後、対象エージェントからBrainbase MCP get_context/searchを呼び出せる。',
81
+ '参照許可範囲と候補レビューを完了、または明示的に延期済み。'
79
82
  ]
80
83
  };
81
84
  }