Skip to content

feat(docs): code→doc reverse index — every edit names the docs that claim to describe it (Event 173) - #157

Merged
junjslee merged 4 commits into
masterfrom
feat/event173-doc-map
Jul 20, 2026
Merged

junjslee merged 4 commits into
masterfrom
feat/event173-doc-map

Conversation

@junjslee

Copy link
Copy Markdown
Owner

What

Operator-ratified design C: the drift linter's existing doc→code citation edges, inverted, become an agent-navigable code→doc map with zero hand-maintained state — the map cannot rot by construction.

  • doc_references.py: build_reverse_index / edges_for_path / docs_for_path / annotate_docs / cached_reverse_index (mtime-digest cache, .episteme/cache/doc_map.json, written only where .episteme/ already exists; 196ms cold → 6–11ms steady-state, measured)
  • workflow_guard.py: path-blind static advisory replaced by a targeted DOC ADVISORY naming the citing docs with lifecycle labels; graceful fallback ladder (no package / no git / no citations → the old generic string). Repairs a latent bug the new advisory exposed: doc-path suppression never matched absolute harness paths (lstrip("./") strips a char set, not a prefix).
  • New episteme docs map [path ...] query surface + COMMANDS.md row; AGENTS.md workflow pointer; docs/SPEC_DOC_MAP.md spec.
  • Separate chore commit: kernel MANIFEST re-baselined over the merged E172 edits (verified per-file via git log before re-hashing).

Governance

  • Anti-accretion (K7): counters late-discovered doc-code drift (the E172 sweep class); replaces workflow_guard's static advisory. No new queue (K6) — the write path is the drain ("repair in the same change or record why not").
  • Rule-shape (K8): positive system — obligation only where a live doc cites the path; uncited code carries none.
  • ⚠️ Doc ceiling now at cap 32/32 (SPEC_DOC_MAP.md). The next doc addition forces the budget decision consciously.

Verification

Suite 1787 passed + 91 subtests (baseline 1766+91; +21 new tests: inversion semantics, cache contract, real-corpus edges, hook fallback ladder end-to-end). docs lint / docs index --check / kernel verify clean. Live-verified: the targeted advisory fired on this event's own edits mid-implementation.

junjslee added 2 commits July 20, 2026 16:49
…laim to describe it (Event 173)

Invert the drift linter's existing citation edges into a code→doc map with
zero hand-maintained state: build_reverse_index / edges_for_path /
docs_for_path / annotate_docs / cached_reverse_index in doc_references.py
(one notion of 'what a doc cites'; dangling citations excluded; archive/ and
fixture trees obligation-exempt; mtime-digest cache at
.episteme/cache/doc_map.json, written only where .episteme/ exists).

workflow_guard.py: the path-blind static advisory is REPLACED by a targeted
DOC ADVISORY naming the citing docs with lifecycle labels ([via dir/] for
directory edges, overflow counted never silent), falling back to the generic
string when the package is unimportable, the project has no git, or no doc
cites the path (positive system: no citation, no obligation). Also repairs a
latent bug the new advisory exposed: doc-path suppression never matched the
absolute file paths harness payloads carry (lstrip strips a char set, not a
prefix) — targets now normalize to project-relative before the policy test.

New query surface: episteme docs map [path ...] (same ordering and labels as
the hook; full target ← docs dump with no args). COMMANDS.md names its
source of truth so cli.py edits surface it; AGENTS.md carries the workflow
pointer; SPEC_DOC_MAP.md records the ratified design (docs at ceiling 32/32).

Anti-accretion: counters late-discovered doc-code drift (the E172 sweep
class); replaces workflow_guard's static advisory. Suite 1787+91.
…fix edits

HOOKS_MAP.md / REASONING_SURFACE.md / REFERENCES.md drifted only because the
E172 doc-truth commits (dbd97c1) postdate the last manifest refresh (c86562b);
verified via git log per file before re-hashing. Re-baselining, not laundering.
@vercel

vercel Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
episteme Ready Ready Preview, Comment Jul 20, 2026 9:00pm

…project

The E173 absolute-path normalization used resolve(), which follows symlinks —
and this repo's authoritative docs (docs/NEXT_STEPS.md, docs/EVENTS.md) are
symlinks into a private tree outside the checkout, so a repo-path edit of
exactly the files the suppression exists for would resolve out of cwd and nag
again. Textual prefix-strip first; resolve() only as fallback for spelling
mismatches (/tmp vs /private/tmp). Covered by a symlinked-doc hook test.
…not go blind to pre-documented files

Adversarial review confirmed the hole by disconfirmation: the digest hashes
only the markdown corpus, so a doc citing a not-yet-existing file produced no
edge at build time and creating the file later never moved the digest — the
cached index served a stale empty answer for exactly the pre-documented-file
case. Root cause: dropping dangling citations made the index depend on target
existence, which a markdown-only digest cannot observe. Fix: a citation is a
CLAIM — unresolved citations keep their root-relative spelling as edges, so
the index is a pure function of the markdown corpus and the digest is honest
by construction. Dangling claims remain find_drift's findings; the mechanisms
stay separate. Also: pid-suffixed cache tmp file (concurrent hook processes),
spec updated to tell the truth, reviewer's disconfirmation scenario added as
a regression test. Suite 1789+91.
@junjslee
junjslee merged commit a236fab into master Jul 20, 2026
5 checks passed
@junjslee
junjslee deleted the feat/event173-doc-map branch July 20, 2026 21:01

This branch was successfully deployed

1 active deployment
Preview — a78b52ae Deployed Jul 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant