@su-record/vibe 2.6.7 → 2.6.8

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/CLAUDE.md CHANGED
@@ -1,675 +1,1074 @@
1
- # VIBE
2
-
3
- SPEC-driven AI Coding Framework (Claude Code Exclusive)
4
-
5
- ## Code Quality Standards (Mandatory)
6
-
7
- Follow these standards when writing code. See `~/.claude/vibe/rules/` (global) for detailed rules.
8
-
9
- ### Core Principles
10
- - **Modify only requested scope** - Don't touch unrelated code
11
- - **Preserve existing style** - Follow project conventions
12
- - **Keep working code** - No unnecessary refactoring
13
- - **Respect user interrupts** - If user interrupts (Ctrl+C/Escape) and sends a new message, the previous task is CANCELLED. Do NOT resume or continue interrupted work. Respond ONLY to the new message.
14
-
15
- ### Code Complexity Limits
16
- | Metric | Limit |
17
- |--------|-------|
18
- | Function length | ≤30 lines (recommended), ≤50 lines (allowed) |
19
- | Nesting depth | ≤3 levels |
20
- | Parameters | ≤5 |
21
- | Cyclomatic complexity | ≤10 |
22
-
23
- ### TypeScript Rules
24
- - No `any` type → Use `unknown` + type guards
25
- - No `as any` casting → Define proper interfaces
26
- - No `@ts-ignore` → Fix type issues at root
27
- - Explicit return types on all functions
28
-
29
- ### Error Handling Required
30
- - try-catch or error state required
31
- - Loading state handling
32
- - User-friendly error messages
33
-
34
- ### Forbidden Patterns
35
- - No console.log in commits (remove after debugging)
36
- - No hardcoded strings/numbers Extract to constants
37
- - No commented-out code in commits
38
- - No incomplete code without TODO
39
-
40
- ## Workflow
41
-
42
- ```
43
- /vibe.spec /new /vibe.spec.review /vibe.run → /vibe.trace → (auto) code review → ✅ Done
44
-
45
- Coverage check (v2.6)
46
- ```
47
-
48
- **Flow:**
49
-
50
- 1. `/vibe.spec` - Write SPEC (requirements + research + draft)
51
- 2. `/new` - Start new session (clean context)
52
- 3. `/vibe.spec.review` - GPT/Gemini review (3-round mandatory)
53
- 4. `/vibe.run` - Implementation + Gemini review
54
- 5. **(auto)** 13+ agent parallel review
55
- 6. **(auto)** P1/P2 issue auto-fix
56
-
57
- ## Plan Mode vs VIBE (Workflow Selection)
58
-
59
- **Offer choice to user on development requests:**
60
-
61
- | Task Size | Recommended |
62
- |-----------|-------------|
63
- | Simple changes (1-2 files) | Plan Mode |
64
- | Complex features (3+ files, research/verification needed) | `/vibe.spec` |
65
-
66
- | Item | Plan Mode | VIBE |
67
- |------|-----------|------|
68
- | Storage location | `~/.claude/plans/` (global) | `.claude/vibe/specs/` (project) |
69
- | Document format | Free form | PTCF structure (AI-optimized) |
70
- | Research | None | 4 parallel agents |
71
- | Verification | None | `/vibe.verify` against SPEC |
72
- | History | Not trackable | Git version control |
73
-
74
- **Rules:**
75
- - After `/vibe.analyze` or `/vibe.review` with dev/modify request → **Ask user for workflow choice**
76
- - User chooses VIBE → Wait for `/vibe.spec`
77
- - User chooses Plan Mode → Proceed with EnterPlanMode
78
-
79
- ## ULTRAWORK Mode (Recommended)
80
-
81
- Include `ultrawork` or `ulw` keyword to activate maximum performance mode:
82
-
83
- ```bash
84
- /vibe.run "feature-name" ultrawork # All optimizations auto-enabled
85
- /vibe.run "feature-name" ulw # Same (shorthand)
86
- ```
87
-
88
- **Activated Features:**
89
- - Parallel sub-agent exploration (3+ concurrent)
90
- - **Background agents** - Prepare next Phase during implementation
91
- - **Phase pipelining** - Remove wait time between Phases
92
- - Boulder Loop (auto-continue until all Phases complete)
93
- - Auto-retry on error (max 3 times)
94
- - Auto-compress/save at 70%+ context
95
- - Continuous execution without confirmation between Phases
96
-
97
- **Speed Comparison:**
98
-
99
- | Mode | Per Phase | 5 Phases |
100
- |------|-----------|----------|
101
- | Sequential | ~2min | ~10min |
102
- | Parallel Exploration | ~1.5min | ~7.5min |
103
- | **ULTRAWORK Pipeline** | **~1min** | **~5min** |
104
-
105
- ## Commands
106
-
107
- | Command | Description |
108
- |---------|-------------|
109
- | `/vibe.spec "feature-name"` | Write SPEC (PTCF structure) + parallel research |
110
- | `/vibe.spec.review "feature-name"` | **GPT/Gemini review** (run in new session) |
111
- | `/vibe.run "feature-name"` | Execute implementation |
112
- | `/vibe.run "feature-name" ultrawork` | **Maximum performance mode** |
113
- | `/vibe.verify "feature-name"` | Verification |
114
- | `/vibe.review` | **Parallel code review** (13+ agents) |
115
- | `/vibe.reason "problem"` | Systematic reasoning |
116
- | `/vibe.analyze` | Project analysis |
117
- | `/vibe.utils --e2e` | E2E testing (Playwright) |
118
- | `/vibe.utils --diagram` | Generate diagrams |
119
- | `/vibe.utils --ui "description"` | UI preview |
120
- | `/vibe.utils --continue` | **Session restore** (load previous context) |
121
-
122
- ## New Features (v2.6.x)
123
-
124
- ### Structured User Questions (v2.6.1)
125
-
126
- Use `askUser` tool for critical requirements that must not be missed:
127
-
128
- ```typescript
129
- import { askUser, askUserQuick } from '@su-record/vibe/tools';
130
-
131
- // Quick helper for login features
132
- const result = await askUserQuick.login('my-login');
133
-
134
- // Custom categories
135
- const result = await askUser({
136
- featureName: 'dashboard',
137
- categories: ['authentication', 'security', 'session'],
138
- });
139
- ```
140
-
141
- **Available categories:**
142
- | Category | Questions |
143
- |----------|-----------|
144
- | `authentication` | Auth method, MFA |
145
- | `security` | Password policy, rate limit |
146
- | `session` | Duration, concurrent login |
147
- | `data_model` | Profile fields |
148
- | `performance` | Response time targets |
149
- | `integration` | External services |
150
-
151
- **When to use:**
152
- - ✅ Critical: auth, security, session → `askUser`
153
- - ❌ Exploratory: scope, style → Natural conversation
154
- - ⚠️ ultrawork mode: skipped (uses defaults)
155
-
156
- ### Fire-and-Forget Background Manager
157
-
158
- Launch background agents without blocking, with automatic concurrency control:
159
-
160
- ```typescript
161
- import { launch, poll, cancel, getStats } from '@su-record/vibe/orchestrator';
162
-
163
- // Fire-and-forget - returns immediately (<100ms)
164
- const { taskId } = launch({
165
- prompt: 'Analyze codebase',
166
- agentName: 'analyzer',
167
- model: 'claude-sonnet-4-5',
168
- });
169
-
170
- // Poll for result later
171
- const result = await poll(taskId);
172
-
173
- // Check queue stats
174
- const stats = getStats();
175
- ```
176
-
177
- **Concurrency limits:**
178
-
179
- | Model | Limit |
180
- |-------|-------|
181
- | claude-opus-4 | 3 |
182
- | claude-sonnet-4-5 | 5 |
183
- | claude-haiku-* | 8 |
184
-
185
- **Error types:**
186
- - `QueueOverflowError`: Queue at capacity (100 tasks max)
187
- - `TaskTimeoutError`: Task exceeded 3 minutes
188
- - `PipelineTimeoutError`: Pipeline exceeded 10 minutes
189
- - `AgentExecutionError`: Agent execution failed
190
-
191
- ### Phase Pipelining
192
-
193
- Remove wait time between phases with background preparation:
194
-
195
- ```typescript
196
- import { PhasePipeline, createStage, createUltraworkPipeline } from '@su-record/vibe/orchestrator';
197
-
198
- const pipeline = createUltraworkPipeline('my-feature', [
199
- createStage('Setup', async (ctx) => { /* ... */ }),
200
- createStage('Core', async (ctx) => { /* ... */ }),
201
- createStage('Test', async (ctx) => { /* ... */ }),
202
- ]);
203
-
204
- const result = await pipeline.execute();
205
- // Next phase preparation happens during current phase execution!
206
- ```
207
-
208
- ### PRD-to-SPEC Automation
209
-
210
- Generate SPEC documents from PRD (Product Requirements Document):
211
-
212
- ```typescript
213
- import { parsePRD, generateSpecFromPRD } from '@su-record/vibe/tools';
214
-
215
- // Parse PRD document
216
- const prd = parsePRD(prdContent, 'login');
217
-
218
- // Generate SPEC
219
- const spec = generateSpecFromPRD(prd, {
220
- techStack: { frontend: 'React', backend: 'Node.js' },
221
- });
222
- ```
223
-
224
- **Supported PRD formats:**
225
- - Markdown with `## Requirements` sections
226
- - YAML frontmatter with `requirements:` array
227
- - Mixed format
228
-
229
- ### Requirements Traceability Matrix (/vibe.trace)
230
-
231
- Track requirements coverage across SPEC → Feature → Test:
232
-
233
- ```bash
234
- /vibe.trace "login" # Generate RTM
235
- /vibe.trace "login" --html # HTML output
236
- /vibe.trace "login" --save # Save to file
237
- ```
238
-
239
- ```typescript
240
- import { generateTraceabilityMatrix, formatMatrixAsMarkdown } from '@su-record/vibe/tools';
241
-
242
- const matrix = generateTraceabilityMatrix('login');
243
- const markdown = formatMatrixAsMarkdown(matrix);
244
- ```
245
-
246
- **Coverage levels:**
247
- | Level | Meaning |
248
- |-------|---------|
249
- | Full (✅) | SPEC + Feature + Test all mapped |
250
- | Partial (⚠️) | Missing one or more mappings |
251
- | None (❌) | Only in SPEC |
252
-
253
- ### SPEC Versioning
254
-
255
- Git-integrated version control for SPEC documents:
256
-
257
- ```typescript
258
- import { bumpSpecVersion, createGitTag, generateChangelog } from '@su-record/vibe/tools';
259
-
260
- // Bump version (major/minor/patch)
261
- const newVersion = bumpSpecVersion(specPath, 'minor', [
262
- { type: 'added', description: 'New login feature' },
263
- ]);
264
-
265
- // Create git tag
266
- createGitTag('login', newVersion.version);
267
-
268
- // Generate changelog
269
- const changelog = generateChangelog(versionHistory);
270
- ```
271
-
272
- ## Previous Features (v2.5.15)
273
-
274
- ### Rule Build System
275
-
276
- Compile individual rule files into consolidated AGENTS.md:
277
-
278
- ```typescript
279
- import { buildRulesDocument, extractTestCasesFromDir } from '@su-record/vibe/tools';
280
-
281
- // Build rules from directory
282
- await buildRulesDocument('./rules', './AGENTS.md', {
283
- version: '1.0.0',
284
- title: 'Code Quality Rules',
285
- abstract: 'Guidelines for code quality',
286
- });
287
-
288
- // Extract test cases for LLM evaluation
289
- await extractTestCasesFromDir('./rules', './test-cases.json');
290
- ```
291
-
292
- **Rule file structure:**
293
- ```markdown
294
- ---
295
- title: Rule Title
296
- impact: CRITICAL
297
- tags: security, performance
298
- ---
299
-
300
- ## Rule Title
301
-
302
- Explanation of the rule.
303
-
304
- **Incorrect:**
305
- \`\`\`typescript
306
- // Bad code
307
- \`\`\`
308
-
309
- **Correct:**
310
- \`\`\`typescript
311
- // Good code
312
- \`\`\`
313
- ```
314
-
315
- ### Impact-Based Classification
316
-
317
- Rules are classified by impact level:
318
-
319
- | Level | Color | Priority |
320
- |-------|-------|----------|
321
- | CRITICAL | 🔴 Red | 0 (highest) |
322
- | HIGH | 🟡 Yellow | 1 |
323
- | MEDIUM-HIGH | 🟡 Yellow | 2 |
324
- | MEDIUM | 🔵 Cyan | 3 |
325
- | LOW-MEDIUM | 🔵 Cyan | 4 |
326
- | LOW | 🟢 Green | 5 |
327
-
328
- ### Framework Auto-Detection
329
-
330
- Automatically detect project framework from package.json:
331
-
332
- ```typescript
333
- import { detectFramework, getFrameworkRecommendations } from '@su-record/vibe/tools';
334
-
335
- const result = await detectFramework('./my-project');
336
- // { framework: { id: 'nextjs', name: 'Next.js', category: 'fullstack' }, ... }
337
-
338
- const recs = getFrameworkRecommendations(result.framework);
339
- // { reviewers: ['react-reviewer'], rules: ['react-*'], features: ['ssr'] }
340
- ```
341
-
342
- **Supported frameworks (40+):**
343
- - Fullstack: Next.js, Remix, Nuxt, SvelteKit, Astro, RedwoodJS
344
- - Frontend: React, Vue, Svelte, Angular, Preact
345
- - Backend: NestJS, Express, Fastify, Hono, Elysia
346
- - Docs: Docusaurus, VitePress, Eleventy
347
-
348
- ### Test Case Extraction
349
-
350
- Extract good/bad examples from rules for LLM evaluation:
351
-
352
- ```typescript
353
- import { extractTestCases, validateRule } from '@su-record/vibe/tools';
354
-
355
- const testCases = extractTestCases(rules);
356
- // [{ ruleId: '1.1', type: 'bad', code: '...', ... }]
357
-
358
- const validation = validateRule(rule);
359
- // { valid: true, errors: [] }
360
- ```
361
-
362
- ## Previous Features (v2.5.7-v2.5.11)
363
-
364
- ### Intelligent Model Routing
365
-
366
- Automatic model selection based on task complexity:
367
-
368
- | Complexity | Model | When |
369
- |------------|-------|------|
370
- | Low (0-7) | Haiku | Simple fixes, searches |
371
- | Medium (8-19) | Sonnet | Standard features, 3-5 files |
372
- | High (20+) | Opus | Architecture, security, 6+ files |
373
-
374
- ### Agent Tier System
375
-
376
- Cost-optimized agent variants:
377
-
378
- | Agent | Low | Medium | High |
379
- |-------|-----|--------|------|
380
- | explorer | explorer-low | explorer-medium | explorer |
381
- | implementer | implementer-low | implementer-medium | implementer |
382
- | architect | architect-low | architect-medium | architect |
383
-
384
- ### Magic Keywords
385
-
386
- | Keyword | Effect |
387
- |---------|--------|
388
- | `ultrawork` / `ulw` | Parallel + auto-continue + Ralph Loop |
389
- | `ralph` | **Ralph Loop**: Iterate until 100% complete (no scope reduction) |
390
- | `ralplan` | Iterative planning + persistence |
391
- | `verify` | Strict verification mode |
392
- | `quick` | Fast mode, minimal verification |
393
-
394
- **Combinations supported:** `ralph ultrawork`, `ralph verify`, etc.
395
-
396
- **Ralph Loop** (from [ghuntley.com/ralph](https://ghuntley.com/ralph)):
397
-
398
- - Compares ORIGINAL request vs current implementation
399
- - Lists ALL missing items explicitly
400
- - Iterates until 100% complete (max 5 iterations)
401
- - **ZERO tolerance for scope reduction** - Never say "basic version" or "simplified"
402
-
403
- ### Skill Quality Gate
404
-
405
- Memory saves are validated for quality:
406
-
407
- - Rejects generic/searchable information
408
- - Requires context, specificity, actionability
409
- - Suggests principle format: "When X, do Y because Z"
410
-
411
- ### HUD Status (Real-time)
412
-
413
- ```bash
414
- node hooks/scripts/hud-status.js show full
415
- node hooks/scripts/hud-status.js start ultrawork "feature"
416
- node hooks/scripts/hud-status.js phase 2 5 "Implementing core"
417
- ```
418
-
419
- ### Pre/Post Tool Hooks
420
-
421
- - **PreToolUse**: Validates dangerous commands before execution
422
- - **PostToolUse**: Provides error recovery hints
423
-
424
- ### Orchestrate Workflow
425
-
426
- Intent Gate → Codebase Assessment → Delegation → Verification pattern:
427
-
428
- ```typescript
429
- import { checkIntentGate, assessCodebase, createDelegationPlan } from '@su-record/vibe/tools';
430
- ```
431
-
432
- ### UltraQA (5-Cycle Autonomous QA)
433
-
434
- ```
435
- Test/Build/Lint Fail → Architect Diagnosis → Executor Fix → Repeat (max 5)
436
- ```
437
-
438
- Exit conditions: All pass, Max cycles, Same failure 3x
439
-
440
- ### DeepInit (Hierarchical AGENTS.md)
441
-
442
- ```
443
- project/
444
- ├── AGENTS.md ← Root
445
- ├── src/
446
- │ └── AGENTS.md ← <!-- Parent: ../AGENTS.md -->
447
- ```
448
-
449
- ### Skill Frontmatter System
450
-
451
- ```yaml
452
- ---
453
- name: my-skill
454
- model: sonnet
455
- triggers: [keyword1, keyword2]
456
- ---
457
- ```
458
-
459
- ### Trigger-Based Skill Injection
460
-
461
- Skills in `~/.claude/vibe/skills/` or `.claude/vibe/skills/` auto-inject on keyword match.
462
-
463
- ### Multi-Line HUD
464
-
465
- ```bash
466
- node hooks/scripts/hud-multiline.js multi # Tree view
467
- node hooks/scripts/hud-multiline.js compact # 2-line view
468
- node hooks/scripts/hud-multiline.js single # 1-line view
469
- ```
470
-
471
- ### Parallel Code Review (/vibe.review)
472
-
473
- 13+ specialized agents review code simultaneously:
474
-
475
- - Security: security-reviewer, data-integrity-reviewer
476
- - Performance: performance-reviewer, complexity-reviewer
477
- - Architecture: architecture-reviewer, simplicity-reviewer
478
- - Language-Specific: python, typescript, rails, react reviewers
479
- - Context: git-history, test-coverage reviewers
480
-
481
- **Priority System:**
482
- - 🔴 P1 (Critical): Blocks merge
483
- - 🟡 P2 (Important): Fix recommended
484
- - 🔵 P3 (Nice-to-have): Backlog
485
-
486
- ### E2E Testing (/vibe.utils --e2e)
487
-
488
- Playwright-based automated testing:
489
-
490
- ```bash
491
- /vibe.utils --e2e "login flow" # Scenario test
492
- /vibe.utils --e2e --visual # Visual regression test
493
- /vibe.utils --e2e --record # Video recording
494
- ```
495
-
496
- ### Enhanced Research Agents
497
-
498
- 4 parallel research agents run **after requirements confirmed** during `/vibe.spec`:
499
-
500
- | Agent | Role |
501
- |-------|------|
502
- | best-practices-agent | Best practices for confirmed feature+stack |
503
- | framework-docs-agent | Latest docs for confirmed stack (context7) |
504
- | codebase-patterns-agent | Analyze existing similar patterns |
505
- | security-advisory-agent | Security advisory for confirmed feature |
506
-
507
- ## PTCF Structure
508
-
509
- SPEC documents are AI-executable prompt format:
510
-
511
- ```
512
- <role> AI role definition
513
- <context> Background, tech stack, related code
514
- <task> Phase-by-phase task list
515
- <constraints> Constraints
516
- <output_format> Files to create/modify
517
- <acceptance> Verification criteria
518
- ```
519
-
520
- ## Built-in Tools
521
-
522
- ### Semantic Code Analysis
523
- | Tool | Purpose |
524
- |------|---------|
525
- | `vibe_find_symbol` | Find symbol definitions |
526
- | `vibe_find_references` | Find references |
527
- | `vibe_analyze_complexity` | Analyze complexity |
528
- | `vibe_validate_code_quality` | Validate quality |
529
-
530
- ### Context Management
531
- | Tool | Purpose |
532
- |------|---------|
533
- | `vibe_start_session` | Start session (restore previous context) |
534
- | `vibe_auto_save_context` | Save current state |
535
- | `vibe_save_memory` | Save important decisions |
536
-
537
- ## Agents
538
-
539
- ### Review Agents (12)
540
- ```
541
- .claude/agents/review/
542
- ├── security-reviewer.md # Security vulnerabilities
543
- ├── performance-reviewer.md # Performance bottlenecks
544
- ├── architecture-reviewer.md # Architecture violations
545
- ├── complexity-reviewer.md # Complexity exceeded
546
- ├── simplicity-reviewer.md # Over-abstraction
547
- ├── data-integrity-reviewer.md # Data integrity
548
- ├── test-coverage-reviewer.md # Missing tests
549
- ├── git-history-reviewer.md # Risk patterns
550
- ├── python-reviewer.md # Python specialist
551
- ├── typescript-reviewer.md # TypeScript specialist
552
- ├── rails-reviewer.md # Rails specialist
553
- └── react-reviewer.md # React specialist
554
- ```
555
-
556
- ### Research Agents (4)
557
- ```
558
- .claude/agents/research/
559
- ├── best-practices-agent.md # Best practices
560
- ├── framework-docs-agent.md # Framework docs
561
- ├── codebase-patterns-agent.md # Code pattern analysis
562
- └── security-advisory-agent.md # Security advisory
563
- ```
564
-
565
- ## Skills
566
-
567
- ### Git Worktree
568
- ```bash
569
- # Isolated environment for PR review
570
- git worktree add ../review-123 origin/pr/123
571
- cd ../review-123 && npm test
572
- git worktree remove ../review-123
573
- ```
574
-
575
- ### Priority Todos
576
- ```
577
- .claude/vibe/todos/
578
- ├── P1-security-sql-injection.md # 🔴 Blocks merge
579
- ├── P2-perf-n1-query.md # 🟡 Fix recommended
580
- └── P3-style-extract-helper.md # 🔵 Backlog
581
- ```
582
-
583
- ## Context Management Strategy
584
-
585
- ### Model Selection
586
- - **Exploration/Search**: Haiku (sub-agent default)
587
- - **Implementation/Debugging**: Sonnet
588
- - **Architecture/Complex logic**: Opus
589
-
590
- ### At 70%+ Context (⚠️ Important)
591
- ```
592
- ❌ Don't use /compact (risk of information loss/distortion)
593
- ✅ save_memory to store important decisions → /new for new session
594
- ```
595
-
596
- vibe maintains context across sessions with its own memory system:
597
- 1. `save_memory` - Explicitly save important decisions
598
- 2. `/new` - Start new session
599
- 3. `start_session` - Auto-restore previous session
600
-
601
- ### Session Restore
602
- To continue previous work in a new session:
603
- ```
604
- /vibe.utils --continue
605
- ```
606
- This command calls `vibe_start_session` to restore previous context from project memory.
607
-
608
- ### Other Commands
609
- - `/rewind` - Revert to previous point
610
- - `/context` - Check current usage
611
-
612
- ### Using context7
613
- Use context7 plugin when you need latest library documentation:
614
- ```
615
- "Search React 19 use() hook with context7"
616
- ```
617
-
618
- ## Documentation Guidelines
619
-
620
- ### Diagrams/Structure Representation
621
- - Avoid ASCII boxes (┌─┐) → Alignment breaks with mixed-width characters
622
- - Use alternatives:
623
- - Mermaid diagrams (GitHub/Notion supported)
624
- - Markdown tables
625
- - Indentation + separators
626
-
627
- ### Preferred Formats
628
- | Purpose | Recommended |
629
- |---------|-------------|
630
- | Flowcharts | Mermaid flowchart |
631
- | Structure/Hierarchy | Indented lists |
632
- | Comparisons/Lists | Markdown tables |
633
- | Sequences | Mermaid sequenceDiagram |
634
-
635
- ## Git Commit Rules
636
-
637
- **Must include:**
638
- - `.claude/vibe/specs/`, `.claude/vibe/features/`, `.claude/vibe/todos/` (project docs)
639
- - `.claude/vibe/config.json`, `.claude/vibe/constitution.md` (project config)
640
- - `CLAUDE.md`
641
-
642
- **Exclude (globally installed):**
643
- - `~/.claude/vibe/rules/`, `~/.claude/vibe/languages/`, `~/.claude/vibe/templates/` (global)
644
- - `~/.claude/commands/`, `~/.claude/agents/`, `~/.claude/skills/` (global)
645
- - `.claude/settings.local.json` (personal settings)
646
-
647
- ## Getting Started
648
-
649
- ```bash
650
- vibe init
651
- /vibe.spec "login feature"
652
- ```
653
-
654
- ## Full Workflow
655
-
656
- ```mermaid
657
- flowchart TD
658
- A["/vibe.spec"] --> B["(auto) SPEC review"]
659
- B --> C["SPEC auto-enhancement"]
660
- C --> D["/vibe.run ultrawork"]
661
- D --> E["Gemini code review"]
662
- E --> F["(auto) 13+ Agent Review"]
663
- F --> G{"P1/P2 issues?"}
664
- G -->|Yes| H["(auto) Auto-Fix"]
665
- H --> I["✅ Done"]
666
- G -->|No| I
667
- ```
668
-
669
- | Step | Description | Automation |
670
- |------|-------------|------------|
671
- | 1. `/vibe.spec` | Collect requirements + Generate SPEC | Manual start |
672
- | 2. SPEC review | Gemini reviews SPEC + Auto-apply | ✅ Auto |
673
- | 3. `/vibe.run` | Implementation + Gemini review | Manual start |
674
- | 4. Agent Review | 13+ agent parallel review | ✅ Auto |
675
- | 5. Auto-Fix | P1/P2 issue auto-fix | ✅ Auto |
1
+ # VIBE
2
+
3
+ SPEC-driven AI Coding Framework (Claude Code Exclusive)
4
+
5
+ ## Response Language
6
+
7
+ **IMPORTANT: Always respond in Korean (한국어) unless the user explicitly requests otherwise.**
8
+
9
+ ## Code Quality Standards (Mandatory)
10
+
11
+ Follow these standards when writing code. See `~/.claude/vibe/rules/` (global) for detailed rules.
12
+
13
+ ### Core Principles
14
+ - **Modify only requested scope** - Don't touch unrelated code
15
+ - **Preserve existing style** - Follow project conventions
16
+ - **Keep working code** - No unnecessary refactoring
17
+ - **Respect user interrupts** - If user interrupts (Ctrl+C/Escape) and sends a new message, the previous task is CANCELLED. Do NOT resume or continue interrupted work. Respond ONLY to the new message.
18
+
19
+ ### Code Complexity Limits
20
+ | Metric | Limit |
21
+ |--------|-------|
22
+ | Function length | ≤30 lines (recommended), ≤50 lines (allowed) |
23
+ | Nesting depth | ≤3 levels |
24
+ | Parameters | ≤5 |
25
+ | Cyclomatic complexity | ≤10 |
26
+
27
+ ### TypeScript Rules
28
+ - No `any` type → Use `unknown` + type guards
29
+ - No `as any` casting → Define proper interfaces
30
+ - No `@ts-ignore` Fix type issues at root
31
+ - Explicit return types on all functions
32
+
33
+ ### TypeScript Rules
34
+ - No `any` type → use `unknown` + type guards
35
+ - No `as any` casting define proper interfaces
36
+ - No `@ts-ignore`fix type issues at root
37
+ - Explicit return types on all functions
38
+
39
+ ### TypeScript Rules
40
+ - No `any` type → use `unknown` + type guards
41
+ - No `as any` casting → define proper interfaces
42
+ - No `@ts-ignore` → fix type issues at root
43
+ - Explicit return types on all functions
44
+
45
+ ### Error Handling Required
46
+ - try-catch or error state required
47
+ - Loading state handling
48
+ - User-friendly error messages
49
+
50
+ ### Forbidden Patterns
51
+ - No console.log in commits (remove after debugging)
52
+ - No hardcoded strings/numbers Extract to constants
53
+ - No commented-out code in commits
54
+ - No incomplete code without TODO
55
+
56
+ ## Workflow
57
+
58
+ ```
59
+ /vibe.spec /new /vibe.spec.review /vibe.run → /vibe.trace → (auto) code review → ✅ Done
60
+
61
+ Coverage check (v2.6)
62
+ ```
63
+
64
+ **Flow:**
65
+
66
+ 1. `/vibe.spec` - Write SPEC (requirements + research + draft)
67
+ 2. `/new` - Start new session (clean context)
68
+ 3. `/vibe.spec.review` - GPT/Gemini review (3-round mandatory)
69
+ 4. `/vibe.run` - Implementation + Gemini review
70
+ 5. **(auto)** 13+ agent parallel review
71
+ 6. **(auto)** P1/P2 issue auto-fix
72
+
73
+ ## Plan Mode vs VIBE (Workflow Selection)
74
+
75
+ **Offer choice to user on development requests:**
76
+
77
+ | Task Size | Recommended |
78
+ |-----------|-------------|
79
+ | Simple changes (1-2 files) | Plan Mode |
80
+ | Complex features (3+ files, research/verification needed) | `/vibe.spec` |
81
+
82
+ | Item | Plan Mode | VIBE |
83
+ |------|-----------|------|
84
+ | Storage location | `~/.claude/plans/` (global) | `.claude/vibe/specs/` (project) |
85
+ | Document format | Free form | PTCF structure (AI-optimized) |
86
+ | Research | None | 4 parallel agents |
87
+ | Verification | None | `/vibe.verify` against SPEC |
88
+ | History | Not trackable | Git version control |
89
+
90
+ **Rules:**
91
+ - After `/vibe.analyze` or `/vibe.review` with dev/modify request → **Ask user for workflow choice**
92
+ - User chooses VIBE Wait for `/vibe.spec`
93
+ - User chooses Plan Mode Proceed with EnterPlanMode
94
+
95
+ ## ULTRAWORK Mode (Recommended)
96
+
97
+ Include `ultrawork` or `ulw` keyword to activate maximum performance mode:
98
+
99
+ ```bash
100
+ /vibe.run "feature-name" ultrawork # All optimizations auto-enabled
101
+ /vibe.run "feature-name" ulw # Same (shorthand)
102
+ ```
103
+
104
+ **Activated Features:**
105
+ - Parallel sub-agent exploration (3+ concurrent)
106
+ - **Background agents** - Prepare next Phase during implementation
107
+ - **Phase pipelining** - Remove wait time between Phases
108
+ - Boulder Loop (auto-continue until all Phases complete)
109
+ - Auto-retry on error (max 3 times)
110
+ - Auto-compress/save at 70%+ context
111
+ - Continuous execution without confirmation between Phases
112
+
113
+ **Speed Comparison:**
114
+
115
+ | Mode | Per Phase | 5 Phases |
116
+ |------|-----------|----------|
117
+ | Sequential | ~2min | ~10min |
118
+ | Parallel Exploration | ~1.5min | ~7.5min |
119
+ | **ULTRAWORK Pipeline** | **~1min** | **~5min** |
120
+
121
+ ## Commands
122
+
123
+ | Command | Description |
124
+ |---------|-------------|
125
+ | `/vibe.spec "feature-name"` | Write SPEC (PTCF structure) + parallel research |
126
+ | `/vibe.spec.review "feature-name"` | **GPT/Gemini review** (run in new session) |
127
+ | `/vibe.run "feature-name"` | Execute implementation |
128
+ | `/vibe.run "feature-name" ultrawork` | **Maximum performance mode** |
129
+ | `/vibe.verify "feature-name"` | Verification |
130
+ | `/vibe.review` | **Parallel code review** (13+ agents) |
131
+ | `/vibe.reason "problem"` | Systematic reasoning |
132
+ | `/vibe.analyze` | Project analysis |
133
+ | `/vibe.utils --e2e` | E2E testing (Playwright) |
134
+ | `/vibe.utils --diagram` | Generate diagrams |
135
+ | `/vibe.utils --ui "description"` | UI preview |
136
+ | `/vibe.utils --continue` | **Session restore** (load previous context) |
137
+
138
+ ## New Features (v2.6.x)
139
+
140
+ ### Structured User Questions (v2.6.1)
141
+
142
+ Use `askUser` tool for critical requirements that must not be missed:
143
+
144
+ ```typescript
145
+ import { askUser, askUserQuick } from '@su-record/vibe/tools';
146
+
147
+ // Quick helper for login features
148
+ const result = await askUserQuick.login('my-login');
149
+
150
+ // Custom categories
151
+ const result = await askUser({
152
+ featureName: 'dashboard',
153
+ categories: ['authentication', 'security', 'session'],
154
+ });
155
+ ```
156
+
157
+ **Available categories:**
158
+ | Category | Questions |
159
+ |----------|-----------|
160
+ | `authentication` | Auth method, MFA |
161
+ | `security` | Password policy, rate limit |
162
+ | `session` | Duration, concurrent login |
163
+ | `data_model` | Profile fields |
164
+ | `performance` | Response time targets |
165
+ | `integration` | External services |
166
+
167
+ **When to use:**
168
+ - ✅ Critical: auth, security, session → `askUser`
169
+ - ❌ Exploratory: scope, style → Natural conversation
170
+ - ⚠️ ultrawork mode: skipped (uses defaults)
171
+
172
+ ### Fire-and-Forget Background Manager
173
+
174
+ Launch background agents without blocking, with automatic concurrency control:
175
+
176
+ ```typescript
177
+ import { launch, poll, cancel, getStats } from '@su-record/vibe/orchestrator';
178
+
179
+ // Fire-and-forget - returns immediately (<100ms)
180
+ const { taskId } = launch({
181
+ prompt: 'Analyze codebase',
182
+ agentName: 'analyzer',
183
+ model: 'claude-sonnet-4-5',
184
+ });
185
+
186
+ // Poll for result later
187
+ const result = await poll(taskId);
188
+
189
+ // Check queue stats
190
+ const stats = getStats();
191
+ ```
192
+
193
+ **Concurrency limits:**
194
+
195
+ | Model | Limit |
196
+ |-------|-------|
197
+ | claude-opus-4 | 3 |
198
+ | claude-sonnet-4-5 | 5 |
199
+ | claude-haiku-* | 8 |
200
+
201
+ **Error types:**
202
+ - `QueueOverflowError`: Queue at capacity (100 tasks max)
203
+ - `TaskTimeoutError`: Task exceeded 3 minutes
204
+ - `PipelineTimeoutError`: Pipeline exceeded 10 minutes
205
+ - `AgentExecutionError`: Agent execution failed
206
+
207
+ ### Phase Pipelining
208
+
209
+ Remove wait time between phases with background preparation:
210
+
211
+ ```typescript
212
+ import { PhasePipeline, createStage, createUltraworkPipeline } from '@su-record/vibe/orchestrator';
213
+
214
+ const pipeline = createUltraworkPipeline('my-feature', [
215
+ createStage('Setup', async (ctx) => { /* ... */ }),
216
+ createStage('Core', async (ctx) => { /* ... */ }),
217
+ createStage('Test', async (ctx) => { /* ... */ }),
218
+ ]);
219
+
220
+ const result = await pipeline.execute();
221
+ // Next phase preparation happens during current phase execution!
222
+ ```
223
+
224
+ ### PRD-to-SPEC Automation
225
+
226
+ Generate SPEC documents from PRD (Product Requirements Document):
227
+
228
+ ```typescript
229
+ import { parsePRD, generateSpecFromPRD } from '@su-record/vibe/tools';
230
+
231
+ // Parse PRD document
232
+ const prd = parsePRD(prdContent, 'login');
233
+
234
+ // Generate SPEC
235
+ const spec = generateSpecFromPRD(prd, {
236
+ techStack: { frontend: 'React', backend: 'Node.js' },
237
+ });
238
+ ```
239
+
240
+ **Supported PRD formats:**
241
+ - Markdown with `## Requirements` sections
242
+ - YAML frontmatter with `requirements:` array
243
+ - Mixed format
244
+
245
+ ### Requirements Traceability Matrix (/vibe.trace)
246
+
247
+ Track requirements coverage across SPEC → Feature → Test:
248
+
249
+ ```bash
250
+ /vibe.trace "login" # Generate RTM
251
+ /vibe.trace "login" --html # HTML output
252
+ /vibe.trace "login" --save # Save to file
253
+ ```
254
+
255
+ ```typescript
256
+ import { generateTraceabilityMatrix, formatMatrixAsMarkdown } from '@su-record/vibe/tools';
257
+
258
+ const matrix = generateTraceabilityMatrix('login');
259
+ const markdown = formatMatrixAsMarkdown(matrix);
260
+ ```
261
+
262
+ **Coverage levels:**
263
+ | Level | Meaning |
264
+ |-------|---------|
265
+ | Full (✅) | SPEC + Feature + Test all mapped |
266
+ | Partial (⚠️) | Missing one or more mappings |
267
+ | None (❌) | Only in SPEC |
268
+
269
+ ### SPEC Versioning
270
+
271
+ Git-integrated version control for SPEC documents:
272
+
273
+ ```typescript
274
+ import { bumpSpecVersion, createGitTag, generateChangelog } from '@su-record/vibe/tools';
275
+
276
+ // Bump version (major/minor/patch)
277
+ const newVersion = bumpSpecVersion(specPath, 'minor', [
278
+ { type: 'added', description: 'New login feature' },
279
+ ]);
280
+
281
+ // Create git tag
282
+ createGitTag('login', newVersion.version);
283
+
284
+ // Generate changelog
285
+ const changelog = generateChangelog(versionHistory);
286
+ ```
287
+
288
+ ## Previous Features (v2.5.15)
289
+
290
+ ### Rule Build System
291
+
292
+ Compile individual rule files into consolidated AGENTS.md:
293
+
294
+ ```typescript
295
+ import { buildRulesDocument, extractTestCasesFromDir } from '@su-record/vibe/tools';
296
+
297
+ // Build rules from directory
298
+ await buildRulesDocument('./rules', './AGENTS.md', {
299
+ version: '1.0.0',
300
+ title: 'Code Quality Rules',
301
+ abstract: 'Guidelines for code quality',
302
+ });
303
+
304
+ // Extract test cases for LLM evaluation
305
+ await extractTestCasesFromDir('./rules', './test-cases.json');
306
+ ```
307
+
308
+ **Rule file structure:**
309
+ ```markdown
310
+ ---
311
+ title: Rule Title
312
+ impact: CRITICAL
313
+ tags: security, performance
314
+ ---
315
+
316
+ ## Rule Title
317
+
318
+ Explanation of the rule.
319
+
320
+ **Incorrect:**
321
+ \`\`\`typescript
322
+ // Bad code
323
+ \`\`\`
324
+
325
+ **Correct:**
326
+ \`\`\`typescript
327
+ // Good code
328
+ \`\`\`
329
+ ```
330
+
331
+ ### Impact-Based Classification
332
+
333
+ Rules are classified by impact level:
334
+
335
+ | Level | Color | Priority |
336
+ |-------|-------|----------|
337
+ | CRITICAL | 🔴 Red | 0 (highest) |
338
+ | HIGH | 🟡 Yellow | 1 |
339
+ | MEDIUM-HIGH | 🟡 Yellow | 2 |
340
+ | MEDIUM | 🔵 Cyan | 3 |
341
+ | LOW-MEDIUM | 🔵 Cyan | 4 |
342
+ | LOW | 🟢 Green | 5 |
343
+
344
+ ### Framework Auto-Detection
345
+
346
+ Automatically detect project framework from package.json:
347
+
348
+ ```typescript
349
+ import { detectFramework, getFrameworkRecommendations } from '@su-record/vibe/tools';
350
+
351
+ const result = await detectFramework('./my-project');
352
+ // { framework: { id: 'nextjs', name: 'Next.js', category: 'fullstack' }, ... }
353
+
354
+ const recs = getFrameworkRecommendations(result.framework);
355
+ // { reviewers: ['react-reviewer'], rules: ['react-*'], features: ['ssr'] }
356
+ ```
357
+
358
+ **Supported frameworks (40+):**
359
+ - Fullstack: Next.js, Remix, Nuxt, SvelteKit, Astro, RedwoodJS
360
+ - Frontend: React, Vue, Svelte, Angular, Preact
361
+ - Backend: NestJS, Express, Fastify, Hono, Elysia
362
+ - Docs: Docusaurus, VitePress, Eleventy
363
+
364
+ ### Test Case Extraction
365
+
366
+ Extract good/bad examples from rules for LLM evaluation:
367
+
368
+ ```typescript
369
+ import { extractTestCases, validateRule } from '@su-record/vibe/tools';
370
+
371
+ const testCases = extractTestCases(rules);
372
+ // [{ ruleId: '1.1', type: 'bad', code: '...', ... }]
373
+
374
+ const validation = validateRule(rule);
375
+ // { valid: true, errors: [] }
376
+ ```
377
+
378
+ ## Previous Features (v2.5.7-v2.5.11)
379
+
380
+ ### Intelligent Model Routing
381
+
382
+ Automatic model selection based on task complexity:
383
+
384
+ | Complexity | Model | When |
385
+ |------------|-------|------|
386
+ | Low (0-7) | Haiku | Simple fixes, searches |
387
+ | Medium (8-19) | Sonnet | Standard features, 3-5 files |
388
+ | High (20+) | Opus | Architecture, security, 6+ files |
389
+
390
+ ### Agent Tier System
391
+
392
+ Cost-optimized agent variants:
393
+
394
+ | Agent | Low | Medium | High |
395
+ |-------|-----|--------|------|
396
+ | explorer | explorer-low | explorer-medium | explorer |
397
+ | implementer | implementer-low | implementer-medium | implementer |
398
+ | architect | architect-low | architect-medium | architect |
399
+
400
+ ### Magic Keywords
401
+
402
+ | Keyword | Effect |
403
+ |---------|--------|
404
+ | `ultrawork` / `ulw` | Parallel + auto-continue + Ralph Loop |
405
+ | `ralph` | **Ralph Loop**: Iterate until 100% complete (no scope reduction) |
406
+ | `ralplan` | Iterative planning + persistence |
407
+ | `verify` | Strict verification mode |
408
+ | `quick` | Fast mode, minimal verification |
409
+
410
+ **Combinations supported:** `ralph ultrawork`, `ralph verify`, etc.
411
+
412
+ **Ralph Loop** (from [ghuntley.com/ralph](https://ghuntley.com/ralph)):
413
+
414
+ - Compares ORIGINAL request vs current implementation
415
+ - Lists ALL missing items explicitly
416
+ - Iterates until 100% complete (max 5 iterations)
417
+ - **ZERO tolerance for scope reduction** - Never say "basic version" or "simplified"
418
+
419
+ ### Skill Quality Gate
420
+
421
+ Memory saves are validated for quality:
422
+
423
+ - Rejects generic/searchable information
424
+ - Requires context, specificity, actionability
425
+ - Suggests principle format: "When X, do Y because Z"
426
+
427
+ ### HUD Status (Real-time)
428
+
429
+ ```bash
430
+ node hooks/scripts/hud-status.js show full
431
+ node hooks/scripts/hud-status.js start ultrawork "feature"
432
+ node hooks/scripts/hud-status.js phase 2 5 "Implementing core"
433
+ ```
434
+
435
+ ### Pre/Post Tool Hooks
436
+
437
+ - **PreToolUse**: Validates dangerous commands before execution
438
+ - **PostToolUse**: Provides error recovery hints
439
+
440
+ ### Orchestrate Workflow
441
+
442
+ Intent Gate → Codebase Assessment → Delegation → Verification pattern:
443
+
444
+ ```typescript
445
+ import { checkIntentGate, assessCodebase, createDelegationPlan } from '@su-record/vibe/tools';
446
+ ```
447
+
448
+ ### UltraQA (5-Cycle Autonomous QA)
449
+
450
+ ```
451
+ Test/Build/Lint → Fail → Architect Diagnosis → Executor Fix → Repeat (max 5)
452
+ ```
453
+
454
+ Exit conditions: All pass, Max cycles, Same failure 3x
455
+
456
+ ### DeepInit (Hierarchical AGENTS.md)
457
+
458
+ ```
459
+ project/
460
+ ├── AGENTS.md ← Root
461
+ ├── src/
462
+ │ └── AGENTS.md ← <!-- Parent: ../AGENTS.md -->
463
+ ```
464
+
465
+ ### Skill Frontmatter System
466
+
467
+ ```yaml
468
+ ---
469
+ name: my-skill
470
+ model: sonnet
471
+ triggers: [keyword1, keyword2]
472
+ ---
473
+ ```
474
+
475
+ ### Trigger-Based Skill Injection
476
+
477
+ Skills in `~/.claude/vibe/skills/` or `.claude/vibe/skills/` auto-inject on keyword match.
478
+
479
+ ### Multi-Line HUD
480
+
481
+ ```bash
482
+ node hooks/scripts/hud-multiline.js multi # Tree view
483
+ node hooks/scripts/hud-multiline.js compact # 2-line view
484
+ node hooks/scripts/hud-multiline.js single # 1-line view
485
+ ```
486
+
487
+ ### Parallel Code Review (/vibe.review)
488
+
489
+ 13+ specialized agents review code simultaneously:
490
+
491
+ - Security: security-reviewer, data-integrity-reviewer
492
+ - Performance: performance-reviewer, complexity-reviewer
493
+ - Architecture: architecture-reviewer, simplicity-reviewer
494
+ - Language-Specific: python, typescript, rails, react reviewers
495
+ - Context: git-history, test-coverage reviewers
496
+
497
+ **Priority System:**
498
+ - 🔴 P1 (Critical): Blocks merge
499
+ - 🟡 P2 (Important): Fix recommended
500
+ - 🔵 P3 (Nice-to-have): Backlog
501
+
502
+ ### E2E Testing (/vibe.utils --e2e)
503
+
504
+ Playwright-based automated testing:
505
+
506
+ ```bash
507
+ /vibe.utils --e2e "login flow" # Scenario test
508
+ /vibe.utils --e2e --visual # Visual regression test
509
+ /vibe.utils --e2e --record # Video recording
510
+ ```
511
+
512
+ ### Enhanced Research Agents
513
+
514
+ 4 parallel research agents run **after requirements confirmed** during `/vibe.spec`:
515
+
516
+ | Agent | Role |
517
+ |-------|------|
518
+ | best-practices-agent | Best practices for confirmed feature+stack |
519
+ | framework-docs-agent | Latest docs for confirmed stack (context7) |
520
+ | codebase-patterns-agent | Analyze existing similar patterns |
521
+ | security-advisory-agent | Security advisory for confirmed feature |
522
+
523
+ ## PTCF Structure
524
+
525
+ SPEC documents are AI-executable prompt format:
526
+
527
+ ```
528
+ <role> AI role definition
529
+ <context> Background, tech stack, related code
530
+ <task> Phase-by-phase task list
531
+ <constraints> Constraints
532
+ <output_format> Files to create/modify
533
+ <acceptance> Verification criteria
534
+ ```
535
+
536
+ ## Built-in Tools
537
+
538
+ ### Semantic Code Analysis
539
+ | Tool | Purpose |
540
+ |------|---------|
541
+ | `vibe_find_symbol` | Find symbol definitions |
542
+ | `vibe_find_references` | Find references |
543
+ | `vibe_analyze_complexity` | Analyze complexity |
544
+ | `vibe_validate_code_quality` | Validate quality |
545
+
546
+ ### Context Management
547
+ | Tool | Purpose |
548
+ |------|---------|
549
+ | `vibe_start_session` | Start session (restore previous context) |
550
+ | `vibe_auto_save_context` | Save current state |
551
+ | `vibe_save_memory` | Save important decisions |
552
+
553
+ ## Agents
554
+
555
+ ### Review Agents (12)
556
+ ```
557
+ .claude/agents/review/
558
+ ├── security-reviewer.md # Security vulnerabilities
559
+ ├── performance-reviewer.md # Performance bottlenecks
560
+ ├── architecture-reviewer.md # Architecture violations
561
+ ├── complexity-reviewer.md # Complexity exceeded
562
+ ├── simplicity-reviewer.md # Over-abstraction
563
+ ├── data-integrity-reviewer.md # Data integrity
564
+ ├── test-coverage-reviewer.md # Missing tests
565
+ ├── git-history-reviewer.md # Risk patterns
566
+ ├── python-reviewer.md # Python specialist
567
+ ├── typescript-reviewer.md # TypeScript specialist
568
+ ├── rails-reviewer.md # Rails specialist
569
+ └── react-reviewer.md # React specialist
570
+ ```
571
+
572
+ ### Research Agents (4)
573
+ ```
574
+ .claude/agents/research/
575
+ ├── best-practices-agent.md # Best practices
576
+ ├── framework-docs-agent.md # Framework docs
577
+ ├── codebase-patterns-agent.md # Code pattern analysis
578
+ └── security-advisory-agent.md # Security advisory
579
+ ```
580
+
581
+ ## Skills
582
+
583
+ ### Git Worktree
584
+ ```bash
585
+ # Isolated environment for PR review
586
+ git worktree add ../review-123 origin/pr/123
587
+ cd ../review-123 && npm test
588
+ git worktree remove ../review-123
589
+ ```
590
+
591
+ ### Priority Todos
592
+ ```
593
+ .claude/vibe/todos/
594
+ ├── P1-security-sql-injection.md # 🔴 Blocks merge
595
+ ├── P2-perf-n1-query.md # 🟡 Fix recommended
596
+ └── P3-style-extract-helper.md # 🔵 Backlog
597
+ ```
598
+
599
+ ## Context Management Strategy
600
+
601
+ ### Model Selection
602
+ - **Exploration/Search**: Haiku (sub-agent default)
603
+ - **Implementation/Debugging**: Sonnet
604
+ - **Architecture/Complex logic**: Opus
605
+
606
+ ### At 70%+ Context (⚠️ Important)
607
+ ```
608
+ Don't use /compact (risk of information loss/distortion)
609
+ save_memory to store important decisions → /new for new session
610
+ ```
611
+
612
+ vibe maintains context across sessions with its own memory system:
613
+ 1. `save_memory` - Explicitly save important decisions
614
+ 2. `/new` - Start new session
615
+ 3. `start_session` - Auto-restore previous session
616
+
617
+ ### Session Restore
618
+ To continue previous work in a new session:
619
+ ```
620
+ /vibe.utils --continue
621
+ ```
622
+ This command calls `vibe_start_session` to restore previous context from project memory.
623
+
624
+ ### Other Commands
625
+ - `/rewind` - Revert to previous point
626
+ - `/context` - Check current usage
627
+
628
+ ### Using context7
629
+ Use context7 plugin when you need latest library documentation:
630
+ ```
631
+ "Search React 19 use() hook with context7"
632
+ ```
633
+
634
+ ## Documentation Guidelines
635
+
636
+ ### Diagrams/Structure Representation
637
+ - Avoid ASCII boxes (┌─┐) → Alignment breaks with mixed-width characters
638
+ - Use alternatives:
639
+ - Mermaid diagrams (GitHub/Notion supported)
640
+ - Markdown tables
641
+ - Indentation + separators
642
+
643
+ ### Preferred Formats
644
+ | Purpose | Recommended |
645
+ |---------|-------------|
646
+ | Flowcharts | Mermaid flowchart |
647
+ | Structure/Hierarchy | Indented lists |
648
+ | Comparisons/Lists | Markdown tables |
649
+ | Sequences | Mermaid sequenceDiagram |
650
+
651
+ ## Git Commit Rules
652
+
653
+ **Must include:**
654
+ - `.claude/vibe/specs/`, `.claude/vibe/features/`, `.claude/vibe/todos/` (project docs)
655
+ - `.claude/vibe/config.json`, `.claude/vibe/constitution.md` (project config)
656
+ - `CLAUDE.md`
657
+
658
+ **Exclude (globally installed):**
659
+ - `~/.claude/vibe/rules/`, `~/.claude/vibe/languages/`, `~/.claude/vibe/templates/` (global)
660
+ - `~/.claude/commands/`, `~/.claude/agents/`, `~/.claude/skills/` (global)
661
+ - `.claude/settings.local.json` (personal settings)
662
+
663
+ ## Getting Started
664
+
665
+ ```bash
666
+ vibe init
667
+ /vibe.spec "login feature"
668
+ ```
669
+
670
+ ## Full Workflow
671
+
672
+ ```mermaid
673
+ flowchart TD
674
+ A["/vibe.spec"] --> B["(auto) SPEC review"]
675
+ B --> C["SPEC auto-enhancement"]
676
+ C --> D["/vibe.run ultrawork"]
677
+ D --> E["Gemini code review"]
678
+ E --> F["(auto) 13+ Agent Review"]
679
+ F --> G{"P1/P2 issues?"}
680
+ G -->|Yes| H["(auto) Auto-Fix"]
681
+ H --> I["✅ Done"]
682
+ G -->|No| I
683
+ ```
684
+
685
+ | Step | Description | Automation |
686
+ |------|-------------|------------|
687
+ | 1. `/vibe.spec` | Collect requirements + Generate SPEC | Manual start |
688
+ | 2. SPEC review | Gemini reviews SPEC + Auto-apply | ✅ Auto |
689
+ | 3. `/vibe.run` | Implementation + Gemini review | Manual start |
690
+ | 4. Agent Review | 13+ agent parallel review | ✅ Auto |
691
+ | 5. Auto-Fix | P1/P2 issue auto-fix | ✅ Auto |
692
+
693
+ ---
694
+ title: Rule Title
695
+ impact: CRITICAL
696
+ tags: security, performance
697
+ ---
698
+
699
+ ## Rule Title
700
+
701
+ Explanation of the rule.
702
+
703
+ **Incorrect:**
704
+ \`\`\`typescript
705
+ // Bad code
706
+ \`\`\`
707
+
708
+ **Correct:**
709
+ \`\`\`typescript
710
+ // Good code
711
+ \`\`\`
712
+ ```
713
+
714
+ ### Impact-Based Classification
715
+
716
+ Rules are classified by impact level:
717
+
718
+ | Level | Color | Priority |
719
+ |-------|-------|----------|
720
+ | CRITICAL | 🔴 Red | 0 (highest) |
721
+ | HIGH | 🟡 Yellow | 1 |
722
+ | MEDIUM-HIGH | 🟡 Yellow | 2 |
723
+ | MEDIUM | 🔵 Cyan | 3 |
724
+ | LOW-MEDIUM | 🔵 Cyan | 4 |
725
+ | LOW | 🟢 Green | 5 |
726
+
727
+ ### Framework Auto-Detection
728
+
729
+ Automatically detect project framework from package.json:
730
+
731
+ ```typescript
732
+ import { detectFramework, getFrameworkRecommendations } from '@su-record/vibe/tools';
733
+
734
+ const result = await detectFramework('./my-project');
735
+ // { framework: { id: 'nextjs', name: 'Next.js', category: 'fullstack' }, ... }
736
+
737
+ const recs = getFrameworkRecommendations(result.framework);
738
+ // { reviewers: ['react-reviewer'], rules: ['react-*'], features: ['ssr'] }
739
+ ```
740
+
741
+ **Supported frameworks (40+):**
742
+ - Fullstack: Next.js, Remix, Nuxt, SvelteKit, Astro, RedwoodJS
743
+ - Frontend: React, Vue, Svelte, Angular, Preact
744
+ - Backend: NestJS, Express, Fastify, Hono, Elysia
745
+ - Docs: Docusaurus, VitePress, Eleventy
746
+
747
+ ### Test Case Extraction
748
+
749
+ Extract good/bad examples from rules for LLM evaluation:
750
+
751
+ ```typescript
752
+ import { extractTestCases, validateRule } from '@su-record/vibe/tools';
753
+
754
+ const testCases = extractTestCases(rules);
755
+ // [{ ruleId: '1.1', type: 'bad', code: '...', ... }]
756
+
757
+ const validation = validateRule(rule);
758
+ // { valid: true, errors: [] }
759
+ ```
760
+
761
+ ## Previous Features (v2.5.7-v2.5.11)
762
+
763
+ ### Intelligent Model Routing
764
+
765
+ Automatic model selection based on task complexity:
766
+
767
+ | Complexity | Model | When |
768
+ |------------|-------|------|
769
+ | Low (0-7) | Haiku | Simple fixes, searches |
770
+ | Medium (8-19) | Sonnet | Standard features, 3-5 files |
771
+ | High (20+) | Opus | Architecture, security, 6+ files |
772
+
773
+ ### Agent Tier System
774
+
775
+ Cost-optimized agent variants:
776
+
777
+ | Agent | Low | Medium | High |
778
+ |-------|-----|--------|------|
779
+ | explorer | explorer-low | explorer-medium | explorer |
780
+ | implementer | implementer-low | implementer-medium | implementer |
781
+ | architect | architect-low | architect-medium | architect |
782
+
783
+ ### Magic Keywords
784
+
785
+ | Keyword | Effect |
786
+ |---------|--------|
787
+ | `ultrawork` / `ulw` | Parallel + auto-continue + Ralph Loop |
788
+ | `ralph` | **Ralph Loop**: Iterate until 100% complete (no scope reduction) |
789
+ | `ralplan` | Iterative planning + persistence |
790
+ | `verify` | Strict verification mode |
791
+ | `quick` | Fast mode, minimal verification |
792
+
793
+ **Combinations supported:** `ralph ultrawork`, `ralph verify`, etc.
794
+
795
+ **Ralph Loop** (from [ghuntley.com/ralph](https://ghuntley.com/ralph)):
796
+
797
+ - Compares ORIGINAL request vs current implementation
798
+ - Lists ALL missing items explicitly
799
+ - Iterates until 100% complete (max 5 iterations)
800
+ - **ZERO tolerance for scope reduction** - Never say "basic version" or "simplified"
801
+
802
+ ### Skill Quality Gate
803
+
804
+ Memory saves are validated for quality:
805
+
806
+ - Rejects generic/searchable information
807
+ - Requires context, specificity, actionability
808
+ - Suggests principle format: "When X, do Y because Z"
809
+
810
+ ### HUD Status (Real-time)
811
+
812
+ ```bash
813
+ node hooks/scripts/hud-status.js show full
814
+ node hooks/scripts/hud-status.js start ultrawork "feature"
815
+ node hooks/scripts/hud-status.js phase 2 5 "Implementing core"
816
+ ```
817
+
818
+ ### Pre/Post Tool Hooks
819
+
820
+ - **PreToolUse**: Validates dangerous commands before execution
821
+ - **PostToolUse**: Provides error recovery hints
822
+
823
+ ### Orchestrate Workflow
824
+
825
+ Intent Gate → Codebase Assessment → Delegation → Verification pattern:
826
+
827
+ ```typescript
828
+ import { checkIntentGate, assessCodebase, createDelegationPlan } from '@su-record/vibe/tools';
829
+ ```
830
+
831
+ ### UltraQA (5-Cycle Autonomous QA)
832
+
833
+ ```
834
+ Test/Build/Lint → Fail → Architect Diagnosis → Executor Fix → Repeat (max 5)
835
+ ```
836
+
837
+ Exit conditions: All pass, Max cycles, Same failure 3x
838
+
839
+ ### DeepInit (Hierarchical AGENTS.md)
840
+
841
+ ```
842
+ project/
843
+ ├── AGENTS.md ← Root
844
+ ├── src/
845
+ │ └── AGENTS.md ← <!-- Parent: ../AGENTS.md -->
846
+ ```
847
+
848
+ ### Skill Frontmatter System
849
+
850
+ ```yaml
851
+ ---
852
+ name: my-skill
853
+ model: sonnet
854
+ triggers: [keyword1, keyword2]
855
+ ---
856
+ ```
857
+
858
+ ### Trigger-Based Skill Injection
859
+
860
+ Skills in `~/.claude/vibe/skills/` or `.claude/vibe/skills/` auto-inject on keyword match.
861
+
862
+ ### Multi-Line HUD
863
+
864
+ ```bash
865
+ node hooks/scripts/hud-multiline.js multi # Tree view
866
+ node hooks/scripts/hud-multiline.js compact # 2-line view
867
+ node hooks/scripts/hud-multiline.js single # 1-line view
868
+ ```
869
+
870
+ ### Parallel Code Review (/vibe.review)
871
+
872
+ 13+ specialized agents review code simultaneously:
873
+
874
+ - Security: security-reviewer, data-integrity-reviewer
875
+ - Performance: performance-reviewer, complexity-reviewer
876
+ - Architecture: architecture-reviewer, simplicity-reviewer
877
+ - Language-Specific: python, typescript, rails, react reviewers
878
+ - Context: git-history, test-coverage reviewers
879
+
880
+ **Priority System:**
881
+ - 🔴 P1 (Critical): Blocks merge
882
+ - 🟡 P2 (Important): Fix recommended
883
+ - 🔵 P3 (Nice-to-have): Backlog
884
+
885
+ ### E2E Testing (/vibe.utils --e2e)
886
+
887
+ Playwright-based automated testing:
888
+
889
+ ```bash
890
+ /vibe.utils --e2e "login flow" # Scenario test
891
+ /vibe.utils --e2e --visual # Visual regression test
892
+ /vibe.utils --e2e --record # Video recording
893
+ ```
894
+
895
+ ### Enhanced Research Agents
896
+
897
+ 4 parallel research agents run **after requirements confirmed** during `/vibe.spec`:
898
+
899
+ | Agent | Role |
900
+ |-------|------|
901
+ | best-practices-agent | Best practices for confirmed feature+stack |
902
+ | framework-docs-agent | Latest docs for confirmed stack (context7) |
903
+ | codebase-patterns-agent | Analyze existing similar patterns |
904
+ | security-advisory-agent | Security advisory for confirmed feature |
905
+
906
+ ## PTCF Structure
907
+
908
+ SPEC documents are AI-executable prompt format:
909
+
910
+ ```
911
+ <role> AI role definition
912
+ <context> Background, tech stack, related code
913
+ <task> Phase-by-phase task list
914
+ <constraints> Constraints
915
+ <output_format> Files to create/modify
916
+ <acceptance> Verification criteria
917
+ ```
918
+
919
+ ## Built-in Tools
920
+
921
+ ### Semantic Code Analysis
922
+ | Tool | Purpose |
923
+ |------|---------|
924
+ | `vibe_find_symbol` | Find symbol definitions |
925
+ | `vibe_find_references` | Find references |
926
+ | `vibe_analyze_complexity` | Analyze complexity |
927
+ | `vibe_validate_code_quality` | Validate quality |
928
+
929
+ ### Context Management
930
+ | Tool | Purpose |
931
+ |------|---------|
932
+ | `vibe_start_session` | Start session (restore previous context) |
933
+ | `vibe_auto_save_context` | Save current state |
934
+ | `vibe_save_memory` | Save important decisions |
935
+
936
+ ## Agents
937
+
938
+ ### Review Agents (12)
939
+ ```
940
+ .claude/agents/review/
941
+ ├── security-reviewer.md # Security vulnerabilities
942
+ ├── performance-reviewer.md # Performance bottlenecks
943
+ ├── architecture-reviewer.md # Architecture violations
944
+ ├── complexity-reviewer.md # Complexity exceeded
945
+ ├── simplicity-reviewer.md # Over-abstraction
946
+ ├── data-integrity-reviewer.md # Data integrity
947
+ ├── test-coverage-reviewer.md # Missing tests
948
+ ├── git-history-reviewer.md # Risk patterns
949
+ ├── python-reviewer.md # Python specialist
950
+ ├── typescript-reviewer.md # TypeScript specialist
951
+ ├── rails-reviewer.md # Rails specialist
952
+ └── react-reviewer.md # React specialist
953
+ ```
954
+
955
+ ### Research Agents (4)
956
+ ```
957
+ .claude/agents/research/
958
+ ├── best-practices-agent.md # Best practices
959
+ ├── framework-docs-agent.md # Framework docs
960
+ ├── codebase-patterns-agent.md # Code pattern analysis
961
+ └── security-advisory-agent.md # Security advisory
962
+ ```
963
+
964
+ ## Skills
965
+
966
+ ### Git Worktree
967
+ ```bash
968
+ # Isolated environment for PR review
969
+ git worktree add ../review-123 origin/pr/123
970
+ cd ../review-123 && npm test
971
+ git worktree remove ../review-123
972
+ ```
973
+
974
+ ### Priority Todos
975
+ ```
976
+ .claude/vibe/todos/
977
+ ├── P1-security-sql-injection.md # 🔴 Blocks merge
978
+ ├── P2-perf-n1-query.md # 🟡 Fix recommended
979
+ └── P3-style-extract-helper.md # 🔵 Backlog
980
+ ```
981
+
982
+ ## Context Management Strategy
983
+
984
+ ### Model Selection
985
+ - **Exploration/Search**: Haiku (sub-agent default)
986
+ - **Implementation/Debugging**: Sonnet
987
+ - **Architecture/Complex logic**: Opus
988
+
989
+ ### At 70%+ Context (⚠️ Important)
990
+ ```
991
+ ❌ Don't use /compact (risk of information loss/distortion)
992
+ ✅ save_memory to store important decisions → /new for new session
993
+ ```
994
+
995
+ vibe maintains context across sessions with its own memory system:
996
+ 1. `save_memory` - Explicitly save important decisions
997
+ 2. `/new` - Start new session
998
+ 3. `start_session` - Auto-restore previous session
999
+
1000
+ ### Session Restore
1001
+ To continue previous work in a new session:
1002
+ ```
1003
+ /vibe.utils --continue
1004
+ ```
1005
+ This command calls `vibe_start_session` to restore previous context from project memory.
1006
+
1007
+ ### Other Commands
1008
+ - `/rewind` - Revert to previous point
1009
+ - `/context` - Check current usage
1010
+
1011
+ ### Using context7
1012
+ Use context7 plugin when you need latest library documentation:
1013
+ ```
1014
+ "Search React 19 use() hook with context7"
1015
+ ```
1016
+
1017
+ ## Documentation Guidelines
1018
+
1019
+ ### Diagrams/Structure Representation
1020
+ - Avoid ASCII boxes (┌─┐) → Alignment breaks with mixed-width characters
1021
+ - Use alternatives:
1022
+ - Mermaid diagrams (GitHub/Notion supported)
1023
+ - Markdown tables
1024
+ - Indentation + separators
1025
+
1026
+ ### Preferred Formats
1027
+ | Purpose | Recommended |
1028
+ |---------|-------------|
1029
+ | Flowcharts | Mermaid flowchart |
1030
+ | Structure/Hierarchy | Indented lists |
1031
+ | Comparisons/Lists | Markdown tables |
1032
+ | Sequences | Mermaid sequenceDiagram |
1033
+
1034
+ ## Git Commit Rules
1035
+
1036
+ **Must include:**
1037
+ - `.claude/vibe/specs/`, `.claude/vibe/features/`, `.claude/vibe/todos/` (project docs)
1038
+ - `.claude/vibe/config.json`, `.claude/vibe/constitution.md` (project config)
1039
+ - `CLAUDE.md`
1040
+
1041
+ **Exclude (globally installed):**
1042
+ - `~/.claude/vibe/rules/`, `~/.claude/vibe/languages/`, `~/.claude/vibe/templates/` (global)
1043
+ - `~/.claude/commands/`, `~/.claude/agents/`, `~/.claude/skills/` (global)
1044
+ - `.claude/settings.local.json` (personal settings)
1045
+
1046
+ ## Getting Started
1047
+
1048
+ ```bash
1049
+ vibe init
1050
+ /vibe.spec "login feature"
1051
+ ```
1052
+
1053
+ ## Full Workflow
1054
+
1055
+ ```mermaid
1056
+ flowchart TD
1057
+ A["/vibe.spec"] --> B["(auto) SPEC review"]
1058
+ B --> C["SPEC auto-enhancement"]
1059
+ C --> D["/vibe.run ultrawork"]
1060
+ D --> E["Gemini code review"]
1061
+ E --> F["(auto) 13+ Agent Review"]
1062
+ F --> G{"P1/P2 issues?"}
1063
+ G -->|Yes| H["(auto) Auto-Fix"]
1064
+ H --> I["✅ Done"]
1065
+ G -->|No| I
1066
+ ```
1067
+
1068
+ | Step | Description | Automation |
1069
+ |------|-------------|------------|
1070
+ | 1. `/vibe.spec` | Collect requirements + Generate SPEC | Manual start |
1071
+ | 2. SPEC review | Gemini reviews SPEC + Auto-apply | ✅ Auto |
1072
+ | 3. `/vibe.run` | Implementation + Gemini review | Manual start |
1073
+ | 4. Agent Review | 13+ agent parallel review | ✅ Auto |
1074
+ | 5. Auto-Fix | P1/P2 issue auto-fix | ✅ Auto |