doc-sentinel

Document-code change notification system: traceable doc-code binding via git tree hash, git-diff-driven reconciliation plans with confidence/risk metadata, and idempotent execution. Use when maintaining documentation freshness, detecting stale docs, or binding docs to source code.

5 stars

Best use case

doc-sentinel is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Document-code change notification system: traceable doc-code binding via git tree hash, git-diff-driven reconciliation plans with confidence/risk metadata, and idempotent execution. Use when maintaining documentation freshness, detecting stale docs, or binding docs to source code.

Teams using doc-sentinel should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/doc-sentinel/SKILL.md --create-dirs "https://raw.githubusercontent.com/northseadl/norix-skills/main/doc-sentinel/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/doc-sentinel/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How doc-sentinel Compares

Feature / Agentdoc-sentinelStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Document-code change notification system: traceable doc-code binding via git tree hash, git-diff-driven reconciliation plans with confidence/risk metadata, and idempotent execution. Use when maintaining documentation freshness, detecting stale docs, or binding docs to source code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Doc Sentinel — 文档-代码变更通知系统

## 核心概念

你负责守护一个仓库的**文档健康度**。三平面架构:

| 平面 | 目标 | 核心能力 |
|:---|:-----|:---------|
| **Identity** | 绑定真值 | 文档 frontmatter 绑定 source paths + git tree hash |
| **Reconciliation** | 变更推理 | Git diff → ChangeEvent → Policy → ChangePlan (含 confidence/risk) |
| **Capability** | 可选能力 | 索引生成(默认可用),矢量检索(未来独立技能) |

**核心价值**:让 Agent 准确知道「哪些文档可能需要更新」,不承诺自动修复,不假装语义理解。

**成功标准**:
- 零漏报:代码变更必须被检测到
- 低误报:误报率 < 20%
- 可解释:每个通知附带变更证据和 confidence

## 工具

```bash
# 主入口
uv run <SKILLS_DIR>/doc-sentinel/scripts/sentinel.py <command> [options]

# --- 4 个核心命令 ---

# 1. 只读状态查询(无副作用)
status [--root <path>] [--doc <id>] [--source <path>] [--format json]

# 2. 建立/更新文档-代码绑定
bind <doc.md> [--source <path>...] [--auto-detect] [--root <path>]

# 3. 生成变更计划(不执行)
plan [--since <commit>] [--output plan.json] [--format json] [--root <path>]

# 4. 执行计划(幂等)
apply [--dry-run] [--root <path>]
```

## 工作流

### Phase 1: 理解仓库

1. 运行 `status` 查看文档健康状态
2. 如无文档追踪,用 `bind` 为关键文档建立绑定

### Phase 2: 绑定文档

为需要追踪的文档注入溯源 frontmatter:

```bash
# 显式指定源码路径
sentinel.py bind docs/auth.md --source "src/auth/" "src/middleware/auth.py"

# 自动检测(使用文档所在目录)
sentinel.py bind docs/api/overview.md --auto-detect
```

### Phase 3: 检测变更

代码变更后,生成变更计划:

```bash
sentinel.py plan
# 输出:
#   📋 Stable actions (auto-executable):
#     📝 UPDATE → auth/overview
#        Reason: Source modified (42 lines): src/auth/handler.py
#   🔍 Review items (need confirmation):
#     ✨ CREATE → ?
#        Reason: New file in untracked area: src/billing/stripe.py
```

### Phase 4: 执行计划

```bash
# 预览
sentinel.py apply --dry-run

# 执行(仅执行 STABLE 级别的操作)
sentinel.py apply
```

## 溯源 Frontmatter 规范

每份受管文档头部嵌入:

```yaml
---
doc_id: "module/feature"
source_paths: ["module/src/"]
source_tree_hash: "a3f2b8c4d5e6"
last_sync_commit: "e7d1c4a..."
sync_timestamp: "2026-03-05T14:00:00+08:00"
doc_version: 3
status: "synced"
---
```

## 变更计划 (ChangePlan) 结构

每个 PlanItem 附带 Agent 可消费的元数据:

```json
{
  "action": "update",
  "risk": "stable",
  "doc_id": "auth/overview",
  "reason": "Source modified (42 lines): src/auth/handler.py",
  "confidence": 0.84,
  "details": {
    "modified_source": "src/auth/handler.py",
    "lines_changed": 42
  }
}
```

**动作分类**:

| 分类 | 动作 | 语义 |
|:-----|:-----|:-----|
| **STABLE** | UPDATE, RENAME, ARCHIVE | 可自动执行,风险低 |
| **REVIEW** | CREATE | 需 Agent/人工确认 |

## 显著性阈值

修改 (M) 状态使用阈值过滤噪声(默认 5 行)。可通过环境变量调整:

```bash
DOC_SENTINEL_THRESHOLD=10 sentinel.py plan
```

## 数据目录

```
<repo_root>/.doc-sentinel/
├── registry.json          # 文档注册表(绑定关系)
├── last_sync_commit       # 上次同步 commit SHA
└── change_log.json        # 操作历史(保留最近 50 条)
```

## 参考文档

| 文档 | 用途 | 何时读取 |
|:-----|:-----|:---------|
| [decision-tree.md](references/decision-tree.md) | 变更操作决策树详解 | 处理 plan/apply 时 |
| [traceback-spec.md](references/traceback-spec.md) | 溯源标识详细规范 | 维护 frontmatter 时 |

## 输出约定

- **思考/规划/报告**: 中文
- **代码/命令/文件名**: English
- **Frontmatter**: YAML (English keys)

Related Skills

web-scraper

5
from northseadl/norix-skills

Web scraper with SPA/JavaScript rendering, page interaction, and JS execution. Two-tier engine (HTTP → Playwright browser). Smart discovery, batch fetch, interactive content extraction, OpenAPI parsing. Use when read_url_content fails, SPA rendering needed, or page interaction required.

pm-toolkit

5
from northseadl/norix-skills

自然语言 → Mermaid 图表(16 种)+ 网页原型,本地 Web 面板实时预览/导出。

mobile-testing

5
from northseadl/norix-skills

Android/iOS automated testing: device management, app install, performance profiling, log analysis, screenshot comparison, Maestro E2E orchestration.

llm-agent-dev

5
from northseadl/norix-skills

LLM Agent engineering: pattern selection (12-mode matrix), data simulation, convergence iteration. Covers intent routing, function calling, ReAct, MCP, prompt chaining, guardrails, evaluation.

image-studio

5
from northseadl/norix-skills

AI image generation and editing: e-commerce templates (hero/banner/detail/lifestyle), image refinement (background replace/remove, enhance, retouch, style transfer), icon extraction (bg-removal + detect + smart crop with transparent output).

feishu-integration

5
from northseadl/norix-skills

Feishu (Lark) unified CLI for tasks, documents, wiki, bitable, messaging, approval, and Drive. Supports search/create/edit/publish/export across all modules. Use when reading/writing Feishu docs, searching docs or wiki, managing tasks, sending messages, creating approvals, exporting to Markdown, or any 飞书/Lark interaction.

es-analytics

5
from northseadl/norix-skills

Elasticsearch / SLS 只读数据分析:索引探索、mapping、聚合统计、日志搜索、时间序列、多 Profile。

coding-net-integration

5
from northseadl/norix-skills

Coding.net DevOps automation: MR lifecycle, CI operations (trigger/logs/stop), artifact registry, cross-project queries, remote file audit.

cnb-cool-integration

5
from northseadl/norix-skills

针对 cnb.cool 的云原生构建(CNB Build):生成/修改 .cnb.yml 流水线、触发规则、 构建环境、runner 资源、缓存、环境变量、手动触发与调试。 在接入、迁移、优化或排查 CNB 构建配置时使用。

agent-task-orchestration

5
from northseadl/norix-skills

Task decomposition and multi-agent orchestration with retry, checkpoint recovery, and real-time monitoring. Mixed Codex/Claude Code engine. Parallel/sequential execution.

agent-swe-team

5
from northseadl/norix-skills

Multi-agent SWE team built on the Workshop model. Full-stack vertical workers, meeting room with @mention notification, private pipes, shared task board. Git worktree isolation, Leader-driven coordination. Mixed Codex/Claude Code engine. Use when a task needs engineering depth beyond a single agent. NOT for simple task parallelism (use agent-task-orchestration) or design discussions (use agent-brainstorm).

agent-front-design

5
from northseadl/norix-skills

Frontend design blueprints with craftsmanship scoring, self-critique loops, and engineering handoff. Aesthetic intelligence against AI homogeneity. Use for: UI/UX design specs, design system creation, visual direction exploration, component design review, design-to-engineering handoff.