Skip to content

.docmeta.json schema

codehub-document writes a .docmeta.json sidecar alongside the generated Markdown tree at the end of every Phase E run. The file is the source of truth for --refresh and for codehub status staleness reporting.

{
"$schema": "https://opencodehub.dev/schemas/docmeta-v1.json",
"generated_at": "2026-04-27T18:12:04Z",
"codehub_graph_hash": "sha256:a1b2c3…",
"mode": "single-repo",
"repo": "opencodehub",
"group": null,
"staleness_at": "2026-04-27T18:12:04Z",
"sections": [
{
"path": "architecture/system-overview.md",
"agent": "doc-architecture",
"sources": [
"packages/mcp/src/server.ts",
"packages/mcp/src/index.ts"
],
"mtime": "2026-04-27T18:11:58Z",
"citation_count": 18,
"mermaid_count": 1
}
],
"cross_repo_refs": [],
"frontmatter_removed": []
}
FieldTypeMeaning
$schemastringJSON Schema URL for v1. Locked.
generated_atISO-8601When Phase E completed.
codehub_graph_hashsha256:<hex>Taken from list_repos at orchestration start. The hash that anchors this doc tree.
mode"single-repo" | "group"Whether the tree was produced by single-repo or group invocation.
repostring | nullThe target repo (single mode) or the group root’s registered repo reference (group mode).
groupstring | nullThe group name (group mode only).
staleness_atISO-8601Lifted from the last MCP response’s _meta.codehub/staleness envelope observed during assembly.
sections[]arrayOne entry per generated Markdown file.
cross_repo_refs[]arrayCross-repo links computed by Phase E. Only populated in group mode.
frontmatter_removed[]string[]Paths where Phase E stripped stray YAML frontmatter. Normally empty.
FieldTypeMeaning
pathstringRelative path from the docs root.
agentstringThe subagent that wrote this section (doc-architecture, doc-reference, etc.). Identifies ownership for --refresh dispatch.
sources[]string[]Source-file paths this section cites. Used by --refresh to decide staleness via mtime comparison.
mtimeISO-8601When this section file was last written.
citation_countnumberTotal backtick citations extracted by Phase E.
mermaid_countnumberFenced ```mermaid blocks detected.

cross_repo_refs[] entries (group mode only)

Section titled “cross_repo_refs[] entries (group mode only)”
FieldTypeMeaning
repostringThe sibling repo being linked.
from_docstringRelative path (from the group docs root) of the source doc.
to_docstringRelative path into the sibling repo’s generated docs.
contract_countnumberNumber of contracts sharing source citations across this cross-repo pair. Computed from group_contracts.
  1. Load .docmeta.json.
  2. Compare the manifest’s codehub_graph_hash against list_repos. If they match exactly, skip to step 5.
  3. For each section, stat every sources[i]. If max(source_mtime) > section.mtime, mark it stale.
  4. Collect stale sections + owners (section.agent); dispatch only the owning subagents with a sections_to_refresh list.
  5. Always re-run Phase E (cross-reference assembly is cheap and idempotent).

See references/cross-reference-spec.md inside the plugin for the Phase E algorithm.

The JSON Schema is locked at v1. Breaking changes bump to v2 and keep v1 readers working for one release cycle. Run-time validation lives in packages/analysis/src/docmeta.ts (written as part of spec 001 Act phase).