feat(knowledge): report note conformance on the doc-integrity pass (KnowledgeLint is invoked by nothing) - #1686
Open
elhoim wants to merge 2 commits into
Open
Conversation
GenerateKnowledgeSchemaDoc.ts is currently dead code — nothing invokes it. Two consequences: _schema.md does not exist on a fresh install, and where it does exist it drifts from KnowledgeSchema.ts, which is the declared source of truth. That drift is not theoretical. On the archive this was found on, _schema.md declared kb-v3 while describing 0.9% of the notes it governed, and the gap went unnoticed because nothing regenerated the doc. Wire the generator into DocIntegrity so the doc is rebuilt from the schema on every integrity pass. Fire-and-forget, non-fatal on failure, and run as a subprocess rather than imported because the generator executes main() on import.
RebuildKnowledgeSchema (danielmiessler#1685) keeps _schema.md honest against KnowledgeSchema.ts, so the DOC can no longer drift from the CODE. Nothing checks whether the NOTES conform to either. That gap is how an archive reached 0.9% conformance without a single warning: a bulk import wrote 1,744 notes off-schema, later writers copied their frontmatter and spread the dialect, and KnowledgeLint — the one tool that could have said so — is invoked by nothing in the tree. It only ever runs when a human remembers to type it. Add a read-only conformance check alongside the regen. It calls validate() from KnowledgeSchema directly rather than shelling out, reports a percentage plus the top violation classes, names the repair command (MigrateKnowledge.ts), and emits a typed event for Pulse. Reports only. Never edits, never blocks — non-conformance is a soft warning, matching MemoryDirIntegrity's contract. Verified on a 1,801-note archive: reports 100.0% clean, and a deliberately downgraded note is caught as '1x convention — not kb-v3'. Stacks on danielmiessler#1685.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks on #1685. That PR keeps
_schema.mdhonest againstKnowledgeSchema.ts, so the doc can no longer drift from the code. Nothing checks whether the notes conform to either.The gap this closes
KnowledgeLint.tsexists and works. It is invoked by nothing in the tree — every reference to it is prose, telling a human to run it. So note-level conformance is only ever measured when someone remembers to type the command.That is how an archive reached 0.9% conformance without a single warning:
MemorySystem.renderInitialNote.#1685 makes step 3's documentation half impossible. This makes the data half visible.
The change
A read-only handler alongside the regen, in the pass that already runs.
validate()/parseNote()fromKnowledgeSchemadirectly rather than shelling out to the CLI — one pass, no subprocess.MigrateKnowledge.ts) in the warning, so the next step is obvious.doc.integrity.knowledge_conformancetoSTATE/events.jsonlfor Pulse.MemoryDirIntegrity's contract.Verified
On a 1,801-note archive:
And with one note deliberately downgraded to
convention: kb-v2:Positive and negative both exercised. 451ms over 1,801 notes, so it is not a meaningful cost on the Stop path.