@mmesh/meshcode
v0.2.0
Published
MeshCode + MeshGuard. An agentic coding CLI AND a transparent governance proxy in front of Claude Code / Cursor / Cline — every prompt routed through ModelMesh for DLP, audit, budgets, and intent-aware routing.
Readme
@mmesh/meshcode
What's new in 0.2.0
- MeshGuard mode —
meshcode wrap claudeandmeshcode shellrun a local proxy in front of Claude Code (or any Anthropic-API tool). Every prompt is DLP-scanned, audited, budget-checked, and routed through ModelMesh while the tool sees a normal Anthropic API. honor_toolrouting policy — when you wrap a tool, ModelMesh only routes to providers matching that tool's family (e.g., Claude Code → Anthropic models only). Switch tooptimizeper-endpoint in the admin portal if you want full multi-provider routing.- 0.1.0 features preserved —
meshcode/meshcode chat(the standalone agent) is unchanged.
⚠ MeshGuard requires backend changes deployed to
api.model-mesh.net: therouting_policycolumn onendpoint_interfaces, thetools/tool_choicepassthrough on/v1/chat/completions, theX-MeshCode-*header support onselect_interface, and the corresponding migration. If your ModelMesh deployment doesn't have these yet,meshcode chatstill works butmeshcode wrapwill fail. See the project repo for the backend rollout PR.
Two products in one CLI:
- MeshCode — standalone agentic coding REPL (
meshcode). Full intent-based routing: any prompt can land on any model in your pool, optimized for cost and quality. - MeshGuard — transparent governance proxy in front of Claude Code / Cursor / Cline / any Anthropic-API tool (
meshcode wrap,meshcode shell). Honors the tool's chosen provider family; layers DLP, audit, budgets, and policy on top.
Every prompt — through either surface — goes through your ModelMesh deployment. Your CISO sees what your developers asked. Your routing rules decide which model gets the prompt. Your token budgets are enforced before the call leaves your perimeter.
Install
Once published, customers run:
npm install -g @mmesh/meshcode
meshcode --versionLocal development
cd cli
npm install
npm run typecheck # sanity check the TS
npm run build # compile to dist/ + chmod +x
npm link # symlinks `meshcode` into your PATH from this folderTo remove the local link: npm unlink -g @mmesh/meshcode.
First-time login
meshcode loginThis opens your browser to the ModelMesh portal. Sign in with the same credentials you use for the web app — your CLI is then authorized. You never see or paste an API key. Under the hood ModelMesh auto-provisions a CLI (auto) endpoint scoped to your role on first login and binds a fresh mm_live_* token to your CLI; the token is stored in ~/.meshcode/config.json (mode 0600).
If you need to point at a non-production deployment:
meshcode login --server https://dev.api.model-mesh.netHeadless / CI / air-gapped environments
When there's no browser, you can still sign in by pasting an API key generated from the admin portal (Admin → Endpoints → API Keys):
meshcode login --key mm_live_xxxxx --server https://api.model-mesh.netOr, on a server that can reach the portal but can't launch a browser, print the URL and complete the flow on another machine:
meshcode login --no-browserUse
MeshCode (standalone agent)
meshcode # start the REPL
meshcode "summarize this codebase" # one-shot prompt, then REPLMeshGuard (proxy in front of existing tools)
meshcode wrap spawns the tool you name with ANTHROPIC_BASE_URL pointed at a local proxy. From the tool's perspective, nothing changed — it's still talking to Anthropic. Underneath, every prompt is routed through ModelMesh.
# Run Claude Code with every prompt routed through ModelMesh.
meshcode wrap claude
# Same idea, but launch a subshell so any tool you run inside it (claude,
# cline, scripts) is automatically routed.
meshcode shell
exit # closes the subshell and the proxyWhat you'll see:
[meshguard] proxy http://127.0.0.1:54213 → https://api.model-mesh.net (source=claude-code, family=anthropic)
[meshguard] launching: claude
╭─ Claude Code ───────────────────────────────────╮
│ │
│ Welcome to Claude Code... │By default, MeshGuard runs in honor-tool mode — when Claude Code calls Anthropic, ModelMesh only picks Anthropic-family models (Haiku/Sonnet/Opus) from your routing pool. DLP, audit, and budgets still apply on every prompt. Switch the endpoint's routing_policy to optimize in the admin portal if you want the full multi-vendor cost optimization.
Built-in tools
| Tool | Destructive | Description |
|--------|:-:|---|
| Read | no | Read a file with line numbers |
| Write | yes | Create or overwrite a file |
| Edit | yes | Exact-string find-and-replace |
| Bash | yes | Run shell commands (120s timeout, 100KB output cap) |
| Glob | no | Find files by pattern (uses fast-glob) |
| Grep | no | Search file contents (uses ripgrep) |
Destructive tools prompt for permission on first use; you can allow once, allow for the session, or deny.
Slash commands
/help — list commands
/login — sign in (opens browser; switch accounts mid-session)
/logout — sign out and exit
/clear — wipe conversation history (keeps system prompt)
/mode <name> — permission mode: default | acceptEdits | bypassPermissions
/exit — quitacceptEdits allows Write and Edit without prompting; bypassPermissions skips all prompts (use with care, e.g. inside a sandboxed container).
Ctrl-C once interrupts the current turn; twice within 2 seconds quits.
What you get from ModelMesh
Every chat completion goes through your ModelMesh deployment. That means:
- Intent routing — your coding prompt may land on a different model than your security-review prompt, based on your routing rules.
- DLP / PII scanning — Presidio + spaCy run on every prompt before it leaves your perimeter.
- Cyber-risk inspection — escalating session-level risk scoring.
- Audit logs — every request, model, token count, cost, and routing decision shows up in your admin portal.
- Budget enforcement — token caps per role are honored.
The CLI surfaces the routing decision on each turn:
routed: claude-sonnet-4-6 · intent: codingArchitecture
meshcode (this CLI)
│
│ POST /v1/chat/completions (Bearer mm_live_...)
│ with tools[] declarations
▼
ModelMesh backend (api.model-mesh.net)
│
├─ Intent classification
├─ Routing rules / health / budget filter
├─ DLP + cyber-risk scan
│
▼
Selected provider (OpenAI / Anthropic / Google / Bedrock / Azure / ...)
│
▼
Streamed back as OpenAI SSE — content deltas + tool_calls deltas
│
▼
meshcode parses tool_calls → executes locally → feeds results backStatus
This is 0.1.0. Working:
- Streaming chat with tool calls
- Read / Write / Edit / Bash / Glob / Grep
- Permission prompts with session/once/deny
- Slash commands
- Conversation history within a session
Coming next:
- Device-flow login (no more pasting keys)
- Sub-agents (delegate a focused task to a fresh context)
/initto bootstrap CLAUDE.md / AGENTS.md style project guides- Plan mode
- MCP server support
- Persistent session resume
License
Proprietary. Internal to ModelMesh.
