whiletrue 0.1.1__tar.gz → 0.2.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 (241) hide show
  1. {whiletrue-0.1.1 → whiletrue-0.2.0}/CHANGELOG.md +5 -0
  2. {whiletrue-0.1.1 → whiletrue-0.2.0}/PKG-INFO +16 -4
  3. {whiletrue-0.1.1 → whiletrue-0.2.0}/README.md +12 -2
  4. whiletrue-0.2.0/THIRD_PARTY_NOTICES.md +32 -0
  5. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/README.md +3 -0
  6. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/architecture.md +70 -0
  7. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/assets/architecture.svg +11 -8
  8. whiletrue-0.2.0/docs/assets/rsi-architecture.svg +69 -0
  9. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/cli.md +5 -0
  10. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/open-questions.md +8 -0
  11. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/plan.md +26 -2
  12. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/reference.md +11 -0
  13. whiletrue-0.2.0/docs/rsi-plan.md +121 -0
  14. whiletrue-0.2.0/docs/rsi.md +127 -0
  15. whiletrue-0.2.0/docs/spike-rsi.md +66 -0
  16. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/todo.md +51 -3
  17. {whiletrue-0.1.1 → whiletrue-0.2.0}/pyproject.toml +5 -3
  18. whiletrue-0.2.0/scripts/check_provenance.py +63 -0
  19. {whiletrue-0.1.1 → whiletrue-0.2.0}/scripts/docs_check.py +4 -1
  20. whiletrue-0.2.0/tests/fixtures/fake_rsi_claude.py +65 -0
  21. whiletrue-0.2.0/tests/integration/test_rsi_cli.py +166 -0
  22. whiletrue-0.2.0/tests/live/test_live_rsi.py +69 -0
  23. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_agent.py +29 -1
  24. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_headless.py +16 -0
  25. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_runtime.py +39 -0
  26. whiletrue-0.2.0/tests/unit/rsi/harness2/conftest.py +219 -0
  27. whiletrue-0.2.0/tests/unit/rsi/harness2/test_apply_adopt.py +340 -0
  28. whiletrue-0.2.0/tests/unit/rsi/harness2/test_context_library_selection.py +162 -0
  29. whiletrue-0.2.0/tests/unit/rsi/harness2/test_edges.py +217 -0
  30. whiletrue-0.2.0/tests/unit/rsi/harness2/test_prompts.py +68 -0
  31. whiletrue-0.2.0/tests/unit/rsi/harness2/test_runmark_ledger.py +79 -0
  32. whiletrue-0.2.0/tests/unit/rsi/harness2/test_sessions_proposal.py +133 -0
  33. whiletrue-0.2.0/tests/unit/rsi/harness2/test_snapshot_trajectory.py +177 -0
  34. whiletrue-0.2.0/tests/unit/rsi/harness2/test_strategy.py +174 -0
  35. whiletrue-0.2.0/tests/unit/rsi/harness2/test_tree.py +179 -0
  36. whiletrue-0.2.0/tests/unit/test_provenance.py +80 -0
  37. whiletrue-0.2.0/third_party/README.md +7 -0
  38. whiletrue-0.2.0/third_party/harness2/LICENSE +202 -0
  39. whiletrue-0.2.0/third_party/harness2/PROVENANCE.md +44 -0
  40. {whiletrue-0.1.1 → whiletrue-0.2.0}/uv.lock +1 -1
  41. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/agent.py +12 -2
  42. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/headless.py +2 -0
  43. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/app.py +31 -2
  44. whiletrue-0.2.0/whiletrue/cli/rsi_cmd.py +142 -0
  45. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/runner.py +3 -0
  46. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/runtime.py +4 -1
  47. whiletrue-0.2.0/whiletrue/rsi/__init__.py +25 -0
  48. whiletrue-0.2.0/whiletrue/rsi/harness2/__init__.py +4 -0
  49. whiletrue-0.2.0/whiletrue/rsi/harness2/adopt.py +113 -0
  50. whiletrue-0.2.0/whiletrue/rsi/harness2/apply.py +159 -0
  51. whiletrue-0.2.0/whiletrue/rsi/harness2/config.py +140 -0
  52. whiletrue-0.2.0/whiletrue/rsi/harness2/context.py +285 -0
  53. whiletrue-0.2.0/whiletrue/rsi/harness2/env.py +63 -0
  54. whiletrue-0.2.0/whiletrue/rsi/harness2/ledger.py +128 -0
  55. whiletrue-0.2.0/whiletrue/rsi/harness2/library.py +206 -0
  56. whiletrue-0.2.0/whiletrue/rsi/harness2/prompts.py +572 -0
  57. whiletrue-0.2.0/whiletrue/rsi/harness2/proposal.py +122 -0
  58. whiletrue-0.2.0/whiletrue/rsi/harness2/rollout.py +156 -0
  59. whiletrue-0.2.0/whiletrue/rsi/harness2/runmark.py +120 -0
  60. whiletrue-0.2.0/whiletrue/rsi/harness2/selection.py +118 -0
  61. whiletrue-0.2.0/whiletrue/rsi/harness2/sessions.py +357 -0
  62. whiletrue-0.2.0/whiletrue/rsi/harness2/snapshot.py +235 -0
  63. whiletrue-0.2.0/whiletrue/rsi/harness2/strategy.py +432 -0
  64. whiletrue-0.2.0/whiletrue/rsi/harness2/surfaces.py +182 -0
  65. whiletrue-0.2.0/whiletrue/rsi/harness2/trajectory.py +86 -0
  66. whiletrue-0.2.0/whiletrue/rsi/harness2/tree.py +426 -0
  67. {whiletrue-0.1.1 → whiletrue-0.2.0}/.editorconfig +0 -0
  68. {whiletrue-0.1.1 → whiletrue-0.2.0}/.envrc +0 -0
  69. {whiletrue-0.1.1 → whiletrue-0.2.0}/.github/ISSUE_TEMPLATE/task.md +0 -0
  70. {whiletrue-0.1.1 → whiletrue-0.2.0}/.github/pull_request_template.md +0 -0
  71. {whiletrue-0.1.1 → whiletrue-0.2.0}/.github/workflows/ci.yml +0 -0
  72. {whiletrue-0.1.1 → whiletrue-0.2.0}/.github/workflows/release.yml +0 -0
  73. {whiletrue-0.1.1 → whiletrue-0.2.0}/.gitignore +0 -0
  74. {whiletrue-0.1.1 → whiletrue-0.2.0}/CLAUDE.md +0 -0
  75. {whiletrue-0.1.1 → whiletrue-0.2.0}/LICENSE +0 -0
  76. {whiletrue-0.1.1 → whiletrue-0.2.0}/devenv.lock +0 -0
  77. {whiletrue-0.1.1 → whiletrue-0.2.0}/devenv.nix +0 -0
  78. {whiletrue-0.1.1 → whiletrue-0.2.0}/devenv.yaml +0 -0
  79. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/assets/demo-real.svg +0 -0
  80. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/assets/issue-loop.svg +0 -0
  81. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/assets/logo.svg +0 -0
  82. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/assets/ralph-loop.svg +0 -0
  83. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/authoring.md +0 -0
  84. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/conventions.md +0 -0
  85. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/developing.md +0 -0
  86. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/getting-started.md +0 -0
  87. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/m0-smoke.md +0 -0
  88. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/plugins.md +0 -0
  89. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/spike-interactive.md +0 -0
  90. {whiletrue-0.1.1 → whiletrue-0.2.0}/docs/tutorial.md +0 -0
  91. {whiletrue-0.1.1 → whiletrue-0.2.0}/examples/issue-loop/README.md +0 -0
  92. {whiletrue-0.1.1 → whiletrue-0.2.0}/examples/issue-loop/agents/fix.md +0 -0
  93. {whiletrue-0.1.1 → whiletrue-0.2.0}/examples/issue-loop/agents/implement.md +0 -0
  94. {whiletrue-0.1.1 → whiletrue-0.2.0}/examples/issue-loop/agents/respond.md +0 -0
  95. {whiletrue-0.1.1 → whiletrue-0.2.0}/examples/issue-loop/whiletrue.yaml +0 -0
  96. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/conftest.py +0 -0
  97. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/fixtures/fake_interactive_claude.py +0 -0
  98. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_cli.py +0 -0
  99. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_cli_surface.py +0 -0
  100. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_gates_cli.py +0 -0
  101. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_interactive_run.py +0 -0
  102. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_issue_loop.py +0 -0
  103. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_m3_exit.py +0 -0
  104. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_ops_cli.py +0 -0
  105. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/integration/test_recipes.py +0 -0
  106. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/live/test_live_backends.py +0 -0
  107. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_exec.py +0 -0
  108. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_gates.py +0 -0
  109. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_history.py +0 -0
  110. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_human.py +0 -0
  111. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_json_source.py +0 -0
  112. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_markdown_source.py +0 -0
  113. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_plugin.py +0 -0
  114. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_process.py +0 -0
  115. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_sessions.py +0 -0
  116. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/basics/test_shell.py +0 -0
  117. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_endpoint.py +0 -0
  118. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_interactive.py +0 -0
  119. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_panes.py +0 -0
  120. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_plugin_scripts.py +0 -0
  121. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_session.py +0 -0
  122. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/claude_code/test_transcript.py +0 -0
  123. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/codex/test_runner.py +0 -0
  124. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/control/test_control.py +0 -0
  125. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_cache.py +0 -0
  126. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_caps.py +0 -0
  127. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_composite.py +0 -0
  128. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_config.py +0 -0
  129. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_context.py +0 -0
  130. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_duration.py +0 -0
  131. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_events.py +0 -0
  132. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_expr.py +0 -0
  133. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_history_store.py +0 -0
  134. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_lock.py +0 -0
  135. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_memory_store.py +0 -0
  136. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_module.py +0 -0
  137. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_outcomes.py +0 -0
  138. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_registry.py +0 -0
  139. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_replay.py +0 -0
  140. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_template.py +0 -0
  141. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_validate.py +0 -0
  142. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/core/test_wake.py +0 -0
  143. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/git/test_git.py +0 -0
  144. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/github/test_client.py +0 -0
  145. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/github/test_filebacked.py +0 -0
  146. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/github/test_plugin.py +0 -0
  147. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/github/test_specs.py +0 -0
  148. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/opencode/test_runner.py +0 -0
  149. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/store_sqlite/test_sqlite_store.py +0 -0
  150. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/test_abort.py +0 -0
  151. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/test_architecture.py +0 -0
  152. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/test_panel.py +0 -0
  153. {whiletrue-0.1.1 → whiletrue-0.2.0}/tests/unit/tmux/test_controller.py +0 -0
  154. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/__init__.py +0 -0
  155. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/__main__.py +0 -0
  156. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/abort.py +0 -0
  157. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/__init__.py +0 -0
  158. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/comments.py +0 -0
  159. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/diff_size.py +0 -0
  160. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/exec_.py +0 -0
  161. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/history.py +0 -0
  162. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/human.py +0 -0
  163. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/json_source.py +0 -0
  164. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/markdown_source.py +0 -0
  165. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/process.py +0 -0
  166. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/sessions.py +0 -0
  167. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/set_.py +0 -0
  168. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/shell.py +0 -0
  169. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/basics/wake.py +0 -0
  170. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/__init__.py +0 -0
  171. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/endpoint.py +0 -0
  172. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/interactive.py +0 -0
  173. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/learnings.py +0 -0
  174. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/panes.py +0 -0
  175. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/plugin/.claude-plugin/plugin.json +0 -0
  176. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/plugin/hook.py +0 -0
  177. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/plugin/hooks/hooks.json +0 -0
  178. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/plugin/mcp_server.py +0 -0
  179. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/session.py +0 -0
  180. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/claude_code/transcript.py +0 -0
  181. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/__init__.py +0 -0
  182. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/__main__.py +0 -0
  183. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/common.py +0 -0
  184. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/gates.py +0 -0
  185. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/ops.py +0 -0
  186. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/panel.py +0 -0
  187. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/registry.py +0 -0
  188. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/cli/templates.py +0 -0
  189. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/codex/__init__.py +0 -0
  190. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/codex/runner.py +0 -0
  191. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/__init__.py +0 -0
  192. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/chain.py +0 -0
  193. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/loop.py +0 -0
  194. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/map_.py +0 -0
  195. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/parallel.py +0 -0
  196. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/retry.py +0 -0
  197. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/sequence.py +0 -0
  198. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/control/switch.py +0 -0
  199. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/__init__.py +0 -0
  200. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/caps.py +0 -0
  201. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/comments.py +0 -0
  202. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/composite.py +0 -0
  203. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/config.py +0 -0
  204. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/context.py +0 -0
  205. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/duration.py +0 -0
  206. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/events.py +0 -0
  207. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/expr.py +0 -0
  208. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/history.py +0 -0
  209. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/lock.py +0 -0
  210. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/memory_store.py +0 -0
  211. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/module.py +0 -0
  212. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/outcomes.py +0 -0
  213. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/registry.py +0 -0
  214. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/replay.py +0 -0
  215. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/source.py +0 -0
  216. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/store.py +0 -0
  217. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/template.py +0 -0
  218. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/validate.py +0 -0
  219. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/wake.py +0 -0
  220. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/core/workspace.py +0 -0
  221. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/git/__init__.py +0 -0
  222. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/git/modules.py +0 -0
  223. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/git/workspaces.py +0 -0
  224. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/__init__.py +0 -0
  225. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/client.py +0 -0
  226. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/filebacked.py +0 -0
  227. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/memory.py +0 -0
  228. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/plugin.py +0 -0
  229. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/github/specs.py +0 -0
  230. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/opencode/__init__.py +0 -0
  231. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/opencode/runner.py +0 -0
  232. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/py.typed +0 -0
  233. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/recipes/issue-loop.yaml +0 -0
  234. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/recipes/ralph.yaml +0 -0
  235. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/recipes/review-pass.yaml +0 -0
  236. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/recipes/review-respond.yaml +0 -0
  237. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/store_sqlite/__init__.py +0 -0
  238. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/store_sqlite/migrations.py +0 -0
  239. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/store_sqlite/sqlite_store.py +0 -0
  240. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/tmux/__init__.py +0 -0
  241. {whiletrue-0.1.1 → whiletrue-0.2.0}/whiletrue/tmux/controller.py +0 -0
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ - **Recursive self-improvement (`rsi`), off by default.** The Harness² method (Xu et al., arXiv:2610.14224) ported into `whiletrue.rsi.harness2`: isolated rollouts, improver sessions that edit the harness, composition, blind selection, a per-domain experience library, human-approved adoption, `rsi.budget_usd` and the R = 4k / P = 3k budget identity. New: top-level `rsi:` setting, strategy `rsi.harness2`, `whiletrue rsi status|diff|library|adopt|reset`. Claude Code and Codex surfaces. Apache-2.0 code keeps its headers; see THIRD_PARTY_NOTICES.md. Guide: docs/rsi.md.
6
+ - Core: a scope can redirect its steps to another directory (`cwd`), runners can pass raw messages (`RunContext.on_raw`), agents expose an event tap, and the item scope has `project_dir`.
7
+
3
8
  ## 0.1.1
4
9
 
5
10
  - Fixed: parallel interactive items raced to create the tmux session. The loser failed with `duplicate session` and that error was fed to the agent as its previous failure. Session and pane creation now run one at a time, and parallel agents share one window grid.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: whiletrue
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Local orchestrator that runs pipelines of agent and deterministic steps around Claude Code, opencode and Codex, with gates, human approval, parallel git worktrees and crash-safe resume.
5
5
  Project-URL: Repository, https://github.com/dariussingh/whiletrue
6
6
  Project-URL: Changelog, https://github.com/dariussingh/whiletrue/blob/main/CHANGELOG.md
@@ -8,7 +8,9 @@ Project-URL: Documentation, https://github.com/dariussingh/whiletrue/tree/main/d
8
8
  Author: Darius Singh
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE
11
- Keywords: agents,ai-agents,claude-code,codex,coding-agents,git-worktree,human-in-the-loop,opencode,orchestration,pipelines,ralph,tmux
11
+ License-File: THIRD_PARTY_NOTICES.md
12
+ License-File: third_party/harness2/LICENSE
13
+ Keywords: agents,ai-agents,claude-code,codex,coding-agents,git-worktree,human-in-the-loop,opencode,orchestration,pipelines,ralph,recursive-self-improvement,tmux
12
14
  Classifier: Development Status :: 4 - Beta
13
15
  Classifier: Environment :: Console
14
16
  Classifier: Intended Audience :: Developers
@@ -137,7 +139,7 @@ Every agent must declare `limits`; `validate` refuses the config otherwise.
137
139
 
138
140
  <img src="docs/assets/architecture.svg" alt="Architecture: whiletrue.yaml and the CLI drive the core engine (loader, scheduler, pipeline runtime, park and resume, plugin registry, SQLite store); built-in plugins connect it to agent CLIs, git, GitHub and tmux" width="900">
139
141
 
140
- The core knows nothing about git, GitHub, tmux or any agent. Every integration is a plugin built on the public plugin API, so you can add your own ([plugins](docs/plugins.md), [architecture](docs/architecture.md)).
142
+ The core knows nothing about git, GitHub, tmux or any agent. Every integration is a plugin built on the public plugin API, including the optional `rsi` layer, so you can add your own ([plugins](docs/plugins.md), [architecture](docs/architecture.md)).
141
143
 
142
144
  ## Concepts
143
145
 
@@ -263,6 +265,16 @@ whiletrue --help # installed editable into .devenv/state/venv
263
265
 
264
266
  Live tests against real agent CLIs are opt-in: `WHILETRUE_LIVE=1 uv run pytest tests/live -v`.
265
267
 
268
+ ## Recursive self-improvement
269
+
270
+ Optional and off by default: `rsi: true` lets whiletrue improve the harness around your agent (prompts, skills, subagents) item by item with the Propose, Probe, Compose method from Harness², using isolated rollouts, blind selection and a per-domain experience library. A person approves what is adopted. It multiplies agent spend (about 7 times at `k: 1`) and is capped by `budget_usd`. See [docs/rsi.md](docs/rsi.md). Next: Gemini CLI support.
271
+
272
+ <img src="docs/assets/rsi-architecture.svg" alt="rsi architecture: task-level recursion per item (reference rollouts, propose, INV and DOM candidates, compose, blind selection, apply) and harnessing-level recursion across items (reflect, human adoption, experience library)" width="900">
273
+
274
+ ## Acknowledgements and citation
275
+
276
+ The `rsi` feature builds on **Harness²: Recursive Agent Harnessing for an Open World** (Xu et al., Google Research, 2026; [arXiv:2610.14224](https://arxiv.org/abs/2610.14224), [code](https://github.com/google-research/harness2), Apache-2.0). If you use `rsi` in research, please cite the paper (BibTeX in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)). whiletrue is an independent project, not affiliated with Google or the Harness² authors.
277
+
266
278
  ## License
267
279
 
268
- MIT. See [LICENSE](LICENSE).
280
+ MIT. See [LICENSE](LICENSE). Third-party code under `third_party/`, benchmarks, and datasets retain their upstream licenses; see [third-party notices](THIRD_PARTY_NOTICES.md).
@@ -112,7 +112,7 @@ Every agent must declare `limits`; `validate` refuses the config otherwise.
112
112
 
113
113
  <img src="docs/assets/architecture.svg" alt="Architecture: whiletrue.yaml and the CLI drive the core engine (loader, scheduler, pipeline runtime, park and resume, plugin registry, SQLite store); built-in plugins connect it to agent CLIs, git, GitHub and tmux" width="900">
114
114
 
115
- The core knows nothing about git, GitHub, tmux or any agent. Every integration is a plugin built on the public plugin API, so you can add your own ([plugins](docs/plugins.md), [architecture](docs/architecture.md)).
115
+ The core knows nothing about git, GitHub, tmux or any agent. Every integration is a plugin built on the public plugin API, including the optional `rsi` layer, so you can add your own ([plugins](docs/plugins.md), [architecture](docs/architecture.md)).
116
116
 
117
117
  ## Concepts
118
118
 
@@ -238,6 +238,16 @@ whiletrue --help # installed editable into .devenv/state/venv
238
238
 
239
239
  Live tests against real agent CLIs are opt-in: `WHILETRUE_LIVE=1 uv run pytest tests/live -v`.
240
240
 
241
+ ## Recursive self-improvement
242
+
243
+ Optional and off by default: `rsi: true` lets whiletrue improve the harness around your agent (prompts, skills, subagents) item by item with the Propose, Probe, Compose method from Harness², using isolated rollouts, blind selection and a per-domain experience library. A person approves what is adopted. It multiplies agent spend (about 7 times at `k: 1`) and is capped by `budget_usd`. See [docs/rsi.md](docs/rsi.md). Next: Gemini CLI support.
244
+
245
+ <img src="docs/assets/rsi-architecture.svg" alt="rsi architecture: task-level recursion per item (reference rollouts, propose, INV and DOM candidates, compose, blind selection, apply) and harnessing-level recursion across items (reflect, human adoption, experience library)" width="900">
246
+
247
+ ## Acknowledgements and citation
248
+
249
+ The `rsi` feature builds on **Harness²: Recursive Agent Harnessing for an Open World** (Xu et al., Google Research, 2026; [arXiv:2610.14224](https://arxiv.org/abs/2610.14224), [code](https://github.com/google-research/harness2), Apache-2.0). If you use `rsi` in research, please cite the paper (BibTeX in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)). whiletrue is an independent project, not affiliated with Google or the Harness² authors.
250
+
241
251
  ## License
242
252
 
243
- MIT. See [LICENSE](LICENSE).
253
+ MIT. See [LICENSE](LICENSE). Third-party code under `third_party/`, benchmarks, and datasets retain their upstream licenses; see [third-party notices](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,32 @@
1
+ # Third-party notices
2
+
3
+ whiletrue is MIT licensed (see [LICENSE](LICENSE)). Third-party code under `third_party/`, benchmarks and datasets retain their upstream licenses.
4
+
5
+ ## Harness²
6
+
7
+ The `rsi` feature builds on **Harness²: Recursive Agent Harnessing for an Open World** (Xu et al., Google Research, 2026; [arXiv:2610.14224](https://arxiv.org/abs/2610.14224), [code](https://github.com/google-research/harness2), Apache-2.0). If you use `rsi` in research, please cite the paper (BibTeX below). whiletrue is an independent project, not affiliated with Google or the Harness² authors.
8
+
9
+ The optional recursive self-improvement feature (`rsi`) is built on the method and code of Harness² by Google Research. The method code is ported and refactored into this repository as `whiletrue.rsi.harness2`; users install no extra dependency.
10
+
11
+ - Source: https://github.com/google-research/harness2 (pinned commit `1cfe254e8d25b15f37048c3730134686abe60335`)
12
+ - License: Apache License 2.0. The license text is at [third_party/harness2/LICENSE](third_party/harness2/LICENSE).
13
+ - Copyright 2026 Google LLC.
14
+ - Each ported file in `whiletrue/rsi/harness2/` keeps its upstream copyright header and carries a notice that it was modified. The files, their upstream paths and the modifications are listed in [third_party/harness2/PROVENANCE.md](third_party/harness2/PROVENANCE.md). Those files are licensed under Apache-2.0, not MIT.
15
+ - Not taken: the benchmark runners, patches and datasets in the upstream repository (JobBench, LAB, WorkBuddy-Bench). They have their own licenses, and the WorkBuddy-derived code includes a territorial limitation on use. whiletrue does not copy, bundle or redistribute them.
16
+
17
+ Please cite the paper if you use `rsi` in research:
18
+
19
+ ```bibtex
20
+ @misc{xu2026harness2,
21
+ title = {Harness$^2$: Recursive Agent Harnessing for an Open World},
22
+ author = {Xu, Ruiyao and Chen, Yanfei and CuiZhu, Zhongying and Dalvi Mishra, Bhavana and Ming, Yifei and Yu, Han and Han, Rujun and Lee, Chen-Yu and Pfister, Tomas},
23
+ year = {2026},
24
+ eprint = {2610.14224},
25
+ archivePrefix = {arXiv},
26
+ primaryClass = {cs.AI},
27
+ doi = {10.48550/arXiv.2610.14224},
28
+ url = {https://arxiv.org/abs/2610.14224}
29
+ }
30
+ ```
31
+
32
+ whiletrue is an independent project. It is not affiliated with or endorsed by Google or the Harness² authors.
@@ -7,12 +7,15 @@
7
7
  | [tutorial.md](tutorial.md) | Tutorial: install, first loop, then build your own gates, review, parallel and human steps |
8
8
  | [authoring.md](authoring.md) | Authoring guide: pipelines, composites, agents, choosing a backend |
9
9
  | [cli.md](cli.md) | CLI reference: every command, option, exit code and environment variable |
10
+ | [rsi.md](rsi.md) | Recursive self-improvement: turn it on, what it costs, adoption, limits |
10
11
  | [reference.md](reference.md) | User reference: modules, control flow, expressions, composites, recipes, replay |
11
12
  | [plugins.md](plugins.md) | Extending whiletrue: modules, strategies, runners, caps, entry points |
12
13
  | [developing.md](developing.md) | Contributing: setup, layout, run flow, workflow |
14
+ | [rsi-plan.md](rsi-plan.md) | Execution plan for M5: Harness² recursive self-improvement and the Gemini CLI backend |
13
15
  | [plan.md](plan.md) | Implementation plan: milestones M0–M4, dependencies, exit criteria, risks, spikes |
14
16
  | [todo.md](todo.md) | Numbered, ordered implementation checklist (work top to bottom) |
15
17
  | [open-questions.md](open-questions.md) | Undecided design questions, each tied to the milestone that forces the decision |
18
+ | [spike-rsi.md](spike-rsi.md) | Findings: Harness² method, what is ported, concept mapping and decisions |
16
19
  | [spike-interactive.md](spike-interactive.md) | Findings: plugin hooks and MCP in interactive Claude Code (OQ-1) |
17
20
  | [conventions.md](conventions.md) | Engineering conventions, test and docs rules (the non-negotiables made concrete) |
18
21
 
@@ -417,6 +417,74 @@ pipeline:
417
417
 
418
418
  The pipeline exercises every core feature: the item graph, parallel worktrees, retry with feedback, deterministic gates, a side-effect journal (push and PR), a conversational human gate that answers every comment, with a `rejected` route, a nested loop, a reusable composite, a second runner, a shared session across steps, and a resource lock for merges.
419
419
 
420
+ ## Recursive harness improvement (RSI)
421
+
422
+ **Status: built (M5), off by default.** User guide: [rsi.md](rsi.md). Source method: Harness² (Xu et al., Google Research, 2026, [arXiv:2610.14224](https://arxiv.org/abs/2610.14224), [code](https://github.com/google-research/harness2), Apache-2.0). The method code is ported into this repo as `whiletrue.rsi.harness2` (Apache-2.0 headers kept; see [THIRD_PARTY_NOTICES.md](../THIRD_PARTY_NOTICES.md)). Other RSI methods can sit beside it as `whiletrue.rsi.<method>`; `rsi.method` selects one (default `harness2`).
423
+
424
+ A pipeline normally runs the same agent harness (the agent file, plus the project's `CLAUDE.md`, skills, subagents, hooks and scripts) for every item. With `rsi: true`, whiletrue improves that harness while the backlog runs, keeping model weights fixed. It works at two levels.
425
+
426
+ - **Task-level recursion** refines the harness for the current item with a contrastive **Propose, Probe, Compose** step. Reference rollouts of the base harness give evidence. An improver proposes general (invariant, INV) and domain-specific (DOM) edits. Each candidate is probed by running it on the same item. Compositions combine the candidates using the behavioral contrasts between their rollouts. A blind selector, which never sees scores, picks one final output.
427
+ - **Harnessing-level recursion** keeps what worked. After an item, a reflector stores the adopted harness and evidence-supported lessons in a per-domain library that later items read.
428
+
429
+ ```mermaid
430
+ flowchart LR
431
+ A[Item] --> B[k reference rollouts<br/>base harness]
432
+ B --> C[Propose: INV and DOM edits]
433
+ C --> D[Probe: run each candidate<br/>in its own worktree]
434
+ D --> E[Compose: k refined harnesses]
435
+ E --> F[Final rollouts]
436
+ F --> G[Blind selection]
437
+ G --> H{Adopt?}
438
+ H -- approve --> I[Diff at human gate,<br/>commit on approval]
439
+ G --> J[Reflect]
440
+ J --> K[(Per-domain library)]
441
+ K -. read before the next item .-> C
442
+ ```
443
+
444
+ ### Setting
445
+
446
+ ```yaml
447
+ rsi: false # default; every existing config behaves exactly as before
448
+
449
+ agents: # or per agent file: `rsi:` in the header
450
+ rsi:
451
+ k: 1 # task-level recursion budget
452
+ mode: parallel # parallel | sequential
453
+ domain: "item.labels[0]" # expression; default is the source label or project
454
+ adopt: approve # approve (default) | auto | never
455
+ evidence: blind # blind (default) | gates
456
+ budget_usd: 12 # required; hard cap, parks the item when reached
457
+ when: "iter.index > 1" # optional guard
458
+ ```
459
+
460
+ `whiletrue run --rsi` and `--no-rsi` override the file. `validate` refuses `rsi` without a budget, without limits on the improver and selector agents, without `workspace: git-worktree`, or without an adoption policy. `plan` prints the RSI stages and the worst-case cost: one step at `k` is **R = 4k rollouts and P = 3k improvement sessions**, so `k: 1` costs about 7 times a plain agent run.
461
+
462
+ ### How it maps onto whiletrue
463
+
464
+ | Harness² | whiletrue |
465
+ |---|---|
466
+ | Task, domain, task stream | Item, `rsi.domain`, item order |
467
+ | Base harness | The agent file and the project's agent surface in the item's worktree |
468
+ | Rollout | The pipeline's agent step run under a harness, in an isolated worktree |
469
+ | Executor | A runner: `claude-code-headless`, `claude-code`, `opencode`, `codex`,
470
+ | Improver, composer, selector, reflector | Ordinary whiletrue agent steps with limits, on any backend |
471
+ | c1..c8 component tree | A `SurfaceSpec` per runner: system prompt, guardrails, memory, tool guidance, subagents, skills, scripts, plugins |
472
+ | Budget ledger | `cost`, split by stage, with a hard `budget_usd` |
473
+ | Experience library | `.whiletrue/rsi/`, linked to `history` and `learnings` |
474
+
475
+ ### Principles
476
+
477
+ 1. **Off unless asked.** `rsi: false` is the default and leaves behavior unchanged. This is regression-tested.
478
+ 2. **Answer-free by default.** Evidence and selection never contain a verifier's verdict, as in the paper. A coding pipeline already has deterministic gates, so `evidence: gates` and `selection: gate-first` are opt-in (OQ-12).
479
+ 3. **A human adopts.** Candidate harnesses live in worktrees. Adopting one into the repo is a diff at a `human.approve` gate. Hooks, scripts and permission rules are never adopted automatically, because they execute code.
480
+ 4. **Bounded.** A required budget, the `4k` and `3k` identity checked at run time, and a `when:` guard.
481
+ 5. **Resumable.** Rollouts are journaled; a finished rollout is reused through its completion marker and harness fingerprint.
482
+ 6. **Core stays clean.** `whiletrue.rsi` is a plugin on the public API. `whiletrue.core` imports nothing from it.
483
+
484
+ ### What is taken from Harness²
485
+
486
+ Only method code (`core/`: component tree, spec seam, ledger, library, selection, run markers, evidence context, prompts), ported and refactored into `whiletrue/rsi/harness2/` with the upstream headers kept, modifications noted, and each file listed in `third_party/harness2/PROVENANCE.md`. The orchestration is rebuilt on whiletrue's runtime. Benchmark runners, patches and datasets are not taken; they keep their upstream licenses, and the WorkBuddy-derived code carries a territorial limitation. whiletrue is an independent project and is not affiliated with Google or the Harness² authors.
487
+
420
488
  ## Packages and repo layout
421
489
 
422
490
  One Python distribution, `whiletrue`, published to PyPI. Each row below is a subpackage (`whiletrue.<name>`); the core has no knowledge of git, GitHub, tmux or any specific agent, and that boundary is enforced by an import test. Third-party plugins are separate distributions that advertise a `Plugin` under the `whiletrue.plugins` entry-point group (or a module exposing `plugin`), and are named in `uses:`.
@@ -434,6 +502,7 @@ One Python distribution, `whiletrue`, published to PyPI. Each row below is a sub
434
502
  | `whiletrue.tmux` | TUI: session, panes, control panel | core |
435
503
  | `whiletrue.cli` | The `whiletrue` command; loads plugins listed in `whiletrue.yaml` | all of the above as defaults |
436
504
  | `whiletrue.recipes` | Shareable composites: `ralph`, `review-pass`, `issue-loop` | control, basics |
505
+ | `whiletrue.rsi` | Optional recursive harness improvement. `whiletrue.rsi.harness2` is the Harness² method (component tree, surfaces, ledger, library, selection, evidence, prompts, `rsi.harness2` strategy, adoption gate); other methods can be added beside it | core, git |
437
506
 
438
507
  ### CLI surface (v0.1)
439
508
 
@@ -444,6 +513,7 @@ One Python distribution, `whiletrue`, published to PyPI. Each row below is a sub
444
513
  - `whiletrue.yaml` is the pipeline, and `whiletrue.lock` pins plugin versions.
445
514
  - `agents/*.md` and `loops/*.yaml` hold the project's agent modules and composites.
446
515
  - `.whiletrue/` holds `state.db`, logs and session transcripts. It is git-ignored.
516
+ - `third_party/` holds the upstream license text and provenance for code ported into this repo (today: Harness²). See [THIRD_PARTY_NOTICES.md](../THIRD_PARTY_NOTICES.md).
447
517
 
448
518
  ## Implementation status (M0 to M4)
449
519
 
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 600" width="960" height="600" role="img" aria-label="whiletrue architecture: CLI and whiletrue.yaml feed the core engine, which uses plugins to drive agent CLIs, git, GitHub and tmux, with state in SQLite">
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 668" width="960" height="668" role="img" aria-label="whiletrue architecture: CLI and whiletrue.yaml feed the core engine, which uses plugins to drive agent CLIs, git, GitHub and tmux, with state in SQLite">
2
2
  <style>
3
3
  text{font:13px ui-monospace,SFMono-Regular,Menlo,Consolas,'DejaVu Sans Mono',monospace;fill:#d5dbe3}
4
4
  .t{font-size:15px;font-weight:700}.d{fill:#7d8896}.b{fill:#151b23;stroke:#2b3440;stroke-width:1.5}
@@ -6,7 +6,7 @@
6
6
  .l{stroke:#7d8896;stroke-width:1.5;fill:none;marker-end:url(#a)}
7
7
  </style>
8
8
  <defs><marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0L10 5L0 10z" fill="#7d8896"/></marker></defs>
9
- <rect width="960" height="600" rx="10" fill="#0f1419"/>
9
+ <rect width="960" height="668" rx="10" fill="#0f1419"/>
10
10
 
11
11
  <rect class="b" x="30" y="24" width="900" height="64" rx="6"/>
12
12
  <text class="t" x="48" y="50">You</text>
@@ -31,7 +31,7 @@
31
31
 
32
32
  <path class="l" d="M480 320V346"/>
33
33
 
34
- <rect class="c" x="30" y="348" width="900" height="122" rx="6"/>
34
+ <rect class="c" x="30" y="348" width="900" height="190" rx="6"/>
35
35
  <text class="t" x="48" y="374">Built-in plugins (public plugin API only)</text>
36
36
  <rect class="b" x="48" y="388" width="140" height="64" rx="5"/><text x="60" y="414">control</text><text class="d" x="60" y="434">loop map switch</text>
37
37
  <rect class="b" x="200" y="388" width="140" height="64" rx="5"/><text x="212" y="414">basics</text><text class="d" x="212" y="434">agent shell</text>
@@ -39,10 +39,13 @@
39
39
  <rect class="b" x="504" y="388" width="140" height="64" rx="5"/><text x="516" y="414">github</text><text class="d" x="516" y="434">issues, PRs</text>
40
40
  <rect class="b" x="656" y="388" width="130" height="64" rx="5"/><text x="668" y="414">claude_code</text><text class="d" x="668" y="434">headless tmux</text>
41
41
  <rect class="b" x="798" y="388" width="114" height="64" rx="5"/><text x="810" y="414">opencode</text><text class="d" x="810" y="434">codex</text>
42
+ <rect x="48" y="462" width="864" height="64" rx="5" fill="#241a2e" stroke="#8b66b0" stroke-width="1.5" stroke-dasharray="6 4"/>
43
+ <text class="t" x="60" y="486" style="fill:#c9a8e8">rsi (optional, off by default) · Harness²</text>
44
+ <text class="d" x="60" y="508">rsi.harness2: rollouts, improver sessions, blind selection, library, human adoption</text>
45
+
46
+ <path class="l" d="M480 538V564"/>
42
47
 
43
- <path class="l" d="M480 470V496"/>
44
-
45
- <rect class="o" x="30" y="498" width="900" height="74" rx="6"/>
46
- <text class="t" x="48" y="524">Outside world</text>
47
- <text class="d" x="48" y="546">claude · opencode · codex CLIs | git | gh (GitHub) | tmux | your tests and scripts</text>
48
+ <rect class="o" x="30" y="566" width="900" height="74" rx="6"/>
49
+ <text class="t" x="48" y="592">Outside world</text>
50
+ <text class="d" x="48" y="614">claude · opencode · codex CLIs | git | gh (GitHub) | tmux | your tests and scripts</text>
48
51
  </svg>
@@ -0,0 +1,69 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 560" width="960" height="560" role="img" aria-label="rsi architecture: task-level recursion runs reference rollouts, proposes general and domain harness edits, probes them in isolated workspaces, composes final harnesses and selects one blind; harnessing-level recursion reflects into a per-domain library read by the next item; a person approves what is adopted">
2
+ <style>
3
+ text{font:13px ui-monospace,SFMono-Regular,Menlo,Consolas,'DejaVu Sans Mono',monospace;fill:#d5dbe3}
4
+ .t{font-weight:700;font-size:15px}.d{fill:#7d8896}.p{fill:#c9a8e8}.ok{fill:#7fd48a}.hu{fill:#e8935a}
5
+ .n{fill:#151b23;stroke:#2b3440;stroke-width:1.5}.a{fill:#10222b;stroke:#3a7f96;stroke-width:1.5}
6
+ .g{fill:#12251a;stroke:#3f7a50;stroke-width:1.5}.y{fill:#2a2812;stroke:#a89a3a;stroke-width:1.5}
7
+ .h{fill:#2a1f14;stroke:#a8683a;stroke-width:1.5}.v{fill:#241a2e;stroke:#8b66b0;stroke-width:1.5}
8
+ .l{stroke:#7d8896;stroke-width:1.5;fill:none;marker-end:url(#m)}
9
+ .lp{stroke:#8b66b0;stroke-width:2;fill:none;marker-end:url(#mp)}
10
+ </style>
11
+ <defs>
12
+ <marker id="m" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0L10 5L0 10z" fill="#7d8896"/></marker>
13
+ <marker id="mp" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0L10 5L0 10z" fill="#8b66b0"/></marker>
14
+ </defs>
15
+ <rect width="960" height="560" rx="10" fill="#0f1419"/>
16
+ <text class="t" x="30" y="32">rsi.harness2: recursion around one item, repeated across items</text>
17
+
18
+ <rect x="20" y="48" width="920" height="352" rx="12" fill="#12161d" stroke="#3a3f4d" stroke-width="1.5"/>
19
+ <text class="t p" x="36" y="74">Task-level recursion, per item</text>
20
+
21
+ <rect class="n" x="36" y="92" width="140" height="150" rx="6"/>
22
+ <text class="t" x="48" y="116">Reference</text><text class="t" x="48" y="134">rollouts</text>
23
+ <text class="d" x="48" y="158">k runs of your</text><text class="d" x="48" y="174">steps with the</text><text class="d" x="48" y="190">current harness,</text><text class="d" x="48" y="206">in a workspace</text><text class="d" x="48" y="222">copy</text>
24
+
25
+ <rect class="a" x="206" y="92" width="150" height="150" rx="6"/>
26
+ <text class="t" x="218" y="116">Propose</text>
27
+ <text class="d" x="218" y="138">improver sessions</text><text class="d" x="218" y="154">edit the harness</text><text class="d" x="218" y="170">from full</text><text class="d" x="218" y="186">trajectories,</text><text class="d" x="218" y="202">no scores</text>
28
+
29
+ <rect class="g" x="388" y="92" width="190" height="66" rx="6"/>
30
+ <text class="t" x="400" y="116">INV candidates</text><text class="d" x="400" y="138">how the agent works</text>
31
+ <rect class="y" x="388" y="176" width="190" height="66" rx="6"/>
32
+ <text class="t" x="400" y="200">DOM candidates</text><text class="d" x="400" y="222">what an expert knows</text>
33
+ <text class="d" x="388" y="262">Probe: each candidate rolled out once</text>
34
+
35
+ <rect class="a" x="610" y="92" width="150" height="150" rx="6"/>
36
+ <text class="t" x="622" y="116">Compose</text>
37
+ <text class="d" x="622" y="138">merge using the</text><text class="d" x="622" y="154">rollouts; k final</text><text class="d" x="622" y="170">harnesses, each</text><text class="d" x="622" y="186">rolled out</text>
38
+
39
+ <rect class="n" x="792" y="92" width="132" height="150" rx="6"/>
40
+ <text class="t" x="804" y="116">Select</text>
41
+ <text class="d" x="804" y="138">anonymous</text><text class="d" x="804" y="154">outputs, blind;</text><text class="d" x="804" y="170">falls back to</text><text class="d" x="804" y="186">a base run</text>
42
+
43
+ <path class="l" d="M176 167H204"/><path class="l" d="M356 167H386"/><path class="l" d="M578 125H608"/><path class="l" d="M578 209H608"/><path class="l" d="M760 167H790"/>
44
+ <path class="l" d="M858 242V290H241V298"/>
45
+
46
+ <rect class="h" x="36" y="300" width="410" height="84" rx="6"/>
47
+ <text class="t hu" x="48" y="324">The chosen result is applied</text>
48
+ <text class="d" x="48" y="346">file changes go into the item's workspace;</text>
49
+ <text class="d" x="48" y="364">your gates, commit and PR run on them</text>
50
+
51
+ <rect class="v" x="478" y="300" width="446" height="84" rx="6"/>
52
+ <text class="t p" x="490" y="324">Budget: R = 4k rollouts, P = 3k sessions</text>
53
+ <text class="d" x="490" y="346">hard cap per item (budget_usd);</text>
54
+ <text class="d" x="490" y="364">finished stages are reused on resume</text>
55
+
56
+ <rect x="20" y="416" width="920" height="124" rx="12" fill="#17121f" stroke="#8b66b0" stroke-width="1.5"/>
57
+ <text class="t p" x="36" y="442">Harnessing-level recursion, across items</text>
58
+
59
+ <rect class="v" x="36" y="454" width="190" height="72" rx="6"/>
60
+ <text class="t" x="48" y="478">Reflect</text><text class="d" x="48" y="498">what each edit did,</text><text class="d" x="48" y="514">one lesson at most</text>
61
+ <rect class="h" x="262" y="454" width="250" height="72" rx="6"/>
62
+ <text class="t hu" x="274" y="478">Human adoption gate</text><text class="d" x="274" y="498">approve | auto | never;</text><text class="d" x="274" y="514">code files always a person</text>
63
+ <rect class="v" x="548" y="454" width="250" height="72" rx="6"/>
64
+ <text class="t" x="560" y="478">Experience library</text><text class="d" x="560" y="498">per domain; read by the</text><text class="d" x="560" y="514">next item's improvers</text>
65
+ <path class="lp" d="M226 490H260"/><path class="lp" d="M512 490H546"/>
66
+ <path class="lp" d="M798 490H830V408H462V250H282V244"/>
67
+ <text class="d" x="838" y="478" style="fill:#c9a8e8">next item</text>
68
+ <text class="d" x="36" y="556">Method: Harness² (Xu et al., Google Research, 2026, arXiv:2610.14224), ported into whiletrue.rsi.harness2.</text>
69
+ </svg>
@@ -42,6 +42,11 @@
42
42
  | `whiletrue comment <item> "text"` | Leave a comment the pipeline must answer at its next wake |
43
43
  | `whiletrue history <item>` | The item's timeline: parks, decisions (who, when, note), comments, replies, steers |
44
44
  | `whiletrue learnings [list \| approve <id> \| reject <id>]` | Review the lessons `history.distill` proposed; only approved ones reach agents |
45
+ | `whiletrue rsi status` | Every item's recursive self-improvement proposal: state, chosen candidate, spend |
46
+ | `whiletrue rsi diff <item>` | The harness change an item proposed |
47
+ | `whiletrue rsi library` | The experience library, by domain |
48
+ | `whiletrue rsi adopt <item> [--yes]` | Write a proposed harness into the project and store its lesson; `--yes` is required when it changes executable files |
49
+ | `whiletrue rsi reset <item>` | Forget an item's rollouts and proposal |
45
50
 
46
51
  ## Watching
47
52
 
@@ -11,6 +11,14 @@
11
11
  | 7 | ~~License: MIT or Apache-2.0~~ **Resolved: MIT** | Done |
12
12
  | 8 | ~~Claim npm org / GitHub org~~ **Superseded by OQ-9:** no npm packages. The PyPI name `whiletrue` is free (checked 2026-10-16); CLI binary stays `whiletrue`. No GitHub org needed. | Done |
13
13
  | 9 | ~~Implementation language~~ **Resolved: Python 3.12+** (2026-10-16), not TypeScript. Nothing in the design needs Node: agents are driven as subprocesses. One `whiletrue` distribution; pydantic, stdlib `sqlite3`, asyncio, pytest, ruff, pyright. | Done |
14
+ | 11 | ~~Vendor, depend on, or re-implement Harness²?~~ **Resolved (2026-10-26, owner): port and refactor** the method code into this repo as `whiletrue.rsi.harness2` so users install nothing extra and other RSI methods can sit beside it (`whiletrue.rsi.<method>`). Apache-2.0 headers kept, modifications noted, license copy in `third_party/harness2/`. Not ported: benchmark runners, WorkBuddy-derived code (territorial license), datasets. | Done |
15
+ | 12 | Harness² is deliberately answer-free (no ground truth, no grader verdicts in evidence). whiletrue has deterministic gates. Do gate results enter the evidence and selection? Default **blind** (faithful to the paper); opt-in `rsi.evidence: gates` and `selection: gate-first`. | M5 (items 84, 86) |
16
+ | 13 | What are "task", "domain" and the "task stream" for coding work? Proposal: task = item, domain = `rsi.domain` expression (default the source's label or milestone, else the project), stream = item order, library persists across items and runs. | M5 (item 88) |
17
+ | 14 | Where do harness edits live, and who approves them? Candidates run in per-candidate worktrees. Adopting a harness into the repo (`CLAUDE.md`, `.claude/`, `agents/`) is a human decision: `rsi.adopt: approve` (default) shows the diff at a `human.approve` gate; `auto` and `never` exist. Edits to hooks and scripts always need approval. | M5 (item 90) |
18
+ | 15 | Cost. One RSI step at k=1 is 4 rollouts and 3 improvement sessions, about 7x one agent run. How do we keep it affordable: required `rsi.budget_usd`, a `when:` guard (for example only after a gate failure, or every Nth item), worst-case estimate in `plan`? | M5 (items 81, 87) |
19
+ | 16 | The editable surface for Claude Code: which of the eight components map to which files, and which are too dangerous to edit unattended (hooks, scripts, permission rules, MCP). Opencode and Codex surfaces come from Harness²'s `SurfaceSpec`s. | M5 spike (items 79, 82) |
20
+ | 17 | Does `rsi` measurably help on coding backlogs where a gate already exists? Needs an honest evaluation against the existing rule-based `history.distill` baseline before it is recommended. | M5 (item 94) |
21
+ | 18 | Gemini CLI as a backend. Its docs show `-p`, `-o stream-json`, `--approval-mode`, exit codes `0/1/42/53` and `GEMINI.md`, but no budget, turn or structured-output flag, and the layout of skills, extensions and agents is not specified. The README also says unpaid-tier and Google One users moved to Antigravity CLI on 2026-06-18, so access depends on the account type. Verify against the real binary first; treat budget and turn limits as unsupported (like Codex). | M6 spike (item 98) |
14
22
 
15
23
  ## Decision: expression language (OQ-6)
16
24
 
@@ -6,7 +6,7 @@ From M1 onward, whiletrue is built using its own workflow (dogfooding). Each mil
6
6
 
7
7
  ## Status
8
8
 
9
- M0 to M4 are built (M0 and M1 reviewed); what remains is the v0.1 release work in [todo.md](todo.md) (see [todo.md](todo.md)).
9
+ M0 to M4 are built and v0.1.0 and v0.1.1 are published to PyPI. Next is **M5 · recursive harness improvement (`rsi`)**, then v0.2. Open work is in [todo.md](todo.md).
10
10
 
11
11
  ## Milestone graph
12
12
 
@@ -16,7 +16,10 @@ M0 Core engine
16
16
  ├─ M2 Interactive Claude Code ─┐ (M2 and M3 are independent: parallelizable)
17
17
  └─ M3 Parallel items & DAG ─┤
18
18
  └─ M4 GitHub, human gates, review
19
- └─ v0.1 release gate
19
+ └─ v0.1 release gate (shipped)
20
+ └─ M5 Recursive harness improvement (rsi)
21
+ └─ v0.2 release
22
+ └─ M6 Gemini CLI backend
20
23
  ```
21
24
 
22
25
  | Milestone | Scope | Exit criterion |
@@ -27,6 +30,9 @@ M0 Core engine
27
30
  | M3 · Parallel items & DAG | Item graph, parallel `map`, git worktrees, resource locks, side-effect journal, crash recovery | 4 JSON tasks run in parallel |
28
31
  | M4 · GitHub, human gates, review | `github_issues` source, PR/review/merge modules, park/approve/reject, comment replies, opencode runner, control panel | One issue goes open → merged |
29
32
  | v0.1 release | Reference pipeline merges a real milestone, 4 items in parallel | Release gate (see below) |
33
+ | M5 · Recursive harness improvement | Optional `rsi` setting (off by default): Propose, Probe, Compose over the agent harness, per-domain experience library, blind selection, human-approved adoption, built on ported Harness² code (Apache-2.0) | A 6-item backlog improves its harness item by item; `rsi: false` is unchanged |
34
+ | v0.2 release | `rsi` documented, evaluated and released | See M5 exit |
35
+ | M6 · Gemini CLI backend | `runner: gemini` (headless stream-json), tests, docs, plus a Gemini surface for RSI | Gemini runs a pipeline step; v0.3 |
30
36
 
31
37
  ## Cross-cutting rules (apply in every milestone)
32
38
 
@@ -87,6 +93,20 @@ M0 Core engine
87
93
  - `whiletrue.opencode` runner; tmux control panel; `logs`, `cost`.
88
94
  - `issue-loop` recipe.
89
95
 
96
+ ### M5 · Recursive harness improvement (RSI)
97
+
98
+ Goal: an optional `rsi: true | false` setting (default `false`) that lets whiletrue improve the harness around its agents as items flow through a pipeline. The method is Harness² (Xu et al., Google Research, 2026, [arXiv:2610.14224](https://arxiv.org/abs/2610.14224)); we port and refactor its method code into this repo as `whiletrue.rsi.harness2` (Apache-2.0 headers kept, provenance recorded, no extra dependency for users), so other RSI methods can later sit beside it as `whiletrue.rsi.<method>`. Design: [architecture.md](architecture.md#recursive-harness-improvement-rsi).
99
+
100
+ - **Provenance first:** third-party notices, license copy, pinned commit, citation, a provenance check in CI. No benchmark runners or datasets are ported.
101
+ - **Setting:** `rsi` at the top level and per agent, `--rsi/--no-rsi` on `run`; `validate` requires a budget, limits and an adoption policy; `plan` prints the stages and the worst-case cost multiplier (R = 4k rollouts, P = 3k improvement stages).
102
+ - **Task-level recursion:** reference rollouts of the base harness, general (INV) and domain (DOM) proposals, probes in per-candidate git worktrees, `k` compositions, blind answer-free selection, in parallel and sequential modes.
103
+ - **Harnessing-level recursion:** a per-domain experience library (adopted harness plus evidence-supported lessons), read before each item and appended after, connected to `history` and `learnings`.
104
+ - **Human accountable:** an adopted harness is a diff shown at a human gate before it enters the repo; hooks and scripts always need approval.
105
+ - **Surfaces:** Claude Code (new), opencode and Codex (ported from Harness²).
106
+ Step-by-step execution plan, with stages, dependencies, tests and decisions for you: [rsi-plan.md](rsi-plan.md).
107
+
108
+ **Exit:** with `rsi: true`, a 6-item backlog improves its agent harness item by item and a person reviews every adopted change; with `rsi: false`, behavior is unchanged (regression-tested). An evaluation against the `history.distill` baseline is published with honest numbers.
109
+
90
110
  ## v0.1 release gate
91
111
 
92
112
  - Reference pipeline merges a real milestone, 4 items parallel, with at least one `rejected` → fix route and one crash/resume exercised.
@@ -102,3 +122,7 @@ M0 Core engine
102
122
  | Crash recovery of tmux panes (re-attach vs. `--resume`) | Decide via experiment; make policy configurable | M3 |
103
123
  | `session: item` resume with changed cwd | Test explicitly; pin worktree per item | M3 |
104
124
  | Expression language scope creep | Pick small sandboxed lib early; no Python eval | M1 |
125
+ | RSI costs about 7x an agent run per item at k=1 | Required `rsi.budget_usd`, `when:` guard, worst-case estimate in `plan` | M5 |
126
+ | Self-edited hooks and scripts are a code-execution surface | Allow-list; always human-approved; never auto-adopted | M5 |
127
+ | Ported code loses its attribution or license | Pinned commit, header and provenance check in CI, notices, no benchmark code | M5 |
128
+ | RSI may not help where a gate already exists | Opt-in; evaluate against `history.distill` before recommending | M5 |
@@ -168,6 +168,17 @@ Built-in recipes use `uses: "recipe:<name>"`:
168
168
  - **`on_idle: watch`** keeps the run alive and polls; **`exit`** (default) ends the run `parked` (exit code 2) for `resume`.
169
169
  - **Resume** replays every recorded step except those that parked (`needs_human`), runs the rest for real, and keeps the same lineage. Gates, loops and expressions re-run against the recorded results.
170
170
 
171
+ ## Recursive self-improvement
172
+
173
+ Optional, off by default. The top-level `rsi:` key (`true`, `false` or settings) wraps the steps around the first agent in the `rsi.harness2` strategy and adds `rsi.review`, `rsi.adopt` and `rsi.discard`. Full guide: [rsi.md](rsi.md).
174
+
175
+ | Module | Kind | What it does |
176
+ | --- | --- | --- |
177
+ | `rsi.harness2` | strategy | Runs its children in isolated workspace copies, improves the harness, selects blind, applies the chosen rollout's file changes |
178
+ | `rsi.review` | strategy | Asks a person (`human.approve`) when the proposed harness changed |
179
+ | `rsi.adopt` | deterministic | Writes the chosen harness into the workspace and stores the lesson |
180
+ | `rsi.discard` | deterministic | Keeps the current harness |
181
+
171
182
  ## Reproducibility
172
183
 
173
184
  - **`whiletrue lock`** writes `whiletrue.lock`, pinning the version of each plugin in use. Once it exists, `validate`/`plan`/`run` fail if the plugins drift; run `whiletrue lock` again to accept.
@@ -0,0 +1,121 @@
1
+ # Execution plan: Harness² recursive self-improvement (M5)
2
+
3
+ How we build [M5](plan.md#m5--recursive-harness-improvement-rsi), in order, with what to write, how to prove each step, and where a person decides. Item numbers refer to [todo.md](todo.md). Gemini CLI support is deliberately later (M6, items 98 to 102). Design: [architecture.md](architecture.md#recursive-harness-improvement-rsi). Open questions: OQ-11 to OQ-17 in [open-questions.md](open-questions.md).
4
+
5
+ Source: Harness² ([arXiv:2610.14224](https://arxiv.org/abs/2610.14224), [code](https://github.com/google-research/harness2), Apache-2.0, pinned `1cfe254`).
6
+
7
+ ## Approach
8
+
9
+ 1. **Walking skeleton first.** Get the whole Propose, Probe, Compose loop running end to end with a deterministic fake improver and fake executor before any real model is involved. Then swap in real agents one at a time.
10
+ 2. **Port and refactor, inside this repo.** The method code becomes `whiletrue.rsi.harness2` (typed to pyright strict, our error and logging conventions, no global state, our test layout), so users install nothing extra and other methods can sit beside it as `whiletrue.rsi.<method>`. Only the method is ported; the orchestration is rebuilt on whiletrue's runtime (items are tasks, pipeline scopes are rollouts, improver sessions are agent steps). Every ported file keeps its Apache header, gains a modification notice and is listed in `third_party/harness2/PROVENANCE.md`.
11
+ 3. **Off by default, provably.** A regression test runs existing pipelines with and without the `rsi` key present and requires identical runs.
12
+ 4. **Small commits.** One todo item or a tight group per commit, tests and docs in the same change, `poe check` green, and your explicit approval before each commit and push (and before any tag).
13
+ 5. **Spend carefully.** Live tests are opt-in (`WHILETRUE_LIVE=1`), use the smallest items, and print their cost. No full runs without a budget you set.
14
+
15
+ ## Dependency graph
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ S0[Stage 0 · Provenance, spike, port<br/>items 77-80] --> S2[Stage 2 · Config and validation<br/>item 81]
20
+ S0 --> S3[Stage 3 · Surfaces and rollouts<br/>items 82-83]
21
+ S2 --> S3
22
+ S3 --> S4[Stage 4 · Task-level recursion<br/>items 84-87]
23
+ S4 --> S5[Stage 5 · Library and reflection<br/>items 88-89]
24
+ S4 --> S6[Stage 6 · Adoption by a human<br/>item 90]
25
+ S5 --> S7[Stage 7 · CLI and panel<br/>item 91]
26
+ S6 --> S7
27
+ S7 --> S8[Stage 8 · Hardening and live tests<br/>items 92-93]
28
+ S8 --> S9[Stage 9 · Evaluation, docs, release<br/>items 94-97]
29
+ S9 --> M6[M6 · Gemini CLI backend<br/>items 98-102]
30
+ ```
31
+
32
+ Stage 2 (config) and the surface half of Stage 3 only need Stage 0, so they can overlap. The rollout adapter reads the `rsi` config.
33
+
34
+ ## Stage 0 · Provenance and spike (items 77 to 80)
35
+
36
+ **Goal:** know exactly what we take and prove we can run it.
37
+
38
+ - **77 (done):** `THIRD_PARTY_NOTICES.md`, `third_party/harness2/{LICENSE,PROVENANCE.md}`, README citation and the license sentence.
39
+ - **78 provenance check:** `scripts/check_provenance.py`. `PROVENANCE.md` maps each ported file to its upstream path. The script fails when a file under `whiletrue/rsi/harness2/` lacks the upstream Apache header or a modification notice, or is not listed. It runs inside `poe docs-check` and CI.
40
+ - **79 spike (`docs/spike-rsi.md`):** clone the pinned commit into a scratch directory, run `harness2-demo --k 2` (no credentials) and trace one task: reference rollouts, INV and DOM proposals, probes, compositions, selection, reflection. Fill the mapping table (task, domain, harness, rollout, executor, improver) and the Claude Code surface and unsafe list (OQ-16).
41
+ - **80 port (`whiletrue/rsi/harness2/`):** `tree.py` and `surfaces.py` (component tree, `SurfaceSpec`), `ledger.py`, `library.py`, `runmark.py`, `selection.py`, `context.py` (evidence tree and leak tripwires), `prompts.py`. Refactor to this repo: typed models, no module globals, our error types, small functions that pass the repo's lint rules, tests in `tests/unit/rsi/harness2/`. Not ported: benchmarks, judge, report, the sweep scheduler, CLI, install and the substrates (our runners replace them).
42
+
43
+ **Exit:** the ported modules pass their tests and reproduce the upstream budget identity, tree validation and selection behavior; the provenance check is in CI.
44
+
45
+ ## Stage 2 · Config and validation (item 81)
46
+
47
+ **Goal:** the `rsi` setting exists, validates, plans, and changes nothing when off.
48
+
49
+ - Pydantic models for `rsi: bool | {k, mode, domain, adopt, evidence, budget_usd, when}` at the top level and in agent headers; precedence agent over top level; `--rsi/--no-rsi` on `run`.
50
+ - `validate` rules: budget required, limits on improver and selector agents, `workspace: git-worktree`, an adoption policy.
51
+ - `plan`: prints the RSI stages and the worst-case multiplier (R = 4k rollouts, P = 3k improvement sessions) and the worst-case cost from the agents' limits.
52
+ - Tests: golden outputs for `validate` and `plan`, and the regression test that every existing example and recipe yields identical plans and runs with the key absent versus `rsi: false`.
53
+
54
+ **Exit:** `whiletrue plan` shows an RSI-expanded pipeline for a sample config; nothing runs yet.
55
+
56
+ ## Stage 3 · Surfaces and rollouts (items 82 and 83)
57
+
58
+ **Goal:** read, edit and run a candidate harness in isolation.
59
+
60
+ - **82 surfaces (`whiletrue/rsi/surface_*.py`):** one `SurfaceSpec` each for Claude Code, opencode and Codex (reuse upstream's). Claude Code maps the eight components to files in the worktree: system prompt (agent file prompt), guardrails (permission settings), memory (`CLAUDE.md`), tool guidance (agent `tools:` and prompt section), subagents (`.claude/agents/`), skills (`.claude/skills/`), scripts, plugins (hooks, MCP). Read, validate, write and diff trees; flag hooks, scripts, permission rules and MCP as always-approve. Tests with golden trees.
61
+ - **83 rollout adapter (`rollout.py`):** run the pipeline's agent step under a candidate tree in its own worktree (`git worktree add` from the item's base), collect trajectory (run record events and transcript) and deliverable, and write the completion marker and harness fingerprint so a finished rollout is reused on resume. Tests with the fake executor: isolation (two candidates never share files), reuse on resume, crash mid-rollout.
62
+
63
+ **Exit:** with a fake executor, a candidate harness is applied, run and recorded in a worktree, then cleaned up.
64
+
65
+ ## Stage 4 · Task-level recursion (items 84 to 87)
66
+
67
+ **Goal:** Propose, Probe, Compose, select, with the budget identity enforced.
68
+
69
+ - **84 improver and evidence:** the improver, composer and selector are ordinary whiletrue agent steps (limits, any backend), prompts adapted from `prompts.py`. The evidence tree builder writes task, rollouts, deliverables, current harness and library as files, with the answer-free tripwires (no gate verdicts unless `evidence: gates`). Tests: a planted gate verdict in evidence is rejected.
70
+ - **85 `rsi` strategy:** k reference rollouts, k general and k domain proposals, probes, k compositions, final rollouts. Parallel mode uses the scheduler's semaphores and `max_agents`; sequential mode carries the harness and evidence forward. Every stage is journaled and resumable. Tests: golden stage order for both modes at k=1 and k=2, resume after a kill at each stage.
71
+ - **86 blind selection:** anonymized finals with a seeded shuffle, selector failure falls back to the base output, optional `selection: gate-first`.
72
+ - **87 budget ledger:** check R = 4k and P = 3k at run time, record spend per stage, enforce `rsi.budget_usd` (park the item with a reason), apply the `when:` guard. `cost` splits by stage. Tests: identity violations fail loudly; budget exhaustion parks, never overspends.
73
+
74
+ **Exit:** the fake-executor demo (ported from `harness2-demo`) runs both modes to a selected output, and the ledger balances.
75
+
76
+ ## Stage 5 · Library and reflection (items 88 and 89)
77
+
78
+ **Goal:** later items benefit from earlier ones.
79
+
80
+ - **88 library:** `.whiletrue/rsi/<domain>/` holds adopted harnesses and `EXPERIENCE.md`, read before each item and appended after. Ordered within a domain, concurrent across domains, scoped per run and mode. Domain comes from `rsi.domain`. Tests: ordering, isolation between domains, library read in the evidence tree.
81
+ - **89 reflector:** an agent step proposing evidence-supported lessons into `history` and `learnings`; nothing reaches an agent until you approve it (existing `learnings approve`).
82
+
83
+ ## Stage 6 · Adoption by a human (item 90)
84
+
85
+ **Goal:** you stay accountable for every line.
86
+
87
+ - `rsi.adopt: approve | auto | never`. On `approve`, the chosen harness diff is shown at a `human.approve` gate (`what: harness`), committed on approval and discarded on `rejected`; your rejection note feeds the next reflection. Hooks, scripts, permission rules and MCP edits never use `auto`.
88
+ - Tests: approve commits exactly the diff shown; reject leaves the repo untouched; `auto` refuses unsafe paths.
89
+
90
+ ## Stage 7 · CLI and panel (item 91)
91
+
92
+ `whiletrue rsi status | diff | library | adopt | reset`; the control panel shows the RSI stage per item; `logs` and `cost` split by stage. Tests via the CLI harness; docs in `cli.md`.
93
+
94
+ ## Stage 8 · Hardening and live tests (items 92 and 93)
95
+
96
+ - **92:** the fake-executor demo as an integration test; kill and resume at every stage; the `rsi: false` regression suite; coverage floor held or raised.
97
+ - **93 (opt-in, spends tokens):** real Claude Code, `k=1`, one tiny item, under a small `budget_usd`. Record cost and wall time in the docs.
98
+
99
+ ## Stage 9 · Evaluation, docs, release (items 94 to 97)
100
+
101
+ - **94 evaluation:** a small coding backlog (about 6 items, like the tutorial's), run three ways (base, `history.distill` baseline, `rsi`), measuring gate pass rate, retries and cost. Publish the numbers honestly, including a negative result (OQ-17).
102
+ - **95 docs:** `docs/rsi.md`, a tutorial section, reference and architecture updates, README feature text (replacing "Roadmap"), CHANGELOG, citation kept in place.
103
+ - **96 exit check** and **97 release `v0.2.0`:** version bump, tag, PyPI trusted publishing, as for 0.1.1.
104
+
105
+ ## Decisions to make with you
106
+
107
+ | # | Decision | When | Default if you say nothing |
108
+ |---|---|---|---|
109
+ | D1 | Package layout for later RSI methods (OQ-11, decided) | Done | `whiletrue.rsi.<method>`, starting with `whiletrue.rsi.harness2` |
110
+ | D2 | Live-test budget (dollars) for Stages 8 and 9 | Stage 8 | $5 total |
111
+ | D3 | Whether `evidence: gates` ships in v0.2 (OQ-12) | Stage 4 | Ships as opt-in, off by default |
112
+ | D4 | `adopt` default (OQ-14) | Stage 6 | `approve` |
113
+ | D5 | A throwaway repo for the real-GitHub run (todo 71) and for the RSI evaluation | Stage 9 | Local `origin` and file-backed GitHub |
114
+
115
+ ## Definition of done for M5
116
+
117
+ - Every todo item 77 to 96 is ticked with its tests and docs in the same commit.
118
+ - `rsi: false` leaves all existing behavior and tests unchanged.
119
+ - `poe check` is green with the coverage floor held; the provenance check is in CI.
120
+ - The evaluation is published; the README claims only what it shows.
121
+ - Notices and the paper citation are in place, no upstream benchmark code or data is copied, and you have reviewed every adopted-harness path and the ported file list.