Skip to content

[Feature]: Publish a supported interop contract for MiniMax Code as an embedded agent harness #637

Backlog

Description

@lucasmauricio

Product or interface

CLI - interactive TUI

Use case and problem

MiniMax Code already speaks ACP v1 and already has a Claude-compatible hook engine, but neither is exposed as a contract that third-party agent hosts can rely on, and two details actively break them:

  1. Hook commands run with a fixed environment allowlist. The hook receives only a fixed allowlist (PATH, HOME, LANG, TERM, SHELL, USER, TMPDIR, TEMP, TMP, PATHEXT, SystemRoot, ComSpec, USERPROFILE, HOMEDRIVE, HOMEPATH, APPDATA, LOCALAPPDATA) plus MCode variables (MINIMAX_HOOKS_DIR, MINIMAX_HOOKS_DATA, MINIMAX_PROJECT_DIR, CLAUDE_PROJECT_DIR, CODEX_PROJECT_DIR, PLUGIN_ROOT, PLUGIN_DATA, …). Everything else the agent process had is dropped — including HERDR_ENV and HERDR_PANE_ID, TMUX/TMUX_PANE, ZELLIJ, STY, KITTY_WINDOW_ID, WEZTERM_PANE and any host-specific variable. A host therefore cannot learn where its agent is running, which is exactly what the documented self-reporting path needs (herdr pane report-agent <PANE_ID>).
  2. The TUI emits SessionStart only on the first turn. A session that was just launched, was restored, or is waiting for input produces no lifecycle event at all, so the host cannot even see that an agent is there.

Reproduce the first one in one command:

# a hook that dumps its environment; compare with the parent process env
HERDR_ENV=1 HERDR_PANE_ID=w3:p2 mcode exec "say OK"
# -> the hook sees no HERDR_ENV, no HERDR_PANE_ID

Consequence in practice: MCode is a second-class seat next to Claude Code and Codex inside multi-agent orchestrators. Measured on one machine (MiniMax Code 0.8.1, Herdr 0.9.5, OpenRig 0.7.10, Linux):

  • Herdr classifies agents from a detection manifest that lists 22 agents (amp, agy, claude, cline, codex, cursor, devin, droid, gemini, grok, hermes, kilo, kimi, kiro, letta, maki, muse, opencode, pi, qodercli, qwen, copilot) — MiniMax Code is not among them — and ships 18 built-in integrations (herdr integration install claude|codex|opencode|kilo|qwen|…) with no mcode entry. Out of the box a pane running MCode has no agent identity: its state reads unknown instead of idle/working/blocked, and the session is not reattached after a restart.
  • OpenRig has no mcode runtime among its built-ins (claude-code, codex, pi, omp, terminal). A plain community-harness preset is documented as degraded — "activity is read from the screen only, so a quiet screen remains unknown", "conversation identity is unavailable and resume is unsupported", "no separate cancellation command is available", "approval prompts remain in the MCode pane; OpenRig relays none" — while Claude Code and Codex seats get none of those limits.

Desired behavior

Ten concrete asks. Each has an acceptance criterion; the last two are the ones that block integrations today.

R1 — Publish a supported ACP interop contract.
The current ACP page lists what a host "can receive" but states no guarantee. Please publish which methods and capabilities are stable across CLI versions, the versioning/compatibility policy for the minimax-code/extensions namespace, the mcode acp process model (it accepts exactly one client connection per process — is a reconnect possible after a host crash?), and a machine-readable schema.
Acceptance: a versioned page plus a JSON schema an external author can implement against, and a stability statement per capability.

R2 — Guarantee resumable session identity across restarts.
Please guarantee and document that an ACP session id from session/new stays valid for session/load/session/resume after the mcode acp process restarts, and document the TUI equivalent (mcode --session <id>) as the host-facing resume command.
Acceptance: a documented guarantee, a test that restarts the ACP process and resumes the same session, and the resume command documented for hosts.

R3 — Add a tool-failure signal to the hook contract.
Hook events do not distinguish a failed tool call from a successful one: there is no PostToolUseFailure event and no documented failure/status field in PostToolUse. Hosts that model agent state need that distinction.
Acceptance: either a PostToolUseFailure event, or a documented status/error field in the PostToolUse payload, with the payload schema published.

R4 — Publish stable TUI markers for external classifiers.
Herdr classifies an unknown agent either by screen-scraping rules published per agent (herdr.dev/agent-detection/<agent>.toml) or by an agent-side hook that self-reports (herdr pane report-agent). Both need something stable from MCode: documented screen markers (OSC title format, working indicator, permission-prompt text, prompt-box marker) kept stable, or an official detection manifest plus a herdr integration install mcode entry.
Acceptance: a published marker reference with a stability promise, and a detection manifest entry Herdr can consume without reading MCode source.

R5 — Run hook commands with the parent environment (or a configurable allowlist).
Either (a) spawn hook commands with the parent environment, minus what MCode needs to control itself; or (b) keep an allowlist but make it configurable (env var or config key) and document the default; or (c) document a supported way for a host to pass a context value to a hook — for example a MCODE_HOOK_CONTEXT variable populated from the parent environment or the session configuration.
Two measured details that matter for the design: the PATH a hook receives is the agent process's own PATH (plus MCode's own directories), so it is a usable per-process channel; TMPDIR is forwarded only if the parent process defines it (absent by default on Linux) and XDG_RUNTIME_DIR is not in the allowlist at all. And the channel has to carry more than a pane id: a host reporting to a per-session server also needs the host session identity, otherwise the report reaches the wrong server and comes back pane_not_found.
Acceptance: a hook command observes the parent's HERDR_ENV/HERDR_PANE_ID (or a documented equivalent), verified by the reproduction above.

R6 — A supported way for a host to deliver hooks to MCode.
MCode reads hooks only from ~/.minimax/hooks.json (user) and <project>/.minimax/hooks.json (project), and explicitly does not read ~/.claude/settings.json or .claude/settings.json. Hosts that manage a fleet write into the other harnesses' convention (OpenRig, for example, writes ~/.claude.json trust, ~/.claude/skills discovery, AGENTS.md/CLAUDE.md guidance and .claude/settings.local.json status lines), so those seats receive hooks and status lines and MCode seats receive nothing. Relocating the data directory (MINIMAX_DATA_DIR) does let a host install hooks per seat, but it is undocumented and has a cost (R8). Please add a hooks-specific injection point — e.g. MINIMAX_HOOKS_FILE=<path> or a hooks.file config key — and publish a compatibility table of which conventions MCode reads, ignores, and will never read.
Acceptance: one documented knob a host can set without relocating the data directory, and a published compatibility table.

R7 — Make project hooks usable by headless/host-managed seats.
Project hooks only run after the user turns them on in Settings → Hooks → Project. A seat launched by an orchestrator has no GUI and no human at the switch, so per-project hooks cannot be enabled for an MCode seat at all. Please allow a per-launch opt-in (env var or CLI flag).
Acceptance: a documented flag or env var that enables project hooks for a launched process.

R8 — Document the credential contract for isolated seats.
A host that seats MCode per agent (one data directory per seat) needs each seat authenticated. Today, relocating the data directory invalidates the stored OAuth session: the credential store keys its record to the data directory, so a copied auth/ directory is not accepted and the seat reports "Sign in to MiniMax to use Agent features". Each isolated seat therefore needs its own interactive mcode login, which an orchestrator cannot perform unattended. Please document this explicitly and provide a supported way to share a credential across seats — for example a documented environment variable or CLI flag pointing at a credential path to reuse, or a non-interactive login a host can drive (device code, service token, exported token).
Acceptance: a documented, unattended way for a host to give an isolated MCode seat a valid credential.

R9 — Surface tool approvals as ACP permission requests.
A host that relays approvals needs the agent to ask, over ACP, when a tool needs a decision. On 0.8.1 it never does:

Case Result
write inside the workspace executed, no request
write outside the workspace executed, no request
rm -rf outside the workspace executed, no request
the same, with the host declaring fs.readTextFile, fs.writeTextFile and terminal capabilities executed, no request
session/set_config_option { configOptionId: "permissionMode", value: "ask" } -32602 Invalid params
session/set_mode { modeId: "ask" } -32602 Unsupported Session mode — only default and plan exist

The effective permission mode reported in the hook payload was auto, and permissionMode: ask in config.yaml maps to it. Please raise ACP session/request_permission for tool approvals honouring the configured mode, make the permission mode controllable per session over ACP, and document the mapping of MCode's permission modes to ACP requests.
Acceptance: with the permission mode set to ask, an ACP session raises session/request_permission for a write outside the workspace, and the request carries option ids a host can map to a human decision.

R10 — Emit the session lifecycle when the session starts, not only on the first turn.
The TUI is lazy about SessionStart: the event fires when the first turn begins, not when the session is created or resumed.

Situation SessionStart fired?
mcode exec "…" yes, at launch (source: "startup")
mcode (TUI) launched and left idle no — nothing fires until the user sends the first prompt
TUI reopened with mcode --session <id> no — same behaviour, the host sees nothing

An MCode seat that was just launched, was restored, or is waiting for input is therefore invisible to the host: no agent in the sidebar, an empty herdr agent list, and no way to tell "MCode is ready" from "there is no agent here". The same gap exists at the other end of the life cycle — the TUI emits no SessionEnd when the process exits (measured: mcode exec emits only SessionStart, UserPromptSubmit and Stop), so the host cannot learn that the agent died either. Claude Code and Codex emit session-start at launch and session-end on exit, so an MCode seat is strictly less observable than its peers even in the best case. Please fire SessionStart when the TUI creates or resumes a session (before the first turn, with a source naming the origin: startup, resume, clear, compact, fork), fire SessionEnd when the TUI process exits (the engine already carries a reason field), and either keep firing SessionStart at the first turn as well or document that it is one-shot per session.
Acceptance: starting mcode (TUI) and leaving it idle produces a SessionStart hook invocation within a second; quitting the TUI produces a SessionEnd invocation.

Platform

Multiple platforms

Alternatives and additional context

We already built a working host-side integration against 0.8.1, using only public surfaces — no source changes, no private APIs. It is a launcher wrapper plus a hook script, both plain shell, and it reaches parity on a live Herdr 0.9.5 server:

  • the pane appears in Herdr's sidebar as agent mcode, with live state (idle / working / blocked) and its own labels;
  • herdr agent list and herdr agent get return the agent;
  • after a Herdr server restart, Herdr re-runs the resume command we reported and the agent reopens the same MCode session;
  • on the OpenRig side, a runner: true community-harness preset over mcode acp gives the seat activity, identity, cancellation and resume; only the approval relay has no trigger (R9).

Getting there required the workarounds this issue asks to remove — the hook could not learn the pane or host session from its environment (R5), and the session lifecycle was only visible from the first turn onward (R10) — so we did not manage it with PATH alone: the launcher writes a small per-process registry under $HOME and the hook finds it by walking its own process ancestry. The integration is public and we are happy to upstream it as an official herdr integration install mcode entry (R4).

Three more host-side findings that may be useful for the design:

  • Herdr ignores a report whose --seq is not greater than the last one accepted for the same --source (the server still answers ok), so a host's sequence numbers must be strictly increasing across sessions and restarts;
  • an agent registered on a pane that is back at an idle shell prompt is cleared by Herdr within seconds, including its resume command;
  • Herdr's pane report-agent-session is dropped silently by the 0.9.5 CLI, while the same command attached to a state report works.

Evidence log:

Item Value
MiniMax Code CLI 0.8.1 (mcode --version)
ACP protocolVersion 1, handshake verified against mcode acp; agent methods initialize, authenticate, logout, providers/*, session/{new,load,list,delete,fork,resume,close,set_mode,set_config_option,prompt,cancel} plus minimax-code/extensions
Hook payload (live) hook_event_name, session_id, turn_id, prompt_id, stop_hook_active, last_assistant_message, transcript_path, cwd, model, permission_mode, source
Transcript <id>.compatible.jsonl under /tmp/minimax-plugin-hooks/transcripts/
Hook environment fixed allowlist, rebuilt per invocation; HERDR_ENV/HERDR_PANE_ID absent
Credential binding the OAuth record is keyed to the data directory; a copied auth/ is rejected, so an isolated seat needs its own mcode login
Herdr 0.9.5 — 22 agents in the detection manifest, 18 built-in integrations, no MCode
ACP permission requests none raised in the cases listed in R9; the effective mode in the hook payload was auto
ACP session modes only default and plan; session/set_config_option rejects permissionMode with -32602
ACP resume session/resume reopens an existing conversation in a new process; a missing one is refused with -32002

Activity

  1. added
    enhancement
    needs-triage
    on Dec 1, 2026
  2. added
    tui
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-triagetui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions