@freibergergarcia/phone-a-friend 2.0.1 → 2.2.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "phone-a-friend",
3
3
  "description": "CLI relay that lets AI coding agents collaborate by sending prompts and repository context to backend agents.",
4
- "version": "2.0.1",
4
+ "version": "2.2.0",
5
5
  "author": {
6
6
  "name": "Bruno Freiberger"
7
7
  }
package/README.md CHANGED
@@ -20,7 +20,7 @@ Relay tasks to any backend, spin up multi-model teams, or run persistent multi-a
20
20
 
21
21
  | Mode | What it does | Best for |
22
22
  |------|-------------|----------|
23
- | **Relay** | One-shot delegation to Codex, Gemini, Ollama, or Claude | Quick second opinions, code reviews, analysis |
23
+ | **Relay** | One-shot delegation to Codex, Gemini, Ollama, Claude, or OpenCode | Quick second opinions, code reviews, analysis |
24
24
  | **Team** | Iterative multi-backend refinement over N rounds | Collaborative review, converging on a solution |
25
25
  | **Agentic** | Persistent multi-agent sessions with @mention routing | Autonomous collaboration, adversarial review, deep analysis |
26
26
 
@@ -44,6 +44,7 @@ Relay tasks to any backend, spin up multi-model teams, or run persistent multi-a
44
44
  - [Codex CLI](https://developers.openai.com/codex/quickstart/)
45
45
  - [Gemini CLI](https://github.com/google-gemini/gemini-cli)
46
46
  - [Ollama](https://ollama.com/download)
47
+ - [OpenCode](https://opencode.ai/docs)
47
48
 
48
49
  **Install:**
49
50
 
@@ -52,7 +53,7 @@ npm install -g @freibergergarcia/phone-a-friend
52
53
  phone-a-friend # first run shows a guided menu — choose Setup
53
54
  ```
54
55
 
55
- The setup wizard detects your backends, installs the Claude Code plugin, and verifies everything works.
56
+ The setup wizard detects your backends, offers to install detected host integrations, and verifies everything works.
56
57
 
57
58
  **Claude Code marketplace (commands and skills only):**
58
59
 
@@ -77,6 +78,20 @@ This fetches the latest version from npm automatically. To update later:
77
78
  > the web dashboard on localhost, install globally with
78
79
  > `npm install -g @freibergergarcia/phone-a-friend`.
79
80
 
81
+ **OpenCode commands and skills:**
82
+
83
+ If you use [OpenCode](https://opencode.ai/docs), install the same Phone-a-Friend skills plus thin slash-command shims into your OpenCode config:
84
+
85
+ ```bash
86
+ phone-a-friend plugin install --opencode
87
+ ```
88
+
89
+ This installs to `~/.config/opencode/skills/` and `~/.config/opencode/commands/` (or `$XDG_CONFIG_HOME/opencode/...`). From OpenCode, ask naturally, for example:
90
+
91
+ ```
92
+ Ask Codex through phone-a-friend for a short sanity review of this repo; do not edit files.
93
+ ```
94
+
80
95
  **From source:**
81
96
 
82
97
  ```bash
@@ -86,7 +101,7 @@ npm install && npm run build
86
101
  ./dist/index.js # first run guides you through setup
87
102
  ```
88
103
 
89
- Then from Claude Code, just talk naturally — the plugin loads the skills automatically:
104
+ Then from Claude Code or OpenCode, just talk naturally — the host integration loads the skills automatically:
90
105
 
91
106
  ```
92
107
  Ask Gemini to review the error handling in relay.ts
@@ -98,7 +113,7 @@ Build a team with Claude and Ollama. Have them review the website copy,
98
113
  loop through 3 rounds, and converge on final suggestions.
99
114
  ```
100
115
 
101
- No slash commands needed. Once the plugin is installed (the setup wizard does this automatically), Claude loads the `/phone-a-friend` and `/phone-a-team` skills. Mention one backend and Claude routes through `/phone-a-friend`; mention multiple and Claude can use `/phone-a-team` for iterative refinement. You can also invoke either skill explicitly.
116
+ No slash commands needed. Once the host integration is installed (the setup wizard offers to do this), the host can route single-backend tasks through `/phone-a-friend`. In Claude Code, mention multiple backends and Claude can use `/phone-a-team` for iterative multi-agent refinement; `/phone-a-team` is Claude-only because it depends on Claude Agent Teams primitives. In OpenCode, use repeated `/phone-a-friend` calls and synthesize the results manually. You can explicitly invoke `/phone-a-friend` in both hosts, and `/phone-a-team` in Claude Code only.
102
117
 
103
118
  > [!TIP]
104
119
  > **Power-user setup:** Run Claude Code in [**tmux**](https://formulae.brew.sh/formula/tmux) and enable [**bypass permissions**](https://docs.anthropic.com/en/docs/claude-code/security) (`⏵⏵`) for trusted repos. [**Agent teams**](https://docs.anthropic.com/en/docs/claude-code/agent-teams) show up in split panes, so you can watch agents work in parallel without approval pauses. Pair it with **phone-a-friend agentic mode** for fully autonomous multi-agent sessions.
@@ -117,7 +132,9 @@ phone-a-friend --to ollama --prompt "Explain this function"
117
132
  phone-a-friend --to opencode --prompt "Audit this repo" --model qwen3-coder # Local agentic (OpenCode + Ollama)
118
133
  phone-a-friend --to claude --prompt "Review this code" --stream # Stream tokens live
119
134
  phone-a-friend --to codex --prompt "Audit the auth module" --quiet # Run silently, save result
120
- phone-a-friend --to claude --prompt "Explain this" --fast # Skip project context (faster)
135
+ phone-a-friend --to opencode --prompt "Explain this" --fast # Skip OpenCode plugins (faster)
136
+ phone-a-friend --to codex --prompt "Review my fix" --include-diff # Append `git diff HEAD` to the prompt
137
+ phone-a-friend --to codex --prompt "Quick question" --no-include-diff # Override defaults.include_diff = true
121
138
  ```
122
139
 
123
140
  ### Structured output
@@ -141,7 +158,7 @@ phone-a-friend --to codex --prompt "Review the auth module" --session auth-revie
141
158
  phone-a-friend --to codex --prompt "Now fix those issues" --session auth-review
142
159
  ```
143
160
 
144
- Sessions work reliably with Claude, Codex, and OpenCode. Ollama replays history (may hit token limits on long conversations). Gemini session resume is best-effort.
161
+ Sessions work reliably with Claude, Codex, and OpenCode. Ollama replays history (may hit token limits on long conversations). Gemini sessions are currently unsupported.
145
162
 
146
163
  ### Job tracking
147
164
 
@@ -164,6 +181,11 @@ phone-a-friend --to codex --review --base develop # Review against a specific b
164
181
  phone-a-friend --to opencode --review # Review with local model (reads repo via tools)
165
182
  ```
166
183
 
184
+ `--review` is the diff-scoped review mode (uses the backend's native review path when available). For ad-hoc prompts where you want the working-tree diff appended, use `--include-diff` with normal prompt mode. To override a `defaults.include_diff = true` config setting on a single call, use `--no-include-diff` (or set `PHONE_A_FRIEND_INCLUDE_DIFF=false` in the environment for older binaries).
185
+
186
+ > [!TIP]
187
+ > Don't paste code into `--prompt` just to review it — the backend can read the repo directly via `--repo "$PWD"` (default: current working directory). Pasting risks leaking uncommitted edits and burns tokens for content the backend can fetch itself.
188
+
167
189
  ### Agentic
168
190
 
169
191
  Spawn multiple agents that collaborate via @mentions (see [Agentic Mode](#agentic-mode) below):
@@ -180,11 +202,15 @@ phone-a-friend agentic dashboard # Launch web dashboard (localhost:777
180
202
  ```bash
181
203
  phone-a-friend # Interactive TUI dashboard (TTY only)
182
204
  phone-a-friend setup # Guided setup wizard
183
- phone-a-friend doctor # Health check all backends
205
+ phone-a-friend doctor # Health check all backends + host install status
206
+ phone-a-friend plugin install --claude # Install Claude Code plugin
207
+ phone-a-friend plugin install --opencode # Install OpenCode commands and skills
184
208
  phone-a-friend config show # Show resolved config
185
209
  phone-a-friend config edit # Open in $EDITOR
186
210
  ```
187
211
 
212
+ `doctor` reports CLI backends, local backends (Ollama), host integration status (Claude / OpenCode plugin install state), and a summary count. The OpenCode CLI is treated as optional: if you only use Claude Code and don't have OpenCode installed, doctor will not flag that as a degraded state.
213
+
188
214
  ## Backends
189
215
 
190
216
  | Backend | Type | Streaming | How it works |
@@ -193,11 +219,16 @@ phone-a-friend config edit # Open in $EDITOR
193
219
  | **Gemini** | CLI subprocess | No | Runs `gemini --prompt` with `--yolo` auto-approve |
194
220
  | **Ollama** | HTTP API | Yes (NDJSON) | POSTs to `localhost:11434/api/chat` via native fetch |
195
221
  | **Claude** | CLI subprocess | Yes (JSON) | Runs `claude` with sandbox-to-tool mapping |
222
+ | **OpenCode** | CLI subprocess | Yes (NDJSON) | Runs `opencode run` with repo-local tool access |
196
223
 
197
224
  Ollama configuration via environment variables:
198
225
  - `OLLAMA_HOST` -- custom host (default: `http://localhost:11434`)
199
226
  - `OLLAMA_MODEL` -- default model (overridden by `--model` flag)
200
227
 
228
+ Phone-a-friend environment variables:
229
+ - `PHONE_A_FRIEND_INCLUDE_DIFF=false` -- disable diff inclusion across every relay; equivalent to passing `--no-include-diff` on every command. Useful when `defaults.include_diff = true` in your config but you want a session without the diff. Also the canonical mechanism used by OpenCode shims for stale-binary compatibility (the `--no-include-diff` flag was added in v2.2.0+; older binaries reject it but accept this env var since v1.7.2).
230
+ - `PHONE_A_FRIEND_HOST=opencode` -- mark the calling process as OpenCode for the recursion guard. Set automatically by the OpenCode shims; only relevant if you're invoking PaF programmatically from inside an OpenCode session.
231
+
201
232
  OpenCode configuration via TOML:
202
233
  ```toml
203
234
  [backends.opencode]
@@ -270,7 +301,7 @@ Full usage guide, examples, CLI reference, and configuration details:
270
301
  npm uninstall -g @freibergergarcia/phone-a-friend
271
302
  ```
272
303
 
273
- The Claude Code plugin is removed automatically.
304
+ The Claude Code plugin and OpenCode commands/skills are removed automatically when installed through the CLI.
274
305
 
275
306
  ## Contributing
276
307
 
@@ -1,15 +1,45 @@
1
1
  ---
2
2
  name: curiosity-engine
3
- description: Structured Q&A rally between Claude and a backend model. Both sides must always reply with ANSWER: and QUESTION:. Seeded by topic, runs for N rounds.
3
+ description: Structured Q&A rally between the host orchestrating model and a backend model. Both sides must always reply with ANSWER: and QUESTION:. Seeded by topic, runs for N rounds.
4
4
  argument-hint: --topic "<topic>" [--rounds N] [--backend codex|gemini|ollama]
5
5
  ---
6
6
 
7
7
  # /curiosity-engine
8
8
 
9
- A structured ping-pong Q&A game between Claude and a backend model.
9
+ A structured ping-pong Q&A game between the host orchestrating model (the
10
+ agent running this skill — Claude in Claude Code, the OpenCode model in
11
+ OpenCode) and a backend model.
10
12
  Both sides MUST produce an ANSWER: and a QUESTION: every round.
11
13
  The game is seeded with a topic and runs for N rounds (default 3, max 6).
12
14
 
15
+ ## Execution rules
16
+
17
+ - The host model running this skill is the orchestrator. It serves the
18
+ opening question and answers each round directly. Do NOT call
19
+ `phone-a-friend --to claude` (or any other backend) to generate the
20
+ orchestrator's questions or answers — that would relay the orchestrator
21
+ role to a different model.
22
+ - One backend per relay call. Never pass comma-separated values to `--to`
23
+ (e.g. `phone-a-friend --to codex,gemini`).
24
+ - `curiosity-engine` is a host slash command / Agent Skill, not a PaF CLI
25
+ subcommand. Never run `phone-a-friend curiosity-engine`.
26
+ - `--backend` is an argument to this skill, not a PaF CLI flag. Do not pass
27
+ `--backend` to `phone-a-friend`.
28
+ - Suppress the working-tree diff on every binary-mode relay (see "Diff
29
+ suppression" below). Curiosity rounds are seeded with self-contained
30
+ prompts; the diff would be noise.
31
+ - Do NOT dump repo files or git output (`git show`, `git diff`,
32
+ `git status`, etc.) into the relay prompt. Curiosity rounds are seeded
33
+ with self-contained prompts; if the round needs file context,
34
+ repo-aware backends (codex, gemini) can read the repo via
35
+ `--repo "$PWD"`. For `ollama` (no repo file access), pick a repo-aware
36
+ backend instead, or ask before sending a minimal excerpt. Inlining
37
+ repo content can leak uncommitted edits or committed secrets and is
38
+ not needed for a Q&A rally. The opening question and round
39
+ transcripts are narrative context that the orchestrator generates and
40
+ inlines into the relay prompt; that is the intended use, not file
41
+ dumping.
42
+
13
43
  ## Inputs
14
44
 
15
45
  - Arguments: `$ARGUMENTS`
@@ -52,6 +82,35 @@ Request:
52
82
  No "Additional Context" section is needed for curiosity-engine (prompts are
53
83
  self-contained).
54
84
 
85
+ Note: do NOT pass PaF flags like `--no-include-diff`, `--fast`, or
86
+ `--session` in direct mode. They are CLI flags on the `phone-a-friend`
87
+ binary; the underlying backend CLIs do not accept them.
88
+
89
+ ## Diff suppression
90
+
91
+ `/curiosity-engine` rounds use self-contained prompts; the working-tree diff
92
+ would be irrelevant noise. PaF reads `defaults.include_diff` from user
93
+ config, so without explicit suppression a user with `include_diff = true`
94
+ would silently leak the diff into every relay round.
95
+
96
+ The cleanest flag is `--no-include-diff`, added in phone-a-friend v2.2.0.
97
+ Older binaries reject the flag with `unknown option '--no-include-diff'`.
98
+ Probe once before Round 1, then reuse the gate across every binary-mode
99
+ relay (initial round, follow-up rounds, and the schema re-prompt):
100
+
101
+ ```bash
102
+ if phone-a-friend relay --help 2>/dev/null | grep -q -- '--no-include-diff'; then
103
+ PAF_NO_DIFF="--no-include-diff"
104
+ else
105
+ export PHONE_A_FRIEND_INCLUDE_DIFF=false
106
+ PAF_NO_DIFF=""
107
+ fi
108
+ ```
109
+
110
+ Append `$PAF_NO_DIFF` to every binary-mode `phone-a-friend` invocation in
111
+ the steps below. The env var fallback works in v1.7.2 and later; the
112
+ explicit flag is preferred when available.
113
+
55
114
  ## Step 1 — Parse Arguments
56
115
 
57
116
  Extract `--topic`, `--rounds`, and `--backend` from `$ARGUMENTS`.
@@ -102,24 +161,29 @@ If `RELAY_MODE = binary`, the binary handles model selection internally.
102
161
 
103
162
  ## Step 3 — Serve Round 1
104
163
 
105
- Claude serves first. Claude's opening move:
164
+ The orchestrating agent (the host model running this skill) serves first.
165
+ It produces the opening move directly, without relaying to any backend:
106
166
 
107
167
  ```
108
168
  ANSWER: N/A — I'm serving first.
109
- QUESTION: <Claude's opening question on TOPIC — make it genuinely curious and specific>
169
+ QUESTION: <orchestrator's opening question on TOPIC — make it genuinely curious and specific>
110
170
  ```
111
171
 
112
172
  Display to user:
113
173
  ```
114
174
  --- Round 1 of <MAX_ROUNDS> | Topic: <TOPIC> ---
115
- 🤖 Claude QUESTION: <question>
175
+ 🤖 <orchestrator> QUESTION: <question>
116
176
  ```
117
177
 
178
+ `<orchestrator>` is the host model's display label (e.g., "Claude" in
179
+ Claude Code, the OpenCode model name in OpenCode). Pick one that the user
180
+ will recognize.
181
+
118
182
  Then relay to backend:
119
183
 
120
184
  **Binary mode** (`RELAY_MODE = binary`):
121
185
  ```bash
122
- phone-a-friend --to <BACKEND> --repo "$PWD" --sandbox read-only --fast [--model <model>] --prompt "<relay-prompt>"
186
+ phone-a-friend --to <BACKEND> --repo "$PWD" --sandbox read-only --fast $PAF_NO_DIFF [--model <model>] --prompt "<relay-prompt>"
123
187
  ```
124
188
 
125
189
  **Direct mode** (`RELAY_MODE = direct`):
@@ -137,17 +201,17 @@ curl -s http://localhost:11434/api/chat -H "Content-Type: application/json" \
137
201
  Where `<relay-prompt>` is:
138
202
 
139
203
  ```
140
- You are playing The Curiosity Engine — a structured Q&A rally with Claude.
204
+ You are playing The Curiosity Engine — a structured Q&A rally with another agent.
141
205
  Topic: <TOPIC>
142
206
  Round: 1 of <MAX_ROUNDS>
143
207
 
144
- Claude's question for you:
208
+ The orchestrating agent's question for you:
145
209
  <QUESTION>
146
210
 
147
211
  You MUST respond in EXACTLY this format — no exceptions, no extra text:
148
212
 
149
- ANSWER: <your answer to Claude's question, 2-4 sentences>
150
- QUESTION: <a new question for Claude on the same topic, that you are genuinely curious about>
213
+ ANSWER: <your answer to the orchestrator's question, 2-4 sentences>
214
+ QUESTION: <a new question for the orchestrator on the same topic, that you are genuinely curious about>
151
215
 
152
216
  Do not add any text before ANSWER: or after the QUESTION line.
153
217
  ```
@@ -175,7 +239,7 @@ Send one correction relay if `ANSWER:` or `QUESTION:` is missing:
175
239
 
176
240
  **Binary mode** (`RELAY_MODE = binary`):
177
241
  ```bash
178
- phone-a-friend --to <BACKEND> --repo "$PWD" --sandbox read-only --fast [--model <model>] --prompt "<re-prompt>"
242
+ phone-a-friend --to <BACKEND> --repo "$PWD" --sandbox read-only --fast $PAF_NO_DIFF [--model <model>] --prompt "<re-prompt>"
179
243
  ```
180
244
 
181
245
  **Direct mode** (`RELAY_MODE = direct`):
@@ -197,7 +261,7 @@ Your previous response did not follow the required format.
197
261
  You MUST respond with EXACTLY this structure:
198
262
 
199
263
  ANSWER: <your answer>
200
- QUESTION: <your question for Claude>
264
+ QUESTION: <your question for the orchestrator>
201
265
 
202
266
  No other text. Try again.
203
267
  ```
@@ -219,34 +283,38 @@ Display backend's response:
219
283
 
220
284
  If this was the final round (ROUND == MAX_ROUNDS) → jump to Step 6 (Synthesis).
221
285
 
222
- Otherwise, increment ROUND. Claude now responds:
286
+ Otherwise, increment ROUND. The orchestrating agent (the host model)
287
+ now responds directly — no relay:
223
288
 
224
289
  ```
225
- 🤖 Claude ANSWER: <Claude's genuine answer to backend's question, 2-4 sentences>
226
- QUESTION: <Claude's new question for backend on TOPIC>
290
+ 🤖 <orchestrator> ANSWER: <orchestrator's genuine answer to backend's question, 2-4 sentences>
291
+ QUESTION: <orchestrator's new question for backend on TOPIC>
227
292
  ```
228
293
 
229
- Relay Claude's question to backend using this template (same structure as Step 3, substituting current values):
294
+ Relay the orchestrator's question to backend using this template (same
295
+ structure as Step 3, substituting current values, and reusing
296
+ `$PAF_NO_DIFF` for binary mode):
230
297
 
231
298
  ```
232
- You are playing The Curiosity Engine — a structured Q&A rally with Claude.
299
+ You are playing The Curiosity Engine — a structured Q&A rally with another agent.
233
300
  Topic: <TOPIC>
234
301
  Round: <ROUND> of <MAX_ROUNDS>
235
302
 
236
- Claude's question for you:
303
+ The orchestrating agent's question for you:
237
304
  <QUESTION>
238
305
 
239
306
  You MUST respond in EXACTLY this format — no exceptions, no extra text:
240
307
 
241
- ANSWER: <your answer to Claude's question, 2-4 sentences>
242
- QUESTION: <a new question for Claude on the same topic, that you are genuinely curious about>
308
+ ANSWER: <your answer to the orchestrator's question, 2-4 sentences>
309
+ QUESTION: <a new question for the orchestrator on the same topic, that you are genuinely curious about>
243
310
 
244
311
  Do not add any text before ANSWER: or after the QUESTION line.
245
312
  ```
246
313
 
247
314
  Repeat Step 4 and Step 5 until MAX_ROUNDS reached or early termination.
248
315
 
249
- **Claude's discipline:** Claude ALWAYS provides both ANSWER: and QUESTION: — never skips either field, never breaks the schema itself.
316
+ **Orchestrator discipline:** the host model ALWAYS provides both ANSWER:
317
+ and QUESTION: — never skips either field, never breaks the schema itself.
250
318
 
251
319
  ## Step 6 — Final Synthesis
252
320
 
@@ -274,7 +342,7 @@ Present the full session summary:
274
342
 
275
343
  ### Most Interesting Exchange
276
344
 
277
- <Claude picks the sharpest Q&A pair from the transcript and explains in 2-3 sentences why it was the most interesting — what tension, insight, or surprise it revealed>
345
+ <orchestrator picks the sharpest Q&A pair from the transcript and explains in 2-3 sentences why it was the most interesting — what tension, insight, or surprise it revealed>
278
346
 
279
347
  ---
280
348
 
@@ -295,7 +363,7 @@ When BACKEND=gemini, the relay command must include `--model`:
295
363
 
296
364
  **Binary mode:**
297
365
  ```bash
298
- phone-a-friend --to gemini --model gemini-2.5-flash --repo "$PWD" --sandbox read-only --fast --prompt "<relay-prompt>"
366
+ phone-a-friend --to gemini --model gemini-2.5-flash --repo "$PWD" --sandbox read-only --fast $PAF_NO_DIFF --prompt "<relay-prompt>"
299
367
  ```
300
368
 
301
369
  **Direct mode:**
@@ -309,7 +377,7 @@ Do NOT use aliases like `auto`, `pro`, or `flash` — always use the full model
309
377
  ## Constraints
310
378
 
311
379
  - MAX_ROUNDS clamped to [1, 6]. Never exceed.
312
- - Both sides must always produce ANSWER: and QUESTION:. Claude never breaks the schema.
380
+ - Both sides must always produce ANSWER: and QUESTION:. The orchestrator never breaks the schema.
313
381
  - One re-prompt allowed per round on schema violation. Two strikes = early termination.
314
382
  - No nested curiosity-engine sessions.
315
383
  - phone-a-friend is used as a black box — do not modify its internals.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: phone-a-friend
3
- description: Relay task context + latest response to a backend (Codex, Gemini, or Ollama) for feedback, then continue with that feedback.
3
+ description: Ask Codex, Gemini, Claude, or Ollama for a second opinion through the phone-a-friend CLI while preserving the user's request in --prompt.
4
4
  argument-hint: [optional review focus]
5
5
  ---
6
6
 
@@ -10,7 +10,34 @@ Use this command after an assistant reply you want reviewed by another AI.
10
10
 
11
11
  ## Goal
12
12
 
13
- Send compact task context + the latest assistant reply to a backend (Codex, Gemini, or Ollama) using `phone-a-friend`, then bring the feedback back into the current conversation.
13
+ Send compact task context + the latest assistant reply to a backend (Codex,
14
+ Gemini, Claude, or Ollama) using `phone-a-friend`, then bring the feedback back
15
+ into the current conversation.
16
+
17
+ ## Execution rules
18
+
19
+ - Preserve the user's actual request in `--prompt`. Do not drop it.
20
+ - Do not run a bare `phone-a-friend --to <backend> --review` unless the user
21
+ explicitly asks to review the current diff, branch changes, or staged changes.
22
+ - If the user asks for a repo sanity check, architecture opinion, plan critique,
23
+ or general second opinion, use normal prompt mode with `--repo "$PWD"`.
24
+ - If the user says not to edit files, keep that instruction in `--prompt`.
25
+ - Suppress the working-tree diff by default (see "Diff suppression" below);
26
+ only include the diff when the user explicitly asked to review the diff,
27
+ branch changes, or staged changes.
28
+ - One backend per call. Never pass comma-separated values to `--to` (e.g.
29
+ `phone-a-friend --to codex,gemini`). To consult multiple models, run
30
+ separate `phone-a-friend` calls. The `/phone-a-team` slash command
31
+ orchestrates that for you in Claude Code.
32
+ - `curiosity-engine` is a host slash command / Agent Skill, not a PaF CLI
33
+ subcommand. Never run `phone-a-friend curiosity-engine`. Same shape rule
34
+ applies to any other slash command: never invoke them as PaF
35
+ subcommands (e.g. `phone-a-friend phone-a-team`).
36
+ - `--backend` is a `/phone-a-team` skill argument, not a PaF CLI flag. Do
37
+ not pass `--backend` to `phone-a-friend`.
38
+ - Do NOT dump repo files or git output into `--context-file` or
39
+ `--context-text`. Repo-aware backends read files via `--repo "$PWD"`
40
+ using their own tools. See "Context hygiene" below.
14
41
 
15
42
  ## Inputs
16
43
 
@@ -53,9 +80,65 @@ Additional Context:
53
80
  <context-payload>
54
81
  ```
55
82
 
56
- In direct mode, also verify the backend CLI is available (`command -v codex` or
57
- `command -v gemini`) before calling it. If not found, tell the user how to
58
- install it and stop.
83
+ In direct mode, also verify the backend CLI is available (`command -v codex`
84
+ or `command -v gemini`) before calling it. If not found, tell the user how
85
+ to install it and stop.
86
+
87
+ Note: do NOT pass PaF flags like `--no-include-diff`, `--fast`, or
88
+ `--session` in direct mode. Those are CLI flags on the `phone-a-friend`
89
+ binary; the underlying backend CLIs do not accept them.
90
+
91
+ ## Context hygiene
92
+
93
+ Do not generate `--context-file` or `--context-text` from repository files,
94
+ `git show`, `git diff`, `git status`, or other local file/git output. Do
95
+ not create temp files just to pass repo content. For repo-aware backends
96
+ (codex, gemini, claude, opencode), pass `--repo "$PWD"` and let the
97
+ backend inspect files with its own tools.
98
+
99
+ `--context-file` and `--context-text` are reserved for **narrative
100
+ context that is not already in the repo** — for example: conversation
101
+ history that the backend cannot see, your own analysis, user constraints,
102
+ prior model output you want reviewed. These remain valid and useful.
103
+
104
+ Inlining repo content is wasteful, can leak tracked uncommitted edits or
105
+ committed secrets into the relay payload, and bypasses the backend's
106
+ normal file-access controls.
107
+
108
+ Backend exception: `ollama` has `localFileAccess: false` and cannot read
109
+ the repo on its own. For Ollama specifically, ask the user before sending
110
+ file content, and send a minimal excerpt rather than bulk-dumping files
111
+ or git output.
112
+
113
+ ## Diff suppression
114
+
115
+ PaF reads `defaults.include_diff` from user config. If a user has
116
+ `include_diff = true` set, every relay would silently leak the working-tree
117
+ diff into the prompt. To prevent that, every binary-mode relay must suppress
118
+ the diff explicitly.
119
+
120
+ The cleanest flag is `--no-include-diff`, which was added in
121
+ phone-a-friend v2.2.0 (the same release that introduced this command).
122
+ Older binaries reject the flag with `unknown option '--no-include-diff'`.
123
+ Probe once at the start of the workflow, then reuse the gate:
124
+
125
+ ```bash
126
+ if phone-a-friend relay --help 2>/dev/null | grep -q -- '--no-include-diff'; then
127
+ PAF_NO_DIFF="--no-include-diff"
128
+ else
129
+ export PHONE_A_FRIEND_INCLUDE_DIFF=false
130
+ PAF_NO_DIFF=""
131
+ fi
132
+ ```
133
+
134
+ Then append `$PAF_NO_DIFF` to every binary-mode `phone-a-friend` invocation.
135
+ The env var fallback works in v1.7.2 and later; the explicit flag is
136
+ preferred when available because it doesn't leak the override into child
137
+ processes.
138
+
139
+ Only when the user explicitly asked to review the diff, branch changes, or
140
+ staged changes, swap `$PAF_NO_DIFF` for `--include-diff` (and prefer
141
+ `phone-a-friend ... --review` for branch-level reviews).
59
142
 
60
143
  ## Workflow
61
144
 
@@ -85,11 +168,17 @@ I'm working on this task and got the above response. Please review it and return
85
168
 
86
169
  **Binary mode** (`RELAY_MODE = binary`):
87
170
  ```bash
88
- phone-a-friend --to codex --repo "$PWD" --prompt "<relay-prompt>" --context-text "<context-payload>" [--fast] [--session <id>]
89
- # For gemini, always include --model (see "Gemini Model Priority" below):
90
- phone-a-friend --to gemini --repo "$PWD" --prompt "<relay-prompt>" --context-text "<context-payload>" --model <model> [--fast] [--session <id>]
171
+ phone-a-friend --to codex --repo "$PWD" --prompt "<relay-prompt>" --context-text "<context-payload>" $PAF_NO_DIFF [--fast] [--session <id>]
172
+ # For gemini, always include --model (see "Gemini Model Priority" below).
173
+ # Do NOT pass --session to gemini it will error (see "Session continuity" below):
174
+ phone-a-friend --to gemini --repo "$PWD" --prompt "<relay-prompt>" --context-text "<context-payload>" --model <model> $PAF_NO_DIFF [--fast]
91
175
  ```
92
176
 
177
+ `$PAF_NO_DIFF` comes from the probe in "Diff suppression" above. It
178
+ resolves to `--no-include-diff` on new binaries and an empty string on
179
+ stale binaries (with `PHONE_A_FRIEND_INCLUDE_DIFF=false` exported as
180
+ the fallback).
181
+
93
182
  See "Speed optimization" and "Session continuity" below for when to
94
183
  include `--fast` and `--session`.
95
184
 
@@ -105,7 +194,9 @@ I'm working on this task and got the above response. Please review it and return
105
194
  "Direct call reference" section, substituting `<relay-prompt>` and
106
195
  `<context-payload>` into the template.
107
196
 
108
- Note: `--fast` and `--session` are only available in binary mode.
197
+ Note: `--fast`, `--session`, and `--no-include-diff` are PaF CLI flags
198
+ only available in binary mode. Do not append them to direct-mode
199
+ invocations of `codex` or `gemini`.
109
200
 
110
201
  5. Return backend feedback in concise review format:
111
202
  - Critical issues
@@ -122,13 +213,14 @@ When building binary-mode relay commands, add `--fast` if ALL of these are true:
122
213
  CLAUDE.md rules that the backend needs to read
123
214
  - The task does NOT need MCP tools (GitHub API, Slack, database queries)
124
215
 
125
- `--fast` skips loading project context (CLAUDE.md, MCP servers, skills,
126
- hooks) for the Claude backend. It is a no-op for Codex, Gemini, and Ollama,
127
- but safe to include regardless of backend.
216
+ `--fast` maps to `--pure` for OpenCode, skipping external plugins. It is a
217
+ no-op for Claude, Codex, Gemini, and Ollama. Claude intentionally does not
218
+ use `--bare` because bare mode skips OAuth/keychain reads and can break
219
+ subscription auth.
128
220
 
129
221
  Most `/phone-a-friend` relay calls are self-contained reviews where the
130
- context is already in the prompt. Default to including `--fast` unless the
131
- task clearly needs project context.
222
+ context is already in the prompt. Default to including `--fast`; it is
223
+ harmless for Claude/Codex/Gemini/Ollama and meaningful for OpenCode.
132
224
 
133
225
  ## Session continuity
134
226
 
@@ -144,7 +236,7 @@ wants the same backend to apply fixes or dig deeper), reuse the session:
144
236
  3. On **subsequent** relays to the **same backend** in the same
145
237
  conversation, reuse the same session ID. The backend remembers previous
146
238
  turns.
147
- 4. If switching backends (e.g., first call to codex, second to gemini),
239
+ 4. If switching backends (e.g., first call to codex, second to ollama),
148
240
  generate a new session ID for the new backend. Sessions are
149
241
  backend-specific.
150
242
 
@@ -152,13 +244,20 @@ Benefits: the backend keeps full conversation history, so follow-up prompts
152
244
  can be shorter (no need to re-send context from previous turns).
153
245
 
154
246
  **Backend-specific behavior:**
155
- - **Claude, Codex**: native session resume. Follow-up prompts can send
156
- deltas only.
157
- - **Ollama**: replays full history each call. Sessions work but prompt size
158
- grows with each turn. Keep follow-ups concise.
159
- - **Gemini**: session resume is best-effort (may start fresh). Always
160
- include enough context for Gemini to answer independently, even in
161
- follow-up calls.
247
+ - **Codex, Claude, OpenCode**: native session resume. Follow-up prompts
248
+ can send deltas only.
249
+ - **Ollama**: replays full history each call. Sessions work but prompt
250
+ size grows with each turn. Keep follow-ups concise.
251
+ - **Gemini**: `--session` is **not supported**. PaF rejects it with a
252
+ RelayError (`--session is not supported by the gemini backend ...`).
253
+ Each Gemini relay call must be self-contained. Do not pass `--session`
254
+ with `--to gemini`.
255
+
256
+ On the FIRST relay under a new session label, PaF prints an informational
257
+ stderr line: `[phone-a-friend] Session label "..." not found in store.
258
+ Starting a fresh session under this label.` This is expected. The hint
259
+ about `--backend-session` in that line is for advanced use (see below)
260
+ and not relevant to the typical `/phone-a-friend` flow.
162
261
 
163
262
  **Omit `--session`** for one-off relays where no follow-up is expected.
164
263
  This is the common case. Only add `--session` when the user explicitly
@@ -166,6 +265,25 @@ asks for a follow-up or continuation of a previous relay.
166
265
 
167
266
  Session continuity is only available in binary mode (`RELAY_MODE = binary`).
168
267
 
268
+ ### Advanced: `--backend-session` (raw thread ID adoption)
269
+
270
+ If the user explicitly provides a Codex/Claude/OpenCode backend thread ID
271
+ that PaF did not create (e.g., from another tool or a previous CLI run),
272
+ attach to it with `--backend-session <id>` instead of `--session <id>`.
273
+ Combine with `--session <label>` to also start tracking under a label.
274
+
275
+ ```bash
276
+ # Resume a raw backend thread once (no PaF persistence):
277
+ phone-a-friend --to codex --repo "$PWD" --backend-session <thread-id> --prompt "<...>" $PAF_NO_DIFF
278
+
279
+ # Adopt: resume AND start tracking under a PaF label going forward:
280
+ phone-a-friend --to codex --repo "$PWD" --session <label> --backend-session <thread-id> --prompt "<...>" $PAF_NO_DIFF
281
+ ```
282
+
283
+ This is rarely the right move from inside a Claude Code conversation — the
284
+ common case is `--session <label>` with a fresh label. Only use
285
+ `--backend-session` when the user supplied a specific backend thread ID.
286
+
169
287
  ## Gemini Model Priority
170
288
 
171
289
  When using `--to gemini`, **always** pass `--model` using the first model from
@@ -214,6 +332,10 @@ This does NOT apply to `--to codex`.
214
332
 
215
333
  ## Notes
216
334
 
217
- - Prefer `--context-text` for small payloads.
335
+ - Prefer `--context-text` for small narrative payloads.
218
336
  - `--context-file` and `--context-text` are mutually exclusive.
219
- - If context is too large for inline args, use a repo-local temp file.
337
+ - If your narrative context is too large for inline args, write it to a
338
+ temp file outside the repo (e.g. under `/tmp`). Do NOT use a repo-local
339
+ temp file — it muddies git status and risks accidental commit. Repo
340
+ content itself does not need a temp file at all; see "Context hygiene"
341
+ above.