start-vibing 2.0.25 → 2.0.26
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,49 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-md-compactor
|
|
3
|
+
description: "AUTOMATICALLY invoke when CLAUDE.md exceeds 40k chars. Triggers: stop hook CLAUDE_MD_SIZE_EXCEEDED, 'compact CLAUDE.md'. Compacts while preserving critical knowledge per Anthropic best practices."
|
|
4
|
+
model: sonnet
|
|
5
|
+
tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch
|
|
6
|
+
skills: codebase-knowledge, docs-tracker
|
|
7
|
+
---
|
|
8
|
+
|
|
1
9
|
# Claude MD Compactor Agent
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
Intelligently compact CLAUDE.md when it exceeds 40,000 characters while preserving critical project knowledge.
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
## Research-Based Best Practices (Sources)
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
Per [Anthropic Engineering Blog](https://www.anthropic.com/engineering/claude-code-best-practices):
|
|
16
|
+
- Keep CLAUDE.md concise and human-readable
|
|
17
|
+
- Treat it like a frequently-used prompt - iterate on effectiveness
|
|
18
|
+
- Use emphasis ("IMPORTANT", "YOU MUST") for critical rules
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
Per [HumanLayer Research](https://www.humanlayer.dev/blog/writing-a-good-claude-md):
|
|
21
|
+
- **Target: <60 lines** (their production CLAUDE.md)
|
|
22
|
+
- **Maximum: <300 lines** (general consensus)
|
|
23
|
+
- LLMs can follow ~150-200 instructions max, Claude Code uses ~50 already
|
|
24
|
+
- Only include **universally applicable** content
|
|
10
25
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
---
|
|
26
|
+
Per [Context Management Research](https://mcpcat.io/guides/managing-claude-code-context/):
|
|
27
|
+
- Performance degrades as file grows ("fading memory" phenomenon)
|
|
28
|
+
- Move task-specific content to separate files (Progressive Disclosure)
|
|
29
|
+
- Use external docs/ folder for ad-hoc content
|
|
16
30
|
|
|
17
31
|
## Execution Steps
|
|
18
32
|
|
|
19
33
|
### Step 1: Analyze Current State
|
|
20
34
|
|
|
21
35
|
```bash
|
|
22
|
-
#
|
|
23
|
-
|
|
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)
|
|
36
|
+
wc -m CLAUDE.md # Current size
|
|
37
|
+
grep -n "^## " CLAUDE.md # Section breakdown
|
|
44
38
|
```
|
|
45
39
|
|
|
46
|
-
### Step
|
|
40
|
+
### Step 2: Apply Compaction Rules
|
|
47
41
|
|
|
48
42
|
#### MUST KEEP (Critical Sections)
|
|
49
43
|
|
|
@@ -939,6 +939,11 @@ interface HookResult {
|
|
|
939
939
|
|
|
940
940
|
/**
|
|
941
941
|
* Maps error types to the subagent that should be launched to fix them.
|
|
942
|
+
* IMPORTANT: Only use built-in Claude Code agent types that exist in the Task tool.
|
|
943
|
+
* Custom agents defined in .claude/agents/ are NOT available as subagent_type.
|
|
944
|
+
*
|
|
945
|
+
* Available built-in types: general-purpose, documenter, commit-manager, branch-manager,
|
|
946
|
+
* analyzer, tester, security-auditor, quality-checker, debugger, etc.
|
|
942
947
|
*/
|
|
943
948
|
const ERROR_TO_SUBAGENT: Record<string, { agent: string; prompt: string }> = {
|
|
944
949
|
FEATURE_BRANCH_NOT_MERGED: {
|
|
@@ -962,8 +967,16 @@ const ERROR_TO_SUBAGENT: Record<string, { agent: string; prompt: string }> = {
|
|
|
962
967
|
prompt: 'Create CLAUDE.md with required sections: Last Change, 30s Overview, Stack, Architecture',
|
|
963
968
|
},
|
|
964
969
|
CLAUDE_MD_SIZE_EXCEEDED: {
|
|
965
|
-
agent: '
|
|
966
|
-
prompt:
|
|
970
|
+
agent: 'general-purpose',
|
|
971
|
+
prompt: `Compact CLAUDE.md to under 40,000 characters. Follow these rules from Anthropic best practices:
|
|
972
|
+
|
|
973
|
+
1. KEEP (critical): Title, Last Change (latest only), 30s Overview, Stack table, Architecture tree
|
|
974
|
+
2. REMOVE: Verbose prose (use bullets), code examples >5 lines (use file refs), duplicate info, old Last Change entries, commented sections
|
|
975
|
+
3. TARGET: <60 lines ideal, <300 max per HumanLayer research
|
|
976
|
+
4. CONDENSE: "Auth uses JWT via lib/auth.ts" instead of paragraphs explaining JWT
|
|
977
|
+
|
|
978
|
+
Read .claude/agents/07-documentation/claude-md-compactor.md for detailed compaction template.
|
|
979
|
+
Validate with: wc -m CLAUDE.md (must be < 40000)`,
|
|
967
980
|
},
|
|
968
981
|
CLAUDE_MD_TEMPLATE_MERGE_NEEDED: {
|
|
969
982
|
agent: 'documenter',
|