Multimodal reasoning tracer β extract, visualize, and explain what vision-language models attend to. Attention maps, reasoning traces, visualization overlays, and a dataset recorder for training data collection.
v1.11.0 β 767 tests passing (9 skipped without MIRU_TEST_REAL_BACKENDS=1).
Python 3.10+ Β· FastAPI Β· Pydantic v2 Β· transformers (CLIP, optional) Β· Pillow Β· NumPy Β· uvicorn
python -m pytest tests/ -x # full test suite (mock backends)
MIRU_TEST_REAL_BACKENDS=1 python -m pytest tests/ # include real VLM backend tests
uvicorn miru.main:app --reload # dev server on :8000
python -m miru # CLI entry point- No
unwrap()β raise with a clear message or log + re-raise - No silent failures β
logging.warningwhen a fallback path swallows an error transformers/torchare optional β all code paths must work in mock-only modeCLIPBackendmust lazy-load weights on firstinfer()call β never at import time- Visualization fallback: pure-zlib PNG encoder when Pillow is absent β never fail silently
- Real-backend tests are always gated behind
MIRU_TEST_REAL_BACKENDS=1β CI runs offline - Attention maps must always be float32 with values in [0, 1] β assert at
AttentionExtractoroutput - Version bumps touch
pyproject.toml+miru/__init__.py
| Module | Role |
|---|---|
miru/api/routes.py |
FastAPI app: GET /health, POST /analyze |
miru/models/base.py |
VLMBackend abstract interface |
miru/models/mock.py |
Deterministic MockVLMBackend (stable-hash Gaussian attention) |
miru/models/clip.py |
CLIPBackend β HuggingFace CLIP via transformers (optional) |
miru/models/qwen3vl.py |
Qwen3VLBackend β generative Qwen3-VL with cross-modal attention (optional) |
miru/models/registry.py |
register(), get(), available(), register_defaults() |
miru/attention/extractor.py |
Min-max norm, block-average resize, top-k hotspot detection |
miru/reasoning/tracer.py |
Structured reasoning trace with decay confidence |
miru/visualization/overlay.py |
Attention heatmap overlay on input image |
miru/recorder.py |
Dataset recorder for training data collection |
miru/fidelity.py |
Deletion-test fidelity scorecard (does masking salient pixels drop confidence?) |
miru/synergy.py |
Modality-level visionΓlanguage Shapley-interaction probe (F_syn) |
miru/alerts.py |
SQLite rule store + webhook delivery for /explain anomalies |
api/main.py |
Deployable FastAPI surface: /explain, /explain/batch, /annotate, etc. |
miru/cli/ |
CLI entry points |
PLAN.mdβ current phase state and version historyCHANGELOG.mdβ all notable changes
Three walls against AI slop β all enforced by CI.
Wall 1 β Pre-commit (bash .konjo/scripts/install-hooks.sh to activate):
ruff lint, ruff format, bare-except scan, DRY check, TODO scan. Blocks the commit.
Wall 2 β CI gate (.github/workflows/konjo-gate.yml):
Coverage β₯ 80% Β· mutation survival β€ 10% Β· complexity β€ 15 Β· file β€ 500L Β· zero DRY violations. Blocks the merge.
Wall 3 β Adversarial review (local only β disabled in CI):
git diff HEAD~1 | python3 .konjo/scripts/konjo_review.py
Claude Opus adversarial critic answers 10 mandatory quality questions.
See KONJO_QUALITY_FRAMEWORK.md for the full specification.
See .claude/skills/ β auto-loaded when relevant.
Run /konjo to boot a full session (Brief + Discovery + Plan).