codeforge-dev 1.4.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.
Files changed (131) hide show
  1. package/.devcontainer/.env +22 -0
  2. package/.devcontainer/CHANGELOG.md +197 -0
  3. package/.devcontainer/CLAUDE.md +117 -0
  4. package/.devcontainer/README.md +222 -0
  5. package/.devcontainer/config/main-system-prompt.md +502 -0
  6. package/.devcontainer/config/settings.json +47 -0
  7. package/.devcontainer/devcontainer.json +94 -0
  8. package/.devcontainer/features/README.md +113 -0
  9. package/.devcontainer/features/agent-browser/README.md +65 -0
  10. package/.devcontainer/features/agent-browser/devcontainer-feature.json +23 -0
  11. package/.devcontainer/features/agent-browser/install.sh +79 -0
  12. package/.devcontainer/features/ast-grep/README.md +24 -0
  13. package/.devcontainer/features/ast-grep/devcontainer-feature.json +24 -0
  14. package/.devcontainer/features/ast-grep/install.sh +51 -0
  15. package/.devcontainer/features/ccstatusline/README.md +296 -0
  16. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +19 -0
  17. package/.devcontainer/features/ccstatusline/install.sh +290 -0
  18. package/.devcontainer/features/ccusage/README.md +205 -0
  19. package/.devcontainer/features/ccusage/devcontainer-feature.json +38 -0
  20. package/.devcontainer/features/ccusage/install.sh +132 -0
  21. package/.devcontainer/features/claude-code/README.md +498 -0
  22. package/.devcontainer/features/claude-code/config/settings.json +36 -0
  23. package/.devcontainer/features/claude-code/config/system-prompt.md +118 -0
  24. package/.devcontainer/features/claude-code/config/world-building-sp.md +1432 -0
  25. package/.devcontainer/features/claude-code/devcontainer-feature.json +42 -0
  26. package/.devcontainer/features/claude-code/install.sh +466 -0
  27. package/.devcontainer/features/claude-monitor/README.md +74 -0
  28. package/.devcontainer/features/claude-monitor/devcontainer-feature.json +38 -0
  29. package/.devcontainer/features/claude-monitor/install.sh +99 -0
  30. package/.devcontainer/features/lsp-servers/README.md +85 -0
  31. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +40 -0
  32. package/.devcontainer/features/lsp-servers/install.sh +116 -0
  33. package/.devcontainer/features/mcp-qdrant/CHANGES.md +399 -0
  34. package/.devcontainer/features/mcp-qdrant/README.md +474 -0
  35. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +57 -0
  36. package/.devcontainer/features/mcp-qdrant/install.sh +295 -0
  37. package/.devcontainer/features/mcp-qdrant/poststart-hook.sh +129 -0
  38. package/.devcontainer/features/mcp-reasoner/README.md +177 -0
  39. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +20 -0
  40. package/.devcontainer/features/mcp-reasoner/install.sh +177 -0
  41. package/.devcontainer/features/mcp-reasoner/poststart-hook.sh +67 -0
  42. package/.devcontainer/features/notify-hook/README.md +86 -0
  43. package/.devcontainer/features/notify-hook/devcontainer-feature.json +23 -0
  44. package/.devcontainer/features/notify-hook/install.sh +38 -0
  45. package/.devcontainer/features/splitrail/README.md +140 -0
  46. package/.devcontainer/features/splitrail/devcontainer-feature.json +34 -0
  47. package/.devcontainer/features/splitrail/install.sh +129 -0
  48. package/.devcontainer/features/tree-sitter/README.md +138 -0
  49. package/.devcontainer/features/tree-sitter/devcontainer-feature.json +52 -0
  50. package/.devcontainer/features/tree-sitter/install.sh +173 -0
  51. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +106 -0
  52. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +7 -0
  53. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/hooks/hooks.json +17 -0
  54. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-file.py +101 -0
  55. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +7 -0
  56. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +17 -0
  57. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +137 -0
  58. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/.claude-plugin/plugin.json +8 -0
  59. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/claude-code-headless/SKILL.md +387 -0
  60. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/claude-code-headless/references/cli-flags-and-output.md +312 -0
  61. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/claude-code-headless/references/sdk-and-mcp.md +569 -0
  62. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker/SKILL.md +309 -0
  63. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker/references/compose-services.md +438 -0
  64. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker/references/dockerfile-patterns.md +340 -0
  65. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker-py/SKILL.md +412 -0
  66. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker-py/references/container-lifecycle.md +388 -0
  67. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/docker-py/references/resources-and-security.md +444 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/fastapi/SKILL.md +344 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/fastapi/references/middleware-and-lifespan.md +254 -0
  70. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/fastapi/references/pydantic-models.md +245 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/fastapi/references/routing-and-dependencies.md +255 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/fastapi/references/sse-and-streaming.md +318 -0
  73. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/pydantic-ai/SKILL.md +345 -0
  74. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/pydantic-ai/references/agents-and-tools.md +271 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/pydantic-ai/references/models-and-streaming.md +422 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/skill-building/SKILL.md +220 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/skill-building/references/cross-vendor-principles.md +139 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/skill-building/references/patterns-and-antipatterns.md +376 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/skill-building/references/skill-authoring-patterns.md +356 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/sqlite/SKILL.md +329 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/sqlite/references/advanced-queries.md +314 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/sqlite/references/javascript-patterns.md +323 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/sqlite/references/python-patterns.md +354 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/sqlite/references/schema-and-pragmas.md +326 -0
  85. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/SKILL.md +356 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/ai-sdk-svelte.md +128 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/component-patterns.md +332 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/layercake.md +203 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/migration-guide.md +350 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/runes-and-reactivity.md +328 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/spa-and-routing.md +262 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/svelte5/references/svelte-dnd-action.md +181 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/testing/SKILL.md +414 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/testing/references/fastapi-testing.md +411 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/codedirective-skills/skills/testing/references/svelte-testing.md +538 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/codeforge-lsp/.claude-plugin/plugin.json +7 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/.claude-plugin/plugin.json +7 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/hooks/hooks.json +17 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/block-dangerous.py +110 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/.claude-plugin/plugin.json +7 -0
  101. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +17 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +7 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +17 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/.claude-plugin/plugin.json +7 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/hooks/hooks.json +17 -0
  106. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +108 -0
  107. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/commands/ticket/357/200/272create-pr.md +337 -0
  108. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/commands/ticket/357/200/272new.md +166 -0
  109. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/commands/ticket/357/200/272review-commit.md +290 -0
  110. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/commands/ticket/357/200/272work.md +257 -0
  111. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/plugin.json +8 -0
  112. package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/system-prompt.md +184 -0
  113. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +6 -0
  114. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +14 -0
  115. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +989 -0
  116. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +33 -0
  117. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  118. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +71 -0
  119. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +68 -0
  120. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +120 -0
  121. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +133 -0
  122. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +253 -0
  123. package/.devcontainer/scripts/setup-aliases.sh +80 -0
  124. package/.devcontainer/scripts/setup-config.sh +28 -0
  125. package/.devcontainer/scripts/setup-irie-claude.sh +32 -0
  126. package/.devcontainer/scripts/setup-plugins.sh +80 -0
  127. package/.devcontainer/scripts/setup.sh +58 -0
  128. package/LICENSE.txt +674 -0
  129. package/README.md +267 -0
  130. package/package.json +44 -0
  131. package/setup.js +83 -0
@@ -0,0 +1,312 @@
1
+ # CLI Flags and Output — Deep Dive
2
+
3
+ ## 1. Complete Flag Reference
4
+
5
+ ### Core Flags
6
+
7
+ | Flag | Description | Print Mode | Interactive |
8
+ |------|-------------|:----------:|:-----------:|
9
+ | `-p`, `--print` | Non-interactive mode; emit result and exit | Required | — |
10
+ | `--output-format` | `text`, `json`, `stream-json` | Yes | No |
11
+ | `--input-format` | `text`, `stream-json` (for pipeline chaining) | Yes | No |
12
+ | `--model` | Model alias (`sonnet`, `opus`, `haiku`) or full name | Yes | Yes |
13
+ | `--fallback-model` | Auto-fallback when primary model is overloaded | Yes | No |
14
+ | `--max-turns` | Maximum agentic turns; exits with error at limit | Yes | No |
15
+ | `--max-budget-usd` | Maximum dollar spend for the invocation | Yes | No |
16
+ | `--verbose` | Full turn-by-turn output to stderr | Yes | Yes |
17
+ | `--debug` | Debug logging with optional category filter | Yes | Yes |
18
+
19
+ ### Tool and Permission Flags
20
+
21
+ | Flag | Description | Example |
22
+ |------|-------------|---------|
23
+ | `--allowedTools` | Auto-approve matching tools (prefix/glob) | `"Read" "Bash(git *)"` |
24
+ | `--disallowedTools` | Remove tools from model context entirely | `"Write" "Edit"` |
25
+ | `--tools` | Restrict available tool set; `""` = none, `"default"` = all | `"Bash,Read,Glob"` |
26
+ | `--permission-mode` | `default`, `acceptEdits`, `plan`, `bypassPermissions` | `acceptEdits` |
27
+ | `--dangerously-skip-permissions` | Skip all permission prompts | — |
28
+ | `--permission-prompt-tool` | MCP tool name for non-interactive permission handling | `mcp_auth_tool` |
29
+
30
+ ### System Prompt Flags
31
+
32
+ | Flag | Behavior | Modes |
33
+ |------|----------|-------|
34
+ | `--system-prompt` | Replace entire default system prompt | Print + Interactive |
35
+ | `--system-prompt-file` | Replace with file contents | Print only |
36
+ | `--append-system-prompt` | Append to default system prompt | Print + Interactive |
37
+ | `--append-system-prompt-file` | Append file contents to default prompt | Print only |
38
+
39
+ `--system-prompt` and `--system-prompt-file` are mutually exclusive. Append flags can combine with either replacement flag.
40
+
41
+ ### Session Flags
42
+
43
+ | Flag | Description |
44
+ |------|-------------|
45
+ | `-c`, `--continue` | Resume most recent session in current directory |
46
+ | `-r`, `--resume` | Resume specific session by ID or name |
47
+ | `--session-id` | Use a specific UUID as the session ID |
48
+ | `--fork-session` | Create new session ID when resuming (preserves context, diverges history) |
49
+ | `--no-session-persistence` | Do not save session to disk (print mode only) |
50
+
51
+ ### Output Control Flags
52
+
53
+ | Flag | Description |
54
+ |------|-------------|
55
+ | `--json-schema` | JSON Schema for structured output validation |
56
+ | `--include-partial-messages` | Include `stream_event` deltas (requires `stream-json`) |
57
+ | `--replay-user-messages` | Re-emit user messages on stdout (requires `stream-json` input and output) |
58
+
59
+ ### Configuration Flags
60
+
61
+ | Flag | Description |
62
+ |------|-------------|
63
+ | `--mcp-config` | Load MCP servers from JSON file or string |
64
+ | `--strict-mcp-config` | Only use MCP servers from `--mcp-config`, ignore all others |
65
+ | `--agents` | Define custom subagents via JSON |
66
+ | `--settings` | Path to settings JSON file or inline JSON string |
67
+ | `--setting-sources` | Comma-separated: `user`, `project`, `local` |
68
+ | `--add-dir` | Add additional working directories |
69
+ | `--betas` | Beta feature headers (API key users only) |
70
+
71
+ ---
72
+
73
+ ## 2. JSON Output Schema
74
+
75
+ When using `--output-format json`, the response is a single JSON object:
76
+
77
+ ```json
78
+ {
79
+ "type": "result",
80
+ "subtype": "success",
81
+ "session_id": "abc123-def456-...",
82
+ "is_error": false,
83
+ "result": "The text content of Claude's final response",
84
+ "num_turns": 5,
85
+ "duration_ms": 15230,
86
+ "duration_api_ms": 12100,
87
+ "total_cost_usd": 0.042,
88
+ "usage": {
89
+ "inputTokens": 12500,
90
+ "outputTokens": 3200,
91
+ "cacheReadInputTokens": 8000,
92
+ "cacheCreationInputTokens": 4500
93
+ },
94
+ "modelUsage": {
95
+ "claude-sonnet-4-20250514": {
96
+ "inputTokens": 12500,
97
+ "outputTokens": 3200,
98
+ "cacheReadInputTokens": 8000,
99
+ "cacheCreationInputTokens": 4500,
100
+ "webSearchRequests": 0,
101
+ "costUSD": 0.042,
102
+ "contextWindow": 200000
103
+ }
104
+ },
105
+ "permission_denials": [],
106
+ "structured_output": null
107
+ }
108
+ ```
109
+
110
+ Error subtypes replace `"success"` with one of:
111
+ - `"error_max_turns"` — agentic turn limit reached
112
+ - `"error_max_budget_usd"` — budget limit exceeded
113
+ - `"error_during_execution"` — runtime error
114
+ - `"error_max_structured_output_retries"` — JSON schema validation retries exhausted
115
+
116
+ Error results include an `errors` array instead of `result`:
117
+
118
+ ```json
119
+ {
120
+ "type": "result",
121
+ "subtype": "error_max_turns",
122
+ "is_error": true,
123
+ "errors": ["Maximum number of turns (10) reached"],
124
+ "total_cost_usd": 0.035
125
+ }
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 3. Stream-JSON Event Type Catalog
131
+
132
+ ### system (init)
133
+
134
+ Emitted once at session start. Contains session metadata:
135
+
136
+ ```typescript
137
+ type SDKSystemMessage = {
138
+ type: "system";
139
+ subtype: "init";
140
+ uuid: string;
141
+ session_id: string;
142
+ apiKeySource: "user" | "project" | "org" | "temporary";
143
+ cwd: string;
144
+ tools: string[];
145
+ mcp_servers: { name: string; status: string }[];
146
+ model: string;
147
+ permissionMode: string;
148
+ slash_commands: string[];
149
+ output_style: string;
150
+ };
151
+ ```
152
+
153
+ Example:
154
+
155
+ ```json
156
+ {"type":"system","subtype":"init","session_id":"abc-123","model":"claude-sonnet-4-20250514","tools":["Read","Write","Edit","Bash","Glob","Grep"],"permissionMode":"acceptEdits","cwd":"/home/user/project"}
157
+ ```
158
+
159
+ ### assistant
160
+
161
+ Claude's response containing text and/or tool use content blocks:
162
+
163
+ ```typescript
164
+ type SDKAssistantMessage = {
165
+ type: "assistant";
166
+ uuid: string;
167
+ session_id: string;
168
+ message: {
169
+ role: "assistant";
170
+ content: (TextBlock | ToolUseBlock | ThinkingBlock)[];
171
+ };
172
+ parent_tool_use_id: string | null;
173
+ };
174
+ ```
175
+
176
+ Example:
177
+
178
+ ```json
179
+ {"type":"assistant","session_id":"abc-123","message":{"role":"assistant","content":[{"type":"text","text":"Reading the file..."},{"type":"tool_use","id":"tu_1","name":"Read","input":{"file_path":"/app/main.py"}}]},"parent_tool_use_id":null}
180
+ ```
181
+
182
+ ### user
183
+
184
+ Tool results and user input fed back to the model:
185
+
186
+ ```typescript
187
+ type SDKUserMessage = {
188
+ type: "user";
189
+ uuid?: string;
190
+ session_id: string;
191
+ message: {
192
+ role: "user";
193
+ content: (ToolResultBlock | TextBlock)[];
194
+ };
195
+ parent_tool_use_id: string | null;
196
+ };
197
+ ```
198
+
199
+ ### stream_event (partial messages)
200
+
201
+ Only emitted when `--include-partial-messages` is set. Provides token-by-token streaming deltas from the Anthropic API:
202
+
203
+ ```typescript
204
+ type SDKPartialAssistantMessage = {
205
+ type: "stream_event";
206
+ uuid: string;
207
+ session_id: string;
208
+ event: RawMessageStreamEvent;
209
+ parent_tool_use_id: string | null;
210
+ };
211
+ ```
212
+
213
+ Common event subtypes within `event`:
214
+ - `content_block_start` — beginning of a text or tool_use block
215
+ - `content_block_delta` — incremental content (`text_delta` or `input_json_delta`)
216
+ - `content_block_stop` — end of a content block
217
+ - `message_start` / `message_stop` — message boundaries
218
+
219
+ ### result
220
+
221
+ Final event signaling completion:
222
+
223
+ ```typescript
224
+ type SDKResultMessage = {
225
+ type: "result";
226
+ subtype: "success" | "error_max_turns" | "error_during_execution" | "error_max_budget_usd" | "error_max_structured_output_retries";
227
+ uuid: string;
228
+ session_id: string;
229
+ is_error: boolean;
230
+ num_turns: number;
231
+ duration_ms: number;
232
+ duration_api_ms: number;
233
+ total_cost_usd: number;
234
+ usage: {
235
+ inputTokens: number;
236
+ outputTokens: number;
237
+ cacheReadInputTokens: number;
238
+ cacheCreationInputTokens: number;
239
+ };
240
+ modelUsage: Record<string, ModelUsage>;
241
+ permission_denials: { tool: string; reason: string }[];
242
+ result?: string;
243
+ structured_output?: unknown;
244
+ errors?: string[];
245
+ };
246
+ ```
247
+
248
+ ### system (compact_boundary)
249
+
250
+ Emitted when conversation compaction occurs mid-session:
251
+
252
+ ```json
253
+ {"type":"system","subtype":"compact_boundary","session_id":"abc-123","compact_metadata":{"trigger":"auto","pre_tokens":180000}}
254
+ ```
255
+
256
+ ---
257
+
258
+ ## 4. Pipeline Chaining
259
+
260
+ Chain multiple Claude invocations using `--input-format stream-json` and `--output-format stream-json`:
261
+
262
+ ```bash
263
+ # First agent analyzes, second agent acts on findings
264
+ claude -p "Identify all security vulnerabilities" \
265
+ --output-format stream-json \
266
+ --permission-mode plan \
267
+ | claude -p "Fix the identified vulnerabilities" \
268
+ --input-format stream-json \
269
+ --output-format stream-json \
270
+ --permission-mode acceptEdits \
271
+ | claude -p "Write a summary of changes made" \
272
+ --input-format stream-json \
273
+ --output-format json
274
+ ```
275
+
276
+ When using `--input-format stream-json`, the agent receives the full conversation history from the upstream agent as context. The `--replay-user-messages` flag re-emits user messages from the input stream on stdout, preserving the full event sequence for downstream consumers.
277
+
278
+ ---
279
+
280
+ ## 5. Environment Variables
281
+
282
+ | Variable | Purpose |
283
+ |----------|---------|
284
+ | `ANTHROPIC_API_KEY` | API key for direct Anthropic authentication |
285
+ | `ANTHROPIC_MODEL` | Default model (overridden by `--model` flag) |
286
+ | `CLAUDE_CODE_USE_BEDROCK` | Set to `1` for Amazon Bedrock provider |
287
+ | `CLAUDE_CODE_USE_VERTEX` | Set to `1` for Google Vertex AI provider |
288
+ | `CLAUDE_CODE_USE_FOUNDRY` | Set to `1` for Microsoft Azure AI Foundry provider |
289
+
290
+ Provider-specific authentication follows the respective cloud SDK conventions (AWS credentials for Bedrock, Google ADC for Vertex, Azure credentials for Foundry).
291
+
292
+ ---
293
+
294
+ ## 6. Verbose and Debug Output
295
+
296
+ `--verbose` writes full turn-by-turn output to stderr, including tool invocations and their results. Useful for debugging automation scripts:
297
+
298
+ ```bash
299
+ claude -p "Fix the tests" --output-format json --verbose 2>debug.log
300
+ ```
301
+
302
+ `--debug` enables debug-level logging with optional category filtering:
303
+
304
+ ```bash
305
+ # All debug output
306
+ claude -p "query" --debug
307
+
308
+ # Specific categories
309
+ claude -p "query" --debug "api,mcp"
310
+ ```
311
+
312
+ Debug categories include `api` (API requests/responses), `mcp` (MCP server communication), and other internal subsystems. Debug output goes to stderr, keeping stdout clean for piping.