龙山灵码 · A terminal-native AI coding agent built on MiMo-Code
中文 · English · Documentation · GitHub
Important
SWUST Code is a MiMo-Code based fork. The rule is simple: when MiMo-Code already provides a capability, SWUST Code keeps the MiMo implementation first; when MiMo-Code does not provide it, SWUST Code layers the SWUST-specific implementation on top.
SWUST Code is a terminal-native AI coding agent for long-running software work. It can read and edit code, run commands, manage sessions, use MCP/LSP/plugins, maintain persistent project memory, coordinate subagents, and keep working against explicit goals.
The Chinese product name is 龙山灵码. The CLI command is:
swust-codeProvider names are intentionally not rebranded. MiMo Auto, Xiaomi MiMo Platform, mimo/mimo-auto, and xiaomi/mimo-* refer to the original provider services and model IDs.
# One-line install
curl -fsSL https://raw.githubusercontent.com/MakeBlackSheepGreat/swust-code/main/install | bash
# Or install via npm
npm install -g @swust-code/cli
# Start the TUI
swust-codeFirst launch opens a guided provider setup:
| Option | Use When |
|---|---|
| MiMo Auto | You want a zero-config free-for-limited-time channel |
| Xiaomi MiMo Platform | You want to sign in with MiMo OAuth |
| Import from Claude Code | You already have Claude Code credentials |
| Custom Provider | You use an OpenAI-compatible API gateway or vendor |
| Command | Purpose |
|---|---|
swust-code |
Start the interactive TUI |
swust-code run "explain this repo" |
Run one prompt from the shell |
swust-code run --goal "fix type errors" "start" |
Run with an autonomous stop condition |
/goal <objective> |
Set a goal inside the TUI |
/memory <query> |
Search persistent project memory |
/dream |
Consolidate durable project knowledge from recent sessions |
/distill |
Turn repeated workflows into reusable skills, subagents, or commands |
/subagent, /subagents |
Configure visible subagents with project-level model, reasoning variant, and max-step overrides |
/paste-image |
Attach an image from the clipboard |
/model, /agent, /mcp, /skill, /effort |
Open existing MiMo/SWUST TUI controls via familiar aliases |
SWUST Code inherits MiMo-Code's current runtime foundation:
- terminal TUI, server runtime, web/desktop surfaces
- multi-provider model routing and OpenAI-compatible providers
- LSP, MCP, plugins, custom commands, skills
- persistent memory, checkpoints, context reconstruction
- actor/subagent orchestration and task tracking
goal,compose, Dream/Distill, and voice input
The SWUST layer focuses on product identity, Chinese-first usability, and engineering safeguards:
- 龙山灵码 branding and Chinese localization
- richer sidebar context for goal, task, todo, LSP, MCP, changed files, token, cost, and cache state
- project-level subagent settings for model, reasoning variant, and max execution steps
- attention notifications and sound-pack configuration
- task gate checks before agents stop with unfinished work
- bash command safety analysis
- document validation helpers
- cache-stable context layout
@pathmemory imports and one-fact-per-file memory storage
| Agent | Description |
|---|---|
| build | Default development agent with full tool permissions |
| plan | Read-only exploration and solution design |
| compose | Structured orchestration for specs, skills, review, TDD, verification, and merge workflows |
| goal | Autonomous mode that keeps working until a judge says the stop condition is met |
Press Tab in the TUI to switch primary agents. The runtime can create subagents for investigation, implementation, review, and checkpoint writing while preserving parent-session context.
SWUST Code keeps useful project knowledge across sessions:
~/.local/share/swust-code/memory/
global/MEMORY.md
projects/<project-id>/MEMORY.md
projects/<project-id>/facts/<fact>.md
sessions/<session-id>/checkpoint.md
sessions/<session-id>/notes.md
sessions/<session-id>/tasks/<task-id>/progress.md
Memory is searchable through SQLite FTS5 and reconstructed with checkpoint state when a session resumes or approaches the context limit. The result is less relearning and more continuity during long tasks.
Runtime configuration uses swust-code.json or swust-code.jsonc.
Common locations:
- Global runtime config:
~/.config/swust-code/swust-code.json - Project runtime config:
swust-code.jsonin the project root - Global TUI config:
~/.config/swust-code/tui.json - Project TUI config:
tui.jsonin the project root
Configuration covers providers, models, permissions, agents, commands, MCP servers, plugins, memory/checkpoint behavior, keybindings, themes, and experimental features.
Max Mode is an experimental primary agent that runs parallel best-of-N reasoning for each step, asks a judge call to pick the best candidate, and executes only the winning candidate's tool calls.
This repository enables the built-in max agent with five candidates in .swust-code/swust-code.json:
After restarting the TUI, switch to the max agent with /agents, <leader>a (Ctrl+X then A by default), or cycle agents with Tab / Shift+Tab. Do not create a separate Max agent: the runtime triggers Max Mode only when the selected agent name is exactly max.
Implementation references:
- Agent registration:
packages/opencode/src/agent/agent.ts - Runtime branch:
packages/opencode/src/session/prompt.ts - Candidate and judge orchestration:
packages/opencode/src/session/max-mode.ts - Winner replay and overhead accounting:
packages/opencode/src/session/processor.ts
bun install
bun run dev
bun turbo typecheckMaintainers publish npm releases through npm trusted publishing from GitHub Actions. Configure the GitHub trusted publisher against workflow file npm-release.yml, then push a semver tag that matches packages/opencode/package.json:
git tag v0.7.0
git push swust-code v0.7.0Important release note:
- Trusted publishing is configured per npm package.
- SWUST Code publishes
@swust-code/cliplus the platform binary packages under@swust-code/swust-code-*. - npm only allows trusted publisher setup after a package exists on the registry, so a brand-new package namespace still needs one bootstrap publish before trusted publishing can fully take over.
Package and runtime details:
| Item | Value |
|---|---|
| npm package | @swust-code/cli |
| CLI binary | swust-code |
| Package manager | bun@1.3.11 |
| Current declared version | 0.7.0 |
- Docs site: https://swust-code.dev
- Quick start: https://swust-code.dev/guide/start
- Commands: https://swust-code.dev/api/commands
- Architecture: https://swust-code.dev/dev/architecture
SWUST Code builds on open-source work from:
- MiMo-Code by Xiaomi, the current base for the runtime, TUI, provider, memory, checkpoint, actor, goal, Compose, Dream/Distill, voice, MCP, LSP, and plugin stack.
- OpenCode, important upstream heritage for terminal-native coding agents.
- DevEco Code, reference for document validation ideas.
- DeepSeek-Reasonix, reference for cache-stable context and memory organization ideas.
Source code is licensed under the MIT License.
Use of SWUST Code is also subject to the Use Restrictions. Use of Xiaomi MiMo-hosted services is subject to the MiMo Terms of Service. Use of the MiMo name, logo, and trademarks is subject to the MiMo Trademark Policy.
{ "experimental": { "maxMode": { "candidates": 5 } } }