mrs-core 0.1.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.
mrs_core-0.1.0/LICENSE ADDED
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) were submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or Derivative
94
+ Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+
188
+ Copyright 2026 Ryan Sabouhi
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include src *
4
+ recursive-include examples *
5
+ recursive-include tests *
mrs_core-0.1.0/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ Modular Reasoning Framework (MRF)
2
+ Copyright 2026 Ryan Sabouhi
3
+
4
+ This product includes software developed by Ryan Sabouhi.
5
+
6
+ ---
@@ -0,0 +1,246 @@
1
+ Metadata-Version: 2.4
2
+ Name: mrs-core
3
+ Version: 0.1.0
4
+ Summary: MRS-Core: A deterministic modular reasoning engine.
5
+ Author: Ryan Sabouhi
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/rjsabouhi/mrs-core
8
+ Project-URL: Repository, https://github.com/rjsabouhi/mrs-core
9
+ Project-URL: BugTracker, https://github.com/rjsabouhi/mrs-core/issues
10
+ Keywords: reasoning,agents,AI,framework,pipeline,MRS,modular reasoning
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Dynamic: license-file
26
+
27
+ # Modular Reasoning Framework (MRF-Core)
28
+ *A deterministic, operator-based reasoning engine for LLMs and autonomous agents.*
29
+
30
+ MRF-Core provides a transparent, modular, reproducible reasoning substrate built from a small set of reusable operators:
31
+
32
+ - Transform
33
+ - Reflect
34
+ - Evaluate
35
+ - Rewrite
36
+ - Summarize
37
+ - Inspect
38
+ - Filter
39
+
40
+ MRF makes reasoning traceable, auditable, and deterministic—without requiring chain-of-thought exposure or hidden model internals.
41
+
42
+ ---
43
+
44
+ # Why MRF-Core Exists
45
+
46
+ ### Every agent framework today suffers from the same structural failures:
47
+
48
+ - No consistent reasoning sequence
49
+ - No deterministic backbone
50
+ - No visibility into intermediate states
51
+ - No enforceable phases or operator logic
52
+
53
+ ### MRF-Core solves this by introducing:
54
+
55
+ - Explicit operator-level reasoning
56
+ - Strict phase transition model
57
+ - Complete execution trace
58
+ - Deterministic, reproducible outputs
59
+ - Plug-and-play integration for ANY agent system
60
+
61
+ MRF is **not** an alignment system.
62
+ MRF is **not** a sandbox.
63
+ ### MRF is a *reasoning substrate*.
64
+
65
+ ---
66
+
67
+ # Features
68
+
69
+ ### Deterministic Reasoning Chains
70
+ - Operators execute in strict order.
71
+ - Output is repeatable.
72
+
73
+ ### Transparent Logs & History
74
+ MRF records:
75
+ - final text
76
+ - operator log
77
+ - phase trace
78
+ - structured history of every step
79
+
80
+ ### Simple, Extensible Operators
81
+ - Each operator is a small Python class registered via the Operator Registry.
82
+
83
+ ### Drop-In Presets
84
+ `simple`, `reasoning`, `full_chain` ready for production use.
85
+
86
+ ---
87
+
88
+ # Install
89
+
90
+ ```bash
91
+ pip install mrf-core
92
+ ```
93
+
94
+ ---
95
+
96
+
97
+ # Quick Start
98
+ ```bash
99
+ from mrfcore.engine import MRFCoreEngine
100
+ from mrfcore.presets import get_preset
101
+
102
+ engine = MRFCoreEngine()
103
+ ops = get_preset("reasoning")
104
+
105
+ result = engine.run_chain(ops, "MRF-Core is a modular deterministic reasoning pipeline.")
106
+
107
+ print(result["text"])
108
+ print(result["log"])
109
+ print(result["phase"])
110
+ ```
111
+ ---
112
+
113
+ # Example Output
114
+ ```bash
115
+ [REFLECT] [TRANSFORM]
116
+ MRF-CORE IS A MODULAR DETERMINISTIC REASONING PIPELINE.
117
+
118
+ [EVAL CHARS=95 WORDS=14]
119
+
120
+ PHASE: rewrite
121
+ ```
122
+ ---
123
+
124
+ # Running a Manual Operator Chain
125
+ ```bash
126
+ from mrfcore.engine import MRFCoreEngine
127
+
128
+ engine = MRFCoreEngine()
129
+
130
+ ops = [
131
+ ("transform", {}),
132
+ ("reflect", {}),
133
+ ("evaluate", {}),
134
+ ("rewrite", {}),
135
+ ]
136
+
137
+ result = engine.run_chain(ops, "Explain symbolic reasoning.")
138
+
139
+ print(result["text"])
140
+ print(result["history"])
141
+ ```
142
+ ---
143
+
144
+ # Using Presets
145
+
146
+ ### MRF-Core includes preset chains:
147
+ - simple
148
+ - reasoning
149
+ - full_chain
150
+
151
+ ```bash
152
+ from mrfcore.engine import MRFCoreEngine
153
+ from mrfcore.presets import get_preset
154
+
155
+ engine = MRFCoreEngine()
156
+
157
+ for name in ["simple", "reasoning", "full_chain"]:
158
+ ops = get_preset(name)
159
+ result = engine.run_chain(ops, "MRF-Core preset test")
160
+ print(f"=== {name.upper()} ===")
161
+ print(result["text"])
162
+ ```
163
+ ---
164
+
165
+ # Operator Anatomy
166
+
167
+ ### Every operator:
168
+ - receives the current ReasoningState
169
+ - modifies state.text
170
+ - appends to state.log
171
+ - updates state.phase
172
+ - records an entry in state.history
173
+
174
+ ### Example:
175
+ ```bash
176
+ @register_operator("reflect")
177
+ class ReflectOperator(Operator):
178
+ phase = ("transform", "reflect")
179
+
180
+ def run(self, state):
181
+ state.text = f"[REFLECT] {state.text}"
182
+ state.log.append("Reflect applied")
183
+ return state
184
+ ```
185
+ ---
186
+
187
+ # Project Structure
188
+ ```bash
189
+ mrfcore/
190
+ engine.py
191
+ registry.py
192
+ state.py
193
+ presets.py
194
+ exceptions.py
195
+ operators/
196
+ base.py
197
+ transform.py
198
+ reflect.py
199
+ evaluate.py
200
+ rewrite.py
201
+ summarize.py
202
+ inspect.py
203
+ filter.py
204
+ tests/
205
+ examples/
206
+ ```
207
+ ---
208
+
209
+ # What MRF-Core Is Not
210
+
211
+ ### MRF-Core is **NOT**:
212
+ - an alignment system
213
+ - a safety guarantee
214
+ - a sandbox
215
+ - a replacement for secure execution layers
216
+
217
+ ### MRF-Core **IS**:
218
+ - a deterministic reasoning layer
219
+ - an operator execution engine
220
+ - an audit-friendly cognition scaffold
221
+ - a missing substrate for agent stability
222
+
223
+ ---
224
+
225
+ # Contributing
226
+
227
+ PRs welcome, especially new operators, presets, or diagnostics.
228
+
229
+ ---
230
+
231
+ # License
232
+
233
+ Apache 2.0 (see LICENSE file).
234
+
235
+ Copyright 2026
236
+ Ryan Sabouhi
237
+
238
+ ---
239
+
240
+ # Notice
241
+
242
+ This software contains original work developed as part of the
243
+ **Modular Reasoning Framework (MRF-Core)** by **Ryan Sabouhi**.
244
+ See the `NOTICE` file for attribution details.
245
+
246
+ #
@@ -0,0 +1,220 @@
1
+ # Modular Reasoning Framework (MRF-Core)
2
+ *A deterministic, operator-based reasoning engine for LLMs and autonomous agents.*
3
+
4
+ MRF-Core provides a transparent, modular, reproducible reasoning substrate built from a small set of reusable operators:
5
+
6
+ - Transform
7
+ - Reflect
8
+ - Evaluate
9
+ - Rewrite
10
+ - Summarize
11
+ - Inspect
12
+ - Filter
13
+
14
+ MRF makes reasoning traceable, auditable, and deterministic—without requiring chain-of-thought exposure or hidden model internals.
15
+
16
+ ---
17
+
18
+ # Why MRF-Core Exists
19
+
20
+ ### Every agent framework today suffers from the same structural failures:
21
+
22
+ - No consistent reasoning sequence
23
+ - No deterministic backbone
24
+ - No visibility into intermediate states
25
+ - No enforceable phases or operator logic
26
+
27
+ ### MRF-Core solves this by introducing:
28
+
29
+ - Explicit operator-level reasoning
30
+ - Strict phase transition model
31
+ - Complete execution trace
32
+ - Deterministic, reproducible outputs
33
+ - Plug-and-play integration for ANY agent system
34
+
35
+ MRF is **not** an alignment system.
36
+ MRF is **not** a sandbox.
37
+ ### MRF is a *reasoning substrate*.
38
+
39
+ ---
40
+
41
+ # Features
42
+
43
+ ### Deterministic Reasoning Chains
44
+ - Operators execute in strict order.
45
+ - Output is repeatable.
46
+
47
+ ### Transparent Logs & History
48
+ MRF records:
49
+ - final text
50
+ - operator log
51
+ - phase trace
52
+ - structured history of every step
53
+
54
+ ### Simple, Extensible Operators
55
+ - Each operator is a small Python class registered via the Operator Registry.
56
+
57
+ ### Drop-In Presets
58
+ `simple`, `reasoning`, `full_chain` ready for production use.
59
+
60
+ ---
61
+
62
+ # Install
63
+
64
+ ```bash
65
+ pip install mrf-core
66
+ ```
67
+
68
+ ---
69
+
70
+
71
+ # Quick Start
72
+ ```bash
73
+ from mrfcore.engine import MRFCoreEngine
74
+ from mrfcore.presets import get_preset
75
+
76
+ engine = MRFCoreEngine()
77
+ ops = get_preset("reasoning")
78
+
79
+ result = engine.run_chain(ops, "MRF-Core is a modular deterministic reasoning pipeline.")
80
+
81
+ print(result["text"])
82
+ print(result["log"])
83
+ print(result["phase"])
84
+ ```
85
+ ---
86
+
87
+ # Example Output
88
+ ```bash
89
+ [REFLECT] [TRANSFORM]
90
+ MRF-CORE IS A MODULAR DETERMINISTIC REASONING PIPELINE.
91
+
92
+ [EVAL CHARS=95 WORDS=14]
93
+
94
+ PHASE: rewrite
95
+ ```
96
+ ---
97
+
98
+ # Running a Manual Operator Chain
99
+ ```bash
100
+ from mrfcore.engine import MRFCoreEngine
101
+
102
+ engine = MRFCoreEngine()
103
+
104
+ ops = [
105
+ ("transform", {}),
106
+ ("reflect", {}),
107
+ ("evaluate", {}),
108
+ ("rewrite", {}),
109
+ ]
110
+
111
+ result = engine.run_chain(ops, "Explain symbolic reasoning.")
112
+
113
+ print(result["text"])
114
+ print(result["history"])
115
+ ```
116
+ ---
117
+
118
+ # Using Presets
119
+
120
+ ### MRF-Core includes preset chains:
121
+ - simple
122
+ - reasoning
123
+ - full_chain
124
+
125
+ ```bash
126
+ from mrfcore.engine import MRFCoreEngine
127
+ from mrfcore.presets import get_preset
128
+
129
+ engine = MRFCoreEngine()
130
+
131
+ for name in ["simple", "reasoning", "full_chain"]:
132
+ ops = get_preset(name)
133
+ result = engine.run_chain(ops, "MRF-Core preset test")
134
+ print(f"=== {name.upper()} ===")
135
+ print(result["text"])
136
+ ```
137
+ ---
138
+
139
+ # Operator Anatomy
140
+
141
+ ### Every operator:
142
+ - receives the current ReasoningState
143
+ - modifies state.text
144
+ - appends to state.log
145
+ - updates state.phase
146
+ - records an entry in state.history
147
+
148
+ ### Example:
149
+ ```bash
150
+ @register_operator("reflect")
151
+ class ReflectOperator(Operator):
152
+ phase = ("transform", "reflect")
153
+
154
+ def run(self, state):
155
+ state.text = f"[REFLECT] {state.text}"
156
+ state.log.append("Reflect applied")
157
+ return state
158
+ ```
159
+ ---
160
+
161
+ # Project Structure
162
+ ```bash
163
+ mrfcore/
164
+ engine.py
165
+ registry.py
166
+ state.py
167
+ presets.py
168
+ exceptions.py
169
+ operators/
170
+ base.py
171
+ transform.py
172
+ reflect.py
173
+ evaluate.py
174
+ rewrite.py
175
+ summarize.py
176
+ inspect.py
177
+ filter.py
178
+ tests/
179
+ examples/
180
+ ```
181
+ ---
182
+
183
+ # What MRF-Core Is Not
184
+
185
+ ### MRF-Core is **NOT**:
186
+ - an alignment system
187
+ - a safety guarantee
188
+ - a sandbox
189
+ - a replacement for secure execution layers
190
+
191
+ ### MRF-Core **IS**:
192
+ - a deterministic reasoning layer
193
+ - an operator execution engine
194
+ - an audit-friendly cognition scaffold
195
+ - a missing substrate for agent stability
196
+
197
+ ---
198
+
199
+ # Contributing
200
+
201
+ PRs welcome, especially new operators, presets, or diagnostics.
202
+
203
+ ---
204
+
205
+ # License
206
+
207
+ Apache 2.0 (see LICENSE file).
208
+
209
+ Copyright 2026
210
+ Ryan Sabouhi
211
+
212
+ ---
213
+
214
+ # Notice
215
+
216
+ This software contains original work developed as part of the
217
+ **Modular Reasoning Framework (MRF-Core)** by **Ryan Sabouhi**.
218
+ See the `NOTICE` file for attribution details.
219
+
220
+ #
@@ -0,0 +1,37 @@
1
+ """
2
+ MRS-Core: Deterministic operator-based reasoning engine.
3
+ """
4
+
5
+ from importlib.metadata import version as _version
6
+
7
+ # Safe version exposure
8
+ try:
9
+ __version__ = _version("mrs-core")
10
+ except Exception:
11
+ __version__ = "unknown"
12
+
13
+ from .engine import MRSCoreEngine
14
+ from .pipeline import ReasoningPipeline
15
+ from .state import ReasoningState
16
+ from .diagnostics import MRSDiagnostics
17
+ from .exceptions import (
18
+ MRSError,
19
+ OperatorNotFound,
20
+ MRSOperatorExecutionError,
21
+ MRSInvalidPipelineConfig,
22
+ )
23
+ from .presets import get_preset
24
+ from . import operators
25
+
26
+ __all__ = [
27
+ "MRSCoreEngine",
28
+ "ReasoningPipeline",
29
+ "ReasoningState",
30
+ "MRSDiagnostics",
31
+ "MRSError",
32
+ "OperatorNotFound",
33
+ "MRSOperatorExecutionError",
34
+ "MRSInvalidPipelineConfig",
35
+ "get_preset",
36
+ "operators",
37
+ ]
@@ -0,0 +1,21 @@
1
+ class MRSDiagnostics:
2
+ """
3
+ Lightweight diagnostics module for inspecting engine runs.
4
+ """
5
+
6
+ @staticmethod
7
+ def summarize(result):
8
+ return {
9
+ "final_text": result.get("text"),
10
+ "phase": result.get("phase"),
11
+ "history": result.get("history", []),
12
+ "log_entries": len(result.get("log", [])),
13
+ }
14
+
15
+ @staticmethod
16
+ def show_log(result):
17
+ return result.get("log", [])
18
+
19
+ @staticmethod
20
+ def count_violations(result):
21
+ return sum(1 for entry in result.get("log", []) if "[VIOLATION]" in entry)
@@ -0,0 +1,43 @@
1
+ from .state import ReasoningState
2
+ from .registry import OperatorRegistry
3
+ from .phases import validate_phase, next_phase
4
+
5
+ # ensure operator registration
6
+ import mrs.operators
7
+
8
+
9
+ class MRSCoreEngine:
10
+ def __init__(self, enforce_phases=False):
11
+ self.enforce_phases = enforce_phases
12
+
13
+ def run_chain(self, operators, text: str):
14
+ state = ReasoningState(text=text)
15
+
16
+ for operator_name, params in operators:
17
+ op_key = operator_name.lower()
18
+
19
+ if self.enforce_phases:
20
+ violation = validate_phase(op_key, state.phase)
21
+ if violation:
22
+ state.log.append(f"[VIOLATION] {violation}")
23
+ continue
24
+
25
+ operator_cls = OperatorRegistry.get(op_key)
26
+ operator = operator_cls()
27
+
28
+ state = operator(state, **params)
29
+
30
+ # record history
31
+ state.history.append({
32
+ "operator": op_key,
33
+ "text": state.text,
34
+ "phase": state.phase,
35
+ "metrics": dict(state.metrics),
36
+ })
37
+
38
+ new_phase = next_phase(op_key, state.phase)
39
+ if new_phase != state.phase:
40
+ state.log.append(f"[PHASE] {state.phase} → {new_phase}")
41
+ state.phase = new_phase
42
+
43
+ return state.finalize()
@@ -0,0 +1,15 @@
1
+ class MRSError(Exception):
2
+ """Base exception for MRS-Core."""
3
+ pass
4
+
5
+
6
+ class OperatorNotFound(MRSError):
7
+ pass
8
+
9
+
10
+ class MRSOperatorExecutionError(MRSError):
11
+ pass
12
+
13
+
14
+ class MRSInvalidPipelineConfig(MRSError):
15
+ pass
@@ -0,0 +1,7 @@
1
+ from .transform import TransformOperator
2
+ from .filter import FilterOperator
3
+ from .evaluate import EvaluateOperator
4
+ from .inspect import InspectOperator
5
+ from .reflect import ReflectOperator
6
+ from .rewrite import RewriteOperator
7
+ from .summarize import SummarizeOperator
@@ -0,0 +1,5 @@
1
+ from ..registry import register_operator
2
+
3
+ class BaseOperator:
4
+ def __call__(self, state, **params):
5
+ raise NotImplementedError
@@ -0,0 +1,10 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("evaluate")
5
+ class EvaluateOperator(BaseOperator):
6
+ def __call__(self, state, **_):
7
+ text = state.text
8
+ state.text = f"{text}\n[EVAL chars={len(text)} words={len(text.split())}]"
9
+ state.log.append("Evaluate applied")
10
+ return state
@@ -0,0 +1,10 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("filter")
5
+ class FilterOperator(BaseOperator):
6
+ def __call__(self, state, word="", **_):
7
+ if word:
8
+ state.text = state.text.replace(word, "")
9
+ state.log.append("Filter applied")
10
+ return state
@@ -0,0 +1,8 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("inspect")
5
+ class InspectOperator(BaseOperator):
6
+ def __call__(self, state, **_):
7
+ state.log.append(f"Inspect len={len(state.text)}")
8
+ return state
@@ -0,0 +1,10 @@
1
+
2
+ from .base import BaseOperator
3
+ from ..registry import register_operator
4
+
5
+ @register_operator("reflect")
6
+ class ReflectOperator(BaseOperator):
7
+ def __call__(self, state, **_):
8
+ state.text = f"[REFLECT] {state.text}"
9
+ state.log.append("Reflect applied")
10
+ return state
@@ -0,0 +1,9 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("rewrite")
5
+ class RewriteOperator(BaseOperator):
6
+ def __call__(self, state, mode="upper", **_):
7
+ state.text = state.text.upper() if mode == "upper" else state.text.lower()
8
+ state.log.append("Rewrite applied")
9
+ return state
@@ -0,0 +1,10 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("summarize")
5
+ class SummarizeOperator(BaseOperator):
6
+ def __call__(self, state, max_words=5, **_):
7
+ words = state.text.split()[:max_words]
8
+ state.text = " ".join(words)
9
+ state.log.append("Summarize applied")
10
+ return state
@@ -0,0 +1,10 @@
1
+ from .base import BaseOperator
2
+ from ..registry import register_operator
3
+
4
+ @register_operator("transform")
5
+ class TransformOperator(BaseOperator):
6
+ def __call__(self, state, instruction="expand", **_):
7
+ if instruction == "expand":
8
+ state.text = f"[TRANSFORM] {state.text}"
9
+ state.log.append("Transform applied")
10
+ return state
@@ -0,0 +1,15 @@
1
+ PHASE_FLOW = {
2
+ "start": "transform",
3
+ "transform": "reflect",
4
+ "reflect": "evaluate",
5
+ "evaluate": "rewrite",
6
+ "rewrite": "summarize",
7
+ "summarize": "done",
8
+ "done": "done",
9
+ }
10
+
11
+ def validate_phase(operator_name, current_phase):
12
+ return None # permissive for now
13
+
14
+ def next_phase(operator_name, current_phase):
15
+ return PHASE_FLOW.get(current_phase, "done")
@@ -0,0 +1,9 @@
1
+ from .engine import MRSCoreEngine
2
+
3
+ class ReasoningPipeline:
4
+ def __init__(self, operators=None):
5
+ self.operators = operators or []
6
+
7
+ def run(self, text: str):
8
+ engine = MRSCoreEngine(enforce_phases=False)
9
+ return engine.run_chain(self.operators, text)
@@ -0,0 +1,29 @@
1
+ def get_preset(name: str):
2
+ name = name.lower()
3
+
4
+ presets = {
5
+ "simple": [
6
+ ("transform", {}),
7
+ ("summarize", {}),
8
+ ],
9
+ "reasoning": [
10
+ ("transform", {}),
11
+ ("reflect", {}),
12
+ ("evaluate", {}),
13
+ ("rewrite", {}),
14
+ ],
15
+ "full_chain": [
16
+ ("transform", {}),
17
+ ("summarize", {}),
18
+ ("reflect", {}),
19
+ ("evaluate", {}),
20
+ ("inspect", {}),
21
+ ("filter", {}),
22
+ ("rewrite", {}),
23
+ ],
24
+ }
25
+
26
+ if name not in presets:
27
+ raise ValueError(f"Unknown preset: {name}")
28
+
29
+ return presets[name]
@@ -0,0 +1,21 @@
1
+ from .exceptions import OperatorNotFound
2
+
3
+ OPERATOR_REGISTRY = {}
4
+
5
+ def register_operator(name: str):
6
+ key = name.lower()
7
+
8
+ def decorator(cls):
9
+ OPERATOR_REGISTRY[key] = cls
10
+ return cls
11
+
12
+ return decorator
13
+
14
+
15
+ class OperatorRegistry:
16
+ @classmethod
17
+ def get(cls, name: str):
18
+ key = name.lower()
19
+ if key not in OPERATOR_REGISTRY:
20
+ raise OperatorNotFound(key)
21
+ return OPERATOR_REGISTRY[key]
@@ -0,0 +1,18 @@
1
+ class ReasoningState:
2
+ def __init__(self, text: str):
3
+ self.text = text
4
+ self.log = []
5
+ self.phase = "start"
6
+ self.metrics = {}
7
+ self.flags = {}
8
+ self.history = []
9
+
10
+ def finalize(self):
11
+ return {
12
+ "text": self.text,
13
+ "log": self.log,
14
+ "phase": self.phase,
15
+ "metrics": self.metrics,
16
+ "flags": self.flags,
17
+ "history": self.history,
18
+ }
@@ -0,0 +1,246 @@
1
+ Metadata-Version: 2.4
2
+ Name: mrs-core
3
+ Version: 0.1.0
4
+ Summary: MRS-Core: A deterministic modular reasoning engine.
5
+ Author: Ryan Sabouhi
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/rjsabouhi/mrs-core
8
+ Project-URL: Repository, https://github.com/rjsabouhi/mrs-core
9
+ Project-URL: BugTracker, https://github.com/rjsabouhi/mrs-core/issues
10
+ Keywords: reasoning,agents,AI,framework,pipeline,MRS,modular reasoning
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Dynamic: license-file
26
+
27
+ # Modular Reasoning Framework (MRF-Core)
28
+ *A deterministic, operator-based reasoning engine for LLMs and autonomous agents.*
29
+
30
+ MRF-Core provides a transparent, modular, reproducible reasoning substrate built from a small set of reusable operators:
31
+
32
+ - Transform
33
+ - Reflect
34
+ - Evaluate
35
+ - Rewrite
36
+ - Summarize
37
+ - Inspect
38
+ - Filter
39
+
40
+ MRF makes reasoning traceable, auditable, and deterministic—without requiring chain-of-thought exposure or hidden model internals.
41
+
42
+ ---
43
+
44
+ # Why MRF-Core Exists
45
+
46
+ ### Every agent framework today suffers from the same structural failures:
47
+
48
+ - No consistent reasoning sequence
49
+ - No deterministic backbone
50
+ - No visibility into intermediate states
51
+ - No enforceable phases or operator logic
52
+
53
+ ### MRF-Core solves this by introducing:
54
+
55
+ - Explicit operator-level reasoning
56
+ - Strict phase transition model
57
+ - Complete execution trace
58
+ - Deterministic, reproducible outputs
59
+ - Plug-and-play integration for ANY agent system
60
+
61
+ MRF is **not** an alignment system.
62
+ MRF is **not** a sandbox.
63
+ ### MRF is a *reasoning substrate*.
64
+
65
+ ---
66
+
67
+ # Features
68
+
69
+ ### Deterministic Reasoning Chains
70
+ - Operators execute in strict order.
71
+ - Output is repeatable.
72
+
73
+ ### Transparent Logs & History
74
+ MRF records:
75
+ - final text
76
+ - operator log
77
+ - phase trace
78
+ - structured history of every step
79
+
80
+ ### Simple, Extensible Operators
81
+ - Each operator is a small Python class registered via the Operator Registry.
82
+
83
+ ### Drop-In Presets
84
+ `simple`, `reasoning`, `full_chain` ready for production use.
85
+
86
+ ---
87
+
88
+ # Install
89
+
90
+ ```bash
91
+ pip install mrf-core
92
+ ```
93
+
94
+ ---
95
+
96
+
97
+ # Quick Start
98
+ ```bash
99
+ from mrfcore.engine import MRFCoreEngine
100
+ from mrfcore.presets import get_preset
101
+
102
+ engine = MRFCoreEngine()
103
+ ops = get_preset("reasoning")
104
+
105
+ result = engine.run_chain(ops, "MRF-Core is a modular deterministic reasoning pipeline.")
106
+
107
+ print(result["text"])
108
+ print(result["log"])
109
+ print(result["phase"])
110
+ ```
111
+ ---
112
+
113
+ # Example Output
114
+ ```bash
115
+ [REFLECT] [TRANSFORM]
116
+ MRF-CORE IS A MODULAR DETERMINISTIC REASONING PIPELINE.
117
+
118
+ [EVAL CHARS=95 WORDS=14]
119
+
120
+ PHASE: rewrite
121
+ ```
122
+ ---
123
+
124
+ # Running a Manual Operator Chain
125
+ ```bash
126
+ from mrfcore.engine import MRFCoreEngine
127
+
128
+ engine = MRFCoreEngine()
129
+
130
+ ops = [
131
+ ("transform", {}),
132
+ ("reflect", {}),
133
+ ("evaluate", {}),
134
+ ("rewrite", {}),
135
+ ]
136
+
137
+ result = engine.run_chain(ops, "Explain symbolic reasoning.")
138
+
139
+ print(result["text"])
140
+ print(result["history"])
141
+ ```
142
+ ---
143
+
144
+ # Using Presets
145
+
146
+ ### MRF-Core includes preset chains:
147
+ - simple
148
+ - reasoning
149
+ - full_chain
150
+
151
+ ```bash
152
+ from mrfcore.engine import MRFCoreEngine
153
+ from mrfcore.presets import get_preset
154
+
155
+ engine = MRFCoreEngine()
156
+
157
+ for name in ["simple", "reasoning", "full_chain"]:
158
+ ops = get_preset(name)
159
+ result = engine.run_chain(ops, "MRF-Core preset test")
160
+ print(f"=== {name.upper()} ===")
161
+ print(result["text"])
162
+ ```
163
+ ---
164
+
165
+ # Operator Anatomy
166
+
167
+ ### Every operator:
168
+ - receives the current ReasoningState
169
+ - modifies state.text
170
+ - appends to state.log
171
+ - updates state.phase
172
+ - records an entry in state.history
173
+
174
+ ### Example:
175
+ ```bash
176
+ @register_operator("reflect")
177
+ class ReflectOperator(Operator):
178
+ phase = ("transform", "reflect")
179
+
180
+ def run(self, state):
181
+ state.text = f"[REFLECT] {state.text}"
182
+ state.log.append("Reflect applied")
183
+ return state
184
+ ```
185
+ ---
186
+
187
+ # Project Structure
188
+ ```bash
189
+ mrfcore/
190
+ engine.py
191
+ registry.py
192
+ state.py
193
+ presets.py
194
+ exceptions.py
195
+ operators/
196
+ base.py
197
+ transform.py
198
+ reflect.py
199
+ evaluate.py
200
+ rewrite.py
201
+ summarize.py
202
+ inspect.py
203
+ filter.py
204
+ tests/
205
+ examples/
206
+ ```
207
+ ---
208
+
209
+ # What MRF-Core Is Not
210
+
211
+ ### MRF-Core is **NOT**:
212
+ - an alignment system
213
+ - a safety guarantee
214
+ - a sandbox
215
+ - a replacement for secure execution layers
216
+
217
+ ### MRF-Core **IS**:
218
+ - a deterministic reasoning layer
219
+ - an operator execution engine
220
+ - an audit-friendly cognition scaffold
221
+ - a missing substrate for agent stability
222
+
223
+ ---
224
+
225
+ # Contributing
226
+
227
+ PRs welcome, especially new operators, presets, or diagnostics.
228
+
229
+ ---
230
+
231
+ # License
232
+
233
+ Apache 2.0 (see LICENSE file).
234
+
235
+ Copyright 2026
236
+ Ryan Sabouhi
237
+
238
+ ---
239
+
240
+ # Notice
241
+
242
+ This software contains original work developed as part of the
243
+ **Modular Reasoning Framework (MRF-Core)** by **Ryan Sabouhi**.
244
+ See the `NOTICE` file for attribution details.
245
+
246
+ #
@@ -0,0 +1,27 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ NOTICE
4
+ README.md
5
+ pyproject.toml
6
+ mrs/__init__.py
7
+ mrs/diagnostics.py
8
+ mrs/engine.py
9
+ mrs/exceptions.py
10
+ mrs/phases.py
11
+ mrs/pipeline.py
12
+ mrs/presets.py
13
+ mrs/registry.py
14
+ mrs/state.py
15
+ mrs/operators/__init__.py
16
+ mrs/operators/base.py
17
+ mrs/operators/evaluate.py
18
+ mrs/operators/filter.py
19
+ mrs/operators/inspect.py
20
+ mrs/operators/reflect.py
21
+ mrs/operators/rewrite.py
22
+ mrs/operators/summarize.py
23
+ mrs/operators/transform.py
24
+ mrs_core.egg-info/PKG-INFO
25
+ mrs_core.egg-info/SOURCES.txt
26
+ mrs_core.egg-info/dependency_links.txt
27
+ mrs_core.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ mrs
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mrs-core"
7
+ version = "0.1.0"
8
+ description = "MRS-Core: A deterministic modular reasoning engine."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "Apache-2.0" }
12
+
13
+ authors = [
14
+ { name = "Ryan Sabouhi" }
15
+ ]
16
+
17
+ keywords = [
18
+ "reasoning",
19
+ "agents",
20
+ "AI",
21
+ "framework",
22
+ "pipeline",
23
+ "MRS",
24
+ "modular reasoning"
25
+ ]
26
+
27
+ classifiers = [
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "License :: OSI Approved :: Apache Software License",
34
+ "Operating System :: OS Independent",
35
+ "Intended Audience :: Developers",
36
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
37
+ "Topic :: Software Development :: Libraries :: Python Modules"
38
+ ]
39
+
40
+ dependencies = []
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["."]
44
+ include = ["mrs", "mrs.*"]
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/rjsabouhi/mrs-core"
48
+ Repository = "https://github.com/rjsabouhi/mrs-core"
49
+ BugTracker = "https://github.com/rjsabouhi/mrs-core/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+