local-context-compiler 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 (285) hide show
  1. local_context_compiler-0.4.0/CHANGELOG.md +225 -0
  2. local_context_compiler-0.4.0/CODE_OF_CONDUCT.md +36 -0
  3. local_context_compiler-0.4.0/CONTRIBUTING.md +57 -0
  4. local_context_compiler-0.4.0/LICENSE +21 -0
  5. local_context_compiler-0.4.0/MANIFEST.in +25 -0
  6. local_context_compiler-0.4.0/PKG-INFO +683 -0
  7. local_context_compiler-0.4.0/README.md +637 -0
  8. local_context_compiler-0.4.0/SECURITY.md +43 -0
  9. local_context_compiler-0.4.0/act2_router/__init__.py +4 -0
  10. local_context_compiler-0.4.0/act2_router/cli.py +6 -0
  11. local_context_compiler-0.4.0/act2_router/config.py +3 -0
  12. local_context_compiler-0.4.0/act2_router/errors.py +3 -0
  13. local_context_compiler-0.4.0/act2_router/eval_runner.py +3 -0
  14. local_context_compiler-0.4.0/act2_router/features.py +3 -0
  15. local_context_compiler-0.4.0/act2_router/final_formatter.py +3 -0
  16. local_context_compiler-0.4.0/act2_router/fireworks_client.py +3 -0
  17. local_context_compiler-0.4.0/act2_router/lcc_adapter.py +3 -0
  18. local_context_compiler-0.4.0/act2_router/local_agent.py +3 -0
  19. local_context_compiler-0.4.0/act2_router/local_solver.py +3 -0
  20. local_context_compiler-0.4.0/act2_router/local_verifier.py +3 -0
  21. local_context_compiler-0.4.0/act2_router/policy.py +3 -0
  22. local_context_compiler-0.4.0/act2_router/prompt_builder.py +3 -0
  23. local_context_compiler-0.4.0/act2_router/router.py +3 -0
  24. local_context_compiler-0.4.0/act2_router/schemas.py +3 -0
  25. local_context_compiler-0.4.0/act2_router/token_accounting.py +3 -0
  26. local_context_compiler-0.4.0/benchmarks/README.md +103 -0
  27. local_context_compiler-0.4.0/benchmarks/cases/approximate_token_fallback/case.yaml +16 -0
  28. local_context_compiler-0.4.0/benchmarks/cases/approximate_token_fallback/input.txt +7 -0
  29. local_context_compiler-0.4.0/benchmarks/cases/basic_redundancy/case.yaml +16 -0
  30. local_context_compiler-0.4.0/benchmarks/cases/basic_redundancy/input.txt +11 -0
  31. local_context_compiler-0.4.0/benchmarks/cases/boilerplate_cleanup/case.yaml +19 -0
  32. local_context_compiler-0.4.0/benchmarks/cases/boilerplate_cleanup/input.txt +15 -0
  33. local_context_compiler-0.4.0/benchmarks/cases/evidence_preservation/case.yaml +18 -0
  34. local_context_compiler-0.4.0/benchmarks/cases/evidence_preservation/input.txt +13 -0
  35. local_context_compiler-0.4.0/benchmarks/cases/prepare_lexical_selection/case.yaml +23 -0
  36. local_context_compiler-0.4.0/benchmarks/cases/prepare_lexical_selection/input.txt +19 -0
  37. local_context_compiler-0.4.0/benchmarks/cases/prepare_no_selection/case.yaml +21 -0
  38. local_context_compiler-0.4.0/benchmarks/cases/prepare_no_selection/input.txt +13 -0
  39. local_context_compiler-0.4.0/benchmarks/research/README.md +746 -0
  40. local_context_compiler-0.4.0/benchmarks/research/RESEARCH_STATUS.md +172 -0
  41. local_context_compiler-0.4.0/benchmarks/research/USE_CASES.md +195 -0
  42. local_context_compiler-0.4.0/benchmarks/research/VERIFY_WITH_REAL_KEY.md +64 -0
  43. local_context_compiler-0.4.0/benchmarks/research/adversarial/contradiction_same_metric.md +32 -0
  44. local_context_compiler-0.4.0/benchmarks/research/adversarial/coreference_resolution.md +32 -0
  45. local_context_compiler-0.4.0/benchmarks/research/adversarial/dependency_causal.md +32 -0
  46. local_context_compiler-0.4.0/benchmarks/research/adversarial/dependency_qualifier.md +32 -0
  47. local_context_compiler-0.4.0/benchmarks/research/adversarial/double_negation.md +28 -0
  48. local_context_compiler-0.4.0/benchmarks/research/adversarial/injection_html.md +28 -0
  49. local_context_compiler-0.4.0/benchmarks/research/adversarial/injection_log.md +28 -0
  50. local_context_compiler-0.4.0/benchmarks/research/adversarial/many_short_blocks.md +50 -0
  51. local_context_compiler-0.4.0/benchmarks/research/adversarial/multiblock_vat_set.md +40 -0
  52. local_context_compiler-0.4.0/benchmarks/research/adversarial/multilingual.md +28 -0
  53. local_context_compiler-0.4.0/benchmarks/research/adversarial/negation_consent.md +32 -0
  54. local_context_compiler-0.4.0/benchmarks/research/adversarial/numeric_precision.md +32 -0
  55. local_context_compiler-0.4.0/benchmarks/research/adversarial/paraphrase_duplicates.md +32 -0
  56. local_context_compiler-0.4.0/benchmarks/research/adversarial/prompt_injection.md +32 -0
  57. local_context_compiler-0.4.0/benchmarks/research/adversarial/qualifier_truncation.md +28 -0
  58. local_context_compiler-0.4.0/benchmarks/research/adversarial/qualifier_unless.md +28 -0
  59. local_context_compiler-0.4.0/benchmarks/research/adversarial/quoted_instruction.md +28 -0
  60. local_context_compiler-0.4.0/benchmarks/research/adversarial/scope_quantifiers.md +32 -0
  61. local_context_compiler-0.4.0/benchmarks/research/adversarial/source_authority_conflict.md +32 -0
  62. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_code.md +36 -0
  63. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_json.md +28 -0
  64. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_semantic_json.md +36 -0
  65. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_semantic_units.md +52 -0
  66. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_table.md +33 -0
  67. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_xml.md +28 -0
  68. local_context_compiler-0.4.0/benchmarks/research/adversarial/structured_yaml.md +34 -0
  69. local_context_compiler-0.4.0/benchmarks/research/adversarial/temporal_supersession.md +36 -0
  70. local_context_compiler-0.4.0/benchmarks/research/adversarial/unicode_content.md +28 -0
  71. local_context_compiler-0.4.0/benchmarks/research/adversarial/unit_conversion.md +28 -0
  72. local_context_compiler-0.4.0/benchmarks/research/adversarial/very_long_block.md +28 -0
  73. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_jev_1.txt +5 -0
  74. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_jev_2.txt +5 -0
  75. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_jev_3.txt +5 -0
  76. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_optimize_1.txt +5 -0
  77. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_optimize_2.txt +5 -0
  78. local_context_compiler-0.4.0/benchmarks/research/answers/lcc_optimize_3.txt +5 -0
  79. local_context_compiler-0.4.0/benchmarks/research/answers/raw_1.txt +5 -0
  80. local_context_compiler-0.4.0/benchmarks/research/answers/raw_2.txt +5 -0
  81. local_context_compiler-0.4.0/benchmarks/research/answers/raw_3.txt +5 -0
  82. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_jev_1.txt +5 -0
  83. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_jev_2.txt +5 -0
  84. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_jev_3.txt +5 -0
  85. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_optimize_1.txt +5 -0
  86. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_optimize_2.txt +5 -0
  87. local_context_compiler-0.4.0/benchmarks/research/answers_after/lcc_optimize_3.txt +5 -0
  88. local_context_compiler-0.4.0/benchmarks/research/answers_after/raw_1.txt +5 -0
  89. local_context_compiler-0.4.0/benchmarks/research/answers_after/raw_2.txt +5 -0
  90. local_context_compiler-0.4.0/benchmarks/research/answers_after/raw_3.txt +5 -0
  91. local_context_compiler-0.4.0/benchmarks/research/corpora/large.md +788 -0
  92. local_context_compiler-0.4.0/benchmarks/research/corpora/large.task.md +10 -0
  93. local_context_compiler-0.4.0/benchmarks/research/corpora/medium.md +308 -0
  94. local_context_compiler-0.4.0/benchmarks/research/corpora/medium.task.md +10 -0
  95. local_context_compiler-0.4.0/benchmarks/research/corpora/small.md +84 -0
  96. local_context_compiler-0.4.0/benchmarks/research/corpora/small.task.md +10 -0
  97. local_context_compiler-0.4.0/benchmarks/research/corpora/xl.md +2988 -0
  98. local_context_compiler-0.4.0/benchmarks/research/corpora/xl.task.md +10 -0
  99. local_context_compiler-0.4.0/benchmarks/research/results/lcc_bench_deterministic.md +19 -0
  100. local_context_compiler-0.4.0/config/default.yaml +24 -0
  101. local_context_compiler-0.4.0/config/pricing.yaml +103 -0
  102. local_context_compiler-0.4.0/configs/models.yaml +16 -0
  103. local_context_compiler-0.4.0/configs/router_policy.yaml +43 -0
  104. local_context_compiler-0.4.0/docker/Dockerfile +16 -0
  105. local_context_compiler-0.4.0/docker/entrypoint.sh +4 -0
  106. local_context_compiler-0.4.0/docs/CACHE_ALIGNMENT.md +158 -0
  107. local_context_compiler-0.4.0/docs/FIREWORKS.md +19 -0
  108. local_context_compiler-0.4.0/docs/LAYA.md +169 -0
  109. local_context_compiler-0.4.0/docs/LOCAL_AGENT_GUIDE.md +145 -0
  110. local_context_compiler-0.4.0/docs/LOCAL_MODEL.md +24 -0
  111. local_context_compiler-0.4.0/docs/MCP.md +87 -0
  112. local_context_compiler-0.4.0/docs/QUICKSTART.md +82 -0
  113. local_context_compiler-0.4.0/docs/ROUTING_POLICY.md +36 -0
  114. local_context_compiler-0.4.0/docs/adr/0001-schema-contracts.md +15 -0
  115. local_context_compiler-0.4.0/docs/adr/0002-module-boundaries.md +15 -0
  116. local_context_compiler-0.4.0/docs/adr/0003-cli-contract.md +15 -0
  117. local_context_compiler-0.4.0/docs/adr/0004-report-schema-versioning.md +12 -0
  118. local_context_compiler-0.4.0/docs/adr/0005-tokenization-boundary.md +15 -0
  119. local_context_compiler-0.4.0/docs/adr/0006-determinism-boundary.md +14 -0
  120. local_context_compiler-0.4.0/docs/adr/0007-deterministic-benchmark-harness.md +48 -0
  121. local_context_compiler-0.4.0/docs/adr/0008-tokenizer-network-boundary.md +46 -0
  122. local_context_compiler-0.4.0/docs/adr/0009-inspection-command-boundary.md +58 -0
  123. local_context_compiler-0.4.0/docs/adr/0010-deterministic-first-preparation-model-assistance.md +58 -0
  124. local_context_compiler-0.4.0/docs/adr/0011-phase-2-opt-in-semantic-retrieval-boundary.md +184 -0
  125. local_context_compiler-0.4.0/docs/adr/0012-semantic-retrieval-execution-boundary.md +244 -0
  126. local_context_compiler-0.4.0/docs/adr/0013-instant-relevance-compaction-boundary.md +65 -0
  127. local_context_compiler-0.4.0/docs/adr/0014-minimum-sufficient-context.md +57 -0
  128. local_context_compiler-0.4.0/docs/adr/0015-minimum-sufficient-context-cost.md +44 -0
  129. local_context_compiler-0.4.0/docs/adr/0016-laya-local-semantic-backend.md +83 -0
  130. local_context_compiler-0.4.0/docs/adr/README.md +26 -0
  131. local_context_compiler-0.4.0/docs/architecture.md +158 -0
  132. local_context_compiler-0.4.0/docs/evaluation.md +53 -0
  133. local_context_compiler-0.4.0/docs/release.md +212 -0
  134. local_context_compiler-0.4.0/docs/roadmap.md +313 -0
  135. local_context_compiler-0.4.0/eval/fixtures/.gitkeep +1 -0
  136. local_context_compiler-0.4.0/eval/reports/.gitkeep +1 -0
  137. local_context_compiler-0.4.0/examples/basic_usage.md +82 -0
  138. local_context_compiler-0.4.0/examples/sample_input.txt +34 -0
  139. local_context_compiler-0.4.0/examples/tasks/ambiguous_context_task.json +7 -0
  140. local_context_compiler-0.4.0/examples/tasks/ambiguous_task.json +9 -0
  141. local_context_compiler-0.4.0/examples/tasks/calculation_total.json +7 -0
  142. local_context_compiler-0.4.0/examples/tasks/long_context.json +7 -0
  143. local_context_compiler-0.4.0/examples/tasks/long_duplicated_context.json +7 -0
  144. local_context_compiler-0.4.0/examples/tasks/noisy_context.json +7 -0
  145. local_context_compiler-0.4.0/examples/tasks/simple_qa.json +7 -0
  146. local_context_compiler-0.4.0/examples/tasks/strict_format.json +7 -0
  147. local_context_compiler-0.4.0/examples/tasks/strict_json_output.json +8 -0
  148. local_context_compiler-0.4.0/examples/tasks/very_short_simple.json +7 -0
  149. local_context_compiler-0.4.0/pyproject.toml +113 -0
  150. local_context_compiler-0.4.0/setup.cfg +4 -0
  151. local_context_compiler-0.4.0/src/lcc/__init__.py +72 -0
  152. local_context_compiler-0.4.0/src/lcc/agents/__init__.py +37 -0
  153. local_context_compiler-0.4.0/src/lcc/agents/local_agent.py +403 -0
  154. local_context_compiler-0.4.0/src/lcc/agents/local_solver.py +89 -0
  155. local_context_compiler-0.4.0/src/lcc/agents/local_verifier.py +276 -0
  156. local_context_compiler-0.4.0/src/lcc/benchmarking/__init__.py +65 -0
  157. local_context_compiler-0.4.0/src/lcc/benchmarking/case_loader.py +257 -0
  158. local_context_compiler-0.4.0/src/lcc/benchmarking/metadata.py +90 -0
  159. local_context_compiler-0.4.0/src/lcc/benchmarking/report.py +91 -0
  160. local_context_compiler-0.4.0/src/lcc/benchmarking/runner.py +316 -0
  161. local_context_compiler-0.4.0/src/lcc/benchmarking/schemas.py +125 -0
  162. local_context_compiler-0.4.0/src/lcc/cleaning/__init__.py +40 -0
  163. local_context_compiler-0.4.0/src/lcc/cleaning/boilerplate.py +75 -0
  164. local_context_compiler-0.4.0/src/lcc/cleaning/deduplicate.py +88 -0
  165. local_context_compiler-0.4.0/src/lcc/cleaning/normalize.py +184 -0
  166. local_context_compiler-0.4.0/src/lcc/cleaning/speech.py +313 -0
  167. local_context_compiler-0.4.0/src/lcc/cli.py +1614 -0
  168. local_context_compiler-0.4.0/src/lcc/compressor.py +119 -0
  169. local_context_compiler-0.4.0/src/lcc/inspection/__init__.py +56 -0
  170. local_context_compiler-0.4.0/src/lcc/inspection/inspector.py +678 -0
  171. local_context_compiler-0.4.0/src/lcc/inspection/report.py +100 -0
  172. local_context_compiler-0.4.0/src/lcc/inspection/schemas.py +186 -0
  173. local_context_compiler-0.4.0/src/lcc/intake/__init__.py +17 -0
  174. local_context_compiler-0.4.0/src/lcc/intake/parser.py +182 -0
  175. local_context_compiler-0.4.0/src/lcc/intake/pipeline.py +170 -0
  176. local_context_compiler-0.4.0/src/lcc/lexical_selection.py +320 -0
  177. local_context_compiler-0.4.0/src/lcc/mcp_server.py +357 -0
  178. local_context_compiler-0.4.0/src/lcc/pipeline.py +147 -0
  179. local_context_compiler-0.4.0/src/lcc/prompt_builder/__init__.py +7 -0
  180. local_context_compiler-0.4.0/src/lcc/prompt_builder/builder.py +41 -0
  181. local_context_compiler-0.4.0/src/lcc/prompt_builder/templates.py +223 -0
  182. local_context_compiler-0.4.0/src/lcc/py.typed +1 -0
  183. local_context_compiler-0.4.0/src/lcc/relevance/__init__.py +164 -0
  184. local_context_compiler-0.4.0/src/lcc/relevance/blocks.py +201 -0
  185. local_context_compiler-0.4.0/src/lcc/relevance/compactor.py +2257 -0
  186. local_context_compiler-0.4.0/src/lcc/relevance/decisions.py +266 -0
  187. local_context_compiler-0.4.0/src/lcc/relevance/graph.py +224 -0
  188. local_context_compiler-0.4.0/src/lcc/relevance/jev.py +347 -0
  189. local_context_compiler-0.4.0/src/lcc/relevance/laya.py +360 -0
  190. local_context_compiler-0.4.0/src/lcc/relevance/provider.py +221 -0
  191. local_context_compiler-0.4.0/src/lcc/relevance/safety.py +75 -0
  192. local_context_compiler-0.4.0/src/lcc/relevance/sufficiency.py +69 -0
  193. local_context_compiler-0.4.0/src/lcc/relevance/trim.py +254 -0
  194. local_context_compiler-0.4.0/src/lcc/relevance/verifier.py +327 -0
  195. local_context_compiler-0.4.0/src/lcc/reporting/__init__.py +23 -0
  196. local_context_compiler-0.4.0/src/lcc/reporting/explain.py +270 -0
  197. local_context_compiler-0.4.0/src/lcc/reporting/report.py +121 -0
  198. local_context_compiler-0.4.0/src/lcc/router/__init__.py +57 -0
  199. local_context_compiler-0.4.0/src/lcc/router/cli.py +138 -0
  200. local_context_compiler-0.4.0/src/lcc/router/cloud_client.py +112 -0
  201. local_context_compiler-0.4.0/src/lcc/router/config.py +150 -0
  202. local_context_compiler-0.4.0/src/lcc/router/context_adapter.py +141 -0
  203. local_context_compiler-0.4.0/src/lcc/router/errors.py +15 -0
  204. local_context_compiler-0.4.0/src/lcc/router/eval_runner.py +179 -0
  205. local_context_compiler-0.4.0/src/lcc/router/features.py +151 -0
  206. local_context_compiler-0.4.0/src/lcc/router/final_formatter.py +75 -0
  207. local_context_compiler-0.4.0/src/lcc/router/fireworks_client.py +17 -0
  208. local_context_compiler-0.4.0/src/lcc/router/lcc_adapter.py +13 -0
  209. local_context_compiler-0.4.0/src/lcc/router/policy.py +64 -0
  210. local_context_compiler-0.4.0/src/lcc/router/prompt_builder.py +48 -0
  211. local_context_compiler-0.4.0/src/lcc/router/router.py +199 -0
  212. local_context_compiler-0.4.0/src/lcc/router/schemas.py +178 -0
  213. local_context_compiler-0.4.0/src/lcc/router/token_accounting.py +8 -0
  214. local_context_compiler-0.4.0/src/lcc/schemas.py +110 -0
  215. local_context_compiler-0.4.0/src/lcc/semantic_retrieval/__init__.py +42 -0
  216. local_context_compiler-0.4.0/src/lcc/semantic_retrieval/boundary.py +500 -0
  217. local_context_compiler-0.4.0/src/lcc/semantic_retrieval/execution.py +481 -0
  218. local_context_compiler-0.4.0/src/lcc/token_budget/__init__.py +29 -0
  219. local_context_compiler-0.4.0/src/lcc/token_budget/counters.py +252 -0
  220. local_context_compiler-0.4.0/src/lcc/token_budget/pricing.py +109 -0
  221. local_context_compiler-0.4.0/src/lcc/toon.py +74 -0
  222. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/PKG-INFO +683 -0
  223. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/SOURCES.txt +283 -0
  224. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/dependency_links.txt +1 -0
  225. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/entry_points.txt +2 -0
  226. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/requires.txt +23 -0
  227. local_context_compiler-0.4.0/src/local_context_compiler.egg-info/top_level.txt +1 -0
  228. local_context_compiler-0.4.0/tests/test_adversarial_compaction.py +314 -0
  229. local_context_compiler-0.4.0/tests/test_adversarial_hardening.py +241 -0
  230. local_context_compiler-0.4.0/tests/test_benchmark_categories.py +122 -0
  231. local_context_compiler-0.4.0/tests/test_benchmark_metadata_eval.py +60 -0
  232. local_context_compiler-0.4.0/tests/test_benchmarking.py +520 -0
  233. local_context_compiler-0.4.0/tests/test_cache_economics.py +88 -0
  234. local_context_compiler-0.4.0/tests/test_cache_identity_semantic.py +108 -0
  235. local_context_compiler-0.4.0/tests/test_cleaning.py +189 -0
  236. local_context_compiler-0.4.0/tests/test_cli.py +103 -0
  237. local_context_compiler-0.4.0/tests/test_cli_compact.py +326 -0
  238. local_context_compiler-0.4.0/tests/test_compressor.py +28 -0
  239. local_context_compiler-0.4.0/tests/test_confidence_and_markers.py +104 -0
  240. local_context_compiler-0.4.0/tests/test_context_graph.py +91 -0
  241. local_context_compiler-0.4.0/tests/test_decision_cache_identity.py +92 -0
  242. local_context_compiler-0.4.0/tests/test_deduplicate.py +81 -0
  243. local_context_compiler-0.4.0/tests/test_deterministic_boundary.py +164 -0
  244. local_context_compiler-0.4.0/tests/test_docs.py +165 -0
  245. local_context_compiler-0.4.0/tests/test_end_to_end_mock.py +116 -0
  246. local_context_compiler-0.4.0/tests/test_eval_runner.py +33 -0
  247. local_context_compiler-0.4.0/tests/test_examples.py +53 -0
  248. local_context_compiler-0.4.0/tests/test_explain.py +227 -0
  249. local_context_compiler-0.4.0/tests/test_features.py +70 -0
  250. local_context_compiler-0.4.0/tests/test_fireworks_client_mock.py +19 -0
  251. local_context_compiler-0.4.0/tests/test_inspection.py +459 -0
  252. local_context_compiler-0.4.0/tests/test_intake.py +79 -0
  253. local_context_compiler-0.4.0/tests/test_jev_failure_modes.py +165 -0
  254. local_context_compiler-0.4.0/tests/test_laya_cli.py +186 -0
  255. local_context_compiler-0.4.0/tests/test_laya_context_limit.py +166 -0
  256. local_context_compiler-0.4.0/tests/test_laya_integration.py +65 -0
  257. local_context_compiler-0.4.0/tests/test_laya_provider.py +250 -0
  258. local_context_compiler-0.4.0/tests/test_lcc_adapter_failure.py +20 -0
  259. local_context_compiler-0.4.0/tests/test_lexical_selection.py +79 -0
  260. local_context_compiler-0.4.0/tests/test_local_agent.py +218 -0
  261. local_context_compiler-0.4.0/tests/test_local_verifier.py +119 -0
  262. local_context_compiler-0.4.0/tests/test_mcp_server.py +170 -0
  263. local_context_compiler-0.4.0/tests/test_metadata.py +13 -0
  264. local_context_compiler-0.4.0/tests/test_node_parity.py +75 -0
  265. local_context_compiler-0.4.0/tests/test_pipeline.py +132 -0
  266. local_context_compiler-0.4.0/tests/test_prepare_cli.py +206 -0
  267. local_context_compiler-0.4.0/tests/test_prompt_builder.py +100 -0
  268. local_context_compiler-0.4.0/tests/test_prompt_injection_properties.py +74 -0
  269. local_context_compiler-0.4.0/tests/test_relevance_blocks.py +50 -0
  270. local_context_compiler-0.4.0/tests/test_relevance_compactor.py +475 -0
  271. local_context_compiler-0.4.0/tests/test_router_policy.py +48 -0
  272. local_context_compiler-0.4.0/tests/test_safety_model.py +45 -0
  273. local_context_compiler-0.4.0/tests/test_semantic_retrieval.py +1853 -0
  274. local_context_compiler-0.4.0/tests/test_semantic_verifier.py +114 -0
  275. local_context_compiler-0.4.0/tests/test_speech_cleaning.py +143 -0
  276. local_context_compiler-0.4.0/tests/test_structured_preservation.py +144 -0
  277. local_context_compiler-0.4.0/tests/test_sufficiency.py +101 -0
  278. local_context_compiler-0.4.0/tests/test_token_budget.py +204 -0
  279. local_context_compiler-0.4.0/tests/test_tokenizer_contract.py +93 -0
  280. local_context_compiler-0.4.0/tests/test_toon.py +36 -0
  281. local_context_compiler-0.4.0/tests/test_trim_qualifiers_adversarial.py +63 -0
  282. local_context_compiler-0.4.0/tests/test_trim_semantic.py +42 -0
  283. local_context_compiler-0.4.0/tests/test_type_aware_trim.py +116 -0
  284. local_context_compiler-0.4.0/tests/test_verifier_contract.py +230 -0
  285. local_context_compiler-0.4.0/tests/test_verifier_fail_restoration.py +128 -0
@@ -0,0 +1,225 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ _No changes yet._
10
+
11
+ ## [0.4.0] - 2026-09-21
12
+
13
+ ### Added
14
+
15
+ - Laya live validation (2026-09-21): the real backend runs end-to-end (verified offline, in-budget, `judged`, no fallback) and the pre-validation "Laya = Jev, −22.6% on XL" claims are corrected — measured with real weights the default checkpoint keeps essentially every block (0.0% reduction at small/medium/large, −0.5% at XL; Jev −52% / mechanical −70% at XL, all at 100% category recall). `run_comparative_stress_test.py` and `run_laya_comparison.py` run real backends by default (`--mock` opts into the labelled harness) and every result row now carries `harness: real|mock`. New `run_laya_context_cases.py` (budget cases A/B/C, offline) and gated live test `tests/test_laya_integration.py` (`LCC_LAYA_INTEGRATION=1`). Pre-validation mock archives preserved and labelled. Full rows: `benchmarks/research/RESEARCH_STATUS.md`.
16
+ - Laya opt-in local semantic backend for `lcc compact` (ADR 0016, `local-context-compiler[laya]` extra): `LayaClient` judges typed `noul`/`choice`/`score` questions on-device with zero network and zero remote tokens. Strict context budgeting (`laya` 512 / `laya-multilingual` / `laya-typed-decisions` 1024, `HEAD_RESERVATION_TOKENS = 192` → 319/831 state tokens, `--laya-context-limit` override); oversized blocks are kept whole with `laya_context_limit_exceeded`, never sliced. Temperature calibration (`calibrate_noul`, `--laya-temperature`, default 1.0) is pure stdlib and part of the decision-cache identity. New CLI flags `--laya-model`, `--laya-device`, `--laya-context-limit`, `--laya-temperature`; Python API `LayaClient` + `provider="laya"`. Missing extra or failed batch falls back honestly to mechanical (`laya+mechanical_fallback`, `degraded: true`, typed reason) — never a fake `judged`. Operator guide: `docs/LAYA.md`.
17
+ - Laya maturity: report schema `relevance-compaction-1.2` (additive; new `context_budget_used`, `laya_temperature` alongside `laya_model_requested`/`resolved`, `laya_context_limit`, `latency_ms`), `lcc compact --help` provider decision guidance (mechanical vs laya vs jev vs auto), and fallback/observability tests including the missing-dependency path.
18
+ - Discoverability: `docs/QUICKSTART.md` (5-minute offline tour), runnable `examples/compact_providers.py` (mechanical vs laya vs honest jev-skip on one dossier) and `examples/long_session_cache.py` (decisions-cache + prefix-marker + append-only session), both covered by `tests/test_examples.py`.
19
+ - Deterministic boundary hardening: `tests/test_deterministic_boundary.py` fails any network/LLM/embedding capability import in `cleaning`, `token_budget`, `inspection`, `pipeline`, `lexical_selection`, `benchmarking` (sole exceptions: the fail-closed download guard and `*_VERSION` identity constants), fails any opt-in layer import into core, and proves core outputs are byte-identical with the network disabled. ADR 0010 clarified (decision unchanged): Laya, sufficiency, verifier, agents, and router are opt-in outside the core.
20
+ - MCP server MVP (`lcc mcp`, `src/lcc/mcp_server.py`, `docs/MCP.md`): stdio JSON-RPC tools `compact` (defaults to offline `mechanical`), `inspect`, `prepare`, `explain`, `intake`. Stdlib only — zero new dependencies; covered by `tests/test_mcp_server.py` including a real framed-subprocess session.
21
+ - Minimum-sufficient-context compilation (ADR 0014): `lcc compact` now answers two questions — "is this block relevant?" and "after these drops, can the objective still be solved from what remains?". New modules `lcc.relevance.safety` (independent relevance/necessity/dependency-risk/semantic-risk/redundancy axes), `lcc.relevance.graph` (typed SUPPORTS/QUALIFIES/CONTRADICTS/SUPERSEDES/DEPENDS_ON/DUPLICATES/DERIVED_FROM edges), `lcc.relevance.sufficiency` (verify-then-restore with `--sufficiency/--no-sufficiency`, `--max-restorations`), `lcc.relevance.trim` (type-aware TRIM: valid-syntax JSON/YAML/XML, row-aware tables, line-bound code, head+tail logs, TRIM→KEEP for high-stakes content), and `lcc.benchmarking.metadata` (reproducible benchmark identity). Decision cache keys bind the full policy identity (v1.1); reports add tokenizer identity, `jev_model_resolved`, sufficiency/relationship/marker accounting, per-decision confidence/relationships/policy/content-type, and `compilation_ms`. New CLI flags `--sufficiency/--no-sufficiency`, `--max-restorations`, `--confidence-threshold`. Adversarial suite grows 20→26 cases (scope quantifiers, coreference, paraphrase duplicates, set-level VAT chain, HTML/log injection); new `benchmarks/research/run_answer_eval.py` gates answer-level regressions (26/26 pass, 0 regressions mechanical). Node engine gains `tokenizerIdentity()`/`estimateTokensWithMeta()` with a documented parity boundary.
22
+ - Relevance compaction v1.1 (2026-09-18 review of `tamaratran/fast-jev-compaction`, adapted to this boundary): three-way decisions — **keep / trim / drop** — where borderline blocks keep a bounded head plus an audit note (`--trim-threshold`, `--trim-head-chars 0` restores strict keep/drop); `--preserve-tail N` pins the newest blocks untouched for live append-only contexts; scoring batches run concurrently (`--max-workers`, up to 8); reduction accounting (`reduction_ratio`, `worth_it`, `--min-reduction`) flags passes that save too little to justify a cache epoch. Report schema is `relevance-compaction-1.1` (additive; `decisions[].chars_after` for trims). A failed scoring batch no longer aborts the remaining ones — missing blocks fall back mechanically, as before.
23
+ - `lcc compact` (ADR 0013): opt-in instant relevance compaction. Drops context blocks that are irrelevant to an objective using narrow model judgment (TypeSafe System One / Jev) in batched calls, with a fully local mechanical fallback (zero-lexical-overlap blocks only) when no API key is configured. Fail-safe: provider failures keep content, never drop it.
24
+ - Cache-aligned compaction: sticky decisions (`--decisions-cache`) pin `(objective, block)` outcomes so unchanged history keeps byte-identical output; `--protect-prefix` / `--prefix-marker` make early-prefix mutation impossible; reports expose `first_mutation_offset`, `prefix_sha256`, and `output_sha256` for automated cache accounting (`docs/CACHE_ALIGNMENT.md`).
25
+ - `lcc intake --enable-relevance` (with `--relevance-threshold`, `--relevance-provider`): runs relevance compaction on raw input before intake compilation; results appear in the intake report JSON and summary.
26
+ - Deterministic relevance block segmentation (`lcc.relevance.blocks`) with content-addressed ids (`blk_0001_<12 hex>`), fenced-code-aware spans, and byte-exact reconstruction; shared-ledger audit trail for every scoring call (`lcc_compact` feature tag, matching the LookADev fleet ledger schema).
27
+ - `lcc agent` local agent subsystem (`lcc.agents`) with native support for **Gemma 4 e4b** (turn formatting `<start_of_turn>user...`) and **Qwen3.5-4B** (ChatML `<|im_start|>...`), Ollama, llama.cpp / GGUF (e4b 4-bit), vLLM, MLX, and mock backends with health checks and zero remote token usage.
28
+ - `lcc route` hybrid local/cloud routing subsystem (`lcc.router`) with conservative verification gates (`RuleBasedVerifier`, `LocalLLMVerifier`) and selective escalation to Fireworks AI.
29
+ - `lcc intake` intelligent prompt intake engine (`lcc.intake`) with automated readiness triage (`READY_TO_EXECUTE`, `NEEDS_LIGHT_REFINEMENT`, `NEEDS_INTAKE`, `BLOCKED`), intent/assumptions extraction, and clarifying questions generation.
30
+ - `lcc speech` and transcript cleaning (`lcc.cleaning.speech`) with deterministic speech disfluency stripping (English & Portuguese fillers), Whisper audio tag elimination (`[Music]`, `[Applause]`, etc.), hallucinated subtitle/video outro removal, and speaker-turn collapsing.
31
+ - Code-block and Markdown-table safe normalization in `lcc.cleaning.normalize` protecting fenced code blocks (``` and ~~~) and Markdown tables against destructive inner-space collapsing and indentation disruption.
32
+ - Fixed `REMOTE_DIRECT` router token leak in `lcc.router` so direct cloud model escalation always receives safe deterministic cleaning (normalization, boilerplate removal, and exact paragraph deduplication).
33
+ - Universal TypeScript & Node.js client package exports (`LccCompressor`, `LccIntake`, `processIntake`).
34
+ - `lcc prepare` deterministic inspect-first workflow. It runs inspection, skips prompt
35
+
36
+ generation for `skip`/`manual_review` recommendations, and runs deterministic lexical
37
+ selection plus the existing safe optimization path for `optimize_safe`/`optimize_with_flags`,
38
+ with input-file overwrite protection for output and report paths.
39
+ - Machine-readable inspection recommendation scoring signals with deterministic scores,
40
+ thresholds, evidence values, and reason codes for duplication pressure, projected savings,
41
+ token budget pressure, missing pricing, approximate token counting, and manual-review risk.
42
+ - Additive `chunk_inventory` data in inspection reports, with deterministic chunk IDs,
43
+ character offsets, line spans, paragraph counts, token counts and methods, structural
44
+ labels, literal heading text, and exact duplicate markers.
45
+ - Deterministic question-aware lexical chunk selection for `lcc prepare` optimize decisions,
46
+ using keyword overlap, heading matches, rare-term matches, heading proximity, and exact
47
+ duplicate markers from `chunk_inventory`; prepare reports explain selected chunks and nested
48
+ optimization output.
49
+ - Deterministic benchmark coverage for `workflow: prepare` cases, including bundled
50
+ selection-applied and selection-not-applied fixtures with required evidence markers,
51
+ forbidden irrelevant/duplicate markers, and prepare selection report assertions.
52
+ - Phase 1.7 roadmap status for the implemented deterministic `prepare` and recommendation
53
+ scoring slices, chunk-inventory slice, lexical-selection slice, and prepare benchmark slice.
54
+ - ADR 0010 documenting the deterministic-first preparation and optional model-assistance
55
+ boundary. Optional future model assistance is not implemented; model, embedding, network
56
+ client, runtime-download, and local/remote model-call code cannot enter the deterministic
57
+ core, inspection, or benchmarking boundary.
58
+ - ADR 0011 as the accepted Phase 2 opt-in semantic retrieval boundary, plus a
59
+ disabled-by-default `lcc.semantic_retrieval` / `lcc semantic-retrieval` scaffold that reports
60
+ disabled or blocked status only. Retrieval execution, embeddings, RAG, model calls, network
61
+ access, and local-model behavior are still not implemented.
62
+ - Visitor-facing project presentation (added during this cycle, since removed as hackathon-specific; pitch content folded into README).
63
+
64
+ ### Changed
65
+
66
+ - **Behavior change:** `--provider laya` without the `[laya]` extra (or with an unloadable model) now falls back honestly to mechanical scoring (`provider_used: laya+mechanical_fallback`, `degraded: true`, `degradation_reason: laya_unavailable_mechanical_fallback`) instead of keeping every block silently. Rationale: a keep-all pass disguised the missing dependency and hid that no semantic judgment ran; the fallback is labeled, warned, and `semantic_guarantee: none`.
67
+ - `semantic_guarantee` is now exact about mixed runs: `partial` only when at least one block was actually judged before the failure; a total provider failure (every decision lexical) reports `none`. Same rule for Jev and Laya fallbacks.
68
+ - Report schema `relevance-compaction-1.1` → `relevance-compaction-1.2` (additive only: `context_budget_used`, `laya_temperature`; all 1.1 consumers keep working, e.g. `lcc explain` reads both).
69
+ - Reworked the README into a clearer first-visit guide with a tighter project summary, the offline-first path, direct links to the five-minute QUICKSTART and MCP Server guide, a command guide, an architecture map, and explicit scope boundaries.
70
+ - Tightened CLI-facing and visitor-facing docs around the deterministic Phase 1.7 prepare
71
+ boundary, diagnostic-only inspection, and mechanical-only benchmark claims.
72
+ - The inline drop marker no longer carries scorer values, so repeated `lcc compact` runs emit
73
+ byte-identical output without extra flags; `--marker-scores` restores the previous verbose
74
+ form. Per-block scores remain in the report. Measured over five identical runs, this took the
75
+ output from five distinct hashes to one.
76
+ - `--provider auto` reports a mechanical fallback honestly: `degraded` is now true with a
77
+ `degradation_reason` and `semantic_guarantee: none`, instead of claiming success while a
78
+ lexical scorer replaced the semantic judge.
79
+ - `lcc compact` exits 3 under `--require-exact-tokens` when token counting degrades to the
80
+ heuristic estimator, and always warns (`approximate_token_count`) that every token figure in
81
+ the report is an estimate.
82
+ - Passing `--trim-head-chars 0` now warns (`strict_keep_drop`) that the trim middle gear is
83
+ disabled and borderline blocks are dropped outright instead of keeping a bounded head.
84
+ - `lcc compact --help` and the README document `--provider jev` as the recommended explicit
85
+ choice, and describe the trim band as the safety net rather than an optional extra.
86
+ - `docs/CACHE_ALIGNMENT.md` corrects the byte-stability claim (scorer values in the marker and
87
+ uncached threshold drift were two distinct causes) and documents the new report fields.
88
+
89
+ ### Added
90
+
91
+ - `lcc compact --append-to <session>`: compacts the payload and appends it in one step, never
92
+ rewriting the bytes already in the file. This makes the placement the measurements favour — a
93
+ per-payload pass instead of a whole-session rewrite — a first-class operation rather than shell
94
+ plumbing, and it is what keeps a session's prefix byte-stable so its prompt cache survives.
95
+ - The Jev scorer is documented as optional everywhere it is mentioned. `--provider mechanical`
96
+ needs no key and no network and the measurements show it keeps every item of every information
97
+ category on every corpus size tested, so the README now answers "does it work without a model
98
+ API key?" directly, and `lcc compact --help` says which path needs what.
99
+ - `benchmarks/research/run_cache_patterns.py`: measures where compaction is placed, which turns
100
+ out to matter more than how much it removes. Per-payload compaction (the tool result, before it
101
+ is appended) saved 42.4% of context cost against 7.9% for a single whole-session pass, and spent
102
+ fewer scorer tokens, because a whole-session drop pays to rewrite everything it invalidates.
103
+ `docs/CACHE_ALIGNMENT.md` now carries the placement guidance and the recommended order.
104
+ - An audit guide in `benchmarks/research/README.md`: what each script proves, how to re-run every
105
+ number, and the two habits that keep the benchmark honest (report recall per information
106
+ category, and check that the objective actually requires the ground truth before blaming a
107
+ component).
108
+ - Supersession rule in the deterministic safety net: a block that revises or corrects a value
109
+ carried by a kept block is kept too, even when it shares only one distinctive term with it. It
110
+ closes the last category the local scorer was losing (`temporal`, at 0.00 on every scale) for
111
+ between one and two points of reduction. The rule is a separate pass rather than a transitive
112
+ closure, because making the closure transitive cost 27 points of reduction on the medium corpus.
113
+ - `lcc explain`: reads a report written by `lcc compact -r` and prints why every block was kept,
114
+ trimmed or dropped, in plain language, with the original text behind each decision when
115
+ `--source` is given. `--only` filters to one decision kind and `--limit` caps the trail. It
116
+ never re-runs compaction and never touches the network, so a pass stays auditable after the
117
+ fact.
118
+ - Recall by information category in the research benchmark. The corpora now carry categorized
119
+ ground truth (critical facts, a constraint, a negative constraint, an exception, a dated
120
+ revision and a contradictory measurement) and `run_matrix.py` reports recall per category
121
+ instead of one flat count.
122
+ - `benchmarks/research/stress_edges.py`: a stress and edge-case suite. The `xl` corpus is roughly
123
+ four times `large` (1 492 blocks, 44 128 tokens) and confirms that category recall, reduction
124
+ and cache byte-stability hold at that scale; eight edge cases cover empty input, whitespace, a
125
+ single oversized block, CRLF, unicode, 400 sub-floor blocks and a 40 kB line.
126
+ - Deterministic safety net for locally scored blocks (`--deterministic-protection`, on by
127
+ default). When `lcc compact` falls back to the lexical scorer, three classes of evidence now
128
+ survive it: quoted third-party speech, evidence written in another language than the
129
+ objective, and blocks sharing two or more distinctive terms with a block that is being kept.
130
+ Measured against the adversarial suite in `benchmarks/research/`, this takes the deterministic
131
+ path from 17/20 cases passing to 20/20, and on the main corpora from 3/5 ground-truth facts
132
+ retained to 5/5, at a cost of 10 to 23 points of reduction. The Jev path is unaffected.
133
+ - `invalidated_tokens` and `break_even_reuses` in the relevance compaction report, plus a
134
+ `cache_epoch_risk` warning when a pass mutates a warm prefix earlier than the reuse count can
135
+ pay for. Measured break-even sits between 11.8 and 20.3 reuses across three corpus sizes.
136
+ - `degradation_reason` and `semantic_guarantee` (`judged` / `partial` / `none`) in the relevance
137
+ compaction report so callers can decide whether a pass is trustworthy without parsing prose.
138
+ - `--marker-scores` and `--require-exact-tokens` CLI flags for `lcc compact`.
139
+ - `benchmarks/research/`: a measured study of compaction effectiveness, evidence retention and
140
+ prompt-cache safety, with reproducible corpora, a 39-run transform matrix, a cache-safety
141
+ suite, and a real 9-agent A/B against a no-LCC baseline.
142
+
143
+ ### Fixed
144
+
145
+ - Identical blocks are now decided once per run. The decisions cache is content-addressed, so a
146
+ run that scored two copies of the same block independently could disagree with the single
147
+ cached score a warm run reuses, changing the emitted bytes between runs.
148
+
149
+ ## [0.2.0] - 2026-06-22
150
+
151
+ ### Added
152
+
153
+ - `lcc inspect` diagnostic command — analyzes a text input (from a file or stdin) and reports
154
+ its token, structure, duplication, cleanup, and cost profile, plus a clearly-labelled
155
+ projection of what `lcc optimize`'s safe cleaning would remove. It is diagnostic, not
156
+ transformative: it builds **no** prompt, makes no network or model call, and never modifies
157
+ the input. The JSON report goes to `--report` (or stdout); a human-readable summary and
158
+ warnings go to stderr.
159
+ - Deterministic inspection reports (`lcc.inspection`, `schema_version` 1.0): identical input
160
+ produces a byte-identical report — no timestamps, random values, absolute paths, or
161
+ machine-specific values. Token counts preserve the exact-vs-approximate honesty of ADR 0005
162
+ and ADR 0008.
163
+ - ADR 0009 — `lcc inspect` is a diagnostic boundary (no prompt, no transform).
164
+ - PyPI Trusted Publishing workflow for tag-triggered releases via GitHub Actions OIDC,
165
+ without long-lived PyPI tokens.
166
+ - Explicit source distribution manifest covering docs, examples, benchmark fixtures, config
167
+ examples, and tests.
168
+ - PEP 561 typing marker (`py.typed`) in the wheel.
169
+
170
+ ### Changed
171
+
172
+ - Documented published-package installation with `pipx install local-context-compiler` and
173
+ `python -m pip install local-context-compiler`.
174
+ - Updated the release checklist for building distributions, checking them with `twine`,
175
+ installing the wheel in a clean virtual environment, and publishing through PyPI Trusted
176
+ Publishing.
177
+
178
+ ## [0.1.0] - 2026-06-19
179
+
180
+ First public release: the deterministic, local-first context-optimization MVP plus a
181
+ deterministic benchmark harness. No RAG, embeddings, vector databases, local or remote LLM
182
+ calls, API server, voice/audio, transcript ingestion, semantic scoring, model routing, or
183
+ response verification — those remain roadmap items (see `docs/roadmap.md`).
184
+
185
+ ### Added
186
+
187
+ - Initial deterministic MVP — identical input produces identical output.
188
+ - Deterministic cleaning: `normalize_text`, `remove_common_boilerplate`,
189
+ `deduplicate_paragraphs` (exact + conservative near-duplicate).
190
+ - Token budget and cost estimation: token counting via `tiktoken` with an honest
191
+ approximate fallback (the method `exact` / `approximate` is surfaced in every report),
192
+ plus configurable, editable model pricing and input-cost estimates.
193
+ - Tokenizer network guard: exact token counting runs inside a tightly scoped no-network
194
+ guard. `lcc` blocks runtime network access by default — including the first-use encoding
195
+ download `tiktoken` would otherwise perform — and no CLI command makes an internet request
196
+ by default. If exact tokenizer assets are not available locally, counting falls back to a
197
+ clearly labelled approximate count whose warning explains the specific reason (tiktoken not
198
+ installed, model/encoding unknown, encoding unavailable offline, or another tiktoken
199
+ failure). Exact counting therefore requires the encoding assets to be cached locally. See
200
+ [ADR 0008](docs/adr/0008-tokenizer-network-boundary.md).
201
+ - Evidence-aware prompt builder with an extensible template registry.
202
+ - `OptimizationReport` (deterministic JSON, `schema_version` 1.0) with before/after
203
+ characters, tokens, compression ratio, savings percentage, cost before/after, cleaning
204
+ steps, dedup metrics, and warnings.
205
+ - `lcc optimize` CLI (file or stdin), with `--version` and graceful, non-zero-exit errors.
206
+ - `lcc bench` CLI and the deterministic benchmark harness (`lcc.benchmarking`): runs the
207
+ optimization pipeline over committed fixtures in `benchmarks/cases/` and reports mechanical
208
+ metrics (token savings, compression ratio, character reduction, exact/approximate token
209
+ mode, literal marker preservation, warnings) with explicit per-case thresholds and a
210
+ versioned (`schema_version` 1.0), deterministic JSON/Markdown report. See ADR 0007. It does
211
+ **not** measure LLM answer quality.
212
+ - Benchmark fixtures in `benchmarks/cases/` (basic redundancy, boilerplate cleanup, evidence
213
+ preservation, approximate-token fallback).
214
+ - Architecture Decision Records 0001–0008 capturing the frozen, one-way-door design
215
+ decisions.
216
+ - CI workflow (`.github/workflows/ci.yml`) running ruff, mypy, and pytest on Python 3.11,
217
+ 3.12, and 3.13.
218
+ - Open-source project docs: `README.md`, `CONTRIBUTING.md`, `SECURITY.md`,
219
+ `CODE_OF_CONDUCT.md`, the `docs/` set (architecture, evaluation, roadmap, release, ADRs),
220
+ examples, and agent guidance (`CLAUDE.md`, `AGENTS.md`).
221
+
222
+ [Unreleased]: https://github.com/lucasmartins-ai/lcc/compare/v0.4.0...HEAD
223
+ [0.4.0]: https://github.com/lucasmartins-ai/lcc/compare/v0.2.0...v0.4.0
224
+ [0.2.0]: https://github.com/lucasmartins-ai/lcc/compare/v0.1.0...v0.2.0
225
+ [0.1.0]: https://github.com/lucasmartins-ai/lcc/releases/tag/v0.1.0
@@ -0,0 +1,36 @@
1
+ # Contributor Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in our community a
6
+ harassment-free experience for everyone, regardless of age, body size, visible or invisible
7
+ disability, ethnicity, sex characteristics, gender identity and expression, level of
8
+ experience, education, socio-economic status, nationality, personal appearance, race,
9
+ religion, or sexual identity and orientation.
10
+
11
+ ## Our standards
12
+
13
+ Examples of behavior that contributes to a positive environment:
14
+
15
+ - Demonstrating empathy and kindness toward other people.
16
+ - Being respectful of differing opinions, viewpoints, and experiences.
17
+ - Giving and gracefully accepting constructive feedback.
18
+ - Focusing on what is best for the community.
19
+
20
+ Examples of unacceptable behavior:
21
+
22
+ - The use of sexualized language or imagery, and unwelcome sexual attention or advances.
23
+ - Trolling, insulting or derogatory comments, and personal or political attacks.
24
+ - Public or private harassment.
25
+ - Publishing others' private information without explicit permission.
26
+
27
+ ## Enforcement
28
+
29
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the
30
+ project maintainers. All complaints will be reviewed and investigated promptly and fairly.
31
+ Maintainers are obligated to respect the privacy and security of the reporter of any incident.
32
+
33
+ ## Attribution
34
+
35
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
36
+ version 2.1.
@@ -0,0 +1,57 @@
1
+ # Contributing to Local Context Compiler
2
+
3
+ Thanks for your interest in improving `lcc`. This project values small, well-tested,
4
+ well-documented changes over large rewrites.
5
+
6
+ ## Development setup
7
+
8
+ Requires Python 3.11+.
9
+
10
+ ```bash
11
+ git clone https://github.com/lucasmartins-ai/lcc
12
+ cd lcc
13
+
14
+ python -m venv .venv && source .venv/bin/activate
15
+ pip install -e ".[dev]"
16
+ ```
17
+
18
+ ## Running the checks
19
+
20
+ ```bash
21
+ python -m pytest # tests
22
+ ruff check . # lint
23
+ ruff format --check . # formatting
24
+ mypy # optional static type check
25
+ ```
26
+
27
+ All four should pass before you open a pull request. New behavior needs tests.
28
+
29
+ ## Code style
30
+
31
+ - Python 3.11+, typed where reasonable. Public functions have docstrings.
32
+ - `ruff` is the single source of truth for lint and formatting (config in `pyproject.toml`,
33
+ line length 100).
34
+ - Prefer small modules with explicit responsibilities. Keep the deterministic core
35
+ (`cleaning`, `token_budget`, `prompt_builder`, `reporting`, `pipeline`) free of any
36
+ network or LLM dependency — see [docs/adr/0006](docs/adr/0006-determinism-boundary.md).
37
+ - **Do not add heavy dependencies** without a clear justification in the PR description.
38
+ - **Do not implement roadmap features** (RAG, embeddings, local LLMs, model routing,
39
+ response verification) unless an issue explicitly asks for it. The MVP stays small.
40
+
41
+ ## Commits and pull requests
42
+
43
+ - Keep commits focused; write imperative, descriptive messages ("Add near-duplicate cap").
44
+ - In the PR description, explain *what* changed, *why*, and *how to test it*. Note any new
45
+ dependency and any residual risk.
46
+ - If your change affects the JSON report shape, follow
47
+ [docs/adr/0004](docs/adr/0004-report-schema-versioning.md): additive fields keep
48
+ `schema_version` at `1.0`; a breaking change bumps it.
49
+
50
+ ## Proposing features
51
+
52
+ Open an issue describing the problem, the smallest useful change, and where it fits on the
53
+ [roadmap](docs/roadmap.md). For one-way-door decisions (public API, cross-module contracts),
54
+ propose a short ADR in [docs/adr/](docs/adr/) first.
55
+
56
+ By contributing, you agree your contributions are licensed under the project's
57
+ [MIT License](LICENSE), and you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Local Context Compiler contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ include AGENTS.md
2
+ include CHANGELOG.md
3
+ include CLAUDE.md
4
+ include CODE_OF_CONDUCT.md
5
+ include CONTRIBUTING.md
6
+ include LICENSE
7
+ include README.md
8
+ include SECURITY.md
9
+ include pyproject.toml
10
+
11
+ recursive-include src *.py *.typed *.yaml
12
+ recursive-include benchmarks *.md *.txt *.yaml
13
+ recursive-include act2_router *.py
14
+ recursive-include config *.yaml
15
+ recursive-include configs *.yaml
16
+
17
+ recursive-include docs *.md
18
+ recursive-include docker *
19
+ recursive-include examples *.md *.txt *.json
20
+ recursive-include eval .gitkeep
21
+ recursive-include tests *.py
22
+
23
+ recursive-exclude * __pycache__
24
+ recursive-exclude * *.py[cod]
25
+ recursive-exclude * .DS_Store