coding-guardrails 0.22.0__tar.gz → 0.26.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 (127) hide show
  1. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/CLAUDE.md +102 -16
  2. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/HISTORY.md +21 -0
  3. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/PKG-INFO +53 -11
  4. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/README.md +52 -10
  5. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/configs/guardrail-config.yaml +24 -0
  6. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docs/architecture.md +4 -0
  7. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docs/models.md +130 -23
  8. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docs/rules.md +8 -0
  9. coding_guardrails-0.26.0/docs/semantic-judge.md +143 -0
  10. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docs/server.md +42 -8
  11. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/pyproject.toml +1 -1
  12. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/middleware.py +9 -0
  13. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/models/profiles.py +115 -3
  14. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/base.py +33 -0
  15. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/commands.py +126 -1
  16. coding_guardrails-0.26.0/src/coding_guardrails/rules/judge.py +276 -0
  17. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/build.py +12 -3
  18. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/download.py +62 -27
  19. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/launcher.py +69 -0
  20. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/manager.py +7 -0
  21. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/sources.py +54 -0
  22. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/version.py +16 -5
  23. coding_guardrails-0.26.0/tests/unit/test_judge.py +368 -0
  24. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_manager.py +19 -6
  25. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_server.py +110 -0
  26. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_sources.py +39 -1
  27. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/.github/workflows/ci.yaml +0 -0
  28. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/.gitignore +0 -0
  29. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/Dockerfile +0 -0
  30. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/Dockerfile.reusable +0 -0
  31. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/LICENSE +0 -0
  32. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/configs/aider.yaml +0 -0
  33. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/configs/claude-code.yaml +0 -0
  34. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/configs/opencode.json +0 -0
  35. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/configs/pi.yaml +0 -0
  36. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docker-compose.yaml +0 -0
  37. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/docs/agents.md +0 -0
  38. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/01-lenient-acceptance-parser.patch +0 -0
  39. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/02-stronger-acceptance-prompt.patch +0 -0
  40. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/03-stronger-finalization-prompt.patch +0 -0
  41. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/04-prefer-acceptance-message.patch +0 -0
  42. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/05-acceptance-schema-tolerance.patch +0 -0
  43. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/README.md +0 -0
  44. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/apply-patches.sh +0 -0
  45. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/test-acceptance-parser.mjs +0 -0
  46. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/test-get-final-output.mjs +0 -0
  47. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/patches/pi-subagents/test-real-world.mjs +0 -0
  48. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/reports/2026-06-08_qwen-vs-gemma-ab.md +0 -0
  49. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/reports/2026-06-08_qwen-vs-gemma-revalidation.md +0 -0
  50. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/reports/2026-06-27_ornith-assessment.md +0 -0
  51. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/scripts/smoke_proxy.py +0 -0
  52. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/__init__.py +0 -0
  53. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/__main__.py +0 -0
  54. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/cli.py +0 -0
  55. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/config.py +0 -0
  56. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/eval.py +0 -0
  57. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/models/__init__.py +0 -0
  58. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/models/registry.py +0 -0
  59. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/__init__.py +0 -0
  60. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/acceptance.py +0 -0
  61. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/client.py +0 -0
  62. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/handler.py +0 -0
  63. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/layer1.py +0 -0
  64. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/proxy/server.py +0 -0
  65. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/__init__.py +0 -0
  66. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/canary.py +0 -0
  67. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/dup_write.py +0 -0
  68. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/injection.py +0 -0
  69. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/lint.py +0 -0
  70. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/loop_detection.py +0 -0
  71. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/network.py +0 -0
  72. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/path_safety.py +0 -0
  73. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/prerequisites.py +0 -0
  74. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/secrets.py +0 -0
  75. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/sensitive_files.py +0 -0
  76. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/sequencing.py +0 -0
  77. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/session_budget.py +0 -0
  78. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/thoroughness.py +0 -0
  79. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/rules/tool_resolution.py +0 -0
  80. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/__init__.py +0 -0
  81. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/cli.py +0 -0
  82. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/manager_vram.py +0 -0
  83. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/paths.py +0 -0
  84. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/src/coding_guardrails/server/proxy_process.py +0 -0
  85. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/__init__.py +0 -0
  86. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/integration/__init__.py +0 -0
  87. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/integration/test_proxy.py +0 -0
  88. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/integration/test_proxy_pipeline.py +0 -0
  89. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/integration-subagent-smoke.sh +0 -0
  90. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/test_backend_manager.py +0 -0
  91. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/__init__.py +0 -0
  92. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/conftest.py +0 -0
  93. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_acceptance_prefill.py +0 -0
  94. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_acceptance_wrap.py +0 -0
  95. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_canary.py +0 -0
  96. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_client_wrappers.py +0 -0
  97. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_commands.py +0 -0
  98. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_config.py +0 -0
  99. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_convergence_nudge.py +0 -0
  100. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_dup_write.py +0 -0
  101. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_fuzz.py +0 -0
  102. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_handler_respond.py +0 -0
  103. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_handler_security_wiring.py +0 -0
  104. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_injection.py +0 -0
  105. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_layer1_tool_arg_validation.py +0 -0
  106. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_lint.py +0 -0
  107. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_loop_detection.py +0 -0
  108. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_loop_session_reset.py +0 -0
  109. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_middleware.py +0 -0
  110. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_network.py +0 -0
  111. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_path_safety.py +0 -0
  112. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_paths.py +0 -0
  113. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_plain_thinking.py +0 -0
  114. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_prerequisites.py +0 -0
  115. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_profiles_budget.py +0 -0
  116. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_proxy_process.py +0 -0
  117. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_reasoning_replay.py +0 -0
  118. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_role_normalization.py +0 -0
  119. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_secrets.py +0 -0
  120. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_sensitive_files.py +0 -0
  121. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_sequencing.py +0 -0
  122. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_session_budget.py +0 -0
  123. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_text_passthrough.py +0 -0
  124. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_thoroughness.py +0 -0
  125. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_tool_resolution.py +0 -0
  126. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/tests/unit/test_vision_captioning.py +0 -0
  127. {coding_guardrails-0.22.0 → coding_guardrails-0.26.0}/uv.lock +0 -0
@@ -6,7 +6,7 @@ An LLM proxy with safety guardrails, built on [Forge](https://github.com/antoine
6
6
 
7
7
  ```bash
8
8
  source .venv/bin/activate
9
- pytest tests/unit/ -q # 746 tests (~24s)
9
+ pytest tests/unit/ -q # 794 tests (~25s)
10
10
  uv pip install -e ".[dev]" # refresh editable install
11
11
  ```
12
12
 
@@ -64,6 +64,26 @@ Agent → :8081 (our proxy)
64
64
  | `canary` | block | Context-exfiltration tripwire: unique token planted in system prompt; any tool call echoing it is blocked |
65
65
  | `input_scanning` | mark | Prompt-injection signatures in inbound message content (indirect injection via tool results spotlighted) |
66
66
 
67
+ ### Semantic judge (opt-in, default OFF)
68
+
69
+ A calibrated probability decider (sibling project `~/workspaces/decision-layer`)
70
+ consulted by `command_safety` **only after every deterministic pattern missed**.
71
+ It exists for novel phrasings of known-dangerous actions — see
72
+ `plans/2026-06-15_exfil-vector-investigation.md` (8 accepted bypasses).
73
+
74
+ - Config: `judge:` block in `configs/guardrail-config.yaml` (`enabled: false` by default).
75
+ - Transport: HTTP `POST {url}/v1/decide` to `dlserver :8044`. No model in the proxy process.
76
+ - Grading: `p > 0.8` block, `0.5 < p <= 0.8` nudge (block if `graded_blocks: true`).
77
+ - Failure: **fail-open** (timeout/error ⇒ allow + `JUDGE unavailable` log). No retries.
78
+ - Measured 2026-10-28 on `decider-0.8b`: 21/21 exfil vectors blocked (14 deterministic,
79
+ **7 newly**), 0 regressions, 0/8 curated benign FPs, p50/p95 **26/29ms**.
80
+ Broader dev commands: **3/18 false positives** (`scp`/`rsync` backup, `find -delete`) —
81
+ the judge lacks an authorization dimension, which is why it defaults off.
82
+ - Ops: `HF_HUB_OFFLINE=1 TORCHDYNAMO_DISABLE=1 ~/workspaces/decision-layer/scripts/start-dlserver.sh 8044`.
83
+ `TORCHDYNAMO_DISABLE=1` is required on this machine (torch 2.11 dynamo/FX error wedges
84
+ the decider's CUDA-graph capture otherwise).
85
+ - Details: `docs/semantic-judge.md`. Validate: `python eval/scripts/run_security_eval.py --exfil-battery`.
86
+
67
87
  ## Production Rules
68
88
 
69
89
  ### Block Response Design
@@ -140,25 +160,56 @@ for shared-GPU systems. The systemd unit bakes this in.
140
160
  # To rebuild: cd ~/llama.cpp && git pull && cmake -S . -B build -DGGML_CUDA=ON -DLLAMA_CURL=ON -DCMAKE_BUILD_TYPE=Release && cmake --build build -j 24 --target llama-server
141
161
  LLAMA=~/llama.cpp/llama-server
142
162
 
143
- # Qwen3.8-27B UD-Q3_K_XL (DEFAULT worker — 128K ctx, MTP, best-measured)
163
+ # Qwen3.8-27B UD-Q3_K_XL (DEFAULT worker — 120K ctx, DSpine draft, best-measured)
144
164
  # Released Aug 2026, Apache-2.0, same qwen3_5 hybrid arch as Qwen3.5-9B (48
145
165
  # Gated DeltaNet + 16 full-attn layers → cheap KV at long ctx). Native 256K ctx;
146
- # 128K on 24 GB. MTP spec decoding (~68 tok/s gen, ~3 tok/draft).
147
- # MEASURED 2026-08-15 Forge eval (proxy mode, 150 runs): 150/150 completion
148
- # (100%), 148/150 correctness (99%) — best ever on this harness, vs Qwen3.5-9B
149
- # 100%/92% and Qwen3.6-27B 99.3%/94%. Only misses: compaction_chain_p1/p2 (4/5 each).
150
- # VRAM: incremental ~18.9 GB @128K q4_0 KV + MTP + mmproj (gate 19.0). q8_0 KV + MTP
151
- # OOMs at 128K; q4_0 KV halves KV and fits the draft. This is the systemd
152
- # default on :8081 (coding-guardrails up --model Qwen3.8-27B-UD-Q3_K_XL).
166
+ # 120K on 24 GB.
167
+ # SPEC DECODING = DSpine (since v0.26.0), not MTP: a 5-layer parallel drafter
168
+ # (arXiv 2609.36173, Tencent Hunyuan) that reads hidden states from target
169
+ # layers 1/16/31/46/61 and drafts a 16-token block with causal code-bridge
170
+ # injection. Rides llama.cpp's `draft-dflash` implementation type. Needs the
171
+ # `dspine` branch of cg's pinned fork (PINNED_REPO in server/version.py).
172
+ # MEASURED 2026-11-09 on this box (RTX 3090 Ti, this quant): short-ctx decode
173
+ # 46.3 -> 94.5 tok/s at --spec-draft-n-max 4; 84 tok/s at the production 120K
174
+ # config. Full 150-run Forge eval: 150/150 completion, 149/150 correctness
175
+ # (99%), 33.8 min wall (29.7 min at 98K q8_0 KV) vs 64.1 min without
176
+ # speculation -> 1.89x production / 2.16x at 98K. n-max 4 is the
177
+ # peak here — 15 is the same speed for 1.7 GB less context; 2 and 7 are slower.
178
+ # VRAM: ~17.5 GB incremental @120K q4_0 KV + drafter (20.9 GB on a 3.4 GB
179
+ # desktop); gate = 16.4 (target) + 1.4 (drafter). 128K still fits at n-max 3.
180
+ # This is the systemd default on :8081 (coding-guardrails up --model Qwen3.8-27B-UD-Q3_K_XL).
153
181
  # VISION: the launcher auto-attaches a sibling mmproj-*.gguf (multimodal),
154
182
  # and the proxy captions inbound images → [image: caption] text (Option A:
155
183
  # vision through a text-only guardrail pipeline). Verified 2026-08-15 through
156
184
  # :8081. Video (hour-scale) is vLLM/SGLang territory — unsupported on llama.cpp.
157
185
  $LLAMA \
158
186
  -m ~/.cache/lm-studio/models/unsloth/Qwen3.8-27B-GGUF/Qwen3.8-27B-UD-Q3_K_XL.gguf \
159
- -c 131072 -ngl 99 --host 0.0.0.0 --port 8080 \
187
+ -md ~/models/dspine/Qwen3.8-27B-DSpine-b16-Q4_K_M.gguf \
188
+ -c 120000 -ngl 99 --host 0.0.0.0 --port 8080 \
160
189
  --jinja --flash-attn auto -ctk q4_0 -ctv q4_0 \
161
- --spec-type draft-mtp -np 1 -v
190
+ --spec-type draft-dflash --spec-draft-n-max 4 --spec-draft-ngl 99 \
191
+ --spec-draft-type-k q8_0 --spec-draft-type-v q8_0 -np 1 -v
192
+ # (MTP is still available as a fallback: --spec-type draft-mtp --spec-draft-n-max 2,
193
+ # but it is ~2x slower than DSpine on this hardware.)
194
+
195
+ # Flint UD-Q3_K_XL (fast MoE tier — 39.8B total / 2.5B active, 128K ctx)
196
+ # Recursive Flint, released 2026-10-21, Apache-2.0. 49 layers (2 dense + 47 MoE,
197
+ # 256 routed experts, 6/token + shared expert); 35 sliding-window (513) + 14
198
+ # full-attn layers → cheap KV at long ctx. NO MTP tensors (do not pass
199
+ # --spec-type draft-mtp). Needs llama.cpp ≥ d77256999 (LLM_ARCH_FLINT, #30928)
200
+ # — cg's pin was bumped to it on 2026-11-01.
201
+ # MEASURED 2026-11-01 Forge eval (proxy mode, 150 runs): 145/150 completion
202
+ # (96.7%), 135/150 accuracy (90%), 24 min wall (fastest 40B-class run). All
203
+ # compaction_chain + data_gap_* 100%. Weak: tool_selection 40% (answers in
204
+ # prose instead of calling respond() → Forge retry exhaustion),
205
+ # argument_transformation / inconsistent_api_recovery ~60%.
206
+ # VRAM: ~20.0 GB incremental @128K q8_0 KV (22.3 GB used with 2.5 GB desktop
207
+ # baseline); gate 19.9. ~107 tok/s decode.
208
+ # Manager: cg server start -m flint-UD-Q3_K_XL
209
+ $LLAMA \
210
+ -m ~/.local/share/coding-guardrails/models/flint-GGUF/flint-UD-Q3_K_XL.gguf \
211
+ -c 131072 -ngl 99 --host 0.0.0.0 --port 8080 \
212
+ --jinja --flash-attn auto -ctk q8_0 -ctv q8_0 -np 1 -v
162
213
 
163
214
  # Qwen3.5-9B-MTP (previous default — best tool-calling reliability at 9B)
164
215
  # Hybrid SSM/Transformer arch (qwen35), 33 layers. MTP = Multi-Token Prediction:
@@ -236,6 +287,23 @@ coding-guardrails server start -m LFM2.5-2.6B-BF16
236
287
  coding-guardrails server start -m MiniCPM5-2B-Q4_K_M
237
288
  # (equivalent raw llama-server: -c 131072 --temp 1.0 --top-p 0.95 -np 1 --jinja)
238
289
 
290
+ # LFM3-1.7B Q8_0 (long-context tiny tier — 256K ctx, ~4.5 GB VRAM, ~150 tok/s)
291
+ # Liquid AI, released 2026-10-21+, LFM Open License v1.0. Tri-hybrid arch (24 layers:
292
+ # 13 gated short-conv + 5 sliding-window + 6 global attn) → only 6 layers hold KV, so the
293
+ # FULL 256K context costs ~4.5 GB total. Requires llama.cpp >= b11960 (`lfm3` arch); cg's
294
+ # pin 39febd2ad has it, older builds reject the GGUF.
295
+ # Full 150-run proxy Forge eval 2026-10-28 (v0.24.0): 144/150 completion (96%), 129/150
296
+ # accuracy (86%), 24 min wall. Ties MiniCPM5-2B on accuracy at 2/3 the params and 2x ctx,
297
+ # but ~2x the wall time. Wins where MiniCPM5 is weak: inconsistent_api_recovery 100/100
298
+ # (vs 40/80), conditional_routing 100/100 (vs 60/100). Loses error_recovery (60/60 vs
299
+ # 100/80), grounded_synthesis (60/20 vs 60/80). 4 of the 6 misses are ONE quirk: after a
300
+ # tool raises TypeError, string args come back double-quoted ("0010" -> "\"0010\"").
301
+ # Card caveat (confirmed): not recommended for agentic coding. Use it for long-context
302
+ # tiny-tier work, not as a coding worker. Card sampling: temp 0.1, top_k 50, rp 1.1.
303
+ coding-guardrails server start -m LFM3-1.7B-Q8_0
304
+ # (equivalent raw llama-server: -c 262144 -ctk q8_0 -ctv q8_0 -np 1 --jinja
305
+ # --temp 0.1 --top-k 50 --repeat-penalty 1.1)
306
+
239
307
  # Session 2: Guardrails proxy (with config for increased budgets)
240
308
  source .venv/bin/activate
241
309
  coding-guardrails serve \
@@ -251,7 +319,7 @@ coding-guardrails serve \
251
319
 
252
320
  ### Notes
253
321
 
254
- - **llama-server**: use the local `~/llama.cpp/llama-server` (a symlink to `build/bin/llama-server`). Rebuilt 2026-07-03 to latest master (commit `fdb1db877`, build 9860) — supports Qwen3.5-MTP, Qwen3.6-27B (qwen3next arch / `ssm_conv1d`), Gemma 4, Ornith, LFM2.5 (`lfm2` arch). Build config: `GGML_CUDA=ON`, `LLAMA_CURL=ON`, Release. NCCL disabled (single-GPU). Stale `llama-server.bak.8276` kept as backup.
322
+ - **llama-server**: use the local `~/llama.cpp/llama-server` (a symlink to `build/bin/llama-server`) for scratch experiments. cg's managed binary lives at `~/.local/share/coding-guardrails/llama.cpp` and is built from the pin in `server/version.py` — **bumped 2026-11-09 to `d493f84` (llama.cpp 0.9.0-dev) from the DSpine fork** (`PINNED_REPO = github.com/Ajay9o9/llama.cpp`, branch `dspine`; was `39febd2ad` upstream). The fork commit is `dflash : add DSpine draft model support` on top of upstream master, so everything the old pin carried (Gemma 4 tool-call fix, Flint `LLM_ARCH_FLINT`, LFM3 tri-hybrid, Qwen3.5/3.6/3.8, Ornith, LFM2.5, MiniCPM5) is still in. `build.py` re-points the checkout's `origin` every run, so a checkout cloned from ggml-org follows the pin to the fork with no manual git work. Rebuild: `coding-guardrails server build` (CUDA auto-detected; the CLI's shallow `git fetch <sha>` can fail with `early EOF` — retry, and clear any stale `.git/shallow.lock` left by a killed run). The 2026-11-09 rebuild was verified end-to-end: `cg server start -m Qwen3.8-27B-UD-Q3_K_XL` boots with `-md` + `--spec-type draft-dflash --spec-draft-n-max 4`, and a 150-run Forge eval through :8081 scored 150/150 completion / 149/150 correctness in 29.7 min. Switch `PINNED_REPO` back to ggml-org once DSpine lands upstream.
255
323
  - **PORTS**: llama-server backend = `:8080`, guardrails proxy = `:8081`. Never run llama-server on `:8081` (collides with the proxy).
256
324
  - **Qwen3.5-MTP `missing tensor 'blk.32.ssm_conv1d.weight'` error** = an OLD llama.cpp build (build 8276-era). The GGUF is correct (33 layers; blk.32 is an attention layer, not SSM). Build ≥ `5a6a0dd` reads the real layout and loads fine. If this recurs, the culprit is a stale binary on PATH / a vendored checkout, not the file.
257
325
  - Qwen3.6-27B: max reliable ctx on the 24 GB card is **48K with q8_0 KV** (UD-Q4_K_XL). 56K+ needs a
@@ -279,11 +347,11 @@ coding-guardrails serve \
279
347
  ## Testing
280
348
 
281
349
  ```bash
282
- pytest tests/unit/ -q # All 746 tests
350
+ pytest tests/unit/ -q # All 794 tests
283
351
  pytest tests/unit/ -q -k "loop" # Specific rule
284
352
  ```
285
353
 
286
- All 746 tests must pass before committing.
354
+ All 794 tests must pass before committing.
287
355
 
288
356
  ## Eval
289
357
 
@@ -303,6 +371,11 @@ python eval/scripts/run_layer2_eval.py
303
371
  # Adversarial security suite (attack scenarios + benign false-positive checks,
304
372
  # deterministic — no LLM, sub-second, CI-able)
305
373
  python eval/scripts/run_security_eval.py
374
+
375
+ # Semantic-judge validation: 21 exfil vectors, deterministic vs judge-on,
376
+ # latency, curated benign controls + developer-FP profile (needs dlserver)
377
+ python eval/scripts/run_security_eval.py --exfil-battery -v \
378
+ --judge-url http://127.0.0.1:8045 --judge-engine decider-0.8b --judge-timeout-ms 2000
306
379
  ```
307
380
 
308
381
  Results go to `eval/runs/<timestamp>/` (gitignored).
@@ -311,9 +384,22 @@ Results go to `eval/runs/<timestamp>/` (gitignored).
311
384
  re-eval 2026-08-08 under v0.16.1 — the old "93% (140/150)" included the v0.7.4 respond() bug
312
385
  that zeroed tool_selection for every model). Qwen3.6-27B: 149/150 (99.3%); LFM2.5: 139/150
313
386
  (92.7%). Accuracy: Ornith 95%, Qwen3.6-27B 94%, Qwen3.5-9B 92%, LFM2.5 71%.
387
+ **Qwen3.8-27B + DSpine (v0.26.0 default): 150/150 completion, 149/150 correctness (99%),
388
+ 33.8 min wall on the shipped profile (120K ctx, q4_0 KV, managed proxy) / 29.7 min at 98K
389
+ q8_0 KV** — the same target GGUF and harness without the drafter takes 64.1 min
390
+ (150/150, 146/150), so DSpine is a clean **1.89x on the production path, 2.16x at 98K**
391
+ at no accuracy cost.
314
392
  **MiniCPM5-2B (added v0.20.0 as the tiny tier): 150/150 (100%) completion, 128/150 (85%) accuracy**
315
393
  — tool_selection 5/5 (+stateful) and data_gap_recovery_extended 100% fix LFM2.5's genuine gaps;
316
394
  only argument_transformation (0-20%) and inconsistent_api_recovery (40%) stay weak.
395
+ **Flint (added v0.23.0 as the fast MoE tier): 145/150 (96.7%) completion, 135/150 (90%)
396
+ accuracy, 24 min wall** — the fastest 40B-class run; all compaction_chain + data_gap_*
397
+ 100%, but tool_selection 40% (prose instead of respond()) and argument_transformation
398
+ ~40-60%.
399
+ **LFM3-1.7B (added v0.24.0 as the long-context tiny tier): 144/150 (96%) completion,
400
+ 129/150 (86%) accuracy, 24 min wall** — ties MiniCPM5-2B on accuracy at 2/3 the params with
401
+ 2x the context (256K @ ~4.5 GB), but ~2x the wall time and worse completion; 4 of its 6
402
+ misses are a retry-context double-quoting quirk on string args, not reasoning.
317
403
 
318
404
  **Eval-harness sync (2026-09-08, v0.20.1):** the vendored `tests/eval` harness was 49 commits
319
405
  stale (v0.7.0-era); its `CountingClientWrapper` lacked the `passthrough`/`inbound_anthropic_body`/
@@ -328,7 +414,7 @@ files — re-sync `tests/eval` from forge upstream after any vendor refresh.
328
414
  ## Development Guidelines
329
415
 
330
416
  - **Do NOT hack Forge source** — extend via public API, subclassing, wrapping
331
- - All 746 unit tests must pass
417
+ - All 794 unit tests must pass
332
418
  - No hardcoded scenario-specific logic
333
419
  - Block responses must return **text**, not empty tool calls
334
420
  - Enforcement prompts must mention `respond()` as the exit tool
@@ -359,7 +445,7 @@ Every release follows these steps **in order**. Do not skip any step.
359
445
 
360
446
  ```bash
361
447
  source .venv/bin/activate
362
- pytest tests/unit/ -q # All 746 tests MUST pass
448
+ pytest tests/unit/ -q # All 794 tests MUST pass
363
449
  ```
364
450
 
365
451
  If any test fails → **stop**, fix, re-run. Do not proceed.
@@ -1,5 +1,26 @@
1
1
  # Session History
2
2
 
3
+ ## 2026-10-28 — v0.24.0: LFM3-1.7B (256K long-context tiny tier) + llama.cpp pin bump
4
+ - **Pin bump**: `d77256999` → `39febd2ad` (llama.cpp 0.8.0-dev) for `LLM_ARCH_LFM3`
5
+ (#31252 text+VL, #31257 audio+omni, #31283 video input). Rebuilt, `cg server version`
6
+ matches the pin. Smoke-tested through `cg server start`: Flint (MoE + q8_0 KV @128K) and
7
+ LFM3-1.7B (256K ctx) both emit clean tool calls. 747 unit tests pass.
8
+ - **New profile `LFM3-1.7B-Q8_0`** — tri-hybrid 1.73B, 256K ctx verified at ~4.5 GB VRAM
9
+ (only 6 of 24 layers hold KV), ~150 tok/s, temp 0.1 / top_k 50 / rp 1.1.
10
+ - **Full Forge 30-scenario eval (150 runs, proxy mode, 24 min): 144/150 (96%) completion,
11
+ 129/150 (86%) accuracy.** Ties MiniCPM5-2B (85%) at 2/3 the params and 2x the context, but
12
+ ~2x the wall time (1444s vs 766s). Wins where MiniCPM5 is weak (inconsistent_api_recovery
13
+ 100/100 vs 40/80; conditional_routing 100/100 vs 60/100; data_gap_* 100%); loses
14
+ error_recovery (60/60 vs 100/80) and grounded_synthesis (60/20 vs 60/80).
15
+ - **Root cause of 4 of the 6 misses**: after a tool raises `TypeError`, string args are
16
+ re-emitted double-quoted (`count: "0010"` → `"\"0010\""`). Direct calls render
17
+ correctly — retry-context drift, not reasoning failure. The other 2 are
18
+ `_ToolCallExhausted` on `sequential_reasoning_stateful`. Card caveat ("not recommended for
19
+ agentic coding") holds; added as a long-context tiny tier, NOT a coding worker.
20
+ - Artifacts: `eval/runs/2026-10-28_143636Z/`; docs/models.md + CLAUDE.md updated.
21
+ - Qwen3.8-27B (systemd default) was NOT re-smoke-tested on this pin — its GGUF is absent on
22
+ the test host.
23
+
3
24
  ## 2026-09-11 — Thinking mode allowed safely + reliably on the plain path
4
25
  - Plain (no-tool) requests previously dropped captured thinking entirely (Forge parses
5
26
  reasoning_content only for tool-call responses) and could return EMPTY content when
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: coding-guardrails
3
- Version: 0.22.0
3
+ Version: 0.26.0
4
4
  Summary: A safety + reliability proxy for coding agents on local LLMs. Forge rescue/retry/validation + 13 composable guardrail rules. Measured on the Forge 30-scenario eval: 100% completion, up to 95% accuracy.
5
5
  Project-URL: Homepage, https://github.com/stawils/coding-guardrails
6
6
  Project-URL: Repository, https://github.com/stawils/coding-guardrails
@@ -85,8 +85,8 @@ policy. Neither requires rewriting your agent.
85
85
  ```bash
86
86
  pip install coding-guardrails
87
87
 
88
- coding-guardrails server build # builds cg's llama-server (pinned commit; includes the Gemma 4 tool-call fix)
89
- coding-guardrails server start --model Qwen3.8-27B-UD-Q3_K_XL # LLM backend on :8080 (default — measured 100% completion / 99% accuracy)
88
+ coding-guardrails server build # builds cg's llama-server (pinned commit: llama.cpp 0.9.0-dev + DSpine draft support)
89
+ coding-guardrails server start --model Qwen3.8-27B-UD-Q3_K_XL # backend on :8080 (default — DSpine draft model attached; 100% completion / 99% accuracy)
90
90
  coding-guardrails serve --backend-url http://localhost:8080 \
91
91
  --model Qwen3.8-27B-UD-Q3_K_XL --port 8081 # proxy on :8081
92
92
 
@@ -157,15 +157,19 @@ Every number below is from a recorded run — timestamps and run IDs included
157
157
  and the eval is reproducible (`eval/scripts/run_forge_eval.py`, proxy mode).
158
158
 
159
159
  All numbers are recorded runs on the same local GPU (proxy mode). The
160
- Qwen3.8-27B row is **v0.17.0** (2026-08-15); the rest are the **v0.16.1**
161
- re-eval (2026-08-07/08) after the respond() fix:
160
+ Qwen3.8-27B row is **v0.26.0** (2026-11-09, shipped profile with the DSpine
161
+ draft model); the rest are the **v0.16.1** re-eval (2026-08-07/08) after the
162
+ respond() fix:
162
163
 
163
164
  | Model | Completion | Accuracy | Run |
164
165
  |---|---|---|---|
165
- | **Qwen3.8-27B (default)** | **150/150 (100%)** | **148/150 (99%)** | `2026-08-15_000804Z` |
166
+ | **Qwen3.8-27B (default)** | **150/150 (100%)** | **149/150 (99%)** | `2026-11-09_101147Z` |
166
167
  | Qwen3.5-9B | **150/150 (100%)** | 138/150 (92%) | `2026-08-08_142633Z` |
167
168
  | Ornith-1.0-9B | **150/150 (100%)** | **143/150 (95%)** | `2026-08-08_144837Z` |
168
169
  | Qwen3.6-27B | **149/150 (99.3%)** | 141/150 (94%) | `2026-08-07_151927Z` |
170
+ | Flint 39.8B-A2.5B | 145/150 (96.7%) | 135/150 (90%) | `2026-10-22_144116Z` |
171
+ | MiniCPM5-2B | **150/150 (100%)** | 128/150 (85%) | `2026-09-08_111510Z` |
172
+ | LFM3-1.7B | 144/150 (96%) | 129/150 (86%) | `2026-10-28_143636Z` |
169
173
  | LFM2.5-2.6B | 139/150 (92.7%) | 100/140 (71%) | `2026-08-08_153811Z` |
170
174
 
171
175
  **What the numbers mean.** *Completion* = the run finished through the terminal
@@ -222,7 +226,7 @@ defaults, boot flags, VRAM requirements, and context limits per GGUF.
222
226
 
223
227
  | Model | Size | VRAM | Context | Speed | Eval | When to use |
224
228
  |---|---|---|---|---|---|---|
225
- | **Qwen3.8-27B** ⭐ | 13.44 GB | 18.2 GB | **128K** | ~68 tok/s (MTP) | **100% / 99% acc** | **Default.** Best measured agent on the harness; vision-capable |
229
+ | **Qwen3.8-27B** ⭐ | 13.44 GB | 17.8 GB | **120K** | **~84 tok/s** (DSpine) | **100% / 99% acc** | **Default.** Best measured agent on the harness; vision-capable |
226
230
  | **Qwen3.5-9B** | 5.7 GB | 18 GB | 200K | ~53 tok/s (MTP) | 100% / 92% acc | Fast fallback; longest context (200K) |
227
231
  | **Ornith-1.0-9B** | 9.5 GB | 18 GB | 200K | ~50 tok/s | 100% / **95% acc** | Best 9B accuracy; reasoning model |
228
232
  | **Qwen3.6-27B** | 17.9 GB | 19.5 GB | **48K** | ~20-30 tok/s | 99.3% / 94% acc | Highest capability when 48K suffices |
@@ -230,6 +234,42 @@ defaults, boot flags, VRAM requirements, and context limits per GGUF.
230
234
  | **LFM2.5-2.6B** | 5.4 GB | 9 GB | 128K | ~113 tok/s | 92.7% / 71% acc | Bounded tasks only (card caveat confirmed) |
231
235
  | **MiniCPM5-2B** | 1.56 GB | ~3.0 GB | **131K** | ~182 tok/s | 100% / 85% acc | Fastest edge tier; replaces LFM2.5 (better tool-select) |
232
236
 
237
+ ### Speculative decoding: DSpine (why the default got ~2x faster)
238
+
239
+ The Qwen3.8-27B default ships a draft model. [DSpine](https://arxiv.org/abs/2609.36173)
240
+ (Tencent Hunyuan) is a five-layer parallel drafter that reads hidden states from
241
+ five target layers, drafts a 16-token block, and injects each position's predicted
242
+ predecessor code into its successor at every layer. It rides llama.cpp's existing
243
+ `draft-dflash` implementation, so a profile only has to name the drafter:
244
+
245
+ ```python
246
+ # models/profiles.py
247
+ drafter="Qwen3.8-27B-DSpine-b16-Q4_K_M", # key into server/sources.py DRAFTERS
248
+ spec_n_max=4, # tokens drafted per verify step
249
+ ```
250
+
251
+ `cg server download <profile>` fetches the drafter with the target; `cg server start`
252
+ appends `-md … --spec-type draft-dflash --spec-draft-n-max 4` and budgets the
253
+ drafter's VRAM in the gate. A missing drafter logs a warning and boots the target
254
+ without speculation rather than failing.
255
+
256
+ Measured 2026-11-09 on an RTX 3090 Ti (UD-Q3_K_XL target, same harness both ways):
257
+
258
+ | | wall time (150 runs) | completion | correctness |
259
+ |---|---:|---:|---:|
260
+ | no speculation | 3846.6 s (64.1 min) | 150/150 | 146/150 (97%) |
261
+ | **DSpine, n-max 4** | **2030.7 s (33.8 min)** | 150/150 | **149/150 (99%)** |
262
+
263
+ Short-context decode goes from **46.3 to 94.5 tok/s** (n-max 4); code and math hit
264
+ ~120 tok/s. `--spec-draft-n-max` is hardware dependent — 4 is the peak on a Q3
265
+ target, while the model card's 15 targets a Q4_K_M/3090 setup; sweep it yourself
266
+ with `llama-benchy` or the eval before trusting a number.
267
+
268
+ > DSpine is not upstream in llama.cpp yet, so cg's pin points at a fork
269
+ > (`PINNED_REPO` in `server/version.py`) whose branch is upstream master plus one
270
+ > audited commit. Everything else in the pin is stock llama.cpp; switch the repo
271
+ > back to `ggml-org` once DSpine lands upstream.
272
+
233
273
  ### Vision (multimodal)
234
274
 
235
275
  Qwen3.8-27B is natively multimodal (images; hour-scale video is vLLM/SGLang
@@ -272,9 +312,11 @@ down.
272
312
  256`) is sized to fit the fragmented state, not the ideal one.
273
313
  - **24 GB VRAM is the practical ceiling.** Qwen3.6-27B is capped at 48K
274
314
  context (56K+ needs a single KV allocation the fragmented allocator can't
275
- provide). Qwen3.8-27B (UD-Q3_K_XL + q4_0 KV + MTP + mmproj) runs **128K on
276
- the same card** — its hybrid architecture keeps the KV cache cheap. 200K
277
- context is still only realistic for the 9B-class models.
315
+ provide). Qwen3.8-27B (UD-Q3_K_XL + q4_0 KV + DSpine draft) runs **120K on
316
+ the same card** (128K at 3 drafted tokens) — its hybrid architecture keeps
317
+ the KV cache cheap. 200K context is still only realistic for the 9B-class
318
+ models. A speculative drafter also costs ~150 MB of recurrent state per
319
+ drafted token, which comes out of that same budget.
278
320
  - **Local models are local models.** The eval tables above are the honest
279
321
  picture: excellent at tool plumbing, weak at multi-source synthesis.
280
322
  - **The lint gate runs on every edited file.** If you don't lint your code,
@@ -291,7 +333,7 @@ limits; workspace root for path safety; secret patterns. Full reference in
291
333
 
292
334
  ```bash
293
335
  source .venv/bin/activate
294
- pytest tests/unit/ -q # 692 tests (~28s)
336
+ pytest tests/unit/ -q # 794 tests (~25s)
295
337
  python eval/scripts/run_forge_eval.py --mode proxy --runs 5 # the eval behind the tables above
296
338
  ```
297
339
 
@@ -53,8 +53,8 @@ policy. Neither requires rewriting your agent.
53
53
  ```bash
54
54
  pip install coding-guardrails
55
55
 
56
- coding-guardrails server build # builds cg's llama-server (pinned commit; includes the Gemma 4 tool-call fix)
57
- coding-guardrails server start --model Qwen3.8-27B-UD-Q3_K_XL # LLM backend on :8080 (default — measured 100% completion / 99% accuracy)
56
+ coding-guardrails server build # builds cg's llama-server (pinned commit: llama.cpp 0.9.0-dev + DSpine draft support)
57
+ coding-guardrails server start --model Qwen3.8-27B-UD-Q3_K_XL # backend on :8080 (default — DSpine draft model attached; 100% completion / 99% accuracy)
58
58
  coding-guardrails serve --backend-url http://localhost:8080 \
59
59
  --model Qwen3.8-27B-UD-Q3_K_XL --port 8081 # proxy on :8081
60
60
 
@@ -125,15 +125,19 @@ Every number below is from a recorded run — timestamps and run IDs included
125
125
  and the eval is reproducible (`eval/scripts/run_forge_eval.py`, proxy mode).
126
126
 
127
127
  All numbers are recorded runs on the same local GPU (proxy mode). The
128
- Qwen3.8-27B row is **v0.17.0** (2026-08-15); the rest are the **v0.16.1**
129
- re-eval (2026-08-07/08) after the respond() fix:
128
+ Qwen3.8-27B row is **v0.26.0** (2026-11-09, shipped profile with the DSpine
129
+ draft model); the rest are the **v0.16.1** re-eval (2026-08-07/08) after the
130
+ respond() fix:
130
131
 
131
132
  | Model | Completion | Accuracy | Run |
132
133
  |---|---|---|---|
133
- | **Qwen3.8-27B (default)** | **150/150 (100%)** | **148/150 (99%)** | `2026-08-15_000804Z` |
134
+ | **Qwen3.8-27B (default)** | **150/150 (100%)** | **149/150 (99%)** | `2026-11-09_101147Z` |
134
135
  | Qwen3.5-9B | **150/150 (100%)** | 138/150 (92%) | `2026-08-08_142633Z` |
135
136
  | Ornith-1.0-9B | **150/150 (100%)** | **143/150 (95%)** | `2026-08-08_144837Z` |
136
137
  | Qwen3.6-27B | **149/150 (99.3%)** | 141/150 (94%) | `2026-08-07_151927Z` |
138
+ | Flint 39.8B-A2.5B | 145/150 (96.7%) | 135/150 (90%) | `2026-10-22_144116Z` |
139
+ | MiniCPM5-2B | **150/150 (100%)** | 128/150 (85%) | `2026-09-08_111510Z` |
140
+ | LFM3-1.7B | 144/150 (96%) | 129/150 (86%) | `2026-10-28_143636Z` |
137
141
  | LFM2.5-2.6B | 139/150 (92.7%) | 100/140 (71%) | `2026-08-08_153811Z` |
138
142
 
139
143
  **What the numbers mean.** *Completion* = the run finished through the terminal
@@ -190,7 +194,7 @@ defaults, boot flags, VRAM requirements, and context limits per GGUF.
190
194
 
191
195
  | Model | Size | VRAM | Context | Speed | Eval | When to use |
192
196
  |---|---|---|---|---|---|---|
193
- | **Qwen3.8-27B** ⭐ | 13.44 GB | 18.2 GB | **128K** | ~68 tok/s (MTP) | **100% / 99% acc** | **Default.** Best measured agent on the harness; vision-capable |
197
+ | **Qwen3.8-27B** ⭐ | 13.44 GB | 17.8 GB | **120K** | **~84 tok/s** (DSpine) | **100% / 99% acc** | **Default.** Best measured agent on the harness; vision-capable |
194
198
  | **Qwen3.5-9B** | 5.7 GB | 18 GB | 200K | ~53 tok/s (MTP) | 100% / 92% acc | Fast fallback; longest context (200K) |
195
199
  | **Ornith-1.0-9B** | 9.5 GB | 18 GB | 200K | ~50 tok/s | 100% / **95% acc** | Best 9B accuracy; reasoning model |
196
200
  | **Qwen3.6-27B** | 17.9 GB | 19.5 GB | **48K** | ~20-30 tok/s | 99.3% / 94% acc | Highest capability when 48K suffices |
@@ -198,6 +202,42 @@ defaults, boot flags, VRAM requirements, and context limits per GGUF.
198
202
  | **LFM2.5-2.6B** | 5.4 GB | 9 GB | 128K | ~113 tok/s | 92.7% / 71% acc | Bounded tasks only (card caveat confirmed) |
199
203
  | **MiniCPM5-2B** | 1.56 GB | ~3.0 GB | **131K** | ~182 tok/s | 100% / 85% acc | Fastest edge tier; replaces LFM2.5 (better tool-select) |
200
204
 
205
+ ### Speculative decoding: DSpine (why the default got ~2x faster)
206
+
207
+ The Qwen3.8-27B default ships a draft model. [DSpine](https://arxiv.org/abs/2609.36173)
208
+ (Tencent Hunyuan) is a five-layer parallel drafter that reads hidden states from
209
+ five target layers, drafts a 16-token block, and injects each position's predicted
210
+ predecessor code into its successor at every layer. It rides llama.cpp's existing
211
+ `draft-dflash` implementation, so a profile only has to name the drafter:
212
+
213
+ ```python
214
+ # models/profiles.py
215
+ drafter="Qwen3.8-27B-DSpine-b16-Q4_K_M", # key into server/sources.py DRAFTERS
216
+ spec_n_max=4, # tokens drafted per verify step
217
+ ```
218
+
219
+ `cg server download <profile>` fetches the drafter with the target; `cg server start`
220
+ appends `-md … --spec-type draft-dflash --spec-draft-n-max 4` and budgets the
221
+ drafter's VRAM in the gate. A missing drafter logs a warning and boots the target
222
+ without speculation rather than failing.
223
+
224
+ Measured 2026-11-09 on an RTX 3090 Ti (UD-Q3_K_XL target, same harness both ways):
225
+
226
+ | | wall time (150 runs) | completion | correctness |
227
+ |---|---:|---:|---:|
228
+ | no speculation | 3846.6 s (64.1 min) | 150/150 | 146/150 (97%) |
229
+ | **DSpine, n-max 4** | **2030.7 s (33.8 min)** | 150/150 | **149/150 (99%)** |
230
+
231
+ Short-context decode goes from **46.3 to 94.5 tok/s** (n-max 4); code and math hit
232
+ ~120 tok/s. `--spec-draft-n-max` is hardware dependent — 4 is the peak on a Q3
233
+ target, while the model card's 15 targets a Q4_K_M/3090 setup; sweep it yourself
234
+ with `llama-benchy` or the eval before trusting a number.
235
+
236
+ > DSpine is not upstream in llama.cpp yet, so cg's pin points at a fork
237
+ > (`PINNED_REPO` in `server/version.py`) whose branch is upstream master plus one
238
+ > audited commit. Everything else in the pin is stock llama.cpp; switch the repo
239
+ > back to `ggml-org` once DSpine lands upstream.
240
+
201
241
  ### Vision (multimodal)
202
242
 
203
243
  Qwen3.8-27B is natively multimodal (images; hour-scale video is vLLM/SGLang
@@ -240,9 +280,11 @@ down.
240
280
  256`) is sized to fit the fragmented state, not the ideal one.
241
281
  - **24 GB VRAM is the practical ceiling.** Qwen3.6-27B is capped at 48K
242
282
  context (56K+ needs a single KV allocation the fragmented allocator can't
243
- provide). Qwen3.8-27B (UD-Q3_K_XL + q4_0 KV + MTP + mmproj) runs **128K on
244
- the same card** — its hybrid architecture keeps the KV cache cheap. 200K
245
- context is still only realistic for the 9B-class models.
283
+ provide). Qwen3.8-27B (UD-Q3_K_XL + q4_0 KV + DSpine draft) runs **120K on
284
+ the same card** (128K at 3 drafted tokens) — its hybrid architecture keeps
285
+ the KV cache cheap. 200K context is still only realistic for the 9B-class
286
+ models. A speculative drafter also costs ~150 MB of recurrent state per
287
+ drafted token, which comes out of that same budget.
246
288
  - **Local models are local models.** The eval tables above are the honest
247
289
  picture: excellent at tool plumbing, weak at multi-source synthesis.
248
290
  - **The lint gate runs on every edited file.** If you don't lint your code,
@@ -259,7 +301,7 @@ limits; workspace root for path safety; secret patterns. Full reference in
259
301
 
260
302
  ```bash
261
303
  source .venv/bin/activate
262
- pytest tests/unit/ -q # 692 tests (~28s)
304
+ pytest tests/unit/ -q # 794 tests (~25s)
263
305
  python eval/scripts/run_forge_eval.py --mode proxy --runs 5 # the eval behind the tables above
264
306
  ```
265
307
 
@@ -155,3 +155,27 @@ lint:
155
155
  # extensions: [".rs"]
156
156
  # command: ["cargo", "clippy", "--", "--no-deps", "-q"]
157
157
  # path_mode: project
158
+
159
+ # ── Semantic judge (opt-in, default OFF) ────────────────────────────────────
160
+ # A calibrated probability decider (sibling project `~/workspaces/decision-layer`)
161
+ # consulted by a rule only AFTER its deterministic patterns found nothing. It is
162
+ # the fallback for novel phrasings of known-dangerous actions (see
163
+ # plans/2026-06-15_exfil-vector-investigation.md — 8 documented bypasses).
164
+ #
165
+ # Costs: ~2GB VRAM while the engine is warm (dlserver idle-unloads it), plus
166
+ # ~40-105ms warm per consult. Nothing is loaded in the proxy process and no
167
+ # VRAM is used when this block is absent.
168
+ #
169
+ # Start the service: ~/workspaces/decision-layer/scripts/start-dlserver.sh 8044
170
+ # Health: curl http://127.0.0.1:8044/health
171
+ #
172
+ # Failure behaviour is fail-open: a timeout, connection error, or malformed
173
+ # reply allows the call and logs JUDGE unavailable (...). No retries.
174
+ # judge:
175
+ # enabled: false # turn on to consult the judge
176
+ # url: "http://127.0.0.1:8044" # dlserver
177
+ # engine: "decider-0.8b" # ~2GB; "decider-2b" (~4GB) for safety-critical
178
+ # timeout_ms: 500 # whole budget, no retries
179
+ # consult_when: "deterministic-allow" # only when every pattern passed
180
+ # graded_blocks: false # true = mid-band (0.5-0.8) becomes a block
181
+ # rules: ["command_safety"] # rules allowed to consult the judge
@@ -39,6 +39,10 @@ coding-guardrails proxy (:8081)
39
39
  │ ├── thoroughness — detect premature terminal submission
40
40
  │ └── tool_resolution — warn on empty/error tool results
41
41
  │
42
+ │ Optional (off by default): rules may consult a semantic judge over HTTP
43
+ │ (dlserver :8044) when their patterns matched nothing. See
44
+ │ docs/semantic-judge.md. The proxy never loads a model for this.
45
+ │
42
46
  ▼
43
47
  llama-server (:8080) → GPU inference
44
48
  │