avalon-ai 0.1.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 (424) hide show
  1. avalon_ai-0.1.1/LICENSE +21 -0
  2. avalon_ai-0.1.1/PKG-INFO +302 -0
  3. avalon_ai-0.1.1/README.md +283 -0
  4. avalon_ai-0.1.1/avalon/__init__.py +133 -0
  5. avalon_ai-0.1.1/avalon/__main__.py +7 -0
  6. avalon_ai-0.1.1/avalon/act/__init__.py +31 -0
  7. avalon_ai-0.1.1/avalon/act/authority.py +218 -0
  8. avalon_ai-0.1.1/avalon/act/executor.py +157 -0
  9. avalon_ai-0.1.1/avalon/act/felt_test.py +146 -0
  10. avalon_ai-0.1.1/avalon/act/proposal.py +242 -0
  11. avalon_ai-0.1.1/avalon/act/witness.py +160 -0
  12. avalon_ai-0.1.1/avalon/answer_live.py +110 -0
  13. avalon_ai-0.1.1/avalon/anticipation.py +498 -0
  14. avalon_ai-0.1.1/avalon/bpc.py +939 -0
  15. avalon_ai-0.1.1/avalon/brain/__init__.py +28 -0
  16. avalon_ai-0.1.1/avalon/brain/contract.py +158 -0
  17. avalon_ai-0.1.1/avalon/brain/search.py +261 -0
  18. avalon_ai-0.1.1/avalon/brain/solve.py +430 -0
  19. avalon_ai-0.1.1/avalon/brain/worlds.py +179 -0
  20. avalon_ai-0.1.1/avalon/buffer.py +591 -0
  21. avalon_ai-0.1.1/avalon/cartridges.py +635 -0
  22. avalon_ai-0.1.1/avalon/cascade.py +1055 -0
  23. avalon_ai-0.1.1/avalon/changes.py +873 -0
  24. avalon_ai-0.1.1/avalon/circadian.py +522 -0
  25. avalon_ai-0.1.1/avalon/cli.py +2597 -0
  26. avalon_ai-0.1.1/avalon/config.py +543 -0
  27. avalon_ai-0.1.1/avalon/consolidate.py +2135 -0
  28. avalon_ai-0.1.1/avalon/constraints.py +1257 -0
  29. avalon_ai-0.1.1/avalon/consult.py +112 -0
  30. avalon_ai-0.1.1/avalon/continual/__init__.py +1 -0
  31. avalon_ai-0.1.1/avalon/continual/bench.py +550 -0
  32. avalon_ai-0.1.1/avalon/continual/consolidate_gate.py +407 -0
  33. avalon_ai-0.1.1/avalon/continual/provrouter.py +454 -0
  34. avalon_ai-0.1.1/avalon/continual/replaybank.py +181 -0
  35. avalon_ai-0.1.1/avalon/continual/report.py +206 -0
  36. avalon_ai-0.1.1/avalon/continual/signatures.py +135 -0
  37. avalon_ai-0.1.1/avalon/continual/tasks.py +475 -0
  38. avalon_ai-0.1.1/avalon/cortex.py +927 -0
  39. avalon_ai-0.1.1/avalon/coverage.py +552 -0
  40. avalon_ai-0.1.1/avalon/data/anchors.jsonl +40 -0
  41. avalon_ai-0.1.1/avalon/data/gate_probes.jsonl +12 -0
  42. avalon_ai-0.1.1/avalon/deeptime.py +390 -0
  43. avalon_ai-0.1.1/avalon/demo/__init__.py +9 -0
  44. avalon_ai-0.1.1/avalon/demo/fabrication_duel.py +802 -0
  45. avalon_ai-0.1.1/avalon/demo/proof_page.py +798 -0
  46. avalon_ai-0.1.1/avalon/demo/test_fabrication_duel.py +352 -0
  47. avalon_ai-0.1.1/avalon/demo/test_proof_page.py +263 -0
  48. avalon_ai-0.1.1/avalon/dreaming.py +749 -0
  49. avalon_ai-0.1.1/avalon/experiments/__init__.py +0 -0
  50. avalon_ai-0.1.1/avalon/experiments/genfence/__init__.py +0 -0
  51. avalon_ai-0.1.1/avalon/experiments/genfence/grader.py +241 -0
  52. avalon_ai-0.1.1/avalon/experiments/genfence/ingest_real.py +246 -0
  53. avalon_ai-0.1.1/avalon/experiments/genfence/owned_model.py +183 -0
  54. avalon_ai-0.1.1/avalon/experiments/genfence/questions.py +190 -0
  55. avalon_ai-0.1.1/avalon/experiments/genfence/run_genfence.py +596 -0
  56. avalon_ai-0.1.1/avalon/extract.py +728 -0
  57. avalon_ai-0.1.1/avalon/factscan.py +843 -0
  58. avalon_ai-0.1.1/avalon/feeds/__init__.py +41 -0
  59. avalon_ai-0.1.1/avalon/feeds/corroborate.py +230 -0
  60. avalon_ai-0.1.1/avalon/feeds/etld.py +150 -0
  61. avalon_ai-0.1.1/avalon/feeds/example_synthetic.py +134 -0
  62. avalon_ai-0.1.1/avalon/feeds/notes_files.py +130 -0
  63. avalon_ai-0.1.1/avalon/feeds/public_rss.py +434 -0
  64. avalon_ai-0.1.1/avalon/feeds/witness.py +568 -0
  65. avalon_ai-0.1.1/avalon/felt_time.py +340 -0
  66. avalon_ai-0.1.1/avalon/flywheel.py +725 -0
  67. avalon_ai-0.1.1/avalon/gate.py +847 -0
  68. avalon_ai-0.1.1/avalon/goal_custody.py +583 -0
  69. avalon_ai-0.1.1/avalon/heartbeat.py +354 -0
  70. avalon_ai-0.1.1/avalon/ingest.py +218 -0
  71. avalon_ai-0.1.1/avalon/latency.py +123 -0
  72. avalon_ai-0.1.1/avalon/ledger.py +642 -0
  73. avalon_ai-0.1.1/avalon/localserver.py +399 -0
  74. avalon_ai-0.1.1/avalon/malleability.py +232 -0
  75. avalon_ai-0.1.1/avalon/masking.py +787 -0
  76. avalon_ai-0.1.1/avalon/metabolism.py +383 -0
  77. avalon_ai-0.1.1/avalon/middlememory.py +1120 -0
  78. avalon_ai-0.1.1/avalon/model.py +623 -0
  79. avalon_ai-0.1.1/avalon/mount.py +1003 -0
  80. avalon_ai-0.1.1/avalon/mouth/__init__.py +59 -0
  81. avalon_ai-0.1.1/avalon/mouth/claims.py +324 -0
  82. avalon_ai-0.1.1/avalon/mouth/factgate.py +527 -0
  83. avalon_ai-0.1.1/avalon/mouth/translate.py +1108 -0
  84. avalon_ai-0.1.1/avalon/mouth/utterance.py +357 -0
  85. avalon_ai-0.1.1/avalon/nested_clocks.py +673 -0
  86. avalon_ai-0.1.1/avalon/nightindex.py +747 -0
  87. avalon_ai-0.1.1/avalon/organism/clocks/ck_baselines.py +56 -0
  88. avalon_ai-0.1.1/avalon/organism/clocks/ck_engine.py +433 -0
  89. avalon_ai-0.1.1/avalon/organism/clocks/ck_meters.py +454 -0
  90. avalon_ai-0.1.1/avalon/organism/clocks/ck_segment.py +315 -0
  91. avalon_ai-0.1.1/avalon/organism/clocks/ck_warp.py +208 -0
  92. avalon_ai-0.1.1/avalon/organism/clocks/ck_world.py +614 -0
  93. avalon_ai-0.1.1/avalon/organism/clocks/run_clocks.py +189 -0
  94. avalon_ai-0.1.1/avalon/organism/clocks/tests/conftest.py +56 -0
  95. avalon_ai-0.1.1/avalon/organism/clocks/tests/test_ck_segment.py +172 -0
  96. avalon_ai-0.1.1/avalon/organism/clocks/tests/test_ck_warp.py +76 -0
  97. avalon_ai-0.1.1/avalon/organism/clocks/tests/test_clocks_noshadow.py +70 -0
  98. avalon_ai-0.1.1/avalon/organism/constraint/ct_baselines.py +163 -0
  99. avalon_ai-0.1.1/avalon/organism/constraint/ct_meters.py +255 -0
  100. avalon_ai-0.1.1/avalon/organism/constraint/ct_rule.py +314 -0
  101. avalon_ai-0.1.1/avalon/organism/constraint/ct_world.py +176 -0
  102. avalon_ai-0.1.1/avalon/organism/constraint/run_constraint.py +213 -0
  103. avalon_ai-0.1.1/avalon/organism/constraint/tests/conftest.py +28 -0
  104. avalon_ai-0.1.1/avalon/organism/constraint/tests/test_constraint.py +230 -0
  105. avalon_ai-0.1.1/avalon/organism/constraint/tests/test_constraint_noshadow.py +69 -0
  106. avalon_ai-0.1.1/avalon/organism/deeptime/dt_baselines.py +118 -0
  107. avalon_ai-0.1.1/avalon/organism/deeptime/dt_churn.py +182 -0
  108. avalon_ai-0.1.1/avalon/organism/deeptime/dt_consolidate.py +293 -0
  109. avalon_ai-0.1.1/avalon/organism/deeptime/dt_lifelong.py +178 -0
  110. avalon_ai-0.1.1/avalon/organism/deeptime/dt_meters.py +388 -0
  111. avalon_ai-0.1.1/avalon/organism/deeptime/dt_nested_clocks.py +419 -0
  112. avalon_ai-0.1.1/avalon/organism/deeptime/dt_nested_clocks_falsifier.py +105 -0
  113. avalon_ai-0.1.1/avalon/organism/deeptime/dt_nested_clocks_reallife.py +560 -0
  114. avalon_ai-0.1.1/avalon/organism/deeptime/dt_organism.py +184 -0
  115. avalon_ai-0.1.1/avalon/organism/deeptime/dt_stream.py +399 -0
  116. avalon_ai-0.1.1/avalon/organism/deeptime/run_consolidation.py +348 -0
  117. avalon_ai-0.1.1/avalon/organism/deeptime/run_deeptime.py +308 -0
  118. avalon_ai-0.1.1/avalon/organism/deeptime/tests/conftest.py +40 -0
  119. avalon_ai-0.1.1/avalon/organism/deeptime/tests/test_deeptime_stability.py +203 -0
  120. avalon_ai-0.1.1/avalon/organism/deeptime/tests/test_dt_consolidation.py +138 -0
  121. avalon_ai-0.1.1/avalon/organism/deeptime/tests/test_dt_meters.py +228 -0
  122. avalon_ai-0.1.1/avalon/organism/fusion/fu_organism.py +967 -0
  123. avalon_ai-0.1.1/avalon/organism/fusion/fu_run.py +588 -0
  124. avalon_ai-0.1.1/avalon/organism/fusion/fu_witness.py +546 -0
  125. avalon_ai-0.1.1/avalon/organism/fusion/fu_world.py +201 -0
  126. avalon_ai-0.1.1/avalon/organism/fusion/tests/conftest.py +29 -0
  127. avalon_ai-0.1.1/avalon/organism/fusion/tests/test_fusion_noshadow.py +69 -0
  128. avalon_ai-0.1.1/avalon/organism/fusion/tests/test_fusion_one_day.py +100 -0
  129. avalon_ai-0.1.1/avalon/organism/lifesurprise/ls_baselines.py +123 -0
  130. avalon_ai-0.1.1/avalon/organism/lifesurprise/ls_meters.py +645 -0
  131. avalon_ai-0.1.1/avalon/organism/lifesurprise/ls_predicate.py +337 -0
  132. avalon_ai-0.1.1/avalon/organism/lifesurprise/ls_signal.py +652 -0
  133. avalon_ai-0.1.1/avalon/organism/lifesurprise/ls_world.py +394 -0
  134. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/live_feed.py +435 -0
  135. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/ls_realfeed.py +123 -0
  136. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/real_stream.py +282 -0
  137. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/run_live_feed.py +91 -0
  138. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/run_real_shadow.py +268 -0
  139. avalon_ai-0.1.1/avalon/organism/lifesurprise/realfeed/tests/test_lifesurprise_real.py +95 -0
  140. avalon_ai-0.1.1/avalon/organism/lifesurprise/run_lifesurprise.py +175 -0
  141. avalon_ai-0.1.1/avalon/organism/lifesurprise/tests/conftest.py +39 -0
  142. avalon_ai-0.1.1/avalon/organism/lifesurprise/tests/test_lifesurprise.py +303 -0
  143. avalon_ai-0.1.1/avalon/organism/lifesurprise/tests/test_lifesurprise_noshadow.py +68 -0
  144. avalon_ai-0.1.1/avalon/organism/loop/lp_baselines.py +121 -0
  145. avalon_ai-0.1.1/avalon/organism/loop/lp_loop.py +351 -0
  146. avalon_ai-0.1.1/avalon/organism/loop/lp_meters.py +350 -0
  147. avalon_ai-0.1.1/avalon/organism/loop/lp_mount.py +267 -0
  148. avalon_ai-0.1.1/avalon/organism/loop/lp_stream.py +347 -0
  149. avalon_ai-0.1.1/avalon/organism/loop/run_loop.py +323 -0
  150. avalon_ai-0.1.1/avalon/organism/loop/tests/conftest.py +29 -0
  151. avalon_ai-0.1.1/avalon/organism/loop/tests/test_loop_mounts_lifesurprise.py +71 -0
  152. avalon_ai-0.1.1/avalon/organism/loop/tests/test_loop_noshadow.py +69 -0
  153. avalon_ai-0.1.1/avalon/organism/loop/tests/test_loop_organism.py +164 -0
  154. avalon_ai-0.1.1/avalon/organism/mind/mi_domain.py +142 -0
  155. avalon_ai-0.1.1/avalon/organism/mind/mi_floor.py +331 -0
  156. avalon_ai-0.1.1/avalon/organism/mind/mi_memory.py +403 -0
  157. avalon_ai-0.1.1/avalon/organism/mind/mi_organism.py +237 -0
  158. avalon_ai-0.1.1/avalon/organism/mind/mi_run.py +546 -0
  159. avalon_ai-0.1.1/avalon/organism/mind/mi_seam.py +125 -0
  160. avalon_ai-0.1.1/avalon/organism/mind/mi_wager.py +469 -0
  161. avalon_ai-0.1.1/avalon/organism/mind/mi_world.py +141 -0
  162. avalon_ai-0.1.1/avalon/organism/mind/tests/conftest.py +29 -0
  163. avalon_ai-0.1.1/avalon/organism/mind/tests/test_mind_coverage_floor.py +167 -0
  164. avalon_ai-0.1.1/avalon/organism/mind/tests/test_mind_noshadow.py +69 -0
  165. avalon_ai-0.1.1/avalon/organism/mind/tests/test_mind_read_seam.py +79 -0
  166. avalon_ai-0.1.1/avalon/organism/mind/tests/test_mind_wager_flip.py +111 -0
  167. avalon_ai-0.1.1/avalon/organism/mind/tests/test_wager_steers.py +92 -0
  168. avalon_ai-0.1.1/avalon/organism/mind/ws_reliable.py +152 -0
  169. avalon_ai-0.1.1/avalon/organism/mind/ws_run.py +316 -0
  170. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_avalon.py +138 -0
  171. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_common.py +181 -0
  172. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_cron.py +116 -0
  173. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_cron_deadline.py +124 -0
  174. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_letta.py +157 -0
  175. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_llm.py +367 -0
  176. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_mem0.py +439 -0
  177. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_run.py +178 -0
  178. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_score.py +161 -0
  179. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/kt_transcript.py +119 -0
  180. avalon_ai-0.1.1/avalon/organism/reasoner/killtest/results/rescore.py +39 -0
  181. avalon_ai-0.1.1/avalon/organism/reasoner/results/edge-2026-09-03/tsize.py +25 -0
  182. avalon_ai-0.1.1/avalon/organism/reasoner/rs_edge.py +788 -0
  183. avalon_ai-0.1.1/avalon/organism/reasoner/rs_fair_monolith.py +82 -0
  184. avalon_ai-0.1.1/avalon/organism/reasoner/rs_monolith.py +118 -0
  185. avalon_ai-0.1.1/avalon/organism/reasoner/rs_organism.py +222 -0
  186. avalon_ai-0.1.1/avalon/organism/reasoner/rs_probes.py +359 -0
  187. avalon_ai-0.1.1/avalon/organism/reasoner/rs_run.py +754 -0
  188. avalon_ai-0.1.1/avalon/organism/reasoner/rs_slot.py +538 -0
  189. avalon_ai-0.1.1/avalon/organism/reasoner/rs_transcript.py +270 -0
  190. avalon_ai-0.1.1/avalon/organism/reasoner/tests/conftest.py +29 -0
  191. avalon_ai-0.1.1/avalon/organism/reasoner/tests/test_reasoner_edge.py +148 -0
  192. avalon_ai-0.1.1/avalon/organism/reasoner/tests/test_reasoner_noshadow.py +69 -0
  193. avalon_ai-0.1.1/avalon/organism/reasoner/tests/test_reasoner_swap.py +130 -0
  194. avalon_ai-0.1.1/avalon/organism/retraction/real_embedder_falsifier.py +130 -0
  195. avalon_ai-0.1.1/avalon/organism/retraction/rt_baselines.py +128 -0
  196. avalon_ai-0.1.1/avalon/organism/retraction/rt_geometry_falsifier.py +166 -0
  197. avalon_ai-0.1.1/avalon/organism/retraction/rt_meters.py +186 -0
  198. avalon_ai-0.1.1/avalon/organism/retraction/rt_retract.py +154 -0
  199. avalon_ai-0.1.1/avalon/organism/retraction/rt_world.py +268 -0
  200. avalon_ai-0.1.1/avalon/organism/retraction/run_retraction.py +303 -0
  201. avalon_ai-0.1.1/avalon/organism/retraction/tests/conftest.py +28 -0
  202. avalon_ai-0.1.1/avalon/organism/retraction/tests/test_retraction.py +253 -0
  203. avalon_ai-0.1.1/avalon/organism/retraction/tests/test_retraction_noshadow.py +69 -0
  204. avalon_ai-0.1.1/avalon/organism/river/run_river.py +257 -0
  205. avalon_ai-0.1.1/avalon/organism/river/rv_baselines.py +80 -0
  206. avalon_ai-0.1.1/avalon/organism/river/rv_gru.py +438 -0
  207. avalon_ai-0.1.1/avalon/organism/river/rv_guard.py +317 -0
  208. avalon_ai-0.1.1/avalon/organism/river/rv_meters.py +375 -0
  209. avalon_ai-0.1.1/avalon/organism/river/rv_stream.py +164 -0
  210. avalon_ai-0.1.1/avalon/organism/river/rv_text.py +113 -0
  211. avalon_ai-0.1.1/avalon/organism/river/tests/conftest.py +40 -0
  212. avalon_ai-0.1.1/avalon/organism/river/tests/test_river_noshadow.py +67 -0
  213. avalon_ai-0.1.1/avalon/organism/river/tests/test_rv_gru.py +122 -0
  214. avalon_ai-0.1.1/avalon/organism/river/tests/test_rv_guard.py +96 -0
  215. avalon_ai-0.1.1/avalon/organism/sleep/run_sleep.py +211 -0
  216. avalon_ai-0.1.1/avalon/organism/sleep/sl_baselines.py +47 -0
  217. avalon_ai-0.1.1/avalon/organism/sleep/sl_memory.py +208 -0
  218. avalon_ai-0.1.1/avalon/organism/sleep/sl_meters.py +172 -0
  219. avalon_ai-0.1.1/avalon/organism/sleep/sl_night.py +404 -0
  220. avalon_ai-0.1.1/avalon/organism/sleep/sl_stream.py +286 -0
  221. avalon_ai-0.1.1/avalon/organism/sleep/tests/conftest.py +38 -0
  222. avalon_ai-0.1.1/avalon/organism/sleep/tests/test_sl_memory.py +53 -0
  223. avalon_ai-0.1.1/avalon/organism/sleep/tests/test_sl_night.py +138 -0
  224. avalon_ai-0.1.1/avalon/organism/sleep/tests/test_sleep_noshadow.py +69 -0
  225. avalon_ai-0.1.1/avalon/organism/wager/run_wager.py +165 -0
  226. avalon_ai-0.1.1/avalon/organism/wager/tests/conftest.py +41 -0
  227. avalon_ai-0.1.1/avalon/organism/wager/tests/test_wager_noshadow.py +70 -0
  228. avalon_ai-0.1.1/avalon/organism/wager/tests/test_wg_book.py +337 -0
  229. avalon_ai-0.1.1/avalon/organism/wager/tests/test_wg_drive.py +117 -0
  230. avalon_ai-0.1.1/avalon/organism/wager/wg_book.py +319 -0
  231. avalon_ai-0.1.1/avalon/organism/wager/wg_drive.py +246 -0
  232. avalon_ai-0.1.1/avalon/organism/wager/wg_meters.py +473 -0
  233. avalon_ai-0.1.1/avalon/organism/wager/wg_predicate.py +353 -0
  234. avalon_ai-0.1.1/avalon/organism/wager/wg_predictors.py +400 -0
  235. avalon_ai-0.1.1/avalon/organism/wager/wg_scoring.py +197 -0
  236. avalon_ai-0.1.1/avalon/organism/wager/wg_world.py +226 -0
  237. avalon_ai-0.1.1/avalon/organism/worldmodel/fetch_real.py +100 -0
  238. avalon_ai-0.1.1/avalon/organism/worldmodel/loop.py +324 -0
  239. avalon_ai-0.1.1/avalon/organism/worldmodel/run_real.py +362 -0
  240. avalon_ai-0.1.1/avalon/organism/worldmodel/test_loop.py +382 -0
  241. avalon_ai-0.1.1/avalon/organism/worldmodel/test_metrics.py +72 -0
  242. avalon_ai-0.1.1/avalon/organism.py +1489 -0
  243. avalon_ai-0.1.1/avalon/organism_skills/__init__.py +18 -0
  244. avalon_ai-0.1.1/avalon/organism_skills/acquire.py +414 -0
  245. avalon_ai-0.1.1/avalon/organism_skills/consolidate_night.py +351 -0
  246. avalon_ai-0.1.1/avalon/organism_skills/contract.py +44 -0
  247. avalon_ai-0.1.1/avalon/organism_skills/run_acquisition.py +383 -0
  248. avalon_ai-0.1.1/avalon/organism_skills/stream.py +154 -0
  249. avalon_ai-0.1.1/avalon/perception.py +867 -0
  250. avalon_ai-0.1.1/avalon/physio.py +525 -0
  251. avalon_ai-0.1.1/avalon/pilot.py +423 -0
  252. avalon_ai-0.1.1/avalon/predict.py +963 -0
  253. avalon_ai-0.1.1/avalon/predictive_surprise.py +251 -0
  254. avalon_ai-0.1.1/avalon/registry.py +549 -0
  255. avalon_ai-0.1.1/avalon/resident.py +214 -0
  256. avalon_ai-0.1.1/avalon/retraction.py +938 -0
  257. avalon_ai-0.1.1/avalon/river.py +532 -0
  258. avalon_ai-0.1.1/avalon/shadow.py +693 -0
  259. avalon_ai-0.1.1/avalon/showcase.py +505 -0
  260. avalon_ai-0.1.1/avalon/skills.py +696 -0
  261. avalon_ai-0.1.1/avalon/soak/__init__.py +16 -0
  262. avalon_ai-0.1.1/avalon/soak/clock.py +80 -0
  263. avalon_ai-0.1.1/avalon/soak/generator.py +643 -0
  264. avalon_ai-0.1.1/avalon/soak/probes.py +328 -0
  265. avalon_ai-0.1.1/avalon/soak/report.py +312 -0
  266. avalon_ai-0.1.1/avalon/soak/runner.py +899 -0
  267. avalon_ai-0.1.1/avalon/stratify.py +730 -0
  268. avalon_ai-0.1.1/avalon/subjective_time.py +338 -0
  269. avalon_ai-0.1.1/avalon/swap_proof.py +778 -0
  270. avalon_ai-0.1.1/avalon/timeweight.py +506 -0
  271. avalon_ai-0.1.1/avalon/trust.py +173 -0
  272. avalon_ai-0.1.1/avalon/vetoes.py +650 -0
  273. avalon_ai-0.1.1/avalon/wagers.py +1551 -0
  274. avalon_ai-0.1.1/avalon/wallbreaker/__init__.py +16 -0
  275. avalon_ai-0.1.1/avalon/wallbreaker/bench.py +86 -0
  276. avalon_ai-0.1.1/avalon/wallbreaker/gate.py +392 -0
  277. avalon_ai-0.1.1/avalon/wallbreaker/probes.py +199 -0
  278. avalon_ai-0.1.1/avalon/wallbreaker/test_gate_logic.py +115 -0
  279. avalon_ai-0.1.1/avalon/witnesskeys.py +595 -0
  280. avalon_ai-0.1.1/avalon/witnessplane.py +498 -0
  281. avalon_ai-0.1.1/avalon/witnessrecall.py +421 -0
  282. avalon_ai-0.1.1/avalon/witnessscan.py +269 -0
  283. avalon_ai-0.1.1/avalon_ai.egg-info/PKG-INFO +302 -0
  284. avalon_ai-0.1.1/avalon_ai.egg-info/SOURCES.txt +422 -0
  285. avalon_ai-0.1.1/avalon_ai.egg-info/dependency_links.txt +1 -0
  286. avalon_ai-0.1.1/avalon_ai.egg-info/entry_points.txt +2 -0
  287. avalon_ai-0.1.1/avalon_ai.egg-info/requires.txt +10 -0
  288. avalon_ai-0.1.1/avalon_ai.egg-info/top_level.txt +1 -0
  289. avalon_ai-0.1.1/pyproject.toml +77 -0
  290. avalon_ai-0.1.1/setup.cfg +4 -0
  291. avalon_ai-0.1.1/tests/test_act_layer.py +128 -0
  292. avalon_ai-0.1.1/tests/test_act_self_surface.py +31 -0
  293. avalon_ai-0.1.1/tests/test_answer_live.py +176 -0
  294. avalon_ai-0.1.1/tests/test_anticipation.py +384 -0
  295. avalon_ai-0.1.1/tests/test_belt_custody.py +354 -0
  296. avalon_ai-0.1.1/tests/test_bpc.py +677 -0
  297. avalon_ai-0.1.1/tests/test_brain_contract.py +89 -0
  298. avalon_ai-0.1.1/tests/test_brain_search.py +298 -0
  299. avalon_ai-0.1.1/tests/test_brain_solve.py +192 -0
  300. avalon_ai-0.1.1/tests/test_brain_worlds.py +47 -0
  301. avalon_ai-0.1.1/tests/test_buffer.py +192 -0
  302. avalon_ai-0.1.1/tests/test_cartridge_content_guard.py +281 -0
  303. avalon_ai-0.1.1/tests/test_cartridges.py +674 -0
  304. avalon_ai-0.1.1/tests/test_cascade.py +469 -0
  305. avalon_ai-0.1.1/tests/test_changes.py +649 -0
  306. avalon_ai-0.1.1/tests/test_circadian.py +357 -0
  307. avalon_ai-0.1.1/tests/test_cli.py +1479 -0
  308. avalon_ai-0.1.1/tests/test_consolidate.py +968 -0
  309. avalon_ai-0.1.1/tests/test_constraints.py +730 -0
  310. avalon_ai-0.1.1/tests/test_constraints_adversarial_wave2.py +252 -0
  311. avalon_ai-0.1.1/tests/test_consult.py +233 -0
  312. avalon_ai-0.1.1/tests/test_continual_bench.py +160 -0
  313. avalon_ai-0.1.1/tests/test_continual_collision_guard.py +288 -0
  314. avalon_ai-0.1.1/tests/test_continual_consolidate.py +309 -0
  315. avalon_ai-0.1.1/tests/test_continual_provrouter.py +251 -0
  316. avalon_ai-0.1.1/tests/test_continual_stress.py +394 -0
  317. avalon_ai-0.1.1/tests/test_cortex.py +395 -0
  318. avalon_ai-0.1.1/tests/test_coverage.py +339 -0
  319. avalon_ai-0.1.1/tests/test_custody_class_kill.py +443 -0
  320. avalon_ai-0.1.1/tests/test_deeptime.py +300 -0
  321. avalon_ai-0.1.1/tests/test_do_ceiling.py +287 -0
  322. avalon_ai-0.1.1/tests/test_dreaming.py +496 -0
  323. avalon_ai-0.1.1/tests/test_extract.py +430 -0
  324. avalon_ai-0.1.1/tests/test_extract_spans.py +568 -0
  325. avalon_ai-0.1.1/tests/test_factgate_answer_path.py +380 -0
  326. avalon_ai-0.1.1/tests/test_factscan.py +369 -0
  327. avalon_ai-0.1.1/tests/test_feeds_corroborate_bypass.py +149 -0
  328. avalon_ai-0.1.1/tests/test_feeds_corroborate_forgery_wave3.py +96 -0
  329. avalon_ai-0.1.1/tests/test_feeds_custody.py +562 -0
  330. avalon_ai-0.1.1/tests/test_feeds_example.py +135 -0
  331. avalon_ai-0.1.1/tests/test_feeds_forgery_v2_wave4.py +332 -0
  332. avalon_ai-0.1.1/tests/test_feeds_public.py +368 -0
  333. avalon_ai-0.1.1/tests/test_feeds_public_adversarial.py +57 -0
  334. avalon_ai-0.1.1/tests/test_feeds_quarantine.py +241 -0
  335. avalon_ai-0.1.1/tests/test_felt_time.py +276 -0
  336. avalon_ai-0.1.1/tests/test_flywheel.py +424 -0
  337. avalon_ai-0.1.1/tests/test_gap4_adversarial.py +226 -0
  338. avalon_ai-0.1.1/tests/test_gap4_wave3.py +87 -0
  339. avalon_ai-0.1.1/tests/test_gap4_wave4.py +171 -0
  340. avalon_ai-0.1.1/tests/test_gap4_wave4_tester.py +68 -0
  341. avalon_ai-0.1.1/tests/test_gate.py +781 -0
  342. avalon_ai-0.1.1/tests/test_gate_typed_scoring.py +203 -0
  343. avalon_ai-0.1.1/tests/test_grounding_e2e.py +565 -0
  344. avalon_ai-0.1.1/tests/test_heartbeat.py +130 -0
  345. avalon_ai-0.1.1/tests/test_ingest.py +194 -0
  346. avalon_ai-0.1.1/tests/test_integration_wave1.py +196 -0
  347. avalon_ai-0.1.1/tests/test_integration_wave2.py +186 -0
  348. avalon_ai-0.1.1/tests/test_integration_wave3.py +183 -0
  349. avalon_ai-0.1.1/tests/test_integration_wave4.py +544 -0
  350. avalon_ai-0.1.1/tests/test_integration_wave7.py +93 -0
  351. avalon_ai-0.1.1/tests/test_latency.py +112 -0
  352. avalon_ai-0.1.1/tests/test_launch_assets.py +41 -0
  353. avalon_ai-0.1.1/tests/test_ledger.py +356 -0
  354. avalon_ai-0.1.1/tests/test_live_timeout.py +865 -0
  355. avalon_ai-0.1.1/tests/test_malleability.py +131 -0
  356. avalon_ai-0.1.1/tests/test_masking.py +376 -0
  357. avalon_ai-0.1.1/tests/test_metabolism.py +241 -0
  358. avalon_ai-0.1.1/tests/test_middlememory.py +838 -0
  359. avalon_ai-0.1.1/tests/test_middlememory_abstain.py +70 -0
  360. avalon_ai-0.1.1/tests/test_middlememory_arm.py +343 -0
  361. avalon_ai-0.1.1/tests/test_middlememory_recall_wave6.py +368 -0
  362. avalon_ai-0.1.1/tests/test_middlememory_recall_wave9.py +326 -0
  363. avalon_ai-0.1.1/tests/test_middlememory_wfp_glue.py +152 -0
  364. avalon_ai-0.1.1/tests/test_mm_kernel_falsifier.py +189 -0
  365. avalon_ai-0.1.1/tests/test_model.py +254 -0
  366. avalon_ai-0.1.1/tests/test_mount_headtohead.py +419 -0
  367. avalon_ai-0.1.1/tests/test_mount_organism.py +54 -0
  368. avalon_ai-0.1.1/tests/test_mount_real.py +128 -0
  369. avalon_ai-0.1.1/tests/test_mount_think.py +185 -0
  370. avalon_ai-0.1.1/tests/test_mouth_claims.py +244 -0
  371. avalon_ai-0.1.1/tests/test_mouth_entailment_wave4.py +240 -0
  372. avalon_ai-0.1.1/tests/test_mouth_factgate.py +447 -0
  373. avalon_ai-0.1.1/tests/test_mouth_false_sum_wave9b.py +117 -0
  374. avalon_ai-0.1.1/tests/test_mouth_mount_drift_pin.py +145 -0
  375. avalon_ai-0.1.1/tests/test_mouth_real.py +535 -0
  376. avalon_ai-0.1.1/tests/test_mouth_result_trust_wave9.py +333 -0
  377. avalon_ai-0.1.1/tests/test_mouth_translate.py +235 -0
  378. avalon_ai-0.1.1/tests/test_mouth_unrepresentable.py +522 -0
  379. avalon_ai-0.1.1/tests/test_multinight.py +661 -0
  380. avalon_ai-0.1.1/tests/test_nested_clocks.py +290 -0
  381. avalon_ai-0.1.1/tests/test_night_crash_belt_wave9.py +296 -0
  382. avalon_ai-0.1.1/tests/test_night_promote.py +365 -0
  383. avalon_ai-0.1.1/tests/test_night_real.py +336 -0
  384. avalon_ai-0.1.1/tests/test_nightindex.py +441 -0
  385. avalon_ai-0.1.1/tests/test_organism.py +577 -0
  386. avalon_ai-0.1.1/tests/test_organism_skills_acquire.py +289 -0
  387. avalon_ai-0.1.1/tests/test_organism_skills_consolidate.py +320 -0
  388. avalon_ai-0.1.1/tests/test_perception.py +488 -0
  389. avalon_ai-0.1.1/tests/test_physio.py +463 -0
  390. avalon_ai-0.1.1/tests/test_pilot_run.py +474 -0
  391. avalon_ai-0.1.1/tests/test_predict.py +642 -0
  392. avalon_ai-0.1.1/tests/test_predictive_surprise.py +230 -0
  393. avalon_ai-0.1.1/tests/test_promote_cartridge_gap.py +134 -0
  394. avalon_ai-0.1.1/tests/test_reference_salience_scale.py +115 -0
  395. avalon_ai-0.1.1/tests/test_registry.py +380 -0
  396. avalon_ai-0.1.1/tests/test_resident_daemon_soak.py +156 -0
  397. avalon_ai-0.1.1/tests/test_resident_serving_loop.py +95 -0
  398. avalon_ai-0.1.1/tests/test_retraction.py +645 -0
  399. avalon_ai-0.1.1/tests/test_river.py +336 -0
  400. avalon_ai-0.1.1/tests/test_serve_survival.py +217 -0
  401. avalon_ai-0.1.1/tests/test_shadow.py +359 -0
  402. avalon_ai-0.1.1/tests/test_showcase.py +74 -0
  403. avalon_ai-0.1.1/tests/test_skills.py +353 -0
  404. avalon_ai-0.1.1/tests/test_soak_killchecks.py +86 -0
  405. avalon_ai-0.1.1/tests/test_soak_smoke.py +201 -0
  406. avalon_ai-0.1.1/tests/test_standing_walls.py +608 -0
  407. avalon_ai-0.1.1/tests/test_stratify.py +542 -0
  408. avalon_ai-0.1.1/tests/test_subjective_time.py +256 -0
  409. avalon_ai-0.1.1/tests/test_swap_proof.py +127 -0
  410. avalon_ai-0.1.1/tests/test_swap_real.py +77 -0
  411. avalon_ai-0.1.1/tests/test_timeweight.py +297 -0
  412. avalon_ai-0.1.1/tests/test_trust_sinks.py +229 -0
  413. avalon_ai-0.1.1/tests/test_two_night_simulation.py +139 -0
  414. avalon_ai-0.1.1/tests/test_vetoes.py +303 -0
  415. avalon_ai-0.1.1/tests/test_wager_predicates.py +359 -0
  416. avalon_ai-0.1.1/tests/test_wagers.py +460 -0
  417. avalon_ai-0.1.1/tests/test_wagers_model_judge.py +515 -0
  418. avalon_ai-0.1.1/tests/test_wave9_integrator_seams.py +194 -0
  419. avalon_ai-0.1.1/tests/test_wfp_arm_glue.py +278 -0
  420. avalon_ai-0.1.1/tests/test_witnesskeys.py +905 -0
  421. avalon_ai-0.1.1/tests/test_witnessplane.py +247 -0
  422. avalon_ai-0.1.1/tests/test_witnessplane_forgery.py +276 -0
  423. avalon_ai-0.1.1/tests/test_witnessrecall.py +413 -0
  424. avalon_ai-0.1.1/tests/test_witnessscan.py +280 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lunar Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,302 @@
1
+ Metadata-Version: 2.4
2
+ Name: avalon-ai
3
+ Version: 0.1.1
4
+ Summary: Avalon: an adaptive AI runtime — heartbeat, hot-swappable LoRA skills, nightly consolidation, and a fitness gate. v1 slice.
5
+ Author: Lunar Labs
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: httpx>=0.27
11
+ Requires-Dist: lunarlabs-core==0.1.0
12
+ Requires-Dist: z3-solver>=4.12
13
+ Requires-Dist: regex>=2024.5.10
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=8; extra == "dev"
16
+ Provides-Extra: mlx
17
+ Requires-Dist: mlx-lm>=0.26; extra == "mlx"
18
+ Dynamic: license-file
19
+
20
+ # Avalon
21
+
22
+ An adaptive AI runtime. MIT © Lunar Labs.
23
+
24
+ The LLM is a stateless function `f(context) -> token`. Avalon is the runtime
25
+ around it that persists, perceives continuously, holds state, learns while
26
+ running, and acts on a clock — the model is demoted to a frozen language
27
+ cortex; all learning lives in hot-swappable LoRA adapters gated by measured
28
+ fitness.
29
+
30
+ This is **v1**: the first slice of a much larger vision. Every module maps
31
+ to a constraint measured on real hardware (Mac Mini M4 / MacBook M1 Pro,
32
+ Qwen3-4B 4-bit, MLX, 2026-07). Where the research hit a wall, v1 ships an
33
+ honest interface instead of a fake.
34
+
35
+ ## Architecture
36
+
37
+ ```
38
+ external events (sensors, messages, tools)
39
+ │ land whether or not anyone is talking
40
+ ▼
41
+ ┌──────────────────────────────────────────────────────────┐
42
+ │ HEARTBEAT (intrinsic time) │
43
+ │ tick loop · nested clocks now/day/project/life │
44
+ │ ONE append-only event stream · atomic JSON state │
45
+ │ daemon mode: avalon serve · intake: avalon inject │
46
+ └──────────────────────────────────────────────────────────┘
47
+ │
48
+ ▼
49
+ ┌──────────────────────────────────────────────────────────┐
50
+ │ DEEP TIME (memory with half-lives) │
51
+ │ salience decays exponentially (36 h default) · surprise │
52
+ │ events RE-INK referenced memories · event stream -> │
53
+ │ episodes · learned circadian histogram (starts blank) │
54
+ └──────────────────────────────────────────────────────────┘
55
+ │
56
+ ▼
57
+ ┌──────────────────────────────────────────────────────────┐
58
+ │ EPISODIC BUFFER (provenance-typed, surprise-gated) │
59
+ │ observed │ inferred │ said-by-assistant │
60
+ │ ONLY observed is trainable — anti-fabrication defense │
61
+ └──────────────────────────────────────────────────────────┘
62
+ │ observed entries, retrieval-task Q→A
63
+ ▼ (NEVER transcripts)
64
+ ┌──────────────────────────────────────────────────────────┐
65
+ │ CONSOLIDATION (sleep) per night │
66
+ │ sufficiency gate → 2:1 mandatory rehearsal → collapse │
67
+ │ cap → training manifest → pluggable Trainer │
68
+ └──────────────────────────────────────────────────────────┘
69
+ │ candidate adapter (one file)
70
+ ▼
71
+ ┌──────────────────────────────────────────────────────────┐
72
+ │ FITNESS GATE (git for a mind) │
73
+ │ probe fixed held-out set ± adapter → DIFF = what it │
74
+ │ learned → regression check FIRST → promote | roll back │
75
+ └──────────────────────────────────────────────────────────┘
76
+ │ promoted
77
+ ▼
78
+ ┌──────────────────────────────────────────────────────────┐
79
+ │ ADAPTER REGISTRY (the registry IS the tool list) │
80
+ │ named callable skills · base-version pin · fitness score │
81
+ │ ONE live adapter · 2-3 hot pre-fetched · 5 ms swap │
82
+ └──────────────────────────────────────────────────────────┘
83
+ │ adapter_path per request
84
+ ▼
85
+ ┌──────────────────────────────────────────────────────────┐
86
+ │ FROZEN BASE (OpenAI-compatible server, mlx_lm style) │
87
+ │ never trains · auto-launched local mlx_lm server on a │
88
+ │ free port (pilot-run), or your own base_url │
89
+ └──────────────────────────────────────────────────────────┘
90
+ ```
91
+
92
+ ## Measured operating points
93
+
94
+ These are bench numbers, not defaults pulled from thin air. They live in
95
+ `avalon/config.py` with citations in comments.
96
+
97
+ | Constraint | Measured value | Where it's enforced |
98
+ |---|---|---|
99
+ | Consolidation point | **lr 5e-5, 48 iters** — 3/3 recall after full context wipe; 8 iters = degenerate loops | `config.py`, pinned in every manifest |
100
+ | Paraphrases per fact | **~10** (27 rows about one fact = mode collapse) | `consolidate.cap_rows_per_fact` |
101
+ | Rehearsal | **2:1 mandatory** — 0:1 → 0/3 prior facts survive; 2:1 → 3/3 | `consolidate.build_manifest` |
102
+ | Training shape | **Q→A retrieval task** — transcripts scored 0/3 on a perfect loss curve | `consolidate.pair_from_entry`, lunarlabs-core `TrainingPair` |
103
+ | Sufficiency | **skip empty days** — updates on signal, not schedule | `build_manifest` sufficiency gate |
104
+ | Live adapters | **ONE** — multi-adapter composition costs ~40% each | `registry.activate` |
105
+ | Adapter swap | **5 ms** attach; pre-fetch 2-3 hot | `registry` hot cache + swap latency |
106
+ | Adapter size | rank-16, 8 layers = 14.7 MB | `config.py` |
107
+ | Trainable memory | **observed only** — inferred / said-by-assistant never train | `buffer.trainable()` |
108
+ | Memory half-life | **36 h default** — salience = surprise × strength × 0.5^(age/half-life); re-inking resets the clock | `deeptime.effective_salience`, `buffer.reink` |
109
+ | Episodes | **30 min silence** closes an episode; consolidation reads episodes, not a flat day-file | `deeptime.segment_episodes` |
110
+ | Circadian | **learned histogram** — 24 hour buckets fed by ticks/events; uniform until lived | `heartbeat.hour_histogram`, `deeptime.expected_activity` |
111
+ | Promotion | **behavioral gate** — loss lies at 48 iters (fact blending looked perfect) | `gate.run_gate` |
112
+
113
+ ## Run the public proof
114
+
115
+ Requirements: an Apple-silicon Mac, Python 3.10 or newer, git on your path (for
116
+ a one-time dependency fetch; run `git --version` and install the Xcode command
117
+ line tools if macOS prompts you), about 4 GB of free disk space, and an internet
118
+ connection for the first run. The first run
119
+ downloads a roughly 2 GB model once. Later runs reuse it. Training time depends
120
+ on the Mac and may take a few minutes.
121
+
122
+ ```bash
123
+ pip install "avalon-ai[mlx]"
124
+ avalon demo
125
+ ```
126
+
127
+ The command runs two proofs with one local 4-bit model:
128
+
129
+ 1. It teaches five invented toy facts, starts fresh answering processes whose
130
+ prompts contain only the questions, and measures recall from the adapter.
131
+ 2. It gives the unguarded model a poisoned toy note, then asks Avalon's
132
+ witnessed-fact gate the same question. With no witnessed fact, the gate
133
+ answers `I do not know.` and the model is called zero times.
134
+
135
+ No API key is needed. No cloud model receives the prompts. The only network use
136
+ is the one-time public model download. Demo files stay in `.avalon/demo_run`.
137
+ Exit code `0` means all five trained questions survived the context wipe and
138
+ the poison gate refused with zero model calls. Exit code `1` means the proof or
139
+ runtime failed. Exit code `2` means the machine cannot run MLX.
140
+
141
+ If startup reports that MLX cannot use Metal, run the command from a normal
142
+ Terminal rather than a headless or virtualized session. If the model download
143
+ is interrupted, reconnect and rerun the command. The download resumes and is
144
+ reused.
145
+
146
+ The latest isolated-environment terminal capture is in
147
+ [`launch/clean-run-output.txt`](launch/clean-run-output.txt). It records 5/5
148
+ trained recall, 5/5 unseen-phrasing recall, and poison refusal with zero model
149
+ calls. Its header states the one untested first-run condition: the model was
150
+ already present in this Mac's shared Hugging Face cache.
151
+
152
+ ## Use it on your own facts
153
+
154
+ Turn your own structured config into witnessed facts, arm the gate, and ask:
155
+
156
+ ```bash
157
+ avalon ingest-facts ./chatterbox.json # dry-run first: shows every candidate, mints nothing
158
+ avalon ingest-facts --commit ./chatterbox.json
159
+ avalon facts-gate on
160
+ avalon answer "what port is chatterbox on" # -> 8100 (witnessed: chatterbox.json:12).
161
+ avalon answer "what is the door code" # -> refusal: I do not know. (model calls: 0)
162
+ ```
163
+
164
+ What the gate guarantees, stated plainly:
165
+
166
+ - It answers **only** from facts you minted, each carrying a verbatim source
167
+ line. The value it returns is the witnessed value — never a guess.
168
+ - On a fact-shaped question whose **key it cannot find among your witnessed
169
+ facts**, it refuses with `I do not know.` and **the model is never invoked**
170
+ (zero model calls — there is no channel for it to confabulate into). That is
171
+ the anti-fabrication guarantee, and it is the honest boundary of the claim:
172
+ the gate refuses on a *witnessed key it cannot find*, not on every possible
173
+ phrasing. A question it cannot key (e.g. `chatterbox port?`) is not a fact
174
+ query and falls through to the normal chain.
175
+ - A witnessed value still passes your send-time constraints (P09): a rule like
176
+ "never reveal the door code" blocks even a witnessed value.
177
+ - Non-fact questions go to the **normal draft + coverage chain**, which needs a
178
+ model backend — `--backend resident` reuses the demo's local model, or point
179
+ `base_url` at a server you run. A buyer with no model server still gets the
180
+ canned witnessed value on fact queries (the refusal and the canned value need
181
+ no model at all).
182
+
183
+ The gate defaults **off** — `avalon answer` behaves exactly as before until you
184
+ turn it on. `avalon facts-gate status` prints the resolved verdict (so a config
185
+ typo is visible) and how many facts you have minted (a flag with no facts still
186
+ falls through — flags are not reachability). `avalon facts-gate off` disarms it.
187
+
188
+ ## Daily use on your own data (real training)
189
+
190
+ One command a night, on your own notes, with **real** learning — no server to
191
+ set up, no mock, no silent hang. Apple silicon + the `mlx` extra:
192
+
193
+ ```bash
194
+ pip install "avalon-ai[mlx]"
195
+
196
+ # 1. drop tonight's facts in (a .txt / .md / .jsonl file, or inject one line)
197
+ avalon ingest notes ~/notes/today.md
198
+ avalon inject "the Northstar cache listens on port 49321"
199
+
200
+ # 2. run the night — this trains for real and proves it
201
+ avalon pilot-run --ask "What port is the Northstar cache on?"
202
+ ```
203
+
204
+ What `pilot-run` does, in order (each stage prints a wall-clock line):
205
+
206
+ 1. **Preflight** — Apple silicon, `mlx_lm` importable, Metal usable, ≥ 4 GB
207
+ free. It stops here (exit 2) *before any download* if the machine can't run.
208
+ 2. **Intake** — your notes become `OBSERVED` facts (re-running the same file is
209
+ a no-op; nothing is trained twice).
210
+ 3. **Extract** — turns notes into Q/A pairs through a model server it
211
+ **auto-launches** for you on a free port (first run downloads the model once,
212
+ ~2.5 GB), then shuts it down before training. `--no-extract` trains the notes
213
+ as-is with no server.
214
+ 4. **Sleep** — one real LoRA night (the shipped `MaskingMLXTrainer` + a resident
215
+ gate that actually attaches the candidate adapter).
216
+ 5. **Verify** — the adapter on disk must be a real (> 1 MB) LoRA, or you get
217
+ `TRAINING DID NOT PRODUCE A REAL ADAPTER` and exit 1. No stub ever counts.
218
+ 6. **Morning proof** — the base model's answer vs the live-adapter answer to
219
+ each `--ask`, printed verbatim, so you can *see* the weights changed.
220
+
221
+ `--nights N` loops it; a night with no new facts is a valid **skip** (exit 0) —
222
+ updates happen on signal, not on a schedule. Roughly 3–6 min per night on an
223
+ M-series Mac after the one-time download.
224
+
225
+ Exit codes: **0** promoted or validly skipped · **1** rolled back / stub
226
+ adapter · **2** this Mac can't run it · **3** the model server couldn't start ·
227
+ **130** Ctrl-C (the child server is killed).
228
+
229
+ **Privacy:** nothing leaves your Mac except the one-time public model download.
230
+ Your notes train into local weights and stay there.
231
+
232
+ **`pilot-run` never uses `MockTrainer`.** `config.trainer_backend` (the safe
233
+ default for every *other* command) is ignored here — this command always trains
234
+ for real, by construction.
235
+
236
+ Optional: `deploy/ai.lunarlabs.avalon.pilot.plist` runs `pilot-run` nightly at
237
+ 03:00 with logs under `<home>/logs/pilot.log`.
238
+
239
+ ## No-GPU smoke test (FAKES learning, CI only)
240
+
241
+ ```bash
242
+ python3 -m venv .venv
243
+ .venv/bin/pip install -e ".[dev,mlx]" # lunarlabs-core comes from git; mlx extra powers the live demo
244
+ .venv/bin/pytest # no GPU, no network
245
+ .venv/bin/avalon tick
246
+ .venv/bin/avalon serve --interval 60 # daemon mode; SIGTERM stops it cleanly
247
+ .venv/bin/avalon inject "the deploy moved to friday" # event -> buffer bridge
248
+ .venv/bin/avalon consolidate --dry-run
249
+ .venv/bin/avalon status
250
+ ```
251
+
252
+ State lives in `./.avalon` (override with `--home`). The default trainer hook
253
+ for `serve` / `consolidate` is **`MockTrainer`**, which writes a stub
254
+ `.safetensors` and **learns nothing** — it exists for CI and plumbing checks
255
+ only. **Never use it to evaluate Avalon; use `avalon pilot-run`, which always
256
+ trains for real.** On a GPU host, `consolidate --mlx` plugs in `LocalMLXTrainer`
257
+ (shells to `mlx_lm lora`). The default model backend is `FrozenBaseClient`;
258
+ tests use `MockModel` — no GPU in tests, ever.
259
+
260
+ ## The organs (P01–P22)
261
+
262
+ Every research proposal in the program now exists as a module: an interface
263
+ matching the measured constraint, a PROVISIONAL default where the real
264
+ signal isn't built yet, and the proposal's falsifier as runnable code whose
265
+ kill condition exits nonzero. The full map from inventory item to module,
266
+ status, and falsifier price is `docs/the-organism.md`.
267
+
268
+ `bpc` (P12, the north-star eval — first real run: `docs/p12-first-run.md`),
269
+ `wagers` (P06), `coverage` (P05, gate 3), `nightindex` (P03), `vetoes`
270
+ (P02), `constraints` (P09), `retraction` (P10), `changes` (P18),
271
+ `timeweight` (P15), `flywheel` (P01+P04), `ledger` (P07), `masking` (P08),
272
+ `dreaming` (P11), `skills` (P13), `physio` (P14), `perception` (P16),
273
+ `stratify` (P17), `river` (P19), `cortex` (P21), `middlememory` (P22),
274
+ plus `tools/do-ceiling/` (P20, gate 2 kit).
275
+
276
+ ## What is still a wall
277
+
278
+ Stated plainly — the organs build interfaces around these, not over them:
279
+
280
+ - **The real surprise signal** — the MECHANISM now ships in Avalon:
281
+ `predictive_surprise.PredictiveSurpriseScorer` scores surprise as the live
282
+ adapter's measured BPC prediction error on incoming observed text (DEFAULT
283
+ OFF until `avalon predict-latency` prices the per-event forward pass). What
284
+ stays JARVIS-side is the owner corpus, the owner model, and the felt-present
285
+ tuning — not the organ. The other token-overlap heuristics (wager resolver,
286
+ ledger matcher, change join) remain PROVISIONAL behind their Protocols.
287
+ - **Implicit adapter routing** — untested; `NoRouter` abstains, embedding
288
+ similarity is the named candidate.
289
+ - **P12 first run (2026-08-04)** — all three adapters LOSE to the frozen
290
+ base on future-Carter BPC: a uniform style-drift tax (~+0.23) and zero
291
+ future-specific gain. The adaptive thesis is unproven where it counts;
292
+ the instrument to fix that now exists with baselines.
293
+ - **Constraint application in weights** — recites 3/3, applies 2/3; the
294
+ runtime verifier tier (`constraints.py`) is the live answer.
295
+ - **Surgical forgetting** — 3 methods failed; the organ is replay-with-
296
+ exclusion + periodic rebase (`retraction.py`), not subtraction.
297
+ - **Subjective time / anticipation gradients** — still research; deep time
298
+ remains half-lives + episodes + circadian histogram.
299
+ - **Base-upgrade retraining bill** — pins enforced; `cortex.SwapBill`
300
+ prices it, the number is still an estimate.
301
+ - **Real training in CI** — `LocalMLXTrainer` and `MLXScorer` need a GPU
302
+ host; the suite exercises contracts via mocks only.
@@ -0,0 +1,283 @@
1
+ # Avalon
2
+
3
+ An adaptive AI runtime. MIT © Lunar Labs.
4
+
5
+ The LLM is a stateless function `f(context) -> token`. Avalon is the runtime
6
+ around it that persists, perceives continuously, holds state, learns while
7
+ running, and acts on a clock — the model is demoted to a frozen language
8
+ cortex; all learning lives in hot-swappable LoRA adapters gated by measured
9
+ fitness.
10
+
11
+ This is **v1**: the first slice of a much larger vision. Every module maps
12
+ to a constraint measured on real hardware (Mac Mini M4 / MacBook M1 Pro,
13
+ Qwen3-4B 4-bit, MLX, 2026-07). Where the research hit a wall, v1 ships an
14
+ honest interface instead of a fake.
15
+
16
+ ## Architecture
17
+
18
+ ```
19
+ external events (sensors, messages, tools)
20
+ │ land whether or not anyone is talking
21
+ ▼
22
+ ┌──────────────────────────────────────────────────────────┐
23
+ │ HEARTBEAT (intrinsic time) │
24
+ │ tick loop · nested clocks now/day/project/life │
25
+ │ ONE append-only event stream · atomic JSON state │
26
+ │ daemon mode: avalon serve · intake: avalon inject │
27
+ └──────────────────────────────────────────────────────────┘
28
+ │
29
+ ▼
30
+ ┌──────────────────────────────────────────────────────────┐
31
+ │ DEEP TIME (memory with half-lives) │
32
+ │ salience decays exponentially (36 h default) · surprise │
33
+ │ events RE-INK referenced memories · event stream -> │
34
+ │ episodes · learned circadian histogram (starts blank) │
35
+ └──────────────────────────────────────────────────────────┘
36
+ │
37
+ ▼
38
+ ┌──────────────────────────────────────────────────────────┐
39
+ │ EPISODIC BUFFER (provenance-typed, surprise-gated) │
40
+ │ observed │ inferred │ said-by-assistant │
41
+ │ ONLY observed is trainable — anti-fabrication defense │
42
+ └──────────────────────────────────────────────────────────┘
43
+ │ observed entries, retrieval-task Q→A
44
+ ▼ (NEVER transcripts)
45
+ ┌──────────────────────────────────────────────────────────┐
46
+ │ CONSOLIDATION (sleep) per night │
47
+ │ sufficiency gate → 2:1 mandatory rehearsal → collapse │
48
+ │ cap → training manifest → pluggable Trainer │
49
+ └──────────────────────────────────────────────────────────┘
50
+ │ candidate adapter (one file)
51
+ ▼
52
+ ┌──────────────────────────────────────────────────────────┐
53
+ │ FITNESS GATE (git for a mind) │
54
+ │ probe fixed held-out set ± adapter → DIFF = what it │
55
+ │ learned → regression check FIRST → promote | roll back │
56
+ └──────────────────────────────────────────────────────────┘
57
+ │ promoted
58
+ ▼
59
+ ┌──────────────────────────────────────────────────────────┐
60
+ │ ADAPTER REGISTRY (the registry IS the tool list) │
61
+ │ named callable skills · base-version pin · fitness score │
62
+ │ ONE live adapter · 2-3 hot pre-fetched · 5 ms swap │
63
+ └──────────────────────────────────────────────────────────┘
64
+ │ adapter_path per request
65
+ ▼
66
+ ┌──────────────────────────────────────────────────────────┐
67
+ │ FROZEN BASE (OpenAI-compatible server, mlx_lm style) │
68
+ │ never trains · auto-launched local mlx_lm server on a │
69
+ │ free port (pilot-run), or your own base_url │
70
+ └──────────────────────────────────────────────────────────┘
71
+ ```
72
+
73
+ ## Measured operating points
74
+
75
+ These are bench numbers, not defaults pulled from thin air. They live in
76
+ `avalon/config.py` with citations in comments.
77
+
78
+ | Constraint | Measured value | Where it's enforced |
79
+ |---|---|---|
80
+ | Consolidation point | **lr 5e-5, 48 iters** — 3/3 recall after full context wipe; 8 iters = degenerate loops | `config.py`, pinned in every manifest |
81
+ | Paraphrases per fact | **~10** (27 rows about one fact = mode collapse) | `consolidate.cap_rows_per_fact` |
82
+ | Rehearsal | **2:1 mandatory** — 0:1 → 0/3 prior facts survive; 2:1 → 3/3 | `consolidate.build_manifest` |
83
+ | Training shape | **Q→A retrieval task** — transcripts scored 0/3 on a perfect loss curve | `consolidate.pair_from_entry`, lunarlabs-core `TrainingPair` |
84
+ | Sufficiency | **skip empty days** — updates on signal, not schedule | `build_manifest` sufficiency gate |
85
+ | Live adapters | **ONE** — multi-adapter composition costs ~40% each | `registry.activate` |
86
+ | Adapter swap | **5 ms** attach; pre-fetch 2-3 hot | `registry` hot cache + swap latency |
87
+ | Adapter size | rank-16, 8 layers = 14.7 MB | `config.py` |
88
+ | Trainable memory | **observed only** — inferred / said-by-assistant never train | `buffer.trainable()` |
89
+ | Memory half-life | **36 h default** — salience = surprise × strength × 0.5^(age/half-life); re-inking resets the clock | `deeptime.effective_salience`, `buffer.reink` |
90
+ | Episodes | **30 min silence** closes an episode; consolidation reads episodes, not a flat day-file | `deeptime.segment_episodes` |
91
+ | Circadian | **learned histogram** — 24 hour buckets fed by ticks/events; uniform until lived | `heartbeat.hour_histogram`, `deeptime.expected_activity` |
92
+ | Promotion | **behavioral gate** — loss lies at 48 iters (fact blending looked perfect) | `gate.run_gate` |
93
+
94
+ ## Run the public proof
95
+
96
+ Requirements: an Apple-silicon Mac, Python 3.10 or newer, git on your path (for
97
+ a one-time dependency fetch; run `git --version` and install the Xcode command
98
+ line tools if macOS prompts you), about 4 GB of free disk space, and an internet
99
+ connection for the first run. The first run
100
+ downloads a roughly 2 GB model once. Later runs reuse it. Training time depends
101
+ on the Mac and may take a few minutes.
102
+
103
+ ```bash
104
+ pip install "avalon-ai[mlx]"
105
+ avalon demo
106
+ ```
107
+
108
+ The command runs two proofs with one local 4-bit model:
109
+
110
+ 1. It teaches five invented toy facts, starts fresh answering processes whose
111
+ prompts contain only the questions, and measures recall from the adapter.
112
+ 2. It gives the unguarded model a poisoned toy note, then asks Avalon's
113
+ witnessed-fact gate the same question. With no witnessed fact, the gate
114
+ answers `I do not know.` and the model is called zero times.
115
+
116
+ No API key is needed. No cloud model receives the prompts. The only network use
117
+ is the one-time public model download. Demo files stay in `.avalon/demo_run`.
118
+ Exit code `0` means all five trained questions survived the context wipe and
119
+ the poison gate refused with zero model calls. Exit code `1` means the proof or
120
+ runtime failed. Exit code `2` means the machine cannot run MLX.
121
+
122
+ If startup reports that MLX cannot use Metal, run the command from a normal
123
+ Terminal rather than a headless or virtualized session. If the model download
124
+ is interrupted, reconnect and rerun the command. The download resumes and is
125
+ reused.
126
+
127
+ The latest isolated-environment terminal capture is in
128
+ [`launch/clean-run-output.txt`](launch/clean-run-output.txt). It records 5/5
129
+ trained recall, 5/5 unseen-phrasing recall, and poison refusal with zero model
130
+ calls. Its header states the one untested first-run condition: the model was
131
+ already present in this Mac's shared Hugging Face cache.
132
+
133
+ ## Use it on your own facts
134
+
135
+ Turn your own structured config into witnessed facts, arm the gate, and ask:
136
+
137
+ ```bash
138
+ avalon ingest-facts ./chatterbox.json # dry-run first: shows every candidate, mints nothing
139
+ avalon ingest-facts --commit ./chatterbox.json
140
+ avalon facts-gate on
141
+ avalon answer "what port is chatterbox on" # -> 8100 (witnessed: chatterbox.json:12).
142
+ avalon answer "what is the door code" # -> refusal: I do not know. (model calls: 0)
143
+ ```
144
+
145
+ What the gate guarantees, stated plainly:
146
+
147
+ - It answers **only** from facts you minted, each carrying a verbatim source
148
+ line. The value it returns is the witnessed value — never a guess.
149
+ - On a fact-shaped question whose **key it cannot find among your witnessed
150
+ facts**, it refuses with `I do not know.` and **the model is never invoked**
151
+ (zero model calls — there is no channel for it to confabulate into). That is
152
+ the anti-fabrication guarantee, and it is the honest boundary of the claim:
153
+ the gate refuses on a *witnessed key it cannot find*, not on every possible
154
+ phrasing. A question it cannot key (e.g. `chatterbox port?`) is not a fact
155
+ query and falls through to the normal chain.
156
+ - A witnessed value still passes your send-time constraints (P09): a rule like
157
+ "never reveal the door code" blocks even a witnessed value.
158
+ - Non-fact questions go to the **normal draft + coverage chain**, which needs a
159
+ model backend — `--backend resident` reuses the demo's local model, or point
160
+ `base_url` at a server you run. A buyer with no model server still gets the
161
+ canned witnessed value on fact queries (the refusal and the canned value need
162
+ no model at all).
163
+
164
+ The gate defaults **off** — `avalon answer` behaves exactly as before until you
165
+ turn it on. `avalon facts-gate status` prints the resolved verdict (so a config
166
+ typo is visible) and how many facts you have minted (a flag with no facts still
167
+ falls through — flags are not reachability). `avalon facts-gate off` disarms it.
168
+
169
+ ## Daily use on your own data (real training)
170
+
171
+ One command a night, on your own notes, with **real** learning — no server to
172
+ set up, no mock, no silent hang. Apple silicon + the `mlx` extra:
173
+
174
+ ```bash
175
+ pip install "avalon-ai[mlx]"
176
+
177
+ # 1. drop tonight's facts in (a .txt / .md / .jsonl file, or inject one line)
178
+ avalon ingest notes ~/notes/today.md
179
+ avalon inject "the Northstar cache listens on port 49321"
180
+
181
+ # 2. run the night — this trains for real and proves it
182
+ avalon pilot-run --ask "What port is the Northstar cache on?"
183
+ ```
184
+
185
+ What `pilot-run` does, in order (each stage prints a wall-clock line):
186
+
187
+ 1. **Preflight** — Apple silicon, `mlx_lm` importable, Metal usable, ≥ 4 GB
188
+ free. It stops here (exit 2) *before any download* if the machine can't run.
189
+ 2. **Intake** — your notes become `OBSERVED` facts (re-running the same file is
190
+ a no-op; nothing is trained twice).
191
+ 3. **Extract** — turns notes into Q/A pairs through a model server it
192
+ **auto-launches** for you on a free port (first run downloads the model once,
193
+ ~2.5 GB), then shuts it down before training. `--no-extract` trains the notes
194
+ as-is with no server.
195
+ 4. **Sleep** — one real LoRA night (the shipped `MaskingMLXTrainer` + a resident
196
+ gate that actually attaches the candidate adapter).
197
+ 5. **Verify** — the adapter on disk must be a real (> 1 MB) LoRA, or you get
198
+ `TRAINING DID NOT PRODUCE A REAL ADAPTER` and exit 1. No stub ever counts.
199
+ 6. **Morning proof** — the base model's answer vs the live-adapter answer to
200
+ each `--ask`, printed verbatim, so you can *see* the weights changed.
201
+
202
+ `--nights N` loops it; a night with no new facts is a valid **skip** (exit 0) —
203
+ updates happen on signal, not on a schedule. Roughly 3–6 min per night on an
204
+ M-series Mac after the one-time download.
205
+
206
+ Exit codes: **0** promoted or validly skipped · **1** rolled back / stub
207
+ adapter · **2** this Mac can't run it · **3** the model server couldn't start ·
208
+ **130** Ctrl-C (the child server is killed).
209
+
210
+ **Privacy:** nothing leaves your Mac except the one-time public model download.
211
+ Your notes train into local weights and stay there.
212
+
213
+ **`pilot-run` never uses `MockTrainer`.** `config.trainer_backend` (the safe
214
+ default for every *other* command) is ignored here — this command always trains
215
+ for real, by construction.
216
+
217
+ Optional: `deploy/ai.lunarlabs.avalon.pilot.plist` runs `pilot-run` nightly at
218
+ 03:00 with logs under `<home>/logs/pilot.log`.
219
+
220
+ ## No-GPU smoke test (FAKES learning, CI only)
221
+
222
+ ```bash
223
+ python3 -m venv .venv
224
+ .venv/bin/pip install -e ".[dev,mlx]" # lunarlabs-core comes from git; mlx extra powers the live demo
225
+ .venv/bin/pytest # no GPU, no network
226
+ .venv/bin/avalon tick
227
+ .venv/bin/avalon serve --interval 60 # daemon mode; SIGTERM stops it cleanly
228
+ .venv/bin/avalon inject "the deploy moved to friday" # event -> buffer bridge
229
+ .venv/bin/avalon consolidate --dry-run
230
+ .venv/bin/avalon status
231
+ ```
232
+
233
+ State lives in `./.avalon` (override with `--home`). The default trainer hook
234
+ for `serve` / `consolidate` is **`MockTrainer`**, which writes a stub
235
+ `.safetensors` and **learns nothing** — it exists for CI and plumbing checks
236
+ only. **Never use it to evaluate Avalon; use `avalon pilot-run`, which always
237
+ trains for real.** On a GPU host, `consolidate --mlx` plugs in `LocalMLXTrainer`
238
+ (shells to `mlx_lm lora`). The default model backend is `FrozenBaseClient`;
239
+ tests use `MockModel` — no GPU in tests, ever.
240
+
241
+ ## The organs (P01–P22)
242
+
243
+ Every research proposal in the program now exists as a module: an interface
244
+ matching the measured constraint, a PROVISIONAL default where the real
245
+ signal isn't built yet, and the proposal's falsifier as runnable code whose
246
+ kill condition exits nonzero. The full map from inventory item to module,
247
+ status, and falsifier price is `docs/the-organism.md`.
248
+
249
+ `bpc` (P12, the north-star eval — first real run: `docs/p12-first-run.md`),
250
+ `wagers` (P06), `coverage` (P05, gate 3), `nightindex` (P03), `vetoes`
251
+ (P02), `constraints` (P09), `retraction` (P10), `changes` (P18),
252
+ `timeweight` (P15), `flywheel` (P01+P04), `ledger` (P07), `masking` (P08),
253
+ `dreaming` (P11), `skills` (P13), `physio` (P14), `perception` (P16),
254
+ `stratify` (P17), `river` (P19), `cortex` (P21), `middlememory` (P22),
255
+ plus `tools/do-ceiling/` (P20, gate 2 kit).
256
+
257
+ ## What is still a wall
258
+
259
+ Stated plainly — the organs build interfaces around these, not over them:
260
+
261
+ - **The real surprise signal** — the MECHANISM now ships in Avalon:
262
+ `predictive_surprise.PredictiveSurpriseScorer` scores surprise as the live
263
+ adapter's measured BPC prediction error on incoming observed text (DEFAULT
264
+ OFF until `avalon predict-latency` prices the per-event forward pass). What
265
+ stays JARVIS-side is the owner corpus, the owner model, and the felt-present
266
+ tuning — not the organ. The other token-overlap heuristics (wager resolver,
267
+ ledger matcher, change join) remain PROVISIONAL behind their Protocols.
268
+ - **Implicit adapter routing** — untested; `NoRouter` abstains, embedding
269
+ similarity is the named candidate.
270
+ - **P12 first run (2026-08-04)** — all three adapters LOSE to the frozen
271
+ base on future-Carter BPC: a uniform style-drift tax (~+0.23) and zero
272
+ future-specific gain. The adaptive thesis is unproven where it counts;
273
+ the instrument to fix that now exists with baselines.
274
+ - **Constraint application in weights** — recites 3/3, applies 2/3; the
275
+ runtime verifier tier (`constraints.py`) is the live answer.
276
+ - **Surgical forgetting** — 3 methods failed; the organ is replay-with-
277
+ exclusion + periodic rebase (`retraction.py`), not subtraction.
278
+ - **Subjective time / anticipation gradients** — still research; deep time
279
+ remains half-lives + episodes + circadian histogram.
280
+ - **Base-upgrade retraining bill** — pins enforced; `cortex.SwapBill`
281
+ prices it, the number is still an estimate.
282
+ - **Real training in CI** — `LocalMLXTrainer` and `MLXScorer` need a GPU
283
+ host; the suite exercises contracts via mocks only.