Skip to content

feat: compute the knowledge index via ctx index; drop stored INDEX …#138

Merged
josealekhine merged 1 commit into
mainfrom
feat/fixes
Jul 14, 2026
Merged

feat: compute the knowledge index via ctx index; drop stored INDEX …#138
josealekhine merged 1 commit into
mainfrom
feat/fixes

Conversation

@josealekhine

Copy link
Copy Markdown
Member

…blocks

Replace the hand-maintained <!-- INDEX --> blocks in DECISIONS.md and LEARNINGS.md with a computed, generic ctx index <file> heading projector. The index is recomputed on demand and never stored, so it cannot drift, clobber entries, or double the merge-conflict surface of contributor PRs (the class of bug the old index.Validate guard existed to catch).

  • New ctx index <file> [--depth N] [--json]: projects any Markdown file's ATX headings (DECISIONS/LEARNINGS entries, CONVENTIONS, TASKS ## Phase). Code-fence- and HTML-comment-aware, so template legends and fenced blocks are not mistaken for headings.
  • Rename internal/index -> internal/heading; keep the entry parsers (ParseHeaders/ParseEntryBlocks, still used by ctx agent scoring) and add the generic Headings() matcher.
  • Remove ctx reindex, ctx decision reindex, ctx learning reindex and the block-maintenance API; the entry-write path no longer mutates an index.
  • Strip the stored INDEX blocks from DECISIONS.md and LEARNINGS.md.
  • Sweep the dead exports the removal exposed (index table formatters, reindex/index-update errors, drift-index writers, column headers).

Net deletion. KB indexing is intentionally untouched.

Spec: specs/computed-index-projection.md
Plan: specs/plans/computed-index-projection.md

…blocks

Replace the hand-maintained `<!-- INDEX -->` blocks in DECISIONS.md and
LEARNINGS.md with a computed, generic `ctx index <file>` heading projector.
The index is recomputed on demand and never stored, so it cannot drift,
clobber entries, or double the merge-conflict surface of contributor PRs
(the class of bug the old `index.Validate` guard existed to catch).

- New `ctx index <file> [--depth N] [--json]`: projects any Markdown file's
  ATX headings (DECISIONS/LEARNINGS entries, CONVENTIONS, TASKS `## Phase`).
  Code-fence- and HTML-comment-aware, so template legends and fenced blocks
  are not mistaken for headings.
- Rename `internal/index` -> `internal/heading`; keep the entry parsers
  (`ParseHeaders`/`ParseEntryBlocks`, still used by `ctx agent` scoring) and
  add the generic `Headings()` matcher.
- Remove `ctx reindex`, `ctx decision reindex`, `ctx learning reindex` and
  the block-maintenance API; the entry-write path no longer mutates an index.
- Strip the stored INDEX blocks from DECISIONS.md and LEARNINGS.md.
- Sweep the dead exports the removal exposed (index table formatters,
  reindex/index-update errors, drift-index writers, column headers).

Net deletion. KB indexing is intentionally untouched.

Spec: specs/computed-index-projection.md
Plan: specs/plans/computed-index-projection.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine josealekhine self-assigned this Jul 14, 2026
@josealekhine josealekhine merged commit cc6f13c into main Jul 14, 2026
17 checks passed
@josealekhine josealekhine deleted the feat/fixes branch July 14, 2026 17:43
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