Repository navigation
Commit 8b7cd94
committed
Add mcode-trajectory-studio: read-only session trajectory inspection
A read-only flight recorder for local MiniMax Code sessions, backed by the
runtime's own SQLite projection: seven MCP tools plus one Skill for analysis, and
a local interactive Studio panel for reading a session by eye.
What it answers, without opening a single session file: turns and steps, LLM and
tool wall-clock time, decode time, token and context breakdown, tool arguments and
results, which calls failed and why, when compaction ran, and which sub-agents
were dispatched. Time-to-first-token is reported as unavailable rather than
estimated, because the runtime does not persist it.
Package layout — the same shape the rest of this repository uses:
plugin.json portable Agent Plugins registry manifest
.claude-plugin/plugin.json mcode 0.4.0+ layout (Skill path + MCP server)
mcp.json stdio MCP descriptor
skills/mcode-trajectory-studio/SKILL.md exactly one Skill
README.md / README.zh-CN.md / LICENSE Apache-2.0
Platforms: verified on Linux (x86_64, Node.js 24.19.0, mcode 0.4.12) with the full
test suite, the MCP handshake and the Studio panel, and verified again by
installing and running the Plugin by hand on macOS and Windows. No platform-specific
handling is needed: paths go through node:path, the home directory resolves from
HOME or USERPROFILE, git is invoked with execFile and an argument array rather than
a shell, and the SQLite driver is Node's built-in node:sqlite. Node 22+ is required
on every platform.
Paths are resolved, never assumed. The data directory comes from MINIMAX_DATA_DIR or
MAVIS_DATA_DIR, then the platform's home variable, so nothing is tied to one
machine. Inside it the canonical layout (v2/sqlite/runtime-state.sqlite,
v2/sessions) is tried first, then a short list of alternatives, and a hit outside
the canonical layout is reported as a warning instead of passing silently;
--doctor prints the path actually opened. A test sweeps every shipped file for a
hardcoded machine path and fails on one.
Runtime and data behavior: opens the projection strictly read-only (mode=ro) and
never writes, moves or deletes session storage; falls back to the session's own
messages.jsonl when the projection is missing. No network access at runtime, no
telemetry, no credentials, no installers and no native binaries. git is optional
and only groups a project's worktrees.
Structure: no god files and no import cycles. The server is layered
(config/json/sqlite/fsutil -> redact/git -> sessions/stats/tasks/events/search/
jsonl -> store facade -> mcp/http/main) with domain modules taking the Store
facade as their first argument, so the layer graph stays a DAG. The client is ES
modules under web/js/, where surfaces announce intents on a leaf bus instead of
importing the actions, so its graph is acyclic too — both properties are enforced
by tests.
Hardening: the panel binds 127.0.0.1 only and fences every API call with an
authority check, an origin check and a required custom header; static assets ship a
deny-by-default CSP and nosniff. summary detail returns no message text, tool
arguments or results; full detail is opt-in and passes through a secret redactor.
Client-facing errors are fixed codes from a closed set — an unexpected error's
message goes to stderr, and no request-derived value is reflected back.
Tests: 51 Plugin tests and the repository suite (408 tests) via `npm run check`,
covering the SQLite reads, the JSONL fallback, git grouping with a real worktree
merge, input provenance, the tool-call/task join, the agent-definition lookup,
redaction, the MCP protocol surface, client formatting, the panel's request fences
and error contract, path portability, and the package declarations. The panel was
also driven end to end in a real browser with zero console messages, and an MCP
handshake returns protocol 2025-06-18 with live tool output.1 parent 1ef5e78 commit 8b7cd94
53 files changed
Lines changed: 8207 additions & 0 deletions
File tree
- plugins/weekbin/mcode-trajectory-studio
- .claude-plugin
- server
- skills/mcode-trajectory-studio
- test
- web
- js
- tests/plugins/mcode-trajectory-studio
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
0 commit comments