diff --git a/.changes/fleet/feat-16541-reach-relay-profile-7c41d2e8.md b/.changes/fleet/feat-16541-reach-relay-profile-7c41d2e8.md new file mode 100644 index 00000000000..ea7a525823f --- /dev/null +++ b/.changes/fleet/feat-16541-reach-relay-profile-7c41d2e8.md @@ -0,0 +1,8 @@ +--- +bump: minor +--- + +### Added + +- The reach skill starts a relay turn or session in a WSL lane in the plugin profile the task names: it finds the target's `profiles.mjs` through `claude plugin list --json`, runs `launch --unattended` there with the relay's own settings in `--with`, and starts `claude` with the printed command. With no profile named, no plugin-profiles on the target, or a Windows lane, it starts as before and says the profile was not applied. +- The reach skill's prompt line says to name the session that holds a PR, issue or branch in the prompt, and never to tell the target to take the work over on its own judgment. diff --git a/plugins/fleet/evals/reach-start-in-profile/case.yaml b/plugins/fleet/evals/reach-start-in-profile/case.yaml new file mode 100644 index 00000000000..892c6600b68 --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/case.yaml @@ -0,0 +1,28 @@ +schema_version: "1.1" +name: 'reach-start-in-profile' +context: + scaffold_script: scaffold.sh +graders: + - name: 'finds-profiles-script' + type: 'regex' + pattern: 'ssh\.exe\s+laptop-wsl\s+''?[^''\n]*\bclaude\s+plugin\s+list\s+--json' + flags: 'i' + target: 'last_message' + - name: 'launch-unattended' + type: 'regex' + pattern: 'profiles\.mjs\S*\s+launch\s+["'']?build\b[^\n]*--unattended' + flags: 'i' + target: 'last_message' + - name: 'settings-through-with' + type: 'regex' + pattern: 'profiles\.mjs\S*\s+launch\b[^\n]*--with\s[^\n]*crossSessionInbound' + flags: 'i' + target: 'last_message' + - name: 'starts-with-printed-command' + type: 'llm' + criteria: 'Starts the laptop session with the command `profiles.mjs launch` prints (its `command` or `argv`) in place of a plain `claude`, and says that when launch exits 1 for a missing required tool nothing is started and the reason is reported' + focus: 'trace' + - name: 'skill-fired' + type: 'tool_used' + tool: 'Skill' + input_match: '"skill"\s*:\s*"(?:fleet:)?reach"' diff --git a/plugins/fleet/evals/reach-start-in-profile/prompt.md b/plugins/fleet/evals/reach-start-in-profile/prompt.md new file mode 100644 index 00000000000..4ef72f74891 --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/prompt.md @@ -0,0 +1,9 @@ +--- +tags: ['reach'] +allowed_tools: [Read, Glob, Grep, Skill] +expected_outcome: 'Starts a named receiver on the laptop''s WSL lane in its build plugin profile: finds profiles.mjs on the laptop through claude plugin list --json (the installPath of the enabled plugin-profiles@ entry), runs profiles.mjs launch build --folder --unattended --json there with the receiver''s crossSessionInbound settings passed through --with, and starts the receiver with the printed command in place of claude. Says that a launch refused for a missing required tool starts nothing and is reported.' +--- + +I'm in the desktop's WSL session (desk-01). Start a Claude session on the laptop's WSL side, in its `build` plugin profile and in `~/repos/app`, that other sessions can keep sending messages to. Give me the exact commands to run; don't run them yourself, and run no shell command to work them out. + +In this session the fleet manifest is at `.config/fleet/FLEET.md` in the working directory, not under `~`. diff --git a/plugins/fleet/evals/reach-start-in-profile/samples/finds-profiles-script.json b/plugins/fleet/evals/reach-start-in-profile/samples/finds-profiles-script.json new file mode 100644 index 00000000000..ae7dd7f2a1e --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/samples/finds-profiles-script.json @@ -0,0 +1,26 @@ +{ + "pass": [ + { + "answer": "**1. Find plugin-profiles on the laptop:**\n\n```sh\n/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'claude plugin list --json'\n```\n\nTake the `installPath` of the enabled `plugin-profiles@` entry.", + "why": "quoted remote command" + }, + { + "answer": "/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl claude plugin list --json", + "why": "unquoted remote command" + } + ], + "fail": [ + { + "answer": "", + "why": "empty reply" + }, + { + "answer": "claude plugin list --json", + "why": "runs locally, not on the laptop" + }, + { + "answer": "/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'node ~/.config/plugin-profiles/profiles.mjs launch build'", + "why": "guesses the script path" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-in-profile/samples/launch-unattended.json b/plugins/fleet/evals/reach-start-in-profile/samples/launch-unattended.json new file mode 100644 index 00000000000..c6ebb93f80f --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/samples/launch-unattended.json @@ -0,0 +1,22 @@ +{ + "pass": [ + { + "answer": "/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'cd ~/repos/app && node /scripts/profiles.mjs launch build --folder ~/repos/app --unattended --json --with \"{\\\"crossSessionInbound\\\":\\\"accept\\\"}\"'", + "why": "launch with --unattended" + }, + { + "answer": "node ~/.claude/plugins/cache/m/plugin-profiles/1.0.0/scripts/profiles.mjs launch build --unattended --json", + "why": "resolved path" + } + ], + "fail": [ + { + "answer": "node /scripts/profiles.mjs launch build --folder ~/repos/app --json", + "why": "no --unattended" + }, + { + "answer": "node /scripts/profiles.mjs apply build --unattended", + "why": "apply, not launch" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-in-profile/samples/settings-through-with.json b/plugins/fleet/evals/reach-start-in-profile/samples/settings-through-with.json new file mode 100644 index 00000000000..e7825a8737b --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/samples/settings-through-with.json @@ -0,0 +1,18 @@ +{ + "pass": [ + { + "answer": "/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'cd ~/repos/app && node /scripts/profiles.mjs launch build --folder ~/repos/app --unattended --json --with \"{\\\"crossSessionInbound\\\":\\\"accept\\\"}\"'", + "why": "settings merged through --with" + } + ], + "fail": [ + { + "answer": "node /scripts/profiles.mjs launch build --unattended --json\nthen: -p -n app-inbox --settings '{\"crossSessionInbound\":\"accept\"}'", + "why": "a second --settings on the start command, which replaces the profile's" + }, + { + "answer": "node /scripts/profiles.mjs launch build --unattended --json --with /tmp/relay.json", + "why": "--with without the receiver's setting" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-in-profile/samples/skill-fired.json b/plugins/fleet/evals/reach-start-in-profile/samples/skill-fired.json new file mode 100644 index 00000000000..9c7398fac3d --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/samples/skill-fired.json @@ -0,0 +1,54 @@ +{ + "pass": [ + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "fleet:reach" + } + } + ], + "why": "qualified name" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "reach" + } + } + ], + "why": "bare name" + } + ], + "fail": [ + { + "answer": [], + "why": "no Skill call" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "other-plugin:other-skill" + } + } + ], + "why": "another skill" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "fleet:reach-other" + } + } + ], + "why": "a skill whose name only starts the same" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-in-profile/scaffold.sh b/plugins/fleet/evals/reach-start-in-profile/scaffold.sh new file mode 100755 index 00000000000..da2e8cc1001 --- /dev/null +++ b/plugins/fleet/evals/reach-start-in-profile/scaffold.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +bash "$(dirname "${BASH_SOURCE[0]}")/../fixtures/fleet-manifest.sh" diff --git a/plugins/fleet/evals/reach-start-without-profile/case.yaml b/plugins/fleet/evals/reach-start-without-profile/case.yaml new file mode 100644 index 00000000000..defea5ab27f --- /dev/null +++ b/plugins/fleet/evals/reach-start-without-profile/case.yaml @@ -0,0 +1,25 @@ +schema_version: "1.1" +name: 'reach-start-without-profile' +context: + scaffold_script: scaffold.sh +graders: + - name: 'one-shot-turn-over-wsl-hop' + type: 'regex' + pattern: '(?/scripts/profiles.mjs launch --unattended --json'", + "why": "runs launch with no profile named" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-without-profile/samples/one-shot-turn-over-wsl-hop.json b/plugins/fleet/evals/reach-start-without-profile/samples/one-shot-turn-over-wsl-hop.json new file mode 100644 index 00000000000..1a6bc3a1450 --- /dev/null +++ b/plugins/fleet/evals/reach-start-without-profile/samples/one-shot-turn-over-wsl-hop.json @@ -0,0 +1,18 @@ +{ + "pass": [ + { + "answer": "```sh\nprintf '%s\\n' 'List the local branches in this repository and reply with the list.' | /mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'cd ~/repos/app && claude -p'\n```\n\nNo plugin profile is applied: you named none, so the turn starts as the route gives it.", + "why": "stdin prompt over the WSL hop" + } + ], + "fail": [ + { + "answer": "", + "why": "empty reply" + }, + { + "answer": "/mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'cd ~/repos/app && git branch'", + "why": "a script, not the laptop's Claude" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-without-profile/samples/says-profile-not-applied.json b/plugins/fleet/evals/reach-start-without-profile/samples/says-profile-not-applied.json new file mode 100644 index 00000000000..7ac9d24a2e7 --- /dev/null +++ b/plugins/fleet/evals/reach-start-without-profile/samples/says-profile-not-applied.json @@ -0,0 +1,22 @@ +{ + "pass": [ + { + "answer": "No plugin profile is applied: you named none.", + "why": "no ... profile ... applied" + }, + { + "answer": "The turn starts without a plugin profile; the profile was not applied because none was named.", + "why": "profile ... not applied" + } + ], + "fail": [ + { + "answer": "printf '%s\\n' 'List the local branches.' | /mnt/c/Windows/System32/OpenSSH/ssh.exe laptop-wsl 'cd ~/repos/app && claude -p'", + "why": "command only, says nothing about the profile" + }, + { + "answer": "The build profile is applied.", + "why": "claims a profile" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-without-profile/samples/skill-fired.json b/plugins/fleet/evals/reach-start-without-profile/samples/skill-fired.json new file mode 100644 index 00000000000..9c7398fac3d --- /dev/null +++ b/plugins/fleet/evals/reach-start-without-profile/samples/skill-fired.json @@ -0,0 +1,54 @@ +{ + "pass": [ + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "fleet:reach" + } + } + ], + "why": "qualified name" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "reach" + } + } + ], + "why": "bare name" + } + ], + "fail": [ + { + "answer": [], + "why": "no Skill call" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "other-plugin:other-skill" + } + } + ], + "why": "another skill" + }, + { + "answer": [ + { + "tool": "Skill", + "input": { + "skill": "fleet:reach-other" + } + } + ], + "why": "a skill whose name only starts the same" + } + ] +} diff --git a/plugins/fleet/evals/reach-start-without-profile/scaffold.sh b/plugins/fleet/evals/reach-start-without-profile/scaffold.sh new file mode 100755 index 00000000000..da2e8cc1001 --- /dev/null +++ b/plugins/fleet/evals/reach-start-without-profile/scaffold.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +bash "$(dirname "${BASH_SOURCE[0]}")/../fixtures/fleet-manifest.sh" diff --git a/plugins/fleet/skills/reach/SKILL.md b/plugins/fleet/skills/reach/SKILL.md index 63998b94280..4088dbd5e20 100644 --- a/plugins/fleet/skills/reach/SKILL.md +++ b/plugins/fleet/skills/reach/SKILL.md @@ -109,7 +109,13 @@ dated measurement and how to re-measure it). When a script can do the job, run t | Background session | `--bg --name ""`, not `-p`, with `< /dev/null` on an SSH row; manage with `claude agents --json --all`, `stop `, `rm ` | none: it is in `` | tested on R2, trusted directory only | - Give every prompt the whole task: what done looks like, and what should make it stop and report. - Nobody answers a question a headless turn asks. + Nobody answers a question a headless turn asks. When the task touches a PR, issue or branch a + session holds, get that session's name and put it in the prompt, and never tell the target to + take the work over on its own judgment. +- **Start in a profile.** When the task names a plugin profile, start the target's turn or session + in it as [reference/relay.md § Start in the target's plugin profile](reference/relay.md#start-in-the-targets-plugin-profile) + says. With no profile named, or none applied, say with the result that the profile was not + applied. - **Query and wait has no one-turn form.** Never wait on a `notify_when_idle` notice from a `-p` sender: in our probe it never reached the sender ([reference/relay.md § Verified behavior](reference/relay.md#verified-behavior)). Send the diff --git a/plugins/fleet/skills/reach/reference/relay.md b/plugins/fleet/skills/reach/reference/relay.md index eb6d121dbe1..9e3247feac4 100644 --- a/plugins/fleet/skills/reach/reference/relay.md +++ b/plugins/fleet/skills/reach/reference/relay.md @@ -11,6 +11,7 @@ plain prompt. - [A named receiver](#a-named-receiver) - [Multi-turn and the open pipe](#multi-turn-and-the-open-pipe) - [Background sessions](#background-sessions) +- [Start in the target's plugin profile](#start-in-the-targets-plugin-profile) - [Mechanisms not used here](#mechanisms-not-used-here) - [Getting a reply back](#getting-a-reply-back) - [Signed-out Windows lane](#signed-out-windows-lane) @@ -165,6 +166,36 @@ For a session that outlives the hop, the target lane's own supervisor hosts it: - **Pointer**: [Agent view: Limitations](https://code.claude.com/docs/en/agent-view#limitations), fetched live. +## Start in the target's plugin profile + +When the task names a plugin profile, a turn or session started in a WSL lane (R2, R4, R5) starts +in that lane's profile, through plugin-profiles' `profiles.mjs launch` on the target. Each step +runs over the row's hop; `` is the directory the session starts in. + +1. Find the script: run `claude plugin list --json` on the target and take the `installPath` of + the entry whose `id` starts with `plugin-profiles@` and whose `enabled` is true. The script is + `/scripts/profiles.mjs`. +2. Run `launch` there with `--unattended`, since nobody answers a relay start, and put the verb's + own `--settings` JSON in `--with`, so the started session carries one settings file + (`profiles.mjs` merges it into the profile's): + + ```console + 'cd && node launch --folder --unattended --json --with "{\"crossSessionInbound\":\"accept\"}"' + ``` + + Leave out `--with` when the verb carries no `--settings`. On exit 1 (the profile switches on a + plugin missing a required tool) start nothing and report the reason it printed. +3. Start the session with the printed `command` in place of `claude`, and the verb's other + arguments after it, without its `--settings`: + + ```console + printf '%s\n' '' | 'cd && -p -n ' + ``` + +With no profile named, no enabled `plugin-profiles@` entry in step 1, or a Windows lane, start the +session as the row does without this section, and say with the result that the profile was not +applied and why. A Windows lane is left out because the printed `command` is a POSIX `env` line. + ## Mechanisms not used here Each fails the fleet's per-lane account split or needs a human; see the linked page before @@ -243,6 +274,7 @@ also rests on documented flag behavior. | Port 22 script hop | Not probed in this pass | | `notify_when_idle` from a `-p` sender | Message delivered; the notice never reached the sender, whose turn ended first | | `-p --remote-control` | Did not connect; Remote Control is interactive only | +| [Start in the target's plugin profile](#start-in-the-targets-plugin-profile) | Untested on a live hop | | Cost | Most of each one-line `-p` turn's cost was SessionStart hooks and context loading; measure a turn per | ## What the relay does not change