cc-os/openspec/changes/graphify-ollama-setup/proposal.md

33 lines
2.9 KiB
Markdown
Raw Normal View History

## Why
Step 2c produced the gold-standard reference set (18 Claude fragments across 6 fixtures), but no local extraction model has been scored against it yet — so the critical-path question "which Ollama model drives vault extraction?" is still open and blocks the initial vault graph build (Step 2d) and everything downstream (hooks, plugin packaging). This change installs and configures the extraction toolchain, scores candidate Ollama models against the existing references, and builds the first real vault graph.
## What Changes
- Install and verify Graphify (`graphifyy` package, `graphify` command) — Step 2a.
- Configure Ollama for extraction: flash attention, 8K context, keep-alive — Step 2b.
- Score candidate local Ollama models against the Step 2c gold-standard references on the same 6 fixtures, measuring both extraction quality (vs. the Opus rubric) and wall-clock speed, then select the extraction model. `gemma4:e4b` is the front-runner candidate (feasibility-validated at ~74 tok/s) but is **not** pre-selected — selection is decided by the scoring run.
- Build the initial vault graph with the selected model and review `GRAPH_REPORT.md` god-nodes for sanity — Step 2d.
- Step 2c (reference set) is a **completed prerequisite**, not work in this change; per-project code graphs (Step 2e) are **out of scope**.
## Capabilities
### New Capabilities
- `local-model-selection`: Score candidate Ollama extraction models against the Step 2c gold-standard reference set and select the model by evidence (quality vs. the Opus rubric + measured speed), rather than hardcoding one. Owns the Ollama runtime configuration (flash attention, context size) that the scoring run depends on.
- `vault-graph-build`: Build the initial `~/Documents/SecondBrain` vault knowledge graph with the selected extraction model and verify graph sanity by reviewing god-nodes against the vault's actual content.
### Modified Capabilities
<!-- None. This change consumes `reference-extraction-benchmark` (Step 2c, complete) as a
prerequisite and is a build-step under `incremental-migration`; it changes neither spec's
requirements. -->
## Impact
- **New dependencies:** Graphify (`graphifyy` on PyPI, anchored to v0.8.30), a running Ollama with at least one pulled candidate model.
- **Environment:** Ollama env vars (`OLLAMA_FLASH_ATTENTION`, `GRAPHIFY_OLLAMA_NUM_CTX`, `GRAPHIFY_OLLAMA_KEEP_ALIVE`) set in the shell profile now; rebaked into the plugin env block at Step 6.
- **Artifacts produced:** a model-scoring result recording the chosen model and its rationale; the initial vault `graphify-out/graph.json` + `GRAPH_REPORT.md` (disposable/rebuildable per ADR-008, not synced).
- **Consumes:** the 18 reference fragments in `docs/memory-system/benchmark/reference-outputs/` and the 6 fixtures.
- **Unblocks:** Step 2e (per-project code graphs), Step 3 (hooks), and downstream plugin packaging — all of which assume a selected model and a built vault graph.