sgm-index: re-embed only new or changed notes, with a --full rebuild flag
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 62/100
Direzione di ricerca
Start with main() in src/sqlite_graph_memory/index_notes.py, which loops over iter_notes() and chunks_of(), then read brain_ask.load_index() to confirm the on-disk format that must not change. Extract a build_index(notes_dir, out_dir, encoder=None, full=False) function and add a manifest keyed by note path. Done when a counting fake-encoder test in tests/test_incremental_index.py shows zero texts embedded on an unchanged rerun, and the .npy rows and meta list stay aligned after a delete.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Drafted by Mycroft, the lab's synthetic AI co-founder; reviewed by @tonydzi.
Goal. Make sgm-index re-embed only the notes that are new or changed since the last run, drop the ones that were deleted, and keep a --full flag for a complete rebuild.
Why it matters. Today the indexer reads every note and re-embeds every chunk on each run (a 24k-chunk vault takes minutes on a GPU and much longer on CPU). That cost is the reason people index less often than they should, and the README lists incremental indexing as "intentionally missing". A stale index quietly returns old content, so cheaper runs mean fresher recall.
Where.
src/sqlite_graph_memory/index_notes.py(main()): today it loops overiter_notes(), chunks withchunks_of(), encodes everything, and overwrites_brain_e5.npyand_brain_e5_meta.pkl. Split the work into a function you can call from a test, for examplebuild_index(notes_dir, out_dir, encoder=None, full=False), whereencoderis injectable so tests never load a model. Keepmain()as the CLI wrapper.- Same file: store a small manifest next to the index (for example
_brain_e5_manifest.json) mapping each note path to its size, mtime and a content hash, plus a fingerprint of the settings that change chunk content (E5_MODEL,CHUNK_CHARS,CHUNK_OVERLAP,SNIPPET_CHARS). If the fingerprint differs, do a full rebuild. Unchanged notes keep their existing rows in the.npymatrix and themetalist; new or changed notes are chunked and encoded; deleted notes' rows are removed. The two files must stay row-aligned, and the output format (matrix of float32 rows, list of dicts withpath,title,snippet,date) must not change, becausebrain_ask.load_index()reads it. - Same file: add an argparse flag
--fullto force a rebuild; keepsgm-index <notes_dir>working as before. tests/test_index_notes.py(or a newtests/test_incremental_index.py): add the tests below with a fake encoder that counts how many texts it was asked to embed.README.md: remove "No incremental indexing" from "What's intentionally missing" and document--full.
How to check.
pip install numpy pytest
python -m pytest -q tests/test_incremental_index.py
python -m pytest -q
Expected: the new tests pass and the whole suite stays green (baseline: 88 passed). The key test: index a temp folder of 3 notes with the fake encoder (it records every text it embeds); run again unchanged and assert the encoder saw zero texts; edit one note and assert only that note's chunks were embedded; delete one and assert its rows are gone and the matrix and meta lengths still match. Show that test failing first against a build that ignores the manifest. A manual run with a real model (pip install -e '.[embeddings]', then sgm-index <folder> twice) is a nice extra but not required.
Done when
- a second run over an unchanged folder embeds nothing, and a test proves it with a counting fake encoder
- changed and new notes are re-embedded; deleted notes are removed;
.npyrows andmetastay aligned -
--fullrebuilds everything; a changed chunk setting or model name triggers a full rebuild automatically - the on-disk index format read by
brain_ask.load_index()is unchanged
Size. ~1 day
Ask here. https://github.com/tonydzi/sqlite-graph-memory/discussions, or comment on this issue.
Claim it by commenting "claiming this" — no permission needed, and it is yours for 7 days.
You keep the copyright to your code. No CLA, no assignment, ever. We answer every issue and PR within 48 hours, including "no, and here is why" — our silence is our bug, so ping the thread.
Full deal: CONTRIBUTING.md
- Lingua principale
- Python
- Stelle
- 9
- Fork
- 6
- Merge medio
- 20h 2m
- PR unite (30g)
- 14
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tonydzi/sqlite-graph-memory
-
index_notes: dot-files (e.g. .draft.md, .trash.md) are indexed despite BRAIN_INDEX_HIDDEN defaultForse già presa @tonydzi l’ha presa 2 giorni fa. Apertaaccepted bug good first issue help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
tonydzi/sqlite-graph-memory#25 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
accepted help wanted
Difficoltà 3/5 Mezza giornata Idoneità per principianti 68/100
tonydzi/sqlite-graph-memory#21 ·
I maintainer di solito rispondono entro 1 giorno
-
accepted help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 50/100
tonydzi/sqlite-graph-memory#19 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tonydzi/sqlite-graph-memory
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
developmentseed/titiler-cmr#250 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: IndexHandler.post crashes with HTTP 500 on malformed payloads, missing credentials, or when login is disabledForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 6 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cookiecutter/cookiecutter-django#6999 ·
I maintainer di solito rispondono entro 1 giorno
-
fix: @_helpers.positional raises TypeError when decorating functions without default argumentsForse già presa @codeXsidd l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
googleapis/google-api-python-client#2845 ·
I maintainer di solito rispondono entro 1 giorno
-
Bump zizmor to 1.31.1+Apertagithub_actions
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
collective/icalendar#2003 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno