Adaptive Architecture
The repo’s self-remediation model. Every governed surface declares a four-part contract – canonical source · deterministic validator · exact repair command · single gate layer. When any of those four is missing, the surface stays inadvisory state until the contract is complete. Once complete, an OSS contributor (or an AI agent acting on their behalf) can correct routine drift without privileged context or staff approval.
The novelty is not validators or hooks individually – most large repos have those. The novelty is the manifest-driven five-stage control loop and the explicit retirement of “human-only context” as a dependency. Post-D-ACT-10: 4 of 5 unified surfaces are formally ownerless-ready in the canonical repo-governance-surfaces.json (bridge_mode "retired"); 1 advisory (github-workspace-governance). Legacy 8-entry ownerless-governance-surfaces.json superseded but kept on disk for reference.
Honest framing: the model is “ownerless for routine drift” – not “ownerless for policy authorship or destructive operations.” Policy decisions stay human. Routine drift becomes contract.
The four-part contract
Every governed surface must declare:
Until all four are declared, the surface stays in
rollout_state: advisory (reports but does not block). After all four are declared and exercised:
autofix– the remediator runs deterministically and writesmigrating– transitional state during rolloutblocking– full enforcement; PR cannot merge on failure
The five-stage control loop
The loop in practice – concrete walkthrough
A contributor editssnippets/components/elements/Badge/Badge.jsx and forgets to update the @usedIn JSDoc tag.
- Detect. Pre-commit runs the component metadata validator (
operations/scripts/validators/components/library/...). It reports: file path; missing tag; severity P2; exact validator command. - Explain. The hook prints a link to
docs-guide/frameworks/component-framework-canonical.mdx(canonical source for the 7-tag JSDoc contract) + notes the surface is declared inownerless-governance-surfaces.jsonunder idcomponent-governance, gate layerpr-changed, rollout stateautofix. - Repair. The hook prints:
lpd repair --surface component-governance --write --staged. That command runsoperations/scripts/remediators/components/library/repair-component-metadata.jsagainst only the staged file set. The remediator derives the missing@usedInfield fromtools/lib/governance/component-governance-utils.js::buildComponentUsageSummary()– a live scan of MDX imports. - Verify. The remediator’s
--verifymode re-runs the validator after writing. If the validator still fails, the loop hands back control instead of escalating. - Record. The repaired file is staged for commit alongside the source change. The catalog at
docs-guide/catalog/components-catalog.mdxis regenerated becausegenerated-artifacts.jsonlists it as acommitted_derived_scopedartefact whose source set includessnippets/components/**. The PR body picks up the change set. The governance approval policy decides whether theapproval:governance-schemalabel is required based on the surface touched.
A live example of the loop self-detecting
Runningnode operations/scripts/generators/governance/reports/generate-repo-governance-status.js --check on 2026-05-23 prints:
Surface inventory (live, 2026-05-25)
Core mechanisms
Script corpus (live counts, 2026-05-23)
The remediation backbone. All 321 active scripts follow the 11-tag JSDoc contract perdocs-guide/frameworks/script-framework.mdx.
Remediator families
Mode standardisation: every remediator supports
--dry-run / --write / --verify / --staged / --files. The --verify mode is partially adopted – some remediators only repair without re-running the validator after writing. The contract says repair-then-recheck.
Generated artefact governance
Generated files are outputs, not authoring surfaces. When a generated artefact is stale:- Identify the generator in
operations/governance/config/generated-artifacts.json(each entry names path + generator + sources + class). - Run the generator in
--checkmode if available. - Run the generator in
--writemode. - Re-run the check.
- Include both source and output changes in the same review unit.
The 3 artefact classes
Hook policies + commit policies + CI policies per class are defined in
generated-artifact-and-hook-governance.mdx.
Locked decisions
Three registries cover this surface:docs-guide/decisions/registry.md– unified cross-reference index.github/workspace/decisions-log.mdx– 18 locked decisions (D-ACT-01..10 + D-GOV-01..08) covering workflow architecture, taxonomy, pipeline tags, dispatcher modeldocs-guide/decisions/docs-guide-structure.md– D-DG-01..13 covering docs-guide IA migration
Pre-commit hooks (the local enforcement layer)
5 hard gates run on every commit, scoped to 60-second runtime budget:
Bypass policy in
.githooks/BYPASS.md. Pre-commit has an undocumented carve-out allowing deletion without the trailer if the blob hash matches a v2/x-archived/ follow-up.
Acceptance criteria for new adaptive features
A new surface graduates fromadvisory to autofix (or blocking) when:
- The surface has a machine-readable manifest entry in
ownerless-governance-surfaces.jsonorrepo-governance-surfaces.json - The surface has an exact validator command (exits non-zero on drift)
- The surface has an exact repair command (or a documented reason repair is manual)
- The surface declares one primary gate layer (not multiple)
- Reports are bounded by retention policy
- Generated outputs carry banners or are listed in
generated-artifacts.json - The final check can be run by a contributor with only repo-local instructions
- The remediator supports
--verifymode (re-runs the validator after writing) - The validator failure output prints the
lpd repaircommand (the Error Reporting and Issue-Creation Hooks contract below)
Error reporting and issue-creation hooks
The standardised failure-output contract: every blocking failure prints (a) why it failed, (b) the re-check command, (c) the repair command. Repair commands are repo-backed commands an OSS contributor or AI agent can run directly. Adoption is uneven. Most newer scripts comply. Older validators (especially undergovernance/pr/) sometimes print failure reasons without the explicit lpd repair command. Cleanup queue.
Known gaps
”Ownerless” is currently 4 of 5 unified surfaces (P1, honest framing)
The four-part contract is real and enforced for the 8 surfaces inownerless-governance-surfaces.json. The wider repo-governance-surfaces.json lists 28 surfaces, of which 20 are still advisory. Manifests still use owner: docs everywhere in root-governance.json. The agent-governance taxonomy references @livepeer/docs-team. Several policies say “human review” or “review owner”. The model is “ownerless for routine drift” – not “ownerless for policy authorship or destructive operations.” This is consistent with the design intent but should be surfaced in product narrative (and on docs-guide/index.mdx).
The stale governance map is self-detected but not auto-repaired (P1)
generate-repo-governance-status.js --check on 2026-05-23 prints docs-guide/repo-ops/config/repo-governance-map.mdx is stale. The map last regenerated 2026-04-07T13:18:37.118Z – about 6 weeks behind. The system flags itself; nothing auto-runs the repair. The check runs at the right cadence; the publish gate doesn’t. Same root cause as the contracts pipeline 19-day staleness – the cron-is-dry-run bug (fix shipped 2026-05-25 in commit e42946cdf on docs-v2-dev-draft; pending merge to docs-v2 after which the next scheduled run should regenerate the map).
307-row v2 cleanup matrix is recommendation-only (P1)
The v2 folder governance audit reports 307 rows (235_workspace candidates + 72 x-deprecated candidates). 41 internal-scope rows. Largest section (gateways) carries 199 of the 307 rows alone.
The pipeline is mature (policy, lane definitions, matrix generator). Execution is the gap. No automated move-waves have run. Humans approve each batch. Per Workspace Lifecycle Policy, 30/90-day TTL is documented; tasks-retention.yml is a stub (not implemented).
Script JSDoc compliance is much better than the documented gap (live data, 2026-05-23)
Documented indocs-guide/features/gap-analysis.mdx (last verified 2026-05-14): “218 scripts marked template non-compliant.”
Live data 2026-05-23:
- 327 of 321 active scripts have canonical
@purpose(essentially 100%) - 81% have
@type(sampled 100) - 81% have
@concern(sampled) - Only 45 scripts repo-wide use retired
@category - Only 4 use retired
@domain
repair-script-inventory.js to close the gap entirely.
--verify mode adoption is partial
Not every remediator implements --verify (the re-check after write). The contract says repair-then-recheck. Audit the corpus, add --verify to the ones missing it.
Hook scripts violate their own JSDoc spec (P2)
Per SLICE-03:.githooks/pre-commit and pre-push use retired JSDoc tags (@category, @domain, @needs, @purpose-statement) that docs-guide/policies/script-governance.mdx lines 195-205 explicitly bans. The hooks that enforce JSDoc compliance violate the JSDoc spec.
.githooks/verify.sh is dead enforcement (P2)
Per SLICE-03: verify.sh defines 7 internal checks (MDX, JSON, JS, shell, mintlify, snippets-import, browser) but is not invoked by the active pre-commit hook. Dead enforcement code. Either wire it back in OR retire.
.githooks/pre-commit-no-deletions is unwired (P2)
Per SLICE-03: declares @pipeline manual – not yet in pipeline in its own header. Not referenced by install.sh, not invoked by pre-commit, no test. Pure safety-net cruft.
.githooks/script-index.md only catalogues 3 of 7 hook scripts
Generator filter is broken – only catches pre-commit* and pre-push. Misses install.sh, verify.sh, verify-browser.js, server-manager.js.
agent-write-governance.json bridge_mode: "staged" migration incomplete
Per SLICE-03: repo-governance-surfaces.json already flipped to "retired" for the corresponding surface but agent-write-governance.json is still in transitional staged mode. Complete the migration.
No automated decision-registry enforcement
docs-guide/decisions/registry.md says “decisions made in chat that aren’t written here don’t exist” – enforced by convention only. No script checks PRs for chat-decisions that should be in the registry but aren’t. Three separate registries (D-NAV, D-ACT+D-GOV, D-DG) + per-plan registries with no automated cross-index check.
Audit→issue automation is partial (Pattern D “Act” stage)
The Pattern D framework doctrine says “every finding gets a response – no headless scans.” Health-scheduled-scan and brand-scheduled-scan open PRs on manual repair. But the daily scheduled runs write findings nowhere except workflow step-summary output (the cron-is-dry-run bug). The “Act” stage of the scan-report-act pattern is mostly missing for cron-driven scans.Surfaces without canonical claim yet (gaps from the gap analysis)
Surfaces that exist in the repo but have not been promoted into the ownerless model:- ~50 scripts with retired JSDoc tags (above)
- 24 archived JSX components with no removal schedule
- Duplicate developer trees (
v2/developers/,v2/developers1/,v2/developers2/) - Large historical reports under
workspace/reports/**/files/ .vscode/livepeer-legacy.code-snippets.bak(35 KB tracked backup)
docs-guide/features/gap-analysis.mdx but not yet under contract.
Related
- Ownerless Governance Policy – full text of the four-part contract; promotion ladder
- Source-of-Truth Policy – canonical boundaries per surface
- Infrastructure Principles – gate-layer rule ownership
- Generated-Artifact + Hook Governance – 3 artefact classes; commit / hook / CI policies
- Agent Governance Framework – adapter rules per D-DG-11
- Quality Gates Policy – gate-layer map with named tools per tier
- Cleanup + Quarantine Policy – conservative deletion-discipline
- Audit System Overview – static-first audit doctrine
- Governance Index – entry point for all governed surfaces
- Automations – the 4-tier composable workflow architecture + cron-dry-run bug
- Gap Analysis – actionable backlog with file paths + acceptance criteria
operations/governance/config/– the machine-readable manifests this page documentstools/lpd– thelpd repairentrypointworkspace/thread-outputs/repo-consolidation-deep/SLICE-03-operations-governance-tests-hooks.md– full operations/governance + tests + hooks inventory (362 lines)