@boshu2/vibe-check 1.6.1 → 1.7.0
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/.agents/bundles/automatic-learning-cadence-plan-2025-12-02.md +1297 -0
- package/.agents/bundles/automatic-learning-cadence-research-2025-12-02.md +481 -0
- package/.agents/bundles/dashboard-data-quality-plan.md +458 -0
- package/.agents/bundles/rating-scoring-alignment-plan.md +427 -0
- package/.agents/bundles/rpi-session-capture-plan-2025-12-02.md +693 -0
- package/.agents/bundles/rpi-session-capture-research-2025-12-02.md +433 -0
- package/.agents/bundles/session-integration-plan-2025-12-02.md +144 -0
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +74 -2
- package/Makefile +173 -0
- package/README.md +35 -2
- package/claude-progress.json +34 -5
- package/claude-progress.txt +66 -0
- package/dashboard/app.js +699 -66
- package/dashboard/chart.min.js +20 -0
- package/dashboard/dashboard-data.js +764 -0
- package/dashboard/dashboard-data.json +182 -71
- package/dashboard/index.html +139 -14
- package/dashboard/styles.css +579 -4
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +38 -2
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/dashboard.js +4 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/learn.d.ts +3 -0
- package/dist/commands/learn.d.ts.map +1 -0
- package/dist/commands/learn.js +161 -0
- package/dist/commands/learn.js.map +1 -0
- package/dist/commands/lesson.d.ts +8 -0
- package/dist/commands/lesson.d.ts.map +1 -0
- package/dist/commands/lesson.js +206 -0
- package/dist/commands/lesson.js.map +1 -0
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +3 -202
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/session.d.ts +51 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +561 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/gamification/index.d.ts +1 -3
- package/dist/gamification/index.d.ts.map +1 -1
- package/dist/gamification/index.js +2 -5
- package/dist/gamification/index.js.map +1 -1
- package/dist/gamification/pattern-memory.d.ts +1 -1
- package/dist/gamification/pattern-memory.d.ts.map +1 -1
- package/dist/gamification/pattern-memory.js.map +1 -1
- package/dist/gamification/profile.d.ts +2 -2
- package/dist/gamification/profile.d.ts.map +1 -1
- package/dist/gamification/profile.js +2 -15
- package/dist/gamification/profile.js.map +1 -1
- package/dist/gamification/types.d.ts +8 -2
- package/dist/gamification/types.d.ts.map +1 -1
- package/dist/gamification/types.js.map +1 -1
- package/dist/insights/index.d.ts.map +1 -1
- package/dist/insights/index.js +16 -4
- package/dist/insights/index.js.map +1 -1
- package/dist/insights/types.d.ts +14 -0
- package/dist/insights/types.d.ts.map +1 -1
- package/dist/learning/cadence.d.ts +15 -0
- package/dist/learning/cadence.d.ts.map +1 -0
- package/dist/learning/cadence.js +130 -0
- package/dist/learning/cadence.js.map +1 -0
- package/dist/learning/index.d.ts +19 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +35 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/lessons-storage.d.ts +48 -0
- package/dist/learning/lessons-storage.d.ts.map +1 -0
- package/dist/learning/lessons-storage.js +266 -0
- package/dist/learning/lessons-storage.js.map +1 -0
- package/dist/learning/lessons-types.d.ts +83 -0
- package/dist/learning/lessons-types.d.ts.map +1 -0
- package/dist/learning/lessons-types.js +15 -0
- package/dist/learning/lessons-types.js.map +1 -0
- package/dist/learning/nudges.d.ts +20 -0
- package/dist/learning/nudges.d.ts.map +1 -0
- package/dist/learning/nudges.js +68 -0
- package/dist/learning/nudges.js.map +1 -0
- package/dist/learning/retrospective.d.ts +27 -0
- package/dist/learning/retrospective.d.ts.map +1 -0
- package/dist/learning/retrospective.js +184 -0
- package/dist/learning/retrospective.js.map +1 -0
- package/dist/learning/storage.d.ts +44 -0
- package/dist/learning/storage.d.ts.map +1 -0
- package/dist/learning/storage.js +194 -0
- package/dist/learning/storage.js.map +1 -0
- package/dist/learning/surfacing.d.ts +36 -0
- package/dist/learning/surfacing.d.ts.map +1 -0
- package/dist/learning/surfacing.js +255 -0
- package/dist/learning/surfacing.js.map +1 -0
- package/dist/learning/synthesis.d.ts +17 -0
- package/dist/learning/synthesis.d.ts.map +1 -0
- package/dist/learning/synthesis.js +293 -0
- package/dist/learning/synthesis.js.map +1 -0
- package/dist/learning/types.d.ts +60 -0
- package/dist/learning/types.d.ts.map +1 -0
- package/dist/learning/types.js +17 -0
- package/dist/learning/types.js.map +1 -0
- package/docs/METRICS.md +528 -0
- package/feature-list.json +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
# RPI Session Capture - Implementation Plan
|
|
2
|
+
|
|
3
|
+
**Type:** Plan
|
|
4
|
+
**Created:** 2025-12-02
|
|
5
|
+
**Depends On:** `rpi-session-capture-research-2025-12-02.md`
|
|
6
|
+
**Scope:** Enhance slash commands + add RPI learning to vibe-check
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Integrate RPI session capture into the existing workflow:
|
|
13
|
+
- `/implement` auto-starts RPI session tracking
|
|
14
|
+
- `/session-end` captures RPI retro and metrics
|
|
15
|
+
- `vibe-check rpi` command for history and learnings
|
|
16
|
+
- Learnings surface during future `/implement` runs
|
|
17
|
+
|
|
18
|
+
**Files to create:** 5 new files
|
|
19
|
+
**Files to modify:** 4 slash commands + 2 vibe-check files
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Part 1: Slash Command Enhancements
|
|
24
|
+
|
|
25
|
+
### 1.1 Enhance `/implement`
|
|
26
|
+
|
|
27
|
+
**File:** `.claude/commands/implement.md`
|
|
28
|
+
|
|
29
|
+
**Current behavior:**
|
|
30
|
+
- Loads plan bundle
|
|
31
|
+
- Executes steps sequentially
|
|
32
|
+
|
|
33
|
+
**Enhanced behavior:**
|
|
34
|
+
- Create RPI session record at start
|
|
35
|
+
- Extract planned files/steps from bundle
|
|
36
|
+
- Show relevant RPI learnings before starting
|
|
37
|
+
- Track progress through steps
|
|
38
|
+
|
|
39
|
+
**Add to implement.md:**
|
|
40
|
+
```markdown
|
|
41
|
+
## RPI Session Tracking
|
|
42
|
+
|
|
43
|
+
Before executing:
|
|
44
|
+
1. Create RPI session in vibe-check:
|
|
45
|
+
```bash
|
|
46
|
+
vibe-check rpi start --plan "[plan-file]" --feature "[feature-name]"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. Check for relevant learnings:
|
|
50
|
+
```bash
|
|
51
|
+
vibe-check rpi learnings --relevant
|
|
52
|
+
```
|
|
53
|
+
Display any warnings or suggestions from past sessions.
|
|
54
|
+
|
|
55
|
+
During execution:
|
|
56
|
+
- After each build command, if it fails, note the error
|
|
57
|
+
- After each test command, if it fails, note the failure
|
|
58
|
+
- Track any deviations from the plan (files not in plan)
|
|
59
|
+
|
|
60
|
+
On completion:
|
|
61
|
+
- Prompt: "Ready to end RPI session and capture learnings?"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 1.2 Enhance `/session-end`
|
|
65
|
+
|
|
66
|
+
**File:** `.claude/commands/session-end.md`
|
|
67
|
+
|
|
68
|
+
**Current behavior:**
|
|
69
|
+
- Warns about uncommitted changes
|
|
70
|
+
- Updates progress files
|
|
71
|
+
- Offers to save bundle
|
|
72
|
+
|
|
73
|
+
**Enhanced behavior:**
|
|
74
|
+
- Detect if RPI session is active
|
|
75
|
+
- Capture git metrics (commits, lines changed)
|
|
76
|
+
- Prompt for retro input
|
|
77
|
+
- Save RPI session record
|
|
78
|
+
|
|
79
|
+
**Add to session-end.md:**
|
|
80
|
+
```markdown
|
|
81
|
+
## RPI Session Capture
|
|
82
|
+
|
|
83
|
+
If RPI session is active:
|
|
84
|
+
1. Gather metrics:
|
|
85
|
+
```bash
|
|
86
|
+
vibe-check rpi metrics
|
|
87
|
+
```
|
|
88
|
+
Shows: commits made, files changed, build errors, test failures
|
|
89
|
+
|
|
90
|
+
2. Prompt for retro:
|
|
91
|
+
- What worked well?
|
|
92
|
+
- What didn't work?
|
|
93
|
+
- Any surprises?
|
|
94
|
+
- Lessons for next time?
|
|
95
|
+
|
|
96
|
+
3. End session:
|
|
97
|
+
```bash
|
|
98
|
+
vibe-check rpi end --retro "[retro-json]"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
4. Show synthesized learnings if patterns detected
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 1.3 Enhance `/research`
|
|
105
|
+
|
|
106
|
+
**File:** `.claude/commands/research.md`
|
|
107
|
+
|
|
108
|
+
**Enhanced behavior:**
|
|
109
|
+
- Check for relevant RPI learnings before research
|
|
110
|
+
- "Last time you researched X, you missed Y"
|
|
111
|
+
|
|
112
|
+
**Add to research.md:**
|
|
113
|
+
```markdown
|
|
114
|
+
## Check Past Learnings
|
|
115
|
+
|
|
116
|
+
Before deep research:
|
|
117
|
+
```bash
|
|
118
|
+
vibe-check rpi learnings --phase research
|
|
119
|
+
```
|
|
120
|
+
Surface any learnings about research quality from past sessions.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 1.4 Enhance `/plan`
|
|
124
|
+
|
|
125
|
+
**File:** `.claude/commands/plan.md`
|
|
126
|
+
|
|
127
|
+
**Enhanced behavior:**
|
|
128
|
+
- Show plan accuracy stats from past sessions
|
|
129
|
+
- Warn about common underestimation patterns
|
|
130
|
+
|
|
131
|
+
**Add to plan.md:**
|
|
132
|
+
```markdown
|
|
133
|
+
## Plan Quality Check
|
|
134
|
+
|
|
135
|
+
Before finalizing plan:
|
|
136
|
+
```bash
|
|
137
|
+
vibe-check rpi learnings --phase plan
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Show stats:
|
|
141
|
+
- Average plan accuracy: X%
|
|
142
|
+
- Common gaps: [list]
|
|
143
|
+
- Suggestion: Add 30% buffer to estimates
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Part 2: vibe-check RPI Module
|
|
149
|
+
|
|
150
|
+
### 2.1 `src/rpi/types.ts`
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
/**
|
|
154
|
+
* RPI Session Capture Types
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
export interface RPISession {
|
|
158
|
+
// Identity
|
|
159
|
+
id: string; // "rpi-2025-12-02-001"
|
|
160
|
+
startedAt: string;
|
|
161
|
+
endedAt?: string;
|
|
162
|
+
durationMinutes?: number;
|
|
163
|
+
status: 'active' | 'completed' | 'abandoned';
|
|
164
|
+
|
|
165
|
+
// Context
|
|
166
|
+
repository: string;
|
|
167
|
+
feature: string;
|
|
168
|
+
planPath?: string;
|
|
169
|
+
vibeLevel?: number;
|
|
170
|
+
|
|
171
|
+
// Plan (extracted from bundle)
|
|
172
|
+
plan: {
|
|
173
|
+
plannedFiles: PlannedFile[];
|
|
174
|
+
plannedSteps: number;
|
|
175
|
+
complexity?: 'simple' | 'medium' | 'complex';
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Execution (tracked during session)
|
|
179
|
+
execution: {
|
|
180
|
+
filesCreated: string[];
|
|
181
|
+
filesModified: string[];
|
|
182
|
+
filesDeleted: string[];
|
|
183
|
+
stepsCompleted: number;
|
|
184
|
+
unplannedFiles: string[]; // Files not in plan
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Friction (captured during session)
|
|
188
|
+
friction: {
|
|
189
|
+
buildErrors: FrictionEvent[];
|
|
190
|
+
testFailures: FrictionEvent[];
|
|
191
|
+
planDeviations: PlanDeviation[];
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Outcome (captured at end)
|
|
195
|
+
outcome?: {
|
|
196
|
+
commits: string[];
|
|
197
|
+
linesAdded: number;
|
|
198
|
+
linesRemoved: number;
|
|
199
|
+
testsPassing: boolean;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// Retro (user input at end)
|
|
203
|
+
retro?: {
|
|
204
|
+
whatWorked: string[];
|
|
205
|
+
whatDidntWork: string[];
|
|
206
|
+
surprises: string[];
|
|
207
|
+
lessonsLearned: string[];
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface PlannedFile {
|
|
212
|
+
path: string;
|
|
213
|
+
action: 'create' | 'modify' | 'delete';
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface FrictionEvent {
|
|
217
|
+
timestamp: string;
|
|
218
|
+
file?: string;
|
|
219
|
+
error: string;
|
|
220
|
+
resolution?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface PlanDeviation {
|
|
224
|
+
type: 'added_file' | 'skipped_step' | 'changed_approach';
|
|
225
|
+
description: string;
|
|
226
|
+
reason?: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface RPILearning {
|
|
230
|
+
id: string;
|
|
231
|
+
createdAt: string;
|
|
232
|
+
updatedAt: string;
|
|
233
|
+
|
|
234
|
+
// Pattern
|
|
235
|
+
pattern: string; // "build-error-type-mismatch"
|
|
236
|
+
phase: 'research' | 'plan' | 'implement' | 'all';
|
|
237
|
+
description: string;
|
|
238
|
+
|
|
239
|
+
// Evidence
|
|
240
|
+
occurrences: number;
|
|
241
|
+
sessionIds: string[];
|
|
242
|
+
|
|
243
|
+
// Actionable
|
|
244
|
+
prevention: string[];
|
|
245
|
+
detection: string[];
|
|
246
|
+
|
|
247
|
+
// Stats
|
|
248
|
+
avgTimeWasted: number;
|
|
249
|
+
confidence: number;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface RPIDatabase {
|
|
253
|
+
version: string;
|
|
254
|
+
sessions: RPISession[];
|
|
255
|
+
learnings: RPILearning[];
|
|
256
|
+
activeSessionId?: string;
|
|
257
|
+
stats: {
|
|
258
|
+
totalSessions: number;
|
|
259
|
+
completedSessions: number;
|
|
260
|
+
avgPlanAccuracy: number; // % of planned files actually created
|
|
261
|
+
avgSessionDuration: number;
|
|
262
|
+
commonFrictionPatterns: string[];
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### 2.2 `src/rpi/storage.ts`
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
/**
|
|
271
|
+
* RPI Session Storage
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
import * as fs from 'fs';
|
|
275
|
+
import * as path from 'path';
|
|
276
|
+
import * as os from 'os';
|
|
277
|
+
import { RPIDatabase, RPISession, RPILearning } from './types';
|
|
278
|
+
|
|
279
|
+
const RPI_FILE = 'rpi-sessions.json';
|
|
280
|
+
|
|
281
|
+
export function getRPIPath(): string {
|
|
282
|
+
return path.join(os.homedir(), '.vibe-check', RPI_FILE);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export function createInitialRPIDatabase(): RPIDatabase {
|
|
286
|
+
return {
|
|
287
|
+
version: '1.0.0',
|
|
288
|
+
sessions: [],
|
|
289
|
+
learnings: [],
|
|
290
|
+
stats: {
|
|
291
|
+
totalSessions: 0,
|
|
292
|
+
completedSessions: 0,
|
|
293
|
+
avgPlanAccuracy: 0,
|
|
294
|
+
avgSessionDuration: 0,
|
|
295
|
+
commonFrictionPatterns: [],
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function loadRPIDatabase(): RPIDatabase { ... }
|
|
301
|
+
export function saveRPIDatabase(db: RPIDatabase): void { ... }
|
|
302
|
+
|
|
303
|
+
// Session management
|
|
304
|
+
export function startSession(feature: string, planPath?: string): RPISession { ... }
|
|
305
|
+
export function getActiveSession(): RPISession | null { ... }
|
|
306
|
+
export function endSession(retro: RPISession['retro']): RPISession { ... }
|
|
307
|
+
export function abandonSession(): void { ... }
|
|
308
|
+
|
|
309
|
+
// Friction tracking
|
|
310
|
+
export function recordBuildError(error: string, file?: string): void { ... }
|
|
311
|
+
export function recordTestFailure(error: string, file?: string): void { ... }
|
|
312
|
+
export function recordDeviation(deviation: PlanDeviation): void { ... }
|
|
313
|
+
|
|
314
|
+
// Metrics
|
|
315
|
+
export function captureGitMetrics(since: string): RPISession['outcome'] { ... }
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 2.3 `src/rpi/plan-parser.ts`
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
/**
|
|
322
|
+
* Parse plan bundles to extract planned files and steps
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
import * as fs from 'fs';
|
|
326
|
+
import { PlannedFile } from './types';
|
|
327
|
+
|
|
328
|
+
export function parsePlanBundle(planPath: string): {
|
|
329
|
+
plannedFiles: PlannedFile[];
|
|
330
|
+
plannedSteps: number;
|
|
331
|
+
complexity: 'simple' | 'medium' | 'complex';
|
|
332
|
+
} {
|
|
333
|
+
const content = fs.readFileSync(planPath, 'utf-8');
|
|
334
|
+
|
|
335
|
+
// Extract files from markdown
|
|
336
|
+
// Look for patterns like:
|
|
337
|
+
// - "Create `src/foo.ts`"
|
|
338
|
+
// - "Modify `src/bar.ts`"
|
|
339
|
+
// - "### 1. `src/foo.ts`"
|
|
340
|
+
// - File paths in code blocks
|
|
341
|
+
|
|
342
|
+
const filePatterns = [
|
|
343
|
+
/(?:create|add)\s+`([^`]+)`/gi,
|
|
344
|
+
/(?:modify|update|edit)\s+`([^`]+)`/gi,
|
|
345
|
+
/(?:delete|remove)\s+`([^`]+)`/gi,
|
|
346
|
+
/###\s+\d+\.\s+`([^`]+)`/g,
|
|
347
|
+
];
|
|
348
|
+
|
|
349
|
+
// Extract steps from headers
|
|
350
|
+
// Look for "## Implementation Order" or numbered steps
|
|
351
|
+
|
|
352
|
+
const plannedFiles: PlannedFile[] = [];
|
|
353
|
+
let plannedSteps = 0;
|
|
354
|
+
|
|
355
|
+
// ... parsing logic
|
|
356
|
+
|
|
357
|
+
const complexity = plannedFiles.length > 10 ? 'complex' :
|
|
358
|
+
plannedFiles.length > 5 ? 'medium' : 'simple';
|
|
359
|
+
|
|
360
|
+
return { plannedFiles, plannedSteps, complexity };
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### 2.4 `src/rpi/synthesis.ts`
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
/**
|
|
368
|
+
* Synthesize learnings from RPI sessions
|
|
369
|
+
*/
|
|
370
|
+
|
|
371
|
+
import { RPIDatabase, RPISession, RPILearning } from './types';
|
|
372
|
+
|
|
373
|
+
export function synthesizeRPILearnings(db: RPIDatabase): RPILearning[] {
|
|
374
|
+
const sessions = db.sessions.filter(s => s.status === 'completed');
|
|
375
|
+
if (sessions.length < 3) return db.learnings; // Need 3+ sessions
|
|
376
|
+
|
|
377
|
+
const learnings: RPILearning[] = [];
|
|
378
|
+
|
|
379
|
+
// Pattern 1: Build errors
|
|
380
|
+
const buildErrorSessions = sessions.filter(s =>
|
|
381
|
+
s.friction.buildErrors.length > 0
|
|
382
|
+
);
|
|
383
|
+
if (buildErrorSessions.length >= 2) {
|
|
384
|
+
// Analyze common build error patterns
|
|
385
|
+
const errorPatterns = extractErrorPatterns(buildErrorSessions);
|
|
386
|
+
for (const pattern of errorPatterns) {
|
|
387
|
+
learnings.push(createLearning('build-error', pattern, buildErrorSessions));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Pattern 2: Plan accuracy
|
|
392
|
+
const avgAccuracy = calculatePlanAccuracy(sessions);
|
|
393
|
+
if (avgAccuracy < 80) {
|
|
394
|
+
learnings.push({
|
|
395
|
+
id: 'rpi-learning-plan-accuracy',
|
|
396
|
+
pattern: 'plan-underestimation',
|
|
397
|
+
phase: 'plan',
|
|
398
|
+
description: `Plans are ${100 - avgAccuracy}% under-scoped on average`,
|
|
399
|
+
prevention: [
|
|
400
|
+
'Add 30% buffer to file estimates',
|
|
401
|
+
'Include "unknown unknowns" section in plan',
|
|
402
|
+
],
|
|
403
|
+
// ...
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Pattern 3: Test failures
|
|
408
|
+
// Pattern 4: Common deviations
|
|
409
|
+
// ...
|
|
410
|
+
|
|
411
|
+
return learnings;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export function getRelevantLearnings(
|
|
415
|
+
db: RPIDatabase,
|
|
416
|
+
phase: 'research' | 'plan' | 'implement'
|
|
417
|
+
): RPILearning[] {
|
|
418
|
+
return db.learnings.filter(l =>
|
|
419
|
+
l.phase === phase || l.phase === 'all'
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 2.5 `src/commands/rpi.ts`
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
/**
|
|
428
|
+
* RPI Command - Manage RPI sessions and learnings
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
import { Command } from 'commander';
|
|
432
|
+
import chalk from 'chalk';
|
|
433
|
+
import {
|
|
434
|
+
loadRPIDatabase,
|
|
435
|
+
saveRPIDatabase,
|
|
436
|
+
startSession,
|
|
437
|
+
getActiveSession,
|
|
438
|
+
endSession,
|
|
439
|
+
captureGitMetrics,
|
|
440
|
+
} from '../rpi/storage';
|
|
441
|
+
import { parsePlanBundle } from '../rpi/plan-parser';
|
|
442
|
+
import { synthesizeRPILearnings, getRelevantLearnings } from '../rpi/synthesis';
|
|
443
|
+
|
|
444
|
+
export function createRPICommand(): Command {
|
|
445
|
+
const cmd = new Command('rpi')
|
|
446
|
+
.description('Manage RPI (Research-Plan-Implement) sessions and learnings');
|
|
447
|
+
|
|
448
|
+
cmd
|
|
449
|
+
.command('start')
|
|
450
|
+
.description('Start a new RPI session')
|
|
451
|
+
.option('--plan <path>', 'Path to plan bundle')
|
|
452
|
+
.option('--feature <name>', 'Feature being implemented')
|
|
453
|
+
.action((options) => { ... });
|
|
454
|
+
|
|
455
|
+
cmd
|
|
456
|
+
.command('end')
|
|
457
|
+
.description('End current RPI session')
|
|
458
|
+
.option('--retro <json>', 'Retro data as JSON')
|
|
459
|
+
.action((options) => { ... });
|
|
460
|
+
|
|
461
|
+
cmd
|
|
462
|
+
.command('status')
|
|
463
|
+
.description('Show current RPI session status')
|
|
464
|
+
.action(() => { ... });
|
|
465
|
+
|
|
466
|
+
cmd
|
|
467
|
+
.command('history')
|
|
468
|
+
.description('Show RPI session history')
|
|
469
|
+
.option('--limit <n>', 'Number of sessions to show', '10')
|
|
470
|
+
.action((options) => { ... });
|
|
471
|
+
|
|
472
|
+
cmd
|
|
473
|
+
.command('learnings')
|
|
474
|
+
.description('Show synthesized RPI learnings')
|
|
475
|
+
.option('--phase <phase>', 'Filter by phase (research, plan, implement)')
|
|
476
|
+
.option('--relevant', 'Show learnings relevant to current context')
|
|
477
|
+
.action((options) => { ... });
|
|
478
|
+
|
|
479
|
+
cmd
|
|
480
|
+
.command('metrics')
|
|
481
|
+
.description('Show metrics for current session')
|
|
482
|
+
.action(() => { ... });
|
|
483
|
+
|
|
484
|
+
cmd
|
|
485
|
+
.command('error')
|
|
486
|
+
.description('Record a build/test error')
|
|
487
|
+
.option('--build', 'Build error')
|
|
488
|
+
.option('--test', 'Test failure')
|
|
489
|
+
.option('--file <path>', 'File with error')
|
|
490
|
+
.option('--message <msg>', 'Error message')
|
|
491
|
+
.action((options) => { ... });
|
|
492
|
+
|
|
493
|
+
return cmd;
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Part 3: Integration Flow
|
|
500
|
+
|
|
501
|
+
### Starting an RPI Session
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
User: /implement my-feature-plan.md
|
|
505
|
+
|
|
506
|
+
Claude:
|
|
507
|
+
1. Reads plan bundle
|
|
508
|
+
2. Calls: vibe-check rpi start --plan my-feature-plan.md --feature "My Feature"
|
|
509
|
+
3. Parses plan → extracts 6 files, 10 steps
|
|
510
|
+
4. Calls: vibe-check rpi learnings --phase implement
|
|
511
|
+
5. Displays: "⚠️ Past sessions show TypeScript errors on 4/5 implementations.
|
|
512
|
+
Suggestion: Run build after each file."
|
|
513
|
+
6. Proceeds with implementation
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### During Implementation
|
|
517
|
+
|
|
518
|
+
```
|
|
519
|
+
Claude runs: npm run build
|
|
520
|
+
Build fails with TypeScript error
|
|
521
|
+
|
|
522
|
+
Claude:
|
|
523
|
+
1. Calls: vibe-check rpi error --build --file src/foo.ts --message "Type X not assignable"
|
|
524
|
+
2. Fixes the error
|
|
525
|
+
3. Calls: vibe-check rpi error --build --file src/foo.ts --resolution "Updated type signature"
|
|
526
|
+
4. Continues
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### Ending RPI Session
|
|
530
|
+
|
|
531
|
+
```
|
|
532
|
+
User: /session-end
|
|
533
|
+
|
|
534
|
+
Claude:
|
|
535
|
+
1. Calls: vibe-check rpi status
|
|
536
|
+
→ Shows: "Active session: my-feature, 45 min, 5/6 files, 2 build errors"
|
|
537
|
+
|
|
538
|
+
2. Calls: vibe-check rpi metrics
|
|
539
|
+
→ Shows: 3 commits, +500 lines, tests passing
|
|
540
|
+
|
|
541
|
+
3. Prompts user:
|
|
542
|
+
"What worked well in this session?"
|
|
543
|
+
"What didn't work?"
|
|
544
|
+
"Any surprises?"
|
|
545
|
+
"Lessons for next time?"
|
|
546
|
+
|
|
547
|
+
4. Calls: vibe-check rpi end --retro '{"whatWorked":["..."], ...}'
|
|
548
|
+
|
|
549
|
+
5. Shows: "Session recorded. 1 new learning synthesized:
|
|
550
|
+
'TypeScript errors occur when modifying existing function signatures'"
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Next RPI Session
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
User: /implement another-feature-plan.md
|
|
557
|
+
|
|
558
|
+
Claude:
|
|
559
|
+
1. Starts session
|
|
560
|
+
2. Calls: vibe-check rpi learnings --relevant
|
|
561
|
+
|
|
562
|
+
3. Displays:
|
|
563
|
+
"📚 LEARNINGS FROM PAST SESSIONS:
|
|
564
|
+
|
|
565
|
+
⚠️ Plan Accuracy: Your plans are 25% under-scoped on average
|
|
566
|
+
→ Consider adding buffer files
|
|
567
|
+
|
|
568
|
+
⚠️ TypeScript Signatures: 4/5 sessions had type errors
|
|
569
|
+
→ Read existing signatures before writing callers
|
|
570
|
+
→ Run build after each new file
|
|
571
|
+
|
|
572
|
+
💡 What Worked: Detailed specs with exact file contents"
|
|
573
|
+
|
|
574
|
+
4. Proceeds with implementation, applying learnings
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
## Implementation Order
|
|
580
|
+
|
|
581
|
+
| Step | File | Action | Validation |
|
|
582
|
+
|------|------|--------|------------|
|
|
583
|
+
| 1 | `src/rpi/types.ts` | Create | `npm run build` |
|
|
584
|
+
| 2 | `src/rpi/storage.ts` | Create | `npm run build` |
|
|
585
|
+
| 3 | `src/rpi/plan-parser.ts` | Create | `npm run build` |
|
|
586
|
+
| 4 | `src/rpi/synthesis.ts` | Create | `npm run build` |
|
|
587
|
+
| 5 | `src/rpi/index.ts` | Create (exports) | `npm run build` |
|
|
588
|
+
| 6 | `src/commands/rpi.ts` | Create | `npm run build` |
|
|
589
|
+
| 7 | `src/commands/index.ts` | Modify (export) | `npm run build` |
|
|
590
|
+
| 8 | `src/cli.ts` | Modify (register) | `npm run build` |
|
|
591
|
+
| 9 | Test `rpi` command | Manual | `node dist/cli.js rpi --help` |
|
|
592
|
+
| 10 | `.claude/commands/implement.md` | Enhance | Manual test |
|
|
593
|
+
| 11 | `.claude/commands/session-end.md` | Enhance | Manual test |
|
|
594
|
+
| 12 | `.claude/commands/plan.md` | Enhance | Manual test |
|
|
595
|
+
| 13 | `.claude/commands/research.md` | Enhance | Manual test |
|
|
596
|
+
| 14 | Full integration test | E2E | Run full RPI cycle |
|
|
597
|
+
| 15 | Commit | Git | |
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Example Output
|
|
602
|
+
|
|
603
|
+
### `vibe-check rpi status`
|
|
604
|
+
|
|
605
|
+
```
|
|
606
|
+
================================================================
|
|
607
|
+
RPI SESSION: Automatic Learning Cadence
|
|
608
|
+
================================================================
|
|
609
|
+
|
|
610
|
+
Status: Active
|
|
611
|
+
Started: 15 minutes ago
|
|
612
|
+
Plan: .agents/bundles/automatic-learning-cadence-plan.md
|
|
613
|
+
|
|
614
|
+
PROGRESS
|
|
615
|
+
Files: 5/6 created, 2/4 modified
|
|
616
|
+
Steps: 10/13 completed
|
|
617
|
+
Unplanned: 1 file (pattern-memory.ts type fix)
|
|
618
|
+
|
|
619
|
+
FRICTION
|
|
620
|
+
Build errors: 1 (resolved)
|
|
621
|
+
Test failures: 0
|
|
622
|
+
Deviations: 1
|
|
623
|
+
|
|
624
|
+
Run `vibe-check rpi end` to complete and capture learnings.
|
|
625
|
+
================================================================
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### `vibe-check rpi learnings`
|
|
629
|
+
|
|
630
|
+
```
|
|
631
|
+
================================================================
|
|
632
|
+
RPI LEARNINGS (3 patterns from 5 sessions)
|
|
633
|
+
================================================================
|
|
634
|
+
|
|
635
|
+
⚠️ PLAN ACCURACY
|
|
636
|
+
Your plans are 25% under-scoped on average
|
|
637
|
+
Occurrences: 4/5 sessions
|
|
638
|
+
Prevention:
|
|
639
|
+
- Add "buffer" section for unknowns
|
|
640
|
+
- Estimate files × 1.3
|
|
641
|
+
|
|
642
|
+
⚠️ TYPESCRIPT SIGNATURES
|
|
643
|
+
Type errors when calling existing functions
|
|
644
|
+
Occurrences: 4/5 sessions
|
|
645
|
+
Time wasted: ~5 min/session
|
|
646
|
+
Prevention:
|
|
647
|
+
- Read existing function signatures first
|
|
648
|
+
- Run build after each new file
|
|
649
|
+
|
|
650
|
+
💡 WHAT WORKS
|
|
651
|
+
Detailed specs with exact file contents
|
|
652
|
+
Occurrences: 5/5 sessions
|
|
653
|
+
Keep doing this!
|
|
654
|
+
|
|
655
|
+
================================================================
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### `vibe-check rpi history`
|
|
659
|
+
|
|
660
|
+
```
|
|
661
|
+
================================================================
|
|
662
|
+
RPI SESSION HISTORY
|
|
663
|
+
================================================================
|
|
664
|
+
|
|
665
|
+
[1] 2025-12-02 Lessons Database (90 min)
|
|
666
|
+
✓ Completed | 10 files | 2 errors | 1 learning
|
|
667
|
+
|
|
668
|
+
[2] 2025-12-02 Learning Cadence (45 min)
|
|
669
|
+
✓ Completed | 7 files | 1 error | 0 learnings
|
|
670
|
+
|
|
671
|
+
[3] 2025-12-01 Timeline Feature (60 min)
|
|
672
|
+
✓ Completed | 8 files | 0 errors | 1 learning
|
|
673
|
+
|
|
674
|
+
Run `vibe-check rpi history --id 1` for details.
|
|
675
|
+
================================================================
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
## Approval Checklist
|
|
681
|
+
|
|
682
|
+
- [ ] Data model captures all relevant RPI friction
|
|
683
|
+
- [ ] Slash command integration is clear
|
|
684
|
+
- [ ] Storage location is appropriate (~/.vibe-check/)
|
|
685
|
+
- [ ] Synthesis logic is sound
|
|
686
|
+
- [ ] CLI commands are intuitive
|
|
687
|
+
- [ ] Integration flow makes sense
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
## Next Step
|
|
692
|
+
|
|
693
|
+
Once approved: `/implement rpi-session-capture-plan-2025-12-02.md`
|