jevify 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. jevify-0.1.0/.github/workflows/ci.yml +54 -0
  2. jevify-0.1.0/.gitignore +35 -0
  3. jevify-0.1.0/AGENTS.md +122 -0
  4. jevify-0.1.0/LICENSE +21 -0
  5. jevify-0.1.0/PKG-INFO +243 -0
  6. jevify-0.1.0/README.md +213 -0
  7. jevify-0.1.0/SKILL.md +148 -0
  8. jevify-0.1.0/docs/00-invariants.md +166 -0
  9. jevify-0.1.0/docs/adr/0001-founding-choices.md +127 -0
  10. jevify-0.1.0/docs/adr/0002-backend-port-and-adapter-kinds.md +183 -0
  11. jevify-0.1.0/docs/adr/0003-jev-compatible-api.md +96 -0
  12. jevify-0.1.0/docs/adr/0004-recipes.md +84 -0
  13. jevify-0.1.0/docs/adr/0005-evaluation-evidence-and-calibration.md +125 -0
  14. jevify-0.1.0/docs/adr/0006-toolchain-dependency-budget-and-portability.md +93 -0
  15. jevify-0.1.0/docs/adr/README.md +20 -0
  16. jevify-0.1.0/docs/evidence/bart-large-mnli.local--policy-29.json +222 -0
  17. jevify-0.1.0/docs/evidence/bart-large-mnli.local--policy-29.md +65 -0
  18. jevify-0.1.0/docs/evidence/bart-large-mnli.local--policy-hard-52.json +351 -0
  19. jevify-0.1.0/docs/evidence/bart-large-mnli.local--policy-hard-52.md +86 -0
  20. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--calibration.json +183 -0
  21. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--calibration.md +24 -0
  22. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--doom-frames-41.json +519 -0
  23. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--doom-frames-41.md +121 -0
  24. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--long-state-24.json +136 -0
  25. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--long-state-24.md +42 -0
  26. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-29.json +149 -0
  27. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-29.md +53 -0
  28. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-hard-52.json +185 -0
  29. jevify-0.1.0/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-hard-52.md +60 -0
  30. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--doom-frames-41.json +675 -0
  31. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--doom-frames-41.md +148 -0
  32. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--long-state-24.json +197 -0
  33. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--long-state-24.md +60 -0
  34. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--policy-29.json +142 -0
  35. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--policy-29.md +49 -0
  36. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--policy-hard-52.json +197 -0
  37. jevify-0.1.0/docs/evidence/gemma-4-e4b-it.llamacpp--policy-hard-52.md +63 -0
  38. jevify-0.1.0/docs/evidence/qwen3-embedding-0.6b.local--policy-29.json +198 -0
  39. jevify-0.1.0/docs/evidence/qwen3-embedding-0.6b.local--policy-29.md +64 -0
  40. jevify-0.1.0/docs/evidence/qwen3-embedding-0.6b.local--policy-hard-52.json +318 -0
  41. jevify-0.1.0/docs/evidence/qwen3-embedding-0.6b.local--policy-hard-52.md +86 -0
  42. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--doom-frames-41.json +849 -0
  43. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--doom-frames-41.md +176 -0
  44. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-29.json +191 -0
  45. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-29.md +63 -0
  46. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-hard-52.json +263 -0
  47. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-hard-52.md +75 -0
  48. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-8b.llamacpp--policy-29.json +161 -0
  49. jevify-0.1.0/docs/evidence/qwen3-vl-reranker-8b.llamacpp--policy-29.md +59 -0
  50. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--doom-frames-41.json +549 -0
  51. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--doom-frames-41.md +127 -0
  52. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--long-state-24.json +136 -0
  53. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--long-state-24.md +42 -0
  54. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-29.json +142 -0
  55. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-29.md +48 -0
  56. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-hard-52.json +191 -0
  57. jevify-0.1.0/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-hard-52.md +64 -0
  58. jevify-0.1.0/jevify/__init__.py +7 -0
  59. jevify-0.1.0/jevify/__main__.py +9 -0
  60. jevify-0.1.0/jevify/adapters/__init__.py +1 -0
  61. jevify-0.1.0/jevify/adapters/embedding/__init__.py +1 -0
  62. jevify-0.1.0/jevify/adapters/embedding/adapter.py +203 -0
  63. jevify-0.1.0/jevify/adapters/embedding/local.py +82 -0
  64. jevify-0.1.0/jevify/adapters/encoder/__init__.py +1 -0
  65. jevify-0.1.0/jevify/adapters/encoder/adapter.py +165 -0
  66. jevify-0.1.0/jevify/adapters/encoder/local.py +77 -0
  67. jevify-0.1.0/jevify/adapters/endpoint/__init__.py +1 -0
  68. jevify-0.1.0/jevify/adapters/endpoint/adapter.py +281 -0
  69. jevify-0.1.0/jevify/adapters/endpoint/client.py +114 -0
  70. jevify-0.1.0/jevify/adapters/endpoint/dialects.py +166 -0
  71. jevify-0.1.0/jevify/adapters/endpoint/probe.py +589 -0
  72. jevify-0.1.0/jevify/adapters/endpoint/readout.py +244 -0
  73. jevify-0.1.0/jevify/adapters/rerank/__init__.py +1 -0
  74. jevify-0.1.0/jevify/adapters/rerank/adapter.py +152 -0
  75. jevify-0.1.0/jevify/api/__init__.py +1 -0
  76. jevify-0.1.0/jevify/api/app.py +228 -0
  77. jevify-0.1.0/jevify/api/schema.py +123 -0
  78. jevify-0.1.0/jevify/api/translate.py +239 -0
  79. jevify-0.1.0/jevify/cli.py +392 -0
  80. jevify-0.1.0/jevify/compose.py +82 -0
  81. jevify-0.1.0/jevify/domain/__init__.py +1 -0
  82. jevify-0.1.0/jevify/domain/distribution.py +103 -0
  83. jevify-0.1.0/jevify/domain/engine.py +152 -0
  84. jevify-0.1.0/jevify/domain/questions.py +121 -0
  85. jevify-0.1.0/jevify/evaluation/__init__.py +1 -0
  86. jevify-0.1.0/jevify/evaluation/calibrate.py +186 -0
  87. jevify-0.1.0/jevify/evaluation/controls.py +78 -0
  88. jevify-0.1.0/jevify/evaluation/metrics.py +91 -0
  89. jevify-0.1.0/jevify/evaluation/scorecard.py +385 -0
  90. jevify-0.1.0/jevify/evaluation/suites.py +166 -0
  91. jevify-0.1.0/jevify/ports/__init__.py +1 -0
  92. jevify-0.1.0/jevify/ports/backend.py +162 -0
  93. jevify-0.1.0/jevify/recipes/__init__.py +21 -0
  94. jevify-0.1.0/jevify/recipes/probe_case.yaml +72 -0
  95. jevify-0.1.0/jevify/recipes/render.py +198 -0
  96. jevify-0.1.0/jevify/recipes/schema.py +204 -0
  97. jevify-0.1.0/jevify/recipes/store.py +81 -0
  98. jevify-0.1.0/pyproject.toml +80 -0
  99. jevify-0.1.0/recipes/bart-large-mnli.local.yaml +55 -0
  100. jevify-0.1.0/recipes/deepseek-v4-flash-vision-exp-keys.vllm.yaml +288 -0
  101. jevify-0.1.0/recipes/gemma-4-e4b-it.llamacpp.yaml +186 -0
  102. jevify-0.1.0/recipes/qwen3-embedding-0.6b.local.yaml +55 -0
  103. jevify-0.1.0/recipes/qwen3-vl-reranker-2b.llamacpp.yaml +166 -0
  104. jevify-0.1.0/recipes/qwen3-vl-reranker-8b.llamacpp.yaml +169 -0
  105. jevify-0.1.0/recipes/ternary-bonsai-2-27b.llamacpp.yaml +216 -0
  106. jevify-0.1.0/suites/doom-frames-41/doom-frames-41.jsonl +164 -0
  107. jevify-0.1.0/suites/doom-frames-41/doom-frames-41.manifest.json +61 -0
  108. jevify-0.1.0/suites/long-state-24.jsonl +24 -0
  109. jevify-0.1.0/suites/long-state-24.manifest.json +18 -0
  110. jevify-0.1.0/suites/policy-29.jsonl +29 -0
  111. jevify-0.1.0/suites/policy-29.manifest.json +16 -0
  112. jevify-0.1.0/suites/policy-hard-52.jsonl +52 -0
  113. jevify-0.1.0/suites/policy-hard-52.manifest.json +19 -0
  114. jevify-0.1.0/tests/conftest.py +72 -0
  115. jevify-0.1.0/tests/fakes/__init__.py +0 -0
  116. jevify-0.1.0/tests/fakes/fake_backend.py +47 -0
  117. jevify-0.1.0/tests/fakes/fake_openai_server.py +587 -0
  118. jevify-0.1.0/tests/fixtures/recipes/fake-embedding.yaml +17 -0
  119. jevify-0.1.0/tests/fixtures/recipes/fake-encoder.yaml +19 -0
  120. jevify-0.1.0/tests/fixtures/recipes/fake-raw.yaml +39 -0
  121. jevify-0.1.0/tests/fixtures/recipes/fake-rerank.yaml +17 -0
  122. jevify-0.1.0/tests/fixtures/recipes/fake-vllm.yaml +46 -0
  123. jevify-0.1.0/tests/fixtures/recipes/local-embedding.yaml +18 -0
  124. jevify-0.1.0/tests/fixtures/recipes/local-encoder.yaml +20 -0
  125. jevify-0.1.0/tests/fixtures/responses/llamacpp-completions-grammar.json +86 -0
  126. jevify-0.1.0/tests/fixtures/responses/llamacpp-completions-top_k.json +122 -0
  127. jevify-0.1.0/tests/fixtures/responses/llamacpp-native-completion.json +58 -0
  128. jevify-0.1.0/tests/fixtures/responses/vllm-chat-top_k.json +96 -0
  129. jevify-0.1.0/tests/guards/test_prompt_literals.py +53 -0
  130. jevify-0.1.0/tests/guards/test_sdk_schema_mirror.py +50 -0
  131. jevify-0.1.0/tests/guards/test_structure.py +84 -0
  132. jevify-0.1.0/tests/live/test_live_ask.py +49 -0
  133. jevify-0.1.0/tests/live/test_live_sdk.py +38 -0
  134. jevify-0.1.0/tests/test_api.py +113 -0
  135. jevify-0.1.0/tests/test_calibrate.py +178 -0
  136. jevify-0.1.0/tests/test_classify_and_states.py +119 -0
  137. jevify-0.1.0/tests/test_cli.py +112 -0
  138. jevify-0.1.0/tests/test_controls.py +97 -0
  139. jevify-0.1.0/tests/test_distribution.py +81 -0
  140. jevify-0.1.0/tests/test_embedding_adapter.py +85 -0
  141. jevify-0.1.0/tests/test_encoder_adapter.py +127 -0
  142. jevify-0.1.0/tests/test_endpoint_adapter.py +191 -0
  143. jevify-0.1.0/tests/test_engine.py +80 -0
  144. jevify-0.1.0/tests/test_evaluation.py +208 -0
  145. jevify-0.1.0/tests/test_llamacpp_dialect.py +168 -0
  146. jevify-0.1.0/tests/test_local_embedding.py +55 -0
  147. jevify-0.1.0/tests/test_multimodal.py +166 -0
  148. jevify-0.1.0/tests/test_probe.py +220 -0
  149. jevify-0.1.0/tests/test_readout_ladder.py +146 -0
  150. jevify-0.1.0/tests/test_recipes.py +183 -0
  151. jevify-0.1.0/tests/test_rerank_adapter.py +86 -0
  152. jevify-0.1.0/tests/test_sdk_acceptance.py +74 -0
  153. jevify-0.1.0/tests/test_translate.py +57 -0
  154. jevify-0.1.0/tests/test_warm.py +114 -0
  155. jevify-0.1.0/tools/author_long_state.py +114 -0
  156. jevify-0.1.0/tools/author_policy_hard.py +331 -0
  157. jevify-0.1.0/tools/play_doom.py +209 -0
  158. jevify-0.1.0/tools/record_doom_suite.py +253 -0
  159. jevify-0.1.0/uv.lock +1604 -0
@@ -0,0 +1,54 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ name: test (${{ matrix.os }}, py${{ matrix.python }})
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ os: [ubuntu-latest, macos-latest]
19
+ python: ["3.12", "3.14"]
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: astral-sh/setup-uv@v6
23
+ with:
24
+ python-version: ${{ matrix.python }}
25
+ enable-cache: true
26
+ - name: Sync (core + dev group)
27
+ run: uv sync --locked --group dev
28
+ - name: Lint
29
+ run: uv run ruff check . && uv run ruff format --check .
30
+ - name: Test (unit, guards, sdk acceptance; live tests skip without a backend)
31
+ run: uv run pytest -m "not live and not encoder"
32
+ - name: Install as a tool and run it from another directory
33
+ run: |
34
+ uv tool install .
35
+ cd "${RUNNER_TEMP}"
36
+ jevify --version
37
+
38
+ encoder:
39
+ name: encoder extra (ubuntu, py3.12, cpu torch)
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: astral-sh/setup-uv@v6
44
+ with:
45
+ python-version: "3.12"
46
+ enable-cache: true
47
+ - name: Sync (core + dev group)
48
+ run: uv sync --locked --group dev
49
+ - name: Add the encoder extra with CPU-only torch
50
+ run: |
51
+ uv pip install --index-url https://download.pytorch.org/whl/cpu torch
52
+ uv pip install transformers safetensors
53
+ - name: Test the in-process kinds (downloads small public models)
54
+ run: uv run --no-sync pytest -m encoder
@@ -0,0 +1,35 @@
1
+ # INV-10: nothing large or secret enters the tree. This file is the chokepoint
2
+ # for that rule (ADR-0001). Extend it; do not work around it.
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.egg-info/
8
+ build/
9
+ dist/
10
+ .venv/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+
15
+ # Model weights and caches. jevify owns no weights (INV-1); a local download
16
+ # for an in-process adapter lives in the cache, never in git.
17
+ .cache/
18
+ models/
19
+ *.safetensors
20
+ *.gguf
21
+ *.pt
22
+ *.bin
23
+
24
+ # Raw run outputs. Scorecard summaries derived from them are committed under
25
+ # docs/evidence/ (ADR-0005); the raw per-decision files stay here.
26
+ runs/
27
+
28
+ # Secrets and local environment
29
+ .env
30
+ .env.*
31
+ *.token
32
+
33
+ # Recorded suite frames (Doom screenshots): regenerated by tools/, hashes pinned in the manifest
34
+ suites/*/frames/
35
+ _vizdoom.ini
jevify-0.1.0/AGENTS.md ADDED
@@ -0,0 +1,122 @@
1
+ # Agent notes — jevify
2
+
3
+ Instructions for coding agents (Claude, Codex, Grok, Cursor, and others)
4
+ working in this repository. These rules are **mandatory** unless the user
5
+ explicitly overrides them for a task.
6
+
7
+ This file governs **how** work is done here. **What** the project is lives in
8
+ [`docs/00-invariants.md`](docs/00-invariants.md): purpose, vocabulary, the
9
+ numbered invariants, the design criteria and the score-semantics contract.
10
+ That document ranks above every ADR and above this file. Read it before
11
+ changing anything. Decisions that constrain future work are ADRs under
12
+ `docs/adr/`, indexed in [`docs/adr/README.md`](docs/adr/README.md).
13
+
14
+ Four principles bind every change, restated here for a project that started
15
+ empty: Always Works, test-driven development, SOLID, and one authoritative
16
+ path per process.
17
+
18
+ ## A. Always Works™ — proof before done
19
+
20
+ **"Should work" ≠ "does work."** Before marking any change complete, prove
21
+ it with evidence you personally observed in this session, not with
22
+ assumptions, not with "the build succeeded", and not with a result from an
23
+ earlier state of the tree.
24
+
25
+ | Change type | Minimum proof |
26
+ |---|---|
27
+ | Code | The test suite runs green against the **working tree**, in the interpreter and dependency set the project pins. |
28
+ | Anything that runs, serves, loads or scores | Run it and observe its output. A passing unit test is not a running program. |
29
+ | A number in a document | Comes from a run whose command, inputs and their hashes, model revisions and software versions are recorded next to it. Re-derive; do not copy from memory. |
30
+ | Docs only | No runtime required; still re-read for accuracy against the tree. |
31
+ | Config, CI, scripts | Execute the path that changed. |
32
+
33
+ **The stale-artifact trap.** Anything cached is evidence about the past:
34
+ a built image, a downloaded checkpoint, a feature cache, a saved run, a
35
+ result file. Before a cached thing counts as proof, show that it
36
+ corresponds to the working tree (rebuild it, or compare a recorded hash or
37
+ revision). A green result on a stale artifact is a silent false green.
38
+
39
+ **Name what is unproven.** When done, state plainly which paths were
40
+ exercised and which were not. A claim of completion that hides an untested
41
+ path is a defect in the claim, not in the code.
42
+
43
+ ## B. Test-driven development — new behavior is test-first
44
+
45
+ Do not write production code for a new feature, a bug fix with a known
46
+ reproduction, or a new module until a failing test names the behavior.
47
+
48
+ | Rule | Detail |
49
+ |---|---|
50
+ | **Red → green → refactor** | Write one failing test; write the minimum code that passes; only then improve structure. |
51
+ | **Vertical slices** | One seam, one behavior at a time. Do not bulk-write a suite of imagined tests and then implement everything. |
52
+ | **Agree the seam first** | Before the first test, state the public interface under test: a function, a Protocol, an HTTP path, a CLI command. Tests hit that seam only. |
53
+ | **No private tests** | Do not assert on private helpers, internal call counts or implementation structure. Prefer fakes at port seams. |
54
+ | **Independent expected values** | Assertions use known literals or domain rules, never a recomputation of the algorithm under test. |
55
+ | **Where tests live** | `tests/`, runnable from a clean checkout with one documented command. |
56
+ | **When TDD does not apply** | Pure renames, docs, configuration, mechanical refactors with no behavior change. Existing tests still run (principle A). |
57
+
58
+ Measured results are tests too. An experiment has a protocol written and
59
+ hashed **before** the run, a fixed evaluation set, and no post-hoc tuning
60
+ against the test split. A result that was selected on the test set is not
61
+ a result.
62
+
63
+ ## C. SOLID — deep modules behind narrow seams
64
+
65
+ Prefer **deep modules** (small interface, large behavior) over shallow
66
+ pass-through wrappers. Vocabulary for structure: *module, interface,
67
+ implementation, depth, seam, adapter, port, composition root.*
68
+
69
+ | Principle | In this repository |
70
+ |---|---|
71
+ | **S** — Single responsibility | One reason to change per module. A module that mixes core logic with a vendor client, a model runtime or a transport has two. |
72
+ | **O** — Open/closed | Extend by adding an adapter or a new caller of a deep module. Do not fork a spine and edit the copy. |
73
+ | **L** — Liskov | Every adapter of a port is substitutable, including test fakes. A fake that honors less of the Protocol than production is a lying test. |
74
+ | **I** — Interface segregation | Focused Protocols. No object that callers use ten percent of. |
75
+ | **D** — Dependency inversion | Core logic depends on **ports** (Protocols), never on concrete adapters, model libraries, HTTP clients or files. One composition root wires adapters into the core; nothing else constructs infrastructure. |
76
+
77
+ **The deletion test.** If deleting a module only moves lines around and no
78
+ complexity concentrates anywhere, it was shallow. Do not add more of those.
79
+
80
+ Anti-patterns to reject on sight:
81
+
82
+ - Implementing first and "adding tests later".
83
+ - Core logic typed against a concrete runtime, client or store instead of a port.
84
+ - A blanket `except Exception` that swallows a failure without logging it and naming its contract.
85
+ - Weakening an invariant in production code to make a test pass.
86
+ - Drive-by changes: reformatting unrelated files, wide renames without need, scope beyond the task.
87
+ - Docs drift: changing a public seam without updating the document that describes it in the same change.
88
+
89
+ ## D. Honor all chokepoints — one authoritative path per singular process
90
+
91
+ Guarantees held by discipline (comments, naming conventions, hand-mirrored
92
+ copies) drift, and the second copy of a process is the one written without
93
+ the guards.
94
+
95
+ **A singular process has exactly one implementation.** Anything that looks
96
+ like a second implementation must be one of:
97
+
98
+ - a **call** into the one authoritative function or module (the chokepoint);
99
+ - a **derived view** computed from the one authoritative registry, never a hand-maintained parallel table;
100
+ - a **pinned mirror**, where a copy is physically unavoidable (another language, another runtime, a serialized payload): a test loads both sides from one fixture or compares them field by field, so drift turns red.
101
+
102
+ Corollaries, each load-bearing:
103
+
104
+ 1. **Guards travel with the chokepoint, not the caller.** A rule such as "validate before scoring" or "wrap transport exceptions" lives inside the shared function so the next caller inherits it by construction.
105
+ 2. **Registries over string literals.** When control flow branches on a family of magic strings, the family gets one registry carrying the strings and their attributes; consumers derive. Wire and record formats are frozen by canary tests; a registry refactors ownership, never compatibility.
106
+ 3. **Enforcement is a ratchet test, not a review habit.** A chokepoint ships with a structure guard (an AST scan, an import ban, a fixture comparison) whose failure message names the chokepoint to use. Guards are anti-accident, not anti-adversary, and say so.
107
+ 4. **Comments that say "keep in sync with X" are defects.** Replace each with a call, a derivation or a pinned mirror, or document why the sync cannot be structural, dated, with the guard that watches it.
108
+
109
+ **In a new project the first implementation is the chokepoint.** Create it
110
+ deliberately the moment a process gets its second caller, not after its
111
+ fourth copy. The review question, answerable mechanically: *which
112
+ chokepoint does this go through?* If none fits, the change either creates
113
+ one or documents why the process is genuinely plural.
114
+
115
+ ## House rules
116
+
117
+ - **Secrets** never enter files, logs, tests or chat. Credentials on this host come from the operator's secret store; pipe them into the consumer, never into the tree.
118
+ - **Local state** stays out of git: downloaded weights, caches, run outputs, generated data. `.gitignore` is the chokepoint for that rule; extend it, do not work around it.
119
+ - **One intent per commit and per PR.** Small, reviewable diffs.
120
+ - **Decisions are recorded.** A choice that constrains future work becomes an ADR under `docs/adr/`, indexed in `docs/adr/README.md`, whose status column is the ledger. Superseding an ADR updates both its row and its header.
121
+ - **Honest claims.** No document, README line, scorecard or API response claims more than the recorded evidence shows. The claims contract is `docs/00-invariants.md` §5; copy that exceeds it is a defect on the same footing as a failing test.
122
+ - **Vocabulary.** Use the terms defined in `docs/00-invariants.md` §2 and no synonyms: state, question, answer, semantics label, readout, adapter, port, probe, recipe, warm, evaluate, suite, scorecard, backend.
jevify-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Felipe Infante de Castro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
jevify-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,243 @@
1
+ Metadata-Version: 2.5
2
+ Name: jevify
3
+ Version: 0.1.0
4
+ Summary: Make a pretrained model you already have answer typed questions in one pass, and measure how well it does.
5
+ Project-URL: Homepage, https://github.com/fidecastro/jevify
6
+ Author: Felipe Infante de Castro
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: decisions,evaluation,logprobs,openai-compatible,readout
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Python: >=3.12
17
+ Requires-Dist: httpx>=0.27
18
+ Requires-Dist: pydantic>=2.12
19
+ Requires-Dist: pyyaml>=6.0.2
20
+ Requires-Dist: starlette>=0.40
21
+ Requires-Dist: uvicorn>=0.30
22
+ Provides-Extra: encoder
23
+ Requires-Dist: safetensors>=0.4; extra == 'encoder'
24
+ Requires-Dist: torch>=2.4; extra == 'encoder'
25
+ Requires-Dist: transformers>=4.51; extra == 'encoder'
26
+ Provides-Extra: games
27
+ Requires-Dist: numpy>=1.26; extra == 'games'
28
+ Requires-Dist: vizdoom>=1.3; extra == 'games'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # jevify
32
+
33
+ **Make any model you already have answer typed questions in one pass, the way
34
+ Jev does, and measure how well it does.**
35
+
36
+ [![CI](https://github.com/fidecastro/jevify/actions/workflows/ci.yml/badge.svg)](https://github.com/fidecastro/jevify/actions/workflows/ci.yml)
37
+ [![PyPI](https://img.shields.io/pypi/v/jevify.svg)](https://pypi.org/project/jevify/)
38
+ [![Licence: MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/fidecastro/jevify/blob/main/LICENSE)
39
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/)
40
+
41
+ You bring a model behind an OpenAI-compatible endpoint (vLLM, llama.cpp,
42
+ anything with logprobs) or a small model that runs in-process. jevify sends it
43
+ a **state** once, then asks **typed questions** about it: a choice among
44
+ options, a score on ordered levels, a yes/no with a probability. Each answer
45
+ is read straight off the model's next-token distribution, no generation, no
46
+ parsing, one request per question. The result comes back in the exact shape
47
+ of TypeSafe's Jev API, so the unmodified `typesafe-sdk` works against it.
48
+
49
+ jevify owns no weights and trains nothing. A **recipe** says how a model is
50
+ asked, a **probe** proves what the deployment can do, and a **scorecard**
51
+ says how it did, with the command, hashes and raw file that produced every
52
+ number.
53
+
54
+ ```text
55
+ state (text, images) one warm request, cached prefix
56
+ │
57
+ ├── "Which team handles this?" ──► {billing: 0.94, support: 0.05, sales: 0.01}
58
+ ├── "How urgent?" ──► {low: 0.05, medium: 0.10, high: 0.85}
59
+ └── "Threatens to cancel." ──► p(true) = 0.95
60
+ each ≈ 30–140 ms on a local GPU
61
+ ```
62
+
63
+ ## Quickstart
64
+
65
+ ```sh
66
+ uv tool install jevify # or: pipx install jevify
67
+ git clone https://github.com/fidecastro/jevify && cd jevify
68
+
69
+ # 1. point a recipe at your server (copy the nearest one under recipes/)
70
+ jevify probe recipes/gemma-4-e4b-it.llamacpp.yaml
71
+
72
+ # 2. ask
73
+ jevify ask recipes/gemma-4-e4b-it.llamacpp.yaml \
74
+ --state "Customer: I was charged twice. Fix it today or I cancel." \
75
+ --choice "dept:Which team should handle this?=billing,support,sales" \
76
+ --score "urgency:How urgent is this?=low,medium,high" \
77
+ --noul "cancel:The customer threatens to cancel." \
78
+ [--image screenshot.png]
79
+
80
+ # 3. serve Jev's API and use the stock SDK
81
+ jevify serve recipes/gemma-4-e4b-it.llamacpp.yaml --port 8600
82
+ ```
83
+
84
+ Every answer carries Jev's fields (`choice`, `confidence`, `probabilities`,
85
+ `score`, `legend`, `noul`) plus an `x_jevify` block naming the readout method,
86
+ the cached tokens, the latency and the recipe hash that produced it.
87
+
88
+ ## How it works
89
+
90
+ 1. **Recipe.** A hashed YAML file: the endpoint, the prompt template (chat
91
+ messages or a raw prompt with the model's own control tokens), the answer
92
+ token spellings, and the readout policy. The only way a model is ever
93
+ asked.
94
+ 2. **Probe.** `jevify probe` measures the deployment: dialect (vLLM,
95
+ llama.cpp, generic), context, which logprob rungs it honours, whether
96
+ thinking is really off, whether an image really adds tokens, how much of a
97
+ warmed prefix a question reuses. The findings are written into the recipe.
98
+ 3. **Warm, then ask.** The state goes once; each question is a short suffix
99
+ that reuses the server's prefix cache. A 32k-token state costs one warm and
100
+ then a few hundred milliseconds per question.
101
+ 4. **Readout ladder.** Named-token logprobs, grammar with post-sampling
102
+ probabilities, top-k, equal bias, and a floored top-k as the last resort.
103
+ Auto walks down the proven rungs; the answer names the rung that read it
104
+ and whether it was degraded.
105
+ 5. **Evidence.** `jevify eval` runs a frozen suite with controls (shuffled
106
+ states, permuted options) and writes a scorecard. `jevify calibrate` fits
107
+ temperatures and refuses tables it cannot defend.
108
+
109
+ ## Model kinds
110
+
111
+ | Kind | Talks to | Proven live with |
112
+ |---|---|---|
113
+ | `endpoint` | Any OpenAI-compatible server; dialect extras for vLLM and llama.cpp | DeepSeek-V4-Flash on vLLM; Ternary Bonsai 2 27B, Gemma 4 E4B and Qwen3-VL-Reranker 8B/2B on llama.cpp; text and images |
114
+ | `embedding` | A `/v1/embeddings` route, or a model in-process | Qwen3-Embedding-0.6B in-process |
115
+ | `encoder` | An NLI sequence-classification head in-process | facebook/bart-large-mnli in-process |
116
+ | `rerank` | A `/v1/rerank` route | Fakes only |
117
+
118
+ The in-process kinds need `uv tool install 'jevify[encoder]'`.
119
+
120
+ ## Results
121
+
122
+ Four frozen suites, every recipe on each, one run each, latencies per
123
+ question on one machine on one day. Every row links to the scorecard that
124
+ records the command, the recipe hash, the suite hash and the raw file digest.
125
+
126
+ **policy-29**, the diagnostic suite carried over from the author's earlier experiments (choice only):
127
+
128
+ | Recipe | Kind | Accuracy | Median latency | Scorecard |
129
+ |---|---|---|---|---|
130
+ | `gemma-4-e4b-it.llamacpp` | endpoint | 29/29 | 28 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/gemma-4-e4b-it.llamacpp--policy-29.md) |
131
+ | `ternary-bonsai-2-27b.llamacpp` | endpoint | 29/29 | 99 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-29.md) |
132
+ | `deepseek-v4-flash-vision-exp-keys.vllm` | endpoint | 28/29 | 428 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-29.md) |
133
+ | `qwen3-vl-reranker-8b.llamacpp` | endpoint | 26/29 | 68 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-vl-reranker-8b.llamacpp--policy-29.md) |
134
+ | `qwen3-vl-reranker-2b.llamacpp` | endpoint | 21/29 | 49 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-29.md) |
135
+ | `qwen3-embedding-0.6b.local` | embedding | 19/29 | 8 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-embedding-0.6b.local--policy-29.md) |
136
+ | `bart-large-mnli.local` | encoder | 15/29 | 7 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/bart-large-mnli.local--policy-29.md) |
137
+
138
+ **policy-hard-52**, written for jevify before any model saw it: instruction
139
+ flips, negations, two-threshold policies, distractors, and long transcripts
140
+ with the decisive line buried (`tools/author_policy_hard.py`):
141
+
142
+ | Recipe | Accuracy | Flips | Thresholds | Long states | Scorecard |
143
+ |---|---|---|---|---|---|
144
+ | `deepseek-v4-flash-vision-exp-keys.vllm` | 47/52 | 6/9 | 16/18 | 12/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--policy-hard-52.md) |
145
+ | `ternary-bonsai-2-27b.llamacpp` | 46/52 | 6/9 | 15/18 | 12/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/ternary-bonsai-2-27b.llamacpp--policy-hard-52.md) |
146
+ | `gemma-4-e4b-it.llamacpp` | 45/52 | 5/9 | 16/18 | 12/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/gemma-4-e4b-it.llamacpp--policy-hard-52.md) |
147
+ | `qwen3-vl-reranker-2b.llamacpp` | 34/52 | 3/9 | 9/18 | 12/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-vl-reranker-2b.llamacpp--policy-hard-52.md) |
148
+ | `bart-large-mnli.local` | 28/52 | 3/9 | 8/18 | 12/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/bart-large-mnli.local--policy-hard-52.md) |
149
+ | `qwen3-embedding-0.6b.local` | 24/52 | 3/9 | 8/18 | 6/12 | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-embedding-0.6b.local--policy-hard-52.md) |
150
+
151
+ Every generative model misses the same inverted instructions ("the action the
152
+ customer asked NOT to take"), a weakness the author's earlier experiments found across model
153
+ generations. Negations in the state and long transcripts are solved.
154
+
155
+ **doom-frames-41**, 164 questions over 41 ViZDoom screenshots at 640×480,
156
+ every label from the engine's labels buffer or a fixed expert rule
157
+ (`tools/record_doom_suite.py`; frames regenerate byte-identically and their
158
+ hashes are pinned in the manifest):
159
+
160
+ | Recipe | Enemy visible | Enemy count | Enemy side | Expert button | Median latency | Scorecard |
161
+ |---|---|---|---|---|---|---|
162
+ | `deepseek-v4-flash-vision-exp-keys.vllm` | 0.88 | 0.83 | 0.56 | 0.24 | 672 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--doom-frames-41.md) |
163
+ | `ternary-bonsai-2-27b.llamacpp` | 0.93 | 0.85 | 0.37 | 0.24 | 97 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/ternary-bonsai-2-27b.llamacpp--doom-frames-41.md) |
164
+ | `gemma-4-e4b-it.llamacpp` | 0.78 | 0.49 | 0.41 | 0.20 | 36 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/gemma-4-e4b-it.llamacpp--doom-frames-41.md) |
165
+ | `qwen3-vl-reranker-2b.llamacpp` | 0.10 | 0.56 | 0.41 | 0.10 | 64 ms | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/qwen3-vl-reranker-2b.llamacpp--doom-frames-41.md) |
166
+
167
+ Presence and count are perception; the expert button asks the model to agree
168
+ with a rule it is not told, so that column is a floor for a scripted policy,
169
+ not a skill score. Enemy side is where the vision models diverge most.
170
+
171
+ **long-state-24**, one decisive customer line at the start, middle or end of
172
+ a filler transcript of about 2k, 8k, 16k or 32k tokens
173
+ (`tools/author_long_state.py`). This is the suite the warm step exists for:
174
+ the state is sent once, and each question then costs only its own tokens.
175
+
176
+ | Recipe | 2k | 8k | 16k | 32k | Warm at 32k | Per question after warm | Scorecard |
177
+ |---|---|---|---|---|---|---|---|
178
+ | `deepseek-v4-flash-vision-exp-keys.vllm` | 6/6 | 6/6 | 6/6 | 6/6 | 20 s | 359 ms, 31,232 tokens cached | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/deepseek-v4-flash-vision-exp-keys.vllm--long-state-24.md) |
179
+ | `ternary-bonsai-2-27b.llamacpp` | 6/6 | 6/6 | 6/6 | 6/6 | 13 s | 136 ms, 33,946 tokens cached | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/ternary-bonsai-2-27b.llamacpp--long-state-24.md) |
180
+ | `gemma-4-e4b-it.llamacpp` | 6/6 | context | context | context | | 37 ms at 2k | [summary](https://github.com/fidecastro/jevify/blob/main/docs/evidence/gemma-4-e4b-it.llamacpp--long-state-24.md) |
181
+
182
+ "context" means the launch's slot context was shorter than the state and the
183
+ case recorded a context error, which is the finding for that launch (Gemma
184
+ was launched with two 8k slots; Bonsai first ran with two 16k slots and
185
+ failed 16k and 32k the same way, then with one 64k slot for the row above). No model that could read the state missed
186
+ the decisive line at any position.
187
+
188
+ These suites rank models; they do not measure calibration, which is why
189
+ `jevify calibrate` refused to write a table for any of them.
190
+
191
+ ## Play Doom
192
+
193
+ `tools/play_doom.py` lets a recipe play ViZDoom from screenshots: one frame
194
+ per decision, one question per frame, the chosen button pressed, a video with
195
+ the decision and its latency burned in. `tools/record_doom_suite.py` records
196
+ the frozen perception suite the same way. Both need `uv sync --extra games`
197
+ and ffmpeg.
198
+
199
+ ## Work with your agent
200
+
201
+ jevify is written to be operated through a coding agent. Point yours at
202
+ [`SKILL.md`](https://github.com/fidecastro/jevify/blob/main/SKILL.md): the workflow, recipe anatomy per kind, how to read
203
+ `x_jevify`, and what a result may claim. Typical asks:
204
+
205
+ - "Write a recipe for the model behind `http://host:8000/v1`, probe it, and
206
+ tell me which readout rung it landed on and why."
207
+ - "Run `policy-hard-52` against this recipe with controls and read me the
208
+ scorecard against the claims contract."
209
+ - "Serve this recipe and show me an unmodified typesafe-sdk call against it."
210
+
211
+ ## Repository map
212
+
213
+ | Path | What it holds |
214
+ |---|---|
215
+ | [`jevify/`](https://github.com/fidecastro/jevify/blob/main/jevify) | The package: domain, ports, adapters (endpoint, embedding, encoder, rerank), recipes, evaluation, Jev API, CLI |
216
+ | [`recipes/`](https://github.com/fidecastro/jevify/blob/main/recipes) | One recipe per model deployment, with its probe results and launch line |
217
+ | [`suites/`](https://github.com/fidecastro/jevify/blob/main/suites) | Frozen, hashed suites and their manifests |
218
+ | [`docs/evidence/`](https://github.com/fidecastro/jevify/blob/main/docs/evidence) | Committed scorecards, one per recipe and suite |
219
+ | [`docs/00-invariants.md`](https://github.com/fidecastro/jevify/blob/main/docs/00-invariants.md) | What jevify is and refuses to be; the claims contract. Ranks above everything else |
220
+ | [`docs/adr/`](https://github.com/fidecastro/jevify/blob/main/docs/adr/README.md) | The decision ledger |
221
+ | [`tools/`](https://github.com/fidecastro/jevify/blob/main/tools) | Suite authoring, the Doom recorder and player |
222
+ | [`AGENTS.md`](https://github.com/fidecastro/jevify/blob/main/AGENTS.md) | The engineering principles that bind every change |
223
+ | [`SKILL.md`](https://github.com/fidecastro/jevify/blob/main/SKILL.md) | How an agent operates jevify |
224
+
225
+ To work on jevify: `uv sync --group dev` (add `--extra encoder --extra
226
+ games` as needed) and `uv run pytest`. Live and in-process tests skip unless
227
+ you opt in.
228
+
229
+ ## Not yet
230
+
231
+ Named so that nobody has to discover it: a direct-call control, so no
232
+ "faster than generation" claim exists yet; a Doom player that survives (both
233
+ models die within seconds of `deadly_corridor`); the rerank kind and the
234
+ embedding route against a live server; a marker-slot encoder layout; the
235
+ grammar rung on the PrismML llama.cpp fork, which accepts a grammar without
236
+ constraining the reported probabilities; Windows. Choice menus on the
237
+ endpoint kind are bounded by the single-token identifier alphabet the probe
238
+ verifies (26 on the DeepSeek recipe); Jev's 255-option ceiling is not
239
+ reachable there.
240
+
241
+ ## Licence
242
+
243
+ [MIT](https://github.com/fidecastro/jevify/blob/main/LICENSE).