@magic-ingredients/tiny-brain-local 0.15.0 → 0.15.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.
@@ -81,6 +81,14 @@ export declare class MCPServer {
81
81
  * Initialize remote authentication
82
82
  */
83
83
  private initializeRemoteAuth;
84
+ /**
85
+ * Initialize bundled personas by copying to user directory if not present
86
+ *
87
+ * Bundled personas are included with the plugin at ${CLAUDE_PLUGIN_ROOT}/personas/
88
+ * and are copied to ~/.tiny-brain/personas/ on first init if they don't exist locally.
89
+ * Local personas take precedence (user can override bundled by creating their own).
90
+ */
91
+ private initializeBundledPersonas;
84
92
  /**
85
93
  * Initialize local personas
86
94
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/core/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,OAAO,KAAK,EAA4B,QAAQ,EAAkC,MAAM,oCAAoC,CAAC;AAE7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAQ5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IAEF,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OA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O,CAAC,IAAI,CAAC;IAsBjC;;;;;;;OAOG;YACW,sBAAsB;IA+DpC;;OAEG;YACW,iBAAiB;IAW/B;;;OAGG;YACW,oBAAoB;IA6BlC;;OAEG;YACW,oBAAoB;IAgFlC;;;;;;OAMG;YACW,yBAAyB;IA+CvC;;OAEG;YACW,kBAAkB;IAsBhC;;OAEG;YACW,wBAAwB;IA8BtC;;OAEG;YACW,mBAAmB;IA8BjC;;OAEG;IACG,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAiBjB,eAAe;YAMf,cAAc;YA6Fd,iBAAiB;YAMjB,eAAe;YAmEf,iBAAiB;CAQhC"}
@@ -4,6 +4,7 @@
4
4
  * Simplified MCP server for local execution without deployment complexity
5
5
  */
6
6
  import * as path from 'path';
7
+ import { existsSync, cpSync, readdirSync } from 'fs';
7
8
  import { Server as McpServer } from '@modelcontextprotocol/sdk/server/index.js';
8
9
  import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
9
10
  import { isDevelopment as checkIsDevelopment } from '@magic-ingredients/tiny-brain-core';
@@ -149,6 +150,7 @@ export class MCPServer {
149
150
  await this.initializeStorage();
150
151
  await this.initializeRepository();
151
152
  await this.initializeRemoteAuth();
153
+ await this.initializeBundledPersonas();
152
154
  await this.initializePersonas();
153
155
  await this.initializeRemotePersonas();
154
156
  await this.initializeDashboard();
@@ -341,6 +343,55 @@ export class MCPServer {
341
343
  // Continue in local mode - don't fail the entire initialization
342
344
  }
343
345
  }
346
+ /**
347
+ * Initialize bundled personas by copying to user directory if not present
348
+ *
349
+ * Bundled personas are included with the plugin at ${CLAUDE_PLUGIN_ROOT}/personas/
350
+ * and are copied to ~/.tiny-brain/personas/ on first init if they don't exist locally.
351
+ * Local personas take precedence (user can override bundled by creating their own).
352
+ */
353
+ async initializeBundledPersonas() {
354
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
355
+ if (!pluginRoot) {
356
+ this.logger.debug('CLAUDE_PLUGIN_ROOT not set, skipping bundled personas');
357
+ return;
358
+ }
359
+ const bundledPersonasDir = path.join(pluginRoot, 'personas');
360
+ if (!existsSync(bundledPersonasDir)) {
361
+ this.logger.debug('No bundled personas directory found');
362
+ return;
363
+ }
364
+ this.logger.info('Checking bundled personas...');
365
+ try {
366
+ const bundledPersonas = readdirSync(bundledPersonasDir);
367
+ for (const personaName of bundledPersonas) {
368
+ // Skip hidden files and non-directories
369
+ if (personaName.startsWith('.'))
370
+ continue;
371
+ const bundledPath = path.join(bundledPersonasDir, personaName);
372
+ const localStorage = this.storage;
373
+ const localPath = path.join(localStorage.personasDir, personaName);
374
+ // Only copy if bundled persona exists and local doesn't
375
+ if (existsSync(bundledPath) && !existsSync(localPath)) {
376
+ this.logger.info(`Copying bundled persona '${personaName}' to local storage`);
377
+ try {
378
+ cpSync(bundledPath, localPath, { recursive: true });
379
+ this.logger.info(`✓ Installed bundled persona: ${personaName}`);
380
+ }
381
+ catch (copyError) {
382
+ this.logger.warn(`Failed to copy bundled persona '${personaName}'`, copyError);
383
+ }
384
+ }
385
+ else if (existsSync(localPath)) {
386
+ this.logger.debug(`Bundled persona '${personaName}' already exists locally, skipping`);
387
+ }
388
+ }
389
+ }
390
+ catch (error) {
391
+ this.logger.warn('Failed to initialize bundled personas', error);
392
+ // Continue without bundled personas - this is optional
393
+ }
394
+ }
344
395
  /**
345
396
  * Initialize local personas
346
397
  */
@@ -11,6 +11,7 @@ export interface AgentInfo {
11
11
  name: string;
12
12
  description: string;
13
13
  version?: string;
14
+ usage?: string;
14
15
  }
15
16
  export interface RepoBlock {
16
17
  rawAnalysis: RepoAnalysis;
@@ -81,7 +82,7 @@ export declare class RepoService {
81
82
  */
82
83
  private formatRepoBlockWithPhases;
83
84
  /**
84
- * Format the complete repository block with subagent context protocol (legacy compact format)
85
+ * Format the complete repository block with simplified structure
85
86
  */
86
87
  private formatRepoBlock;
87
88
  /**
@@ -93,13 +94,14 @@ export declare class RepoService {
93
94
  */
94
95
  formatAgentsWithPhases(agentResponse: any): string;
95
96
  /**
96
- * Format agents in compact style with categories
97
+ * Format agents as a simple table with tech-stack specific "Use for" descriptions
97
98
  */
98
- private formatAgentsCompact;
99
+ private formatAgentTable;
99
100
  /**
100
- * Get compact description by removing common phrases and truncating if needed
101
+ * Generate generic "Use for" description based on agent name
102
+ * This is a fallback when TBR doesn't provide contextual usage
101
103
  */
102
- private getCompactDescription;
104
+ private generateAgentUseCase;
103
105
  /**
104
106
  * Format repository context as clean YAML
105
107
  */
@@ -114,11 +116,6 @@ export declare class RepoService {
114
116
  * @returns Version string or null if not found/invalid
115
117
  */
116
118
  extractTinyBrainVersion(content: string): string | null;
117
- /**
118
- * Format Developer Workflow section with PRD and ADR information
119
- * This section appears before the Subagent Context Protocol
120
- */
121
- private formatDeveloperWorkflowSection;
122
119
  /**
123
120
  * Format documentation templates section for PRDs and ADRs
124
121
  * Only includes sections for directories that exist
@@ -213,17 +210,13 @@ export declare class RepoService {
213
210
  */
214
211
  private getAgentDescription;
215
212
  /**
216
- * Format PRD Workflow section (appears FIRST in tiny-brain block)
217
- * Combines PRD locations, ADR locations, workflow instructions, and commit headers
213
+ * Format workflow sections for CLAUDE.md
214
+ * Each section is independent - enabled features appear regardless of other settings
218
215
  */
219
216
  private formatPRDWorkflowSection;
220
217
  /**
221
218
  * Format ADR section (currently empty as ADR info is part of PRD workflow)
222
219
  */
223
220
  private formatADRSection;
224
- /**
225
- * Format the PRD Commit Headers section
226
- */
227
- private formatPRDCommitHeadersSection;
228
221
  }
229
222
  //# sourceMappingURL=repo-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-service.d.ts","sourceRoot":"","sources":["../../src/services/repo-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,YAA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,GAAG,cAAc;IAsEzE;;OAEG;IACG,sBAAsB,CAC1B,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,cAAc,EAAE,EACjC,eAAe,GAAE,MAAoB,GACpC,OAAO,CAAC,IAAI,CAAC;IAuDhB;;OAEG;IACG,2BAA2B,CAC/B,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,cAAc,EAAE,EACjC,eAAe,GAAE,MAAoB,GACpC,OAAO,CAAC,IAAI,CAAC;IAwChB;;OAEG;IACG,WAAW,CAAC,eAAe,GAAE,MAAoB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IA0BlF;;OAEG;IACG,uBAAuB,CAC3B,QAAQ,EAAE,YAAY,EACtB,eAAe,GAAE,MAAoB,GACpC,OAAO,CAAC,IAAI,CAAC;IAgChB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAgElC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsB9B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA4BlC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAwB7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;;OAGG;YACW,wBAAwB;IAuFtC;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAIzB"}
@@ -107,7 +107,7 @@ export class RepoService {
107
107
  fullPath
108
108
  });
109
109
  // Build the complete repo block
110
- const repoBlock = this.formatRepoBlock(analysis, agents, version);
110
+ const repoBlock = await this.formatRepoBlock(analysis, agents, version);
111
111
  // Read existing content
112
112
  let existingContent = '';
113
113
  try {
@@ -246,9 +246,9 @@ export class RepoService {
246
246
  return block;
247
247
  }
248
248
  /**
249
- * Format the complete repository block with subagent context protocol (legacy compact format)
249
+ * Format the complete repository block with simplified structure
250
250
  */
251
- formatRepoBlock(analysis, agents, version) {
251
+ async formatRepoBlock(analysis, agents, version) {
252
252
  let block = `${RepoService.REPO_BLOCK_START}\n`;
253
253
  // Add YAML frontmatter with version if provided
254
254
  if (version) {
@@ -257,43 +257,22 @@ export class RepoService {
257
257
  block += `updated: ${new Date().toISOString()}\n`;
258
258
  block += '---\n\n';
259
259
  }
260
- // Developer Workflow section (appears before Subagent Context Protocol)
261
- const developerWorkflow = this.formatDeveloperWorkflowSection();
262
- if (developerWorkflow) {
263
- block += developerWorkflow;
260
+ // PRD Workflow section (includes commit format, TDD workflow if enabled)
261
+ const prdWorkflow = await this.formatPRDWorkflowSection();
262
+ if (prdWorkflow) {
263
+ block += prdWorkflow;
264
264
  }
265
- block += `${RepoService.SUBAGENT_PROTOCOL_HEADER}\n\n`;
266
- // When to use agents - compact format
267
- block += `${RepoService.AGENT_USAGE_HEADER}\n\n`;
268
- block += this.formatAgentsCompact(agents);
265
+ // Tech Stack & Agents section (simplified table format)
266
+ block += '## Tech Stack & Agents\n\n';
267
+ block += this.formatAgentTable(agents, analysis);
269
268
  // Repository context - YAML format
270
- block += `${RepoService.REPO_CONTEXT_HEADER}\n`;
269
+ block += '\n## Repository Context\n';
271
270
  block += this.formatRepositoryContextYaml(analysis);
272
271
  // Documentation templates section (conditional)
273
272
  const docTemplatesSection = this.formatDocumentationTemplatesSection();
274
273
  if (docTemplatesSection) {
275
274
  block += docTemplatesSection;
276
275
  }
277
- // Usage template
278
- block += `\n${RepoService.USAGE_TEMPLATE_HEADER}\n\n`;
279
- block += '```\n';
280
- block += 'Repository Context: [paste the yaml above]\n\n';
281
- block += 'AGENT: [choose from list above]\n';
282
- block += 'TASK: [specific task description]\n';
283
- block += 'CONSTRAINTS: [requirements/limitations]\n';
284
- block += 'EXPECTED OUTPUT: [what you need back]\n';
285
- block += '```\n';
286
- // Example
287
- block += `\n${RepoService.EXAMPLE_HEADER}\n`;
288
- block += '```\n';
289
- block += 'Repository Context: [repo context yaml]\n\n';
290
- block += 'AGENT: component-developer\n';
291
- block += 'TASK: Create a UserProfile component with avatar, name, and email\n';
292
- block += 'CONSTRAINTS: Must be accessible, use TypeScript, follow TDD\n';
293
- block += 'EXPECTED OUTPUT: Component file with tests and usage example\n';
294
- block += '```\n';
295
- // PRD Commit Headers section (before analysis marker)
296
- block += this.formatPRDCommitHeadersSection();
297
276
  // TB_ANALYSIS at the end with IGNORE suffix for clarity
298
277
  block += `\n${RepoService.ANALYSIS_IGNORE_PREFIX}${JSON.stringify(analysis)}${RepoService.ANALYSIS_IGNORE_SUFFIX}\n`;
299
278
  block += `${RepoService.REPO_BLOCK_END}\n`;
@@ -426,68 +405,72 @@ export class RepoService {
426
405
  return output;
427
406
  }
428
407
  /**
429
- * Format agents in compact style with categories
408
+ * Format agents as a simple table with tech-stack specific "Use for" descriptions
430
409
  */
431
- formatAgentsCompact(agents) {
432
- const categories = {
433
- 'Planning & Architecture': [],
434
- 'Development': [],
435
- 'Testing & Quality': [],
436
- 'Operations & Analysis': []
437
- };
438
- agents.forEach(agent => {
439
- const compactDesc = this.getCompactDescription(agent.description);
440
- const line = `\`${agent.name}\` - ${compactDesc}`;
441
- // Categorize based on keywords in name and description
442
- const searchText = `${agent.name} ${agent.description}`.toLowerCase();
443
- if (searchText.includes('architect') || searchText.includes('researcher') ||
444
- searchText.includes('planner') || searchText.includes('design') ||
445
- searchText.includes('prd') || searchText.includes('requirement')) {
446
- categories['Planning & Architecture'].push(line);
447
- }
448
- else if (searchText.includes('test') || searchText.includes('validator') ||
449
- searchText.includes('quality') || searchText.includes('refactor') ||
450
- searchText.includes('tdd')) {
451
- categories['Testing & Quality'].push(line);
452
- }
453
- else if (searchText.includes('metrics') || searchText.includes('analyst') ||
454
- searchText.includes('monitor') || searchText.includes('observ') ||
455
- searchText.includes('collector') || searchText.includes('root-cause')) {
456
- categories['Operations & Analysis'].push(line);
457
- }
458
- else {
459
- // Default to Development
460
- categories['Development'].push(line);
461
- }
462
- });
463
- // Build formatted output
410
+ formatAgentTable(agents, analysis) {
411
+ if (agents.length === 0) {
412
+ return 'No agents installed for this repository.\n';
413
+ }
414
+ // Generate tech stack summary
415
+ const techParts = [];
416
+ if (analysis.languages.length > 0) {
417
+ techParts.push(analysis.languages.join('/'));
418
+ }
419
+ if (analysis.frameworks.length > 0) {
420
+ techParts.push(analysis.frameworks.join(', '));
421
+ }
422
+ const testingTool = analysis.testingTools[0];
423
+ if (testingTool) {
424
+ techParts.push(`${testingTool} testing`);
425
+ }
464
426
  let output = '';
465
- for (const [category, agentList] of Object.entries(categories)) {
466
- if (agentList.length > 0) {
467
- output += `**${category}**\n`;
468
- agentList.forEach(line => output += `- ${line}\n`);
469
- output += '\n';
470
- }
427
+ if (techParts.length > 0) {
428
+ output += `${techParts.join(' repository with ')}.\n\n`;
471
429
  }
430
+ // Build agent table
431
+ output += '| Agent | Use for |\n';
432
+ output += '|-------|--------|\n';
433
+ agents.forEach(agent => {
434
+ // Use TBR-provided usage if available, otherwise generic fallback
435
+ const useCase = agent.usage || this.generateAgentUseCase(agent);
436
+ output += `| \`${agent.name}\` | ${useCase} |\n`;
437
+ });
438
+ output += '\nSkills automatically select appropriate agents. Use Task tool for direct invocation.\n';
472
439
  return output;
473
440
  }
474
441
  /**
475
- * Get compact description by removing common phrases and truncating if needed
442
+ * Generate generic "Use for" description based on agent name
443
+ * This is a fallback when TBR doesn't provide contextual usage
476
444
  */
477
- getCompactDescription(description) {
478
- // Remove common prefixes and make concise
479
- let compact = description
480
- .replace(/^(A |An |The )/i, '')
481
- .replace(/specialist (who|that) /gi, '')
482
- .replace(/focused on /gi, '')
483
- .replace(/development specialist /gi, '');
484
- // Capitalize first letter
485
- compact = compact.charAt(0).toUpperCase() + compact.slice(1);
486
- // Truncate if too long (80 chars)
487
- if (compact.length > 80) {
488
- compact = compact.substring(0, 77) + '...';
489
- }
490
- return compact;
445
+ generateAgentUseCase(agent) {
446
+ const name = agent.name.toLowerCase();
447
+ // Generic fallback based on agent name
448
+ if (name.includes('typescript'))
449
+ return 'TypeScript files';
450
+ if (name.includes('react'))
451
+ return 'React components';
452
+ if (name.includes('component'))
453
+ return 'UI components';
454
+ if (name.includes('tdd') || name.includes('test'))
455
+ return 'Test files';
456
+ if (name.includes('backend'))
457
+ return 'Backend code';
458
+ if (name.includes('frontend'))
459
+ return 'Frontend code';
460
+ if (name.includes('architect'))
461
+ return 'Architecture decisions';
462
+ if (name.includes('refactor'))
463
+ return 'Refactoring';
464
+ if (name.includes('security'))
465
+ return 'Security';
466
+ if (name.includes('performance'))
467
+ return 'Performance';
468
+ if (name.includes('quality'))
469
+ return 'Code review';
470
+ if (name.includes('validator'))
471
+ return 'Validation';
472
+ // Fallback to cleaned-up agent name
473
+ return agent.name.replace(/-/g, ' ');
491
474
  }
492
475
  /**
493
476
  * Format repository context as clean YAML
@@ -552,49 +535,6 @@ export class RepoService {
552
535
  const match = content.match(versionRegex);
553
536
  return match ? match[1] : null;
554
537
  }
555
- /**
556
- * Format Developer Workflow section with PRD and ADR information
557
- * This section appears before the Subagent Context Protocol
558
- */
559
- formatDeveloperWorkflowSection() {
560
- const repoRoot = getRepoRoot();
561
- const prdPath = path.join(repoRoot, 'docs', 'prd');
562
- const adrPath = path.join(repoRoot, 'docs', 'adr');
563
- const hasPRD = existsSync(prdPath);
564
- const hasADR = existsSync(adrPath);
565
- // Only include section if PRD or ADR directories exist
566
- if (!hasPRD && !hasADR) {
567
- return '';
568
- }
569
- let section = '## Developer Workflow\n\n';
570
- section += 'This repository uses structured documentation for technical decisions and feature planning.\n\n';
571
- if (hasPRD) {
572
- section += '**Product Requirements Documents (PRDs):**\n';
573
- section += `- Location: \`docs/prd/{prd-id}/prd.md\`\n`;
574
- section += `- Features: \`docs/prd/{prd-id}/features/{feature-id}.md\`\n`;
575
- section += `- Skills: \`.claude/skills/plan/\`, \`.claude/skills/feature/\`, \`.claude/skills/fix/\`\n\n`;
576
- }
577
- if (hasADR) {
578
- section += '**Architecture Decision Records (ADRs):**\n';
579
- section += `- Location: \`docs/adr/NNNN-decision-title.md\`\n`;
580
- section += `- Skill: \`.claude/skills/adr/\`\n\n`;
581
- }
582
- // Add PRD commit workflow with ADR checking if both exist
583
- if (hasPRD && hasADR) {
584
- section += '**PRD Commit Workflow:**\n\n';
585
- section += 'After committing PRD-tracked code, ALWAYS check for ADR suggestions:\n\n';
586
- section += '1. After successful git commit (via Bash tool)\n';
587
- section += '2. Immediately call: `plan operation=check-adrs`\n';
588
- section += '3. If suggestions exist, present them to user\n';
589
- section += '4. Wait for user decision before proceeding\n\n';
590
- section += '**When to Suggest ADRs:**\n\n';
591
- section += 'Commit messages containing:\n';
592
- section += '- adopt, migrate, implement, choose, replace, select\n';
593
- section += '- + technology names (PostgreSQL, Redis, GraphQL, OAuth2, Kubernetes, etc.)\n';
594
- section += '- + architecture patterns (microservices, event-driven, CQRS, etc.)\n\n';
595
- }
596
- return section;
597
- }
598
538
  /**
599
539
  * Format documentation templates section for PRDs and ADRs
600
540
  * Only includes sections for directories that exist
@@ -1185,163 +1125,78 @@ export class RepoService {
1185
1125
  return descriptions[agentName] || `${agentName.replace(/-/g, ' ')} specialist`;
1186
1126
  }
1187
1127
  /**
1188
- * Format PRD Workflow section (appears FIRST in tiny-brain block)
1189
- * Combines PRD locations, ADR locations, workflow instructions, and commit headers
1128
+ * Format workflow sections for CLAUDE.md
1129
+ * Each section is independent - enabled features appear regardless of other settings
1190
1130
  */
1191
1131
  async formatPRDWorkflowSection() {
1192
- // Check if SDD is enabled
1193
- const enableSDD = await this.configService.isSDDEnabled();
1194
- if (!enableSDD) {
1195
- this.context.logger.debug('SDD disabled, skipping PRD Workflow section');
1196
- return '';
1197
- }
1132
+ let section = '';
1198
1133
  const repoRoot = getRepoRoot();
1199
1134
  const prdPath = path.join(repoRoot, 'docs', 'prd');
1200
1135
  const adrPath = path.join(repoRoot, 'docs', 'adr');
1201
1136
  const hasPRD = existsSync(prdPath);
1202
1137
  const hasADR = existsSync(adrPath);
1203
- // Only show section if PRD exists
1204
- if (!hasPRD) {
1205
- return '';
1206
- }
1207
- let section = '## PRD Workflow\n\n';
1208
- section += 'IMPORTANT: Skills at `.claude/skills/` are **model-invoked** - describe your intent and Claude will use them automatically.\n';
1209
- section += 'Examples: "I want to plan a new feature", "track this bug fix", "add a feature to the PRD"\n';
1210
- section += 'Check available skills: ask "What Skills are available?"\n\n';
1211
- section += '**First-time Setup:** Run `npx tiny-brain analyse` from terminal before starting Claude Code to install skills.\n';
1212
- section += 'If skills were installed mid-session, restart Claude Code to activate them.\n\n';
1213
- section += '**Product Requirements Documents (PRDs):**\n';
1214
- section += `- Location: \`docs/prd/{prd-id}/prd.md\`\n`;
1215
- section += `- Features: \`docs/prd/{prd-id}/features/{feature-id}.md\`\n`;
1216
- section += `- Skills: plan (create PRDs), feature (add features), fix (track fixes)\n\n`;
1217
- // Check if ADR is enabled before showing ADR-related content
1138
+ // Check all feature flags
1139
+ const enableSDD = await this.configService.isSDDEnabled();
1218
1140
  const enableADR = await this.configService.isADREnabled();
1219
- if (hasADR && enableADR) {
1220
- section += '**Architecture Decision Records (ADRs):**\n';
1141
+ const enableQuality = await this.configService.isQualityEnabled();
1142
+ const enableTDD = await this.configService.isTDDEnabled();
1143
+ // PRD Workflow section (requires SDD enabled AND docs/prd exists)
1144
+ if (enableSDD && hasPRD) {
1145
+ section += '## PRD Workflow\n\n';
1146
+ section += 'IMPORTANT: Skills at `.claude/skills/` are **model-invoked** - describe your intent and Claude will use them automatically.\n';
1147
+ section += 'Examples: "I want to plan a new feature", "track this bug fix", "add a feature to the PRD"\n\n';
1148
+ section += '**Product Requirements Documents (PRDs):**\n';
1149
+ section += `- Location: \`docs/prd/{prd-id}/prd.md\`\n`;
1150
+ section += `- Features: \`docs/prd/{prd-id}/features/{feature-id}.md\`\n`;
1151
+ section += `- Skills: plan (create PRDs), feature (add features), fix (track fixes)\n\n`;
1152
+ // Commit Message Format (part of SDD)
1153
+ section += '## Commit Message Format\n\n';
1154
+ section += 'This project uses **Conventional Commits** for PRD-tracked tasks.\n\n';
1155
+ section += '**Format:**\n';
1156
+ section += '```\n';
1157
+ section += '{type}({scope}): commit title\n\n';
1158
+ section += 'PRD: {prd-id}\n';
1159
+ section += 'Feature: {feature-id}\n';
1160
+ section += 'Task: {exact-task-description}\n\n';
1161
+ section += 'Description of changes...\n\n';
1162
+ section += '🤖 Generated with [Claude Code](https://claude.com/claude-code)\n';
1163
+ section += '```\n\n';
1164
+ section += '**Quick Reference:**\n';
1165
+ section += '- PRD ID = directory name in `docs/prd/`\n';
1166
+ section += '- Feature ID = feature\'s `id` field\n';
1167
+ section += '- Task = EXACT description from progress.json\n';
1168
+ section += '- Type = `test`, `feat`, or `refactor` (for TDD tracking)\n\n';
1169
+ }
1170
+ // ADR section (independent - requires ADR enabled)
1171
+ if (enableADR && hasADR) {
1172
+ section += '## Architecture Decision Records\n\n';
1221
1173
  section += `- Location: \`docs/adr/NNNN-decision-title.md\`\n`;
1222
- section += `- Use \`/adr\` skill to create ADRs\n`;
1223
- section += `- Skill and template at \`.claude/skills/adr/\`\n\n`;
1174
+ section += `- Use \`/adr\` skill to create ADRs\n\n`;
1175
+ if (enableSDD && hasPRD) {
1176
+ section += '**ADR Suggestions:** After PRD commits, check for ADR suggestions with `plan operation=check-adrs`\n\n';
1177
+ }
1224
1178
  }
1225
- // Check if Quality is enabled before showing Quality-related content
1226
- const enableQuality = await this.configService.isQualityEnabled();
1179
+ // Quality section (independent - requires Quality enabled)
1227
1180
  if (enableQuality) {
1228
- section += '**Code Quality Analysis:**\n';
1181
+ section += '## Code Quality Analysis\n\n';
1229
1182
  section += `- Use \`/quality\` skill to run comprehensive quality analysis\n`;
1230
- section += `- Runs parallel analysis across 8 quality categories\n`;
1231
- section += `- Categories: Security (15pts), Reliability (10pts), Performance (10pts), Maintainability (5pts), Testing (5pts), Architecture (5pts), Documentation (3pts), Operations (3pts)\n`;
1232
- section += `- Grades: A (90-100), B (80-89), C (70-79), D (60-69), F (<60)\n`;
1233
- section += `- Run history stored in \`docs/quality/runs/\`\n`;
1234
- section += `- Skill and templates at \`.claude/skills/quality/\`\n\n`;
1235
- }
1236
- if (hasADR && enableADR) {
1237
- section += '**PRD Commit Workflow:**\n\n';
1238
- section += 'After committing PRD-tracked code, ALWAYS check for ADR suggestions:\n\n';
1239
- section += '1. After successful git commit (via Bash tool)\n';
1240
- section += '2. Immediately call: `plan operation=check-adrs`\n';
1241
- section += '3. If suggestions exist, present them to user\n';
1242
- section += '4. Wait for user decision before proceeding\n\n';
1243
- section += '**When to Suggest ADRs:**\n\n';
1244
- section += 'Commit messages containing:\n';
1245
- section += '- adopt, migrate, implement, choose, replace, select\n';
1246
- section += '- + technology names (PostgreSQL, Redis, GraphQL, OAuth2, Kubernetes, etc.)\n';
1247
- section += '- + architecture patterns (microservices, event-driven, CQRS, etc.)\n\n';
1248
- }
1249
- // Add commit headers section
1250
- section += '## Commit Message Format\n\n';
1251
- section += 'This project uses **Conventional Commits** (https://www.conventionalcommits.org/en/v1.0.0/).\n\n';
1252
- section += 'When working on PRD-tracked tasks, ALWAYS add these headers immediately after the commit title.\n\n';
1253
- section += '**Format:**\n';
1254
- section += '```\n';
1255
- section += '{type}({scope}): commit title\n\n';
1256
- section += 'PRD: {prd-id}\n';
1257
- section += 'Feature: {feature-id}\n';
1258
- section += 'Task: {exact-task-description}\n\n';
1259
- section += 'Detailed description of what changed, why, and how.\n';
1260
- section += 'This section is REQUIRED - explain implementation details,\n';
1261
- section += 'technical decisions, and any important context.\n\n';
1262
- section += '🤖 Generated with [Claude Code](https://claude.com/claude-code)\n';
1263
- section += '```\n\n';
1264
- section += '**Example:**\n';
1265
- section += '```\n';
1266
- section += 'feat(dashboard): add SSE events for plan changes\n\n';
1267
- section += 'PRD: plan-system-refactoring-implementation\n';
1268
- section += 'Feature: dashboard-integration\n';
1269
- section += 'Task: Add real-time SSE updates for plan changes\n\n';
1270
- section += 'Implement server-sent events to notify dashboard clients\n';
1271
- section += 'when progress.json files are updated. Uses EventEmitter\n';
1272
- section += 'pattern to broadcast changes. Clients automatically\n';
1273
- section += 'reconnect on connection loss.\n\n';
1274
- section += '🤖 Generated with [Claude Code](https://claude.com/claude-code)\n';
1275
- section += '```\n\n';
1276
- section += '**Quick Reference:**\n';
1277
- section += '- Use conventional commit format: `type(scope):` or `type:`\n';
1278
- section += '- Scope is optional but recommended\n';
1279
- section += '- PRD ID = directory name in `docs/prd/`\n';
1280
- section += '- Feature ID = feature\'s `id` field (NOT `number`)\n';
1281
- section += '- Task = EXACT description from progress.json\n';
1282
- section += '- Type = `test`, `feat`, or `refactor` (for TDD tracking)\n';
1283
- section += '- Order: Title → PRD headers → Description (REQUIRED) → Claude footer (LAST)\n\n';
1284
- section += '📖 **Full documentation**: See `docs/prd/README.md` → "Task Tracking with Git Commits" section\n\n';
1285
- // Check if TDD is enabled before showing TDD Workflow section
1286
- const enableTDD = await this.configService.isTDDEnabled();
1183
+ section += `- Categories: Security, Reliability, Performance, Maintainability, Testing, Architecture, Documentation, Operations\n`;
1184
+ section += `- Grades: A (90-100), B (80-89), C (70-79), D (60-69), F (<60)\n\n`;
1185
+ }
1186
+ // TDD Workflow section (independent - requires TDD enabled)
1287
1187
  if (enableTDD) {
1288
- // Add TDD Workflow section
1289
1188
  section += '## TDD Workflow\n\n';
1290
- section += '**MANDATORY:** This repository follows strict Test-Driven Development (TDD) with a 3-phase commit workflow.\n\n';
1291
- section += '### ⚠️ CRITICAL RULE: One Task = One Commit Cycle\n\n';
1292
- section += '**NEVER implement multiple tasks in a single commit.**\n\n';
1293
- section += 'Each PRD task MUST have its own complete TDD cycle:\n';
1294
- section += '- **1 task** = **1 test commit** (RED phase) + **1 feat commit** (GREEN phase) + optionally **1 refactor commit**\n';
1295
- section += '- Multiple tasks cannot share commits - even if the implementation is related\n';
1296
- section += '- This ensures accurate progress tracking and proper task completion detection\n';
1297
- section += '- Violation of this rule will cause incorrect task tracking in progress.json\n\n';
1298
- section += '❌ **WRONG**: One commit implements tasks 1-1, 1-4, 1-5, and 1-6\n';
1299
- section += '✅ **CORRECT**: Four separate commit cycles, one for each task\n\n';
1300
- section += '**CRITICAL RULES - NO EXCEPTIONS:**\n';
1301
- section += '1. **NEVER** commit test files and implementation files together\n';
1302
- section += '2. **ALWAYS** commit in this exact order: Red → Green → (optional) Refactor\n';
1303
- section += '3. **RED PHASE MUST FAIL** - If tests pass in red phase, you did it wrong\n';
1304
- section += '4. **GREEN PHASE MUST PASS** - If tests fail in green phase, you did it wrong\n\n';
1189
+ section += '**MANDATORY:** This repository follows strict Test-Driven Development (TDD).\n\n';
1305
1190
  section += '**Red → Green → Refactor Cycle:**\n\n';
1306
- section += '1. **Red Phase** (`test:` or `test(scope):` commits):\n';
1307
- section += ' - **ONLY commit test files** (e.g., `*.test.ts`, `*.test.tsx`)\n';
1308
- section += ' - **DO NOT commit implementation files** in this commit\n';
1309
- section += ' - Tests MUST fail when you commit them (that\'s the point!)\n';
1310
- section += ' - Run tests BEFORE committing to verify they fail\n';
1311
- section += ' - Use: `git commit -m "test: ..."` or `git commit -m "test(api): ..."`\n';
1312
- section += ' - Git hook automatically runs typecheck + lint but SKIPS tests\n';
1313
- section += ' - Tracked in: `testCommitSha` field\n';
1314
- section += ' - **Example:** `git add src/**/*.test.ts && git commit -m "test: add preference integration tests"`\n\n';
1315
- section += '2. **Green Phase** (`feat:` or `feat(scope):` commits):\n';
1316
- section += ' - **ONLY commit implementation files** (e.g., service files, components)\n';
1317
- section += ' - **DO NOT commit test files** in this commit\n';
1318
- section += ' - Implement minimum code to make tests pass\n';
1319
- section += ' - Run tests BEFORE committing to verify they pass\n';
1320
- section += ' - Use: `git commit -m "feat: ..."` or `git commit -m "feat(auth): ..."`\n';
1321
- section += ' - Git hook automatically runs full checks (typecheck + lint + test)\n';
1322
- section += ' - Tracked in: `commitSha` field\n';
1323
- section += ' - **Marks task as COMPLETED**\n';
1324
- section += ' - **Example:** `git add src/services/*.ts && git commit -m "feat: implement preference integration"`\n\n';
1325
- section += '3. **Refactor Phase** (`refactor:` or `refactor(scope):` commits - optional):\n';
1326
- section += ' - Improve code quality without changing behavior\n';
1327
- section += ' - All tests must still pass\n';
1328
- section += ' - Use: `git commit -m "refactor: ..."` or `git commit -m "refactor(plan): ..."`\n';
1329
- section += ' - Git hook automatically runs full checks (typecheck + lint + test)\n';
1330
- section += ' - Tracked in: `refactorCommitSha` field\n\n';
1331
- section += '**Workflow Checklist:**\n';
1332
- section += '- [ ] Write tests first (Red phase)\n';
1333
- section += '- [ ] Run tests to verify they FAIL\n';
1334
- section += '- [ ] Commit ONLY test files with `test:` prefix\n';
1335
- section += '- [ ] Write implementation (Green phase)\n';
1336
- section += '- [ ] Run tests to verify they PASS\n';
1337
- section += '- [ ] Commit ONLY implementation files with `feat:` prefix\n';
1338
- section += '- [ ] (Optional) Refactor and commit with `refactor:` prefix\n\n';
1339
- section += '**Why This Matters:**\n';
1340
- section += '- Git hooks automatically detect commit type and run appropriate checks\n';
1341
- section += '- Separate commit tracking enables Feature 9 (TDD phase tracking in dashboard)\n';
1342
- section += '- Provides audit trail of development process\n';
1343
- section += '- Only `feat:` or `feat(scope):` commits mark tasks as completed\n';
1344
- section += '- **Bundling phases together breaks the tracking system**\n\n';
1191
+ section += '| Phase | Commit Type | What to Commit | Tests Must |\n';
1192
+ section += '|-------|-------------|----------------|------------|\n';
1193
+ section += '| RED | `test:` | Test files only | FAIL |\n';
1194
+ section += '| GREEN | `feat:` or `fix:` | Implementation only | PASS |\n';
1195
+ section += '| REFACTOR | `refactor:` | Any (optional) | PASS |\n\n';
1196
+ section += '**Critical Rules:**\n';
1197
+ section += '- NEVER commit test + implementation files together\n';
1198
+ section += '- One task = one complete TDD cycle\n';
1199
+ section += '- Git hooks enforce: `test:` skips test run, `feat:`/`fix:` runs full checks\n\n';
1345
1200
  }
1346
1201
  return section;
1347
1202
  }
@@ -1352,45 +1207,4 @@ export class RepoService {
1352
1207
  // ADR information is now included in PRD workflow section
1353
1208
  return '';
1354
1209
  }
1355
- /**
1356
- * Format the PRD Commit Headers section
1357
- */
1358
- formatPRDCommitHeadersSection() {
1359
- let section = '\n## Commit Message Format\n\n';
1360
- section += 'This project uses **Conventional Commits** (https://www.conventionalcommits.org/en/v1.0.0/).\n\n';
1361
- section += 'When working on PRD-tracked tasks, ALWAYS add these headers immediately after the commit title.\n\n';
1362
- section += '**Format:**\n';
1363
- section += '```\n';
1364
- section += '{type}({scope}): commit title\n\n';
1365
- section += 'PRD: {prd-id}\n';
1366
- section += 'Feature: {feature-id}\n';
1367
- section += 'Task: {exact-task-description}\n\n';
1368
- section += 'Detailed description of what changed, why, and how.\n';
1369
- section += 'This section is REQUIRED - explain implementation details,\n';
1370
- section += 'technical decisions, and any important context.\n\n';
1371
- section += '🤖 Generated with [Claude Code](https://claude.com/claude-code)\n';
1372
- section += '```\n\n';
1373
- section += '**Example:**\n';
1374
- section += '```\n';
1375
- section += 'feat(dashboard): add SSE events for plan changes\n\n';
1376
- section += 'PRD: plan-system-refactoring-implementation\n';
1377
- section += 'Feature: dashboard-integration\n';
1378
- section += 'Task: Add real-time SSE updates for plan changes\n\n';
1379
- section += 'Implement server-sent events to notify dashboard clients\n';
1380
- section += 'when progress.json files are updated. Uses EventEmitter\n';
1381
- section += 'pattern to broadcast changes. Clients automatically\n';
1382
- section += 'reconnect on connection loss.\n\n';
1383
- section += '🤖 Generated with [Claude Code](https://claude.com/claude-code)\n';
1384
- section += '```\n\n';
1385
- section += '**Quick Reference:**\n';
1386
- section += '- Use conventional commit format: `type(scope):` or `type:`\n';
1387
- section += '- Scope is optional but recommended\n';
1388
- section += '- PRD ID = directory name in `docs/prd/`\n';
1389
- section += '- Feature ID = feature\'s `id` field (NOT `number`)\n';
1390
- section += '- Task = EXACT description from progress.json\n';
1391
- section += '- Type = `test`, `feat`, or `refactor` (for TDD tracking)\n';
1392
- section += '- Order: Title → PRD headers → Description (REQUIRED) → Claude footer (LAST)\n\n';
1393
- section += '📖 **Full documentation**: See `docs/prd/README.md` → "Task Tracking with Git Commits" section\n';
1394
- return section;
1395
- }
1396
1210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-ingredients/tiny-brain-local",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "MCP server for Tiny Brain AI assistant",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "dxt:init": "cd dxt && dxt init"
32
32
  },
33
33
  "dependencies": {
34
- "@magic-ingredients/tiny-brain-core": "^0.15.0",
34
+ "@magic-ingredients/tiny-brain-core": "^0.15.2",
35
35
  "@magic-ingredients/tiny-brain-dashboard": "file:../tiny-brain-dashboard",
36
36
  "@modelcontextprotocol/sdk": "^1.0.6",
37
37
  "chalk": "^5.3.0",