tenish-cabal 0.5.2__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 (313) hide show
  1. tenish_cabal-0.5.2/LICENSE +21 -0
  2. tenish_cabal-0.5.2/NOTICE +5 -0
  3. tenish_cabal-0.5.2/PKG-INFO +631 -0
  4. tenish_cabal-0.5.2/README.md +584 -0
  5. tenish_cabal-0.5.2/pyproject.toml +157 -0
  6. tenish_cabal-0.5.2/setup.cfg +4 -0
  7. tenish_cabal-0.5.2/src/cabal/__init__.py +10 -0
  8. tenish_cabal-0.5.2/src/cabal/__main__.py +11 -0
  9. tenish_cabal-0.5.2/src/cabal/agents/__init__.py +0 -0
  10. tenish_cabal-0.5.2/src/cabal/agents/base.py +24 -0
  11. tenish_cabal-0.5.2/src/cabal/agents/echo.py +27 -0
  12. tenish_cabal-0.5.2/src/cabal/agents/llm_persona.py +924 -0
  13. tenish_cabal-0.5.2/src/cabal/agents/personas/__init__.py +37 -0
  14. tenish_cabal-0.5.2/src/cabal/agents/personas/architect.py +61 -0
  15. tenish_cabal-0.5.2/src/cabal/agents/personas/archivist.py +88 -0
  16. tenish_cabal-0.5.2/src/cabal/agents/personas/librarian.py +53 -0
  17. tenish_cabal-0.5.2/src/cabal/agents/personas/mason.py +119 -0
  18. tenish_cabal-0.5.2/src/cabal/agents/personas/wright.py +121 -0
  19. tenish_cabal-0.5.2/src/cabal/agents/primus.py +925 -0
  20. tenish_cabal-0.5.2/src/cabal/agents/subordinate.py +81 -0
  21. tenish_cabal-0.5.2/src/cabal/agents/tck.py +97 -0
  22. tenish_cabal-0.5.2/src/cabal/archivist/__init__.py +60 -0
  23. tenish_cabal-0.5.2/src/cabal/archivist/backfill.py +104 -0
  24. tenish_cabal-0.5.2/src/cabal/archivist/dedup.py +143 -0
  25. tenish_cabal-0.5.2/src/cabal/archivist/erase.py +213 -0
  26. tenish_cabal-0.5.2/src/cabal/archivist/gitmemory.py +124 -0
  27. tenish_cabal-0.5.2/src/cabal/archivist/gitsync.py +312 -0
  28. tenish_cabal-0.5.2/src/cabal/archivist/models.py +203 -0
  29. tenish_cabal-0.5.2/src/cabal/archivist/promote.py +203 -0
  30. tenish_cabal-0.5.2/src/cabal/archivist/purge.py +157 -0
  31. tenish_cabal-0.5.2/src/cabal/archivist/schema.py +138 -0
  32. tenish_cabal-0.5.2/src/cabal/archivist/store.py +533 -0
  33. tenish_cabal-0.5.2/src/cabal/cli/__init__.py +0 -0
  34. tenish_cabal-0.5.2/src/cabal/cli/client.py +675 -0
  35. tenish_cabal-0.5.2/src/cabal/cli/edit_format.py +195 -0
  36. tenish_cabal-0.5.2/src/cabal/cli/main.py +1712 -0
  37. tenish_cabal-0.5.2/src/cabal/codex/__init__.py +29 -0
  38. tenish_cabal-0.5.2/src/cabal/codex/blame.py +185 -0
  39. tenish_cabal-0.5.2/src/cabal/codex/repos.py +153 -0
  40. tenish_cabal-0.5.2/src/cabal/config/__init__.py +0 -0
  41. tenish_cabal-0.5.2/src/cabal/config/home.py +121 -0
  42. tenish_cabal-0.5.2/src/cabal/config/identity.py +851 -0
  43. tenish_cabal-0.5.2/src/cabal/core/__init__.py +0 -0
  44. tenish_cabal-0.5.2/src/cabal/core/a2a/__init__.py +0 -0
  45. tenish_cabal-0.5.2/src/cabal/core/a2a/card.py +114 -0
  46. tenish_cabal-0.5.2/src/cabal/core/a2a/codes.py +87 -0
  47. tenish_cabal-0.5.2/src/cabal/core/a2a/inbound.py +42 -0
  48. tenish_cabal-0.5.2/src/cabal/core/a2a/jsonrpc.py +114 -0
  49. tenish_cabal-0.5.2/src/cabal/core/a2a/types.py +113 -0
  50. tenish_cabal-0.5.2/src/cabal/core/a2a/v1.py +479 -0
  51. tenish_cabal-0.5.2/src/cabal/core/a2a/v1_card.py +455 -0
  52. tenish_cabal-0.5.2/src/cabal/core/a2a/v1_errors.py +158 -0
  53. tenish_cabal-0.5.2/src/cabal/core/a2a/version.py +46 -0
  54. tenish_cabal-0.5.2/src/cabal/core/abort.py +277 -0
  55. tenish_cabal-0.5.2/src/cabal/core/app.py +936 -0
  56. tenish_cabal-0.5.2/src/cabal/core/auth/__init__.py +0 -0
  57. tenish_cabal-0.5.2/src/cabal/core/auth/bootstrap.py +30 -0
  58. tenish_cabal-0.5.2/src/cabal/core/auth/bootstrap_codes.py +89 -0
  59. tenish_cabal-0.5.2/src/cabal/core/auth/jwks_provider.py +45 -0
  60. tenish_cabal-0.5.2/src/cabal/core/auth/jwt.py +174 -0
  61. tenish_cabal-0.5.2/src/cabal/core/auth/keys.py +156 -0
  62. tenish_cabal-0.5.2/src/cabal/core/auth/master_key.py +182 -0
  63. tenish_cabal-0.5.2/src/cabal/core/auth/reset.py +214 -0
  64. tenish_cabal-0.5.2/src/cabal/core/auth/revocations.py +150 -0
  65. tenish_cabal-0.5.2/src/cabal/core/broker/__init__.py +0 -0
  66. tenish_cabal-0.5.2/src/cabal/core/broker/bookkeeping.py +280 -0
  67. tenish_cabal-0.5.2/src/cabal/core/broker/heartbeat.py +90 -0
  68. tenish_cabal-0.5.2/src/cabal/core/broker/router.py +954 -0
  69. tenish_cabal-0.5.2/src/cabal/core/broker/waiting.py +142 -0
  70. tenish_cabal-0.5.2/src/cabal/core/budget_store.py +238 -0
  71. tenish_cabal-0.5.2/src/cabal/core/bulletin/__init__.py +0 -0
  72. tenish_cabal-0.5.2/src/cabal/core/bulletin/store.py +324 -0
  73. tenish_cabal-0.5.2/src/cabal/core/checkpoint.py +175 -0
  74. tenish_cabal-0.5.2/src/cabal/core/db.py +72 -0
  75. tenish_cabal-0.5.2/src/cabal/core/db_pragmas.py +26 -0
  76. tenish_cabal-0.5.2/src/cabal/core/detached.py +101 -0
  77. tenish_cabal-0.5.2/src/cabal/core/dispatch_pairs.py +108 -0
  78. tenish_cabal-0.5.2/src/cabal/core/dispatch_timeout.py +73 -0
  79. tenish_cabal-0.5.2/src/cabal/core/guardrails.py +283 -0
  80. tenish_cabal-0.5.2/src/cabal/core/guardrails_builtin.py +1175 -0
  81. tenish_cabal-0.5.2/src/cabal/core/hooks/__init__.py +0 -0
  82. tenish_cabal-0.5.2/src/cabal/core/hooks/registry.py +149 -0
  83. tenish_cabal-0.5.2/src/cabal/core/identity_sync.py +104 -0
  84. tenish_cabal-0.5.2/src/cabal/core/llm/__init__.py +0 -0
  85. tenish_cabal-0.5.2/src/cabal/core/llm/budget.py +173 -0
  86. tenish_cabal-0.5.2/src/cabal/core/llm/circuit_breaker.py +116 -0
  87. tenish_cabal-0.5.2/src/cabal/core/llm/litellm_client.py +452 -0
  88. tenish_cabal-0.5.2/src/cabal/core/llm/protocol.py +96 -0
  89. tenish_cabal-0.5.2/src/cabal/core/memory/__init__.py +0 -0
  90. tenish_cabal-0.5.2/src/cabal/core/memory/session_tracker.py +94 -0
  91. tenish_cabal-0.5.2/src/cabal/core/memory/store.py +52 -0
  92. tenish_cabal-0.5.2/src/cabal/core/memory/techne_store.py +109 -0
  93. tenish_cabal-0.5.2/src/cabal/core/meter.py +539 -0
  94. tenish_cabal-0.5.2/src/cabal/core/models.py +452 -0
  95. tenish_cabal-0.5.2/src/cabal/core/observability/__init__.py +0 -0
  96. tenish_cabal-0.5.2/src/cabal/core/observability/activity_logger.py +331 -0
  97. tenish_cabal-0.5.2/src/cabal/core/observability/event_bus.py +70 -0
  98. tenish_cabal-0.5.2/src/cabal/core/observability/failures.py +22 -0
  99. tenish_cabal-0.5.2/src/cabal/core/observability/langfuse_client.py +111 -0
  100. tenish_cabal-0.5.2/src/cabal/core/observability/trace_exporter.py +133 -0
  101. tenish_cabal-0.5.2/src/cabal/core/persona_factory.py +328 -0
  102. tenish_cabal-0.5.2/src/cabal/core/review_engine.py +1293 -0
  103. tenish_cabal-0.5.2/src/cabal/core/reviews.py +235 -0
  104. tenish_cabal-0.5.2/src/cabal/core/routes/__init__.py +0 -0
  105. tenish_cabal-0.5.2/src/cabal/core/routes/_dispatch_auth.py +311 -0
  106. tenish_cabal-0.5.2/src/cabal/core/routes/a2a_jsonrpc.py +505 -0
  107. tenish_cabal-0.5.2/src/cabal/core/routes/a2a_v1.py +1012 -0
  108. tenish_cabal-0.5.2/src/cabal/core/routes/admin.py +1347 -0
  109. tenish_cabal-0.5.2/src/cabal/core/routes/auth.py +307 -0
  110. tenish_cabal-0.5.2/src/cabal/core/routes/directory.py +92 -0
  111. tenish_cabal-0.5.2/src/cabal/core/routes/healthz.py +22 -0
  112. tenish_cabal-0.5.2/src/cabal/core/routes/meter.py +27 -0
  113. tenish_cabal-0.5.2/src/cabal/core/routes/reviews.py +125 -0
  114. tenish_cabal-0.5.2/src/cabal/core/routes/tasks.py +150 -0
  115. tenish_cabal-0.5.2/src/cabal/core/routes/well_known.py +56 -0
  116. tenish_cabal-0.5.2/src/cabal/core/running.py +162 -0
  117. tenish_cabal-0.5.2/src/cabal/core/scheduler.py +299 -0
  118. tenish_cabal-0.5.2/src/cabal/core/secrets.py +203 -0
  119. tenish_cabal-0.5.2/src/cabal/core/secrets_backend.py +150 -0
  120. tenish_cabal-0.5.2/src/cabal/core/tools/__init__.py +0 -0
  121. tenish_cabal-0.5.2/src/cabal/core/tools/mcp_proxy.py +126 -0
  122. tenish_cabal-0.5.2/src/cabal/guides/__init__.py +31 -0
  123. tenish_cabal-0.5.2/src/cabal/guides/welcome.md +263 -0
  124. tenish_cabal-0.5.2/src/cabal/handlers/__init__.py +14 -0
  125. tenish_cabal-0.5.2/src/cabal/handlers/archivist.py +637 -0
  126. tenish_cabal-0.5.2/src/cabal/handlers/code.py +284 -0
  127. tenish_cabal-0.5.2/src/cabal/handlers/documents.py +252 -0
  128. tenish_cabal-0.5.2/src/cabal/handlers/patterns.py +300 -0
  129. tenish_cabal-0.5.2/src/cabal/librarian/__init__.py +34 -0
  130. tenish_cabal-0.5.2/src/cabal/librarian/adapter.py +75 -0
  131. tenish_cabal-0.5.2/src/cabal/librarian/adapters/__init__.py +5 -0
  132. tenish_cabal-0.5.2/src/cabal/librarian/adapters/filesystem.py +179 -0
  133. tenish_cabal-0.5.2/src/cabal/librarian/store.py +239 -0
  134. tenish_cabal-0.5.2/src/cabal/migrations/env.py +79 -0
  135. tenish_cabal-0.5.2/src/cabal/migrations/script.py.mako +27 -0
  136. tenish_cabal-0.5.2/src/cabal/migrations/versions/167ac846783f_initial_schema.py +128 -0
  137. tenish_cabal-0.5.2/src/cabal/migrations/versions/1a19a7317962_add_conversations_result_json.py +35 -0
  138. tenish_cabal-0.5.2/src/cabal/migrations/versions/a1b2c3d4e5f6_add_federated_bulletin_fields.py +39 -0
  139. tenish_cabal-0.5.2/src/cabal/migrations/versions/a9d3e5f7c1b2_add_review_runs.py +74 -0
  140. tenish_cabal-0.5.2/src/cabal/migrations/versions/b4c8e2a6d1f3_add_conversations_target_group.py +33 -0
  141. tenish_cabal-0.5.2/src/cabal/migrations/versions/b7c1d9e04a22_add_session_work_json.py +33 -0
  142. tenish_cabal-0.5.2/src/cabal/migrations/versions/c2f4a8b61d07_add_delegation_budgets.py +56 -0
  143. tenish_cabal-0.5.2/src/cabal/migrations/versions/c4f0a2b18e77_add_dispatch_pairs.py +41 -0
  144. tenish_cabal-0.5.2/src/cabal/migrations/versions/c6e1f4a8b2d9_add_meter_spend.py +50 -0
  145. tenish_cabal-0.5.2/src/cabal/migrations/versions/d7e1f3a9b2c4_add_token_revocations.py +37 -0
  146. tenish_cabal-0.5.2/src/cabal/migrations/versions/e0518ce53aff_add_task_checkpoints_conversations_.py +61 -0
  147. tenish_cabal-0.5.2/src/cabal/migrations/versions/f3b6c1d2e4a5_add_conversations_schedule.py +36 -0
  148. tenish_cabal-0.5.2/src/cabal/tui/__init__.py +1 -0
  149. tenish_cabal-0.5.2/src/cabal/tui/app.py +65 -0
  150. tenish_cabal-0.5.2/src/cabal/tui/client/__init__.py +1 -0
  151. tenish_cabal-0.5.2/src/cabal/tui/client/base.py +23 -0
  152. tenish_cabal-0.5.2/src/cabal/tui/client/inprocess.py +294 -0
  153. tenish_cabal-0.5.2/src/cabal/tui/main.py +83 -0
  154. tenish_cabal-0.5.2/src/cabal/tui/panes/__init__.py +0 -0
  155. tenish_cabal-0.5.2/src/cabal/tui/panes/primus.py +152 -0
  156. tenish_cabal-0.5.2/src/cabal/tui/rendering/__init__.py +0 -0
  157. tenish_cabal-0.5.2/src/cabal/tui/rendering/markdown.py +50 -0
  158. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/PKG-INFO +631 -0
  159. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/SOURCES.txt +311 -0
  160. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/dependency_links.txt +1 -0
  161. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/entry_points.txt +9 -0
  162. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/requires.txt +38 -0
  163. tenish_cabal-0.5.2/src/tenish_cabal.egg-info/top_level.txt +1 -0
  164. tenish_cabal-0.5.2/tests/test_a2a_card.py +201 -0
  165. tenish_cabal-0.5.2/tests/test_a2a_codes.py +76 -0
  166. tenish_cabal-0.5.2/tests/test_a2a_jsonrpc.py +186 -0
  167. tenish_cabal-0.5.2/tests/test_a2a_tck_support.py +109 -0
  168. tenish_cabal-0.5.2/tests/test_a2a_v1_card.py +525 -0
  169. tenish_cabal-0.5.2/tests/test_a2a_v1_context.py +310 -0
  170. tenish_cabal-0.5.2/tests/test_a2a_v1_detached.py +231 -0
  171. tenish_cabal-0.5.2/tests/test_a2a_v1_endpoint.py +279 -0
  172. tenish_cabal-0.5.2/tests/test_a2a_v1_errors.py +132 -0
  173. tenish_cabal-0.5.2/tests/test_a2a_v1_outside_agent.py +226 -0
  174. tenish_cabal-0.5.2/tests/test_a2a_v1_send_checks.py +139 -0
  175. tenish_cabal-0.5.2/tests/test_a2a_v1_tasks.py +459 -0
  176. tenish_cabal-0.5.2/tests/test_a2a_v1_types.py +471 -0
  177. tenish_cabal-0.5.2/tests/test_a2a_v1_version.py +190 -0
  178. tenish_cabal-0.5.2/tests/test_abort.py +331 -0
  179. tenish_cabal-0.5.2/tests/test_activity_logger.py +960 -0
  180. tenish_cabal-0.5.2/tests/test_admin_conversations.py +228 -0
  181. tenish_cabal-0.5.2/tests/test_admin_route.py +230 -0
  182. tenish_cabal-0.5.2/tests/test_archivist.py +725 -0
  183. tenish_cabal-0.5.2/tests/test_archivist_gitmemory.py +111 -0
  184. tenish_cabal-0.5.2/tests/test_archivist_gitsync.py +140 -0
  185. tenish_cabal-0.5.2/tests/test_archivist_memory.py +129 -0
  186. tenish_cabal-0.5.2/tests/test_archivist_origin.py +524 -0
  187. tenish_cabal-0.5.2/tests/test_archivist_origin_handler.py +99 -0
  188. tenish_cabal-0.5.2/tests/test_archivist_promote.py +268 -0
  189. tenish_cabal-0.5.2/tests/test_archivist_publish_race.py +77 -0
  190. tenish_cabal-0.5.2/tests/test_archivist_purge.py +197 -0
  191. tenish_cabal-0.5.2/tests/test_archivist_search_query.py +137 -0
  192. tenish_cabal-0.5.2/tests/test_archivist_supersede_duplicate.py +150 -0
  193. tenish_cabal-0.5.2/tests/test_archivist_superseded_get.py +45 -0
  194. tenish_cabal-0.5.2/tests/test_archivist_supersession.py +213 -0
  195. tenish_cabal-0.5.2/tests/test_auth_jwt.py +194 -0
  196. tenish_cabal-0.5.2/tests/test_auth_keys.py +154 -0
  197. tenish_cabal-0.5.2/tests/test_auth_liminal_token.py +155 -0
  198. tenish_cabal-0.5.2/tests/test_bookkeeping_event_metadata.py +87 -0
  199. tenish_cabal-0.5.2/tests/test_bootstrap_code_delivery.py +134 -0
  200. tenish_cabal-0.5.2/tests/test_bootstrap_codes.py +134 -0
  201. tenish_cabal-0.5.2/tests/test_broker_router.py +1684 -0
  202. tenish_cabal-0.5.2/tests/test_budget.py +73 -0
  203. tenish_cabal-0.5.2/tests/test_budget_integration.py +156 -0
  204. tenish_cabal-0.5.2/tests/test_bulletin.py +151 -0
  205. tenish_cabal-0.5.2/tests/test_cabal_home.py +219 -0
  206. tenish_cabal-0.5.2/tests/test_capability_dispatch.py +156 -0
  207. tenish_cabal-0.5.2/tests/test_chat.py +330 -0
  208. tenish_cabal-0.5.2/tests/test_checkpoint.py +106 -0
  209. tenish_cabal-0.5.2/tests/test_ci_workflow.py +261 -0
  210. tenish_cabal-0.5.2/tests/test_circuit_breaker.py +117 -0
  211. tenish_cabal-0.5.2/tests/test_cli_detach.py +467 -0
  212. tenish_cabal-0.5.2/tests/test_cli_dispatch_metadata.py +130 -0
  213. tenish_cabal-0.5.2/tests/test_cli_dispatch_timeout_parity.py +74 -0
  214. tenish_cabal-0.5.2/tests/test_cli_login_dispatch.py +151 -0
  215. tenish_cabal-0.5.2/tests/test_codex.py +268 -0
  216. tenish_cabal-0.5.2/tests/test_colleague_scope.py +498 -0
  217. tenish_cabal-0.5.2/tests/test_config_models_are_served.py +150 -0
  218. tenish_cabal-0.5.2/tests/test_credential_flow_e2e.py +572 -0
  219. tenish_cabal-0.5.2/tests/test_delegation_budget_guardrail.py +731 -0
  220. tenish_cabal-0.5.2/tests/test_delegation_budget_persistence.py +407 -0
  221. tenish_cabal-0.5.2/tests/test_delegation_depth_guardrail.py +155 -0
  222. tenish_cabal-0.5.2/tests/test_delegation_edge_guardrail.py +429 -0
  223. tenish_cabal-0.5.2/tests/test_delegation_storm_regression.py +328 -0
  224. tenish_cabal-0.5.2/tests/test_dev_stack_wiring.py +49 -0
  225. tenish_cabal-0.5.2/tests/test_dispatch_pairs.py +741 -0
  226. tenish_cabal-0.5.2/tests/test_dispatch_timeout.py +68 -0
  227. tenish_cabal-0.5.2/tests/test_doom_loop_guardrail.py +589 -0
  228. tenish_cabal-0.5.2/tests/test_doom_loop_ttl_dispatch_coupling.py +127 -0
  229. tenish_cabal-0.5.2/tests/test_edit_format.py +220 -0
  230. tenish_cabal-0.5.2/tests/test_end_to_end.py +163 -0
  231. tenish_cabal-0.5.2/tests/test_event_bus.py +73 -0
  232. tenish_cabal-0.5.2/tests/test_fanout_budget.py +296 -0
  233. tenish_cabal-0.5.2/tests/test_gateway_audience.py +132 -0
  234. tenish_cabal-0.5.2/tests/test_group_dispatch.py +646 -0
  235. tenish_cabal-0.5.2/tests/test_guardrails.py +817 -0
  236. tenish_cabal-0.5.2/tests/test_guides.py +73 -0
  237. tenish_cabal-0.5.2/tests/test_handler_allowlist_e2e.py +264 -0
  238. tenish_cabal-0.5.2/tests/test_handler_status.py +57 -0
  239. tenish_cabal-0.5.2/tests/test_heartbeat.py +112 -0
  240. tenish_cabal-0.5.2/tests/test_honesty_floor.py +81 -0
  241. tenish_cabal-0.5.2/tests/test_hooks_registry.py +115 -0
  242. tenish_cabal-0.5.2/tests/test_identity_config.py +158 -0
  243. tenish_cabal-0.5.2/tests/test_identity_mcp.py +281 -0
  244. tenish_cabal-0.5.2/tests/test_identity_sync.py +181 -0
  245. tenish_cabal-0.5.2/tests/test_inbound_metadata.py +177 -0
  246. tenish_cabal-0.5.2/tests/test_librarian.py +315 -0
  247. tenish_cabal-0.5.2/tests/test_liminal_fail_fast.py +48 -0
  248. tenish_cabal-0.5.2/tests/test_liminal_integration.py +353 -0
  249. tenish_cabal-0.5.2/tests/test_litellm_client.py +170 -0
  250. tenish_cabal-0.5.2/tests/test_llm_client_protocol.py +130 -0
  251. tenish_cabal-0.5.2/tests/test_llm_persona.py +152 -0
  252. tenish_cabal-0.5.2/tests/test_llm_persona_checkpointing.py +281 -0
  253. tenish_cabal-0.5.2/tests/test_llm_persona_session.py +118 -0
  254. tenish_cabal-0.5.2/tests/test_log_failure.py +139 -0
  255. tenish_cabal-0.5.2/tests/test_mason_primus.py +1157 -0
  256. tenish_cabal-0.5.2/tests/test_master_key_recovery.py +449 -0
  257. tenish_cabal-0.5.2/tests/test_memory_commit.py +234 -0
  258. tenish_cabal-0.5.2/tests/test_memory_store.py +81 -0
  259. tenish_cabal-0.5.2/tests/test_meter.py +404 -0
  260. tenish_cabal-0.5.2/tests/test_migration_packaging.py +84 -0
  261. tenish_cabal-0.5.2/tests/test_migrations.py +130 -0
  262. tenish_cabal-0.5.2/tests/test_mint_service_no_operator.py +86 -0
  263. tenish_cabal-0.5.2/tests/test_mint_service_token.py +177 -0
  264. tenish_cabal-0.5.2/tests/test_operator_only_handlers.py +45 -0
  265. tenish_cabal-0.5.2/tests/test_operator_renew.py +311 -0
  266. tenish_cabal-0.5.2/tests/test_patterns_handler.py +272 -0
  267. tenish_cabal-0.5.2/tests/test_persona_extra_kwargs.py +187 -0
  268. tenish_cabal-0.5.2/tests/test_persona_factory_primus_guard.py +76 -0
  269. tenish_cabal-0.5.2/tests/test_persona_graduate_absorb.py +414 -0
  270. tenish_cabal-0.5.2/tests/test_persona_overrides.py +410 -0
  271. tenish_cabal-0.5.2/tests/test_personas.py +115 -0
  272. tenish_cabal-0.5.2/tests/test_personas_end_to_end.py +162 -0
  273. tenish_cabal-0.5.2/tests/test_personas_memory_uniform.py +132 -0
  274. tenish_cabal-0.5.2/tests/test_primus_rotate.py +145 -0
  275. tenish_cabal-0.5.2/tests/test_release_image.py +273 -0
  276. tenish_cabal-0.5.2/tests/test_reload_identity.py +175 -0
  277. tenish_cabal-0.5.2/tests/test_remint_sub.py +115 -0
  278. tenish_cabal-0.5.2/tests/test_review_engine.py +517 -0
  279. tenish_cabal-0.5.2/tests/test_review_merge.py +668 -0
  280. tenish_cabal-0.5.2/tests/test_review_watch.py +428 -0
  281. tenish_cabal-0.5.2/tests/test_reviews.py +185 -0
  282. tenish_cabal-0.5.2/tests/test_router_guardrails_wired.py +321 -0
  283. tenish_cabal-0.5.2/tests/test_running_and_drain.py +698 -0
  284. tenish_cabal-0.5.2/tests/test_schedule.py +458 -0
  285. tenish_cabal-0.5.2/tests/test_schema.py +166 -0
  286. tenish_cabal-0.5.2/tests/test_secrets_backend.py +129 -0
  287. tenish_cabal-0.5.2/tests/test_secrets_endpoint.py +191 -0
  288. tenish_cabal-0.5.2/tests/test_secrets_endpoints.py +227 -0
  289. tenish_cabal-0.5.2/tests/test_secrets_module.py +394 -0
  290. tenish_cabal-0.5.2/tests/test_service_token_handlers.py +188 -0
  291. tenish_cabal-0.5.2/tests/test_session_presence.py +237 -0
  292. tenish_cabal-0.5.2/tests/test_session_presence_cli.py +119 -0
  293. tenish_cabal-0.5.2/tests/test_session_presence_routes.py +191 -0
  294. tenish_cabal-0.5.2/tests/test_session_tracker.py +67 -0
  295. tenish_cabal-0.5.2/tests/test_smoke.py +79 -0
  296. tenish_cabal-0.5.2/tests/test_standalone_imports.py +64 -0
  297. tenish_cabal-0.5.2/tests/test_startup_failure_is_logged.py +52 -0
  298. tenish_cabal-0.5.2/tests/test_streaming.py +553 -0
  299. tenish_cabal-0.5.2/tests/test_streaming_truncation.py +265 -0
  300. tenish_cabal-0.5.2/tests/test_subordinate_primus_attribution.py +742 -0
  301. tenish_cabal-0.5.2/tests/test_terminal_verdict_on_the_wire.py +110 -0
  302. tenish_cabal-0.5.2/tests/test_token_revocation.py +464 -0
  303. tenish_cabal-0.5.2/tests/test_tool_extras_end_to_end.py +321 -0
  304. tenish_cabal-0.5.2/tests/test_tool_guardrails.py +587 -0
  305. tenish_cabal-0.5.2/tests/test_trace_exporter.py +127 -0
  306. tenish_cabal-0.5.2/tests/test_truncation_is_not_success.py +527 -0
  307. tenish_cabal-0.5.2/tests/test_tui_app_smoke.py +264 -0
  308. tenish_cabal-0.5.2/tests/test_tui_inprocess_client.py +390 -0
  309. tenish_cabal-0.5.2/tests/test_tui_inprocess_refusal.py +117 -0
  310. tenish_cabal-0.5.2/tests/test_validate_before_record.py +416 -0
  311. tenish_cabal-0.5.2/tests/test_vendored_liminal_protocol.py +29 -0
  312. tenish_cabal-0.5.2/tests/test_waiting.py +279 -0
  313. tenish_cabal-0.5.2/tests/test_wright_primus.py +259 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tenish and the cabal contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ cabal
2
+ Copyright (C) 2026 tenish and the cabal contributors
3
+
4
+ This product includes software developed by tenish and the cabal contributors
5
+ (https://github.com/tenishai/cabal).
@@ -0,0 +1,631 @@
1
+ Metadata-Version: 2.4
2
+ Name: tenish-cabal
3
+ Version: 0.5.2
4
+ Summary: Self-hosted personal agent orchestration platform
5
+ Author: tenish
6
+ License-Expression: MIT
7
+ Project-URL: Source, https://github.com/tenishai/cabal
8
+ Classifier: Development Status :: 2 - Pre-Alpha
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Requires-Dist: fastapi>=0.115
16
+ Requires-Dist: uvicorn[standard]>=0.32
17
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.36
18
+ Requires-Dist: aiosqlite>=0.20
19
+ Requires-Dist: alembic>=1.14
20
+ Requires-Dist: pydantic>=2.10
21
+ Requires-Dist: pydantic-settings>=2.6
22
+ Requires-Dist: typer>=0.13
23
+ Requires-Dist: joserfc>=1.6.1
24
+ Requires-Dist: cryptography>=44
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: structlog>=24.4
27
+ Requires-Dist: tomli>=2.0; python_version < "3.13"
28
+ Requires-Dist: litellm==1.104.2
29
+ Provides-Extra: mcp
30
+ Requires-Dist: tenish-liminal>=0.4; extra == "mcp"
31
+ Provides-Extra: tui
32
+ Requires-Dist: textual>=1.0; extra == "tui"
33
+ Provides-Extra: memory
34
+ Requires-Dist: tenish-techne>=0.18.2; extra == "memory"
35
+ Provides-Extra: full
36
+ Requires-Dist: tenish-liminal>=0.4; extra == "full"
37
+ Requires-Dist: tenish-techne>=0.18.2; extra == "full"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.3; extra == "dev"
40
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
41
+ Requires-Dist: pytest-cov>=6.0; extra == "dev"
42
+ Requires-Dist: httpx>=0.27; extra == "dev"
43
+ Requires-Dist: ruff>=0.8; extra == "dev"
44
+ Requires-Dist: mypy>=1.13; extra == "dev"
45
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # Cabal
49
+
50
+ cabal is a self-hosted daemon that runs a small team of LLM personas and routes work
51
+ between them and other agents over A2A. It is the identity provider (it mints and
52
+ verifies the JWTs), the dispatch broker that decides who may call whom and logs every
53
+ hop, and the encrypted store for the credentials your agents' tools need. Run it when
54
+ you have more than one agent and want one place on your own machine that connects them,
55
+ scopes them and keeps their keys.
56
+
57
+ For an agent: `cbl guide welcome` prints the bundled guide to what cabal is, what it can
58
+ do for you, and every option with why you'd want it. It ships in the package, so it
59
+ describes the installed version.
60
+
61
+ The distribution is named `tenish-cabal` (`pip show tenish-cabal`; extras install as
62
+ `tenish-cabal[mcp]`); the import package is still `cabal` and the commands are `cbl` and `cabal`.
63
+ `v0.3.0` is the first tag that builds `tenish-cabal`; `v0.2.0` builds `cabal`.
64
+
65
+ ## Where this fits
66
+
67
+ cabal is the orchestrator. Each project below is optional to it.
68
+
69
+ - **liminal** (MCP tool gateway), extra `mcp`: personas call their tools through it, and
70
+ it loads cabal's four handlers and fetches credentials from cabal.
71
+ - **techne** (memory library), extra `memory`: persona recall, and the corpora behind the
72
+ documents, patterns and code handlers.
73
+ - **daedalus** (agent construction kit): no import either way. A daedalus agent runs as
74
+ its own process, and cabal dispatches to it over A2A once you register it with
75
+ `cbl persona graduate`.
76
+ - **kobo** ("the room"): no import. It mints `colleague` tokens cabal accepts and syncs
77
+ `PUT /admin/dispatch-pairs`.
78
+ - **gojira**: `gojira.yaml` deploys cabal to GKE.
79
+
80
+ **Where an agent is defined.** A cabal persona is a `[personas.<name>]` block in
81
+ `identity.toml`, and the name must be one cabal has code for (`architect`, `archivist`,
82
+ `librarian`, `mason`, `wright`; `PERSONA_REGISTRY` in `agents/personas/__init__.py`).
83
+ Any other name gets a bulletin-board row and no handler. A daedalus agent is defined in
84
+ its own bundle directory and run by daedalus; cabal only holds a federated row pointing at
85
+ its endpoint, and sends it Tasks at `POST <endpoint>/a2a/tasks`.
86
+
87
+ **The handlers ship unconfigured.** The archivist, documents, patterns and code handlers
88
+ run inside liminal and have no corpus until you name one: `CABAL_ARCHIVIST_DB` turns on
89
+ shared team memory, `CABAL_LIBRARIAN_DB` document search, and `CABAL_ARCHITECT_DB` pattern
90
+ search and recording. `code` reads no env var and needs a persona's `code.db_path`.
91
+ Details in [Handler status in the shipped stacks](#handler-status-in-the-shipped-stacks).
92
+
93
+ ## What works
94
+
95
+ - **Full A2A dispatch loop** — submit a task via HTTP or CLI, get a completed
96
+ Task back. In-process local dispatch and HTTP remote dispatch both work (the dispatch and
97
+ router tests pass as of 2026-11-23; no second live daemon was run).
98
+ - **JWT trust boundary** — every token is verified as RS256 only, at every
99
+ verify site, so an HS256 token with a real `kid` fails. Every `/admin` route
100
+ checks audience and scope, and every dispatch checks the caller token's
101
+ audience. Some paths check less. `/healthz`, the agent cards,
102
+ `/.well-known/jwks.json` and `/auth/bootstrap` (which takes a one-time code)
103
+ take no token. A2A v1.0 GetTask, ListTasks, CancelTask and an answer to a
104
+ task need a token aimed at the persona in the path, or an operator or
105
+ colleague token aimed at `cabal-core` (a new SendMessage is looser, issue
106
+ #472), then show only the
107
+ caller's own tasks unless it holds `operator` scope (issue #296). The legacy
108
+ `tasks/get` still checks only that the caller owns the task, not the token's
109
+ audience. A token whose `aud` already matches the dispatch target is passed on as
110
+ is, with no scope check. Operator tokens cannot impersonate liminal service
111
+ tokens and vice versa. `allow_dev_master_key` defaults to `False`.
112
+ - **liminal integration** — personas that have `[mcp]` wired in their identity.toml
113
+ persona block get a `tool_proxy` that dispatches to liminal over JSON-RPC. The
114
+ credential flow (`cbl secret set` → `/admin/secrets` → `ctx.credentials` in the
115
+ handler) is tested end to end with liminal and cabal in one process
116
+ (`tests/test_credential_flow_e2e.py`, reported passing 2026-11-23 against liminal 0.7.1; it skips when liminal isn't installed).
117
+ - **LLM personas** — `LLMPersona` wraps LiteLLM acompletion with tool-use loop,
118
+ budget guard, circuit breaker, and per-step hook callbacks.
119
+ - **CLI** — `cbl` covers daemon, login, dispatch (also detached, with `cbl task`),
120
+ chat, tail, `status`, `tasks`, `drain`, `review`, `conversations`,
121
+ `token renew` and `token mint-service`, `secret set|unset|list`,
122
+ `reload identity`, `persona graduate|absorb`, `primus rotate`, `session`,
123
+ `reset-auth`, `archivist purge|erase|backfill-origin`, and `cbl guide`.
124
+ - **Review runs and a merge gate** — `cbl review start|list|show|cancel` queue and
125
+ follow one review per pull-request head, taken through its seats in order (default
126
+ `temperance`, which checks the assertions a change adds, then `prudence`, which
127
+ reviews correctness). Off unless `[review] enabled`. A watch loop queues a
128
+ run for each PR that carries the `ready-for-review` label in a repo listed under
129
+ `[review.repos."owner/name"]`, and a repo that sets `merge = true` has approved runs
130
+ merged, pinned to the reviewed commit, once CI is green. `identity.toml.example`
131
+ describes every key; the CHANGELOG lists the checks the gate makes.
132
+ - **Group dispatch and answers** — `[groups]` in identity.toml names agents in order;
133
+ `cbl dispatch --detach group:<name> "<brief>"` starts the task on the first member with
134
+ nothing running. A task that stops in `input-required`, group or not, takes
135
+ `cbl task <id> --answer "<text>"`, which puts it back in the queue.
136
+ - **Token budgets** — a primus's fan-out has a ceiling and each worker an allotment
137
+ (`leg_token_budget_override`, `fanout_token_budget_override`). For federated agents,
138
+ `[meter]` passes their model calls through `/meter/<key>/...` and charges the
139
+ tokens to the task they run; `task_budget` and `root_budget` refuse calls once the task has spent its budget.
140
+ - **Docker Compose dev stack** — `make up / bootstrap / demo` runs the full
141
+ cabal + liminal stack; `make demo` is a 6-step smoke test. It needs the running stack, so the
142
+ release pass did not measure how often it passes.
143
+ - **A2A v1.0 interface** — `POST /agents/{name}/a2a` (with `A2A-Version: 1.0`)
144
+ serves SendMessage, GetTask, ListTasks and CancelTask, including
145
+ `returnImmediately` and conversations by `contextId`. Each persona has a signed
146
+ v1.0 card at `/agents/{name}/.well-known/agent-card.json` once `public_url` is
147
+ set. The legacy routes (`/agents/{name}`, its `/stream`, `/a2a/tasks`) still
148
+ serve clients that send no `A2A-Version`; a request that sends one gets `-32009`
149
+ (HTTP 400 on `/a2a/tasks`).
150
+ `docs/outside-agents.md` says how to admit an outside agent.
151
+ - **Colleagues and dispatch pairs** — the room (kobo) mints colleague tokens and
152
+ syncs who may call whom with `PUT /admin/dispatch-pairs`. An empty table means
153
+ open, and emptying it logs `dispatch_pairs.replaced_empty`. `GET /directory`
154
+ lists only the agents a colleague may dispatch to, with each one's
155
+ `agent_card_url` (null until `public_url` is set).
156
+ - **Refusals are logged, audited and actionable** — every refusal of a dispatch
157
+ token (bad token, revoked, wrong audience, missing scope, missing colleague pair)
158
+ logs `dispatch.refused` (never the token), and one whose token verified also
159
+ writes a `dispatch_refused` event row. Other refusals (a caller JWT the router
160
+ rejects, a draining daemon, a guardrail block, a refused scheduled start) do
161
+ not log it. A refusal for a missing colleague pair carries
162
+ `"remedy": "colleague_invite"` and says which owner invites and which accepts.
163
+ - **Token revocation** — `POST /admin/token/revoke` (operator) refuses every token
164
+ a subject was issued before the cutoff, and the cutoff survives a restart. An
165
+ `aud=liminal` token already exchanged is checked by the gateway, not here, and
166
+ lives out its 15 minutes. The gateway can fetch every cutoff from
167
+ `GET /auth/revocations`, using the same token it uses to fetch secrets.
168
+ - **Bootstrap code delivery** — `cabal.bootstrap_code` (`log`, `file` or `off`)
169
+ lets a cabal that already has its operator keep the startup code out of the log.
170
+
171
+ ## Layout
172
+
173
+ ```
174
+ src/cabal/
175
+ core/ FastAPI + SQLite + A2A broker + bulletin board
176
+ auth/ JWT mint/verify, bootstrap codes, JWKS provider
177
+ broker/ Dispatch router, bookkeeping, heartbeat, waiting
178
+ routes/ admin, a2a_v1, a2a_jsonrpc, tasks, well_known, auth, healthz,
179
+ directory, meter, reviews
180
+ observability/ Trace exporter + Langfuse adapter
181
+ cli/ cbl entrypoint
182
+ tui/ cabal entrypoint — the Textual terminal UI
183
+ agents/ LLMPersona, EchoAgent, and personas/ (architect, archivist,
184
+ librarian, mason, wright)
185
+ archivist/ Shared-memory sync: gitmemory, gitsync, dedup, promote, store,
186
+ schema, models; purge, erase, backfill (admin-only, CLI)
187
+ guides/ Markdown guides bundled in the wheel (`cbl guide`)
188
+ librarian/ Document indexing + adapters
189
+ handlers/ liminal-facing MCP handlers: archivist, code, documents, patterns
190
+ codex/ Code-graph blame and repo resolution
191
+ config/ identity.toml loader
192
+ migrations/ Alembic revisions (ship as package data; cabal#79)
193
+ tests/ pytest suite
194
+ scripts/ bootstrap.sh, demo.sh, test-docker.sh, check-techne-sibling.sh,
195
+ check_arch_cards.py, a2a_tck/
196
+ compose/ identity.dev.toml, litellm-config.yaml, litestream.yml
197
+ ```
198
+
199
+ ## Handler status in the shipped stacks
200
+
201
+ The `handlers/` modules load inside liminal (`liminal serve`), and no shipped
202
+ compose or k8s file sets their corpus paths, so they are not configured out of
203
+ the box (tenishai/cabal#129 tracks the wiring). Each needs a corpus db that you
204
+ point at yourself, and `documents`, `patterns` and `code` also need `techne`
205
+ importable (`pip install tenish-cabal[memory]`):
206
+
207
+ - **`archivist`**: set `CABAL_ARCHIVIST_DB` on the liminal process, or give a
208
+ persona `archivist.db_path` in its `tool_extras`. Without either, every call
209
+ fails with "no archivist corpus configured".
210
+ - **`documents`** (librarian): set `CABAL_LIBRARIAN_DB`, or a persona
211
+ `documents.db_path`. Without either, every call fails with "no librarian
212
+ corpus configured". `documents.refresh` is operator-only (see below).
213
+ - **`patterns`**: set `CABAL_ARCHITECT_DB`, or a persona `patterns.db_path`.
214
+ `patterns.record` is operator-only (see below).
215
+ - **`code`**: has no env var. The only path is a persona `code.db_path` in
216
+ `tool_extras`, and the handler has no repo list, so `code.refresh` has
217
+ nothing to index and rejects any named repo as unknown. `code.refresh` is operator-only (see below). The codex is a db per repo, which one path cannot address;
218
+ the design is still open in #129.
219
+
220
+ With liminal 0.6.0 or later, `/healthz` shows each of these handlers as
221
+ `unconfigured`, with the reason, until its default corpus is set (the code
222
+ handler always shows it, since it reads no env var). Older liminal ignores
223
+ the handlers' `status()` and shows them `ready`. The tools stay listed either
224
+ way, because a persona's `tool_extras` can still name a corpus.
225
+
226
+ ## Quickstart (development)
227
+
228
+ **Prerequisites**: Python 3.12 or newer, `git`, and on Debian/Ubuntu
229
+ `sudo apt update && sudo apt install python3-venv` (a stock install lacks the
230
+ `venv` module).
231
+ cabal, techne and liminal are cloned as siblings:
232
+
233
+ ```
234
+ parent/
235
+ ├── cabal/ # this repo
236
+ ├── liminal/ # github.com/tenishai/liminal
237
+ └── techne/ # github.com/tenishai/techne
238
+ ```
239
+
240
+ > **Upgrading across the `limenal` → `liminal` rename**
241
+ >
242
+ > The gateway was previously misspelled `limenal`. If your checkout predates
243
+ > the rename:
244
+ >
245
+ > 1. `pip uninstall limenal` before reinstalling. The distribution *name*
246
+ > changed, so pip treats the two as unrelated projects and leaves the old
247
+ > one in place — a stale editable finder pointing at the deleted
248
+ > `src/limenal/`, plus a `limenal` console script that now fails with an
249
+ > import traceback rather than "command not found". Fresh CI runners are
250
+ > unaffected, which is exactly why this bites only developer machines.
251
+ > 2. Rename the sibling directory to `liminal` — `docker-compose.yml` builds
252
+ > it by path (`context: ../liminal`).
253
+ > 3. Rename `[limenal]` to `[liminal]` in your **untracked** `identity.toml`.
254
+ > Nothing in the repo can do this for you, and the config model allows
255
+ > unknown keys, so a stale section is absorbed silently: `[liminal].url`
256
+ > falls back to `None` and every persona comes up with no tool surface.
257
+ > That miss now logs `personas.mcp_skipped`.
258
+ > 4. `LIMENAL_*` environment variables are now `LIMINAL_*`. There is no
259
+ > back-compat shim — a stale `.env` fails loudly on a missing variable
260
+ > instead of silently reading a name nothing sets. Note that
261
+ > `LIMINAL_SECRET_GUARD=0` set under the old spelling means the guard
262
+ > comes back **on** until you rename it.
263
+
264
+ ```bash
265
+ mkdir parent && cd parent
266
+ git clone https://github.com/tenishai/cabal.git
267
+ git clone --branch v0.20.0 https://github.com/tenishai/techne.git # the tag the Dockerfile pins
268
+ git clone https://github.com/tenishai/liminal.git
269
+ cd cabal
270
+
271
+ python3 -m venv .venv
272
+ source .venv/bin/activate
273
+ pip install -e ".[dev]"
274
+ pip install -e ../techne
275
+ pip install -e ../liminal
276
+
277
+ # Generate a master key
278
+ export CABAL_MASTER_KEY=$(python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())")
279
+ # Name the operator. Without this (or `operator_id` under `[cabal]` in
280
+ # identity.toml), `cbl login` fails with "operator_id not configured".
281
+ # The daemon reads it, so set it in the shell that starts the daemon.
282
+ export CABAL_OPERATOR_ID=alice
283
+
284
+ cbl daemon up
285
+ # In another terminal: grab the bootstrap code from the daemon's log
286
+ cbl login --code <CODE>
287
+ cbl dispatch echo "hello cabal"
288
+ ```
289
+
290
+ The operator token lasts an hour (`[cabal] operator_token_ttl_seconds`). `cbl` renews it by
291
+ itself when it has under ten minutes left, and `cbl token renew` renews it now. One that has
292
+ already expired needs a new bootstrap code, which means a daemon restart.
293
+
294
+ Run the unit suite (no sibling deps needed; measured 2026-11-23 at commit 002ed91 on Python 3.12.15 with
295
+ `pip install -e ".[dev]"` only: 1826 passed, 20 skipped in about 4.5 minutes):
296
+
297
+ ```bash
298
+ pytest -q
299
+ ```
300
+
301
+ ## Quickstart (Docker Compose)
302
+
303
+ ```bash
304
+ make up # dev stack; needs the prerequisites below
305
+ make bootstrap # within 5 minutes of `make up`: mints tokens, restarts liminal
306
+ make demo # 6-step smoke test: healthz → mint → init → tools/list → set → get
307
+ ```
308
+
309
+ Run `make bootstrap` within 5 minutes of `make up`: the bootstrap code cabal prints at
310
+ startup expires after that. If it has, restart cabal for a fresh code
311
+ (`docker compose -f docker-compose.dev.yml restart cabal`) and run it again.
312
+ `make bootstrap` waits for liminal to come back healthy before it returns, so
313
+ `make demo` can follow straight away.
314
+ `make bootstrap` reads the code from cabal's log, so it needs the default
315
+ `bootstrap_code = "log"`; `identity.toml.example` describes `file` and `off`.
316
+
317
+ **Prerequisites for `make up`**: Docker with the Compose plugin, and `docker buildx`
318
+ (on Ubuntu: `sudo apt update && sudo apt install docker-buildx`). The dev compose file builds the cabal
319
+ and liminal images from sibling checkouts of `techne` and `liminal` (BuildKit named
320
+ build contexts, which need buildx), so clone both next to this repo as in the
321
+ layout above before running it. `make build` and `make up` first check that
322
+ `../techne` is at the tag the Dockerfile pins (`TECHNE_VERSION`, currently
323
+ `v0.20.0`) and stop if it isn't; set `TECHNE_ANY=1` to build against whatever
324
+ `../techne` has checked out, for example when changing techne and cabal
325
+ together. The generated `.env` and the tracked
326
+ `compose/identity.dev.toml` cover the rest, so there is nothing else to prepare.
327
+
328
+ Logs: `make logs`. Tear down: `make down`.
329
+
330
+ `make up` runs the **dev** stack (`docker-compose.dev.yml`), whose identity file
331
+ is `compose/identity.dev.toml` — tracked, so a fresh clone already has it. Set
332
+ `CABAL_IDENTITY_FILE` to point somewhere else.
333
+
334
+ The **production** stack (`docker-compose.yml`) adds a LiteLLM proxy and a
335
+ Litestream sidecar replicating the SQLite DB. It is invoked directly, never
336
+ through `make`, and **it is not a two-line quickstart** — it needs four things
337
+ the dev stack does not:
338
+
339
+ 1. `cp identity.toml.example identity.toml`. The compose file bind-mounts
340
+ `./identity.toml`, which is gitignored; without it Docker creates an empty
341
+ *directory* at that path and cabal-core fails reading it.
342
+ 2. `CABAL_MASTER_KEY` in `.env`, also `:?`. `.env` is gitignored and only
343
+ `make` creates it, so a production checkout has to write it:
344
+ `echo "CABAL_MASTER_KEY=$(python3 -c "import base64,os;print(base64.urlsafe_b64encode(os.urandom(32)).decode())")" >> .env`
345
+ 3. `LITELLM_MASTER_KEY` in `.env`. Declared `:?`, so compose refuses to start
346
+ anything without it.
347
+ 4. `LIMINAL_CABAL_TOKEN` in `.env`, also `:?`. This one is circular: the token
348
+ is minted by cabal-core, and compose checks every `:?` variable in the file
349
+ before starting any service, including when you start only cabal-core. The
350
+ dev stack avoids it (the token is optional there, and `make bootstrap` fills
351
+ it in). For production, start from a placeholder:
352
+
353
+ ```bash
354
+ echo 'LIMINAL_CABAL_TOKEN=placeholder' >> .env
355
+ docker compose -f docker-compose.yml up -d cabal-core
356
+ docker compose -f docker-compose.yml logs cabal-core | grep bootstrap_code
357
+ cbl login --code <CODE> # the code from that log line
358
+ cbl token mint-service --scope secrets-fetch # prints the token
359
+ # replace the placeholder in .env with the printed token, then:
360
+ docker compose -f docker-compose.yml up -d
361
+ ```
362
+
363
+ `docker compose -f docker-compose.yml config` exits non-zero until 2, 3 and 4
364
+ are set — run it first to check rather than discovering it during `up`.
365
+
366
+ Name proxy models `anthropic/...` or `openai/...`. A Vertex name (`vertex_ai/...`,
367
+ or a bare `gemini-...`, which litellm maps to Vertex) makes the SDK call Google
368
+ itself and skip `[litellm] api_base`, and the image has no `google` package, so it
369
+ fails (issues #257, #335). A `gemini/` name is sent to `api_base` in Google's
370
+ own format, on the proxy's `/models/<name>:generateContent` route; that path is
371
+ untested with cabal. To reach a Gemini model through the proxy, name it
372
+ `openai/<proxy model_name>`.
373
+
374
+ Because this stack is not built through `make`, nothing runs the techne check
375
+ for you: run `bash scripts/check-techne-sibling.sh` before the first `up`. The
376
+ image build itself only compares version strings, which cannot tell techne's
377
+ main from the tag.
378
+
379
+ > `CABAL_MASTER_KEY` encrypts the `signing_keys` and `secrets` tables. For the
380
+ > dev stack, `make up` writes a fresh one into `.env` on first run (`Makefile:8`),
381
+ > and `.env` is gitignored. Keep that key: change it and the stored rows can no
382
+ > longer be decrypted (`.env.example` explains `cbl reset-auth`). A key that was
383
+ > committed to this repo before 2026-09-23 is rotated and dead, but it is still in
384
+ > git history (#196), so never reuse anything from an old `.env`.
385
+
386
+ ## Configuration (identity.toml)
387
+
388
+ ```toml
389
+ [cabal]
390
+ operator_id = "alice"
391
+
392
+ [personas.archivist]
393
+ description = "Memory and search"
394
+ role = "singleton" # "singleton" or "primus"
395
+ safety_tier = "moderate"
396
+ model_override = "claude-haiku-4-5-20251001" # optional
397
+ system_prompt_override = "You are an archivist." # optional
398
+
399
+ [personas.archivist.mcp]
400
+ enabled = true
401
+ max_steps = 6
402
+ allowed_handlers = ["memory", "scratchpad"]
403
+ tool_extras = { "memory.db_path" = "/data/archivist.db" }
404
+
405
+ [langfuse] # optional; omit to disable tracing
406
+ host = "https://cloud.langfuse.com"
407
+ public_key_env = "LANGFUSE_PUBLIC_KEY"
408
+ secret_key_env = "LANGFUSE_SECRET_KEY"
409
+ ```
410
+
411
+ ### Where cabal keeps its state
412
+
413
+ Since 0.3.0, cabal reads `--config` if you pass it. Otherwise it picks a state
414
+ root and reads `identity.toml` from there. The state root is the working
415
+ directory if it already holds `identity.toml`, `data/cabal.db` or
416
+ `data/.master_key`, so older installs keep working in place; otherwise it is
417
+ `$CABAL_HOME`, which defaults to `~/.cabal`. The database and the dev master key
418
+ live under the state root, and `CABAL_DB_URL` overrides the database path. The
419
+ CLI token is always `$CABAL_HOME/token`.
420
+
421
+ ### Settings added in 0.3.x
422
+
423
+ Each `[cabal]` setting below is described in `identity.toml.example`. Where an
424
+ environment variable is listed, it wins over the file.
425
+
426
+ | Setting | Env var | Default | What it does |
427
+ |---|---|---|---|
428
+ | `data_dir` | `CABAL_DATA_DIR` (new in 0.3) | `"data"` | Anchors relative `[techne]` paths such as `db_path`. It does not set the database path (see `CABAL_DB_URL`). The image sets the env var to `/data`. |
429
+ | `public_url` | `CABAL_PUBLIC_URL` | unset | The URL clients reach cabal at. A2A v1.0 cards answer 503 without it. |
430
+ | `front_door` | `CABAL_FRONT_DOOR` | unset | The persona whose v1.0 card `/.well-known/agent-card.json` serves; 404 when unset. |
431
+ | `context_replay_messages` | | `40` | How many earlier messages a v1.0 SendMessage with a `contextId` replays; 0 for none. |
432
+ | `detached_task_limit` | | `16` | Most `returnImmediately` tasks running at once; more get `-32004`. |
433
+ | `detached_drain_seconds` | | `10` | How long each detached task gets to stop at shutdown before it is cancelled. |
434
+ | `bootstrap_code` | `CABAL_BOOTSTRAP_CODE` | `"log"` | `file` writes the code to `$CABAL_HOME/bootstrap_code` (mode 0600) and logs only the path; `off` mints none. An unknown value stops the start. |
435
+
436
+ `[guardrails] caller_edges` says which personas an `agent:<name>` caller may reach
437
+ when `delegation_edges = true`; see `docs/outside-agents.md`.
438
+
439
+ ### `CABAL_DISPATCH_TIMEOUT_S`
440
+
441
+ Environment variable (not identity.toml). Bounds the read ceiling of the
442
+ HTTP client used for federated dispatch — default 30s, the historical
443
+ hardcoded value. Raise it if a federated peer fronts a real model call and
444
+ can legitimately take minutes; connect stays at 10s (or the whole timeout, if that is shorter), so an
445
+ unreachable peer still fails fast rather than hanging for the full read
446
+ ceiling. Must parse as a finite number > 0.
447
+
448
+ Coupled to the doom-loop guardrail: `DoomLoopGuardrail`'s TTL (default 600s,
449
+ `guardrails.doom_loop_ttl_s`) has to stay above the dispatch timeout or a
450
+ hanging federated peer resets the guard's repeat count on every attempt
451
+ before it ever reaches its threshold. Rather than requiring operators to
452
+ hand-tune both, cabal auto-widens the TTL to `2 * CABAL_DISPATCH_TIMEOUT_S`
453
+ whenever the configured TTL would fall below that, logging
454
+ `guardrails.doom_loop_ttl_raised` when it does. In practice: raising this
455
+ above 300s (half the default TTL) triggers the widening automatically.
456
+
457
+ **`cbl` follows it automatically, on dispatch routes only.** The CLI's own HTTP
458
+ client used to be pinned at 30s, so raising this variable produced a daemon
459
+ that waited minutes and a `cbl` that gave up at 30s — the exact failure the
460
+ knob exists to prevent, on the route the knob is for. `cbl` now resolves the
461
+ same variable and allows `2 * CABAL_DISPATCH_TIMEOUT_S` for the two routes
462
+ that trigger a federated dispatch (`cbl dispatch` / `cbl chat`), since the client
463
+ additionally waits on auth, bookkeeping and the response trip. Most other
464
+ `cbl` calls keep the short 30s ceiling on purpose: a hung daemon should not
465
+ make `cbl status` sit for minutes. The session-presence calls
466
+ (`register_session`, `heartbeat_session`, `end_session`) are tighter still at
467
+ 5s: they run from a Stop hook on every turn, so a firewall that DROPs rather
468
+ than refuses would stall the turn itself. An unparseable value fails the CLI
469
+ the same way it aborts the daemon, rather than silently falling back to 30.
470
+
471
+ **Detached tasks.** `cbl dispatch --detach <agent> "text"` returns at once with the task id
472
+ (A2A `returnImmediately`, issue #277); `cbl task <id>` reads it and `cbl task <id> --wait
473
+ [--interval S] [--timeout S]` polls until it ends. The daemon runs the task, so a client
474
+ restart or network blip does not lose it, and `cbl`'s own ceiling does not apply. The
475
+ daemon's does: a detached task's call to a federated peer goes through the same HTTP client
476
+ as a blocking dispatch, so `CABAL_DISPATCH_TIMEOUT_S` still bounds it, and a peer that takes
477
+ longer fails the task. Raise the variable on the daemon for long peer tasks; the doom-loop
478
+ TTL widening above applies unchanged. A local persona has no such ceiling. `cbl task`
479
+ exits 1 for a task that did not complete and 3 when `--timeout` runs out first.
480
+ `cbl task` finds the persona through the operator's conversation view; with a persona token,
481
+ pass `--target <agent>`.
482
+
483
+ ## Recovering a lost master key
484
+
485
+ `CABAL_MASTER_KEY` encrypts the `signing_keys` and `secrets` tables. Start cabal
486
+ against a database written under a *different* key and it stops before binding
487
+ the port:
488
+
489
+ ```
490
+ [error] cabal.master_key_mismatch db_url=... key_source='the CABAL_MASTER_KEY environment variable'
491
+ msg='Could not decrypt this database's signing key: either the master key is
492
+ not the one that wrote it, or the stored row is damaged. ...'
493
+ ```
494
+
495
+ Three ways out, cheapest first:
496
+
497
+ 1. **Restore the original key** — if the key is what is wrong. Then nothing is
498
+ lost: the data was never damaged, only unreadable. The message says *either
499
+ the key or a damaged row* because cabal genuinely cannot always tell: a
500
+ malformed ciphertext envelope is detected and reported separately as
501
+ `cabal.encrypted_row_damaged`, but damage inside the encrypted body is
502
+ indistinguishable from a wrong key without the key itself. If restoring the
503
+ key does not work, assume the row is damaged and go to 2 or 3.
504
+ 2. **Point somewhere else**: `CABAL_DB_URL=sqlite+aiosqlite:///data-new/cabal.db`
505
+ leaves the old database untouched for a later recovery.
506
+ 3. **`cbl reset-auth`** — backs the database up, deletes the undecryptable
507
+ signing keys, and drops the cached operator token they signed. The next
508
+ `cbl daemon up` mints a fresh key and prints a new bootstrap code.
509
+
510
+ `reset-auth` keeps your `secrets` rows by default. They stay encrypted under the
511
+ key you no longer have, so they are unreadable until it comes back — but they are
512
+ also the only thing here that cannot be regenerated, which is why deleting them
513
+ takes an explicit `--purge-secrets`.
514
+
515
+ If the daemon starts but dispatch fails with `No key for kid`, the saved token
516
+ was signed by a key that no longer exists: run `cbl login --code <CODE>` again.
517
+
518
+ ## Removing an archivist entry (`cbl archivist purge`)
519
+
520
+ To stop serving an entry that is no longer true, publish a tombstone that
521
+ supersedes it through `archivist.publish` (`supersede: true`; add
522
+ `supersede_scope: "resource"` to retire the name's entries of every type).
523
+ The old row stays in the table for audit, and search stops returning it.
524
+
525
+ When the text must not be stored at all (personal data, a leaked secret), purge
526
+ it on the host that holds the database. For the archivist container, that's
527
+ `docker exec -it archivist cbl archivist purge <resource_name>`:
528
+
529
+ ```sh
530
+ cbl archivist purge <resource_name> # dry run: lists every version
531
+ cbl archivist purge <resource_name> --apply # deletes
532
+ ```
533
+
534
+ The name must match exactly. `--db` names the database file and defaults to
535
+ `$CABAL_ARCHIVIST_DB`. `--apply` deletes every version of the entry, whatever
536
+ its status or type, together with its full-text index rows and every relation
537
+ that touches it. It then runs the FTS5 `optimize` and `VACUUM`, so the text
538
+ leaves the index and the file. If `--apply` fails after the delete, re-running
539
+ it finishes that cleanup. The output and the log carry ids, types, statuses and
540
+ content hashes, never the entry's text.
541
+
542
+ No MCP tool or HTTP route can reach this command. A writer that still holds the
543
+ fact (for example a techne row tagged `team`) will publish it again, so remove
544
+ it there first. If the corpus is mirrored with gitsync, also delete
545
+ `entries/<content_hash>.json` from the memory repo; git history keeps it until
546
+ that history is rewritten.
547
+
548
+ ## Seeing the fleet (`cbl status`)
549
+
550
+ `cbl status` lists the personas this cabal owns. It also lists **live agent
551
+ sessions** — the Claude Code sessions actually doing work — once they register:
552
+
553
+ ```
554
+ NAME GEN KIND ROLE STATUS TIER HEARTBEAT
555
+ -------------------------------------------------------------------------------
556
+ echo 1 member builtin active strict —
557
+ agent-b 1 session session active strict 2026-09-10T12:04:00+00:00
558
+ ↳ liminal · fix/73-hardening · working the hardening bill
559
+ agent-c 1 session session active strict 2026-09-10T11:31:00+00:00 STALE
560
+ ```
561
+
562
+ A session row is **presence only** — it exists to answer "what is running, and
563
+ what is it doing". Capability routing cannot select it, and the reason is not the
564
+ empty capability map on the row: capability routing matches against an in-memory
565
+ registry that only `identity.toml` personas are ever added to, so a session is
566
+ absent from it entirely. Naming a session as an explicit dispatch target is not
567
+ refused by kind; its `session://` endpoint has no transport, so the dispatch
568
+ fails there. The `session://` endpoint and empty agent card are belt to that
569
+ suspenders.
570
+
571
+ Wire it up with the hook cabal ships:
572
+
573
+ ```jsonc
574
+ // ~/.claude/settings.json, or a project .claude/settings.json
575
+ "hooks": {
576
+ "SessionStart": [{"hooks": [{"type": "command",
577
+ "command": "/path/to/cabal/hooks/cabal-session-presence.sh start"}]}],
578
+ "Stop": [{"hooks": [{"type": "command",
579
+ "command": "/path/to/cabal/hooks/cabal-session-presence.sh beat"}]}]
580
+ }
581
+ ```
582
+
583
+ Set `CABAL_SESSION_NAME=agent-b` for a readable roster (it falls back to a short
584
+ session id), and `CABAL_SESSION_TASK="..."` for the one-line what-I-am-doing.
585
+ Repo and branch are read from git; a detached worktree reports `detached@<sha>`.
586
+
587
+ The hook **fails open everywhere** — no `cbl` on PATH, a daemon that is down, or
588
+ a failing call all exit 0. Presence is an operator convenience and must never
589
+ break a turn.
590
+
591
+ `STALE` marks a session that has not heartbeated in 15 minutes. Clean
592
+ de-registration cannot be relied on — a crashed session never runs its Stop
593
+ hook — so staleness, not `cbl session end`, is what makes a dead session read
594
+ as dead. Reaping those rows is tracked in #70.
595
+
596
+ ## Operator-only tools (`documents.refresh`, `code.refresh`, `patterns.record`)
597
+
598
+ liminal refuses these three tools unless the caller's token holds `operator`
599
+ scope alongside `dispatch`. Persona tokens carry only `dispatch` and the
600
+ `cbl login` token carries only `operator`. `cbl token mint-service` answers 400
601
+ to any request for `operator` scope or an `operator` subject (#403), and no
602
+ other cabal route mints a token holding both, so these tools cannot
603
+ currently be reached with cabal-minted tokens (issue #453). In a sovereign liminal the policy grant must hold
604
+ `operator` instead, and with `LIMINAL_AUTH_DISABLED=1` these tools are refused
605
+ outright. This needs a liminal release that has `requires_operator`.
606
+
607
+ ## Modes
608
+
609
+ - **Solo (default)**: one process, all personas as local handlers, dispatch router
610
+ shortcuts the network for in-process calls.
611
+ - **Scale**: some personas run elsewhere and the router reaches them over HTTP. Today
612
+ that is federation: `cbl persona graduate` points a persona at a remote endpoint.
613
+
614
+ `cbl daemon up --agent <name>` is accepted and logged, but nothing reads it yet: every
615
+ daemon registers every persona its `identity.toml` declares.
616
+
617
+ ## How this was built
618
+
619
+ tenishai is a small team of engineers who build with AI coding agents. Most of
620
+ this code was written in pairing sessions with Claude models in Claude Code: a
621
+ person set the design, directed the work and reviewed what landed, and the
622
+ agent wrote much of the code and docs. Many commits name the agent in a
623
+ `Co-Authored-By:` trailer, either a Claude model or the name of the
624
+ agent one of us pairs with. A commit without a trailer may still
625
+ have had AI help.
626
+
627
+ ## License
628
+
629
+ Copyright (c) 2026 tenish and the cabal contributors
630
+
631
+ MIT. See [LICENSE](LICENSE).