Skip to content

Fix: Use @path prompt references for task delegation#37

Merged
tctinh merged 6 commits intotctinh:mainfrom
imarshallwidjaja:feat/better-worker-prompt-referencing-for-native-task
Feb 4, 2026
Merged

Fix: Use @path prompt references for task delegation#37
tctinh merged 6 commits intotctinh:mainfrom
imarshallwidjaja:feat/better-worker-prompt-referencing-for-native-task

Conversation

@imarshallwidjaja
Copy link
Copy Markdown
Collaborator

PR: Use @path prompt references for task delegation

The change set standardizes how delegateMode=task passes worker prompts by reference, aligns tests with the output contract, and documents the expected behavior.

Summary

  • Switch task delegation to return a taskToolCall.prompt string that uses OpenCode @path attachment syntax (no prompt inlining).
  • Add e2e coverage for the task delegation output contract, including prompt reference wording and the new taskPromptMode field.
  • Document pass‑by‑reference behavior in opencode‑hive docs and note worktree dependency installs in AGENTS.md.

Changes

  • packages/opencode-hive/src/index.ts
    • Emit taskToolCall.prompt with @<workerPromptPath> and remove promptFile for task mode.
    • Add taskPromptMode: 'opencode-at-file' for task delegation.
    • Update task delegation instructions to reference @path attachment usage.
  • packages/opencode-hive/src/e2e/plugin-smoke.test.ts
    • Add tests asserting taskToolCall fields, absence of backgroundTaskCall, and instruction wording.
    • Add test for taskPromptMode when delegateMode=task.
  • Docs
    • packages/opencode-hive/README.md, docs/HIVE-TOOLS.md, docs/DATA-MODEL.md: clarify worker-prompt.md pass‑by‑reference for task vs hive delegation.
    • AGENTS.md: note that worktrees require bun install before running tests/builds.

Testing

  • bun run test -- packages/opencode-hive/src/e2e/plugin-smoke.test.ts

Manual validation

Prompt an agent to run a small task in delegateMode=task and observe whether it follows the worker prompt file reference during handoff.

Suggested prompt:
"Start a simple Hive task in delegateMode=task and tell me what prompt content you receive during the handoff, including any file references or attachments."

@imarshallwidjaja imarshallwidjaja marked this pull request as ready for review February 2, 2026 10:46
@imarshallwidjaja imarshallwidjaja marked this pull request as draft February 2, 2026 13:16
Switch delegateMode=task handoff to return a prompt string that uses OpenCode's @path attachment syntax instead of inline content.
Update the task instructions and add a smoke test to assert the prompt uses @.hive/.../worker-prompt.md with no promptFile.
Assert delegateMode=task emits taskToolCall fields, omits backgroundTaskCall, and embeds the @path prompt reference in instructions.
This locks the expected hive_exec_start output shape for task-based delegation.
Clarify that worker-prompt.md is passed by reference via @path tokens for task delegation.
Document the recommended task() call pattern and distinguish it from hive background promptFile usage.
Add taskPromptMode: 'opencode-at-file' to hive_exec_start output when delegateMode=task.
Include e2e coverage to assert the field is present alongside the task delegation response.
Document that worktrees are isolated and require bun install before running tests or builds in the worktree.
Remove brittle wording assertion for task delegation instructions and add a discovery section to the prompt-mode test plan so approval succeeds in CI.
The tests now match the actual guidance string while keeping @path coverage.
@imarshallwidjaja imarshallwidjaja force-pushed the feat/better-worker-prompt-referencing-for-native-task branch from 3596b34 to e3fcb6f Compare February 2, 2026 13:22
@imarshallwidjaja imarshallwidjaja marked this pull request as ready for review February 2, 2026 13:22
@tctinh tctinh merged commit ef25309 into tctinh:main Feb 4, 2026
1 check passed
arxdeus pushed a commit to arxdeus/agent-hive that referenced this pull request Mar 21, 2026
…-prompt-referencing-for-native-task

Fix: Use @path prompt references for task delegation
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