brain-dev 2.1.0 → 2.2.1

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.
@@ -5,7 +5,7 @@ const path = require('node:path');
5
5
  const { readState, writeState, atomicWriteSync } = require('../state.cjs');
6
6
  const { parseRoadmap } = require('../roadmap.cjs');
7
7
  const { loadTemplate, interpolate } = require('../templates.cjs');
8
- const { output, error, success } = require('../core.cjs');
8
+ const { output, error, success, prefix, pipelineGate } = require('../core.cjs');
9
9
  const { generateExpertise } = require('../stack-expert.cjs');
10
10
 
11
11
  /**
@@ -230,8 +230,11 @@ function handleSave(args, brainDir, state) {
230
230
  nextAction: '/brain:plan'
231
231
  };
232
232
 
233
- success("Context captured. Run /brain:plan to create execution plans.");
234
- output(result, '');
233
+ const humanLines = [
234
+ prefix('Context captured.'),
235
+ pipelineGate(`npx brain-dev plan --phase ${phaseNumber}`)
236
+ ].join('\n');
237
+ output(result, humanLines);
235
238
 
236
239
  return result;
237
240
  }
@@ -8,7 +8,7 @@ const { loadTemplate, interpolate, loadTemplateWithOverlay } = require('../templ
8
8
  const { getAgent, resolveModel } = require('../agents.cjs');
9
9
  const { logEvent } = require('../logger.cjs');
10
10
  const { estimateFromPlan, getDefaultBudget, checkBudget } = require('../complexity.cjs');
11
- const { output, error, success } = require('../core.cjs');
11
+ const { output, error, success, pipelineGate } = require('../core.cjs');
12
12
  const { generateExpertise, getDetectedFramework } = require('../stack-expert.cjs');
13
13
 
14
14
  /**
@@ -317,7 +317,8 @@ function handleSingle(args, brainDir, state) {
317
317
  `[brain] Checker enabled: true`,
318
318
  result.advocate_enabled ? `[brain] Advocate enabled: true` : '',
319
319
  '',
320
- fullPrompt
320
+ fullPrompt,
321
+ pipelineGate(`npx brain-dev execute --phase ${phaseNumber}`)
321
322
  ].filter(Boolean);
322
323
  output(result, humanLines.join('\n'));
323
324
 
@@ -504,12 +504,12 @@ function handleLogRecovery(args, logRecoveryIdx, brainDir, state) {
504
504
  ? parseInt(args[phaseIdx + 1], 10)
505
505
  : state.phase.current;
506
506
 
507
- logEvent(brainDir, phaseNumber, event);
508
-
509
507
  if (!event || typeof event !== 'object') {
510
508
  error('--log-recovery requires a JSON object, not null/primitive');
511
509
  return { error: 'invalid-json' };
512
510
  }
511
+
512
+ logEvent(brainDir, phaseNumber, event);
513
513
  output({ action: 'recovery-logged', event }, `[brain] Recovery event logged: ${event.type || 'unknown'}`);
514
514
  return { action: 'recovery-logged', event };
515
515
  }
package/bin/lib/core.cjs CHANGED
@@ -59,4 +59,21 @@ function success(msg) {
59
59
  console.log(`${tag} ${msg}`);
60
60
  }
61
61
 
62
- module.exports = { isTTY, output, prefix, error, success };
62
+ /**
63
+ * Generate a pipeline gate marker for command output.
64
+ * This is a visual signal telling Claude the exact next command to run.
65
+ * @param {string} nextCommand - The exact command to run next
66
+ * @returns {string}
67
+ */
68
+ function pipelineGate(nextCommand) {
69
+ return [
70
+ '',
71
+ '--- PIPELINE GATE ---',
72
+ `NEXT COMMAND (mandatory): ${nextCommand}`,
73
+ 'Do NOT skip this command. Do NOT improvise. Do NOT start coding.',
74
+ 'Copy and run the command above.',
75
+ '--- END GATE ---'
76
+ ].join('\n');
77
+ }
78
+
79
+ module.exports = { isTTY, output, prefix, error, success, pipelineGate };
@@ -30,7 +30,7 @@ const STACK_PATTERNS = {
30
30
  antiPatterns: 'N+1 queries (use eager loading with/load), fat controllers (extract to Services/Actions), raw SQL in controllers, logic in models (use Services), not using Form Requests for validation',
31
31
  testing: 'Feature tests in tests/Feature, Unit tests in tests/Unit, use RefreshDatabase trait, factories for test data',
32
32
  migration: 'php artisan make:migration create_X_table, php artisan migrate, php artisan migrate:rollback',
33
- commonBugs: 'N+1 query on relationships (use ->with()), mass assignment vulnerability (use $fillable), missing foreign key constraints, not using transactions for multi-table writes, queue job serialization with deleted models',
33
+ commonBugs: ['N+1 query on relationships (use ->with())', 'Mass assignment vulnerability (use $fillable)', 'Missing foreign key constraints', 'Not using transactions for multi-table writes', 'Queue job serialization with deleted models'],
34
34
  verificationRules: ['Migrations exist for all new models', '.env.example has all required keys', 'Routes registered in routes/api.php or routes/web.php', 'Form Requests validate all user input', 'API Resources used for JSON responses', 'Factories exist for all models'],
35
35
  planningHints: ['Plan migration tasks BEFORE model/controller tasks', 'Each model needs: migration, model, factory, controller, request, resource, test', 'Group related migrations in same plan', 'Include seeder tasks for test data'],
36
36
  testExamples: {
@@ -44,7 +44,7 @@ const STACK_PATTERNS = {
44
44
  patterns: 'Server Components by default, use client directive for interactivity, Server Actions for mutations, Route Handlers for API, Metadata API for SEO, Suspense for loading states',
45
45
  antiPatterns: 'useEffect for data fetching (use Server Components), client-side state for server data, large client bundles, not using loading.tsx/error.tsx, fetching in client when server component suffices',
46
46
  testing: 'Jest + React Testing Library, or Vitest, test in __tests__/ or *.test.tsx',
47
- commonBugs: 'Hydration mismatch (server vs client render difference), importing server-only code in client components, not handling loading/error states, stale cache in fetch(), middleware running on every request',
47
+ commonBugs: ['Hydration mismatch (server vs client render difference)', 'Importing server-only code in client components', 'Not handling loading/error states', 'Stale cache in fetch()', 'Middleware running on every request'],
48
48
  verificationRules: ['Page components exist in app/ directory', 'loading.tsx exists for async pages', 'error.tsx exists for error boundaries', 'API Route Handlers use correct HTTP method exports', 'Client components have "use client" directive', 'Metadata exported for SEO pages'],
49
49
  planningHints: ['Plan layout components before page components', 'Server Components first, add "use client" only when needed', 'Plan API Route Handlers separate from page components', 'Include loading.tsx and error.tsx for each route group'],
50
50
  testExamples: {
@@ -58,7 +58,7 @@ const STACK_PATTERNS = {
58
58
  patterns: 'Functional components + hooks, React Navigation/Expo Router, AsyncStorage, StyleSheet.create, Platform.select for platform-specific code',
59
59
  antiPatterns: 'Inline styles (use StyleSheet.create), heavy computation on JS thread, large FlatList without getItemLayout/keyExtractor, not using Platform.OS for platform checks, synchronous storage calls',
60
60
  testing: 'Jest + React Native Testing Library, detox for E2E',
61
- commonBugs: 'Platform-specific rendering not tested on both OS, keyboard covering inputs (use KeyboardAvoidingView), memory leaks from unsubscribed listeners, navigation state persistence issues, StatusBar behavior differences iOS vs Android',
61
+ commonBugs: ['Platform-specific rendering not tested on both OS', 'Keyboard covering inputs (use KeyboardAvoidingView)', 'Memory leaks from unsubscribed listeners', 'Navigation state persistence issues', 'StatusBar behavior differences iOS vs Android'],
62
62
  verificationRules: ['Platform-specific code uses Platform.OS or Platform.select', 'FlatList has keyExtractor and getItemLayout', 'Navigation screens registered in navigator', 'Assets imported correctly (require() for local)', 'No web-only APIs used (document, window)'],
63
63
  planningHints: ['Plan shared components before screen-specific ones', 'Consider both iOS and Android in task descriptions', 'Plan navigation structure before individual screens', 'Include platform-specific testing tasks'],
64
64
  testExamples: {
@@ -72,7 +72,7 @@ const STACK_PATTERNS = {
72
72
  patterns: 'Router middleware chain, error handling middleware, async/await with express-async-errors, request validation with Joi/Zod, controller-service separation',
73
73
  antiPatterns: 'Callback hell, no error middleware, sync operations blocking event loop, not validating request body, try/catch in every route (use express-async-errors)',
74
74
  testing: 'Jest/Mocha + supertest for HTTP assertions',
75
- commonBugs: 'Unhandled promise rejections crashing server, missing error middleware (must have 4 params), route order matters (specific before generic), CORS misconfiguration, not closing DB connections on shutdown',
75
+ commonBugs: ['Unhandled promise rejections crashing server', 'Missing error middleware (must have 4 params: err, req, res, next)', 'Route order matters (specific before generic)', 'CORS misconfiguration', 'Not closing DB connections on shutdown'],
76
76
  verificationRules: ['Error handling middleware exists (4 params: err, req, res, next)', 'Routes validate input before processing', 'Async handlers properly catch errors', 'CORS configured for production origins', 'Graceful shutdown handler exists'],
77
77
  planningHints: ['Plan middleware before routes', 'Error handling middleware is a separate task at the end', 'Group related routes in same router file', 'Plan validation schemas alongside route handlers'],
78
78
  testExamples: {
@@ -87,7 +87,7 @@ const STACK_PATTERNS = {
87
87
  antiPatterns: 'N+1 queries (use select_related/prefetch_related), logic in views (use services), not using serializers for validation, raw SQL without parameterization',
88
88
  testing: 'pytest-django or TestCase, factory_boy for fixtures',
89
89
  migration: 'python manage.py makemigrations, python manage.py migrate, python manage.py migrate <app> zero (rollback)',
90
- commonBugs: 'Circular imports between apps, migration conflicts in teams, not using select_related causing N+1, signals firing during tests unexpectedly, timezone-naive datetime comparisons',
90
+ commonBugs: ['Circular imports between apps', 'Migration conflicts in teams', 'Not using select_related causing N+1', 'Signals firing during tests unexpectedly', 'Timezone-naive datetime comparisons'],
91
91
  verificationRules: ['Migrations created for all model changes', 'URLs registered in app urls.py and included in root urls.py', 'Admin registered for all models', 'Serializers validate all user input', 'Permissions set on views'],
92
92
  planningHints: ['Plan models and migrations before views', 'Each app should be self-contained', 'Plan serializers alongside models', 'Include admin registration tasks', 'Plan management commands for data operations'],
93
93
  testExamples: {
@@ -137,7 +137,7 @@ const STACK_PATTERNS = {
137
137
  antiPatterns: 'Sync database calls in async endpoints, no Pydantic validation, global mutable state, not using Depends() for shared logic, blocking the event loop',
138
138
  testing: 'pytest + httpx AsyncClient',
139
139
  migration: 'alembic init, alembic revision --autogenerate -m "description", alembic upgrade head',
140
- commonBugs: 'Mixing sync/async database drivers, Pydantic v2 model_validator vs v1 validator, circular imports in routers, not closing DB connections in lifespan, CORS middleware order matters',
140
+ commonBugs: ['Mixing sync/async database drivers', 'Pydantic v2 model_validator vs v1 validator', 'Circular imports in routers', 'Not closing DB connections in lifespan', 'CORS middleware order matters'],
141
141
  verificationRules: ['Pydantic schemas exist for all request/response models', 'Dependencies use Depends() injection', 'Async endpoints use async database driver', 'Alembic migrations exist for schema changes', 'Error handlers return consistent JSON format'],
142
142
  planningHints: ['Plan Pydantic schemas before routers', 'Plan database models with Alembic migrations', 'Group related endpoints in same router', 'Plan dependency injection for shared resources (DB, auth)'],
143
143
  testExamples: {
@@ -318,7 +318,8 @@ function generateExpertise(brainDir, role = 'general') {
318
318
  if (fwInfo.commonBugs) {
319
319
  sections.push('');
320
320
  sections.push(`### Common ${framework} Bugs to Avoid`);
321
- for (const [i, bug] of fwInfo.commonBugs.split(', ').entries()) {
321
+ const bugs = Array.isArray(fwInfo.commonBugs) ? fwInfo.commonBugs : fwInfo.commonBugs.split(', ');
322
+ for (const [i, bug] of bugs.entries()) {
322
323
  sections.push(`${i + 1}. ${bug}`);
323
324
  }
324
325
  }
@@ -242,3 +242,15 @@ Include sections:
242
242
  - On successful completion of all tasks: `## EXECUTION COMPLETE`
243
243
  - On failure after retry: `## EXECUTION FAILED`
244
244
  - On checkpoint (user input needed): `## CHECKPOINT REACHED`
245
+
246
+ ## Pipeline Enforcement Reminders
247
+
248
+ **EXECUTION FAILED:** When you output this marker:
249
+ - The orchestrator will handle recovery (debugger agent or re-execution)
250
+ - Do NOT start debugging manually. Do NOT skip to the next plan.
251
+ - Follow the "Suggested actions" field ONLY.
252
+
253
+ **CHECKPOINT REACHED:** When you output this marker:
254
+ - STOP all implementation work immediately
255
+ - The user MUST be asked via AskUserQuestion — do NOT pick an option yourself
256
+ - Checkpoints exist because a HUMAN decision is required. Never skip them.
@@ -0,0 +1,30 @@
1
+ ## Next.js-Specific Planning
2
+
3
+ ### Task Ordering
4
+ 1. **Layouts first**: Create layout.tsx before page components
5
+ 2. **Server Components first**: Default to Server Components, add "use client" only when needed
6
+ 3. **API Routes separate**: Plan Route Handlers as distinct tasks from pages
7
+ 4. **Error boundaries**: Include loading.tsx and error.tsx for each route group
8
+
9
+ ### Standard Feature Pattern
10
+ For each new route/feature, plan these tasks:
11
+ 1. Layout component (if new route group)
12
+ 2. Page component (Server Component by default)
13
+ 3. Loading state (loading.tsx)
14
+ 4. Error boundary (error.tsx)
15
+ 5. API Route Handler (if needed)
16
+ 6. Client components (only for interactivity)
17
+ 7. Tests
18
+
19
+ ### must_haves Template for Next.js
20
+ ```yaml
21
+ truths:
22
+ - "Page renders correctly as Server Component"
23
+ - "loading.tsx shows skeleton/spinner during data fetch"
24
+ - "error.tsx catches and displays errors gracefully"
25
+ - "No useEffect used for data fetching (Server Component handles it)"
26
+ artifacts:
27
+ - path: "app/{route}/page.tsx"
28
+ - path: "app/{route}/loading.tsx"
29
+ - path: "app/{route}/error.tsx"
30
+ ```
@@ -0,0 +1,27 @@
1
+ ## React Native-Specific Planning
2
+
3
+ ### Task Ordering
4
+ 1. **Navigation first**: Define navigation structure before screens
5
+ 2. **Shared components**: Plan reusable components before screen-specific ones
6
+ 3. **Platform handling**: Consider both iOS and Android in each task
7
+ 4. **Performance**: Plan FlatList optimization tasks alongside data display tasks
8
+
9
+ ### Standard Feature Pattern
10
+ For each new screen/feature, plan these tasks:
11
+ 1. Navigation registration (add to navigator)
12
+ 2. Screen component with StyleSheet
13
+ 3. Shared sub-components (if needed)
14
+ 4. Platform-specific adjustments (Platform.OS checks)
15
+ 5. Tests (component + interaction)
16
+
17
+ ### must_haves Template for React Native
18
+ ```yaml
19
+ truths:
20
+ - "Screen renders correctly on both iOS and Android"
21
+ - "Navigation to/from screen works with correct params"
22
+ - "StyleSheet.create used (no inline styles)"
23
+ - "FlatList has keyExtractor for list screens"
24
+ artifacts:
25
+ - path: "app/{screen}.tsx or src/screens/{Screen}.tsx"
26
+ - path: "components/{Component}.tsx"
27
+ ```
@@ -196,6 +196,12 @@ If you cannot create a valid plan after **2 attempts** (e.g., checker keeps reje
196
196
 
197
197
  Do NOT produce incomplete or low-quality plans. Blocking with clear information is better than a plan that will fail during execution.
198
198
 
199
+ **When PLANNING BLOCKED is output:**
200
+ - Ask the user for the missing information using AskUserQuestion
201
+ - Do NOT attempt to force a plan through
202
+ - Do NOT rewrite requirements yourself
203
+ - Wait for user input, then re-run /brain:plan
204
+
199
205
  ## Enriched SUMMARY.md
200
206
 
201
207
  After each plan executes, the executor creates a SUMMARY.md with:
@@ -220,3 +220,10 @@ When verification is complete, output:
220
220
  **Gaps:** [count of failed must_haves, or "none"]
221
221
  **Human items:** [count of items needing human verification, or "none"]
222
222
  ```
223
+
224
+ ## Pipeline Enforcement
225
+
226
+ **When gaps_found or partial:**
227
+ - Run `/brain:execute` with `--gaps-only` flag to fix specific gaps
228
+ - Do NOT manually fix the files — the executor agent has the context to fix gaps properly
229
+ - Do NOT skip to `/brain:complete` with unresolved gaps
@@ -23,9 +23,16 @@ Supports creating new ADRs, listing existing ones, and searching decision histor
23
23
  </context>
24
24
 
25
25
  <critical-rules>
26
- - ALWAYS use `npx brain-dev adr` to manage ADRs. Never manually create ADR files in .brain/adrs/.
27
- - The CLI assigns sequential IDs, applies the template, and tracks status lifecycle.
28
- - Manual ADR creation can cause ID conflicts and missing metadata.
26
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
27
+ 1. Run `npx brain-dev adr $ARGUMENTS` FIRST before reading code, before analyzing, before suggesting fixes
28
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
29
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
30
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
31
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
32
+
33
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
34
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
35
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
29
36
  </critical-rules>
30
37
 
31
38
  <process>
@@ -22,11 +22,16 @@ Each step tells you which agent to spawn and what prompt to use.
22
22
  </context>
23
23
 
24
24
  <critical-rules>
25
- - ALWAYS run `npx brain-dev execute --auto` to start. Never manually chain brain commands as a substitute.
26
- - Follow the generated runbook EXACTLYeach step tells you which command to run.
27
- - DO NOT skip steps or reorder them the runbook respects phase dependencies.
28
- - On error, follow the error recovery decision tree in the runbook do not improvise.
29
- - ALWAYS run `npx brain-dev execute --auto --stop` when done or on failure.
25
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
26
+ 1. Run `npx brain-dev execute --auto` FIRST before reading code, before analyzing, before suggesting fixes
27
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
28
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
29
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
30
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
31
+
32
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
33
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
34
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
30
35
  </critical-rules>
31
36
 
32
37
  <process>
@@ -24,9 +24,16 @@ Ensures all phases are verified before completing.
24
24
  </context>
25
25
 
26
26
  <critical-rules>
27
- - ALWAYS run `npx brain-dev complete` FIRST. Never manually create git tags or archive files.
28
- - DO NOT skip the completion auditit verifies all phases passed before archiving.
29
- - DO NOT mark phases as complete without running this command — it updates state, creates audit trails, and generates release notes.
27
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
28
+ 1. Run `npx brain-dev complete $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
29
+ 2. READ the full output — it contains step-by-step instructions specific to this project's stack
30
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
31
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
32
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
33
+
34
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
35
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
36
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
30
37
  </critical-rules>
31
38
 
32
39
  <process>
@@ -26,9 +26,16 @@ When no subcommand is given, launches an interactive menu.
26
26
  </context>
27
27
 
28
28
  <critical-rules>
29
- - ALWAYS use `npx brain-dev config` to change settings. Never manually edit brain.json config fields.
30
- - The CLI validates values against the schema manual edits can set invalid values that break the pipeline.
31
- - Use `config docs` to see available settings before making changes.
29
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
30
+ 1. Run `npx brain-dev config $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
31
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
32
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
33
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
34
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
35
+
36
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
37
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
38
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
32
39
  </critical-rules>
33
40
 
34
41
  <process>
@@ -22,10 +22,16 @@ Creates a CONTEXT.md file that feeds into the planning process.
22
22
  </context>
23
23
 
24
24
  <critical-rules>
25
- - ALWAYS run `npx brain-dev discuss` FIRST. Never skip discussion and go straight to planning.
26
- - DO NOT assume you know the right approach the discuss step surfaces gray areas that cause rework later.
27
- - DO NOT write CONTEXT.md manually the CLI provides the discuss template with stack-specific guidance.
28
- - Decisions made here feed directly into planning. Skipping discuss = plans based on assumptions.
25
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
26
+ 1. Run `npx brain-dev discuss $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
27
+ 2. READ the full outputit contains step-by-step instructions specific to this project's stack
28
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
29
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
30
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
31
+
32
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
33
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
34
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
29
35
  </critical-rules>
30
36
 
31
37
  <process>
@@ -23,10 +23,16 @@ Discovers plans, analyzes dependencies, groups into waves, spawns subagents, and
23
23
  </context>
24
24
 
25
25
  <critical-rules>
26
- - ALWAYS run `npx brain-dev execute` FIRST. Never manually implement plan tasks yourself.
27
- - DO NOT read PLAN.md files and execute them manuallythe CLI handles agent spawning, wave ordering, and progress tracking.
28
- - DO NOT skip to verification without running execute the executor agent creates SUMMARY.md files that the verifier needs.
29
- - If execution fails, follow the EXECUTION FAILED output do not improvise a fix outside the pipeline.
26
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
27
+ 1. Run `npx brain-dev execute $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
28
+ 2. READ the full outputit contains step-by-step instructions specific to this project's stack
29
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
30
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
31
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
32
+
33
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
34
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
35
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
30
36
  </critical-rules>
31
37
 
32
38
  <process>
@@ -22,9 +22,16 @@ Optionally auto-repairs safe issues with --fix.
22
22
  </context>
23
23
 
24
24
  <critical-rules>
25
- - ALWAYS run `npx brain-dev health` FIRST. Never manually fix hooks, templates, or state files.
26
- - The CLI knows which repairs are safe (auto-repairable) vs which need manual intervention.
27
- - DO NOT manually edit .brain/brain.json to fix health issues use `--fix` flag instead.
25
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
26
+ 1. Run `npx brain-dev health $ARGUMENTS` FIRST before reading code, before analyzing, before suggesting fixes
27
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
28
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
29
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
30
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
31
+
32
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
33
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
34
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
28
35
  </critical-rules>
29
36
 
30
37
  <process>
@@ -12,9 +12,16 @@ Set up Brain for an existing or new project. Detects your stack, maps the codeba
12
12
  </objective>
13
13
 
14
14
  <critical-rules>
15
- - ALWAYS run `npx brain-dev new-project` FIRST. Never manually create PROJECT.md or edit brain.json project fields.
16
- - The CLI detects your stack, maps workspace siblings, and sets up detection.json — manual setup misses this.
17
- - ALWAYS use AskUserQuestion for the goal question do not print options as text.
15
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
16
+ 1. Run `npx brain-dev new-project` FIRST before reading code, before analyzing, before suggesting fixes
17
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
18
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
19
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
20
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
21
+
22
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
23
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
24
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
18
25
  </critical-rules>
19
26
 
20
27
  <process>
@@ -22,20 +22,19 @@ Examples: "add payment integration", "refactor auth to JWT", "fix ATS rescoring
22
22
  </context>
23
23
 
24
24
  <critical-rules>
25
- NEVER skip the pipeline. Even if the fix seems obvious:
26
- - DO NOT start debugging, coding, or investigating before running `npx brain-dev new-task "description"`
27
- - DO NOT "just fix it" and skip discuss/plan/verify steps
28
- - The pipeline exists to catch edge cases, ensure test coverage, and create audit trails
29
- - A "quick fix" that skips pipeline often misses root causes or introduces regressions
25
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
26
+ 1. Run `npx brain-dev new-task "description"` FIRST — before reading code, before analyzing, before suggesting fixes
27
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
28
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
29
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
30
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
30
31
 
31
- If the user describes a BUG:
32
- 1. First run `npx brain-dev new-task "fix: description of bug"` to create the task
33
- 2. The discuss step IS the investigation use it to understand root cause
34
- 3. The plan step defines the fix + tests
35
- 4. The execute step implements with TDD
36
- 5. The verify step confirms the fix works
32
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
33
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
34
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
37
35
 
38
- If the task seems too small for full pipeline, suggest `/brain:quick` instead. But NEVER skip pipeline silently.
36
+ BUG WORKFLOW: User describes bug `npx brain-dev new-task "fix: description"` discuss (root cause) plan (fix + tests) → execute (TDD) → verify → complete.
37
+ If too small for full pipeline, suggest `/brain:quick` instead. NEVER skip pipeline silently.
39
38
  </critical-rules>
40
39
 
41
40
  <process>
@@ -15,8 +15,16 @@ No arguments required. Captures current session state automatically.
15
15
  </context>
16
16
 
17
17
  <critical-rules>
18
- - ALWAYS run `npx brain-dev pause` to save state. Never manually write continue-here.md or edit session files.
19
- - The CLI captures decisions, plan state, and active work context that manual saves miss.
18
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
19
+ 1. Run `npx brain-dev pause` FIRST before reading code, before analyzing, before suggesting fixes
20
+ 2. READ the full output — it contains step-by-step instructions specific to this project's stack
21
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
22
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
23
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
24
+
25
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
26
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
27
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
20
28
  </critical-rules>
21
29
 
22
30
  <process>
@@ -25,10 +25,16 @@ Default flow: Research (if needed) -> Plan -> Verify -> Done.
25
25
  </context>
26
26
 
27
27
  <critical-rules>
28
- - ALWAYS run `npx brain-dev plan` FIRST. Never write PLAN.md files manually.
29
- - DO NOT skip the plan-checker verification loopit catches requirement gaps and file ownership conflicts.
30
- - DO NOT proceed to execute without running plan plans contain must_haves that the verifier checks against.
31
- - If planning fails, use `/brain:discuss` to clarify requirements do not force a plan through.
28
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
29
+ 1. Run `npx brain-dev plan $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
30
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
31
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
32
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
33
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
34
+
35
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
36
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
37
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
32
38
  </critical-rules>
33
39
 
34
40
  <process>
@@ -28,11 +28,16 @@ Use subagent_type "brain-verifier" for verification (--full mode only).
28
28
  </agents>
29
29
 
30
30
  <critical-rules>
31
- - ALWAYS run `npx brain-dev quick` FIRST. Never skip the CLI and code directly.
32
- - Even quick tasks go through plan execute commit. The CLI generates the planner/executor prompts.
33
- - DO NOT manually write code without first having a plan from the CLI.
34
- - Follow the `nextAction` field in each CLI output do not guess the next step.
35
- - If the task needs discussion or verification, use `/brain:new-task` instead.
31
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
32
+ 1. Run `npx brain-dev quick "description"` FIRST before reading code, before analyzing, before suggesting fixes
33
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
34
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
35
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
36
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
37
+
38
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
39
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
40
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
36
41
  </critical-rules>
37
42
 
38
43
  <process>
@@ -13,9 +13,16 @@ Default mode shows what happened. Use --fix to auto-resume or --rollback to reve
13
13
  </objective>
14
14
 
15
15
  <critical-rules>
16
- - ALWAYS run `npx brain-dev recover` FIRST. Never manually edit brain.json, delete lock files, or reset state.
17
- - Manual state edits can corrupt the project the CLI validates consistency before making changes.
18
- - Review the recovery briefing before choosing --fix or --rollback.
16
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
17
+ 1. Run `npx brain-dev recover` FIRST before reading code, before analyzing, before suggesting fixes
18
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
19
+ 3. FOLLOW the nextAction field — copy the exact command, do not modify it
20
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
21
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
22
+
23
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
24
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
25
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
19
26
  </critical-rules>
20
27
 
21
28
  <process>
@@ -25,10 +25,16 @@ Stories are Brain's primary way to organize significant work. A story creates:
25
25
  </context>
26
26
 
27
27
  <critical-rules>
28
- - ALWAYS run `npx brain-dev story` FIRST. Never manually create research, requirements, or roadmap files.
29
- - DO NOT skip the research phaseit uses 6 parallel researchers that find pitfalls you'd miss manually.
30
- - DO NOT start coding before the story is fully activated (research requirements → roadmap → activate).
31
- - After each step, run `npx brain-dev story --continue` do not guess the next step.
28
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
29
+ 1. Run `npx brain-dev story "title"` FIRSTbefore reading code, before analyzing, before suggesting fixes
30
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
31
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
32
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
33
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
34
+
35
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
36
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
37
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
32
38
  </critical-rules>
33
39
 
34
40
  <process>
@@ -23,10 +23,16 @@ Produces a VERIFICATION.md report with pass/gaps/human_needed status.
23
23
  </context>
24
24
 
25
25
  <critical-rules>
26
- - ALWAYS run `npx brain-dev verify` FIRST. Never manually check must_haves yourself.
27
- - DO NOT declare work "done" or "verified" without running the verify command it performs 3-level checks (exists, substantive, wired) that catch issues manual review misses.
28
- - DO NOT skip verification to save time unverified work creates technical debt and regressions.
29
- - If verification finds gaps, use `/brain:plan --gaps` to create fix plans — do not manually patch.
26
+ PIPELINE ENFORCEMENT (NON-NEGOTIABLE):
27
+ 1. Run `npx brain-dev verify $ARGUMENTS` FIRSTbefore reading code, before analyzing, before suggesting fixes
28
+ 2. READ the full output it contains step-by-step instructions specific to this project's stack
29
+ 3. FOLLOW the nextAction field copy the exact command, do not modify it
30
+ 4. If output shows an ERROR: follow the recovery path in the output, do NOT debug manually
31
+ 5. If output shows a CHECKPOINT: use AskUserQuestion, do NOT pick options yourself
32
+
33
+ CONSEQUENCE OF SKIPPING: Pipeline tracks state, creates audit trails, spawns specialized agents,
34
+ and injects framework-specific expertise. Skipping it means: no state tracking, no audit trail,
35
+ no specialized agents, no framework guidance, potential data loss in .brain/ state.
30
36
  </critical-rules>
31
37
 
32
38
  <process>
@@ -66,14 +66,29 @@ try {
66
66
  '',
67
67
  'Commands: /brain:new-project, /brain:story, /brain:discuss, /brain:plan, /brain:execute, /brain:verify, /brain:complete, /brain:quick, /brain:new-task, /brain:progress, /brain:pause, /brain:resume, /brain:help, /brain:health, /brain:update, /brain:upgrade, /brain:storm, /brain:adr, /brain:phase, /brain:config, /brain:map, /brain:recover, /brain:dashboard, /brain:auto (or execute --auto)',
68
68
  '',
69
- 'Instructions for Claude:',
70
- '- When user types /brain:<command>, run: npx brain-dev <command> [args]',
71
- '- EXCEPTION: For /brain:update, always run: npx brain-dev@latest update (the @latest is critical to avoid stale npx cache)',
72
- '- Read output carefully and FOLLOW the step instructions. Do not skip steps or improvise.',
73
- '- Use /brain:progress to check current state before suggesting next steps.',
74
- '- NEVER run brain-dev init after an update. Updates are backward compatible.',
75
- '- NEVER start coding/debugging before running the brain command. The pipeline IS the process.',
76
- '- When user describes a bug or task, FIRST run the appropriate brain command (new-task, quick, story), THEN follow its output.',
69
+ 'PIPELINE RULES (NON-NEGOTIABLE):',
70
+ '',
71
+ '1. ENTRY: When user describes ANY work (bug, feature, task), run the brain command FIRST.',
72
+ ' Do NOT read code, run git, or analyze before running: npx brain-dev <command>',
73
+ ' If you catch yourself analyzing: STOP, run the CLI, restart with CLI context.',
74
+ '',
75
+ '2. FOLLOW: When brain command outputs, find the nextAction field.',
76
+ ' Copy the exact command verbatim. Do NOT interpret, modify, or skip it.',
77
+ ' Human text is EXPLANATION. The nextAction field is the INSTRUCTION.',
78
+ '',
79
+ '3. NEVER ESCAPE: If you see EXECUTION FAILED, PLANNING BLOCKED, or gaps_found:',
80
+ ' Follow the recovery instructions in that output ONLY.',
81
+ ' Do NOT start debugging manually. Do NOT exit the pipeline.',
82
+ '',
83
+ '4. CHECKPOINTS: If you see CHECKPOINT REACHED:',
84
+ ' Use AskUserQuestion to ask the user. Do NOT pick an option yourself.',
85
+ '',
86
+ '5. AGENTS: When output says to spawn an agent (brain-planner, brain-executor):',
87
+ ' Use the Agent tool with the specified subagent_type. Do NOT execute the prompt yourself.',
88
+ '',
89
+ '6. STATE: Run /brain:progress before suggesting next steps.',
90
+ ' For /brain:update, always use: npx brain-dev@latest update',
91
+ ' NEVER run brain-dev init after an update.',
77
92
  '--- End Brain Context ---'
78
93
  ];
79
94
  console.log(lines.join('\n'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brain-dev",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "AI-powered development workflow orchestrator",
5
5
  "author": "halilcosdu",
6
6
  "license": "MIT",