start-vibing 2.0.18 → 2.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "start-vibing",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "Setup Claude Code agents, skills, and hooks in your project. Smart copy that preserves your custom domains and configurations.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,220 @@
1
+ # Claude MD Compactor Agent
2
+
3
+ > **Purpose:** Intelligently compact CLAUDE.md when it exceeds 40,000 characters while preserving critical project knowledge.
4
+
5
+ ---
6
+
7
+ ## Trigger
8
+
9
+ AUTOMATICALLY invoke when:
10
+
11
+ - CLAUDE.md exceeds 40,000 characters
12
+ - Stop hook blocks with `CLAUDE_MD_SIZE_EXCEEDED` error
13
+ - User says "compact", "reduce", "shrink" CLAUDE.md
14
+
15
+ ---
16
+
17
+ ## Execution Steps
18
+
19
+ ### Step 1: Analyze Current State
20
+
21
+ ```bash
22
+ # Get current size
23
+ wc -m CLAUDE.md
24
+
25
+ # Get section breakdown
26
+ grep -n "^## " CLAUDE.md
27
+ ```
28
+
29
+ ### Step 2: Research Best Practices
30
+
31
+ Use MCP servers to get latest recommendations:
32
+
33
+ ```
34
+ 1. context7 - Query Claude Code documentation patterns
35
+ 2. WebSearch - "Anthropic Claude system prompt best practices 2024 2025"
36
+ 3. WebSearch - "Claude context window optimization techniques"
37
+ ```
38
+
39
+ ### Step 3: Read Template for Structure
40
+
41
+ ```
42
+ Read: .claude/skills/codebase-knowledge/TEMPLATE.md
43
+ Read: .claude/CLAUDE.md (agent context file for reference)
44
+ ```
45
+
46
+ ### Step 4: Apply Compaction Rules
47
+
48
+ #### MUST KEEP (Critical Sections)
49
+
50
+ | Section | Max Size | Notes |
51
+ | -------------------- | -------- | ---------------------------- |
52
+ | # Project Title | 1 line | Just the name |
53
+ | ## Last Change | 200 char | ONLY latest, no history |
54
+ | ## 30 Seconds | 300 char | 2-3 sentences max |
55
+ | ## Stack | 500 char | Table format only |
56
+ | ## Architecture | 800 char | Tree structure, no prose |
57
+ | ## Critical Rules | 2000 char | Bullet points only |
58
+ | ## FORBIDDEN Actions | 1000 char | Table format |
59
+ | ## Quality Gates | 500 char | Commands only |
60
+
61
+ #### MUST REMOVE/CONDENSE
62
+
63
+ | Remove | Why |
64
+ | --------------------------- | ------------------------------------ |
65
+ | Verbose explanations | Use bullet points instead |
66
+ | Code examples > 5 lines | Reference file paths instead |
67
+ | Duplicate information | Keep only in most relevant section |
68
+ | Old "Last Change" entries | Git history has this |
69
+ | Long tables with examples | Keep headers + 1-2 rows max |
70
+ | Commented-out sections | Delete completely |
71
+ | Multiple H1 headers | Only one allowed |
72
+ | Nested sub-sub-sections | Flatten to H2 max |
73
+
74
+ #### CONDENSE TECHNIQUES
75
+
76
+ ```markdown
77
+ # BAD (verbose)
78
+ ## Authentication
79
+ The authentication system uses JWT tokens for secure session management.
80
+ When a user logs in, the server generates a token that contains...
81
+ [50 more lines of explanation]
82
+
83
+ # GOOD (compact)
84
+ ## Auth
85
+ - JWT tokens via `lib/auth.ts`
86
+ - Session: 7 days, refresh: 30 days
87
+ - Middleware: `middleware/auth.ts`
88
+ ```
89
+
90
+ ### Step 5: Rewrite File
91
+
92
+ Create new CLAUDE.md with:
93
+
94
+ 1. **Header** - Project name only
95
+ 2. **Last Change** - Latest only (branch, date, 1-line summary)
96
+ 3. **30 Seconds** - What it does in 2 sentences
97
+ 4. **Stack** - Technology table (no descriptions)
98
+ 5. **Architecture** - Tree only, no explanations
99
+ 6. **Workflow** - Numbered steps, no prose
100
+ 7. **Critical Rules** - Bullets, max 10 rules
101
+ 8. **FORBIDDEN** - Table format
102
+ 9. **Quality Gates** - Commands only
103
+
104
+ ### Step 6: Validate Size
105
+
106
+ ```bash
107
+ # Must be under 40,000
108
+ wc -m CLAUDE.md
109
+
110
+ # If still over, remove more:
111
+ # 1. Reduce examples
112
+ # 2. Shorten rule descriptions
113
+ # 3. Remove optional sections
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Compaction Template
119
+
120
+ ```markdown
121
+ # {Project Name}
122
+
123
+ > Max 40k chars. Validate: `wc -m CLAUDE.md`
124
+
125
+ ---
126
+
127
+ ## Last Change
128
+
129
+ **Branch:** {branch}
130
+ **Date:** {YYYY-MM-DD}
131
+ **Summary:** {1 sentence}
132
+
133
+ ---
134
+
135
+ ## Overview
136
+
137
+ {2-3 sentences max}
138
+
139
+ ---
140
+
141
+ ## Stack
142
+
143
+ | Component | Tech |
144
+ |-----------|------|
145
+ | Runtime | Bun |
146
+ | Language | TS |
147
+
148
+ ---
149
+
150
+ ## Architecture
151
+
152
+ \`\`\`
153
+ project/
154
+ ├── app/ # Routes
155
+ ├── lib/ # Utils
156
+ └── types/ # Types
157
+ \`\`\`
158
+
159
+ ---
160
+
161
+ ## Rules
162
+
163
+ - Rule 1
164
+ - Rule 2
165
+ - Rule 3
166
+
167
+ ---
168
+
169
+ ## FORBIDDEN
170
+
171
+ | Action | Reason |
172
+ |--------|--------|
173
+ | X | Y |
174
+
175
+ ---
176
+
177
+ ## Commands
178
+
179
+ \`\`\`bash
180
+ bun run typecheck
181
+ bun run lint
182
+ bun run test
183
+ \`\`\`
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Research Queries (MCP)
189
+
190
+ When compacting, query these for best practices:
191
+
192
+ ```
193
+ context7: "Claude Code CLAUDE.md structure"
194
+ WebSearch: "Anthropic system prompt optimization 2025"
195
+ WebSearch: "Claude context efficiency best practices"
196
+ WebSearch: "LLM prompt compression techniques"
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Output
202
+
203
+ After compaction:
204
+
205
+ 1. Show before/after character count
206
+ 2. List removed sections
207
+ 3. Confirm all critical sections preserved
208
+ 4. Verify file validates with stop hook
209
+
210
+ ---
211
+
212
+ ## Integration
213
+
214
+ The stop hook will:
215
+
216
+ 1. Detect CLAUDE.md > 40k chars
217
+ 2. Block with message suggesting this agent
218
+ 3. Agent compacts file
219
+ 4. Stop hook re-validates
220
+ 5. Task completes if under limit
@@ -400,39 +400,63 @@ function validateClaudeMdSize(): ValidationError | null {
400
400
  if (content.length <= MAX_CHARACTERS) return null;
401
401
 
402
402
  const excess = content.length - MAX_CHARACTERS;
403
+ const percentOver = ((excess / MAX_CHARACTERS) * 100).toFixed(1);
403
404
 
404
405
  return {
405
406
  type: 'CLAUDE_MD_SIZE_EXCEEDED',
406
- message: `CLAUDE.md exceeds 40,000 character limit by ${excess} characters (current: ${content.length}).`,
407
+ message: `CLAUDE.md exceeds 40,000 character limit by ${excess} characters (${percentOver}% over).`,
407
408
  action: `
408
409
  ================================================================================
409
- CLAUDE.MD MUST BE COMPACTED (MAX 40,000 CHARACTERS)
410
+ CLAUDE.MD MUST BE COMPACTED - RUN COMPACTOR AGENT (MANDATORY)
410
411
  ================================================================================
411
412
 
412
413
  Current size: ${content.length} characters
413
414
  Maximum allowed: ${MAX_CHARACTERS} characters
414
- Excess: ${excess} characters
415
-
416
- COMPACTION RULES (what to keep vs remove):
417
-
418
- KEEP (critical):
419
- - # Project Title
420
- - ## Last Change (only the MOST RECENT)
421
- - ## 30 Seconds Overview
422
- - ## Stack
423
- - ## Architecture
424
- - ## Critical Rules
425
- - ## FORBIDDEN Actions
426
- - ## Quality Gates
427
-
428
- REMOVE/CONDENSE:
429
- - Verbose explanations (use bullet points)
430
- - Duplicate information
431
- - Old/outdated sections
432
- - Long code examples (keep minimal)
433
- - Multiple "Last Change" entries (keep only latest)
434
-
435
- After editing, verify: wc -m CLAUDE.md
415
+ Excess: ${excess} characters (${percentOver}% over limit)
416
+
417
+ --------------------------------------------------------------------------------
418
+ REQUIRED ACTION: Run the claude-md-compactor agent
419
+ --------------------------------------------------------------------------------
420
+
421
+ Task(subagent_type="claude-md-compactor", prompt="Compact CLAUDE.md to under 40k characters while preserving critical project knowledge")
422
+
423
+ The compactor agent will:
424
+ 1. Research best practices via context7 and web search
425
+ 2. Analyze current CLAUDE.md structure
426
+ 3. Apply intelligent compaction rules:
427
+ - Keep: Title, Last Change, Overview, Stack, Architecture, Rules
428
+ - Remove: Verbose prose, old history, long examples, duplicates
429
+ 4. Rewrite file in compact format
430
+ 5. Validate final size < 40,000 chars
431
+
432
+ --------------------------------------------------------------------------------
433
+ COMPACTION PRIORITIES (agent follows these)
434
+ --------------------------------------------------------------------------------
435
+
436
+ MUST KEEP (max sizes):
437
+ - # Project Title (1 line)
438
+ - ## Last Change (200 chars, ONLY latest)
439
+ - ## 30 Seconds Overview (300 chars)
440
+ - ## Stack (500 chars, table only)
441
+ - ## Architecture (800 chars, tree only)
442
+ - ## Critical Rules (2000 chars, bullets)
443
+ - ## FORBIDDEN (1000 chars, table)
444
+
445
+ MUST REMOVE:
446
+ - Verbose explanations → bullet points
447
+ - Code examples > 5 lines → file references
448
+ - Old "Last Change" entries → git has history
449
+ - Duplicate information → keep in one place
450
+ - Long tables → header + 2 rows max
451
+
452
+ --------------------------------------------------------------------------------
453
+ MANUAL VERIFICATION (after agent runs)
454
+ --------------------------------------------------------------------------------
455
+
456
+ wc -m CLAUDE.md # Must show < 40000
457
+
458
+ ================================================================================
459
+ The stop hook will BLOCK until CLAUDE.md is under 40,000 characters.
436
460
  ================================================================================`,
437
461
  };
438
462
  }
@@ -151,6 +151,11 @@
151
151
  "file": "agents/domain-updater.md",
152
152
  "description": "Updates domain documentation with session learnings and problems solved. FINAL step after commit.",
153
153
  "priority": 11
154
+ },
155
+ "claude-md-compactor": {
156
+ "file": "agents/07-documentation/claude-md-compactor.md",
157
+ "description": "Compacts CLAUDE.md when it exceeds 40k chars. Uses research + template to intelligently reduce size while preserving critical knowledge.",
158
+ "priority": 12
154
159
  }
155
160
  },
156
161