Same-Repository Docs
When the Context knowledge workspace sits inside a project repository, that repository usually already has documentation and Agent Skills. They should stay where they are and keep being edited there. repo-content.yaml registers them as same-repository content: Context links to the originals instead of copying their bodies into knowledge or source snapshots.
flowchart LR
orig["docs/ and .agents/skills/<br/>the only originals"] --> links["repo-content/<br/>relative symlinks"]
orig --> ev["Evidence<br/>repo-content:docs@commit"]
links --> pages["Pages link with<br/>context:repo/..."]
pages --> pkg["Optional entrance page<br/>in the package or site"]Use the context-repo-content Skill to choose and edit these entries; it does not start knowledge production.
Register
At the knowledge workspace root:
protocol: context.repo-content/v1
entries:
docs:
kind: docs
path: docs
tools:
kind: skills
path: .agents/skillsPaths are relative to the Git root, not the knowledge workspace. Kinds are docs, document, skills and skill. Optional group adds one module level, mount overrides the default mount name, and exclude globs skip files inside an entry (they are not access control). Overlapping entries, targets outside the repository, nested repositories and cycles are rejected.
context source ensure repo-content --format json maintains the relative symlinks under repo-content/; context status reports problems without repairing them. Ordinary files are never overwritten, and no Git configuration or index changes.
Link and cite
A page links to an original with [Guide](context:repo/docs/guide.md); build turns it into an upstream link when one is available, otherwise a plain location. Evidence records repo-content:docs@<full-commit> with the real path, line range and digest; uncommitted text is recorded as <commit>+worktree.
Optional entrance page
kbPackage({ name: "project-kb", template: { path: "src/package-templates/kb" }, repoContentPage: true });This projects each group's README and the Skill names and descriptions into wikis/repo-content.md; it does not copy all docs or Skill scripts. { site: true } adds the entrance to a configured website. Review README sensitivity before exposing it.
When something is wrong
- An invalid
repo-content.yamlis reported bystatus, andcontext buildstops before replacing existing outputs. Correct the file rather than rerunningensure. ensureis suggested only for missing or misdirected symlinks.- Other repositories and externally installed Skills are not same-repository content; declare them as External Entrances.
Registering an entrance does not authorize installing, running or publishing anything.
同仓库文档
当 Context 知识工作区位于某个项目仓库内部时,该仓库通常已经有文档和 Agent Skill。它们应该留在原处,并继续在原处编辑。repo-content.yaml 把它们登记为同仓库内容:Context 链接到原件,而不是把正文复制到知识或来源快照中。
flowchart LR
orig["docs/ 和 .agents/skills/<br/>唯一的原件"] --> links["repo-content/<br/>相对符号链接"]
orig --> ev["证据<br/>repo-content:docs@commit"]
links --> pages["页面通过<br/>context:repo/... 链接"]
pages --> pkg["知识包或站点中的<br/>可选入口页"]使用 context-repo-content Skill 来选择和编辑这些条目;它不会启动知识生产。
登记
在知识工作区根目录下:
protocol: context.repo-content/v1
entries:
docs:
kind: docs
path: docs
tools:
kind: skills
path: .agents/skills路径相对于 Git 根目录,而不是知识工作区。可用的类型有 docs、document、skills 和 skill。可选的 group 会增加一层模块层级,mount 用于覆盖默认挂载名,exclude 通配符用于跳过条目内的文件(它们不是访问控制)。重叠的条目、指向仓库外的目标、嵌套仓库和循环都会被拒绝。
context source ensure repo-content --format json 负责维护 repo-content/ 下的相对符号链接;context status 只报告问题,不做修复。普通文件永远不会被覆盖,Git 配置和索引也不会被修改。
链接与引用
页面用 [Guide](context:repo/docs/guide.md) 链接到原件;构建时,如果有上游链接就转换为上游链接,否则转换为普通位置。证据会记录 repo-content:docs@<full-commit>,以及真实路径、行范围和摘要值;未提交的文本记录为 <commit>+worktree。
可选入口页
kbPackage({ name: "project-kb", template: { path: "src/package-templates/kb" }, repoContentPage: true });这会把每个分组的 README 以及 Skill 的名称和描述投影到 wikis/repo-content.md;它不会复制全部文档或 Skill 脚本。{ site: true } 会把该入口加入已配置的网站。在公开 README 之前,请先评估其敏感性。
出现问题时
status会报告无效的repo-content.yaml,context build会在替换现有产物之前停止。请修正该文件,而不是重新运行ensure。- 只有在符号链接缺失或指向错误时,才会建议运行
ensure。 - 其他仓库和外部安装的 Skill 不属于同仓库内容;请将它们声明为外部入口。
登记入口并不代表授权安装、运行或发布任何内容。