sia-hu 0.4.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 (230) hide show
  1. sia_hu-0.4.0/.codegraphinclude +42 -0
  2. sia_hu-0.4.0/.github/workflows/ci.yml +43 -0
  3. sia_hu-0.4.0/.github/workflows/publish.yml +33 -0
  4. sia_hu-0.4.0/.gitignore +78 -0
  5. sia_hu-0.4.0/.ixd.toml +38 -0
  6. sia_hu-0.4.0/.python-version +1 -0
  7. sia_hu-0.4.0/CHANGELOG.md +56 -0
  8. sia_hu-0.4.0/LICENSE +21 -0
  9. sia_hu-0.4.0/PKG-INFO +161 -0
  10. sia_hu-0.4.0/PROJECT-ROADMAP.md +85 -0
  11. sia_hu-0.4.0/README.md +126 -0
  12. sia_hu-0.4.0/SESSION-HANDOFF.md +152 -0
  13. sia_hu-0.4.0/SESSION-SUMMARY.md +36 -0
  14. sia_hu-0.4.0/capture-proxy/config/capture-proxy.toml +10 -0
  15. sia_hu-0.4.0/capture-proxy/scripts/capture_query.py +309 -0
  16. sia_hu-0.4.0/capture-proxy/scripts/verify_routed_experts.py +172 -0
  17. sia_hu-0.4.0/capture-proxy/set-agent-model.py +277 -0
  18. sia_hu-0.4.0/capture-proxy/subagent.sh +163 -0
  19. sia_hu-0.4.0/capture-proxy/tests/conftest.py +52 -0
  20. sia_hu-0.4.0/capture-proxy/tests/test_alias.py +336 -0
  21. sia_hu-0.4.0/capture-proxy/tests/test_alias_perf.py +50 -0
  22. sia_hu-0.4.0/capture-proxy/tests/test_alias_request.py +235 -0
  23. sia_hu-0.4.0/capture-proxy/tests/test_alias_response.py +206 -0
  24. sia_hu-0.4.0/capture-proxy/tests/test_alias_streaming.py +209 -0
  25. sia_hu-0.4.0/capture-proxy/tests/test_app.py +1322 -0
  26. sia_hu-0.4.0/capture-proxy/tests/test_capture_contract.py +616 -0
  27. sia_hu-0.4.0/capture-proxy/tests/test_classification.py +559 -0
  28. sia_hu-0.4.0/capture-proxy/tests/test_embedding.py +519 -0
  29. sia_hu-0.4.0/capture-proxy/tests/test_headroom.py +1217 -0
  30. sia_hu-0.4.0/capture-proxy/tests/test_headroom_activations.py +473 -0
  31. sia_hu-0.4.0/capture-proxy/tests/test_headroom_emo_support.py +842 -0
  32. sia_hu-0.4.0/capture-proxy/tests/test_headroom_real_io.py +388 -0
  33. sia_hu-0.4.0/capture-proxy/tests/test_image.py +548 -0
  34. sia_hu-0.4.0/capture-proxy/tests/test_isolation.py +46 -0
  35. sia_hu-0.4.0/capture-proxy/tests/test_logger.py +198 -0
  36. sia_hu-0.4.0/capture-proxy/tests/test_main_alias_config.py +152 -0
  37. sia_hu-0.4.0/capture-proxy/tests/test_main_ensure_config.py +152 -0
  38. sia_hu-0.4.0/capture-proxy/tests/test_main_model_tasks_config.py +171 -0
  39. sia_hu-0.4.0/capture-proxy/tests/test_names_contract.py +286 -0
  40. sia_hu-0.4.0/capture-proxy/tests/test_native_routes.py +366 -0
  41. sia_hu-0.4.0/capture-proxy/tests/test_rerank.py +561 -0
  42. sia_hu-0.4.0/capture-proxy/tests/test_routing.py +402 -0
  43. sia_hu-0.4.0/capture-proxy/tests/test_routing_injection.py +317 -0
  44. sia_hu-0.4.0/capture-proxy/tests/test_runtime.py +320 -0
  45. sia_hu-0.4.0/capture-proxy/tests/test_session.py +77 -0
  46. sia_hu-0.4.0/capture-proxy/tests/test_sglang.py +246 -0
  47. sia_hu-0.4.0/capture-proxy/tests/test_smoke.py +501 -0
  48. sia_hu-0.4.0/capture-proxy/tests/test_stream.py +655 -0
  49. sia_hu-0.4.0/capture-proxy/tests/test_taskclass_adversarial.py +446 -0
  50. sia_hu-0.4.0/capture-proxy/tests/test_tracking.py +463 -0
  51. sia_hu-0.4.0/capture-proxy/tests/test_upstream.py +252 -0
  52. sia_hu-0.4.0/docs/architecture/authority-carrier.md +122 -0
  53. sia_hu-0.4.0/docs/architecture/contract.md +132 -0
  54. sia_hu-0.4.0/docs/architecture/sia-hu-identity.md +71 -0
  55. sia_hu-0.4.0/docs/capture-proxy/CHANGELOG.md +41 -0
  56. sia_hu-0.4.0/docs/capture-proxy/PROJECT-ROADMAP.md +464 -0
  57. sia_hu-0.4.0/docs/capture-proxy/README.md +439 -0
  58. sia_hu-0.4.0/docs/capture-proxy/codegraph-ferrari-finetune-proposal.md +105 -0
  59. sia_hu-0.4.0/docs/capture-proxy/example-headroom.md +126 -0
  60. sia_hu-0.4.0/docs/capture-proxy/headroom-capture-design.md +162 -0
  61. sia_hu-0.4.0/docs/capture-proxy/signal-recipe-work-order.md +76 -0
  62. sia_hu-0.4.0/docs/concepts/frozen-contracts.md +88 -0
  63. sia_hu-0.4.0/docs/concepts/headroom-signals.md +214 -0
  64. sia_hu-0.4.0/docs/concepts/provenance.md +71 -0
  65. sia_hu-0.4.0/docs/guides/capture-proxy.md +224 -0
  66. sia_hu-0.4.0/docs/guides/engine-selection.md +170 -0
  67. sia_hu-0.4.0/docs/guides/model-headroom.md +171 -0
  68. sia_hu-0.4.0/docs/guides/p2-research-items.md +185 -0
  69. sia_hu-0.4.0/docs/guides/quickstart.md +280 -0
  70. sia_hu-0.4.0/docs/guides/sia-cli.md +81 -0
  71. sia_hu-0.4.0/docs/guides/support-matrix.md +91 -0
  72. sia_hu-0.4.0/docs/index.md +93 -0
  73. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U1a-1.md +144 -0
  74. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U1a-2.md +145 -0
  75. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U1b-1.md +84 -0
  76. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U1b-2.md +56 -0
  77. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U2a.md +105 -0
  78. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U2b.md +114 -0
  79. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U3.md +127 -0
  80. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U4.md +185 -0
  81. sia_hu-0.4.0/docs/maintenance/2026-11-06-cam/U5.md +201 -0
  82. sia_hu-0.4.0/docs/maintenance/2026-11-06-handoff.md +177 -0
  83. sia_hu-0.4.0/docs/maintenance/2026-11-07-ad/AD-A.md +32 -0
  84. sia_hu-0.4.0/docs/maintenance/2026-11-07-ad/AD-D.md +32 -0
  85. sia_hu-0.4.0/docs/maintenance/2026-11-07-cbp/CBP.md +32 -0
  86. sia_hu-0.4.0/docs/maintenance/2026-11-07-seams/SEAMS.md +33 -0
  87. sia_hu-0.4.0/docs/maintenance/2026-11-08-audit/Phase2-effective-rank.md +45 -0
  88. sia_hu-0.4.0/docs/maintenance/2026-11-08-audit/Phase8-research.md +73 -0
  89. sia_hu-0.4.0/docs/maintenance/2026-11-08-audit/U6.md +130 -0
  90. sia_hu-0.4.0/docs/maintenance/2026-11-08-audit/U7.md +209 -0
  91. sia_hu-0.4.0/docs/model-headroom/PROJECT-ROADMAP.md +215 -0
  92. sia_hu-0.4.0/docs/model-headroom/README.md +204 -0
  93. sia_hu-0.4.0/docs/model-headroom/TEST_PROTOCOL.md +422 -0
  94. sia_hu-0.4.0/docs/operations/dev-commands.md +110 -0
  95. sia_hu-0.4.0/docs/operations/environment.md +81 -0
  96. sia_hu-0.4.0/docs/operations/verify-chain.md +103 -0
  97. sia_hu-0.4.0/docs/reference/cli-flags.md +131 -0
  98. sia_hu-0.4.0/docs/reference/env-vars.md +63 -0
  99. sia_hu-0.4.0/docs/reference/file-layout.md +127 -0
  100. sia_hu-0.4.0/model_headroom/tests/__init__.py +0 -0
  101. sia_hu-0.4.0/model_headroom/tests/conftest.py +293 -0
  102. sia_hu-0.4.0/model_headroom/tests/test_adversarial_phase9.py +283 -0
  103. sia_hu-0.4.0/model_headroom/tests/test_cli.py +112 -0
  104. sia_hu-0.4.0/model_headroom/tests/test_cli_extra.py +614 -0
  105. sia_hu-0.4.0/model_headroom/tests/test_cli_provenance.py +286 -0
  106. sia_hu-0.4.0/model_headroom/tests/test_coverage_gaps.py +74 -0
  107. sia_hu-0.4.0/model_headroom/tests/test_cross_batch_contract.py +208 -0
  108. sia_hu-0.4.0/model_headroom/tests/test_d1_load_boundary.py +158 -0
  109. sia_hu-0.4.0/model_headroom/tests/test_dense_support.py +450 -0
  110. sia_hu-0.4.0/model_headroom/tests/test_device.py +243 -0
  111. sia_hu-0.4.0/model_headroom/tests/test_gguf_loader.py +347 -0
  112. sia_hu-0.4.0/model_headroom/tests/test_gguf_loader_extra.py +69 -0
  113. sia_hu-0.4.0/model_headroom/tests/test_gguf_loader_legacy.py +71 -0
  114. sia_hu-0.4.0/model_headroom/tests/test_human_report.py +39 -0
  115. sia_hu-0.4.0/model_headroom/tests/test_human_report_diagnostics.py +155 -0
  116. sia_hu-0.4.0/model_headroom/tests/test_human_report_extra.py +220 -0
  117. sia_hu-0.4.0/model_headroom/tests/test_integration_real_models.py +191 -0
  118. sia_hu-0.4.0/model_headroom/tests/test_json_report.py +43 -0
  119. sia_hu-0.4.0/model_headroom/tests/test_loader.py +134 -0
  120. sia_hu-0.4.0/model_headroom/tests/test_loader_extra.py +138 -0
  121. sia_hu-0.4.0/model_headroom/tests/test_loader_format_detection.py +46 -0
  122. sia_hu-0.4.0/model_headroom/tests/test_loader_provenance.py +184 -0
  123. sia_hu-0.4.0/model_headroom/tests/test_main.py +23 -0
  124. sia_hu-0.4.0/model_headroom/tests/test_module_family.py +212 -0
  125. sia_hu-0.4.0/model_headroom/tests/test_orchestrator.py +189 -0
  126. sia_hu-0.4.0/model_headroom/tests/test_orchestrator_errors.py +160 -0
  127. sia_hu-0.4.0/model_headroom/tests/test_orchestrator_extra.py +125 -0
  128. sia_hu-0.4.0/model_headroom/tests/test_provenance_coverage.py +426 -0
  129. sia_hu-0.4.0/model_headroom/tests/test_refusal_activations.py +459 -0
  130. sia_hu-0.4.0/model_headroom/tests/test_refusal_cli.py +468 -0
  131. sia_hu-0.4.0/model_headroom/tests/test_refusal_extract.py +426 -0
  132. sia_hu-0.4.0/model_headroom/tests/test_refusal_recover.py +203 -0
  133. sia_hu-0.4.0/model_headroom/tests/test_scoring.py +190 -0
  134. sia_hu-0.4.0/model_headroom/tests/test_scoring_coverage.py +353 -0
  135. sia_hu-0.4.0/model_headroom/tests/test_scoring_extra.py +293 -0
  136. sia_hu-0.4.0/model_headroom/tests/test_signal_correctness.py +239 -0
  137. sia_hu-0.4.0/model_headroom/tests/test_signals_dead_neurons.py +63 -0
  138. sia_hu-0.4.0/model_headroom/tests/test_signals_effective_rank.py +53 -0
  139. sia_hu-0.4.0/model_headroom/tests/test_signals_effective_rank_extra.py +27 -0
  140. sia_hu-0.4.0/model_headroom/tests/test_signals_grad_weight_ratio.py +104 -0
  141. sia_hu-0.4.0/model_headroom/tests/test_signals_growth_factor.py +92 -0
  142. sia_hu-0.4.0/model_headroom/tests/test_signals_growth_factor_extra.py +51 -0
  143. sia_hu-0.4.0/model_headroom/tests/test_signals_load_balance.py +172 -0
  144. sia_hu-0.4.0/model_headroom/tests/test_signals_load_balance_extra.py +27 -0
  145. sia_hu-0.4.0/model_headroom/tests/test_signals_loss_saturation.py +74 -0
  146. sia_hu-0.4.0/model_headroom/tests/test_signals_loss_saturation_extra.py +17 -0
  147. sia_hu-0.4.0/model_headroom/tests/test_signals_specialization.py +62 -0
  148. sia_hu-0.4.0/model_headroom/tests/test_signals_specialization_extra.py +38 -0
  149. sia_hu-0.4.0/model_headroom/tests/test_ternary_quants.py +180 -0
  150. sia_hu-0.4.0/model_headroom/tests/test_ternary_sampling.py +166 -0
  151. sia_hu-0.4.0/model_headroom/tests/test_types.py +140 -0
  152. sia_hu-0.4.0/pyproject.toml +103 -0
  153. sia_hu-0.4.0/scripts/fetch_refusal_prompts.py +103 -0
  154. sia_hu-0.4.0/src/capture_proxy/__init__.py +1 -0
  155. sia_hu-0.4.0/src/capture_proxy/__main__.py +1074 -0
  156. sia_hu-0.4.0/src/capture_proxy/alias.py +385 -0
  157. sia_hu-0.4.0/src/capture_proxy/app.py +2746 -0
  158. sia_hu-0.4.0/src/capture_proxy/blobs.py +185 -0
  159. sia_hu-0.4.0/src/capture_proxy/headroom.py +1438 -0
  160. sia_hu-0.4.0/src/capture_proxy/logger.py +430 -0
  161. sia_hu-0.4.0/src/capture_proxy/models.py +625 -0
  162. sia_hu-0.4.0/src/capture_proxy/names.py +149 -0
  163. sia_hu-0.4.0/src/capture_proxy/py.typed +0 -0
  164. sia_hu-0.4.0/src/capture_proxy/routing.py +432 -0
  165. sia_hu-0.4.0/src/capture_proxy/runtime.py +650 -0
  166. sia_hu-0.4.0/src/capture_proxy/schema.py +193 -0
  167. sia_hu-0.4.0/src/capture_proxy/session.py +156 -0
  168. sia_hu-0.4.0/src/capture_proxy/stream.py +544 -0
  169. sia_hu-0.4.0/src/capture_proxy/sync.py +560 -0
  170. sia_hu-0.4.0/src/capture_proxy/taskclass.py +559 -0
  171. sia_hu-0.4.0/src/capture_proxy/upstream.py +198 -0
  172. sia_hu-0.4.0/src/model_headroom/__init__.py +11 -0
  173. sia_hu-0.4.0/src/model_headroom/__main__.py +9 -0
  174. sia_hu-0.4.0/src/model_headroom/analysis/__init__.py +5 -0
  175. sia_hu-0.4.0/src/model_headroom/analysis/evidence_store.py +127 -0
  176. sia_hu-0.4.0/src/model_headroom/analysis/intervention_record.py +84 -0
  177. sia_hu-0.4.0/src/model_headroom/analysis/module_discovery.py +280 -0
  178. sia_hu-0.4.0/src/model_headroom/analysis/orchestrator.py +680 -0
  179. sia_hu-0.4.0/src/model_headroom/analysis/scoring.py +386 -0
  180. sia_hu-0.4.0/src/model_headroom/analysis/template_compat.py +121 -0
  181. sia_hu-0.4.0/src/model_headroom/analysis/training_feasibility.py +159 -0
  182. sia_hu-0.4.0/src/model_headroom/cli.py +643 -0
  183. sia_hu-0.4.0/src/model_headroom/device.py +49 -0
  184. sia_hu-0.4.0/src/model_headroom/download.py +369 -0
  185. sia_hu-0.4.0/src/model_headroom/models/__init__.py +5 -0
  186. sia_hu-0.4.0/src/model_headroom/models/gguf_loader.py +921 -0
  187. sia_hu-0.4.0/src/model_headroom/models/loader.py +999 -0
  188. sia_hu-0.4.0/src/model_headroom/models/ternary_quants.py +292 -0
  189. sia_hu-0.4.0/src/model_headroom/models/ternary_sampling.py +79 -0
  190. sia_hu-0.4.0/src/model_headroom/models/types.py +403 -0
  191. sia_hu-0.4.0/src/model_headroom/py.typed +0 -0
  192. sia_hu-0.4.0/src/model_headroom/refusal/__init__.py +10 -0
  193. sia_hu-0.4.0/src/model_headroom/refusal/activations.py +354 -0
  194. sia_hu-0.4.0/src/model_headroom/refusal/cli.py +524 -0
  195. sia_hu-0.4.0/src/model_headroom/refusal/extract.py +376 -0
  196. sia_hu-0.4.0/src/model_headroom/refusal/recover.py +210 -0
  197. sia_hu-0.4.0/src/model_headroom/refusal/report.py +153 -0
  198. sia_hu-0.4.0/src/model_headroom/reporting/__init__.py +5 -0
  199. sia_hu-0.4.0/src/model_headroom/reporting/human_report.py +347 -0
  200. sia_hu-0.4.0/src/model_headroom/reporting/json_report.py +78 -0
  201. sia_hu-0.4.0/src/model_headroom/signals/__init__.py +5 -0
  202. sia_hu-0.4.0/src/model_headroom/signals/dead_neurons.py +74 -0
  203. sia_hu-0.4.0/src/model_headroom/signals/effective_rank.py +163 -0
  204. sia_hu-0.4.0/src/model_headroom/signals/grad_weight_ratio.py +131 -0
  205. sia_hu-0.4.0/src/model_headroom/signals/gradient_coherence.py +173 -0
  206. sia_hu-0.4.0/src/model_headroom/signals/gradient_effective_rank.py +152 -0
  207. sia_hu-0.4.0/src/model_headroom/signals/growth_factor.py +181 -0
  208. sia_hu-0.4.0/src/model_headroom/signals/load_balance.py +166 -0
  209. sia_hu-0.4.0/src/model_headroom/signals/loss_saturation.py +108 -0
  210. sia_hu-0.4.0/src/model_headroom/signals/specialization.py +104 -0
  211. sia_hu-0.4.0/src/sia/__init__.py +1 -0
  212. sia_hu-0.4.0/src/sia/cli.py +109 -0
  213. sia_hu-0.4.0/src/sia/doctor.py +238 -0
  214. sia_hu-0.4.0/src/sia/publish.py +147 -0
  215. sia_hu-0.4.0/tests/conftest.py +72 -0
  216. sia_hu-0.4.0/tests/test_sia_doctor.py +195 -0
  217. sia_hu-0.4.0/tests/test_sia_publish.py +227 -0
  218. sia_hu-0.4.0/tests/test_sync.py +639 -0
  219. sia_hu-0.4.0/tests/test_sync_errors.py +329 -0
  220. sia_hu-0.4.0/tests/test_sync_rclone_argv.py +136 -0
  221. sia_hu-0.4.0/tests/test_ternary_bonsai_regression.py +127 -0
  222. sia_hu-0.4.0/tools/README.md +87 -0
  223. sia_hu-0.4.0/tools/emo_runner/__init__.py +0 -0
  224. sia_hu-0.4.0/tools/emo_runner/diff_probe.py +269 -0
  225. sia_hu-0.4.0/tools/emo_runner/health_probe.py +188 -0
  226. sia_hu-0.4.0/tools/emo_runner/moe_shard.py +312 -0
  227. sia_hu-0.4.0/tools/emo_runner/run_probe.py +161 -0
  228. sia_hu-0.4.0/tools/emo_runner/test_moe_shard.py +154 -0
  229. sia_hu-0.4.0/tools/engine_probe.py +684 -0
  230. sia_hu-0.4.0/uv.lock +2137 -0
@@ -0,0 +1,42 @@
1
+ # .codegraphinclude — ! means EXCLUDE (reverse of gitignore re-inclusion)
2
+ #
3
+ # Admits every sia-hu subsystem so the graph targets all source, tests,
4
+ # config, scripts, tools, and the dependency manifests they reference.
5
+ # Bare files are intentionally NOT listed: a bare positive file makes its
6
+ # parent (the project root) a scan root and silently widens ix coverage.
7
+ # See ../codegraph-ferrari/docs/INDEX_SCOPE.md.
8
+
9
+ # === SOURCE CODE ===
10
+ src/
11
+ capture-proxy/
12
+ model_headroom/
13
+ scripts/
14
+ tools/
15
+
16
+ # === EXCLUSIONS (apply within scan roots) ===
17
+ # Build/runtime artifacts
18
+ !__pycache__/**
19
+ !.venv/**
20
+ !.codegraph/**
21
+ !.ix/**
22
+ !node_modules/**
23
+ !target/**
24
+ !build/**
25
+ !dist/**
26
+
27
+ # Test caches
28
+ !.pytest_cache/**
29
+ !.mypy_cache/**
30
+ !.ruff_cache/**
31
+ !htmlcov/**
32
+
33
+ # Non-source text
34
+ !*.md
35
+ !*.log
36
+ !*.toml
37
+ !*.yaml
38
+ !*.yml
39
+
40
+ # VCS / editor
41
+ !.git/**
42
+ !.sniper/**
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, public-repo]
6
+ pull_request:
7
+ branches: [main, public-repo]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.12", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: astral-sh/setup-uv@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: Install dependencies
24
+ run: uv sync --extra dev --extra headroom --extra gguf
25
+ - name: Install rclone
26
+ run: |
27
+ curl https://rclone.org/install.sh | sudo bash
28
+ - name: Configure rclone gdrive remote
29
+ run: |
30
+ mkdir -p ~/.config/rclone
31
+ cat > ~/.config/rclone/rclone.conf << 'EOF'
32
+ [gdrive]
33
+ type = local
34
+ root = /tmp/rclone-gdrive-dummy
35
+ EOF
36
+ - name: Lint
37
+ run: uv run ruff check .
38
+ - name: Format check
39
+ run: uv run ruff format --check .
40
+ - name: Type check
41
+ run: uv run mypy src/
42
+ - name: Tests
43
+ run: uv run pytest -q
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment:
11
+ name: pypi
12
+ url: https://pypi.org/p/sia-hu
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ - name: Build
20
+ run: uv build
21
+ - name: Check distribution
22
+ run: uv run --with twine twine check dist/*
23
+ - name: Inspect wheel contents
24
+ run: |
25
+ uv run python -c "
26
+ import glob, zipfile
27
+ whl = glob.glob('dist/*.whl')[0]
28
+ with zipfile.ZipFile(whl) as z:
29
+ for name in z.namelist():
30
+ print(name)
31
+ "
32
+ - name: Publish
33
+ run: uv publish
@@ -0,0 +1,78 @@
1
+ # === Python ===
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.egg-info/
6
+ *.so
7
+ *.egg
8
+ dist/
9
+ build/
10
+
11
+ # === Virtual environments ===
12
+ .venv/
13
+ venv/
14
+ ENV/
15
+ .env
16
+ .env.*
17
+
18
+ # === Tooling caches ===
19
+ .pytest_cache/
20
+ .mypy_cache/
21
+ .ruff_cache/
22
+ .coverage
23
+ htmlcov/
24
+ .uv-cache/
25
+
26
+ # === IDE / OS ===
27
+ .idea/
28
+ .vscode/
29
+ *.swp
30
+ *.swo
31
+ .DS_Store
32
+ Thumbs.db
33
+
34
+ # === Secrets ===
35
+ *.pem
36
+ *.key
37
+
38
+ # === Tool artifacts (repo-wide) ===
39
+ .ix/
40
+ .imodent/
41
+ .sniper/
42
+ .githooks/
43
+
44
+ # === CodeGraph (dev-only) ===
45
+ .codegraph/
46
+ .codegraph/codegraph.db
47
+ .codegraph/codegraph.db-shm
48
+ .codegraph/codegraph.db-wal
49
+ /reasoning.db
50
+ .codegraph/cache/
51
+ .codegraph/community_cache.json
52
+ .codegraph/ct_cache.db
53
+ .codegraph/ct_cache.db-shm
54
+ .codegraph/ct_cache.db-wal
55
+ .codegraph/ct_scan.lock
56
+ .codegraph/knowledge.sled/
57
+ .codegraph/neighborhoods.json
58
+ .codegraph/neighborhoods.json.meta.json
59
+ .codegraph/.lock*
60
+ .codegraph/repo_registry.json
61
+ .codegraph/semantic_summaries.json
62
+ .codegraph/sled_cache.json
63
+ .codegraph/sled_patterns.json
64
+ .codegraph/sled_patterns.json.meta.json
65
+
66
+ # === Agentic artifacts (alpha — not published) ===
67
+ AGENTS.md
68
+ .annotations/
69
+ .maat/
70
+ .maintenance/
71
+ thoughts.jsonl
72
+ .mcp.json
73
+ .opencode/
74
+ .opencode/agents/*.md
75
+ failed_reason.txt
76
+
77
+ # === Logs ===
78
+ *.log
sia_hu-0.4.0/.ixd.toml ADDED
@@ -0,0 +1,38 @@
1
+ # .ixd.toml — ix daemon / CLI index scope for sia-hu (unified)
2
+ #
3
+ # Canonical flat schema (ix >= 0.14). Coarse scoping only; admission is governed
4
+ # by .codegraphinclude. See ../codegraph-ferrari/docs/INDEX_SCOPE.md.
5
+ #
6
+ # watch_roots lists directories to index (relative to this file's directory);
7
+ # ix discovers the root plus one level deep via Path::starts_with. Roots must
8
+ # stay congruent with the positive roots in .codegraphinclude so the ix search
9
+ # surface never diverges from what codegraph admits.
10
+
11
+ watch_roots = [
12
+ "src",
13
+ "capture-proxy",
14
+ "model_headroom",
15
+ "scripts",
16
+ "tools",
17
+ ]
18
+
19
+ # DIRECTORY NAMES, exact match — not globs, no trailing slashes.
20
+ # lost+found / .git / .ix / .codegraph are hardcoded in ix and need not be
21
+ # listed here. Every other default relied upon must be explicit because an
22
+ # existing file yields an empty list via #[serde(default)].
23
+ exclude_patterns = [
24
+ "__pycache__",
25
+ ".venv",
26
+ ".codegraph",
27
+ ".ix",
28
+ "node_modules",
29
+ "target",
30
+ "build",
31
+ "dist",
32
+ ".pytest_cache",
33
+ ".mypy_cache",
34
+ ".ruff_cache",
35
+ "htmlcov",
36
+ ]
37
+
38
+ debounce_ms = 500
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.0] - 2026-11-10
11
+
12
+ ### Added
13
+ - `capture-proxy --sync` (one-shot), `--sync-daemon`, `--sync-stop`, `--sync-status` — native off-box capture sync via rclone subprocess; no new runtime Python dependency (pure stdlib), no restored shell scripts. New optional `env` extra (`wrapt>=1.16`) for Kaggle self-healing; not in `[project].dependencies`. Settings flags: `--sync-remote`, `--sync-cmd` (default `copy`), `--sync-min-age` (default `60s`), `--sync-interval` (default `300`), `--sync-dry-run`, `--sync-rclone-opts`, `--sync-rclone-binary`, `--sync-machine-id`, `--sync-pid-file`, `--sync-log-file`.
14
+ - `sia doctor` — read-only workspace preflight; every failure names its fix command; exit 0/1/2 (2 on flag errors).
15
+ - `sia publish` — push current branch and verify the remote ref matches local HEAD; never auto-commits; `--dry-run` / `--allow-dirty`; credential URLs redacted in output.
16
+
17
+ ### Changed
18
+ - Version bumped `0.3.0` → `0.4.0` (`pyproject.toml`).
19
+ - `pytest testpaths` extended to include root `tests/`; `sia` added to coverage `source`.
20
+
21
+ ### Removed
22
+ - `rclone-sync-captures.sh`, `bootstrap-capture.sh`, `bootstrap.sh` shell scripts — replaced by native `capture-proxy --sync*` flags and `sia doctor`/`sia publish` verbs.
23
+
24
+ ## [0.3.0] - 2026-11-10
25
+
26
+ ### Added
27
+ - `--device {auto,cuda,cpu}` on `model-headroom` (default `auto`): accelerator-preferred device selection (cuda → xpu → mps → cpu), resolving through new `src/model_headroom/device.py`. `auto` picks the first available accelerator else CPU; `--device cuda` on a box with no CUDA exits 1 with an informative error, never silently downgrades. The resolved device is recorded in `report.metadata["device"]`.
28
+ - New public module `src/model_headroom/device.py` (`available_accelerators()`, `default_device()`, `resolve_device(requested) -> str | None`) — the single source of truth for device selection, threaded into `run_analysis(..., device=...)` and into the GGUF weight-sampling path.
29
+ - New `tools/engine_probe.py` capability probe: workspace shim importing neither package and no torch; `probe_engines()` returns a JSON manifest of installed/running serving engines with capability set (`chat_completions`, `embeddings`, `rerank`, `routed_experts`, `hidden_states`), measured hardware, and hard limits. Never raises, never starts/stops a server, never binds a port; identifies an engine by its own `/v1/models` metadata.
30
+ - New `env` optional-dependency extra (`wrapt>=1.16`): self-healing on Kaggle-class hosts whose system `sitecustomize.py` imports `wrapt`. Deliberately NOT in `[project].dependencies` — sia-hu never imports wrapt, and a published wheel must not ship a bogus runtime dependency.
31
+ - New "Engine Selection Policy" section separating HARD constraints (routed_experts and hidden-state capture require SGLang; measurement signals cannot be served and need in-process forward passes) from PREFERENCES (llama.cpp for GGUF/low-VRAM/FastMTP, vLLM for dense throughput and `/v1/rerank`).
32
+
33
+ ### Changed
34
+ - NFR-01 rewritten: previously mandated CPU-only weight loading; now mandates accelerator-preferred with CPU fallback. The 21 frozen dataclasses were not touched.
35
+ - `model-headroom-refusal --device` default changed from `cpu` to `auto`: an unflagged refusal run now selects the first available accelerator (cuda → xpu → mps → cpu) instead of silently capturing on CPU; `--device cuda` on a box with no CUDA exits 1, `--device cpu` stays on CPU. `src/model_headroom/refusal/cli.py:158-163`.
36
+ - `recover_direction_from_weight_deltas(deltas, spec, device="cpu")` now runs `torch.linalg.svd` on the resolved device and returns the direction on CPU so the serialized report stays device-independent. `src/model_headroom/refusal/recover.py:34-38,103-119,149`; wired at `src/model_headroom/refusal/cli.py:417`.
37
+ - The SVD failure message now names the device and suggests `--device cpu`: `SVD failed on device {device}: {exc}; retry with --device cpu`. `src/model_headroom/refusal/recover.py:128`.
38
+
39
+ ### Fixed
40
+ - Loader error output now reports the specific cause (file does not exist / JSON malformed / missing required keys with the found keys / tensor is 3-D but must be 2-D / empty-but-valid), the offending path, the flag to use, the expected JSON shape, and where a valid example lives — instead of discarding the cause. New `LoadOutcome` + `*_diagnostic` loader functions in `src/model_headroom/models/loader.py`; existing loaders keep their documented `None`-returning contracts.
41
+
42
+ ## [0.2.0] - 2026-11-06
43
+
44
+ ### Added
45
+ - Unified `sia` CLI dispatcher aliasing `capture-proxy`, `model-headroom`, and `model-headroom-refusal`.
46
+ - Unified single project layout (`src/`, one `pyproject.toml`, one `uv.lock`).
47
+ - MIT license.
48
+ - CI workflows for testing and PyPI publishing.
49
+
50
+ ### Changed
51
+ - Raised `requires-python` to `>=3.12` (numpy 2.5.4 requirement).
52
+ - Bumped all dependencies to latest PyPI versions.
53
+ - Ruff target version `py310` → `py312`.
54
+
55
+ ### Fixed
56
+ - Removed engineering-process artifacts from published tree (AGENTS.md, agent definitions, tickets, session artifacts, dev tooling configs).
sia_hu-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Moe Shawky
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.
sia_hu-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.5
2
+ Name: sia-hu
3
+ Version: 0.4.0
4
+ Summary: Unified headroom measurement: capture-proxy carrier + model_headroom scoring authority
5
+ Project-URL: Homepage, https://github.com/moeshawky/sia-hu
6
+ Project-URL: Repository, https://github.com/moeshawky/sia-hu
7
+ Project-URL: Issues, https://github.com/moeshawky/sia-hu/issues
8
+ Author: Moe Shawky
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: fastapi>=0.162
13
+ Requires-Dist: httpx>=0.28.1
14
+ Requires-Dist: pydantic>=2.14.3
15
+ Requires-Dist: uvicorn>=0.54
16
+ Provides-Extra: dev
17
+ Requires-Dist: mypy>=2.4.1; extra == 'dev'
18
+ Requires-Dist: pre-commit>=4.7; extra == 'dev'
19
+ Requires-Dist: pytest-asyncio>=1.4.1.post1; extra == 'dev'
20
+ Requires-Dist: pytest-cov>=7.1; extra == 'dev'
21
+ Requires-Dist: pytest>=9.2; extra == 'dev'
22
+ Requires-Dist: ruff>=0.17.4; extra == 'dev'
23
+ Provides-Extra: env
24
+ Requires-Dist: wrapt>=1.16; extra == 'env'
25
+ Provides-Extra: gguf
26
+ Requires-Dist: gguf>=0.19; extra == 'gguf'
27
+ Provides-Extra: headroom
28
+ Requires-Dist: accelerate>=1.15; extra == 'headroom'
29
+ Requires-Dist: huggingface-hub>=2.4; extra == 'headroom'
30
+ Requires-Dist: numpy>=2.5.4; extra == 'headroom'
31
+ Requires-Dist: safetensors>=0.8.0; extra == 'headroom'
32
+ Requires-Dist: torch>=2.15; extra == 'headroom'
33
+ Requires-Dist: transformers>=5.22.1; extra == 'headroom'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # sia-hu — Sia + Hu
37
+
38
+ **Sia** (sỉꜣ): divine perception, deep insight, interior knowledge — perceiving what
39
+ is hidden inside a closed form BEFORE it is spoken (the pre-verbal activation state,
40
+ latent internal representation). **Hu** (ḥw): the uttered word, spoken output, token
41
+ generation.
42
+
43
+ A logit lens that reads Sia before it becomes Hu is a 1-to-1 conceptual match:
44
+
45
+ | Egyptian concept | sia-hu role | Repository | What it does |
46
+ |------------------|-------------|------------|--------------|
47
+ | **Sia** — hidden perception | AUTHORITY — scores | `model_headroom/` | Reads model weights (the hidden form) and computes a headroom score in [0.0, 1.0]. Nine signals inspect latent structure: weight spectra, activation balance, expert routing, gradient ratios. |
48
+ | **Hu** — uttered word | CARRIER — emits | `capture-proxy/` | Runs an OpenAI-compatible proxy that logs every request/response before forwarding. Emitted JSONL records, sidecar `headroom.json`, and `weight_pairs.json` are the uttered output — token generation made observable. |
49
+ | The bridge | CLI | `sia` | `sia <subcommand>` forwards to the corresponding existing CLI. Neither scores nor emits itself — it bridges Sia and Hu. |
50
+
51
+ **Contract (never inverted):**
52
+ - Authority scores (`model_headroom`); carrier never scores (`capture-proxy`).
53
+ - Proxy never scores; authority never proxies.
54
+ - Proxy → authority: emits `{capture_id}.headroom.json` +
55
+ `{capture_id}-weight_pairs.json` in the loader format the authority consumes.
56
+ - Authority → proxy: defines the 2-D pair contract and signal semantics; the proxy
57
+ never invents a signal meaning.
58
+ - Agreement between the authority and carrier implementations is the cross-check — one
59
+ voice is an echo.
60
+
61
+ See `docs/architecture/sia-hu-identity.md` for the full cosmology, and
62
+ `docs/index.md` for the unified documentation tree.
63
+
64
+ ---
65
+
66
+ ## One project, two packages
67
+
68
+ | Package | Role | Rule |
69
+ |---------|------|------|
70
+ | `src/model_headroom/` | **Authority** — scores training headroom (reads Sia) | Never proxies |
71
+ | `src/capture_proxy/` | **Carrier** — emits sidecar capture (emits Hu) | Never scores |
72
+
73
+ Both are **tracked packages inside this single repo** — not submodules, not gitignored, not separate remotes. One clone carries the whole workspace: single `pyproject.toml`, single `uv.lock`, single ruff/mypy/pytest config, installed editable from the repo root, exposing `capture-proxy`, `model-headroom`, `model-headroom-refusal`, and `sia`.
74
+
75
+ `model_headroom` is the sole scoring authority; `capture-proxy` emits artifacts in the format the authority consumes. Agreement between the two is the cross-check.
76
+
77
+ ---
78
+
79
+ ## The unified `sia` CLI
80
+
81
+ `sia <subcommand> <args>` forwards to the corresponding existing CLI's `main()`:
82
+
83
+ | `sia` subcommand | Forwards to | Role |
84
+ |------------------|-------------|------|
85
+ | `sia capture-proxy` | `capture-proxy` | Carrier — emits Hu |
86
+ | `sia model-headroom` | `model-headroom` | Authority — scores Sia |
87
+ | `sia model-headroom-refusal` | `model-headroom-refusal` | Refusal analysis |
88
+
89
+ Each `main()` returns an `int` and only calls `sys.exit()` inside its
90
+ `if __name__ == "__main__"` guard. Exit codes propagate. `sia` adds no flags,
91
+ no behavior, no new subcommands beyond the three it aliases.
92
+
93
+ See `docs/guides/sia-cli.md` and `docs/reference/cli-flags.md`.
94
+
95
+ ---
96
+
97
+ ## Quick start
98
+
99
+ ```bash
100
+ pip install -e . # carrier package only
101
+ pip install -e ".[headroom]" # + torch / numpy / safetensors (scoring)
102
+ pip install -e ".[dev]" # + pytest / mypy / ruff
103
+ ```
104
+
105
+ Verify: `ruff check . && ruff format --check . && mypy src/ && pytest`
106
+
107
+ Full install, bootstrap, and verification steps: `docs/guides/quickstart.md`.
108
+ Verify chain details: `docs/operations/verify-chain.md`.
109
+
110
+ ---
111
+
112
+ ## Repository layout
113
+
114
+ ```
115
+ sia-hu/
116
+ README.md → this file
117
+ AGENTS.md → agent/operator gate (gitignored, on disk)
118
+ PROJECT-ROADMAP.md → unified `sia` CLI plan, phases 1-2
119
+ pyproject.toml → single project (sia-hu); one lockfile
120
+ src/ → source packages (capture_proxy, model_headroom, sia)
121
+ capture-proxy/ → carrier tests, config, scripts (docs moved to docs/)
122
+ model_headroom/ → authority tests (docs moved to docs/)
123
+ docs/ → unified documentation tree
124
+ tools/ → repo tools
125
+ ```
126
+
127
+ ## Documentation
128
+
129
+ Unified docs live in `docs/` at the repo root. Start with
130
+ [`docs/index.md`](docs/index.md).
131
+
132
+ | Section | Purpose |
133
+ |---------|---------|
134
+ | `docs/architecture/` | Sia/Hu identity, authority/carrier division, bidirectional contract |
135
+ | `docs/concepts/` | Headroom signals (R-01–R-09), provenance, frozen contracts |
136
+ | `docs/guides/` | Quickstart, `sia` CLI, carrier guide, authority guide |
137
+ | `docs/operations/` | Verify chain, dev commands, environment |
138
+ | `docs/reference/` | CLI flags, env vars, file layout |
139
+ | `docs/capture-proxy/` | Carrier README, roadmap, design notes (moved from `capture-proxy/`) |
140
+ | `docs/model-headroom/` | Authority README, roadmap, test protocol (moved from `model_headroom/`) |
141
+
142
+ Authority and carrier roadmaps, test protocol, and package READMEs now live
143
+ under `docs/` (see `docs/reference/file-layout.md`).
144
+
145
+ Key docs:
146
+ - `docs/architecture/sia-hu-identity.md` — cosmology in detail
147
+ - `docs/architecture/authority-carrier.md` — who scores, who emits
148
+ - `docs/architecture/contract.md` — bidirectional contract, 2-D pair contract
149
+ - `docs/concepts/headroom-signals.md` — R-01 through R-09 signal reference
150
+ - `docs/guides/quickstart.md` — install, bootstrap, verify
151
+ - `docs/guides/capture-proxy.md` — carrier usage
152
+ - `docs/guides/model-headroom.md` — authority usage
153
+ - `docs/operations/verify-chain.md` — ruff → format → mypy → pytest
154
+ - `docs/reference/cli-flags.md` — all CLI flags
155
+ - `docs/reference/env-vars.md` — all env vars
156
+
157
+ ---
158
+
159
+ ## License
160
+
161
+ MIT — see [`LICENSE`](LICENSE).
@@ -0,0 +1,85 @@
1
+ # PROJECT-ROADMAP.md — sia-hu unified CLI
2
+
3
+ ## Intent Statement
4
+
5
+ Provide one operator surface, `sia`, over the three package CLIs — `capture-proxy`, `model-headroom`, and `model-headroom-refusal` — and over the workspace operations that were previously carried by shell scripts.
6
+
7
+ The aliasing contract is unchanged: `sia <subcommand> <args>` forwards to the matching existing CLI's `main()` and propagates its exit code. Two deliberate expansions are authorized by the operator (2026-11-10), because the shell scripts that carried these capabilities were removed on purpose and must not be restored:
8
+
9
+ - **`capture-proxy --sync`** — native off-box capture sync, replacing `rclone-sync-captures.sh` and the sync step of `bootstrap-capture.sh`. Every other capability of `bootstrap-capture.sh` already exists as a native flag (`--ensure-config`, `--daemon`, `--status`, `--stop`, `--print-effective-config`).
10
+ - **`sia doctor` and verified publish** — native workspace preflight and push verification, replacing `bootstrap.sh`. The load-bearing capability there is refusing to trust `git push` exit 0: the remote ref is compared to local HEAD.
11
+
12
+ `capture-proxy` is therefore no longer byte-for-byte unchanged. That is a recorded decision, not drift: the removed scripts are the specification, and the native flags are their replacement.
13
+
14
+ ## Current State (Verified from codebase survey)
15
+
16
+ - **Single root project**: `sia-hu` 0.3.0, one `pyproject.toml`, one `uv.lock`, one ruff/mypy/pytest config at the repo root
17
+ - **Three console scripts** already defined in `[project.scripts]`:
18
+ - `capture-proxy = "capture_proxy.__main__:main"`
19
+ - `model-headroom = "model_headroom.cli:main"`
20
+ - `model-headroom-refusal = "model_headroom.refusal.cli:main"`
21
+ - **Each `main()`** returns an `int` and only calls `sys.exit()` inside its `if __name__ == "__main__"` guard — safe to import and call directly from a new dispatcher
22
+ - **Packages live under `src/`**: `src/capture_proxy/`, `src/model_headroom/`, `src/sia/`
23
+ - **The `sia` dispatcher exists** (Phase 1) and currently adds no verbs of its own
24
+ - **Verify chain**: `ruff check . && ruff format --check . && mypy src/ && pytest` (run from repo root)
25
+
26
+ ## Gap
27
+
28
+ Measured 2026-11-10 against `master-archive` (the branch that still holds the scripts) and against the current `src/` tree:
29
+
30
+ - `bootstrap-capture.sh` (115 lines): its config, daemon, status, and effective-config steps are native; its sync step is not.
31
+ - `rclone-sync-captures.sh` (191 lines): **no native equivalent anywhere in `src/`**. `rg rclone` hits only `AGENTS.md`.
32
+ - `bootstrap.sh` (330 lines): **no native equivalent**. Its unique load-bearing piece is push verification.
33
+ - `sia` has **no tests**: `testpaths` covers only `capture-proxy/tests` and `model_headroom/tests`, and no test file references `sia`.
34
+
35
+ ## Planned Phases
36
+
37
+ ### Phase 1: Add `sia` CLI package (COMPLETE)
38
+ - **Goal**: Create `src/sia/` package with `cli.py` that uses argparse subparsers to dispatch `capture-proxy`, `model-headroom`, `model-headroom-refusal` to the existing `main()` functions
39
+ - **Success criterion**: `sia capture-proxy --help`, `sia model-headroom --help`, `sia model-headroom-refusal --help` each show the corresponding subcommand's help; `sia --help` lists all three subcommands; exit codes propagate
40
+ - **Scope**: New files only — `src/sia/__init__.py`, `src/sia/cli.py`. Edit `pyproject.toml` to add `sia` console script and `src/sia` to wheel packages. Zero changes to `src/capture_proxy/` or `src/model_headroom/`.
41
+
42
+ ### Phase 2: Verify (COMPLETE)
43
+ - **Goal**: Run the full verify chain and confirm both package test suites still pass
44
+ - **Success criterion**: `ruff check . && ruff format --check . && mypy src/ && pytest` all exit 0; existing `capture-proxy`, `model-headroom`, `model-headroom-refusal` console scripts still work unchanged
45
+
46
+ ### Phase 3: Native `capture-proxy --sync` (AUTHORIZED — not started)
47
+ - **Goal**: Replace `rclone-sync-captures.sh` with a native sync mode, so off-box capture sync is a property of the installed binary rather than of a shell file that no longer exists
48
+ - **Success criterion**: one-shot sync and daemon loop both work against an rclone remote; re-running the daemon start is idempotent; a missing rclone produces an instructive error naming the flag, the expected value, and a valid example
49
+ - **Constraints**: `copy` is the default; `sync` (destructive mirror) is refused unless the instance id is explicit; instance keying preserves `CAPTURE_MACHINE_ID` > hostname > `/etc/machine-id`; `--min-age` skips files still being written; sync never touches the response path; no new Python dependency
50
+ - **Scope**: new `src/capture_proxy/sync.py`, `__main__.py` wiring, `_CONFIG_KEYS` additions, tests under `capture-proxy/tests/`
51
+
52
+ ### Phase 4: `sia doctor` + verified publish (AUTHORIZED — not started)
53
+ - **Goal**: Replace `bootstrap.sh` with native workspace verbs: a read-only preflight, and a publish that refuses to trust `git push` exit 0
54
+ - **Success criterion**: `sia doctor` changes nothing and reports every failed check with the command that fixes it; `sia publish` pushes the current branch and fails loudly when the remote ref does not match local HEAD
55
+ - **Constraints**: doctor is read-only; publish never auto-commits; a dirty tree is refused unless explicitly overridden; credential-bearing URLs are redacted in every message; `sia` keeps lazy imports so `sia --help` pulls no heavy dependency
56
+ - **Scope**: `src/sia/` native verbs, tests (new `tests/` path or an explicit `testpaths` addition), docs
57
+
58
+ ## Scope-Creep Defenses
59
+
60
+ - IN scope (authorized 2026-11-10): `capture-proxy --sync`; `sia doctor`; `sia` verified publish; the tests and docs that cover them
61
+ - OUT of scope: restoring any removed shell script; changing the existing behavior of the three aliased CLIs; adding scoring to the carrier; any sync backend other than rclone; auto-commit in publish
62
+ - The earlier "no new flags, no new subcommands" rule is **superseded only for the two items above**. Any further expansion needs a new explicit operator request recorded in this file first
63
+
64
+ ## Controlled-Evolution Path
65
+
66
+ - `sia` remains an aliasing layer for the three package CLIs, plus the two native workspace verbs recorded in Phase 4
67
+ - `capture-proxy` gains `--sync` only; no other behavior changes
68
+ - A new subcommand or flag requires an explicit operator request recorded in this file before implementation
69
+
70
+ ## Fringe Modules (working, not tested in core verify chain)
71
+
72
+ - `model-headroom-refusal` (refusal-direction extraction) is implemented and smoke-tested
73
+ (Qwen3-0.6b: direction_status=computed, cohen_d=4.36, layer model.layers.16).
74
+ It is a fringe module: not part of the core verify chain, not client-perspective tested,
75
+ and parked while higher-priority work (release hygiene, carrier/authority contract) proceeds.
76
+ Revisit only on explicit operator request.
77
+
78
+ ## Drift Checkpoints
79
+
80
+ - After implementation: re-read intent — confirm no removed shell script was restored, and no scoring entered the carrier
81
+ - Before delivery: confirm all three existing console scripts still work unchanged for their existing flags
82
+ - Verify chain must pass in order: ruff → format → mypy → pytest
83
+
84
+ ---
85
+ *Living document — update at each phase transition.*