cmp-standards 3.5.1 → 3.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/README.md +399 -633
- package/dist/analytics/CrossProjectAnalytics.js +65 -65
- package/dist/cli/index.js +255 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/tokens.js +173 -173
- package/dist/db/cloud.d.ts +1 -0
- package/dist/db/cloud.d.ts.map +1 -1
- package/dist/db/migrations.js +256 -256
- package/dist/db/turso-client.js +2 -2
- package/dist/db/upstash-client.d.ts +9 -0
- package/dist/db/upstash-client.d.ts.map +1 -1
- package/dist/db/upstash-client.js +11 -0
- package/dist/db/upstash-client.js.map +1 -1
- package/dist/eslint/rules/no-async-useeffect.js +6 -6
- package/dist/experts/ExpertVotePersistence.js +9 -9
- package/dist/hooks/cloud-post-tool-use.d.ts.map +1 -1
- package/dist/hooks/cloud-post-tool-use.js +72 -10
- package/dist/hooks/cloud-post-tool-use.js.map +1 -1
- package/dist/hooks/cloud-pre-tool-use.d.ts +12 -9
- package/dist/hooks/cloud-pre-tool-use.d.ts.map +1 -1
- package/dist/hooks/cloud-pre-tool-use.js +227 -99
- package/dist/hooks/cloud-pre-tool-use.js.map +1 -1
- package/dist/hooks/cloud-session-start.js +5 -5
- package/dist/hooks/resilient-hook-runner.d.ts +78 -0
- package/dist/hooks/resilient-hook-runner.d.ts.map +1 -0
- package/dist/hooks/resilient-hook-runner.js +201 -0
- package/dist/hooks/resilient-hook-runner.js.map +1 -0
- package/dist/hooks/session-end.js +14 -14
- package/dist/patterns/registry.js +90 -90
- package/dist/schema/codewiki-types.d.ts +10 -10
- package/dist/schema/docs-types.d.ts +8 -8
- package/dist/schema/ecosystem-types.d.ts +12 -12
- package/dist/services/BootstrapService.d.ts +123 -0
- package/dist/services/BootstrapService.d.ts.map +1 -0
- package/dist/services/BootstrapService.js +309 -0
- package/dist/services/BootstrapService.js.map +1 -0
- package/dist/services/CodeWikiIndexer.js +3 -3
- package/dist/services/ContextGenerator.js +7 -7
- package/dist/services/FeedbackCollector.js +11 -11
- package/dist/services/GitIntegration.js +9 -9
- package/dist/services/HookVerifier.js +70 -70
- package/dist/services/KnowledgeGapDetector.d.ts +122 -0
- package/dist/services/KnowledgeGapDetector.d.ts.map +1 -0
- package/dist/services/KnowledgeGapDetector.js +530 -0
- package/dist/services/KnowledgeGapDetector.js.map +1 -0
- package/dist/services/ProjectScaffold.d.ts.map +1 -1
- package/dist/services/ProjectScaffold.js +79 -78
- package/dist/services/ProjectScaffold.js.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/knowledge-graph.d.ts +121 -0
- package/dist/services/knowledge-graph.d.ts.map +1 -0
- package/dist/services/knowledge-graph.js +446 -0
- package/dist/services/knowledge-graph.js.map +1 -0
- package/dist/services/memory-router.d.ts +25 -0
- package/dist/services/memory-router.d.ts.map +1 -1
- package/dist/services/memory-router.js +236 -98
- package/dist/services/memory-router.js.map +1 -1
- package/dist/services/pattern-learning.d.ts +79 -0
- package/dist/services/pattern-learning.d.ts.map +1 -0
- package/dist/services/pattern-learning.js +312 -0
- package/dist/services/pattern-learning.js.map +1 -0
- package/dist/services/pattern-tracker.js +95 -95
- package/dist/services/semantic-search.js +2 -2
- package/package.json +124 -116
- package/standards/README.md +94 -50
- package/standards/experts/expert-routing.md +215 -215
- package/standards/general/code-quality.md +86 -86
- package/standards/general/ecosystem.md +243 -0
- package/standards/general/learning-loop.md +192 -0
- package/standards/general/memory-usage.md +205 -205
- package/standards/general/project-onboarding.md +339 -0
- package/standards/general/sync-workflow.md +235 -235
- package/standards/general/workflow.md +82 -82
- package/standards/hooks/mandatory-tracking.md +446 -446
- package/standards/infrastructure/cloud-database.md +287 -287
- package/standards/mcp/server-design.md +243 -243
- package/standards/mcp/tool-patterns.md +354 -354
- package/standards/skills/skill-structure.md +286 -286
- package/standards/skills/workflow-design.md +323 -323
- package/standards/tools/tool-design.md +297 -297
- package/templates/agents/architecture-expert.md +61 -61
- package/templates/agents/database-expert.md +62 -62
- package/templates/agents/documentation-expert.md +57 -57
- package/templates/agents/ecosystem-expert.md +104 -0
- package/templates/agents/memory-expert.md +88 -88
- package/templates/agents/performance-expert.md +61 -61
- package/templates/agents/security-expert.md +59 -59
- package/templates/agents/ux-expert.md +63 -63
- package/templates/agents/worker.md +75 -75
- package/templates/ai-skills/SKILL_TEMPLATE.md +55 -55
- package/templates/claude-settings.json +72 -72
- package/templates/commands/experts.md +138 -138
- package/templates/hooks/README.md +158 -158
- package/templates/hooks/project.config.json.template +77 -77
- package/templates/hooks/settings.local.json.template +57 -57
- package/templates/hooks.config.json +21 -0
- package/templates/memory-config.json +56 -56
- package/templates/memory-config.schema.json +212 -212
- package/templates/settings.json +58 -58
- package/templates/skills/continue.md +205 -205
- package/templates/workflows/business-improvement.md +264 -264
- package/templates/workflows/expert-review.md +153 -153
- package/templates/workflows/internal-app.md +245 -245
- package/templates/workflows/sync-docs.md +187 -187
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Project Onboarding Guide
|
|
2
|
+
|
|
3
|
+
> **Purpose**: Set up CMP in a new project
|
|
4
|
+
> **Audience**: AI agents and developers
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Quick Start Checklist
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
□ 1. Install cmp-standards
|
|
12
|
+
□ 2. Run initialization
|
|
13
|
+
□ 3. Configure CLAUDE.md
|
|
14
|
+
□ 4. Set up database (DEV_Items table)
|
|
15
|
+
□ 5. (Optional) Configure hooks
|
|
16
|
+
□ 6. Verify with status command
|
|
17
|
+
□ 7. Start recording knowledge!
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Step 1: Install cmp-standards
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install cmp-standards
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or with yarn/pnpm:
|
|
29
|
+
```bash
|
|
30
|
+
yarn add cmp-standards
|
|
31
|
+
pnpm add cmp-standards
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 2: Initialize Project
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx cmp-standards init --system MYPROJECT --name "My Project"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates:
|
|
43
|
+
- `.claude/` directory structure
|
|
44
|
+
- Initial configuration files
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Step 3: Configure CLAUDE.md
|
|
49
|
+
|
|
50
|
+
Your `CLAUDE.md` should include this template:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
# CLAUDE.md - [Project Name]
|
|
54
|
+
|
|
55
|
+
> **System**: [PROJECT_CODE]
|
|
56
|
+
> **CMP Version**: 3.7.0
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Project Overview
|
|
61
|
+
|
|
62
|
+
[Brief description of your project]
|
|
63
|
+
|
|
64
|
+
### Tech Stack
|
|
65
|
+
|
|
66
|
+
- **Framework**: [Next.js/React/etc]
|
|
67
|
+
- **Language**: TypeScript
|
|
68
|
+
- **Database**: [MySQL/PostgreSQL/etc]
|
|
69
|
+
- **CMP**: cmp-standards (persistent memory)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## CMP Integration
|
|
74
|
+
|
|
75
|
+
This project uses **Collective Memory Protocol** for persistent AI memory.
|
|
76
|
+
|
|
77
|
+
### Session Start
|
|
78
|
+
On session start, check for:
|
|
79
|
+
- Active tasks: `WHERE system='PROJECT_CODE' AND status='in_progress'`
|
|
80
|
+
- Pending knowledge: `WHERE system='PROJECT_CODE' AND type='knowledge'`
|
|
81
|
+
- Shared patterns: `WHERE system='SHARED'`
|
|
82
|
+
|
|
83
|
+
### Memory Commands
|
|
84
|
+
```bash
|
|
85
|
+
npm run ai:health # Check system health
|
|
86
|
+
npm run ai:distill # Extract knowledge
|
|
87
|
+
cmp-standards status # Show status
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Core Rules
|
|
91
|
+
- Filter database by `system='PROJECT_CODE'`
|
|
92
|
+
- Check `system='SHARED'` for cross-project knowledge
|
|
93
|
+
- Record significant decisions in DEV_Items
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Core Rules (Non-Negotiable)
|
|
98
|
+
|
|
99
|
+
### Code Quality
|
|
100
|
+
- NO `any`/`unknown` types
|
|
101
|
+
- NO ESLint disable comments
|
|
102
|
+
- Validate inputs with Zod
|
|
103
|
+
|
|
104
|
+
### Database
|
|
105
|
+
- ALWAYS filter by `system='PROJECT_CODE'`
|
|
106
|
+
- Use transactions for multi-table operations
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
### Development
|
|
113
|
+
```bash
|
|
114
|
+
npm run dev
|
|
115
|
+
npm run build
|
|
116
|
+
npm run lint
|
|
117
|
+
npm run typecheck
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### AI/Memory
|
|
121
|
+
```bash
|
|
122
|
+
npm run ai:health
|
|
123
|
+
npm run ai:distill
|
|
124
|
+
cmp-standards status
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
*Using CMP - Collective Memory Protocol*
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Step 4: Set Up Database
|
|
135
|
+
|
|
136
|
+
Create the DEV_Items table in your database:
|
|
137
|
+
|
|
138
|
+
```sql
|
|
139
|
+
CREATE TABLE DEV_Items (
|
|
140
|
+
id VARCHAR(255) PRIMARY KEY,
|
|
141
|
+
system VARCHAR(50) NOT NULL,
|
|
142
|
+
type ENUM('task', 'memory', 'knowledge', 'pattern', 'error') NOT NULL,
|
|
143
|
+
status ENUM('pending', 'in_progress', 'done', 'archived') DEFAULT 'pending',
|
|
144
|
+
priority ENUM('critical', 'high', 'medium', 'low') DEFAULT 'medium',
|
|
145
|
+
content JSON NOT NULL,
|
|
146
|
+
tags JSON,
|
|
147
|
+
created_at TIMESTAMP DEFAULT NOW(),
|
|
148
|
+
updated_at TIMESTAMP DEFAULT NOW(),
|
|
149
|
+
|
|
150
|
+
INDEX idx_system (system),
|
|
151
|
+
INDEX idx_type (type),
|
|
152
|
+
INDEX idx_status (status)
|
|
153
|
+
);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### For Drizzle ORM
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// schema/tables/dev.ts
|
|
160
|
+
import { mysqlTable, varchar, mysqlEnum, json, timestamp } from 'drizzle-orm/mysql-core'
|
|
161
|
+
|
|
162
|
+
export const devItems = mysqlTable('DEV_Items', {
|
|
163
|
+
id: varchar('id', { length: 255 }).primaryKey(),
|
|
164
|
+
system: varchar('system', { length: 50 }).notNull(),
|
|
165
|
+
type: mysqlEnum('type', ['task', 'memory', 'knowledge', 'pattern', 'error']).notNull(),
|
|
166
|
+
status: mysqlEnum('status', ['pending', 'in_progress', 'done', 'archived']).default('pending'),
|
|
167
|
+
priority: mysqlEnum('priority', ['critical', 'high', 'medium', 'low']).default('medium'),
|
|
168
|
+
content: json('content').notNull(),
|
|
169
|
+
tags: json('tags'),
|
|
170
|
+
createdAt: timestamp('created_at').defaultNow(),
|
|
171
|
+
updatedAt: timestamp('updated_at').defaultNow(),
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Step 5: Configure Hooks (Optional)
|
|
178
|
+
|
|
179
|
+
For Claude Code, add to `.claude/settings.json`:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"hooks": {
|
|
184
|
+
"SessionStart": [{
|
|
185
|
+
"matcher": "",
|
|
186
|
+
"hooks": [{
|
|
187
|
+
"type": "command",
|
|
188
|
+
"command": "npx tsx node_modules/cmp-standards/dist/hooks/cloud-session-start.js"
|
|
189
|
+
}]
|
|
190
|
+
}]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Custom SessionStart Hook
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// .claude/hooks/session-start.ts
|
|
199
|
+
export async function onSessionStart() {
|
|
200
|
+
console.log('━'.repeat(50))
|
|
201
|
+
console.log('PROJECT: WAKING UP...')
|
|
202
|
+
console.log('━'.repeat(50))
|
|
203
|
+
|
|
204
|
+
// 1. Check active tasks
|
|
205
|
+
await showActiveTasks()
|
|
206
|
+
|
|
207
|
+
// 2. Check for pending knowledge
|
|
208
|
+
await checkPendingKnowledge()
|
|
209
|
+
|
|
210
|
+
console.log('━'.repeat(50))
|
|
211
|
+
console.log('✅ System Ready.')
|
|
212
|
+
console.log('━'.repeat(50))
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async function showActiveTasks() {
|
|
216
|
+
// Query DEV_Items for active tasks
|
|
217
|
+
const tasks = await db.query.devItems.findMany({
|
|
218
|
+
where: and(
|
|
219
|
+
eq(devItems.system, 'MYPROJECT'),
|
|
220
|
+
eq(devItems.status, 'in_progress')
|
|
221
|
+
)
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
console.log(`\n📋 Active tasks: ${tasks.length}`)
|
|
225
|
+
tasks.forEach(t => console.log(` - ${t.content.title}`))
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async function checkPendingKnowledge() {
|
|
229
|
+
// Query for knowledge needing distillation
|
|
230
|
+
const pending = await db.query.devItems.findMany({
|
|
231
|
+
where: and(
|
|
232
|
+
eq(devItems.system, 'MYPROJECT'),
|
|
233
|
+
eq(devItems.type, 'knowledge'),
|
|
234
|
+
eq(devItems.status, 'pending')
|
|
235
|
+
)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
if (pending.length > 5) {
|
|
239
|
+
console.log(`\n⚠️ ${pending.length} knowledge items pending distillation`)
|
|
240
|
+
console.log(' Consider running: npm run ai:distill')
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Step 6: Verify Setup
|
|
248
|
+
|
|
249
|
+
Run the status command:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
cmp-standards status
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Expected output:
|
|
256
|
+
```
|
|
257
|
+
CMP Status
|
|
258
|
+
──────────────────────────────────
|
|
259
|
+
System: MYPROJECT
|
|
260
|
+
Database: Connected
|
|
261
|
+
DEV_Items: 0 entries
|
|
262
|
+
Status: Ready
|
|
263
|
+
──────────────────────────────────
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Step 7: Initial Knowledge Dump
|
|
269
|
+
|
|
270
|
+
Record your project's key patterns:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
// Via code
|
|
274
|
+
await db.insert(devItems).values({
|
|
275
|
+
id: `knowledge_${Date.now()}`,
|
|
276
|
+
system: 'MYPROJECT',
|
|
277
|
+
type: 'knowledge',
|
|
278
|
+
status: 'done',
|
|
279
|
+
priority: 'high',
|
|
280
|
+
content: {
|
|
281
|
+
title: 'Important Pattern: [Name]',
|
|
282
|
+
body: '[Description of the pattern]',
|
|
283
|
+
domain: 'architecture',
|
|
284
|
+
},
|
|
285
|
+
tags: ['onboarding', 'architecture'],
|
|
286
|
+
})
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Or via CLI:
|
|
290
|
+
```bash
|
|
291
|
+
cmp-standards capture "Always validate user inputs with Zod schemas"
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Verification Checklist
|
|
297
|
+
|
|
298
|
+
After setup, verify:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
□ CLAUDE.md has correct System code
|
|
302
|
+
□ DEV_Items table exists in database
|
|
303
|
+
□ cmp-standards status works
|
|
304
|
+
□ Can insert a test knowledge entry
|
|
305
|
+
□ Can query by system filter
|
|
306
|
+
□ (Optional) SessionStart hook runs
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Common Issues
|
|
312
|
+
|
|
313
|
+
### "DEV_Items table not found"
|
|
314
|
+
- Run the SQL migration
|
|
315
|
+
- Check DATABASE_URL is correct
|
|
316
|
+
|
|
317
|
+
### "Cannot connect to database"
|
|
318
|
+
- Verify DATABASE_URL environment variable
|
|
319
|
+
- Check network/firewall settings
|
|
320
|
+
|
|
321
|
+
### "No knowledge found"
|
|
322
|
+
- Make sure you're filtering by correct system code
|
|
323
|
+
- Run initial knowledge dump
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Next Steps
|
|
328
|
+
|
|
329
|
+
After onboarding:
|
|
330
|
+
|
|
331
|
+
1. **Record patterns** as you work
|
|
332
|
+
2. **Run distillation** periodically: `npm run ai:distill`
|
|
333
|
+
3. **Check health**: `npm run ai:health`
|
|
334
|
+
4. **Promote patterns** to SHARED when valuable
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
*CMP - Collective Memory Protocol*
|
|
339
|
+
*Created by Carlos Martin Pavón*
|