Skip to content

feat(opencode): split Work and Code agents - #184

Merged
mdev34-lab merged 27 commits into
devfrom
arena/01a0a813-alphacode
Sep 23, 2026
Merged

mdev34-lab merged 27 commits into
devfrom
arena/01a0a813-alphacode

Conversation

@mdev34-lab

@mdev34-lab mdev34-lab commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Issue for this PR

Closes #99

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Implements Work (general-purpose workhorse) and Code (software-engineering specialist) as distinct agents.

Work:

  • General-purpose, runs in arbitrary folders and mixed-file workspaces, broad filesystem access, document handling, planning/execution without assuming a software project.
  • No LSP tools.

Code:

  • Software-engineering specialist for Git/project folders, with LSP and repo-aware context.
  • Cannot delegate to Work or to itself.

Enforcement:

  • Core and OpenCode encode the Work/Code LSP and delegation boundaries in permissions.
  • TaskTool rejects primary-agent delegation before prompting for permission.
  • ToolRegistry applies merged agent/session deny rules to tool visibility while preserving finish.
  • Code/Work prompts describe the same runtime boundaries.

Default agent behavior:

  • Work remains the default primary agent. When Work is disabled, Plan is preferred before other visible primary agents. Code remains mode: all rather than becoming the default primary entry point.

How did you verify your code works?

  • Focused Core and OpenCode tests cover agent resolution, delegation, LSP permissions/tool visibility, permission-based tool filtering, primary-agent rejection ordering, and default-agent fallback.
  • Remote CI is the verification environment for this PR because the local container cannot reach GitHub.
  • Current CI status: typecheck and unit (linux) are green; unit (windows) is still running and nix-eval is queued.

Screenshots / recordings

Not applicable; this PR does not change a UI surface.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

mdev34-lab and others added 12 commits September 16, 2026 02:54
- Work is general-purpose workhorse, Code is software-engineering specialist
- Work can delegate to Code, Code cannot delegate to Work via task permission deny
- Code receives LSP tools, Work does not via lsp permission deny and tool filtering
- Enforced at agent/tool configuration seam, not just prompts
- Added minimal LSP and task tools in core and code prompt in opencode
- Added focused regression tests for both runtimes

Co-authored-by: arena-agent <[email protected]>

@mdev34-lab mdev34-lab left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up implementation

Implemented the review findings in commit 3dafa7a1ac9cec47a91c2ff41520d249eda38172.

  • Work explicitly denies task: work at the Core permission seam.
  • TaskTool now rejects every primary agent target at runtime, closing Work→Work, Work→Plan, Code→Plan, Plan→Work, and other primary-agent cycle edges even when permission configuration is permissive.
  • Tool descriptions already exclude primary targets; regression coverage now verifies the runtime execution seam itself.
  • Default-agent fallback explicitly preserves Work first, then Plan, so adding Code cannot change the existing Work-disabled fallback accidentally.
  • Restored the unrelated builtins TODO wording.
  • Added focused Core and opencode regression coverage.

The local container cannot reach GitHub, so tests cannot be executed locally here. The new PR has not reported CI runs/statuses yet; it must remain unapproved until the repository gates report green.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

Copy link
Copy Markdown
Owner Author

The checklist item I have tested my changes locally is intentionally unchecked: this execution environment cannot run the repository checkout locally or reach GitHub from its local container. The changes are being verified through the repository's remote CI; typecheck and unit (linux) are green, with Windows and nix-eval still pending. I will not mark a local-testing claim that did not happen. The PR otherwise follows the required template and the second checklist item is checked.

@mdev34-lab
mdev34-lab merged commit 11b50fc into dev Sep 23, 2026
11 of 12 checks passed
@mdev34-lab
mdev34-lab deleted the arena/01a0a813-alphacode branch September 23, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agent): split Work and Code into specialized runtimes with first-class delegation

1 participant