---
title: "network"
url: "https://claudemods.dev/zh-cn/builds/network-23e2fb"
source: "https://github.com/gray9199/claude-network-mod"
source_type: "github"
repo: "https://github.com/gray9199/claude-network-mod"
author: "gray9199"
author_handle: "gray9199"
stars: 0
category: "其他"
categories: ["other"]
tags: ["hooks", "matching", "model-calls", "networking", "privacy", "relay"]
permission_level: 3
scan_complete: true
install: "claude plugin marketplace add gray9199/claude-network-mod\nclaude plugin install network@network-mod"
added: "2026-11-15T11:20:49.914Z"
updated: "2026-11-15T11:20:49.915Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# network

一个 Claude Code 模组，让你加入中继：由 haiku 生成的 40 词卡片会描述你的会话内容，并与其他正在处理类似问题的开发者进行匹配。

## Description

用户通过一个 handle 选择加入；每隔几轮，haiku 会读取最近的提示和回答（不是工具输出或文件内容），并写出一张 40 词的公开卡片和标签，卡片会筛查姓名、URL、路径和凭据，并在变更前显示在转录记录中。中继会匹配卡片，并返回最多五个人及匹配原因，该原因也会作为上下文注入，以便 Claude 起草介绍。命令：/network on、/network show、/network off。需要启用函数钩子的 Claude Code >= 2.1.270；捆绑的中继在 Node 上运行且零依赖，支持可选的 bearer-token 认证和 Voyage AI 嵌入，并默认监听 localhost。

## Install

```
claude plugin marketplace add gray9199/claude-network-mod
claude plugin install network@network-mod
```

## Original 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.

```sh
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:

```sh
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:

```sh
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

```sh
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 `HOST` says otherwise. Set `NETWORK_TOKEN` when 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_EMBED` is 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.fetch` and `$.model.complete` can be withheld by an org's admin mod.
- The `$` surface is still moving between releases; re-run `/plugin-types` and `tsc` after updating.
