Skip to content
SprecherEast
Issue 770

process: Make the knowledge-sync check cover the whole repository, not only mapped modules

Back to our plan
Done
ciprocesspriority: high

Problem

The knowledge-sync check only guards code under paths listed in docs/knowledge/map.json. Today that is the events module alone. A behavior change anywhere else (a new block, a route, shared platform code, scripts, config) passes with no check. This already happened: PR #766 (the map block) said it updated the block list in docs/guidelines/payload-cms.md, but that file was not in its diff, and nothing failed.

The owner wants the check to cover the whole repository, not only mapped modules, without reviewing every small edit (decision recorded below).

Decision (owner, 2026-11-06, Claude Code voice session, relayed in text)

  • The check applies to any behavior change anywhere in the repository. The per-module trigger is removed: a mapped path is no longer what decides whether a PR is checked.
  • It must be smart. Changes that cannot alter behavior (tests, comments, formatting, docs-only edits, pure refactors) do not trigger a knowledge review, so tokens are not wasted.
  • Missing a real behavior change is the worse failure. When the check cannot tell, it leans toward asking for the declaration.
  • How to detect behavior change is left to the implementer, within the native-first ladder.
  • Notes that exist (such as the events note) stay; map.json keeps saying which note describes which code, but it no longer limits where the check runs.

Proposed fix

  1. Record findings first: how other tools decide "does this change need docs" (changed-file classification, CODEOWNERS-style rules, docs-impact heuristics), with links.
  2. Replace the mapped-path trigger in .github/scripts/knowledge-sync.mjs with a repository-wide classifier. Suggested starting point: classify changed files as exempt (tests, comments-only or formatting-only diffs, docs, lockfile-only dependency patches) or behavior-bearing (everything else under src/, scripts/, .github/, ops/, config, migrations). For a behavior-bearing change the PR must either change the note or reference that describes it, or declare Behavior change: none with a reason of at least 20 characters. A change under a mapped path still has to name its mapped note.
  3. Update decision 0019 §6, guard rail 9, the PR template wording, pr-review and the hook reminder (#717) to match.
  4. Tests first: fixtures for exempt and behavior-bearing diffs, including the #766 case.

Acceptance criteria

  • A PR that changes behavior-bearing code outside any mapped module fails PR Policy unless it changes a doc or declares Behavior change: none with a reason.
  • A PR that only changes tests, comments, formatting or docs passes without a declaration.
  • Replaying the #766 diff against the new check flags the missing payload-cms.md update.
  • Decision 0019 §6, guard rail 9 and the reviewer's checklist describe the new rule. npm run agent-context stays under budget.
  • The classifier rules are in one place and documented.

Area

ci, process

Priority

priority: high

Files likely touched

.github/scripts/knowledge-sync.mjs, .github/scripts/knowledge-sync.test.mjs, .github/workflows/pr-policy.yml, .github/pull_request_template.md, docs/architecture/decisions/0019-knowledge-layer.md, docs/guidelines/guard-rails.md, docs/knowledge/map.json (comment only), .agents/skills/pr-review/SKILL.md, .claude/hooks/ (reminder).

Must not touch

Application code under src/.

This is a policy change the owner asked for; the independent review checks it stays within the decision above.


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab