Skip to content

I0812 — Validate the graph, and let doctor and watch ask the same validator

Implement `knowledge validate` detecting duplicate node ids, dangling explicit references, source paths that no longer exist, hash mismatches, edges with a missing end, edges without provenance and a stale generated index, each with a severity and a reproduce command, and declare the rule in the doctrine registry so doctor and watch dispatch the same validator rather than reimplementing it.

DONE wave 5 · p1 · implementation profile · runs alone

Part of M003 — A session is a durable envelope, and knowledge is compiled from what is already canonical.

Objective

Implement `knowledge validate` detecting duplicate node ids, dangling explicit references, source paths that no longer exist, hash mismatches, edges with a missing end, edges without provenance and a stale generated index, each with a severity and a reproduce command, and declare the rule in the doctrine registry so doctor and watch dispatch the same validator rather than reimplementing it.

Why

Validation logic that exists twice diverges, and the second copy is the one that stops being run. The registry is the mechanism that makes doctor, watch and the command itself provably the same rule.

Current state

Doctrines are declared with a validator, the commands that enforce it and its test; doctor proves each link of that chain from the source rather than from the declaration.

Desired state

knowledge_integrity is declared and dispatched from doctor and watch. Findings distinguish a broken Majordomus-owned reference, which is a failure, from a broken link to a deliberately external resource, which is not. Doctor also answers whether the index can be built at all in this checkout.

Scope

  • lib/knowledge.sh
  • share/standard/majordomus/rules/knowledge-graph.v1.md
  • lib/doctor.sh
  • lib/watch.sh
  • test/cases

Out of scope

  • Repairing anything automatically
  • Failing on a link to a resource outside the repository

Dependencies

What waits on this

Acceptance criteria

  • Every listed condition is detected by a case that introduces exactly that fault
  • The doctrine appears in doctrine list, doctor proves it reaches both commands, and its test is named
  • Severity distinguishes an owned reference from an external one, and the rule for which is which is stated
  • A stale index is drift under watch and a failure under the command, and neither rebuilds it
  • doctor reports whether the index is buildable here without leaving one behind

Validation

  • bash test/run.sh 3075_knowledge_validate_judges_the_graph
  • bin/majordomus knowledge validate
  • bin/majordomus doctor
  • bin/majordomus watch

Evidence required

  • validation_detects
  • doctrines_wired

Evidence

coverstypecommandresultat commit
validation_detectstestbash test/run.sh --no-skips 3075_knowledge_validate_judges_the_graph; bin/majordomus knowledge validatecase 3075 ok, 0 skipped; knowledge validate: 2263 nodes, 2803 edges, 0 failures (code on master since c5aec68c9a6; re-run at master 01227a0)01227a0
doctrines_wiredtestbash test/run.sh --no-skips 3075_knowledge_validate_judges_the_graphcase 3075 ok: doctor and watch dispatch rule majordomus.knowledge-graph (knowledge-graph.v1) to the same validator (code on master since c5aec68c9a6; re-run at master 01227a0)01227a0

Risk

A validator that runs a full extraction inside doctor makes doctor slow enough to be skipped, and a check nobody runs is the failure this project measures. It has to compare hashes rather than rebuild.

Timeline

started
2026-10-17T12:03:09Z
verified
2026-10-17T12:03:31Z
completed
2026-10-17T12:03:55Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I0812.yaml. Read it back with majordomus plan show I0812.

Searches the titles and descriptions of every page this site publishes.