Skip to content

Add MiniMax Code (mcode) to the agents panel and default agent switch - #11367

Open
joshleblanc wants to merge 7 commits into
omacom:quattrofrom
joshleblanc:add-mcode-support
Open

joshleblanc wants to merge 7 commits into
omacom:quattrofrom
joshleblanc:add-mcode-support

Conversation

@joshleblanc

@joshleblanc joshleblanc commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • New collector bin/omarchy-agent-usage-mcode reads mcode's JSONL session transcripts under ~/.minimax/v2/sessions/ (override with MCODE_HOME), walks every assistant turn, and emits the panel record contract: per-day totals, per-model breakdown (input / output / cacheRead / cacheWrite), today vs. last-week vs. all-time, and an auth-status probe. mcode has no OAuth rate-limit endpoint, so limits are empty and the panel renders the by-day / by-model chart the way it does for every collector without limits.
  • Panel default: mcode joins claude, codex, and fireworks in shell/plugins/agents/manifest.json, so a fresh install ships with the tab on and the widget self-hides on machines that have never run mcode (the same behaviour the panel already has for every other agent).
  • Mark: shell/plugins/agents/assets/mcode.svg so the panel chip, hero, and subscription chip render the agent instead of falling back to the generic bar glyph.
  • Default-agent switch: omarchy-default-agent mcode (and the minimax-code / minimax aliases) routes through bin/omarchy-install-ai-mcode, which installs @minimax-ai/code via npm with --foreground-scripts --include=optional --allow-scripts=@minimax-ai/code,better-sqlite3 (the same flags mcode's binary uses for its self-update) and writes a marked wrapper at ~/.local/bin/mcode. The installer defers to an existing ~/.minimax-code/bin/mcode (mcode's official install) and drops any stale wrapper that would shadow it. omarchy-agent mcode then launches mcode the same way it launches every other agent through the floating TUI container, threading the prompt straight in.
  • Menu picker: default/omarchy/omarchy-menu.jsonc exposes setup.default.agent.mcode so the menu can pick mcode like any other supported provider.
  • README: collector table now lists mcode, and the MCODE_HOME override is documented alongside CLAUDE_CONFIG_DIR / CODEX_HOME.
  • Tests: new agent-usage-mcode-scanner-test.sh covers the collector's no-sessions, auth-present, multi-session totals, cache split, totals-only fallback, user-only ignore, and MCODE_HOME override cases. New agent-usage-mcode-installer-test.sh covers --check / --owns / --now / --remove across the fresh-install, foreign-wrapper, official-install-present, and post-remove cases. default-agent-test.sh and menu-test.sh are extended so the existing launcher and sort-alphabetically loops exercise the new provider.

Notes for reviewers

  • The mcode wire format reports input as non-cached input and cacheRead separately (totalTokens = input + output + cacheRead + cacheWrite). The collector therefore does NOT subtract cache from input the way the Claude/Codex collectors do — the test data asserts both halves of the split. See agent-usage-mcode-scanner-test.sh for the contract.
  • The assets/mcode.svg mark is a generic terminal/code-bracket glyph. A branded mark in the omarchy icon font should follow omarchy dev font add mcode <source> per agents/skills/icon-font.md — that workflow is package-owned (omarchy-settings ships the font), so it's a separate concern from this PR.
  • The installer follows the --check / --now / --owns / --remove contract used by omarchy-install-hermes-cli and omarchy-install-openclaw-cli. The reason for an installer rather than a mise use -g npm:@minimax-ai/code line in omarchy-default-agent is that mcode's npm package ships a postinstall that depends on better-sqlite3's optional native binding; mise's npm: shorthand drops both --include=optional and --allow-scripts, so the bare install leaves the binary on PATH but unable to load sqlite on first touch. The installer's npm flags are taken straight from the npm commands embedded in the mcode binary itself, so they should track upstream when those change.
  • The PR is built on a fork (joshleblanc/omarchy) since I don't have write access to omacom/omarchy directly.

Testing

$ for t in test/shell.d/agent-*test.sh test/shell.d/agents-*test.sh \
           test/shell.d/default-agent-test.sh test/shell.d/menu-test.sh \
           test/shell.d/menu-guards-test.sh; do
    echo "=== $(basename $t) ==="
    bash "$t" 2>&1 | grep -cE "^not ok"
  done
agent-invitation-test.sh:              0
agent-usage-claude-limits-test.sh:     0
agent-usage-claude-scanner-test.sh:    0
agent-usage-codex-scanner-test.sh:     0
agent-usage-fireworks-scanner-test.sh: 0
agent-usage-mcode-installer-test.sh:   0   <-- new (20 assertions)
agent-usage-mcode-scanner-test.sh:     0   <-- new (14 assertions)
agent-usage-update-test.sh:            0
agents-panel-test.sh:                  0
agents-rename-migration-test.sh:       0
default-agent-test.sh:                 0
menu-test.sh:                          0
menu-guards-test.sh:                   0

- New omarchy-agent-usage-mcode collector scans ~/.minimax/v2/sessions/
  for assistant message transcripts, sums per-day and per-model token
  counts, and prints the panel record contract (with MCODE_HOME override
  and a 30-day scan window).
- mcode joins the default providers in shell/plugins/agents/manifest.json
  and gains an assets/mcode.svg mark so the panel can render it.
- omarchy-default-agent recognises mcode (and the minimax-code /
  minimax aliases), installing npm:@minimax-ai/code via mise the same
  way it installs every other global CLI agent.
- omarchy-agent launches mcode via the floating terminal the way it
  launches every other agent, threading a prompt through as a
  positional argument when one is supplied.
- omarchy-menu.jsonc exposes setup.default.agent.mcode so the menu can
  pick mcode like any other supported provider.
- README + default-agent and menu tests updated to cover the new
  provider; new agent-usage-mcode-scanner-test.sh covers the
  collector's happy and edge cases.
Mavis Code added 3 commits September 11, 2026 18:57
The first pass pointed omarchy-default-agent at npm:@minimax-ai/code
through mise, which installs the binary on PATH but leaves
better-sqlite3 without its optional native binding. mcode's npm
postinstall script verifies the binding and the binary then crashes on
first sqlite touch.

This pass adds bin/omarchy-install-ai-mcode, an installer that:

  - installs via 'npm install -g @minimax-ai/code --foreground-scripts
    --include=optional --allow-scripts=@minimax-ai/code,better-sqlite3'
    -- the same flags the mcode binary itself uses for its self-update
    -- so the optional prebuild lands and the postinstall runs;
  - writes a marked wrapper at ~/.local/bin/mcode that execs the npm
    binary, the same way the user_install check on PATH expects;
  - recognises and defers to ~/.minimax-code/bin/mcode, the official
    install path, dropping a stale wrapper that would shadow it;
  - leaves any foreign wrapper at the slot untouched (--now, --remove,
    --owns);
  - matches the --check / --now / --owns / --remove contract of
    omarchy-install-hermes-cli and omarchy-install-openclaw-cli.

omarchy-default-agent's mcode case now sets agent_installer to the new
script. The default-agent test removes mcode from the mise-loop
expected_agents/expected_packages tables (the loop only exercises
mise-installed agents) and adds assert_launch/assert_bypass lines so
the launcher still covers mcode.

New test/shell.d/agent-usage-mcode-installer-test.sh exercises
--check / --owns / --now / --remove across the fresh-install,
foreign-wrapper, official-install-present, and post-remove cases
(20 assertions).
The collector now probes the platform coding-plan endpoint at
/v1/api/openplatform/coding_plan/remains on the openplatform host
(platform.minimax.io for en, www.minimaxi.com for cn), picks the
first non-media model_remains entry, and emits Session + Weekly
rows with fraction percent (0.0-1.0), an ISO resetsAt string, and
unlimited: true when status === 3.

The panel renders the new fields: limitWindow now passes unlimited
through, LimitRow.alarming ignores unlimited windows, and the
percent column shows 'Unlimited' instead of '0%'.

The record also picks up the same UX signals the other collectors
already carry:

  - scope: 'account'           limits are account-wide, so sync
                                merge keeps a single view rather
                                than summing machines
  - retryAdvised               set on transport failure so the
                                shell retries sooner than its
                                regular interval
  - usageStatusText / authHelpText
                                'Sign-in expired' on 401/403,
                                'MiniMax limits unavailable' on
                                transport failure with no cache
                                fallback, otherwise empty
The test stubs urllib.request.urlopen (and urllib.error.HTTPError
for 401) and exercises the collector's happy path, unlimited path,
media-only fallback, empty / error responses, cn vs en region
routing, Authorization header + GET method, --limits-only reuse,
scope: 'account' on the record, Sign-in expired on 401, and the
connection-error / MiniMax limits unavailable path.

Follows the pattern of agent-usage-claude-limits-test.sh: each
case runs the collector with a throwaway MCODE_HOME and the test
asserts on the JSON record via jq.
@joshleblanc

joshleblanc commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Used mcode installed by this integration to implement this.

image

This is the only coding plan I have, so I'm not 100% sure if I've gotten all the integrations integrated. The install works, the keybinding works, and the info panel has what's shown

Mavis Code added 3 commits September 11, 2026 23:10
The omarchy-install-ai-mcode installer already exists and
omarchy-default-agent mcode routes through it when the binary
isn't on PATH, so the menu is the missing user-facing discovery
surface.

Empty icon glyph matches the existing setup.default.agent.mcode
entry; a real one can land alongside the mcode.svg hero mark
when one is sourced.
Replace the placeholder </> icon with the official MiniMax M-mark.
The source SVG had a 300x250 viewBox, which would letterbox inside
the panel's square hero slot. Squared it to 300x300 and removed the
y-offset from the transform matrix so the mark sits centered with
matching top/bottom padding.
The agents panel and the install/default menus now reference U+E90F,
the next free slot in the omarchy icon font, which renders the M-mark
in monochrome so the menu can pick it up under the active theme's
foreground color.

The glyph was built from the same artwork used by the agents panel
hero mark (shell/plugins/agents/assets/mcode.svg) so the two glyphs
stay visually consistent. The source SVG is kept next to the font
under default/fonts/omarchy/mcode.svg, matching the convention
hermes.svg already uses.

- default/fonts/omarchy/omarchy.ttf: +1 glyph at U+E90F, cmap +
  hmtx + maxp + hhea + post.glyphOrder updated to match.
- default/fonts/omarchy/mcode.svg: source SVG for the glyph, kept
  alongside the font so future maintainers can rebuild it.
- default/fonts/omarchy/README.md: documents the new slot.
- default/omarchy/omarchy-menu.jsonc: setup.default.agent.mcode and
  install.ai.mcode now reference U+E90F under iconFont: omarchy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants