oh-my-customcode 0.64.2 → 0.65.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/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +85 -1
- package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
- package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
- package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
- package/templates/.claude/rules/MUST-agent-design.md +47 -0
- package/templates/.claude/skills/evaluator-optimizer/SKILL.md +52 -0
- package/templates/.claude/skills/monitoring-setup/SKILL.md +69 -0
- package/templates/guides/claude-code/13-cli-flags.md +151 -0
- package/templates/guides/claude-code/index.yaml +5 -0
- package/templates/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -127,6 +127,18 @@
|
|
|
127
127
|
"description": "Scan TODO.md files for stale items at session start"
|
|
128
128
|
}
|
|
129
129
|
],
|
|
130
|
+
"UserPromptSubmit": [
|
|
131
|
+
{
|
|
132
|
+
"matcher": "*",
|
|
133
|
+
"hooks": [
|
|
134
|
+
{
|
|
135
|
+
"type": "command",
|
|
136
|
+
"command": "bash .claude/hooks/scripts/user-prompt-preprocessor.sh"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"description": "Advisory pre-processing of user input — skill matching hints and intent analysis"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
130
142
|
"SubagentStart": [
|
|
131
143
|
{
|
|
132
144
|
"matcher": "*",
|
|
@@ -159,13 +171,85 @@
|
|
|
159
171
|
"description": "Record agent outcomes + auto-continue workflow on subagent completion"
|
|
160
172
|
}
|
|
161
173
|
],
|
|
174
|
+
"CwdChanged": [
|
|
175
|
+
{
|
|
176
|
+
"matcher": "*",
|
|
177
|
+
"hooks": [
|
|
178
|
+
{
|
|
179
|
+
"type": "command",
|
|
180
|
+
"command": "bash .claude/hooks/scripts/cwd-change-detector.sh"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"description": "Auto-detect project type on working directory change (v2.1.83+)"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"FileChanged": [
|
|
187
|
+
{
|
|
188
|
+
"matcher": "*",
|
|
189
|
+
"hooks": [
|
|
190
|
+
{
|
|
191
|
+
"type": "command",
|
|
192
|
+
"command": "bash .claude/hooks/scripts/file-change-validator.sh"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"description": "Validate externally modified files — advisory staleness warning (v2.1.83+)"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"Notification": [
|
|
199
|
+
{
|
|
200
|
+
"matcher": "*",
|
|
201
|
+
"hooks": [
|
|
202
|
+
{
|
|
203
|
+
"type": "command",
|
|
204
|
+
"command": "#!/bin/bash\ninput=$(cat)\nmsg=$(echo \"$input\" | jq -r '.message // \"\"' 2>/dev/null)\nif [ -n \"$msg\" ]; then\n echo \"[Hook] Notification: $msg\" >&2\nfi\necho \"$input\""
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"description": "Display notifications for long-running operation completions"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"TeammateIdle": [
|
|
211
|
+
{
|
|
212
|
+
"matcher": "*",
|
|
213
|
+
"hooks": [
|
|
214
|
+
{
|
|
215
|
+
"type": "command",
|
|
216
|
+
"command": "#!/bin/bash\ninput=$(cat)\nteammate=$(echo \"$input\" | jq -r '.teammate_id // \"unknown\"' 2>/dev/null)\necho \"[Hook] TeammateIdle: $teammate — available for reassignment\" >&2\necho \"$input\""
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"description": "Track idle Agent Teams members for work reassignment"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"TaskCreated": [
|
|
223
|
+
{
|
|
224
|
+
"matcher": "*",
|
|
225
|
+
"hooks": [
|
|
226
|
+
{
|
|
227
|
+
"type": "command",
|
|
228
|
+
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\ndesc=$(echo \"$input\" | jq -r '.description // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCreated: $task_id — $desc\" >&2\necho \"$input\""
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"description": "Log task creation events for Agent Teams coordination"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"TaskCompleted": [
|
|
235
|
+
{
|
|
236
|
+
"matcher": "*",
|
|
237
|
+
"hooks": [
|
|
238
|
+
{
|
|
239
|
+
"type": "command",
|
|
240
|
+
"command": "#!/bin/bash\ninput=$(cat)\ntask_id=$(echo \"$input\" | jq -r '.task_id // \"\"' 2>/dev/null)\nresult=$(echo \"$input\" | jq -r '.result // \"\"' 2>/dev/null | head -c 60)\necho \"[Hook] TaskCompleted: $task_id — $result\" >&2\necho \"$input\""
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"description": "Log task completion events for Agent Teams coordination"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
162
246
|
"PostCompact": [
|
|
163
247
|
{
|
|
164
248
|
"matcher": "*",
|
|
165
249
|
"hooks": [
|
|
166
250
|
{
|
|
167
251
|
"type": "prompt",
|
|
168
|
-
"prompt": "Context compacted. RULES ACTIVE.\n\nR007: next response MUST start with ┌─ Agent: claude (default) / └─ Task: {task}\nR008: before EVERY tool call → [claude][model] → Tool: Name / Target: path\nR010: write→delegate to subagent; orchestrator read-only (Read/Glob/Grep); git→mgr-gitnerd\nR009: 2+ independent tasks → parallel agents, same message\nR018: 3+ agents OR review cycle → Agent Teams\n\nAutonomous mode: if /tmp/.claude-autonomous-$PPID exists → simple git (add/commit/push) may run directly; Write/Edit still delegates.\nbypassPermissions does NOT persist across compaction — re-enable if tasks seem blocked.\n\nRe-read CLAUDE.md NOW."
|
|
252
|
+
"prompt": "Context compacted. RULES ACTIVE.\n\nR007: next response MUST start with ┌─ Agent: claude (default) / └─ Task: {task}\nR008: before EVERY tool call → [claude][model] → Tool: Name / Target: path\nR010: write→delegate to subagent; orchestrator read-only (Read/Glob/Grep); git→mgr-gitnerd\nR009: 2+ independent tasks → parallel agents, same message\nR018: 3+ agents OR review cycle → Agent Teams\nR000: user communication in Korean (한국어); code/files in English — NON-NEGOTIABLE\n\nAutonomous mode: if /tmp/.claude-autonomous-$PPID exists → simple git (add/commit/push) may run directly; Write/Edit still delegates.\nbypassPermissions does NOT persist across compaction — re-enable if tasks seem blocked.\n\nRe-read CLAUDE.md NOW."
|
|
169
253
|
}
|
|
170
254
|
],
|
|
171
255
|
"description": "Reinforce enforced rules after context compaction — prevents rule amnesia (v2.1.76+)"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CwdChanged hook — detect project type on directory change
|
|
3
|
+
# Advisory only — provides context hints when cwd changes
|
|
4
|
+
|
|
5
|
+
input=$(cat)
|
|
6
|
+
new_cwd=$(echo "$input" | jq -r '.new_cwd // ""' 2>/dev/null)
|
|
7
|
+
|
|
8
|
+
if [ -z "$new_cwd" ] || [ ! -d "$new_cwd" ]; then
|
|
9
|
+
echo "$input"
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
hints=""
|
|
14
|
+
|
|
15
|
+
# Detect project type indicators
|
|
16
|
+
if [ -f "$new_cwd/package.json" ]; then
|
|
17
|
+
hints="${hints}[Hook] Node.js project detected\n"
|
|
18
|
+
fi
|
|
19
|
+
if [ -f "$new_cwd/go.mod" ]; then
|
|
20
|
+
hints="${hints}[Hook] Go project detected\n"
|
|
21
|
+
fi
|
|
22
|
+
if [ -f "$new_cwd/Cargo.toml" ]; then
|
|
23
|
+
hints="${hints}[Hook] Rust project detected\n"
|
|
24
|
+
fi
|
|
25
|
+
if [ -f "$new_cwd/pyproject.toml" ] || [ -f "$new_cwd/requirements.txt" ]; then
|
|
26
|
+
hints="${hints}[Hook] Python project detected\n"
|
|
27
|
+
fi
|
|
28
|
+
if [ -f "$new_cwd/CLAUDE.md" ]; then
|
|
29
|
+
hints="${hints}[Hook] oh-my-customcode project detected\n"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if [ -n "$hints" ]; then
|
|
33
|
+
printf "%b" "$hints" >&2
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
echo "$input"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# FileChanged hook — detect external file modifications
|
|
3
|
+
# Advisory warning when files are modified outside Claude Code
|
|
4
|
+
|
|
5
|
+
input=$(cat)
|
|
6
|
+
file_path=$(echo "$input" | jq -r '.file_path // ""' 2>/dev/null)
|
|
7
|
+
change_type=$(echo "$input" | jq -r '.change_type // "modified"' 2>/dev/null)
|
|
8
|
+
|
|
9
|
+
if [ -z "$file_path" ]; then
|
|
10
|
+
echo "$input"
|
|
11
|
+
exit 0
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
echo "[Hook] External file change detected: ${change_type} ${file_path}" >&2
|
|
15
|
+
|
|
16
|
+
# Warn about important files
|
|
17
|
+
case "$file_path" in
|
|
18
|
+
*/CLAUDE.md|*/hooks.json|*/settings*.json)
|
|
19
|
+
echo "[Hook] WARNING: Configuration file changed externally — re-read recommended" >&2
|
|
20
|
+
;;
|
|
21
|
+
*.lock|*lockfile*)
|
|
22
|
+
echo "[Hook] Lock file changed — dependency state may have shifted" >&2
|
|
23
|
+
;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
echo "$input"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# UserPromptSubmit hook — advisory pre-processing of user input
|
|
3
|
+
# Provides skill matching hints based on user input patterns
|
|
4
|
+
# Advisory only — never blocks user prompt submission
|
|
5
|
+
|
|
6
|
+
input=$(cat)
|
|
7
|
+
user_input=$(echo "$input" | jq -r '.user_input // ""' 2>/dev/null)
|
|
8
|
+
|
|
9
|
+
if [ -z "$user_input" ]; then
|
|
10
|
+
echo "$input"
|
|
11
|
+
exit 0
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# Detect common patterns and provide advisory hints
|
|
15
|
+
hints=""
|
|
16
|
+
|
|
17
|
+
# Korean session-end signals
|
|
18
|
+
if echo "$user_input" | grep -qiE '(끝|종료|마무리|done|wrap up|end session)'; then
|
|
19
|
+
hints="${hints}[Hook] Session-end signal detected — R011 memory saves will be triggered\n"
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Workflow invocation
|
|
23
|
+
if echo "$user_input" | grep -qE '^/'; then
|
|
24
|
+
hints="${hints}[Hook] Slash command detected\n"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Output hints to stderr (advisory)
|
|
28
|
+
if [ -n "$hints" ]; then
|
|
29
|
+
printf "%b" "$hints" >&2
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "$input"
|
|
@@ -63,6 +63,53 @@ domain: backend # backend | frontend | data-engineering | devops |
|
|
|
63
63
|
|
|
64
64
|
> **Note**: `isolation`, `background`, `maxTurns`, `maxTokens`, `mcpServers`, `hooks`, `permissionMode`, `disallowedTools`, `limitations` are supported in Claude Code v2.1.63+. Hook types `PostCompact`, `Elicitation`, `ElicitationResult` require v2.1.76+. `CwdChanged`, `FileChanged` hook events and `managed-settings.d/` drop-in directory require v2.1.83+. Conditional `if` field for hooks requires v2.1.85+.
|
|
65
65
|
|
|
66
|
+
## Hook Event Types
|
|
67
|
+
|
|
68
|
+
All supported hook event types in Claude Code. Agents and skills can reference these in `hooks:` frontmatter.
|
|
69
|
+
|
|
70
|
+
| Event | Trigger | Data Available | Handler Types | CC Version |
|
|
71
|
+
|-------|---------|---------------|---------------|------------|
|
|
72
|
+
| `PreToolUse` | Before tool execution | tool, tool_input | command, prompt | v2.1.63+ |
|
|
73
|
+
| `PostToolUse` | After tool execution | tool, tool_input, tool_output | command, prompt | v2.1.63+ |
|
|
74
|
+
| `PreCompact` | Before context compaction | — | command, prompt | v2.1.76+ |
|
|
75
|
+
| `PostCompact` | After context compaction | — | command, prompt | v2.1.76+ |
|
|
76
|
+
| `Stop` | Session ending | — | command, prompt | v2.1.63+ |
|
|
77
|
+
| `SessionStart` | Session begins | — | command | v2.1.63+ |
|
|
78
|
+
| `SessionEnd` | Session fully closes | — | command | v2.1.76+ |
|
|
79
|
+
| `SubagentStart` | Subagent spawned | agent_type, model, description | command | v2.1.63+ |
|
|
80
|
+
| `SubagentStop` | Subagent completed | agent_type, model, result | command, prompt | v2.1.63+ |
|
|
81
|
+
| `UserPromptSubmit` | User submits prompt | user_input | command, prompt | v2.1.76+ |
|
|
82
|
+
| `Notification` | Long-running op completes | message | command | v2.1.76+ |
|
|
83
|
+
| `CwdChanged` | Working directory changes | old_cwd, new_cwd | command | v2.1.83+ |
|
|
84
|
+
| `FileChanged` | External file modification | file_path, change_type | command | v2.1.83+ |
|
|
85
|
+
| `Elicitation` | Agent requests user input | question | command, prompt | v2.1.76+ |
|
|
86
|
+
| `ElicitationResult` | User responds to elicitation | answer | command, prompt | v2.1.76+ |
|
|
87
|
+
| `PostMessage` | After message sent | message_type | command | v2.1.76+ |
|
|
88
|
+
| `TeammateIdle` | Agent Teams member idle | teammate_id | command | v2.1.83+ |
|
|
89
|
+
| `TaskCreated` | Task created | task_id, description | command | v2.1.83+ |
|
|
90
|
+
| `TaskCompleted` | Task completed | task_id, result | command | v2.1.83+ |
|
|
91
|
+
|
|
92
|
+
### Hook Handler Types
|
|
93
|
+
|
|
94
|
+
| Type | Behavior | Use Case |
|
|
95
|
+
|------|----------|----------|
|
|
96
|
+
| `command` | Execute shell command, stdin receives JSON context | Scripts, validation, logging |
|
|
97
|
+
| `prompt` | Inject text into model context | Rule reinforcement, advisory guidance |
|
|
98
|
+
| `http` | POST to HTTP endpoint | External integrations, webhooks |
|
|
99
|
+
| `agent` | Spawn agent to handle event | Complex event-driven workflows |
|
|
100
|
+
|
|
101
|
+
### Hook Matcher Syntax
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
hooks:
|
|
105
|
+
PreToolUse:
|
|
106
|
+
- matcher: "tool == \"Edit\"" # Match specific tool
|
|
107
|
+
if: "Edit(*.md)" # Conditional filter (v2.1.85+)
|
|
108
|
+
command: "echo hook"
|
|
109
|
+
- matcher: "*" # Match all
|
|
110
|
+
command: "echo hook"
|
|
111
|
+
```
|
|
112
|
+
|
|
66
113
|
## Permission Mode Guidance
|
|
67
114
|
|
|
68
115
|
When spawning agents via the Agent tool, CC applies a default `mode` of `acceptEdits` if not explicitly specified. To maintain consistent permission behavior:
|
|
@@ -54,6 +54,56 @@ When enabled:
|
|
|
54
54
|
|
|
55
55
|
Use when: tasks requiring 3+ iterations consistently, or when generator-evaluator score disagreements exceed 0.3.
|
|
56
56
|
|
|
57
|
+
### Evaluator Calibration
|
|
58
|
+
|
|
59
|
+
Anthropic's harness design research identifies evaluator leniency as a key failure mode: LLMs default to generous scoring, especially when evaluating output from the same model family. Counter-measures:
|
|
60
|
+
|
|
61
|
+
**Skepticism Prompting**: Include explicit instructions in the evaluator prompt:
|
|
62
|
+
- "Default to skepticism. A 'pass' should require clear evidence, not absence of issues."
|
|
63
|
+
- "Score as if you are reviewing code that will run in production with real users."
|
|
64
|
+
- "When uncertain between pass and fail, choose fail and explain what evidence would change your mind."
|
|
65
|
+
|
|
66
|
+
**Anti-Self-Praise Bias**: When generator and evaluator share the same model family (e.g., both Claude), add:
|
|
67
|
+
- "You are reviewing another agent's work, not your own. Do not give credit for intent — only for execution."
|
|
68
|
+
- "Identify at least one concrete improvement, even for high-quality output."
|
|
69
|
+
|
|
70
|
+
**Calibration via Rubric Examples**: Each rubric criterion SHOULD include a `fail_example` alongside the description:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
rubric:
|
|
74
|
+
- criterion: error_handling
|
|
75
|
+
weight: 0.25
|
|
76
|
+
description: "All error paths handled with meaningful messages"
|
|
77
|
+
fail_example: "Generic try/catch with console.log(error) — no recovery, no user-facing message"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Adding `fail_example` anchors the evaluator's scale, reducing score inflation by ~20% (based on Anthropic's internal testing).
|
|
81
|
+
|
|
82
|
+
### Conditional Evaluator (Cost Optimization)
|
|
83
|
+
|
|
84
|
+
Not every task justifies evaluator overhead. Skip the evaluator loop for tasks within the model's reliable capability range. From Anthropic's research: "Worth cost when tasks sit beyond baseline model capability; unnecessary overhead for problems within model's reliable range."
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
evaluator-optimizer:
|
|
88
|
+
conditional:
|
|
89
|
+
enabled: true
|
|
90
|
+
skip_when:
|
|
91
|
+
- task_complexity: low # Simple, well-defined tasks
|
|
92
|
+
- generator_confidence: high # Generator self-reports high confidence
|
|
93
|
+
- historical_pass_rate: 0.9 # Same task type historically passes first try
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
When `conditional.enabled: true` and ANY `skip_when` condition is met, the evaluator is skipped and the generator's first output is returned directly. This reduces token cost by ~40% for straightforward tasks.
|
|
97
|
+
|
|
98
|
+
**Decision matrix**:
|
|
99
|
+
|
|
100
|
+
| Task Type | Complexity | Evaluator? |
|
|
101
|
+
|-----------|-----------|------------|
|
|
102
|
+
| Simple file rename, config change | Low | Skip |
|
|
103
|
+
| Standard CRUD implementation | Medium | Run |
|
|
104
|
+
| Complex architecture, security-critical | High | Run with pre-negotiation |
|
|
105
|
+
| Previously failed task retry | Any | Always run |
|
|
106
|
+
|
|
57
107
|
### Parameter Details
|
|
58
108
|
|
|
59
109
|
| Parameter | Required | Default | Description |
|
|
@@ -224,6 +274,7 @@ evaluator-optimizer:
|
|
|
224
274
|
- criterion: correctness
|
|
225
275
|
weight: 0.35
|
|
226
276
|
description: Code compiles, logic is correct, edge cases handled
|
|
277
|
+
fail_example: "Missing null check on user input causes runtime crash"
|
|
227
278
|
- criterion: style
|
|
228
279
|
weight: 0.2
|
|
229
280
|
description: Follows project conventions, clean and readable
|
|
@@ -328,6 +379,7 @@ When ecomode is active (R013), compress output:
|
|
|
328
379
|
- The evaluator prompt MUST include the full rubric to ensure consistent scoring
|
|
329
380
|
- Iteration state (best score, best output) is tracked by the orchestrator
|
|
330
381
|
- The hard cap of 5 iterations prevents runaway refinement loops
|
|
382
|
+
- For multi-sprint runs (5+ iterations), consider context reset: spawn a fresh evaluator agent rather than continuing with degraded context. The workflow-runner supports this via `context: fork` on individual steps. Anthropic's research confirms "context resets provide clean slates superior to compaction" for long-running evaluation.
|
|
331
383
|
|
|
332
384
|
## Domain Examples
|
|
333
385
|
|
|
@@ -116,6 +116,75 @@ OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
|
|
116
116
|
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
+
## Advanced OTel Configuration
|
|
120
|
+
|
|
121
|
+
### Additional Metrics
|
|
122
|
+
|
|
123
|
+
| Metric | Description | Unit |
|
|
124
|
+
|--------|-------------|------|
|
|
125
|
+
| `code_edit_tool.decision` | Edit tool accept/reject decisions | count |
|
|
126
|
+
|
|
127
|
+
### Exporter Configuration
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"env": {
|
|
132
|
+
"OTEL_METRICS_EXPORTER": "otlp",
|
|
133
|
+
"OTEL_LOGS_EXPORTER": "otlp",
|
|
134
|
+
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
|
|
135
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317",
|
|
136
|
+
"OTEL_RESOURCE_ATTRIBUTES": "service.name=claude-code,service.version=2.1.85"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Cardinality Controls
|
|
142
|
+
|
|
143
|
+
| Variable | Description | Default |
|
|
144
|
+
|----------|-------------|---------|
|
|
145
|
+
| `OTEL_LOG_TOOL_DETAILS` | Include tool input/output in logs | `false` |
|
|
146
|
+
| `OTEL_METRICS_INCLUDE_TOOL_NAME` | Include tool name dimension | `true` |
|
|
147
|
+
| `OTEL_METRICS_INCLUDE_MODEL` | Include model dimension | `true` |
|
|
148
|
+
|
|
149
|
+
### Multi-Exporter Syntax
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Send metrics to both console and OTLP
|
|
153
|
+
OTEL_METRICS_EXPORTER=console,otlp
|
|
154
|
+
OTEL_LOGS_EXPORTER=console,otlp
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Prometheus Exporter
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
OTEL_METRICS_EXPORTER=prometheus
|
|
161
|
+
OTEL_EXPORTER_PROMETHEUS_PORT=9464
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Data Privacy
|
|
165
|
+
|
|
166
|
+
Environment variables to control data collection and telemetry:
|
|
167
|
+
|
|
168
|
+
| Variable | Description |
|
|
169
|
+
|----------|-------------|
|
|
170
|
+
| `DISABLE_TELEMETRY` | Disable all telemetry collection |
|
|
171
|
+
| `DISABLE_ERROR_REPORTING` | Disable error reporting to Anthropic |
|
|
172
|
+
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Disable non-essential network traffic |
|
|
173
|
+
| `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` | Disable feedback survey prompts |
|
|
174
|
+
| `DO_NOT_TRACK` | Standard DNT signal |
|
|
175
|
+
|
|
176
|
+
### Enterprise Configuration
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"env": {
|
|
181
|
+
"DISABLE_TELEMETRY": "1",
|
|
182
|
+
"DISABLE_ERROR_REPORTING": "1",
|
|
183
|
+
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
119
188
|
## HTTP-Level Inspection (Optional)
|
|
120
189
|
|
|
121
190
|
For deeper payload-level debugging beyond aggregated metrics, [Claude Inspector](https://github.com/kangraemin/claude-inspector) provides MITM proxy inspection of Claude Code HTTP traffic.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Claude Code CLI Flags & Modes
|
|
2
|
+
|
|
3
|
+
## CLI Flags Reference
|
|
4
|
+
|
|
5
|
+
| Flag | Description | Example |
|
|
6
|
+
|------|------------|---------|
|
|
7
|
+
| `--worktree` | Run in isolated git worktree | `claude --worktree "fix bug"` |
|
|
8
|
+
| `--remote` | Connect to remote Claude Code instance | `claude --remote` |
|
|
9
|
+
| `--bare` | Minimal UI, no statusline | `claude --bare` |
|
|
10
|
+
| `--agent <name>` | Use specific agent as main thread | `claude --agent lang-golang-expert` |
|
|
11
|
+
| `--agents` | List available agents | `claude --agents` |
|
|
12
|
+
| `--from-pr <url>` | Start from a pull request | `claude --from-pr https://github.com/org/repo/pull/123` |
|
|
13
|
+
| `--chrome` | Enable Chrome browser automation | `claude --chrome` |
|
|
14
|
+
| `--json-schema` | Output JSON schema for structured output | `claude --json-schema schema.json` |
|
|
15
|
+
| `--max-budget-usd <n>` | Set maximum spend cap | `claude --max-budget-usd 5.00` |
|
|
16
|
+
| `--fallback-model <id>` | Model to use when primary unavailable | `claude --fallback-model claude-sonnet-4-6` |
|
|
17
|
+
| `--fork-session` | Fork an existing session | `claude --fork-session` |
|
|
18
|
+
| `--teleport` | Transfer session context to another terminal | `claude --teleport` |
|
|
19
|
+
|
|
20
|
+
## Headless Mode (`claude -p`)
|
|
21
|
+
|
|
22
|
+
Headless mode runs Claude Code non-interactively, useful for CI/CD pipelines and automated workflows.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Basic pipe mode
|
|
26
|
+
echo "explain this code" | claude -p
|
|
27
|
+
|
|
28
|
+
# With JSON output
|
|
29
|
+
echo "list all TODOs" | claude -p --output-format json
|
|
30
|
+
|
|
31
|
+
# Stream JSON events
|
|
32
|
+
echo "refactor this function" | claude -p --output-format stream-json
|
|
33
|
+
|
|
34
|
+
# With specific model
|
|
35
|
+
echo "review PR" | claude -p --model claude-sonnet-4-6
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Output Formats
|
|
39
|
+
|
|
40
|
+
| Format | Flag | Description |
|
|
41
|
+
|--------|------|-------------|
|
|
42
|
+
| Text | (default) | Plain text output |
|
|
43
|
+
| JSON | `--output-format json` | Structured JSON response |
|
|
44
|
+
| Stream JSON | `--output-format stream-json` | Newline-delimited JSON events |
|
|
45
|
+
|
|
46
|
+
### CI Integration
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
# GitHub Actions example
|
|
50
|
+
- name: Claude Code Review
|
|
51
|
+
run: echo "Review this PR for security issues" | claude -p --max-budget-usd 2.00
|
|
52
|
+
env:
|
|
53
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Scheduled Agents (CronCreate)
|
|
57
|
+
|
|
58
|
+
Claude Code supports native scheduled agents via `CronCreate`, `CronDelete`, and `CronList` tools.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Create a scheduled agent
|
|
62
|
+
# CronCreate(schedule: "0 9 * * 1-5", prompt: "check for stale PRs", name: "pr-checker")
|
|
63
|
+
|
|
64
|
+
# List scheduled agents
|
|
65
|
+
# CronList()
|
|
66
|
+
|
|
67
|
+
# Delete a scheduled agent
|
|
68
|
+
# CronDelete(name: "pr-checker")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Schedule Format
|
|
72
|
+
|
|
73
|
+
Standard cron syntax: `minute hour day-of-month month day-of-week`
|
|
74
|
+
|
|
75
|
+
| Pattern | Description |
|
|
76
|
+
|---------|-------------|
|
|
77
|
+
| `0 9 * * 1-5` | Weekdays at 9:00 AM |
|
|
78
|
+
| `0 */6 * * *` | Every 6 hours |
|
|
79
|
+
| `0 0 * * 0` | Weekly on Sunday midnight |
|
|
80
|
+
|
|
81
|
+
### RemoteTrigger
|
|
82
|
+
|
|
83
|
+
For on-demand execution of scheduled agents:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Trigger a scheduled agent immediately
|
|
87
|
+
# RemoteTrigger(name: "pr-checker")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Auto Mode Configuration
|
|
91
|
+
|
|
92
|
+
Auto mode allows Claude Code to make decisions about tool permissions autonomously.
|
|
93
|
+
|
|
94
|
+
### Settings
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"autoMode": {
|
|
99
|
+
"environment": "local",
|
|
100
|
+
"allow": ["Read", "Write", "Edit", "Glob", "Grep"],
|
|
101
|
+
"soft_deny": ["Bash(rm *)", "Bash(git push --force)"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### CLI Commands
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
claude auto-mode defaults # Show default auto mode settings
|
|
110
|
+
claude auto-mode config # Configure auto mode
|
|
111
|
+
claude auto-mode critique # Review auto mode decisions
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Field | Description |
|
|
115
|
+
|-------|-------------|
|
|
116
|
+
| `environment` | Execution context (`local`, `ci`, `container`) |
|
|
117
|
+
| `allow` | Tools auto-approved without prompting |
|
|
118
|
+
| `soft_deny` | Tool patterns that trigger warning before execution |
|
|
119
|
+
|
|
120
|
+
## Environment Variables
|
|
121
|
+
|
|
122
|
+
### Model & Behavior
|
|
123
|
+
|
|
124
|
+
| Variable | Description | Example |
|
|
125
|
+
|----------|-------------|---------|
|
|
126
|
+
| `ANTHROPIC_MODEL` | Override default model | `claude-opus-4-6` |
|
|
127
|
+
| `CLAUDE_CODE_SUBAGENT_MODEL` | Override subagent model | `claude-haiku-4-5` |
|
|
128
|
+
| `CLAUDE_CODE_EFFORT_LEVEL` | Set effort level | `high` |
|
|
129
|
+
| `CLAUDE_CODE_DISABLE_FAST_MODE` | Disable fast mode | `1` |
|
|
130
|
+
|
|
131
|
+
### Agent Teams
|
|
132
|
+
|
|
133
|
+
| Variable | Description |
|
|
134
|
+
|----------|-------------|
|
|
135
|
+
| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` | Enable Agent Teams (`1`) |
|
|
136
|
+
|
|
137
|
+
### Data Privacy
|
|
138
|
+
|
|
139
|
+
| Variable | Description |
|
|
140
|
+
|----------|-------------|
|
|
141
|
+
| `DISABLE_TELEMETRY` | Disable all telemetry collection |
|
|
142
|
+
| `DISABLE_ERROR_REPORTING` | Disable error reporting to Anthropic |
|
|
143
|
+
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Disable non-essential network traffic |
|
|
144
|
+
| `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` | Disable feedback survey prompts |
|
|
145
|
+
| `DO_NOT_TRACK` | Standard DNT signal — disables tracking |
|
|
146
|
+
|
|
147
|
+
## Related
|
|
148
|
+
|
|
149
|
+
- [Monitoring Guide](10-monitoring.md) — OTel metrics and events
|
|
150
|
+
- [Sub-agents Guide](11-sub-agents.md) — Agent spawning and coordination
|
|
151
|
+
- [Workflow Patterns](12-workflow-patterns.md) — Workflow automation
|
package/templates/manifest.json
CHANGED