snapdec 0.2.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 (65) hide show
  1. snapdec-0.2.0/.github/workflows/ci.yml +20 -0
  2. snapdec-0.2.0/.github/workflows/publish.yml +24 -0
  3. snapdec-0.2.0/.gitignore +10 -0
  4. snapdec-0.2.0/AGENTS.md +18 -0
  5. snapdec-0.2.0/CHANGELOG.md +38 -0
  6. snapdec-0.2.0/LICENSE +202 -0
  7. snapdec-0.2.0/PKG-INFO +181 -0
  8. snapdec-0.2.0/README.md +142 -0
  9. snapdec-0.2.0/SYSONE_ARCHITECTURE.md +818 -0
  10. snapdec-0.2.0/docs/adr/0001-shim-daemon-split.md +19 -0
  11. snapdec-0.2.0/docs/adr/0002-decision-tiers.md +19 -0
  12. snapdec-0.2.0/docs/adr/0004-ipc-transport.md +20 -0
  13. snapdec-0.2.0/docs/adr/0006-api-key-storage.md +19 -0
  14. snapdec-0.2.0/docs/adr/0007-rename-snapdec.md +30 -0
  15. snapdec-0.2.0/docs/spikes/S4-mcp-v2-skeleton.md +33 -0
  16. snapdec-0.2.0/pyproject.toml +69 -0
  17. snapdec-0.2.0/src/snapdec/_brand.py +8 -0
  18. snapdec-0.2.0/src/snapdec/backends/__init__.py +5 -0
  19. snapdec-0.2.0/src/snapdec/backends/base.py +31 -0
  20. snapdec-0.2.0/src/snapdec/backends/keydetect.py +67 -0
  21. snapdec-0.2.0/src/snapdec/backends/mock.py +72 -0
  22. snapdec-0.2.0/src/snapdec/backends/remote_systemone.py +79 -0
  23. snapdec-0.2.0/src/snapdec/cli/__init__.py +3 -0
  24. snapdec-0.2.0/src/snapdec/cli/__main__.py +3 -0
  25. snapdec-0.2.0/src/snapdec/cli/main.py +756 -0
  26. snapdec-0.2.0/src/snapdec/config.py +119 -0
  27. snapdec-0.2.0/src/snapdec/decisions/__init__.py +14 -0
  28. snapdec-0.2.0/src/snapdec/decisions/envelope.py +98 -0
  29. snapdec-0.2.0/src/snapdec/decisions/policy.py +51 -0
  30. snapdec-0.2.0/src/snapdec/decisions/tier0/__init__.py +3 -0
  31. snapdec-0.2.0/src/snapdec/decisions/tier0/project_facts.py +216 -0
  32. snapdec-0.2.0/src/snapdec/hardware/__init__.py +4 -0
  33. snapdec-0.2.0/src/snapdec/hardware/catalog.py +91 -0
  34. snapdec-0.2.0/src/snapdec/hardware/detect.py +181 -0
  35. snapdec-0.2.0/src/snapdec/hardware/profile.py +62 -0
  36. snapdec-0.2.0/src/snapdec/integrations/__init__.py +4 -0
  37. snapdec-0.2.0/src/snapdec/integrations/agents_json.py +162 -0
  38. snapdec-0.2.0/src/snapdec/integrations/base.py +181 -0
  39. snapdec-0.2.0/src/snapdec/integrations/claude_code.py +142 -0
  40. snapdec-0.2.0/src/snapdec/integrations/codex.py +126 -0
  41. snapdec-0.2.0/src/snapdec/integrations/json_family.py +126 -0
  42. snapdec-0.2.0/src/snapdec/integrations/patchers.py +137 -0
  43. snapdec-0.2.0/src/snapdec/integrations/registry.py +29 -0
  44. snapdec-0.2.0/src/snapdec/mcp/__init__.py +3 -0
  45. snapdec-0.2.0/src/snapdec/mcp/server.py +218 -0
  46. snapdec-0.2.0/src/snapdec/runtime/__init__.py +8 -0
  47. snapdec-0.2.0/src/snapdec/runtime/daemon.py +200 -0
  48. snapdec-0.2.0/src/snapdec/runtime/ipc.py +148 -0
  49. snapdec-0.2.0/src/snapdec/runtime/lifecycle.py +138 -0
  50. snapdec-0.2.0/src/snapdec/runtime/probe.py +69 -0
  51. snapdec-0.2.0/src/snapdec/runtime/provision.py +232 -0
  52. snapdec-0.2.0/src/snapdec/skills/snapdec/SKILL.md +19 -0
  53. snapdec-0.2.0/src/snapdec/skills/snapdec/references/recipes.md +21 -0
  54. snapdec-0.2.0/src/snapdec/skills/snapdec/references/tools.md +26 -0
  55. snapdec-0.2.0/tests/conftest.py +24 -0
  56. snapdec-0.2.0/tests/contract/test_mcp_server.py +84 -0
  57. snapdec-0.2.0/tests/unit/test_catalog.py +40 -0
  58. snapdec-0.2.0/tests/unit/test_integrations.py +79 -0
  59. snapdec-0.2.0/tests/unit/test_keydetect.py +34 -0
  60. snapdec-0.2.0/tests/unit/test_patchers.py +93 -0
  61. snapdec-0.2.0/tests/unit/test_policy.py +60 -0
  62. snapdec-0.2.0/tests/unit/test_probe.py +62 -0
  63. snapdec-0.2.0/tests/unit/test_profile.py +43 -0
  64. snapdec-0.2.0/tests/unit/test_project_facts.py +56 -0
  65. snapdec-0.2.0/uv.lock +1714 -0
@@ -0,0 +1,20 @@
1
+ name: ci
2
+ on:
3
+ push: { branches: [main] }
4
+ pull_request:
5
+
6
+ jobs:
7
+ test:
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ os: [ubuntu-latest, windows-latest, macos-latest]
12
+ python: ["3.10", "3.12", "3.13"]
13
+ runs-on: ${{ matrix.os }}
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v5
17
+ with: { python-version: "${{ matrix.python }}" }
18
+ - run: uv venv && uv pip install -e ".[dev]"
19
+ - run: uv run ruff check src tests
20
+ - run: uv run pytest -q
@@ -0,0 +1,24 @@
1
+ name: publish
2
+ on:
3
+ release:
4
+ types: [published]
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ pypi:
9
+ runs-on: ubuntu-24.04
10
+ environment: pypi # requires PyPI trusted-publisher setup (repo Settings → Environments)
11
+ permissions:
12
+ id-token: write # OIDC for PyPI Trusted Publishing
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v5
16
+ with:
17
+ python-version: "3.12"
18
+ enable-cache: false
19
+ - run: uv pip install -e ".[dev]" # setup-uv provides the venv
20
+ - run: uv run ruff check src tests
21
+ - run: uv run pytest -q
22
+ - run: uv build
23
+ - name: Publish to PyPI (Trusted Publishing)
24
+ run: uv publish
@@ -0,0 +1,10 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .state/
10
+ *.bak-*
@@ -0,0 +1,18 @@
1
+ # AGENTS.md — conventions for contributing coding agents
2
+
3
+ Read SYSONE_ARCHITECTURE.md §0 first; it overrides your defaults.
4
+
5
+ - Run tests: `uv run pytest` (or `.venv/Scripts/python -m pytest`). All green before done.
6
+ - **Never touch a real HOME** in tests/CI: every test runs under a temp
7
+ `SNAPDEC_HOME` + `HOME` (see `tests/conftest.py::tmp_home`). The only code
8
+ allowed to touch real user configs is `integrations/`, executed via
9
+ `snapdec init` / `snapdec agents add` with user consent.
10
+ - No stdout writes in `src/snapdec/mcp/` — stdout is MCP protocol only.
11
+ - Pin everything; never write "latest" into a manifest (§0.3).
12
+ - Every non-obvious decision gets an ADR in `docs/adr/NNNN-title.md`.
13
+ - Claims ("fast", "saves tokens") must come from `snapdec bench` output
14
+ committed under `docs/benchmarks/` — not adjectives.
15
+ - Errors in Tier-1 paths fail closed: envelope with `decision:"review"`,
16
+ never an exception toward the host agent (NFR-4).
17
+ - Match existing code style: stdlib-first, small deps, type hints, docstrings
18
+ that cite the architecture doc section they implement.
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [0.2.0] — 2026-10-03
7
+
8
+ ### Added
9
+ - First-run wizard with hardware-gated model catalog and honest stats
10
+ (Decision Index / OOD accuracy / latency / setup size); only options the
11
+ machine can actually run are listed; Kev-4B requires 12 GB VRAM, Kev-0.8B
12
+ flagged `slow on CPU` without a CUDA GPU.
13
+ - Managed local provisioning, fully automatic after choice: runtime venv,
14
+ install, weight download, server launch (127.0.0.1 only). Supports Laya
15
+ (`laya[serve]`, PyPI) and Kev (pinned git tarball — not on PyPI).
16
+ - Hosted path: paste any key — provider auto-detected from key format;
17
+ OpenAI/Groq/Anthropic keys get a clear incompatibility hint instead of a
18
+ silent misroute; model auto-picked free-variant-first with paid fallback.
19
+ - Agent registration resolves the absolute command (fixes bare-`snapdec`
20
+ entries that failed when the venv wasn't on PATH); Claude Code entries are
21
+ refreshed idempotently on re-init.
22
+ - Fan-out for classify/score/rank: one request per item, parallel (§4.6) —
23
+ small-context backends can no longer collapse N items into one answer.
24
+ - Daemon: port fallback for concurrent instances; `/shutdown` no longer
25
+ token-gated (loopback bind is the boundary; fixes stale-daemon deadlock).
26
+ - JSONC-tolerant verify for agents whose configs carry comments
27
+ (Antigravity) — writing commented files is still refused.
28
+
29
+ ### Fixed
30
+ - Laya wire compat: `noul` arrives as P(yes) float (not bool); `/models`
31
+ endpoint (not `/v1/models`); non-empty `instructions` required.
32
+
33
+ ## [0.1.0] — 2026-10-03
34
+
35
+ - Initial Phase 1 scaffold: MCP v2 shim + shared daemon, tier-0
36
+ `project_facts`, mock + remote `/v1/systemone` backends, 9 agent
37
+ integrators (CLI-first, backup-first, atomic, exactly reversible),
38
+ fail-closed decision envelopes, wizard, doctor, uninstall.
snapdec-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
snapdec-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.5
2
+ Name: snapdec
3
+ Version: 0.2.0
4
+ Summary: Snap decisions for coding agents: one command wires a local or hosted System One decision backend into every coding agent (MCP + Agent Skill).
5
+ Author: AKTONAY
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: agents,cli,coding-agents,decisions,jev,kev,laya,llm,mcp,system-one
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: filelock>=3.13
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: mcp<3,>=2
24
+ Requires-Dist: platformdirs>=4
25
+ Requires-Dist: psutil>=5.9
26
+ Requires-Dist: pydantic>=2
27
+ Requires-Dist: rich>=13
28
+ Requires-Dist: tomlkit>=0.13
29
+ Requires-Dist: typer>=0.12
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
32
+ Requires-Dist: pytest>=8; extra == 'dev'
33
+ Requires-Dist: ruff>=0.6; extra == 'dev'
34
+ Provides-Extra: runtime-onnx-cpu
35
+ Requires-Dist: onnxruntime>=1.19; extra == 'runtime-onnx-cpu'
36
+ Provides-Extra: runtime-onnx-dml
37
+ Requires-Dist: onnxruntime-directml>=1.19; extra == 'runtime-onnx-dml'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # snapdec
41
+
42
+ <!-- mcp-name: io.github.aktonay/snapdec -->
43
+
44
+ **Snap decisions for coding agents.** One command, any machine, any agent:
45
+ fast, calibrated typed decisions (classify / check / score / rank) from a
46
+ local model or hosted API — exposed to every coding agent through one shared
47
+ MCP server plus a portable Agent Skill.
48
+
49
+ - **One prompt setup** — snapdec shows your PC spec and a menu of every backend
50
+ your hardware can actually run, with honest accuracy stats. You choose.
51
+ - **Local = fully automatic** — pick a local model and snapdec creates a
52
+ runtime venv, downloads the model, launches the server (127.0.0.1 only),
53
+ and wires it into every coding agent it finds. No other steps.
54
+ - **Hosted = paste a key** — provider auto-detected from the key format, model
55
+ auto-selected (free variant first), validated by a live canary call.
56
+ - **Honest by design** — every answer carries calibrated probabilities and an
57
+ `auto | review` decision. Uncertain → the agent decides itself. Advisory
58
+ only; never used to approve destructive actions.
59
+
60
+ ## Install
61
+
62
+ ```bash
63
+ uv tool install snapdec # or: pipx install snapdec / pip install snapdec
64
+ snapdec init
65
+ ```
66
+
67
+ Dev (from source): `uv venv && uv pip install -e ".[dev]" && uv run pytest`
68
+
69
+ ## The first-run menu (real example, 16 GB laptop, no dGPU)
70
+
71
+ ```
72
+ Recommended for this machine (13th Gen i5 · 16 GB RAM · Intel UHD · Windows 11)
73
+
74
+ LOCAL — free · private · offline
75
+ [1] Laya EN (421M) — DI ~0 zero-shot (specialize-first base)
76
+ 5–15 ms GPU/Apple · 50–450 ms CPU · setup: ~2 GB (recommended)
77
+ [2] Laya multilingual (322M) — DI ~0 zero-shot · 100+ languages
78
+ [3] Kev 0.8B — DI 13.26 · OOD acc 0.652
79
+ ~40–80 ms CUDA · CPU: seconds/question · setup: ~3 GB [slow on CPU]
80
+ HOSTED — API key · best accuracy
81
+ [4] OpenRouter — free keys (openrouter.ai/keys) · hosts Jev + Kev · Jev DI 51.67 (best known)
82
+ [5] TypeSafe Jev — native /v1/systemone · Jev DI 51.67 (best known) · paid per call
83
+ [6] Other /v1/systemone URL
84
+
85
+ Choice [1]:
86
+ ```
87
+
88
+ Only what fits your hardware is listed — a machine without a 12 GB+ GPU never
89
+ sees Kev-4B (DI 31.31); every listed option is genuinely runnable. Stats are
90
+ zero-shot Decision Index numbers (chance-corrected, 40 benchmarks; Jev 51.67
91
+ is the best known reference) from [our research](SYSONE_ARCHITECTURE.md#13).
92
+
93
+ Picking `[3]` on the machine above works — you get the honest `[slow on CPU]`
94
+ flag first. Freedom within your spec.
95
+
96
+ After you choose, snapdec automatically:
97
+
98
+ 1. provisions the backend (local: venv + download + server; hosted: key
99
+ validation + model canary),
100
+ 2. registers its MCP server in **every coding agent it detects** (Claude
101
+ Code, Codex, Cursor, OpenCode, Antigravity, Windsurf, VS Code, Cline —
102
+ CLI-first, backup-first, exactly reversible),
103
+ 3. installs the Agent Skill globally so every repo gets it,
104
+ 4. starts the shared daemon and prints a live health check.
105
+
106
+ ## What agents get
107
+
108
+ | Tool | Tier | What it does |
109
+ |---|---|---|
110
+ | `project_facts` | 0 | Test/lint/typecheck/build commands, package manager, monorepo layout, CI — deterministic, zero model calls |
111
+ | `classify` | 1 | Label items from caller-defined classes, with calibrated probabilities |
112
+ | `check` | 1 | Yes/no questions about one piece of evidence (`yes \| no \| uncertain`) |
113
+ | `score` | 1 | Ordinal rating (severity/priority/risk), 2–10 levels |
114
+ | `rank` | 1 | Which candidates answer a query |
115
+
116
+ Multi-item tools fan out one request per item (small-context backends can't
117
+ answer N items against one blob) and run the calls in parallel.
118
+
119
+ Example (CLI mirror of the MCP tool, real output from Laya on a CPU laptop):
120
+
121
+ ```
122
+ $ echo '{"items":[
123
+ {"id":"t1","text":"Tests failed: OSError network unreachable on runner"},
124
+ {"id":"t2","text":"AssertionError: expected status 200, got 500"},
125
+ {"id":"t3","text":"ModuleNotFoundError: No module named requests"}],
126
+ "classes":{"infra":"network/runner problem","bug":"real code bug",
127
+ "deps":"missing dependency"}}' | snapdec classify --input -
128
+
129
+ t1: bug p=0.73 decision=review
130
+ t2: bug p=0.94 decision=auto
131
+ t3: deps p=0.61 decision=review
132
+ ```
133
+
134
+ `auto` results can be acted on in bulk; `review` items go back to the host
135
+ agent — that abstention is the product.
136
+
137
+ ## CLI
138
+
139
+ ```
140
+ snapdec init # the wizard (above)
141
+ snapdec init --yes --api-key sk-or-… # non-interactive, provider auto-detected
142
+ snapdec init --yes --backend local # non-interactive managed local setup
143
+ snapdec doctor --live # verify install, daemon, every agent registration
144
+ snapdec daemon start|stop|status|logs
145
+ snapdec agents list|add|remove|print # integrations, all reversible
146
+ snapdec classify|check|score|rank --input - # CLI mirrors of the tools
147
+ snapdec project-facts . # tier-0 facts straight from the terminal
148
+ snapdec uninstall # reverses every integration exactly
149
+ ```
150
+
151
+ ## Architecture (30 seconds)
152
+
153
+ ```
154
+ agents (Claude Code, Codex, Cursor, …)
155
+ │ stdio MCP (one thin shim per agent, <1 s start, no ML imports)
156
+ ▼
157
+ snapdec daemon (one shared process, loopback+token IPC / UDS)
158
+ ▼
159
+ backend: managed Laya (8901) · managed Kev (8902, pinned git SHA)
160
+ · hosted /v1/systemone (OpenRouter, TypeSafe, any URL) · mock
161
+ ```
162
+
163
+ Keys live only in snapdec's own state (env-var reference or 0600 file) —
164
+ never in agent configs. Local servers bind 127.0.0.1 only. No telemetry.
165
+
166
+ Full design doc with research citations: [SYSONE_ARCHITECTURE.md](SYSONE_ARCHITECTURE.md)
167
+ · decisions: [docs/adr/](docs/adr/)
168
+
169
+ ## Status
170
+
171
+ Phase 1/2 complete for: tier-0, managed Laya + Kev provisioning, hosted
172
+ backends, 9 agent integrations, MCP v2 shim + shared daemon. Windows is
173
+ verified on real hardware; macOS/Linux covered by CI and follow the same
174
+ paths. Honest gaps: Kev on CPU is slow (flagged in the menu, not hidden);
175
+ Laya zero-shot is weak (it's a specialize-first base — the stats say so in
176
+ the menu); calibration refit and micro-batching are Phase 4.
177
+
178
+ ## License
179
+
180
+ Apache-2.0. Not affiliated with TypeSafe/Jev, Kev, or Laya — snapdec routes
181
+ to them and credits them. Model licenses: Apache-2.0 (Kev, Laya).
@@ -0,0 +1,142 @@
1
+ # snapdec
2
+
3
+ <!-- mcp-name: io.github.aktonay/snapdec -->
4
+
5
+ **Snap decisions for coding agents.** One command, any machine, any agent:
6
+ fast, calibrated typed decisions (classify / check / score / rank) from a
7
+ local model or hosted API — exposed to every coding agent through one shared
8
+ MCP server plus a portable Agent Skill.
9
+
10
+ - **One prompt setup** — snapdec shows your PC spec and a menu of every backend
11
+ your hardware can actually run, with honest accuracy stats. You choose.
12
+ - **Local = fully automatic** — pick a local model and snapdec creates a
13
+ runtime venv, downloads the model, launches the server (127.0.0.1 only),
14
+ and wires it into every coding agent it finds. No other steps.
15
+ - **Hosted = paste a key** — provider auto-detected from the key format, model
16
+ auto-selected (free variant first), validated by a live canary call.
17
+ - **Honest by design** — every answer carries calibrated probabilities and an
18
+ `auto | review` decision. Uncertain → the agent decides itself. Advisory
19
+ only; never used to approve destructive actions.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ uv tool install snapdec # or: pipx install snapdec / pip install snapdec
25
+ snapdec init
26
+ ```
27
+
28
+ Dev (from source): `uv venv && uv pip install -e ".[dev]" && uv run pytest`
29
+
30
+ ## The first-run menu (real example, 16 GB laptop, no dGPU)
31
+
32
+ ```
33
+ Recommended for this machine (13th Gen i5 · 16 GB RAM · Intel UHD · Windows 11)
34
+
35
+ LOCAL — free · private · offline
36
+ [1] Laya EN (421M) — DI ~0 zero-shot (specialize-first base)
37
+ 5–15 ms GPU/Apple · 50–450 ms CPU · setup: ~2 GB (recommended)
38
+ [2] Laya multilingual (322M) — DI ~0 zero-shot · 100+ languages
39
+ [3] Kev 0.8B — DI 13.26 · OOD acc 0.652
40
+ ~40–80 ms CUDA · CPU: seconds/question · setup: ~3 GB [slow on CPU]
41
+ HOSTED — API key · best accuracy
42
+ [4] OpenRouter — free keys (openrouter.ai/keys) · hosts Jev + Kev · Jev DI 51.67 (best known)
43
+ [5] TypeSafe Jev — native /v1/systemone · Jev DI 51.67 (best known) · paid per call
44
+ [6] Other /v1/systemone URL
45
+
46
+ Choice [1]:
47
+ ```
48
+
49
+ Only what fits your hardware is listed — a machine without a 12 GB+ GPU never
50
+ sees Kev-4B (DI 31.31); every listed option is genuinely runnable. Stats are
51
+ zero-shot Decision Index numbers (chance-corrected, 40 benchmarks; Jev 51.67
52
+ is the best known reference) from [our research](SYSONE_ARCHITECTURE.md#13).
53
+
54
+ Picking `[3]` on the machine above works — you get the honest `[slow on CPU]`
55
+ flag first. Freedom within your spec.
56
+
57
+ After you choose, snapdec automatically:
58
+
59
+ 1. provisions the backend (local: venv + download + server; hosted: key
60
+ validation + model canary),
61
+ 2. registers its MCP server in **every coding agent it detects** (Claude
62
+ Code, Codex, Cursor, OpenCode, Antigravity, Windsurf, VS Code, Cline —
63
+ CLI-first, backup-first, exactly reversible),
64
+ 3. installs the Agent Skill globally so every repo gets it,
65
+ 4. starts the shared daemon and prints a live health check.
66
+
67
+ ## What agents get
68
+
69
+ | Tool | Tier | What it does |
70
+ |---|---|---|
71
+ | `project_facts` | 0 | Test/lint/typecheck/build commands, package manager, monorepo layout, CI — deterministic, zero model calls |
72
+ | `classify` | 1 | Label items from caller-defined classes, with calibrated probabilities |
73
+ | `check` | 1 | Yes/no questions about one piece of evidence (`yes \| no \| uncertain`) |
74
+ | `score` | 1 | Ordinal rating (severity/priority/risk), 2–10 levels |
75
+ | `rank` | 1 | Which candidates answer a query |
76
+
77
+ Multi-item tools fan out one request per item (small-context backends can't
78
+ answer N items against one blob) and run the calls in parallel.
79
+
80
+ Example (CLI mirror of the MCP tool, real output from Laya on a CPU laptop):
81
+
82
+ ```
83
+ $ echo '{"items":[
84
+ {"id":"t1","text":"Tests failed: OSError network unreachable on runner"},
85
+ {"id":"t2","text":"AssertionError: expected status 200, got 500"},
86
+ {"id":"t3","text":"ModuleNotFoundError: No module named requests"}],
87
+ "classes":{"infra":"network/runner problem","bug":"real code bug",
88
+ "deps":"missing dependency"}}' | snapdec classify --input -
89
+
90
+ t1: bug p=0.73 decision=review
91
+ t2: bug p=0.94 decision=auto
92
+ t3: deps p=0.61 decision=review
93
+ ```
94
+
95
+ `auto` results can be acted on in bulk; `review` items go back to the host
96
+ agent — that abstention is the product.
97
+
98
+ ## CLI
99
+
100
+ ```
101
+ snapdec init # the wizard (above)
102
+ snapdec init --yes --api-key sk-or-… # non-interactive, provider auto-detected
103
+ snapdec init --yes --backend local # non-interactive managed local setup
104
+ snapdec doctor --live # verify install, daemon, every agent registration
105
+ snapdec daemon start|stop|status|logs
106
+ snapdec agents list|add|remove|print # integrations, all reversible
107
+ snapdec classify|check|score|rank --input - # CLI mirrors of the tools
108
+ snapdec project-facts . # tier-0 facts straight from the terminal
109
+ snapdec uninstall # reverses every integration exactly
110
+ ```
111
+
112
+ ## Architecture (30 seconds)
113
+
114
+ ```
115
+ agents (Claude Code, Codex, Cursor, …)
116
+ │ stdio MCP (one thin shim per agent, <1 s start, no ML imports)
117
+ ▼
118
+ snapdec daemon (one shared process, loopback+token IPC / UDS)
119
+ ▼
120
+ backend: managed Laya (8901) · managed Kev (8902, pinned git SHA)
121
+ · hosted /v1/systemone (OpenRouter, TypeSafe, any URL) · mock
122
+ ```
123
+
124
+ Keys live only in snapdec's own state (env-var reference or 0600 file) —
125
+ never in agent configs. Local servers bind 127.0.0.1 only. No telemetry.
126
+
127
+ Full design doc with research citations: [SYSONE_ARCHITECTURE.md](SYSONE_ARCHITECTURE.md)
128
+ · decisions: [docs/adr/](docs/adr/)
129
+
130
+ ## Status
131
+
132
+ Phase 1/2 complete for: tier-0, managed Laya + Kev provisioning, hosted
133
+ backends, 9 agent integrations, MCP v2 shim + shared daemon. Windows is
134
+ verified on real hardware; macOS/Linux covered by CI and follow the same
135
+ paths. Honest gaps: Kev on CPU is slow (flagged in the menu, not hidden);
136
+ Laya zero-shot is weak (it's a specialize-first base — the stats say so in
137
+ the menu); calibration refit and micro-batching are Phase 4.
138
+
139
+ ## License
140
+
141
+ Apache-2.0. Not affiliated with TypeSafe/Jev, Kev, or Laya — snapdec routes
142
+ to them and credits them. Model licenses: Apache-2.0 (Kev, Laya).