Malong·Liuhe Toolkit — a code-operation toolchain designed for LLMs, not humans
Traditional tools assume users with hands, eyes and memory. LLMs have none of the three.
We rebuilt the entire pipeline — from parsing to writing — around those three missing pieces.
44 tools form a routing network — every result carries a next_step: where to go on success, where to go on error. Six layers, six return loops.
flowchart TB
classDef layer fill:#141419,stroke:#e8b86e,color:#f9ecd6,font-size:14px,font-weight:600;
classDef loop fill:none,stroke:#6d6d6d,color:#b0b0b0,font-size:11px,stroke-dasharray:6 4;
L1["① Locate & Understand
find, read, map the symbol"]:::layer
L2["② Impact & Pre-edit
blast radius · collision check"]:::layer
L3["③ Edit & Write
transactional edits · rename"]:::layer
L4["④ Verify & Test
diff_facts → test_bridge"]:::layer
L5["⑤ Quality & Hygiene
review · security · dead code"]:::layer
L6["⑥ Commit & Ops
git_worktree · health · feedback"]:::layer
L1 -->|ok → symbol found| L2
L2 -->|ok → safe to edit| L3
L3 -->|ok → committed| L4
L4 -->|ok → 0 failures| L5
L5 -->|ok → clean| L6
L4 -. "A · fail → debug_runner → fix" .-> L3
L4 -. "B · commit → diff_facts" .-> L4
L5 -. "C · issues → ③ fix → ④ verify" .-> L3
L2 -. "E · high risk → sandbox_validate" .-> L3
L2 -. "F · conflict → re-read" .-> L3
L1 -. "D · cycles → fix_imports (⑤)" .-> L5
Not an IDE plugin for human programmers — OS primitives for LLMs.
LLMs cannot click, drag or confirm. Every operation must be atomic, undoable and retryable.
LLMs cannot "see" code structure. Output must be structured and self-explaining — JSON for direct consumption, errors with fix suggestions.
LLM context is finite and unstable. Every call must be self-contained — workspace-anchored, with optimistic version concurrency control.
Real numbers under a real 512MB Docker cgroup limit — no paper benchmarks.
| Metric | Value | Note |
|---|---|---|
| Memory footprint | RSS 134MB / 26% | docker --memory=512m real cgroup limit |
| Concurrency | 128 conc / 256 in-flight | zero OOM, zero tearing |
| Token savings | ↓65.3% | same task 7673 → 2662 est |
| Call count | ↓50.0% | old 6 steps → new 3 primitives |
| Index throughput | 538 files / 7s | scoped reindex measured |
| dry_run consistency | 47/47 100% | 3-language golden hashes |
| Concurrent writes, same symbol | 16/16 no silent overwrite | exactly one win, one conflict |
Not an MCP shell — a 4-layer parsing/indexing/writing infrastructure.
MCP protocol, 44-tool orchestration, error recovery, Semaphore scheduling
tree-sitter + tokio + rayon, Unix Socket IPC, catch_unwind crash isolation
WAL mode, single-file DB, integrity_check self-heal, per-workspace isolation
temp+rename atomic writes, 6-state conflict machine, undo journal
From symbolic read/write to quality gates — the full code-operation chain. Pure regex/AST, zero LLM calls.
The threat here is not external attackers — it's the LLM itself, under concurrency, crashes and conflicts.
30+ rounds of "Malong reviews Malong" — the suite audits and fixes its own code, each round growing the assertion suite.
Every quality-gate tool makes zero LLM calls — pure regex/AST, same input always yields the same output. Reproducible, CI-ready, auditable.
A tree-sitter-based symbol extraction engine covering mainstream languages.
Standard install: git clone + npm ci — up in under a minute.
# 1) Clone and install (full better-sqlite3 backend) git clone <repo-url> liuhe && cd liuhe/malong npm ci # full backend, incl. Rust parser binary # 2) Start the MCP server node mcp-server.js --workspace /path/to/project # 3) Self-check (30s) node tests/test-mcp-server.js # 25 assertions
When npm ci is impossible, grab the tarball for your platform on the
download page
and extract it (sql.js sandbox backend; upgrade hint on boot). Full and degraded builds are feature-identical — only the backend differs.
{
"mcp": {
"malong": {
"type": "local",
"command": [
"node",
"--max-old-space-size=512",
"malong/mcp-server.js",
"--workspace", "."
],
"enabled": true
}
}
}
{
"mcpServers": {
"malong": {
"command": "node",
"args": [
"/path/to/malong/mcp-server.js",
"--workspace",
"/path/to/project"
]
}
}
}