start-vibing 2.0.24 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "start-vibing",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
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": {
@@ -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
- > **Purpose:** Intelligently compact CLAUDE.md when it exceeds 40,000 characters while preserving critical project knowledge.
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
- ## Trigger
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
- AUTOMATICALLY invoke when:
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
- - 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
- ---
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
- # 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)
36
+ wc -m CLAUDE.md # Current size
37
+ grep -n "^## " CLAUDE.md # Section breakdown
44
38
  ```
45
39
 
46
- ### Step 4: Apply Compaction Rules
40
+ ### Step 2: Apply Compaction Rules
47
41
 
48
42
  #### MUST KEEP (Critical Sections)
49
43
 
@@ -932,12 +932,18 @@ interface HookInput {
932
932
  }
933
933
 
934
934
  interface HookResult {
935
+ continue: boolean;
935
936
  decision: 'approve' | 'block';
936
937
  reason: string;
937
938
  }
938
939
 
939
940
  /**
940
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.
941
947
  */
942
948
  const ERROR_TO_SUBAGENT: Record<string, { agent: string; prompt: string }> = {
943
949
  FEATURE_BRANCH_NOT_MERGED: {
@@ -961,8 +967,16 @@ const ERROR_TO_SUBAGENT: Record<string, { agent: string; prompt: string }> = {
961
967
  prompt: 'Create CLAUDE.md with required sections: Last Change, 30s Overview, Stack, Architecture',
962
968
  },
963
969
  CLAUDE_MD_SIZE_EXCEEDED: {
964
- agent: 'claude-md-compactor',
965
- prompt: 'Compact CLAUDE.md to under 40k characters while preserving critical project knowledge',
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)`,
966
980
  },
967
981
  CLAUDE_MD_TEMPLATE_MERGE_NEEDED: {
968
982
  agent: 'documenter',
@@ -1099,6 +1113,7 @@ async function main(): Promise<void> {
1099
1113
  // Prevent infinite loops
1100
1114
  if (hookInput.stop_hook_active) {
1101
1115
  const result: HookResult = {
1116
+ continue: false,
1102
1117
  decision: 'approve',
1103
1118
  reason: 'Stop hook cycle detected, allowing exit',
1104
1119
  };
@@ -1166,7 +1181,8 @@ The stop hook will check for remaining issues. Repeat until ALL CHECKS PASSED.
1166
1181
 
1167
1182
  // Stop hooks MUST return JSON with decision field
1168
1183
  // Exit code 2 signals blocking, but the JSON format is required for Stop hooks
1169
- const result: HookResult = { decision: 'block', reason: blockReason.trim() };
1184
+ // continue: true tells Claude to KEEP WORKING after receiving this block
1185
+ const result: HookResult = { continue: true, decision: 'block', reason: blockReason.trim() };
1170
1186
  console.log(JSON.stringify(result));
1171
1187
  process.exit(2);
1172
1188
  }
@@ -1185,7 +1201,8 @@ All validations passed. Task may complete.
1185
1201
  ################################################################################
1186
1202
  `;
1187
1203
 
1188
- const result: HookResult = { decision: 'approve', reason: successOutput.trim() };
1204
+ // continue: false tells Claude the task is DONE and can stop
1205
+ const result: HookResult = { continue: false, decision: 'approve', reason: successOutput.trim() };
1189
1206
  console.log(JSON.stringify(result));
1190
1207
  process.exit(0);
1191
1208
  }
@@ -1193,7 +1210,7 @@ All validations passed. Task may complete.
1193
1210
  main().catch((err) => {
1194
1211
  console.error('Hook error:', err);
1195
1212
  // On error, allow to continue to not block user
1196
- const result: HookResult = { decision: 'approve', reason: 'Hook error, allowing by default' };
1213
+ const result: HookResult = { continue: false, decision: 'approve', reason: 'Hook error, allowing by default' };
1197
1214
  console.log(JSON.stringify(result));
1198
1215
  process.exit(0);
1199
1216
  });