doctrack
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDoctrack — Codebase Knowledge Graph
Doctrack — 代码库知识图谱
You maintain a knowledge graph of project documentation in a local Obsidian vault (). The vault travels with the code in git — it's the project's persistent memory across sessions and team members.
.doctrack/This skill depends on the obsidian skill () for all vault operations. The obsidian skill handles MCP tool usage, Obsidian CLI, and git sync. Doctrack focuses on what knowledge to capture and how to structure it — not the mechanics of reading/writing notes.
bitbonsai/mcpvaultIf the obsidian skill or MCP tools are not available, doctrack init will set them up automatically (see Pre-init).
你需要在本地Obsidian vault()中维护项目文档的知识图谱。该vault会随代码一同提交至git——它是跨会话和跨团队成员的项目持久化记忆。
.doctrack/此技能依赖obsidian技能()来处理所有vault操作。obsidian技能负责MCP工具的使用、Obsidian CLI以及git同步。Doctrack专注于要捕获哪些知识以及如何构建知识结构——而非读写笔记的具体机制。
bitbonsai/mcpvault如果obsidian技能或MCP工具不可用,doctrack init会自动进行设置(参见预初始化部分)。
Knowledge graph structure
知识图谱结构
The vault contains these node types, connected by :
[[wikilinks]]| Node | Directory | Purpose | Audience |
|---|---|---|---|
| Features | | What the system does. High-level functional units. | Claude |
| Components | | How pieces work internally. Dense implementation details. | Claude |
| Concepts | | Cross-cutting ideas and patterns spanning multiple features. | Claude + Human |
| Decisions | | Why things are the way they are — including rejected alternatives. | Claude + Human |
| Interfaces | | Contracts and boundaries between features or packages. | Claude + Human |
| Guides | | Procedural docs only: build, deploy, test, setup workflows. | Human |
| Specs | | Machine-readable specifications (OpenAPI, schemas). | Machine |
| References | | Imported pre-existing docs and user-provided materials. | Claude |
Wikilinks are the edges. Every note should link to related notes — features link to their components, components link to interfaces they implement, concepts link to the features they span, decisions link to what they affect. This is what makes the vault navigable in Obsidian's graph view.
Use Mermaid for all diagrams. More token-efficient than ASCII art, natively rendered by Obsidian, and structured enough to parse and update programmatically. Use it for flowcharts, sequence diagrams, state machines, ER diagrams, class diagrams, and dependency graphs. Avoid ASCII art entirely.
Linking notes in Mermaid diagrams. To make Mermaid nodes clickable links to other notes, use Obsidian's class — NOT wikilink syntax inside node labels:
internal-linkmermaid
graph TD
A[Auth Service] --> B[Token Validator]
B --> C[User Store]
class A,B,C internal-link;The node label text must match the note filename (without ). Nodes with the class become clickable in Obsidian's reading view. Never put inside Mermaid code blocks — use wikilinks only in regular markdown content outside of code fences.
.mdinternal-link[[wikilinks]]Avoid hex colors in Mermaid. Do NOT use with hex color fills (e.g., ). Obsidian interprets inside code blocks as an inline hashtag and creates a spurious tag. If you need styling, use named CSS classes without hex values, or skip styling entirely — the diagrams are informational, not decorative.
classDefclassDef internal fill:#e1f5fe#e1f5fe#vault包含以下节点类型,通过相互关联:
[[wikilinks]]| 节点类型 | 目录 | 用途 | 受众 |
|---|---|---|---|
| 功能(Features) | | 系统实现的功能,即高层级功能单元。 | Claude |
| 组件(Components) | | 各部分的内部工作原理,包含详细的实现细节。 | Claude |
| 概念(Concepts) | | 跨多个功能的通用理念和模式。 | Claude + 人类开发者 |
| 决策(Decisions) | | 系统为何采用当前实现方式的原因——包括被否决的方案。 | Claude + 人类开发者 |
| 接口(Interfaces) | | 功能或包之间的契约与边界。 | Claude + 人类开发者 |
| 指南(Guides) | | 仅包含流程类文档:构建、部署、测试、设置工作流。 | 人类开发者 |
| 规范(Specs) | | 机器可读的规范(如OpenAPI、数据模型)。 | 机器 |
| 参考资料(References) | | 导入的既有文档和用户提供的资料。 | Claude |
Wikilinks是关联边。每个笔记都应链接到相关笔记——功能链接到其对应的组件,组件链接到其实现的接口,概念链接到其涉及的功能,决策链接到其影响的对象。这是Obsidian图谱视图中vault可导航的核心。
所有图表均使用Mermaid。相比ASCII图,它更节省token,能被Obsidian原生渲染,且结构足够规范以便程序化解析和更新。可用于流程图、序列图、状态机、ER图、类图和依赖图。完全避免使用ASCII图。
在Mermaid图表中链接笔记。要让Mermaid节点成为指向其他笔记的可点击链接,请使用Obsidian的类——不要在节点标签内使用wikilink语法:
internal-linkmermaid
graph TD
A[Auth Service] --> B[Token Validator]
B --> C[User Store]
class A,B,C internal-link;节点标签文本必须与笔记文件名(不含)完全匹配。带有类的节点在Obsidian阅读视图中会变为可点击状态。绝对不要在Mermaid代码块内使用——仅在代码块外的普通Markdown内容中使用wikilinks。
.mdinternal-link[[wikilinks]]避免在Mermaid中使用十六进制颜色。不要使用带十六进制颜色填充的(例如)。Obsidian会将代码块内的解析为行内标签,并创建不必要的标签。如果需要样式,请使用不带十六进制值的命名CSS类,或者完全跳过样式——图表是用于展示信息的,而非装饰。
classDefclassDef internal fill:#e1f5fe#e1f5fe#Tag taxonomy
标签分类体系
Every note gets three required tags (applied via the obsidian skill's tag management):
| Category | Tags |
|---|---|
| Type | |
| Status | |
| Audience | |
Additional: (shared vaults), (monorepos).
doctrack/project/{name}doctrack/package/{name}Only use tags from the namespace. Do not invent domain-specific tags (e.g., , , ). The tag taxonomy is intentionally controlled — domain-specific context belongs in note content and frontmatter fields, not in tags. Stray tags clutter the tag panel and create inconsistent filtering.
doctrack/dojo/authkeycloakmongodb每个笔记都需要添加三个必填标签(通过obsidian技能的标签管理功能添加):
| 分类 | 标签 |
|---|---|
| 类型 | |
| 状态 | |
| 受众 | |
附加标签:(共享vault)、(单体仓库)。
doctrack/project/{name}doctrack/package/{name}仅使用命名空间下的标签。不要创建领域特定的标签(例如, , )。标签分类体系是受控的——领域特定上下文应放在笔记内容和前置元数据字段中,而非标签里。无关标签会使标签面板混乱,并导致过滤结果不一致。
doctrack/dojo/authkeycloakmongodbWhen to use this
使用场景
After making code changes: Update relevant documentation before finishing your response.
At session start: Run session init to orient yourself from previous sessions.
When the user asks: Documenting, updating docs, syncing, or generating documentation.
To initialize a project: When the user says "doctrack init".
To refresh stale docs: When the user says "doctrack refresh", "refresh docs", "update docs", or "sync docs".
Do NOT use for: Trivial formatting changes, comment-only edits, or read-only exploration.
代码修改后:在完成响应前更新相关文档。
会话开始时:运行会话初始化,从之前的会话中获取上下文。
用户请求时:记录代码、更新文档、同步文档或生成文档。
项目初始化时:当用户说"doctrack init"时。
刷新过时文档时:当用户说"doctrack refresh"、"refresh docs"、"update docs"或"sync docs"时。
请勿用于:无关紧要的格式修改、仅修改注释的编辑,或只读探索。
Session init (every session)
会话初始化(每次会话)
Runs at the start of every Claude session in a project with doctrack. Idempotent.
-
Detect vault and init state: Check ifexists on the filesystem.
.doctrack/- If exists but
.doctrack/doesn't → post-restart after dependency setup. Tell the user: "Your doctrack vault is set up. Say_project.mdto continue."doctrack init - If exists and contains a
_project.mdfield that is NOTCurrent phase→ interrupted init. Check which phase it's in and summarize progress. Tell the user: "Doctrack init was interrupted during {phase}. Saycompleteto resume where we left off."doctrack init - If doesn't exist → check
.doctrack/for vault path info.CLAUDE.md
- If
-
Verify MCP connection: Check iftools are available.
mcp__obsidian__*- If tools are available → try reading via MCP. If it works, proceed to step 3.
_project.md - If tools are available but can't reach the vault → the MCP server may be pointing elsewhere. Check to see if it has the right vault path. If not, update it.
.mcp.json - If tools are NOT available → check if exists with an obsidian server config. If not, create it:
.mcp.jsonUse relative paths (json{ "mcpServers": { "obsidian": { "command": "npx", "args": ["@bitbonsai/mcpvault@latest", ".doctrack"] } } }not absolute) so the config works across clones and users. Claude Code sets the working directory to the project root when spawning MCP servers. Tell the user: "I've configured the MCP server in.doctrack. Please restart Claude Code for the connection to activate." Then proceed with what you can do without MCP (read.mcp.jsonfiles directly from the filesystem using the Read tool as a fallback)..doctrack/
- If tools are available → try reading
-
Read project config: Loadfrom the vault. Check
_project.md(see Version tracking).doctrack_version -
Check doctrack-mcp version (if installed): Run this command (with a timeout to handle old binaries that don't support --version):bash
timeout 2 doctrack-mcp --version 2>/dev/null || echo "unknown"Expected output format:. Compare the version againstdoctrack-mcp {version} ({git-hash})(minimum required for this skill version).0.1.0- If not found () and
command not foundis available: runcargoand tell the user to restart Claude Code for the MCP server to connect.cargo install --git https://github.com/liamstar97/doctrack.git dt-mcp - If output is or version is older than required: run
unknownto update. Tell the user "Updated doctrack-mcp — restart Claude Code for the new version to take effect."cargo install --git https://github.com/liamstar97/doctrack.git dt-mcp --force - If isn't available: skip silently, the vault works without the MCP server.
cargo - If up to date: proceed silently.
- If not found (
-
Orient: Use vault stats to see recently modified notes. Load only docs relevant to the current task — don't read the whole vault.
在项目的每个Claude会话开始时运行,支持幂等操作。
-
检测vault和初始化状态:检查文件系统中是否存在。
.doctrack/- 如果存在但
.doctrack/不存在 → 依赖设置完成后的重启。告知用户:"你的doctrack vault已设置完成。请输入_project.md继续。"doctrack init - 如果存在且其
_project.md字段不为Current phase→ 初始化被中断。检查当前处于哪个阶段并总结进度。告知用户:"Doctrack初始化在{phase}阶段被中断。请输入complete从中断处恢复。"doctrack init - 如果不存在 → 检查
.doctrack/中的vault路径信息。CLAUDE.md
- 如果
-
验证MCP连接:检查工具是否可用。
mcp__obsidian__*- 如果工具可用 → 尝试通过MCP读取。如果成功,进入步骤3。
_project.md - 如果工具可用但无法访问vault → MCP服务器可能指向了其他位置。检查是否包含正确的vault路径。如果没有,更新它。
.mcp.json - 如果工具不可用 → 检查是否存在带有obsidian服务器配置的。如果不存在,创建该文件:
.mcp.json使用相对路径(json{ "mcpServers": { "obsidian": { "command": "npx", "args": ["@bitbonsai/mcpvault@latest", ".doctrack"] } } }而非绝对路径),确保配置在不同克隆和用户环境中都能正常工作。Claude Code在启动MCP服务器时会将工作目录设置为项目根目录。 告知用户:"我已在.doctrack中配置了MCP服务器。请重启Claude Code以激活连接。" 然后在没有MCP的情况下继续完成可执行的操作(作为备选方案,使用Read工具直接从文件系统读取.mcp.json文件)。.doctrack/
- 如果工具可用 → 尝试通过MCP读取
-
读取项目配置:从vault中加载。检查
_project.md(参见版本跟踪部分)。doctrack_version -
检查doctrack-mcp版本(如果已安装):运行以下命令(设置超时以处理不支持--version的旧版本二进制文件):bash
timeout 2 doctrack-mcp --version 2>/dev/null || echo "unknown"预期输出格式:。将版本与doctrack-mcp {version} ({git-hash})(此技能版本的最低要求)进行比较。0.1.0- 如果未找到(提示)且
command not found可用:运行cargo,并告知用户重启Claude Code以连接MCP服务器。cargo install --git https://github.com/liamstar97/doctrack.git dt-mcp - 如果输出为或版本低于要求:运行
unknown进行更新。告知用户"已更新doctrack-mcp —— 请重启Claude Code使新版本生效。"cargo install --git https://github.com/liamstar97/doctrack.git dt-mcp --force - 如果不可用:静默跳过,vault在没有MCP服务器的情况下仍可工作。
cargo - 如果版本符合要求:静默继续。
- 如果未找到(提示
-
获取上下文:使用vault统计信息查看最近修改的笔记。仅加载与当前任务相关的文档——不要读取整个vault。
Doctrack refresh
Doctrack刷新
When the user says "doctrack refresh", "refresh docs", "update docs", or "sync docs" — or when you detect that code has changed and docs may be stale. Requires the doctrack MCP server ( tools).
mcp__doctrack__*If doctrack MCP tools are not available, tell the user: "The doctrack MCP server is needed for refresh. Run and restart Claude Code."
cargo install --git https://github.com/liamstar97/doctrack.git dt-mcp当用户说"doctrack refresh"、"refresh docs"、"update docs"或"sync docs"时——或者当你检测到代码已更改且文档可能过时的时候。需要doctrack MCP服务器(工具)。
mcp__doctrack__*如果doctrack MCP工具不可用,告知用户:"刷新功能需要doctrack MCP服务器。请运行并重启Claude Code。"
cargo install --git https://github.com/liamstar97/doctrack.git dt-mcpRefresh flow
刷新流程
-
Get the refresh plan: Call. This returns a prioritized list of stale notes with specific reasons (code newer than doc, missing symbols, broken refs).
refresh_docs -
If nothing is stale: Report "All documentation is up to date" and stop.
-
Work through stale notes in priority order (HIGH → MEDIUM → LOW):For each stale note: a. Read the note via obsidian MCP to understand its current content. b. Read the changed code files listed in the refresh plan reasons. Focus on the symbols and sections that changed. c. Update the note via obsidian MCP (for surgical edits,
patch_notefor significant rewrites):write_note- Fix broken file references with correct paths (use if needed)
resolve_symbol - Add documentation for new symbols the note is missing
- Update descriptions for renamed or modified symbols
- Fix broken wikilinks
- Update frontmatter to today's date d. Validate the note: Call
last_updatedon the updated note. Fix any remaining issues.validate_note
- Fix broken file references with correct paths (use
-
Handle undocumented code files: Ifreported undocumented files:
refresh_docs- For files that belong to an existing feature, create component notes
- For files that represent new features, create feature notes
- Follow the same write-as-you-go pattern from init (write immediately, tag, link)
-
Verify: Callagain. It should return "All documentation is up to date." If issues remain, continue from step 3.
refresh_docs -
Report: Tell the user what was updated — e.g., "Updated 5 notes, created 2 new component notes, fixed 3 broken references."
-
获取刷新计划:调用。这会返回一个按优先级排序的过时笔记列表,并附带具体原因(代码比文档新、缺失符号、无效引用)。
refresh_docs -
如果没有过时内容:报告"所有文档均为最新版本"并停止。
-
按优先级处理过时笔记(高→中→低):对于每个过时笔记: a. 读取笔记:通过obsidian MCP读取笔记,了解其当前内容。 b. 读取变更的代码文件:查看刷新计划原因中列出的已更改代码文件。重点关注已更改的符号和部分。 c. 更新笔记:通过obsidian MCP更新笔记(小范围修改用,大幅重写用
patch_note):write_note- 修复无效的文件引用,使用正确路径(必要时使用)
resolve_symbol - 为笔记中缺失的新符号添加文档
- 更新重命名或修改后的符号描述
- 修复无效的wikilinks
- 将前置元数据更新为当前日期 d. 验证笔记:调用
last_updated验证更新后的笔记。修复所有剩余问题。validate_note
- 修复无效的文件引用,使用正确路径(必要时使用
-
处理未记录的代码文件:如果报告存在未记录的文件:
refresh_docs- 对于属于现有功能的文件,创建组件笔记
- 对于代表新功能的文件,创建功能笔记
- 遵循初始化时的"边写边存"模式(立即写入、添加标签、建立链接)
-
验证:再次调用。它应返回"所有文档均为最新版本"。如果仍有问题,从步骤3继续。
refresh_docs -
报告:告知用户更新内容——例如,"已更新5个笔记,创建2个新组件笔记,修复3个无效引用。"
Incremental refresh (after specific code changes)
增量刷新(特定代码变更后)
When you've just modified code files (not a full refresh), use the targeted workflow instead:
- Call for each file you changed
check_impact - Read and update only the impacted notes
- Call on each updated note
validate_note
This is faster than a full when you know exactly what changed.
refresh_docs当你刚修改了代码文件(非全量刷新)时,使用针对性工作流:
- 为每个已更改的文件调用
check_impact - 仅读取和更新受影响的笔记
- 为每个更新后的笔记调用
validate_note
当你明确知道变更内容时,这比全量更快。
refresh_docsVault layout
Vault布局
Local vault (default)
本地vault(默认)
project-root/
├── .doctrack/ # Obsidian vault — committed to git
│ ├── .obsidian/ # Obsidian config
│ ├── _project.md # Project config — always read first
│ ├── features/
│ ├── components/
│ ├── concepts/
│ ├── decisions/
│ ├── interfaces/
│ ├── guides/
│ ├── specs/
│ └── references/
├── README.md
├── CLAUDE.md
└── src/project-root/
├── .doctrack/ # Obsidian vault — 提交至git
│ ├── .obsidian/ # Obsidian配置
│ ├── _project.md # 项目配置 — 始终优先读取
│ ├── features/
│ ├── components/
│ ├── concepts/
│ ├── decisions/
│ ├── interfaces/
│ ├── guides/
│ ├── specs/
│ └── references/
├── README.md
├── CLAUDE.md
└── src/Monorepo
单体仓库(Monorepo)
.doctrack/
├── _project.md # Root: package map, cross-package deps
├── packages/
│ └── {package-name}/
│ ├── _package.md
│ ├── features/ components/ concepts/ decisions/ interfaces/
│ └── ...
├── concepts/ # Monorepo-wide concepts
├── decisions/ # Monorepo-wide decisions
├── interfaces/ # Cross-package contracts
├── guides/
└── references/.doctrack/
├── _project.md # 根目录:包映射、跨包依赖
├── packages/
│ └── {package-name}/
│ ├── _package.md
│ ├── features/ components/ concepts/ decisions/ interfaces/
│ └── ...
├── concepts/ # 单体仓库级别的通用概念
├── decisions/ # 单体仓库级别的决策
├── interfaces/ # 跨包契约
├── guides/
└── references/Shared vault (multi-project)
共享vault(多项目)
Notes namespaced under . A at vault root lists all projects.
projects/{name}/_doctrack.md笔记以为命名空间。vault根目录下的列出所有项目。
projects/{name}/_doctrack.mdNote templates
笔记模板
_project.md
(project config)
_project.md_project.md
(项目配置)
_project.mdmarkdown
---
project: {project-name}
type: index
doctrack_version: "3.0.0"
monorepo: false
initialized: YYYY-MM-DD
last_updated: YYYY-MM-DD
---markdown
---
project: {project-name}
type: index
doctrack_version: "3.0.0"
monorepo: false
initialized: YYYY-MM-DD
last_updated: YYYY-MM-DD
---{Project Name}
{Project Name}
Features
Features
| Feature | Note | Description | Status |
|---|
| Feature | Note | Description | Status |
|---|
File Registry
File Registry
List individual source files, not directories. Each row maps a specific file to its feature and component.
| Source File | Feature | Component |
|---|---|---|
| src/controllers/UserController.java | user-management | user-controller |
| src/services/AuthService.java | authentication | auth-service-impl |
Tags: `doctrack/type/index`, `doctrack/status/active`, `doctrack/audience/claude`列出单个源文件,而非目录。每行将特定文件映射到其对应的功能和组件。
| Source File | Feature | Component |
|---|---|---|
| src/controllers/UserController.java | user-management | user-controller |
| src/services/AuthService.java | authentication | auth-service-impl |
标签:`doctrack/type/index`, `doctrack/status/active`, `doctrack/audience/claude`Feature note (features/{name}.md
)
features/{name}.md功能笔记(features/{name}.md
)
features/{name}.mdmarkdown
---
feature: feature-name
type: feature
doctrack_version: "3.0.0"
files:
- src/path/to/file.ts
last_updated: YYYY-MM-DD
status: active
---markdown
---
feature: feature-name
type: feature
doctrack_version: "3.0.0"
files:
- src/path/to/file.ts
last_updated: YYYY-MM-DD
status: active
---Feature Name
Feature Name
Purpose
Purpose
What this feature does and why it exists.
该功能的作用及其存在的原因。
Architecture
Architecture
mermaid
flowchart TD
A[Entry Point] --> B{Router}
B --> C[Handler]
C --> D[Service Layer]
class A,B,C,D internal-link;mermaid
flowchart TD
A[Entry Point] --> B{Router}
B --> C[Handler]
C --> D[Service Layer]
class A,B,C,D internal-link;Key Files
Key Files
- — Main entry point
src/path/to/file.ts
- — 主入口点
src/path/to/file.ts
Dependencies
Dependencies
- Internal: [[features/auth|Authentication]]
- Concepts: [[concepts/health-data-model|Health Data Model]]
- Interfaces: [[interfaces/api-contract|API Contract]]
- External: express, lodash
- Internal: [[features/auth|Authentication]]
- Concepts: [[concepts/health-data-model|Health Data Model]]
- Interfaces: [[interfaces/api-contract|API Contract]]
- External: express, lodash
API Surface
API Surface
Key exports, endpoints, or interfaces.
关键导出、端点或接口。
Notes
Notes
Gotchas, tech debt, planned changes.
Tags: `doctrack/type/feature`, `doctrack/status/active`, `doctrack/audience/claude`注意事项、技术债务、计划中的变更。
标签:`doctrack/type/feature`, `doctrack/status/active`, `doctrack/audience/claude`Component note (components/{feature}/{name}.md
)
components/{feature}/{name}.md组件笔记(components/{feature}/{name}.md
)
components/{feature}/{name}.mdmarkdown
---
feature: parent-feature
type: component
files:
- src/path/to/component.ts
last_updated: YYYY-MM-DD
status: active
---markdown
---
feature: parent-feature
type: component
files:
- src/path/to/component.ts
last_updated: YYYY-MM-DD
status: active
---Component Name
Component Name
Responsibility
Responsibility
Single-sentence description.
单句描述组件职责。
Internal Logic
Internal Logic
mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Active : trigger()
Active --> Idle : complete()mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Active : trigger()
Active --> Idle : complete()Relationships
Relationships
- Used by: [[features/auth|Authentication]]
- Depends on: [[features/database|Database]]
- Implements: [[interfaces/session-contract|Session Contract]]
Tags: `doctrack/type/component`, `doctrack/status/active`, `doctrack/audience/claude`- Used by: [[features/auth|Authentication]]
- Depends on: [[features/database|Database]]
- Implements: [[interfaces/session-contract|Session Contract]]
标签:`doctrack/type/component`, `doctrack/status/active`, `doctrack/audience/claude`Concept note (concepts/{name}.md
)
concepts/{name}.md概念笔记(concepts/{name}.md
)
concepts/{name}.mdCross-cutting ideas that span multiple features. Create one when a pattern, model, or architectural idea connects disparate parts of the codebase.
markdown
---
type: concept
related_features:
- feature-a
- feature-b
last_updated: YYYY-MM-DD
status: active
---跨多个功能的通用理念。当某个模式、模型或架构理念连接代码库中不同部分时,创建概念笔记。
markdown
---
type: concept
related_features:
- feature-a
- feature-b
last_updated: YYYY-MM-DD
status: active
---Concept Name
Concept Name
What it is
What it is
Clear explanation and why it matters.
清晰的解释及其重要性。
Where it appears
Where it appears
mermaid
graph LR
C[Concept] --> F1[Feature A]
C --> F2[Feature B]
C --> I[Interface]
class C,F1,F2,I internal-link;- [[features/feature-a|Feature A]] — How it uses this concept
- [[features/feature-b|Feature B]] — How it uses this concept
mermaid
graph LR
C[Concept] --> F1[Feature A]
C --> F2[Feature B]
C --> I[Interface]
class C,F1,F2,I internal-link;- [[features/feature-a|Feature A]] — 该功能如何使用此概念
- [[features/feature-b|Feature B]] — 该功能如何使用此概念
Key decisions
Key decisions
- [[decisions/relevant-decision|Why we chose this approach]]
Tags: `doctrack/type/concept`, `doctrack/status/active`, `doctrack/audience/claude`- [[decisions/relevant-decision|Why we chose this approach]]
标签:`doctrack/type/concept`, `doctrack/status/active`, `doctrack/audience/claude`Decision note (decisions/{name}.md
)
decisions/{name}.md决策笔记(decisions/{name}.md
)
decisions/{name}.mdRecords why something was built a certain way — including rejected alternatives. This prevents re-proposing approaches that were already considered.
markdown
---
type: decision
status: accepted|rejected|superseded
date: YYYY-MM-DD
superseded_by: other-decision # only if superseded
related_features:
- feature-a
last_updated: YYYY-MM-DD
---记录为何采用当前构建方式——包括被否决的备选方案。这可以避免重新提出已被考虑过的方案。
markdown
---
type: decision
status: accepted|rejected|superseded
date: YYYY-MM-DD
superseded_by: other-decision # 仅当被取代时填写
related_features:
- feature-a
last_updated: YYYY-MM-DD
---Decision: Title
Decision: Title
Status
Status
Accepted | Rejected | Superseded by [[decisions/other|Other]]
Accepted | Rejected | Superseded by [[decisions/other|Other]]
Context
Context
What problem were we solving? What constraints existed?
我们要解决什么问题?存在哪些约束条件?
Decision
Decision
What we chose (or chose NOT to do, if rejected).
我们选择的方案(如果是被否决的,则是我们选择不做的事情)。
Alternatives considered
Alternatives considered
| Alternative | Pros | Cons | Why rejected |
|---|---|---|---|
| Option A | Fast | Fragile | Couldn't handle scale |
| Option B | Simple | Limited | Missing feature X |
| Alternative | Pros | Cons | Why rejected |
|---|---|---|---|
| Option A | 快速 | 脆弱 | 无法处理大规模场景 |
| Option B | 简单 | 功能有限 | 缺少功能X |
Consequences
Consequences
What changed. Trade-offs accepted. Known limitations.
Tags: `doctrack/type/decision`, `doctrack/status/{accepted|rejected}`, `doctrack/audience/claude`
**When to create decisions:**
- Non-trivial architectural choices
- When you or the user reject an approach — document why
- When the user says "we tried X and it didn't work because Y"
- When a decision constrains future work带来的变化。接受的权衡。已知的局限性。
标签:`doctrack/type/decision`, `doctrack/status/{accepted|rejected}`, `doctrack/audience/claude`
**何时创建决策笔记:**
- 非 trivial 的架构选择
- 当你或用户否决某个方案时——记录原因
- 当用户说"我们尝试过X但因为Y失败了"时
- 当某个决策会限制未来工作时Interface note (interfaces/{name}.md
)
interfaces/{name}.md接口笔记(interfaces/{name}.md
)
interfaces/{name}.mdContracts between features or packages — boundaries where different parts meet.
markdown
---
type: interface
implementors:
- feature-a
- feature-b
consumers:
- feature-c
last_updated: YYYY-MM-DD
status: active
---功能或包之间的契约——不同部分的交互边界。
markdown
---
type: interface
implementors:
- feature-a
- feature-b
consumers:
- feature-c
last_updated: YYYY-MM-DD
status: active
---Interface: Name
Interface: Name
Contract
Contract
mermaid
classDiagram
class HealthData {
+String _id
+int current_heart_rate
+int total_steps
}mermaid
classDiagram
class HealthData {
+String _id
+int current_heart_rate
+int total_steps
}Implementors
Implementors
- [[features/feature-a|Feature A]] — Produces this data
- [[features/feature-a|Feature A]] — 生成此数据
Consumers
Consumers
- [[features/feature-c|Feature C]] — Receives and validates
- [[features/feature-c|Feature C]] — 接收并验证此数据
Validation rules
Validation rules
Key constraints on the contract.
Tags: `doctrack/type/interface`, `doctrack/status/active`, `doctrack/audience/claude`契约的关键约束条件。
标签:`doctrack/type/interface`, `doctrack/status/active`, `doctrack/audience/claude`Guide note (guides/{name}.md
)
guides/{name}.md指南笔记(guides/{name}.md
)
guides/{name}.mdProcedural docs only — things a developer follows step-by-step.
Valid guides: , , ,
deployment.mddevelopment.mdsetup.mdtesting.mdNOT guides: architecture overviews (→ concepts), feature explanations (→ features), API docs (→ specs/interfaces).
Tags: , ,
doctrack/type/guidedoctrack/status/activedoctrack/audience/human仅包含流程类文档——开发者需要逐步遵循的操作步骤。
有效的指南:, , ,
deployment.mddevelopment.mdsetup.mdtesting.md非指南内容:架构概述(→ 概念)、功能说明(→ 功能)、API文档(→ 规范/接口)。
标签:, ,
doctrack/type/guidedoctrack/status/activedoctrack/audience/humanDoctrack MCP integration
Doctrack MCP集成
When the MCP server is available (tools prefixed ), use it to write better documentation and keep the vault healthy. The MCP server maintains a bidirectional index between code symbols and vault notes.
doctrackmcp__doctrack__当 MCP服务器可用时(工具前缀为),使用它来编写更优质的文档并保持vault的健康状态。MCP服务器维护代码符号与vault笔记之间的双向索引。
doctrackmcp__doctrack__Available tools
可用工具
| Tool | Input | Purpose |
|---|---|---|
| | Check a note for stale refs, broken wikilinks, ambiguous references |
| | Find all vault notes that document a code file |
| | Look up where a symbol is defined and which notes reference it |
| | After code changes, find which vault notes may need updating |
| (none) | Scan vault and generate prioritized plan of stale documentation |
| (none) | Vault health — note count, code files, link coverage, undocumented files |
| (none) | Full list of broken file refs and wikilinks across the vault |
| | Fuzzy search across note titles, summaries, tags, and code symbols |
| 工具 | 输入 | 用途 |
|---|---|---|
| | 检查笔记是否存在过时引用、无效wikilinks、模糊引用 |
| | 查找所有记录了该代码文件的vault笔记 |
| | 查找符号的定义位置以及哪些笔记引用了它 |
| | 代码变更后,查找哪些vault笔记可能需要更新 |
| (无) | 扫描vault并生成按优先级排序的过时文档计划 |
| (无) | vault健康状况——笔记数量、代码文件、链接覆盖率、未记录的文件 |
| (无) | 列出vault中所有无效文件引用和wikilinks |
| | 对笔记标题、摘要、标签和代码符号进行模糊搜索 |
During code changes
代码变更期间
-
Before modifying code: Callwith the file you're about to change. Read the linked vault notes to understand the documented architecture and contracts before making changes.
docs_for_file -
After modifying code: Callwith the changed file path to see which vault notes reference it. Update those notes if the changes affect documented behavior, renamed symbols, or moved files.
check_impact
-
修改代码前:调用传入你要修改的文件。在修改前,读取关联的vault笔记以了解已记录的架构和契约。
docs_for_file -
修改代码后:调用传入已更改的文件路径,查看哪些vault笔记引用了该文件。如果变更影响了已记录的行为、重命名了符号或移动了文件,更新这些笔记。
check_impact
During documentation writing
文档编写期间
-
Before writing a note: Callto get accurate file paths and line numbers for symbols you're documenting. Use the resolved paths in
resolve_symbolfrontmatter andfiles:entries — don't guess or abbreviate paths.file-registry -
After writing or updating a note: Callwith the note path (relative to vault root, e.g.
validate_note). Fix any stale references, ambiguous file refs, or broken wikilinks it reports before moving on.features/auth.md
-
编写笔记前:调用获取你要记录的符号的准确文件路径和行号。在
resolve_symbol前置元数据和files:条目中使用解析后的路径——不要猜测或缩写路径。file-registry -
编写或更新笔记后:调用传入笔记路径(相对于vault根目录,例如
validate_note)。在继续下一步前,修复它报告的所有过时引用、模糊文件引用或无效wikilinks。features/auth.md
Refreshing stale documentation
刷新过时文档
Call to get a prioritized plan of what needs updating. It compares note timestamps against code file modification times, detects new/missing symbols, and finds broken references. Use it:
refresh_docslast_updated- At session start (after reading ) to see what's drifted since last session
_project.md - After a batch of code changes to identify all impacted docs at once
- After updating docs to verify nothing remains stale (idempotent — returns empty when everything is current)
The tool returns a prioritized list (HIGH/MEDIUM/LOW) with specific reasons per note. Work through them in priority order — HIGH means broken refs or code changed significantly, LOW means minor symbol drift.
调用获取按优先级排序的更新计划。它会比较笔记的时间戳与代码文件的修改时间,检测新的/缺失的符号,并查找无效引用。可在以下场景使用:
refresh_docslast_updated- 会话开始时(读取后)查看自上次会话以来的变更
_project.md - 批量代码变更后一次性识别所有受影响的文档
- 更新文档后验证是否还有过时内容(幂等操作——当所有内容都是最新时返回空)
该工具返回按优先级排序的列表(高/中/低),并附带每个笔记的具体原因。按优先级顺序处理——高优先级表示存在无效引用或代码发生了重大变更,低优先级表示符号有轻微变化。
For vault health
Vault健康维护
- Call during Phase 4 verification to see overall vault health, undocumented code files, and stale reference counts.
coverage_report - Call to get the full list of broken references for a cleanup pass.
stale_report - Call to find existing notes before creating duplicates.
search_index
- 在第4阶段验证期间调用查看整体vault健康状况、未记录的代码文件和过时引用数量。
coverage_report - 调用获取所有无效引用的完整列表以进行清理。
stale_report - 在创建重复笔记前调用查找现有笔记。
search_index
File path best practices (for MCP indexing)
文件路径最佳实践(针对MCP索引)
The MCP server resolves file references in your notes. Help it by:
- Use full relative paths in frontmatter:
files:notcustom-actions/src/main/java/com/iointel/ci/actions/Action.javaorAction.java.../Action.java - Avoid abbreviations in paths — the indexer can expand them but full paths are more reliable
... - Avoid glob patterns like in file references — they can't be resolved
*Exception.java - Use backtick code spans for inline file references: — the indexer extracts these
`src/auth/session.rs`
MCP服务器会解析笔记中的文件引用。遵循以下规则以帮助它正确解析:
- 在前置元数据中使用完整相对路径:例如
files:而非custom-actions/src/main/java/com/iointel/ci/actions/Action.java或Action.java.../Action.java - 避免使用缩写路径——索引器可以展开它们,但完整路径更可靠
... - 避免在文件引用中使用通配符模式如——无法被解析
*Exception.java - 对行内文件引用使用反引号代码块:——索引器会提取这些内容
`src/auth/session.rs`
Important principles
重要原则
-
Read before writing. Search for existing notes before creating new ones.
-
Dense internal docs. Features and components are for Claude — pack them with information.
-
Document decisions, especially rejections. The "why not" is as valuable as the "why."
-
Concepts connect the graph. When a pattern spans features, create a concept note and link everything to it.
-
Interfaces define boundaries. When features communicate, document the contract.
-
Guides are procedural only. Build, deploy, test, setup. Not explanations.
-
Mermaid everywhere. All diagrams. No ASCII art. Useto make nodes clickable links to notes — never put
class NodeId internal-link;inside Mermaid code blocks.[[wikilinks]] -
Incremental updates. Surgical edits, not full rewrites.
-
Timestamp everything. Updateon every modification.
last_updated -
Local vault is the default.in the project directory, committed to git.
.doctrack/ -
Wikilinks are edges. Every cross-reference usessyntax.
[[path|Display]]
-
先读后写。创建新笔记前先搜索现有笔记。
-
高密度的内部文档。功能和组件笔记是给Claude看的——尽可能填充详细信息。
-
记录决策,尤其是被否决的方案。"为什么不做"和"为什么做"同样重要。
-
概念连接知识图谱。当某个模式跨多个功能时,创建概念笔记并将所有相关内容链接到它。
-
接口定义边界。当功能之间进行通信时,记录契约。
-
指南仅包含流程。构建、部署、测试、设置。不包含解释性内容。
-
所有图表使用Mermaid。全部使用Mermaid,不使用ASCII图。在Mermaid节点中使用使节点成为可点击的笔记链接——绝对不要在Mermaid代码块内使用
class NodeId internal-link;。[[wikilinks]] -
增量更新。进行小范围的精准编辑,而非全量重写。
-
所有内容都添加时间戳。每次修改时更新。
last_updated -
默认使用本地vault。项目目录下的,提交至git。
.doctrack/ -
Wikilinks是关联边。所有交叉引用都使用语法。
[[path|Display]]
Version tracking and migration
版本跟踪与迁移
Current version: .
3.0.0当前版本:。
3.0.0Version history
版本历史
| Version | Key changes |
|---|---|
| 1.x | Filesystem-only ( |
| 2.0 | Local Obsidian vault ( |
| 3.0 | Companion |
| 版本 | 主要变更 |
|---|---|
| 1.x | 仅基于文件系统( |
| 2.0 | 本地Obsidian vault( |
| 3.0 | 配套的 |
Version checking (during session init)
版本检查(会话初始化期间)
After reading , check :
_project.mddoctrack_version- Missing → v1.x filesystem docs. Offer migration.
- Matches → proceed normally.
- Same major, older minor → proceed, silently update version stamp.
- Older major → inform user, offer migration. Don't auto-migrate.
- Newer than skill → warn user, proceed carefully.
读取后,检查:
_project.mddoctrack_version- 缺失 → v1.x文件系统文档。提供迁移选项。
- 匹配 → 正常继续。
- 主版本相同,次版本较旧 → 继续,静默更新版本标记。
- 主版本较旧 → 告知用户,提供迁移选项。不要自动迁移。
- 版本比技能新 → 警告用户,谨慎继续。
Migration: v1 → v3
迁移:v1 → v3
When exists but no :
.claude_docs/.doctrack/- Read v1 docs (index, features, components — they have structured frontmatter)
- Create vault with
.doctrack/and.obsidian/.gitignore - Convert v1 notes to vault notes (convert cross-refs to wikilinks, add tags)
- Extract implicit concepts and decisions from v1 content
- Write from v1 index
_project.md - Write section
CLAUDE.md - Ask user: archive or clean up old and
.claude_docs/docs/
当存在但不存在时:
.claude_docs/.doctrack/- 读取v1文档(索引、功能、组件——它们有结构化的前置元数据)
- 创建vault,包含
.doctrack/和.obsidian/.gitignore - 将v1笔记转换为vault笔记(将交叉引用转换为wikilinks,添加标签)
- 从v1内容中提取隐含的概念和决策
- 根据v1索引编写
_project.md - 编写部分
CLAUDE.md - 询问用户是否要将文件系统中的副本归档到。
.doctrack/archive/
Migration: v2 → v3
迁移:v2 → v3
When exists with :
_project.mddoctrack_version: "2.x"- Add ,
concepts/,decisions/directoriesinterfaces/ - Move non-procedural guides to or deprecate
concepts/ - Convert ASCII art to Mermaid in existing notes
- Update version stamp
- If vault is external, offer to move to local
.doctrack/
当存在且时:
_project.mddoctrack_version: "2.x"- 添加、
concepts/、decisions/目录interfaces/ - 将非流程类指南移动到或标记为过时
concepts/ - 将现有笔记中的ASCII图转换为Mermaid
- 更新版本标记
- 如果vault在外部,提供将其移动到本地的选项
.doctrack/
Project initialization
项目初始化
When the user says "doctrack init" or asks to document a project.
当用户说"doctrack init"或要求记录项目文档时。
Pre-init
预初始化
Step 1: Install dependencies
步骤1:安装依赖
Check for obsidian skill: Look for tools in the available tools.
mcp__obsidian__*If MCP tools are NOT available:
-
Check ifexists in the project root. If it has an
.mcp.jsonserver entry, the MCP server is configured but Claude Code needs a restart.obsidian -
If no, check if the obsidian skill is installed by looking for
.mcp.jsonor.claude/skills/obsidian/..agents/skills/obsidian/ -
If the obsidian skill is not installed, install it:bash
npx skills add bitbonsai/mcpvault --yes -
Create or updatein the project root:
.mcp.jsonjson{ "mcpServers": { "obsidian": { "command": "npx", "args": ["@bitbonsai/mcpvault@latest", ".doctrack"] }, "doctrack": { "command": "doctrack-mcp" } } }Always use relative paths —not absolute. Claude Code sets the working directory to the project root when spawning MCP servers..doctrackdefaults to the current directory whendoctrack-mcpis not set. This ensures the config works across clones, worktrees, and users.DOCTRACK_ROOTIfalready exists with other servers, merge the entries — don't overwrite existing config. The.mcp.jsonserver is optional — only add it ifdoctrackis installed (doctrack-mcp). If not installed, skip it and note that the doctrack MCP tools won't be available.which doctrack-mcp -
Also create thedirectory,
.doctrack/, and.doctrack/.obsidian/now — so the vault path in.doctrack/.gitignoreis valid when the MCP server starts..mcp.json -
Set up doctrack MCP server. Check ifis on PATH:
doctrack-mcpbashwhich doctrack-mcpIf not found, try to install it automatically:bashcargo install --git https://github.com/liamstar97/doctrack.git dt-mcpIfis not available either, tell the user: "Install Rust (https://rustup.rs) and runcargofor code↔doc indexing tools, or skip it — the vault will still work without it." Then remove thecargo install dt-mcpentry fromdoctrack(only keep.mcp.json).obsidianOnceis available:doctrack-mcp- The entry in
doctrack(step 4) will work as-is..mcp.json - Install hooks: run in the project directory. This adds SessionStart and PostToolUse hooks to
doctrack-mcp --setup-hooksfor proactive code↔doc feedback..claude/settings.json
- The
-
STOP and tell the user to restart. This is critical — you MUST clearly tell the user:"I've set up the doctrack dependencies:
- Installed the obsidian skill (mcpvault)
- Configured the MCP server(s) in
.mcp.json - Created the vault directory
.doctrack/ - Installed Claude Code hooks (if doctrack-mcp is available)
Please restart Claude Code (exit and relaunch), then sayagain. The MCP server needs a restart to connect to the vault."doctrack initAfter delivering this message, do not continue with init. Do not attempt to write vault notes, create features, or do any documentation work. The MCP connection will not be available until after the restart. End your response here.
If MCP tools ARE available → proceed to step 2.
检查obsidian技能:在可用工具中查找工具。
mcp__obsidian__*如果MCP工具不可用:
-
检查项目根目录下是否存在。如果它包含
.mcp.json服务器条目,则MCP服务器已配置但Claude Code需要重启。obsidian -
如果没有,通过查找
.mcp.json或.claude/skills/obsidian/来检查obsidian技能是否已安装。.agents/skills/obsidian/ -
如果obsidian技能未安装,安装它:bash
npx skills add bitbonsai/mcpvault --yes -
在项目根目录下创建或更新:
.mcp.jsonjson{ "mcpServers": { "obsidian": { "command": "npx", "args": ["@bitbonsai/mcpvault@latest", ".doctrack"] }, "doctrack": { "command": "doctrack-mcp" } } }始终使用相对路径——而非绝对路径。Claude Code在启动MCP服务器时会将工作目录设置为项目根目录。当未设置.doctrack时,DOCTRACK_ROOT默认使用当前目录。这确保配置在不同克隆、工作树和用户环境中都能正常工作。doctrack-mcp如果已存在且包含其他服务器条目,合并条目——不要覆盖现有配置。.mcp.json服务器是可选的——仅当doctrack已安装时添加(通过doctrack-mcp检查)。如果未安装,跳过它并记录doctrack MCP工具不可用。which doctrack-mcp -
同时创建目录、
.doctrack/和.doctrack/.obsidian/——这样当MCP服务器启动时,.doctrack/.gitignore中的vault路径是有效的。.mcp.json -
设置doctrack MCP服务器。检查是否在PATH中:
doctrack-mcpbashwhich doctrack-mcp如果未找到,尝试自动安装:bashcargo install --git https://github.com/liamstar97/doctrack.git dt-mcp如果也不可用,告知用户:"安装Rust(https://rustup.rs)并运行`cargo install dt-mcpcargo.mcp.json以获取代码与文档的索引工具,或者跳过此步骤——vault在没有它的情况下仍可工作。" 然后从doctrack中移除obsidian`)。条目(仅保留一旦可用:doctrack-mcp- 中的
.mcp.json条目(步骤4)将按原样工作。doctrack - 安装钩子:在项目目录中运行。这会在
doctrack-mcp --setup-hooks中添加SessionStart和PostToolUse钩子,以实现主动的代码与文档反馈。.claude/settings.json
-
停止并告知用户重启。这非常关键——你必须明确告知用户:"我已设置好doctrack的依赖:
- 安装了obsidian技能(mcpvault)
- 在中配置了MCP服务器
.mcp.json - 创建了vault目录
.doctrack/ - 安装了Claude Code钩子(如果doctrack-mcp可用)
请重启Claude Code(退出并重新启动),然后输入继续。MCP服务器需要重启才能连接到vault。"doctrack init发送此消息后,不要继续初始化。不要尝试写入vault笔记、创建功能或进行任何文档工作。在重启前,MCP连接不可用。在此处结束响应。
如果MCP工具可用 → 进入步骤2。
Step 2: Create local vault
步骤2:创建本地vault
- Create directory on the filesystem
.doctrack/ - Create for Obsidian config
.doctrack/.obsidian/ - Write :
.doctrack/.gitignore.obsidian/workspace.json .obsidian/workspace-mobile.json .obsidian/appearance.json .obsidian/hotkeys.json .obsidian/app.json .obsidian/graph.json - Verify MCP can reach the vault: try a simple call. If it fails, the MCP server may be pointed at a different path — update
get_vault_statsand tell the user to restart..mcp.json - Open the vault in Obsidian via the obsidian skill's CLI: . If Obsidian CLI isn't available, tell the user: "Open
obsidian open path="{absolute-path}/.doctrack"as a vault in Obsidian to browse the knowledge graph.".doctrack/
- 在文件系统中创建目录
.doctrack/ - 创建用于存储Obsidian配置
.doctrack/.obsidian/ - 编写:
.doctrack/.gitignore.obsidian/workspace.json .obsidian/workspace-mobile.json .obsidian/appearance.json .obsidian/hotkeys.json .obsidian/app.json .obsidian/graph.json - 验证MCP能否访问vault:尝试调用简单的。如果失败,MCP服务器可能指向了其他路径——更新
get_vault_stats并告知用户重启。.mcp.json - 通过obsidian技能的CLI在Obsidian中打开vault:。如果Obsidian CLI不可用,告知用户:"在Obsidian中打开
obsidian open path="{absolute-path}/.doctrack"作为vault以浏览知识图谱。".doctrack/
Step 3: Detect project name
步骤3:检测项目名称
From field, directory name, or ask the user.
package.jsonname从的字段、目录名称获取,或询问用户。
package.jsonnameStep 4: Check for existing doctrack data
步骤4:检查现有doctrack数据
- on filesystem → v1, offer migration (see Version tracking)
.claude_docs/ - in vault → already initialized, ask to re-init or abort
_project.md
- 文件系统中的→ v1版本,提供迁移选项(参见版本跟踪部分)
.claude_docs/ - vault中的→ 已初始化,询问用户是重新初始化还是终止
_project.md
Step 5: Check for monorepo
步骤5:检查是否为单体仓库
Check for any of these indicators:
- JS/TS: in
workspaces,package.json,pnpm-workspace.yaml,lerna.json,turbo.jsonnx.json - Java/Kotlin: section in
<modules>(Maven multi-module),pom.xmlinincludeorsettings.gradle(Gradle multi-project)settings.gradle.kts - Rust: in root
[workspace]Cargo.toml - Go: Multiple files in subdirectories
go.mod - Git: file (git submodules)
.gitmodules - General: ,
packages/,apps/, orservices/directories containing multiple sub-projects with their own build configslibs/ - Multi-platform: Multiple independent sub-projects with their own directories under one parent
.git
检查以下任何一项指标:
- JS/TS:中的
package.json、workspaces、pnpm-workspace.yaml、lerna.json、turbo.jsonnx.json - Java/Kotlin:中的
pom.xml部分(Maven多模块)、<modules>或settings.gradle中的settings.gradle.kts(Gradle多项目)include - Rust:根目录中的
Cargo.toml[workspace] - Go:子目录中有多个文件
go.mod - Git:文件(git子模块)
.gitmodules - 通用:、
packages/、apps/或services/目录包含多个子项目,且每个子项目有自己的构建配置libs/ - 多平台:一个父目录下有多个独立的子项目,每个子项目有自己的目录
.git
Init strategy: depth-first, write-as-you-go, resumable
初始化策略:深度优先、边写边存、可恢复
Doctrack uses a depth-first approach with immediate writes and checkpoint tracking. This is critical for large projects where sessions may be interrupted by usage limits, timeouts, or restarts.
Core principles:
- Process one module at a time in depth, not all modules broadly
- Write each note to the vault immediately after creating it — don't batch writes
- Checkpoint progress in after each module completes
_project.md - On resume, detect what's already documented and continue where you left off
Doctrack采用深度优先的方法,结合立即写入和检查点跟踪。这对于大型项目至关重要,因为会话可能会因使用限制、超时或重启而中断。
核心原则:
- 一次深度处理一个模块,而非广泛处理所有模块
- 创建每个笔记后立即写入vault——不要批量写入
- 每个模块完成后在中记录检查点
_project.md - 恢复时,检测已记录的内容并从中断处继续
Phase 1: Lightweight discovery
阶段1:轻量级发现
Read only build config and directory structure — do not read source files yet.
-
Read build config —,
pom.xml,package.json,build.gradle, etc. Identify modules/packages and their dependencies.Cargo.toml -
List modules — from build config or top-level directories. For each module, note: name, path, estimated size (file count via glob).
-
Import existing docs — this step is important, don't skip it. Search the project for:
- at root and in each module
README.md - with project context
CLAUDE.md - ,
docs/,documentation/directorieswiki/ - Architecture decision records (,
adr/)decisions/ - API specs, design docs, runbooks, files in non-source directories
.md
For each found doc, write it toin the vault with frontmatter includingreferences/imported/{filename}.md. Tag withoriginal_path. These are valuable source material — they often contain architectural context, decisions, and domain knowledge not visible in code.doctrack/type/referenceAsk user about archiving filesystem copies to..doctrack/archive/ -
Sort modules by dependency order — foundation/shared modules first. If unclear, smallest first.
-
Write initial— module list with a
_project.mdcolumn tracking init progress:Status
markdown
undefined仅读取构建配置和目录结构——暂时不要读取源文件。
-
读取构建配置 ——、
pom.xml、package.json、build.gradle等。识别模块/包及其依赖。Cargo.toml -
列出模块 —— 从构建配置或顶级目录中获取。对于每个模块,记录:名称、路径、估计大小(通过通配符统计文件数量)。
-
导入现有文档 —— 这一步很重要,不要跳过。在项目中搜索:
- 根目录和每个模块中的
README.md - 包含项目上下文的
CLAUDE.md - 、
docs/、documentation/目录wiki/ - 架构决策记录(、
adr/)decisions/ - API规范、设计文档、运行手册、非源目录中的文件
.md
对于每个找到的文档,将其写入vault中的,并在前置元数据中包含references/imported/{filename}.md。添加标签original_path。这些是有价值的源材料——它们通常包含架构上下文、决策和领域知识,这些在代码中是不可见的。doctrack/type/reference询问用户是否要将文件系统中的副本归档到。.doctrack/archive/ - 根目录和每个模块中的
-
按依赖顺序排序模块 —— 先处理基础/共享模块。如果不确定,先处理最小的模块。
-
编写初始的—— 包含模块列表和跟踪初始化进度的
_project.md列:Status
markdown
undefinedInit Progress
Init Progress
Current phase: phase-1
Current phase: phase-1
Modules
Modules
| Module | Files | Status | Components |
|---|---|---|---|
| ci-model | 43 | pending | — |
| ci-common | 11 | pending | — |
| story-service | 300 | pending | — |
| Module | Files | Status | Components |
|---|---|---|---|
| ci-model | 43 | pending | — |
| ci-common | 11 | pending | — |
| story-service | 300 | pending | — |
Phase 3 Checklist
Phase 3 Checklist
| Category | Target | Created | Status |
|---|---|---|---|
| Concepts | 6-10 | 0 | pending |
| Decisions | 5-8 | 0 | pending |
| Interfaces | 4-8 | 0 | pending |
| References | all docs | 0 | pending |
| README | — | — | pending |
| CLAUDE.md | — | — | pending |
| Guides | — | — | pending |
This is the **checkpoint**. It tracks progress across ALL phases:
- **`Current phase`** — which phase the init is in (`phase-1`, `phase-2`, `phase-3`, `phase-4`, `complete`). Updated when transitioning between phases.
- **Modules table** — Phase 2 progress. Update each module to `done` with component count after completing it.
- **Phase 3 Checklist** — tracks cross-cutting note creation. Update `Created` count and `Status` after writing each category. This prevents Phase 3 from re-running on resume if it already completed.
On resume, read this checkpoint to determine:
1. Which phase to start from
2. Which modules still need documenting (Phase 2)
3. Which Phase 3 categories still need work| Category | Target | Created | Status |
|---|---|---|---|
| Concepts | 6-10 | 0 | pending |
| Decisions | 5-8 | 0 | pending |
| Interfaces | 4-8 | 0 | pending |
| References | all docs | 0 | pending |
| README | — | — | pending |
| CLAUDE.md | — | — | pending |
| Guides | — | — | pending |
这是**检查点**。它跟踪所有阶段的进度:
- **`Current phase`** —— 初始化所处的阶段(`phase-1`、`phase-2`、`phase-3`、`phase-4`、`complete`)。在阶段转换时更新。
- **Modules表格** —— 阶段2的进度。每个模块完成后,将其状态更新为`done`并填写组件数量。
- **Phase 3 Checklist** —— 跟踪跨模块笔记的创建。编写每个分类的笔记后,更新`Created`数量和`Status`。这可以防止阶段3在恢复时重复执行(如果已完成)。
恢复时,读取此检查点以确定:
1. 从哪个阶段开始
2. 哪些模块仍需要记录(阶段2)
3. 阶段3中哪些分类仍需要处理Phase 2: Deep-dive modules (depth-first, write-as-you-go)
阶段2:深度处理模块(深度优先、边写边存)
Process modules one at a time (or 2-3 independent modules in parallel). For each module, follow this sequence — writing each note immediately, not batching:
Step A: Read source files for this module in small groups (5-10 files at a time for large modules). As you read each group, identify what component it belongs to.
Step B: Write the feature note immediately. Don't wait until you've read all files — write a draft feature note after reading enough to understand the architecture (first 10-15 files). You can patch it later with additional details. Getting the note into the vault early means it survives interruption.
Step C: Write each component note as you identify it. This is the critical change from batch writing: as soon as you understand a logical unit (a controller, a service, a model group), write its component note immediately. Then move to the next group of source files. This way, if the session ends mid-module, the components you've already written are preserved.
Component notes are not optional. Guidelines:
| Module size | Expected components |
|---|---|
| 1-2 files | 0 (feature note is sufficient) |
| 3-10 files | 2-5 components |
| 10-30 files | 5-15 components |
| 30-100 files | 15-30 components |
| 100+ files | 30+ components |
Step D: Tag each note immediately after writing it. Don't defer tagging to a batch step.
Step E: Checkpoint. After finishing a module (feature + all components), update via :
_project.mdpatch_note- Set to
Current phase(if not already)phase-2 - Set this module's row in the Modules table to with component count
done - Add file registry entries for this module (individual source files)
- This is the checkpoint — if the session ends here, the next session knows this module is complete
Step F: Note cross-cutting observations as you go — shared patterns, architectural choices, contracts. Collect these for Phase 3 but don't write them yet.
Step G: Move to the next module.
Parallelization: Spawn subagents for 2-3 independent modules at a time — but each subagent must follow the write-as-you-go pattern internally. Don't spawn all modules in parallel.
Give each subagent this context:
You are documenting the "{module-name}" module for doctrack. Go DEEP.
Module path: {path}
Source files: {count} files
Module dependencies: {list of other modules this depends on}
Already-documented modules (for cross-referencing): {list with vault paths}
CRITICAL: Write each note IMMEDIATELY after creating it — do NOT batch writes.
The session may end at any time due to usage limits. Every note you write to
the vault before that happens is preserved. Every note you defer is lost.
Workflow:
1. Read source files in groups of 5-10
2. Write features/{module-name}.md as soon as you understand the architecture
3. Write components/{module-name}/{component}.md ONE AT A TIME as you identify each
4. Tag each note immediately after writing
5. Return: vault paths created + file registry entries (individual files)
A module with {count} files should produce roughly {count/5 to count/3} components.
Use internal-link class in Mermaid nodes. Use [[wikilinks]] in markdown content only.
Do NOT use classDef with hex colors (#e1f5fe etc.) — Obsidian creates spurious tags.
Vault paths must be clean note paths (e.g., features/auth.md, components/auth/token.md).
Never write notes with paths containing wildcards, code patterns, or Java package names.一次处理一个模块(或同时处理2-3个独立模块)。对于每个模块,遵循以下流程——立即编写每个笔记,不要批量处理:
步骤A:读取源文件 对于大型模块,分小组读取(每次5-10个文件)。读取每个小组时,识别它属于哪个组件。
步骤B:立即编写功能笔记。不要等到读取完所有文件——在读取足够多的文件以理解架构后(前10-15个文件),就编写功能笔记的草稿。之后可以补充更多细节。尽早将笔记写入vault意味着即使会话中断,它也能保留下来。
步骤C:识别到组件后立即编写每个组件笔记。这与批量编写的关键区别在于:一旦你理解了一个逻辑单元(控制器、服务、模型组),就立即编写其组件笔记。然后继续读取下一组源文件。这样,即使会话在处理模块中途结束,你已经编写的组件也会被保留。
组件笔记是必须的。参考指南:
| 模块大小 | 预期组件数量 |
|---|---|
| 1-2个文件 | 0(功能笔记已足够) |
| 3-10个文件 | 2-5个组件 |
| 10-30个文件 | 5-15个组件 |
| 30-100个文件 | 15-30个组件 |
| 100+个文件 | 30+个组件 |
步骤D:编写每个笔记后立即添加标签。不要将标签操作推迟到批量步骤。
步骤E:记录检查点。完成一个模块(功能+所有组件)后,通过更新:
patch_note_project.md- 将设置为
Current phase(如果尚未设置)phase-2 - 将该模块在Modules表格中的行设置为并填写组件数量
done - 为该模块添加文件注册表条目(单个源文件)
- 这是检查点——如果会话在此处结束,下一次会话会知道该模块已完成
步骤F:随时记录跨模块观察结果——共享模式、架构选择、契约。收集这些用于阶段3,但不要立即编写。
步骤G:处理下一个模块。
并行处理:为2-3个独立模块生成子代理——但每个子代理必须在内部遵循边写边存的模式。不要同时处理所有模块。
为每个子代理提供以下上下文:
你正在为doctrack记录"{module-name}"模块。请深入处理。
模块路径:{path}
源文件:{count}个文件
模块依赖:{该模块依赖的其他模块列表}
已记录的模块(用于交叉引用):{带vault路径的列表}
关键要求:创建每个笔记后**立即**写入——不要批量写入。
由于使用限制,会话可能随时结束。你在结束前写入vault的每个笔记都会被保留。你推迟写入的每个笔记都会丢失。
工作流:
1. 分小组读取源文件(每次5-10个)
2. 一旦理解了架构,立即编写features/{module-name}.md
3. 识别到每个组件后,**逐个**编写components/{module-name}/{component}.md
4. 编写每个笔记后立即添加标签
5. 返回:创建的vault路径 + 文件注册表条目(单个文件)
一个包含{count}个文件的模块应生成大约{count/5到count/3}个组件。
在Mermaid节点中使用internal-link类。仅在Markdown内容中使用[[wikilinks]]。
不要使用带十六进制颜色的classDef(#e1f5fe等)——Obsidian会创建不必要的标签。
Vault路径必须是清晰的笔记路径(例如features/auth.md、components/auth/token.md)。
永远不要编写路径中包含通配符、代码模式或Java包名的笔记。Phase 3: Build cross-cutting knowledge graph
阶段3:构建跨模块知识图谱
Update to in before starting.
Current phasephase-3_project.mdAfter all modules are documented (or as many as completed before interruption), this phase is equally important as Phase 2 — it's what turns isolated feature docs into a connected knowledge graph. Don't rush or skip it.
Write each note immediately (same write-as-you-go principle as Phase 2). Checkpoint after each sub-phase by updating the Phase 3 Checklist in .
_project.md开始前,在中将更新为。
_project.mdCurrent phasephase-3所有模块都已记录(或在中断前完成了尽可能多的模块)后,此阶段与阶段2同样重要——它将孤立的功能文档转换为互联的知识图谱。不要匆忙或跳过此阶段。
立即编写每个笔记(与阶段2相同的边写边存原则)。每个子阶段后记录检查点,更新中的Phase 3 Checklist。
_project.md3a. Concept notes
3a. 概念笔记
Create concept notes for every cross-cutting pattern that spans 2+ modules. Review the features you documented — what patterns appeared repeatedly?
Minimum guideline: A project with N modules should have roughly N/3 to N/2 concept notes. An 18-module project should produce 6-10 concepts.
Common concepts to look for:
- Shared architectural patterns (event-driven messaging, circuit breaker, audit logging)
- Domain models that cross module boundaries
- Infrastructure patterns (service discovery, config management, security model)
- Data flow patterns (ingestion pipeline, processing pipeline)
- Operational patterns (monitoring, logging, deployment)
Checkpoint: After writing all concept notes, update the Phase 3 Checklist in : set Concepts row to , .
_project.mdCreated: {count}Status: done为每个跨2+个模块的通用模式创建概念笔记。回顾你已记录的功能——哪些模式反复出现?
最低指南:一个有N个模块的项目应大约有N/3到N/2个概念笔记。一个18模块的项目应生成6-10个概念。
常见的概念类型:
- 共享架构模式(事件驱动消息、断路器、审计日志)
- 跨模块边界的领域模型
- 基础设施模式(服务发现、配置管理、安全模型)
- 数据流模式(摄入管道、处理管道)
- 操作模式(监控、日志、部署)
检查点:编写完所有概念笔记后,更新中的Phase 3 Checklist:将Concepts行设置为、。
_project.mdCreated: {count}Status: done3b. Decision notes
3b. 决策笔记
Create decision notes for every non-trivial architectural choice visible in the codebase. Look for:
- Technology choices (why this database? why this messaging system? why this framework?)
- Architectural patterns (why microservices? why event-driven? why this module structure?)
- Design tradeoffs visible in code comments, README, or existing docs
- Conventions that aren't obvious (why denormalized data? why this naming pattern?)
Minimum guideline: A project with N modules should have roughly N/3 decision notes. An 18-module project should produce 5-8 decisions. Each should include rejected alternatives.
Checkpoint: Update Decisions row in Phase 3 Checklist to with count.
done为代码库中每个非trivial的架构选择创建决策笔记。查找:
- 技术选择(为什么使用这个数据库?为什么使用这个消息系统?为什么使用这个框架?)
- 架构模式(为什么使用微服务?为什么使用事件驱动?为什么采用这种模块结构?)
- 代码注释、README或现有文档中可见的设计权衡
- 不明显的约定(为什么使用非规范化数据?为什么采用这种命名模式?)
最低指南:一个有N个模块的项目应大约有N/3个决策笔记。一个18模块的项目应生成5-8个决策。每个决策笔记应包含被否决的备选方案。
检查点:更新Phase 3 Checklist中的Decisions行为并填写数量。
done3c. Interface notes
3c. 接口笔记
Create interface notes for every contract between modules. Look for:
- Shared DTOs/models passed between services
- REST API contracts between services (Feign clients, HTTP endpoints)
- Message schemas (Kafka topics, event formats)
- Database document schemas shared across modules
- Plugin/extension interfaces
Minimum guideline: A project with inter-service communication should have at least one interface per communication channel. An 18-module microservices project should produce 4-8 interface notes.
Checkpoint: Update Interfaces row in Phase 3 Checklist to with count.
done为每个模块之间的契约创建接口笔记。查找:
- 服务之间传递的共享DTO/模型
- 服务之间的REST API契约(Feign客户端、HTTP端点)
- 消息模式(Kafka主题、事件格式)
- 跨模块共享的数据库文档模式
- 插件/扩展接口
最低指南:有服务间通信的项目应至少为每个通信通道创建一个接口笔记。一个18模块的微服务项目应生成4-8个接口笔记。
检查点:更新Phase 3 Checklist中的Interfaces行为并填写数量。
done3d. Import references
3d. 导入参考资料
Import any pre-existing documentation that wasn't captured in Phase 1:
- README files from modules
- Existing docs/, wiki/, or documentation directories
- Architecture decision records (ADRs)
- API specs, design docs, runbooks
- CLAUDE.md files with project context
Write each to in the vault. Tag with .
references/imported/{filename}.mddoctrack/type/referenceCheckpoint: Update References row in Phase 3 Checklist to with count.
done导入阶段1中未捕获的任何既有文档:
- 模块中的README文件
- 现有的docs/、wiki/或documentation目录
- 架构决策记录(ADRs)
- API规范、设计文档、运行手册
- 包含项目上下文的CLAUDE.md文件
将每个文档写入vault中的。添加标签。
references/imported/{filename}.mddoctrack/type/reference检查点:更新Phase 3 Checklist中的References行为并填写数量。
done3e. Finalize project files and config
3e. 完成项目文件和配置
Write filesystem files and finalize the vault:
5. Write on filesystem.
6. Write on filesystem (idempotent — read existing first, update the section in place or append if not present):
README.mdCLAUDE.md# Doctrackmarkdown
undefined编写文件系统文件并完成vault:
5. 在文件系统中编写。
6. 在文件系统中编写(幂等操作——先读取现有内容,更新或追加部分):
README.mdCLAUDE.md# Doctrackmarkdown
undefinedDoctrack
Doctrack
This project maintains a knowledge graph in (Obsidian vault).
.doctrack/此项目在(Obsidian vault)中维护知识图谱。
.doctrack/BEFORE writing any code
编写任何代码之前
You MUST read relevant documentation before planning or implementing changes:
- Read for project structure and module map
.doctrack/_project.md - Search the vault for features related to the code you'll touch:
- Use with the module/feature name
mcp__obsidian__search_notes - Read the matching feature note and its component notes
- Use
- Check for cross-cutting patterns that may affect your approach
concepts/ - Check for past choices and rejected alternatives — do NOT re-propose approaches that were already considered and rejected
decisions/
This context prevents duplicate work, respects architectural decisions, and ensures
your changes align with existing patterns.
你必须先阅读相关文档,然后再规划或实现变更:
- 读取了解项目结构和模块映射
.doctrack/_project.md - 在vault中搜索与你要修改的代码相关的功能:
- 使用并传入模块/功能名称
mcp__obsidian__search_notes - 读取匹配的功能笔记及其组件笔记
- 使用
- 检查中可能影响你实现方式的跨模块模式
concepts/ - 检查中的过往选择和被否决的方案——不要重新提出 已被考虑并否决的方案
decisions/
这些上下文可以避免重复工作、尊重架构决策,并确保你的变更与现有模式保持一致。
AFTER modifying code files
修改代码文件之后
You MUST update the knowledge graph to reflect your changes:
- Update the feature note if the feature's architecture, dependencies, or API changed
- Update or create component notes for any classes/modules you modified or added
- Create a decision note if you made a non-trivial design choice — include alternatives you considered and why you rejected them
- Update interfaces if contracts between modules changed
- Create a concept note if you introduced a new cross-cutting pattern
- Update file registry if you added new source files
_project.md
Do NOT skip documentation updates. The knowledge graph is how future sessions
understand this codebase without re-reading source files.
你必须更新知识图谱以反映你的变更:
- 如果功能的架构、依赖或API发生了变化,更新功能笔记
- 为你修改或添加的任何类/模块更新或创建组件笔记
- 如果你做出了非trivial的设计选择,创建决策笔记——包含 你考虑过的备选方案以及否决它们的原因
- 如果模块之间的契约发生了变化,更新接口笔记
- 如果你引入了新的跨模块模式,创建概念笔记
- 如果添加了新的源文件,更新中的文件注册表
_project.md
不要跳过文档更新。知识图谱是未来会话无需重新读取源文件即可理解此代码库的方式。
Vault connection
Vault连接
- Vault path:
.doctrack/ - MCP servers: configured in (obsidian server for vault I/O, doctrack server for code↔doc index)
.mcp.json - If MCP tools are unavailable: read/write files directly from filesystem
.doctrack/
7. **Write hooks** to `.claude/settings.json` (idempotent — read existing, merge, don't overwrite other settings):
Read the project's `.claude/settings.json` if it exists. Add or update hook entries. Preserve any existing hooks and settings.
```json
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "test -f .doctrack/_project.md && echo 'Doctrack vault detected at .doctrack/. Read _project.md and relevant feature/component notes before starting work. Check decisions/ for past architectural choices.' || true",
"statusMessage": "Checking for doctrack..."
}
]
}
]
}
}If is installed (check with ), also install hooks for proactive code↔doc feedback by running:
doctrack-mcpwhich doctrack-mcpbash
doctrack-mcp --setup-hooksThis merges hooks into without overwriting existing settings:
.claude/settings.json- SessionStart: shows vault coverage summary at the start of each session
- PostToolUse: validates notes after writing them via obsidian MCP tools
If already has other hooks, the doctrack hooks are appended alongside them.
.claude/settings.json- Write procedural guides — ,
guides/development.mdif applicable.guides/deployment.md - Write specs — if REST APIs exist.
specs/openapi.md
- Vault路径:
.doctrack/ - MCP服务器:在中配置(obsidian服务器用于vault I/O,doctrack服务器用于代码与文档索引)
.mcp.json - 如果MCP工具不可用:直接从文件系统读取/写入文件
.doctrack/
7. **编写钩子到`.claude/settings.json`**(幂等操作——读取现有内容,合并,不要覆盖其他设置):
读取项目的`.claude/settings.json`(如果存在)。添加或更新钩子条目。保留任何现有钩子和设置。
```json
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "test -f .doctrack/_project.md && echo 'Doctrack vault detected at .doctrack/. Read _project.md and relevant feature/component notes before starting work. Check decisions/ for past architectural choices.' || true",
"statusMessage": "Checking for doctrack..."
}
]
}
]
}
}如果已安装(通过检查),还可以通过运行以下命令安装主动的代码与文档反馈钩子:
doctrack-mcpwhich doctrack-mcpbash
doctrack-mcp --setup-hooks这会将钩子合并到中而不覆盖现有设置:
.claude/settings.json- SessionStart:在每个会话开始时显示vault覆盖率摘要
- PostToolUse:通过obsidian MCP工具编写笔记后验证笔记
- 编写流程指南 —— 如、
guides/development.md(如果适用)。guides/deployment.md - 编写规范 —— 如果存在REST API,编写。
specs/openapi.md
Phase 4: Verify completeness
阶段4:验证完整性
Update to in .
Current phasephase-4_project.md- Cross-reference pass — check wikilinks in Dependencies, Relationships, concept links, interface implementors. Fill gaps.
- File registry audit — compare source files against registry. Unmapped files → missed components.
- Component coverage check — flag modules where file count vs component count suggests gaps.
- Graph density check — report: total wikilinks, links per note, orphan notes (should be 0), cross-type links (links between different node types like feature→concept). A healthy vault has 3+ links per note and zero orphans.
- Tag audit — verify all notes have the required doctrack/ tags (type + status + audience). Flag any non-doctrack tags.
- Set to
Current phase— remove the Init Progress section fromcompleteor keep it as a record. The init is done._project.md
在中将更新为。
_project.mdCurrent phasephase-4- 交叉引用检查 —— 检查Dependencies、Relationships、概念链接、接口实现者中的wikilinks。填补空白。
- 文件注册表审计 —— 比较源文件与注册表。未映射的文件 → 遗漏的组件。
- 组件覆盖率检查 —— 标记文件数量与组件数量比例异常的模块(例如50个文件但0个组件),以便重新记录。
- 图谱密度检查 —— 报告:总wikilinks数量、每个笔记的链接数、孤立笔记(应为0)、跨类型链接(不同节点类型之间的链接,如功能→概念)。健康的vault每个笔记应有3+个链接,且没有孤立笔记。
- 标签审计 —— 验证所有笔记都包含必填的doctrack/标签(类型+状态+受众)。标记任何非doctrack标签。
- 将设置为
Current phase—— 从complete中移除Init Progress部分,或保留作为记录。初始化完成。_project.md
Resuming an interrupted init
恢复中断的初始化
When session init detects an Init Progress section in , read the and checklist to determine where to resume:
_project.mdCurrent phaseIf is : Phase 1 is lightweight — just re-run it.
Current phasephase-1If is :
Current phasephase-2- Tell the user: "Resuming doctrack init — {N} of {M} modules documented so far. Continuing with {next pending module}..."
- Process only modules with status.
pending - Check modules for component coverage — flag any with suspiciously low counts (e.g., 50 files but 0 components) for re-documentation.
done - After all modules complete, proceed to Phase 3.
If is :
Current phasephase-3- Tell the user: "Resuming doctrack init — modules are done, continuing with knowledge graph ({list pending categories})..."
- Read the Phase 3 Checklist. Only run sub-phases still marked (e.g., if Concepts is
pendingbut Decisions isdone, start from 3b).pending - After Phase 3 completes, proceed to Phase 4.
If is : Tell the user "Resuming — running verification pass." Re-run verification.
Current phasephase-4If is : Init is already done. Tell the user: "This project is already initialized. To re-initialize from scratch, delete and run again."
Current phasecomplete.doctrack/doctrack initThis means large projects can be initialized across multiple sessions — each session makes progress, checkpoints it, and the next session picks up exactly where it left off.
当会话初始化在中检测到Init Progress部分时,读取和检查点以确定从何处恢复:
_project.mdCurrent phase如果是:阶段1是轻量级的——重新运行即可。
Current phasephase-1如果是:
Current phasephase-2- 告知用户:"恢复doctrack初始化 —— 已完成{M}个模块中的{N}个。继续处理{下一个待处理模块}..."
- 仅处理状态为的模块。
pending - 检查已完成模块的组件覆盖率——标记组件数量异常少的模块(例如50个文件但0个组件)以便重新记录。
- 所有模块完成后,进入阶段3。
如果是:
Current phasephase-3- 告知用户:"恢复doctrack初始化 —— 模块已完成,继续构建知识图谱({待处理分类列表})..."
- 读取Phase 3 Checklist。仅运行仍标记为的子阶段(例如,如果Concepts已
pending但Decisions为done,则从3b开始)。pending - 阶段3完成后,进入阶段4。
如果是:告知用户"恢复初始化 —— 运行验证检查。" 重新运行验证。
Current phasephase-4如果是:初始化已完成。告知用户:"此项目已完成初始化。要从头开始重新初始化,请删除并运行。"
Current phasecomplete.doctrack/doctrack init这意味着大型项目可以跨多个会话完成初始化——每个会话都能取得进展、记录检查点,下一个会话可以从中断处继续。
Init for monorepos
单体仓库的初始化
Detection: Same indicators as Step 5 of Pre-init — JS workspaces, Maven , Gradle , Cargo , , multiple , or multi-project directory structures.
<modules>include[workspace].gitmodulesgo.modWorkflow (same depth-first strategy, scoped to packages):
- Lightweight discovery — detect packages, list them, sort by dependency order
- Write root with Mermaid cross-package diagram and Init Progress table
_project.md - Deep-dive each package (Phase 2 within ) — process 2-3 at a time, write-as-you-go
packages/{name}/ - After all packages: create monorepo-level concepts, decisions, interfaces
- Write root README and CLAUDE.md
- Cross-reference pass across packages
- Tag with
doctrack/package/{name}
检测:与预初始化步骤5的指标相同——JS工作区、Maven 、Gradle 、Cargo 、、多个,或多项目目录结构。
<modules>include[workspace].gitmodulesgo.mod工作流(相同的深度优先策略,作用于包):
- 轻量级发现——检测包、列出包、按依赖顺序排序
- 编写根目录,包含Mermaid跨包图和Init Progress表格
_project.md - 深度处理每个包(在内执行阶段2)——同时处理2-3个包,边写边存
packages/{name}/ - 所有包处理完成后:创建单体仓库级别的概念、决策、接口
- 编写根目录README和CLAUDE.md
- 跨包交叉引用检查
- 添加标签
doctrack/package/{name}
Working with teams
团队协作
All agents share the same vault via git. For concurrent access (multiple agents, worktrees):
- Scope-based partitioning: Each agent only updates notes for features it modifies.
- Append-only for project config: Use append mode for during concurrent work.
_project.md - Advisory locking: Check frontmatter before updating shared notes.
editing_agent - Post-task reconciliation: Consolidate appends, check for stale notes, clear locks, verify file registry.
For vault backup and git sync, use the obsidian skill's git sync capabilities.
所有代理通过git共享同一个vault。对于并发访问(多个代理、工作树):
- 基于范围的分区:每个代理仅更新它修改的功能对应的笔记。
- 项目配置的追加模式:并发工作时,对使用追加模式。
_project.md - 建议性锁定:更新共享笔记前,检查前置元数据。
editing_agent - 任务后协调:合并追加内容、检查过时笔记、清除锁定、验证文件注册表。
对于vault备份和git同步,使用obsidian技能的git同步功能。
Naming conventions
命名规范
- Features: kebab-case ()
user-authentication.md - Components: kebab-case ()
token-validator.md - Concepts: descriptive kebab-case ()
health-data-model.md - Decisions: verb-prefixed kebab-case (,
chose-firestore.md)rejected-websockets.md - Interfaces: kebab-case ()
health-data-schema.md
- 功能:短横线分隔(kebab-case),例如
user-authentication.md - 组件:短横线分隔,例如
token-validator.md - 概念:描述性短横线分隔,例如
health-data-model.md - 决策:动词前缀短横线分隔,例如、
chose-firestore.mdrejected-websockets.md - 接口:短横线分隔,例如
health-data-schema.md