/cannbot-knowledge:knowledge-lintfrom cannbot-knowledge
Lints Ascend NPU OKF knowledge base for structural, provenance, index, and graph compliance before ingestion, generation, or PR submission. Runs deterministic checks (naming, frontmatter, sources, links, logs) and optional semantic deep review.
Ships in cannbot-knowledge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
对 reference/ + ops/ + runbooks/ 的全部 concept 卡,按 SPEC(Reference/Source/Graph/Retrieve)的基本原则做一次权威体检。安装后的 skill 入口 scripts/knowledge_lint.py --knowledge-root <知识库根> 是确定性、零-LLM、只读只报的 linter,一条命令叠加全库原则检查 + 聚合现有 okf_graph/knowledge_query verify,单一分级报告。与 ops-knowledge-reference-ingest 期逐批的 review(§5,agent 语义审)互补——knowledge-lint 是全库 post-hoc 体检。
依据:
SPEC-Reference.md§3(写入规范)/§7(verify)、SPEC-Source.md(溯源)、SPEC-Graph.md、SPEC-Retrieve.md。复用ops-knowledge-ingest/scripts/okf_graph.py(图簇)+ops-knowledge-reference-ingest/scripts/okf_source.py(源簇)、knowledge-query/scripts/knowledge_query.py的解析器。
python3 scripts/knowledge_lint.py --knowledge-root <知识库根> [--bundle B] [--kind K] [--json] # 全部确定性检查 + 聚合 verify
python3 scripts/knowledge_lint.py --knowledge-root <知识库根> --aggregate-only # 只跑 okf_graph/knowledge_query verify
python3 scripts/knowledge_lint.py --knowledge-root <知识库根> --sample N [--bundle B] [--kind K] # 抽 N 卡为 JSON worklist,喂 §3 深审
--json 输出结构化 findings 供 CI/agent 消费。✗ blocker / ! warn / ✓ ok,尾部 blocker N / warn M + OK|FAIL;同仓连跑逐字节一致。@sha blob|tree;op-dev-guide/profiling=hiascend.com 文档 URL(无 @sha/pin);glossary/runbooks 允许空 resource。脚本内置该策略表,不会对文档站 URL/空 resource 误报。--bundle asc-devkit / --kind example。| 组 | 检查 | 级别 |
|---|---|---|
| A 命名/结构 | 文件名无前导序号 ^\d+[_-];深度 id 段数 ≤3;snake_case(CJK 名容忍、runbooks/ops 的 ID 约定豁免大写) | blocker / 空格或大写 warn |
| B frontmatter | okf.v1 基础字段在位:schema_version/kind/type/source_family/title/description/tags/created_at/updated_at;kind/type/source_family 合法;无 legacy timestamp;无重复 tag;无 merge 冲突标记 | blocker |
| C 多源溯源 | 有 sources:唯一 primary、resource==primary.url、role∈受控词表;resource/sources[].url 形态按 per-bundle 策略(@sha / 文档 URL / 空 OK) | blocker |
| D 正文 | 无嵌图 path-like 相对链接解析到存在文件;未完成标记 TODO/FIXME/待补充 | 嵌图/多块 blocker;死链/标记 warn |
| E index/导航 | 每级 index.md 每条目有非空描述;git-bundle 根 index.md 含 upstream_repo/ref/commit pin | blocker |
| G 日志 | log/<date>.md:首行 # <date> 与文件名一致、[HH:MM] 合法、条目倒序(最新在前)。仅全库 lint 跑(不随 --bundle/--kind/--aggregate-only);autofix=log/sort_logs.py,不查 operation 词表 | blocker |
| F 聚合 | shell okf_graph verify + knowledge_query verify,独立成段(区分"原则违规"与"图谱/索引未重建") | blocker |
确定性脚本管不了的语义原则(SPEC 标记 SEMANTIC):蒸馏非照搬、description 与正文一致、index 只列本层。流程:
knowledge_lint.py --sample N [--bundle/--kind] 取 JSON worklist(每项 path+sources+excerpt)。sources 上游对照,正文是否成段照搬而非蒸馏融合。ops-knowledge-reference-ingest §5 review(B OKF 原则 / C 正确性);输出 findings(severity+位置+建议)。只报不改。OK。knowledge_query build / okf_graph candidates→judge→inject)再复跑。okf_graph/knowledge_query verify 仍可单独跑;asc_devkit_extract verify(覆盖账)保留。ops-knowledge-reference-ingest 期 review(§5,逐批语义审);knowledge-lint 是全库收口体检。What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
knowledge-base-lint, okf, ascend-npu, compliance-check, ci-lint
npx claudepluginhub catman626/cannbot-skills --plugin cannbot-knowledge8 skills in this plugin
/knowledge-issue-report生成并校验 cannbot-knowledge 知识库 GitCode Issue 提交材料。触发:当用户要提交 Issue、反馈知识内容错误/缺失、检索错误、图谱错误、知识编译错误、治理 lint 错误、debug 下游 agent 使用问题,或要求打包复现与测试材料时使用。/knowledge-queryUse when 用户正在处理昇腾 NPU 上的 Ascend C/CANN 算子任务,并询问 API 名称或可用性、签名、参数、头文件、调用方式、平台/版本支持、Tiling、数据搬运、AICore kernel、实现样例、编译/运行错误、精度、性能或 Profiling;在搜索本地 CANN/Toolkit/SDK 安装包或源码前触发。/ops-knowledge-cv-ingest为 AscendC CV(cube-vector)融合算子生成「cube↔vector 融合设计」wiki(手动触发)。Other plugins' skills for the same job