zhin zhin-packages.instructions.md

zhin zhin-packages.instructions.md is an instructions file for GitHub Copilot from zhinjs/zhin. It costs 477 tokens per session, scanned A, original, MIT.

A set of development rules for the core Zhin.js packages. It explains package layers, source directories, import and export conventions, message delivery rules, and recommended checks.

In plain words
What is it for?
Use it when editing Zhin.js core, kernel, AI, agent, or application packages, especially for changes involving exports, message sending, plugin context, or cross-package types.
Why use it?
It prevents changes from crossing package boundaries incorrectly or bypassing runtime rules that other parts of Zhin.js depend on.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/zhinjs/zhin/zhin-packages
Clone the repo
git clone --depth 1 https://github.com/zhinjs/zhin

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for zhin zhin-packages.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zhinjs/zhin/zhin-packages.svg)](https://agentmods.dev/instructions/zhinjs/zhin/zhin-packages)
Your own site
<a href="https://agentmods.dev/instructions/zhinjs/zhin/zhin-packages"><img src="https://agentmods.dev/badge/instructions/zhinjs/zhin/zhin-packages.svg" alt="Measured on agentmods" height="20"></a>
Per session 477 This file is loaded in full into every session.
When invoked 477 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00477 $0.00477
Opus 5 $0.00238 $0.00238
Sonnet 5 $0.00095 $0.00095
Haiku 4.5 $0.00048 $0.00048

Measured 5d ago against content hash 14ff214b525a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

zhin zhin-packages.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/instructions/zhin-packages.instructions.md · 44 lines

What it actually says

Zhin 核心包默认开发习惯

在 basic 和 packages 目录下编辑代码时自动生效。

分层边界

  • 依赖方向保持单向:basic → kernel → ai → core → agent → zhin。
  • kernel 和 ai 不应引入 IM 概念,如 Adapter、Bot、Message。

目录语义

  • Node 侧源码放 src/,构建产物放 lib/。
  • 浏览器侧源码放 client/,构建产物放 dist/。
  • 不要把仅浏览器代码混进 src/,也不要把服务端实现放进 client/。

导入与导出

  • TypeScript 本地导入通常必须带 .js 扩展名。
  • 包的 public surface 应与真实构建产物一致;不要新增指向不存在文件的 exports。
  • 变更聚合导出时,优先检查 packages/im/zhin/src/index.ts 是否需要同步。

运行时不变量

  • 如果改动涉及 Plugin 上下文,usePlugin() 只能在模块顶层调用。
  • 如果改动涉及 IM 出站消息,必须保留统一链路:Message.$reply 或 Adapter.sendMessage → renderSendMessage → before.sendMessage → 平台 Endpoint。
  • 不要新增绕过 before.sendMessage 的发送捷径。

变更落点

  • Plugin、Adapter、Dispatcher、消息链:packages/im/core。
  • AI 引擎、Session、Memory、Compaction、Provider:packages/im/ai。
  • AI 编排、工具发现、安全策略、MCP client:packages/im/agent。
  • 应用入口与聚合 re-export:packages/im/zhin。
  • 底层通用能力:basic/* 和 packages/im/kernel。

验证习惯

  • 优先运行最小范围验证:pnpm --filter build、pnpm --filter test。
  • 跨包类型改动再运行 pnpm type-check。
  • 如果改动影响架构边界、目录约定或包导出,检查 docs/architecture-overview.md 和 docs/contributing/repo-structure.md 是否需要同步。
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 44 lines · 477 tokens per session scan A 14ff214b525a

Subscribe to this mod's changes

zhin zhin-packages.instructions.md is an instructions file published in the GitHub repository zhinjs/zhin (135 stars, last pushed yesterday), licensed MIT. It adds 477 tokens to every session, about $0.0024 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.