fable-engine 1.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. fable_engine-1.3.1/LICENSE +22 -0
  2. fable_engine-1.3.1/MANIFEST.in +7 -0
  3. fable_engine-1.3.1/PKG-INFO +173 -0
  4. fable_engine-1.3.1/README.md +130 -0
  5. fable_engine-1.3.1/docs/fable-v1-v2-migration.md +44 -0
  6. fable_engine-1.3.1/docs/fable-v2-architecture.md +93 -0
  7. fable_engine-1.3.1/docs/system3-architecture.md +122 -0
  8. fable_engine-1.3.1/fable_compressor.py +356 -0
  9. fable_engine-1.3.1/fable_engine/__init__.py +1 -0
  10. fable_engine-1.3.1/fable_engine/actions/__init__.py +291 -0
  11. fable_engine-1.3.1/fable_engine/actions/cas.py +182 -0
  12. fable_engine-1.3.1/fable_engine/actions/deliberation.py +523 -0
  13. fable_engine-1.3.1/fable_engine/actions/fleet.py +807 -0
  14. fable_engine-1.3.1/fable_engine/actions/lifecycle.py +298 -0
  15. fable_engine-1.3.1/fable_engine/actions/scrapers.py +116 -0
  16. fable_engine-1.3.1/fable_engine/actions/system3.py +815 -0
  17. fable_engine-1.3.1/fable_engine/browser.py +824 -0
  18. fable_engine-1.3.1/fable_engine/cas.py +974 -0
  19. fable_engine-1.3.1/fable_engine/fable_session.json +510 -0
  20. fable_engine-1.3.1/fable_engine/guards.py +283 -0
  21. fable_engine-1.3.1/fable_engine/schema.py +714 -0
  22. fable_engine-1.3.1/fable_engine/scrapers/__init__.py +32 -0
  23. fable_engine-1.3.1/fable_engine/scrapers/arxiv.py +115 -0
  24. fable_engine-1.3.1/fable_engine/scrapers/base.py +386 -0
  25. fable_engine-1.3.1/fable_engine/scrapers/github.py +129 -0
  26. fable_engine-1.3.1/fable_engine/scrapers/reddit.py +154 -0
  27. fable_engine-1.3.1/fable_engine/scrapers/web.py +120 -0
  28. fable_engine-1.3.1/fable_engine/scrapers/x.py +125 -0
  29. fable_engine-1.3.1/fable_engine/scrapers/youtube.py +132 -0
  30. fable_engine-1.3.1/fable_engine/server.py +414 -0
  31. fable_engine-1.3.1/fable_engine/session.py +1819 -0
  32. fable_engine-1.3.1/fable_engine/test_server.py +1362 -0
  33. fable_engine-1.3.1/fable_engine/updater.py +541 -0
  34. fable_engine-1.3.1/fable_engine.egg-info/PKG-INFO +173 -0
  35. fable_engine-1.3.1/fable_engine.egg-info/SOURCES.txt +153 -0
  36. fable_engine-1.3.1/fable_engine.egg-info/dependency_links.txt +1 -0
  37. fable_engine-1.3.1/fable_engine.egg-info/entry_points.txt +5 -0
  38. fable_engine-1.3.1/fable_engine.egg-info/top_level.txt +6 -0
  39. fable_engine-1.3.1/fable_mode/__init__.py +3 -0
  40. fable_engine-1.3.1/fable_mode/__main__.py +4 -0
  41. fable_engine-1.3.1/fable_mode/adapters.py +1014 -0
  42. fable_engine-1.3.1/fable_mode/installer.py +553 -0
  43. fable_engine-1.3.1/fable_mode/launcher.py +437 -0
  44. fable_engine-1.3.1/fable_mode/manifest.py +142 -0
  45. fable_engine-1.3.1/fable_mode/resources.json +114 -0
  46. fable_engine-1.3.1/fable_mode/safety.py +103 -0
  47. fable_engine-1.3.1/fable_mode_entry.py +10 -0
  48. fable_engine-1.3.1/fable_v2/__init__.py +146 -0
  49. fable_engine-1.3.1/fable_v2/adapters.py +151 -0
  50. fable_engine-1.3.1/fable_v2/coder_fleet/__init__.py +100 -0
  51. fable_engine-1.3.1/fable_v2/coder_fleet/ast_tools.py +158 -0
  52. fable_engine-1.3.1/fable_v2/coder_fleet/compute.py +199 -0
  53. fable_engine-1.3.1/fable_v2/coder_fleet/design_engine.py +1316 -0
  54. fable_engine-1.3.1/fable_v2/coder_fleet/diagnostics.py +293 -0
  55. fable_engine-1.3.1/fable_v2/coder_fleet/fleet_dispatcher.py +214 -0
  56. fable_engine-1.3.1/fable_v2/coder_fleet/mock_auditor.py +306 -0
  57. fable_engine-1.3.1/fable_v2/coder_fleet/mutation.py +216 -0
  58. fable_engine-1.3.1/fable_v2/coder_fleet/property_oracle.py +260 -0
  59. fable_engine-1.3.1/fable_v2/coder_fleet/receipt_attestor.py +122 -0
  60. fable_engine-1.3.1/fable_v2/coder_fleet/red_team_swarm.py +908 -0
  61. fable_engine-1.3.1/fable_v2/coder_fleet/test_harness.py +198 -0
  62. fable_engine-1.3.1/fable_v2/coder_fleet/vector_engine.py +1287 -0
  63. fable_engine-1.3.1/fable_v2/coder_fleet/visual.py +357 -0
  64. fable_engine-1.3.1/fable_v2/coder_fleet/workspace.py +153 -0
  65. fable_engine-1.3.1/fable_v2/cortical/__init__.py +20 -0
  66. fable_engine-1.3.1/fable_v2/cortical/plasticity_engine.py +992 -0
  67. fable_engine-1.3.1/fable_v2/execution_broker.py +811 -0
  68. fable_engine-1.3.1/fable_v2/proof_engine.py +1141 -0
  69. fable_engine-1.3.1/fable_v2/protocol.py +485 -0
  70. fable_engine-1.3.1/fable_v2/runtime.py +1010 -0
  71. fable_engine-1.3.1/fable_v2/system3/__init__.py +204 -0
  72. fable_engine-1.3.1/fable_v2/system3/causal.py +558 -0
  73. fable_engine-1.3.1/fable_v2/system3/dialectical.py +577 -0
  74. fable_engine-1.3.1/fable_v2/system3/evolution.py +503 -0
  75. fable_engine-1.3.1/fable_v2/system3/executive.py +338 -0
  76. fable_engine-1.3.1/fable_v2/system3/free_energy.py +479 -0
  77. fable_engine-1.3.1/fable_v2/system3/hyperbolic.py +555 -0
  78. fable_engine-1.3.1/fable_v2/system3/induction.py +336 -0
  79. fable_engine-1.3.1/fable_v2/system3/kripke.py +548 -0
  80. fable_engine-1.3.1/fable_v2/system3/oracle.py +745 -0
  81. fable_engine-1.3.1/fable_v2/verifiers.py +72 -0
  82. fable_engine-1.3.1/pyproject.toml +43 -0
  83. fable_engine-1.3.1/rules/AGENTS.md +138 -0
  84. fable_engine-1.3.1/rules/GEMINI.md +139 -0
  85. fable_engine-1.3.1/rules/fable-mode.md +138 -0
  86. fable_engine-1.3.1/setup.cfg +4 -0
  87. fable_engine-1.3.1/setup.py +30 -0
  88. fable_engine-1.3.1/skills/fable-mode/SKILL.md +142 -0
  89. fable_engine-1.3.1/skills/fable-mode/cortex/concurrency.md +116 -0
  90. fable_engine-1.3.1/skills/fable-mode/cortex/design_3d.md +227 -0
  91. fable_engine-1.3.1/skills/fable-mode/cortex/frontend_design.md +263 -0
  92. fable_engine-1.3.1/skills/fable-mode/cortex/process.md +66 -0
  93. fable_engine-1.3.1/skills/fable-mode/cortex/python.md +116 -0
  94. fable_engine-1.3.1/skills/fable-mode/cortex/research.md +120 -0
  95. fable_engine-1.3.1/skills/fable-mode/cortex/rust.md +116 -0
  96. fable_engine-1.3.1/skills/fable-mode/cortex/security.md +64 -0
  97. fable_engine-1.3.1/skills/fable-mode/cortex/synaptic_matrix.json +72 -0
  98. fable_engine-1.3.1/skills/fable-mode/cortex/system.md +44 -0
  99. fable_engine-1.3.1/skills/fable-mode/cortex/target.md +66 -0
  100. fable_engine-1.3.1/skills/fable-mode/examples/autonomous-agentic-migration.md +77 -0
  101. fable_engine-1.3.1/skills/fable-mode/examples/breakthrough-algorithm-synthesis.md +85 -0
  102. fable_engine-1.3.1/skills/fable-mode/examples/deepthink-analysis-proof.md +53 -0
  103. fable_engine-1.3.1/skills/fable-mode/examples/distributed-system-design.md +75 -0
  104. fable_engine-1.3.1/skills/fable-mode/examples/swe-bench-pro-debugging.md +77 -0
  105. fable_engine-1.3.1/skills/fable-mode/examples/weak_model_ollama_setup.md +143 -0
  106. fable_engine-1.3.1/skills/fable-mode/references/aaa-threejs-game-engine.md +820 -0
  107. fable_engine-1.3.1/skills/fable-mode/references/adversarial-code-review-swarm.md +432 -0
  108. fable_engine-1.3.1/skills/fable-mode/references/agentic-execution.md +276 -0
  109. fable_engine-1.3.1/skills/fable-mode/references/anti-slop-frontend-architecture.md +141 -0
  110. fable_engine-1.3.1/skills/fable-mode/references/architectural-blueprinting.md +107 -0
  111. fable_engine-1.3.1/skills/fable-mode/references/cinematic-design-engine.md +152 -0
  112. fable_engine-1.3.1/skills/fable-mode/references/cognitive-protocol.md +225 -0
  113. fable_engine-1.3.1/skills/fable-mode/references/deepthink-mode.md +159 -0
  114. fable_engine-1.3.1/skills/fable-mode/references/design-tokens-and-typographies.md +173 -0
  115. fable_engine-1.3.1/skills/fable-mode/references/goal-rubric-and-pipeline-automation.md +353 -0
  116. fable_engine-1.3.1/skills/fable-mode/references/hebbian-cortical-plasticity.md +231 -0
  117. fable_engine-1.3.1/skills/fable-mode/references/innovation-engine.md +67 -0
  118. fable_engine-1.3.1/skills/fable-mode/references/interleaved-verification.md +138 -0
  119. fable_engine-1.3.1/skills/fable-mode/references/model-velocity-calibration.md +88 -0
  120. fable_engine-1.3.1/skills/fable-mode/references/prompt-scaffolds.md +270 -0
  121. fable_engine-1.3.1/skills/fable-mode/references/proof-architecture.md +268 -0
  122. fable_engine-1.3.1/skills/fable-mode/references/svg-craft-and-vector-design.md +249 -0
  123. fable_engine-1.3.1/skills/fable-mode/references/system2-session-engine.md +272 -0
  124. fable_engine-1.3.1/skills/fable-mode/references/system3-meta-cognition.md +258 -0
  125. fable_engine-1.3.1/skills/fable-mode/references/visual-imagination-engine.md +308 -0
  126. fable_engine-1.3.1/skills/fable-mode/references/weak-model-frontier-uplift.md +140 -0
  127. fable_engine-1.3.1/tests/__init__.py +1 -0
  128. fable_engine-1.3.1/tests/test_anti_loop_circuit_breaker.py +64 -0
  129. fable_engine-1.3.1/tests/test_auto_updater.py +407 -0
  130. fable_engine-1.3.1/tests/test_coder_fleet.py +535 -0
  131. fable_engine-1.3.1/tests/test_delegation_compiler.py +54 -0
  132. fable_engine-1.3.1/tests/test_descriptor_boundaries.py +126 -0
  133. fable_engine-1.3.1/tests/test_design_engine.py +603 -0
  134. fable_engine-1.3.1/tests/test_epistemic_evidence_validator.py +66 -0
  135. fable_engine-1.3.1/tests/test_execution_broker.py +233 -0
  136. fable_engine-1.3.1/tests/test_fable_v2.py +406 -0
  137. fable_engine-1.3.1/tests/test_fleet_transitions.py +116 -0
  138. fable_engine-1.3.1/tests/test_fsm_redteam_evolution.py +406 -0
  139. fable_engine-1.3.1/tests/test_goal_rubric_and_pipeline.py +367 -0
  140. fable_engine-1.3.1/tests/test_hebbian_plasticity.py +585 -0
  141. fable_engine-1.3.1/tests/test_packaging_runtime.py +194 -0
  142. fable_engine-1.3.1/tests/test_proof_engine.py +259 -0
  143. fable_engine-1.3.1/tests/test_red_team_swarm.py +645 -0
  144. fable_engine-1.3.1/tests/test_redteam_remediation.py +169 -0
  145. fable_engine-1.3.1/tests/test_registration_transaction.py +375 -0
  146. fable_engine-1.3.1/tests/test_requested_regressions.py +467 -0
  147. fable_engine-1.3.1/tests/test_scrapers.py +370 -0
  148. fable_engine-1.3.1/tests/test_server_actions.py +93 -0
  149. fable_engine-1.3.1/tests/test_server_frontier_actions.py +269 -0
  150. fable_engine-1.3.1/tests/test_server_protocol.py +88 -0
  151. fable_engine-1.3.1/tests/test_stealth_browser.py +970 -0
  152. fable_engine-1.3.1/tests/test_system3.py +381 -0
  153. fable_engine-1.3.1/tests/test_system3_deep_integration.py +385 -0
  154. fable_engine-1.3.1/tests/test_system3_frontier.py +436 -0
  155. fable_engine-1.3.1/tests/test_vector_engine.py +608 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 REX-codebase 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.
22
+
@@ -0,0 +1,7 @@
1
+ include LICENSE
2
+ include fable_compressor.py
3
+ include fable_engine/fable_session.json
4
+ include fable_mode/resources.json
5
+ recursive-include skills *
6
+ recursive-include rules *
7
+ recursive-include docs *
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.2
2
+ Name: fable-engine
3
+ Version: 1.3.1
4
+ Summary: Independent deterministic System 2 cognitive engine and mechanical time-lock MCP server
5
+ Author: REX-codebase
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 REX-codebase contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+
29
+ Project-URL: Homepage, https://github.com/REX-codebase/fable-mode
30
+ Project-URL: Repository, https://github.com/REX-codebase/fable-mode
31
+ Project-URL: Issues, https://github.com/REX-codebase/fable-mode/issues
32
+ Keywords: mcp,ai-agents,coding-agents,verification,red-team,llm-tools
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Dynamic: requires-python
43
+
44
+ <div align="center">
45
+
46
+ <br/>
47
+
48
+ <img src="./assets/logo-light-mode.svg" width="120" alt="Fable Mode"/>
49
+
50
+ # Fable Mode
51
+
52
+ **Agents that think before they write.**
53
+
54
+ <br/>
55
+
56
+ <a href="https://github.com/REX-codebase/fable-mode"><img src="https://img.shields.io/badge/python-3.10%2B-black" alt="Python 3.10+"/></a>
57
+ &nbsp;
58
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-black" alt="MIT"/></a>
59
+ &nbsp;
60
+ <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/protocol-MCP-black" alt="MCP"/></a>
61
+ &nbsp;
62
+ <img src="https://img.shields.io/badge/dependencies-0-black" alt="Zero Dependencies"/>
63
+ &nbsp;
64
+ <img src="https://img.shields.io/badge/tests-473%20passing-black" alt="473 tests passing"/>
65
+
66
+ <br/><br/>
67
+
68
+ </div>
69
+
70
+ ---
71
+
72
+ <br/>
73
+
74
+ Fable Mode is an open-source control plane for AI coding agents.
75
+
76
+ It makes an agent deliberate, produce evidence, and survive adversarial review
77
+ **before** it earns permission to write to your workspace. The gates are
78
+ mechanical, not prompt advice: no timer, no proof, no write access.
79
+
80
+ <br/>
81
+
82
+ <div align="center">
83
+ <img src="./assets/flow-simple.svg" width="720" alt="Think → Prove → Attack → Write"/>
84
+ </div>
85
+
86
+ <div align="center">
87
+ <video src="https://github.com/REX-codebase/fable-mode/raw/main/assets/launch-film.mp4" width="720" controls muted loop playsinline></video>
88
+ </div>
89
+
90
+ <br/>
91
+
92
+ ### See it work
93
+
94
+ A session starts locked. Confidence does not unlock it.
95
+
96
+ ```text
97
+ >>> session = create_session('demo-refactor', budget='2 min')
98
+ state=INIT execution_locked=True can_execute_code=False
99
+
100
+ >>> session.unlock_execution('the plan looks fine, let me write code now')
101
+ PermissionError: HARD TIME-LOCK VIOLATION: Execution unlock rejected!
102
+ The immutable 2.0m authority budget has not elapsed yet
103
+ (Remaining: 1m 59s / 120.0s).
104
+ ```
105
+
106
+ The same gates guard every phase: evidence receipts for claims, a five-vector
107
+ red-team swarm for code, and a sealed record of what was verified.
108
+
109
+ <br/>
110
+
111
+ ### Install
112
+
113
+ ```bash
114
+ pip install fable-engine
115
+ ```
116
+
117
+ Point your agent at the MCP server:
118
+
119
+ ```jsonc
120
+ // Claude Code: claude mcp add fable-engine -- python -m fable_engine.server
121
+ // Cursor: ~/.cursor/mcp.json
122
+ {
123
+ "mcpServers": {
124
+ "fable-engine": {
125
+ "command": "python",
126
+ "args": ["-m", "fable_engine.server"]
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ Python 3.10+, zero runtime dependencies. PyPI package publishing is in progress.
133
+
134
+ <br/>
135
+
136
+ ### How it works
137
+
138
+ 1. **Think** — Time-locked deliberation. The agent cannot write until the timer ends.
139
+ 2. **Prove** — Claims need real evidence (tool receipts, hashes, invariants).
140
+ 3. **Attack** — A red-team swarm tries to break the code.
141
+ 4. **Write** — Only then is the workspace unlocked.
142
+
143
+ <br/>
144
+
145
+ ### What it is not
146
+
147
+ - Not a claim of flawless code. It is a checkable workflow, not a guarantee.
148
+ - Not a bigger prompt. The locks are enforced by the engine, not by wording.
149
+ - Not a framework lock-in. It speaks MCP and runs beside your current agent.
150
+
151
+ <br/>
152
+
153
+ ### Docs
154
+
155
+ - [V1 → V2 migration](./docs/fable-v1-v2-migration.md)
156
+ - [V2 architecture](./docs/fable-v2-architecture.md)
157
+ - [System 3 (experimental)](./docs/system3-architecture.md)
158
+
159
+ <br/>
160
+
161
+ ### Contributing
162
+
163
+ Issues and pull requests are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md).
164
+
165
+ <br/>
166
+
167
+ ---
168
+
169
+ <div align="center">
170
+
171
+ <sub>MIT License · Built by REX</sub>
172
+
173
+ </div>
@@ -0,0 +1,130 @@
1
+ <div align="center">
2
+
3
+ <br/>
4
+
5
+ <img src="./assets/logo-light-mode.svg" width="120" alt="Fable Mode"/>
6
+
7
+ # Fable Mode
8
+
9
+ **Agents that think before they write.**
10
+
11
+ <br/>
12
+
13
+ <a href="https://github.com/REX-codebase/fable-mode"><img src="https://img.shields.io/badge/python-3.10%2B-black" alt="Python 3.10+"/></a>
14
+ &nbsp;
15
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-black" alt="MIT"/></a>
16
+ &nbsp;
17
+ <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/protocol-MCP-black" alt="MCP"/></a>
18
+ &nbsp;
19
+ <img src="https://img.shields.io/badge/dependencies-0-black" alt="Zero Dependencies"/>
20
+ &nbsp;
21
+ <img src="https://img.shields.io/badge/tests-473%20passing-black" alt="473 tests passing"/>
22
+
23
+ <br/><br/>
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ <br/>
30
+
31
+ Fable Mode is an open-source control plane for AI coding agents.
32
+
33
+ It makes an agent deliberate, produce evidence, and survive adversarial review
34
+ **before** it earns permission to write to your workspace. The gates are
35
+ mechanical, not prompt advice: no timer, no proof, no write access.
36
+
37
+ <br/>
38
+
39
+ <div align="center">
40
+ <img src="./assets/flow-simple.svg" width="720" alt="Think → Prove → Attack → Write"/>
41
+ </div>
42
+
43
+ <div align="center">
44
+ <video src="https://github.com/REX-codebase/fable-mode/raw/main/assets/launch-film.mp4" width="720" controls muted loop playsinline></video>
45
+ </div>
46
+
47
+ <br/>
48
+
49
+ ### See it work
50
+
51
+ A session starts locked. Confidence does not unlock it.
52
+
53
+ ```text
54
+ >>> session = create_session('demo-refactor', budget='2 min')
55
+ state=INIT execution_locked=True can_execute_code=False
56
+
57
+ >>> session.unlock_execution('the plan looks fine, let me write code now')
58
+ PermissionError: HARD TIME-LOCK VIOLATION: Execution unlock rejected!
59
+ The immutable 2.0m authority budget has not elapsed yet
60
+ (Remaining: 1m 59s / 120.0s).
61
+ ```
62
+
63
+ The same gates guard every phase: evidence receipts for claims, a five-vector
64
+ red-team swarm for code, and a sealed record of what was verified.
65
+
66
+ <br/>
67
+
68
+ ### Install
69
+
70
+ ```bash
71
+ pip install fable-engine
72
+ ```
73
+
74
+ Point your agent at the MCP server:
75
+
76
+ ```jsonc
77
+ // Claude Code: claude mcp add fable-engine -- python -m fable_engine.server
78
+ // Cursor: ~/.cursor/mcp.json
79
+ {
80
+ "mcpServers": {
81
+ "fable-engine": {
82
+ "command": "python",
83
+ "args": ["-m", "fable_engine.server"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ Python 3.10+, zero runtime dependencies. PyPI package publishing is in progress.
90
+
91
+ <br/>
92
+
93
+ ### How it works
94
+
95
+ 1. **Think** — Time-locked deliberation. The agent cannot write until the timer ends.
96
+ 2. **Prove** — Claims need real evidence (tool receipts, hashes, invariants).
97
+ 3. **Attack** — A red-team swarm tries to break the code.
98
+ 4. **Write** — Only then is the workspace unlocked.
99
+
100
+ <br/>
101
+
102
+ ### What it is not
103
+
104
+ - Not a claim of flawless code. It is a checkable workflow, not a guarantee.
105
+ - Not a bigger prompt. The locks are enforced by the engine, not by wording.
106
+ - Not a framework lock-in. It speaks MCP and runs beside your current agent.
107
+
108
+ <br/>
109
+
110
+ ### Docs
111
+
112
+ - [V1 → V2 migration](./docs/fable-v1-v2-migration.md)
113
+ - [V2 architecture](./docs/fable-v2-architecture.md)
114
+ - [System 3 (experimental)](./docs/system3-architecture.md)
115
+
116
+ <br/>
117
+
118
+ ### Contributing
119
+
120
+ Issues and pull requests are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md).
121
+
122
+ <br/>
123
+
124
+ ---
125
+
126
+ <div align="center">
127
+
128
+ <sub>MIT License · Built by REX</sub>
129
+
130
+ </div>
@@ -0,0 +1,44 @@
1
+ # Fable V1 to V2 Migration & Integration Guide
2
+
3
+ ## Overview of Entry Points
4
+
5
+ | Entry Point | Version | Purpose |
6
+ |---|---|---|
7
+ | `fable-engine` | V1 | Main `fable_session` MCP server from `fable_engine.server` |
8
+ | `fable-v1` | V1 | Explicit alias for `fable-engine` |
9
+ | `fable-v2-broker` | V2 | Out-of-process workspace execution broker from `fable_v2.execution_broker` |
10
+
11
+ The `install.sh` and `install.ps1` scripts register the V1 `fable-engine` MCP server by default for backward compatibility with existing MCP clients. Installing the Python package (`pip install -e .`) registers the `fable-v2-broker` executable without replacing the V1 MCP server.
12
+
13
+ ---
14
+
15
+ ## V2 Execution Broker Setup
16
+
17
+ Start the V2 execution broker specifying its managed workspace:
18
+
19
+ ```bash
20
+ fable-v2-broker --workspace /path/to/workspace
21
+ ```
22
+
23
+ ### Authorization & Control Pipe
24
+ - The broker loads write authorization digest from the `FABLE_BROKER_WRITE_TOKEN_DIGEST` environment variable or `FABLE_BROKER_WRITE_TOKEN_DIGEST_FILE` file. This value is a SHA-256 digest of an administrative token.
25
+ - Unlocking write permissions requires communicating over a dedicated administrative control descriptor (`--admin-fd` on POSIX). The model-facing JSON-lines channel cannot issue unlock commands directly.
26
+ - Host integration adapters should keep administrative file descriptors isolated from model tool definitions.
27
+
28
+ ### Process & Path Restrictions
29
+ - The broker allowlists permitted executables and runs commands without shell invocation (`shell=False`).
30
+ - Working directories and file writes are constrained to the designated workspace.
31
+ - Interpreter execution is restricted while writes are locked to prevent inline write bypasses.
32
+
33
+ > **Security Note:** The broker operates as a process and policy boundary. For untrusted code execution, run the broker inside a container or sandboxed OS environment with restricted permissions.
34
+
35
+ ---
36
+
37
+ ## Migration Sequence for Hosts & Adapters
38
+
39
+ 1. **Keep V1 MCP Enabled:** Maintain the `fable-engine` MCP server active during initial adapter testing.
40
+ 2. **Launch V2 Broker:** Start `fable-v2-broker` with its dedicated workspace directory.
41
+ 3. **Probe Host Capabilities:** Query host capabilities at runtime and verify attested features.
42
+ 4. **Issue Tool Receipts:** Route V2 command executions and file operations through the broker to generate `ToolReceipt` objects.
43
+ 5. **Enforce Verification Policies:** Enable candidate finalization once verifier checks pass.
44
+ 6. **Final Transition:** Disable legacy V1 tools only after validating V2 execution broker flows in your environment.
@@ -0,0 +1,93 @@
1
+ # Fable V2: Portable Verifier-Guided Runtime
2
+
3
+ ## Goal
4
+
5
+ Fable V2 is a portable, model-agnostic intelligence runtime designed to work across AI agent hosts such as Antigravity, Claude Code, Cursor, OpenAI Codex, and others. Fable V2 aims to make coding models more reliable, consistent, and effective on verifiable software engineering tasks.
6
+
7
+ Rather than relying on unverified model assertions, Fable V2 coordinates models, tools, evidence receipts, search strategies, and verification policies.
8
+
9
+ ## Design Principle
10
+
11
+ > Do not rely on an agent's unverified claim that work was performed correctly. Require the runtime to collect execution receipts, run verification checks, and accept only evidence-backed artifacts.
12
+
13
+ MCP serves as an interface and transport layer. Fable V2 provides the runtime around it: execution broker, evidence ledger, model router, candidate manager, verifier broker, and repair loops.
14
+
15
+ ## Architecture
16
+
17
+ ```text
18
+ User task
19
+ |
20
+ v
21
+ TaskSpec: objective, constraints, done conditions, required capabilities
22
+ |
23
+ v
24
+ Budget + model router ---- host capability probe
25
+ |
26
+ v
27
+ Diverse candidate fleet ---- tools / sandbox / execution broker
28
+ |
29
+ v
30
+ ToolReceipts & Evidence integrity ledger
31
+ |
32
+ v
33
+ Deterministic verifiers -> independent model verifiers -> repair/search loop
34
+ |
35
+ v
36
+ Finalization gate: accepts only passing, evidence-backed candidates
37
+ ```
38
+
39
+ ## Portable Core and Adapters
40
+
41
+ The core speaks a host-neutral JSON data contract (`fable_v2/protocol.py`). Adapters translate native host tools into standard capabilities such as `inspect_files`, `execute_command`, `run_tests`, `search_web`, `edit_files`, and `delegate_agents`.
42
+
43
+ Supported integrations are implemented as thin adapters. MCP is the primary tool binding, while CLI or HTTP interfaces accommodate hosts without native MCP support.
44
+
45
+ ## Execution Boundary (`fable-v2-broker`)
46
+
47
+ `fable_v2.execution_broker` provides an isolated execution boundary for V2:
48
+ - Runs as a separate process (`fable-v2-broker`).
49
+ - Restricts executables via allowlists and runs commands without shell invocation.
50
+ - Constrains file operations and workspace paths.
51
+ - Keeps workspace file writes locked until administrative authorization.
52
+ - Blocks interactive interpreter bypasses while writes are locked.
53
+ - Accepts administrative unlock commands over a separate control handle (`--admin-fd` on POSIX) that is isolated from model input channels.
54
+
55
+ > **Security Note:** The broker is a process and policy boundary. Hostile or untrusted workloads should be executed within container or OS-level virtualized sandboxes with restricted permissions.
56
+
57
+ ## Enforcement Model
58
+
59
+ ### 1. Invocation Is Not Correctness
60
+ A `ToolReceipt` confirms that a tool was executed and captures its raw output hash. A successful `pytest` receipt proves test execution, but does not inherently guarantee overall solution correctness. Correctness is established by the configured `VerificationPolicy`.
61
+
62
+ ### 2. Receipt and Evidence Integrity
63
+ Each tool execution generates a `ToolReceipt` containing:
64
+ - Session and tool identifiers
65
+ - Capability classification
66
+ - Hashes of tool input and output
67
+ - Execution status and timestamps
68
+
69
+ `Evidence` is constructed from receipts using `Evidence.from_receipt(...)`. Content hashes are verified to prevent tampering or mismatched output claims.
70
+
71
+ ### 3. Policy-Enforced Verification
72
+ Finalization requires satisfying the `VerificationPolicy`:
73
+ - Verification verdicts are runtime-attested and bound to specific candidate artifact hashes.
74
+ - Verification commitments include candidate state and referenced receipt/evidence hashes.
75
+ - Deterministic checks (linters, test runners, type checkers) execute prior to model-based judges.
76
+
77
+ ## Runtime Objects (`fable_v2/protocol.py`)
78
+
79
+ - `TaskSpec`: Task contract, objectives, required capabilities, and definition of done.
80
+ - `VerificationPolicy`: Required verifier classes and passing thresholds.
81
+ - `ToolReceipt`: Invocation receipt containing input/output hashes and execution metadata.
82
+ - `Evidence`: Provenance-backed claim constructed from a valid `ToolReceipt`.
83
+ - `Candidate`: A specific solution trajectory or artifact.
84
+ - `VerificationResult`: Runtime-attested verdict bound to a candidate artifact.
85
+
86
+ ## Quality & Verification Rules
87
+
88
+ 1. **No Self-Attested Verification:** Claims must be backed by tool execution receipts.
89
+ 2. **Deterministic Before Model Verification:** Machine checks run prior to model judges.
90
+ 3. **Independent Review:** Generator and verifier components remain separate for complex tasks.
91
+ 4. **Targeted Repair:** Failed verification attempts yield structured failure classifications for targeted iteration.
92
+ 5. **Gated Finalization:** Candidate finalization requires complete receipt and policy satisfaction.
93
+ 6. **Isolated Permission Enforcer:** Workspace permissions are enforced by the execution broker/sandbox boundary.
@@ -0,0 +1,122 @@
1
+ # System 3 Meta-Cognitive Deliberation Architecture (Experimental)
2
+
3
+ ## 1. Executive Summary & Overview
4
+
5
+ Fable Mode includes an experimental **System 3 Meta-Cognitive Deliberation Engine** (`fable_v2/system3/`), designed as a research extension to dual-process agent architectures (System 1 intuitive heuristics and System 2 deliberative search).
6
+
7
+ System 3 operates above the solution generation loop. It provides tools for modeling structural causal dependencies (Pearl's do-calculus), embedding architectural tree structures into Poincaré hyperbolic space, checking modal properties across state transition models (Kripke structures), evaluating policy uncertainty via Active Inference (Variational Free Energy), checking constructive proofs (Curry-Howard isomorphism), resolving parameter trade-offs via TRIZ principles, and searching architectural trade-off spaces.
8
+
9
+ > **Note on status:** System 3 capabilities in `fable_v2/system3/` are experimental research modules. They provide specialized mathematical and logical tools accessible through the `fable_session` MCP interface or direct Python APIs.
10
+
11
+ ---
12
+
13
+ ## 2. Tri-Level Cognitive Hierarchy
14
+
15
+ ```text
16
+ ┌────────────────────────────────────────────────────────────────────────────────┐
17
+ │ SYSTEM 3: META-COGNITIVE & LOGICAL REASONING │
18
+ │ - Pearl Do-Calculus Causal Models (DAG, Interventions, Brittleness Analysis) │
19
+ │ - Poincaré Hyperbolic Manifold Embeddings (Exact Metric, Möbius Gyrovectors) │
20
+ │ - Kripke Modal Model Checker (CTL Temporal Logic: AG, EF, AF, AX, EU, AU) │
21
+ │ - Friston Active Inference (Variational F = Complexity - Accuracy, EFE G) │
22
+ │ - Gödelian Proof Oracle & Curry-Howard Constructive Type Verification │
23
+ │ - Dialectical Triad & 40 TRIZ Inventive Contradiction Resolution │
24
+ │ - Evolutionary Paradigm Engine (10D Pareto Frontier NSGA-II Optimization) │
25
+ │ - Neuro-Symbolic Invariant Induction (Empirical Falsification) │
26
+ └──────────────────────────────────────┬─────────────────────────────────────────┘
27
+ │ (Gear Arbitration)
28
+
29
+ ┌────────────────────────────────────────────────────────────────────────────────┐
30
+ │ SYSTEM 2: DELIBERATIVE REASONING │
31
+ │ - Structured Deliberation Chains & Time-Locked Execution │
32
+ │ - Adversarial Red-Teaming & Falsification Probes │
33
+ │ - Formal Invariant Modeling & Domain Specification │
34
+ │ - Continuous Rethink-Refine Loop │
35
+ └──────────────────────────────────────┬─────────────────────────────────────────┘
36
+ │ (Execution Delegation)
37
+
38
+ ┌────────────────────────────────────────────────────────────────────────────────┐
39
+ │ SYSTEM 1: INTUITIVE & PROCEDURAL EXECUTION │
40
+ │ - Fast Pattern Matching & Code Generation via Subagent Fleet │
41
+ │ - Deterministic Machine Verification & Tool Receipts │
42
+ │ - Local Error Recovery & Repair Loops │
43
+ └────────────────────────────────────────────────────────────────────────────────┘
44
+ ```
45
+
46
+ ### Cognitive Gear Arbitration
47
+
48
+ The `TriLevelArbitrator` evaluates task complexity, contradiction metrics, failure counts, and epistemic uncertainty to suggest operating gears:
49
+
50
+ 1. **`SYSTEM_1_INTUITIVE`**: Selected for low-complexity, procedural, non-conflicting tasks.
51
+ 2. **`SYSTEM_2_DELIBERATIVE`**: Selected for medium-complexity tasks requiring deep decomposition, formal invariants, and red-team review.
52
+ 3. **`SYSTEM_3_META_COGNITIVE`**: Engaged when high contradiction density or repeated test failures occur, engaging causal simulation, hyperbolic embeddings, modal checking, or proof oracles.
53
+
54
+ ---
55
+
56
+ ## 3. Hyperbolic Geometry (`fable_v2.system3.hyperbolic`)
57
+
58
+ Tree hierarchies and software dependency graphs can suffer distortion when embedded into Euclidean spaces. System 3 provides Poincaré Ball embeddings ($\mathbb{B}^n_c = \{x \in \mathbb{R}^n : c \|x\|^2 < 1\}$) to represent deep hierarchical tree structures with bounded distance metric distortion.
59
+
60
+ ---
61
+
62
+ ## 4. Kripke Modal Model Checker (`fable_v2.system3.kripke`)
63
+
64
+ System 3 implements verification of state machines and concurrent transitions using **Kripke Structures** $M = \langle W, R, L, W_0 \rangle$ and **Computation Tree Logic (CTL)**:
65
+
66
+ - **Safety Invariants ($AG \phi$):** Checks if property $\phi$ holds across all reachable states. Generates counterexample trace paths when violated.
67
+ - **Reachability ($EF \phi$):** Verifies if a desired state $\phi$ is reachable from initial states. Generates witness paths upon success.
68
+
69
+ ---
70
+
71
+ ## 5. Active Inference & Free Energy (`fable_v2.system3.free_energy`)
72
+
73
+ Implements Karl Friston's **Free Energy Principle** to model agent perception and action selection under uncertainty:
74
+
75
+ - **Variational Free Energy ($F$):** Evaluates complexity vs. accuracy metrics over hidden architectural states.
76
+ - **Expected Free Energy ($G$):** Balances pragmatic cost (goal divergence) and epistemic value (information gain) for policy selection.
77
+
78
+ ---
79
+
80
+ ## 6. Curry-Howard Proof Oracle (`fable_v2.system3.oracle`)
81
+
82
+ Bridges logical assertions and type checking via the **Curry-Howard Isomorphism** (Propositions-as-Types):
83
+
84
+ - **Type Checker:** Evaluates bidirectional type checking ($\Gamma \vdash t : T$) for constructive propositions.
85
+ - **Undecidability Detector:** Identifies circular references, cyclical negations, and self-referential paradoxes, returning classifications (`DECIDABLE_PROVED`, `DECIDABLE_REFUTED`, `INDEPENDENT_UNDECIDABLE`, `COMPLEXITY_EXCEEDED`).
86
+
87
+ ---
88
+
89
+ ## 7. Causal Simulation & Pearl's Do-Calculus (`fable_v2.system3.causal`)
90
+
91
+ - **Graph Interventions (`do(X = x)`):** Simulates structural causal graph modifications and measures counterfactual deltas.
92
+ - **Sensitivity Analysis:** Identifies single points of failure (SPOFs) and fragile nodes in dependency graphs.
93
+
94
+ ---
95
+
96
+ ## 8. Dialectical Synthesis & TRIZ Matrix (`fable_v2.system3.dialectical`)
97
+
98
+ - Maps parameter trade-offs (e.g., speed vs. safety) to TRIZ inventive principles (Segmentation, Extraction, Local Quality, Prior Action, Inversion).
99
+ - `DialecticalSynthesizer` runs bounded debate iterations to resolve contradictions.
100
+
101
+ ---
102
+
103
+ ## 9. Evolutionary Paradigm Engine (`fable_v2.system3.evolution`)
104
+
105
+ Optimizes candidate architectures across up to 10 quality dimensions (Latency, Throughput, Memory, Fault Tolerance, Modularity, Simplicity, Testability, Security, Determinism, Token Efficiency) using non-dominated sorting.
106
+
107
+ ---
108
+
109
+ ## 10. MCP Tool Integration (`fable_session`)
110
+
111
+ System 3 capabilities are exposed through `fable_session` MCP actions:
112
+
113
+ | Action | Description | Parameters |
114
+ |---|---|---|
115
+ | `system3_hyperbolic_embed` | Poincaré ball tree embedding | `tree`, `root_id`, `dimension`, `curvature` |
116
+ | `system3_kripke_verify` | Kripke model checking with CTL formulas | `worlds`, `transitions`, `formula`, `initial_world` |
117
+ | `system3_active_inference` | Variational Free Energy $F$ & EFE $G$ | `observation`, `policies`, `gamma`, `states` |
118
+ | `system3_proof_oracle` | Curry-Howard proof verification | `claim`, `context`, `axioms` |
119
+ | `system3_dialectical_synthesis` | Dialectical debate & TRIZ resolution | `thesis_title`, `antithesis_title`, `contradictions` |
120
+ | `system3_causal_simulate` | Causal DAG intervention & sensitivity | `nodes`, `edges`, `interventions`, `target_metric` |
121
+ | `system3_evolve_paradigms` | Pareto frontier genetic optimization | `generations`, `population_size`, `mutation_rate` |
122
+ | `system3_tri_level_orchestrate` | Cognitive gear arbitration | `task_complexity`, `contradiction_density`, `failure_count` |