codevira 4.0.1__tar.gz → 4.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 (420) hide show
  1. {codevira-4.0.1 → codevira-4.1.0}/CHANGELOG.md +213 -0
  2. {codevira-4.0.1/codevira.egg-info → codevira-4.1.0}/PKG-INFO +2 -2
  3. {codevira-4.0.1 → codevira-4.1.0}/README.md +1 -1
  4. {codevira-4.0.1 → codevira-4.1.0/codevira.egg-info}/PKG-INFO +2 -2
  5. {codevira-4.0.1 → codevira-4.1.0}/docs/v2-master-plan.md +19 -0
  6. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/__init__.py +1 -1
  7. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/relevance_inject.py +22 -1
  8. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/project_binding.py +93 -4
  9. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/retrieval/score.py +92 -2
  10. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/server.py +9 -0
  11. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/decisions_store.py +35 -4
  12. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/digest.py +16 -1
  13. codevira-4.1.0/mcp_server/storage/reconcile.py +505 -0
  14. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/check_conflict.py +23 -4
  15. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/learning.py +124 -3
  16. {codevira-4.0.1 → codevira-4.1.0}/pyproject.toml +1 -1
  17. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_relevance_inject.py +91 -4
  18. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_digest.py +13 -2
  19. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_score_breakdown.py +75 -1
  20. {codevira-4.0.1 → codevira-4.1.0}/tests/test_check_conflict.py +31 -6
  21. {codevira-4.0.1 → codevira-4.1.0}/tests/test_project_binding.py +146 -0
  22. codevira-4.1.0/tests/test_reconcile.py +446 -0
  23. {codevira-4.0.1 → codevira-4.1.0}/tests/test_retrieval_score.py +121 -0
  24. {codevira-4.0.1 → codevira-4.1.0}/tests/test_server.py +74 -0
  25. {codevira-4.0.1 → codevira-4.1.0}/tests/test_supersede_on_write.py +70 -0
  26. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_learning.py +259 -0
  27. codevira-4.0.1/mcp_server/storage/reconcile.py +0 -196
  28. codevira-4.0.1/tests/test_reconcile.py +0 -107
  29. {codevira-4.0.1 → codevira-4.1.0}/LICENSE +0 -0
  30. {codevira-4.0.1 → codevira-4.1.0}/MANIFEST.in +0 -0
  31. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/01-code-review.md +0 -0
  32. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/02-adversarial-fix-review.md +0 -0
  33. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/03-cross-module-impact.md +0 -0
  34. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/06-doc-drift.md +0 -0
  35. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/07-security-audit.md +0 -0
  36. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/12-llm-redteam.md +0 -0
  37. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/13-multi-ide-schema.md +0 -0
  38. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/22-competitor-benchmark.md +0 -0
  39. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/README.md +0 -0
  40. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/tier2-scripts.md +0 -0
  41. {codevira-4.0.1 → codevira-4.1.0}/agents/qa/tier3-manual.md +0 -0
  42. {codevira-4.0.1 → codevira-4.1.0}/codevira.egg-info/SOURCES.txt +0 -0
  43. {codevira-4.0.1 → codevira-4.1.0}/codevira.egg-info/dependency_links.txt +0 -0
  44. {codevira-4.0.1 → codevira-4.1.0}/codevira.egg-info/entry_points.txt +0 -0
  45. {codevira-4.0.1 → codevira-4.1.0}/codevira.egg-info/requires.txt +0 -0
  46. {codevira-4.0.1 → codevira-4.1.0}/codevira.egg-info/top_level.txt +0 -0
  47. {codevira-4.0.1 → codevira-4.1.0}/config.example.yaml +0 -0
  48. {codevira-4.0.1 → codevira-4.1.0}/docs/alpha-tester-invites.md +0 -0
  49. {codevira-4.0.1 → codevira-4.1.0}/docs/architecture.md +0 -0
  50. {codevira-4.0.1 → codevira-4.1.0}/docs/audit-2026-05-22.md +0 -0
  51. {codevira-4.0.1 → codevira-4.1.0}/docs/demo/README.md +0 -0
  52. {codevira-4.0.1 → codevira-4.1.0}/docs/foolproof-product-charter.md +0 -0
  53. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/00-engine.md +0 -0
  54. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/01-decision-lock.md +0 -0
  55. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/02-anti-regression.md +0 -0
  56. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/03-scope-contract.md +0 -0
  57. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/04-blast-radius.md +0 -0
  58. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/05-cross-session.md +0 -0
  59. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/06-token-budget.md +0 -0
  60. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/07-live-style.md +0 -0
  61. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/08-decision-replay.md +0 -0
  62. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/09-intent-inference.md +0 -0
  63. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/10-ai-promotion.md +0 -0
  64. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/README.md +0 -0
  65. {codevira-4.0.1 → codevira-4.1.0}/docs/heroes/pillar-1-setup.md +0 -0
  66. {codevira-4.0.1 → codevira-4.1.0}/docs/hn-launch-day.md +0 -0
  67. {codevira-4.0.1 → codevira-4.1.0}/docs/how-i-built-persistent-memory-for-ai-agents.md +0 -0
  68. {codevira-4.0.1 → codevira-4.1.0}/docs/internal/4.0-beta.md +0 -0
  69. {codevira-4.0.1 → codevira-4.1.0}/docs/internal/architecture-4.0.md +0 -0
  70. {codevira-4.0.1 → codevira-4.1.0}/docs/internal/competitive-landscape.md +0 -0
  71. {codevira-4.0.1 → codevira-4.1.0}/docs/internal/memory-strategy-2026-07.md +0 -0
  72. {codevira-4.0.1 → codevira-4.1.0}/docs/linkedin-article-ai-agent-memory.md +0 -0
  73. {codevira-4.0.1 → codevira-4.1.0}/docs/linkedin-post-ai-agent-memory.md +0 -0
  74. {codevira-4.0.1 → codevira-4.1.0}/docs/local-pypi-https.md +0 -0
  75. {codevira-4.0.1 → codevira-4.1.0}/docs/medium-your-ai-coding-agent-has-amnesia.md +0 -0
  76. {codevira-4.0.1 → codevira-4.1.0}/docs/morning-handoff-2026-05-22.md +0 -0
  77. {codevira-4.0.1 → codevira-4.1.0}/docs/plans/opt-in-activation.md +0 -0
  78. {codevira-4.0.1 → codevira-4.1.0}/docs/plans/v2.1.2.md +0 -0
  79. {codevira-4.0.1 → codevira-4.1.0}/docs/plans/v2.1.3.md +0 -0
  80. {codevira-4.0.1 → codevira-4.1.0}/docs/plans/v2.2.0.md +0 -0
  81. {codevira-4.0.1 → codevira-4.1.0}/docs/plans/v3.0.0.md +0 -0
  82. {codevira-4.0.1 → codevira-4.1.0}/docs/qa-playbook.md +0 -0
  83. {codevira-4.0.1 → codevira-4.1.0}/docs/release-notes/v3.1.1.md +0 -0
  84. {codevira-4.0.1 → codevira-4.1.0}/docs/release-notes/v3.7.1.md +0 -0
  85. {codevira-4.0.1 → codevira-4.1.0}/docs/release-process.md +0 -0
  86. {codevira-4.0.1 → codevira-4.1.0}/docs/roadmap.md +0 -0
  87. {codevira-4.0.1 → codevira-4.1.0}/docs/surface-cuts-2026-05-22.md +0 -0
  88. {codevira-4.0.1 → codevira-4.1.0}/docs/troubleshooting/antigravity.md +0 -0
  89. {codevira-4.0.1 → codevira-4.1.0}/docs/troubleshooting/config-hygiene.md +0 -0
  90. {codevira-4.0.1 → codevira-4.1.0}/docs/v2-completion-plan.md +0 -0
  91. {codevira-4.0.1 → codevira-4.1.0}/docs/v2-execution-log.md +0 -0
  92. {codevira-4.0.1 → codevira-4.1.0}/docs/vs-other-memory-tools.md +0 -0
  93. {codevira-4.0.1 → codevira-4.1.0}/graph/_schema.yaml +0 -0
  94. {codevira-4.0.1 → codevira-4.1.0}/indexer/__init__.py +0 -0
  95. {codevira-4.0.1 → codevira-4.1.0}/indexer/_dedupe_migration.py +0 -0
  96. {codevira-4.0.1 → codevira-4.1.0}/indexer/_fork_safety.py +0 -0
  97. {codevira-4.0.1 → codevira-4.1.0}/indexer/_sqlite_util.py +0 -0
  98. {codevira-4.0.1 → codevira-4.1.0}/indexer/fix_history.py +0 -0
  99. {codevira-4.0.1 → codevira-4.1.0}/indexer/global_db.py +0 -0
  100. {codevira-4.0.1 → codevira-4.1.0}/indexer/graph_generator.py +0 -0
  101. {codevira-4.0.1 → codevira-4.1.0}/indexer/imports.py +0 -0
  102. {codevira-4.0.1 → codevira-4.1.0}/indexer/index_codebase.py +0 -0
  103. {codevira-4.0.1 → codevira-4.1.0}/indexer/outcome_classifier.py +0 -0
  104. {codevira-4.0.1 → codevira-4.1.0}/indexer/sqlite_graph.py +0 -0
  105. {codevira-4.0.1 → codevira-4.1.0}/indexer/treesitter_parser.py +0 -0
  106. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/__main__.py +0 -0
  107. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_ghost_check.py +0 -0
  108. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_mcp_registry.py +0 -0
  109. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_project_inventory.py +0 -0
  110. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_prompts.py +0 -0
  111. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_repair_init.py +0 -0
  112. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/_safe_crash.py +0 -0
  113. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/auto_init.py +0 -0
  114. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli.py +0 -0
  115. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_eval.py +0 -0
  116. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_export.py +0 -0
  117. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_graph.py +0 -0
  118. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_hooks_admin.py +0 -0
  119. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_induce.py +0 -0
  120. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_init.py +0 -0
  121. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_memory.py +0 -0
  122. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_projects.py +0 -0
  123. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_repair.py +0 -0
  124. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_replay.py +0 -0
  125. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_search.py +0 -0
  126. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_sync.py +0 -0
  127. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_transfer.py +0 -0
  128. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_uninstall.py +0 -0
  129. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/cli_working.py +0 -0
  130. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/crash_logger.py +0 -0
  131. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/__init__.py +0 -0
  132. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/config.example.yaml +0 -0
  133. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/hooks/post_tool_use.sh +0 -0
  134. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/hooks/pre_tool_use.sh +0 -0
  135. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/hooks/session_start.sh +0 -0
  136. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/hooks/stop.sh +0 -0
  137. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/hooks/user_prompt_submit.sh +0 -0
  138. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/coding-standards-generic.md +0 -0
  139. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/coding-standards-go.md +0 -0
  140. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/coding-standards-typescript.md +0 -0
  141. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/coding-standards.md +0 -0
  142. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/engineering-excellence.md +0 -0
  143. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/git-cicd-governance.md +0 -0
  144. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/git_commits.md +0 -0
  145. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/incremental-updates.md +0 -0
  146. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/master_rule.md +0 -0
  147. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/multi-language.md +0 -0
  148. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/persistence.md +0 -0
  149. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/resilience-observability.md +0 -0
  150. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/smoke-testing.md +0 -0
  151. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/data/rules/testing-standards.md +0 -0
  152. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/decision_replay.py +0 -0
  153. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/detect.py +0 -0
  154. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/doctor.py +0 -0
  155. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/egress.py +0 -0
  156. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/__init__.py +0 -0
  157. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/audit.py +0 -0
  158. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/demo_policy.py +0 -0
  159. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/events.py +0 -0
  160. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/memory_fanout.py +0 -0
  161. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/__init__.py +0 -0
  162. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/_region_detect.py +0 -0
  163. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/_signature_detect.py +0 -0
  164. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/anti_regression.py +0 -0
  165. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/blast_radius.py +0 -0
  166. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/decision_lock.py +0 -0
  167. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/post_edit_refresh.py +0 -0
  168. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/session_log_enforcer.py +0 -0
  169. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policies/token_budget.py +0 -0
  170. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/policy.py +0 -0
  171. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/runner.py +0 -0
  172. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/signals.py +0 -0
  173. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/token_meter.py +0 -0
  174. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/__init__.py +0 -0
  175. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/_diff_envelope.py +0 -0
  176. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/antigravity_hooks.py +0 -0
  177. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/claude_code_hooks.py +0 -0
  178. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/git_hooks.py +0 -0
  179. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/engine/wiring/mcp_dispatch.py +0 -0
  180. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/eval/__init__.py +0 -0
  181. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/eval/judge.py +0 -0
  182. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/eval/relevance.py +0 -0
  183. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/eval/report.py +0 -0
  184. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/gitignore.py +0 -0
  185. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/global_sync.py +0 -0
  186. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/graph/__init__.py +0 -0
  187. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/graph/template.html +0 -0
  188. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/http_server.py +0 -0
  189. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/ide_inject.py +0 -0
  190. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/launchd.py +0 -0
  191. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/log_retention.py +0 -0
  192. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/memory_undo.py +0 -0
  193. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/migrate.py +0 -0
  194. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/opt_in.py +0 -0
  195. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/paths.py +0 -0
  196. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/prompts.py +0 -0
  197. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/register_all.py +0 -0
  198. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/retrieval/__init__.py +0 -0
  199. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/roadmap_drift.py +0 -0
  200. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/setup_wizard.py +0 -0
  201. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/__init__.py +0 -0
  202. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/activity_store.py +0 -0
  203. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/agents_md_generator.py +0 -0
  204. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/anchor.py +0 -0
  205. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/atomic.py +0 -0
  206. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/config.py +0 -0
  207. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/fts5_index.py +0 -0
  208. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/id_repair.py +0 -0
  209. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/jsonl_store.py +0 -0
  210. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/manifest.py +0 -0
  211. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/origin.py +0 -0
  212. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/outcomes_writer.py +0 -0
  213. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/paths.py +0 -0
  214. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/sanitize.py +0 -0
  215. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/sessions_store.py +0 -0
  216. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/skills_store.py +0 -0
  217. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/synonyms.py +0 -0
  218. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/text.py +0 -0
  219. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/token_estimator.py +0 -0
  220. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/uid.py +0 -0
  221. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/storage/working_store.py +0 -0
  222. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tenant.py +0 -0
  223. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/__init__.py +0 -0
  224. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/graph.py +0 -0
  225. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/playbook.py +0 -0
  226. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/provenance.py +0 -0
  227. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/roadmap.py +0 -0
  228. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/search.py +0 -0
  229. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/skills.py +0 -0
  230. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/tools/working.py +0 -0
  231. {codevira-4.0.1 → codevira-4.1.0}/mcp_server/update_check.py +0 -0
  232. {codevira-4.0.1 → codevira-4.1.0}/rules/coding-standards.md +0 -0
  233. {codevira-4.0.1 → codevira-4.1.0}/rules/engineering-excellence.md +0 -0
  234. {codevira-4.0.1 → codevira-4.1.0}/rules/git-cicd-governance.md +0 -0
  235. {codevira-4.0.1 → codevira-4.1.0}/rules/git_commits.md +0 -0
  236. {codevira-4.0.1 → codevira-4.1.0}/rules/incremental-updates.md +0 -0
  237. {codevira-4.0.1 → codevira-4.1.0}/rules/master_rule.md +0 -0
  238. {codevira-4.0.1 → codevira-4.1.0}/rules/persistence.md +0 -0
  239. {codevira-4.0.1 → codevira-4.1.0}/rules/resilience-observability.md +0 -0
  240. {codevira-4.0.1 → codevira-4.1.0}/rules/smoke-testing.md +0 -0
  241. {codevira-4.0.1 → codevira-4.1.0}/rules/testing-standards.md +0 -0
  242. {codevira-4.0.1 → codevira-4.1.0}/setup.cfg +0 -0
  243. {codevira-4.0.1 → codevira-4.1.0}/tests/conftest.py +0 -0
  244. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/__init__.py +0 -0
  245. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/code_only_python/README.md +0 -0
  246. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/code_only_python/pyproject.toml +0 -0
  247. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/code_only_python/src/widgets.py +0 -0
  248. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/code_only_python/tests/test_widgets.py +0 -0
  249. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/conftest.py +0 -0
  250. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/docs_only/CONTRIBUTING.md +0 -0
  251. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/docs_only/README.md +0 -0
  252. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/docs_only/docs/architecture.md +0 -0
  253. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/docs_only/package.json +0 -0
  254. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/monorepo/README.md +0 -0
  255. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/monorepo/package.json +0 -0
  256. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/monorepo/packages/foo/package.json +0 -0
  257. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/monorepo/packages/foo/src/index.ts +0 -0
  258. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/CLAUDE.md +0 -0
  259. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/README.md +0 -0
  260. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/config/settings.yaml +0 -0
  261. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/pyproject.toml +0 -0
  262. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/src/api.py +0 -0
  263. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/fixtures/polyglot/src/client.ts +0 -0
  264. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_cross_tool_universality.py +0 -0
  265. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_first_contact.py +0 -0
  266. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_product_invariants.py +0 -0
  267. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_qa_round_v2_completion.py +0 -0
  268. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_v2_release_candidate.py +0 -0
  269. {codevira-4.0.1 → codevira-4.1.0}/tests/e2e/test_v350_acceptance.py +0 -0
  270. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/__init__.py +0 -0
  271. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_anti_regression.py +0 -0
  272. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_antigravity_hooks.py +0 -0
  273. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_audit.py +0 -0
  274. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_blast_radius.py +0 -0
  275. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_block_message_evidence.py +0 -0
  276. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_claude_native_memory.py +0 -0
  277. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_decision_lock.py +0 -0
  278. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_decision_replay.py +0 -0
  279. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_diff_envelope.py +0 -0
  280. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_events.py +0 -0
  281. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_evidence_reaches_readers.py +0 -0
  282. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_fix_history.py +0 -0
  283. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_git_hook_enforcement.py +0 -0
  284. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_integration.py +0 -0
  285. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_memory_fanout.py +0 -0
  286. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_policies.py +0 -0
  287. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_qa_p0_fixes.py +0 -0
  288. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_qa_round3.py +0 -0
  289. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_qa_round4.py +0 -0
  290. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_qa_round5.py +0 -0
  291. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_qa_round_week13.py +0 -0
  292. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_region_detect.py +0 -0
  293. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_runner.py +0 -0
  294. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_session_log_enforcer.py +0 -0
  295. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_signals_project_scoping.py +0 -0
  296. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_token_budget.py +0 -0
  297. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_token_meter.py +0 -0
  298. {codevira-4.0.1 → codevira-4.1.0}/tests/engine/test_week2_edge_cases.py +0 -0
  299. {codevira-4.0.1 → codevira-4.1.0}/tests/integration/__init__.py +0 -0
  300. {codevira-4.0.1 → codevira-4.1.0}/tests/integration/test_help_text_consistency.py +0 -0
  301. {codevira-4.0.1 → codevira-4.1.0}/tests/integration/test_mcp_roundtrip.py +0 -0
  302. {codevira-4.0.1 → codevira-4.1.0}/tests/integration/test_sandboxed_parent.py +0 -0
  303. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/__init__.py +0 -0
  304. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_activity_store.py +0 -0
  305. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_agents_md_generator.py +0 -0
  306. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_amendment_provenance.py +0 -0
  307. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_anchor_derivation.py +0 -0
  308. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_atomic.py +0 -0
  309. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_concurrent_writes.py +0 -0
  310. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_cross_process_writes.py +0 -0
  311. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_decisions_store.py +0 -0
  312. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_device_identity.py +0 -0
  313. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_fts5_index.py +0 -0
  314. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_id_repair_references.py +0 -0
  315. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_jsonl_store.py +0 -0
  316. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_manifest.py +0 -0
  317. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_origin.py +0 -0
  318. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_sanitize.py +0 -0
  319. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_search_perf_caches.py +0 -0
  320. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_session_identity.py +0 -0
  321. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_skills_store.py +0 -0
  322. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_stranded_parameters.py +0 -0
  323. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_token_estimator.py +0 -0
  324. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_uid.py +0 -0
  325. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_uid_edges.py +0 -0
  326. {codevira-4.0.1 → codevira-4.1.0}/tests/storage/test_working_store.py +0 -0
  327. {codevira-4.0.1 → codevira-4.1.0}/tests/test__prompts.py +0 -0
  328. {codevira-4.0.1 → codevira-4.1.0}/tests/test_antigravity_hook_portable.py +0 -0
  329. {codevira-4.0.1 → codevira-4.1.0}/tests/test_auto_init.py +0 -0
  330. {codevira-4.0.1 → codevira-4.1.0}/tests/test_binding_conflict_detection.py +0 -0
  331. {codevira-4.0.1 → codevira-4.1.0}/tests/test_binding_e2e.py +0 -0
  332. {codevira-4.0.1 → codevira-4.1.0}/tests/test_call_edge_fk_safety.py +0 -0
  333. {codevira-4.0.1 → codevira-4.1.0}/tests/test_claude_binding_conflict.py +0 -0
  334. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_export.py +0 -0
  335. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_graph.py +0 -0
  336. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_induce.py +0 -0
  337. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_projects.py +0 -0
  338. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_replay.py +0 -0
  339. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_search.py +0 -0
  340. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_transfer.py +0 -0
  341. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_uninstall.py +0 -0
  342. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_untrack.py +0 -0
  343. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_version.py +0 -0
  344. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cli_working.py +0 -0
  345. {codevira-4.0.1 → codevira-4.1.0}/tests/test_committed_memory.py +0 -0
  346. {codevira-4.0.1 → codevira-4.1.0}/tests/test_crash_logger.py +0 -0
  347. {codevira-4.0.1 → codevira-4.1.0}/tests/test_cross_project_search.py +0 -0
  348. {codevira-4.0.1 → codevira-4.1.0}/tests/test_decisions_store.py +0 -0
  349. {codevira-4.0.1 → codevira-4.1.0}/tests/test_dedupe_migration.py +0 -0
  350. {codevira-4.0.1 → codevira-4.1.0}/tests/test_detect.py +0 -0
  351. {codevira-4.0.1 → codevira-4.1.0}/tests/test_doctor.py +0 -0
  352. {codevira-4.0.1 → codevira-4.1.0}/tests/test_e1_summary_first.py +0 -0
  353. {codevira-4.0.1 → codevira-4.1.0}/tests/test_egress_boundary.py +0 -0
  354. {codevira-4.0.1 → codevira-4.1.0}/tests/test_eval_e3.py +0 -0
  355. {codevira-4.0.1 → codevira-4.1.0}/tests/test_fk_safety_extended.py +0 -0
  356. {codevira-4.0.1 → codevira-4.1.0}/tests/test_fork_safety.py +0 -0
  357. {codevira-4.0.1 → codevira-4.1.0}/tests/test_g3_hermetic.py +0 -0
  358. {codevira-4.0.1 → codevira-4.1.0}/tests/test_ghost_check.py +0 -0
  359. {codevira-4.0.1 → codevira-4.1.0}/tests/test_git_shared.py +0 -0
  360. {codevira-4.0.1 → codevira-4.1.0}/tests/test_gitignore.py +0 -0
  361. {codevira-4.0.1 → codevira-4.1.0}/tests/test_global_db.py +0 -0
  362. {codevira-4.0.1 → codevira-4.1.0}/tests/test_global_home_isolation.py +0 -0
  363. {codevira-4.0.1 → codevira-4.1.0}/tests/test_global_sync.py +0 -0
  364. {codevira-4.0.1 → codevira-4.1.0}/tests/test_graph_generator.py +0 -0
  365. {codevira-4.0.1 → codevira-4.1.0}/tests/test_graph_not_indexed_contract.py +0 -0
  366. {codevira-4.0.1 → codevira-4.1.0}/tests/test_hook_resilience.py +0 -0
  367. {codevira-4.0.1 → codevira-4.1.0}/tests/test_http_server.py +0 -0
  368. {codevira-4.0.1 → codevira-4.1.0}/tests/test_id_repair.py +0 -0
  369. {codevira-4.0.1 → codevira-4.1.0}/tests/test_ide_inject.py +0 -0
  370. {codevira-4.0.1 → codevira-4.1.0}/tests/test_imports.py +0 -0
  371. {codevira-4.0.1 → codevira-4.1.0}/tests/test_index_codebase.py +0 -0
  372. {codevira-4.0.1 → codevira-4.1.0}/tests/test_launchd.py +0 -0
  373. {codevira-4.0.1 → codevira-4.1.0}/tests/test_log_retention.py +0 -0
  374. {codevira-4.0.1 → codevira-4.1.0}/tests/test_managed_files_e4.py +0 -0
  375. {codevira-4.0.1 → codevira-4.1.0}/tests/test_memory_undo.py +0 -0
  376. {codevira-4.0.1 → codevira-4.1.0}/tests/test_migrate.py +0 -0
  377. {codevira-4.0.1 → codevira-4.1.0}/tests/test_migration_memory_loss.py +0 -0
  378. {codevira-4.0.1 → codevira-4.1.0}/tests/test_migration_no_data_loss_e2e.py +0 -0
  379. {codevira-4.0.1 → codevira-4.1.0}/tests/test_opt_in.py +0 -0
  380. {codevira-4.0.1 → codevira-4.1.0}/tests/test_outcome_reconcile_p17.py +0 -0
  381. {codevira-4.0.1 → codevira-4.1.0}/tests/test_path_glob_and_scrub.py +0 -0
  382. {codevira-4.0.1 → codevira-4.1.0}/tests/test_paths.py +0 -0
  383. {codevira-4.0.1 → codevira-4.1.0}/tests/test_phase27_quality_fixes.py +0 -0
  384. {codevira-4.0.1 → codevira-4.1.0}/tests/test_pin_generation.py +0 -0
  385. {codevira-4.0.1 → codevira-4.1.0}/tests/test_pre_release_block_hook.py +0 -0
  386. {codevira-4.0.1 → codevira-4.1.0}/tests/test_project_inventory.py +0 -0
  387. {codevira-4.0.1 → codevira-4.1.0}/tests/test_prompts.py +0 -0
  388. {codevira-4.0.1 → codevira-4.1.0}/tests/test_prune_and_clean_deprecation.py +0 -0
  389. {codevira-4.0.1 → codevira-4.1.0}/tests/test_record_decision.py +0 -0
  390. {codevira-4.0.1 → codevira-4.1.0}/tests/test_register_all.py +0 -0
  391. {codevira-4.0.1 → codevira-4.1.0}/tests/test_registration_heal.py +0 -0
  392. {codevira-4.0.1 → codevira-4.1.0}/tests/test_remote_hijack.py +0 -0
  393. {codevira-4.0.1 → codevira-4.1.0}/tests/test_removed_tool_migration.py +0 -0
  394. {codevira-4.0.1 → codevira-4.1.0}/tests/test_repair_ids.py +0 -0
  395. {codevira-4.0.1 → codevira-4.1.0}/tests/test_repair_ids_race.py +0 -0
  396. {codevira-4.0.1 → codevira-4.1.0}/tests/test_repair_init.py +0 -0
  397. {codevira-4.0.1 → codevira-4.1.0}/tests/test_retirement_and_amendments.py +0 -0
  398. {codevira-4.0.1 → codevira-4.1.0}/tests/test_review_round2.py +0 -0
  399. {codevira-4.0.1 → codevira-4.1.0}/tests/test_review_round3.py +0 -0
  400. {codevira-4.0.1 → codevira-4.1.0}/tests/test_roadmap_drift.py +0 -0
  401. {codevira-4.0.1 → codevira-4.1.0}/tests/test_sdist_completeness.py +0 -0
  402. {codevira-4.0.1 → codevira-4.1.0}/tests/test_setup_wizard.py +0 -0
  403. {codevira-4.0.1 → codevira-4.1.0}/tests/test_skill_reinforcement.py +0 -0
  404. {codevira-4.0.1 → codevira-4.1.0}/tests/test_sqlite_graph.py +0 -0
  405. {codevira-4.0.1 → codevira-4.1.0}/tests/test_sqlite_util.py +0 -0
  406. {codevira-4.0.1 → codevira-4.1.0}/tests/test_startup_migrations.py +0 -0
  407. {codevira-4.0.1 → codevira-4.1.0}/tests/test_subprocess_imports_working_tree.py +0 -0
  408. {codevira-4.0.1 → codevira-4.1.0}/tests/test_synonym_widening_e5.py +0 -0
  409. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tenant_isolation.py +0 -0
  410. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_graph.py +0 -0
  411. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_playbook.py +0 -0
  412. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_roadmap.py +0 -0
  413. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_skills.py +0 -0
  414. {codevira-4.0.1 → codevira-4.1.0}/tests/test_tools_working.py +0 -0
  415. {codevira-4.0.1 → codevira-4.1.0}/tests/test_treesitter_parser.py +0 -0
  416. {codevira-4.0.1 → codevira-4.1.0}/tests/test_update_check.py +0 -0
  417. {codevira-4.0.1 → codevira-4.1.0}/tests/test_watcher_circuit.py +0 -0
  418. {codevira-4.0.1 → codevira-4.1.0}/tests/test_working_promote_skill.py +0 -0
  419. {codevira-4.0.1 → codevira-4.1.0}/tests/test_worktree_and_cache.py +0 -0
  420. {codevira-4.0.1 → codevira-4.1.0}/tests/test_worktree_shared_memory.py +0 -0
@@ -9,6 +9,219 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+
13
+ ## [4.1.0] — 2026-08-16
14
+
15
+ **If you are on 4.0.1, upgrade.** That release will silently replace a decision
16
+ with its own negation: supersede-on-write is on by default and fires at Jaccard
17
+ ≥ 0.75, while `"never do X"` and `"do X"` score **0.75–0.83** against each other.
18
+ Measured on the shipped 4.0.1 artifact, not inferred. Only `do_not_revert`
19
+ decisions were exempt. The guard that fixes it is below, and it is the reason
20
+ this release exists.
21
+
22
+ Also here: a workspace root that is a *subdirectory* of your project no longer
23
+ binds to the wrong project, and `get_session_context` now ranks the brief by
24
+ recency × outcome-confidence instead of write order — the one change in this
25
+ release that alters observable output of a documented tool, and so the reason
26
+ this is a minor rather than a patch.
27
+
28
+ `reconcile.cluster_store()` and `reconcile.pick_canonical()` (Phases 25 and 29)
29
+ land as **library internals**. They are complete and tested, but nothing calls
30
+ them yet — no MCP tool, no CLI subcommand. They are groundwork for a merge
31
+ surface, listed here for contributors, not as capabilities you can invoke.
32
+
33
+ ### Fixed — a workspace root inside a project no longer binds to the wrong project
34
+
35
+ An MCP client advertises its workspace roots, and codevira uses them to bind to
36
+ the right project when the server is not pinned. Measured against Claude Code
37
+ 2.1.221: `roots/list` returns the **literal session directory**, so opening
38
+ `~/repo/packages/web` advertises that path — not `~/repo`.
39
+
40
+ Such a root has neither `.codevira/` nor `.git/`, so it matched no branch of
41
+ `pick_project_root`, fell through to "first valid root", and `choose_binding`
42
+ then kept the inherited cwd. The binding silently landed on whatever project
43
+ the process happened to start in — precisely the failure roots-binding exists
44
+ to prevent.
45
+
46
+ Each candidate root is now resolved to its **enclosing** initialized codevira
47
+ project before being classified, and duplicates are dropped — so `--add-dir`
48
+ of two subdirectories of one repo is one project, not an ambiguous multi-root
49
+ workspace.
50
+
51
+ This closes the same split already documented in `_is_git_repo`: `paths.
52
+ _discover_project_root` has always walked upward, while `pick_project_root`
53
+ judged each root as-is. Two layers disagreeing about what counts as a project.
54
+
55
+ Deliberately the `.codevira` walk **only**, not the generic marker walk — a
56
+ walk that stopped at a bare `.git` would let `choose_binding` rule 2 auto-init
57
+ `.codevira` at a monorepo root the user never opted into. The `$HOME` refusal
58
+ is load-bearing rather than defensive: `~/.codevira` always exists, so an
59
+ unguarded walk would bind every marker-less folder to `$HOME` (the v1.8.0
60
+ rogue-`$HOME`-project crash).
61
+
62
+ Proved end-to-end over the real MCP wire, not only in unit tests: with roots
63
+ pointing at `…/packages/web/src` and cwd set to a *different* project, the
64
+ patched server binds to the enclosing project while the unpatched build binds
65
+ to cwd. *(Tests: `TestSubdirectoryRoots` (6) — 4 fail without the change; 2
66
+ are regression guards for the `$HOME` and bare-`.git` limits.)*
67
+
68
+ ### Added — `get_session_context` ranks by recency × outcome-confidence (Phase 26)
69
+
70
+ `recent_decisions` was a binary filter: drop reverted and outdated, then take
71
+ whatever the store returned first. That made the catch-me-up brief a function
72
+ of **write order** — a decision recorded months ago and never confirmed could
73
+ outrank one the git outcome-tracker watched survive last week.
74
+
75
+ Survivors are now ranked. Every signal is already on the row, so this costs no
76
+ extra I/O:
77
+
78
+ | signal | weight |
79
+ |---|---|
80
+ | `outcome="kept"` — the tracker watched the file survive | 1.0 |
81
+ | `outcome` unset — nothing has tested it | 0.7 |
82
+ | `outcome="modified"` — the file changed underneath it | 0.4 |
83
+ | `dnr_soft_expired` — a lock nobody re-confirmed | × 0.5 |
84
+ | recency | exponential, 90-day half-life |
85
+
86
+ Ranking replaces the *ordering*, not the filter: reverted and outdated
87
+ decisions are still hidden entirely.
88
+
89
+ ### Added — the same ranking now reaches `search` and prompt injection
90
+
91
+ Phase 26 names **three** read surfaces. Only the session brief got the ranking
92
+ at first; `search` and the relevance-injection hook still ordered purely by
93
+ keyword relevance, so a two-year-old decision the tracker never validated
94
+ outranked a current one scoring a hair lower on BM25.
95
+
96
+ The arithmetic now lives once, in `retrieval.score.freshness()` —
97
+ `outcome_weight × recency_decay`, both of which already existed there while
98
+ three separate copies of the same table sat in `learning.py`, `digest.py` and
99
+ `score.py`. `now` is a **required** keyword argument, unlike `recency_decay`
100
+ which defaults it: one instant must cover a whole comparison, and having no
101
+ default makes the sample-per-row bug unrepresentable rather than discouraged.
102
+
103
+ **`search`** re-ranks by `rank_norm × freshness` and reports `freshness` in
104
+ `score_breakdown`, so an order the reader cannot explain stays impossible. The
105
+ `limit` cap moved *after* ranking — it used to sit inside the BM25 loop, so
106
+ freshness could only reorder rows relevance had already selected. `score` is
107
+ still raw BM25; its meaning is unchanged for callers.
108
+
109
+ **The injection hook** could not do this at all before: it scores digest rows,
110
+ and the digest carried no timestamp from any source (the manifest holds bare id
111
+ lists). `digest_record` now carries `ts` and the raw `outcome` label. `weight`
112
+ alone could not serve — it is a pre-applied, lossy derivative that collapses
113
+ "no outcome" and "unrecognised outcome" onto 0.5 and cannot be re-tabled by a
114
+ caller needing different weights.
115
+
116
+ One deliberate divergence, stated rather than smoothed away: the brief scores
117
+ `modified` **below** an untested decision, search scores it **above**. In a
118
+ catch-up brief churn is the liability that earns `needs_review`; in a search it
119
+ means you asked about this area and someone touched it recently. Same
120
+ arithmetic, two named tables, both in `retrieval/score.py` with the reasoning.
121
+
122
+ > **Existing projects:** the digest is appended incrementally, so decisions
123
+ > recorded before this release keep their old rows until something rebuilds
124
+ > them. Those rows fall back to the previous behaviour *exactly* — not to a
125
+ > neutral score, which would have halved them and pushed real matches under the
126
+ > injection threshold. Run `codevira sync` to rebuild immediately; otherwise it
127
+ > heals as the outcome tracker rewrites the digest.
128
+
129
+ ### Added — a churn nudge on decisions whose file moved
130
+
131
+ `outcome="modified"` is exactly the churn signal Phase 26 asks for — the
132
+ tracker saw the decision's file change but not disappear. Those rows now carry
133
+ `needs_review` and a hint to `reaffirm_decision` if the decision still holds,
134
+ or `supersede_decision` / `mark_decision_outdated` if it does not. It needs a
135
+ human verdict, not
136
+ silent removal. The keys are absent on every other row, so the brief stays
137
+ lean.
138
+
139
+ ### Fixed — the ranking clock is sampled once, not per row
140
+
141
+ Caught by a tie test while building the above, and worth recording because the
142
+ bug is invisible by inspection: the rank key read `datetime.now()` **inside**
143
+ the sort, so rows evaluated later came out microseconds younger. The score was
144
+ a function of evaluation order rather than of the data, and the sort quietly
145
+ preserved whatever order it was given. `_age_days` now takes the reference
146
+ instant, and any caller ranking a collection must pass one. Unpinning it turns
147
+ the tie test red on 5 runs out of 5.
148
+
149
+ ### Fixed — a decision and its negation were classified as duplicates
150
+
151
+ `"never switch the package manager away from pnpm"` and the same sentence
152
+ without `never` differ by one token, so pure set math scores them **Jaccard
153
+ 0.83** — comfortably over the 0.60 duplicate threshold.
154
+
155
+ That is the worst false positive available in this codebase. The classifier is
156
+ shared: Tier-1 would have aliased one meaning away, and **supersede-on-write
157
+ would have retired `"never do X"` as a duplicate of `"do X"`**. A protected
158
+ decision is guarded there, but an unprotected one was not.
159
+
160
+ A negation present on one side and absent on the other is now a **conflict by
161
+ construction**, whatever the similarity says. It stays fully deterministic — a
162
+ set difference against a fixed word list, no model. The guard keys on
163
+ *disagreement*, so two decisions that both say `never` are still duplicates.
164
+
165
+ ### Added — Tier-1 store clustering: `reconcile.cluster_store()` (Phase 25)
166
+
167
+ Tier-0 (`id_repair`) resolves records that collide on an **id**. Tier-1
168
+ resolves records that say the same **thing** in different words — two engineers
169
+ recording the same decision independently, each with its own id.
170
+
171
+ Returns `{merges, conflicts, scanned, truncated}`. Duplicate grouping is
172
+ transitive via union-find, so A~C and B~C land in one cluster even when A and B
173
+ alone would not classify as duplicates — otherwise the same decision survives
174
+ twice under two canonical ids. Ordering is total before any pairing, so two
175
+ engineers running it over the same store get the same plan.
176
+
177
+ Conflicts come back as **data, never a silent pick**: the structural tier is
178
+ authoritative and this one is assistive. The phase specified routing
179
+ escalations through `consensus_store`, which was removed in 4.0 — returning
180
+ them keeps this layer free of I/O and lets the caller choose the surface.
181
+
182
+ The O(n²) scan is bounded at 2,000 records and the bound is **reported**
183
+ (`truncated`) rather than silently applied.
184
+
185
+ ### Added — `reconcile.pick_canonical()`: the deterministic merge winner (Phase 29)
186
+
187
+ The reconcile core could classify a pair as duplicate / conflict / distinct,
188
+ but nothing decided **which record survives** a duplicate cluster. That pick is
189
+ what both the cross-engineer Tier-1 reconcile (Phase 25) and any future
190
+ merge surface consume, so it belongs in the shared core rather than in either
191
+ caller, where it would drift.
192
+
193
+ Returns the canonical record, the union of `tags` and `origin` provenance
194
+ across the cluster, and an **alias map** `old_id → canonical_id` so `[[Dxxxx]]`
195
+ references still resolve after a merge.
196
+
197
+ The winner order is total, and every component is a pure function of the
198
+ record:
199
+
200
+ 1. **protected first** — merging a `do_not_revert` record into an unprotected
201
+ one would silently drop the protection, so a lock outranks a plain decision
202
+ regardless of age;
203
+ 2. **earliest `ts`** — the oldest id is the one other decisions are most likely
204
+ to reference, so keeping it minimises alias churn;
205
+ 3. **writer id**, then **content hash**, then **id** — the components that keep
206
+ the order strict once the first two collide.
207
+
208
+ Two or more *protected* members disagreeing on text sets `ambiguous`. That is a
209
+ real conflict, not a duplicate: the pick stays reproducible, but the caller
210
+ must escalate rather than merge. The committed text is always one of the
211
+ inputs — an LLM may suggest a merged wording upstream, but committing
212
+ synthesised text would make the result a function of sampling instead of
213
+ content, and convergence would be gone.
214
+
215
+ The id tiebreak is load-bearing, not belt-and-braces. Without it, records
216
+ differing only by id hash identically, tie on every component, and `sorted`
217
+ falls back to input position — the same defect fixed in `id_repair` this
218
+ release. A permutation test over the full cluster caught it here *before* it
219
+ shipped; the older order test could not have, because its two entries had
220
+ different similarities so nothing was ever contested. That test now uses
221
+ identical texts. *(Tests: `TestPickCanonical` (7), rewritten
222
+ `test_deterministic_order_independent`.)*
223
+
224
+
12
225
  ## [4.0.1] — 2026-08-12
13
226
 
14
227
  Repairs team-shared memory (`init --shared` never actually worked), removes the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: codevira
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: Cross-IDE decision enforcement for AI coding agents. 1 MB per project, in your repo, no cloud, no vectors. Claude Code, Cursor, Windsurf, Antigravity, Codex all share the same in-repo memory; hooks block AI tool calls that violate prior decisions. MIT, local-first.
5
5
  Author-email: Sachin Shelke <sachin.worldnet@gmail.com>
6
6
  License: MIT
@@ -221,7 +221,7 @@ one tool is visible to every tool.
221
221
  | **Frugal by design** | Tools return summaries by default; `get_session_context()` is one ~500-token call; the server cold-starts in well under a second with no ML model to load. |
222
222
  | **Concurrent-safe** | Every write is a crash-safe atomic write behind a Posix `fcntl.flock`, so two IDEs on one project don't race. [Details](#concurrency--safety) (expand) |
223
223
 
224
- <sub><strong>Latest: 4.0.1.</strong> 4.0 made enforcement <em>universal</em> — a locked decision now blocks a commit in every editor via a git <code>pre-commit</code> hook, not just an edit in Claude Code — and when it blocks, it shows the reasoning. 4.0.1 removes the deprecated <code>codevira clean</code> command plus two <code>doctor</code>/project-inventory fixes. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes →</a></sub>
224
+ <sub><strong>Latest: 4.1.0.</strong> Upgrade if you are on 4.0.1: that release could silently replace a decision with its own <em>negation</em> — <code>"never do X"</code> and <code>"do X"</code> score 0.75&ndash;0.83 against each other, over the auto-supersede bar. 4.1.0 makes a one-sided negation a conflict by construction, stops a workspace root inside a project binding to the wrong project, and ranks the session brief, search and prompt injection by recency &times; outcome-confidence instead of write order. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes &rarr;</a></sub>
225
225
 
226
226
  ---
227
227
 
@@ -169,7 +169,7 @@ one tool is visible to every tool.
169
169
  | **Frugal by design** | Tools return summaries by default; `get_session_context()` is one ~500-token call; the server cold-starts in well under a second with no ML model to load. |
170
170
  | **Concurrent-safe** | Every write is a crash-safe atomic write behind a Posix `fcntl.flock`, so two IDEs on one project don't race. [Details](#concurrency--safety) (expand) |
171
171
 
172
- <sub><strong>Latest: 4.0.1.</strong> 4.0 made enforcement <em>universal</em> — a locked decision now blocks a commit in every editor via a git <code>pre-commit</code> hook, not just an edit in Claude Code — and when it blocks, it shows the reasoning. 4.0.1 removes the deprecated <code>codevira clean</code> command plus two <code>doctor</code>/project-inventory fixes. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes →</a></sub>
172
+ <sub><strong>Latest: 4.1.0.</strong> Upgrade if you are on 4.0.1: that release could silently replace a decision with its own <em>negation</em> — <code>"never do X"</code> and <code>"do X"</code> score 0.75&ndash;0.83 against each other, over the auto-supersede bar. 4.1.0 makes a one-sided negation a conflict by construction, stops a workspace root inside a project binding to the wrong project, and ranks the session brief, search and prompt injection by recency &times; outcome-confidence instead of write order. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes &rarr;</a></sub>
173
173
 
174
174
  ---
175
175
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: codevira
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: Cross-IDE decision enforcement for AI coding agents. 1 MB per project, in your repo, no cloud, no vectors. Claude Code, Cursor, Windsurf, Antigravity, Codex all share the same in-repo memory; hooks block AI tool calls that violate prior decisions. MIT, local-first.
5
5
  Author-email: Sachin Shelke <sachin.worldnet@gmail.com>
6
6
  License: MIT
@@ -221,7 +221,7 @@ one tool is visible to every tool.
221
221
  | **Frugal by design** | Tools return summaries by default; `get_session_context()` is one ~500-token call; the server cold-starts in well under a second with no ML model to load. |
222
222
  | **Concurrent-safe** | Every write is a crash-safe atomic write behind a Posix `fcntl.flock`, so two IDEs on one project don't race. [Details](#concurrency--safety) (expand) |
223
223
 
224
- <sub><strong>Latest: 4.0.1.</strong> 4.0 made enforcement <em>universal</em> — a locked decision now blocks a commit in every editor via a git <code>pre-commit</code> hook, not just an edit in Claude Code — and when it blocks, it shows the reasoning. 4.0.1 removes the deprecated <code>codevira clean</code> command plus two <code>doctor</code>/project-inventory fixes. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes →</a></sub>
224
+ <sub><strong>Latest: 4.1.0.</strong> Upgrade if you are on 4.0.1: that release could silently replace a decision with its own <em>negation</em> — <code>"never do X"</code> and <code>"do X"</code> score 0.75&ndash;0.83 against each other, over the auto-supersede bar. 4.1.0 makes a one-sided negation a conflict by construction, stops a workspace root inside a project binding to the wrong project, and ranks the session brief, search and prompt injection by recency &times; outcome-confidence instead of write order. Upgrading is automatic on the first server start. <a href="https://github.com/sachinshelke/codevira/blob/main/CHANGELOG.md">Full release notes &rarr;</a></sub>
225
225
 
226
226
  ---
227
227
 
@@ -1,5 +1,24 @@
1
1
  # Codevira v2.0 — Master Plan
2
2
 
3
+ > **⚠️ Frozen planning artifact — v2.0 era. Do not read this as current state.**
4
+ >
5
+ > This was the plan of record for v2.0 and is kept as a record of intent. Four
6
+ > of the ten "heroes" it lists as shipping were later **removed** after they
7
+ > were measured in real sessions, each for a documented reason
8
+ > (`mcp_server/engine/policies/__init__.py` carries the verdicts):
9
+ >
10
+ > | # | Hero | Outcome |
11
+ > |---|---|---|
12
+ > | 3 | Proactive Scope Contract Lock | removed v2.2.0 — never fired; users did not trust it |
13
+ > | 7 | Live Style Enforcement | removed v2.2.0 — consumed the preferences/rules surface, both since deleted |
14
+ > | 9 | Proactive Intent Inference | removed v2.2.0 — guessed wrong about half the time |
15
+ > | 10 | AI Promotion Score | removed v2.2.0 — produced noise; never validated in real sessions |
16
+ > | 8 | Decision Replay | scaffolded as a browse surface, never a Policy |
17
+ >
18
+ > For what actually runs today, read `mcp_server/engine/policies/__init__.py`
19
+ > (the registered set), `CHANGELOG.md`, and `docs/architecture.md`.
20
+
21
+
3
22
  > Single source of truth for the v2.0 release. Per-hero detailed specs live in `docs/heroes/`. Running progress log: `docs/v2-execution-log.md`.
4
23
 
5
24
  ---
@@ -14,4 +14,4 @@ internals — internal APIs may change between minor versions.
14
14
  from mcp_server.cli import main
15
15
 
16
16
  __all__ = ["main"]
17
- __version__ = "4.0.1"
17
+ __version__ = "4.1.0"
@@ -380,8 +380,14 @@ class RelevanceInject(Policy):
380
380
  digest_records: list[dict[str, Any]],
381
381
  min_score: float,
382
382
  ) -> list[dict[str, Any]]:
383
- """Merge tag/file/FTS hits + outcome weight; return scored decisions
383
+ """Merge tag/file/FTS hits + freshness; return scored decisions
384
384
  sorted by score desc."""
385
+ from datetime import datetime as _dt, timezone as _tz
386
+
387
+ from mcp_server.retrieval import score as _score
388
+
389
+ # ONE instant for the whole comparison — see retrieval.score.freshness.
390
+ _now = _dt.now(_tz.utc)
385
391
  digest_by_id = {str(d.get("id")): d for d in digest_records}
386
392
 
387
393
  # Phase 13: effective weights (shipped defaults, or opt-in learned).
@@ -435,6 +441,21 @@ class RelevanceInject(Policy):
435
441
  # line the "why" was silently dropped between the two.
436
442
  why = digest_rec.get("why")
437
443
 
444
+ # v4.1 (Phase 26): outcome-confidence x RECENCY, replacing the bare
445
+ # outcome weight. Not multiplied on top of `weight` — freshness
446
+ # already contains the same outcome factor, so applying both would
447
+ # square it and let outcome swamp the tag/file/FTS relevance the
448
+ # score is mostly made of.
449
+ #
450
+ # A digest written before 4.1 has no `ts`, so recency has no source.
451
+ # Fall back to the stored `weight` — i.e. exactly the pre-4.1
452
+ # behaviour — rather than to a neutral 0.5, which would halve every
453
+ # score and could push real matches under min_score until the
454
+ # digest happened to regenerate. Degrade to unchanged, not to worse.
455
+ if digest_rec is not None and digest_rec.get("ts"):
456
+ weight = _score.freshness(
457
+ digest_rec.get("outcome"), digest_rec.get("ts"), now=_now
458
+ )
438
459
  final = base * max(weight, 0.1) # never zero-out a real match
439
460
  if final < min_score:
440
461
  continue
@@ -74,10 +74,12 @@ def root_uri_to_path(uri: str | None) -> Path | None:
74
74
  def pick_project_root(candidates: list[Path | None]) -> Path | None:
75
75
  """Choose the best project root from candidate workspace roots.
76
76
 
77
- Preference order, among roots that are real directories and not
78
- refused system roots:
79
- 1. a root that already has a ``.codevira/`` dir (an initialized
80
- codevira project);
77
+ Each candidate that is a real directory and not a refused system root is
78
+ first resolved to its **enclosing** initialized codevira project (a
79
+ workspace root is often a subdirectory of the project — see below), and
80
+ duplicates are dropped. Then, in preference order:
81
+ 1. a root that has a ``.codevira/`` dir (an initialized codevira
82
+ project);
81
83
  2. a root that has a ``.git/`` dir (a repo);
82
84
  3. the first valid root.
83
85
 
@@ -105,6 +107,39 @@ def pick_project_root(candidates: list[Path | None]) -> Path | None:
105
107
  if not valid:
106
108
  return None
107
109
 
110
+ # A workspace root can be a SUBDIRECTORY of the project. Claude Code
111
+ # advertises the literal session cwd, so opening ``~/repo/packages/web``
112
+ # yields that path and not ``~/repo`` (measured against 2.1.221, D00013U).
113
+ # Resolve each candidate to its enclosing codevira project BEFORE
114
+ # classifying: otherwise such a root matches neither branch below, falls
115
+ # through to ``valid[0]``, and choose_binding keeps the inherited cwd —
116
+ # the wrong project, which is the bug roots-binding exists to fix. This is
117
+ # the same "two layers disagreeing about what a project is" split already
118
+ # called out in _is_git_repo, on the walk-up axis instead.
119
+ #
120
+ # ORPHAN roots only — a root carrying either marker keeps its own identity.
121
+ # Without that guard, `codevira init` in ~/Projects would make every repo
122
+ # under it resolve to ~/Projects, merging unrelated projects' memory into
123
+ # one store. The walk is for roots with NO project identity of their own.
124
+ #
125
+ # Deliberately the ``.codevira`` walk, not the generic marker walk in
126
+ # paths._discover_project_root: stopping at a bare ``.git`` would let
127
+ # choose_binding rule 2 auto-init ``.codevira`` at a monorepo root the user
128
+ # never opted into. resolve_project_from_file_path refuses $HOME and system
129
+ # tops, which is load-bearing here — ``~/.codevira`` ALWAYS exists, so an
130
+ # unguarded walk would bind every marker-less folder to $HOME (v1.8.0).
131
+ walked: list[Path] = []
132
+ for c in valid:
133
+ if _has_codevira(c) or _is_git_repo(c):
134
+ target = c
135
+ else:
136
+ target = _enclosing_project_within_repo(c) or c
137
+ if target not in walked:
138
+ # Two subdirs of one repo are ONE project, not an ambiguous
139
+ # multi-root workspace — de-dupe before the ambiguity check.
140
+ walked.append(target)
141
+ valid = walked
142
+
108
143
  codevira_roots = [c for c in valid if _has_codevira(c)]
109
144
  if len(codevira_roots) > 1:
110
145
  # Lane-A safety net (v3.7.0): a multi-root workspace with 2+ initialized
@@ -127,6 +162,60 @@ def pick_project_root(candidates: list[Path | None]) -> Path | None:
127
162
  return valid[0]
128
163
 
129
164
 
165
+ def _enclosing_project_within_repo(start: Path) -> Path | None:
166
+ """Nearest ancestor with ``.codevira/`` — but never across a repo boundary.
167
+
168
+ A workspace root can be a subdirectory of the project (Claude Code
169
+ advertises the literal session directory), so an orphan root has to be
170
+ walked up to find its project. The walk MUST stop at the first ancestor
171
+ carrying ``.git``:
172
+
173
+ ~/Projects/.codevira <- `codevira init` was run up here
174
+ ~/Projects/myapp/.git <- but myapp is its own repo
175
+ ~/Projects/myapp/src <- opening this must bind to myapp
176
+
177
+ Without the stop, ``src`` resolves to ``~/Projects`` and every sibling
178
+ repo underneath shares one decision store — cross-project memory bleed,
179
+ which is the exact failure this whole binding path exists to prevent.
180
+ ``resolve_project_from_file_path`` deliberately has no such boundary (it
181
+ serves Claude Desktop, where the tool-call path is the only signal), so
182
+ this is a separate walk rather than a parameter on that one.
183
+
184
+ Returns None when no enclosing project is found before the boundary; the
185
+ caller then keeps the original candidate.
186
+ """
187
+ from mcp_server.paths import is_invalid_project_root
188
+
189
+ try:
190
+ chain = [start, *start.parents]
191
+ except (OSError, ValueError):
192
+ return None
193
+ for cand in chain:
194
+ try:
195
+ if is_invalid_project_root(cand) is not None:
196
+ continue # never $HOME / a system top — ~/.codevira always exists
197
+ if _has_codevira(cand):
198
+ return cand
199
+ if cand != start and _is_git_repo(cand):
200
+ # A repo with no .codevira of its own: THIS is the project, and
201
+ # the walk stops here rather than continuing to some
202
+ # .codevira above. Returning the repo root (not None, not the
203
+ # original subdirectory) is what ``paths._discover_project_root``
204
+ # has always done for cwd — treating .git as a project marker —
205
+ # so the two layers now agree instead of answering "what
206
+ # project is this path in?" differently, which is the same
207
+ # split ``_is_git_repo`` was written to close.
208
+ #
209
+ # It cannot auto-init somewhere unwanted on its own:
210
+ # ``choose_binding`` rule 2 still requires that cwd is not
211
+ # already an initialized project before it will bind a bare
212
+ # repo.
213
+ return cand
214
+ except OSError:
215
+ continue
216
+ return None
217
+
218
+
130
219
  def _is_git_repo(path: Path) -> bool:
131
220
  """True if ``path`` is a git working tree.
132
221
 
@@ -122,9 +122,99 @@ def recency_decay(
122
122
  def outcome_weight(outcome: Any) -> float:
123
123
  """Multiplier for a decision's git-derived outcome, in [0, 1].
124
124
 
125
- Unknown or absent outcomes get ``NO_OUTCOME_WEIGHT``. Note that
126
- ``archived`` is the only value that can zero a score outright.
125
+ Unknown or absent outcomes get ``NO_OUTCOME_WEIGHT``.
126
+
127
+ ``archived`` is in the table but the outcome classifier never emits it
128
+ — ``indexer/outcome_classifier.py`` returns only kept / modified /
129
+ reverted. The entry is kept because the mapping is data, not control
130
+ flow, and a future archiver would land on it; nothing reaches it today.
127
131
  """
128
132
  if not outcome:
129
133
  return NO_OUTCOME_WEIGHT
130
134
  return _OUTCOME_WEIGHTS.get(str(outcome).strip().lower(), NO_OUTCOME_WEIGHT)
135
+
136
+
137
+ #: Recency score for a decision whose timestamp is missing or unparseable.
138
+ #: NOT 0.0: ``recency_decay`` returns 0.0 there so a malformed record cannot
139
+ #: masquerade as fresh, which is right when recency is the whole score. As a
140
+ #: *factor* it would instead zero the decision out of the ranking entirely —
141
+ #: a missing ``ts`` would hide a real decision rather than merely fail to
142
+ #: promote it. Neutral is the safe reading of "we don't know how old this is".
143
+ UNKNOWN_AGE_RECENCY = 0.5
144
+
145
+
146
+ def freshness(
147
+ outcome: Any,
148
+ timestamp: str | float | None,
149
+ *,
150
+ now: datetime,
151
+ dnr_soft_expired: bool = False,
152
+ half_life_days: float = DEFAULT_HALF_LIFE_DAYS,
153
+ weights: dict[str, float] | None = None,
154
+ no_outcome: float = NO_OUTCOME_WEIGHT,
155
+ ) -> float:
156
+ """How much should reality's verdict on a decision promote it? ``[0, 1]``.
157
+
158
+ ``outcome_weight`` × ``recency_decay`` — the composite every staleness
159
+ read-side surface needs (Phase 26), in one place so ``get_session_context``,
160
+ ``search`` and the relevance-injection hook cannot drift apart.
161
+
162
+ ``now`` is REQUIRED and keyword-only, deliberately — unlike
163
+ ``recency_decay``, which defaults it and re-samples the clock. One instant
164
+ must cover a whole comparison: sampling per row makes rows evaluated later
165
+ score microseconds younger, so the result becomes a function of evaluation
166
+ order rather than of the data. That exact bug shipped once. Having no
167
+ default makes it unrepresentable at every call site rather than merely
168
+ discouraged.
169
+
170
+ ``dnr_soft_expired`` halves the score: a ``do_not_revert`` lock nobody has
171
+ re-confirmed past the soft-expire threshold is weaker evidence than a
172
+ current one.
173
+
174
+ ``weights`` / ``no_outcome`` override the outcome table for callers with a
175
+ *stated* reason to disagree — see ``SESSION_BRIEF_OUTCOME_WEIGHTS`` and
176
+ ``SESSION_BRIEF_NO_OUTCOME``. Absent, the shared table applies, so surfaces
177
+ agree by default. They exist so consolidating an already-shipped scorer onto
178
+ this function is arithmetically identical rather than a quiet re-tune.
179
+ """
180
+ table = _OUTCOME_WEIGHTS if weights is None else weights
181
+ key = str(outcome).strip().lower() if outcome else ""
182
+ confidence = table.get(key, no_outcome) if key else no_outcome
183
+ if dnr_soft_expired:
184
+ confidence *= 0.5
185
+ # ABSENT timestamp -> neutral. PRESENT but ancient or unparseable -> whatever
186
+ # recency_decay says, including 0.0.
187
+ #
188
+ # An earlier cut rewrote a 0.0 from recency_decay back to neutral, reasoning
189
+ # that 0.0 meant "unparseable". It cannot: recency_decay returns 0.0 for a
190
+ # parse failure AND for anything old enough to round to zero. Conflating
191
+ # them promoted a 2020 decision to the same recency as one written today —
192
+ # measured, not hypothesised. Scoring a corrupt timestamp lowest is the safe
193
+ # direction: the row still returns, it just ranks last.
194
+ recency = (
195
+ recency_decay(timestamp, now=now, half_life_days=half_life_days)
196
+ if timestamp
197
+ else UNKNOWN_AGE_RECENCY
198
+ )
199
+ return confidence * recency
200
+
201
+
202
+ #: The catch-up brief disagrees with the shared table on ``modified``,
203
+ #: deliberately. ``modified`` means the tracker saw the decision's file change
204
+ #: underneath it. In a *brief* that is a liability — it is the churn signal that
205
+ #: earns ``needs_review``, so it should sink below an untested decision. In a
206
+ #: *search* the same decision is a strong hit: you asked about this area and
207
+ #: someone touched it recently, so the shared 0.6 is right there. Same
208
+ #: arithmetic, two stated policies, rather than one number that fits neither.
209
+ #:
210
+ #: ``reverted`` is absent because the brief FILTERS those rows out before
211
+ #: ranking (``_is_stale``); it never reaches the table.
212
+ SESSION_BRIEF_OUTCOME_WEIGHTS: dict[str, float] = {
213
+ "kept": 1.0,
214
+ "modified": 0.4,
215
+ }
216
+
217
+ #: The brief's unobserved weight. Higher than the shared 0.5: a brief is a
218
+ #: short list where an untested decision is still worth surfacing, whereas in a
219
+ #: ranked search it competes against hits with real evidence behind them.
220
+ SESSION_BRIEF_NO_OUTCOME = 0.7
@@ -830,6 +830,9 @@ async def list_tools() -> list[Tool]:
830
830
  description=(
831
831
  "Check whether a proposed decision contradicts any "
832
832
  "do_not_revert=True decision OR duplicates an existing one. "
833
+ "A NEGATED restatement is always a conflict, never a duplicate: "
834
+ "'never do X' and 'do X' differ by one token and score as "
835
+ "near-identical text, so they are separated explicitly. "
833
836
  "Returns {status: novel|duplicate|conflict, conflicts, "
834
837
  "duplicates}. Call BEFORE record_decision to surface conflicts "
835
838
  "proactively (record_decision also runs this internally and "
@@ -1121,6 +1124,12 @@ async def list_tools() -> list[Tool]:
1121
1124
  "Returns current roadmap phase, recent decisions with confidence, "
1122
1125
  "learned preferences, and active rules — everything a new session needs. "
1123
1126
  "Call this at the START of every session instead of multiple separate calls. "
1127
+ "recent_decisions is ranked by recency x outcome-confidence (a decision "
1128
+ "git watched survive outranks one nothing has tested); reverted and "
1129
+ "outdated ones are hidden entirely. A decision whose file has CHANGED "
1130
+ "since it was recorded carries 'needs_review': true plus a "
1131
+ "'review_hint' — reaffirm_decision if it still holds, "
1132
+ "supersede_decision or mark_decision_outdated if it does not. "
1124
1133
  "Works seamlessly across AI tools: Cursor, Claude Code, Antigravity."
1125
1134
  ),
1126
1135
  inputSchema={"type": "object", "properties": {}},