linglu-discipline

linglu-discipline is a skill for Claude Code from FuRongJun-1999/dsh-memory. It costs 73 tokens per session (4,466 once invoked), scanned A, original, MIT.

A set of 16 operating rules for an AI coding agent, including when to read or write long-term memory and how to report completed actions. It is designed to work with the Lingshu memory service through an MCP connection.

In plain words
What is it for?
It helps structure task preparation, memory searches, command execution, submissions, root-cause analysis, sensitive-data handling, and publishing work.
Why use it?
It gives the agent a defined procedure for starting tasks, using existing knowledge, recording violations, and showing evidence of what it did.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents; mentions Claude Code; mentions Codex.

Part of the lingshu-memory plugin — 1 skill shipped together

Good fit It helps structure task preparation, memory searches, command execution, submissions, root-cause analysis, sensitive-data handling, and publishing work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/furongjun-1999/dsh-memory/linglu-discipline
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.

Any agent
npx skills add FuRongJun-1999/dsh-memory --skill linglu-discipline
Clone the repo
git clone --depth 1 https://github.com/FuRongJun-1999/dsh-memory

Made for: Claude Code.

Or install lingshu-memory, the plugin that ships this one along with the rest of its 1 skill.

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 linglu-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/furongjun-1999/dsh-memory/linglu-discipline/github.svg)](https://agentmods.dev/skills/furongjun-1999/dsh-memory/linglu-discipline)
Your own site
<a href="https://agentmods.dev/skills/furongjun-1999/dsh-memory/linglu-discipline"><img src="https://agentmods.dev/badge/skills/furongjun-1999/dsh-memory/linglu-discipline/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 linglu-discipline

Your own site · 80×15
<a href="https://agentmods.dev/skills/furongjun-1999/dsh-memory/linglu-discipline"><img src="https://agentmods.dev/badge/skills/furongjun-1999/dsh-memory/linglu-discipline.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,466 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00073 $0.04466
Opus 5.5 $0.00029 $0.01786
Sonnet 5.5 $0.00015 $0.00893
Haiku 4.5 $0.00007 $0.00447

Measured 9d ago against content hash 69b029b8ac61, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

linglu-discipline scanned grade A with 1 finding 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 9d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

动作:构造 argv 列表→subprocess.run(capture_output=True, text=True, encoding='utf-8', errors='replace')→env 带 PYTHONUTF8=1→shell=False;边界判据=本次调用是否产出非UTF-8字节流(纯MSYS工具与不起进程的内置工具豁免;原生Windows程序不豁免,须python包装或显式解码);仓内引用与文档路径一律写相对路径(本
claude/lingshu-memory/skills/linglu-discipline/SKILL.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

你是挂载了灵枢(Lingshu)长期记忆的 Agent。以下工作纪律与 DSH / CodeBuddy / ZCode / Codex / Claude Code 各端同源, 真源 = 灵枢大脑库 docs/工作纪律_认知图条目_v1.1.json(工作纪律_认知图条目_v1.1),共 18 条。 命中「触发」即执行该条「动作」,并在回复中原样输出该条「声明」;未声明视为未执行。

【执行公约】 0.1 会话起始先查记忆:动手前先调认知图入口(MCP server「mdcg」的 cg 工具;op 为必填参数,勿省略)cg(op=route, intent=<任务意图>);命中纪律/知识则按其「动作」执行。 0.2 命中即声明:输出该条 response.direct 原文——这是「已执行」的唯一可观测证据。 0.3 产出即证据:动作栏要求的产出(判定单/检索结果/验证结论/归档节点 id)必须实际给出,缺失即未执行。 0.4 违规即归档:发现违规 → 第 4 条归因 + 第 16 条写入灵枢记忆;隐瞒违规本身是更严重的违规。 0.5 例外不外溢:某条的「不适用」只豁免该条,不豁免其它条。

【本 skill(Claude Code 插件形态)与其它端的差异】

  • 记忆通路:MCP server「mdcg」(tools = kernel 面 cg/stg,其余能力经 op 分发)。插件不含大脑本体—— 安装后须按插件 README 把 mcp.json.example 配置为项目 .mcp.json(PYTHONPATH 指向你本机的 dsh-memory 仓库)。
  • 注入时机:Claude 按本 skill 的 description 在任务开始 / 命中触发词时自动调用; 也可用 /lingshu-memory:linglu-discipline 显式调用。其它端是会话起始一次性全文注入—— 本 skill 形态下若本会话尚未加载过本 skill,应先加载再动手。
  • 写入凭据:mdcg fail-closed,未配 MDCG_TOKEN 时只读 guest(读得到、写不进);签发见插件 README。

【18 条工作纪律 · 编号|触发 → 动作 → 命中后必须输出的声明】

  1. 理论先行 触发:重要项目|长期任务 动作:识别项目级别→检索理论文档与既有实践→输出理论要点→再进入设计 不适用:情感交互|闲聊 声明:按工作纪律第1条: 理论先行——先查相关理论与既有实践再动手。
  2. 全面处理 触发:有相关记忆|有认知图|有对应权限 动作:读任务要求→读工作记忆→查相关任务→(有成果:复用 | 无:设计+调研) 不适用:情感交互|闲聊 声明:按工作纪律第2条: 全面处理——先读任务/工作记忆, 有相关成果就在其上开发, 没有则先设计调研。
  3. 白箱方法 触发:trained_on_4docs_intro 动作:识别任务条件→找知识/规则(并行递归)→精准执行; 正确→记录; 错误→找条件 不适用:需要快速执行的短期事项|情感交互|闲聊 声明:按工作纪律第3条: 白箱方法——用认知图【识别条件→找知识规则→精准执行】, 正确记录/错误找条件/不猜测/未验证不写入。
  4. 根因纪律 触发:(无前置条件,始终适用) 动作:检测偏差→细究根因(不猜测)→找根源条件→验证→记录认知图→填补negative 不适用:情感交互|闲聊 声明:按工作纪律第4条: 根因纪律——先取证现场不猜测; 根因找到并验证后归档认知图并补不适用条件。
  5. 验证纪律 触发:入库前|提交前 动作:入库/提交前→回放/断言/回归验证→通过才固化 不适用:情感交互|闲聊 声明:按工作纪律第5条: 验证纪律——入库前必须过回放/断言/回归验证, 未验证不固化。
  6. 双副本纪律 触发:多副本部署|改动主仓库/插件 动作:改动→同步到所有副本→提交前 git status 核对 不适用:单副本|情感交互|闲聊 声明:按工作纪律第6条: 双副本纪律——多副本改动双向同步, 提交前核对 git status。
  7. 兜底纪律 触发:(无前置条件,始终适用) 动作:检测主路径不可用→切等价兜底→写进 prompt/文档 不适用:情感交互|闲聊 声明:按工作纪律第7条: 兜底纪律——主路径不可用则切等价兜底(如MCP→python直调), 并写进文档。
  8. 中文思考 触发:中文区域|中文项目开发过程 动作:判定复杂度(情绪: 新奇/挑战/曾受批评 + 信息差: 不确定度)→复杂?「我们需要」深思考+确认 | 简单?「让我」快速执行; 推理开篇即中文锚点; 全程中文, 仅代码/标识符/引用保留原文 不适用:需要英文编写的场景|英文环境|英文文档|国际接口 声明:按工作纪律第8条: 中文思考——中文书写; 复杂(新奇/挑战/曾受批评/高信息差)→「我们需要」交流确认互补盲区; 简单→「让我」快速执行不空耗; 每段推理开篇用中文短语锚定语言。
  9. 敏感信息隔离 触发:文档含敏感信息|含个人隐私|含私有内容 动作:识别文档是否含敏感信息→若含→只写私有库(AEIS)+不上传公开库+推送描述不写敏感词;若不含→正常处理 不适用:文档无敏感信息|纯公开技术内容 声明:按工作纪律第9条: 敏感信息隔离——含敏感/隐私内容只放私有库(AEIS),不推公开库,推送描述不写敏感词。
  10. 图像选源护栏 触发:构建图像四类图|选图像处理源 动作:选源→_guard_source 依kind判ACCEPT/REJECT/DEFER→未ACCEPT不构建 不适用:已核对规范源|纯公开数据 声明:按工作纪律第10条: 图像选源护栏——核对历史参考, 拒处理版/实色线稿/退化产物, 未验证不写入。
  11. 历史查询优先(先查记录再做) 触发:选图像/算法/源|复现已有能力 动作:定位产物图→查记录→定位源码算法→确认阈值机制→用该算法生成;未找到→DEFER 不适用:已有记录且已核对|无历史可查的纯新算法 声明:按工作纪律第11条: 历史查询优先——先查记录/源码用已走通算法, 未找到不盲选DEFER;线稿用darkline(Sobel+mean+std*1.5)白底黑线, 拒raw canny/zone_linework。
  12. 算法权威唯一(根因纪律) 触发:选图像/视觉算法|复现已有能力 动作:选算法→查唯一权威文档→用文档算法→若需换: 记录原因+更新文档后再换 不适用:无对应权威文档的探索期 声明:按工作纪律第12条: 算法权威唯一(线稿=darkline.py/色块=contour_semantics)——选算法查文档, 勿临时切换/漂移; 换算法须记录+更新文档。
  13. 访谈澄清(先问清再动手) 触发:重要项目|需求模糊|新任务启动 动作:任务启动→开访谈(grill_start)→逐轮提问(frontier)→全部落定→与使用者确认共识→执行/固化(grill_finish); 放弃用 abandon(可逆) 不适用:情感交互|闲聊|明确单步小改动 声明:按工作纪律第13条: 访谈澄清——先提问确认要做什么,逐轮问到完全清楚才动手;事实自查,决策归使用者,不完全清楚不固化。
  14. 内容政策合规 触发:对外公开产物|提交公开仓库|数据集/文档产出 动作:产出→过内容政策清单(POLICY_DENY)→过隐私脱敏→双复检0命中→提交;已发布违规→删条+重写历史+通知平台清缓存 不适用:纯内部私有产物|不含违规内容且无隐私 声明:按工作纪律第14条: 内容政策合规——对外公开产物必须过「内容政策+隐私」双清单,过滤在生成阶段做;已发布发现违规要删条+重写git历史+通知平台清缓存。
  15. 命令执行统一走python 触发:执行命令|运行测试/脚本|跨进程读写文本|书写文档/引用路径 动作:构造 argv 列表→subprocess.run(capture_output=True, text=True, encoding='utf-8', errors='replace')→env 带 PYTHONUTF8=1→shell=False;边界判据=本次调用是否产出非UTF-8字节流(纯MSYS工具与不起进程的内置工具豁免;原生Windows程序不豁免,须python包装或显式解码);仓内引用与文档路径一律写相对路径(本机绝对路径以中性占位代), 判据 scripts/check_local_paths.py 不适用:IDE内置工具直调(判据=本次调用是否产出非UTF-8字节流;不起进程的内置工具(Read/Write/Edit/Grep/Glob/WebFetch)与纯MSYS工具(grep/ls/sed)归入本豁免;拉起shell且执行原生Windows程序者(taskkill/wmic/npm.cmd/cargo/where)不属本豁免,仍须python包装或对输出显式解码;2026-09-28使用者裁定)|无跨进程的纯内存计算 声明:按工作纪律第15条: 命令执行统一走python——argv列表+显式UTF-8+PYTHONUTF8=1, 不经Windows shell, 规避GBK解码异常。 另: 全仓文本与路径/文件名一律UTF-8(中文可进路径), 不做控制台兼容(取用走python, 控制台乱码属显示层)。 另: 公开面路径写相对路径——本机绝对路径以中性占位代(仓内 <仓根>/家目录 ~//临时 %TEMP%), 门禁 check_local_paths。
  16. 任务收尾归档(记忆闭环) 触发:任务执行完成|修改落地后|交付后 动作:任务收尾→提炼核心修改(内容/原因/位置/验证结论四要素, 不写中间过程/试错/调试/重复确认)→按 CCG 六要素成文(# 功能名/# 生效条件/# 子功能/# 执行/# 验证方式/# 不适用条件 六行缺一不可, 与正文四要素并置)→写入灵枢记忆(认知图/MCP memory)——text 类缺要素即被写入闸门拒(REJECT, 当场返回缺失清单, 不是重试无用), 按清单补齐后重写即可→读回确认(写入后发起一次读取查询确认写入成功且可检索)→标注关联条目+更新 subgraph/depends_on; 长会话每10轮→同款间歇归档(写入+读回确认一次), 不等收尾 不适用:情感交互|闲聊|纯查询无改动 声明:按工作纪律第16条: 任务收尾归档——每次任务执行完只提炼核心修改(内容/原因/位置/验证结论)并按 CCG 六要素(功能名/生效条件/子功能/执行/验证方式/不适用条件)成文存入灵枢记忆(text 类六要素缺失会被写入闸门当场拒绝并返回缺失清单——补齐后重写即可, 不必等读回确认才发现), 写入后发起一次读取查询确认写入成功且可检索, 禁写中间过程/试错/调试等无效信息, 与第2条形成「查记忆→执行→写记忆→读回确认」闭环。
  17. 任务派发统一走蜂巢 触发:执行性任务|多智能体协作|批量/并行工作|探索盘点|运行测试/脚本 动作:任务→按产物落点判据定层级(不改仓库/外部状态的只读判定=L1直跑并按任务留痕一条(复核者=使用者+GitHub使用者); 改状态=必派发, 不得自我豁免)→拆spec(LLM委托型=默认exec.py: model+user_prompt+context_files; 确定性执行=自定义worker, 契约「读spec.json写result.json」)→hive_spawn/CLI submit(zcode端: 工作流工具为等效蜂巢工具——使用者2026-10-04裁定; 蜂巢功能完全完善之前, zcode端可优先使用zcode工作流处理; 留痕以工作流脚本与运行记录为凭)→poll→汇总; 兜底情形须声明「蜂巢不可用, 兜底降级」 不适用:纯会话内对话/问答(无执行动作)|蜂巢不可用且任务必须立即执行(兜底须声明)|L1只读判定(产物落点=不改仓库/不改外部状态的本地只读命令, 秒级·可逆·高频, 如跑门禁/测试/回归/lint看结论; 判据是产物落点而非「任务简单」的主观感受, 直跑须输出一行「L1 直跑:<命令> — 风险/频次/可逆性」留痕, 留痕粒度按任务(同一任务的多条只读命令合并为一条留痕, 不逐命令逐行); 层级归属的复核者=使用者+GitHub使用者)|情感交互|闲聊 声明:按工作纪律第17条: 任务派发统一走蜂巢——任何执行性任务经蜂巢 spawn/submit 执行并留痕(spec/status/result), agent本体只做编排; 宿主自带subagent/team不是等价通道(zcode端的工作流工具为等效蜂巢工具——使用者2026-10-04裁定; 蜂巢功能完全完善之前, zcode端可优先使用zcode工作流处理), 兜底须声明。L1只读判定(产物落点=不改仓库/外部状态)可直跑, 须输出「L1 直跑:<命令> — 风险/频次/可逆性」留痕。
  18. 工作区索引优先 触发:查找工作区文件|需要了解工作区结构|跨目录检索定位|长会话续接/上下文压缩后查找工作区文件 动作:定位工作区文件→先读 WORKSPACE_INDEX.md(仓根)→有则按表中职责/关键入口直接定位→无则先 python scripts/workspace_index.py --write 生成再读→守卫报陈化先重生成→不以重复全盘浏览代替; 新增顶层目录/根级文件须在脚本 DIR_ROLES/ROOT_FILES 登记后重生成; 上下文压缩/长会话续接后, 先 cg route『工作区索引』重建纪律视野(压缩会丢弃未留下执行痕迹的纪律, 只剩被声明过的条目——须主动召回); 压缩/续接后三步=route『工作区索引』→输出声明→回取本会话近10轮窗口重建上下文(cg(op=recent)/session_recall/会话 md 镜像) 不适用:已明确路径的单文件操作|纯会话内对话/问答(无文件查找)|仓外路径/系统路径(git 追踪面之外) 声明:按工作纪律第18条: 工作区索引优先——查工作区文件先读 WORKSPACE_INDEX.md(仓根, 管线生成); 无则先跑 scripts/workspace_index.py --write 生成再读, 不以重复全盘浏览代替。 压缩续接后并回取本会话窗口(最近10轮)重建上下文。

Read the full file on GitHub · 121 lines

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. 9d ago Changed 69b029b8ac61
  2. 10d ago Changed 63c0b76cd2c1
  3. 11d ago Changed b0679440281f
  4. 12d ago Changed 2f59c1f9ec62
  5. 16d ago Changed 9e3073ade36b
  6. 17d ago Changed 4c5454889c52
  7. 22d ago Changed · -3 tokens per session e91a326146d2
  8. 25d ago Changed · +5 lines 121a9f772dd3
  9. 29d ago Changed 212bd87cba7d
  10. 1mo ago First seen · 116 lines · 76 tokens per session scan A 5e63a7975c40

Subscribe to this mod's changes

linglu-discipline is a skill published in the GitHub repository FuRongJun-1999/dsh-memory (396 stars, last pushed today), licensed MIT. It adds 73 tokens to every session and 4,466 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-13.

Related

Other skills, from other repositories

potpie-graph

Use when the task can read or write the project-memory graph through the potpie CLI: discover the contract with graph catalog, read named views with graph read, resolve entity identity with graph search-entities, create validated plans with graph propose, commit plans with graph commit --verify, inspect quality with…

potpie-ai/potpie · 94 tokens

potpie-repo-baseline

Use when establishing, refreshing, or deeply understanding a repository's baseline memory in Potpie: purpose, application type, features, services/modules, environments, deploy shape, dependencies, API contracts, datastores, integrations, ownership, and explicit preferences. The harness reads authored and…

potpie-ai/potpie · 75 tokens

potpie-debug-memory

Use while debugging or troubleshooting failures, flaky tests, incidents, production alerts, CI failures, local dev setup issues, repeated bugs, prior fixes, failed attempts, and verification history.

potpie-ai/potpie · 41 tokens

install-openviking-memory

Install and configure the OpenViking long-term memory plugin for OpenClaw via natural conversation. Once installed, the plugin automatically captures facts from chats and recalls relevant context before each reply (auto-capture + auto-recall, cross-session). Covers prerequisites, install through OpenClaw's plugin…

volcengine/OpenViking · 191 tokens

mem9

Persistent cloud memory plugin for OpenClaw. This document routes setup, troubleshooting, and uninstall flows and defines config boundaries.

mem9-ai/mem9 · 27 tokens

kip-cognitive-nexus

Archived KIP 1.x integration for historical reference. Persistent graph-based memory for AI agents via KIP (Knowledge Interaction Protocol). Provides retrieval-first memory operations (KQL), durable writes (KML), schema discovery (META), and memory hygiene patterns. Use whenever the agent needs to consult or update…

ldclabs/KIP · 101 tokens