ctxcache 0.3.0__tar.gz → 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 (160) hide show
  1. {ctxcache-0.3.0 → ctxcache-0.4.0}/.github/workflows/ci.yml +6 -4
  2. {ctxcache-0.3.0 → ctxcache-0.4.0}/.github/workflows/contract.yml +1 -3
  3. ctxcache-0.4.0/CHANGELOG.md +8 -0
  4. {ctxcache-0.3.0 → ctxcache-0.4.0}/LICENSE +25 -0
  5. {ctxcache-0.3.0 → ctxcache-0.4.0}/PKG-INFO +49 -25
  6. {ctxcache-0.3.0 → ctxcache-0.4.0}/README.md +47 -23
  7. {ctxcache-0.3.0 → ctxcache-0.4.0}/ctxcache-synthesis.html +6 -6
  8. {ctxcache-0.3.0 → ctxcache-0.4.0}/ctxcache-v0.1-proof.html +2 -2
  9. {ctxcache-0.3.0 → ctxcache-0.4.0}/ctxcache-v0.1-proof.typescript +1 -1
  10. ctxcache-0.4.0/docs/ADOPTION_BASELINE.md +24 -0
  11. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/BENCH.md +2 -2
  12. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/BREAKS.md +2 -2
  13. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/BUILD_HANDBOOK.md +17 -17
  14. ctxcache-0.4.0/docs/CLAIMS.md +32 -0
  15. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/DECISIONS.md +1 -1
  16. ctxcache-0.4.0/docs/LIMITS.md +11 -0
  17. ctxcache-0.4.0/docs/PYPI.md +23 -0
  18. ctxcache-0.4.0/docs/REPRODUCE.md +21 -0
  19. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/STATUS.md +18 -18
  20. ctxcache-0.4.0/docs/hdiagrams/h3_call.svg +1 -0
  21. ctxcache-0.4.0/docs/media/ctxcache-cost-proof-preview.gif +0 -0
  22. ctxcache-0.4.0/docs/media/ctxcache-cost-proof.mp4 +0 -0
  23. ctxcache-0.4.0/examples/01_quickstart_openai.py +134 -0
  24. ctxcache-0.4.0/examples/02_fastapi_streaming_service.py +106 -0
  25. ctxcache-0.4.0/examples/03_opentelemetry_tracing.py +75 -0
  26. ctxcache-0.4.0/examples/README.md +29 -0
  27. ctxcache-0.4.0/examples/github-action/workflow.yml +16 -0
  28. ctxcache-0.4.0/experiments/2026-11-30-m4-sim/RECORD.md +8 -0
  29. ctxcache-0.4.0/experiments/2026-11-30-m4-sim/stdout.txt +99 -0
  30. ctxcache-0.4.0/experiments/RECORD_TEMPLATE.md +23 -0
  31. ctxcache-0.4.0/gtm/hdiagrams/g1_funnel.svg +1 -0
  32. {ctxcache-0.3.0 → ctxcache-0.4.0}/pyproject.toml +2 -2
  33. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/cli.py +116 -0
  34. ctxcache-0.4.0/src/ctxcache/demo.py +101 -0
  35. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/ledger.py +9 -0
  36. ctxcache-0.4.0/tests/fixtures/check_clean.py +26 -0
  37. ctxcache-0.4.0/tests/fixtures/check_reorder.py +31 -0
  38. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_bedrock_converse.py +1 -1
  39. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_cli.py +38 -0
  40. ctxcache-0.4.0/tests/test_observe_wire.py +201 -0
  41. {ctxcache-0.3.0 → ctxcache-0.4.0}/uv.lock +45 -45
  42. ctxcache-0.3.0/AGENTS.md +0 -1
  43. ctxcache-0.3.0/docs/hdiagrams/g1_funnel.svg +0 -1
  44. ctxcache-0.3.0/docs/media/ctxcache-cost-proof.mp4 +0 -0
  45. ctxcache-0.3.0/gtm/hdiagrams/h3_call.svg +0 -1
  46. {ctxcache-0.3.0 → ctxcache-0.4.0}/.githooks/pre-push +0 -0
  47. {ctxcache-0.3.0 → ctxcache-0.4.0}/.github/workflows/bedrock-probe.yml +0 -0
  48. {ctxcache-0.3.0 → ctxcache-0.4.0}/.github/workflows/live-session.yml +0 -0
  49. {ctxcache-0.3.0 → ctxcache-0.4.0}/.github/workflows/release.yml +0 -0
  50. {ctxcache-0.3.0 → ctxcache-0.4.0}/.gitignore +0 -0
  51. {ctxcache-0.3.0 → ctxcache-0.4.0}/CLAUDE.md +0 -0
  52. {ctxcache-0.3.0 → ctxcache-0.4.0}/DELIVERY.md +0 -0
  53. {ctxcache-0.3.0 → ctxcache-0.4.0}/Makefile +0 -0
  54. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/bedrock_probe.py +0 -0
  55. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live/2026-11-12-broad.json +0 -0
  56. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live/2026-11-12-tools.json +0 -0
  57. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live/2026-11-12.json +0 -0
  58. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live_broad.py +0 -0
  59. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live_session.py +0 -0
  60. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/live_summary.py +0 -0
  61. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m0/__init__.py +0 -0
  62. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m0/arms.py +0 -0
  63. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m0/runner.py +0 -0
  64. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m2/compaction_study.py +0 -0
  65. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m2/runner.py +0 -0
  66. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m3/runner.py +0 -0
  67. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m4/freeze_report.py +0 -0
  68. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m4/runner.py +0 -0
  69. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m5/runner.py +0 -0
  70. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/m6/runner.py +0 -0
  71. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/render_live.py +0 -0
  72. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/tasks/__init__.py +0 -0
  73. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/tasks/base.py +0 -0
  74. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/tasks/memory.py +0 -0
  75. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/tasks/mixed.py +0 -0
  76. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/tasks/registry.py +0 -0
  77. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/templates/__init__.py +0 -0
  78. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/templates/minimal.py +0 -0
  79. {ctxcache-0.3.0 → ctxcache-0.4.0}/bench/templates/typical.py +0 -0
  80. {ctxcache-0.3.0 → ctxcache-0.4.0}/ctxcache-live-session.html +0 -0
  81. {ctxcache-0.3.0 → ctxcache-0.4.0}/ctxcache-scenarios.html +0 -0
  82. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/METRICS.md +0 -0
  83. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/REPORT.md +0 -0
  84. {ctxcache-0.3.0/gtm → ctxcache-0.4.0/docs}/hdiagrams/g1_funnel.svg +0 -0
  85. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/hdiagrams/g2_flywheel.svg +0 -0
  86. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/hdiagrams/h1_arch.svg +0 -0
  87. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/hdiagrams/h2_layout.svg +0 -0
  88. {ctxcache-0.3.0 → ctxcache-0.4.0}/docs/hdiagrams/h4_plan.svg +0 -0
  89. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/CLAIMS.md +0 -0
  90. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/GTM_HANDBOOK.md +0 -0
  91. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/SCOREBOARD.md +0 -0
  92. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/hdiagrams/g2_flywheel.svg +0 -0
  93. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/hdiagrams/h1_arch.svg +0 -0
  94. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/hdiagrams/h2_layout.svg +0 -0
  95. {ctxcache-0.3.0/docs → ctxcache-0.4.0/gtm}/hdiagrams/h3_call.svg +0 -0
  96. {ctxcache-0.3.0 → ctxcache-0.4.0}/gtm/hdiagrams/h4_plan.svg +0 -0
  97. {ctxcache-0.3.0 → ctxcache-0.4.0}/prompts/BUILD_AGENT_PROMPT.md +0 -0
  98. {ctxcache-0.3.0 → ctxcache-0.4.0}/prompts/GTM_AGENT_PROMPT.md +0 -0
  99. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/__init__.py +0 -0
  100. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/__init__.py +0 -0
  101. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/anthropic.py +0 -0
  102. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/base.py +0 -0
  103. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/bedrock.py +0 -0
  104. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/gemini.py +0 -0
  105. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/adapters/openai.py +0 -0
  106. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/bedrock_converse.py +0 -0
  107. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/bench/__init__.py +0 -0
  108. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/bench/runner.py +0 -0
  109. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/compaction.py +0 -0
  110. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/cost.py +0 -0
  111. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/data/breaks.yaml +0 -0
  112. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/data/providers.toml +0 -0
  113. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/exceptions.py +0 -0
  114. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/fingerprint.py +0 -0
  115. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/guard.py +0 -0
  116. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/integrations/__init__.py +0 -0
  117. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/integrations/langchain.py +0 -0
  118. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/integrations/langgraph.py +0 -0
  119. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/integrations/openai_agents.py +0 -0
  120. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/integrations/pydantic_ai.py +0 -0
  121. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/layout.py +0 -0
  122. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/memory/__init__.py +0 -0
  123. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/memory/checks.py +0 -0
  124. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/memory/recall.py +0 -0
  125. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/memory/store.py +0 -0
  126. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/offload.py +0 -0
  127. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/openai_chat.py +0 -0
  128. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/otel.py +0 -0
  129. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/planner.py +0 -0
  130. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/policies/__init__.py +0 -0
  131. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/policies/route.py +0 -0
  132. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/replay.py +0 -0
  133. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/scenarios.py +0 -0
  134. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/segments.py +0 -0
  135. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/sim/__init__.py +0 -0
  136. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/sim/cache_sim.py +0 -0
  137. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/sim/tokens.py +0 -0
  138. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/testing.py +0 -0
  139. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/tools.py +0 -0
  140. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/trace.py +0 -0
  141. {ctxcache-0.3.0 → ctxcache-0.4.0}/src/ctxcache/wrapper.py +0 -0
  142. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/__init__.py +0 -0
  143. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_chat_optimize.py +0 -0
  144. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_compaction.py +0 -0
  145. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_contract.py +0 -0
  146. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_guard.py +0 -0
  147. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_integrations.py +0 -0
  148. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_invariants.py +0 -0
  149. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_live_summary.py +0 -0
  150. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_memory.py +0 -0
  151. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_named_tests_exist.py +0 -0
  152. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_otel.py +0 -0
  153. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_outbound.py +0 -0
  154. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_perf.py +0 -0
  155. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_planner.py +0 -0
  156. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_routing.py +0 -0
  157. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_scenarios.py +0 -0
  158. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_sim.py +0 -0
  159. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_stream.py +0 -0
  160. {ctxcache-0.3.0 → ctxcache-0.4.0}/tests/test_testing.py +0 -0
@@ -1,16 +1,18 @@
1
1
  name: check
2
2
 
3
+ # Once per night (~00:00 IST). Manual re-run via Actions tab.
3
4
  on:
4
- push:
5
- pull_request:
5
+ schedule:
6
+ - cron: "30 18 * * *"
7
+ workflow_dispatch:
6
8
 
7
9
  jobs:
8
10
  check:
9
11
  runs-on: ubuntu-latest
10
12
  strategy:
11
- fail-fast: false
13
+ fail-fast: true
12
14
  matrix:
13
- python-version: ["3.10", "3.11", "3.12"]
15
+ python-version: ["3.12"]
14
16
  steps:
15
17
  - uses: actions/checkout@v4
16
18
  - uses: astral-sh/setup-uv@v5
@@ -6,8 +6,6 @@ name: contract
6
6
  # before any model is called, and that stop is a success. A failed model
7
7
  # step does not block a retry the same day.
8
8
  on:
9
- schedule:
10
- - cron: "0 15 * * *"
11
9
  workflow_dispatch:
12
10
 
13
11
  permissions:
@@ -15,7 +13,7 @@ permissions:
15
13
  actions: read
16
14
 
17
15
  concurrency:
18
- group: hearth-contract
16
+ group: ctxcache-contract
19
17
  cancel-in-progress: false
20
18
 
21
19
  jobs:
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0
4
+
5
+ - `ctxcache demo` runs offline: three named cache breaks, a simulator price, then the fix.
6
+ - `ctxcache check` fails when a local run records a user-caused prefix break. An empty run fails unless `--allow-empty`.
7
+ - `ctxcache report` prints one row per turn from the ledger.
8
+ - README numbers are tagged in `docs/CLAIMS.md`. Limits are in `docs/LIMITS.md`.
@@ -174,3 +174,28 @@
174
174
  of your accepting any such warranty or additional liability.
175
175
 
176
176
  END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 CtxCache contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ctxcache
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Embeddable context engine that keeps an AI agent's prompt cache warm and proves it with measurements.
5
5
  Author-email: Abhranshu <abhranshu@atnms.ai>
6
6
  License-Expression: Apache-2.0
7
7
  License-File: LICENSE
8
- Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: Apache Software License
11
11
  Classifier: Programming Language :: Python :: 3
@@ -30,21 +30,36 @@ Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otel'
30
30
  Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
31
31
  Description-Content-Type: text/markdown
32
32
 
33
- # CtxCache (`ctxcache`)
33
+ # CtxCache
34
+
35
+ ```
36
+ ____ _______ ______ _ ____ _ _ _____
37
+ / ___|_ _\ \/ / ___| / \ / ___| | | | ____|
38
+ | | | | \ / | / _ \| | | |_| | _|
39
+ | |___ | | / \ |___ / ___ \ |___| _ | |___
40
+ \____| |_| /_/\_\____/_/ \_\____|_| |_|_____|
41
+ ```
34
42
 
35
43
  [![CI](https://github.com/jishmisc28/ctxcache/actions/workflows/ci.yml/badge.svg)](https://github.com/jishmisc28/ctxcache/actions)
36
44
  [![PyPI version](https://img.shields.io/pypi/v/ctxcache.svg)](https://pypi.org/project/ctxcache/)
37
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
45
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
38
46
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
39
47
 
48
+ **CtxCache** is an open source Python library that keeps an AI agent's prompt cache warm — in-process, not a gateway — and proves the bill with measurements. Every number on this page is tagged in [`docs/CLAIMS.md`](docs/CLAIMS.md). What is not proven is in [`docs/LIMITS.md`](docs/LIMITS.md).
49
+
40
50
  ## Proof video
41
51
 
42
- A clear measured proof film for CtxCache is being remade. Until it ships, see the live session numbers in [`docs/REPORT.md`](docs/REPORT.md) and [`bench/live/2026-11-12-broad.json`](bench/live/2026-11-12-broad.json) (Kimi K3: paid **$0.95546138**, uncached **$2.22368850**, saved **$1.26822712**).
52
+ LIVE, one Kimi K3 session: the standing document, no-cache vs cached cost, the break when the document changes, and the receipt — **paid $0.95546138** against **$2.22368850** uncached (**saved $1.26822712**). Source: [`bench/live/2026-11-12-broad.json`](bench/live/2026-11-12-broad.json).
53
+
54
+ [`bench/live/2026-11-12-tools.json`](bench/live/2026-11-12-tools.json) is the tool session: one tool description changed, and the cache-read count on that turn stayed high.
55
+
56
+ ![CtxCache measured proof](docs/media/ctxcache-cost-proof-preview.gif)
43
57
 
58
+ [Full MP4 (~81s)](docs/media/ctxcache-cost-proof.mp4) · [Release download](https://github.com/jishmisc28/ctxcache/releases/download/proof-video/ctxcache-cost-proof.mp4) · [Live session write-up](docs/REPORT.md)
44
59
 
45
60
  An embeddable context engine that keeps an AI agent's prompt cache warm and proves it with measurements.
46
61
 
47
- Prompt caching cuts LLM input cost and time-to-first-token (TTFT) by up to 90%, but agent loops routinely break provider caches on every turn: volatile timestamps prepended to system instructions, fluctuating tool definitions, non-deterministic JSON serialization, and uncompacted chat histories invalidate prefixes silently.
62
+ Agent loops break provider caches on later turns when a timestamp sits in the system prompt, tool definitions change order, JSON key order changes, or the history is rewritten. CtxCache wraps the client you already have, records the break, and can put the stable prefix back.
48
63
 
49
64
  CtxCache wraps your existing LLM client in-process, measures cache behavior, restores stable prefix layouts, protects against regressions in CI, and traces every cache break to its exact root cause.
50
65
 
@@ -52,22 +67,31 @@ CtxCache wraps your existing LLM client in-process, measures cache behavior, res
52
67
 
53
68
  ## Highlights
54
69
 
55
- - **Zero Required External Dependencies:** Pure Python standard library implementation on Python 3.11+ (`tomli` backport for 3.10).
56
- - **Sub-Millisecond Overhead:** Adds < 2.0 ms per call at 50,000 tokens of context (measured p50: **0.66 ms**, p99: **1.08 ms**; claim C-06).
57
- - **Comprehensive Break Taxonomy:** Identifies 15 distinct cache break causes and attributes fault honestly (never blames developers for provider cold starts, minimum-token thresholds, or TTL expirations; claim C-05).
58
- - **Proven Cost Savings:** Demonstrates a **42.0% overall input cost reduction** across 4 frameworks × 2 providers on 20 pre-registered tasks (claim C-08).
59
- - **Calibrated Offline Simulation:** Includes `FakeProvider` and `CacheSimulator` predicting per-session read share within **0.00 points MAE** on held-out sessions (claim C-07).
60
- - **One-Line Integration:** Drop-in adapters for LangGraph, Pydantic AI, and the OpenAI Agents SDK (claim C-10).
70
+ - **In process.** Pure Python. Requires Python 3.10+ (`tomli` on 3.10 only). No gateway.
71
+ - **SIM, not a bill.** The frozen simulator report is a **42.0%** input-cost reduction across 4 frameworks × 2 providers on 20 tasks. Source: [`docs/REPORT.md`](docs/REPORT.md) (2026-10-19).
72
+ - **SIM calibration.** Held-out read-share error in that same report is **0.00 points MAE**. That fit is not a forecast of a future provider bill.
73
+ - **MICROBENCH.** `tests/test_perf.py` checks that safe-mode work at about 50,000 tokens stays under 2 ms p50 and 5 ms p99. A status note recorded 0.66 ms p50 and 1.08 ms p99 on one machine with GC off. See [`docs/CLAIMS.md`](docs/CLAIMS.md).
74
+ - **15 break causes** in `src/ctxcache/data/breaks.yaml`. Cold starts, minimum length, and TTL expiry are not labeled as your bug.
61
75
 
62
76
  ---
63
77
 
64
78
  ## Installation
65
79
 
66
80
  ```bash
67
- pip install ctxcache
81
+ pip install "ctxcache @ git+https://github.com/jishmisc28/ctxcache.git@v0.4.0"
68
82
  ```
69
83
 
70
- See four cache failures without an API key. The prices are the simulator, not a provider bill.
84
+ PyPI still serves 0.3.0. That upload does not contain `ctxcache demo`. Use the command above until 0.4.0 is on PyPI.
85
+
86
+ Run this first. No API key and no network. The prices are the simulator, not a provider bill.
87
+
88
+ ```bash
89
+ ctxcache demo
90
+ ```
91
+
92
+ A CI job can run `ctxcache check` the same way, with no API key. The workflow file is [`examples/github-action/workflow.yml`](examples/github-action/workflow.yml).
93
+
94
+ The same offline prices, four named cases:
71
95
 
72
96
  ```bash
73
97
  ctxcache scenarios
@@ -114,7 +138,7 @@ client = ctxcache.wrap(Anthropic(), mode="safe")
114
138
 
115
139
  ### 3. `optimize` Mode (Active Context Engineering)
116
140
  Performs structured context layout optimizations:
117
- - **Volatile Relocation:** Relocates dynamic timestamps and runtime identifiers from the static system prefix to the user turn tail, converting 0% cache hits into 100% prefix reuse on subsequent turns.
141
+ - **Volatile Relocation:** Moves timestamps and runtime identifiers from the system prefix to the user turn. This is a layout change. It is not the 42.0% SIM figure and not the Kimi receipt.
118
142
  - **Large Output Offloading:** Stores tool outputs exceeding 2,000 tokens in a local blob store and passes a deterministic handle stub, keeping the prefix stable when frameworks resend full tool outputs.
119
143
  - **Planned History Compaction:** Compares the one-time summary rewrite penalty against expected remaining turns ($k^* \approx 8.0$ calls) to compact history only when it yields net cost savings (claim C-09).
120
144
 
@@ -161,34 +185,34 @@ set_default_openai_client(OpenAI())
161
185
 
162
186
  ## CLI & Tooling
163
187
 
164
- ### `hearth report`
188
+ ### `ctxcache report`
165
189
  Inspect aggregated cache performance, read share, and exact input dollar savings for a session from the SQLite ledger:
166
190
  ```bash
167
- hearth report --session "session-prod-worker-1"
191
+ ctxcache report --session "session-prod-worker-1"
168
192
  ```
169
193
 
170
- ### `hearth diagnose`
194
+ ### `ctxcache diagnose`
171
195
  Analyze root causes of cache breaks in a JSONL trace file:
172
196
  ```bash
173
- hearth diagnose ./traces/session.jsonl
197
+ ctxcache diagnose ./traces/session.jsonl
174
198
  ```
175
199
 
176
- ### `hearth replay`
200
+ ### `ctxcache replay`
177
201
  Replay recorded JSONL traces through the deterministic cache simulator under `observe`, `safe`, and `optimize` policies:
178
202
  ```bash
179
- hearth replay ./traces/session.jsonl
203
+ ctxcache replay ./traces/session.jsonl
180
204
  ```
181
205
 
182
- ### `hearth guard`
206
+ ### `ctxcache guard`
183
207
  Protect against prompt cache regressions in CI test suites. Fails if a code commit introduces user-caused prefix breaks:
184
208
  ```bash
185
- hearth guard --baseline ./traces/baseline.jsonl --run "pytest tests/agent/"
209
+ ctxcache guard --baseline ./traces/baseline.jsonl --run "pytest tests/agent/"
186
210
  ```
187
211
 
188
- ### `hearth bench --report`
212
+ ### `ctxcache bench --report`
189
213
  Reproduce the frozen Cache Efficiency Report v1 across all 20 pre-registered tasks:
190
214
  ```bash
191
- hearth bench --report
215
+ ctxcache bench --report
192
216
  ```
193
217
 
194
218
  ---
@@ -1,18 +1,33 @@
1
- # CtxCache (`ctxcache`)
1
+ # CtxCache
2
+
3
+ ```
4
+ ____ _______ ______ _ ____ _ _ _____
5
+ / ___|_ _\ \/ / ___| / \ / ___| | | | ____|
6
+ | | | | \ / | / _ \| | | |_| | _|
7
+ | |___ | | / \ |___ / ___ \ |___| _ | |___
8
+ \____| |_| /_/\_\____/_/ \_\____|_| |_|_____|
9
+ ```
2
10
 
3
11
  [![CI](https://github.com/jishmisc28/ctxcache/actions/workflows/ci.yml/badge.svg)](https://github.com/jishmisc28/ctxcache/actions)
4
12
  [![PyPI version](https://img.shields.io/pypi/v/ctxcache.svg)](https://pypi.org/project/ctxcache/)
5
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
13
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6
14
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
7
15
 
16
+ **CtxCache** is an open source Python library that keeps an AI agent's prompt cache warm — in-process, not a gateway — and proves the bill with measurements. Every number on this page is tagged in [`docs/CLAIMS.md`](docs/CLAIMS.md). What is not proven is in [`docs/LIMITS.md`](docs/LIMITS.md).
17
+
8
18
  ## Proof video
9
19
 
10
- A clear measured proof film for CtxCache is being remade. Until it ships, see the live session numbers in [`docs/REPORT.md`](docs/REPORT.md) and [`bench/live/2026-11-12-broad.json`](bench/live/2026-11-12-broad.json) (Kimi K3: paid **$0.95546138**, uncached **$2.22368850**, saved **$1.26822712**).
20
+ LIVE, one Kimi K3 session: the standing document, no-cache vs cached cost, the break when the document changes, and the receipt — **paid $0.95546138** against **$2.22368850** uncached (**saved $1.26822712**). Source: [`bench/live/2026-11-12-broad.json`](bench/live/2026-11-12-broad.json).
21
+
22
+ [`bench/live/2026-11-12-tools.json`](bench/live/2026-11-12-tools.json) is the tool session: one tool description changed, and the cache-read count on that turn stayed high.
23
+
24
+ ![CtxCache measured proof](docs/media/ctxcache-cost-proof-preview.gif)
11
25
 
26
+ [Full MP4 (~81s)](docs/media/ctxcache-cost-proof.mp4) · [Release download](https://github.com/jishmisc28/ctxcache/releases/download/proof-video/ctxcache-cost-proof.mp4) · [Live session write-up](docs/REPORT.md)
12
27
 
13
28
  An embeddable context engine that keeps an AI agent's prompt cache warm and proves it with measurements.
14
29
 
15
- Prompt caching cuts LLM input cost and time-to-first-token (TTFT) by up to 90%, but agent loops routinely break provider caches on every turn: volatile timestamps prepended to system instructions, fluctuating tool definitions, non-deterministic JSON serialization, and uncompacted chat histories invalidate prefixes silently.
30
+ Agent loops break provider caches on later turns when a timestamp sits in the system prompt, tool definitions change order, JSON key order changes, or the history is rewritten. CtxCache wraps the client you already have, records the break, and can put the stable prefix back.
16
31
 
17
32
  CtxCache wraps your existing LLM client in-process, measures cache behavior, restores stable prefix layouts, protects against regressions in CI, and traces every cache break to its exact root cause.
18
33
 
@@ -20,22 +35,31 @@ CtxCache wraps your existing LLM client in-process, measures cache behavior, res
20
35
 
21
36
  ## Highlights
22
37
 
23
- - **Zero Required External Dependencies:** Pure Python standard library implementation on Python 3.11+ (`tomli` backport for 3.10).
24
- - **Sub-Millisecond Overhead:** Adds < 2.0 ms per call at 50,000 tokens of context (measured p50: **0.66 ms**, p99: **1.08 ms**; claim C-06).
25
- - **Comprehensive Break Taxonomy:** Identifies 15 distinct cache break causes and attributes fault honestly (never blames developers for provider cold starts, minimum-token thresholds, or TTL expirations; claim C-05).
26
- - **Proven Cost Savings:** Demonstrates a **42.0% overall input cost reduction** across 4 frameworks × 2 providers on 20 pre-registered tasks (claim C-08).
27
- - **Calibrated Offline Simulation:** Includes `FakeProvider` and `CacheSimulator` predicting per-session read share within **0.00 points MAE** on held-out sessions (claim C-07).
28
- - **One-Line Integration:** Drop-in adapters for LangGraph, Pydantic AI, and the OpenAI Agents SDK (claim C-10).
38
+ - **In process.** Pure Python. Requires Python 3.10+ (`tomli` on 3.10 only). No gateway.
39
+ - **SIM, not a bill.** The frozen simulator report is a **42.0%** input-cost reduction across 4 frameworks × 2 providers on 20 tasks. Source: [`docs/REPORT.md`](docs/REPORT.md) (2026-10-19).
40
+ - **SIM calibration.** Held-out read-share error in that same report is **0.00 points MAE**. That fit is not a forecast of a future provider bill.
41
+ - **MICROBENCH.** `tests/test_perf.py` checks that safe-mode work at about 50,000 tokens stays under 2 ms p50 and 5 ms p99. A status note recorded 0.66 ms p50 and 1.08 ms p99 on one machine with GC off. See [`docs/CLAIMS.md`](docs/CLAIMS.md).
42
+ - **15 break causes** in `src/ctxcache/data/breaks.yaml`. Cold starts, minimum length, and TTL expiry are not labeled as your bug.
29
43
 
30
44
  ---
31
45
 
32
46
  ## Installation
33
47
 
34
48
  ```bash
35
- pip install ctxcache
49
+ pip install "ctxcache @ git+https://github.com/jishmisc28/ctxcache.git@v0.4.0"
36
50
  ```
37
51
 
38
- See four cache failures without an API key. The prices are the simulator, not a provider bill.
52
+ PyPI still serves 0.3.0. That upload does not contain `ctxcache demo`. Use the command above until 0.4.0 is on PyPI.
53
+
54
+ Run this first. No API key and no network. The prices are the simulator, not a provider bill.
55
+
56
+ ```bash
57
+ ctxcache demo
58
+ ```
59
+
60
+ A CI job can run `ctxcache check` the same way, with no API key. The workflow file is [`examples/github-action/workflow.yml`](examples/github-action/workflow.yml).
61
+
62
+ The same offline prices, four named cases:
39
63
 
40
64
  ```bash
41
65
  ctxcache scenarios
@@ -82,7 +106,7 @@ client = ctxcache.wrap(Anthropic(), mode="safe")
82
106
 
83
107
  ### 3. `optimize` Mode (Active Context Engineering)
84
108
  Performs structured context layout optimizations:
85
- - **Volatile Relocation:** Relocates dynamic timestamps and runtime identifiers from the static system prefix to the user turn tail, converting 0% cache hits into 100% prefix reuse on subsequent turns.
109
+ - **Volatile Relocation:** Moves timestamps and runtime identifiers from the system prefix to the user turn. This is a layout change. It is not the 42.0% SIM figure and not the Kimi receipt.
86
110
  - **Large Output Offloading:** Stores tool outputs exceeding 2,000 tokens in a local blob store and passes a deterministic handle stub, keeping the prefix stable when frameworks resend full tool outputs.
87
111
  - **Planned History Compaction:** Compares the one-time summary rewrite penalty against expected remaining turns ($k^* \approx 8.0$ calls) to compact history only when it yields net cost savings (claim C-09).
88
112
 
@@ -129,34 +153,34 @@ set_default_openai_client(OpenAI())
129
153
 
130
154
  ## CLI & Tooling
131
155
 
132
- ### `hearth report`
156
+ ### `ctxcache report`
133
157
  Inspect aggregated cache performance, read share, and exact input dollar savings for a session from the SQLite ledger:
134
158
  ```bash
135
- hearth report --session "session-prod-worker-1"
159
+ ctxcache report --session "session-prod-worker-1"
136
160
  ```
137
161
 
138
- ### `hearth diagnose`
162
+ ### `ctxcache diagnose`
139
163
  Analyze root causes of cache breaks in a JSONL trace file:
140
164
  ```bash
141
- hearth diagnose ./traces/session.jsonl
165
+ ctxcache diagnose ./traces/session.jsonl
142
166
  ```
143
167
 
144
- ### `hearth replay`
168
+ ### `ctxcache replay`
145
169
  Replay recorded JSONL traces through the deterministic cache simulator under `observe`, `safe`, and `optimize` policies:
146
170
  ```bash
147
- hearth replay ./traces/session.jsonl
171
+ ctxcache replay ./traces/session.jsonl
148
172
  ```
149
173
 
150
- ### `hearth guard`
174
+ ### `ctxcache guard`
151
175
  Protect against prompt cache regressions in CI test suites. Fails if a code commit introduces user-caused prefix breaks:
152
176
  ```bash
153
- hearth guard --baseline ./traces/baseline.jsonl --run "pytest tests/agent/"
177
+ ctxcache guard --baseline ./traces/baseline.jsonl --run "pytest tests/agent/"
154
178
  ```
155
179
 
156
- ### `hearth bench --report`
180
+ ### `ctxcache bench --report`
157
181
  Reproduce the frozen Cache Efficiency Report v1 across all 20 pre-registered tasks:
158
182
  ```bash
159
- hearth bench --report
183
+ ctxcache bench --report
160
184
  ```
161
185
 
162
186
  ---
@@ -266,7 +266,7 @@
266
266
  <p class="kicker">CtxCache · synthesis · 20 October 2026</p>
267
267
  <h1>What this project is, in language you can reason with</h1>
268
268
  <p class="lede">CtxCache is a Python library that sits inside an agent’s own process, on the path between the agent’s code and the model company. On every call it keeps the stable beginning of the prompt identical, records what the cache did, and — only if you ask — moves the bits that would have broken that cache.</p>
269
- <p class="meta">Package <code>ctxcache</code>, import <code>hearth</code>, version <code>0.1.0b1</code>. Public repo <code>jishmisc28/ctxcache</code>. Tag on GitHub: <code>0.1.0a1</code>. Not on PyPI. Written 19 October 2026. This page is a reading copy of the code and the status log, dated 20 October 2026.</p>
269
+ <p class="meta">Package <code>ctxcache</code>, import <code>ctxcache</code>, version <code>0.1.0b1</code>. Public repo <code>jishmisc28/ctxcache</code>. Tag on GitHub: <code>0.1.0a1</code>. Not on PyPI. Written 19 October 2026. This page is a reading copy of the code and the status log, dated 20 October 2026.</p>
270
270
 
271
271
  <h2 id="idea">The idea</h2>
272
272
  <p>An agent is a loop. Step 30 sends the system instructions, the tool definitions, and every earlier message again, then adds one new piece. The model company already saw the beginning of that text. If the beginning is byte-for-byte the same, they charge about a tenth of the normal input price for it, and the first token often arrives sooner. If one byte near the start changes, they charge full price for everything after it.</p>
@@ -403,7 +403,7 @@
403
403
  <div class="entity">
404
404
  <h3>Simulator, fake provider, bench, replay, guard</h3>
405
405
  <span class="file">src/ctxcache/sim/ · src/ctxcache/testing.py · src/ctxcache/replay.py · src/ctxcache/cli.py</span>
406
- <p><code>FakeProvider</code> returns canned SDK-shaped responses and invents usage numbers from the same rules as <code>providers.toml</code>, so tests need no API key. The simulator replays a trace and predicts read share. <code>hearth replay</code> runs a trace through observe, safe, and optimize and prints cost. <code>hearth guard</code> fails a CI run when a new user-caused break appears against a baseline. <code>hearth report</code> and <code>hearth diagnose</code> read a session and explain the cause.</p>
406
+ <p><code>FakeProvider</code> returns canned SDK-shaped responses and invents usage numbers from the same rules as <code>providers.toml</code>, so tests need no API key. The simulator replays a trace and predicts read share. <code>ctxcache replay</code> runs a trace through observe, safe, and optimize and prints cost. <code>ctxcache guard</code> fails a CI run when a new user-caused break appears against a baseline. <code>ctxcache report</code> and <code>ctxcache diagnose</code> read a session and explain the cause.</p>
407
407
  </div>
408
408
  <div class="entity">
409
409
  <h3>Framework adapters</h3>
@@ -442,7 +442,7 @@
442
442
  <tr><td class="status wait">M7</td><td>License, README, a latency microbench, providers file re-dated.</td><td>Docs are done. Release is waiting. See the last section.</td></tr>
443
443
  </tbody>
444
444
  </table>
445
- <p>Overhead measured in-process, with garbage collection paused for the timing loop: median 0.66 ms and 99th percentile 1.08 ms at about 50,000 tokens of context. The budget was 2 ms and 5 ms. That number is CPU time inside Hearth, not time-to-first-token from a provider.</p>
445
+ <p>Overhead measured in-process, with garbage collection paused for the timing loop: median 0.66 ms and 99th percentile 1.08 ms at about 50,000 tokens of context. The budget was 2 ms and 5 ms. That number is CPU time inside CtxCache, not time-to-first-token from a provider.</p>
446
446
 
447
447
  <h2 id="made">How it was made</h2>
448
448
  <ul>
@@ -459,9 +459,9 @@
459
459
  <li>Wrap a Gemini, OpenAI, or Anthropic client and leave the request untouched while recording cache accounting.</li>
460
460
  <li>Wrap it in safe mode and have tool order restored when the same tools come back shuffled.</li>
461
461
  <li>Wrap it in optimize mode and have timestamp-like lines moved out of the system prompt.</li>
462
- <li>Ask, after a session, what broke the prefix and what it cost, with <code>hearth report</code> and <code>hearth diagnose</code>.</li>
462
+ <li>Ask, after a session, what broke the prefix and what it cost, with <code>ctxcache report</code> and <code>ctxcache diagnose</code>.</li>
463
463
  <li>Replay a trace offline through the three modes.</li>
464
- <li>Fail a test run when a new user-caused break shows up, with <code>hearth guard</code>.</li>
464
+ <li>Fail a test run when a new user-caused break shows up, with <code>ctxcache guard</code>.</li>
465
465
  <li>Store facts that supersede instead of overwrite, and that refuse secrets and instruction-override text.</li>
466
466
  <li>Ask whether staying, switching, or delegating is the cheaper next step, given the price table and the remaining calls.</li>
467
467
  <li>Drop the same wrap into LangGraph, Pydantic AI, or the OpenAI Agents SDK without those libraries becoming dependencies of CtxCache itself.</li>
@@ -469,7 +469,7 @@
469
469
 
470
470
  <h2 id="numbers">How to read the numbers</h2>
471
471
  <div class="callout amber">
472
- <p>The 42% cost reduction, the 49% read share, the 18% routing saving, and the 0.00 calibration error are outputs of Hearth’s own simulator and fake provider. <code>docs/BENCH.md</code> records $0.00 of provider spend. No live kill test has been logged. The calibration error of zero is the simulator agreeing with itself.</p>
472
+ <p>The 42% cost reduction, the 49% read share, the 18% routing saving, and the 0.00 calibration error are outputs of CtxCache’s own simulator and fake provider. <code>docs/BENCH.md</code> records $0.00 of provider spend. No live kill test has been logged. The calibration error of zero is the simulator agreeing with itself.</p>
473
473
  </div>
474
474
  <p>The report file also prints the same read share and the same dollar figures for every framework row. That is what you get when one layout scenario is scored four times, not when four real agents were run on two companies’ APIs. The handbook’s kill test was three live runs per task per arm, on named models, with the spend written down. That run is the measurement that would turn the 42% into a claim.</p>
475
475
  <p>The local tests are a different kind of evidence, and they are real: the identity rules, the usage arithmetic, the fail-open path, and the decimal costs were executed on 19 October and passed. They prove the library behaves as specified against fixtures. They do not prove a provider bill moved.</p>
@@ -1036,9 +1036,9 @@ ls: .github/workflows: No such file or directory</pre>
1036
1036
  2. `minimal`: Hand-cleaned prompt layout with static prefix and dynamic turn context in user messages.
1037
1037
  - **Four Experimental Arms:**
1038
1038
  - **Arm A (`stock`)**: Unmodified agent template (`observe` mode).
1039
- - **Arm B (`hearth-safe`)**: `ctxcache.wrap(client, mode="safe")` — deterministic tool order restoration + cache breakpoints, zero content modification.
1039
+ - **Arm B (`ctxcache-safe`)**: `ctxcache.wrap(client, mode="safe")` — deterministic tool order restoration + cache breakpoints, zero content modification.
1040
1040
  - **Arm C (`naive-compact`)**: Summarizes conversation every 5 turns.
1041
- - **Arm D (`hearth-optimize`)**: `ctxcache.wrap(client, mode="optimize")` — relocates volatile system fields to turn tail, offloads large tool outputs, and protects prefix.
1041
+ - **Arm D (`ctxcache-optimize`)**: `ctxcache.wrap(client, mode="optimize")` — relocates volatile system fields to turn tail, offloads large tool outputs, and protects prefix.
1042
1042
  - **Task Suite:** 20 multi-turn software engineering &amp; tool-use tasks (8–20 turns each, 3 runs per cell).
1043
1043
 
1044
1044
  ---
@@ -1,4 +1,4 @@
1
- === HEARTH v0.1 OFFLINE DEMO RECORDING (2026-10-23T02:14:34Z) ===
1
+ === CTXCACHE v0.1 OFFLINE DEMO RECORDING (2026-10-23T02:14:34Z) ===
2
2
 
3
3
  --- [Check 3] observe mode byte-identical passthrough ---
4
4
  IN_BYTES : {"messages": [{"content": "Hello world", "role": "user"}], "model": "claude-3-5-sonnet-20241022", "session_id": "demo-observe", "system": "You are a precise assistant.\nTimestamp: 2026-10-23T02:00:00Z", "tools": [{"description": "Z", "name": "z_tool"}, {"description": "A", "name": "a_tool"}]}
@@ -0,0 +1,24 @@
1
+ # Adoption baseline
2
+
3
+ Measured 2026-11-30. A later edit adds a new dated row. It does not rewrite this one.
4
+
5
+ | Date | Stars | Forks | Open issues | Contributors | PyPI version | pypistats recent |
6
+ |---|---|---|---|---|---|---|
7
+ | 2026-11-30 | 8 | 4 | 0 | 1 (`jishmisc28`) | 0.3.0, uploaded 2026-11-23T08:12:20Z | last_day 1, last_week 117, last_month 117 |
8
+
9
+ Sources for that row:
10
+
11
+ - `GET /repos/jishmisc28/ctxcache`: stars 8, forks 4. The same object’s `open_issues_count` was 4. Those 4 are pull requests 4, 5, 6, and 7. Issue search `is:issue is:open` returned 0.
12
+ - `GET /repos/jishmisc28/ctxcache/contributors` returned one login, `jishmisc28`.
13
+ - PyPI JSON `https://pypi.org/pypi/ctxcache/json`: version 0.3.0, wheel and sdist `upload_time` 2026-11-23T08:12:20Z and 2026-11-23T08:12:21Z.
14
+ - `https://pypistats.org/api/packages/ctxcache/recent`: `{"last_day":1,"last_month":117,"last_week":117}`.
15
+
16
+ Import search the same day:
17
+
18
+ - GitHub code search `ctxcache` in `pyproject.toml`: 0 files.
19
+ - GitHub code search `ctxcache` in `requirements.txt`: 0 files.
20
+ - `Clawdlinux/atticdb` has a directory `research/ctxcache/` that imports `research.ctxcache`. That is not this package.
21
+
22
+ No external importers found.
23
+
24
+ Zenodo record 24462335 (`10.5281/zenodo.24462335`), same day, `stats` from the record API: downloads 8, unique_downloads 8, views 8, unique_views 8. A view is not a citation.
@@ -16,8 +16,8 @@ Tracks live provider calls, token totals, and spend against approved budget (D-0
16
16
  | 2026-11-02 | bedrock-gptoss-stable-1 | Amazon Bedrock Chat Completions | openai.gpt-oss-120b-1:0 | 1699 | 0 (field absent) | 8 | 0.00025965 | 0.00029145 |
17
17
  | 2026-11-02 | bedrock-gptoss-stable-2 | Amazon Bedrock Chat Completions | openai.gpt-oss-120b-1:0 | 1699 | 0 (field absent) | 8 | 0.00025965 | 0.00055110 |
18
18
  | 2026-11-02 | bedrock-gptoss-clock | Amazon Bedrock Chat Completions | openai.gpt-oss-120b-1:0 | 1716 | 0 (field absent) | 8 | 0.00026220 | 0.00081330 |
19
- | 2026-11-02 | bedrock-hearth-observe | Amazon Bedrock via ctxcache.wrap observe | openai.gpt-oss-120b-1:0 | 102 | 0 (field absent) | 8 | 0.00002010 | 0.00083340 |
20
- | 2026-11-02 | bedrock-hearth-optimize | Amazon Bedrock via ctxcache.wrap optimize | openai.gpt-oss-120b-1:0 | 106 | 0 (field absent) | 8 | 0.00002070 | 0.00085410 |
19
+ | 2026-11-02 | bedrock-ctxcache-observe | Amazon Bedrock via ctxcache.wrap observe | openai.gpt-oss-120b-1:0 | 102 | 0 (field absent) | 8 | 0.00002010 | 0.00083340 |
20
+ | 2026-11-02 | bedrock-ctxcache-optimize | Amazon Bedrock via ctxcache.wrap optimize | openai.gpt-oss-120b-1:0 | 106 | 0 (field absent) | 8 | 0.00002070 | 0.00085410 |
21
21
  | 2026-11-02 | bedrock-nova-write | Amazon Bedrock Converse | amazon.nova-micro-v1:0 | 2407 | 0 read, 2401 written | 2 | 0.00000049 | 0.00085459 |
22
22
  | 2026-11-02 | bedrock-nova-read | Amazon Bedrock Converse | amazon.nova-micro-v1:0 | 2407 | 2401 | 2 | 0.00002150 | 0.00087609 |
23
23
  | 2026-11-02 | bedrock-nova-wrap-write | ctxcache.wrap observe, Converse | amazon.nova-micro-v1:0 | 3607 | 0 read, 3601 written | 2 | 0.00000049 | 0.00087658 |
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generated from `src/ctxcache/data/breaks.yaml` per `BUILD_HANDBOOK.md` §5.2 and Milestone 2.
4
4
 
5
- Hearth's `PrefixGuard` inspects successive API calls in a session, compares prompt prefix tokens against prior turns, and evaluates divergence causes **in strict precedence order** (first match wins).
5
+ CtxCache's `PrefixGuard` inspects successive API calls in a session, compares prompt prefix tokens against prior turns, and evaluates divergence causes **in strict precedence order** (first match wins).
6
6
 
7
7
  ---
8
8
 
@@ -54,7 +54,7 @@ When evaluating developer metrics:
54
54
  ### 3. `ttl_expired`
55
55
  - **Condition**: Idle duration between consecutive turn invocations exceeds provider cache TTL (e.g. 5 minutes).
56
56
  - **Impact**: Cold cache miss on all prefix tokens.
57
- - **Remediation**: Use Hearth's 1-hour TTL on stable breakpoints or application `s.expect_pause()` hints before long human approvals.
57
+ - **Remediation**: Use CtxCache's 1-hour TTL on stable breakpoints or application `s.expect_pause()` hints before long human approvals.
58
58
 
59
59
  ### 4. `provider_miss`
60
60
  - **Condition**: Exact byte-identical prefix submitted within TTL window, yet provider reported `read_tokens == 0`.