Skip to main content

NOC Living Docs

CI License: PolyForm Noncommercial 1.0.0 Codex Skill Living Docs

A local project-memory Skill for Codex, with a CLI that handles setup and one-time project initialization.

Start in three steps

1. Install

pipx install noc-living-docs
noc setup

2. Initialize a project once

cd my-project
noc init .

3. Use Codex normally

帮我给登录接口增加失败次数限制。
  • You do not need to run work, index, check, feature, or suggest-map yourself.
  • The Codex Skill automatically reads the smallest useful project memory.
  • It updates memory only when a change creates a durable fact that future Codex sessions must know.
  • Ordinary Bug fixes and small refactors do not create documentation work.
  • NOC does not call a model or upload code; all project memory stays in your project.

中文说明在下方:中文

License note: you can read and use this for learning, research, and personal non-commercial work. Commercial use needs written permission.

Advanced usage

The commands and protocol details below are optional. The Codex Skill runs the relevant commands automatically during normal development.

Why NOC

AI coding agents are fast, but project memory is fragile.

Common failure modes:

  • Requirements stay in chat and disappear with the session.
  • Current behavior is buried in code, old PRs, or someone's memory.
  • Guardrails get forgotten when a new agent starts fresh.
  • Test commands and gaps are not recorded.
  • Agents read too much, miss the important file, or confidently infer the wrong thing.

NOC gives each feature a stable documentation home and gives agents one deterministic first step:

noc work . --path src/auth/login.py --json

That command answers: what feature is this, how confident is the mapping, which docs should I read, and what should I update after the code changes?

What It Looks Like

Given a path like scripts/noc.py, NOC can return a work plan like this:

{
  "schema_version": "1.0",
  "resolution_status": "resolved",
  "paths": ["scripts/noc.py"],
  "features": [
    {
      "id": "cli-core",
      "matched_by": "path",
      "matched_pattern": "scripts/noc.py",
      "confidence": "high",
      "read_before_code": [
        "noc_docs/features/cli-core/agent-guide.md",
        "noc_docs/features/cli-core/status.md",
        "noc_docs/features/cli-core/guardrails.md",
        "noc_docs/features/cli-core/test-record.md"
      ],
      "update_after_code": [
        {
          "doc": "noc_docs/features/cli-core/status.md",
          "reason": "when actual behavior changes"
        },
        {
          "doc": "noc_docs/features/cli-core/test-record.md",
          "reason": "with verification commands and results"
        }
      ]
    }
  ],
  "next_actions": []
}

If NOC cannot resolve a path, it says so explicitly with resolution_status: "unresolved" and suggests the next command, such as noc suggest-map or noc feature create.

Alternative installation

With pip:

python -m pip install noc-living-docs
noc setup

The package installs the noc CLI. noc setup, available since 1.1.0, installs the bundled, matching-version project-living-docs Skill into Codex. Run both once per machine.

For local development without installing:

git clone https://github.com/SmallNoc/noc-living-docs.git
cd noc-living-docs
python scripts/noc.py --help

Update

If installed with pipx:

pipx upgrade noc-living-docs

If installed with pip:

python -m pip install --upgrade noc-living-docs

If running from source:

git pull
python scripts/noc.py --help

After updating an existing NOC-enabled project, refresh indexes:

noc index /path/to/project
noc doctor /path/to/project

Advanced CLI workflow

Add NOC to a project:

noc init /path/to/project
noc doctor /path/to/project

Create docs for a real feature and map code to it:

noc feature create /path/to/project user-login --path src/auth/

Before changing code, route the agent:

noc work /path/to/project --path src/auth/login.py --json

Or route from Git state:

noc work /path/to/project --staged --json
noc work /path/to/project --changed --json

After changing code, update only the facts that changed, then verify:

noc index /path/to/project
noc check /path/to/project --staged

Advanced daily use

Use this loop for normal feature work:

  1. Run noc work <project> --path <code/path> --json.
  2. Read only the docs listed in read_before_code.
  3. Change code.
  4. Update only the docs whose facts changed.
  5. Run noc index <project>.
  6. Run noc check <project> --staged.

Use this loop when changes are already in Git:

noc work . --changed --json
noc work . --staged --json

Use this loop when NOC cannot resolve a path:

noc suggest-map . --interactive
noc feature create . <feature> --path <code/path>
noc index .

Advanced agent workflow

Before code:

  1. Run noc work <project> --path <code/path> --json, or use --staged / --changed.
  2. Read only the docs listed in the work plan.
  3. Stop and ask if a requested change conflicts with guardrails.md.
  4. Put confirmed new intent in requirements.md; put uncertainty in notes.md.

After code:

  1. Update status.md when actual behavior changed.
  2. Update test-record.md with commands, results, and gaps.
  3. Update change-record.md for important changes worth remembering.
  4. Update requirements.md only when intended behavior changed.
  5. Run noc index and noc check --staged.

The point is not to update every file every time. The point is to keep the few facts future agents will need.

Advanced command reference

Command What it does
noc setup Installs or checks the matching Codex Skill.
noc init <project> Adds noc_docs/ and an agent entry block.
noc doctor <project> Checks setup, JSON, Git, mode, indexes, and hook state.
noc work <project> Routes a feature, path, or Git diff to the docs an agent should read and update. Use --json for automation.
noc check <project> Warns or fails when code changed without matching NOC docs.
noc index <project> Refreshes generated .living-docs routing files.
noc suggest-map <project> Suggests code-path to feature mappings.
noc feature create <project> <feature> Creates a feature doc folder from the template.
noc feature adopt <project> <source> <feature> Turns a placeholder feature folder into a real one.
noc feature rename <project> <old> <new> Renames a feature folder and its mapping.
noc hook install <project> Installs the pre-commit reminder.
noc hook status <project> Shows whether the pre-commit reminder is installed.
noc hook uninstall <project> Removes the NOC managed hook block.
noc validate --target <project> Validates a target project.
noc validate Validates this repository.

Use noc <command> --help for arguments.

Generated Documents

Default small mode creates:

<project>/
  AGENTS.md
  noc_docs/
    docs-map.md
    project-status.md
    development/
      documentation-policy.md
      git-workflow.md
      testing.md
    features/
      index.md
      _feature/
        agent-guide.md
        requirements.md
        status.md
        guardrails.md
        test-record.md
        change-record.md
        notes.md
    .living-docs/
      config.json
      docs-index.json
      feature-map.json
      manifest.json

AGENTS.md can be replaced by CLAUDE.md or GEMINI.md:

noc init /path/to/project --agent-file CLAUDE.md
noc init /path/to/project --agent-file GEMINI.md

_feature/ is a template placeholder. Real feature docs are created with:

noc feature create /path/to/project user-login --path src/auth/

That creates:

noc_docs/features/user-login/
  agent-guide.md
  requirements.md
  status.md
  guardrails.md
  test-record.md
  change-record.md
  notes.md

Document Responsibilities

File Purpose
docs-map.md Tells humans and agents where to start.
project-status.md Summarizes the project, stack, capabilities, and known risks.
development/documentation-policy.md Explains how docs should be maintained.
development/git-workflow.md Records Git and commit expectations.
development/testing.md Records expected verification commands.
features/index.md Lists feature documentation folders.
agent-guide.md Quick entry point for a feature.
requirements.md Intended behavior, business rules, and acceptance criteria.
status.md Current behavior as implemented.
guardrails.md Constraints that must not be broken.
test-record.md Test strategy, commands, results, and gaps.
change-record.md Important changes and why they happened.
notes.md Temporary notes, open questions, and uncertain findings.

Machine Files

The .living-docs/ directory is generated and maintained by noc index.

File Purpose
config.json Project mode and check strictness configuration.
feature-map.json Maps code paths to feature docs and stores trust signals.
docs-index.json Lists known documentation files and metadata.
manifest.json Records generated file inventory for validation.

Agents should read feature-map.json through noc work --json rather than parsing it by hand.

Domain Mode

Bigger projects can use domain mode:

noc init /path/to/project --mode domain

Domain mode creates:

noc_docs/
  domains/
    index.md
    _domain/
      index.md
      guardrails.md
      features/
        _feature/
          agent-guide.md
          requirements.md
          status.md
          guardrails.md
          test-record.md
          change-record.md
          notes.md

Use domain mode for monorepos, multi-service systems, or teams with domain-level guardrails.

How It Compares

Tool Good for NOC's role
README Project overview and setup Points agents to feature-level memory before a change.
Wiki or docs site Long-form guides and broad knowledge Keeps change-critical memory next to the code workflow.
ADRs Architectural decisions Records feature behavior, guardrails, tests, and change facts.
Issue tracker Planning, ownership, and discussion Preserves what became true after implementation.
Generated API docs Reference generated from code Captures intent, constraints, and verification that code alone does not show.

NOC can coexist with all of these. It is the local routing layer that tells an agent where to look before it edits code.

For Coding Agents

noc setup installs the bundled project-living-docs Skill into Codex's global Skill directory and keeps its version aligned with the CLI:

noc setup

The repository paths .agents/skills/project-living-docs and skills/codex/project-living-docs remain available for source development and compatibility.

Generic agents can read the managed block from:

noc init /path/to/project --agent-file AGENTS.md

See Agent Compatibility for details.

Developing This Repo

python scripts/noc.py validate
python scripts/release.py --check
python -m unittest tests.test_noc_cli tests.test_release_cli
python -m py_compile scripts/noc.py scripts/init-noc-docs.py scripts/index-noc-docs.py scripts/release.py scripts/validate-noc-docs.py

Current version: 1.2.0.

GitHub Discovery

Suggested GitHub topics:

codex
codex-skill
agent-skills
ai-coding
agents-md
living-docs
developer-tools
documentation
cli
git-hooks
project-memory

More reading:

License

This repo is source-available and non-commercial by default.

Code, scripts, templates, and skills are licensed under the PolyForm Noncommercial License 1.0.0. For commercial use, get written permission first.


中文

NOC 是 Codex 的本地项目记忆 Skill,CLI 负责安装和一次性项目初始化。

三步开始使用

  1. 安装:

    pipx install noc-living-docs
    noc setup
    
  2. 每个项目初始化一次:

    cd my-project
    noc init .
    
  3. 此后正常向 Codex 提出开发需求。无需手动运行 workindexcheckfeaturesuggest-map

Codex Skill 会自动读取最小项目记忆,并且只在产生未来会话必须知道的新事实时更新记录。普通 Bug 修复和小型重构不会带来文档负担。NOC 不调用模型、不上传代码,所有记录都保存在项目本地。

高级用法

以下命令和协议细节均为可选内容;正常开发时由 Codex Skill 自动调用相关命令。

NOC 是给代码仓库用的轻量级 agent memory router

它帮助 AI 编程助手在改代码前找到最小但有用的项目上下文,并在改完后留下未来会话需要的事实:当前行为、需求、限制、测试和重要变更。

NOC 保持本地、小而硬。它不调用模型、不运行服务端、不替代 issue tracker,也不试图变成 Wiki。

为什么需要 NOC

AI agent 写代码很快,但项目记忆很容易丢:

  • 需求留在聊天里,换会话就消失。
  • 当前行为藏在代码、旧 PR 或某个人的记忆里。
  • guardrails 被新会话忘掉。
  • 测试命令和测试缺口没有沉淀。
  • agent 读太多、读错文件,或者自信地猜错。

NOC 给每个功能一个稳定的文档位置,也给 agent 一个确定的第一步:

noc work . --path src/auth/login.py --json

这个命令会回答:这是什么 feature、映射置信度如何、应该先读哪些文档、改完后可能要更新什么。

效果示例

给定 scripts/noc.py 这样的路径,NOC 可以返回这样的 work plan:

{
  "schema_version": "1.0",
  "resolution_status": "resolved",
  "paths": ["scripts/noc.py"],
  "features": [
    {
      "id": "cli-core",
      "matched_by": "path",
      "matched_pattern": "scripts/noc.py",
      "confidence": "high",
      "read_before_code": [
        "noc_docs/features/cli-core/agent-guide.md",
        "noc_docs/features/cli-core/status.md",
        "noc_docs/features/cli-core/guardrails.md",
        "noc_docs/features/cli-core/test-record.md"
      ],
      "update_after_code": [
        {
          "doc": "noc_docs/features/cli-core/status.md",
          "reason": "when actual behavior changes"
        },
        {
          "doc": "noc_docs/features/cli-core/test-record.md",
          "reason": "with verification commands and results"
        }
      ]
    }
  ],
  "next_actions": []
}

如果 NOC 无法解析路径,它会明确返回 resolution_status: "unresolved",并建议下一步命令,例如 noc suggest-mapnoc feature create

其他安装方式

也可以使用 pip

python -m pip install noc-living-docs
noc setup

安装包提供 noc CLI;从 1.1.0 开始,noc setup 会把同版本的 project-living-docs Skill 安装到 Codex。每台机器只需执行一次。

本地开发不安装时:

git clone https://github.com/SmallNoc/noc-living-docs.git
cd noc-living-docs
python scripts/noc.py --help

更新

如果使用 pipx 安装:

pipx upgrade noc-living-docs

如果使用 pip 安装:

python -m pip install --upgrade noc-living-docs

如果使用源码:

git pull
python scripts/noc.py --help

已有项目升级后,刷新索引:

noc index /path/to/project
noc doctor /path/to/project

高级 CLI 工作流

给项目接入 NOC:

noc init /path/to/project
noc doctor /path/to/project

创建真实 feature 并映射代码路径:

noc feature create /path/to/project user-login --path src/auth/

改代码前,先路由 agent:

noc work /path/to/project --path src/auth/login.py --json

或者从 Git 状态路由:

noc work /path/to/project --staged --json
noc work /path/to/project --changed --json

改完代码后,只更新真的变化了的事实,然后验证:

noc index /path/to/project
noc check /path/to/project --staged

高级日常使用

普通功能开发使用这个循环:

  1. 运行 noc work <project> --path <code/path> --json
  2. 只读 read_before_code 列出的文档。
  3. 修改代码。
  4. 只更新事实发生变化的文档。
  5. 运行 noc index <project>
  6. 运行 noc check <project> --staged

如果代码已经改了,可以从 Git 状态生成 work plan:

noc work . --changed --json
noc work . --staged --json

如果 NOC 无法解析路径:

noc suggest-map . --interactive
noc feature create . <feature> --path <code/path>
noc index .

高级 Agent 工作流

改代码前:

  1. 运行 noc work <project> --path <code/path> --json,或者用 --staged / --changed
  2. 只读 work plan 里列出的文档。
  3. 如果请求和 guardrails.md 冲突,停下来问用户。
  4. 已确认的新意图写进 requirements.md;不确定的问题写进 notes.md

改代码后:

  1. 当前行为变了,更新 status.md
  2. 写入测试命令、结果和缺口到 test-record.md
  3. 重要变更写进 change-record.md
  4. 只有目标行为变了,才更新 requirements.md
  5. 运行 noc indexnoc check --staged

重点不是每次更新所有文件,而是保留未来 agent 真正需要的少数事实。

高级命令参考

命令 作用
noc setup 安装或检查与 CLI 同版本的 Codex Skill。
noc init <project> 添加 noc_docs/ 和 agent 入口区块。
noc doctor <project> 检查环境、JSON、Git、模式、索引和 hook 状态。
noc work <project> 根据 feature、路径或 Git diff 路由到 agent 应该读和更新的文档。自动化场景使用 --json
noc check <project> 检查代码变更是否缺少对应 NOC 文档更新。
noc index <project> 刷新 .living-docs 里的路由文件。
noc suggest-map <project> 建议代码路径到 feature 的映射。
noc feature create <project> <feature> 从模板创建 feature 文档目录。
noc feature adopt <project> <source> <feature> 把占位 feature 目录转成真实 feature。
noc feature rename <project> <old> <new> 重命名 feature 目录和映射。
noc hook install <project> 安装 pre-commit 提醒。
noc hook status <project> 查看 pre-commit 提醒是否安装。
noc hook uninstall <project> 移除 NOC managed hook 区块。
noc validate --target <project> 校验目标项目。
noc validate 校验本仓库。

参数细节可运行 noc <command> --help

生成的文档

默认 small 模式会生成:

<project>/
  AGENTS.md
  noc_docs/
    docs-map.md
    project-status.md
    development/
      documentation-policy.md
      git-workflow.md
      testing.md
    features/
      index.md
      _feature/
        agent-guide.md
        requirements.md
        status.md
        guardrails.md
        test-record.md
        change-record.md
        notes.md
    .living-docs/
      config.json
      docs-index.json
      feature-map.json
      manifest.json

AGENTS.md 可以替换成 CLAUDE.mdGEMINI.md

noc init /path/to/project --agent-file CLAUDE.md
noc init /path/to/project --agent-file GEMINI.md

_feature/ 是模板占位目录。真实 feature 文档用下面的命令创建:

noc feature create /path/to/project user-login --path src/auth/

会生成:

noc_docs/features/user-login/
  agent-guide.md
  requirements.md
  status.md
  guardrails.md
  test-record.md
  change-record.md
  notes.md

文档职责

文件 作用
docs-map.md 告诉人和 agent 从哪里开始读。
project-status.md 总结项目、技术栈、当前能力和已知风险。
development/documentation-policy.md 说明文档维护规则。
development/git-workflow.md 记录 Git 和提交期望。
development/testing.md 记录验证命令和测试要求。
features/index.md 列出 feature 文档目录。
agent-guide.md 某个 feature 的快速入口。
requirements.md 目标行为、业务规则和验收标准。
status.md 当前代码实际行为。
guardrails.md 不能破坏的限制。
test-record.md 测试策略、命令、结果和缺口。
change-record.md 重要变更及原因。
notes.md 临时笔记、开放问题和不确定发现。

机器文件

.living-docs/ 目录由 noc index 生成和维护。

文件 作用
config.json 项目模式和 check 严格度配置。
feature-map.json 把代码路径映射到 feature 文档,并保存 trust signals。
docs-index.json 列出已知文档和元数据。
manifest.json 记录生成文件清单,供校验使用。

agent 应该通过 noc work --json 使用 feature-map.json,而不是手写解析它。

Domain 模式

大项目可以使用 domain 模式:

noc init /path/to/project --mode domain

domain 模式生成:

noc_docs/
  domains/
    index.md
    _domain/
      index.md
      guardrails.md
      features/
        _feature/
          agent-guide.md
          requirements.md
          status.md
          guardrails.md
          test-record.md
          change-record.md
          notes.md

monorepo、多服务系统,或者有领域级 guardrails 的团队适合使用 domain 模式。

和其他工具的关系

工具 适合做什么 NOC 的角色
README 项目概览和启动方式 在改动前把 agent 指向 feature 级项目记忆。
Wiki 或文档站 长文指南和广泛知识 把和代码改动强相关的记忆放在代码工作流旁边。
ADR 架构决策 记录 feature 行为、限制、测试和变更事实。
Issue tracker 计划、负责人和讨论 保存实现后真正变成事实的内容。
自动生成 API 文档 从代码生成 reference 捕获代码本身看不出来的意图、限制和验证。

NOC 可以和这些工具共存。它是本地路由层,告诉 agent 改代码前应该看哪里。

给 Coding Agents 使用

noc setup 会把内置的 project-living-docs Skill 安装到 Codex 的全局 Skill 目录,并保持 Skill 与 CLI 版本一致:

noc setup

仓库中的 .agents/skills/project-living-docsskills/codex/project-living-docs 继续用于源码开发和兼容旧用法。

通用 agent 可以读取 managed block:

noc init /path/to/project --agent-file AGENTS.md

细节见 Agent Compatibility

开发本仓库

python scripts/noc.py validate
python scripts/release.py --check
python -m unittest tests.test_noc_cli tests.test_release_cli
python -m py_compile scripts/noc.py scripts/init-noc-docs.py scripts/index-noc-docs.py scripts/release.py scripts/validate-noc-docs.py

当前版本:1.2.0

GitHub 发现性

建议添加这些 GitHub topics:

codex
codex-skill
agent-skills
ai-coding
agents-md
living-docs
developer-tools
documentation
cli
git-hooks
project-memory

更多阅读:

许可证

本仓库源码公开,默认用于非商业场景。

代码、脚本、模板和 skills 使用 PolyForm Noncommercial License 1.0.0。商业使用需要书面许可。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

noc_living_docs-1.2.0.tar.gz (63.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

noc_living_docs-1.2.0-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file noc_living_docs-1.2.0.tar.gz.

File metadata

  • Download URL: noc_living_docs-1.2.0.tar.gz
  • Upload date:
  • Size: 63.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for noc_living_docs-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b6570c9791191d533c5c9a9600dd5f662b482681e4ee69361f4bb14b99a8da7c
MD5 a6be3f57a968fdaeb4f0ccd6ac189ff9
BLAKE2b-256 b0d9fc4e344adb8c2f1069ae5c34200cdb86e2208c987af86d3880904317aaad

See more details on using hashes here.

Provenance

The following attestation bundles were made for noc_living_docs-1.2.0.tar.gz:

Publisher: publish.yml on SmallNoc/noc-living-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file noc_living_docs-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: noc_living_docs-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for noc_living_docs-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7ad514281c3bccbfebae5300201c56180afcc042a58ed1c20bcfd64e8fc772
MD5 074c4a60ab3ff6a846053c3da4681ff4
BLAKE2b-256 e5f235c983ad99ba59db3ae8585cb8469f3f7575573c9de11d4e377c0d5934d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for noc_living_docs-1.2.0-py3-none-any.whl:

Publisher: publish.yml on SmallNoc/noc-living-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.1

2 files

This release

1.2.0 This release

2 files

1.1.0

2 files

1.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page