Docs-as-wiki governance
Schema-validated docs tree, generated index, retrospection, de-scarringDocumentation trees grow into hundreds of files nobody can navigate or trust: no lifecycle, stale content indistinguishable from current, no defined home for new knowledge — so agents (and people) re-derive what was already written, and finished documents carry the scars of the review that produced them. This module governs the docs tree like a living wiki: machine-validated metadata on every doc, generated navigation, an activity log, a promotion pipeline from raw session notes to durable pages, and a de-scarring rule that keeps approved documents clean.
Every doc carries machine-validated frontmatter (type, status, lifecycle, owner, freshness); navigation is generated, never hand-curated; knowledge flows raw → compiled → indexed; approved documents are scar-free (review findings live in threads/issues, not the artifact); conflicts resolve along a written authority hierarchy; and a document that defers work to the tracker names an item that is still open.
M4 Lite — minimum useful
a written governance model: a schema doc naming the frontmatter fields, status/lifecycle vocabulary, and the de-scarring rule; new docs start from a template rather than a copied neighbor. Enforcement may be convention-only.
- A written governance model names the frontmatter fields, the status/lifecycle vocabulary, the de-scarring rule, and the authority hierarchy for resolving conflicts between docs.
governance-model-writtenWhat the audit looks for (2)- a schema/governance doc lists required frontmatter fields and their enum vocabularies
- the de-scarring rule and an authority hierarchy are stated in prose
- New docs start from a schema-conformant template rather than a copied neighbor.
docs-start-from-templateWhat the audit looks for (1)- a doc template with valid frontmatter exists and is referenced by the instructions
M4 Standard — production teams
frontmatter is machine-validated in CI (required fields, enum membership, date format), by a check that states the YAML subset it reads; the index is generated with a freshness gate; the authority hierarchy is written. De-scarring is at least an advisory lint. Where documents defer work to a tracker, the static deferral gate blocks a deferral that names no item, in the pre-commit hook and on the pull request.
- A check validates every doc's frontmatter against the schema (required fields present, enum membership, date format) and runs in CI.
frontmatter-machine-validatedWhat the audit looks for (2)- a frontmatter checker validates required fields, enums, and last_updated format
- a CI job runs it on changed docs and fails on violations
- The navigation index is generated from the tree and a CI drift gate fails when the committed index no longer matches what the generator produces.
index-generated-and-freshness-gatedWhat the audit looks for (2)- a generator produces the index from doc frontmatter
- a CI check regenerates and fails on a stale committed index
- The frontmatter check either reads documents with a full YAML parser, or states the subset of YAML it reads and rejects every construct outside it with an error instead of guessing at a value.
frontmatter-subset-declaredWhat the audit looks for (3)- the frontmatter check's documentation or the governance doc lists the YAML constructs it reads and the ones it rejects (or the check parses documents with a full YAML parser)
- a document using a construct outside the stated subset (an anchor, a duplicate key, a value continued on the next line) fails the check, and a self-test proves it per construct
- a line-oriented reader with no stated subset, or one that silently takes the first of two duplicate keys, is not credited
- A document that defers work to the tracker names the item that carries it, in the same block of prose as the deferral, and a check enforces this on the lines each change adds, in the pre-commit hook and in CI (expected-absent where no document defers work to a tracker).
deferrals-name-itemsWhat the audit looks for (4)- a check reads configured marker phrases (such as 'tracked to closure' or 'a follow-up will be filed') and item-reference patterns, and fails a block of prose with a marker and no item reference
- CI runs it over the pull request's range with history back to the merge base, and a run without a range says it skipped rather than passing
- a block is set aside only by a waiver that states its reason, and a configuration the check cannot read exits as could-not-check rather than passing
- a check that recognises unfiled promises by their wording (a list of ways to say 'a new issue will be filed') is not credited: it is always one phrasing behind
- A single-valued authority hierarchy is written down so contradictions between docs resolve without a judgment call.
authority-hierarchy-writtenWhat the audit looks for (1)- the governance doc states an ordered precedence for conflicting sources
M4 Strict — regulated / compliance posture
de-scarring lint blocks promotion to approved; a stale-doc gate requires last_updated to advance when a doc’s body changes, and generators stamp their dates sticky in UTC; the orphan report is generated with the index; the wiki-lint cadence runs on a schedule and posts to the log; raw → compiled promotion (retrospection backlog) is tracked; where documents defer work to a tracker, a scheduled check on the default branch fails a deferral whose items have all closed.
- A scar lint prevents a doc from reaching a promoted status (approved, or the statuses the repository configures as promoted) while carrying review scars (strikethroughs, resolution phrasing, reviewer dialogue), with a self-test proving the lint still catches scars.
descarring-lint-blocks-approvalWhat the audit looks for (2)- a scar lint scans docs of every promoted status the repository uses and fails on scar markers
- a blocking self-test proves the lint catches known scars
- A CI check requires last_updated to advance in the same diff when a doc's body changes, so freshness metadata cannot silently lie.
stale-doc-gateWhat the audit looks for (3)- a diff-aware check fails when a body change (an added or removed line after the frontmatter) does not advance last_updated, unless it already equals today's UTC date
- only a last_updated line inside the frontmatter counts as a bump, compared after cutting comments and quotes, so a body line starting last_updated: or an added comment does not pass
- CI runs it over the pull request's range with history back to the merge base, and a run without a range says it skipped rather than passing
- Every generator that writes a dated document into the docs tree stamps last_updated with the UTC date, and advances it only when its output changed.
generators-stamp-sticky-utcWhat the audit looks for (3)- a generator writing a document with a last_updated field under the docs tree takes the date in UTC
- it keeps the existing date when only the date would change (a shared stamping helper, or a comparison that sets aside the last_updated line only)
- a repository whose generators write no dated document into the docs tree scores expected-absent
- The index generator also writes a report of the documents no other document lists as related, and the freshness gate covers that report; orphans themselves warn and never fail.
orphan-report-generatedWhat the audit looks for (3)- a generated report lists the documents referenced by no other document's related list
- the drift gate that checks the index fails when the committed report is stale
- a report written by hand, or one no gate checks, counts as convention
- Where a subtree of the docs tree requires frontmatter fields or values that differ from the rest of the tree, path-scoped rules in the schema enforce them in the frontmatter check, and a rule that cannot be evaluated fails the check.
path-rules-enforce-subtree-vocabularyWhat the audit looks for (3)- the schema declares rules for path prefixes (required fields, values narrowed from the tree's vocabulary, forbidden body text) and the frontmatter check applies them
- a malformed rule (an unknown key, a pattern that does not compile, a value outside the tree's enum) fails the check rather than matching nothing
- a repository with no subtree whose requirements differ from the rest scores expected-absent
- A scheduled wiki-lint runs the health checks (stale, broken links, orphans, retrospection backlog) and posts findings, and raw-to-compiled promotion (retrospection backlog) is tracked.
wiki-lint-cadence-and-promotionWhat the audit looks for (2)- a scheduled job runs the wiki-lint table and records findings (e.g. to an activity log)
- the retrospection/raw-notes backlog awaiting promotion is tracked
- A scheduled job on the default branch asks the tracker whether the items the documents' deferrals name are still open, fails a deferral that has no open item left (an item closed, or one that does not exist), and fails rather than passes when it could not look an item up; the tracker credential is available to that job's tracker step only and never to code from a pull request (expected-absent where no document defers work to a tracker).
deferral-liveness-scheduledWhat the audit looks for (4)- a workflow triggered by a schedule, with any manual trigger limited to the default branch, lists the items the deferrals name and reads their current state from the tracker
- the tracker credential is stored where only the default branch's runs can read it (an environment restricted to that branch, a protected variable) and is used only by the step that calls the tracker; a repository-wide secret is not credited, since a workflow on any branch can read it
- the job fails on a deferral whose items are all closed or missing, and on a tracker that could not be reached or an item it did not answer for
- a deferral that cites a closed item beside an open one passes: the verdict is per deferral, not per citation
Adoption steps
- Copy
templates/WIKI-SCHEMA.mdinto your docs tree, adapt the domain folders and the authority order, and link it from the instruction file; start new docs from a template with valid frontmatter. This is Lite. - Copy
templates/frontmatter-schema.yaml, run the frontmatter check in CI on changed docs, generate the index with the index generator and gate its freshness, and run the scar lint as at least an advisory check. This is Standard. Thedocsskill runs every check of this module in one pass and lists the documents the tree still lacks. - Before tightening any validator (a new required field, a narrowed enum, path rules, the YAML subset), bring the existing docs into line with a one-shot codemod first, or the tightened check blocks every docs pull request on day one. Run it as survey (a histogram of every field’s current values), plan (a read-only diff per mapping family, such as one for status values and one for lifecycle values), then apply, one commit per mapping family, so each can be reverted on its own. Values that occur once or twice go to a triage list for a person to decide; they are never corrected automatically.
- Make the scar lint block promotion to
approved, run the stalelast_updatedgate in CI and the pre-commit hook, stamp generated docs with the sticky stamp, add path rules where a subtree needs them, schedule the wiki-lint table, and track the backlog of raw notes awaiting promotion. This is Strict. - Where documents defer work to a tracker, copy
templates/deferral-references.yaml, run the deferral check with--alland fix what it reports (file the item and name it, or say what is true today), then run it on the staged change and on the pull request’s range; that is the Standard rung. For Strict, add the scheduled liveness check fromtemplates/deferral-liveness.ymlwith a provider for your tracker (mappings).
The three-layer modelKnowledge moves up three layers, each promoting into the next:Open
Knowledge moves up three layers, each promoting into the next:
- Raw sources — unstructured capture: session logs, debugging records,
post-mortems, feedback (
retrospection/), and working notes (scratch/). Cheap to write, expected to be temporary. - Compiled wiki — structured, frontmatter-bearing pages organized by domain. The queryable knowledge. Reusable lessons are promoted out of raw sources into here; the un-promoted backlog is tracked by the lint.
- Navigation & meta — the wayfinding layer: a generated
INDEX.md(read first), this schema doc, anAGENTS.md/instruction layer, alog.mdactivity journal, andconnections/cross-domain pages.
Core piecesOpen
- Frontmatter schema — a machine-readable schema (
frontmatter-schema.yaml) fixing the vocabulary: a closed set of doc types, statuses, lifecycle horizons, and owners, a canonical tag list, and a “did-you-mean” suggestion map that steers common wrong values toward the canonical one instead of blindly rejecting. Validated by a blocking check that reads an explicit, documented subset of YAML and rejects anything outside it rather than guessing. Path-scoped rules add requirements for a subtree whose vocabulary differs from the rest (a runbook directory, an archive). - Generated index + freshness gate — a script walks the tree, reads each
doc’s frontmatter, and regenerates
INDEX.md(grouped, sorted). A drift gate fails when the committed index no longer matches the tree — this is M2’s freshness triad applied to navigation. The same generator writes an orphan report: the documents no other document lists as related, a warning that never blocks. - Honest freshness dates — a diff-aware gate requires
last_updatedto advance whenever a doc’s body changes. Generators that write into the docs tree stamp the date sticky: advanced in UTC only when their output changed, so they neither break the gate nor churn dates. - De-scarring rule + scar lint — an approved doc is a clean statement of
current truth; review findings and correction traces (strikethroughs,
“addressed as suggested”, reviewer-dialogue blocks) are scars that belong
in the review thread, the tracking issue, or a light
## Version history— never the artifact. A lint detects scars in changed approved docs, and reports a named draft as not scanned rather than clean. - Authority hierarchy — a written precedence order for resolving contradictions between docs (generated ground-truth > decision records > domain references > feature docs > historical retrospection), so “which doc wins?” is never a judgment call.
- Activity log + wiki-lint cadence —
log.mdjournals every ingest and lint run; a periodic lint table (index drift, stale >6mo, broken links, orphans, missing frontmatter, contradictions, retrospection backlog) keeps the tree healthy, its findings appended to the log. The docs tree is one drift-prone area among others: list it, with its cadence, owner and last-audited date, in the repository’s audit catalog. - Deferral references — a document that defers work to the tracker (“tracked to closure”, “a follow-up will be filed”) names the item that carries it, and that item is still open. A promise naming no item cannot be looked up, and one naming a closed item reads as pending work nobody is doing. An offline gate fails a deferral that names no item on the lines a change adds; a scheduled check on the default branch, the only step holding the tracker credential, fails a deferral whose items have all closed.
In your toolsThe same rule, wired into a specific CI provider, hook manager or tracker. Shows only your stack.Open
The module invariant — validated frontmatter, generated
navigation, scar-free approved docs, a written authority hierarchy — is
tool-independent. This file maps its checks onto concrete
CI providers and git hook managers.
Replace <placeholders> with your values.
The gates, per rung
| Gate | Local (hook) | CI (authority) |
|---|---|---|
| Frontmatter valid | pre-commit over staged docs/**/*.md | blocking; closes the --no-verify hole |
last_updated advanced | pre-commit: stale-last-updated.ts --staged | blocking: DIFF_RANGE=<base>...HEAD with full history |
| Index and orphan report fresh | pre-commit: regenerate + auto-stage INDEX.md and .orphans.md | blocking: generate-index.ts --check |
| No scars in approved docs | (optional) pre-commit | advisory scan + blocking self-test |
| A deferral names an item | pre-commit: check-deferrals.ts --staged | blocking: --range=<base>...HEAD with full history |
| The item a deferral names is still open | none: needs the tracker credential | scheduled on the default branch, never on a pull request |
The pattern throughout: hooks are the fast, bypassable convenience; CI re-runs the same checks and is the authority (see M1).
The recipes name the scripts as <m4>/…, where <m4> is
plugin/skills/docs/scripts inside a pinned Jig checkout: the gates are the
docs skill’s, which also runs them all
in one pass. A vendored copy keeps the plugin’s layout (the skill’s folder
under skills/, beside shared/; see below for why the frontmatter checker
needs shared/).
GitHub Actions
# .github/workflows/docs-governance.yml. No path filter on the trigger: a
# required check must report on every pull request (M1), so the job selects
# its own work.
on:
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
env:
BASE: origin/${{ github.base_ref }} # the target branch, passed as data
M4: <m4>
VENDORED: "" # a vendored copy: its <m4> and shared/ paths, space-separated
steps:
- uses: actions/checkout@<full-commit-sha> # v4
with: { fetch-depth: 0 } # the merge base, new-doc detection and the scar lint need history
- name: Select the work
id: scope
run: git diff --quiet "$BASE"...HEAD -- docs/ $VENDORED || echo "docs=true" >> "$GITHUB_OUTPUT"
- name: Frontmatter valid (blocking)
if: steps.scope.outputs.docs
run: |
# -z: file names verbatim; a file, not a pipe, so a failing git diff stops the step
list=$(mktemp)
git diff -z --name-only --diff-filter=A "$BASE"...HEAD -- 'docs/*.md' > "$list"
export NEW_DOCS="$(tr '\0' '\n' < "$list")"
if git diff --quiet "$BASE"...HEAD -- docs/.frontmatter-schema.yaml $VENDORED; then
git diff -z --name-only --diff-filter=ACMR "$BASE"...HEAD -- 'docs/*.md' > "$list"
mapfile -d '' files < "$list"
[ ${#files[@]} -eq 0 ] || bun "$M4/frontmatter-check/frontmatter-check.ts" "${files[@]}"
else
bun "$M4/frontmatter-check/frontmatter-check.ts" # the schema or checker changed: check every document
fi
- name: last_updated advanced with the body (blocking)
if: steps.scope.outputs.docs
run: DIFF_RANGE="$BASE...HEAD" bun "$M4/stale-last-updated/stale-last-updated.ts" --ci
- name: Index and orphan report fresh (blocking)
if: steps.scope.outputs.docs
run: bun "$M4/index/generate-index.ts" --check
- name: Scar-lint self-test (blocking)
if: steps.scope.outputs.docs
run: bun test "$M4/../__tests__/check-descarring-scars.test.ts"
- name: Scar-lint scan (advisory)
if: steps.scope.outputs.docs
run: |
list=$(mktemp)
git diff -z --name-only --diff-filter=ACMR "$BASE"...HEAD -- 'docs/*.md' > "$list"
mapfile -d '' files < "$list"
[ ${#files[@]} -eq 0 ] || bun "$M4/scar-lint/check-descarring-scars.ts" "${files[@]}"
continue-on-error: true # promote to blocking by deleting this lineThe schema is listed with the documents because a change to it changes what
every document must satisfy: a new path rule or a narrowed enum is checked
against the whole tree, not only the documents the pull request touches. A
vendored checker counts the same way, so when you vendor it, set VENDORED to
its <m4> and shared/ paths: that one value feeds both the step that selects
the work and the comparison that decides on the whole tree. On GitLab, add
those paths to the job’s changes: list as well as to VENDORED. Renamed
documents (R) are checked at their new path, since a move into another
subtree can break that subtree’s path rules.
File names come from git diff -z, which prints them verbatim, each ended by
a zero byte; without it git quotes a name holding a double quote, a backslash,
a control character such as a newline, or (under the default
core.quotePath) a non-ASCII character, and the quoted form names no file.
The list goes through a file rather than a pipe or process substitution, so
a failing git diff stops the step instead of reading as an empty list. The
pathspec is 'docs/*.md': in a git pathspec * crosses /, so it matches
every depth, while 'docs/**/*.md' misses the documents directly under
docs/. NEW_DOCS takes one path per line, and the checker fails on an entry
that names no file it checked. mapfile -d '' needs bash 4.4 or later.
GitLab CI
docs-governance:
# Merge-request pipelines only: CI_MERGE_REQUEST_DIFF_BASE_SHA is empty in
# any other pipeline, and the stale gate needs it for its range.
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: ['docs/**/*'] # documents and the schema beside them; a vendored checker's paths too
variables: { GIT_DEPTH: 0, M4: <m4>, VENDORED: "" } # full history: the merge base must be present
image: <an image with bun and bash>
script:
- |
BASE="$CI_MERGE_REQUEST_DIFF_BASE_SHA"
list=$(mktemp)
git diff -z --name-only --diff-filter=A "$BASE"...HEAD -- 'docs/*.md' > "$list"
export NEW_DOCS="$(tr '\0' '\n' < "$list")"
if git diff --quiet "$BASE"...HEAD -- docs/.frontmatter-schema.yaml $VENDORED; then
git diff -z --name-only --diff-filter=ACMR "$BASE"...HEAD -- 'docs/*.md' > "$list"
mapfile -d '' files < "$list"
[ ${#files[@]} -eq 0 ] || bun "$M4/frontmatter-check/frontmatter-check.ts" "${files[@]}"
else
bun "$M4/frontmatter-check/frontmatter-check.ts"
fi
- DIFF_RANGE="$CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD" bun "$M4/stale-last-updated/stale-last-updated.ts" --ci
- bun "$M4/index/generate-index.ts" --check
- bun test "$M4/../__tests__/check-descarring-scars.test.ts"
# advisory scar scan as a separate allow_failure job:
docs-scars:
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: ['docs/**/*.md']
variables: { GIT_DEPTH: 0, M4: <m4> }
image: <an image with bun and bash>
script:
- |
list=$(mktemp)
git diff -z --name-only --diff-filter=ACMR "$CI_MERGE_REQUEST_DIFF_BASE_SHA"...HEAD -- 'docs/*.md' > "$list"
mapfile -d '' files < "$list"
[ ${#files[@]} -eq 0 ] || bun "$M4/scar-lint/check-descarring-scars.ts" "${files[@]}"Any CI that can run Bun runs every gate. The only provider
specifics are the base-diff expression (for new-doc detection, the stale gate’s
range and diff-scoped scanning) and the advisory mechanism
(continue-on-error / allow_failure).
The stale gate needs two things from CI. A full history (fetch-depth: 0, or
GitLab’s GIT_DEPTH: 0), because a triple-dot range reads the old side at the
merge base, and a shallow clone may not hold it; the gate exits 2 when the
range does not resolve rather than passing. And the range itself: with --ci
and no DIFF_RANGE it prints SKIP — … and does not check, so a job that
misses the variable says so in its log. A range that is set but malformed (an
unset base variable turns $BASE...HEAD into ...HEAD) is an error in every
mode, so run the job only where its base exists: on pull_request events, or
GitLab’s merge-request pipelines as above.
The M4 scripts need only <m4> (lib/docs.ts and stamp/ are shared inside
it), except the frontmatter checker: it parses the schema with the js-yaml
build the plugin vendors, at ../../../../shared/vendor/js-yaml.mjs from
<m4>/frontmatter-check/. That is why <m4> sits in a checkout or a copy
with the plugin’s layout, skills/docs/scripts/ with shared/ two levels
above the skill, and not on its own at the repository root. Without shared/
the checker exits 2 rather than reading the schema another way. The scar
lint’s self-test sits beside <m4> in the skill’s __tests__/, which a Jig
checkout holds and a plugin install leaves out.
Hook managers (index auto-stage + fast frontmatter feedback)
| Manager | Wiring |
|---|---|
| lefthook | pre-commit docs-index-fresh: glob: "docs/**/*.md", run: bun <m4>/index/generate-index.ts && git add docs/INDEX.md docs/.orphans.md, stage_fixed: true; pre-commit frontmatter: glob: "docs/**/*.md", run: bun <m4>/frontmatter-check/frontmatter-check.ts {staged_files}; pre-commit docs-last-updated: glob: "docs/**/*.md", run: bun <m4>/stale-last-updated/stale-last-updated.ts --staged {staged_files} |
| husky | in .husky/pre-commit: guard on git diff --cached --name-only | grep -q '^docs/.*\.md$', then run the generator + git add docs/INDEX.md docs/.orphans.md, then the frontmatter check, then stale-last-updated.ts --staged |
| pre-commit framework | repo: local hooks with files: '^docs/.*\.md$': one runs the frontmatter check, one stale-last-updated.ts --staged, one the index generator (a modified INDEX.md or .orphans.md fails the commit; git add + retry) |
Deferral references
The static half runs where the other diff-aware gates run. In the GitHub
Actions job above, add a step after the last_updated one; it needs the same
full history and the same $BASE:
- name: A deferral names an item (blocking)
run: bun "$M4/deferral-references/check-deferrals.ts" --ci --range="$BASE...HEAD"The step has no if:: the docs/ selection above does not cover the
documents the gate’s own include globs reach (a root README.md, say) or
its configuration file, and the gate selects its own documents from the range,
quickly.
On GitLab, in the docs-governance job’s script:
bun "$M4/deferral-references/check-deferrals.ts" --ci --range="$CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD".
With --ci and no range the gate prints SKIP and passes, so a job that lost
its base says so; a malformed range is an error. The job’s changes: list
must cover the configuration’s include globs and the configuration file
(.config/deferral-references.yaml) itself, since a new items pattern
changes what every document must satisfy.
The hooks run on a staged Markdown file or a staged configuration, so a commit that changes only the configuration still sweeps every document:
| Hook manager | Wiring |
|---|---|
| lefthook | pre-commit deferrals: glob: "{*.md,.config/deferral-references.yaml}", run: bun <m4>/deferral-references/check-deferrals.ts --staged |
| husky | in .husky/pre-commit, after the last_updated check: bun <m4>/deferral-references/check-deferrals.ts --staged (it runs on every commit) |
| pre-commit framework | repo: local hook, files: '\.md$|^\.config/deferral-references\.yaml$', pass_filenames: false, entry: bun <m4>/deferral-references/check-deferrals.ts --staged |
The gate takes no file names: it judges the staged change, so pass_filenames
and {staged_files} are unused.
The live half holds one credential, in one step (the workflow template is the GitHub Actions form). The scheduled trigger and the rule that a manual run is allowed only on the default branch are the provider specifics:
| CI | Scheduled run | Credential |
|---|---|---|
| GitHub Actions | on: schedule; workflow_dispatch with the job if: limited to the default branch (a guard against a slip, not a control: a manual run uses the chosen branch’s workflow file) | A secret of an environment whose deployment branches are the default branch alone, named by the job’s environment:, and read in the env: of the one step that calls the tracker. A repository secret is readable by a workflow on any branch and does not keep it from pull-request code |
| GitLab CI | A pipeline schedule on the default branch; rules: - if: $CI_PIPELINE_SOURCE == "schedule" | A CI/CD variable marked masked and protected, so only protected branches’ pipelines receive it |
| Other | A scheduler that runs the default branch’s pipeline | A secret that merge-request or pull-request pipelines cannot read |
The provider is a command that reads item keys on standard input, one per line,
and prints a JSON object from each key to open, closed or not_found. It
must exit non-zero when it could not ask, and when it was asked about an item
it could not classify. Per tracker:
| Tracker | Provider |
|---|---|
Jig’s tracker interface (Linear, GitHub Issues or Jira: the adapter issue_tracker.adapter names) | bun <jig>/plugin/skills/do-item/scripts/tracker.ts issue-states with issue_tracker in .config/jig.yaml and the adapter’s credential in the environment (LINEAR_API_KEY for Linear; a signed-in gh for GitHub Issues; JIRA_EMAIL and JIRA_API_TOKEN, JIRA_BEARER_TOKEN or JIRA_TOKEN_COMMAND for Jira). It reads the state category of each item through the tracker interface: completed, canceled and duplicate are closed, a missing item is not_found, and an issue the tracker reports without a category fails the run. Keys are ENG-123 or #123 |
| Jira | GET /rest/api/3/issue/<key>?fields=status, mapping status.statusCategory.key of done to closed and of new or indeterminate to open, and failing on any other category (an undefined one included); a 404 to not_found; every other status code fails the provider |
| A plan file in the repository | A script that reads the item’s status from the file; no credential, so it can run in the pull-request check beside the static half |
A provider that maps a failed request to not_found turns an outage into a
report that every item is gone, or the reverse; keep “does not exist” and
“could not ask” apart.
Schema format
The schema template is YAML because the frontmatter is YAML, but the checker
only relies on the regular values: [...] / list shape — any format your repo
prefers works as long as the reader is adjusted. Keeping the schema machine
read at runtime (rather than duplicating the enums inside the checker) is the
point: the schema is the single source of truth for the doc vocabulary.
The module’s runnable form is the
/jig:docs skill: one pass over a
repository’s docs tree that runs every gate below, flags drafts left stale
and lists the documents the project’s type calls for and the tree lacks. The
gates live in the skill, each with its own command line for a hook or CI, and
their self-tests and fixtures in the skill’s __tests__/.
What this module provides:
templates/WIKI-SCHEMA.md— the written governance model: the three layers, frontmatter, de-scarring, the authority hierarchy, the wiki-lint table and naming conventions.templates/frontmatter-schema.yaml— the closed vocabularies (types, statuses, lifecycle horizons, owners), a neutral canonical tag list, the “did you mean” suggestions and a tag merge map.templates/deferral-references.yamlandtemplates/deferral-liveness.yml— the configuration (item patterns, marker phrases, scope) and the scheduled workflow, with the credential held by one step on the default branch.mappings.md(CI providers, hook managers, schema formats) and the module’s maturity criteria.
The gates, in the docs skill:
- the frontmatter check — validates every doc’s frontmatter against that schema, read at run time, including its path-scoped rules, and documents the YAML subset it reads;
- the index generator —
generates
INDEX.mdand the orphan report from frontmatter, with a--checkfreshness gate over both; - the stale
last_updatedgate — fails a diff that changes a doc’s body without advancinglast_updated, over a CI diff range or the staged changes; - the sticky stamp —
sticky UTC stamping of
last_updatedfor generators; - the scar lint — finds scars in approved docs, with code masked first, and reports named files it did not scan;
- the deferral check — fails a block of prose that holds a deferral marker phrase and names no item, over the lines a diff adds or the whole tree; and, in separate steps that keep the credential out of the check, fails a deferral whose items have all closed or do not exist, from a tracker’s answers it is given as a file;
- the frontmatter reader the gates share: the YAML subset, with an error for each construct outside it.
The
/jig:descar skill is the
operating procedure for the de-scarring rule: it handles the part a lint
cannot do. /jig:promote-memory
promotes a lesson from an agent’s private memory into this docs tree.
Deliberately left out: a tag-merge normalizer and a full canonical tag taxonomy, because a tag list is a repository’s domain values; the schema template shows the mechanism (a canonical list plus a merge map) with neutral tags. The frontmatter codemod is a procedure (adoption step 3), not a gate, for the same reason: its mapping tables are a repository’s values.
The deferral check does not judge that the item named is the right one, and its static half reads blocks of prose, not sentences. Both are stated, with the reasons, in the check’s README. It ships a tracker provider for the tracker interface Jig’s skills use; the mappings sketch the others.
Future: a schema for connections/ pages; a scheduled wiki-lint workflow
(the lint table runs as a manual cadence until then); and a path rule that
requires each document under a prefix to have a row in that directory’s
README.