ahadiff 1.1.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 (330) hide show
  1. ahadiff-1.1.0/.gitignore +148 -0
  2. ahadiff-1.1.0/LICENSE +21 -0
  3. ahadiff-1.1.0/PKG-INFO +320 -0
  4. ahadiff-1.1.0/README.md +270 -0
  5. ahadiff-1.1.0/README.zh.md +270 -0
  6. ahadiff-1.1.0/pyproject.toml +138 -0
  7. ahadiff-1.1.0/src/ahadiff/__init__.py +5 -0
  8. ahadiff-1.1.0/src/ahadiff/__main__.py +6 -0
  9. ahadiff-1.1.0/src/ahadiff/challenge/__init__.py +56 -0
  10. ahadiff-1.1.0/src/ahadiff/challenge/adapt.py +65 -0
  11. ahadiff-1.1.0/src/ahadiff/challenge/engine.py +325 -0
  12. ahadiff-1.1.0/src/ahadiff/challenge/manifest.py +382 -0
  13. ahadiff-1.1.0/src/ahadiff/challenge/state.py +306 -0
  14. ahadiff-1.1.0/src/ahadiff/claims/__init__.py +39 -0
  15. ahadiff-1.1.0/src/ahadiff/claims/classify.py +58 -0
  16. ahadiff-1.1.0/src/ahadiff/claims/extract.py +623 -0
  17. ahadiff-1.1.0/src/ahadiff/claims/negative_scan.py +186 -0
  18. ahadiff-1.1.0/src/ahadiff/claims/runtime.py +521 -0
  19. ahadiff-1.1.0/src/ahadiff/claims/schema.py +90 -0
  20. ahadiff-1.1.0/src/ahadiff/claims/verify.py +847 -0
  21. ahadiff-1.1.0/src/ahadiff/cli.py +3912 -0
  22. ahadiff-1.1.0/src/ahadiff/contracts/__init__.py +240 -0
  23. ahadiff-1.1.0/src/ahadiff/contracts/claim_status.py +155 -0
  24. ahadiff-1.1.0/src/ahadiff/contracts/error_codes.py +81 -0
  25. ahadiff-1.1.0/src/ahadiff/contracts/error_types.py +71 -0
  26. ahadiff-1.1.0/src/ahadiff/contracts/eval_bundle.py +88 -0
  27. ahadiff-1.1.0/src/ahadiff/contracts/event_log.py +80 -0
  28. ahadiff-1.1.0/src/ahadiff/contracts/orchestrator.py +109 -0
  29. ahadiff-1.1.0/src/ahadiff/contracts/quiz_choice.py +80 -0
  30. ahadiff-1.1.0/src/ahadiff/contracts/run_source.py +152 -0
  31. ahadiff-1.1.0/src/ahadiff/contracts/serve_app.py +345 -0
  32. ahadiff-1.1.0/src/ahadiff/contracts/serve_audit.py +22 -0
  33. ahadiff-1.1.0/src/ahadiff/contracts/serve_concepts.py +34 -0
  34. ahadiff-1.1.0/src/ahadiff/contracts/serve_demo.py +39 -0
  35. ahadiff-1.1.0/src/ahadiff/contracts/serve_doctor.py +25 -0
  36. ahadiff-1.1.0/src/ahadiff/contracts/serve_improve.py +73 -0
  37. ahadiff-1.1.0/src/ahadiff/contracts/serve_install.py +98 -0
  38. ahadiff-1.1.0/src/ahadiff/contracts/serve_providers.py +125 -0
  39. ahadiff-1.1.0/src/ahadiff/contracts/serve_runtime.py +302 -0
  40. ahadiff-1.1.0/src/ahadiff/contracts/serve_stats.py +157 -0
  41. ahadiff-1.1.0/src/ahadiff/core/__init__.py +3 -0
  42. ahadiff-1.1.0/src/ahadiff/core/budget.py +267 -0
  43. ahadiff-1.1.0/src/ahadiff/core/config.py +1392 -0
  44. ahadiff-1.1.0/src/ahadiff/core/errors.py +27 -0
  45. ahadiff-1.1.0/src/ahadiff/core/ids.py +46 -0
  46. ahadiff-1.1.0/src/ahadiff/core/json_util.py +52 -0
  47. ahadiff-1.1.0/src/ahadiff/core/orchestrator.py +2032 -0
  48. ahadiff-1.1.0/src/ahadiff/core/paths.py +358 -0
  49. ahadiff-1.1.0/src/ahadiff/core/registry.py +206 -0
  50. ahadiff-1.1.0/src/ahadiff/core/sqlite_util.py +705 -0
  51. ahadiff-1.1.0/src/ahadiff/core/task_runner.py +560 -0
  52. ahadiff-1.1.0/src/ahadiff/core/watcher.py +329 -0
  53. ahadiff-1.1.0/src/ahadiff/eval/__init__.py +61 -0
  54. ahadiff-1.1.0/src/ahadiff/eval/benchmark.py +673 -0
  55. ahadiff-1.1.0/src/ahadiff/eval/deterministic.py +633 -0
  56. ahadiff-1.1.0/src/ahadiff/eval/evaluator.py +1089 -0
  57. ahadiff-1.1.0/src/ahadiff/eval/gates.py +462 -0
  58. ahadiff-1.1.0/src/ahadiff/eval/ratchet.py +224 -0
  59. ahadiff-1.1.0/src/ahadiff/eval/results.py +575 -0
  60. ahadiff-1.1.0/src/ahadiff/eval/rubric.py +105 -0
  61. ahadiff-1.1.0/src/ahadiff/eval/rubric.yaml +34 -0
  62. ahadiff-1.1.0/src/ahadiff/eval/spec_alignment.py +1569 -0
  63. ahadiff-1.1.0/src/ahadiff/export/__init__.py +13 -0
  64. ahadiff-1.1.0/src/ahadiff/export/preview.py +593 -0
  65. ahadiff-1.1.0/src/ahadiff/export/writer.py +305 -0
  66. ahadiff-1.1.0/src/ahadiff/git/__init__.py +58 -0
  67. ahadiff-1.1.0/src/ahadiff/git/capture.py +3402 -0
  68. ahadiff-1.1.0/src/ahadiff/git/download.py +449 -0
  69. ahadiff-1.1.0/src/ahadiff/git/hunk_hash.py +33 -0
  70. ahadiff-1.1.0/src/ahadiff/git/line_map.py +157 -0
  71. ahadiff-1.1.0/src/ahadiff/git/notebook.py +98 -0
  72. ahadiff-1.1.0/src/ahadiff/git/parser.py +398 -0
  73. ahadiff-1.1.0/src/ahadiff/git/path_tokens.py +231 -0
  74. ahadiff-1.1.0/src/ahadiff/git/repo.py +408 -0
  75. ahadiff-1.1.0/src/ahadiff/git/symbols.py +1269 -0
  76. ahadiff-1.1.0/src/ahadiff/git/tree_sitter_runtime.py +860 -0
  77. ahadiff-1.1.0/src/ahadiff/graphify/__init__.py +39 -0
  78. ahadiff-1.1.0/src/ahadiff/graphify/cli.py +58 -0
  79. ahadiff-1.1.0/src/ahadiff/graphify/freshness.py +60 -0
  80. ahadiff-1.1.0/src/ahadiff/graphify/linker.py +106 -0
  81. ahadiff-1.1.0/src/ahadiff/graphify/matcher.py +105 -0
  82. ahadiff-1.1.0/src/ahadiff/graphify/models.py +40 -0
  83. ahadiff-1.1.0/src/ahadiff/graphify/parser.py +399 -0
  84. ahadiff-1.1.0/src/ahadiff/graphify/search.py +77 -0
  85. ahadiff-1.1.0/src/ahadiff/graphify/slicer.py +109 -0
  86. ahadiff-1.1.0/src/ahadiff/i18n/__init__.py +19 -0
  87. ahadiff-1.1.0/src/ahadiff/i18n/resolver.py +146 -0
  88. ahadiff-1.1.0/src/ahadiff/improve/__init__.py +29 -0
  89. ahadiff-1.1.0/src/ahadiff/improve/loop.py +1722 -0
  90. ahadiff-1.1.0/src/ahadiff/improve/preflight.py +84 -0
  91. ahadiff-1.1.0/src/ahadiff/improve/program.py +349 -0
  92. ahadiff-1.1.0/src/ahadiff/improve/rewrite.py +63 -0
  93. ahadiff-1.1.0/src/ahadiff/improve/targeted.py +192 -0
  94. ahadiff-1.1.0/src/ahadiff/install/__init__.py +17 -0
  95. ahadiff-1.1.0/src/ahadiff/install/aider.py +54 -0
  96. ahadiff-1.1.0/src/ahadiff/install/antigravity.py +73 -0
  97. ahadiff-1.1.0/src/ahadiff/install/antigravity_cli.py +78 -0
  98. ahadiff-1.1.0/src/ahadiff/install/base.py +440 -0
  99. ahadiff-1.1.0/src/ahadiff/install/claude.py +73 -0
  100. ahadiff-1.1.0/src/ahadiff/install/cline.py +57 -0
  101. ahadiff-1.1.0/src/ahadiff/install/codex.py +73 -0
  102. ahadiff-1.1.0/src/ahadiff/install/common.py +57 -0
  103. ahadiff-1.1.0/src/ahadiff/install/continue_.py +54 -0
  104. ahadiff-1.1.0/src/ahadiff/install/copilot.py +81 -0
  105. ahadiff-1.1.0/src/ahadiff/install/cursor.py +54 -0
  106. ahadiff-1.1.0/src/ahadiff/install/gemini.py +73 -0
  107. ahadiff-1.1.0/src/ahadiff/install/github_action.py +89 -0
  108. ahadiff-1.1.0/src/ahadiff/install/hooks.py +374 -0
  109. ahadiff-1.1.0/src/ahadiff/install/opencode.py +71 -0
  110. ahadiff-1.1.0/src/ahadiff/install/registry.py +64 -0
  111. ahadiff-1.1.0/src/ahadiff/install/roo.py +57 -0
  112. ahadiff-1.1.0/src/ahadiff/install/template_loader.py +17 -0
  113. ahadiff-1.1.0/src/ahadiff/install/templates/__init__.py +1 -0
  114. ahadiff-1.1.0/src/ahadiff/install/templates/agents_section.md.j2 +29 -0
  115. ahadiff-1.1.0/src/ahadiff/install/templates/ahadiff-generate.yml.j2 +125 -0
  116. ahadiff-1.1.0/src/ahadiff/install/templates/ahadiff-verify.yml.j2 +80 -0
  117. ahadiff-1.1.0/src/ahadiff/install/templates/aider_section.md.j2 +30 -0
  118. ahadiff-1.1.0/src/ahadiff/install/templates/antigravity_cli_skill.md.j2 +56 -0
  119. ahadiff-1.1.0/src/ahadiff/install/templates/antigravity_rule.md.j2 +27 -0
  120. ahadiff-1.1.0/src/ahadiff/install/templates/antigravity_skill.md.j2 +56 -0
  121. ahadiff-1.1.0/src/ahadiff/install/templates/claude_section.md.j2 +26 -0
  122. ahadiff-1.1.0/src/ahadiff/install/templates/claude_skill.md.j2 +56 -0
  123. ahadiff-1.1.0/src/ahadiff/install/templates/cline_rules.md.j2 +26 -0
  124. ahadiff-1.1.0/src/ahadiff/install/templates/codex_skill.md.j2 +56 -0
  125. ahadiff-1.1.0/src/ahadiff/install/templates/continue_rule.md.j2 +29 -0
  126. ahadiff-1.1.0/src/ahadiff/install/templates/copilot_instruction.md.j2 +30 -0
  127. ahadiff-1.1.0/src/ahadiff/install/templates/copilot_section.md.j2 +26 -0
  128. ahadiff-1.1.0/src/ahadiff/install/templates/cursor_rule.mdc.j2 +27 -0
  129. ahadiff-1.1.0/src/ahadiff/install/templates/gemini_section.md.j2 +26 -0
  130. ahadiff-1.1.0/src/ahadiff/install/templates/gemini_skill.md.j2 +56 -0
  131. ahadiff-1.1.0/src/ahadiff/install/templates/opencode_agent.md.j2 +57 -0
  132. ahadiff-1.1.0/src/ahadiff/install/templates/post_commit_hook.sh.j2 +13 -0
  133. ahadiff-1.1.0/src/ahadiff/install/templates/pre_push_hook.sh.j2 +13 -0
  134. ahadiff-1.1.0/src/ahadiff/install/templates/roo_rules.md.j2 +26 -0
  135. ahadiff-1.1.0/src/ahadiff/install/templates/windsurf_rule.md.j2 +27 -0
  136. ahadiff-1.1.0/src/ahadiff/install/usage_hints.py +245 -0
  137. ahadiff-1.1.0/src/ahadiff/install/windsurf.py +54 -0
  138. ahadiff-1.1.0/src/ahadiff/lesson/__init__.py +43 -0
  139. ahadiff-1.1.0/src/ahadiff/lesson/generator.py +1050 -0
  140. ahadiff-1.1.0/src/ahadiff/lesson/helpfulness.py +126 -0
  141. ahadiff-1.1.0/src/ahadiff/lesson/learnability.py +280 -0
  142. ahadiff-1.1.0/src/ahadiff/lesson/scaffolding.py +66 -0
  143. ahadiff-1.1.0/src/ahadiff/lesson/schemas.py +663 -0
  144. ahadiff-1.1.0/src/ahadiff/lesson/transfer.py +147 -0
  145. ahadiff-1.1.0/src/ahadiff/llm/__init__.py +164 -0
  146. ahadiff-1.1.0/src/ahadiff/llm/adapters/__init__.py +21 -0
  147. ahadiff-1.1.0/src/ahadiff/llm/adapters/_capability_overrides.py +49 -0
  148. ahadiff-1.1.0/src/ahadiff/llm/adapters/anthropic.py +144 -0
  149. ahadiff-1.1.0/src/ahadiff/llm/adapters/azure.py +118 -0
  150. ahadiff-1.1.0/src/ahadiff/llm/adapters/gemini.py +112 -0
  151. ahadiff-1.1.0/src/ahadiff/llm/adapters/lmstudio.py +107 -0
  152. ahadiff-1.1.0/src/ahadiff/llm/adapters/newapi.py +7 -0
  153. ahadiff-1.1.0/src/ahadiff/llm/adapters/ollama.py +164 -0
  154. ahadiff-1.1.0/src/ahadiff/llm/adapters/openai.py +174 -0
  155. ahadiff-1.1.0/src/ahadiff/llm/adapters/openai_compat.py +75 -0
  156. ahadiff-1.1.0/src/ahadiff/llm/adapters/openai_responses.py +134 -0
  157. ahadiff-1.1.0/src/ahadiff/llm/adapters/structured.py +104 -0
  158. ahadiff-1.1.0/src/ahadiff/llm/adapters/thinking.py +118 -0
  159. ahadiff-1.1.0/src/ahadiff/llm/cache.py +281 -0
  160. ahadiff-1.1.0/src/ahadiff/llm/cost.py +798 -0
  161. ahadiff-1.1.0/src/ahadiff/llm/model_registry.json +1448 -0
  162. ahadiff-1.1.0/src/ahadiff/llm/model_registry.py +439 -0
  163. ahadiff-1.1.0/src/ahadiff/llm/probe.py +271 -0
  164. ahadiff-1.1.0/src/ahadiff/llm/probe_limits.py +18 -0
  165. ahadiff-1.1.0/src/ahadiff/llm/provider.py +1109 -0
  166. ahadiff-1.1.0/src/ahadiff/llm/schemas.py +157 -0
  167. ahadiff-1.1.0/src/ahadiff/llm/strict_json.py +99 -0
  168. ahadiff-1.1.0/src/ahadiff/llm/structured.py +427 -0
  169. ahadiff-1.1.0/src/ahadiff/llm/usage.py +402 -0
  170. ahadiff-1.1.0/src/ahadiff/llm/validation_retry.py +182 -0
  171. ahadiff-1.1.0/src/ahadiff/mcp/__init__.py +5 -0
  172. ahadiff-1.1.0/src/ahadiff/mcp/_lesson_search.py +355 -0
  173. ahadiff-1.1.0/src/ahadiff/mcp/server.py +1325 -0
  174. ahadiff-1.1.0/src/ahadiff/prompts/claim_extract.md +47 -0
  175. ahadiff-1.1.0/src/ahadiff/prompts/eval_judge.md +39 -0
  176. ahadiff-1.1.0/src/ahadiff/prompts/improve_program.md +30 -0
  177. ahadiff-1.1.0/src/ahadiff/prompts/lesson_compact.md +36 -0
  178. ahadiff-1.1.0/src/ahadiff/prompts/lesson_generate.md +42 -0
  179. ahadiff-1.1.0/src/ahadiff/prompts/lesson_hint.md +38 -0
  180. ahadiff-1.1.0/src/ahadiff/prompts/misconception_card.md +25 -0
  181. ahadiff-1.1.0/src/ahadiff/prompts/quiz_generate.md +67 -0
  182. ahadiff-1.1.0/src/ahadiff/prompts/spec_semantic_alignment.md +27 -0
  183. ahadiff-1.1.0/src/ahadiff/py.typed +0 -0
  184. ahadiff-1.1.0/src/ahadiff/quiz/__init__.py +44 -0
  185. ahadiff-1.1.0/src/ahadiff/quiz/adaptive.py +108 -0
  186. ahadiff-1.1.0/src/ahadiff/quiz/generator.py +834 -0
  187. ahadiff-1.1.0/src/ahadiff/quiz/misconception.py +494 -0
  188. ahadiff-1.1.0/src/ahadiff/quiz/schemas.py +679 -0
  189. ahadiff-1.1.0/src/ahadiff/review/__init__.py +171 -0
  190. ahadiff-1.1.0/src/ahadiff/review/apkg_export.py +250 -0
  191. ahadiff-1.1.0/src/ahadiff/review/database.py +3188 -0
  192. ahadiff-1.1.0/src/ahadiff/review/optimizer.py +267 -0
  193. ahadiff-1.1.0/src/ahadiff/review/scheduler.py +230 -0
  194. ahadiff-1.1.0/src/ahadiff/review/schemas.py +100 -0
  195. ahadiff-1.1.0/src/ahadiff/review/search.py +273 -0
  196. ahadiff-1.1.0/src/ahadiff/review/signal.py +38 -0
  197. ahadiff-1.1.0/src/ahadiff/review/templates/__init__.py +0 -0
  198. ahadiff-1.1.0/src/ahadiff/review/templates/anki_card.css +29 -0
  199. ahadiff-1.1.0/src/ahadiff/safety/__init__.py +3 -0
  200. ahadiff-1.1.0/src/ahadiff/safety/_types.py +14 -0
  201. ahadiff-1.1.0/src/ahadiff/safety/allowlist.yaml +18 -0
  202. ahadiff-1.1.0/src/ahadiff/safety/audit.py +314 -0
  203. ahadiff-1.1.0/src/ahadiff/safety/gates.py +54 -0
  204. ahadiff-1.1.0/src/ahadiff/safety/ignore.py +269 -0
  205. ahadiff-1.1.0/src/ahadiff/safety/injection.py +292 -0
  206. ahadiff-1.1.0/src/ahadiff/safety/redact.py +667 -0
  207. ahadiff-1.1.0/src/ahadiff/serve/__init__.py +6 -0
  208. ahadiff-1.1.0/src/ahadiff/serve/_errors.py +32 -0
  209. ahadiff-1.1.0/src/ahadiff/serve/app.py +346 -0
  210. ahadiff-1.1.0/src/ahadiff/serve/auth.py +77 -0
  211. ahadiff-1.1.0/src/ahadiff/serve/config_runtime.py +50 -0
  212. ahadiff-1.1.0/src/ahadiff/serve/locale.py +23 -0
  213. ahadiff-1.1.0/src/ahadiff/serve/lock.py +22 -0
  214. ahadiff-1.1.0/src/ahadiff/serve/middleware.py +399 -0
  215. ahadiff-1.1.0/src/ahadiff/serve/routes_audit.py +195 -0
  216. ahadiff-1.1.0/src/ahadiff/serve/routes_capture.py +102 -0
  217. ahadiff-1.1.0/src/ahadiff/serve/routes_challenge.py +471 -0
  218. ahadiff-1.1.0/src/ahadiff/serve/routes_config.py +865 -0
  219. ahadiff-1.1.0/src/ahadiff/serve/routes_db.py +46 -0
  220. ahadiff-1.1.0/src/ahadiff/serve/routes_demo.py +129 -0
  221. ahadiff-1.1.0/src/ahadiff/serve/routes_export.py +394 -0
  222. ahadiff-1.1.0/src/ahadiff/serve/routes_graph.py +336 -0
  223. ahadiff-1.1.0/src/ahadiff/serve/routes_improve.py +369 -0
  224. ahadiff-1.1.0/src/ahadiff/serve/routes_install.py +400 -0
  225. ahadiff-1.1.0/src/ahadiff/serve/routes_learn.py +680 -0
  226. ahadiff-1.1.0/src/ahadiff/serve/routes_locale.py +68 -0
  227. ahadiff-1.1.0/src/ahadiff/serve/routes_providers.py +1323 -0
  228. ahadiff-1.1.0/src/ahadiff/serve/routes_review.py +323 -0
  229. ahadiff-1.1.0/src/ahadiff/serve/routes_runs.py +1468 -0
  230. ahadiff-1.1.0/src/ahadiff/serve/routes_search.py +127 -0
  231. ahadiff-1.1.0/src/ahadiff/serve/routes_signals.py +168 -0
  232. ahadiff-1.1.0/src/ahadiff/serve/routes_stats.py +1131 -0
  233. ahadiff-1.1.0/src/ahadiff/serve/routes_tasks.py +246 -0
  234. ahadiff-1.1.0/src/ahadiff/serve/routes_watch.py +55 -0
  235. ahadiff-1.1.0/src/ahadiff/serve/state.py +68 -0
  236. ahadiff-1.1.0/src/ahadiff/serve/static.py +74 -0
  237. ahadiff-1.1.0/src/ahadiff/wiki/__init__.py +19 -0
  238. ahadiff-1.1.0/src/ahadiff/wiki/concepts.py +887 -0
  239. ahadiff-1.1.0/src/ahadiff/wiki/lint.py +758 -0
  240. ahadiff-1.1.0/viewer/dist/.vite/manifest.json +728 -0
  241. ahadiff-1.1.0/viewer/dist/assets/AppShell-9Dsje35l.css +1 -0
  242. ahadiff-1.1.0/viewer/dist/assets/AppShell-DCQxFRRH.js +2 -0
  243. ahadiff-1.1.0/viewer/dist/assets/CalendarHeatmap-C0E8NwO-.css +1 -0
  244. ahadiff-1.1.0/viewer/dist/assets/CalendarHeatmap-DPlLVZR5.js +1 -0
  245. ahadiff-1.1.0/viewer/dist/assets/ChallengePage-CANAqae0.js +1 -0
  246. ahadiff-1.1.0/viewer/dist/assets/ChallengePage-DXPUh3Ml.css +1 -0
  247. ahadiff-1.1.0/viewer/dist/assets/ClaimBadge-BQFh2PdV.js +1 -0
  248. ahadiff-1.1.0/viewer/dist/assets/ClaimBadge-CbAHeN0n.css +1 -0
  249. ahadiff-1.1.0/viewer/dist/assets/CommandBlock-C4Qeaw4h.js +1 -0
  250. ahadiff-1.1.0/viewer/dist/assets/CommandBlock-CNzX6E2y.css +1 -0
  251. ahadiff-1.1.0/viewer/dist/assets/ConceptsPage-BB3XsjbA.js +1 -0
  252. ahadiff-1.1.0/viewer/dist/assets/ConceptsPage-DcFGP7Rn.css +1 -0
  253. ahadiff-1.1.0/viewer/dist/assets/DashboardPage-CC3YHtRX.css +1 -0
  254. ahadiff-1.1.0/viewer/dist/assets/DashboardPage-y4C7t34A.js +2 -0
  255. ahadiff-1.1.0/viewer/dist/assets/DiffViewerPage-BasS7n_B.css +1 -0
  256. ahadiff-1.1.0/viewer/dist/assets/DiffViewerPage-C4Fw0GvR.js +7 -0
  257. ahadiff-1.1.0/viewer/dist/assets/EvidencePanel-BUprHSxX.js +1 -0
  258. ahadiff-1.1.0/viewer/dist/assets/GraphifyCard-B96UqPYy.css +1 -0
  259. ahadiff-1.1.0/viewer/dist/assets/GraphifyCard-Cdw86lba.js +1 -0
  260. ahadiff-1.1.0/viewer/dist/assets/GraphifyCard-DOXJgEhe.js +1 -0
  261. ahadiff-1.1.0/viewer/dist/assets/GraphifySourceCard-BaI7d8Yd.js +1 -0
  262. ahadiff-1.1.0/viewer/dist/assets/GuidePage-1QExWtbw.js +17 -0
  263. ahadiff-1.1.0/viewer/dist/assets/GuidePage-BnNF9js4.css +1 -0
  264. ahadiff-1.1.0/viewer/dist/assets/ImprovePreview-B9KJiJav.js +1 -0
  265. ahadiff-1.1.0/viewer/dist/assets/ImprovePreview-D13gbr33.css +1 -0
  266. ahadiff-1.1.0/viewer/dist/assets/InfoHint-7X3W88et.css +1 -0
  267. ahadiff-1.1.0/viewer/dist/assets/InfoHint-Cg6dQ5mg.js +1 -0
  268. ahadiff-1.1.0/viewer/dist/assets/LandingPage-Dbk142RU.js +10 -0
  269. ahadiff-1.1.0/viewer/dist/assets/LandingPage-jMsomcBF.css +1 -0
  270. ahadiff-1.1.0/viewer/dist/assets/LearnModeDialog-AMyDVwX_.js +1 -0
  271. ahadiff-1.1.0/viewer/dist/assets/LearnModeDialog-qJpeYnbj.css +1 -0
  272. ahadiff-1.1.0/viewer/dist/assets/LearnTaskBanner-BQ5DkTXe.js +1 -0
  273. ahadiff-1.1.0/viewer/dist/assets/LearnTaskBanner-C0m-wKNk.css +1 -0
  274. ahadiff-1.1.0/viewer/dist/assets/LessonPage-BLCUMU5w.js +4 -0
  275. ahadiff-1.1.0/viewer/dist/assets/LessonPage-J60eugJe.css +1 -0
  276. ahadiff-1.1.0/viewer/dist/assets/NotFoundPage-CZ8X8P0P.js +1 -0
  277. ahadiff-1.1.0/viewer/dist/assets/OnboardingPage-2tTsxpn4.css +1 -0
  278. ahadiff-1.1.0/viewer/dist/assets/OnboardingPage-6GtjsPZW.js +3 -0
  279. ahadiff-1.1.0/viewer/dist/assets/QuizPage-BriqxVqQ.js +4 -0
  280. ahadiff-1.1.0/viewer/dist/assets/QuizPage-QsJU7SKE.css +1 -0
  281. ahadiff-1.1.0/viewer/dist/assets/RatchetChart-ZXv9EsKV.js +1 -0
  282. ahadiff-1.1.0/viewer/dist/assets/RatchetChart-zf40NrhD.css +1 -0
  283. ahadiff-1.1.0/viewer/dist/assets/RatchetPage-8ZjROQ5b.js +5 -0
  284. ahadiff-1.1.0/viewer/dist/assets/RatchetPage-BrvAecTL.css +1 -0
  285. ahadiff-1.1.0/viewer/dist/assets/ReviewPage-B8KJOqRB.js +2 -0
  286. ahadiff-1.1.0/viewer/dist/assets/ReviewPage-Djr0Arm5.css +1 -0
  287. ahadiff-1.1.0/viewer/dist/assets/RunDetailPage-BUCrJrXm.css +1 -0
  288. ahadiff-1.1.0/viewer/dist/assets/RunDetailPage-haQ01GCT.js +2 -0
  289. ahadiff-1.1.0/viewer/dist/assets/SearchOverlay-CreadLlX.css +1 -0
  290. ahadiff-1.1.0/viewer/dist/assets/SearchOverlay-Dp4rfckb.js +1 -0
  291. ahadiff-1.1.0/viewer/dist/assets/SettingsPage-BI4RS7Lh.css +1 -0
  292. ahadiff-1.1.0/viewer/dist/assets/SettingsPage-D450PhOF.js +2 -0
  293. ahadiff-1.1.0/viewer/dist/assets/Skeleton-CUuGMnjh.css +1 -0
  294. ahadiff-1.1.0/viewer/dist/assets/Skeleton-DnmeLUWt.js +1 -0
  295. ahadiff-1.1.0/viewer/dist/assets/UsagePanel-KDir0NTE.js +1 -0
  296. ahadiff-1.1.0/viewer/dist/assets/UsagePanel-Z1v1N5v0.css +1 -0
  297. ahadiff-1.1.0/viewer/dist/assets/clipboard-D8_T8yuw.js +1 -0
  298. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-300-normal-BuXLI6C0.woff +0 -0
  299. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-300-normal-Cw-E_7L1.woff2 +0 -0
  300. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-400-italic-BLh7T8o8.woff +0 -0
  301. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-400-italic-Dc_OZ8oc.woff2 +0 -0
  302. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-400-normal-B-1hWBU7.woff2 +0 -0
  303. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-400-normal-B7YtguxJ.woff +0 -0
  304. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-600-normal-2CBVLo0M.woff +0 -0
  305. ahadiff-1.1.0/viewer/dist/assets/cormorant-garamond-latin-600-normal-Co1r35X9.woff2 +0 -0
  306. ahadiff-1.1.0/viewer/dist/assets/doctor-C9Mb7g4X.css +1 -0
  307. ahadiff-1.1.0/viewer/dist/assets/doctor-Qe6ovKhr.js +1 -0
  308. ahadiff-1.1.0/viewer/dist/assets/hard-gates-DIZRerhy.js +1 -0
  309. ahadiff-1.1.0/viewer/dist/assets/idempotency-D5pLKM8A.js +1 -0
  310. ahadiff-1.1.0/viewer/dist/assets/index-DOJ1Ce4O.js +16 -0
  311. ahadiff-1.1.0/viewer/dist/assets/index-DyS6SVUP.css +1 -0
  312. ahadiff-1.1.0/viewer/dist/assets/markdown-CJokCqkc.js +3 -0
  313. ahadiff-1.1.0/viewer/dist/assets/review-BbE9Wi53.js +1 -0
  314. ahadiff-1.1.0/viewer/dist/assets/signals-XNSyx1SI.js +1 -0
  315. ahadiff-1.1.0/viewer/dist/assets/stats-BGsGiN5C.js +1 -0
  316. ahadiff-1.1.0/viewer/dist/assets/vendor-graph-CIDDrSdo.js +46 -0
  317. ahadiff-1.1.0/viewer/dist/assets/vendor-misc-C-bP8WKR.css +1 -0
  318. ahadiff-1.1.0/viewer/dist/assets/vendor-misc-CTj4-mM9.js +181 -0
  319. ahadiff-1.1.0/viewer/dist/assets/vendor-page-deps-BGRrjEMU.js +64 -0
  320. ahadiff-1.1.0/viewer/dist/assets/vendor-react-D0d-xh35.js +49 -0
  321. ahadiff-1.1.0/viewer/dist/assets/vendor-router-C1y3GPND.js +28 -0
  322. ahadiff-1.1.0/viewer/dist/favicon.svg +4 -0
  323. ahadiff-1.1.0/viewer/dist/icons/ahadiff-192.png +0 -0
  324. ahadiff-1.1.0/viewer/dist/icons/ahadiff-512.png +0 -0
  325. ahadiff-1.1.0/viewer/dist/icons/ahadiff.svg +6 -0
  326. ahadiff-1.1.0/viewer/dist/index.html +63 -0
  327. ahadiff-1.1.0/viewer/dist/manifest.json +30 -0
  328. ahadiff-1.1.0/viewer/dist/registerSW.js +45 -0
  329. ahadiff-1.1.0/viewer/dist/sw.js +1 -0
  330. ahadiff-1.1.0/viewer/dist/workbox-3105ea8d.js +1 -0
@@ -0,0 +1,148 @@
1
+ # Cloned reference repos (test/exploration only)
2
+ repo/
3
+
4
+ # Graphify output (generated artifacts)
5
+ graphify-out/
6
+
7
+ # Playwright MCP cache
8
+ .playwright-mcp/
9
+
10
+ # Eval screenshots (generated during testing)
11
+ eval-screenshots/
12
+
13
+ # Local AhaDiff per-repo state
14
+ .ahadiff/
15
+
16
+ # macOS
17
+ .DS_Store
18
+ .DS_Store?
19
+ ._*
20
+
21
+ # Python
22
+ __pycache__/
23
+ *.py[cod]
24
+ *.egg-info/
25
+ .coverage
26
+ dist/
27
+ build/
28
+ .venv/
29
+ *.egg
30
+
31
+ # JavaScript
32
+ node_modules/
33
+
34
+ # IDE
35
+ .idea/
36
+ .vscode/
37
+ *.swp
38
+ *.swo
39
+
40
+ # Environment
41
+ .env
42
+ .env.*
43
+
44
+ # Claude Code local dev artifacts (review reports, team plans, memory)
45
+ .claude/
46
+
47
+ # CCG local dev artifacts (review reports, team plans, scratch)
48
+ .ccg/
49
+ .codex/
50
+
51
+ # Generated agent skill installs (local only)
52
+ .agents/
53
+
54
+ # Internal planning artifacts (research prompts, audit reports, kept local)
55
+ plan/
56
+
57
+ # Development screenshots & test patches (local only)
58
+ *.png
59
+ !viewer/public/icons/ahadiff-192.png
60
+ !viewer/public/icons/ahadiff-512.png
61
+ # Committed media: README/USER_GUIDE-embedded screenshots & burned-subtitles tutorial videos
62
+ # Only the 16 README-embedded screenshots (8 EN + 8 ZH). Other dev/eval captures stay ignored.
63
+ !docs/video/public/screenshots/en/en-concepts-graph.png
64
+ !docs/video/public/screenshots/en/en-dashboard.png
65
+ !docs/video/public/screenshots/en/en-diff.png
66
+ !docs/video/public/screenshots/en/en-lesson.png
67
+ !docs/video/public/screenshots/en/en-quiz.png
68
+ !docs/video/public/screenshots/en/en-review.png
69
+ !docs/video/public/screenshots/en/en-rundetail-overview.png
70
+ !docs/video/public/screenshots/en/en-settings.png
71
+ !docs/video/public/screenshots/zh/zh-concepts-graph.png
72
+ !docs/video/public/screenshots/zh/zh-dashboard.png
73
+ !docs/video/public/screenshots/zh/zh-diff.png
74
+ !docs/video/public/screenshots/zh/zh-lesson.png
75
+ !docs/video/public/screenshots/zh/zh-quiz.png
76
+ !docs/video/public/screenshots/zh/zh-review.png
77
+ !docs/video/public/screenshots/zh/zh-rundetail-overview.png
78
+ !docs/video/public/screenshots/zh/zh-settings.png
79
+ !docs/video/output/*.burned-subtitles.mp4
80
+ *.patch
81
+ !benchmarks/fixtures/**/*.patch
82
+
83
+ # Large media source files (keep only burned-subtitles MP4 for users)
84
+ *.wav
85
+ *.mp3
86
+ *.m4a
87
+ *.ogg
88
+ *.webm
89
+ *.mov
90
+ docs/video/output/*clean*.mp4
91
+
92
+ # Local dev output dirs
93
+ /output/
94
+ artifacts/
95
+ /screenshots/
96
+ .claude-tmp/
97
+
98
+ # TypeScript incremental cache
99
+ *.tsbuildinfo
100
+
101
+ # Benchmark run outputs (regenerated by benchmarks/scripts/run_all.sh;
102
+ # derived results, not source — baseline json embeds dev-machine absolute paths)
103
+ benchmarks/results/
104
+
105
+ # Development-only tracked files (kept locally for reference)
106
+ result.json
107
+ blueprint-snapshot.md
108
+ snapshot-01-dashboard.md
109
+ docs/VALIDATION_AUDIT.zh.md
110
+ docs/USER_GUIDE.*.txt
111
+ viewer/AUDIT-REPORT.md
112
+ viewer/AUDIT_V6_FIDELITY.md
113
+ viewer/V6_DEEP_ANALYSIS.md
114
+
115
+ # Release cleanup: development-only directories and files
116
+
117
+ # Development HTML mockups and prototypes (root + ui/)
118
+ AhaDiff Warm*.html
119
+ AhaDiff-Blueprint.html
120
+ AhaDiff-Competitors-Research.html
121
+ ui/
122
+
123
+ # Internal development documentation and planning
124
+ doc/
125
+ docs/EVAL_SCORING_ENHANCEMENT_PLAN.md
126
+ docs/EVAL_SCORING_ENHANCEMENT_REVIEW.md
127
+ docs/plans/
128
+
129
+ # Codex / Aider / dev conventions (not for end users)
130
+ AGENTS.md
131
+ CLAUDE.md
132
+ CONVENTIONS.md
133
+ R0-feature-matrix.md
134
+
135
+ # Video build intermediates (keep final burned-subtitles MP4 + screenshots)
136
+ docs/video/content/
137
+ docs/video/output/asr/
138
+ docs/video/output/script/
139
+ docs/video/output/subtitles/
140
+ docs/video/scripts/
141
+ docs/video/src/
142
+ docs/video/package.json
143
+ docs/video/pnpm-lock.yaml
144
+ docs/video/remotion.config.ts
145
+ docs/video/tsconfig.json
146
+ docs/video/README.md
147
+ docs/video/public/captions/
148
+ docs/video/.gitignore
ahadiff-1.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AhaDiff 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.
ahadiff-1.1.0/PKG-INFO ADDED
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.4
2
+ Name: ahadiff
3
+ Version: 1.1.0
4
+ Summary: Local-first verified diff learning layer.
5
+ Project-URL: Homepage, https://github.com/AGI-is-going-to-arrive/ahadiff
6
+ Project-URL: Repository, https://github.com/AGI-is-going-to-arrive/ahadiff
7
+ Project-URL: Documentation, https://github.com/AGI-is-going-to-arrive/ahadiff
8
+ Project-URL: Issues, https://github.com/AGI-is-going-to-arrive/ahadiff/issues
9
+ Author: AhaDiff
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: code-review,diff,learning,llm,local-first,srs
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: fsrs<7,>=6.3.1
24
+ Requires-Dist: genanki<1,>=0.13
25
+ Requires-Dist: httpx<1,>=0.28
26
+ Requires-Dist: jinja2<4,>=3.1
27
+ Requires-Dist: mcp<2,>=1.0
28
+ Requires-Dist: portalocker<4,>=3.1
29
+ Requires-Dist: pydantic<3,>=2.11
30
+ Requires-Dist: rich<15,>=14
31
+ Requires-Dist: starlette<1,>=0.49
32
+ Requires-Dist: tree-sitter-c-sharp<1,>=0.23
33
+ Requires-Dist: tree-sitter-go<1,>=0.25
34
+ Requires-Dist: tree-sitter-java<1,>=0.23
35
+ Requires-Dist: tree-sitter-javascript<1,>=0.25
36
+ Requires-Dist: tree-sitter-php<1,>=0.24
37
+ Requires-Dist: tree-sitter-ruby<1,>=0.23
38
+ Requires-Dist: tree-sitter-rust<1,>=0.24
39
+ Requires-Dist: tree-sitter-typescript<1,>=0.23
40
+ Requires-Dist: tree-sitter<1,>=0.24
41
+ Requires-Dist: typer<1,>=0.16
42
+ Requires-Dist: uvicorn<1,>=0.38
43
+ Requires-Dist: watchdog<7,>=6
44
+ Provides-Extra: anki
45
+ Provides-Extra: optimizer
46
+ Requires-Dist: fsrs[optimizer]<7,>=6.3.1; extra == 'optimizer'
47
+ Provides-Extra: tree-sitter
48
+ Provides-Extra: watchdog
49
+ Description-Content-Type: text/markdown
50
+
51
+ # AhaDiff (知返)
52
+
53
+ > **Ship with AI. Learn it back.**
54
+ >
55
+ > Every AI-written git diff becomes a verified Aha lesson, with code-linked evidence, active-recall quizzes, spaced review, and a self-improving quality ratchet.
56
+
57
+ [中文](./README.zh.md) · [Landing page](https://agi-is-going-to-arrive.github.io/ahadiff/) · [User Guide](./docs/USER_GUIDE.en.html) · [English tutorial video (subtitled)](./docs/video/output/ahadiff-tutorial.en.burned-subtitles.mp4) · [Chinese tutorial video (Bilibili)](https://www.bilibili.com/video/BV1b57k6yEWm)
58
+
59
+ ---
60
+
61
+ ## What it is
62
+
63
+ **AhaDiff** is a **local-first learning layer for AI coding**.
64
+
65
+ It is not a PR summary or a repo wiki. It reads a single git diff and turns that change into:
66
+
67
+ - A **lesson** that teaches what changed and why
68
+ - A **claims ledger** where conclusions trace back to `file:line` evidence
69
+ - A **quiz and review loop** so the knowledge comes back later
70
+ - A **quality history** that makes runs comparable over time
71
+
72
+ All repo-local state lives in `.ahadiff/`: run artifacts under `runs/`, and SRS / result history in `review.sqlite`.
73
+
74
+ > Code Wiki explains a repo. AhaDiff teaches you what changed, and verifies every claim against the diff.
75
+
76
+ ## Why
77
+
78
+ AI writes code faster, but developers can understand less of what actually changed. AhaDiff exists to close that loop:
79
+
80
+ 1. **AI ships, understanding returns to humans**: a commit message is not enough.
81
+ 2. **Every claim needs evidence**: no hallucinated functions, no fabricated causality.
82
+ 3. **Knowledge should compound**: repeated concepts should build history and backlinks.
83
+ 4. **Quality should be comparable**: replace "looks fine" with a stable score and ratchet.
84
+
85
+ ## Prerequisites
86
+
87
+ - Python 3.11+ with Python's `sqlite3` runtime at SQLite 3.51.3+; patched backport branches 3.50.4+ and 3.44.6+ are also accepted. Run `ahadiff doctor` to check the runtime Python actually uses.
88
+ - git (on PATH)
89
+ - [uv](https://docs.astral.sh/uv/): install with `curl -LsSf https://astral.sh/uv/install.sh | sh` or `brew install uv`
90
+ - An LLM provider: remote (OpenAI / Anthropic / Gemini / Azure / any OpenAI-compatible) with API key, or local (LM Studio / Ollama, no key needed)
91
+
92
+ ## Install
93
+
94
+ ```bash
95
+ pip install ahadiff
96
+ ahadiff --version # should print ahadiff 1.1.0
97
+ ```
98
+ This ships a working WebUI out of the box, and all default features work with no extras.
99
+
100
+ `pip install 'ahadiff[optimizer]'` is only needed for FSRS parameter auto-optimization, which pulls in a heavy torch dependency. Base review and scheduling work without it.
101
+
102
+ ### From source (contributors)
103
+
104
+ ```bash
105
+ git clone https://github.com/AGI-is-going-to-arrive/ahadiff.git
106
+ cd ahadiff
107
+ uv tool install --editable .
108
+ cd viewer && pnpm install && pnpm build # builds the dev WebUI
109
+ ```
110
+
111
+ ## Configure a provider
112
+
113
+ AhaDiff needs an LLM to generate lessons. Set up once per repo:
114
+ ```bash
115
+ ahadiff init
116
+
117
+ # Register and test a provider (OpenAI-compatible example)
118
+ export OPENAI_API_KEY="<your-provider-api-key>"
119
+ export AHADIFF_PROVIDER_BASE_URL="<provider-base-url>"
120
+ ahadiff provider test \
121
+ --name default \
122
+ --provider-class openai \
123
+ --base-url "$AHADIFF_PROVIDER_BASE_URL" \
124
+ --api-key-env OPENAI_API_KEY
125
+ ```
126
+ `provider test` sends a small probe request. If it succeeds, the provider is saved to `.ahadiff/config.toml`. When the provider exposes model limits, AhaDiff records split input / output limits; otherwise auto capture falls back to the bundled model registry or conservative defaults.
127
+
128
+ `api_key_env` is the environment variable name, not the secret. Repo config accepts `AHADIFF_*` names and the common provider names (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `AZURE_OPENAI_API_KEY`). Identifier-shaped values are treated as environment-variable names and fail closed when unset, so a missing variable is not sent as a literal bearer token.
129
+
130
+ Supported provider classes: `openai`, `openai_responses`, `gemini`, `anthropic`, `azure`, `newapi`, `lmstudio`, `ollama`. Advanced OpenAI-compatible or local setups can use `providers.<name>.capability_overrides` for known boolean capabilities such as native JSON schema support; invalid keys or non-boolean values are rejected. NewAPI disables `supports_native_json_schema` by default; if your NewAPI gateway backend actually supports native JSON schema, you can add `capability_overrides = { supports_native_json_schema = true }` in the provider config. See [User Guide](./docs/USER_GUIDE.en.html) for details.
131
+
132
+ The Settings provider card can also preview model limits before you save, using only the draft provider class, model, and optional limits profile. It does not call the remote provider or read the API key for that preview. Leaving `max_output_tokens` empty means Auto; when a known trusted output max is exceeded, save-time config clamps it and returns a warning. Unknown, low-confidence, route-specific, or local-runtime limits are shown as warnings instead of being presented as hard facts.
133
+
134
+ For GPT-5.5 specifically, the bundled registry keeps two profiles: ordinary `openai` access budgets 400k context, while `openai_responses` / API access budgets 1.05M. A live probe can still override the registry when the endpoint reports a trustworthy total context.
135
+
136
+ > AhaDiff defaults to strict_local privacy: nothing leaves your machine unless you explicitly configure a remote provider.
137
+
138
+ ## Your first lesson
139
+
140
+ ```bash
141
+ # Learn from your latest commit
142
+ ahadiff learn --last
143
+
144
+ # Open the local web UI to read your lesson
145
+ ahadiff serve
146
+ ```
147
+ `ahadiff serve` opens http://127.0.0.1:8765 automatically. Pass `--no-browser` to stay in the terminal. You'll see the Dashboard with your first run, then click through to Lesson, Diff, and Quiz.
148
+
149
+ Two more things to try:
150
+ ```bash
151
+ ahadiff quiz <run_id> # test yourself on what you just learned
152
+ ahadiff review # spaced-repetition review of past cards
153
+ ```
154
+ See the [User Guide](./docs/USER_GUIDE.en.html) for all 10 diff capture sources, export options, concept graphs, and advanced commands.
155
+
156
+ ## Features
157
+
158
+ - **Learn**: `ahadiff learn` supports 10 diff capture sources: working tree (`--staged --unstaged --include-untracked`), unstaged (`--unstaged`), staged (`--staged`), last commit (`--last`, or omit a capture-source flag), revision/range (`REVISION`), time-window (`--since`; add `--author` only when that filter matches one commit), patch file/stdin (`--patch FILE|-`), patch URL (`--patch-url`), file compare (`--compare`), and directory compare (`--compare-dir`, macOS/Linux only). Recursive directory compare requires the secure directory file descriptor available on macOS/Linux. Patch files are resolved inside the repo root; use stdin for external generated patches. Patch file/stdin and patch URL runs do not have a repository symbol index; when only hunk evidence is available, AhaDiff can still generate a lesson from weak diff-anchored claims instead of claiming symbol-level proof.
159
+ - **Evidence-linked claims**: every lesson conclusion is tied to `file:line` evidence, with verification states such as verified, weak, not proven, contradicted, and rejected.
160
+ - **Structured LLM output**: generation uses schema-aware JSON contracts where supported, defaults to JSON object mode with one bounded validation retry, and keeps the existing parser, repair, and degraded fallback paths. Truncated or malformed fallback JSON is retried instead of being accepted.
161
+ - **Adaptive capture limits**: fresh configs default to auto capture sizing; existing customized capture settings stay manual. Auto mode uses provider probes, the bundled model registry, output reserves, safety reserves, and CJK diff density, while runtime patch intake remains capped at 50 MiB. Settings previews provider limits from the current draft provider class, model, and optional limits profile before saving, without remote probing on every edit.
162
+ - **Quiz and review**: `ahadiff quiz` tests the run you just learned; source evidence stays locked until you answer. `ahadiff review` brings back older cards with spaced repetition. Quiz count is fixed by default (3 questions, configurable from 1 to 30) and can adapt to diff size when enabled (default range 3-12).
163
+ - **Scoring**: each run gets an 8-dimension deterministic score, with an optional advisory LLM judge when configured. No-spec `spec_alignment` is shown as N/A / `0/0` and excluded from the overall score; judge results never override `score.json.verdict`. Diff Coverage is based on visible `line_map.json` files and line-weighted hunks, and hard-gate details show the adaptive claim-anchor threshold used for that run. If the optional judge fails, the deterministic score is still kept and the failure is saved as a redacted `judge_failure.json`.
164
+ - **WebUI**: `ahadiff serve` opens Welcome, Dashboard, Lesson, Diff, Quiz, Review, Concepts, Run Detail, Settings, and Guide. The viewer uses a light, editorial paper-style theme, with fonts bundled locally so nothing loads from a CDN. Run Detail shows Score, Judge, Artifacts, and a sanitized judge-failure panel when the optional LLM judge could not complete. The Welcome Before/After demo keeps long raw diffs collapsed with a line count and a Show all / Collapse control; short or empty diffs stay simple.
165
+ - **New Run dialog**: Dashboard can start quick learn runs for working tree, unstaged, staged, or last commit changes, with advanced cards for `--since`, revision/range, patch URL, pasted patch text, file compare, and directory compare.
166
+ - **Export**: from the CLI, `ahadiff export-results` writes `results.tsv` and `ahadiff export preview` writes a local static preview bundle. The WebUI (and the `serve` API) also export TSV / JSON and Anki `.apkg`; `.apkg` export uses the bundled `genanki`, available by default.
167
+ - **Concept graph**: AhaDiff extracts cross-diff concepts and shows them in a Canvas graph with health checks.
168
+ - **AI tool integration**: project-level guidance for 15 CLI / IDE / CI targets. Settings groups the targets, shows localized usage hints and a provider-free local demo, and keeps write/remove behind confirmation. Guide shows commands plus read-only cards that explain usage and preview the files AhaDiff would write. Supported targets include Claude, Codex, Gemini, Antigravity IDE, Antigravity CLI, Copilot, OpenCode, Cursor, Cline, Continue, Roo, Windsurf, Aider, GitHub Actions, and Git hooks.
169
+ - **Auto-iteration**: `ahadiff improve` optimizes prompts in an isolated worktree and keeps only better results.
170
+ - **Privacy**: three tiers: strict_local, redacted_remote, explicit_remote. The default is strict_local.
171
+ - **i18n**: English and Chinese for the WebUI and prompt output language. CLI help and most CLI diagnostics are in English.
172
+ - **Cross-platform**: macOS and Linux are the primary tested platforms; Windows is supported for the core CLI and serve flows. `--compare-dir` and the `hooks` install target are macOS/Linux only. Installer writes and rollbacks use atomic replacement; POSIX restores file mode before replace, while Windows uses a best-effort mode restore after replace.
173
+ - **Validation scope**: the latest local pre-release audit covered backend unit/integration/eval tests, ruff/pyright, wheel build, viewer Vitest/typecheck/build, real-serve smoke, Guide browser checks, i18n parity, and live learn runs for the documented capture sources. A clean full Playwright matrix, remote CI, and a real Windows runner remain separate release gates.
174
+ - **Security**: URL secret redaction, provider URL validation, provider API-key environment validation, input validation, prompt injection detection, safety hard gates, and redacted judge-failure reporting.
175
+
176
+ ## Screenshots
177
+
178
+ <p align="center">
179
+ <img src="./docs/video/public/screenshots/en/en-dashboard.png" alt="Dashboard: runs, scores, ratchet trajectory" width="800">
180
+ </p>
181
+
182
+ <details>
183
+ <summary>Welcome: first-run entry point</summary>
184
+ <img src="./docs/video/public/screenshots/en/en-welcome.png" alt="Welcome page with first-run quick start" width="800">
185
+ </details>
186
+
187
+ <details>
188
+ <summary>Lesson: AI-generated lesson from your diff</summary>
189
+ <img src="./docs/video/public/screenshots/en/en-lesson.png" alt="Lesson page" width="800">
190
+ </details>
191
+
192
+ <details>
193
+ <summary>Diff Viewer: claim-linked code evidence</summary>
194
+ <img src="./docs/video/public/screenshots/en/en-diff.png" alt="Diff viewer with claim highlights" width="800">
195
+ </details>
196
+
197
+ <details>
198
+ <summary>Quiz: active recall from the lesson</summary>
199
+ <img src="./docs/video/public/screenshots/en/en-quiz.png" alt="Quiz page" width="800">
200
+ </details>
201
+
202
+ <details>
203
+ <summary>Review: spaced repetition cards</summary>
204
+ <img src="./docs/video/public/screenshots/en/en-review.png" alt="Review page" width="800">
205
+ </details>
206
+
207
+ <details>
208
+ <summary>Concept Graph: cross-diff knowledge map</summary>
209
+ <img src="./docs/video/public/screenshots/en/en-concepts-graph.png" alt="Concept graph" width="800">
210
+ </details>
211
+
212
+ <details>
213
+ <summary>Concepts Ledger: learned concepts table</summary>
214
+ <img src="./docs/video/public/screenshots/en/en-concepts.png" alt="Concepts ledger table" width="800">
215
+ </details>
216
+
217
+ <details>
218
+ <summary>Run Detail: scores and evaluation breakdown</summary>
219
+ <img src="./docs/video/public/screenshots/en/en-rundetail-overview.png" alt="Run detail overview" width="800">
220
+ </details>
221
+
222
+ <details>
223
+ <summary>Run Detail Score: 8-dimension score breakdown</summary>
224
+ <img src="./docs/video/public/screenshots/en/en-rundetail-score.png" alt="Run detail score breakdown" width="800">
225
+ </details>
226
+
227
+ <details>
228
+ <summary>Settings: provider, preferences, and AI tool guidance</summary>
229
+ <img src="./docs/video/public/screenshots/en/en-settings.png" alt="Settings page" width="800">
230
+ </details>
231
+
232
+ ## AI tool integration
233
+
234
+ AhaDiff writes repo-local guidance files for the current project; it does not install the AhaDiff CLI again or write global user directories:
235
+ ```bash
236
+ ahadiff install --detect # auto-detect your tools
237
+ ahadiff install claude # also: cursor, copilot, codex, gemini, antigravity, antigravity-cli, aider, windsurf, cline, roo, continue, ...
238
+ ```
239
+ 15 targets supported. Run `ahadiff install --help` for the full list, or configure in the WebUI under Settings → AI Tool Guidance.
240
+
241
+ Settings groups targets into CLI / IDE / CI, shows quick-start steps, example prompts, expected behavior, platform notes, and a provider-free local demo. Guide uses the same usage hints inside default-collapsed tool cards and shows what files would be written before you apply changes; actual write/remove stays in Settings.
242
+
243
+ Guide and the New Run dialog keep cards, note markers, and footer actions readable in Windows high-contrast / forced-colors mode; usage hints use the same tokenized type scale as the rest of the viewer.
244
+
245
+ Some targets write tool-native generated files. Examples include `.claude/skills/ahadiff/SKILL.md`, `.agents/skills/ahadiff/SKILL.md`, `.gemini/skills/ahadiff/SKILL.md`, `.agents/skills/ahadiff-antigravity/SKILL.md`, `.agents/skills/ahadiff-antigravity-cli/SKILL.md`, `.agents/rules/ahadiff.md`, `.github/instructions/ahadiff.instructions.md`, `.opencode/agents/ahadiff.md`, `.clinerules/ahadiff.md`, `.continue/rules/ahadiff.md`, `.cursor/rules/ahadiff.mdc`, `.roo/rules/ahadiff.md`, and `.windsurf/rules/ahadiff.md`. Repo guidance sections stay in user-managed files such as `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, and `.github/copilot-instructions.md`. Uninstall only removes AhaDiff-generated files and AhaDiff marked sections.
246
+
247
+ This repository ignores generated `.agents/` installs, so repo-local Codex / Antigravity skill output remains local unless a user explicitly tracks it.
248
+
249
+ ## 8-Dimension Rubric
250
+
251
+ | # | Dimension | Weight | Hard gate |
252
+ |---|-----------|--------|-----------|
253
+ | 1 | Accuracy | 20 | Base gate: < 14 → FAIL. Runtime policy may lower this threshold for very large visible diffs, but unsafe rejected-claim ratios and safety gates still block PASS. |
254
+ | 2 | Evidence | 18 | Base gate: < 12 → FAIL. Runtime policy may lower this threshold for very large visible diffs, but invalid or missing evidence still counts against the run. |
255
+ | 3 | Diff Coverage | 14 | Adaptive claim-anchor gate. Normal diffs fail below 7.70; large broad diffs use a lower threshold, while one/two-file many-hunk diffs use a stricter one. The exact ratio, regime, and visible basis are written into hard gate details. |
256
+ | 4 | Learnability | 14 | None |
257
+ | 5 | Quiz Transfer | 10 | None |
258
+ | 6 | Spec Alignment | 10 | None |
259
+ | 7 | Conciseness | 8 | None |
260
+ | 8 | Safety & Privacy | 6 | Unmitigated Critical → FAIL |
261
+
262
+ Three verdicts: **PASS** ≥ 80 / **CAUTION** 60–80 / **FAIL** < 60. Hard gates can still force **FAIL** even when the overall score is high; contradicted claims require zero tolerance, and unmitigated Critical safety findings fail the run.
263
+
264
+ ## Repository Layout
265
+
266
+ ```text
267
+ ahadiff/
268
+ ├─ src/ahadiff/ # Python source
269
+ ├─ viewer/ # React 19 frontend
270
+ ├─ tests/ # Test suite
271
+ ├─ prompts/ # LLM prompt templates
272
+ ├─ benchmarks/ # Eval benchmark fixtures
273
+ ├─ docs/ # Landing page, user guides, tutorial videos
274
+ ├─ .github/workflows/ # CI/CD
275
+ ├─ pyproject.toml # Python package config
276
+ └─ LICENSE # MIT
277
+ ```
278
+
279
+ ## Core Philosophy (N-File Contract)
280
+
281
+ AhaDiff extends the Karpathy / autoresearch three-file contract into an N-file variant:
282
+
283
+ | File | Who edits | Role |
284
+ |------|-----------|------|
285
+ | `program.md` | Human | Natural-language state machine for the improve loop |
286
+ | evaluation bundle | **Immutable** | `evaluator.py` + `rubric.py` + `rubric.yaml` + `gates.py` + `deterministic.py`, locked as a unit |
287
+ | `prompts/*.md` | Agent | The improve loop edits only allowlisted generation prompts; `eval_judge.md` is a judge prompt resource, not part of that writable set |
288
+
289
+ Loop: edit → commit → evaluate → keep if better, reset if worse → record the result for review and future runs.
290
+
291
+ ## Inspirations, Design Axioms, and License
292
+
293
+ ### Inspirations
294
+
295
+ - **karpathy/autoresearch**: N-file contract and git ratchet
296
+ - **alchaincyf/darwin-skill**: 8-dimension rubric and Phase 2.5 rewrite
297
+ - **Evol-ai/SkillCompass**: PASS / CAUTION / FAIL and weakest-dimension-first
298
+ - **ZJU-REAL/SkillZero**: helpfulness-driven retention and compact context
299
+ - **safishamsi/graphify**: repo-level graph overlay
300
+ - **karpathy/llm-wiki** gist: persistent compounding wiki
301
+
302
+ ### Design Axioms
303
+
304
+ 1. **Evidence first**: every claim must trace back to `file:line`
305
+ 2. **Learning over summary**: quizzes and review beat pretty summaries
306
+ 3. **Local-first trust**: privacy tiers are explicit, and local stays local by default
307
+ 4. **Paper-like seriousness**: academic feel, not a loud SaaS landing page
308
+ 5. **One accent per style**: warm paper background plus a single accent color
309
+
310
+ ### Acknowledgements
311
+
312
+ Thanks to the [linux.do](https://linux.do/) community for feedback and support.
313
+
314
+ ### License
315
+
316
+ [MIT](./LICENSE)
317
+
318
+ ---
319
+
320
+ > AhaDiff / 知返: Δ知 ↺