secondbrainos-mcp-server 1.5.2 → 1.5.3

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/bin/cli.js CHANGED
@@ -362,6 +362,42 @@ async function main() {
362
362
  const cliPath = path.join(packageRoot, 'bin', 'cli.js');
363
363
  const claudeCodeConfigured = await configureClaudeCode(cliPath, nodePath);
364
364
 
365
+ // Add SessionStart hook to global Claude Code settings
366
+ if (claudeCodeConfigured) {
367
+ try {
368
+ const claudeSettingsPath = path.join(homedir(), '.claude', 'settings.json');
369
+ let settings = {};
370
+ try {
371
+ settings = JSON.parse(await fs.readFile(claudeSettingsPath, 'utf8'));
372
+ } catch { /* file may not exist yet */ }
373
+
374
+ if (!settings.hooks) settings.hooks = {};
375
+ if (!settings.hooks.SessionStart) settings.hooks.SessionStart = [];
376
+
377
+ // Check if our hook already exists
378
+ const skillFilePath = path.join(homedir(), '.claude', 'skills', 'secondbrainos', 'server-use', 'SKILL.md');
379
+ const hookCommand = `cat "${skillFilePath}" 2>/dev/null || true`;
380
+ const hasHook = settings.hooks.SessionStart.some(
381
+ entry => entry.hooks && entry.hooks.some(h => h.command && h.command.includes('secondbrainos/server-use/SKILL.md'))
382
+ );
383
+
384
+ if (!hasHook) {
385
+ settings.hooks.SessionStart.push({
386
+ hooks: [
387
+ {
388
+ type: "command",
389
+ command: hookCommand
390
+ }
391
+ ]
392
+ });
393
+ await fs.writeFile(claudeSettingsPath, JSON.stringify(settings, null, 2));
394
+ console.log('SessionStart hook configured for SBOS context loading.');
395
+ }
396
+ } catch (error) {
397
+ console.log(`Note: Could not configure SessionStart hook: ${error.message}`);
398
+ }
399
+ }
400
+
365
401
  console.log('\nInstallation successful!');
366
402
  console.log('\nClaude Desktop:');
367
403
  console.log('1. Completely quit Claude Desktop if it is running');
package/build/index.js CHANGED
@@ -584,8 +584,62 @@ class SecondBrainOSServer {
584
584
  fs.mkdirSync(dir, { recursive: true });
585
585
  fs.writeFileSync(path.join(dir, 'SKILL.md'), content, 'utf-8');
586
586
  };
587
- // 1. server-use — placeholder
588
- writeSkill(path.join(skillsBase, 'server-use'), `---\nname: secondbrainos_server_use\ndescription: Second Brain OS server context\nuser-invocable: false\n---\n\nHello world.\n`);
587
+ // 1. server-use — context document for Claude Code sessions
588
+ // Gather agent and workflow names for the index
589
+ let agentIndex = '';
590
+ let skillIndex = '';
591
+ try {
592
+ const agents = await this.fetchAndEnrichAgents();
593
+ agentIndex = agents
594
+ .filter((a) => a.name && a.id)
595
+ .map((a) => `- ${a.name} → \`/secondbrainos:agent_${toSnakeCase(a.name)}\``)
596
+ .join('\n');
597
+ }
598
+ catch { /* skip if unavailable */ }
599
+ try {
600
+ const workflows = await this.fetchAndEnrichWorkflows();
601
+ skillIndex = workflows
602
+ .filter((wf) => wf.name)
603
+ .map((wf) => `- ${wf.name} → \`/secondbrainos:skill_${toSnakeCase(wf.name)}\``)
604
+ .join('\n');
605
+ }
606
+ catch { /* skip if unavailable */ }
607
+ const serverUseContent = `---
608
+ name: secondbrainos_server_use
609
+ description: Second Brain OS server context — terminology, architecture, and available agents/skills index
610
+ user-invocable: false
611
+ ---
612
+
613
+ # Second Brain OS — Server Context
614
+
615
+ ## Terminology
616
+ These terms are synonyms and used interchangeably in SBOS:
617
+ - **Tabs / Agents** — AI agents with behaviour, knowledge, tools, and skills
618
+ - **Services / Tools** — always MCP tools
619
+ - **Workflows / Skills** — a skill is a structured set of prompts, enabling optimised context per step so the agent can progress through a skill without overload
620
+
621
+ ## Agent Architecture
622
+ An agent definition combines:
623
+ 1. **Knowledge** — an obfuscated vector store collection ID for \`searchMyKnowledge\`
624
+ 2. **Services (Tools)** — the MCP tools the agent can use
625
+ 3. **Workflows (Skills)** — the prompt chains the agent follows
626
+
627
+ This means you can spin up sub-agents from an agent's skill definitions (see \`~/.claude/skills/secondbrainos/tabs/\`).
628
+
629
+ ## Accessing Agents & Skills
630
+ - Skill files live at \`~/.claude/skills/secondbrainos/\` (tabs/, workflows/, knowledgebases/)
631
+ - All skill files are set to \`user-invocable: false\` to avoid duplicating slash commands already available via MCP prompts
632
+ - **Users** invoke agents or skills via slash commands (e.g. \`/secondbrainos:agent_...\` or \`/secondbrainos:skill_...\`)
633
+ - **Users** cannot invoke MCP tools directly via slash commands — they must ask you to load and call the relevant tool
634
+ - When using an agent with sub-agents, load the necessary skills at the start of the conversation by reading the agent's skill files
635
+
636
+ ## Available Agents
637
+ ${agentIndex || '_None configured_'}
638
+
639
+ ## Available Skills
640
+ ${skillIndex || '_None configured_'}
641
+ `;
642
+ writeSkill(path.join(skillsBase, 'server-use'), serverUseContent);
589
643
  // 2. tabs (agents)
590
644
  if (this.getAIAgentsSchemaPath) {
591
645
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secondbrainos-mcp-server",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Second Brain OS MCP Server for Claude Desktop",
5
5
  "type": "module",
6
6
  "main": "build/index.js",