Phase 2: CF-core deep integration #3

Closed
opened 2026-03-28 15:21:09 -07:00 by pyr0ball · 3 comments
Owner

Completed

  • has_byok detection wired into CloudUser via _detect_byok() — reads ~/.config/circuitforge/llm.yaml, same pattern as Peregrine
  • BYOK unlock propagated to all tier-gated call sites (receipt_ocr, expiry_llm_matching, recipe_suggestions)
  • OCR pipeline staging — full 5-stage pipeline in ReceiptService: quality gate → VLM extraction → flatten → persist → staged status
  • POST /receipts/{id}/ocr/approve endpoint — partial or full approval, normalised inventory entries, moves to processed
  • Unit normalisation — metric as source of truth (g, ml, each); imperial/metric display conversion in app/utils/units.py
  • LLM expiry fallback prompts — conservative food safety framing, integer-only output, 1825-day sanity cap
  • Migration 005 — adds staged and low_quality to receipts status constraint

Deferred to dedicated session

  • SQLCipher per-user DB encryption — needs native lib rebuild in Dockerfile
## Completed - [x] `has_byok` detection wired into `CloudUser` via `_detect_byok()` — reads `~/.config/circuitforge/llm.yaml`, same pattern as Peregrine - [x] BYOK unlock propagated to all tier-gated call sites (`receipt_ocr`, `expiry_llm_matching`, `recipe_suggestions`) - [x] OCR pipeline staging — full 5-stage pipeline in `ReceiptService`: quality gate → VLM extraction → flatten → persist → `staged` status - [x] `POST /receipts/{id}/ocr/approve` endpoint — partial or full approval, normalised inventory entries, moves to `processed` - [x] Unit normalisation — metric as source of truth (`g`, `ml`, `each`); imperial/metric display conversion in `app/utils/units.py` - [x] LLM expiry fallback prompts — conservative food safety framing, integer-only output, 1825-day sanity cap - [x] Migration 005 — adds `staged` and `low_quality` to receipts status constraint ## Deferred to dedicated session - [ ] SQLCipher per-user DB encryption — needs native lib rebuild in Dockerfile
pyr0ball added this to the Alpha milestone 2026-03-28 15:21:09 -07:00
Author
Owner

Progress update — 2026-03-28

Completed this session

  • LLMRouter wired into ExpirationPredictor as tier-gated fallback (prompt TODO left for domain review)
  • /inventory/scan/text endpoint implemented (was called by frontend but missing server-side)
  • Tier gate rollout:
    • receipts.py: OCR background task now checks receipt_ocr tier before queuing
    • inventory.py: both scan endpoints now receive CloudUser session and pass tier to predictor
  • ~/.config/circuitforge mounted into API containers (llm.yaml accessible when present)
  • Salt/Fat/Acid/Heat recipe engine design note saved to circuitforge-plans/kiwi/notes/

Deferred to focused session

  • SQLCipher per-user DB encryption (requires native lib rebuild)
  • LLM prompts in _llm_predict_days (domain review needed)

Remaining Phase 2 items

  • Pipeline staging for receipt OCR queue
  • has_byok detection in get_session (currently hardcoded False)
## Progress update — 2026-03-28 ### Completed this session - ✅ LLMRouter wired into `ExpirationPredictor` as tier-gated fallback (prompt TODO left for domain review) - ✅ `/inventory/scan/text` endpoint implemented (was called by frontend but missing server-side) - ✅ Tier gate rollout: - `receipts.py`: OCR background task now checks `receipt_ocr` tier before queuing - `inventory.py`: both scan endpoints now receive `CloudUser` session and pass `tier` to predictor - ✅ `~/.config/circuitforge` mounted into API containers (llm.yaml accessible when present) - ✅ Salt/Fat/Acid/Heat recipe engine design note saved to `circuitforge-plans/kiwi/notes/` ### Deferred to focused session - SQLCipher per-user DB encryption (requires native lib rebuild) - LLM prompts in `_llm_predict_days` (domain review needed) ### Remaining Phase 2 items - Pipeline staging for receipt OCR queue - `has_byok` detection in `get_session` (currently hardcoded False)
Author
Owner

Progress update — 2026-03-28 (session end)

Completed

  • LLMRouter wired into ExpirationPredictor (fail-soft, tier-gated; prompt TODO for domain review)
  • /inventory/scan/text endpoint implemented (was expected by frontend, was missing server-side)
  • Tier gate rollout: OCR background task, both scan endpoints now check tier before processing
  • ~/.config/circuitforge mounted into API containers (llm.yaml accessible when present)
  • Self-service free key claim wired on website (register + claim-key + account page)
  • Salt/Fat/Acid/Heat recipe engine design note saved to circuitforge-plans

Remaining Phase 2

  • has_byok detection in get_session (currently hardcoded False — BYOK unlock not active)
  • Pipeline staging for receipt OCR queue
  • SQLCipher per-user DB encryption (dedicated session — needs native lib rebuild)
  • LLM prompts in _llm_predict_days (domain review needed — placeholder in place)
## Progress update — 2026-03-28 (session end) ### Completed - ✅ LLMRouter wired into ExpirationPredictor (fail-soft, tier-gated; prompt TODO for domain review) - ✅ `/inventory/scan/text` endpoint implemented (was expected by frontend, was missing server-side) - ✅ Tier gate rollout: OCR background task, both scan endpoints now check tier before processing - ✅ `~/.config/circuitforge` mounted into API containers (llm.yaml accessible when present) - ✅ Self-service free key claim wired on website (register + claim-key + account page) - ✅ Salt/Fat/Acid/Heat recipe engine design note saved to circuitforge-plans ### Remaining Phase 2 - `has_byok` detection in `get_session` (currently hardcoded False — BYOK unlock not active) - Pipeline staging for receipt OCR queue - SQLCipher per-user DB encryption (dedicated session — needs native lib rebuild) - LLM prompts in `_llm_predict_days` (domain review needed — placeholder in place)
Author
Owner

Closing — cf-core integration complete:

  • circuitforge_core.db, llm_router, tiers, config, tasks.scheduler all in use
  • Kiwi scheduler shim passes service_name="kiwi" and coordinator_url to cf-core TaskScheduler
  • VRAM leasing via cf-orch coordinator (cf-orch agent sidecar in compose.override.yml)
  • editable install: pip install -e ../circuitforge-core

All on main as of c418d04.

Closing — cf-core integration complete: - `circuitforge_core.db`, `llm_router`, `tiers`, `config`, `tasks.scheduler` all in use - Kiwi scheduler shim passes `service_name="kiwi"` and `coordinator_url` to cf-core TaskScheduler - VRAM leasing via cf-orch coordinator (cf-orch agent sidecar in compose.override.yml) - editable install: `pip install -e ../circuitforge-core` All on main as of `c418d04`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/kiwi#3
No description provided.