pre-reasoning 2.5.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mia Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include pre_reasoning/checkpoints/*.safetensors
2
+ exclude checkpoints/*.pt
3
+ prune __pycache__
4
+ global-exclude *.py[cod]
5
+ global-exclude .DS_Store
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: pre-reasoning
3
+ Version: 2.5.0
4
+ Summary: 3M-parameter neural pre-reasoning engine for grounding LLMs before they answer.
5
+ Author: Luis Lozano, Dr. Shannon (Mia Labs AI co-researcher), Mia Labs
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/luislozanogmia/pre-reasoning
8
+ Keywords: reasoning,llm,graph,deterministic
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
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: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: neural
21
+ Requires-Dist: torch>=2.0.0; extra == "neural"
22
+ Requires-Dist: safetensors>=0.4.0; extra == "neural"
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # Pre-Reasoning
28
+
29
+ Pre-Reasoning is a Mia Labs structural analysis engine that grounds an LLM before it answers. It uses a 3M-parameter neural model (V3) to surface dependencies, root blockers, unlock order, parallel work, cycles, and conflicts from problem text.
30
+
31
+ The engine ships with bundled safetensors weights -- install and run, no downloads needed.
32
+
33
+ ## What It Does
34
+
35
+ Given natural-language problem text, the engine returns:
36
+
37
+ - ROOT BLOCKERS: what must be resolved first
38
+ - UNLOCK SEQUENCE: a dependency-aware resolution order
39
+ - PARALLEL WORK: independent items that can proceed now
40
+ - CYCLES: circular dependencies that cannot be solved sequentially
41
+ - CONFLICTS: competing positions or incompatible entities
42
+ - REQUIREMENTS: numeric or threshold requirements
43
+
44
+ When `torch` is not installed, the engine falls back to deterministic heuristic graph reasoning. For the best experience, install the `[neural]` extra.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install pre-reasoning # base (deterministic fallback)
50
+ pip install "pre-reasoning[neural]" # full: 3M-param V3 neural model
51
+ ```
52
+
53
+ For local development from this repo:
54
+
55
+ ```bash
56
+ pip install -e .
57
+ pip install -e ".[neural]"
58
+ ```
59
+
60
+ ## Python Usage
61
+
62
+ ```python
63
+ from pre_reasoning import analyze, pulse
64
+
65
+ result = analyze("Frontend depends on API. API depends on Auth.")
66
+ print(result["trace"])
67
+
68
+ check = pulse(
69
+ "Frontend depends on API. API depends on Auth.",
70
+ "Fix Auth first, then verify the API before frontend work."
71
+ )
72
+ print(check["status"])
73
+ ```
74
+
75
+ ## CLI Usage
76
+
77
+ ```bash
78
+ pre-reasoning "A depends on B. B depends on C."
79
+ pre-reasoning --json "CTO conflicts with senior dev."
80
+ pre-reasoning --info
81
+ ```
82
+
83
+ To use a different weights file, set `PRE_REASONING_CHECKPOINT=/path/to/weights.safetensors` or pass `--checkpoint`.
84
+
85
+ ## Results
86
+
87
+ Early comparison table, illustrative, n=5 architectural decision problems:
88
+
89
+ | Comparison | Illustrative result, n=5 |
90
+ |---|---:|
91
+ | 9B + trace vs 32B baseline | 3W 2T 0L |
92
+ | 9B + trace vs 120B baseline | 4W 1T 0L |
93
+ | 120B + trace vs 120B baseline | 3W 2T 0L |
94
+
95
+ These are product-research notes, not benchmark claims.
96
+
97
+ ## Architecture
98
+
99
+ ```text
100
+ Full install (recommended):
101
+ User text
102
+ -> V3 neural perception (3M params, safetensors)
103
+ -> neural findings converted to structural blocks
104
+ -> heuristic graph analysis
105
+ -> structural trace
106
+
107
+ Base install (fallback when torch is missing):
108
+ User text
109
+ -> deterministic text-to-blocks adapter
110
+ -> heuristic graph analysis
111
+ -> structural trace
112
+ ```
113
+
114
+ ## File Map
115
+
116
+ | Path | Purpose |
117
+ |---|---|
118
+ | `pre_reasoning/` | Installable Python package and CLI entry point |
119
+ | `pre_reasoning/inference.py` | 3M-parameter V3 neural perception layer |
120
+ | `pre_reasoning/heuristic.py` | Deterministic graph-reasoning core (fallback) |
121
+ | `pre_reasoning/pre_reasoning_v2_5.py` | v2.5 orchestrator: V3 neural + heuristic |
122
+ | `pre_reasoning/checkpoints/pre-reasoning-3m-v2.5.safetensors` | Bundled V3 weights (11MB) |
123
+ | `examples/` | Runnable usage examples |
124
+ | `tests/` | Pytest suite |
125
+ | `skill/SKILL.md` | Agent skill descriptor for model adoption |
126
+ | `CLAUDE.md` | Optional Claude Code hooks configuration |
127
+ | `WHY_TRACES_WORK.md` | Literature connection, 9 cited papers |
128
+
129
+ ## Weights Policy
130
+
131
+ The raw training checkpoint is not part of the release. The package bundles `pre_reasoning/checkpoints/pre-reasoning-3m-v2.5.safetensors`, a weights-only inference artifact. It ships no training metadata: no optimizer state, LR schedules, step counters, RNG state, training config, or raw checkpoint provenance.
132
+
133
+ ## License
134
+
135
+ MIT License. See `LICENSE`.
136
+
137
+ ## Authors
138
+
139
+ Luis Lozano and Dr. Shannon, Mia Labs' AI co-researcher, 2026.
@@ -0,0 +1,113 @@
1
+ # Pre-Reasoning
2
+
3
+ Pre-Reasoning is a Mia Labs structural analysis engine that grounds an LLM before it answers. It uses a 3M-parameter neural model (V3) to surface dependencies, root blockers, unlock order, parallel work, cycles, and conflicts from problem text.
4
+
5
+ The engine ships with bundled safetensors weights -- install and run, no downloads needed.
6
+
7
+ ## What It Does
8
+
9
+ Given natural-language problem text, the engine returns:
10
+
11
+ - ROOT BLOCKERS: what must be resolved first
12
+ - UNLOCK SEQUENCE: a dependency-aware resolution order
13
+ - PARALLEL WORK: independent items that can proceed now
14
+ - CYCLES: circular dependencies that cannot be solved sequentially
15
+ - CONFLICTS: competing positions or incompatible entities
16
+ - REQUIREMENTS: numeric or threshold requirements
17
+
18
+ When `torch` is not installed, the engine falls back to deterministic heuristic graph reasoning. For the best experience, install the `[neural]` extra.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ pip install pre-reasoning # base (deterministic fallback)
24
+ pip install "pre-reasoning[neural]" # full: 3M-param V3 neural model
25
+ ```
26
+
27
+ For local development from this repo:
28
+
29
+ ```bash
30
+ pip install -e .
31
+ pip install -e ".[neural]"
32
+ ```
33
+
34
+ ## Python Usage
35
+
36
+ ```python
37
+ from pre_reasoning import analyze, pulse
38
+
39
+ result = analyze("Frontend depends on API. API depends on Auth.")
40
+ print(result["trace"])
41
+
42
+ check = pulse(
43
+ "Frontend depends on API. API depends on Auth.",
44
+ "Fix Auth first, then verify the API before frontend work."
45
+ )
46
+ print(check["status"])
47
+ ```
48
+
49
+ ## CLI Usage
50
+
51
+ ```bash
52
+ pre-reasoning "A depends on B. B depends on C."
53
+ pre-reasoning --json "CTO conflicts with senior dev."
54
+ pre-reasoning --info
55
+ ```
56
+
57
+ To use a different weights file, set `PRE_REASONING_CHECKPOINT=/path/to/weights.safetensors` or pass `--checkpoint`.
58
+
59
+ ## Results
60
+
61
+ Early comparison table, illustrative, n=5 architectural decision problems:
62
+
63
+ | Comparison | Illustrative result, n=5 |
64
+ |---|---:|
65
+ | 9B + trace vs 32B baseline | 3W 2T 0L |
66
+ | 9B + trace vs 120B baseline | 4W 1T 0L |
67
+ | 120B + trace vs 120B baseline | 3W 2T 0L |
68
+
69
+ These are product-research notes, not benchmark claims.
70
+
71
+ ## Architecture
72
+
73
+ ```text
74
+ Full install (recommended):
75
+ User text
76
+ -> V3 neural perception (3M params, safetensors)
77
+ -> neural findings converted to structural blocks
78
+ -> heuristic graph analysis
79
+ -> structural trace
80
+
81
+ Base install (fallback when torch is missing):
82
+ User text
83
+ -> deterministic text-to-blocks adapter
84
+ -> heuristic graph analysis
85
+ -> structural trace
86
+ ```
87
+
88
+ ## File Map
89
+
90
+ | Path | Purpose |
91
+ |---|---|
92
+ | `pre_reasoning/` | Installable Python package and CLI entry point |
93
+ | `pre_reasoning/inference.py` | 3M-parameter V3 neural perception layer |
94
+ | `pre_reasoning/heuristic.py` | Deterministic graph-reasoning core (fallback) |
95
+ | `pre_reasoning/pre_reasoning_v2_5.py` | v2.5 orchestrator: V3 neural + heuristic |
96
+ | `pre_reasoning/checkpoints/pre-reasoning-3m-v2.5.safetensors` | Bundled V3 weights (11MB) |
97
+ | `examples/` | Runnable usage examples |
98
+ | `tests/` | Pytest suite |
99
+ | `skill/SKILL.md` | Agent skill descriptor for model adoption |
100
+ | `CLAUDE.md` | Optional Claude Code hooks configuration |
101
+ | `WHY_TRACES_WORK.md` | Literature connection, 9 cited papers |
102
+
103
+ ## Weights Policy
104
+
105
+ The raw training checkpoint is not part of the release. The package bundles `pre_reasoning/checkpoints/pre-reasoning-3m-v2.5.safetensors`, a weights-only inference artifact. It ships no training metadata: no optimizer state, LR schedules, step counters, RNG state, training config, or raw checkpoint provenance.
106
+
107
+ ## License
108
+
109
+ MIT License. See `LICENSE`.
110
+
111
+ ## Authors
112
+
113
+ Luis Lozano and Dr. Shannon, Mia Labs' AI co-researcher, 2026.
@@ -0,0 +1,61 @@
1
+ """Public package API for Pre-Reasoning."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+
7
+ from .pre_reasoning_v2_5 import ReasoningEngineV25
8
+
9
+ ReasoningEngine = ReasoningEngineV25
10
+
11
+ __all__ = [
12
+ "ReasoningEngineV25",
13
+ "ReasoningEngine",
14
+ "analyze",
15
+ "pulse",
16
+ "get_engine",
17
+ ]
18
+
19
+
20
+ def get_engine(
21
+ *,
22
+ checkpoint_path: Optional[str] = None,
23
+ device: str = "auto",
24
+ ) -> ReasoningEngineV25:
25
+ """Create a reasoning engine.
26
+
27
+ The package-level default is auto mode: use neural perception when the
28
+ optional dependencies are installed, otherwise fall back to deterministic
29
+ graph reasoning without torch.
30
+ """
31
+ return ReasoningEngineV25(
32
+ checkpoint_path=checkpoint_path,
33
+ device=device,
34
+ )
35
+
36
+
37
+ def analyze(
38
+ text: str,
39
+ *,
40
+ checkpoint_path: Optional[str] = None,
41
+ device: str = "auto",
42
+ ) -> dict:
43
+ """Analyze problem text and return a structural trace result."""
44
+ return get_engine(
45
+ checkpoint_path=checkpoint_path,
46
+ device=device,
47
+ ).analyze(text)
48
+
49
+
50
+ def pulse(
51
+ original_problem: str,
52
+ response: str,
53
+ *,
54
+ checkpoint_path: Optional[str] = None,
55
+ device: str = "auto",
56
+ ) -> dict:
57
+ """Check whether a draft response addresses detected root blockers."""
58
+ return get_engine(
59
+ checkpoint_path=checkpoint_path,
60
+ device=device,
61
+ ).pulse(original_problem, response)
@@ -0,0 +1 @@
1
+ """Bundled weights for optional neural perception."""
@@ -0,0 +1,9 @@
1
+ """Console entry point for Pre-Reasoning."""
2
+
3
+ from .pre_reasoning_v2_5 import main
4
+
5
+ __all__ = ["main"]
6
+
7
+
8
+ if __name__ == "__main__":
9
+ main()