token-miser 0.3.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 (220) hide show
  1. token_miser-0.3.0/.github/workflows/benchmark.yml +59 -0
  2. token_miser-0.3.0/.github/workflows/publish.yml +26 -0
  3. token_miser-0.3.0/.github/workflows/test.yml +37 -0
  4. token_miser-0.3.0/.gitignore +58 -0
  5. token_miser-0.3.0/.kanon +24 -0
  6. token_miser-0.3.0/AGENTS.md +29 -0
  7. token_miser-0.3.0/CHANGELOG.md +75 -0
  8. token_miser-0.3.0/CLAUDE.md +4 -0
  9. token_miser-0.3.0/LICENSE +190 -0
  10. token_miser-0.3.0/MEMORY.md +6 -0
  11. token_miser-0.3.0/PKG-INFO +354 -0
  12. token_miser-0.3.0/README.md +332 -0
  13. token_miser-0.3.0/benchmarks/fixtures/tiny-api/README.md +39 -0
  14. token_miser-0.3.0/benchmarks/fixtures/tiny-api/repo.bundle +0 -0
  15. token_miser-0.3.0/benchmarks/fixtures/tiny-cli/README.md +55 -0
  16. token_miser-0.3.0/benchmarks/fixtures/tiny-cli/repo.bundle +0 -0
  17. token_miser-0.3.0/benchmarks/repos.yaml +72 -0
  18. token_miser-0.3.0/benchmarks/suites/axis.yaml +43 -0
  19. token_miser-0.3.0/benchmarks/suites/domain-frontend.yaml +35 -0
  20. token_miser-0.3.0/benchmarks/suites/domain-iac.yaml +35 -0
  21. token_miser-0.3.0/benchmarks/suites/domain-python-api.yaml +35 -0
  22. token_miser-0.3.0/benchmarks/suites/quick.yaml +28 -0
  23. token_miser-0.3.0/benchmarks/suites/standard.yaml +58 -0
  24. token_miser-0.3.0/benchmarks/tasks/bm-axis-bashheavy.yaml +29 -0
  25. token_miser-0.3.0/benchmarks/tasks/bm-axis-bigoutput.yaml +28 -0
  26. token_miser-0.3.0/benchmarks/tasks/bm-axis-diff.yaml +33 -0
  27. token_miser-0.3.0/benchmarks/tasks/bm-axis-explore.yaml +28 -0
  28. token_miser-0.3.0/benchmarks/tasks/bm-axis-multiturn.yaml +30 -0
  29. token_miser-0.3.0/benchmarks/tasks/bm-axis-reasoning.yaml +23 -0
  30. token_miser-0.3.0/benchmarks/tasks/bm-axis-smallio.yaml +23 -0
  31. token_miser-0.3.0/benchmarks/tasks/bm-axis-testrun.yaml +27 -0
  32. token_miser-0.3.0/benchmarks/tasks/bm-fe-a11y-fix.yaml +35 -0
  33. token_miser-0.3.0/benchmarks/tasks/bm-fe-api-integration.yaml +37 -0
  34. token_miser-0.3.0/benchmarks/tasks/bm-fe-component-test.yaml +32 -0
  35. token_miser-0.3.0/benchmarks/tasks/bm-fe-custom-hook.yaml +34 -0
  36. token_miser-0.3.0/benchmarks/tasks/bm-fe-form-component.yaml +33 -0
  37. token_miser-0.3.0/benchmarks/tasks/bm-fe-perf-optimize.yaml +35 -0
  38. token_miser-0.3.0/benchmarks/tasks/bm-fe-trace-dataflow.yaml +32 -0
  39. token_miser-0.3.0/benchmarks/tasks/bm-fe-typescript-refactor.yaml +30 -0
  40. token_miser-0.3.0/benchmarks/tasks/bm-feat-001.yaml +22 -0
  41. token_miser-0.3.0/benchmarks/tasks/bm-feat-002.yaml +23 -0
  42. token_miser-0.3.0/benchmarks/tasks/bm-feat-003.yaml +23 -0
  43. token_miser-0.3.0/benchmarks/tasks/bm-fix-001.yaml +24 -0
  44. token_miser-0.3.0/benchmarks/tasks/bm-fix-002.yaml +22 -0
  45. token_miser-0.3.0/benchmarks/tasks/bm-fix-003.yaml +25 -0
  46. token_miser-0.3.0/benchmarks/tasks/bm-iac-cdk-nag.yaml +32 -0
  47. token_miser-0.3.0/benchmarks/tasks/bm-iac-cdk-test.yaml +31 -0
  48. token_miser-0.3.0/benchmarks/tasks/bm-iac-cdk-vpc-stack.yaml +32 -0
  49. token_miser-0.3.0/benchmarks/tasks/bm-iac-cfn-refactor.yaml +30 -0
  50. token_miser-0.3.0/benchmarks/tasks/bm-iac-cost-review.yaml +30 -0
  51. token_miser-0.3.0/benchmarks/tasks/bm-iac-security-review.yaml +31 -0
  52. token_miser-0.3.0/benchmarks/tasks/bm-iac-terraform-explore.yaml +30 -0
  53. token_miser-0.3.0/benchmarks/tasks/bm-iac-terraform-module.yaml +33 -0
  54. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-fastapi-auth.yaml +35 -0
  55. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-fastapi-crud.yaml +35 -0
  56. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-fastapi-middleware.yaml +32 -0
  57. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-fastapi-openapi.yaml +32 -0
  58. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-flask-debug-500.yaml +28 -0
  59. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-flask-n-plus-one.yaml +31 -0
  60. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-flask-test-integration.yaml +34 -0
  61. token_miser-0.3.0/benchmarks/tasks/bm-pyapi-httpx-test.yaml +33 -0
  62. token_miser-0.3.0/benchmarks/tasks/bm-refactor-001.yaml +28 -0
  63. token_miser-0.3.0/benchmarks/tasks/bm-refactor-002.yaml +27 -0
  64. token_miser-0.3.0/benchmarks/tasks/bm-refactor-003.yaml +28 -0
  65. token_miser-0.3.0/benchmarks/tasks/bm-seq-001.yaml +30 -0
  66. token_miser-0.3.0/benchmarks/tasks/bm-seq-002.yaml +37 -0
  67. token_miser-0.3.0/benchmarks/tasks/bm-seq-003.yaml +32 -0
  68. token_miser-0.3.0/benchmarks/tasks/bm-test-001.yaml +26 -0
  69. token_miser-0.3.0/benchmarks/tasks/bm-test-002.yaml +26 -0
  70. token_miser-0.3.0/benchmarks/tasks/bm-test-003.yaml +30 -0
  71. token_miser-0.3.0/docs/agent-agnostic-plan.md +72 -0
  72. token_miser-0.3.0/docs/grade-template.yml +61 -0
  73. token_miser-0.3.0/docs/index.html +737 -0
  74. token_miser-0.3.0/docs/kanon-integration.md +100 -0
  75. token_miser-0.3.0/docs/plans/2026-04-18-public-release-cleanup.md +566 -0
  76. token_miser-0.3.0/docs/plans/2026-04-20-package-lifecycle.md +659 -0
  77. token_miser-0.3.0/docs/plans/critique-and-roadmap.md +220 -0
  78. token_miser-0.3.0/docs/results-axis.json +473 -0
  79. token_miser-0.3.0/docs/results-domain-python-api.json +464 -0
  80. token_miser-0.3.0/docs/results-quick.json +325 -0
  81. token_miser-0.3.0/docs/results-standard.json +584 -0
  82. token_miser-0.3.0/packages/adversarial-frugal/AGENTS.md +34 -0
  83. token_miser-0.3.0/packages/adversarial-frugal/CLAUDE.md +1 -0
  84. token_miser-0.3.0/packages/adversarial-frugal/manifest.yaml +9 -0
  85. token_miser-0.3.0/packages/adversarial-frugal/settings.json +1 -0
  86. token_miser-0.3.0/packages/async-first/AGENTS.md +32 -0
  87. token_miser-0.3.0/packages/async-first/CLAUDE.md +1 -0
  88. token_miser-0.3.0/packages/async-first/manifest.yaml +7 -0
  89. token_miser-0.3.0/packages/c-structured/AGENTS.md +6 -0
  90. token_miser-0.3.0/packages/c-structured/CLAUDE.md +1 -0
  91. token_miser-0.3.0/packages/c-structured/manifest.yaml +11 -0
  92. token_miser-0.3.0/packages/c-structured/rules/efficiency.md +11 -0
  93. token_miser-0.3.0/packages/c-structured/rules/workflow.md +11 -0
  94. token_miser-0.3.0/packages/caveman/AGENTS.md +27 -0
  95. token_miser-0.3.0/packages/caveman/CLAUDE.md +1 -0
  96. token_miser-0.3.0/packages/caveman/manifest.yaml +7 -0
  97. token_miser-0.3.0/packages/claude-mem/CLAUDE.md +3 -0
  98. token_miser-0.3.0/packages/claude-mem/manifest.yaml +13 -0
  99. token_miser-0.3.0/packages/claude-mem/settings.json +26 -0
  100. token_miser-0.3.0/packages/context-guardian/AGENTS.md +28 -0
  101. token_miser-0.3.0/packages/context-guardian/CLAUDE.md +1 -0
  102. token_miser-0.3.0/packages/context-guardian/manifest.yaml +7 -0
  103. token_miser-0.3.0/packages/depth-control/AGENTS.md +35 -0
  104. token_miser-0.3.0/packages/depth-control/CLAUDE.md +1 -0
  105. token_miser-0.3.0/packages/depth-control/manifest.yaml +7 -0
  106. token_miser-0.3.0/packages/domain-python-api/AGENTS.md +31 -0
  107. token_miser-0.3.0/packages/domain-python-api/CLAUDE.md +1 -0
  108. token_miser-0.3.0/packages/domain-python-api/manifest.yaml +7 -0
  109. token_miser-0.3.0/packages/drona23/AGENTS.md +12 -0
  110. token_miser-0.3.0/packages/drona23/CLAUDE.md +1 -0
  111. token_miser-0.3.0/packages/drona23/manifest.yaml +7 -0
  112. token_miser-0.3.0/packages/fail-smart/AGENTS.md +38 -0
  113. token_miser-0.3.0/packages/fail-smart/CLAUDE.md +1 -0
  114. token_miser-0.3.0/packages/fail-smart/manifest.yaml +7 -0
  115. token_miser-0.3.0/packages/lean/AGENTS.md +42 -0
  116. token_miser-0.3.0/packages/lean/CLAUDE.md +1 -0
  117. token_miser-0.3.0/packages/lean/manifest.yaml +7 -0
  118. token_miser-0.3.0/packages/minimal-wip/AGENTS.md +33 -0
  119. token_miser-0.3.0/packages/minimal-wip/CLAUDE.md +1 -0
  120. token_miser-0.3.0/packages/minimal-wip/manifest.yaml +7 -0
  121. token_miser-0.3.0/packages/opportunistic-lazy/AGENTS.md +26 -0
  122. token_miser-0.3.0/packages/opportunistic-lazy/CLAUDE.md +1 -0
  123. token_miser-0.3.0/packages/opportunistic-lazy/manifest.yaml +7 -0
  124. token_miser-0.3.0/packages/personal/AGENTS.md +264 -0
  125. token_miser-0.3.0/packages/personal/manifest.yaml +7 -0
  126. token_miser-0.3.0/packages/phase-budget/AGENTS.md +33 -0
  127. token_miser-0.3.0/packages/phase-budget/CLAUDE.md +1 -0
  128. token_miser-0.3.0/packages/phase-budget/manifest.yaml +7 -0
  129. token_miser-0.3.0/packages/piersede/AGENTS.md +137 -0
  130. token_miser-0.3.0/packages/piersede/CLAUDE.md +1 -0
  131. token_miser-0.3.0/packages/piersede/manifest.yaml +7 -0
  132. token_miser-0.3.0/packages/planner/AGENTS.md +20 -0
  133. token_miser-0.3.0/packages/planner/CLAUDE.md +1 -0
  134. token_miser-0.3.0/packages/planner/manifest.yaml +7 -0
  135. token_miser-0.3.0/packages/quality-floor/AGENTS.md +37 -0
  136. token_miser-0.3.0/packages/quality-floor/CLAUDE.md +1 -0
  137. token_miser-0.3.0/packages/quality-floor/manifest.yaml +7 -0
  138. token_miser-0.3.0/packages/rtk/README.md +12 -0
  139. token_miser-0.3.0/packages/rtk/hooks/rtk-rewrite.sh +101 -0
  140. token_miser-0.3.0/packages/rtk/hooks/rtk-wrapper.sh +4 -0
  141. token_miser-0.3.0/packages/rtk/manifest.yaml +13 -0
  142. token_miser-0.3.0/packages/rtk/settings.json +15 -0
  143. token_miser-0.3.0/packages/rubin/AGENTS.md +266 -0
  144. token_miser-0.3.0/packages/rubin/CLAUDE.md +1 -0
  145. token_miser-0.3.0/packages/rubin/manifest.yaml +7 -0
  146. token_miser-0.3.0/packages/rubin-async/AGENTS.md +301 -0
  147. token_miser-0.3.0/packages/rubin-async/CLAUDE.md +1 -0
  148. token_miser-0.3.0/packages/rubin-async/manifest.yaml +7 -0
  149. token_miser-0.3.0/packages/rubin-lazy/AGENTS.md +295 -0
  150. token_miser-0.3.0/packages/rubin-lazy/CLAUDE.md +1 -0
  151. token_miser-0.3.0/packages/rubin-lazy/manifest.yaml +7 -0
  152. token_miser-0.3.0/packages/rubin-v2/AGENTS.md +44 -0
  153. token_miser-0.3.0/packages/rubin-v2/CLAUDE.md +1 -0
  154. token_miser-0.3.0/packages/rubin-v2/manifest.yaml +9 -0
  155. token_miser-0.3.0/packages/tdd-strict/AGENTS.md +16 -0
  156. token_miser-0.3.0/packages/tdd-strict/CLAUDE.md +1 -0
  157. token_miser-0.3.0/packages/tdd-strict/manifest.yaml +7 -0
  158. token_miser-0.3.0/packages/thinking-cap/AGENTS.md +15 -0
  159. token_miser-0.3.0/packages/thinking-cap/CLAUDE.md +1 -0
  160. token_miser-0.3.0/packages/thinking-cap/manifest.yaml +7 -0
  161. token_miser-0.3.0/packages/thorough/AGENTS.md +16 -0
  162. token_miser-0.3.0/packages/thorough/CLAUDE.md +1 -0
  163. token_miser-0.3.0/packages/thorough/manifest.yaml +7 -0
  164. token_miser-0.3.0/packages/token-miser/AGENTS.md +24 -0
  165. token_miser-0.3.0/packages/token-miser/CLAUDE.md +1 -0
  166. token_miser-0.3.0/packages/token-miser/manifest.yaml +7 -0
  167. token_miser-0.3.0/pyproject.toml +65 -0
  168. token_miser-0.3.0/scripts/run-axis-matrix.sh +50 -0
  169. token_miser-0.3.0/scripts/run-matrix.sh +50 -0
  170. token_miser-0.3.0/scripts/run-suite-crossover.sh +4 -0
  171. token_miser-0.3.0/scripts/run-suite-package-matrix.sh +157 -0
  172. token_miser-0.3.0/scripts/run-suite-shared-baseline.sh +4 -0
  173. token_miser-0.3.0/src/token_miser/__init__.py +3 -0
  174. token_miser-0.3.0/src/token_miser/__main__.py +641 -0
  175. token_miser-0.3.0/src/token_miser/backends/__init__.py +57 -0
  176. token_miser-0.3.0/src/token_miser/backends/base.py +112 -0
  177. token_miser-0.3.0/src/token_miser/backends/claude.py +189 -0
  178. token_miser-0.3.0/src/token_miser/backends/codex.py +137 -0
  179. token_miser-0.3.0/src/token_miser/checker.py +117 -0
  180. token_miser-0.3.0/src/token_miser/db.py +439 -0
  181. token_miser-0.3.0/src/token_miser/digest.py +162 -0
  182. token_miser-0.3.0/src/token_miser/environment.py +265 -0
  183. token_miser-0.3.0/src/token_miser/evaluator.py +216 -0
  184. token_miser-0.3.0/src/token_miser/executor.py +23 -0
  185. token_miser-0.3.0/src/token_miser/matrix.py +304 -0
  186. token_miser-0.3.0/src/token_miser/package_adapter.py +319 -0
  187. token_miser-0.3.0/src/token_miser/package_ref.py +56 -0
  188. token_miser-0.3.0/src/token_miser/publish.py +74 -0
  189. token_miser-0.3.0/src/token_miser/recommend.py +330 -0
  190. token_miser-0.3.0/src/token_miser/report.py +198 -0
  191. token_miser-0.3.0/src/token_miser/repos.py +94 -0
  192. token_miser-0.3.0/src/token_miser/score.py +126 -0
  193. token_miser-0.3.0/src/token_miser/suite.py +82 -0
  194. token_miser-0.3.0/src/token_miser/task.py +104 -0
  195. token_miser-0.3.0/src/token_miser/tune.py +426 -0
  196. token_miser-0.3.0/src/token_miser/tune_builder.py +65 -0
  197. token_miser-0.3.0/tasks/quick-001.yaml +23 -0
  198. token_miser-0.3.0/tasks/synth-001.yaml +36 -0
  199. token_miser-0.3.0/tasks/synth-002.yaml +34 -0
  200. token_miser-0.3.0/tasks/synth-003.yaml +29 -0
  201. token_miser-0.3.0/tests/test_checker.py +209 -0
  202. token_miser-0.3.0/tests/test_cli.py +44 -0
  203. token_miser-0.3.0/tests/test_db.py +160 -0
  204. token_miser-0.3.0/tests/test_digest.py +159 -0
  205. token_miser-0.3.0/tests/test_environment.py +395 -0
  206. token_miser-0.3.0/tests/test_evaluator.py +308 -0
  207. token_miser-0.3.0/tests/test_executor.py +244 -0
  208. token_miser-0.3.0/tests/test_matrix.py +304 -0
  209. token_miser-0.3.0/tests/test_package_adapter.py +230 -0
  210. token_miser-0.3.0/tests/test_package_ref.py +109 -0
  211. token_miser-0.3.0/tests/test_publish.py +114 -0
  212. token_miser-0.3.0/tests/test_recommend.py +338 -0
  213. token_miser-0.3.0/tests/test_report.py +140 -0
  214. token_miser-0.3.0/tests/test_repos.py +202 -0
  215. token_miser-0.3.0/tests/test_score.py +361 -0
  216. token_miser-0.3.0/tests/test_suite.py +119 -0
  217. token_miser-0.3.0/tests/test_task.py +148 -0
  218. token_miser-0.3.0/tests/test_tune.py +198 -0
  219. token_miser-0.3.0/tests/test_tune_builder.py +139 -0
  220. token_miser-0.3.0/uv.lock +1024 -0
@@ -0,0 +1,59 @@
1
+ name: benchmark
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ suite:
7
+ description: "Suite name (e.g. quick, standard)"
8
+ required: true
9
+ default: quick
10
+ package:
11
+ description: "Package name to evaluate (e.g. lean)"
12
+ required: true
13
+ default: lean
14
+
15
+ jobs:
16
+ benchmark:
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ id-token: write
20
+ contents: read
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Configure AWS credentials (Bedrock)
26
+ uses: aws-actions/configure-aws-credentials@v4
27
+ with:
28
+ role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }}
29
+ aws-region: us-east-2
30
+
31
+ - name: Install Node + Claude CLI
32
+ run: npm install -g @anthropic-ai/claude-code
33
+
34
+ - name: Install uv + token-miser
35
+ uses: astral-sh/setup-uv@v4
36
+
37
+ - run: uv sync
38
+
39
+ - name: Run benchmarks
40
+ env:
41
+ AWS_REGION: us-east-2
42
+ run: |
43
+ uv run token-miser tune \
44
+ --suite ${{ inputs.suite }} \
45
+ --package ${{ inputs.package }} \
46
+ --agent claude
47
+
48
+ - name: Export score
49
+ run: |
50
+ uv run token-miser score \
51
+ --suite ${{ inputs.suite }} \
52
+ --package ${{ inputs.package }} \
53
+ --output score.json
54
+
55
+ - uses: actions/upload-artifact@v4
56
+ with:
57
+ name: benchmark-score
58
+ path: score.json
59
+ retention-days: 90
@@ -0,0 +1,26 @@
1
+ name: publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: release
12
+ permissions:
13
+ id-token: write
14
+ contents: read
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+
22
+ - name: Build
23
+ run: uv build
24
+
25
+ - name: Publish to PyPI
26
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,37 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ run: uv python install ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: uv sync
27
+
28
+ - name: Lint
29
+ run: uv run ruff check src/ tests/
30
+
31
+ - name: Test
32
+ run: uv run pytest tests/ -v
33
+
34
+ - name: Verify CLI
35
+ run: |
36
+ uv run token-miser --version
37
+ uv run token-miser tasks --dir tasks/
@@ -0,0 +1,58 @@
1
+ # Build artifacts (the CLI binary at repo root, not packages/token-miser/)
2
+ /token-miser
3
+
4
+ # Claude Code session data
5
+ .claude/
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+ *.so
12
+ .pytest_cache/
13
+ .coverage
14
+ htmlcov/
15
+ dist/
16
+ build/
17
+ *.egg-info/
18
+ .venv/
19
+ venv/
20
+ *.egg
21
+
22
+ # Editor / OS
23
+ .vscode/
24
+ .idea/
25
+ .DS_Store
26
+ .cursor/
27
+
28
+ # Personal package configs — commit only shared/example packages
29
+ packages/my-config/
30
+
31
+ # Kanon managed directories (synced from manifest repos)
32
+ .packages/
33
+ .kanon-data/
34
+
35
+ # Token miser generated output
36
+ tuned-profile/
37
+ .token_miser/
38
+
39
+ # Agent execution artifacts
40
+ .ralphael/
41
+ .worktrees/
42
+ *.log
43
+
44
+ # Plan execution state
45
+ docs/plans/*_state.json
46
+
47
+ # Maestro workflow state
48
+ .maestro/
49
+ entities.json
50
+
51
+ # Internal dev notes
52
+ docs/notes-*.md
53
+ docs/research-notes.md
54
+ docs/plans/notes-*.md
55
+ tuned-package/
56
+
57
+ # Compiled package binaries — build locally, do not commit
58
+ packages/*/bin/
@@ -0,0 +1,24 @@
1
+ # This .kanon file shows how kanon distributes packages to a team.
2
+ # It points to the author's public package repository as an example.
3
+ # Replace GITBASE and KANON_SOURCE_packages_URL to use your own package repository.
4
+ #
5
+ # token-miser Kanon Configuration
6
+ #
7
+ # kanon syncs versioned packages from a manifest repo into .packages/,
8
+ # then token-miser can reference them as experiment packages.
9
+ #
10
+ # Pipeline: kanon distributes -> loadout applies -> token-miser measures
11
+
12
+ # Shared variables
13
+ GITBASE=https://github.com/rubin-johnson/
14
+ CLAUDE_MARKETPLACES_DIR=${HOME}/.claude-marketplaces
15
+
16
+ # Marketplace install disabled (loadout handles config, not plugins)
17
+ KANON_MARKETPLACE_INSTALL=false
18
+
19
+ # Source: loadout packages manifest repository
20
+ # After 'kanon install', packages appear in .packages/ as symlinks.
21
+ # token-miser references them: --package .packages/token-miser
22
+ KANON_SOURCE_packages_URL=https://github.com/rubin-johnson/loadout-packages.git
23
+ KANON_SOURCE_packages_REVISION=refs/tags/0.1.0
24
+ KANON_SOURCE_packages_PATH=repo-specs/meta.xml
@@ -0,0 +1,29 @@
1
+ # token_miser
2
+
3
+ Benchmarks coding-agent configurations; records token usage, cost, and task outcomes.
4
+
5
+ ## Common Commands
6
+ - Install/sync: `uv sync`
7
+ - Tests: `uv run pytest -q`
8
+ - Lint: `uv run ruff check src tests`
9
+ - Format: `uv run ruff format src tests`
10
+ - CLI help: `uv run token-miser --help`
11
+
12
+ ## Repo Notes
13
+ - Main CLI entrypoint: `src/token_miser/__main__.py`
14
+ - Execution backends: `src/token_miser/backends/` (claude, codex) — extend `base.py`
15
+ - Benchmark environment setup: `src/token_miser/environment.py`
16
+ - Run data schema: `src/token_miser/db.py`
17
+ - Package operations: `src/token_miser/package_adapter.py` — validate, apply, restore, pack packages
18
+ - Package publishing to kanon: `src/token_miser/publish.py`
19
+ - Experiment packages live in `packages/`
20
+
21
+ ## Working Rules
22
+ - Keep backend additions additive; do not regress existing Claude behavior while adding Codex support
23
+ - Depends on kanon-cli — `uv sync` resolves it
24
+ - Schema changes need migration logic in `init_db()`, not fresh database creation
25
+ - `checker.py` evaluates success criteria — changes affect all benchmark results, test carefully
26
+ - `package_adapter.py` inlines loadout functionality — no external loadout dependency
27
+ - Packages renamed: `slim-rubin` → `lean`, `full-rubin` → `personal` (2026-05-07)
28
+ - `observations` and `task_dimensions` tables exist in db.py; use `record_observations()` to log per-task metrics
29
+ - `environment.py` deep-merges package settings.json into ~/.claude/settings.json; starts services listed in manifest.yaml
@@ -0,0 +1,75 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.3.0] - 2026-05-07
6
+
7
+ ### Added
8
+ - `observations` table: normalized (run_id, task_id, metric_name, metric_value, metric_bool, dimension_type) fact table for per-task metrics
9
+ - `task_dimensions` table: per-task metadata (task_id, dimension, value, source)
10
+ - `record_observations()`, `record_task_dimension()`, `get_package_observations()` in `db.py`
11
+ - Package lifecycle: `settings.json` deep-merge via `_deep_merge` / `_merge_package_settings` in `environment.py`
12
+ - Service lifecycle: `_start_services` / `_read_manifest_services` in `environment.py`; SIGTERM teardown on env cleanup; `service_pids` tracking on `EnvironmentContext`
13
+ - `validate_package` now enforces that each service entry has a `command` field
14
+ - `claude-mem` package: manifest.yaml, CLAUDE.md, and settings.json demonstrating hook-based persistent memory
15
+ - Dashboard type badges: `.tag-hook`, `.tag-plugin`, `.tag-config`, `.tag-mcp` CSS classes; cards for `rtk` and `claude-mem` tagged
16
+
17
+ ### Changed
18
+ - Package names: `slim-rubin` → `lean`, `full-rubin` → `personal`
19
+ - `TOKEN_MISER_DB` env var supported for database path override
20
+
21
+ ### Fixed
22
+ - Caylent employer content and internal paths scrubbed from `AGENTS.md` and package files
23
+ - RTK binary removed from git tracking; `packages/*/bin/` added to `.gitignore`
24
+ - Internal task files and `.cursor/` scaffolding deleted
25
+
26
+ ## [0.2.0] - 2026-04-18
27
+
28
+ ### Added
29
+ - Codex backend (`backends/codex.py`) — run benchmarks against Codex CLI alongside Claude
30
+ - `--agent` flag: `claude`, `codex`, or `both` for all run/tune commands
31
+ - `--order baseline-first|package-first` for crossover experimental design
32
+ - `scripts/run-suite-package-matrix.sh` — unified matrix runner across agents and packages
33
+ - `token-miser list` — shows available packages from the configured directory
34
+ - `--packages-dir` flag and `TOKEN_MISER_PACKAGES_DIR` env var for configurable package location
35
+ - `TOKEN_MISER_DB` env var override for database path (useful for CI isolation)
36
+ - `backend.estimate_cost(usage, model)` — per-backend cost estimation from token counts
37
+ - Claude pricing table in `ClaudeBackend` (haiku/sonnet/opus, cache-aware)
38
+ - 7 new packages: `caveman`, `c-structured`, `piersede`, `thinking-cap`, `planner`, `drona23`, `adversarial-frugal`
39
+ - 3 domain benchmark suites: `domain-python-api`, `domain-iac`, `domain-frontend` (24 tasks total)
40
+ - Axis suite: 8 tasks isolating distinct tool-interaction patterns
41
+ - `token-miser matrix` — cross-package comparison grid (text + JSON export)
42
+
43
+ ### Changed
44
+ - `loadouts/` directory renamed to `packages/` to align with kanon terminology
45
+ - Package names: `slim-rubin` → `lean`, `full-rubin` → `personal`
46
+ - `loadout` dependency now resolved from git URL (no local path required)
47
+
48
+ ### Fixed
49
+ - `--model` flag now propagates correctly through executor and run command
50
+ - `--skip-baseline` now fetches the previous session correctly
51
+ - Baseline temp directory no longer leaks on early-exit paths in tune.py
52
+
53
+ ## [0.1.0] - 2026-04-15
54
+
55
+ Initial Python release. Complete rewrite from Go.
56
+
57
+ ### Added
58
+ - `token-miser run` — execute a task under baseline and package configurations
59
+ - `token-miser compare` — side-by-side comparison of runs
60
+ - `token-miser analyze` — statistical summary (mean, stdev, median per package)
61
+ - `token-miser history` — list all recorded runs
62
+ - `token-miser show` — inspect a specific run in detail
63
+ - `token-miser tasks` — list available task YAML files
64
+ - `token-miser migrate` — initialize or migrate the database
65
+ - `token-miser tune` — automated package evaluation against benchmark suites
66
+ - `token-miser recommend` — generate package configuration recommendations from tune results
67
+ - SQLite persistence with automatic schema migration
68
+ - Three initial packages: `token-miser`, `thorough`, `tdd-strict`
69
+ - Kanon integration for distributing packages across machines
70
+ - LLM-as-judge quality scoring for task evaluation
71
+ - GitHub Actions CI
72
+ - Apache 2.0 license
73
+
74
+ ### Removed
75
+ - All Go code
@@ -0,0 +1,4 @@
1
+ @AGENTS.md
2
+
3
+ ## Claude Code
4
+ - Prefer preserving existing CLI text unless the feature requires a visible change.
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Rubin Johnson
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ # token_miser Memory
2
+
3
+ ## Packages
4
+
5
+ 24 packages in `packages/`: adversarial-frugal, async-first, c-structured, caveman, context-guardian, depth-control, domain-python-api, drona23, fail-smart, lean, minimal-wip, opportunistic-lazy, personal, phase-budget, piersede, planner, quality-floor, rtk, rubin, rubin-async, rubin-lazy, tdd-strict, thinking-cap, thorough, token-miser.
6
+