Skip to content

docs(skill): support OpenCode in agent handoffs section - #2108

Merged
max-sixty merged 1 commit into
mainfrom
docs/agent-handoffs-opencode
Apr 12, 2026
Merged

max-sixty merged 1 commit into
mainfrom
docs/agent-handoffs-opencode

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Updates the worktrunk skill's "Advanced: Agent Handoffs" section to instruct the agent to use whichever CLI it is running as — claude for Claude Code or 'opencode run' for OpenCode — instead of hardcoding claude in the example commands.
  • Broadens the project-instructions reference to include AGENTS.md alongside CLAUDE.md.
  • Adds an OpenCode substitution note (and matching AGENTS.md reference) to the user-facing "Agent handoffs" example in docs/content/tips-patterns.md.

Closes the concrete sub-request from #2076: when an OpenCode session was asked to spawn a parallel worktree, the skill told it to run claude literally, so the handoff defaulted to Claude Code. After this change the agent is told to substitute its own CLI.

The broader docs-prominence question from #2076 (a dedicated reference/opencode.md, OpenCode mentions in claude-code.md, etc.) is intentionally left out of this PR for maintainer judgment.

Test plan

  • cargo test --test integration test_command_pages_and_skill_files_are_in_sync — passes; auto-syncs skills/worktrunk/reference/tips-patterns.md and the .well-known/agent-skills/index.json digest.
  • cargo test --test integration test_docs_quickstart_examples_are_in_sync — passes.
  • typos runs clean on the touched files.
  • Verified opencode run accepts a positional prompt (opencode run [message..]) per the OpenCode CLI docs, and that wt switch -x 'opencode run' -- '<task>' works because --execute is passed through the user's shell, so the multi-word command is parsed correctly and trailing -- args are shell-escaped and appended.

The "Agent handoffs" guidance was Claude-only. OpenCode users hit
this when triggering parallel-worktree handoffs because the skill
told the agent to use `claude` literally. Make the skill instruct
the agent to use whichever CLI it is running as (`claude` or
`'opencode run'`), broaden the project-instructions reference to
include `AGENTS.md`, and update the user-facing docs example with
the OpenCode substitution.

Refs #2076
@max-sixty
max-sixty enabled auto-merge (squash) April 12, 2026 01:00
@max-sixty
max-sixty merged commit c0059a5 into main Apr 12, 2026
22 checks passed
@max-sixty
max-sixty deleted the docs/agent-handoffs-opencode branch April 12, 2026 01:05
max-sixty pushed a commit to max-sixty/tend that referenced this pull request Apr 12, 2026
…ml (#256)

## Summary

The review-reviewers skill's Step 1 resolved `BOT_LOGIN` with `gh api
user --jq '.login'`, which returns the currently authenticated analysis
bot — e.g., `tend-agent` when review-reviewers runs on tend. That login
is **not** the target repo's bot when analyzing cross-repo (e.g.,
`worktrunk-bot` on max-sixty/worktrunk, `prql-bot` on PRQL/prql). The
wrong login was then passed into the Haiku outcome-survey subagent's
prompt as ``The bot's login is `$BOT_LOGIN`.``, and the subagent
filtered reviews/comments by that wrong login → false "no bot output"
negatives on runs where real bot reviews were posted.

Fix: read `bot_name` from the target repo's `.config/tend.toml` — the
authoritative source every tend adopter already declares.

## Evidence

**Run**:
[24295690958](https://github.com/max-sixty/tend/actions/runs/24295690958)
(review-reviewers on max-sixty/worktrunk)

The Haiku subagent I spawned was told ``The bot's login is
`tend-agent`.`` and reported:

> - **24295397943** — `tend-review` on PR #2108 — No bot review posted
despite run completing successfully
> - **24295084845** — `tend-review` on PR #2104 — No bot review posted
despite run completing successfully
> - **24294851520** — `tend-review` on PR #2107 — No bot review posted
despite run completing successfully

Verified directly with the actual bot login:

```
$ gh api repos/max-sixty/worktrunk/pulls/2107/reviews --jq '.[] | {user: .user.login, state, submitted_at}'
{"state":"APPROVED","submitted_at":"2026-04-12T00:25:46Z","user":"worktrunk-bot"}

$ gh api repos/max-sixty/worktrunk/pulls/2104/reviews --jq '.[] | {user: .user.login, state, submitted_at}'
{"state":"COMMENTED","submitted_at":"2026-04-12T00:09:43Z","user":"worktrunk-bot"}
{"state":"APPROVED","submitted_at":"2026-04-12T00:17:08Z","user":"worktrunk-bot"}
{"state":"APPROVED","submitted_at":"2026-04-12T00:20:28Z","user":"worktrunk-bot"}
```

So PR #2107 *was* reviewed+approved+merged, and PR #2104 had three prior
bot reviews — the analysis bot filtered them out because it was looking
for `tend-agent`, not `worktrunk-bot`. The false negatives would have
triggered session-log drilldowns and potentially spurious findings if
the main Opus agent hadn't manually double-checked.

The prior [max-sixty/worktrunk PR
#2108](max-sixty/worktrunk#2108) (bot-authored
docs PR) also "looked" unreviewed — but that one was a correct silent
exit on a self-authored PR, and only visible as such after verifying the
bot login manually.

## Fix

Before:
```bash
BOT_LOGIN=$(gh api user --jq '.login')
```

After:
```bash
BOT_LOGIN=$(gh api "repos/$ARGUMENTS/contents/.config/tend.toml" --jq '.content' 2>/dev/null \
  | base64 -d 2>/dev/null \
  | grep -E '^bot_name\s*=' | head -1 | sed -E 's/.*=\s*"?([^"]+)"?.*/\1/')
if [ -z "$BOT_LOGIN" ]; then
  echo "ERROR: could not resolve bot_name from \$ARGUMENTS/.config/tend.toml" >&2
  exit 1
fi
```

Verified against all three live tend adopters:

| Target | Resolved BOT_LOGIN |
|---|---|
| max-sixty/worktrunk | worktrunk-bot |
| max-sixty/tend | tend-agent |
| PRQL/prql | prql-bot |

## Gate assessment

- **Evidence level**: Critical. The bug silently produces wrong analysis
input for every cross-repo run. **1 occurrence is sufficient.**
- **Classification**: **Structural** — same inputs always produce the
wrong `BOT_LOGIN` for cross-repo analysis. Deterministic, not
model-dependent.
- **Change type**: Targeted fix (small bash-block replacement, same
step, no new step).
- **Gate 1 (confidence)**: PASS — critical structural bug, 1 confirmed
occurrence.
- **Gate 2 (magnitude)**: PASS — targeted fix is proportionate to the
bug.

## Not fixed here (out of scope)

`plugins/tend-ci-runner/skills/review-runs/SKILL.md:101` references
`$BOT_LOGIN` without defining it (that skill runs in-repo, so `gh api
user` would at least be consistent, but the var is never set). Separate
problem; leaving alone.

## Test plan

- [x] Pre-commit passes on edited file
- [x] Dry-run of the new bash block correctly resolves `worktrunk-bot`
from `max-sixty/worktrunk/.config/tend.toml`
- [x] Dry-run resolves `tend-agent` from
`max-sixty/tend/.config/tend.toml`
- [x] Dry-run resolves `prql-bot` from `PRQL/prql/.config/tend.toml`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants