ouroboros-ai 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ouroboros-ai might be problematic. Click here for more details.

Files changed (268) hide show
  1. ouroboros_ai-0.4.0/HANDOFF.md +111 -0
  2. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/PKG-INFO +10 -5
  3. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/README.md +7 -4
  4. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/planning-artifacts/architecture.md +78 -2
  5. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/planning-artifacts/epics.md +267 -6
  6. ouroboros_ai-0.4.0/docs/README.md +59 -0
  7. ouroboros_ai-0.4.0/docs/api/README.md +178 -0
  8. ouroboros_ai-0.4.0/docs/api/core.md +456 -0
  9. ouroboros_ai-0.4.0/docs/api/mcp.md +864 -0
  10. ouroboros_ai-0.4.0/docs/architecture.md +306 -0
  11. ouroboros_ai-0.4.0/docs/examples/mcp-config.yaml +88 -0
  12. ouroboros_ai-0.4.0/docs/guides/cli-usage.md +838 -0
  13. ouroboros_ai-0.4.0/docs/ontological-framework/HANDOFF.md +288 -0
  14. ouroboros_ai-0.4.0/docs/ontological-framework/aop-design.md +930 -0
  15. ouroboros_ai-0.4.0/docs/ontological-framework/architecture.md +519 -0
  16. ouroboros_ai-0.4.0/docs/ontological-framework/requirements.md +112 -0
  17. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/pyproject.toml +4 -1
  18. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/__init__.py +1 -1
  19. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/bigbang/__init__.py +9 -0
  20. ouroboros_ai-0.4.0/src/ouroboros/bigbang/ontology.py +180 -0
  21. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/commands/__init__.py +2 -0
  22. ouroboros_ai-0.4.0/src/ouroboros/cli/commands/mcp.py +161 -0
  23. ouroboros_ai-0.4.0/src/ouroboros/cli/commands/run.py +347 -0
  24. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/main.py +2 -1
  25. ouroboros_ai-0.4.0/src/ouroboros/core/ontology_aspect.py +455 -0
  26. ouroboros_ai-0.4.0/src/ouroboros/core/ontology_questions.py +462 -0
  27. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/__init__.py +16 -1
  28. ouroboros_ai-0.4.0/src/ouroboros/evaluation/consensus.py +908 -0
  29. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/models.py +81 -0
  30. ouroboros_ai-0.4.0/src/ouroboros/events/ontology.py +135 -0
  31. ouroboros_ai-0.4.0/src/ouroboros/mcp/__init__.py +83 -0
  32. ouroboros_ai-0.4.0/src/ouroboros/mcp/client/__init__.py +20 -0
  33. ouroboros_ai-0.4.0/src/ouroboros/mcp/client/adapter.py +632 -0
  34. ouroboros_ai-0.4.0/src/ouroboros/mcp/client/manager.py +600 -0
  35. ouroboros_ai-0.4.0/src/ouroboros/mcp/client/protocol.py +161 -0
  36. ouroboros_ai-0.4.0/src/ouroboros/mcp/errors.py +377 -0
  37. ouroboros_ai-0.4.0/src/ouroboros/mcp/resources/__init__.py +22 -0
  38. ouroboros_ai-0.4.0/src/ouroboros/mcp/resources/handlers.py +328 -0
  39. ouroboros_ai-0.4.0/src/ouroboros/mcp/server/__init__.py +21 -0
  40. ouroboros_ai-0.4.0/src/ouroboros/mcp/server/adapter.py +408 -0
  41. ouroboros_ai-0.4.0/src/ouroboros/mcp/server/protocol.py +291 -0
  42. ouroboros_ai-0.4.0/src/ouroboros/mcp/server/security.py +636 -0
  43. ouroboros_ai-0.4.0/src/ouroboros/mcp/tools/__init__.py +24 -0
  44. ouroboros_ai-0.4.0/src/ouroboros/mcp/tools/definitions.py +351 -0
  45. ouroboros_ai-0.4.0/src/ouroboros/mcp/tools/registry.py +269 -0
  46. ouroboros_ai-0.4.0/src/ouroboros/mcp/types.py +333 -0
  47. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/orchestrator/__init__.py +31 -0
  48. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/orchestrator/events.py +40 -0
  49. ouroboros_ai-0.4.0/src/ouroboros/orchestrator/mcp_config.py +419 -0
  50. ouroboros_ai-0.4.0/src/ouroboros/orchestrator/mcp_tools.py +483 -0
  51. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/orchestrator/runner.py +119 -2
  52. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/providers/claude_code_adapter.py +75 -0
  53. ouroboros_ai-0.4.0/src/ouroboros/strategies/__init__.py +23 -0
  54. ouroboros_ai-0.4.0/src/ouroboros/strategies/devil_advocate.py +197 -0
  55. ouroboros_ai-0.4.0/tests/e2e/__init__.py +1 -0
  56. ouroboros_ai-0.4.0/tests/e2e/conftest.py +523 -0
  57. ouroboros_ai-0.4.0/tests/e2e/test_cli_commands.py +396 -0
  58. ouroboros_ai-0.4.0/tests/e2e/test_full_workflow.py +502 -0
  59. ouroboros_ai-0.4.0/tests/e2e/test_session_persistence.py +684 -0
  60. ouroboros_ai-0.4.0/tests/integration/mcp/__init__.py +1 -0
  61. ouroboros_ai-0.4.0/tests/integration/mcp/conftest.py +786 -0
  62. ouroboros_ai-0.4.0/tests/integration/mcp/test_client_adapter.py +529 -0
  63. ouroboros_ai-0.4.0/tests/integration/mcp/test_client_manager.py +659 -0
  64. ouroboros_ai-0.4.0/tests/integration/mcp/test_server_adapter.py +599 -0
  65. ouroboros_ai-0.4.0/tests/unit/bigbang/test_ontology.py +146 -0
  66. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/test_main.py +24 -0
  67. ouroboros_ai-0.4.0/tests/unit/core/test_ontology_aspect.py +261 -0
  68. ouroboros_ai-0.4.0/tests/unit/core/test_ontology_questions.py +348 -0
  69. ouroboros_ai-0.4.0/tests/unit/evaluation/test_consensus.py +782 -0
  70. ouroboros_ai-0.4.0/tests/unit/mcp/__init__.py +1 -0
  71. ouroboros_ai-0.4.0/tests/unit/mcp/client/__init__.py +1 -0
  72. ouroboros_ai-0.4.0/tests/unit/mcp/client/test_adapter.py +110 -0
  73. ouroboros_ai-0.4.0/tests/unit/mcp/client/test_manager.py +157 -0
  74. ouroboros_ai-0.4.0/tests/unit/mcp/conftest.py +48 -0
  75. ouroboros_ai-0.4.0/tests/unit/mcp/server/__init__.py +1 -0
  76. ouroboros_ai-0.4.0/tests/unit/mcp/server/test_adapter.py +224 -0
  77. ouroboros_ai-0.4.0/tests/unit/mcp/server/test_security.py +279 -0
  78. ouroboros_ai-0.4.0/tests/unit/mcp/test_errors.py +189 -0
  79. ouroboros_ai-0.4.0/tests/unit/mcp/test_types.py +309 -0
  80. ouroboros_ai-0.4.0/tests/unit/mcp/tools/__init__.py +1 -0
  81. ouroboros_ai-0.4.0/tests/unit/mcp/tools/test_definitions.py +163 -0
  82. ouroboros_ai-0.4.0/tests/unit/mcp/tools/test_registry.py +238 -0
  83. ouroboros_ai-0.4.0/tests/unit/orchestrator/test_mcp_config.py +452 -0
  84. ouroboros_ai-0.4.0/tests/unit/orchestrator/test_mcp_tools.py +467 -0
  85. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/orchestrator/test_runner.py +210 -0
  86. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/uv.lock +25 -1
  87. ouroboros_ai-0.4.0/vision-draft.md +42 -0
  88. ouroboros_ai-0.3.0/PR-43-CODE-REVIEW-REPORT.md +0 -614
  89. ouroboros_ai-0.3.0/src/ouroboros/cli/commands/run.py +0 -209
  90. ouroboros_ai-0.3.0/src/ouroboros/evaluation/consensus.py +0 -350
  91. ouroboros_ai-0.3.0/tests/unit/evaluation/test_consensus.py +0 -384
  92. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/.gitignore +0 -0
  93. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/.pre-commit-config.yaml +0 -0
  94. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/.python-version +0 -0
  95. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/CHANGELOG.md +0 -0
  96. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/LICENSE +0 -0
  97. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/github-issue-mapping.yaml +0 -0
  98. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/sprint-status.yaml +0 -0
  99. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-1-project-initialization-with-uv.md +0 -0
  100. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-2-core-types-and-error-handling.md +0 -0
  101. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-3-event-store-with-sqlalchemy-core.md +0 -0
  102. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-4-configuration-and-credentials-management.md +0 -0
  103. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-5-llm-provider-adapter-with-litellm.md +0 -0
  104. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-6-cli-skeleton-with-typer-and-rich.md +0 -0
  105. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-7-structured-logging-with-structlog.md +0 -0
  106. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-8-checkpoint-and-recovery-system.md +0 -0
  107. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/0-9-context-compression-engine.md +0 -0
  108. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/1-1-interview-protocol-engine.md +0 -0
  109. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/1-2-ambiguity-score-calculation.md +0 -0
  110. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/1-3-immutable-seed-generation.md +0 -0
  111. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/2-1-three-tier-model-configuration.md +0 -0
  112. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/2-2-complexity-based-routing.md +0 -0
  113. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/2-3-escalation-on-failure.md +0 -0
  114. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/2-4-downgrade-on-success.md +0 -0
  115. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/3-1-double-diamond-cycle-implementation.md +0 -0
  116. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/3-2-hierarchical-ac-decomposition.md +0 -0
  117. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/3-3-atomicity-detection.md +0 -0
  118. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/3-4-subagent-isolation.md +0 -0
  119. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/4-1-stagnation-detection-4-patterns.md +0 -0
  120. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/4-2-lateral-thinking-personas.md +0 -0
  121. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/4-3-persona-rotation-strategy.md +0 -0
  122. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/5-1-stage-1-mechanical-verification.md +0 -0
  123. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/5-2-stage-2-semantic-evaluation.md +0 -0
  124. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/5-3-stage-3-multi-model-consensus.md +0 -0
  125. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/5-4-consensus-trigger-matrix.md +0 -0
  126. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/6-1-drift-measurement-engine.md +0 -0
  127. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/6-2-automatic-retrospective.md +0 -0
  128. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/7-1-todo-registry.md +0 -0
  129. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/implementation-artifacts/stories/7-2-secondary-loop-batch-processing.md +0 -0
  130. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/planning-artifacts/bmm-workflow-status.yaml +0 -0
  131. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/_bmad-output/update-stories.sh +0 -0
  132. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/docs/cli-reference.md +0 -0
  133. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/docs/running-with-claude-code.md +0 -0
  134. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/project-context.md +0 -0
  135. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/__main__.py +0 -0
  136. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/bigbang/ambiguity.py +0 -0
  137. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/bigbang/interview.py +0 -0
  138. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/bigbang/seed_generator.py +0 -0
  139. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/__init__.py +0 -0
  140. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/commands/config.py +0 -0
  141. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/commands/init.py +0 -0
  142. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/commands/status.py +0 -0
  143. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/formatters/__init__.py +0 -0
  144. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/formatters/panels.py +0 -0
  145. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/formatters/progress.py +0 -0
  146. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/cli/formatters/tables.py +0 -0
  147. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/config/__init__.py +0 -0
  148. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/config/loader.py +0 -0
  149. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/config/models.py +0 -0
  150. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/__init__.py +0 -0
  151. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/ac_tree.py +0 -0
  152. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/context.py +0 -0
  153. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/errors.py +0 -0
  154. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/security.py +0 -0
  155. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/seed.py +0 -0
  156. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/core/types.py +0 -0
  157. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/mechanical.py +0 -0
  158. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/pipeline.py +0 -0
  159. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/semantic.py +0 -0
  160. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/evaluation/trigger.py +0 -0
  161. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/events/__init__.py +0 -0
  162. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/events/base.py +0 -0
  163. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/events/decomposition.py +0 -0
  164. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/events/evaluation.py +0 -0
  165. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/execution/__init__.py +0 -0
  166. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/execution/atomicity.py +0 -0
  167. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/execution/decomposition.py +0 -0
  168. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/execution/double_diamond.py +0 -0
  169. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/execution/subagent.py +0 -0
  170. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/observability/__init__.py +0 -0
  171. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/observability/drift.py +0 -0
  172. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/observability/logging.py +0 -0
  173. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/observability/retrospective.py +0 -0
  174. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/orchestrator/adapter.py +0 -0
  175. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/orchestrator/session.py +0 -0
  176. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/__init__.py +0 -0
  177. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/checkpoint.py +0 -0
  178. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/event_store.py +0 -0
  179. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/migrations/__init__.py +0 -0
  180. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/migrations/runner.py +0 -0
  181. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/migrations/scripts/001_initial.sql +0 -0
  182. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/schema.py +0 -0
  183. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/persistence/uow.py +0 -0
  184. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/providers/__init__.py +0 -0
  185. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/providers/base.py +0 -0
  186. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/providers/litellm_adapter.py +0 -0
  187. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/py.typed +0 -0
  188. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/resilience/__init__.py +0 -0
  189. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/resilience/lateral.py +0 -0
  190. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/resilience/stagnation.py +0 -0
  191. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/__init__.py +0 -0
  192. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/complexity.py +0 -0
  193. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/downgrade.py +0 -0
  194. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/escalation.py +0 -0
  195. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/router.py +0 -0
  196. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/routing/tiers.py +0 -0
  197. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/secondary/__init__.py +0 -0
  198. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/secondary/scheduler.py +0 -0
  199. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/src/ouroboros/secondary/todo_registry.py +0 -0
  200. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/conftest.py +0 -0
  201. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/integration/test_entry_point.py +0 -0
  202. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/bigbang/__init__.py +0 -0
  203. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/bigbang/test_ambiguity.py +0 -0
  204. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/bigbang/test_interview.py +0 -0
  205. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/bigbang/test_seed_generator.py +0 -0
  206. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/__init__.py +0 -0
  207. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/formatters/__init__.py +0 -0
  208. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/formatters/test_console.py +0 -0
  209. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/formatters/test_panels.py +0 -0
  210. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/formatters/test_progress.py +0 -0
  211. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/cli/formatters/test_tables.py +0 -0
  212. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/config/__init__.py +0 -0
  213. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/config/test_loader.py +0 -0
  214. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/config/test_models.py +0 -0
  215. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/__init__.py +0 -0
  216. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_ac_tree.py +0 -0
  217. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_context.py +0 -0
  218. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_errors.py +0 -0
  219. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_security.py +0 -0
  220. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_seed.py +0 -0
  221. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/core/test_types.py +0 -0
  222. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/evaluation/__init__.py +0 -0
  223. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/evaluation/test_mechanical.py +0 -0
  224. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/evaluation/test_models.py +0 -0
  225. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/evaluation/test_semantic.py +0 -0
  226. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/evaluation/test_trigger.py +0 -0
  227. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/events/__init__.py +0 -0
  228. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/events/test_base.py +0 -0
  229. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/events/test_decomposition_events.py +0 -0
  230. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/execution/__init__.py +0 -0
  231. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/execution/test_atomicity.py +0 -0
  232. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/execution/test_decomposition.py +0 -0
  233. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/execution/test_double_diamond.py +0 -0
  234. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/execution/test_subagent_isolation.py +0 -0
  235. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/observability/__init__.py +0 -0
  236. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/observability/test_drift.py +0 -0
  237. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/observability/test_logging.py +0 -0
  238. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/observability/test_retrospective.py +0 -0
  239. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/orchestrator/__init__.py +0 -0
  240. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/orchestrator/test_adapter.py +0 -0
  241. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/orchestrator/test_events.py +0 -0
  242. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/orchestrator/test_session.py +0 -0
  243. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/persistence/__init__.py +0 -0
  244. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/persistence/test_checkpoint.py +0 -0
  245. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/persistence/test_event_store.py +0 -0
  246. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/persistence/test_schema.py +0 -0
  247. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/persistence/test_uow.py +0 -0
  248. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/providers/__init__.py +0 -0
  249. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/providers/test_base.py +0 -0
  250. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/providers/test_litellm_adapter.py +0 -0
  251. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/resilience/__init__.py +0 -0
  252. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/resilience/test_lateral.py +0 -0
  253. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/resilience/test_stagnation.py +0 -0
  254. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/__init__.py +0 -0
  255. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/test_complexity.py +0 -0
  256. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/test_downgrade.py +0 -0
  257. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/test_escalation.py +0 -0
  258. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/test_router.py +0 -0
  259. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/routing/test_tiers.py +0 -0
  260. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/secondary/__init__.py +0 -0
  261. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/secondary/test_scheduler.py +0 -0
  262. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/secondary/test_todo_registry.py +0 -0
  263. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/test_dependencies_configured.py +0 -0
  264. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/test_main_entry_point.py +0 -0
  265. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/test_module_structure.py +0 -0
  266. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/test_project_initialization.py +0 -0
  267. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tests/unit/test_tooling_configuration.py +0 -0
  268. {ouroboros_ai-0.3.0 → ouroboros_ai-0.4.0}/tools/sync_github_project.py +0 -0
@@ -0,0 +1,111 @@
1
+ # Handoff Document
2
+
3
+ > Last Updated: 2026-02-03
4
+ > Session: Ontological Framework Implementation - Phase 6 Complete
5
+
6
+ ---
7
+
8
+ ## Goal
9
+
10
+ Ouroboros v0.4.0에 **Ontological Framework** 추가:
11
+ 1. **AOP 기반 분석 프레임워크** - 횡단 관심사를 모듈화하여 재사용 가능한 분석 전략 구현
12
+ 2. **Deliberative Consensus** - Advocate/Devil/Judge 역할 기반 2라운드 토론 시스템
13
+ 3. **Devil's Advocate Strategy** - 온톨로지 질문으로 "근본 해결책인가?" 검증
14
+
15
+ ---
16
+
17
+ ## Current Progress
18
+
19
+ ### ✅ Phase 6: Quality Review - COMPLETE
20
+
21
+ **Code Review 이슈 수정 완료:**
22
+
23
+ | 이슈 | 위치 | 해결 |
24
+ |------|------|------|
25
+ | Exception Handling (ProviderError 중복 래핑) | `consensus.py:731-737` | try/except 제거 - Strategy가 내부에서 에러 처리 |
26
+ | Unused import | `consensus.py:26` | `build_devil_advocate_prompt` 제거 |
27
+ | Import ordering | 3개 파일 | `ruff --fix`로 자동 정렬 |
28
+ | Missing `__all__` | `ontology_aspect.py` | 이미 존재 (line 443-454) |
29
+
30
+ **테스트 결과:** 73개 테스트 통과 (consensus + ontology 관련)
31
+
32
+ ### ✅ 완료된 구현
33
+
34
+ | 파일 | 설명 | 테스트 |
35
+ |------|------|--------|
36
+ | `src/ouroboros/core/ontology_questions.py` | 온톨로지 질문 정의 | ✅ |
37
+ | `src/ouroboros/core/ontology_aspect.py` | AOP 분석 프레임워크 | ✅ |
38
+ | `src/ouroboros/evaluation/models.py` | VoterRole, FinalVerdict, DeliberationResult | ✅ |
39
+ | `src/ouroboros/evaluation/consensus.py` | DeliberativeConsensus 클래스 | ✅ |
40
+ | `src/ouroboros/strategies/devil_advocate.py` | DevilAdvocateStrategy | ✅ |
41
+ | `tests/unit/evaluation/test_consensus.py` | Deliberative 테스트 | ✅ |
42
+ | `tests/unit/core/test_ontology_aspect.py` | AOP 테스트 | ✅ |
43
+ | `tests/unit/core/test_ontology_questions.py` | 온톨로지 질문 테스트 | ✅ |
44
+
45
+ ---
46
+
47
+ ## Next Steps
48
+
49
+ ### Phase 7: Summary
50
+
51
+ 1. **전체 테스트 실행**
52
+ ```bash
53
+ uv run pytest tests/unit/evaluation/ tests/unit/core/ -v
54
+ ```
55
+
56
+ 2. **변경 사항 커밋** (선택적)
57
+ ```bash
58
+ git add -p # 변경 검토
59
+ git commit -m "feat(evaluation): add deliberative consensus with AOP-based devil's advocate"
60
+ ```
61
+
62
+ ### 대기 중 (낮은 우선순위)
63
+
64
+ | 파일 | 설명 |
65
+ |------|------|
66
+ | `src/ouroboros/bigbang/ontology.py` | Interview Phase 통합 |
67
+ | `src/ouroboros/bigbang/ambiguity.py` | Ontology Score 가중치 추가 |
68
+
69
+ ---
70
+
71
+ ## Important Files
72
+
73
+ ### 핵심 구현
74
+ ```
75
+ src/ouroboros/core/ontology_questions.py # 온톨로지 질문 정의
76
+ src/ouroboros/core/ontology_aspect.py # AOP 프레임워크 (BaseAnalyzer, AnalysisResult)
77
+ src/ouroboros/evaluation/consensus.py # DeliberativeConsensus (lines 500-830)
78
+ src/ouroboros/strategies/devil_advocate.py # Strategy 패턴 구현
79
+ ```
80
+
81
+ ### 테스트
82
+ ```
83
+ tests/unit/evaluation/test_consensus.py # 32개 테스트
84
+ tests/unit/core/test_ontology_aspect.py # 18개 테스트
85
+ tests/unit/core/test_ontology_questions.py # 23개 테스트
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Notes
91
+
92
+ ### 아키텍처 결정
93
+
94
+ 1. **Devil's Advocate는 Strategy 객체**: LLM 호출 대신 `DevilAdvocateStrategy.analyze()` 사용
95
+ 2. **Strategy가 에러 처리**: `analyze()` 메서드가 LLM 에러를 내부에서 처리하여 `AnalysisResult.invalid()` 반환
96
+ 3. **AnalysisResult.is_valid**: `True` = 근본 해결책, `False` = 증상 치료
97
+
98
+ ### 검증 명령어
99
+
100
+ ```bash
101
+ # 테스트
102
+ uv run pytest tests/unit/evaluation/test_consensus.py -v
103
+ uv run pytest tests/unit/core/ -v
104
+
105
+ # 린트
106
+ uv run ruff check src/ouroboros/evaluation/ src/ouroboros/core/ src/ouroboros/strategies/
107
+ ```
108
+
109
+ ---
110
+
111
+ *Phase 6 완료. Phase 7 (Summary)로 진행 가능.*
@@ -1,14 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ouroboros-ai
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Self-Improving AI Workflow System
5
5
  Author-email: Q00 <jqyu.lee@gmail.com>
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.14
8
8
  Requires-Dist: aiosqlite>=0.20.0
9
+ Requires-Dist: cachetools>=5.0.0
9
10
  Requires-Dist: claude-agent-sdk>=0.1.0
10
11
  Requires-Dist: httpx>=0.27.0
11
12
  Requires-Dist: litellm>=1.80.0
13
+ Requires-Dist: mcp>=1.26.0
12
14
  Requires-Dist: pydantic>=2.0.0
13
15
  Requires-Dist: pyyaml>=6.0.0
14
16
  Requires-Dist: rich>=13.0.0
@@ -60,7 +62,7 @@ Description-Content-Type: text/markdown
60
62
  <br/>
61
63
 
62
64
  <p align="center">
63
- <code>75 modules</code> · <code>1,341 tests</code> · <code>97%+ coverage</code> · <code>v0.2.x</code>
65
+ <code>75 modules</code> · <code>1,341 tests</code> · <code>97%+ coverage</code>
64
66
  </p>
65
67
 
66
68
  <br/>
@@ -244,7 +246,7 @@ These iterate until a **Seed** crystallizes—a specification with `Ambiguity
244
246
  ┃ └────┬────┘ ┃
245
247
  ┃ │ Stage 1: Mechanical ($0) — lint, build, test ┃
246
248
  ┃ │ Stage 2: Semantic ($$) — AC compliance, drift ┃
247
- ┃ │ Stage 3: Consensus ($$$$) — multi-model vote
249
+ ┃ │ Stage 3: Consensus ($$$$) — Advocate/Devil/Judge debate
248
250
  ┃ ▼ ┃
249
251
  ┃ ┌─────────┐ ┃
250
252
  ┃ │ PHASE 5 │ S E C O N D A R Y L O O P ┃
@@ -312,9 +314,9 @@ def select_approach(task):
312
314
  ```
313
315
  src/ouroboros/
314
316
 
315
- ├── core/ ◆ The essence: types, errors, seed, context
317
+ ├── core/ ◆ The essence: types, errors, seed, ontology
316
318
 
317
- ├── bigbang/ ◇ Phase 0: Interview → Ambiguity → Seed
319
+ ├── bigbang/ ◇ Phase 0: Interview → Ontology → Ambiguity → Seed
318
320
 
319
321
  ├── routing/ ◇ Phase 1: PAL router, complexity, tiers
320
322
 
@@ -357,6 +359,7 @@ src/ouroboros/
357
359
  | **THE RESEARCHER** | *"Stop coding. Read the docs."* | Knowledge gap detected | Search, read documentation, find examples |
358
360
  | **THE SIMPLIFIER** | *"Cut scope in half. Return to MVP."* | Overengineering detected | Remove features, reduce complexity |
359
361
  | **THE ARCHITECT** | *"Question the foundation. Rebuild if needed."* | Structural issues | Redesign, refactor core assumptions |
362
+ | **THE CONTRARIAN** | *"What if we're solving the wrong problem?"* | Root cause unclear | Challenge assumptions using ontological questions |
360
363
 
361
364
  <br/>
362
365
 
@@ -618,6 +621,8 @@ Contributions are welcome! Please see:
618
621
  [■■■■■■■■■■] Epic 6 Drift Control ✓
619
622
  [■■■■■■■■■■] Epic 7 Secondary Loop ✓
620
623
  [■■■■■■■■■■] Epic 8 Orchestrator ✓
624
+ [■■■■■■■■■■] Epic 9 MCP Integration ✓
625
+ [■■■■■■■■■■] Epic 10 TUI Mode ✓
621
626
  ```
622
627
 
623
628
  ### Upcoming
@@ -40,7 +40,7 @@
40
40
  <br/>
41
41
 
42
42
  <p align="center">
43
- <code>75 modules</code> · <code>1,341 tests</code> · <code>97%+ coverage</code> · <code>v0.2.x</code>
43
+ <code>75 modules</code> · <code>1,341 tests</code> · <code>97%+ coverage</code>
44
44
  </p>
45
45
 
46
46
  <br/>
@@ -224,7 +224,7 @@ These iterate until a **Seed** crystallizes—a specification with `Ambiguity
224
224
  ┃ └────┬────┘ ┃
225
225
  ┃ │ Stage 1: Mechanical ($0) — lint, build, test ┃
226
226
  ┃ │ Stage 2: Semantic ($$) — AC compliance, drift ┃
227
- ┃ │ Stage 3: Consensus ($$$$) — multi-model vote
227
+ ┃ │ Stage 3: Consensus ($$$$) — Advocate/Devil/Judge debate
228
228
  ┃ ▼ ┃
229
229
  ┃ ┌─────────┐ ┃
230
230
  ┃ │ PHASE 5 │ S E C O N D A R Y L O O P ┃
@@ -292,9 +292,9 @@ def select_approach(task):
292
292
  ```
293
293
  src/ouroboros/
294
294
 
295
- ├── core/ ◆ The essence: types, errors, seed, context
295
+ ├── core/ ◆ The essence: types, errors, seed, ontology
296
296
 
297
- ├── bigbang/ ◇ Phase 0: Interview → Ambiguity → Seed
297
+ ├── bigbang/ ◇ Phase 0: Interview → Ontology → Ambiguity → Seed
298
298
 
299
299
  ├── routing/ ◇ Phase 1: PAL router, complexity, tiers
300
300
 
@@ -337,6 +337,7 @@ src/ouroboros/
337
337
  | **THE RESEARCHER** | *"Stop coding. Read the docs."* | Knowledge gap detected | Search, read documentation, find examples |
338
338
  | **THE SIMPLIFIER** | *"Cut scope in half. Return to MVP."* | Overengineering detected | Remove features, reduce complexity |
339
339
  | **THE ARCHITECT** | *"Question the foundation. Rebuild if needed."* | Structural issues | Redesign, refactor core assumptions |
340
+ | **THE CONTRARIAN** | *"What if we're solving the wrong problem?"* | Root cause unclear | Challenge assumptions using ontological questions |
340
341
 
341
342
  <br/>
342
343
 
@@ -598,6 +599,8 @@ Contributions are welcome! Please see:
598
599
  [■■■■■■■■■■] Epic 6 Drift Control ✓
599
600
  [■■■■■■■■■■] Epic 7 Secondary Loop ✓
600
601
  [■■■■■■■■■■] Epic 8 Orchestrator ✓
602
+ [■■■■■■■■■■] Epic 9 MCP Integration ✓
603
+ [■■■■■■■■■■] Epic 10 TUI Mode ✓
601
604
  ```
602
605
 
603
606
  ### Upcoming
@@ -149,6 +149,33 @@ class FilteredContext:
149
149
  - Fallback to sequential retry on partial failure
150
150
  - Minimum valid responses required before aggregation
151
151
 
152
+ #### 6. Deliberative Consensus Pattern (v0.4.0)
153
+
154
+ For high-stakes decisions requiring ontological validation:
155
+
156
+ ```python
157
+ class DeliberativeConsensus:
158
+ """Two-round adversarial evaluation with philosophical grounding"""
159
+
160
+ async def evaluate(self, proposal: Proposal) -> DeliberativeResult:
161
+ # Round 1: Concurrent positions
162
+ advocate_task = self._run_advocate(proposal)
163
+ devil_task = self._run_devil(proposal) # Uses ontology_questions
164
+ advocate, devil = await asyncio.gather(advocate_task, devil_task)
165
+
166
+ # Round 2: Judge renders verdict
167
+ verdict = await self._run_judge(advocate, devil)
168
+ return DeliberativeResult(
169
+ verdict=verdict, # APPROVED | REJECTED | CONDITIONAL
170
+ is_root_solution=devil.confirmed_root_cause,
171
+ )
172
+ ```
173
+
174
+ **Roles:**
175
+ - **ADVOCATE**: Argues for the proposal's merits
176
+ - **DEVIL'S ADVOCATE**: Challenges using four ontological questions (ESSENCE, ROOT_CAUSE, PREREQUISITES, HIDDEN_ASSUMPTIONS)
177
+ - **JUDGE**: Synthesizes positions, renders final verdict
178
+
152
179
  ### Testing Strategy
153
180
 
154
181
  **Priority**: Observability Layer First (E0 Epic)
@@ -1000,6 +1027,46 @@ async def execute_phase(phase: Phase, uow: UnitOfWork):
1000
1027
  )
1001
1028
  ```
1002
1029
 
1030
+ #### Ontological Questioning Pattern (v0.4.0)
1031
+
1032
+ ```python
1033
+ from enum import Enum
1034
+
1035
+ class OntologyQuestionType(str, Enum):
1036
+ """Four fundamental questions for deep analysis"""
1037
+ ESSENCE = "essence" # "What IS this, really?"
1038
+ ROOT_CAUSE = "root_cause" # "Is this the root cause or a symptom?"
1039
+ PREREQUISITES = "prerequisites" # "What must exist first?"
1040
+ HIDDEN_ASSUMPTIONS = "hidden_assumptions" # "What are we assuming?"
1041
+
1042
+ @dataclass
1043
+ class OntologyQuestion:
1044
+ type: OntologyQuestionType
1045
+ question: str
1046
+ context: str
1047
+
1048
+ def format_prompt(self) -> str:
1049
+ """Format for LLM consumption"""
1050
+ return f"[{self.type.value.upper()}] {self.question}\nContext: {self.context}"
1051
+
1052
+ # Usage in Contrarian Persona
1053
+ class ContrarianPersona:
1054
+ def challenge(self, proposal: str) -> list[OntologyQuestion]:
1055
+ return [
1056
+ OntologyQuestion(
1057
+ type=OntologyQuestionType.ROOT_CAUSE,
1058
+ question="Is this addressing the root cause or treating a symptom?",
1059
+ context=proposal,
1060
+ ),
1061
+ # ... other questions
1062
+ ]
1063
+ ```
1064
+
1065
+ **Application Points:**
1066
+ - `resilience/personas.py`: Contrarian uses ontological questions
1067
+ - `evaluation/consensus.py`: Devil's Advocate role
1068
+ - `bigbang/ontology.py`: Interview framework discovery
1069
+
1003
1070
  ### Anti-Patterns (MUST AVOID)
1004
1071
 
1005
1072
  #### 1. Zombie Objects (Detached ORM State)
@@ -1112,7 +1179,8 @@ ouroboros/
1112
1179
  │ │ │ ├── validate.py # ouroboros validate <seed.yaml>
1113
1180
  │ │ │ ├── status.py # ouroboros status [--seed-id]
1114
1181
  │ │ │ ├── resume.py # ouroboros resume <checkpoint-id>
1115
- │ │ │ └── config.py # ouroboros config [show|set|init]
1182
+ │ │ │ ├── config.py # ouroboros config [show|set|init]
1183
+ │ │ │ └── story.py # v0.4.0: ouroboros story - narrative generation from universe
1116
1184
  │ │ └── formatters/
1117
1185
  │ │ ├── __init__.py
1118
1186
  │ │ ├── tables.py # Rich table formatters
@@ -1126,6 +1194,7 @@ ouroboros/
1126
1194
  │ │ ├── protocols.py # Protocol definitions (LLMAdapter, etc.)
1127
1195
  │ │ ├── seed.py # Seed, OntologySchema, Constraints
1128
1196
  │ │ ├── ontology.py # EffectiveOntology, OntologyEvent
1197
+ │ │ ├── ontology_questions.py # v0.4.0: Four ontological probes (ESSENCE, ROOT_CAUSE, PREREQUISITES, HIDDEN_ASSUMPTIONS)
1129
1198
  │ │ ├── ac.py # AcceptanceCriteria, ACNode, ACTree
1130
1199
  │ │ └── context.py # ExecutionContext, contextvars
1131
1200
  │ │
@@ -1143,6 +1212,7 @@ ouroboros/
1143
1212
  │ │ ├── clarifier.py # Clarification engine
1144
1213
  │ │ ├── ambiguity.py # Ambiguity Gate (≤0.2 threshold)
1145
1214
  │ │ ├── interview.py # Interview protocol
1215
+ │ │ ├── ontology.py # v0.4.0: Ontological framework discovery during interview
1146
1216
  │ │ └── seed_generator.py # Generate Seed from interview
1147
1217
  │ │
1148
1218
  │ ├── routing/ # Phase 1: PAL Router
@@ -1169,10 +1239,12 @@ ouroboros/
1169
1239
  │ │
1170
1240
  │ ├── evaluation/ # Phase 4: Evaluation
1171
1241
  │ │ ├── __init__.py
1242
+ │ │ ├── models.py # v0.4.0: EvaluationResult, ConsensusResult, Verdict
1172
1243
  │ │ ├── pipeline.py # EvaluationPipeline orchestrator
1173
1244
  │ │ ├── mechanical.py # Stage 1: MechanicalEvaluator ($0)
1174
1245
  │ │ ├── semantic.py # Stage 2: SemanticEvaluator ($$)
1175
- │ │ └── stage_result.py # StageResult, EvaluationResult
1246
+ │ │ ├── consensus.py # v0.4.0: DeliberativeConsensus (Advocate/Devil/Judge)
1247
+ │ │ └── stage_result.py # StageResult (legacy, see models.py)
1176
1248
  │ │
1177
1249
  │ ├── consensus/ # Phase 5: Consensus
1178
1250
  │ │ ├── __init__.py
@@ -1749,3 +1821,7 @@ The Python 3.14 + uv + Typer stack with Event Sourcing and Domain-Driven Design
1749
1821
 
1750
1822
  **Document Maintenance:** Update this architecture when major technical decisions are made during implementation.
1751
1823
 
1824
+ ---
1825
+
1826
+ _Last Updated: 2026-02-02 (v0.4.0 additions)_
1827
+
@@ -369,6 +369,22 @@ So that I have a clear, immutable specification for execution.
369
369
 
370
370
  ---
371
371
 
372
+ ### Story 1.4: Story Generation Command
373
+
374
+ As a developer,
375
+ I want a CLI command to generate stories from my universe,
376
+ So that I can create narrative elements based on the ontological framework.
377
+
378
+ **Acceptance Criteria:**
379
+
380
+ **Given** an existing universe with bigbang session
381
+ **When** running `ouroboros story`
382
+ **Then** the story generation wizard launches
383
+ **And** user can select from discovered story types
384
+ **And** narrative elements are generated based on universe ontology
385
+
386
+ ---
387
+
372
388
  ## Epic 2: Intelligent Task Routing (PAL)
373
389
 
374
390
  **Goal:** Developers benefit from cost-optimized LLM routing that automatically selects the right model tier based on task complexity, with intelligent escalation and downgrade.
@@ -547,7 +563,18 @@ So that stagnation is broken through creative approaches.
547
563
  **And** Researcher persona seeks additional information
548
564
  **And** Simplifier persona reduces complexity
549
565
  **And** Architect persona restructures the approach
550
- **And** Contrarian persona challenges assumptions
566
+ **And** Contrarian persona challenges assumptions using ontological questions
567
+
568
+ **Contrarian Ontological Analysis (v0.4.0):**
569
+
570
+ **Given** the Contrarian persona is activated
571
+ **When** challenging assumptions
572
+ **Then** it uses the four ontological questions:
573
+ - ESSENCE: "What IS this, really?"
574
+ - ROOT_CAUSE: "Is this the root cause or a symptom?"
575
+ - PREREQUISITES: "What must exist first?"
576
+ - HIDDEN_ASSUMPTIONS: "What are we assuming?"
577
+ **And** challenges are grounded in philosophical inquiry, not just contrarianism
551
578
 
552
579
  ---
553
580
 
@@ -589,6 +616,14 @@ So that obvious issues are caught before expensive LLM evaluation.
589
616
  **And** static analysis runs
590
617
  **And** coverage threshold ≥ 0.7 is verified
591
618
 
619
+ **Unified Evaluation Protocol (v0.4.0):**
620
+
621
+ **Given** any evaluation stage
622
+ **When** `EvaluationProtocol.evaluate()` is called
623
+ **Then** the unified interface dispatches to appropriate stage handler
624
+ **And** `EvaluationResult` contains: passed, score, feedback, metadata
625
+ **And** `ConsensusResult` extends with: verdicts list, majority_reached, dissenting_opinions
626
+
592
627
  ---
593
628
 
594
629
  ### Story 5.2: Stage 2 - Semantic Evaluation
@@ -621,6 +656,15 @@ So that important outputs have diverse verification.
621
656
  **And** 2/3 majority agreement is required
622
657
  **And** disagreements are logged with reasoning
623
658
 
659
+ **Deliberative Mode (v0.4.0):**
660
+
661
+ **Given** a high-stakes decision requiring ontological analysis
662
+ **When** DeliberativeConsensus is triggered
663
+ **Then** Round 1 runs ADVOCATE and DEVIL'S ADVOCATE positions concurrently
664
+ **And** Devil's Advocate uses ontological questions to challenge root cause vs symptom
665
+ **And** Round 2 has JUDGE review both positions and render verdict (APPROVED/REJECTED/CONDITIONAL)
666
+ **And** `is_root_solution` indicates whether Devil confirmed the solution addresses root cause
667
+
624
668
  ---
625
669
 
626
670
  ### Story 5.4: Consensus Trigger Matrix
@@ -682,6 +726,29 @@ So that accumulated drift is caught and corrected.
682
726
 
683
727
  ---
684
728
 
729
+ ### Story 6.3: Ontological Framework Discovery
730
+
731
+ As a developer using the interview system,
732
+ I want the bigbang interview to capture fundamental ontological insights,
733
+ So that the generated universe has coherent philosophical foundations.
734
+
735
+ **Acceptance Criteria:**
736
+
737
+ **Given** a bigbang interview session
738
+ **When** exploring the problem domain
739
+ **Then** the system probes for:
740
+ - ESSENCE: The fundamental nature of concepts
741
+ - ROOT_CAUSE: Distinguishing symptoms from causes
742
+ - PREREQUISITES: Identifying foundational dependencies
743
+ - HIDDEN_ASSUMPTIONS: Surfacing implicit beliefs
744
+
745
+ **Given** ontological insights are captured
746
+ **When** the interview completes
747
+ **Then** findings are stored in structured format for universe generation
748
+ **And** can inform the Contrarian persona and Devil's Advocate evaluations
749
+
750
+ ---
751
+
685
752
  ## Epic 7: Secondary Loop & TODO Processing
686
753
 
687
754
  **Goal:** Developers can defer non-critical improvements discovered during execution and process them efficiently in batches after primary goals are met.
@@ -793,20 +860,210 @@ So that I can run orchestrator mode from the command line.
793
860
 
794
861
  ---
795
862
 
863
+ ## Epic 9: MCP Protocol Integration
864
+
865
+ **Value Proposition:** Enable Ouroboros to be controlled via Model Context Protocol, allowing Claude Desktop and other MCP clients to execute workflows.
866
+
867
+ **Dependencies:** Epic 0 (Foundation), Epic 8 (Orchestrator)
868
+
869
+ **Stories:** 4
870
+
871
+ ---
872
+
873
+ ### Story 9.1: MCP Type Definitions
874
+
875
+ As a developer,
876
+ I want well-typed MCP protocol types,
877
+ So that I can implement type-safe MCP communication.
878
+
879
+ **Acceptance Criteria:**
880
+
881
+ **Given** the mcp/types.py module
882
+ **When** I import MCP types
883
+ **Then** MCPToolDefinition, MCPToolResult, MCPResourceDefinition are available
884
+ **And** MCPCapabilities, MCPServerInfo describe server capabilities
885
+ **And** all types are immutable dataclasses with validation
886
+
887
+ ---
888
+
889
+ ### Story 9.2: MCP Server Adapter
890
+
891
+ As a developer,
892
+ I want an MCP server that exposes Ouroboros tools,
893
+ So that MCP clients can interact with Ouroboros.
894
+
895
+ **Acceptance Criteria:**
896
+
897
+ **Given** the mcp/server/adapter.py module
898
+ **When** I create and start an MCPServerAdapter
899
+ **Then** tools are registered via register_tool()
900
+ **And** resources are registered via register_resource()
901
+ **And** server supports stdio and SSE transports
902
+ **And** FastMCP SDK is used for protocol handling
903
+
904
+ ---
905
+
906
+ ### Story 9.3: MCP Tools Implementation
907
+
908
+ As a developer,
909
+ I want Ouroboros functionality exposed as MCP tools,
910
+ So that Claude Desktop can execute seeds and query status.
911
+
912
+ **Acceptance Criteria:**
913
+
914
+ **Given** the mcp/tools/definitions.py module
915
+ **When** OUROBOROS_TOOLS are registered
916
+ **Then** ouroboros_execute_seed executes a seed specification
917
+ **And** ouroboros_session_status returns session state
918
+ **And** ouroboros_query_events queries event history
919
+ **And** all tools return Result types for error handling
920
+
921
+ ---
922
+
923
+ ### Story 9.4: MCP CLI Integration
924
+
925
+ As a developer,
926
+ I want CLI commands for MCP server management,
927
+ So that I can start and inspect MCP servers from the command line.
928
+
929
+ **Acceptance Criteria:**
930
+
931
+ **Given** the cli/commands/mcp.py module
932
+ **When** I run `ouroboros mcp serve`
933
+ **Then** MCP server starts with configured transport
934
+ **And** `ouroboros mcp info` shows server information and tools
935
+ **And** `--transport`, `--host`, `--port` options are available
936
+
937
+ ---
938
+
939
+ ## Epic 10: Interactive TUI Mode
940
+
941
+ **Value Proposition:** Provide real-time visual monitoring of workflow execution through an interactive terminal interface.
942
+
943
+ **Dependencies:** Epic 0 (Foundation), Epic 8 (Orchestrator)
944
+
945
+ **Stories:** 6
946
+
947
+ ---
948
+
949
+ ### Story 10.1: TUI Application Framework
950
+
951
+ As a developer,
952
+ I want a Textual-based TUI application,
953
+ So that I can monitor workflows in real-time.
954
+
955
+ **Acceptance Criteria:**
956
+
957
+ **Given** the tui/app.py module
958
+ **When** I launch OuroborosTUI
959
+ **Then** application initializes with TUIState
960
+ **And** screens are registered and switchable via number keys
961
+ **And** events from EventStore update the UI reactively
962
+ **And** keyboard shortcuts are documented in help screen
963
+
964
+ ---
965
+
966
+ ### Story 10.2: Dashboard Screen
967
+
968
+ As a developer,
969
+ I want a dashboard showing execution overview,
970
+ So that I can see phase progress, drift, and costs at a glance.
971
+
972
+ **Acceptance Criteria:**
973
+
974
+ **Given** the tui/screens/dashboard.py module
975
+ **When** Dashboard screen is displayed
976
+ **Then** PhaseProgressWidget shows Double Diamond phases
977
+ **And** DriftMeterWidget shows weighted drift score
978
+ **And** CostTrackerWidget shows token usage and cost
979
+ **And** ACTreeWidget shows acceptance criteria hierarchy
980
+
981
+ ---
982
+
983
+ ### Story 10.3: Logs Screen
984
+
985
+ As a developer,
986
+ I want a filterable log viewer,
987
+ So that I can inspect execution logs by level.
988
+
989
+ **Acceptance Criteria:**
990
+
991
+ **Given** the tui/screens/logs.py module
992
+ **When** Logs screen is displayed
993
+ **Then** logs are displayed with timestamps and levels
994
+ **And** LogFilterBar allows filtering by level (DEBUG/INFO/WARNING/ERROR)
995
+ **And** logs auto-scroll and can be paused
996
+ **And** filter changes refresh the log display
997
+
998
+ ---
999
+
1000
+ ### Story 10.4: Execution Screen
1001
+
1002
+ As a developer,
1003
+ I want detailed execution information,
1004
+ So that I can inspect phase outputs and event timeline.
1005
+
1006
+ **Acceptance Criteria:**
1007
+
1008
+ **Given** the tui/screens/execution.py module
1009
+ **When** Execution screen is displayed
1010
+ **Then** current phase and status are shown
1011
+ **And** event timeline shows chronological events
1012
+ **And** phase outputs are displayed per phase
1013
+ **And** events update reactively from EventStore
1014
+
1015
+ ---
1016
+
1017
+ ### Story 10.5: Debug Screen
1018
+
1019
+ As a developer,
1020
+ I want debug tools for inspecting state,
1021
+ So that I can troubleshoot issues during development.
1022
+
1023
+ **Acceptance Criteria:**
1024
+
1025
+ **Given** the tui/screens/debug.py module
1026
+ **When** Debug screen is displayed
1027
+ **Then** StateInspector shows TUIState fields
1028
+ **And** raw events tab shows unprocessed events
1029
+ **And** config tab shows current configuration
1030
+ **And** state can be refreshed manually
1031
+
1032
+ ---
1033
+
1034
+ ### Story 10.6: TUI CLI Integration
1035
+
1036
+ As a developer,
1037
+ I want CLI commands for launching TUI,
1038
+ So that I can monitor executions from the command line.
1039
+
1040
+ **Acceptance Criteria:**
1041
+
1042
+ **Given** the cli/commands/tui.py module
1043
+ **When** I run `ouroboros tui monitor`
1044
+ **Then** TUI application launches
1045
+ **And** `--execution-id` monitors specific execution
1046
+ **And** `--session-id` monitors specific session
1047
+ **And** keyboard navigation works (1-5 for screens, q to quit)
1048
+
1049
+ ---
1050
+
796
1051
  ## Epic Summary
797
1052
 
798
1053
  | Epic | Title | Stories | FRs | Key Value |
799
1054
  |------|-------|---------|-----|-----------|
800
1055
  | 0 | Project Foundation & Infrastructure | 9 | 3 | Installable, configurable CLI |
801
- | 1 | Seed Creation via Big Bang | 3 | 3 | Clear requirement specification |
1056
+ | 1 | Seed Creation via Big Bang | 4 | 3 | Clear requirement specification |
802
1057
  | 2 | Intelligent Task Routing (PAL) | 4 | 4 | Cost-optimized LLM usage |
803
1058
  | 3 | Double Diamond Execution | 4 | 3 | Recursive task decomposition |
804
1059
  | 4 | Resilience & Stagnation Recovery | 3 | 2 | Zero-stop operation |
805
1060
  | 5 | Three-Stage Evaluation Pipeline | 4 | 4 | Rigorous verification |
806
- | 6 | Drift Control & Retrospective | 2 | 2 | Goal alignment |
1061
+ | 6 | Drift Control & Retrospective | 3 | 2 | Goal alignment |
807
1062
  | 7 | Secondary Loop & TODO Processing | 2 | 2 | Deferred improvements |
808
1063
  | 8 | Orchestrator (Claude Agent SDK) | 4 | - | Real code execution via SDK |
809
- | **Total** | | **35** | **23** | |
1064
+ | 9 | MCP Protocol Integration | 4 | - | External client integration |
1065
+ | 10 | Interactive TUI Mode | 6 | - | Real-time visual monitoring |
1066
+ | **Total** | | **45** | **23** | |
810
1067
 
811
1068
  ---
812
1069
 
@@ -824,6 +1081,10 @@ Epic 1 (Seed) ──→ Epic 2 (Routing) ──→ Epic 3 (Execution)
824
1081
  Epic 6 (Drift) ──→ Epic 7 (Secondary)
825
1082
 
826
1083
  Epic 8 (Orchestrator)
1084
+
1085
+ ┌───────────────┴───────────────┐
1086
+ ↓ ↓
1087
+ Epic 9 (MCP) Epic 10 (TUI)
827
1088
  ```
828
1089
 
829
1090
  Each Epic provides **complete, standalone functionality** while building upon previous Epics. No Epic requires a future Epic to function.
@@ -831,5 +1092,5 @@ Each Epic provides **complete, standalone functionality** while building upon pr
831
1092
  ---
832
1093
 
833
1094
  _Generated: 2026-01-14_
834
- _Updated: 2026-01-23_
835
- _Status: Complete_
1095
+ _Updated: 2026-02-03_
1096
+ _Status: Complete (v0.4.0 additions)_