agentsys 5.3.3 → 5.3.5

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 (108) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.kiro/agents/agent-enhancer.json +1 -1
  4. package/.kiro/agents/ci-fixer.json +1 -1
  5. package/.kiro/agents/ci-monitor.json +1 -1
  6. package/.kiro/agents/claudemd-enhancer.json +1 -1
  7. package/.kiro/agents/consult-agent.json +1 -1
  8. package/.kiro/agents/cross-file-enhancer.json +1 -1
  9. package/.kiro/agents/debate-orchestrator.json +1 -1
  10. package/.kiro/agents/delivery-validator.json +1 -1
  11. package/.kiro/agents/deslop-agent.json +1 -1
  12. package/.kiro/agents/docs-enhancer.json +1 -1
  13. package/.kiro/agents/exploration-agent.json +1 -1
  14. package/.kiro/agents/hooks-enhancer.json +1 -1
  15. package/.kiro/agents/implementation-agent.json +1 -1
  16. package/.kiro/agents/learn-agent.json +1 -1
  17. package/.kiro/agents/map-validator.json +1 -1
  18. package/.kiro/agents/perf-analyzer.json +1 -1
  19. package/.kiro/agents/perf-code-paths.json +1 -1
  20. package/.kiro/agents/perf-investigation-logger.json +1 -1
  21. package/.kiro/agents/perf-orchestrator.json +1 -1
  22. package/.kiro/agents/perf-theory-gatherer.json +1 -1
  23. package/.kiro/agents/perf-theory-tester.json +1 -1
  24. package/.kiro/agents/plan-synthesizer.json +1 -1
  25. package/.kiro/agents/planning-agent.json +1 -1
  26. package/.kiro/agents/plugin-enhancer.json +1 -1
  27. package/.kiro/agents/prompt-enhancer.json +1 -1
  28. package/.kiro/agents/reviewer-perf-test.json +1 -1
  29. package/.kiro/agents/reviewer-quality-security.json +1 -1
  30. package/.kiro/agents/simple-fixer.json +1 -1
  31. package/.kiro/agents/skills-enhancer.json +1 -1
  32. package/.kiro/agents/sync-docs-agent.json +1 -1
  33. package/.kiro/agents/task-discoverer.json +1 -1
  34. package/.kiro/agents/test-coverage-checker.json +1 -1
  35. package/.kiro/agents/web-session.json +1 -1
  36. package/.kiro/agents/worktree-manager.json +1 -1
  37. package/CHANGELOG.md +14 -0
  38. package/bin/cli.js +48 -36
  39. package/lib/adapter-transforms.js +3 -3
  40. package/package.json +1 -1
  41. package/site/content.json +32 -8
  42. package/.cursor/commands/audit-project-agents.md +0 -454
  43. package/.cursor/commands/audit-project-github.md +0 -141
  44. package/.cursor/commands/audit-project.md +0 -330
  45. package/.cursor/commands/consult.md +0 -417
  46. package/.cursor/commands/debate.md +0 -381
  47. package/.cursor/commands/delivery-approval.md +0 -334
  48. package/.cursor/commands/deslop.md +0 -142
  49. package/.cursor/commands/drift-detect.md +0 -259
  50. package/.cursor/commands/enhance.md +0 -172
  51. package/.cursor/commands/learn.md +0 -165
  52. package/.cursor/commands/next-task.md +0 -519
  53. package/.cursor/commands/perf.md +0 -464
  54. package/.cursor/commands/repo-map.md +0 -124
  55. package/.cursor/commands/ship-ci-review-loop.md +0 -468
  56. package/.cursor/commands/ship-deployment.md +0 -348
  57. package/.cursor/commands/ship-error-handling.md +0 -265
  58. package/.cursor/commands/ship.md +0 -517
  59. package/.cursor/commands/sync-docs.md +0 -171
  60. package/.cursor/commands/web-ctl.md +0 -101
  61. package/.cursor/skills/consult/SKILL.md +0 -425
  62. package/.cursor/skills/debate/SKILL.md +0 -316
  63. package/.cursor/skills/deslop/SKILL.md +0 -204
  64. package/.cursor/skills/discover-tasks/SKILL.md +0 -297
  65. package/.cursor/skills/drift-analysis/SKILL.md +0 -324
  66. package/.cursor/skills/enhance-agent-prompts/SKILL.md +0 -277
  67. package/.cursor/skills/enhance-claude-memory/SKILL.md +0 -387
  68. package/.cursor/skills/enhance-cross-file/SKILL.md +0 -110
  69. package/.cursor/skills/enhance-docs/SKILL.md +0 -298
  70. package/.cursor/skills/enhance-hooks/SKILL.md +0 -554
  71. package/.cursor/skills/enhance-orchestrator/SKILL.md +0 -255
  72. package/.cursor/skills/enhance-plugins/SKILL.md +0 -319
  73. package/.cursor/skills/enhance-prompts/SKILL.md +0 -340
  74. package/.cursor/skills/enhance-skills/SKILL.md +0 -436
  75. package/.cursor/skills/learn/SKILL.md +0 -349
  76. package/.cursor/skills/orchestrate-review/SKILL.md +0 -260
  77. package/.cursor/skills/perf-analyzer/SKILL.md +0 -37
  78. package/.cursor/skills/perf-baseline-manager/SKILL.md +0 -30
  79. package/.cursor/skills/perf-benchmarker/SKILL.md +0 -52
  80. package/.cursor/skills/perf-code-paths/SKILL.md +0 -32
  81. package/.cursor/skills/perf-investigation-logger/SKILL.md +0 -41
  82. package/.cursor/skills/perf-profiler/SKILL.md +0 -42
  83. package/.cursor/skills/perf-theory-gatherer/SKILL.md +0 -35
  84. package/.cursor/skills/perf-theory-tester/SKILL.md +0 -36
  85. package/.cursor/skills/repo-mapping/SKILL.md +0 -83
  86. package/.cursor/skills/sync-docs/SKILL.md +0 -351
  87. package/.cursor/skills/validate-delivery/SKILL.md +0 -186
  88. package/.cursor/skills/web-auth/SKILL.md +0 -177
  89. package/.cursor/skills/web-browse/SKILL.md +0 -516
  90. package/.kiro/steering/audit-project-agents.md +0 -459
  91. package/.kiro/steering/audit-project-github.md +0 -146
  92. package/.kiro/steering/audit-project.md +0 -330
  93. package/.kiro/steering/consult.md +0 -422
  94. package/.kiro/steering/debate.md +0 -386
  95. package/.kiro/steering/delivery-approval.md +0 -339
  96. package/.kiro/steering/deslop.md +0 -149
  97. package/.kiro/steering/drift-detect.md +0 -264
  98. package/.kiro/steering/enhance.md +0 -177
  99. package/.kiro/steering/learn.md +0 -166
  100. package/.kiro/steering/next-task.md +0 -481
  101. package/.kiro/steering/perf.md +0 -469
  102. package/.kiro/steering/repo-map.md +0 -126
  103. package/.kiro/steering/ship-ci-review-loop.md +0 -473
  104. package/.kiro/steering/ship-deployment.md +0 -353
  105. package/.kiro/steering/ship-error-handling.md +0 -270
  106. package/.kiro/steering/ship.md +0 -522
  107. package/.kiro/steering/sync-docs.md +0 -178
  108. package/.kiro/steering/web-ctl.md +0 -106
@@ -1,101 +0,0 @@
1
-
2
- # /web-ctl Command
3
-
4
- Browser automation for AI agents. Navigate websites, authenticate with human handoff, and interact with web pages.
5
-
6
- ## Intent Routing
7
-
8
- Parse the user's request and route appropriately:
9
-
10
- ### Simple Actions (Direct Skill Invocation)
11
-
12
- For single-step requests like "go to example.com" or "take a screenshot":
13
-
14
- 1. Invoke the **web-browse** skill with session name and action
15
- 2. Sessions auto-create on first run command if they don't exist
16
-
17
- ### Auth Requests
18
-
19
- For "log into X" or "authenticate to Y":
20
-
21
- 1. Create a session named after the service
22
- 2. Invoke the **web-auth** skill
23
-
24
- ### Multi-Step Flows
25
-
26
- For complex requests like "find information on a website" or "fill out a form":
27
-
28
- 1. Delegate to the **web-session** agent via Task tool
29
-
30
- ## Quick Reference
31
-
32
- ```bash
33
- # Session lifecycle
34
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session start <name>
35
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session auth <name> --provider <provider>
36
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session auth <name> --url <url> [--verify-url <url>] [--verify-selector <sel>]
37
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session auth <name> --provider <slug> --providers-file <path>
38
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session providers
39
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session list
40
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session end <name>
41
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js session verify <name> --url <url>
42
-
43
- # Browser actions
44
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> goto <url> [--ensure-auth]
45
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> snapshot
46
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> click <selector>
47
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> read <selector>
48
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> screenshot
49
-
50
- # Snapshot control (apply to any action with snapshot output)
51
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> snapshot --snapshot-depth 3
52
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> goto <url> --snapshot-selector "css=nav"
53
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> click <sel> --no-snapshot
54
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> snapshot --snapshot-collapse
55
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> snapshot --snapshot-compact
56
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> snapshot --snapshot-text-only --snapshot-max-lines 50
57
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> goto <url> --snapshot-full
58
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> goto <url> --snapshot-collapse --snapshot-depth 4
59
-
60
- # Macros
61
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> select-option <sel> <text>
62
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> tab-switch <name>
63
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> modal-dismiss [--accept]
64
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> form-fill --fields '<json>' [--submit]
65
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> search-select <sel> <query> --pick <text>
66
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> date-pick <sel> --date <YYYY-MM-DD>
67
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> file-upload <sel> <path>
68
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> hover-reveal <sel> --click <target>
69
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> scroll-to <sel>
70
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> wait-toast [--dismiss]
71
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> iframe-action <iframe> <action> [args]
72
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> login --user <u> --pass <p>
73
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> next-page
74
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> paginate --selector <sel> [--max-pages N] [--max-items N]
75
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> extract --selector <sel> [--fields f1,f2,...] [--max-items N] [--max-field-length N]
76
- node /Users/avifen/.agentsys/plugins/web-ctl/scripts/web-ctl.js run <session> extract --auto [--max-items N] [--max-field-length N]
77
- ```
78
-
79
- ## Examples
80
-
81
- User: "Open github.com and show me my profile"
82
- 1. Start session "github"
83
- 2. Auth if needed (web-auth skill)
84
- 3. Navigate to github.com/profile
85
- 4. Snapshot and report
86
-
87
- User: "Take a screenshot of example.com"
88
- 1. Start session "quick"
89
- 2. Goto example.com
90
- 3. Screenshot
91
- 4. End session
92
-
93
- User: "Log into Twitter"
94
- 1. Start session "twitter"
95
- 2. Auth with `--provider twitter` (auto-configures URL and success detection)
96
- 3. Report success/failure
97
-
98
- User: "Log into GitHub"
99
- 1. Start session "github"
100
- 2. Auth with `--provider github`
101
- 3. Report success/failure
@@ -1,425 +0,0 @@
1
- ---
2
- name: consult
3
- description: "Cross-tool AI consultation. Use when user asks to 'consult gemini', 'ask codex', 'get second opinion', 'cross-check with claude', 'consult another AI', 'ask opencode', 'copilot opinion', or wants a second opinion from a different AI tool."
4
- version: 5.1.0
5
- argument-hint: "[question] [--tool] [--effort] [--model] [--context] [--continue]"
6
- ---
7
-
8
- # consult
9
-
10
- Cross-tool AI consultation: query another AI CLI tool and return the response.
11
-
12
- ## When to Use
13
-
14
- Invoke this skill when:
15
- - User wants a second opinion from a different AI tool
16
- - User asks to consult, ask, or cross-check with gemini/codex/claude/opencode/copilot
17
- - User needs to compare responses across AI tools
18
- - User wants to validate a decision with an external AI
19
-
20
- ## Arguments
21
-
22
- Parse from `$ARGUMENTS`:
23
-
24
- | Flag | Values | Default | Description |
25
- |------|--------|---------|-------------|
26
- | `--tool` | gemini, codex, claude, opencode, copilot | (picker) | Target tool |
27
- | `--effort` | low, medium, high, max | medium | Thinking effort level |
28
- | `--model` | any model name | (from effort) | Override model selection |
29
- | `--context` | diff, file=PATH, none | none | Auto-include context |
30
- | `--continue` | (flag) or SESSION_ID | false | Resume previous session |
31
-
32
- Question text is everything in `$ARGUMENTS` except the flags above.
33
-
34
- ## Provider Configurations
35
-
36
- ### Claude
37
-
38
- ```
39
- Command: env -u CLAUDECODE claude -p "QUESTION" --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep"
40
- Session resume: --resume "SESSION_ID"
41
- ```
42
-
43
- Models: claude-haiku-4-5, claude-sonnet-4-6, claude-opus-4-6
44
-
45
- | Effort | Model | Max Turns |
46
- |--------|-------|-----------|
47
- | low | claude-haiku-4-5 | 1 |
48
- | medium | claude-sonnet-4-6 | 3 |
49
- | high | claude-opus-4-6 | 5 |
50
- | max | claude-opus-4-6 | 10 |
51
-
52
- **Parse output**: `JSON.parse(stdout).result`
53
- **Session ID**: `JSON.parse(stdout).session_id`
54
- **Continuable**: Yes
55
- **ACP adapter**: `npx -y @anthropic-ai/claude-code-acp` (see ACP Transport section)
56
-
57
- ### Gemini
58
-
59
- ```
60
- Command: gemini -p "QUESTION" --output-format json -m "MODEL"
61
- Session resume: --resume "SESSION_ID"
62
- ```
63
-
64
- Models: gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash-preview, gemini-3-pro-preview, gemini-3.1-pro-preview
65
-
66
- | Effort | Model |
67
- |--------|-------|
68
- | low | gemini-3-flash-preview |
69
- | medium | gemini-3-flash-preview |
70
- | high | gemini-3.1-pro-preview |
71
- | max | gemini-3.1-pro-preview |
72
-
73
- **Parse output**: `JSON.parse(stdout).response`
74
- **Session ID**: `JSON.parse(stdout).session_id`
75
- **Continuable**: Yes (via `--resume`)
76
- **ACP adapter**: `gemini` (native ACP - Gemini CLI is ACP-compatible)
77
-
78
- ### Codex
79
-
80
- ```
81
- Command: codex exec "QUESTION" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"
82
- Session resume: codex exec resume "SESSION_ID" "QUESTION" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"
83
- Session resume (latest): codex exec resume --last "QUESTION" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"
84
- ```
85
-
86
- Note: `codex exec` is the non-interactive/headless mode. There is no `-q` flag. The TUI mode is `codex` (no subcommand).
87
- `{SKIP_GIT_FLAG}` is resolved by the trust gate in Command Building Step 1b:
88
- - inside trusted git repo: empty string
89
- - trusted non-repo execution: `--skip-git-repo-check`
90
-
91
- Models: gpt-5.3-codex
92
-
93
- | Effort | Model | Reasoning |
94
- |--------|-------|-----------|
95
- | low | gpt-5.3-codex | low |
96
- | medium | gpt-5.3-codex | medium |
97
- | high | gpt-5.3-codex | high |
98
- | max | gpt-5.3-codex | high |
99
-
100
- **Parse output**: `JSON.parse(stdout).message` or raw text
101
- **Session ID**: Codex prints a resume hint at session end (e.g., `codex resume SESSION_ID`). Extract the session ID from stdout or from `JSON.parse(stdout).session_id` if available.
102
- **Continuable**: Yes. Sessions are stored as JSONL rollout files at `~/.codex/sessions/`. Non-interactive resume uses `codex exec resume "SESSION_ID" "follow-up prompt" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"`. Use `--last` instead of a session ID to resume the most recent session.
103
- **ACP adapter**: `npx -y @zed-industries/codex-acp` (see ACP Transport section)
104
-
105
- ### OpenCode
106
-
107
- ```
108
- Command: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT"
109
- Session resume: opencode run "QUESTION" --format json --model "MODEL" --variant "VARIANT" --continue (most recent) or --session "SESSION_ID"
110
- With thinking: add --thinking flag
111
- ```
112
-
113
- Models: 75+ via providers (format: `provider/model`). Key providers: `opencode/` (free), `github-copilot/`, `amazon-bedrock/`, `google/`. Examples: `github-copilot/gemini-3.1-pro-preview`, `opencode/big-pickle`, `amazon-bedrock/anthropic.claude-opus-4-6-v1`. Run `opencode models` to list all.
114
-
115
- Free models: `opencode/big-pickle`, `opencode/gpt-5-nano`, `opencode/minimax-m2.5-free`, `opencode/trinity-large-preview-free`
116
-
117
- | Effort | Model | Variant |
118
- |--------|-------|---------|
119
- | low | (user-selected or default) | low |
120
- | medium | (user-selected or default) | medium |
121
- | high | (user-selected or default) | high |
122
- | max | (user-selected or default) | high + --thinking |
123
-
124
- **Parse output**: OpenCode outputs newline-delimited JSON events. Each line is a JSON object with a `type` field. Extract the response text from events where `type === "text"` - the text is in `part.text` (NOT `part.content`). Concatenate all `part.text` values from `type: "text"` events. Event types: `step_start`, `tool_use`, `text`, `step_finish`. The `sessionID` is in every event's top-level `sessionID` field.
125
-
126
- **Session ID**: Available in every event as `event.sessionID` (e.g., `ses_xxxxx`). Use `--session SESSION_ID` to resume.
127
- **Continuable**: Yes (via `--continue` or `--session`). Sessions are stored in a SQLite database in the OpenCode data directory. Use `--session SESSION_ID` for a specific session, or `--continue` for the most recent.
128
- **ACP adapter**: `opencode acp` (see ACP Transport section)
129
-
130
- ### Copilot
131
-
132
- ```
133
- Command: copilot -p "QUESTION"
134
- ```
135
-
136
- Models: claude-sonnet-4-6 (default), claude-opus-4-6, claude-haiku-4-5, gpt-5
137
-
138
- | Effort | Notes |
139
- |--------|-------|
140
- | all | No effort control available. Model selectable via --model flag. |
141
-
142
- **Parse output**: Raw text from stdout
143
- **Continuable**: No
144
- **ACP adapter**: `copilot --acp --stdio` (see ACP Transport section)
145
-
146
- ### Kiro
147
-
148
- ```
149
- ACP-only provider. No CLI mode for external consultation.
150
- Command: node acp/run.js --provider="kiro" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000
151
- ```
152
-
153
- Kiro is available only via ACP transport. It requires `kiro-cli` on PATH.
154
-
155
- **Parse output**: Via ACP runner (`JSON.parse(stdout)`)
156
- **Continuable**: No
157
- **ACP adapter**: `kiro-cli acp` (native ACP)
158
-
159
- ## Input Validation
160
-
161
- Before building commands, validate all user-provided arguments:
162
-
163
- - **--tool**: MUST be one of: gemini, codex, claude, opencode, copilot, kiro. Reject all other values.
164
- - **--effort**: MUST be one of: low, medium, high, max. Default to medium.
165
- - **--model**: Allow any string, but quote it in the command.
166
- - **--continue=SESSION_ID**: If provided, SESSION_ID MUST match `^(?!-)[A-Za-z0-9._:-]+$`. Reject values that contain spaces, leading dashes, or shell metacharacters.
167
- - **--context=file=PATH**: MUST resolve within the project directory. Reject absolute paths outside cwd. Additional checks:
168
- 1. **Block UNC paths** (Windows): Reject paths starting with `\\` or `//` (network shares)
169
- 2. **Resolve canonical path**: Use the Read tool to read the file (do NOT use shell commands). Before reading, resolve the path: join `cwd + PATH`, then normalize (collapse `.`, `..`, resolve symlinks)
170
- 3. **Verify containment**: The resolved canonical path MUST start with the current working directory. If it escapes (via `..`, symlinks, or junction points), reject with: `[ERROR] Path escapes project directory: {PATH}`
171
- 4. **No shell access**: Read file content using the Read tool only. Never pass user-provided paths to shell commands (prevents injection via path values)
172
-
173
- ## Command Building
174
-
175
- Given the parsed arguments, build the complete CLI command. All user-provided values MUST be quoted in the shell command to prevent injection.
176
-
177
- ### Step 1: Resolve Model
178
-
179
- If `--model` is specified, use it directly. Otherwise, use the effort-based model from the provider table above.
180
-
181
- ### Step 1b: Trust Gate for Codex `--skip-git-repo-check`
182
-
183
- Before using any Codex template, resolve `{SKIP_GIT_FLAG}` with this gate:
184
-
185
- 1. Verify the consultation is running from the current project working directory (the same workspace where `/consult` was invoked), not an arbitrary external path.
186
- 2. Verify the resolved active tool is Codex (flag, NLP, picker, or restored `--continue` session).
187
- 3. Run `git rev-parse --is-inside-work-tree` in the current working directory:
188
- - if true: set `{SKIP_GIT_FLAG}` to empty string
189
- - if false and checks 1-2 passed: set `{SKIP_GIT_FLAG}` to `--skip-git-repo-check`
190
- 4. If checks 1-2 fail, reject execution with `[ERROR] Refusing Codex --skip-git-repo-check outside trusted working directory`.
191
-
192
- Codex templates in this skill assume this trust gate has already passed.
193
-
194
- ### Step 2: Build Command String
195
-
196
- Use the command template from the provider's configuration section. Substitute QUESTION, MODEL, TURNS, LEVEL, VARIANT, and SKIP_GIT_FLAG with resolved literal values.
197
- `{SKIP_GIT_FLAG}` MUST be set by Step 1b only. Do not read `SKIP_GIT_FLAG` from inherited shell environment.
198
-
199
- If continuing a session:
200
- - **Claude or Gemini**: append `--resume "SESSION_ID"` to the command.
201
- - **Codex**: use `codex exec resume "SESSION_ID" "QUESTION" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"` instead of the standard command. Use `--last` instead of a session ID for the most recent session.
202
- - **OpenCode**: append `--session SESSION_ID` to the command. If no session_id is saved, use `--continue` instead (resumes most recent session).
203
- If OpenCode at max effort: append `--thinking`.
204
-
205
- ### Step 3: Context Packaging
206
-
207
- If `--context=diff`: Run `git diff 2>/dev/null` and prepend output to the question.
208
- If `--context=file=PATH`: Read the file using the Read tool and prepend its content to the question.
209
-
210
- ### Step 4: Safe Question Passing
211
-
212
- User-provided question text MUST NOT be interpolated into shell command strings. Shell escaping is insufficient -- `$()`, backticks, and other expansion sequences can execute arbitrary commands even inside double quotes.
213
-
214
- **Required approach -- pass question via stdin or temp file:**
215
-
216
- 1. **Write the question** to a temporary file using the Write tool (e.g., `{AI_STATE_DIR}/consult/question.tmp`)
217
-
218
- Platform state directory:
219
- - Claude Code: `.claude/`
220
- - OpenCode: `.opencode/`
221
- - Codex CLI: `.codex/`
222
- 2. **Build the command** using the temp file as input instead of inline text:
223
-
224
- | Provider | Safe command pattern |
225
- |----------|---------------------|
226
- | Claude | `env -u CLAUDECODE claude -p - --output-format json --model "MODEL" --max-turns TURNS --allowedTools "Read,Glob,Grep" < "{AI_STATE_DIR}/consult/question.tmp"` |
227
- | 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"` |
228
- | Gemini | `gemini -p - --output-format json -m "MODEL" < "{AI_STATE_DIR}/consult/question.tmp"` |
229
- | Gemini (resume) | `gemini -p - --output-format json -m "MODEL" --resume "SESSION_ID" < "{AI_STATE_DIR}/consult/question.tmp"` |
230
- | Codex | `codex exec "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"` (Codex exec lacks stdin mode -- cat reads from platform-controlled path, not user input) |
231
- | 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"` |
232
- | Codex (resume latest) | `codex exec resume --last "$(cat "{AI_STATE_DIR}/consult/question.tmp")" --json -m "MODEL" {SKIP_GIT_FLAG} -c model_reasoning_effort="LEVEL"` |
233
- | OpenCode | `opencode run - --format json --model "MODEL" --variant "VARIANT" < "{AI_STATE_DIR}/consult/question.tmp"` |
234
- | OpenCode (resume by ID) | `opencode run - --format json --model "MODEL" --variant "VARIANT" --session "SESSION_ID" < "{AI_STATE_DIR}/consult/question.tmp"` |
235
- | OpenCode (resume latest) | `opencode run - --format json --model "MODEL" --variant "VARIANT" --continue < "{AI_STATE_DIR}/consult/question.tmp"` |
236
- | Copilot | `copilot -p - < "{AI_STATE_DIR}/consult/question.tmp"` |
237
-
238
- 3. **Delete the temp file** after the command completes (success or failure). Always clean up to prevent accumulation.
239
-
240
- **Model and session ID values** are controlled strings (from pickers or saved state) and safe to quote directly in the command. Only the question contains arbitrary user text and requires the temp file approach. The temp file path (`{AI_STATE_DIR}/consult/question.tmp`) uses a platform-controlled directory and fixed filename -- no user input in the path.
241
-
242
- ## Provider Detection
243
-
244
- Cross-platform tool detection:
245
-
246
- - **Windows**: `where.exe TOOL 2>nul` -- returns 0 if found
247
- - **Unix**: `which TOOL 2>/dev/null` -- returns 0 if found
248
-
249
- Check each tool (claude, gemini, codex, opencode, copilot, kiro) and return only the available ones.
250
-
251
- ## ACP Transport
252
-
253
- ACP (Agent Client Protocol) is an alternative transport to CLI subprocess invocation. When available, ACP provides structured JSON-RPC 2.0 communication, session persistence, and streaming responses via a universal protocol supported by all major AI coding tools.
254
-
255
- ### ACP Provider Adapters
256
-
257
- | Provider | ACP Command | Type | Detection |
258
- |----------|-------------|------|-----------|
259
- | Claude | `npx -y @anthropic-ai/claude-code-acp` | adapter | npx available |
260
- | Gemini | `gemini` (native ACP) | native | gemini available |
261
- | Codex | `npx -y @zed-industries/codex-acp` | adapter | npx available |
262
- | Copilot | `copilot --acp --stdio` | native | copilot available |
263
- | Kiro | `kiro-cli acp` | native | kiro-cli available |
264
- | OpenCode | `opencode acp` | native | opencode available |
265
-
266
- ### Transport Selection
267
-
268
- 1. Check ACP availability for the target provider (see ACP Detection below)
269
- 2. If ACP available: use ACP transport (preferred - standardized protocol, session persistence)
270
- 3. If ACP unavailable: fall back to CLI transport (existing behavior above)
271
-
272
- The output envelope is identical regardless of transport. Downstream consumers (session management, debate orchestrator, output parsing) are transport-agnostic.
273
-
274
- ### ACP Command Template
275
-
276
- All ACP providers use the same command pattern via the ACP runner script:
277
-
278
- ```
279
- node acp/run.js --provider="PROVIDER" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=TIMEOUT_MS [--model="MODEL"] [--session-id="SESSION_ID"]
280
- ```
281
-
282
- | Provider | ACP Safe Command Pattern |
283
- |----------|------------------------|
284
- | Claude | `node acp/run.js --provider="claude" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000 --model="MODEL"` |
285
- | Gemini | `node acp/run.js --provider="gemini" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000 --model="MODEL"` |
286
- | Codex | `node acp/run.js --provider="codex" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000 --model="MODEL"` |
287
- | OpenCode | `node acp/run.js --provider="opencode" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000 --model="MODEL"` |
288
- | Copilot | `node acp/run.js --provider="copilot" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000` |
289
- | Kiro | `node acp/run.js --provider="kiro" --question-file="{AI_STATE_DIR}/consult/question.tmp" --timeout=120000` |
290
-
291
- **Parse output**: Same as CLI transport - `JSON.parse(stdout)`. The ACP runner outputs the same envelope format.
292
- **Session ID**: From `JSON.parse(stdout).session_id` (ACP session ID)
293
- **Resume**: Pass `--session-id="SESSION_ID"` flag on the ACP command
294
- **Continuable**: Claude, Gemini, Codex, OpenCode (yes). Copilot, Kiro (no).
295
-
296
- ### ACP Detection
297
-
298
- Run ACP detection alongside CLI detection. For each provider:
299
-
300
- ```bash
301
- node acp/run.js --detect --provider="PROVIDER"
302
- ```
303
-
304
- Returns on success (exit 0):
305
- ```json
306
- {"provider": "claude", "acp_available": true, "name": "Claude"}
307
- ```
308
-
309
- Returns on failure (exit 1):
310
- ```json
311
- {"provider": "claude", "acp_available": false, "name": "Claude", "reason": "npx not found on PATH"}
312
- ```
313
-
314
- **Kiro note**: Kiro is ACP-only - it has no CLI mode for external consultation. It only appears as available when `kiro-cli` is on PATH and ACP detection succeeds.
315
-
316
- ## Session Management
317
-
318
- ### Save Session
319
-
320
- After successful consultation, save to `{AI_STATE_DIR}/consult/last-session.json`:
321
-
322
- ```json
323
- {
324
- "tool": "claude",
325
- "model": "opus",
326
- "effort": "high",
327
- "session_id": "abc-123-def-456",
328
- "timestamp": "2026-02-10T12:00:00Z",
329
- "question": "original question text",
330
- "continuable": true,
331
- "transport": "acp"
332
- }
333
- ```
334
-
335
- The `transport` field is `"acp"` or `"cli"`. When resuming a session with `--continue`, use the same transport that created it. If the field is absent, assume `"cli"` (backward compatible).
336
-
337
- `AI_STATE_DIR` uses the platform state directory:
338
- - Claude Code: `.claude/`
339
- - OpenCode: `.opencode/`
340
- - Codex CLI: `.codex/`
341
-
342
- ### Load Session
343
-
344
- For `--continue`, read the session file and restore:
345
- - tool (from saved state)
346
- - session_id (for --resume flag)
347
- - model (reuse same model)
348
-
349
- Before using restored values, re-validate them:
350
- - tool must still be in allow-list: gemini, codex, claude, opencode, copilot, kiro
351
- - session_id must match `^(?!-)[A-Za-z0-9._:-]+$`
352
- - model must match `^[A-Za-z0-9._:/-]+$` (reject spaces and shell metacharacters)
353
- - if either check fails, reject with `[ERROR] Invalid restored session data` and do not build a command
354
-
355
- If session file not found, warn and proceed as fresh consultation.
356
-
357
- ## Output Sanitization
358
-
359
- Before including any consulted tool's response in the output, scan the response text and redact matches for these patterns:
360
-
361
- | Pattern | Description | Replacement |
362
- |---------|-------------|-------------|
363
- | `sk-[a-zA-Z0-9_-]{20,}` | Anthropic API keys | `[REDACTED_API_KEY]` |
364
- | `sk-proj-[a-zA-Z0-9_-]{20,}` | OpenAI project keys | `[REDACTED_API_KEY]` |
365
- | `sk-ant-[a-zA-Z0-9_-]{20,}` | Anthropic API keys (ant prefix) | `[REDACTED_API_KEY]` |
366
- | `AIza[a-zA-Z0-9_-]{30,}` | Google API keys | `[REDACTED_API_KEY]` |
367
- | `ghp_[a-zA-Z0-9]{36,}` | GitHub personal access tokens | `[REDACTED_TOKEN]` |
368
- | `gho_[a-zA-Z0-9]{36,}` | GitHub OAuth tokens | `[REDACTED_TOKEN]` |
369
- | `github_pat_[a-zA-Z0-9_]{20,}` | GitHub fine-grained PATs | `[REDACTED_TOKEN]` |
370
- | `ANTHROPIC_API_KEY=[^\s]+` | Key assignment in env output | `ANTHROPIC_API_KEY=[REDACTED]` |
371
- | `OPENAI_API_KEY=[^\s]+` | Key assignment in env output | `OPENAI_API_KEY=[REDACTED]` |
372
- | `GOOGLE_API_KEY=[^\s]+` | Key assignment in env output | `GOOGLE_API_KEY=[REDACTED]` |
373
- | `GEMINI_API_KEY=[^\s]+` | Key assignment in env output | `GEMINI_API_KEY=[REDACTED]` |
374
- | `AKIA[A-Z0-9]{16}` | AWS access keys | `[REDACTED_AWS_KEY]` |
375
- | `ASIA[A-Z0-9]{16}` | AWS session tokens | `[REDACTED_AWS_KEY]` |
376
- | `Bearer [a-zA-Z0-9_-]{20,}` | Authorization headers | `Bearer [REDACTED]` |
377
-
378
- Apply redaction to the full response text before inserting into the result JSON. If any redaction occurs, append a note: `[WARN] Sensitive tokens were redacted from the response.`
379
-
380
- ## Output Format
381
-
382
- Return a plain JSON object to stdout (no markers or wrappers):
383
-
384
- ```json
385
- {
386
- "tool": "gemini",
387
- "model": "gemini-3.1-pro-preview",
388
- "effort": "high",
389
- "duration_ms": 12300,
390
- "response": "The AI's response text here...",
391
- "session_id": "abc-123",
392
- "continuable": true
393
- }
394
- ```
395
-
396
- ## Install Instructions
397
-
398
- When a tool is not found, return these install commands:
399
-
400
- | Tool | Install |
401
- |------|---------|
402
- | Claude | `npm install -g @anthropic-ai/claude-code` |
403
- | Gemini | See https://gemini.google.com/cli for install instructions |
404
- | Codex | `npm install -g @openai/codex` |
405
- | OpenCode | `npm install -g opencode-ai` or `brew install anomalyco/tap/opencode` |
406
- | Copilot | `gh extension install github/copilot-cli` |
407
-
408
- ## Error Handling
409
-
410
- | Error | Response |
411
- |-------|----------|
412
- | Tool not installed | Return install instructions from table above |
413
- | Tool execution timeout | Return `"response": "Timeout after 120s"` |
414
- | JSON parse error | Return raw text as response |
415
- | Empty output | Return `"response": "No output received"` |
416
- | Session file missing | Proceed without session resume |
417
- | API key missing | Return tool-specific env var instructions |
418
-
419
- ## Integration
420
-
421
- This skill is invoked by:
422
- - `consult-agent` for `/consult` command
423
- - Direct invocation: `Skill('consult', '"question" --tool=gemini --effort=high')`
424
-
425
- Example: `Skill('consult', '"Is this approach correct?" --tool=gemini --effort=high --model=gemini-3.1-pro-preview')`