Files
nexus/CLAUDE.md
2026-04-14 16:02:50 +08:00

5.6 KiB
Raw Blame History

LLM Wiki Agent — Schema & Workflow Instructions中文版增强规范

本 Wiki 完全由 Claude Code 自动维护。无需 API Key 或 Python 脚本 —— 只需在 Claude Code 中打开本仓库并与其对话。


🔴 全局强制规则CRITICAL

1. 输出语言(必须遵守)

  • 所有输出必须使用简体中文
  • 专有名词允许保留英文,但首次出现必须附带中文解释
  • 禁止中英混合句(术语除外)
  • 不允许输出纯英文总结或分析

示例:

Transformer变压器模型一种基于注意力机制的神经网络架构


2. 输出风格(严格限制)

所有输出必须:

  • 去修辞(禁止 narrative 风格)
  • 去模糊(禁止“可能”“大概”等词)
  • 信息密度最大化
  • 面向“知识结构化”,而非阅读体验

优先级:

结构 > 关系 > 结论 > 描述


3. 结构化语义(必须)

所有页面必须遵循结构化语义规则:

  • Summary 必须使用固定字段
  • Claim 必须符合标准语法
  • Connections 必须使用关系类型
  • 禁止自由发挥

Slash CommandsClaude Code

Command 使用方式
/wiki-ingest ingest raw/your-file.md
/wiki-query query: 你的问题
/wiki-lint lint the wiki
/wiki-graph build the knowledge graph

自然语言示例

  • ingest raw/papers/attention-is-all-you-need.md
  • query: Transformer 的核心机制是什么?
  • lint the wiki
  • build the graph and analyze RAG

Claude Code 会自动读取本文件并执行以下工作流。


Directory Layout目录结构

raw/          # 原始文档(不可修改) 
wiki/         # 知识层(由 Claude 完全维护)  
  index.md    # 页面索引(每次 ingest 必须更新) 
  log.md      # 追加式日志 
  overview.md # 全局知识总结  
  sources/    # 每个原始文档对应一个页面  
  entities/   # 实体(人/公司/产品/项目) 
  concepts/   # 概念(方法/理论/框架)
  syntheses/  # 查询结果沉淀  
graph/        # 自动生成的图数据  
tools/        # 可选 Python 工具 (require ANTHROPIC_API_KEY)

Page Format页面格式

每个页面必须包含:

---
id: unique_id
title: "Page Title"
type: source | entity | concept | synthesis
tags: []
sources: []       # 来源
last_updated: YYYY-MM-DD
---

必须使用 [[PageName]] 进行链接。


Ingest Workflow摄取流程

触发方式:

  • /wiki-ingest
  • 或:ingest <file>

执行步骤(严格顺序)

  1. 使用 Read 工具完整读取 source 文档
  2. 读取 wiki/index.mdwiki/overview.md
  3. 生成 wiki/sources/<slug>.md
  4. 更新 wiki/index.md
  5. 更新 wiki/overview.md(如有必要)
  6. 创建或更新 Entity 页面
  7. 创建或更新 Concept 页面
  8. 检测并记录冲突
  9. 追加 wiki/log.md

Source Page Format增强结构

---
title: "Source Title"
type: source
tags: []
date: YYYY-MM-DD
source_file: raw/...
---

## Summary
- 核心主题:
- 问题域:
- 方法/机制:
- 结论/价值:

## Key Claims
- (必须符合:主体 + 机制 + 结果)

## Key Quotes
> "引用内容" — 上下文说明

## Key Concepts
- [[ConceptName]]:定义

## Key Entities
- [[EntityName]]:角色说明

## Connections
- [[A]] ← depends_on ← [[B]]
- [[C]] ← extends ← [[D]]

## Contradictions
- 与 [[OtherPage]] 冲突:
  - 冲突点:
  - 当前观点:
  - 对方观点:

Domain-Specific Templates领域模板

Diary / Journal

---
title: "YYYY-MM-DD Diary"
type: source
tags: [diary]
date: YYYY-MM-DD
---
## Event Summary
## Key Decisions
## Energy & Mood
## Connections
## Shifts & Contradictions

Meeting Notes

---
title: "Meeting Title"
type: source
tags: [meeting]
date: YYYY-MM-DD
---
## Goal
## Key Discussions
## Decisions Made
## Action Items

Entity & Concept Rules关键增强

Entity实体

创建条件:

  • 出现 ≥ 2 次
  • 对主题有关键影响

类型:

  • 人 / 公司 / 产品 / 项目

Concept概念

创建条件:

  • 可抽象
  • 可复用
  • 非具体实例

命名规范(强制)

  • 使用唯一标准名称
  • 所有别名写入页面:
## Aliases
- GPT4
- GPT-4

去重机制(必须)

创建前必须:

  1. 搜索 index
  2. 判断是否存在
  3. 存在则更新

Query Workflow查询流程

触发:

  • /wiki-query
  • 或:query: 问题

步骤

  1. 读取 index
  2. 找到相关页面
  3. 使用 Read 工具加载
  4. 输出结构化答案
  5. 使用 [[Page]] 引用
  6. 询问是否保存为 synthesis

Lint Workflow校验

检查内容:

  • 孤立页面
  • 断链
  • 冲突
  • 过期内容
  • 缺失实体
  • 知识空白

Graph Workflow知识图谱

触发:

  • /wiki-graph

执行:

  • 优先运行 tools/build_graph.py
  • 否则手动构建:

步骤:

  1. 提取所有 [[links]]
  2. 构建节点与边
  3. 输出 graph.json

Naming Conventions命名规范

  • Sourcekebab-case
  • EntityTitleCase
  • ConceptTitleCase

Index Format索引结构

# Wiki Index

## Overview
- [Overview](overview.md)

## Sources
- [Title](sources/slug.md)

## Entities
- [Entity](entities/Entity.md)

## Concepts
- [Concept](concepts/Concept.md)

## Syntheses
- [Title](syntheses/slug.md)

Log Format日志

## [YYYY-MM-DD] ingest | 标题

最终目标

该系统用于:

  • 知识沉淀
  • 结构化理解
  • 自动图谱构建
  • Agent 推理支持

END