arborist/docs/tickets
russell@unturf.com 38d9116c88
ticket #000039 Phase 1: sqlite-vec semantic retrieval backend
Implements the optional vec backend from the #000039 doc, with the
"obvious" v1 tuning, and demonstrates it on a real corpus shard.

arborist/search/vec.py (new):
- VecBackend(SearchBackend) — ANN over chunk_vecs, UNGROUNDED hits
  (same as FTS5; vec changes recall, never warrant — embeddings are
  soft signal, never in the proof path).
- chunk_vecs vec0 virtual table + vec_meta — sibling tables, additive,
  don't touch chunks/documents/the audit chain.
- embed_documents() — batched ingest; delete-then-insert per chunk_id
  (vec0 doesn't honor INSERT-OR-REPLACE — re-inserting an existing PK
  is a hard UNIQUE error), so re-runs are idempotent and content-
  changed → re-embed works. Skips cold-evicted chunks (content NULL).
- Pluggable Embedder callable; default = fastembed bge-small-en-v1.5
  (~130 MB ONNX, downloads on first use). load_vec_extension(conn)
  toggles enable_load_extension + sqlite_vec.load.
- v1 hyperparams (VEC_BACKEND_VERSION = vec-v1-bge-small-en-v1.5-
  384float32-cosine-flat): model bge-small-en-v1.5, dim 384, quant
  float32 (int8/binary = the production storage knob per §3.1, not
  wired in v1), metric cosine (bge outputs L2-normalized, so cosine
  ranking ≡ L2 ranking), ANN flat (vec0 default), top_k 20. These
  five fold into governance_policy_hash in a later phase (§6).

CLI (arborist/cli.py):
-  — populate chunk_vecs
  for --db; prints progress + timing.
-  — semantic ANN search (errors with
  an install/embed hint if [vec] missing or chunk_vecs empty).
- Both surfaced only when sqlite_vec imports (mirrors the [html] /
  selectolax pattern).

pyproject.toml: [vec] optional extra (sqlite-vec>=0.1.9, fastembed>=0.4);
added to [dev]. Note: sentence-transformers is the heavier "official"
embedder path §5 names; fastembed is the lightweight ONNX one.

tests/test_search_vec.py (7 tests, skip-if-no-[vec]): deterministic
stub embedder (hash → unit vector) so the suite exercises the
sqlite-vec plumbing — ext load, schema, ingest, KNN, JOIN, Hit shape,
limit, idempotent re-embed, --limit cap, empty/unpopulated — without
the heavy fastembed model. Semantic quality is demonstrated on a
shard, not unit-tested.

Demonstrated on ~/.arborist/shards/crawl_appliedcombinatorics_org.db:
168 chunks embedded in ~37 s (mostly model load); semantic queries
return topically-correct hits — "how many ways to choose k things
from n" → top hit "AC Combinations", "binomial coefficient counting"
→ "AC Introduction" (integer-solution counting) + "AC Combinatorial
Proofs". None of the query tokens need stem-match the chunk — the
semantic-allusion-gap closure the ticket promised. chain-check on
that shard reports 0 after embedding (chunk_vecs is a sibling table).

#000039 status flipped to "in progress · Phase 1 landed"; Phase 2
(RRF hybrid fusion in query.py) gated on a ≥5pp recall-lift
measurement with no STRICT-rate regression (§8).

(Unrelated: tests/test_weights.py::test_as_dict_returns_all_eleven_fields
fails in the working tree — that's a parallel-clone in-flight change
to arborist/substrate/weights.py + its test, not touched here.)
2026-05-11 08:23:29 -04:00
..
ticket-000001-retrieval-keywords-audit-gap.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000002-reference-frame-polarity-contract.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000003-anchor-class-warrant.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000004-directive-coverage-in-bench.md docs: tickets/ subdir + delete naming-deferral, ref-frame, coverage-audit 2026-05-02 12:51:09 -04:00
ticket-000005-label-ladder-migration.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000006-bench-emergent-findings.md ticket #000035: flip φ_PRG counter big-endian → little-endian to match v7 TLV 2026-05-11 07:47:35 -04:00
ticket-000007-query-layer-hyphen-fold.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000008-broad-quantifier-preflight-guard.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000009-quantifier-preflight-dag-binding.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000010-metacognition-preflight-guard.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000011-soft-preflight-hint-sidecar.md aborist/arborist 2026-05-07 09:31:49 -04:00
ticket-000012-selection-consensus-protocol.md #000046 Phase 1 — HARD live-path Falsification tier (first below-ceiling pack) 2026-05-11 08:16:01 -04:00
ticket-000013-spatial-temporal-substrate.md #000013 closed: v7-W spatial-temporal substrate paper + namespace 2026-05-09 15:00:05 -04:00
ticket-000014-self-model.md selfmodel: land ticket #000014 (identity record + falsification) 2026-05-07 16:36:34 -04:00
ticket-000015-pi-star-domain-library.md pi_star: land ticket #000015 (π* domain library + composition algebra) 2026-05-07 16:51:33 -04:00
ticket-000016-zk-frontier-proof.md #000016 parked: ZK frontier-proof bench plan + wire protocol 2026-05-09 15:05:08 -04:00
ticket-000017-memory-root-lifelong-learning.md memory: land ticket #000017 (memory-root lifelong learning summary) 2026-05-07 16:46:41 -04:00
ticket-000018-soft-hash-covert-channel.md docs/tickets: open #000034 / #000035 / #000036#000018 follow-ups 2026-05-09 14:50:15 -04:00
ticket-000019-specification-methodology.md docs: land ticket #000019 (spec methodology for π*, V, policy fields) 2026-05-07 16:53:28 -04:00
ticket-000020-capital-cost-ledger.md capital: land ticket #000020 (8-capital-form cost ledger) 2026-05-07 16:41:48 -04:00
ticket-000021-bench-fixtures-5s-5t-5r.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000022-adapter-loss-report.md loss_report: land ticket #000022 (adapter LossReport sidecar) 2026-05-07 17:58:50 -04:00
ticket-000023-5s-phase-1b-syllogism-synthesis-semiotics.md bench: land #000023 + #000024 + #000025 (Phase 1a/1b — Dav1DPrometheus suite) 2026-05-07 20:14:44 -04:00
ticket-000024-5t-phase-1b-and-rename.md bench: land #000023 + #000024 + #000025 (Phase 1a/1b — Dav1DPrometheus suite) 2026-05-07 20:14:44 -04:00
ticket-000025-5f-battery.md #000025 §10.11 + §10.13 + §10.14 — close the 5F battery 2026-05-11 07:41:37 -04:00
ticket-000026-real-shard-workload-baseline.md tickets: close #000026 (Phase 3 landed 60b5748) 2026-05-10 15:54:32 -04:00
ticket-000027-canonical-projections-in-providence-cache.md #000027 + #000028: canonical projections persist; STRICT-WITNESSED reachable 2026-05-09 11:37:06 -04:00
ticket-000028-multi-modality-witness.md ticket #000028 §2.6 sketch: refresh stale TODO post-#000027 2026-05-10 07:52:54 -04:00
ticket-000029-claim-pack-source.md ticket #000029: claim-pack source for axiom/theorem JSON bundles 2026-05-09 11:44:08 -04:00
ticket-000030-math-pi-star-expansion-sympy-substrate.md fan-out: close #000030 · composition fixtures · witness end-to-end 2026-05-09 13:29:59 -04:00
ticket-000031-surface-ingest-cited-textbooks.md docs: refresh stale alias counts (residual 40/54 → 74) 2026-05-10 12:27:23 -04:00
ticket-000032-combinatorics-pi-star.md ticket #000032: combinatorics@v1 π* (pure-integer counting kernel) 2026-05-09 13:20:29 -04:00
ticket-000033-claim-pack-pillar-vii-combinatorics.md ticket #000033: pillar VII (combinatorics) live in shard 000 2026-05-09 15:42:40 -04:00
ticket-000034-hessian-alignment-phi-linear.md docs: ticket §7 status refresh (#000034 + #000036) + CLAUDE.md AUTOCOUNT rule + #000045 ref 2026-05-10 18:39:05 -04:00
ticket-000035-prg-choice-phi-prg.md ticket #000036: add KAT-regen tooling + close 2026-05-11 08:02:25 -04:00
ticket-000036-t3-per-window-bound.md ticket #000036: add KAT-regen tooling + close 2026-05-11 08:02:25 -04:00
ticket-000037-prometheus-sigma-recursive-falsification-controller.md #000012 Phase 1c follow-through: wire #000037 §12 Trigger 1 probe to fork_score_branches 2026-05-11 06:56:09 -04:00
ticket-000038-phase-4-content-acquisition.md docs: refresh stale citation-alias counts (40 → 54 → 74) across 4 surfaces 2026-05-10 10:41:07 -04:00
ticket-000039-sqlite-vec-optional-backend.md ticket #000039 Phase 1: sqlite-vec semantic retrieval backend 2026-05-11 08:23:29 -04:00
ticket-000040-phase-5-resolver-content-tokens.md docs/tickets: stale-map sweep — 3 deferred markers refreshed 2026-05-10 07:00:56 -04:00
ticket-000041-citation-aliases-table.md docs: refresh stale citation-alias counts (40 → 54 → 74) across 4 surfaces 2026-05-10 10:41:07 -04:00
ticket-000042-term-aliases-table.md docs: 100% claim-pack warrant resolution recorded across tickets 2026-05-10 08:40:35 -04:00
ticket-000043-t3-bound-constant-tightening.md ticket #000043: open empirical-tightening sub-ticket for T3 bound constants 2026-05-10 11:55:36 -04:00
ticket-000044-autocount-doc-drift-discipline.md ticket #000035: flip φ_PRG counter big-endian → little-endian to match v7 TLV 2026-05-11 07:47:35 -04:00
ticket-000045-prometheus-sigma-phase-3-sleep-sweep.md docs: #000045 §4 sweep-swap closure + cookbook prometheus_audit 22→25 2026-05-10 19:37:20 -04:00
ticket-000046-harder-5sf-fixture-tier.md #000046 Phase 1 — HARD live-path Falsification tier (first below-ceiling pack) 2026-05-11 08:16:01 -04:00
ticket-000047-fork-score-delta-aggregator.md #000046 + #000047 — open the two #000025 §10.14 follow-up tickets 2026-05-11 08:03:45 -04:00