ask-colleague 0.1.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.
@@ -0,0 +1,38 @@
1
+ # Contributing
2
+
3
+ Thanks for improving Agent Colleague.
4
+
5
+ ## Local checks
6
+
7
+ ```bash
8
+ npm test
9
+ npm pack --dry-run
10
+ bash -n bin/colleague install.sh uninstall.sh scripts/ask-codex.sh scripts/ask-claude.sh
11
+ ```
12
+
13
+ For an end-to-end local `npx` check:
14
+
15
+ ```bash
16
+ npm pack --pack-destination /tmp
17
+ npx --yes --package /tmp/agent-colleague-0.4.0.tgz agent-colleague --version
18
+ npx --yes --package /tmp/agent-colleague-0.4.0.tgz agent-colleague install --dry-run
19
+ ```
20
+
21
+ ## Design constraints
22
+
23
+ - Keep the bridge one-shot and stateless.
24
+ - Avoid runtime npm dependencies; npm is only the distribution channel.
25
+ - Do not add defaults that grant write access to the peer agent.
26
+ - Keep installed skills explicit-only unless users intentionally edit their local copy.
27
+ - Keep prompts short and explicit.
28
+ - Preserve compatibility with macOS, Linux, WSL, and Git Bash where possible.
29
+ - Use `mktemp` for context files; do not document fixed predictable temp paths.
30
+
31
+ ## Pull requests
32
+
33
+ Please include:
34
+
35
+ - why the change is needed
36
+ - before/after example command
37
+ - any security implications
38
+ - local test output
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Colleague contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,389 @@
1
+ # Ask Colleague
2
+
3
+ A tiny, self-contained bridge that lets one local AI coding CLI ask another local AI coding CLI for a one-shot second opinion.
4
+
5
+ The default flow:
6
+
7
+ - Claude Code asks Codex with `colleague ask codex ...`
8
+ - Codex asks Claude Code with `colleague ask claude ...`
9
+ - The primary agent writes a compact context briefing, shells out to the peer once, reads stdout, and folds the advice back into the current session.
10
+
11
+ This repository packages the pattern as:
12
+
13
+ - one dependency-free Bash CLI: `bin/colleague`
14
+ - one npm package: `ask-colleague`
15
+ - one Claude Code skill: `skills/claude/colleague/SKILL.md`
16
+ - one Codex skill: `skills/codex/colleague/SKILL.md`
17
+ - install/uninstall scripts with a safety manifest
18
+ - context templates and fallback instruction snippets
19
+
20
+ ## Why this exists
21
+
22
+ Both CLIs have headless one-shot modes. Codex supports `codex exec` for non-interactive runs and can read the task from stdin with `codex exec -`. Claude Code supports print mode with `claude -p`, and can combine piped stdin with a prompt.
23
+
24
+ That makes “ask a colleague” just a local shell bridge:
25
+
26
+ 1. summarize the current task into a small context file
27
+ 2. invoke the other CLI once
28
+ 3. treat the answer as peer advice, not ground truth
29
+ 4. continue in the original session
30
+
31
+ ## Install with npx
32
+
33
+ After this package is published to npm:
34
+
35
+ ```bash
36
+ npx ask-colleague@latest install
37
+ ```
38
+
39
+ That one command installs:
40
+
41
+ ```text
42
+ ~/.local/bin/colleague
43
+ ~/.local/bin/ask-colleague
44
+ ~/.claude/skills/colleague/SKILL.md
45
+ ~/.agents/skills/colleague/SKILL.md
46
+ ~/.agents/skills/colleague/agents/openai.yaml
47
+ ~/.codex/prompts/colleague.md # legacy Codex custom prompt fallback
48
+ ~/.ask-colleague/install-manifest.tsv
49
+ ```
50
+
51
+ The installer refuses to overwrite existing files unless they are tracked in the install manifest and have not been modified. Use `--force` only when you intentionally want to replace an existing ask-colleague install.
52
+
53
+ Make sure `~/.local/bin` is in your `PATH`:
54
+
55
+ ```bash
56
+ export PATH="$HOME/.local/bin:$PATH"
57
+ ```
58
+
59
+ Then check your setup:
60
+
61
+ ```bash
62
+ colleague doctor
63
+ ```
64
+
65
+ Install only selected parts:
66
+
67
+ ```bash
68
+ npx ask-colleague@latest install --bin
69
+ npx ask-colleague@latest install --claude
70
+ npx ask-colleague@latest install --codex
71
+ npx ask-colleague@latest install --prefix "$HOME/bin"
72
+ ```
73
+
74
+ ### Optional global Codex fallback
75
+
76
+ By default, install does **not** modify `~/.codex/AGENTS.md`, because that file affects every Codex session. To opt into the fallback block for Codex versions that do not load skills or prompts the way you expect, run:
77
+
78
+ ```bash
79
+ npx ask-colleague@latest install --agents-md
80
+ ```
81
+
82
+ The AGENTS.md block is marker-delimited and idempotent. `colleague uninstall` removes it only when it was recorded in the install manifest, or when you pass `--force` for a legacy uninstall.
83
+
84
+ Uninstall:
85
+
86
+ ```bash
87
+ colleague uninstall
88
+ # or, without relying on the installed command:
89
+ npx ask-colleague@latest uninstall
90
+ ```
91
+
92
+ Uninstall removes only files recorded in `~/.ask-colleague/install-manifest.tsv` and only if their checksums still match. If you edited an installed skill or prompt, uninstall leaves it in place and tells you to use `--force` if you really want it removed.
93
+
94
+ ## Install from source
95
+
96
+ ```bash
97
+ git clone https://github.com/stevyhacker/ask-colleague.git
98
+ cd ask-colleague
99
+ ./install.sh
100
+ ```
101
+
102
+ This performs the same install as `npx ask-colleague@latest install`.
103
+
104
+ ## Direct CLI usage
105
+
106
+ Create a briefing:
107
+
108
+ ```bash
109
+ ctx="$(mktemp -t colleague-ctx.XXXXXX.md)"
110
+ colleague make-context --output "$ctx"
111
+ $EDITOR "$ctx"
112
+ ```
113
+
114
+ Ask Codex:
115
+
116
+ ```bash
117
+ colleague ask codex \
118
+ --context "$ctx" \
119
+ --question "What is the strongest critique of this implementation plan?"
120
+ ```
121
+
122
+ Ask Claude:
123
+
124
+ ```bash
125
+ colleague ask claude \
126
+ --context "$ctx" \
127
+ --question "What bug or design flaw am I most likely missing?"
128
+ ```
129
+
130
+ Preview the assembled prompt without calling either CLI:
131
+
132
+ ```bash
133
+ colleague ask codex \
134
+ --context "$ctx" \
135
+ --question "Review this" \
136
+ --dry-run
137
+ ```
138
+
139
+ You can set a default peer:
140
+
141
+ ```bash
142
+ export COLLEAGUE_DEFAULT_PEER=codex
143
+ colleague ask --context "$ctx" --question "Review this plan"
144
+ ```
145
+
146
+ ## Using from Claude Code
147
+
148
+ After install, Claude Code can invoke the skill explicitly as:
149
+
150
+ ```text
151
+ /colleague ask Codex to critique my current plan
152
+ ```
153
+
154
+ The Claude skill has `disable-model-invocation: true`, so it is explicit-only by default. The skill instructs Claude to:
155
+
156
+ 1. create a private `mktemp` context file
157
+ 2. write a concise briefing
158
+ 3. run `colleague ask codex ...`
159
+ 4. compare Codex’s response with its own analysis
160
+ 5. proceed using its own judgment
161
+
162
+ ## Using from Codex
163
+
164
+ The install wires up the Codex → Claude direction in two default ways, plus one opt-in fallback:
165
+
166
+ 1. **Skill** (`~/.agents/skills/colleague`) — preferred on Codex versions that scan user skill locations:
167
+
168
+ ```text
169
+ $colleague ask Claude to critique my current plan
170
+ ```
171
+
172
+ The Codex skill policy sets `allow_implicit_invocation: false`, so it is explicit-only by default.
173
+
174
+ 2. **Legacy custom prompt** (`~/.codex/prompts/colleague.md`) — compatibility fallback:
175
+
176
+ ```text
177
+ /prompts:colleague is optimistic locking the right call for this endpoint?
178
+ ```
179
+
180
+ 3. **AGENTS.md block** — opt-in only:
181
+
182
+ ```bash
183
+ npx ask-colleague@latest install --agents-md
184
+ ```
185
+
186
+ You can also copy `snippets/AGENTS.md` into a project-level `AGENTS.md` if you want the fallback available only in specific repos.
187
+
188
+ ## Options
189
+
190
+ ```text
191
+ colleague ask [codex|claude] --context FILE --question TEXT [options]
192
+
193
+ --cwd DIR run the peer CLI from this directory
194
+ --model MODEL pass a model override to the peer CLI
195
+ --sandbox MODE Codex sandbox: read-only, workspace-write, danger-full-access
196
+ --timeout SECONDS use timeout/gtimeout when available
197
+ --max-bytes BYTES refuse over-large context files
198
+ --allow-large-context disable the size guard
199
+ --dry-run print the prompt, do not call peer CLI
200
+ ```
201
+
202
+ Environment defaults:
203
+
204
+ ```bash
205
+ export COLLEAGUE_DEFAULT_PEER="codex"
206
+ export COLLEAGUE_CODEX_MODEL="gpt-5.4"
207
+ export COLLEAGUE_CLAUDE_MODEL="sonnet"
208
+ export COLLEAGUE_CODEX_SANDBOX="read-only"
209
+ export COLLEAGUE_TIMEOUT="120"
210
+ export COLLEAGUE_VERBOSE="1"
211
+ export COLLEAGUE_MAX_CONTEXT_BYTES="120000"
212
+ export COLLEAGUE_STATE_DIR="$HOME/.ask-colleague"
213
+ ```
214
+
215
+ ## Safety model
216
+
217
+ This project intentionally keeps the consultation one-shot and read-oriented.
218
+
219
+ - Do not paste raw transcripts. They are noisy, expensive, and often contain private data.
220
+ - Do not include secrets, `.env` contents, private keys, tokens, or credentials in the briefing.
221
+ - The bridge sends the prompt through stdin to avoid shell argument-length and quoting problems.
222
+ - Codex is invoked through non-interactive `codex exec` with `--sandbox read-only` by default for the one-shot consult.
223
+ - Claude is called with `--bare`, `-p`, `--output-format text`, `--no-session-persistence`, `--max-turns 1`, `--tools ""`, and `--` before the positional prompt.
224
+ - Installed skills are explicit-only by default.
225
+ - The peer response is advice only. The primary agent remains responsible for verifying, testing, and deciding.
226
+
227
+ See `docs/security.md` for more detail.
228
+
229
+ ## Good context beats big context
230
+
231
+ A good briefing is usually under 1,000-2,000 words:
232
+
233
+ ```markdown
234
+ # Goal
235
+
236
+ # Relevant files and snippets
237
+
238
+ # What I tried
239
+
240
+ # Current error or dilemma
241
+
242
+ # Constraints / non-goals
243
+ ```
244
+
245
+ Bad briefing:
246
+
247
+ - entire conversation transcript
248
+ - full tool logs
249
+ - whole files pasted without explanation
250
+ - secrets or environment dumps
251
+ - vague question like “thoughts?”
252
+
253
+ Good question:
254
+
255
+ - “What edge case does this migration plan miss?”
256
+ - “Is there a simpler patch than adding a new abstraction?”
257
+ - “Why might this test still be flaky after this fix?”
258
+ - “What would you reject in review?”
259
+
260
+ ## Repository layout
261
+
262
+ ```text
263
+ ask-colleague/
264
+ bin/colleague # main bridge CLI and npm bin target
265
+ package.json # npm package metadata and bin mappings
266
+ scripts/ask-codex.sh # compatibility wrapper
267
+ scripts/ask-claude.sh # compatibility wrapper
268
+ skills/claude/colleague/SKILL.md # Claude Code skill, explicit-only
269
+ skills/codex/colleague/SKILL.md # Codex skill, explicit-only via policy
270
+ prompts/colleague.md # legacy Codex custom prompt fallback
271
+ snippets/AGENTS.md # optional Codex AGENTS.md block
272
+ snippets/CLAUDE.md # fallback Claude instructions
273
+ templates/context.md # manual context template
274
+ docs/security.md
275
+ docs/publishing.md
276
+ tests/smoke.sh
277
+ ```
278
+
279
+ ## Troubleshooting
280
+
281
+ ### `colleague: codex CLI not found in PATH`
282
+
283
+ Install Codex CLI and confirm `codex --version` works in the same shell where Claude Code or Codex is running.
284
+
285
+ ### `colleague: claude CLI not found in PATH`
286
+
287
+ Install Claude Code and confirm `claude --version` works in the same shell where Codex is running.
288
+
289
+ ### Install refuses to overwrite a file
290
+
291
+ The file already exists and is not tracked as an unmodified ask-colleague install. Inspect it first. Re-run with `--force` only if it belongs to this package and should be replaced.
292
+
293
+ ### Uninstall leaves a file in place
294
+
295
+ The file was modified after install, so uninstall refuses to delete it by default. Keep the file, remove it manually, or run `colleague uninstall --force` if you are sure.
296
+
297
+ ### The primary agent does not use the skill
298
+
299
+ Invoke it explicitly first:
300
+
301
+ ```text
302
+ /colleague ask Codex to review this # in Claude Code
303
+ $colleague ask Claude to review this # in Codex skill
304
+ /prompts:colleague ask Claude to review this # legacy Codex prompt fallback
305
+ ```
306
+
307
+ The installed skills are intentionally explicit-only by default. This avoids surprising cross-agent calls from paid/authenticated CLIs.
308
+
309
+ ### The peer answer is generic
310
+
311
+ The briefing is probably too thin. Add file paths, the exact error, constraints, and a pointed question.
312
+
313
+ ### The peer answer is distracted by irrelevant context
314
+
315
+ The briefing is probably too large. Remove raw transcript/tool noise and keep only the current decision point.
316
+
317
+ ## Development
318
+
319
+ Run smoke tests:
320
+
321
+ ```bash
322
+ npm test
323
+ ```
324
+
325
+ The smoke tests use dry-run and mocked CLI paths, so they do not require authenticated Codex or Claude CLIs.
326
+
327
+ ## npm package details
328
+
329
+ `package.json` exposes two commands through the `bin` field:
330
+
331
+ ```json
332
+ {
333
+ "bin": {
334
+ "ask-colleague": "bin/colleague",
335
+ "colleague": "bin/colleague"
336
+ }
337
+ }
338
+ ```
339
+
340
+ This means:
341
+
342
+ ```bash
343
+ npx ask-colleague@latest install
344
+ ```
345
+
346
+ runs the package command named `ask-colleague`, while a global install also provides both `ask-colleague` and `colleague` commands:
347
+
348
+ ```bash
349
+ npm install --global ask-colleague
350
+ colleague doctor
351
+ ```
352
+
353
+ The project has no runtime npm dependencies. Node/npm are only used as the distribution mechanism.
354
+
355
+ ## Local npm smoke test
356
+
357
+ Before publishing, test the exact tarball that npm would distribute:
358
+
359
+ ```bash
360
+ npm test
361
+ npm pack --dry-run
362
+ npm pack --pack-destination /tmp
363
+ npx --yes --package /tmp/ask-colleague-0.4.0.tgz ask-colleague --version
364
+ npx --yes --package /tmp/ask-colleague-0.4.0.tgz ask-colleague install --dry-run
365
+ ```
366
+
367
+ ## Publish to npm
368
+
369
+ Before publishing, check the package name and add repository metadata to `package.json` if you have a public repo URL ready.
370
+
371
+ ```bash
372
+ npm login
373
+ npm publish --access public
374
+ ```
375
+
376
+ See `docs/publishing.md` for a pre-publish checklist.
377
+
378
+ ## License
379
+
380
+ MIT. See `LICENSE`.
381
+
382
+ ## References
383
+
384
+ - npm package.json documentation: https://docs.npmjs.com/files/package.json/
385
+ - npm npx documentation: https://docs.npmjs.com/cli/v8/commands/npx/
386
+ - Codex CLI docs: https://developers.openai.com/codex/cli/reference
387
+ - Codex skills docs: https://developers.openai.com/codex/skills
388
+ - Claude Code CLI docs: https://docs.anthropic.com/en/docs/claude-code/cli-reference
389
+ - Claude Code skills docs: https://docs.anthropic.com/en/docs/claude-code/skills