oh-my-customcode 0.101.0 → 0.102.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 +5 -5
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +10 -0
- package/templates/.claude/hooks/scripts/playwright-compress.sh +50 -0
- package/templates/.claude/skills/design-shotgun/SKILL.md +104 -0
- package/templates/.claude/skills/playwright-compress/SKILL.md +68 -0
- package/templates/.claude/skills/product-strategy/SKILL.md +82 -0
- package/templates/CLAUDE.md +2 -2
- package/templates/guides/browser-automation/01-browser-automation-patterns.md +68 -0
- package/templates/guides/claude-code/14-token-efficiency.md +187 -0
- package/templates/manifest.json +3 -3
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
**[한국어 문서 (Korean)](./README_ko.md)**
|
|
15
15
|
|
|
16
|
-
48 agents.
|
|
16
|
+
48 agents. 112 skills. 22 rules. One command.
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
npm install -g oh-my-customcode && cd your-project && omcustom init
|
|
@@ -132,7 +132,7 @@ Each agent declares its tools, model, memory scope, and limitations in YAML fron
|
|
|
132
132
|
|
|
133
133
|
---
|
|
134
134
|
|
|
135
|
-
### Skills (
|
|
135
|
+
### Skills (112)
|
|
136
136
|
|
|
137
137
|
| Category | Count | Includes |
|
|
138
138
|
|----------|-------|----------|
|
|
@@ -222,7 +222,7 @@ Key rules: R010 (orchestrator never writes files), R009 (parallel execution mand
|
|
|
222
222
|
|
|
223
223
|
---
|
|
224
224
|
|
|
225
|
-
### Guides (
|
|
225
|
+
### Guides (40)
|
|
226
226
|
|
|
227
227
|
Reference documentation covering best practices, architecture decisions, and integration patterns. Located in `guides/` at project root, covering topics from agent design to CI/CD to observability.
|
|
228
228
|
|
|
@@ -272,14 +272,14 @@ your-project/
|
|
|
272
272
|
├── CLAUDE.md # Entry point
|
|
273
273
|
├── .claude/
|
|
274
274
|
│ ├── agents/ # 48 agent definitions
|
|
275
|
-
│ ├── skills/ #
|
|
275
|
+
│ ├── skills/ # 112 skill modules
|
|
276
276
|
│ ├── rules/ # 22 governance rules (R000-R021)
|
|
277
277
|
│ ├── hooks/ # 15 lifecycle hook scripts
|
|
278
278
|
│ ├── schemas/ # Tool input validation schemas
|
|
279
279
|
│ ├── specs/ # Extracted canonical specs
|
|
280
280
|
│ ├── contexts/ # 4 shared context files
|
|
281
281
|
│ └── ontology/ # Knowledge graph for RAG
|
|
282
|
-
└── guides/ #
|
|
282
|
+
└── guides/ # 40 reference documents
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
---
|
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -475,6 +475,16 @@
|
|
|
475
475
|
}
|
|
476
476
|
],
|
|
477
477
|
"description": "Advisory reminder to sync skill counts in 6 locations when a SKILL.md is created/modified (R021)"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"matcher": "mcp_tool_name matches \"mcp__playwright__.*\" || mcp_tool_name matches \"mcp__claude-in-chrome__.*\"",
|
|
481
|
+
"hooks": [
|
|
482
|
+
{
|
|
483
|
+
"type": "command",
|
|
484
|
+
"command": "bash .claude/hooks/scripts/playwright-compress.sh"
|
|
485
|
+
}
|
|
486
|
+
],
|
|
487
|
+
"description": "Layer 4: Compress Playwright/Chrome MCP output via Haiku summarization"
|
|
478
488
|
}
|
|
479
489
|
],
|
|
480
490
|
"Stop": [
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Layer 4: Playwright/Chrome MCP Output Intelligence Compression
|
|
3
|
+
# Reduces MCP tool output by 94-96% using Haiku summarization
|
|
4
|
+
# Preserves ref= values for interactive flow continuity
|
|
5
|
+
# Source: adapted from treesoop/claude-native-plugin (MIT)
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
input=$(cat)
|
|
10
|
+
tool_output=$(echo "$input" | jq -r '.tool_output // ""')
|
|
11
|
+
|
|
12
|
+
# Skip if output is small (< 3000 chars)
|
|
13
|
+
output_len=${#tool_output}
|
|
14
|
+
if [ "$output_len" -lt 3000 ]; then
|
|
15
|
+
echo "$input"
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Extract ref= values to preserve
|
|
20
|
+
refs=$(echo "$tool_output" | grep -oE 'ref="[^"]*"' | sort -u || true)
|
|
21
|
+
|
|
22
|
+
# Summarize using Haiku via subscription auth
|
|
23
|
+
summary=$(echo "$tool_output" | claude -p --model haiku "Summarize this browser page content concisely. Preserve ALL ref= attribute values exactly as they appear. Focus on: page structure, interactive elements with their ref values, visible text content, and any error messages." 2>/dev/null) || {
|
|
24
|
+
# Fallback: return original on failure
|
|
25
|
+
echo "$input"
|
|
26
|
+
exit 0
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Verify ref= preservation
|
|
30
|
+
if [ -n "$refs" ]; then
|
|
31
|
+
missing_refs=""
|
|
32
|
+
while IFS= read -r ref; do
|
|
33
|
+
if ! echo "$summary" | grep -qF "$ref"; then
|
|
34
|
+
missing_refs="$missing_refs $ref"
|
|
35
|
+
fi
|
|
36
|
+
done <<< "$refs"
|
|
37
|
+
|
|
38
|
+
# Append missing refs if any
|
|
39
|
+
if [ -n "$missing_refs" ]; then
|
|
40
|
+
summary="$summary
|
|
41
|
+
|
|
42
|
+
[Preserved refs]:$missing_refs"
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Return compressed output
|
|
47
|
+
compressed_len=${#summary}
|
|
48
|
+
savings=$(( (output_len - compressed_len) * 100 / output_len ))
|
|
49
|
+
echo "$input" | jq --arg summary "$summary" --arg savings "${savings}% reduced (${output_len}→${compressed_len} chars)" \
|
|
50
|
+
'.tool_output = $summary | .["updatedMCPToolOutput"] = $summary'
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-shotgun
|
|
3
|
+
description: Generate 4-6 parallel design mockups for rapid visual comparison — adapted from gstack /design-shotgun pattern
|
|
4
|
+
scope: core
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
user-invocable: true
|
|
7
|
+
argument-hint: "<component/page description>"
|
|
8
|
+
effort: high
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Design Shotgun — Parallel Mockup Generation
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Generates 4-6 independent design variations simultaneously, then presents them side-by-side for comparison. Prevents premature convergence on a single design direction.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/design-shotgun "landing page hero section"
|
|
21
|
+
/design-shotgun "dashboard settings panel"
|
|
22
|
+
/design-shotgun "mobile navigation menu"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### Phase 1: Brief Analysis
|
|
28
|
+
|
|
29
|
+
Parse the design brief to extract:
|
|
30
|
+
- Component type (page, section, widget, modal)
|
|
31
|
+
- Constraints (brand colors, existing design system, accessibility requirements)
|
|
32
|
+
- Target platform (web, mobile, responsive)
|
|
33
|
+
|
|
34
|
+
### Phase 2: Parallel Generation (R009)
|
|
35
|
+
|
|
36
|
+
Spawn 4 parallel agents, each generating a distinct design approach:
|
|
37
|
+
|
|
38
|
+
| Agent | Style Direction | Focus |
|
|
39
|
+
|-------|----------------|-------|
|
|
40
|
+
| 1 | Minimal | Maximum whitespace, essential elements only |
|
|
41
|
+
| 2 | Data-dense | Information-rich, compact layout |
|
|
42
|
+
| 3 | Visual | Hero imagery, bold typography, emotional |
|
|
43
|
+
| 4 | Conventional | Industry-standard patterns, familiar UX |
|
|
44
|
+
|
|
45
|
+
Each agent generates:
|
|
46
|
+
- HTML mockup (self-contained, inline CSS)
|
|
47
|
+
- Design rationale (2-3 sentences)
|
|
48
|
+
- Accessibility notes
|
|
49
|
+
|
|
50
|
+
### Phase 3: Comparison Board
|
|
51
|
+
|
|
52
|
+
Present all mockups with side-by-side comparison:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
## Design Shotgun Results: {component}
|
|
56
|
+
|
|
57
|
+
### Variation 1: Minimal
|
|
58
|
+
Rationale: {why}
|
|
59
|
+
[HTML mockup code]
|
|
60
|
+
|
|
61
|
+
### Variation 2: Data-dense
|
|
62
|
+
Rationale: {why}
|
|
63
|
+
[HTML mockup code]
|
|
64
|
+
|
|
65
|
+
### Variation 3: Visual
|
|
66
|
+
Rationale: {why}
|
|
67
|
+
[HTML mockup code]
|
|
68
|
+
|
|
69
|
+
### Variation 4: Conventional
|
|
70
|
+
Rationale: {why}
|
|
71
|
+
[HTML mockup code]
|
|
72
|
+
|
|
73
|
+
## Comparison
|
|
74
|
+
| Criteria | V1 | V2 | V3 | V4 |
|
|
75
|
+
|----------|----|----|----|----|
|
|
76
|
+
| Readability | ★★★ | ★★ | ★★ | ★★★ |
|
|
77
|
+
| Visual impact | ★ | ★★ | ★★★ | ★★ |
|
|
78
|
+
| Information density | ★ | ★★★ | ★★ | ★★ |
|
|
79
|
+
| Accessibility | ★★★ | ★★ | ★★ | ★★★ |
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Phase 4: Selection & Refinement
|
|
83
|
+
|
|
84
|
+
User selects preferred variation(s). Selected design can be:
|
|
85
|
+
- Refined with follow-up iterations
|
|
86
|
+
- Combined with elements from other variations
|
|
87
|
+
- Handed to fe-design-expert for production implementation
|
|
88
|
+
|
|
89
|
+
## Integration
|
|
90
|
+
|
|
91
|
+
| Component | Role |
|
|
92
|
+
|-----------|------|
|
|
93
|
+
| R009 | 4 parallel agents for mockup generation |
|
|
94
|
+
| impeccable-design | Quality baseline for generated mockups |
|
|
95
|
+
| fe-design-expert | Production refinement after selection |
|
|
96
|
+
| web-design-guidelines | Accessibility and UX compliance |
|
|
97
|
+
|
|
98
|
+
## Permission Mode
|
|
99
|
+
|
|
100
|
+
When spawning agents via the Agent tool during this skill's execution, always pass `mode: "bypassPermissions"`. The Agent tool default (`acceptEdits`) overrides agent frontmatter `permissionMode`, causing permission prompts during unattended execution.
|
|
101
|
+
|
|
102
|
+
## Source
|
|
103
|
+
|
|
104
|
+
Adapted from [garrytan/gstack](https://github.com/garrytan/gstack) /design-shotgun pattern.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-compress
|
|
3
|
+
description: PostToolUse hook that compresses Playwright MCP tool output using Haiku summarization — Layer 4 of the token defense stack
|
|
4
|
+
scope: core
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
user-invocable: false
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Playwright MCP Output Compression (Layer 4)
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
Reduces Playwright MCP tool output tokens by 94-96% using intelligent Haiku summarization while preserving `ref=` values for interactive flow continuity.
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
MCP tool response (37K+ chars)
|
|
20
|
+
↓ PostToolUse hook
|
|
21
|
+
↓ playwright-compress.sh
|
|
22
|
+
↓ claude -p --model haiku (summarize)
|
|
23
|
+
↓ updatedMCPToolOutput (1.4K-1.9K chars)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Token Defense Stack Position
|
|
27
|
+
|
|
28
|
+
| Layer | Component | Mechanism | Scope |
|
|
29
|
+
|-------|-----------|-----------|-------|
|
|
30
|
+
| 1 | cc-token-saver | Time-based budget alerts | Session |
|
|
31
|
+
| 2 | R013 Ecomode | Context-aware output compression | Agent |
|
|
32
|
+
| 3 | MAX_MCP_OUTPUT_TOKENS | Hard truncation (lossy) | Setting |
|
|
33
|
+
| **4** | **playwright-compress** | **Intelligent summarization (lossless ref=)** | **Hook** |
|
|
34
|
+
|
|
35
|
+
## Behavior
|
|
36
|
+
|
|
37
|
+
- **Trigger**: PostToolUse on `mcp__playwright__.*` tools
|
|
38
|
+
- **Skip condition**: Output < 3000 characters (not worth compressing)
|
|
39
|
+
- **ref= preservation**: All `ref=` attribute values are extracted and preserved in the summary
|
|
40
|
+
- **Fallback**: If Haiku summarization fails, original output is returned unchanged
|
|
41
|
+
- **Auth**: Uses Claude subscription auth (`claude -p`), no API key needed
|
|
42
|
+
|
|
43
|
+
## Integration
|
|
44
|
+
|
|
45
|
+
| Rule | Interaction |
|
|
46
|
+
|------|-------------|
|
|
47
|
+
| R001 | No external data transmission — uses local `claude -p` |
|
|
48
|
+
| R013 | Complements Ecomode (Layer 2) with MCP-specific compression |
|
|
49
|
+
| R021 | Advisory PostToolUse hook — never blocks |
|
|
50
|
+
|
|
51
|
+
## Hook Configuration
|
|
52
|
+
|
|
53
|
+
Configured in `.claude/hooks/hooks.json` PostToolUse section:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"matcher": "mcp_tool_name matches \"mcp__playwright__.*\" || mcp_tool_name matches \"mcp__claude-in-chrome__.*\"",
|
|
58
|
+
"hooks": [{
|
|
59
|
+
"type": "command",
|
|
60
|
+
"command": "bash .claude/hooks/scripts/playwright-compress.sh"
|
|
61
|
+
}],
|
|
62
|
+
"description": "Layer 4: Compress Playwright/Chrome MCP output via Haiku summarization"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Source
|
|
67
|
+
|
|
68
|
+
Adapted from [treesoop/claude-native-plugin](https://github.com/treesoop/claude-native-plugin) playwright-optimizer (MIT).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: product-strategy
|
|
3
|
+
description: YC-style product strategy assessment with forced questions and CEO scope modes — adapted from gstack /office-hours pattern
|
|
4
|
+
scope: core
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
user-invocable: true
|
|
7
|
+
argument-hint: "[product/feature name]"
|
|
8
|
+
effort: high
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Product Strategy Assessment
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Forces rigorous product thinking by applying YC's 6 mandatory questions before any major feature decision. Prevents "build first, think later" anti-pattern.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
/product-strategy "new authentication system"
|
|
21
|
+
/product-strategy "API rate limiting redesign"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
### Phase 1: YC Forced Questions
|
|
27
|
+
|
|
28
|
+
Before any implementation planning, answer ALL 6 questions. Incomplete answers block Phase 2.
|
|
29
|
+
|
|
30
|
+
| # | Question | Must Answer |
|
|
31
|
+
|---|----------|-------------|
|
|
32
|
+
| 1 | **Who is the user?** | Specific persona, not "everyone" |
|
|
33
|
+
| 2 | **What problem does this solve?** | Observable behavior, not assumed need |
|
|
34
|
+
| 3 | **How do they solve it today?** | Current workaround — if none exists, question the need |
|
|
35
|
+
| 4 | **Why is this solution better?** | Measurable improvement, not "it's newer" |
|
|
36
|
+
| 5 | **What's the smallest version that validates the hypothesis?** | MVP scope — ruthlessly cut |
|
|
37
|
+
| 6 | **How will you know it worked?** | Success metric, measurable within 2 weeks |
|
|
38
|
+
|
|
39
|
+
### Phase 2: CEO Scope Mode Assessment
|
|
40
|
+
|
|
41
|
+
Categorize the feature into one of 4 modes:
|
|
42
|
+
|
|
43
|
+
| Mode | Signal | Action |
|
|
44
|
+
|------|--------|--------|
|
|
45
|
+
| **Expansion** | Strong user signal + clear gap | Full implementation, invest aggressively |
|
|
46
|
+
| **Selective** | Mixed signals, some demand | Targeted implementation, measure before expanding |
|
|
47
|
+
| **Hold** | Low signal, maintenance only | Keep working, no new investment |
|
|
48
|
+
| **Reduction** | Negative signal, cost > value | Phase out, redirect resources |
|
|
49
|
+
|
|
50
|
+
### Phase 3: Output
|
|
51
|
+
|
|
52
|
+
Generate structured assessment:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
## Product Strategy: {feature}
|
|
56
|
+
|
|
57
|
+
### YC Assessment
|
|
58
|
+
1. User: {answer}
|
|
59
|
+
2. Problem: {answer}
|
|
60
|
+
3. Current solution: {answer}
|
|
61
|
+
4. Why better: {answer}
|
|
62
|
+
5. MVP: {answer}
|
|
63
|
+
6. Success metric: {answer}
|
|
64
|
+
|
|
65
|
+
### Scope Mode: {Expansion|Selective|Hold|Reduction}
|
|
66
|
+
Rationale: {why this mode}
|
|
67
|
+
|
|
68
|
+
### Recommendation
|
|
69
|
+
{Go / No-Go / Needs more data}
|
|
70
|
+
Next step: {specific action}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Integration
|
|
74
|
+
|
|
75
|
+
| Rule | Interaction |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| R010 | Orchestrator invokes skill; no file writes |
|
|
78
|
+
| R015 | Transparent assessment — user sees all reasoning |
|
|
79
|
+
|
|
80
|
+
## Source
|
|
81
|
+
|
|
82
|
+
Adapted from [garrytan/gstack](https://github.com/garrytan/gstack) /office-hours + /plan-ceo-review patterns.
|
package/templates/CLAUDE.md
CHANGED
|
@@ -114,11 +114,11 @@ project/
|
|
|
114
114
|
+-- CLAUDE.md # 진입점
|
|
115
115
|
+-- .claude/
|
|
116
116
|
| +-- agents/ # 서브에이전트 정의 (48 파일)
|
|
117
|
-
| +-- skills/ # 스킬 (
|
|
117
|
+
| +-- skills/ # 스킬 (112 디렉토리)
|
|
118
118
|
| +-- rules/ # 전역 규칙 (R000-R022)
|
|
119
119
|
| +-- hooks/ # 훅 스크립트 (보안, 검증, HUD)
|
|
120
120
|
| +-- contexts/ # 컨텍스트 파일 (ecomode)
|
|
121
|
-
+-- guides/ # 레퍼런스 문서 (
|
|
121
|
+
+-- guides/ # 레퍼런스 문서 (40 토픽)
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
## 오케스트레이션
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Browser Automation Patterns for AI Agents
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Reference guide for AI-controlled browser automation patterns, focusing on integration with Claude Code and MCP-based browser tools.
|
|
6
|
+
|
|
7
|
+
## Patterns
|
|
8
|
+
|
|
9
|
+
### 1. MCP-based Browser Control (Recommended)
|
|
10
|
+
|
|
11
|
+
Use MCP tools (`mcp__claude-in-chrome__*` or `mcp__playwright__*`) for browser interaction:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Agent → MCP tool call → Browser extension/Playwright → Page interaction
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Advantages**: Native integration, no external dependencies, permission-controlled.
|
|
18
|
+
|
|
19
|
+
### 2. Cookie-Based Authentication
|
|
20
|
+
|
|
21
|
+
For testing authenticated flows, import cookies from a real browser session:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Export cookies from browser (DevTools → Application → Cookies)
|
|
25
|
+
# Import into Playwright context for authenticated testing
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Use case**: QA testing of authenticated pages without re-implementing login flows.
|
|
29
|
+
|
|
30
|
+
### 3. Anti-Bot Stealth Patterns
|
|
31
|
+
|
|
32
|
+
When automating against sites with bot detection:
|
|
33
|
+
- Use realistic viewport sizes and user agents
|
|
34
|
+
- Add human-like delays between actions
|
|
35
|
+
- Randomize mouse movement patterns
|
|
36
|
+
- Respect robots.txt and rate limits
|
|
37
|
+
|
|
38
|
+
**Caution**: Only use for authorized testing on your own applications.
|
|
39
|
+
|
|
40
|
+
### 4. Cross-AI Vendor Orchestration
|
|
41
|
+
|
|
42
|
+
Multiple AI agents can share browser sessions via:
|
|
43
|
+
- Shared MCP server connection
|
|
44
|
+
- ngrok tunnels for remote access (scoped tokens for security)
|
|
45
|
+
- Agent Teams (R018) for coordination
|
|
46
|
+
|
|
47
|
+
## Tools Available in oh-my-customcode
|
|
48
|
+
|
|
49
|
+
| Tool | Scope | Configuration |
|
|
50
|
+
|------|-------|---------------|
|
|
51
|
+
| `mcp__claude-in-chrome__*` | Chrome DevTools Protocol | MCP server in settings |
|
|
52
|
+
| `mcp__playwright__*` | Playwright automation | MCP server in settings |
|
|
53
|
+
| `playwright-compress` | Output compression (Layer 4) | PostToolUse hook |
|
|
54
|
+
|
|
55
|
+
## Security Considerations
|
|
56
|
+
|
|
57
|
+
| Concern | Mitigation |
|
|
58
|
+
|---------|-----------|
|
|
59
|
+
| Credential exposure | Never hardcode credentials; use env vars or cookie import |
|
|
60
|
+
| External data transmission | R001 compliance — no PII to external services |
|
|
61
|
+
| Rate limiting | Respect target site limits; implement backoff |
|
|
62
|
+
| Scope creep | Only automate your own applications or authorized targets |
|
|
63
|
+
|
|
64
|
+
## References
|
|
65
|
+
|
|
66
|
+
- [garrytan/gstack](https://github.com/garrytan/gstack) — /browse, /pair-agent patterns
|
|
67
|
+
- [playwright.dev](https://playwright.dev) — Official Playwright documentation
|
|
68
|
+
- [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) — CDP reference
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Token Efficiency — Three-Layer Defense Stack
|
|
2
|
+
|
|
3
|
+
> **Source**: [Claude Code & Codex token efficiency by settings adjustment](https://www.stdy.blog/increasing-token-efficiency-by-setting-adjustment-in-claude-and-codex/)
|
|
4
|
+
> **Reference baseline**: Claude Code v2.1.114+ / Codex v0.121.0+
|
|
5
|
+
|
|
6
|
+
## Why This Matters
|
|
7
|
+
|
|
8
|
+
Token spend in Claude Code is not purely a function of task complexity. A significant portion of token consumption occurs through structural overhead: auto-injected git instructions, IDE file listings, tool output that exceeds what the model actually needs, and session state reloaded unnecessarily across turns.
|
|
9
|
+
|
|
10
|
+
The three-layer defense stack addresses this overhead at three distinct points in the session lifecycle:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
14
|
+
│ Layer 1: cc-token-saver (CACHE DEFENSE) │
|
|
15
|
+
│ Before session — protect prompt cache TTL from idle expiry │
|
|
16
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
17
|
+
│ Layer 2: R013 Ecomode (RUNTIME COMPRESSION) │
|
|
18
|
+
│ During session — compact output, aggregate results, prune input│
|
|
19
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
20
|
+
│ Layer 3: Settings-Based Gates (PRE-SESSION PREVENTION) │
|
|
21
|
+
│ Config time — disable injections before they happen │
|
|
22
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
23
|
+
│ Layer 4: playwright-compress (MCP OUTPUT INTELLIGENCE) │
|
|
24
|
+
│ PostToolUse hook — Haiku summarization of browser MCP output │
|
|
25
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Each layer is independently deployable and non-overlapping. Together they form a complete defense.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Layer 1: cc-token-saver (Prompt Cache TTL Guard)
|
|
33
|
+
|
|
34
|
+
**What it does:** Detects when the 1-hour prompt cache TTL is about to expire due to idle time. Warns before cache invalidates, preventing a full re-spend on the next turn.
|
|
35
|
+
|
|
36
|
+
**Why it matters:** Claude Code's prompt cache has a 1-hour TTL on idle. If you pause a long session, the entire cached context must be re-processed at full cost on the next message. cc-token-saver intercepts this.
|
|
37
|
+
|
|
38
|
+
**Key features:**
|
|
39
|
+
- Token Guardian: idle TTL detection and warning
|
|
40
|
+
- `/continue`: zero-cost context restore after session pause
|
|
41
|
+
- `/usage-view`: cost dashboard for session/cumulative spend
|
|
42
|
+
|
|
43
|
+
**When to use:** Always — install as a plugin and leave active.
|
|
44
|
+
|
|
45
|
+
**Reference:** `guides/cc-token-saver/README.md`
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Layer 2: R013 Ecomode (Runtime Behavior Compression)
|
|
50
|
+
|
|
51
|
+
**What it does:** Compresses agent output at runtime — compact result format, aggregated multi-agent results, and active pruning of irrelevant input context.
|
|
52
|
+
|
|
53
|
+
**Why it matters:** Without ecomode, subagents return verbose outputs that accumulate across parallel invocations. At 4+ concurrent agents, unchecked output grows the context window rapidly.
|
|
54
|
+
|
|
55
|
+
**Activation triggers:**
|
|
56
|
+
- 4+ parallel tasks running simultaneously
|
|
57
|
+
- Batch operations on independent targets
|
|
58
|
+
- Context usage approaching 80%
|
|
59
|
+
- Explicit "ecomode on"
|
|
60
|
+
|
|
61
|
+
**Key behaviors:**
|
|
62
|
+
- Agents return `status + 1-2 sentence summary + key_data only`
|
|
63
|
+
- File lists compressed to count (when > 5 files)
|
|
64
|
+
- Error traces: first/last 3 lines only
|
|
65
|
+
- Code references: `path:line` ref instead of full block
|
|
66
|
+
|
|
67
|
+
**When to use:** Auto-activates on threshold — configure threshold in ecomode config if needed.
|
|
68
|
+
|
|
69
|
+
**Reference:** `.claude/rules/SHOULD-ecomode.md` (R013)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Layer 3: Settings-Based Gates (Pre-Session Prevention)
|
|
74
|
+
|
|
75
|
+
**What it does:** Disables token-consuming injections and sets output caps in configuration files before sessions start. These gates prevent overhead from ever entering the context window.
|
|
76
|
+
|
|
77
|
+
**Why it matters:** Certain Claude Code defaults inject tokens on every session start regardless of whether they are needed:
|
|
78
|
+
- `includeGitInstructions: true` (default) injects git workflow context on every session
|
|
79
|
+
- `autoConnectIde: true` injects file lists from connected IDEs
|
|
80
|
+
- Uncapped `BASH_MAX_OUTPUT_LENGTH` allows tool output to flood the context
|
|
81
|
+
|
|
82
|
+
**How to apply:** `token-efficiency-audit` skill — see `.claude/skills/token-efficiency-audit/SKILL.md`
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Lever Reference Table
|
|
87
|
+
|
|
88
|
+
### Interactive Session Levers (safe for development)
|
|
89
|
+
|
|
90
|
+
| Lever | Location | Default | Recommended | Token Impact | Risk |
|
|
91
|
+
|-------|----------|---------|-------------|-------------|------|
|
|
92
|
+
| `includeGitInstructions` | settings.json | `true` | `false` | Medium — removes git workflow injection | None for most projects |
|
|
93
|
+
| `autoConnectIde` | settings.json | `true` | `false` | Low — removes IDE file list injection | Loses IDE file awareness |
|
|
94
|
+
| `attribution.commit` | settings.json | auto text | `""` | Low — removes attribution boilerplate | None |
|
|
95
|
+
| `attribution.pr` | settings.json | auto text | `""` | Low — removes attribution boilerplate | None |
|
|
96
|
+
| `BASH_MAX_OUTPUT_LENGTH` | env | unlimited | `15000` | High — caps bash output | Output truncated if > 15000 chars |
|
|
97
|
+
| `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS` | env | unlimited | `8000` | Medium — caps file read output | Large files truncated |
|
|
98
|
+
| `MAX_MCP_OUTPUT_TOKENS` | env | unlimited | `8000` | Medium — caps MCP output | MCP results truncated |
|
|
99
|
+
| `CLAUDE_CODE_GLOB_NO_IGNORE` | env | `true` | `false` | Low — respects .gitignore | Fewer files visible in globs |
|
|
100
|
+
|
|
101
|
+
### CI/Worker-Only Levers (destructive — disables oh-my-customcode)
|
|
102
|
+
|
|
103
|
+
> These settings disable core oh-my-customcode functionality. **Never apply to interactive sessions.**
|
|
104
|
+
|
|
105
|
+
| Lever | What it disables | Token impact | oh-my-customcode impact |
|
|
106
|
+
|-------|-----------------|-------------|------------------------|
|
|
107
|
+
| `CLAUDE_CODE_DISABLE_CLAUDE_MDS=1` | All `.claude/*.md` files including CLAUDE.md | High | ALL global rules and routing offline |
|
|
108
|
+
| `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS=1` | Built-in agent definitions | High | All 48 agents unavailable |
|
|
109
|
+
| `ENABLE_CLAUDEAI_MCP_SERVERS=false` | MCP server connections | Medium | MCP-dependent skills unavailable |
|
|
110
|
+
| `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` | Agent auto-memory | Low | No persistent memory across sessions |
|
|
111
|
+
|
|
112
|
+
### Codex CLI Levers
|
|
113
|
+
|
|
114
|
+
| Lever | Location | Default | Recommended | Token Impact |
|
|
115
|
+
|-------|----------|---------|-------------|-------------|
|
|
116
|
+
| `features.apps` | config.toml | `true` | `false` | Medium |
|
|
117
|
+
| `apps._default.enabled` | config.toml | `true` | `false` | Medium |
|
|
118
|
+
| `web_search` | config.toml | `"auto"` | `"disabled"` | Medium — web search adds significant context |
|
|
119
|
+
| `tool_output_token_limit` | config.toml | `10000` | `10000` | High — do not lower below 5000 |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Tradeoffs and Guardrails
|
|
124
|
+
|
|
125
|
+
### The re-call trap
|
|
126
|
+
|
|
127
|
+
Setting output limits too low forces the model into repeated re-call loops — the model issues `tail -n 50 output.txt` or re-reads files in chunks, which costs more tokens than the original uncapped output. The minimum values below are empirically safe floors:
|
|
128
|
+
|
|
129
|
+
| Variable | Safe minimum | Recommended |
|
|
130
|
+
|----------|-------------|-------------|
|
|
131
|
+
| `BASH_MAX_OUTPUT_LENGTH` | 10000 | 15000 |
|
|
132
|
+
| `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS` | 4000 | 8000 |
|
|
133
|
+
| `MAX_MCP_OUTPUT_TOKENS` | 4000 | 8000 |
|
|
134
|
+
| Codex `tool_output_token_limit` | 5000 | 10000 |
|
|
135
|
+
|
|
136
|
+
### Version drift
|
|
137
|
+
|
|
138
|
+
Settings defaults change with minor CC version releases. After each upgrade, verify active defaults with `/token-efficiency-audit audit`. The reference baseline for this guide is CC v2.1.114+ / Codex v0.121.0+.
|
|
139
|
+
|
|
140
|
+
### includeGitInstructions tradeoff
|
|
141
|
+
|
|
142
|
+
Disabling `includeGitInstructions` removes git workflow guidance from the context. For projects with non-standard git workflows or junior contributors, this guidance may be worth keeping. For projects with experienced teams using `mgr-gitnerd` (R010), the injection is redundant.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Interaction with Other Rules
|
|
147
|
+
|
|
148
|
+
| Rule / Component | Interaction |
|
|
149
|
+
|-----------------|-------------|
|
|
150
|
+
| R013 Ecomode | Layer 2 runtime compression. These layers are complementary — apply both. |
|
|
151
|
+
| cc-token-saver | Layer 1 cache defense. `Token Guardian` + `BASH_MAX_OUTPUT_LENGTH` together eliminate the two largest waste sources. |
|
|
152
|
+
| R010 Orchestrator | `CLAUDE_CODE_DISABLE_CLAUDE_MDS` disables R010 enforcement — CI-only. |
|
|
153
|
+
| R001 Safety | `apply-ci` mode is Risk Level High — requires user confirmation before applying. |
|
|
154
|
+
| R012 HUD Statusline | Statusline shows CTX% — effective measure of Layer 2+3 combined impact. |
|
|
155
|
+
| playwright-compress | Layer 4 hook — complements Layer 3 MAX_MCP_OUTPUT_TOKENS with intelligent lossless compression. |
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Layer 4: MCP Output Intelligence Compression
|
|
160
|
+
|
|
161
|
+
PostToolUse hook that compresses Playwright and Chrome MCP tool output using Haiku summarization.
|
|
162
|
+
|
|
163
|
+
| Metric | Before | After | Reduction |
|
|
164
|
+
|--------|--------|-------|-----------|
|
|
165
|
+
| browser_navigate | 37,983 chars | 1,922 chars | -94% |
|
|
166
|
+
| browser_snapshot | 37,897 chars | 1,435 chars | -96% |
|
|
167
|
+
|
|
168
|
+
- Preserves `ref=` attribute values for interactive flow
|
|
169
|
+
- Skips output < 3000 chars
|
|
170
|
+
- Falls back to original on Haiku failure
|
|
171
|
+
- No API key needed (uses `claude -p` subscription auth)
|
|
172
|
+
|
|
173
|
+
Configuration: `.claude/hooks/scripts/playwright-compress.sh`
|
|
174
|
+
Hook trigger: `mcp__playwright__.*` and `mcp__claude-in-chrome__.*`
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Cross-References
|
|
179
|
+
|
|
180
|
+
- `guides/claude-code/13-cli-flags.md` — CLI flags for non-interactive/CI invocation
|
|
181
|
+
- `guides/cc-token-saver/README.md` — Layer 1 detailed guide
|
|
182
|
+
- `.claude/rules/SHOULD-ecomode.md` — Layer 2 R013 specification
|
|
183
|
+
- `.claude/skills/token-efficiency-audit/SKILL.md` — Layer 3 HOW: audit and apply
|
|
184
|
+
- `.claude/skills/monitoring-setup/SKILL.md` — Measure effectiveness via OTel metrics
|
|
185
|
+
- `.claude/skills/update-config/` — Generic settings.json manipulation (broader scope)
|
|
186
|
+
- `.claude/skills/playwright-compress/SKILL.md` — Layer 4 MCP output compression hook
|
|
187
|
+
- `.claude/hooks/scripts/playwright-compress.sh` — Layer 4 hook script
|
package/templates/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.102.0",
|
|
3
3
|
"lastUpdated": "2026-04-18T00:00:00.000Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"name": "skills",
|
|
19
19
|
"path": ".claude/skills",
|
|
20
20
|
"description": "Reusable skill modules (includes slash commands)",
|
|
21
|
-
"files":
|
|
21
|
+
"files": 112
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"name": "guides",
|
|
25
25
|
"path": "guides",
|
|
26
26
|
"description": "Reference documentation",
|
|
27
|
-
"files":
|
|
27
|
+
"files": 40
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"name": "hooks",
|