@rynfar/meridian 1.35.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -18
- package/dist/{cli-g9ypdz51.js → cli-pr79d7nw.js} +9 -5
- package/dist/{cli-0kfa6j99.js → cli-ygx1djsx.js} +575 -21
- package/dist/cli.js +2 -2
- package/dist/{profilePage-e90fq8ye.js → profilePage-g5t5t6av.js} +3 -1
- package/dist/proxy/adapter.d.ts +17 -0
- package/dist/proxy/adapter.d.ts.map +1 -1
- package/dist/proxy/adapters/crush.d.ts.map +1 -1
- package/dist/proxy/auth.d.ts +27 -0
- package/dist/proxy/auth.d.ts.map +1 -0
- package/dist/proxy/errors.d.ts +1 -1
- package/dist/proxy/errors.d.ts.map +1 -1
- package/dist/proxy/query.d.ts +21 -1
- package/dist/proxy/query.d.ts.map +1 -1
- package/dist/proxy/sdkFeatures.d.ts +56 -0
- package/dist/proxy/sdkFeatures.d.ts.map +1 -0
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/server.js +2 -2
- package/dist/telemetry/profileBar.d.ts +1 -1
- package/dist/telemetry/profileBar.d.ts.map +1 -1
- package/dist/telemetry/settingsPage.d.ts +6 -0
- package/dist/telemetry/settingsPage.d.ts.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,18 +23,7 @@ Meridian bridges the Claude Code SDK to the standard Anthropic API. No OAuth int
|
|
|
23
23
|
>
|
|
24
24
|
> What Meridian adds is a **presentation and interoperability layer**. We translate Claude Code's output into the standard Anthropic API format so developers can connect the editors, terminals, and workflows they prefer. The SDK does the work; Meridian formats the result.
|
|
25
25
|
>
|
|
26
|
-
>
|
|
27
|
-
|
|
28
|
-
> [!WARNING]
|
|
29
|
-
> ### Why Meridian does not support OpenClaw
|
|
30
|
-
>
|
|
31
|
-
> There is technically a way to make Meridian work with OpenClaw, but we're not interested in pursuing it.
|
|
32
|
-
>
|
|
33
|
-
> The reason Claude Max offers generous usage limits is because Anthropic can justify it through Claude Code — their harness, their optimizations, their control. OpenClaw blows through that with autonomous workflows that Anthropic has little ability to manage or optimize. Using Opus to check an email when a local model would handle it fine isn't efficient use — it's waste that degrades the plan for everyone.
|
|
34
|
-
>
|
|
35
|
-
> I built Meridian because I believe developers should have the right to use the frontend of their choice. But that right comes with a responsibility: don't wreck the subscription for the rest of us. Sloppy autonomous agents that burn through Claude Max tokens are directly counter-productive to developers like me who depend on the plan being sustainable.
|
|
36
|
-
>
|
|
37
|
-
> Meridian's philosophy is simple — play nice with the SDK, let Anthropic optimize how they see fit, and use the frontend you want within the constraints of Claude Code. OpenClaw is not just a frontend; it's an autonomous system that abuses the Max plan. We won't be supporting it.
|
|
26
|
+
> **Our philosophy is simple: work within the SDK's constraints, not around them.** The generous limits on Claude Max exist because Anthropic can optimize and manage usage through Claude Code. Meridian respects that by building only on the tools Anthropic provides — no shortcuts, no workarounds that create friction. We believe this is how developers keep the freedom to choose their own frontends while keeping the platform sustainable for everyone.
|
|
38
27
|
|
|
39
28
|
## Quick Start
|
|
40
29
|
|
|
@@ -83,6 +72,66 @@ The Claude Code SDK provides programmatic access to Claude. But your favorite co
|
|
|
83
72
|
- **Telemetry dashboard** — real-time performance metrics at `/telemetry`, including token usage and prompt cache efficiency ([`MONITORING.md`](MONITORING.md))
|
|
84
73
|
- **Telemetry persistence** — opt-in SQLite storage for telemetry data that survives proxy restarts, with configurable retention
|
|
85
74
|
- **Prometheus metrics** — `GET /metrics` endpoint for scraping request counters and duration histograms
|
|
75
|
+
- **SDK feature toggles** *(experimental)* — unlock Claude Code features (memory, dreaming, CLAUDE.md) for any connected agent
|
|
76
|
+
|
|
77
|
+
## SDK Feature Toggles (Experimental)
|
|
78
|
+
|
|
79
|
+
Meridian can expose Claude Code features to any connected agent. Capabilities like auto-memory, dreaming, and CLAUDE.md — normally exclusive to Claude Code — become available to OpenCode, Crush, Droid, and any other harness routed through Meridian. Each agent keeps its own toolchain while gaining access to these additional features.
|
|
80
|
+
|
|
81
|
+
Configure per-adapter at **`/settings`** in the Meridian web UI. Changes take effect on the next request — no restart needed. Config is persisted to `~/.config/meridian/sdk-features.json`.
|
|
82
|
+
|
|
83
|
+
### Available features
|
|
84
|
+
|
|
85
|
+
| Setting | Options | Description |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| **Claude Code Prompt** | on / off | Include the SDK's built-in system prompt (tool usage rules, safety guidelines, coding best practices) |
|
|
88
|
+
| **Client Prompt** | on / off | Include the system prompt sent by the connecting agent (e.g. OpenCode or Crush instructions) |
|
|
89
|
+
| **CLAUDE.md** | off / project / full | Load instruction files — `off`: none, `project`: `./CLAUDE.md` only, `full`: `~/.claude/CLAUDE.md` + `./CLAUDE.md` |
|
|
90
|
+
| **Memory** | on / off | Auto-memory: read and write memories across sessions |
|
|
91
|
+
| **Auto-Dream** | on / off | Background memory consolidation between sessions |
|
|
92
|
+
| **Thinking** | disabled / adaptive / enabled | Extended thinking mode for complex reasoning |
|
|
93
|
+
| **Thinking Passthrough** | on / off | Forward thinking blocks to the client for display |
|
|
94
|
+
| **Shared Memory** | on / off | Share memory directory with Claude Code (`~/.claude`) instead of isolated storage |
|
|
95
|
+
|
|
96
|
+
### System prompts
|
|
97
|
+
|
|
98
|
+
The system prompt controls are independent — any combination works:
|
|
99
|
+
|
|
100
|
+
- **Both enabled** (recommended): Claude Code instructions come first, followed by your agent's specific instructions. This gives Claude the full context it needs for features like memory and tool use to work correctly.
|
|
101
|
+
- **Claude Code only**: Just the base Claude Code prompt without agent-specific instructions.
|
|
102
|
+
- **Client only**: Just your agent's prompt, passed through as a raw string.
|
|
103
|
+
- **Neither**: No system prompt at all — Claude operates with just the user message.
|
|
104
|
+
|
|
105
|
+
> **Note:** For features like memory and dreaming to work well, the Claude Code system prompt should be enabled — it contains the instructions Claude needs to read and write memories correctly.
|
|
106
|
+
|
|
107
|
+
## Passthrough Mode and Tool Calling
|
|
108
|
+
|
|
109
|
+
The core question is **who executes the tools** — the SDK or the client?
|
|
110
|
+
|
|
111
|
+
- **Passthrough mode** (default for OpenCode) — Claude generates tool calls, but Meridian captures them and sends them back to the client for execution. The client runs the tool using its own implementation, with its own sandboxing, file tracking, and UI, then sends the result in the next request. This is how OpenCode, oh-my-opencagent (OMO), and most coding agents work — they have their own read/write/bash tools and need to stay in control of what runs on the user's machine.
|
|
112
|
+
- **Internal mode** — Claude Code handles everything. The SDK executes tools directly on the host, runs its full agent loop, and returns the final result. This is for clients that are purely chat interfaces (Open WebUI, simple API consumers) with no tool execution of their own.
|
|
113
|
+
|
|
114
|
+
Most users don't need to configure anything — the adapter sets the right mode automatically. To override:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
MERIDIAN_PASSTHROUGH=1 meridian # force passthrough
|
|
118
|
+
MERIDIAN_PASSTHROUGH=0 meridian # force internal
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### How tool calling works in passthrough
|
|
122
|
+
|
|
123
|
+
1. The client sends a request with tool definitions (read, write, edit, bash, glob, grep)
|
|
124
|
+
2. Meridian registers these as MCP tools so the SDK can generate proper `tool_use` blocks
|
|
125
|
+
3. The SDK produces a tool call → Meridian captures it and returns it to the client
|
|
126
|
+
4. The client executes the tool locally and sends the result back
|
|
127
|
+
|
|
128
|
+
For large tool sets (>15 tools), non-core tools are automatically deferred via the SDK's ToolSearch mechanism. Core tools (read, write, edit, bash, glob, grep) are always loaded eagerly. The deferral threshold is configurable with `MERIDIAN_DEFER_TOOL_THRESHOLD`.
|
|
129
|
+
|
|
130
|
+
### Known limitations
|
|
131
|
+
|
|
132
|
+
- **Single tool round-trip per request** — in passthrough mode, the SDK is configured with `maxTurns=2` (or 3 for deferred tools). Multi-step agentic loops where Claude needs several consecutive tool calls require the client to re-send after each round.
|
|
133
|
+
- **Blocked tools** — 13 built-in SDK tools (Read, Write, Bash, etc.) are blocked to prevent conflicts with the client's own tools. 15 additional Claude Code-only tools (CronCreate, EnterWorktree, Agent, etc.) are blocked because they require capabilities that external clients don't support.
|
|
134
|
+
- **Subagent extraction** — Meridian parses the client's Task tool description to extract subagent names and build SDK AgentDefinitions. If the client's agent framework uses a non-standard format, subagent routing may not work automatically.
|
|
86
135
|
|
|
87
136
|
## Multi-Profile Support
|
|
88
137
|
|
|
@@ -158,7 +207,7 @@ meridian setup
|
|
|
158
207
|
This adds the Meridian plugin to your OpenCode global config (`~/.config/opencode/opencode.json`). The plugin enables:
|
|
159
208
|
|
|
160
209
|
- **Session tracking** — reliable conversation continuity across requests
|
|
161
|
-
- **Safe model defaults** — Opus uses 1M context (included with Max subscription); Sonnet uses 200k to avoid Extra Usage charges ([details](#
|
|
210
|
+
- **Safe model defaults** — Opus uses 1M context (included with Max subscription); Sonnet uses 200k to avoid Extra Usage charges ([details](#configuration))
|
|
162
211
|
- **Subagent model selection** — subagents automatically use `sonnet`/`opus` (200k), preserving rate-limit budget
|
|
163
212
|
|
|
164
213
|
If the plugin is missing, Meridian warns at startup and reports `"plugin": "not-configured"` in the health endpoint.
|
|
@@ -176,6 +225,14 @@ export ANTHROPIC_API_KEY=x
|
|
|
176
225
|
export ANTHROPIC_BASE_URL=http://127.0.0.1:3456
|
|
177
226
|
```
|
|
178
227
|
|
|
228
|
+
#### oh-my-opencagent (OMO)
|
|
229
|
+
|
|
230
|
+
[oh-my-opencagent](https://github.com/nicobailey/oh-my-opencagent) adds multi-agent orchestration on top of OpenCode. It works transparently through Meridian with no extra configuration — OMO uses the same OpenCode headers and tool format, so Meridian detects it automatically.
|
|
231
|
+
|
|
232
|
+
Meridian parses OMO's Task tool descriptions to extract subagent names (explore, code-review, etc.) and builds SDK AgentDefinitions so Claude can route to the correct agent. Internal orchestration markers (`<!-- OMO_INTERNAL_INITIATOR -->`, `[SYSTEM DIRECTIVE: OH-MY-OPENCODE ...]`) are stripped automatically to prevent context leakage.
|
|
233
|
+
|
|
234
|
+
OMO requires **passthrough mode** (the default for OpenCode) — subagent delegation flows through tool calls that must be forwarded back to the client.
|
|
235
|
+
|
|
179
236
|
### Crush
|
|
180
237
|
|
|
181
238
|
Add a provider to `~/.config/crush/crush.json`:
|
|
@@ -252,7 +309,7 @@ No plugin needed — Cline uses the standard Anthropic SDK.
|
|
|
252
309
|
|
|
253
310
|
```bash
|
|
254
311
|
ANTHROPIC_API_KEY=x ANTHROPIC_BASE_URL=http://127.0.0.1:3456 \
|
|
255
|
-
aider --model anthropic/claude-sonnet-4-
|
|
312
|
+
aider --model anthropic/claude-sonnet-4-6
|
|
256
313
|
```
|
|
257
314
|
|
|
258
315
|
> **Note:** `--no-stream` is incompatible due to a litellm parsing issue — use the default streaming mode.
|
|
@@ -284,7 +341,7 @@ Add a custom provider to `~/forge/.forge.toml`:
|
|
|
284
341
|
id = "meridian"
|
|
285
342
|
url = "http://127.0.0.1:3456/v1/messages"
|
|
286
343
|
models = "http://127.0.0.1:3456/v1/models"
|
|
287
|
-
api_key_vars = "
|
|
344
|
+
api_key_vars = "MERIDIAN_FORGE_KEY"
|
|
288
345
|
response_type = "Anthropic"
|
|
289
346
|
auth_methods = ["api_key"]
|
|
290
347
|
|
|
@@ -293,10 +350,10 @@ provider_id = "meridian"
|
|
|
293
350
|
model_id = "claude-opus-4-6"
|
|
294
351
|
```
|
|
295
352
|
|
|
296
|
-
Set the API key env var
|
|
353
|
+
Set the API key env var. Any value works unless you've enabled authentication with `MERIDIAN_API_KEY`, in which case use your auth key here:
|
|
297
354
|
|
|
298
355
|
```bash
|
|
299
|
-
export
|
|
356
|
+
export MERIDIAN_FORGE_KEY=x
|
|
300
357
|
```
|
|
301
358
|
|
|
302
359
|
Then log in and select the model:
|
|
@@ -413,8 +470,10 @@ Agents are identified from request headers automatically:
|
|
|
413
470
|
| Signal | Adapter |
|
|
414
471
|
|---|---|
|
|
415
472
|
| `x-meridian-agent` header | Explicit override (any adapter) |
|
|
416
|
-
| `
|
|
473
|
+
| `x-opencode-session` or `x-session-affinity` header | OpenCode |
|
|
474
|
+
| `opencode/` User-Agent | OpenCode |
|
|
417
475
|
| `factory-cli/` User-Agent | Droid |
|
|
476
|
+
| `Charm-Crush/` User-Agent | Crush |
|
|
418
477
|
| `litellm/` UA or `x-litellm-*` headers | LiteLLM passthrough |
|
|
419
478
|
| *(anything else)* | `MERIDIAN_DEFAULT_AGENT` env var, or OpenCode |
|
|
420
479
|
|
|
@@ -422,10 +481,30 @@ Agents are identified from request headers automatically:
|
|
|
422
481
|
|
|
423
482
|
Implement the `AgentAdapter` interface in `src/proxy/adapters/`. See [`adapters/opencode.ts`](src/proxy/adapters/opencode.ts) for a reference.
|
|
424
483
|
|
|
484
|
+
## API Key Authentication
|
|
485
|
+
|
|
486
|
+
By default, Meridian binds to `127.0.0.1` and requires no authentication — anyone on localhost can use it. If you expose Meridian over a network (Tailscale, LAN, Docker with port mapping), you can enable API key authentication to prevent unauthorized access.
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
MERIDIAN_API_KEY=your-secret-key meridian
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
When set:
|
|
493
|
+
- All API routes (`/v1/messages`, `/v1/chat/completions`, etc.) and admin routes (`/telemetry`, `/metrics`, `/profiles`) require a matching key
|
|
494
|
+
- `/` and `/health` remain open (monitoring tools need unauthenticated health checks)
|
|
495
|
+
- Keys are accepted via `x-api-key` header or `Authorization: Bearer` header
|
|
496
|
+
|
|
497
|
+
Clients just set their `ANTHROPIC_API_KEY` to the shared secret — since most tools already send this header, no workflow changes are needed:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
ANTHROPIC_API_KEY=your-secret-key ANTHROPIC_BASE_URL=http://meridian-host:3456 opencode
|
|
501
|
+
```
|
|
502
|
+
|
|
425
503
|
## Configuration
|
|
426
504
|
|
|
427
505
|
| Variable | Alias | Default | Description |
|
|
428
506
|
|----------|-------|---------|-------------|
|
|
507
|
+
| `MERIDIAN_API_KEY` | — | unset | Shared secret for API key authentication. When set, all API and admin routes require a matching `x-api-key` or `Authorization: Bearer` header. `/` and `/health` remain open. |
|
|
429
508
|
| `MERIDIAN_PORT` | `CLAUDE_PROXY_PORT` | `3456` | Port to listen on |
|
|
430
509
|
| `MERIDIAN_HOST` | `CLAUDE_PROXY_HOST` | `127.0.0.1` | Host to bind to |
|
|
431
510
|
| `MERIDIAN_PASSTHROUGH` | `CLAUDE_PROXY_PASSTHROUGH` | unset | Forward tool calls to client instead of executing |
|
|
@@ -439,6 +518,7 @@ Implement the `AgentAdapter` interface in `src/proxy/adapters/`. See [`adapters/
|
|
|
439
518
|
| `MERIDIAN_SONNET_MODEL` | `CLAUDE_PROXY_SONNET_MODEL` | `sonnet` | Sonnet context tier: `sonnet` (200k, default) or `sonnet[1m]` (1M, requires Extra Usage†) |
|
|
440
519
|
| `MERIDIAN_DEFAULT_AGENT` | — | `opencode` | Default adapter for unrecognized agents: `opencode`, `forgecode`, `pi`, `crush`, `droid`, `passthrough`. Requires restart. |
|
|
441
520
|
| `MERIDIAN_PROFILES` | — | unset | JSON array of profile configs (overrides disk discovery). See [Multi-Profile Support](#multi-profile-support). |
|
|
521
|
+
| `MERIDIAN_DEFER_TOOL_THRESHOLD` | — | `15` | Number of tools before non-core tools are deferred via ToolSearch. Set to `0` to disable. |
|
|
442
522
|
| `MERIDIAN_TELEMETRY_PERSIST` | — | unset | Enable SQLite telemetry persistence. Data survives proxy restarts. |
|
|
443
523
|
| `MERIDIAN_TELEMETRY_DB` | — | `~/.config/meridian/telemetry.db` | SQLite database path (when persistence is enabled) |
|
|
444
524
|
| `MERIDIAN_TELEMETRY_RETENTION_DAYS` | — | `7` | Days to retain telemetry data before cleanup |
|
|
@@ -471,6 +551,7 @@ Health response example:
|
|
|
471
551
|
```json
|
|
472
552
|
{
|
|
473
553
|
"status": "healthy",
|
|
554
|
+
"version": "1.34.1",
|
|
474
555
|
"auth": { "loggedIn": true, "email": "you@example.com", "subscriptionType": "max" },
|
|
475
556
|
"mode": "internal",
|
|
476
557
|
"plugin": { "opencode": "configured" }
|
|
@@ -509,10 +590,40 @@ await instance.close()
|
|
|
509
590
|
|
|
510
591
|
## Docker
|
|
511
592
|
|
|
593
|
+
Claude Code authentication requires a browser, which isn't available inside containers. Authenticate on your local machine first, then mount the credentials into Docker.
|
|
594
|
+
|
|
595
|
+
### Single account
|
|
596
|
+
|
|
512
597
|
```bash
|
|
598
|
+
# 1. Authenticate locally (one time)
|
|
599
|
+
claude login
|
|
600
|
+
|
|
601
|
+
# 2. Run with mounted credentials
|
|
513
602
|
docker run -v ~/.claude:/home/claude/.claude -p 3456:3456 meridian
|
|
514
603
|
```
|
|
515
604
|
|
|
605
|
+
Meridian refreshes OAuth tokens automatically — once the credentials are mounted, no further browser access is needed.
|
|
606
|
+
|
|
607
|
+
### Multiple profiles in Docker
|
|
608
|
+
|
|
609
|
+
Authenticate each profile locally, then pass them to Docker via the `MERIDIAN_PROFILES` environment variable:
|
|
610
|
+
|
|
611
|
+
```bash
|
|
612
|
+
# 1. Authenticate each account locally
|
|
613
|
+
meridian profile add personal
|
|
614
|
+
meridian profile add work # sign out of claude.ai first, sign into work account
|
|
615
|
+
|
|
616
|
+
# 2. Run Docker with profile configs pointing to mounted credential directories
|
|
617
|
+
docker run \
|
|
618
|
+
-v ~/.config/meridian/profiles/personal:/profiles/personal \
|
|
619
|
+
-v ~/.config/meridian/profiles/work:/profiles/work \
|
|
620
|
+
-e 'MERIDIAN_PROFILES=[{"id":"personal","claudeConfigDir":"/profiles/personal"},{"id":"work","claudeConfigDir":"/profiles/work"}]' \
|
|
621
|
+
-e MERIDIAN_DEFAULT_PROFILE=personal \
|
|
622
|
+
-p 3456:3456 meridian
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
Switch profiles at runtime via the `x-meridian-profile` header or `meridian profile switch` (see [Multi-Profile Support](#multi-profile-support)).
|
|
626
|
+
|
|
516
627
|
## Testing
|
|
517
628
|
|
|
518
629
|
```bash
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./cli-p9swy5t3.js";
|
|
4
|
+
|
|
1
5
|
// src/telemetry/profileBar.ts
|
|
2
6
|
var profileBarCss = `
|
|
3
7
|
.meridian-profile-bar {
|
|
@@ -41,8 +45,7 @@ var profileBarCss = `
|
|
|
41
45
|
}
|
|
42
46
|
.meridian-profile-bar .profile-nav a:hover { color: var(--text, #e6edf3); }
|
|
43
47
|
.meridian-profile-bar .profile-nav a.active { color: var(--accent, #58a6ff); }
|
|
44
|
-
|
|
45
|
-
var profileBarHtml = `
|
|
48
|
+
`, profileBarHtml = `
|
|
46
49
|
<div class="meridian-profile-bar" id="meridianProfileBar">
|
|
47
50
|
<span class="profile-label">Profile</span>
|
|
48
51
|
<select id="meridianProfileSelect"></select>
|
|
@@ -51,12 +54,12 @@ var profileBarHtml = `
|
|
|
51
54
|
<div class="spacer"></div>
|
|
52
55
|
<div class="profile-nav">
|
|
53
56
|
<a href="/" id="nav-home">Home</a>
|
|
57
|
+
<a href="/settings" id="nav-settings">Settings</a>
|
|
54
58
|
<a href="/profiles" id="nav-profiles">Profiles</a>
|
|
55
59
|
<a href="/telemetry" id="nav-telemetry">Telemetry</a>
|
|
56
60
|
</div>
|
|
57
61
|
</div>
|
|
58
|
-
|
|
59
|
-
var profileBarJs = `
|
|
62
|
+
`, profileBarJs = `
|
|
60
63
|
(function() {
|
|
61
64
|
var profileBar = document.getElementById('meridianProfileBar');
|
|
62
65
|
var profileSelect = document.getElementById('meridianProfileSelect');
|
|
@@ -109,5 +112,6 @@ var profileBarJs = `
|
|
|
109
112
|
setInterval(loadProfiles, 10000);
|
|
110
113
|
})();
|
|
111
114
|
`;
|
|
115
|
+
var init_profileBar = () => {};
|
|
112
116
|
|
|
113
|
-
export { profileBarCss, profileBarHtml, profileBarJs };
|
|
117
|
+
export { profileBarCss, profileBarHtml, profileBarJs, init_profileBar };
|