zhin: Instructions file for GitHub Copilot

.github/instructions/zhin-packages.instructions.md

zhin zhin-packages.instructions.md is an instructions file for GitHub Copilot from zhinjs/zhin. It costs 579 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

Written for GitHub Copilot: a Copilot instructions file.

This is zhinjs/zhin's own configuration. It tells GitHub Copilot how to work on zhin itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zhin configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zhinjs/zhin. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zhinjs/zhin/main/.github/instructions/zhin-packages.instructions.md
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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for zhin zhin-packages.instructions.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/zhinjs/zhin/zhin-packages"><img src="https://agentmods.dev/badge/instructions/zhinjs/zhin/zhin-packages.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 579 This file is loaded in full into every session.
When invoked 579 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00579 $0.00579
Opus 5.5 $0.00232 $0.00232
Sonnet 5.5 $0.00116 $0.00116
Haiku 4.5 $0.00058 $0.00058

Measured 1mo ago against content hash 5dd03a256721, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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 · 47 lines

What it actually says

Zhin 核心包默认开发习惯

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

分层边界

  • 以 docs/concepts/architecture.md 和各包 package.json 为准;运行 pnpm check:architecture 验证。
  • plugin-runtime → feature-kit → Feature packages;im-contract 供 adapter/core/agent 使用;core → zhin,core + ai → agent。
  • kernel 和 ai 不应引入 IM 概念,如 Adapter、Endpoint、Message。

目录语义

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

导入与导出

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

运行时不变量

  • usePlugin() / getPlugin() 已移除;依赖必须通过 setup 的 context.resources、能力执行上下文的 context.use(token) 或当前 operation 的 Generation View 取得。
  • 代级状态走 snapshot Resource;不要新增模块级 latest-value 单例或恢复 createGenerationStore。
  • 如果改动涉及 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/concepts/architecture.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. 1mo ago Changed · +3 lines · +102 tokens per session 5dd03a256721
  2. 2mo 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 (136 stars, last pushed today), licensed MIT. It adds 579 tokens to every session, about $0.0023 per session on Opus 5.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.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,461 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,261 tokens