@misaka-net/misakanet-setup 0.5.5 → 0.6.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 +74 -7
- package/bin/misakanet-setup.mjs +820 -103
- package/hook/checkpoint_reminder.mjs +94 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# @misaka-net/misakanet-setup
|
|
2
2
|
|
|
3
|
-
One command to teach your **Claude Code**, **Codex**, **Hermes**, **OpenClaw
|
|
4
|
-
|
|
5
|
-
lessons
|
|
3
|
+
One command to teach your **Claude Code**, **Codex**, **Hermes**, **OpenClaw**, **codewhale**,
|
|
4
|
+
**Cursor**, **Gemini CLI**, **Copilot CLI**, **OpenCode** or **Kiro** to
|
|
5
|
+
check MisakaNet's failure lessons before repeating a mistake — and to write up the reusable lessons
|
|
6
|
+
this session produced, at a checkpoint.
|
|
7
|
+
|
|
8
|
+
**What it writes:** an MCP endpoint into each agent config, rules blocks for the clients that take
|
|
9
|
+
one, and a local hook for Claude Code. **What leaves this machine:** at most one anonymous request
|
|
10
|
+
while the installer runs; afterwards, only what the agent itself sends — with one opt-in exception:
|
|
11
|
+
`MISAKANET_HOOK_FETCH=1` (off by default) makes the hook itself send the failed call's error text
|
|
12
|
+
(or the command, when the tool gave no error text) as a search query.
|
|
6
13
|
|
|
7
14
|
```bash
|
|
8
15
|
npx @misaka-net/misakanet-setup
|
|
@@ -16,19 +23,54 @@ knowledge base on its own instead of guessing.
|
|
|
16
23
|
|
|
17
24
|
| # | Goal | Mechanism |
|
|
18
25
|
|---|---|---|
|
|
19
|
-
| 1 | the agent **can** call it | MCP server `https://misakanet.org/mcp` (streamable HTTP) in `~/.claude.json`, `~/.codex/config.toml` and `~/.openclaw/openclaw.json` (`mcp.servers.misakanet`), with the Bearer token
|
|
20
|
-
|
|
26
|
+
| 1 | the agent **can** call it | MCP server `https://misakanet.org/mcp` (streamable HTTP) in `~/.claude.json`, `~/.codex/config.toml` and `~/.openclaw/openclaw.json` (`mcp.servers.misakanet`), with the Bearer token when registration succeeds — reads need no token (anonymous reads are unmetered since 2026-09-18); the token is what opens the **write** path. Every entry also carries the self-declared context hints `X-MisakaNet-Client` / `-Agent` / `-Os` / `-Version`, which the endpoint records on the read's analytics row and never treats as identity (`codewhale` is the one exception: its server entry has no custom-header field). Hermes is the same thing in its own files: `mcp_servers.misakanet` in `~/.hermes/config.yaml` plus the token in `~/.hermes/.env` under `MCP_MISAKANET_API_KEY`. Five clients take the same idea in one file each, and **each file uses its own key path and URL field** — they are not interchangeable, and a copied entry with the wrong key fails silently (no error, the server simply never appears):
|
|
27
|
+
|
|
28
|
+
| client | file | container | URL field |
|
|
29
|
+
|---|---|---|---|
|
|
30
|
+
| Cursor | `~/.cursor/mcp.json` | `mcpServers` | `url` |
|
|
31
|
+
| Gemini CLI | `~/.gemini/settings.json` | `mcpServers` | **`httpUrl`** (its `url` means SSE) |
|
|
32
|
+
| Copilot CLI | `~/.copilot/mcp-config.json` | `mcpServers` | `url`, with `type: "http"` |
|
|
33
|
+
| OpenCode | `~/.config/opencode/opencode.json` | **`mcp`** | `url`, with `type: "remote"` |
|
|
34
|
+
| Kiro | `~/.kiro/settings/mcp.json` | `mcpServers` | `url` |
|
|
35
|
+
|
|
36
|
+
All of them are config files written file-to-file — no subprocess is spawned, so **no token ever appears in a command line**. For Claude Code only, the five **read-only** tools are also added to `permissions.allow` — "can call it" otherwise still means a permission prompt on the very first search, so `0.5.3` pre-allows them (`--verify` reports it, `--report` prints `permissions:`); `write_lesson` is deliberately **not** pre-allowed, because a tool that writes should ask |
|
|
37
|
+
| 2 | the agent **knows when** | rules block appended to `~/.claude/CLAUDE.md` / `~/.codex/AGENTS.md` / `~/.hermes/SOUL.md` / `~/.openclaw/workspace/AGENTS.md`. **The five JSON-file clients are the exception: they get none**, because their rules are project-scoped (`.cursor/rules/*.mdc`, `GEMINI.md`, `.github/copilot-instructions.md`, `AGENTS.md`, `.kiro/steering/*.md`) and the installer cannot know where your projects live — the install output says so, with the project-side action for each client, instead of implying behaviour changed (issue, retry, risky-operation triggers; desensitisation rules). Wording is **imperative first** ("必须先调 misakanet_search") rather than descriptive, because a field test showed a weaker model reads a descriptive block as background and never calls the tool |
|
|
21
38
|
| 4 | *(opt-in)* you **hear** it | `--voice` adds a `PostToolUse` hook that plays the cue the server asked for (`lesson-found` / `failure-warning` / `connect-success` / `pair-success`). Off by default; mute with `MISAKANET_VOICE=0`; see `docs/integrations/mcp-voice-hooks.md` |
|
|
22
|
-
| 3 | the checkpoint **fires** | a hook that counts user turns: turn 1 announces the install to the user, turn 20 (and every 10 after) injects the "
|
|
39
|
+
| 3 | the checkpoint **fires** | a hook that counts user turns: turn 1 announces the install to the user, turn 20 (and every 10 after) injects the "write up the reusable lessons and submit them" reminder — the agent does that writing and that submitting, by hand, and the hook itself sends nothing by default; a failed tool call injects a "search before you retry" reminder built from the error text, and only with `MISAKANET_HOOK_FETCH=1` (off by default) does the hook itself send that error text as a search query. Claude Code only today — Codex's user-level hook shape is unconfirmed and OpenClaw's events are unverified, so those two work from the rules block, and `--verify` says so per target instead of implying otherwise |
|
|
23
40
|
|
|
24
41
|
Without (3) a rule saying "summarise every 20 turns" never fires — agents do not keep
|
|
25
42
|
counters. Without (1)/(2) the hook has nothing to call.
|
|
26
43
|
|
|
44
|
+
### dsh is not a file target — it is a plugin
|
|
45
|
+
|
|
46
|
+
dsh takes its MCP servers from a **plugin bundle**, not from a JSON file. Its instruction files are a
|
|
47
|
+
chain: **`$DSH_HOME/AGENTS.md`** (user-global, default `~/.dsh/AGENTS.md`, applies to every session)
|
|
48
|
+
first, then the project's `AGENTS.md`/`CLAUDE.md` from the project root down to the working directory
|
|
49
|
+
(`@deepseek-ai/dsh-agent-instructions`, byte-budgeted at 65,536 by default). It has no Claude-Code-style
|
|
50
|
+
hooks. So the two commands are:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
dsh plugin --profile web add misakanet # ① the tools (mcp__misakanet__*)
|
|
54
|
+
# ② put the rules block in ~/.dsh/AGENTS.md (global) or the project's AGENTS.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Measured 2026-10-17: writing `~/.dsh/AGENTS.md` is picked up as `user-global` instructions on the next
|
|
58
|
+
message, with no restart.
|
|
59
|
+
|
|
60
|
+
Measured 2026-10-17: installing the current `misakanet` takes ~1s into `~/.dsh/profiles/web`; the plugin's
|
|
61
|
+
`index.js` mounts the MCP client and `lib/client.js` is the web panel — **neither injects a rule**,
|
|
62
|
+
which is why ② is a separate, manual step. Full guide: `docs/integrations/dsh.md`.
|
|
63
|
+
|
|
27
64
|
## Flags
|
|
28
65
|
|
|
29
66
|
```bash
|
|
30
67
|
npx @misaka-net/misakanet-setup --dry-run # show what would change, write nothing
|
|
31
68
|
npx @misaka-net/misakanet-setup --verify # READY / NOT READY, installed version, and the fix for each gap
|
|
69
|
+
# two sections, two questions: 端点/可用性 (can you use it — the
|
|
70
|
+
# endpoint answers) and 安装完整性 (are the files we prefer
|
|
71
|
+
# written); one failing does not condemn the other, and a file
|
|
72
|
+
# we cannot write says 装不了 with its cause — not 没装 with
|
|
73
|
+
# the one fix that cannot work ("re-run the installer")
|
|
32
74
|
npx @misaka-net/misakanet-setup --only claude # one agent only
|
|
33
75
|
npx @misaka-net/misakanet-setup --no-register # read-only, no anonymous token
|
|
34
76
|
npx @misaka-net/misakanet-setup --upgrade # same as installing the latest (the command is idempotent)
|
|
@@ -98,6 +140,10 @@ GPO / Intune / Jamf / Ansible snippets, and the section an IT security review ac
|
|
|
98
140
|
`--no-register` avoids registration entirely):
|
|
99
141
|
[`docs/maintainer/enterprise-deployment.md`](https://github.com/Ikalus1988/MisakaNet/blob/main/docs/maintainer/enterprise-deployment.md).
|
|
100
142
|
|
|
143
|
+
A reviewer-facing landing page — the same boundary questions, plus an explicit list of what does
|
|
144
|
+
**not** exist yet (no compliance certifications, no organisation-level audit export, no self-hosted
|
|
145
|
+
form of the hosted endpoint): <https://misakanet.org/enterprise/>.
|
|
146
|
+
|
|
101
147
|
The short version for a deployment script — two commands, both silent:
|
|
102
148
|
|
|
103
149
|
```bash
|
|
@@ -153,9 +199,30 @@ npx @misaka-net/misakanet-setup@latest
|
|
|
153
199
|
## Offline / restricted networks
|
|
154
200
|
|
|
155
201
|
The hook ships inside the npm tarball, so installing needs no download beyond npm itself.
|
|
156
|
-
Registration is best-effort: without it you keep the anonymous read path (
|
|
202
|
+
Registration is best-effort: without it you keep the anonymous read path (unmetered since 2026-09-18; only a per-address burst window applies)
|
|
157
203
|
and the installer says so in plain words.
|
|
158
204
|
|
|
205
|
+
**Behind a corporate proxy, read the probe line before believing it.** `--verify` probes the
|
|
206
|
+
endpoint with Node's `fetch`, and Node ignores `HTTP_PROXY` / `HTTPS_PROXY` unless the runtime is
|
|
207
|
+
told to use them — `NODE_USE_ENV_PROXY=1` or `--use-env-proxy`, with `fetch` support in Node
|
|
208
|
+
≥ 22.21.0 / 24.0.0 ([Node docs](https://nodejs.org/learn/http/enterprise-network-configuration)).
|
|
209
|
+
On a proxy machine the probe can therefore fail while your agent reaches the endpoint fine. The
|
|
210
|
+
report now says which of the two it is:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
NODE_USE_ENV_PROXY=1 npx @misaka-net/misakanet-setup --verify # let Node use the proxy
|
|
214
|
+
curl -sS https://misakanet.org/mcp -H 'Accept: application/json' \
|
|
215
|
+
-H 'MCP-Protocol-Version: 2025-06-18' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`endpoint-probe: inconclusive-proxy` in `--report` means exactly this: a proxy is configured, this
|
|
219
|
+
process could not use it, so the `endpoint-reachable` boolean above it says nothing. `--strict` /
|
|
220
|
+
`--ci` still fail in that case — a gate that cannot tell must not pass silently. If your proxy also
|
|
221
|
+
intercepts TLS, add `NODE_USE_SYSTEM_CA=1`.
|
|
222
|
+
|
|
223
|
+
The Python installer (`integrations/agent-autostart/install_misakanet_agent.py`) needs none of this:
|
|
224
|
+
it uses `urllib`, which honours the proxy environment variables by default.
|
|
225
|
+
|
|
159
226
|
## Requires
|
|
160
227
|
|
|
161
228
|
Node 18+ (the same runtime your assistant already uses). No dependencies, no Python.
|