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

4.3 KiB

Handoff — graphify-ollama-setup (2026-06-05)

Where we are

Mid-application of the graphify-ollama-setup OpenSpec change. Toolchain installed; the hard part (finding a local model that produces relationship-bearing graphs through graphify) is SOLVED. Remaining: formal scoring, selection record, vault build, doc updates, verify.

The working config (use this)

  • Model: qwen2.5-coder:7b (graphify's shipped default). Run via Modelfile variant qwen25-coder-7b-16k (already created: FROM qwen2.5-coder:7b + PARAMETER num_ctx 16384).
  • Always: OLLAMA_BASE_URL=http://127.0.0.1:11434/v1 (MUST end in /v1), --backend ollama --max-concurrency 1 (single 12GB GPU, run models sequentially).
  • A one-line thinking-OFF patch (reasoning_effort:"none") is applied to installed ~/.local/lib/python3.14/site-packages/graphify/llm.py (backup: /tmp/graphify-bench/llm.py.orig; patched copy: /tmp/graphify-bench/llm.py.patched). No-op for qwen2.5-coder but harmless; note it for production (lost on pip install --upgrade).

Gotchas (all the lessons, so you don't relearn them)

  1. GRAPHIFY_OLLAMA_NUM_CTX env var does NOT propagate through graphify's ollama /v1 endpoint — bake num_ctx into a Modelfile variant instead. Verify with ollama ps (CONTEXT column).
  2. graphify extract <path> needs a DIRECTORY, not a single file. Each benchmark fixture was isolated in its own dir.
  3. For the vault build, add --exclude .obsidian (graphify treats .obsidian/*.json as code and indexes it as noise).
  4. extract produces graphify-out/graph.json + .graphify_analysis.json (god-nodes here). It does NOT produce GRAPH_REPORT.md — that's a separate step; read the analysis JSON for the god-node sanity check (task 4.2).
  5. OLLAMA_API_KEY only needed if base_url is non-loopback; 127.0.0.1 avoids it.
  6. Small models (gemma4:e4b 8B, gemma4:e2b 5.1B, qwen3.5:2b 2.3B) all FAIL the relationship/edge gate through graphify's prompt — don't revisit them.

Remaining tasks (in order)

  • 3.4 — Score qwen2.5-coder:7b outputs vs the .opus references (docs/memory-system/benchmark/reference-outputs/*.opus.md) on the 3 COMPARABLE dimensions only: entity correctness, relationship plausibility, edge-level EXTRACTED/INFERRED/AMBIGUOUS confidence. EXCLUDE facets + entity-type + free-text relation-typing (graphify doesn't emit them; facets are note metadata per ADR-011). The qwen2.5-coder per-fixture node/edge lists are recorded verbatim in docs/memory-system/benchmark/scoring-results-2026-06-04.md (Round 3) so you can score WITHOUT re-running. Raw graph.json (if /tmp survived): /tmp/graphify-bench/out6/coder7b/<slug>/graphify-out/graph.json.
  • 3.5 / 3.6 — Record + select: add scoring scores + selection rationale to the findings doc; qwen2.5-coder:7b is the de-facto selection. Per the change, don't lock before 3.4 is done.
  • 4 — Build vault graph: OLLAMA_BASE_URL=http://127.0.0.1:11434/v1 graphify extract ~/Documents/SecondBrain --backend ollama --model qwen25-coder-7b-16k --max-concurrency 2 --token-budget 4000 --exclude .obsidian --out <dir>. (token-budget BELOW context so multi-file chunks fit 16k.) Then 4.2 god-node sanity check via .graphify_analysis.json; 4.3 confirm graph artifacts are gitignored/not vault-synced (ADR-008).
  • 5.1 — Update docs/memory-system/05-implementation-process.md status + Step 2 markers (2a/2b/2d executed; selected model = qwen2.5-coder:7b; the e4b/e2b inconsistency is resolved — see findings). NOTE: that doc currently claims 2a/2b "DONE" but they were only truly executed this round; reconcile honestly.
  • 5.2 — Verify with /opsx:verify then archive.

Re-run extraction if /tmp was wiped (reboot)

Fixtures live in the vault; recreate isolated dirs by copying the 6 source notes (slugs in scoring-results-2026-06-04.md Round-3 table) into per-fixture temp dirs, then run the working command above per fixture.

Pointers

  • Findings + raw data: docs/memory-system/benchmark/scoring-results-2026-06-04.md
  • Model-choice reference (incl. Triplex/purpose-built assessment): docs/graphify/10-extraction-model-options.md
  • Task list + status block: openspec/changes/graphify-ollama-setup/tasks.md
  • Optional cleanup: extra ollama variants from the investigation (gemma4-e4b-8k/16k, gemma4-e2b-8k/16k, qwen35-2b-8k/16k) can be removed with ollama rm; KEEP qwen25-coder-7b-16k.