MiMoCode AI Coding Assistant

repository·main·Indexed 11 days ago

https://github.com/xiaomimimo/mimo-code

A terminal-native AI coding assistant designed to read/write code, manage Git, and execute commands. It features a persistent memory system, supports various LLM providers via OAuth or API keys, and includes an Agent Client Protocol (ACP) v1 implementation for integration with editors like Zed.

Tokens
322.2K
Snippets
903
Records
1.3K
Agent score
94%

What's inside MiMoCode

  1. Core Features of MiMoCode

    main

    MiMoCode is a terminal-native AI coding assistant with the following capabilities:

    • Multiple Agents: Switch between different agent roles by pressing Tab.
      • build (default)
      • plan (read-only analysis)
      • compose (specs-driven orchestration)
    • Persistent Memory: Uses SQLite FTS5 to maintain project knowledge, checkpoints, and task progress across sessions.
    • Intelligent Context Management: Handles automatic checkpoints, context reconstruction, and budgeted injection to respect model limits.
    • Task Tracking: A tree-shaped task system integrated with the checkpoint system.
    • Subagent System: Supports parallel subagents with lifecycle tracking, cancellation, and background execution.
    • Compose Mode: A structured workflow for specs-driven development. It is recommended to use the /compose-next skill on the build agent.
    • Builtin Skills: Over 20 reusable instruction sets (e.g., PDF/Office generation, research, design) invoked via /skill-name or auto-matched by relevance.
    • Workflows: Deterministic multi-agent orchestration scripts (e.g., compose, deep-research, fact-check, research-experiment).
    • Voice Input: Real-time streaming voice input via TenVAD and MiMo ASR.
    • Dream & Distill: Use /dream to extract knowledge into memory and /distill to discover reusable workflows.
  2. What is MiMo Orchestrator Mode

    main

    MiMo Orchestrator Mode is an experimental coordination mode designed to manage multiple tasks from a single window and a single session using natural language. Instead of manually multiplexing between multiple terminal windows and coding sessions, the Orchestrator acts as a 'manager' that:

    1. Decomposes a high-level user goal into deliverable units of work.
    2. Distributes these units to independent child sessions (running in the background with mode: "peer").
    3. Coordinates, integrates (via git merge of the mimocode/* branch from each child), and reports progress.

    Key Distinction: The Orchestrator does not perform the heavy lifting itself (it doesn't write code or perform quality reviews). It delegates implementation tasks to specific modes: implementation goes to build, and planning/composition goes to plan or compose.

    Note: This feature is disabled by default. To enable it, you must set the environment variable MIMOCODE_EXPERIMENTAL_ORCHESTRATOR.

  3. Ensure skill registration for Handoff dialogs

    main

    For the Handoff dialog to function correctly with specific harness options, the required skills must be registered in sync.data.command.

    Specifically, the codex and claude-code skills must be registered. If these skills are not registered, the corresponding options in the Handoff dialog will be hidden to prevent errors when attempting to invoke them.

  4. How MCP Tool Search works in MiMoCode

    main

    MiMoCode implements a provider-independent mechanism for discovering Model Context Protocol (MCP) tools without overwhelming the model's context window. Instead of sending every tool definition at once, MiMoCode provides a single tool named mcp_tool_search.

    The Discovery Process

    1. The Catalog: When enabled, the model sees mcp_tool_search. Its description contains a catalog of available tool names and descriptions. To save tokens, this catalog degrades based on context pressure:
      • Low Pressure (0-1): Includes names and full descriptions.
      • High Pressure (2-3): Includes names only.
      • Budget: The catalog is capped at 10% of the usable input window or 20,000 tokens.
    2. Searching: The model calls mcp_tool_search with a query. MiMoCode uses a local BM25 index to find matches based on names, descriptions, and recursive parameter metadata.
    3. Activation: A successful search does not make the tool immediately callable in the same step. Instead, the matched tools are loaded into the activeTools subset for the next outer-loop step in the session.
    4. Accumulation: Tools accumulate across multiple searches within a single user request. A new user message resets the state, hiding all MCP functions again.
  5. Enterprise features: Central configuration, SSO, and AI Gateways

    main

    OpenCode Enterprise provides several features for organizational control and security:

    • Central Configuration: Allows an organization to enforce a single configuration across all users.
    • SSO Integration: Integrates with your organization's Single Sign-On (SSO) provider for authentication, allowing OpenCode to obtain credentials for internal AI gateways through your existing identity management system.
    • Internal AI Gateway: Can be configured to use only your organization's internal AI gateway, allowing you to disable all other AI providers to ensure all requests pass through approved infrastructure.
    • Self-hosting: While sharing is typically disabled for security, self-hosting the share functionality on your own infrastructure is available upon request.
  6. Control skill visibility and invocation with frontmatter

    main

    MiMoCode distinguishes between authorization (who can use a skill) and reachability (whether the model can see/invoke it). You can control these using YAML frontmatter in your skill's SKILL.md file.

    1. Authorization (permission.skill)

    Use permission.skill to define if a skill is usable at all.

    • deny: The skill is unusable by anyone (neither the model nor the user). Even an explicit user slash command (e.g., /name) will fail.

    2. Model Reachability (disable-model-invocation)

    Use disable-model-invocation to hide a skill from the AI model while keeping it available for manual user invocation.

    • disable-model-invocation: true: The model cannot see the skill in its catalog, tool descriptions, or search results. However, a user can still trigger it using a slash command (e.g., /name).
    • disable-model-invocation: false (default): The model can see and invoke the skill.

    Behavior Matrix

    FrontmatterModel Sees ItModel May InvokeUser /name Works
    (default)yesyesyes
    disable-model-invocation: truenonoyes
    permission.skill: denynonono
    # Example: A skill only a user can trigger manually
    permission:
      skill: allow
    disable-model-invocation: true
  7. Manage the lifecycle of background child sessions

    main

    Orchestrator mode uses an asynchronous, non-polling model for managing background tasks:

    • Dispatching: The session create command returns immediately. The Orchestrator does not poll for status; instead, the child session actively wakes the Orchestrator via an inbox notification when it finishes.
    • Interrupting: Interrupting the main Orchestrator session does not stop its children. They continue running in the background. To stop a specific child, use session cancel <id>. If the entire Orchestrator session exits, all children will exit with it.
    • Resuming: To resume a child that failed or was interrupted, use session list to find the child and then forward it a message via the actor send action to continue.
  8. How the 'system' theme works

    main

    The system theme is designed to match your terminal's appearance automatically. Unlike fixed-color themes, it:

    • Generates a custom grayscale: Creates a grayscale scale based on your terminal's background color for optimal contrast.
    • Uses ANSI colors: Utilizes standard ANSI colors (0-15) for syntax highlighting and UI elements while respecting your terminal's palette.
    • Preserves terminal defaults: Uses none for text and background colors to maintain the original terminal look.

    Use this theme if you want OpenCode to feel like a native part of your terminal or if you use highly customized terminal color schemes.

  9. Understand the Mix of Harness (MoH) and Hand-off mechanism

    main

    The Mix of Harness (MoH) mechanism allows MiMoCode to package external CLI tools like Codex CLI and Claude Code CLI as callable skills. This enables MiMoCode to delegate execution to a specialized harness when it encounters a "low-return cycle" (a state where further token consumption does not result in progress).

    Key Concepts:

    • Separation of Planes: The control plane remains within the MiMoCode session (maintaining context, task panel, memory, and approval routing), while the execution plane shifts to the selected harness.
    • No Provider Switch: Choosing a different harness via MoH does not change the underlying MiMoCode session provider or model. The model simply loads the corresponding skill and delegates the task.
    • Try-Best Detector: A mechanism that monitors the current turn for signs of failure or stagnation (e.g., repeated bash commands without change, or no file changes for X minutes) and triggers a Hand-off to the user to select a new harness.
  10. Understand Try-Best HandOff and Low-Yield Loops

    main

    Try-Best HandOff is an automated version of Fallback mode. It monitors for "low-yield loops" (failure patterns) in real-time during a turn. When a loop is detected, the current turn is paused, evidence is recorded, and control is handed back to the user to decide how to proceed.

    Low-Yield Loop Patterns detected:

    • Loops and Repetitions: Repeatedly editing the same file, consecutive semantically similar diffs, or retrying the same failing bash command.
    • Divergence between Progress and Consumption: High token burn rate with zero progress (e.g., no new tests passing or files covered).
    • Wandering Patterns: Excessive searching (grep) or reading large, unrelated files late in the process, indicating a failure to build a workspace model.
    • Premature Completion: Declaring a task done without actually running or verifying tests.