Zhijing (织经)
English | 中文
Formerly XSkill. Zhijing (织经) means "weaving the warp": scattered Skills and Experiences are woven into one shared fabric for every agent. The legacy XSKILL_ROOT environment variable is still honored.
Zero-dependency, two-tier shared knowledge & skill hub for multi-agent workflows — exposed over standard MCP.
Zhijing lets multiple AI coding & research agents (Claude Code, Codex, Cursor, OpenCode, Gemini CLI, etc.) share a single source of truth for Skills (reusable workflows) and Experiences (contextual decision rules) without duplicating files across tools.
Highlights
- Zero third-party dependencies: pure Python 3.10+ standard library.
- Two-tier retrieval:
projects/<project>/ (1.5x priority boost) + global/ fallback.
- Dual skill formats (no symlinks required): natively discovers both single-file entries (
*.md) and folder-based standard Agent Skills (<name>/SKILL.md), safe on Linux, macOS, and Windows.
- Import quality gate:
audit checks path traversal, symlinks, file count/size, read/write permissions, frontmatter types, and destination conflicts. import runs the same checks and skips existing entries unless --overwrite is explicit.
- Read-only MCP Server with path lock:
zhijing_mcp.py exposes zhijing_search (BM25), zhijing_list, and zhijing_read over stdio JSON-RPC 2.0, preventing unintended writes or directory traversal outside ZHIJING_ROOT.
- Dual-repo ready: keep the framework public (
zhijing) while pointing ZHIJING_ROOT or --root to your private knowledge vault (zhijing-vault).
Repository Layout
zhijing/
├── zhijing_core.py # Search, index, and CRUD engine
├── zhijing_mcp.py # Read-only stdio MCP server
├── scripts/
│ └── zhijing_doctor.py # Knowledge base health check
├── global/
│ ├── skills/ # Bundled starter skills (*.md and <name>/SKILL.md)
│ └── experiences/ # Contextual decision rules & lessons learned
├── projects/ # Project-scoped overrides (projects/<name>/{skills,experiences})
├── tests/
│ └── test_zhijing.py # Core & MCP test suite
└── _index.json # Generated index
Bundled Starter Skills (Academic & Engineering)
| Skill |
Format |
Domain |
Purpose |
anti-defensive-writing |
Folder |
Academic |
Eliminate defensive hedging in papers, protocols, and rebuttals |
paper-claim-audit |
Single |
Academic |
Context-free number-by-number audit between manuscript and raw outputs |
citation-integrity-check |
Single |
Academic |
Dual-source DOI/metadata verification, chimera & retraction checks |
claim-safety-gates |
Single |
Academic |
Three hard gates (no fabrication, no unapproved promises, full coverage) |
review-rebuttal |
Single |
Academic |
Structured peer-review triage, evidence binding, and commitment ledger |
figure-creation-standards |
Folder |
Academic |
Journal dimensions, colorblind-safe palettes, vector export, honest encoding |
figure-review-gate |
Single |
Academic |
Post-render PDF figure QA and visual honesty checklist |
minimal-code-ladder |
Single |
Engineering |
Anti-over-engineering ladder with non-negotiable safety boundaries |
code-review-beyond-diff |
Single |
Engineering |
Impact-first code review beyond changed lines + shortcut debt ledger |
Quick Start
1. Install the Engine from PyPI
python3 -m pip install zhijing
export ZHIJING_ROOT=/path/to/zhijing-vault
zhijing stats
The PyPI distribution intentionally contains only the engine and the zhijing / zhijing-mcp commands. Starter Skills and the doctor script remain in the source repository. For an installed engine, always point ZHIJING_ROOT or --root at a writable knowledge base instead of storing entries in site-packages.
2. Run Source Health Check & Tests
python3 scripts/zhijing_doctor.py
python3 -m unittest discover -s tests -v
3. CLI Usage
# Search with a full-sentence task description
python3 zhijing_core.py search "论文里的数字和原始结果文件对不上,怎么逐数字核对"
# Rebuild _index.json after adding or editing entries
python3 zhijing_core.py index
# Inspect counts
python3 zhijing_core.py stats
# Preflight without importing; exits 1 on errors
python3 zhijing_core.py audit /path/to/skill-or-pack
# Import through the same checks; existing entries are skipped
python3 zhijing_core.py import /path/to/skill-or-pack
# Add --overwrite only when replacing existing entries is intended
python3 zhijing_core.py import /path/to/skill-or-pack --overwrite
Tip on querying: Full-sentence task descriptions usually provide more useful terms for weighted BM25 over name / description / tags / body. Short distinctive terms such as RoB and R语言 are also supported.
4. Dual-Repo Setup (Framework + Private Vault)
Keep this repo as your framework, and store your private global/ and projects/ entries in a separate private repository (e.g. zhijing-vault). Point Zhijing at your vault via --root or ZHIJING_ROOT:
export ZHIJING_ROOT=/path/to/zhijing-vault
python3 zhijing_mcp.py
# or explicitly:
python3 zhijing_mcp.py --root /path/to/zhijing-vault
MCP Integration
Point any MCP-compatible client to zhijing_mcp.py (optionally passing --root /path/to/your/vault).
Claude Code
claude mcp add zhijing -s user -- python3 /path/to/zhijing/zhijing_mcp.py --root /path/to/zhijing-vault
Codex CLI (~/.codex/config.toml)
[mcp_servers.zhijing]
command = "python3"
args = ["/path/to/zhijing/zhijing_mcp.py", "--root", "/path/to/zhijing-vault"]
Cursor / Gemini CLI (mcp_config.json)
{
"mcpServers": {
"zhijing": {
"command": "python3",
"args": ["/path/to/zhijing/zhijing_mcp.py", "--root", "/path/to/zhijing-vault"]
}
}
}
OpenCode
opencode mcp add zhijing --global -- python3 /path/to/zhijing/zhijing_mcp.py --root /path/to/zhijing-vault
Writing a New Entry
Every Skill or Experience uses a lightweight YAML frontmatter block:
---
type: skill
name: my-workflow
description: One-sentence description used for retrieval matching.
metadata:
domain: academic
tools: ["read_file", "terminal"]
success_count: 1
tags: ["workflow", "audit"]
author: your-name
created: 2026-11-20
updated: 2026-11-20
---
## Steps
...
Place it at global/skills/my-workflow.md (or global/skills/my-workflow/SKILL.md for folder-based skills with bundled scripts/assets), then run python3 zhijing_core.py index.
License
MIT