Skip to content

feat: import quality gate — tiny ML keep/drop classifier at import time - #364

Merged
o8-run-agent[bot] merged 1 commit into
mainfrom
feat/import-quality-gate
Mar 24, 2026
Merged

o8-run-agent[bot] merged 1 commit into
mainfrom
feat/import-quality-gate

Conversation

@o8-run-agent

@o8-run-agent o8-run-agent Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

What

Experimental import-time quality gate using a tiny TF-IDF + LogisticRegression classifier (shipped as embedded JSON, <50KB). Filters garbage at import before it enters the DB.

Usage

cortex import <path> --import-quality-gate

Flag is experimental — not default-on yet.

Model

  • Teacher-seeded F1: 0.91, precision 0.83, recall 1.0
  • 50KB JSON embedded in binary
  • Sub-millisecond inference per memory
  • No Python, no ONNX, no external deps — pure Go dot product

Training loop

  • build_import_quality_dataset.py — builds balanced proxy dataset from live DB
  • import_quality_student.py — trains and exports model
  • import_quality_teacher.py — LLM teacher labeling for correction
  • import_quality_gate_eval.py — fixture-based regression test

Validation

  • Fixture eval: 7/7 pass, 0 regression
  • go test ./internal/ingest
  • go test ./cmd/cortex -run Import

What it filters

  • Protocol noise (HEARTBEAT_OK, NO_REPLY, metadata wrappers)
  • Short meaningless fragments
  • Preserves: operational commands, config, decisions, facts

Closes #357 (partial — denylist + quality gate)

@o8-run-agent
o8-run-agent Bot merged commit 931a6db into main Mar 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: memory hygiene — denylist, quality gate, dedup, garbage collection

0 participants