Skip to content

v0.31.1 — scoped-force clear + doc vector routing + warm-retry bound - #7

Merged
hamr0 merged 2 commits into
mainfrom
feat/litectx-fixes
Jul 28, 2026
Merged

v0.31.1 — scoped-force clear + doc vector routing + warm-retry bound#7
hamr0 merged 2 commits into
mainfrom
feat/litectx-fixes

Conversation

@hamr0

@hamr0 hamr0 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Four correctness fixes to the index/recall/MCP surface (all were uncommitted working-tree changes; none had reached npm). Each ships a mutation-verified regression test.

Fixes

  1. Scoped-force clear footgun (src/index.js) — index({ force: true, paths: […] }) cleared the whole index while re-inserting only the scoped subset, deleting files outside the caller's scope. The destructive whole-index wipe is now gated on a whole-index rebuild (clearAll = rebuild && !partial); a scoped force pass re-chunks its files in place (reported updated, not added) and touches nothing else. Not reachable via CLI/MCP — a latent library-API footgun.
  2. Doc recall vector-table collision (src/store.js + src/index.js) — a written doc whose id equals an indexed .md path put the same path in both file_embeddings and mem_embeddings; the semantic re-rank merged both into one path-keyed map, letting the written vector clobber the file's at cosine time. search() now carries docs.source; docCandidateVectors routes each doc candidate to the table its source names (positional, no clobber); the internal source field is stripped before recall returns. Completes the 0.31.0 vector-table split for the one kind spanning both tables.
  3. MCP warm-index retry bound (bin/litectx-mcp.js) — 0.31.0 retried a failed warm-index on every initialize, so a reconnect loop against a durably-broken index thrashed a full rebuild each handshake. Bounded to 3 attempts before giving up until restart.
  4. added/updated reporting (src/index.js) — a scoped force pass counted files as added; now correctly updated, consistent with the stale-stamp scoped path.

Verification

  • Bug release: v0.28.0 — export WRITE_KINDS (write-side kind vocabulary) #2 (doc collision) proven reachable first with a real POC, not assumed.
  • All regression tests mutation-verified (each driven RED by neutralizing its own fix).
  • Independent second-model /diff-review on origin/main...HEAD: 0 Critical / 0 Warning.
  • /ship: tests 419 pass / 0 fail / 1 skip (pre-existing embeddings-dep skip), tsc --noEmit exit 0.
  • /security: injection-safe (${table} literals, bound params), tenant fence intact.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MEtvo8nTSpwN59712wEPEt

hamr0 and others added 2 commits July 28, 2026 13:43
Four correctness fixes to the index/recall/MCP surface (all uncommitted
working-tree changes; none had reached npm):

- index(): a scoped force pass (force + paths) no longer wipes the whole
  index while re-inserting only the scoped subset. Decouple clearAll
  (physical whole-index wipe) from rebuild (re-chunk in scope); a scoped
  force pass now re-chunks in place and reports `updated`, not `added`.
- MCP warm-index: bound the retry (WARM_MAX_ATTEMPTS=3) so a persistently
  failing index can't thrash a full rebuild on every reconnect.
- doc recall vector-table split: a written doc whose id equals an indexed
  .md path no longer has its file vector clobbered by the mem vector at
  cosine time. search() carries `source`; docCandidateVectors routes each
  doc candidate to the table its source names (positional, no clobber);
  the internal `source` field is stripped before recall returns.

Each fix ships a mutation-verified regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MEtvo8nTSpwN59712wEPEt
…ry bound

Docs + version bump for the four correctness fixes:
- CHANGELOG: [0.31.1] entry (scoped-force clear, doc vector-table routing,
  bounded warm-index retry).
- litectx.context.md: scoped pass never deletes outside scope now holds under
  `force`; warm-index retry documented as bounded.
- litectx-prd.md: doc recall routes each candidate to its own vector table;
  scoped-force clear gated on a whole-index rebuild.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MEtvo8nTSpwN59712wEPEt
@hamr0
hamr0 merged commit 20b8153 into main Jul 28, 2026
2 checks passed
@hamr0
hamr0 deleted the feat/litectx-fixes branch July 28, 2026 21:37
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