LegnaCode is built on top of Claude Code CLI with deep enhancements — fully compatible with the original, while adding multimodal tools, smarter memory, better UX, and more.
🧠 88% less memory tokens — 4-layer memory stack with vector search replaces flat MEMORY.md injection
🎨 6 multimodal tools — Image, video, speech, music, vision, web search (MiniMax models)
⚡ Instant feedback — Token counter from second 1, status in spinner line, no silent operations
🔌 Pluggable memory — DrawerStore (SQLite + TF-IDF), temporal knowledge graph, WAL audit
🤖 Smarter agents — RPC subprocess execution, autonomous skill detection, smart model routing
| Version | Summary |
|---|---|
| 1.4.5 | OpenViking content tiering (L0/L1/L2 degradation + budget-capped injection) |
| 1.4.4 | Status messages → spinner line; comparison doc |
| 1.4.3 | Mempalace memory fusion (DrawerStore + TF-IDF + 4-layer stack + knowledge graph) |
| 1.4.2 | Progress feedback (8 silent paths fixed); verbose default on |
| 1.4.0 | MiniMax multimodal (6 tools); RPC execution; Memory Provider; smart routing |
Older versions
| Version | Summary |
|---|---|
| 1.3.6 | Windows path separator fix for Edit tool |
| 1.3.5 | SessionStart hook fix; Windows alt-screen rendering |
| 1.3.4 | OML Superpowers (11 skills); SessionStart guidance |
| 1.3.3 | OML smart orchestration (19 agent skills) |
| 1.3.2 | Disabled History Snip; Windows streaming fix |
| 1.3.1 | 1M model snip threshold fix |
| 1.3.0 | Project-local storage; legna migrate |
| 1.2.1 | Model adapter layer (MiMo, GLM, DeepSeek, Kimi, MiniMax) |
| 1.2.0 | Sessions grouped by project; native Windows compilation |
| 1.1.5–1.1.9 | Windows install fixes; WebUI admin panel |
| 1.0.0–1.0.9 | Initial release; feature flags; i18n; BUDDY pet |
Full details → CHANGELOG.md
Built on Claude Code CLI by Anthropic — the pioneering terminal AI programming tool. LegnaCode extends it with multimodal capabilities, smarter memory, and enhanced UX while maintaining full upstream compatibility. Thanks to the Anthropic team for open-sourcing this excellent foundation.
|
🎨 Multimodal (MiniMax)
|
🧠 Memory
|
|
⚡ Agent
|
🛡️ Core
|
|
🖥️ UX
|
🔧 DevOps
|
| Dependency | Version |
|---|---|
| Bun | >= 1.2.0 |
| Node.js | >= 18 (optional) |
| Git | >= 2.0 |
| OS | macOS / Linux |
npm install -g @legna-lnc/legnacodeIf using a mirror registry (e.g., cnpm, Taobao mirror) and the install fails or the version is out of sync, you can specify the official registry:
npm install -g @legna-lnc/legnacode --registry=https://registry.npmjs.orgOnce installed, the legna command is available in any directory. It automatically downloads the precompiled binary for your platform (supports macOS arm64/x64, Linux x64/arm64, Windows x64).
# Verify installation
legna --version
# Update to the latest version
npm update -g @legna-lnc/legnacodegit clone https://github.com/LegnaOS/LegnaCode-cli.git
cd LegnaCode-cli
bun install
bun run compile
# The compiled binary is ./legna — move it to your PATH# Interactive mode
legna
# Non-interactive mode (ask directly)
legna -p "Explain what this code does"
# Continue the last session
legna --continue
# Check version
legna --version├── src/
│ ├── entrypoints/ # Entry point (cli.tsx)
│ ├── server/ # HTTP server (admin WebUI)
│ ├── components/ # React/Ink terminal UI components
│ ├── tools/ # Built-in tools (Bash, file ops, search, etc.)
│ ├── services/ # API calls, MCP client, analytics, etc.
│ ├── native-ts/ # Pure TS replacements for native modules (syntax highlighting, etc.)
│ ├── utils/ # Utility functions
│ └── hooks/ # React hooks
├── webui/ # Admin WebUI frontend (React + Vite + Tailwind)
├── stubs/ # Native module stubs (compile-time external dependency placeholders)
├── scripts/ # Build scripts
├── bunfig.toml # Bun build config (Feature Flags, macro definitions)
└── package.json
LegnaCode uses Bun's bundler for building, with two modes:
bun run build— Build todist/directory, suitable for development and debuggingbun run compile— Compile to a standalonelegnabinary, no Bun runtime required
legna admin launches a browser-based admin panel that lets you manage all configuration through a web interface — no manual JSON editing needed.
# Launch admin panel (default port 3456, auto-opens browser)
legna admin
# Custom port
legna admin 8080Tabs at the top of the panel switch between management scopes: Claude (~/.claude/) and LegnaCode (~/.legna/). Each scope provides four panels:
| Panel | Function |
|---|---|
| Config Editor | Visual editing of settings.json: API endpoint, API key, model mapping (Opus/Sonnet/Haiku), timeout, permission mode, language, etc. |
| Config Profiles | Lists all settings*.json files, shows baseUrl/model, one-click to switch active profile |
| Session History | Browse past sessions showing project path, slug, timestamp, prompt count; one-click copy legna --resume command |
| Config Migration | Bidirectional Claude ↔ LegnaCode migration; supports full or selective field migration with pre-migration diff preview |
When running from source, build the frontend first:
cd webui && npm install && npm run build, thenbun run src/server/admin.ts. The npm global install version includes the pre-built WebUI.
Build-time constants such as version numbers are injected via [bundle.define] in bunfig.toml. Feature Flags in [bundle.features] enable dead code elimination.
Native modules (color-diff-napi, modifiers-napi, etc.) are marked as external and load placeholder implementations from stubs/ at runtime. Syntax highlighting has been switched to a pure TypeScript implementation under src/native-ts/color-diff/, requiring no native compilation dependencies.
LegnaCode uses ~/.legna/ as the global config directory, with project-level data stored in <project>/.legna/:
~/.legna/settings.json— Global user settings~/.legna/.credentials.json— Authentication credentials<project>/.legna/sessions/— Project session records (JSONL)<project>/.legna/skills/— Project skills<project>/.legna/rules/— Project rules<project>/.legna/settings.json— Project-level settingsLEGNA.md— Project instruction file, automatically read and followed by the AI
On first launch, global data is automatically migrated one-way from
~/.claude/to~/.legna/(existing files are not overwritten). Legacy sessions under~/.claude/projects/are read automatically via a fallback chain — no manual migration needed. SetLEGNA_NO_CONFIG_SYNC=1to disable automatic migration.
Manually migrate data:
# Migrate everything (global + current project sessions)
legna migrate
# Migrate global data only: ~/.claude/ → ~/.legna/
legna migrate --global
# Migrate current project sessions to local .legna/sessions/ only
legna migrate --sessions
# Dry run (no files are actually moved)
legna migrate --dry-run| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Anthropic API key |
CLAUDE_CODE_USE_BEDROCK |
Use AWS Bedrock backend |
CLAUDE_CODE_USE_VERTEX |
Use GCP Vertex backend |
CLAUDE_CODE_SYNTAX_HIGHLIGHT |
Set to 0 to disable syntax highlighting |
MINIMAX_API_KEY |
MiniMax API key (enables multimodal tools) |
MINIMAX_REGION |
MiniMax region: global (default) or cn |
MINIMAX_BASE_URL |
Custom MiniMax API URL (overrides region default) |
When using a MiniMax model (ANTHROPIC_BASE_URL pointing to api.minimax.io or api.minimaxi.com) with MINIMAX_API_KEY configured, LegnaCode automatically registers 6 native multimodal tools that the AI can call directly.
# Option 1: Environment variables
export MINIMAX_API_KEY="your-api-key"
export MINIMAX_REGION="global" # or "cn"
# Option 2: Interactive configuration (persisted to ~/.legna/minimax-credentials.json)
legna
> /auth-minimax your-api-keyGet your API key: MiniMax Global or MiniMax China
| Tool | Function | Example |
|---|---|---|
MiniMaxImageGenerate |
Text-to-image generation | "Generate a cyberpunk cityscape at night" |
MiniMaxVideoGenerate |
Text/image-to-video generation | "Turn this image into a 5-second animation" |
MiniMaxSpeechSynthesize |
Text-to-speech | "Convert this text to spoken audio" |
MiniMaxMusicGenerate |
Text-to-music generation | "Generate an upbeat piano background track" |
MiniMaxVisionDescribe |
Image understanding and analysis | "Describe the contents of this image" |
MiniMaxWebSearch |
Web search | "Search for the latest TypeScript 5.x features" |
These tools are only enabled when using MiniMax models and do not affect the tool list for other models.
The AI can automatically orchestrate multiple tools to complete complex tasks:
User: Help me create a promotional video for my project
AI auto-orchestrates:
1. Analyze the project README, extract key selling points
2. MiniMaxImageGenerate → Generate keyframe images
3. MiniMaxVideoGenerate → Generate video from keyframes
4. MiniMaxSpeechSynthesize → Generate narration voiceover
5. Return URLs for all generated assets
MiniMax tool schemas can be exported in Anthropic-compatible format for external integration:
import { exportMiniMaxToolSchemasJSON } from './src/tools/MiniMaxTools/schemaExport.js'
console.log(exportMiniMaxToolSchemasJSON())This project follows the open-source license of the upstream Claude Code CLI. See the Claude Code CLI original repository for details.
