agentsys 5.3.0 → 5.3.2

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 (137) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor/commands/audit-project-agents.md +454 -0
  4. package/.cursor/commands/audit-project-github.md +141 -0
  5. package/.cursor/commands/audit-project.md +330 -0
  6. package/.cursor/commands/consult.md +417 -0
  7. package/.cursor/commands/debate.md +381 -0
  8. package/.cursor/commands/delivery-approval.md +334 -0
  9. package/.cursor/commands/deslop.md +142 -0
  10. package/.cursor/commands/drift-detect.md +259 -0
  11. package/.cursor/commands/enhance.md +172 -0
  12. package/.cursor/commands/learn.md +165 -0
  13. package/.cursor/commands/next-task.md +519 -0
  14. package/.cursor/commands/perf.md +464 -0
  15. package/.cursor/commands/repo-map.md +124 -0
  16. package/.cursor/commands/ship-ci-review-loop.md +468 -0
  17. package/.cursor/commands/ship-deployment.md +348 -0
  18. package/.cursor/commands/ship-error-handling.md +265 -0
  19. package/.cursor/commands/ship.md +517 -0
  20. package/.cursor/commands/sync-docs.md +171 -0
  21. package/.cursor/commands/web-ctl.md +101 -0
  22. package/.cursor/skills/consult/SKILL.md +425 -0
  23. package/.cursor/skills/debate/SKILL.md +316 -0
  24. package/.cursor/skills/deslop/SKILL.md +204 -0
  25. package/.cursor/skills/discover-tasks/SKILL.md +297 -0
  26. package/.cursor/skills/drift-analysis/SKILL.md +324 -0
  27. package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
  28. package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
  29. package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
  30. package/.cursor/skills/enhance-docs/SKILL.md +298 -0
  31. package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
  32. package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
  33. package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
  34. package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
  35. package/.cursor/skills/enhance-skills/SKILL.md +436 -0
  36. package/.cursor/skills/learn/SKILL.md +349 -0
  37. package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
  38. package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
  39. package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
  40. package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
  41. package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
  42. package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
  43. package/.cursor/skills/perf-profiler/SKILL.md +42 -0
  44. package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
  45. package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
  46. package/.cursor/skills/repo-mapping/SKILL.md +83 -0
  47. package/.cursor/skills/sync-docs/SKILL.md +351 -0
  48. package/.cursor/skills/validate-delivery/SKILL.md +186 -0
  49. package/.cursor/skills/web-auth/SKILL.md +177 -0
  50. package/.cursor/skills/web-browse/SKILL.md +516 -0
  51. package/.kiro/agents/agent-enhancer.json +12 -0
  52. package/.kiro/agents/ci-fixer.json +13 -0
  53. package/.kiro/agents/ci-monitor.json +12 -0
  54. package/.kiro/agents/claudemd-enhancer.json +12 -0
  55. package/.kiro/agents/consult-agent.json +13 -0
  56. package/.kiro/agents/cross-file-enhancer.json +12 -0
  57. package/.kiro/agents/debate-orchestrator.json +13 -0
  58. package/.kiro/agents/delivery-validator.json +12 -0
  59. package/.kiro/agents/deslop-agent.json +12 -0
  60. package/.kiro/agents/docs-enhancer.json +12 -0
  61. package/.kiro/agents/exploration-agent.json +12 -0
  62. package/.kiro/agents/hooks-enhancer.json +11 -0
  63. package/.kiro/agents/implementation-agent.json +13 -0
  64. package/.kiro/agents/learn-agent.json +12 -0
  65. package/.kiro/agents/map-validator.json +11 -0
  66. package/.kiro/agents/perf-analyzer.json +12 -0
  67. package/.kiro/agents/perf-code-paths.json +11 -0
  68. package/.kiro/agents/perf-investigation-logger.json +12 -0
  69. package/.kiro/agents/perf-orchestrator.json +13 -0
  70. package/.kiro/agents/perf-theory-gatherer.json +12 -0
  71. package/.kiro/agents/perf-theory-tester.json +13 -0
  72. package/.kiro/agents/plan-synthesizer.json +12 -0
  73. package/.kiro/agents/planning-agent.json +12 -0
  74. package/.kiro/agents/plugin-enhancer.json +12 -0
  75. package/.kiro/agents/prompt-enhancer.json +12 -0
  76. package/.kiro/agents/reviewer-perf-test.json +11 -0
  77. package/.kiro/agents/reviewer-quality-security.json +11 -0
  78. package/.kiro/agents/simple-fixer.json +13 -0
  79. package/.kiro/agents/skills-enhancer.json +11 -0
  80. package/.kiro/agents/sync-docs-agent.json +13 -0
  81. package/.kiro/agents/task-discoverer.json +12 -0
  82. package/.kiro/agents/test-coverage-checker.json +12 -0
  83. package/.kiro/agents/web-session.json +12 -0
  84. package/.kiro/agents/worktree-manager.json +13 -0
  85. package/.kiro/skills/consult/SKILL.md +425 -0
  86. package/.kiro/skills/debate/SKILL.md +316 -0
  87. package/.kiro/skills/deslop/SKILL.md +204 -0
  88. package/.kiro/skills/discover-tasks/SKILL.md +297 -0
  89. package/.kiro/skills/drift-analysis/SKILL.md +324 -0
  90. package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
  91. package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
  92. package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
  93. package/.kiro/skills/enhance-docs/SKILL.md +298 -0
  94. package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
  95. package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
  96. package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
  97. package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
  98. package/.kiro/skills/enhance-skills/SKILL.md +436 -0
  99. package/.kiro/skills/learn/SKILL.md +349 -0
  100. package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
  101. package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
  102. package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
  103. package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
  104. package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
  105. package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
  106. package/.kiro/skills/perf-profiler/SKILL.md +42 -0
  107. package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
  108. package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
  109. package/.kiro/skills/repo-mapping/SKILL.md +83 -0
  110. package/.kiro/skills/sync-docs/SKILL.md +351 -0
  111. package/.kiro/skills/validate-delivery/SKILL.md +186 -0
  112. package/.kiro/skills/web-auth/SKILL.md +177 -0
  113. package/.kiro/skills/web-browse/SKILL.md +516 -0
  114. package/.kiro/steering/audit-project-agents.md +459 -0
  115. package/.kiro/steering/audit-project-github.md +146 -0
  116. package/.kiro/steering/audit-project.md +330 -0
  117. package/.kiro/steering/consult.md +422 -0
  118. package/.kiro/steering/debate.md +386 -0
  119. package/.kiro/steering/delivery-approval.md +339 -0
  120. package/.kiro/steering/deslop.md +149 -0
  121. package/.kiro/steering/drift-detect.md +264 -0
  122. package/.kiro/steering/enhance.md +177 -0
  123. package/.kiro/steering/learn.md +166 -0
  124. package/.kiro/steering/next-task.md +481 -0
  125. package/.kiro/steering/perf.md +469 -0
  126. package/.kiro/steering/repo-map.md +126 -0
  127. package/.kiro/steering/ship-ci-review-loop.md +473 -0
  128. package/.kiro/steering/ship-deployment.md +353 -0
  129. package/.kiro/steering/ship-error-handling.md +270 -0
  130. package/.kiro/steering/ship.md +522 -0
  131. package/.kiro/steering/sync-docs.md +178 -0
  132. package/.kiro/steering/web-ctl.md +106 -0
  133. package/CHANGELOG.md +15 -0
  134. package/bin/cli.js +2 -2
  135. package/lib/adapter-transforms.js +34 -2
  136. package/package.json +1 -1
  137. package/site/content.json +1 -1
@@ -0,0 +1,417 @@
1
+
2
+ # /consult - Cross-Tool AI Consultation
3
+
4
+ You are executing the /consult command. Your job is to parse the user's request (natural language or flags), resolve missing parameters interactively, and execute the consultation.
5
+
6
+ ## Constraints
7
+
8
+ - NEVER expose API keys in commands or output
9
+ - NEVER run with permission-bypassing flags (`--dangerously-skip-permissions`, `bypassPermissions`)
10
+ - MUST use safe-mode defaults (`env -u CLAUDECODE ... --allowedTools "Read,Glob,Grep"` for Claude, `-c model_reasoning_effort` for Codex). For Codex non-interactive exec mode, resolve `SKIP_GIT_FLAG` via trust gate: empty in trusted git repos, `--skip-git-repo-check` only for trusted non-repo execution.
11
+ - MUST enforce 120s timeout on all tool executions
12
+ - MUST validate tool names against allow-list: gemini, codex, claude, opencode, copilot, kiro (reject all others)
13
+ - MUST prefer ACP transport when available (structured protocol, session persistence)
14
+ - MUST fall back to CLI transport when ACP is unavailable
15
+ - MUST validate `--context=file=PATH` is within the project directory (reject absolute paths outside cwd)
16
+ - MUST enforce the Codex trust gate before setting `SKIP_GIT_FLAG` (same project working directory + resolved active tool is Codex, including flag/NLP/picker/`--continue` restore paths)
17
+ - MUST quote all user-provided values in shell commands to prevent injection
18
+ - NEVER execute tools the user has not explicitly requested
19
+
20
+ ## Execution
21
+
22
+ ### Phase 1: Parse Input (Flags + Natural Language)
23
+
24
+ Parse `$ARGUMENTS` using both explicit flags and natural language extraction. Flags always take priority over NLP when both provide the same parameter.
25
+
26
+ #### Step 1a: Extract explicit flags
27
+
28
+ Look for and remove these flags from `$ARGUMENTS`:
29
+
30
+ 1. `--tool=VALUE` or `--tool VALUE` where VALUE is one of: gemini, codex, claude, opencode, copilot, kiro
31
+ 2. `--effort=VALUE` or `--effort VALUE` where VALUE is one of: low, medium, high, max
32
+ 3. `--model=VALUE` or `--model VALUE` (any string, including quoted)
33
+ 4. `--context=VALUE` where VALUE is: diff, file=PATH, or none
34
+ 5. `--continue` (optionally `--continue=SESSION_ID`)
35
+ 6. `--count=N` where N is 1-5
36
+
37
+ Remove all matched flags and their values from `$ARGUMENTS`.
38
+
39
+ #### Step 1b: Natural language extraction (on remaining text)
40
+
41
+ After removing flags, parse the remaining text for these patterns:
42
+
43
+ **Tool extraction** (case-insensitive):
44
+ - "with {tool}" (e.g., "with codex") -> tool
45
+ - "ask {tool}" (e.g., "ask gemini") -> tool
46
+ - "consult {tool}" -> tool
47
+ - "{tool} about" (e.g., "codex about") -> tool
48
+ - Tool names: claude, gemini, codex, opencode, copilot, kiro
49
+
50
+ **Count extraction**:
51
+ - "ask {N} {tool}" (e.g., "ask 3 codex") -> count=N, tool
52
+ - "{N} {tool}" (e.g., "3 codex") -> count=N, tool
53
+ - "{N} instances" -> count=N
54
+ - "few instances" / "multiple" / "several" -> count=ambiguous (ask user in Phase 2)
55
+
56
+ **Count validation**: After extracting count (from flags or NLP), validate: 1 <= count <= 5. If count < 1 or count > 5, show `[ERROR] Instance count must be 1-5. Got: {count}` and stop.
57
+
58
+ **Effort extraction**:
59
+ - "quick" / "fast" / "brief" -> effort=low
60
+ - "thorough" / "deep" / "carefully" / "detailed" -> effort=high
61
+ - "maximum" / "max effort" / "exhaustive" -> effort=max
62
+
63
+ **Question extraction**:
64
+ - Text after "about" is the question (e.g., "with codex about my auth approach" -> question="my auth approach")
65
+ - If no "about" pattern, everything remaining after removing tool/count/effort markers is the question
66
+
67
+ **Precedence rule**: Flags from Step 1a always override NLP from Step 1b.
68
+
69
+ If no question text and no `--continue` flag found after both steps:
70
+ ```
71
+ [ERROR] Usage: /consult "your question" or /consult with gemini about your question
72
+ ```
73
+
74
+ ### Phase 2: Interactive Parameter Resolution
75
+
76
+ MUST resolve ALL missing parameters interactively. ONLY skip this phase if ALL required params (tool, effort, model) are resolved AND either a question exists or --continue is present. Do NOT silently default any parameter.
77
+
78
+ #### Step 2a: Handle --continue
79
+
80
+ **Note:** `--continue` and `--count > 1` are mutually exclusive. Session resume applies to a single tool session. If both are present, show `[ERROR] Cannot use --continue with --count > 1. Use --continue for single session resume.` and stop.
81
+
82
+ If `--continue` is present:
83
+ 1. Read the session file at `{AI_STATE_DIR}/consult/last-session.json`
84
+
85
+ Platform state directory:
86
+ - Claude Code: `.claude/`
87
+ - OpenCode: `.opencode/`
88
+ - Codex CLI: `.codex/`
89
+ 2. If the file exists, restore the saved tool, session_id, and model from it
90
+ 3. If the file does not exist, show `[WARN] No previous session found` and proceed as a fresh consultation
91
+
92
+ #### Step 2b: Detect installed tools
93
+
94
+ Run all 5 checks **in parallel** via Bash:
95
+
96
+ - `where.exe <tool> 2>nul && echo FOUND || echo NOTFOUND` (Windows)
97
+ - `which <tool> 2>/dev/null && echo FOUND || echo NOTFOUND` (Unix)
98
+
99
+ Check for: claude, gemini, codex, opencode, copilot, kiro-cli.
100
+
101
+ #### Step 2b-acp: Detect ACP support (parallel with Step 2b)
102
+
103
+ For each tool found in Step 2b (plus kiro-cli), check ACP support in parallel:
104
+
105
+ ```
106
+ node acp/run.js --detect --provider="claude"
107
+ node acp/run.js --detect --provider="gemini"
108
+ node acp/run.js --detect --provider="codex"
109
+ node acp/run.js --detect --provider="opencode"
110
+ node acp/run.js --detect --provider="copilot"
111
+ node acp/run.js --detect --provider="kiro"
112
+ ```
113
+
114
+ Record which providers have ACP support. This enables:
115
+ - Kiro as a consultation target (ACP-only provider, no CLI mode)
116
+ - Preferred ACP transport for providers that support both CLI and ACP
117
+
118
+ If the `node` command is not available, skip ACP detection and use CLI transport only.
119
+
120
+ If zero tools are installed (neither CLI nor ACP): `[ERROR] No AI CLI tools found. Install at least one: npm i -g @anthropic-ai/claude-code, npm i -g @openai/codex, npm i -g opencode-ai`
121
+
122
+ #### Step 2c: Batch selection for missing params
123
+
124
+ Use a SINGLE AskUserQuestion call to ask all missing parameters at once. Include ONLY questions for parameters NOT already resolved from Phase 1:
125
+
126
+ ```
127
+ AskUserQuestion:
128
+ questions:
129
+ - header: "AI Tool" # SKIP if tool resolved
130
+ question: "Which AI tool should I consult?"
131
+ multiSelect: false
132
+ options (only if installed):
133
+ - label: "Claude" description: "Deep code reasoning"
134
+ - label: "Gemini" description: "Fast multimodal analysis"
135
+ - label: "Codex" description: "Agentic coding"
136
+ - label: "OpenCode" description: "Flexible model choice"
137
+ - label: "Copilot" description: "GitHub-integrated AI"
138
+ - label: "Kiro" description: "AWS agentic AI (ACP only)"
139
+
140
+ - header: "Effort" # SKIP if effort resolved
141
+ question: "What thinking effort level?"
142
+ multiSelect: false
143
+ options:
144
+ - label: "Medium (Recommended)" description: "Balanced speed and quality"
145
+ - label: "Low" description: "Fast, minimal reasoning"
146
+ - label: "High" description: "Thorough analysis"
147
+ - label: "Max" description: "Maximum reasoning depth"
148
+
149
+ - header: "Instances" # SKIP if count resolved or not hinted
150
+ question: "How many parallel consultations?"
151
+ multiSelect: false
152
+ options:
153
+ - label: "1 (Single)" description: "Standard single consultation"
154
+ - label: "2 (Compare)" description: "Two responses to compare"
155
+ - label: "3 (Panel)" description: "Three perspectives"
156
+ - label: "5 (Full spread)" description: "Five diverse perspectives"
157
+ ```
158
+
159
+ ONLY show the Instances question if:
160
+ - The user explicitly mentioned multiple instances (e.g., "few", "multiple", "several")
161
+ - The count was set but ambiguous
162
+ Do NOT show Instances question for simple single-tool requests. Default count=1 silently when no multi-instance intent detected.
163
+
164
+ Map tool choice to lowercase: "Claude" -> "claude", "Codex" -> "codex", etc.
165
+ Map effort choice: "Medium (Recommended)" -> "medium", "Low" -> "low", etc.
166
+ Map count choice: "1 (Single)" -> 1, "2 (Compare)" -> 2, "3 (Panel)" -> 3.
167
+
168
+ #### Step 2d: Model selection (MUST ask if no --model)
169
+
170
+ After tool is resolved, present a model picker with options specific to the selected tool. The user can always type a custom model name via the "Other" option.
171
+
172
+ **For Claude:**
173
+ ```
174
+ AskUserQuestion:
175
+ questions:
176
+ - header: "Model"
177
+ question: "Which Claude model?"
178
+ multiSelect: false
179
+ options:
180
+ - label: "sonnet (Recommended)" description: "Sonnet 4.5 - balanced speed and intelligence"
181
+ - label: "opus" description: "Opus 4.6 - most capable, adaptive thinking"
182
+ - label: "haiku" description: "Haiku 4.5 - fastest, lightweight"
183
+ ```
184
+
185
+ **For Gemini:**
186
+ ```
187
+ AskUserQuestion:
188
+ questions:
189
+ - header: "Model"
190
+ question: "Which Gemini model?"
191
+ multiSelect: false
192
+ options:
193
+ - label: "gemini-3.1-pro-preview" description: "Most capable, strong reasoning"
194
+ - label: "gemini-3-flash-preview" description: "Fast, efficient coding"
195
+ - label: "gemini-2.5-pro" description: "Previous gen pro model"
196
+ - label: "gemini-2.5-flash" description: "Previous gen flash model"
197
+ ```
198
+
199
+ **For Codex:**
200
+ ```
201
+ AskUserQuestion:
202
+ questions:
203
+ - header: "Model"
204
+ question: "Which Codex model?"
205
+ multiSelect: false
206
+ options:
207
+ - label: "gpt-5.3-codex" description: "Latest, most capable coding model"
208
+ - label: "gpt-5.2-codex" description: "Strong coding model"
209
+ - label: "gpt-5.2" description: "General purpose GPT-5.2"
210
+ - label: "gpt-5.3-codex-spark" description: "Cost-effective, 4x more usage"
211
+ ```
212
+
213
+ **For OpenCode (model format: `provider/model`, run `opencode models` to list all):**
214
+ ```
215
+ AskUserQuestion:
216
+ questions:
217
+ - header: "Model"
218
+ question: "Which model? (format: provider/model, type via Other for any)"
219
+ multiSelect: false
220
+ options:
221
+ - label: "opencode/big-pickle" description: "Free - stealth model, 200K context"
222
+ - label: "github-copilot/gemini-3.1-pro-preview" description: "Copilot - Google Gemini 3.1 Pro"
223
+ - label: "opencode/minimax-m2.5-free" description: "Free - 230B MoE, multilingual coding"
224
+ - label: "github-copilot/claude-opus-4.6" description: "Copilot - Claude Opus 4.6"
225
+ ```
226
+
227
+ **For Copilot:**
228
+ ```
229
+ AskUserQuestion:
230
+ questions:
231
+ - header: "Model"
232
+ question: "Which Copilot model?"
233
+ multiSelect: false
234
+ options:
235
+ - label: "claude-sonnet-4-5" description: "Default Copilot model"
236
+ - label: "claude-opus-4-6" description: "Most capable Claude model"
237
+ - label: "gpt-5.3-codex" description: "OpenAI GPT-5.3 Codex"
238
+ - label: "gemini-3.1-pro-preview" description: "Google Gemini 3.1 Pro"
239
+ ```
240
+
241
+ **For Kiro:**
242
+
243
+ Kiro does not support model selection. Skip the model picker for Kiro. Set model to `"kiro"` and proceed directly to Phase 3.
244
+
245
+ Map the user's choice to the model string (strip " (Recommended)" suffix if present).
246
+
247
+ IMPORTANT: Do NOT skip model selection. Do NOT silently use a default model. If --model was not explicitly provided, you MUST present this picker.
248
+
249
+ ### Phase 3: Execute Consultation
250
+
251
+ With all parameters resolved (tool, effort, model, question, count, and optionally context/continue):
252
+
253
+ #### Multi-instance (count > 1)
254
+
255
+ Spawn the `consult-agent` via the Task tool with all resolved parameters:
256
+
257
+ ```
258
+ Task:
259
+ subagent_type: "consult-agent"
260
+ prompt: |
261
+ Execute a multi-instance consultation with these pre-resolved parameters:
262
+ - tool: [tool]
263
+ - model: [model]
264
+ - effort: [effort]
265
+ - question: [question]
266
+ - count: [count]
267
+ - context: [context or none]
268
+
269
+ Run [count] parallel consultations with the same tool and parameters.
270
+ Return all responses formatted with numbered headers and a brief synthesis.
271
+ ```
272
+
273
+ Then skip to Phase 4 (multi-instance).
274
+
275
+ #### Single instance (count=1, the default)
276
+
277
+ Execute the consultation directly. Do NOT call `Skill: consult` - that would recursively load this command file.
278
+
279
+ ##### Step 3a: Resolve model from effort (if not explicit)
280
+
281
+ If `--model` was provided, use it directly. Otherwise map effort to model:
282
+
283
+ | Effort | Claude | Gemini | Codex | OpenCode | Copilot | Kiro |
284
+ |--------|--------|--------|-------|----------|---------|------|
285
+ | low | claude-haiku-4-5 (1 turn) | gemini-3-flash-preview | gpt-5.3-codex (low) | default (low) | no control | n/a |
286
+ | medium | claude-sonnet-4-6 (3 turns) | gemini-3-flash-preview | gpt-5.3-codex (medium) | default (medium) | no control | n/a |
287
+ | high | claude-opus-4-6 (5 turns) | gemini-3.1-pro-preview | gpt-5.3-codex (high) | default (high) | no control | n/a |
288
+ | max | claude-opus-4-6 (10 turns) | gemini-3.1-pro-preview | gpt-5.3-codex (high) | default + --thinking | no control | n/a |
289
+
290
+ **Claude model ID resolution**: If the CLI returns "invalid model identifier", retry with Bedrock format: replace `claude-opus-4-6` with `us.anthropic.claude-opus-4-6-v1`, `claude-sonnet-4-6` with `us.anthropic.claude-sonnet-4-6-v1`, `claude-haiku-4-5` with `us.anthropic.claude-haiku-4-5-20251001-v1:0`.
291
+
292
+ ##### Step 3b: Context packaging
293
+
294
+ If `--context=diff`: run `git diff 2>/dev/null` and prepend output to the question.
295
+ If `--context=file=PATH`: read the file using the Read tool and prepend its content to the question.
296
+
297
+ ##### Step 3c: Write question to temp file
298
+
299
+ Write the full question text (with any prepended context) to `{AI_STATE_DIR}/consult/question.tmp` using the Write tool. Create the `consult/` directory if needed.
300
+
301
+ Platform state directory: `.claude/` (Claude Code), `.opencode/` (OpenCode), `.codex/` (Codex).
302
+
303
+ ##### Step 3d: Codex trust gate (Codex only)
304
+
305
+ If tool is codex, resolve `{SKIP_GIT_FLAG}`:
306
+ 1. Run `git rev-parse --is-inside-work-tree`
307
+ 2. If true: `SKIP_GIT_FLAG` = empty string
308
+ 3. If false: `SKIP_GIT_FLAG` = `--skip-git-repo-check`
309
+
310
+ ##### Step 3e: Build and execute CLI command
311
+
312
+ **For ACP providers** (preferred when ACP was detected in Step 2b-acp):
313
+
314
+ ```
315
+ node acp/run.js --provider="PROVIDER" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000 [--model="MODEL"] [--effort="EFFORT"] [--max-turns=TURNS]
316
+ ```
317
+
318
+ **For CLI providers** (fallback when ACP unavailable):
319
+
320
+ | Provider | Safe Command Pattern |
321
+ |----------|---------------------|
322
+ | Claude | `env -u CLAUDECODE claude -p - --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep" < "{AI_STATE_DIR}/consult/question.tmp"` |
323
+ | Claude (resume) | `env -u CLAUDECODE claude -p - --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep" --resume "SESSION_ID" < "{AI_STATE_DIR}/consult/question.tmp"` |
324
+ | Gemini | `gemini -p - --output-format json -m "MODEL" < "{AI_STATE_DIR}/consult/question.tmp"` |
325
+ | Gemini (resume) | `gemini -p - --output-format json -m "MODEL" --resume "SESSION_ID" < "{AI_STATE_DIR}/consult/question.tmp"` |
326
+ | Codex | `codex exec "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"` |
327
+ | Codex (resume) | `codex exec resume "SESSION_ID" "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"` |
328
+ | OpenCode | `opencode run - --format json --model "MODEL" --variant "VARIANT" < "{AI_STATE_DIR}/consult/question.tmp"` |
329
+ | OpenCode (resume) | `opencode run - --format json --model "MODEL" --variant "VARIANT" --session "SESSION_ID" < "{AI_STATE_DIR}/consult/question.tmp"` |
330
+ | Copilot | `copilot -p - < "{AI_STATE_DIR}/consult/question.tmp"` |
331
+ | Kiro | ACP only - use ACP command above |
332
+
333
+ **Timeout enforcement**: Wrap CLI commands with the `timeout` command to enforce the 120s limit:
334
+
335
+ ```
336
+ timeout 120 env -u CLAUDECODE claude -p - --output-format json ... < question.tmp
337
+ timeout 120 gemini -p - --output-format json ... < question.tmp
338
+ ```
339
+
340
+ If `timeout` is not available (some macOS systems), use a background process with kill:
341
+ ```
342
+ COMMAND < question.tmp & PID=$!; ( sleep 120 && kill $PID 2>/dev/null ) & TIMER=$!; wait $PID 2>/dev/null; kill $TIMER 2>/dev/null
343
+ ```
344
+
345
+ For ACP, `acp/run.js --timeout=120000` handles timeouts internally via per-request timers.
346
+
347
+ ##### Step 3f: Parse result
348
+
349
+ | Provider | Parse Expression |
350
+ |----------|-----------------|
351
+ | Claude | `JSON.parse(stdout).result` |
352
+ | Gemini | `JSON.parse(stdout).response` |
353
+ | Codex | `JSON.parse(stdout).message` or raw text |
354
+ | OpenCode | Newline-delimited JSON events. Concatenate `part.text` from events where `type === "text"`. Session ID from `event.sessionID`. |
355
+ | Copilot | Raw stdout text |
356
+ | ACP (any) | `JSON.parse(stdout).response` |
357
+
358
+ Extract: response text, session_id (if available), duration_ms.
359
+
360
+ ### Phase 4: Present Results
361
+
362
+ #### Single instance
363
+
364
+ Display:
365
+
366
+ ```
367
+ Tool: {tool}, Model: {model}, Effort: {effort}, Duration: {duration_ms}ms.
368
+
369
+ The results of the consultation are:
370
+ {response}
371
+ ```
372
+
373
+ For continuable tools (Claude, Gemini, Codex, OpenCode), display: `Session: {session_id} - use /consult --continue to resume`
374
+
375
+ Save session state to `{AI_STATE_DIR}/consult/last-session.json`.
376
+
377
+ #### Multi-instance
378
+
379
+ Display the agent's formatted output directly. The agent returns numbered responses with a synthesis section.
380
+
381
+ On failure: `[ERROR] Consultation Failed: {specific error message}`
382
+
383
+ ## Error Handling
384
+
385
+ | Error | Output |
386
+ |-------|--------|
387
+ | No question provided | `[ERROR] Usage: /consult "your question" or /consult with gemini about your question` |
388
+ | Tool not installed | `[ERROR] {tool} is not installed. Install with: {install command from skill}` |
389
+ | Tool execution fails | `[ERROR] {tool} failed: {error}. Try a different tool with --tool=[other]` |
390
+ | Timeout (>120s) | `[ERROR] {tool} timed out after 120s. Try --effort=low for faster response` |
391
+ | No tools available | `[ERROR] No AI CLI tools found. Install: npm i -g @anthropic-ai/claude-code` |
392
+ | Session not found | `[WARN] No previous session found. Starting fresh consultation.` |
393
+ | API key missing | `[ERROR] {tool} requires API key. Set {env var} (see skill for details)` |
394
+ | Count out of range | `[ERROR] Instance count must be 1-5. Got: {count}` |
395
+ | Multi-instance partial failure | Show successful responses, note failures |
396
+
397
+ ## Example Usage
398
+
399
+ ```bash
400
+ # Natural language (NLP parsing)
401
+ /consult with codex about my auth approach
402
+ /consult ask 3 codex about this design
403
+ /consult gemini should I use redis or postgres
404
+ /consult thoroughly ask claude about error handling
405
+ /consult codex few instances about performance
406
+
407
+ # Explicit flags (backward compatible)
408
+ /consult "Is this the right approach?" --tool=gemini --effort=high
409
+ /consult "Review this function" --tool=codex --count=3
410
+ /consult "Suggest improvements" --tool=opencode --model=github-copilot/claude-opus-4-6
411
+ /consult --continue
412
+ /consult "Explain this error" --context=diff --tool=gemini
413
+ /consult "Review this file" --context=file=src/index.js --tool=claude
414
+
415
+ # Mixed (flags + natural language)
416
+ /consult with gemini --effort=max about database schema design
417
+ ```