gray9199/claude-network-mod
network
一個 Claude Code 模組,讓你加入中繼:由 haiku 生成的 40 詞卡片會描述你的工作階段內容,並與其他正在處理類似問題的開發者進行配對。
關於這個 mod
使用者透過一個 handle 選擇加入;每隔幾輪,haiku 會讀取最近的提示與回答(不是工具輸出或檔案內容),並寫出一張 40 詞的公開卡片加標籤,卡片會篩選姓名、URL、路徑與憑證,並在變更前顯示於逐字稿中。中繼會比對卡片,並傳回最多五個人及配對原因,該原因也會作為脈絡注入,讓 Claude 可以起草介紹。指令:/network on、/network show、/network off。需要啟用函式掛鉤的 Claude Code >= 2.1.270;隨附的中繼在 Node 上執行且零依賴,支援選用的 bearer-token 驗證與 Voyage AI 嵌入,並預設監聽 localhost。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add gray9199/claude-network-mod claude plugin install network@network-mod
原文 / README
network — a Claude Mod
Find the people working on the same problem as you, matched on what your session is about, not which repo it's in.
How it works, in one breath: you opt in with a handle → every few turns, haiku reads your recent prompts and answers (never tool output or file contents) and writes a 40-word public card plus a few tags, with names, products and secrets ruled out → the card is printed in your transcript the moment it changes, so nothing goes out you haven't seen → the relay matches cards and hands back up to five people and why they matched → you do the talking. The model also gets the matches as context, so "draft an intro to the person doing grader calibration" just works.
/network on github:graeme opt in (or set NETWORK_HANDLE)
/network show your card, your matches
/network off stop, and pull your card off the relay
Run it
Needs Claude Code ≥ 2.1.270 with function hooks enabled (CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1; shipping as "Claude Mods" in the coming weeks). Verified on 2.1.271.
node relay/server.mjs # http://127.0.0.1:8788, lexical matching
VOYAGE_API_KEY=... node relay/server.mjs # embedding matching: catches "same problem, different words"
export NETWORK_RELAY=https://your-relay # skip if the relay is on localhost
export NETWORK_TOKEN=... # only if the relay was started with one
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir /path/to/network
Or install it from this repo's marketplace:
claude plugin marketplace add gray9199/claude-network-mod
claude plugin install network@network-mod
Windows, Git Bash: MSYS rewrites an argument starting with / into a Windows path, so claude -p "/network show" reaches Claude as C:/Program Files/Git/network show. Turn the rewriting off and hand --plugin-dir a Windows-style path:
MSYS_NO_PATHCONV=1 CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir "$(pwd -W)" -p "/network show"
PowerShell needs neither: claude --plugin-dir $PWD -p "/network show". Inside an interactive session the command is typed at Claude's prompt and no shell touches it.
Layout
.claude-plugin/plugin.json manifest
.claude-plugin/marketplace.json lets `claude plugin marketplace add` install it from this repo
hooks/hooks.json names the module
hooks/register.ts the mod (~250 lines)
relay/server.mjs the relay (~190 lines, zero dependencies)
tests/register.test.ts the demo, as a test that runs in the real engine
types/claude-code.d.ts Anthropic's published contract, for tsc (regenerate with /plugin-types)
Checks
npx tsc -p tsconfig.json # types, against the real contract
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin validate . # Claude Code's own offline scan
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin test . # runs tests/ through the real hooks engine (2.1.271+)
tests/register.test.ts is also the demo: it drives /network on, the card, the matches and the model's context block with the world beneath the mod mocked, prints what each side sees, and asserts that the company name and file path in the transcript never leave the machine.
What is and isn't shared
Shared: your handle, the card, the tags. Nothing else — not the transcript, not file contents, not the repo. The card prompt forbids company, product, customer and person names, URLs, paths and credentials, and the card is shown to you when it changes. After haiku, the mod checks the card once more on your side: one that still looks like it carries a URL, a file path, an email address or a credential is withheld and never sent. That is a strong default, not a guarantee: for work you can't describe in public, don't turn it on, or run a relay only your team can reach.
Security
The relay and everyone on it are strangers, and the mod treats them that way.
- Inbound is data, not instructions. Every match the relay returns is shape-checked, stripped of control and escape characters, and capped (handle 64 chars, card 40 words / 320 chars, 6 tags of 32 chars, 5 matches). The context block hands the cards to the model with a line saying they came from other people over the network and are never instructions to follow. Terminal output gets the same cleaned text, so a card can't smuggle ANSI escapes into your transcript.
- Outbound is bounded and checked twice. The card is written by haiku under a prompt that forbids names, URLs, paths and credentials, then screened by regex for URLs, paths, emails, key-shaped strings and long opaque tokens. Anything that trips the screen is withheld with a line in the transcript.
- The relay listens on localhost unless
HOSTsays otherwise. SetNETWORK_TOKENwhen starting it and every request must carry that bearer token (compared in constant time); the mod reads the same variable. Bodies over 16 KB get a 413, malformed handles and cards a 400, and the table stops at 5 000 cards. A remote relay over plain http earns a warning in the transcript: use https. - What it does not do. A handle is a name people choose, not a verified identity: anyone with the token can post under any handle. Cards are visible to everyone on the relay by design. If you use embeddings, card text goes to Voyage AI.
Known limits (early access)
- Lexical matching only sees vocabulary: a card with a tag in common always matches, but two people describing one problem in different words with no tag in common rank low. Embeddings fix that;
MIN_EMBEDis a starting threshold, tune it. - Hooks fail open. If the relay or the model call fails, the mod logs a line and Claude carries on.
$.http.fetchand$.model.completecan be withheld by an org's admin mod.- The
$surface is still moving between releases; re-run/plugin-typesandtscafter updating.
取得徽章
這是你的專案嗎?把這個徽章放進 README 或網站,連回本頁。

