rein-agentic-kit 2.2.0__tar.gz → 2.3.1__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 (199) hide show
  1. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/PKG-INFO +6 -3
  2. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/README.md +5 -2
  3. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/.claude-plugin/plugin.json +1 -1
  4. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/.codex-plugin/plugin.json +1 -1
  5. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/bin/rein +1 -1
  6. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/flow.config.example.json +4 -2
  7. rein_agentic_kit-2.3.1/plugins/rein/lib/failure_triage.py +223 -0
  8. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate_run.py +2 -0
  9. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/quick_driver.py +17 -8
  10. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/quota.py +18 -2
  11. rein_agentic_kit-2.3.1/plugins/rein/lib/run_events.py +167 -0
  12. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship.py +204 -56
  13. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship_decide.py +117 -26
  14. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship_state.py +33 -1
  15. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/token_report.py +198 -26
  16. rein_agentic_kit-2.3.1/plugins/rein/lib/usage_report.py +1001 -0
  17. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/pyproject.toml +1 -1
  18. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/rein_agentic_kit.egg-info/PKG-INFO +6 -3
  19. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/rein_agentic_kit.egg-info/SOURCES.txt +4 -0
  20. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_check_evidence.py +9 -2
  21. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_failure_triage.py +6 -0
  22. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_model_policy.py +11 -10
  23. rein_agentic_kit-2.3.1/tests/test_run_stability.py +726 -0
  24. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship.py +12 -2
  25. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_tiers.py +2 -2
  26. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_token_report.py +10 -4
  27. rein_agentic_kit-2.3.1/tests/test_usage_report.py +1320 -0
  28. rein_agentic_kit-2.2.0/plugins/rein/lib/failure_triage.py +0 -135
  29. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/LICENSE +0 -0
  30. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/ENTRY.md +0 -0
  31. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/IMPACT.md +0 -0
  32. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/NATIVE-CLOSURE.md +0 -0
  33. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/PROVIDERS.md +0 -0
  34. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/SHIP-WATCH.md +0 -0
  35. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/__init__.py +0 -0
  36. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/affected.py +0 -0
  37. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/angular_impact.py +0 -0
  38. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/delivery.py +0 -0
  39. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/detect.py +0 -0
  40. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/evidence.py +0 -0
  41. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate.py +0 -0
  42. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate_cache.py +0 -0
  43. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate_env.py +0 -0
  44. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate_execution.py +0 -0
  45. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/gate_log.py +0 -0
  46. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/guard.py +0 -0
  47. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/impact.py +0 -0
  48. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/integration_ready.py +0 -0
  49. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/launch_profile.py +0 -0
  50. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/migrate_config.py +0 -0
  51. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/orca_client.py +0 -0
  52. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/plan.py +0 -0
  53. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/plan_check.py +0 -0
  54. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/quick.py +0 -0
  55. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/quick_inbox.py +0 -0
  56. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/roles.py +0 -0
  57. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/routing.py +0 -0
  58. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/serve.py +0 -0
  59. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship_answer.py +0 -0
  60. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship_done.py +0 -0
  61. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/ship_watch.py +0 -0
  62. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/startup_dialog.py +0 -0
  63. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/tmproot.py +0 -0
  64. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/verify.py +0 -0
  65. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/lib/worker_leases.py +0 -0
  66. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/answer/IMPACT.md +0 -0
  67. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/answer/PROVIDERS.md +0 -0
  68. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/answer/SKILL.md +0 -0
  69. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/quick/IMPACT.md +0 -0
  70. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/quick/PROVIDERS.md +0 -0
  71. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/quick/SKILL.md +0 -0
  72. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-audit/IMPACT.md +0 -0
  73. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-audit/PROVIDERS.md +0 -0
  74. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-audit/SKILL.md +0 -0
  75. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-discover/IMPACT.md +0 -0
  76. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-discover/PROVIDERS.md +0 -0
  77. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-discover/SKILL.md +0 -0
  78. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-plan/IMPACT.md +0 -0
  79. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-plan/PROVIDERS.md +0 -0
  80. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-plan/SKILL.md +0 -0
  81. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-role/IMPACT.md +0 -0
  82. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-role/PROVIDERS.md +0 -0
  83. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/rein-role/SKILL.md +0 -0
  84. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/ship/IMPACT.md +0 -0
  85. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/ship/PROVIDERS.md +0 -0
  86. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/plugins/rein/skills/ship/SKILL.md +0 -0
  87. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/rein_agentic_kit.egg-info/dependency_links.txt +0 -0
  88. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/rein_agentic_kit.egg-info/entry_points.txt +0 -0
  89. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/rein_agentic_kit.egg-info/top_level.txt +0 -0
  90. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/setup.cfg +0 -0
  91. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_affected.py +0 -0
  92. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_angular_impact.py +0 -0
  93. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_baseline.py +0 -0
  94. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_baseline_cli.py +0 -0
  95. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_blocked_launch.py +0 -0
  96. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_capability_scope.py +0 -0
  97. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_capacity_wait.py +0 -0
  98. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_claimable.py +0 -0
  99. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_cli_presentation.py +0 -0
  100. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_cli_resolution.py +0 -0
  101. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_delivery.py +0 -0
  102. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_detect.py +0 -0
  103. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_discovery_v2.py +0 -0
  104. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_doctor_cli.py +0 -0
  105. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_downgrade_expiry.py +0 -0
  106. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_failed_start.py +0 -0
  107. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_fix_verification.py +0 -0
  108. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate.py +0 -0
  109. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_cache.py +0 -0
  110. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_cleanup.py +0 -0
  111. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_cli.py +0 -0
  112. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_decision.py +0 -0
  113. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_env.py +0 -0
  114. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_execution.py +0 -0
  115. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_log.py +0 -0
  116. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_prepare.py +0 -0
  117. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_run.py +0 -0
  118. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_scope.py +0 -0
  119. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_tiers.py +0 -0
  120. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_gate_timeouts.py +0 -0
  121. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_graph_index.py +0 -0
  122. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard.py +0 -0
  123. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard_attribution.py +0 -0
  124. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard_fail_closed.py +0 -0
  125. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard_outside.py +0 -0
  126. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard_robust.py +0 -0
  127. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_guard_strict_read.py +0 -0
  128. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_hook_tracker_snapshot.py +0 -0
  129. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_host_workers.py +0 -0
  130. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_impact.py +0 -0
  131. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_impact_eval_oracle.py +0 -0
  132. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_integration_ready.py +0 -0
  133. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_launch_profile.py +0 -0
  134. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_migrate_config.py +0 -0
  135. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_mise_runner.py +0 -0
  136. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_monorepo.py +0 -0
  137. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_native_done.py +0 -0
  138. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_native_skills.py +0 -0
  139. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_orca_client.py +0 -0
  140. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_owner_decisions.py +0 -0
  141. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_packaging.py +0 -0
  142. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_plan.py +0 -0
  143. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_plan_check_decision.py +0 -0
  144. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_plan_check_repos.py +0 -0
  145. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_plan_self_check.py +0 -0
  146. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_python39_compat.py +0 -0
  147. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick.py +0 -0
  148. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_cli.py +0 -0
  149. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_close_record.py +0 -0
  150. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_driver.py +0 -0
  151. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_env.py +0 -0
  152. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_inbox.py +0 -0
  153. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_record_lock.py +0 -0
  154. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_report.py +0 -0
  155. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quick_resend.py +0 -0
  156. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quota.py +0 -0
  157. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quota_evolution.py +0 -0
  158. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_quota_guard_freshness.py +0 -0
  159. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_readme_is_current.py +0 -0
  160. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_regenerable.py +0 -0
  161. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_reserved_names.py +0 -0
  162. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_resume_old_state.py +0 -0
  163. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_review_artifact.py +0 -0
  164. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_review_fixes.py +0 -0
  165. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_roles.py +0 -0
  166. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_round2.py +0 -0
  167. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_round3.py +0 -0
  168. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_round4.py +0 -0
  169. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_round5.py +0 -0
  170. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_round6.py +0 -0
  171. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_routing.py +0 -0
  172. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_routing_v2.py +0 -0
  173. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_run_duration.py +0 -0
  174. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_serve_probe.py +0 -0
  175. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_setup_tabs.py +0 -0
  176. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_agent_flag.py +0 -0
  177. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_async_gates.py +0 -0
  178. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_decide.py +0 -0
  179. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_done.py +0 -0
  180. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_env.py +0 -0
  181. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_hunt.py +0 -0
  182. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_inbox.py +0 -0
  183. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_resilience.py +0 -0
  184. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_state.py +0 -0
  185. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_ux.py +0 -0
  186. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_ship_watch.py +0 -0
  187. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_single_subproject.py +0 -0
  188. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_skill_budget.py +0 -0
  189. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_skill_names.py +0 -0
  190. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_stalled_worker.py +0 -0
  191. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_startup_dialog.py +0 -0
  192. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_task_base.py +0 -0
  193. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_temp_root.py +0 -0
  194. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_v2_surface.py +0 -0
  195. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_verification_reuse.py +0 -0
  196. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_verify_commands.py +0 -0
  197. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_verify_plan.py +0 -0
  198. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_verify_policy.py +0 -0
  199. {rein_agentic_kit-2.2.0 → rein_agentic_kit-2.3.1}/tests/test_version_lock.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rein-agentic-kit
3
- Version: 2.2.0
3
+ Version: 2.3.1
4
4
  Summary: Rein — keep your Claude Code agents lean and in control. Token-lean, stack-aware agentic dev flow.
5
5
  Author: Luis Farfan
6
6
  License: MIT
@@ -300,8 +300,11 @@ Keep these limits in mind:
300
300
  valid data arrives, but cannot guarantee that the source refreshes or that
301
301
  enough capacity remains to finish a task.
302
302
 
303
- To see where tokens go, run `rein token-report --sessions --days 30`: it shows totals
304
- by kind of session, model and what triggered each turn, with no conversation content.
303
+ To see how you work and what to change, run `rein token-report --sessions --days 7`. It
304
+ reads local Claude Code transcripts (native sessions too) and REIN's own records, shows totals
305
+ with no conversation content, and gives recommendations with their evidence and how certain
306
+ they are. It sends nothing. You can [save a baseline, compare windows](docs/reference.md#how-you-use-rein-and-what-to-change)
307
+ and turn a finding into [an experiment](docs/laboratory.md).
305
308
  The [latest measurement](docs/research/2026-11-29-native-first/RESULTS.md) also fixes an
306
309
  earlier double count. `ledger` and `baseline` keep run history. Token reports read Claude Code transcripts; they are not complete
307
310
  accounting for all Codex sessions. Historical studies are linked from the research
@@ -280,8 +280,11 @@ Keep these limits in mind:
280
280
  valid data arrives, but cannot guarantee that the source refreshes or that
281
281
  enough capacity remains to finish a task.
282
282
 
283
- To see where tokens go, run `rein token-report --sessions --days 30`: it shows totals
284
- by kind of session, model and what triggered each turn, with no conversation content.
283
+ To see how you work and what to change, run `rein token-report --sessions --days 7`. It
284
+ reads local Claude Code transcripts (native sessions too) and REIN's own records, shows totals
285
+ with no conversation content, and gives recommendations with their evidence and how certain
286
+ they are. It sends nothing. You can [save a baseline, compare windows](docs/reference.md#how-you-use-rein-and-what-to-change)
287
+ and turn a finding into [an experiment](docs/laboratory.md).
285
288
  The [latest measurement](docs/research/2026-11-29-native-first/RESULTS.md) also fixes an
286
289
  earlier double count. `ledger` and `baseline` keep run history. Token reports read Claude Code transcripts; they are not complete
287
290
  accounting for all Codex sessions. Historical studies are linked from the research
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rein",
3
3
  "description": "Rein \u2014 keep your Claude Code agents lean and in control. A deterministic plan / ship / audit method on top of Orca: fresh workers, gated tasks, independent review, and real per-model token measurement.",
4
- "version": "2.2.0",
4
+ "version": "2.3.1",
5
5
  "author": {
6
6
  "name": "Luis Farfan"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rein",
3
3
  "description": "Shared engineering workflows for Claude Code and Codex, with deterministic gates and Orca execution.",
4
- "version": "2.2.0",
4
+ "version": "2.3.1",
5
5
  "author": {
6
6
  "name": "Luis Farfan"
7
7
  },
@@ -176,7 +176,7 @@ import subprocess
176
176
  import sys
177
177
  import time
178
178
 
179
- VERSION = "2.2.0"
179
+ VERSION = "2.3.1"
180
180
 
181
181
  HERE = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
182
182
  PLUGIN_ROOT = os.path.dirname(HERE)
@@ -46,8 +46,10 @@
46
46
  "largeChangeFiles": 25,
47
47
  "riskyPaths": ["**/auth/**", "**/payments/**", "**/migrations/**"],
48
48
  "auditExclude": [],
49
- "$models": "Optional. Authorized choices per responsibility, in order of preference, as \"agent/model\" (agents: claude, codex, antigravity). implement: workers (Claude still yields above claudeWeeklyThreshold when another entry exists). escalate: a task whose code failed its checks twice, only with measured capacity, never for infrastructure. audit: normal reviews. auditRisky: risky or large changes (and quick audits). A responsibility left out keeps the built-in routing. A malformed value launches nothing. Example: {\"implement\": [\"claude/sonnet\", \"codex/<model>\"], \"escalate\": [\"claude/opus\"], \"auditRisky\": [\"claude/opus\"]}",
50
- "models": {}
49
+ "$models": "Optional. Authorized choices per responsibility, in order of preference, as \"agent/model\" (agents: claude, codex, antigravity). implement: workers (Claude still yields above claudeWeeklyThreshold when another entry exists). escalate: a task whose same code defect came back after a repair, only with measured capacity, never for infrastructure or an unreadable failure. audit: normal reviews. auditRisky: risky or large changes (and quick audits). A responsibility left out keeps the built-in routing. A malformed value launches nothing. Example: {\"implement\": [\"claude/sonnet\", \"codex/<model>\"], \"escalate\": [\"claude/opus\"], \"auditRisky\": [\"claude/opus\"]}",
50
+ "models": {},
51
+ "$requireReportedModel": "true = refuse a launch whose model Orca does not report, or is not an authorized one (quick then launches nothing). Any other non-boolean value launches nothing.",
52
+ "requireReportedModel": false
51
53
  },
52
54
 
53
55
  "gate": {
@@ -0,0 +1,223 @@
1
+ """What a red task's failure says before Rein spends another worker on it. Pure: no I/O.
2
+
3
+ Measured on 53 real `rein ship` runs (docs/research/2026-10-26-arquitectura): a fresh worker met
4
+ exactly the failure its predecessor had met 26 times in a row -- mostly the guard's "wrote outside
5
+ its worktree" about a commit in another checkout, which no new worker can undo -- and one task took
6
+ 18 dispatches. The failure text a retry was given carried ANSI colour codes in 74% of test failures.
7
+
8
+ `clean` is the text a worker or the owner reads; `signature` is what two failures are compared by
9
+ (the same failure, whatever the run-specific ids, shas, timings and temp paths in it); `hint` is
10
+ the one line that tells the owner what a fresh worker cannot do about it.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import hashlib
16
+ import itertools
17
+ import re
18
+
19
+ _ANSI = re.compile(r"\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-_]")
20
+ # What changes between two runs of the same failure and says nothing about it.
21
+ _VOLATILE = [
22
+ (re.compile(r"(?:/private)?/var/folders/\S+|/tmp/\S+"), "<tmp>"),
23
+ (re.compile(r"\b(?:ctx|task|run|msg|delivery|term|gate)_[0-9a-f-]{6,}\b"), "<id>"),
24
+ (re.compile(r"\b[0-9a-f]{7,40}\b"), "<sha>"),
25
+ (re.compile(r"\b\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?Z?\b"), "<time>"),
26
+ (re.compile(r"\b\d+(?:\.\d+)?\s*(?:ms|s|sec|seconds|min)\b"), "<dur>"),
27
+ (re.compile(r"\(\d+:\d{2}:\d{2}\)"), "<dur>"),
28
+ ]
29
+
30
+
31
+ def clean(text: str) -> str:
32
+ """`text` without terminal escape sequences or carriage-return redraws."""
33
+ out = _ANSI.sub("", text or "")
34
+ # A progress line redrawn with \r keeps only what it last showed; a \r that ends the line (CRLF, as
35
+ # any terminal writes it) redraws nothing.
36
+ return "\n".join(line.rstrip("\r").rsplit("\r", 1)[-1] for line in out.split("\n"))
37
+
38
+
39
+ def normalize(text: str) -> str:
40
+ out = clean(text)
41
+ for rx, token in _VOLATILE:
42
+ out = rx.sub(token, out)
43
+ return "\n".join(" ".join(line.split()) for line in out.splitlines() if line.strip())
44
+
45
+
46
+ def signature(text: str) -> str:
47
+ """Equal for two failures that only differ in ids, shas, timings or temp paths; "" for none."""
48
+ norm = normalize(text)
49
+ return hashlib.sha1(norm.encode("utf-8")).hexdigest()[:16] if norm else ""
50
+
51
+
52
+ # What the environment said, not the code: a dropped or refused connection, a busy port, no Docker,
53
+ # no name resolution, a full disk.
54
+ _INFRA = re.compile(r"rejected SSL upgrade|ConnectionRefusedError|Connection refused|[Cc]onnection reset|"
55
+ r"connection was closed in the middle|too many clients|could not connect to server|"
56
+ r"Cannot connect to the Docker daemon|address already in use|"
57
+ r"\b(?:ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|ENOSPC|EMFILE|EADDRINUSE)\b|"
58
+ r"name resolution|Could not resolve host|TLS handshake timeout|i/o timeout|"
59
+ r"No space left on device|Too many open files|Read-only file system|no such host|"
60
+ r"nodename nor servname|Can't reach database server|DockerException|docker daemon|"
61
+ r"certificate verify failed|SSLCertVerificationError|NoCredentialsError|"
62
+ r"Unable to locate credentials|fetch failed|HTTP\w*Error:? 50[234]")
63
+ # The check did not finish judging: out of memory (the host's or the code's fault, nobody can say).
64
+ _STARVED = re.compile(r"heap out of memory|Cannot allocate memory|\bENOMEM\b|\bMemoryError\b")
65
+ _KILLED = (127, 134, 137, 139, 143) # the tool is missing, or a signal ended it (negative codes too)
66
+ INFRA_LINES = 3
67
+ # A pytest summary line: `FAILED tests/x.py::test_y - AssertionError` or `ERROR tests/x.py`.
68
+ _FAILED_TEST = re.compile(r"^(?:FAILED|ERROR) ((?!\()\S+)", re.M) # never unittest's `FAILED (failures=1)`
69
+ # An unmet assertion, as a test runner prints it: the only thing a test's output can prove about the
70
+ # code. Any exception may be a broken setup's (a missing variable, another runtime version).
71
+ _ASSERTION = (r"\b(?:AssertionError|AssertionFailedError|ComparisonFailure)\b|"
72
+ r"\bexpected:? ?<.*but was|\b[Aa]ssertion `.{0,200}\bfailed\b")
73
+ _DEFECT = re.compile(_ASSERTION + r"|^(?:E\s+)?assert\b|^\s*Expected\b[^:\n]{0,60}:.*\n\s*Received\b[^:\n]{0,60}:|"
74
+ r"^\s*- Expected\s*\n\s*\+ Received|"
75
+ r"^\s+\w+_test\.go:\d+:.*(?:\bgot\b.*\bwant\b|\bwant\b.*\bgot\b)", re.M)
76
+ # A pytest summary line that names a test together with its unmet assertion.
77
+ _ASSERTED_TEST = re.compile(r"^FAILED (\S+::\S+) - (?:assert\b|AssertionError\b)", re.M)
78
+ # What else is left of an infrastructure failure once its own lines are set aside.
79
+ _ERROR = re.compile(r"\b[A-Z]\w*(?:Error|Exception)\b|^E\s+assert\b", re.M)
80
+ STATIC = ("lint", "typecheck", "build") # only a known tool's diagnostic proves these red
81
+ # One finding about a source line, in the exact format of a known tool: tsc, ruff/flake8/pylint, mypy,
82
+ # pyright, an eslint item with its rule, rustc, and Go's own compile errors. Any other "file:line:
83
+ # text" may be a warning, a stack frame, a missing tool or a dependency.
84
+ _DIAGNOSTIC = re.compile(
85
+ r"\.[cm]?tsx?(?:\(\d+,\d+\):|:\d+:\d+ -) error TS\d+:|\.pyi?:\d+:\d+: [A-Z]{1,4}\d{2,4}\b|"
86
+ r"\.pyi?:\d+(?::\d+)?: error: .*\[[a-z-]+\]$|\.pyi?:\d+:\d+ - error: .*\(report\w+\)$|"
87
+ r"^\s+\d+:\d+\s+error\s+\S.*\s{2,}[@\w/-]+$|^error\[E\d{4}\]:|"
88
+ r"\.go:\d+:\d+: (?:undefined: |cannot use |declared and not used|missing return|syntax error|invalid operation|"
89
+ r"not enough arguments|too many arguments|assignment mismatch|\S+ (?:declared|imported) and not used)")
90
+ # A missing dependency or its types, a tool's own configuration or crash, someone else's code, another
91
+ # toolchain. One such line and no diagnostic of that check is proof: the rest may only follow from it.
92
+ _SETUP = re.compile(r"node_modules(?!/\.bin/)|site-packages|\.cargo/registry|/pkg/mod/|"
93
+ r"\bTS(?:2307|2580|2582|2591|2593|2688|2792|2875|7016|7026)\b|Do you need to install|"
94
+ r": (?:E902|[EF]0401|E0611|F0\d{3})\b|\[import[a-z-]*\]$|\(reportMissing\w+\)$|"
95
+ r"\[E0(?:432|433|46[0-3]|514|519)\]|incompatible version of rustc|found crate|"
96
+ r"Unable to resolve|Resolve error|Parsing error|Definition for rule|no-unresolved|"
97
+ r"Cannot find (?:module|package)|ModuleNotFoundError|ERR_MODULE_NOT_FOUND|"
98
+ r"requires [Gg]o\b|go\.sum|no required module|is not in (?:std|GOROOT)", re.M)
99
+
100
+ _RED_SLOT = re.compile(r"^(\w+) \[failed\]", re.M)
101
+
102
+
103
+ def kind(text: str) -> str:
104
+ """outside | hook | infra | test | other: which part of Rein said no."""
105
+ t = clean(text)
106
+ if "wrote outside its worktree" in t:
107
+ return "outside"
108
+ if "pre-commit hook only after the hook rewrites" in t or "commit-msg hook" in t:
109
+ return "hook"
110
+ if _INFRA.search(t):
111
+ return "infra"
112
+ if re.search(r"^(?:test|testIntegration|lint|typecheck|build) \[", t, re.M):
113
+ return "test"
114
+ return "other"
115
+
116
+
117
+ def failing_tests(text: str) -> list:
118
+ """The test ids a pytest summary names as failed or errored, sorted; [] when it names none."""
119
+ return sorted(set(_FAILED_TEST.findall(clean(text))))
120
+
121
+
122
+ def red_slots(text: str) -> set:
123
+ """The gate slots a gate report names as failed: `lint [failed] exit=1 $ ...` -> {"lint"}."""
124
+ return set(_RED_SLOT.findall(clean(text)))
125
+
126
+
127
+ def defect_ids(slot: str, error_lines, output_head=()) -> list:
128
+ """What one check that proved the code red is recognised by next time: the tests whose unmet
129
+ assertion it shows, and its whole failure. Never a test that failed some other way."""
130
+ errors, head = (clean("\n".join(str(x) for x in lines or ())) for lines in (error_lines, output_head))
131
+ body = errors if errors.strip() else head
132
+ return sorted({"%s %s" % (slot, t) for t in _ASSERTED_TEST.findall(body)}) + ["%s =%s" % (slot, signature(body))]
133
+
134
+
135
+ def infra_lines(text: str) -> list:
136
+ """The first lines of a WHOLE capture that show an environment failure: an excerpt may leave them out."""
137
+ found = (line.strip()[:200] for line in clean(text or "").splitlines()
138
+ if _INFRA.search(line) or _STARVED.search(line))
139
+ return list(itertools.islice(found, INFRA_LINES))
140
+
141
+
142
+ def capture_evidence(text: str) -> dict:
143
+ """What a check's WHOLE output shows and its excerpt may leave out: the report fields `infraLines`
144
+ and `setupTrouble`, which `check_kind` takes as `infra_seen` and `setup_seen`."""
145
+ return {"infraLines": infra_lines(text), "setupTrouble": bool(_SETUP.search(clean(text or "")))}
146
+
147
+
148
+ def check_kind(slot: str, outcome: str, error_lines, output_head=(), infra_seen=(), exit_code=None,
149
+ setup_seen=False) -> str:
150
+ """code | infra | unclear | blocked | timeout | unproven | unreadable: what one red check says.
151
+
152
+ Every argument comes from that check's structured result, so its output can only show an
153
+ environment failure inside it, never stand for another check. `infra_seen` and `setup_seen`
154
+ are the `capture_evidence` of its whole output. `code` needs positive evidence, in any slot; `unproven` is a red check whose cause
155
+ nobody can read (a worker may look at it, but it proves no defect). An environment failure beside
156
+ other errors or outside the failure's own lines, a killed check and one that says nothing are
157
+ `unclear`: only the owner can tell."""
158
+ if outcome != "failed":
159
+ return {"timeout": "timeout", "not_invocable": "blocked", "inconclusive": "blocked",
160
+ "proves_nothing": "unproven"}.get(outcome, "unreadable")
161
+ errors, head, seen = (clean("\n".join(str(x) for x in lines or ()))
162
+ for lines in (error_lines, output_head, infra_seen))
163
+ body = errors if errors.strip() else head
164
+ if not body.strip() or isinstance(exit_code, int) and (exit_code < 0 or exit_code in _KILLED):
165
+ return "unclear"
166
+ lines = body.splitlines()
167
+ proof = [x for x in lines if slot in STATIC and _DIAGNOSTIC.search(x)]
168
+ broken = setup_seen or any(_SETUP.search(x) for x in lines)
169
+ # A diagnostic may quote anything ('"ECONNREFUSED"'): only the other lines show the environment.
170
+ others = [x for x in lines if x not in proof]
171
+ if any(_STARVED.search(x) for x in others):
172
+ return "unclear"
173
+ if not any(_INFRA.search(x) for x in others):
174
+ if proof and not broken:
175
+ return "code" # no connection or disk failure elsewhere makes a compiler name a wrong line
176
+ if _INFRA.search(head) or seen.strip():
177
+ return "unclear"
178
+ return "code" if slot not in STATIC and _DEFECT.search(body) else "unproven"
179
+ rest = "\n".join(x for x in others if not _INFRA.search(x))
180
+ return "unclear" if proof or _ERROR.search(rest) or _DEFECT.search(rest) else "infra"
181
+
182
+
183
+ NO_VERDICT = ("infra", "unclear", "blocked", "unreadable")
184
+
185
+
186
+ def is_blocked(reason: str, checks=None) -> bool:
187
+ """No check proved the code red and at least one could not judge it: no worker is started.
188
+
189
+ `checks` are the `check_kind`s of the verdict, plus "policy" when the guard rejected the
190
+ change. None (a verdict saved or built without them) is judged by its text. A Verification that
191
+ timed out or proved nothing stays red; a gate slot that timed out is a setup problem (exit 126),
192
+ which asks the owner anyway."""
193
+ if checks is None:
194
+ return kind(reason) == "infra" and "Rein's guard rejected" not in clean(reason)
195
+ return not {"policy", "code"} & set(checks) and bool(set(NO_VERDICT) & set(checks))
196
+
197
+
198
+ def is_infra(checks=None) -> bool:
199
+ """Every red check failed on the environment alone: running them again is all there is to do."""
200
+ return bool(checks) and set(checks) == {"infra"}
201
+
202
+
203
+ def is_code(checks=None) -> bool:
204
+ """A structured result proved the code red, and the guard did not reject the change."""
205
+ checks = checks or ()
206
+ return "code" in checks and "policy" not in checks
207
+
208
+
209
+ def hint(text: str) -> str:
210
+ """What the owner can do that a fresh worker cannot, for the kind of `text`."""
211
+ k = kind(text)
212
+ if k == "outside":
213
+ return ("A new worker cannot undo a change in another checkout. If it is your own or another "
214
+ "session's work, `rein accept-outside --path <abs path>` or `--commit <sha>` records that, "
215
+ "then retry; if a worker wrote it, revert it there yourself, then retry.")
216
+ if k == "hook":
217
+ return ("The repo's own git hook rewrites files on commit; check that hook, or let the next worker "
218
+ "amend its commit with the hook's fix (retry).")
219
+ if k == "infra":
220
+ return "The environment failed (a connection, a port, Docker), not the change: fix it, then retry."
221
+ if k == "test":
222
+ return "Two workers in a row could not make this check pass the same way; look at the failure before retrying."
223
+ return "Look at the failure before retrying."
@@ -22,6 +22,7 @@ import time
22
22
  from typing import Callable
23
23
 
24
24
  import affected as _affected
25
+ import failure_triage as _triage
25
26
  import gate_cache as _cache
26
27
  import gate_execution as _execution
27
28
  import verify as _verify
@@ -264,6 +265,7 @@ def run_steps(root: str, steps: list, timeout_for: Callable[[str, str], float],
264
265
  entry["budgetSeconds"] = budget
265
266
  if res.outcome != _verify.OUTCOME_OK:
266
267
  entry["errorLines"] = _verify.failure_lines(res.output)
268
+ entry.update(_triage.capture_evidence(res.output)) # the excerpt may leave it out
267
269
  if fail_fast:
268
270
  stopped_by = slot
269
271
  else:
@@ -339,6 +339,10 @@ def start_quick(
339
339
  for line in cfg.models_errors:
340
340
  say(line)
341
341
  return 2
342
+ if cfg.require_reported_model:
343
+ say("ship.requireReportedModel is on, and Orca does not report which model a Quick implementer runs: "
344
+ "nothing was launched. Work natively, or use `rein ship`")
345
+ return 2
342
346
  preferred = cfg.models.get("implement") or ()
343
347
  if not agent:
344
348
  agent, model = quota.choose_implementer(
@@ -449,7 +453,7 @@ def start_quick(
449
453
 
450
454
  # 6. Report
451
455
  say("agent: %s" % agent)
452
- say("model: %s" % model)
456
+ say("model: %s (requested; Orca does not report which one a Quick implementer runs)" % model)
453
457
  say("workspace: %s" % workspace)
454
458
  if handle:
455
459
  say("tab: %s" % handle)
@@ -677,7 +681,8 @@ def _main_checkout(workspace: str) -> str:
677
681
 
678
682
  def _audit(workspace: str, record: dict, changed: list, limits: dict, client: OrcaClient,
679
683
  clock: Callable[[], float], say: Callable[[str], None], accept_outside: bool = False,
680
- brake_percent: float = 90.0, task_base: str = "", models: dict | None = None) -> int:
684
+ brake_percent: float = 90.0, task_base: str = "", models: dict | None = None,
685
+ strict: bool = False) -> int:
681
686
  """One audit round over `changed`; the exit code of `done` (0 approved)."""
682
687
  name = os.path.basename(workspace)
683
688
  change = "quick-" + name
@@ -712,13 +717,16 @@ def _audit(workspace: str, record: dict, changed: list, limits: dict, client: Or
712
717
  dispatch_id = oc.dispatch_id_of(started)
713
718
  launch = oc.effective_launch_of(started)
714
719
  agent, model = str(launch.get("agent") or pick[0]), str(launch.get("model") or "")
715
- if not quota.authorized(allowed, agent, model):
720
+ if not quota.authorized(allowed or ([pick] if strict else []), agent, model, strict):
716
721
  _stop_worker(client, dispatch_id, say)
717
- say("Orca launched %s/%s for the audit, which ship.models does not authorize: stopped, and no "
718
- "verdict is taken" % (agent, model or "?"))
722
+ say("Orca launched %s/%s for the audit, %s: stopped, and no "
723
+ "verdict is taken" % (agent, model or "?", ship.refusal(strict, model)))
719
724
  return 126
720
- say("audit round %d started on %s/%s (%s); waiting up to %d minutes"
721
- % (rounds + 1, pick[0], pick[1], dispatch_id, AUDIT_WAIT_SECONDS // 60))
725
+ first = next((models[n][0] for n in ("auditRisky", "audit") if (models or {}).get(n)), quota.OPUS)
726
+ say("audit round %d started on %s/%s (%s); %s%s; waiting up to %d minutes"
727
+ % (rounds + 1, agent, model or pick[1], dispatch_id,
728
+ ship.audit_words("risky:%s" % ("preferred" if tuple(pick) == tuple(first) else "alternative")),
729
+ "" if model else "; model not verified: Orca did not report it", AUDIT_WAIT_SECONDS // 60))
722
730
 
723
731
  previous = _install_handler(_stop_on_signal(client, dispatch_id, say))
724
732
  try:
@@ -1065,7 +1073,8 @@ def done_quick(*, cwd: str = ".", client: OrcaClient, run=verify.run_one,
1065
1073
  try:
1066
1074
  options = {"task_base": handoff_base} if handoff_base else {}
1067
1075
  status = _audit(workspace, record, changed, limits, client, clock, say, accept_outside,
1068
- brake_percent=cfg.brake_percent, models=policy.models, **options)
1076
+ brake_percent=cfg.brake_percent, models=policy.models,
1077
+ strict=policy.require_reported_model, **options)
1069
1078
  return _hand_off(workspace, handoff_base, change, say) if status == 0 else status
1070
1079
  except OrcaError as error:
1071
1080
  return _failed(say, error)
@@ -68,13 +68,29 @@ def _same_model(agent: str, a: str, b: str) -> bool:
68
68
  short.isalpha() and full.startswith("claude-%s-" % short) for short, full in ((a, b), (b, a))))
69
69
 
70
70
 
71
- def authorized(allowed, agent: str, model: str) -> bool:
71
+ def authorized(allowed, agent: str, model: str, strict: bool = False) -> bool:
72
72
  """May `agent`/`model` (what Orca launched) run under `allowed`, the list its launch was chosen
73
73
  from? An empty list restricts nothing. An unknown agent never passes a restriction; a model
74
- Orca does not report is judged by its agent."""
74
+ Orca does not report is judged by its agent, and never passes when `strict`."""
75
+ if strict and not model:
76
+ return False
75
77
  return not allowed or any(agent == a and (not model or _same_model(a, model, m)) for a, m in allowed)
76
78
 
77
79
 
80
+ def identity(requested: str, agent: str, model: str) -> str:
81
+ """How far what Orca says it launched confirms `requested` ("agent/model"): "reported",
82
+ "substituted", or "unverified" when it names no model. A launch Orca reports is what it
83
+ configured, not what the provider served: only a transcript shows that."""
84
+ wanted, _, name = requested.partition("/")
85
+ if not name:
86
+ return "unverified" # a launch saved before requests were kept
87
+ if agent and agent != wanted:
88
+ return "substituted"
89
+ if not model:
90
+ return "unverified"
91
+ return "reported" if _same_model(wanted, model, name) else "substituted"
92
+
93
+
78
94
  WINDOWS = ("session", "weekly")
79
95
  _ALWAYS = ("claude", "codex")
80
96
  MAX_OBSERVATION_AGE_SECONDS = 15 * 60
@@ -0,0 +1,167 @@
1
+ """What a `rein ship` run did, kept after its state is archived, so `rein token-report --sessions`
2
+ can explain how REIN is used.
3
+
4
+ One JSONL file per run in `~/.claude/rein/ship-events/` ($REIN_EVENTS_DIR moves it; REIN_EVENTS=0
5
+ writes nothing). Only significant changes are recorded, never a poll, and only by code that runs
6
+ anyway: no model turn is spent on it. Nothing here names a project, a path, a task, a person or an
7
+ account, and no prompt, output or answer is kept: ids are hashed, and every other value is a number
8
+ or comes from REIN's own vocabulary. Nothing is sent anywhere. The files stay until `rein
9
+ token-report --prune DAYS --yes` deletes the old ones."""
10
+
11
+ from __future__ import annotations
12
+
13
+ import hashlib
14
+ import json
15
+ import os
16
+ import re
17
+
18
+ import failure_triage as _triage
19
+ import quota as _quota
20
+
21
+ VERSION = 1
22
+ MODES = 0o600
23
+ VERDICTS = ("APPROVED", "CHANGES_REQUESTED", "NO_VERDICT") # the episode file may hold anything
24
+ _CLAUDE = re.compile(r"(?:claude-)?(?:opus|sonnet|haiku|fable)(?:-\d{1,2}){0,2}(?:-20\d{6})?")
25
+
26
+
27
+ def events_dir() -> str:
28
+ return os.environ.get("REIN_EVENTS_DIR") or os.path.expanduser("~/.claude/rein/ship-events")
29
+
30
+
31
+ def _opaque(*parts) -> str:
32
+ return hashlib.sha256("\0".join(map(str, parts)).encode("utf-8")).hexdigest()[:12]
33
+
34
+
35
+ def append(run_id: str, at: float, events: list) -> None:
36
+ """Add one line per event; a record that cannot be written never affects the run."""
37
+ if not events or not run_id or os.environ.get("REIN_EVENTS") == "0":
38
+ return
39
+ run = _opaque(run_id)
40
+ try:
41
+ lines = "".join(json.dumps(dict(
42
+ e, v=VERSION, at=at, run=run, **({"task": _opaque(run_id, e["task"])} if e.get("task") else {})),
43
+ sort_keys=True) + "\n" for e in events)
44
+ os.makedirs(events_dir(), exist_ok=True)
45
+ fd = os.open(os.path.join(events_dir(), run + ".jsonl"), os.O_WRONLY | os.O_APPEND | os.O_CREAT, MODES)
46
+ with os.fdopen(fd, "a", encoding="utf-8") as fh:
47
+ fh.write(lines)
48
+ except (OSError, TypeError, ValueError):
49
+ pass
50
+
51
+
52
+ def parallel(tasks) -> int:
53
+ """How many workers the plan's repos and dependencies allow at once. Two tasks can overlap when they
54
+ are in different repos and neither needs the other, even through a third. 1 always means that no two
55
+ can. More than 1 is an estimate: groups are grown greedily, so a larger one may be missed, and plan
56
+ order, worker slots, quota and timing may still keep tasks apart. It's never what really ran."""
57
+ tasks = {t.id: t for t in tasks}
58
+ needs: dict = {}
59
+ for tid in tasks:
60
+ todo, seen = list(tasks[tid].deps), set()
61
+ while todo:
62
+ dep = todo.pop()
63
+ if dep in tasks and dep not in seen:
64
+ seen.add(dep)
65
+ todo += tasks[dep].deps
66
+ needs[tid] = seen
67
+ workers = [t for t in tasks.values() if not t.human_review or t.verification.strip()] # the rest run no worker
68
+ most = 0
69
+ for first in workers:
70
+ group = [first]
71
+ for t in workers:
72
+ if all(t.repo != g.repo and t.id not in needs[g.id] and g.id not in needs[t.id] for g in group):
73
+ group.append(t)
74
+ most = max(most, len(group))
75
+ return most
76
+
77
+
78
+ def started(state, resumed: bool, rein: str) -> dict:
79
+ tasks = [t for t in state.tasks.values() if not t.id.startswith(("AUDIT", "GATE"))]
80
+ return {"event": "start", "tasks": len(tasks), "repos": len({t.repo for t in tasks}),
81
+ "edges": sum(len(t.deps) for t in tasks), "parallel": parallel(tasks), "resumed": resumed, "rein": rein}
82
+
83
+
84
+ def launched(role: str, task: str, requested: str, reported: str, identity: str, escalated: bool = False,
85
+ attempt: int = 1) -> dict:
86
+ return {"event": "launch", "role": role, "task": task, "requested": _public(requested),
87
+ "reported": _public(reported), "identity": identity, "escalated": escalated, "attempt": attempt}
88
+
89
+
90
+ def finished(done: int, tasks: int, audit: str, delivery: str, usage) -> dict:
91
+ """`usage`: the run's quota.usage_delta, per provider and window; None where it can't be told."""
92
+ quota = {p: {w: v for w, v in used.items() if w in _quota.WINDOWS}
93
+ for p, used in (usage or {}).items() if p in _quota.DEFAULT_MODELS}
94
+ return {"event": "finish", "done": done, "tasks": tasks, "audit": audit, "delivery": delivery, "quota": quota}
95
+
96
+
97
+ def _public(name: str) -> str:
98
+ """`agent/model` when REIN knows both; any other name ("other") may hold a customer or an account."""
99
+ agent, _, model = name.partition("/")
100
+ if not agent:
101
+ return ""
102
+ if agent not in _quota.DEFAULT_MODELS:
103
+ agent, model = "other", model and "other"
104
+ elif model and model != _quota.DEFAULT_MODELS[agent] and not (agent == "claude" and _CLAUDE.fullmatch(model)):
105
+ model = "other"
106
+ return "%s/%s" % (agent, model)
107
+
108
+
109
+ def _audit(round_: int, verdict, blocking, basis: str) -> dict:
110
+ return {"event": "audit", "round": round_, "verdict": verdict if verdict in VERDICTS else "other",
111
+ "blocking": blocking if isinstance(blocking, int) else 0, "basis": basis}
112
+
113
+
114
+ def _outcome(event) -> str:
115
+ if event.admission_waiting:
116
+ return "waiting"
117
+ if event.exit_code == 0:
118
+ return "green"
119
+ return "blocked" if event.exit_code == 126 or _triage.is_blocked(event.reason, event.checks) else "red"
120
+
121
+
122
+ def _check(event, scope: str, task: str, then: str) -> dict:
123
+ return {"event": "check", "scope": scope, "task": task, "outcome": _outcome(event),
124
+ "kinds": sorted(set(event.checks or ())), "next": then,
125
+ "seconds": None if event.seconds is None else round(event.seconds, 1)}
126
+
127
+
128
+ def _task_next(task) -> str:
129
+ if task.status == "pending":
130
+ return "escalate" if task.needs_stronger else "worker"
131
+ return {"gating": "rerun", "waiting": "wait", "gated": "ask", "failed": "ask"}.get(task.status, "none")
132
+
133
+
134
+ def of(old, event, new, now: float) -> list:
135
+ """The events one `decide(old, event) -> new` step stands for; [] when it changed nothing."""
136
+ name = type(event).__name__
137
+ if name == "GateVerdict":
138
+ before, after = old.tasks.get(event.task_id), new.tasks.get(event.task_id)
139
+ if before is None or before.status != "gating" or before == after:
140
+ return []
141
+ if event.admission_waiting and before.admission_wait:
142
+ return [] # still the same wait
143
+ return [_check(event, "task", event.task_id, _task_next(after))]
144
+ if name == "RepoGateVerdict":
145
+ if old.repo_gates.get(event.repo) != "running" or old == new and event.exit_code:
146
+ return []
147
+ if event.admission_waiting and old.repo_waits.get(event.repo):
148
+ return []
149
+ then = {"passed": "none", "running": "rerun", "waiting": "wait", "failed": "worker"}
150
+ return [_check(event, "repo", event.repo, then.get(new.repo_gates.get(event.repo), "ask"))]
151
+ if name == "WorkerDone" and event.outcome != "succeeded":
152
+ for tid, before in old.tasks.items():
153
+ if before.dispatch_id == event.dispatch_id and before != new.tasks[tid]:
154
+ return [{"event": "worker_failed", "task": tid, "next": _task_next(new.tasks[tid])}]
155
+ if name == "AuditVerdict" and old.phase == "auditing":
156
+ if event.guard:
157
+ return [] # held: it counts once the owner accepts it
158
+ return [_audit(old.audit_rounds + 1, event.verdict, event.blocking, old.audit_basis)]
159
+ if name == "GateResolved" and event.gate_id in old.gates and event.gate_id not in new.gates:
160
+ gate = old.gates[event.gate_id]
161
+ asked = gate.get("opened_at")
162
+ held = old.pending_verdict if gate.get("kind") == "audit_guard" and event.resolution == "accept" \
163
+ and old.phase == "auditing" else {}
164
+ return ([] if gate.get("auto") else [{
165
+ "event": "answer", "kind": gate.get("kind"), "waited": round(now - asked, 1) if asked else None}]) + (
166
+ [_audit(old.audit_rounds + 1, held.get("verdict"), held.get("blocking"), old.audit_basis)] if held else [])
167
+ return []