Skip to content

feat: add MCode as a built-in ACP agent - #503

Open
hetaoBackend wants to merge 3 commits into
openclaw:mainfrom
hetaoBackend:feat/mcode-agent
Open

feat: add MCode as a built-in ACP agent#503
hetaoBackend wants to merge 3 commits into
openclaw:mainfrom
hetaoBackend:feat/mcode-agent

Conversation

@hetaoBackend

@hetaoBackend hetaoBackend commented Aug 16, 2026

Copy link
Copy Markdown

Closes #502

What Problem This Solves

MiniMax Code already exposes a native ACP v1 server through mcode acp, but acpx users currently have to configure that command manually. This makes MCode unavailable through the same built-in agent workflow as Codex, Claude, Gemini, and the other supported ACP agents.

Why This Change Was Made

Add mcode to both built-in command registries as structured argv (["mcode", "acp"]), with registry and cross-platform CLI integration coverage. The agent guide documents installation, authentication, permission handling, and the current session/load limitation without adding an adapter or sidecar.

User Impact

After installing and authenticating MiniMax Code, users can run:

acpx mcode exec 'summarize this repository'

MCode remains responsible for its own runtime, login state, model configuration, and tools; acpx only owns the ACP client lifecycle and permission policy.

Evidence

  • pnpm run check — 918 tests passed; coverage thresholds passed (94.73% lines, 87.94% branches)
  • pnpm run check:docs — formatting, markdown lint, and docs site build passed
  • Focused registry test passed after first demonstrating the missing built-in as a failing test
  • Focused CLI integration test verifies mcode acp resolution on Unix and Windows .cmd launch paths
  • Live smoke with @minimax-ai/code 0.1.2 returned ACPX_MCODE_OK through acpx mcode exec; the redacted transcript is below
  • Live JSON smoke completed ACP initialize/session/prompt, advertised loadSession: false, streamed a terminal tool-call lifecycle, and returned the expected result; the redacted protocol excerpt is below
  • Project autoreview: clean, no accepted/actionable findings

Redacted real-agent transcript

This was rerun from the PR checkout against the installed, authenticated
@minimax-ai/code 0.1.2 binary. The working-directory path and per-session/message/tool
identifiers are omitted; no protocol result fields were changed.

$ mcode --version
0.1.2

$ ./node_modules/.bin/tsx src/cli.ts --format quiet --timeout 180 --deny-all --cwd <temporary-directory> mcode exec 'Reply with exactly ACPX_MCODE_OK and do not use tools.'
ACPX_MCODE_OK

The second run used --format json --json-strict --approve-all, asked MCode to execute
printf ACPX_TOOL_OK, and filtered the transcript to the initialize response, tool
lifecycle, final agent message, and prompt result:

{"jsonrpc":"2.0","id":0,"result":{"protocolVersion":1,"agentCapabilities":{"loadSession":false,"mcpCapabilities":{"http":true,"sse":true},"promptCapabilities":{"image":false,"audio":false,"embeddedContext":false}},"agentInfo":{"name":"minimax-code","title":"MiniMax Code","version":"0.1.2"}}}
{"jsonrpc":"2.0","method":"session/update","params":{"update":{"sessionUpdate":"tool_call","toolCallId":"<redacted>","title":"bash","name":"bash","kind":"execute","status":"in_progress","rawInput":{"command":"printf ACPX_TOOL_OK"}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"update":{"sessionUpdate":"tool_call_update","toolCallId":"<redacted>","status":"completed","rawInput":{"command":"printf ACPX_TOOL_OK"},"rawOutput":{"content":[{"type":"text","text":"ACPX_TOOL_OK"}]}}}}
{"jsonrpc":"2.0","method":"session/update","params":{"update":{"sessionUpdate":"agent_message_chunk","messageId":"<redacted>","content":{"type":"text","text":"ACPX_TOOL_OK"}}}}
{"jsonrpc":"2.0","id":2,"result":{"stopReason":"end_turn"}}

Scope Notes

  • No MCode protocol changes are included.
  • MCode 0.1.2 does not advertise provider-session reload. The docs now show only one-shot exec usage and explicitly state that sequential CLI invocations start fresh MCode context.

AI assistance was used to investigate the integration path, implement the change, run validation, and draft this PR. All generated changes and evidence were reviewed before submission.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@hetaoBackend
hetaoBackend marked this pull request as ready for review August 16, 2026 13:15
@hetaoBackend
hetaoBackend requested a review from a team as a code owner August 16, 2026 13:15
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 21, 2026, 11:55 PM ET / August 22, 2026, 03:55 UTC.

ClawSweeper review

What this changes

The PR registers mcode acp as a built-in ACP agent, adds MCode documentation, and covers command resolution with registry and CLI integration tests.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep open for an explicit product decision: the proof supports the narrow wiring, but adding a permanent built-in keyword duplicates an existing configured-agent path and creates a durable compatibility contract.

Priority: P3
Reviewed head: 5b40647f7cf48e7f747191afeacc9110ef5c3c36
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Real-agent proof and focused wiring are strong, but the unresolved permanent registry contract prevents a merge-ready rating.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides a redacted after-fix authenticated MCode run plus ACP protocol output showing initialization, tool execution, and the final response.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides a redacted after-fix authenticated MCode run plus ACP protocol output showing initialization, tool execution, and the final response.
Evidence reviewed 7 items Current main lacks the proposed built-in: The released current-main registry has no mcode entry, so this work is not already implemented.
Existing supported configuration path: Current documentation supports friendly configured names with literal structured argv, including Windows-compatible launches, and says same-name entries replace built-ins.
Configuration has precedence: Invocation resolution checks configured agents before falling back to built-in argv, so users can already define mcode: ["mcode", "acp"] without a core registry entry.
Findings 1 actionable finding [P1] Avoid reserving mcode without an approved registry need
Security None None.

Live Verification

Command: pnpm run dev -- mcode --help

Result: PASS (completed)

pnpm run dev -- mcode --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-503-71QR6c/target$ pnpm run dev -- mcode --help

› acpx@0.13.0 dev /tmp/clawsweeper-live-proof-503-71QR6c/target
› tsx src/cli.ts -- mcode --help

Usage: acpx mcode [options] [command] [prompt...]

Use mcode agent

Arguments:
  prompt                        Prompt text

Options:
  -s, --session ‹name›          Use named session instead of cwd default
  --no-wait                     Queue prompt and return immediately when another prompt is already running
  -f, --file ‹path›             Read prompt text from file path (use - for stdin)
  -h, --help                    display help for command

Commands:
  prompt [options] [prompt...]  Prompt using persistent session
  exec [options] [prompt...]    One-shot prompt without saved session
  cancel [options]              Cooperatively cancel current in-flight prompt
  set-mode [options] ‹mode›     Set session mode
  set [options] ‹key› ‹value›   Set session config option
  status [options]              Show local status of current session agent process
  sessions [options]            List, ensure, create, or close sessions for this agent
runner@runnervm76f27:/tmp/clawsweeper-live-proof-503-71QR6c/target$ pnpm run dev -- mcode --help

› acpx@0.13.0 dev /tmp/clawsweeper-live-proof-503-71QR6c/target
› tsx src/cli.ts -- mcode --help

Usage: acpx mcode [options] [command] [prompt...]

Use mcode agent

Arguments:
  prompt                        Prompt text

Options:
  -s, --session ‹name›          Use named session instead of cwd default
  --no-wait                     Queue prompt and return immediately when another prompt is already running
  -f, --file ‹path›             Read prompt text from file path (use - for stdin)
  -h, --help                    display help for command

Commands:
  prompt [options] [prompt...]  Prompt using persistent session
  exec [options] [prompt...]    One-shot prompt without saved session
  cancel [options]              Cooperatively cancel current in-flight prompt
  set-mode [options] ‹mode›     Set session mode
  set [options] ‹key› ‹value›   Set session config option
  status [options]              Show local status of current session agent process
  sessions [options]            List, ensure, create, or close sessions for this agent
runner@runnervm76f27:/tmp/clawsweeper-live-proof-503-71QR6c/target$

Assertions:

  • PASS expect_output: Usage:

How this fits together

ACPX resolves a user-facing agent name into a launch command, then runs that command as an ACP server and manages its session and permissions. The built-in registry defines durable command keywords, while local configuration can add or override named agents.

flowchart LR
  A[User CLI command] --> B[Agent-name resolver]
  C[Project or global configuration] --> B
  D[Built-in agent registry] --> B
  B --> E[ACP process launch]
  E --> F[ACP client session]
  F --> G[Agent response]
Loading

Decision needed

Question Recommendation
Should ACPX reserve mcode as a permanent built-in command when the existing structured custom-agent configuration already supports the same launch argv? Keep MCode configured locally: Decline the built-in addition and retain the existing agents.mcode.argv path, which already provides the requested launch behavior without expanding the core registry.

Why: The implementation is mechanically sound, but VISION and repository policy treat new keywords as long-term API surface; only maintainers can decide whether this convenience warrants an enduring support commitment.

Before merge

  • Avoid reserving `mcode` without an approved registry need (P1) - The existing configuration contract already supports a friendly mcode key with literal structured argv and takes it before built-in resolution. This new row turns that opt-in setup into a permanent default keyword; because ACPX treats keywords as API surface, obtain explicit approval or remove the built-in addition. This retains the prior review blocker rather than introducing a late finding.
  • Resolve merge risk (P1) - Merging reserves mcode as a documented long-term command keyword and changes that token from an unknown raw command to mcode acp; green tests do not decide whether ACPX should own that support contract.
  • Complete next step (P2) - A maintainer must decide whether this permanent public keyword is warranted; no safe mechanical repair can resolve that product choice.

Findings

  • [P1] Avoid reserving mcode without an approved registry need — src/agent-registry.ts:54
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change composition production +2, tests +67, docs +65 across 7 files The implementation is intentionally a small registry addition, while most of the change documents and verifies the proposed public convention.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #502
Summary: This PR is the open candidate implementation for the linked MCode built-in-agent proposal.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Keep the configuration path (recommended)
    Remove the registry addition and direct MCode users to the existing structured agents configuration, avoiding a new permanent keyword.
  2. Accept the keyword contract
    A maintainer can explicitly sponsor the built-in name and its ongoing compatibility expectations before merge.

Technical review

Best possible solution:

Either obtain explicit approval that mcode -> mcode acp belongs in ACPX’s permanent built-in registry, or keep MCode available through the documented custom-agent configuration path.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR proposes a new built-in convention, not a report of broken behavior.

Is this the best way to solve the issue?

No: the current supported configuration path already provides the same named structured launch, so a permanent built-in should land only after explicit product approval.

Full review comments:

  • [P1] Avoid reserving mcode without an approved registry need — src/agent-registry.ts:54
    The existing configuration contract already supports a friendly mcode key with literal structured argv and takes it before built-in resolution. This new row turns that opt-in setup into a permanent default keyword; because ACPX treats keywords as API surface, obtain explicit approval or remove the built-in addition. This retains the prior review blocker rather than introducing a late finding.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2d735cf18220.

Labels

Label justifications:

  • P3: This is a low-urgency built-in-agent convenience addition rather than a broken existing workflow.
  • merge-risk: 🚨 compatibility: The new built-in permanently reserves a user-facing command name and changes its default resolution behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body provides a redacted after-fix authenticated MCode run plus ACP protocol output showing initialization, tool execution, and the final response.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a redacted after-fix authenticated MCode run plus ACP protocol output showing initialization, tool execution, and the final response.

Evidence

What I checked:

  • Current main lacks the proposed built-in: The released current-main registry has no mcode entry, so this work is not already implemented. (src/agent-registry.ts:39, 2d735cf18220)
  • Existing supported configuration path: Current documentation supports friendly configured names with literal structured argv, including Windows-compatible launches, and says same-name entries replace built-ins. (docs/config.md:83, 2d735cf18220)
  • Configuration has precedence: Invocation resolution checks configured agents before falling back to built-in argv, so users can already define mcode: ["mcode", "acp"] without a core registry entry. (src/cli/flags.ts:560, 5b40647f7cf4)
  • Prior blocker remains unchanged: The registry and documentation surfaces are unchanged since the previous ClawSweeper review, so its product-contract concern still applies. (src/agent-registry.ts:54, 5b40647f7cf4)
  • Real behavior proof: The PR body contains a redacted after-fix authenticated MCode run and ACP protocol transcript covering initialization, tool lifecycle, and final response. (5b40647f7cf4)
  • Related area history: This commit added the recent structured-argv compatibility behavior used by built-in agents on Windows. (src/agent-registry.ts:64, f64e2ca4e4cc)

Likely related people:

  • Peter Steinberger: Authored the recent cross-platform structured-argv compatibility change central to this registry contract. (role: recent structured-argv contributor; confidence: high; commits: f64e2ca4e4cc; files: src/agent-registry.ts, src/cli/flags.ts, test/integration.test.ts)
  • JordanTheJet: Authored the recent ZeroClaw built-in-agent addition using the same registry and documentation surfaces. (role: recent built-in registry contributor; confidence: high; commits: b34d7be64799; files: src/agent-registry.ts, docs/agents.md, agents/README.md)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit maintainer approval for the permanent built-in keyword, or remove the registry addition and retain the custom-agent route.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-16T13:21:18.339Z sha 79b5bf4 :: needs real behavior proof before merge. :: [P2] Remove the contributor-owned changelog entry
  • reviewed 2026-08-16T14:28:49.624Z sha ddafca4 :: needs changes before merge. :: [P2] Remove the persistent-session example
  • reviewed 2026-08-16T14:34:28.761Z sha 5b40647 :: found issues before merge. :: [P1] Avoid reserving mcode without an approved registry need
  • reviewed 2026-08-21T22:22:09.715Z sha 5b40647 :: found issues before merge. :: [P1] Avoid reserving mcode without an approved registry need

@hetaoBackend

Copy link
Copy Markdown
Author

Addressed the actionable review items in ddafca4:

  • Removed the contributor-owned CHANGELOG.md entry; release notes remain owned by the release process.
  • Reran the integration against the installed, authenticated @minimax-ai/code 0.1.2 binary.
  • Added a redacted, inspectable transcript to the PR body covering ACP v1 initialization, the advertised loadSession: false boundary, a completed terminal tool call, the final agent message, and end_turn.
  • Reran pnpm run check (918/918 tests, coverage gates passed) and pnpm run check:docs successfully on the updated checkout.

The remaining question—whether mcode should be accepted as a permanent built-in keyword—is intentionally left to maintainer product judgment.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 16, 2026
@hetaoBackend

Copy link
Copy Markdown
Author

Addressed the remaining author-side documentation finding in 5b40647:

  • Removed the sessions new plus later bare-prompt example from agents/MCode.md.
  • Documented that sessions new closes the ACP client after saving the local record and that, without provider-session reload, a later CLI invocation starts fresh MCode context.
  • Synchronized the same exec-first boundary in docs/agents.md.
  • Verified pnpm run check:docs and explicit Markdown lint for agents/README.md and agents/MCode.md.

The real-agent proof remains in the PR body. The only remaining question is maintainer approval of mcode as a permanent built-in keyword.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@hetaoBackend

Copy link
Copy Markdown
Author

@steipete Would you mind taking a look and making the product call on this one?

I’d like to get MCode included as a built-in ACP agent. While mcode acp can already be configured through the custom-agent path, a built-in entry gives users the same straightforward discovery and invocation experience as the other supported agents:

acpx mcode exec 'summarize this repository'

The implementation is intentionally narrow: it only registers the native mcode acp argv, without an adapter or sidecar. Cross-platform registry/CLI coverage, the full test suite, docs checks, and authenticated real-agent ACP smoke tests all pass. The current lack of provider-session reload is also documented explicitly.

ClawSweeper’s remaining concern is the long-term keyword/support contract rather than an implementation defect. I’m in favor of accepting that contract and merging the PR, but I’d appreciate your decision as the maintainer familiar with this registry boundary. If you’re open to the built-in, I’m happy to address any final changes you’d like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add MCode as a built-in ACP agent

1 participant