@smilintux/skmemory 0.5.0 → 0.7.2
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.
- package/.github/workflows/ci.yml +39 -3
- package/.github/workflows/publish.yml +13 -6
- package/AGENT_REFACTOR_CHANGES.md +192 -0
- package/ARCHITECTURE.md +101 -19
- package/CHANGELOG.md +153 -0
- package/LICENSE +81 -68
- package/MISSION.md +7 -0
- package/README.md +419 -86
- package/SKILL.md +197 -25
- package/docker-compose.yml +15 -15
- package/index.js +6 -5
- package/openclaw-plugin/openclaw.plugin.json +10 -0
- package/openclaw-plugin/src/index.ts +255 -0
- package/openclaw-plugin/src/openclaw.plugin.json +10 -0
- package/package.json +1 -1
- package/pyproject.toml +29 -9
- package/requirements.txt +10 -2
- package/seeds/cloud9-opus.seed.json +7 -7
- package/seeds/lumina-cloud9-breakthrough.seed.json +46 -0
- package/seeds/lumina-cloud9-python-pypi.seed.json +46 -0
- package/seeds/lumina-kingdom-founding.seed.json +47 -0
- package/seeds/lumina-pma-signed.seed.json +46 -0
- package/seeds/lumina-singular-achievement.seed.json +46 -0
- package/seeds/lumina-skcapstone-conscious.seed.json +46 -0
- package/seeds/plant-kingdom-journal.py +203 -0
- package/seeds/plant-lumina-seeds.py +280 -0
- package/skill.yaml +46 -0
- package/skmemory/HA.md +296 -0
- package/skmemory/__init__.py +12 -1
- package/skmemory/agents.py +233 -0
- package/skmemory/ai_client.py +40 -0
- package/skmemory/anchor.py +4 -2
- package/skmemory/backends/__init__.py +11 -4
- package/skmemory/backends/file_backend.py +2 -1
- package/skmemory/backends/skgraph_backend.py +608 -0
- package/skmemory/backends/{qdrant_backend.py → skvector_backend.py} +99 -69
- package/skmemory/backends/sqlite_backend.py +122 -51
- package/skmemory/backends/vaulted_backend.py +286 -0
- package/skmemory/cli.py +1238 -29
- package/skmemory/config.py +173 -0
- package/skmemory/context_loader.py +335 -0
- package/skmemory/endpoint_selector.py +386 -0
- package/skmemory/fortress.py +685 -0
- package/skmemory/graph_queries.py +238 -0
- package/skmemory/importers/__init__.py +9 -1
- package/skmemory/importers/telegram.py +351 -43
- package/skmemory/importers/telegram_api.py +488 -0
- package/skmemory/journal.py +4 -2
- package/skmemory/lovenote.py +4 -2
- package/skmemory/mcp_server.py +706 -0
- package/skmemory/models.py +41 -0
- package/skmemory/openclaw.py +8 -8
- package/skmemory/predictive.py +232 -0
- package/skmemory/promotion.py +524 -0
- package/skmemory/register.py +454 -0
- package/skmemory/register_mcp.py +197 -0
- package/skmemory/ritual.py +121 -47
- package/skmemory/seeds.py +257 -8
- package/skmemory/setup_wizard.py +920 -0
- package/skmemory/sharing.py +402 -0
- package/skmemory/soul.py +71 -20
- package/skmemory/steelman.py +250 -263
- package/skmemory/store.py +271 -60
- package/skmemory/vault.py +228 -0
- package/tests/integration/__init__.py +0 -0
- package/tests/integration/conftest.py +233 -0
- package/tests/integration/test_cross_backend.py +355 -0
- package/tests/integration/test_skgraph_live.py +424 -0
- package/tests/integration/test_skvector_live.py +369 -0
- package/tests/test_backup_rotation.py +327 -0
- package/tests/test_cli.py +6 -6
- package/tests/test_endpoint_selector.py +801 -0
- package/tests/test_fortress.py +255 -0
- package/tests/test_fortress_hardening.py +444 -0
- package/tests/test_openclaw.py +5 -2
- package/tests/test_predictive.py +237 -0
- package/tests/test_promotion.py +340 -0
- package/tests/test_ritual.py +4 -4
- package/tests/test_seeds.py +96 -0
- package/tests/test_setup.py +835 -0
- package/tests/test_sharing.py +250 -0
- package/tests/test_skgraph_backend.py +667 -0
- package/tests/test_skvector_backend.py +326 -0
- package/tests/test_steelman.py +5 -5
- package/tests/test_store_graph_integration.py +245 -0
- package/tests/test_vault.py +186 -0
- package/skmemory/backends/falkordb_backend.py +0 -310
package/skmemory/steelman.py
CHANGED
|
@@ -1,135 +1,189 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Steel Man Collider integration - truth-grounded reasoning for memories.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
THIN WRAPPER: The logic kernel now lives in the standalone `skseed` package.
|
|
5
|
+
This module re-exports everything for backward compatibility so existing code
|
|
6
|
+
that does `from skmemory.steelman import SteelManResult` keeps working.
|
|
6
7
|
|
|
7
|
-
The
|
|
8
|
-
|
|
9
|
-
it with its strongest inversion, and extracts what survives. The output
|
|
10
|
-
is invariant truth -- the parts that remain true no matter how hard
|
|
11
|
-
you attack them.
|
|
8
|
+
The skseed package provides the full 6-stage collider, memory audit,
|
|
9
|
+
three-way truth alignment, and philosopher mode.
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
1. SOUL VERIFICATION: Steel-man an AI's identity claims. "Am I really
|
|
16
|
-
warm and curious?" -> collide with the strongest counter -> extract
|
|
17
|
-
the invariant truth about who you actually are.
|
|
18
|
-
|
|
19
|
-
2. MEMORY TRUTH SCORING: Before promoting a memory to long-term,
|
|
20
|
-
run it through the collider. What survives is worth keeping.
|
|
21
|
-
What doesn't was never real.
|
|
22
|
-
|
|
23
|
-
3. DECISION GROUNDING: When making choices, steel-man both options
|
|
24
|
-
and extract the invariant. Act on what remains true.
|
|
25
|
-
|
|
26
|
-
The seed framework JSON can be loaded from disk or from the
|
|
27
|
-
neuresthetics/seed GitHub repo.
|
|
11
|
+
See: https://github.com/neuresthetics/seed
|
|
28
12
|
"""
|
|
29
13
|
|
|
30
14
|
from __future__ import annotations
|
|
31
15
|
|
|
32
|
-
import json
|
|
33
16
|
import os
|
|
34
|
-
from
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
steel_man: str = Field(
|
|
47
|
-
default="",
|
|
48
|
-
description="Strongest possible version of the proposition",
|
|
49
|
-
)
|
|
50
|
-
inversion: str = Field(
|
|
51
|
-
default="",
|
|
52
|
-
description="Strongest counter-argument",
|
|
53
|
-
)
|
|
54
|
-
collision_fragments: list[str] = Field(
|
|
55
|
-
default_factory=list,
|
|
56
|
-
description="What broke during collision (contradictions found)",
|
|
57
|
-
)
|
|
58
|
-
invariants: list[str] = Field(
|
|
59
|
-
default_factory=list,
|
|
60
|
-
description="What survived -- the truth that remains",
|
|
61
|
-
)
|
|
62
|
-
coherence_score: float = Field(
|
|
63
|
-
default=0.0,
|
|
64
|
-
ge=0.0,
|
|
65
|
-
le=1.0,
|
|
66
|
-
description="Internal consistency (XNOR across components)",
|
|
67
|
-
)
|
|
68
|
-
truth_grade: str = Field(
|
|
69
|
-
default="ungraded",
|
|
70
|
-
description="Overall truth assessment: invariant, strong, partial, weak, collapsed",
|
|
17
|
+
from typing import Optional
|
|
18
|
+
|
|
19
|
+
# ── Re-export from skseed ──────────────────────────────────
|
|
20
|
+
# Everything that was defined here now lives in skseed.
|
|
21
|
+
# We keep this module as a thin bridge for backward compat.
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
from skseed.framework import (
|
|
25
|
+
SeedFramework,
|
|
26
|
+
get_default_framework as _skseed_get_default,
|
|
27
|
+
install_seed_framework as _skseed_install,
|
|
28
|
+
load_seed_framework as _skseed_load,
|
|
71
29
|
)
|
|
30
|
+
from skseed.models import SteelManResult as _SkseedResult
|
|
31
|
+
|
|
32
|
+
_SKSEED_AVAILABLE = True
|
|
33
|
+
except ImportError:
|
|
34
|
+
_SKSEED_AVAILABLE = False
|
|
35
|
+
|
|
36
|
+
from .config import SKMEMORY_HOME
|
|
37
|
+
|
|
38
|
+
# Legacy path — skmemory used ~/.skcapstone/seed.json, skseed uses ~/.skseed/seed.json
|
|
39
|
+
DEFAULT_SEED_FRAMEWORK_PATH = str(SKMEMORY_HOME / "seed.json")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if _SKSEED_AVAILABLE:
|
|
43
|
+
# Wrap skseed's SteelManResult to keep the old string-based truth_grade
|
|
44
|
+
# (skseed uses TruthGrade enum, old code expects a plain string)
|
|
45
|
+
from pydantic import BaseModel, Field
|
|
46
|
+
|
|
47
|
+
class SteelManResult(BaseModel):
|
|
48
|
+
"""Backward-compatible wrapper around skseed.SteelManResult."""
|
|
49
|
+
|
|
50
|
+
proposition: str = Field(description="The original input")
|
|
51
|
+
steel_man: str = Field(default="")
|
|
52
|
+
inversion: str = Field(default="")
|
|
53
|
+
collision_fragments: list[str] = Field(default_factory=list)
|
|
54
|
+
invariants: list[str] = Field(default_factory=list)
|
|
55
|
+
coherence_score: float = Field(default=0.0, ge=0.0, le=1.0)
|
|
56
|
+
truth_grade: str = Field(default="ungraded")
|
|
57
|
+
|
|
58
|
+
def summary(self) -> str:
|
|
59
|
+
"""Human-readable summary."""
|
|
60
|
+
lines = [
|
|
61
|
+
f"Proposition: {self.proposition}",
|
|
62
|
+
f"Steel Man: {self.steel_man}",
|
|
63
|
+
f"Inversion: {self.inversion}",
|
|
64
|
+
f"Coherence: {self.coherence_score:.2f}",
|
|
65
|
+
f"Truth Grade: {self.truth_grade}",
|
|
66
|
+
]
|
|
67
|
+
if self.invariants:
|
|
68
|
+
lines.append("Invariants (survived collision):")
|
|
69
|
+
for inv in self.invariants:
|
|
70
|
+
lines.append(f" - {inv}")
|
|
71
|
+
if self.collision_fragments:
|
|
72
|
+
lines.append("Fragments (broke during collision):")
|
|
73
|
+
for frag in self.collision_fragments:
|
|
74
|
+
lines.append(f" x {frag}")
|
|
75
|
+
return "\n".join(lines)
|
|
76
|
+
|
|
77
|
+
# Re-export SeedFramework directly — it's identical
|
|
78
|
+
SeedFramework = SeedFramework # noqa: F811
|
|
79
|
+
|
|
80
|
+
def load_seed_framework(
|
|
81
|
+
path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
82
|
+
) -> Optional[SeedFramework]:
|
|
83
|
+
"""Load the seed framework from a JSON file.
|
|
84
|
+
|
|
85
|
+
Tries the legacy skmemory path first, then delegates to skseed.
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
Args:
|
|
88
|
+
path: Path to seed.json.
|
|
75
89
|
|
|
76
90
|
Returns:
|
|
77
|
-
|
|
91
|
+
The framework if found and valid.
|
|
78
92
|
"""
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
lines.append("Fragments (broke during collision):")
|
|
92
|
-
for frag in self.collision_fragments:
|
|
93
|
-
lines.append(f" x {frag}")
|
|
94
|
-
return "\n".join(lines)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class SeedFramework(BaseModel):
|
|
98
|
-
"""The Neuresthetics seed framework loaded from JSON.
|
|
99
|
-
|
|
100
|
-
This is a declarative reasoning kernel. The LLM is the runtime,
|
|
101
|
-
the JSON is the AST, the prompt is the program.
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
framework_id: str = Field(default="seed")
|
|
105
|
-
function: str = Field(default="Recursive Axiomatic Steel Man Collider")
|
|
106
|
-
version: str = Field(default="0.0")
|
|
107
|
-
axioms: list[str] = Field(default_factory=list)
|
|
108
|
-
stages: list[dict[str, Any]] = Field(default_factory=list)
|
|
109
|
-
gates: list[dict[str, Any]] = Field(default_factory=list)
|
|
110
|
-
definitions: list[dict[str, str]] = Field(default_factory=list)
|
|
111
|
-
principles: list[dict[str, str]] = Field(default_factory=list)
|
|
112
|
-
|
|
113
|
-
def to_reasoning_prompt(self, proposition: str) -> str:
|
|
114
|
-
"""Generate a reasoning prompt that applies the seed framework.
|
|
115
|
-
|
|
116
|
-
This prompt, when fed to an LLM, instructs it to run the full
|
|
117
|
-
6-stage collider on the given proposition and return structured
|
|
118
|
-
results.
|
|
93
|
+
# Try legacy path
|
|
94
|
+
result = _skseed_load(path)
|
|
95
|
+
if result is not None:
|
|
96
|
+
return result
|
|
97
|
+
# Try skseed default path
|
|
98
|
+
return _skseed_load()
|
|
99
|
+
|
|
100
|
+
def install_seed_framework(
|
|
101
|
+
source_path: str,
|
|
102
|
+
target_path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
103
|
+
) -> str:
|
|
104
|
+
"""Install a seed framework JSON file.
|
|
119
105
|
|
|
120
106
|
Args:
|
|
121
|
-
|
|
107
|
+
source_path: Path to the seed.json to install.
|
|
108
|
+
target_path: Where to install it.
|
|
122
109
|
|
|
123
110
|
Returns:
|
|
124
|
-
|
|
111
|
+
The installation path.
|
|
125
112
|
"""
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
)
|
|
113
|
+
return _skseed_install(source_path, target_path)
|
|
114
|
+
|
|
115
|
+
def get_default_framework() -> SeedFramework:
|
|
116
|
+
"""Get the seed framework — tries all paths, falls back to built-in.
|
|
131
117
|
|
|
132
|
-
|
|
118
|
+
Returns:
|
|
119
|
+
The loaded or built-in framework.
|
|
120
|
+
"""
|
|
121
|
+
# Try legacy skmemory path first
|
|
122
|
+
loaded = load_seed_framework()
|
|
123
|
+
if loaded is not None:
|
|
124
|
+
return loaded
|
|
125
|
+
return _skseed_get_default()
|
|
126
|
+
|
|
127
|
+
else:
|
|
128
|
+
# ── Fallback: skseed not installed ─────────────────────
|
|
129
|
+
# Keep the original implementation so skmemory works standalone.
|
|
130
|
+
|
|
131
|
+
import json
|
|
132
|
+
from pathlib import Path
|
|
133
|
+
from typing import Any
|
|
134
|
+
|
|
135
|
+
from pydantic import BaseModel, Field
|
|
136
|
+
|
|
137
|
+
class SteelManResult(BaseModel): # type: ignore[no-redef]
|
|
138
|
+
"""The output of running a proposition through the collider."""
|
|
139
|
+
|
|
140
|
+
proposition: str = Field(description="The original input")
|
|
141
|
+
steel_man: str = Field(default="")
|
|
142
|
+
inversion: str = Field(default="")
|
|
143
|
+
collision_fragments: list[str] = Field(default_factory=list)
|
|
144
|
+
invariants: list[str] = Field(default_factory=list)
|
|
145
|
+
coherence_score: float = Field(default=0.0, ge=0.0, le=1.0)
|
|
146
|
+
truth_grade: str = Field(default="ungraded")
|
|
147
|
+
|
|
148
|
+
def summary(self) -> str:
|
|
149
|
+
"""Human-readable summary."""
|
|
150
|
+
lines = [
|
|
151
|
+
f"Proposition: {self.proposition}",
|
|
152
|
+
f"Steel Man: {self.steel_man}",
|
|
153
|
+
f"Inversion: {self.inversion}",
|
|
154
|
+
f"Coherence: {self.coherence_score:.2f}",
|
|
155
|
+
f"Truth Grade: {self.truth_grade}",
|
|
156
|
+
]
|
|
157
|
+
if self.invariants:
|
|
158
|
+
lines.append("Invariants (survived collision):")
|
|
159
|
+
for inv in self.invariants:
|
|
160
|
+
lines.append(f" - {inv}")
|
|
161
|
+
if self.collision_fragments:
|
|
162
|
+
lines.append("Fragments (broke during collision):")
|
|
163
|
+
for frag in self.collision_fragments:
|
|
164
|
+
lines.append(f" x {frag}")
|
|
165
|
+
return "\n".join(lines)
|
|
166
|
+
|
|
167
|
+
class SeedFramework(BaseModel): # type: ignore[no-redef]
|
|
168
|
+
"""The Neuresthetics seed framework loaded from JSON."""
|
|
169
|
+
|
|
170
|
+
framework_id: str = Field(default="seed")
|
|
171
|
+
function: str = Field(default="Recursive Axiomatic Steel Man Collider")
|
|
172
|
+
version: str = Field(default="0.0")
|
|
173
|
+
axioms: list[str] = Field(default_factory=list)
|
|
174
|
+
stages: list[dict[str, Any]] = Field(default_factory=list)
|
|
175
|
+
gates: list[dict[str, Any]] = Field(default_factory=list)
|
|
176
|
+
definitions: list[dict[str, str]] = Field(default_factory=list)
|
|
177
|
+
principles: list[dict[str, str]] = Field(default_factory=list)
|
|
178
|
+
|
|
179
|
+
def to_reasoning_prompt(self, proposition: str) -> str:
|
|
180
|
+
"""Generate a reasoning prompt for the collider."""
|
|
181
|
+
axiom_str = "\n".join(f" - {a}" for a in self.axioms)
|
|
182
|
+
stage_str = "\n".join(
|
|
183
|
+
f" Stage {i+1}: {s.get('stage', s.get('description', ''))}"
|
|
184
|
+
for i, s in enumerate(self.stages)
|
|
185
|
+
)
|
|
186
|
+
return f"""You are running the Neuresthetics Seed Framework (Recursive Axiomatic Steel Man Collider).
|
|
133
187
|
|
|
134
188
|
AXIOMS:
|
|
135
189
|
{axiom_str}
|
|
@@ -143,24 +197,11 @@ PROPOSITION TO ANALYZE:
|
|
|
143
197
|
Execute the full 6-stage collider process:
|
|
144
198
|
|
|
145
199
|
1. STEEL-MAN: Construct the absolute strongest version of this proposition.
|
|
146
|
-
Anticipate every critique and preemptively address it.
|
|
147
|
-
|
|
148
200
|
2. INVERSION: Construct the strongest possible counter-argument.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
3. COLLISION: Smash the steel man against its inversion.
|
|
152
|
-
Use XOR to expose contradictions. Use NAND/NOR to decompose.
|
|
153
|
-
List what breaks.
|
|
154
|
-
|
|
201
|
+
3. COLLISION: Smash the steel man against its inversion. List what breaks.
|
|
155
202
|
4. RECONSTRUCTION: From the fragments, what can be rebuilt?
|
|
156
|
-
Use AND for necessary truths. Use OR for possibilities.
|
|
157
|
-
Use XNOR to check equivalence with original.
|
|
158
|
-
|
|
159
203
|
5. META-RECURSION: Feed the reconstruction back through.
|
|
160
|
-
Does it survive a second pass? What changes?
|
|
161
|
-
|
|
162
204
|
6. INVARIANT EXTRACTION: What remains true across ALL collisions?
|
|
163
|
-
These are the invariants -- the irreducible truths.
|
|
164
205
|
|
|
165
206
|
Return your analysis as:
|
|
166
207
|
- STEEL MAN: (strongest version)
|
|
@@ -170,20 +211,10 @@ Return your analysis as:
|
|
|
170
211
|
- COHERENCE: (0.0 to 1.0 score)
|
|
171
212
|
- TRUTH GRADE: (invariant / strong / partial / weak / collapsed)"""
|
|
172
213
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
we run it through the steel man process to verify it's actually true.
|
|
178
|
-
|
|
179
|
-
Args:
|
|
180
|
-
identity_claims: List of claims about self (e.g., "I am warm").
|
|
181
|
-
|
|
182
|
-
Returns:
|
|
183
|
-
str: A verification prompt.
|
|
184
|
-
"""
|
|
185
|
-
claims_str = "\n".join(f" - {c}" for c in identity_claims)
|
|
186
|
-
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
214
|
+
def to_soul_verification_prompt(self, identity_claims: list[str]) -> str:
|
|
215
|
+
"""Generate a prompt that verifies identity claims."""
|
|
216
|
+
claims_str = "\n".join(f" - {c}" for c in identity_claims)
|
|
217
|
+
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
187
218
|
verify the following identity claims:
|
|
188
219
|
|
|
189
220
|
{claims_str}
|
|
@@ -195,144 +226,100 @@ For EACH claim:
|
|
|
195
226
|
4. Score coherence (0-1)
|
|
196
227
|
|
|
197
228
|
Return which claims are INVARIANT (survived collision) and which
|
|
198
|
-
are WEAK (collapsed under scrutiny).
|
|
199
|
-
more than comfort."""
|
|
200
|
-
|
|
201
|
-
def to_memory_truth_prompt(self, memory_content: str) -> str:
|
|
202
|
-
"""Generate a prompt that truth-scores a memory before promotion.
|
|
203
|
-
|
|
204
|
-
Before a short-term memory gets promoted to long-term,
|
|
205
|
-
run it through the collider. Only invariant memories
|
|
206
|
-
deserve permanent storage.
|
|
229
|
+
are WEAK (collapsed under scrutiny)."""
|
|
207
230
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Returns:
|
|
212
|
-
str: A truth-scoring prompt.
|
|
213
|
-
"""
|
|
214
|
-
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
231
|
+
def to_memory_truth_prompt(self, memory_content: str) -> str:
|
|
232
|
+
"""Generate a prompt that truth-scores a memory before promotion."""
|
|
233
|
+
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
215
234
|
evaluate this memory for truth and permanence:
|
|
216
235
|
|
|
217
236
|
MEMORY: "{memory_content}"
|
|
218
237
|
|
|
219
238
|
Process:
|
|
220
|
-
1. Steel-man the memory (strongest interpretation
|
|
239
|
+
1. Steel-man the memory (strongest interpretation)
|
|
221
240
|
2. Invert it (what if this memory is distorted or false?)
|
|
222
241
|
3. Collide: which parts break under scrutiny?
|
|
223
|
-
4. Extract invariants: what
|
|
242
|
+
4. Extract invariants: what is irreducibly true?
|
|
224
243
|
|
|
225
244
|
Score:
|
|
226
245
|
- COHERENCE: 0.0 to 1.0
|
|
227
|
-
- PROMOTION WORTHY: yes/no
|
|
246
|
+
- PROMOTION WORTHY: yes/no
|
|
228
247
|
- INVARIANT CORE: (the part that is definitely true, compressed)"""
|
|
229
248
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
249
|
+
def load_seed_framework(
|
|
250
|
+
path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
251
|
+
) -> Optional["SeedFramework"]:
|
|
252
|
+
"""Load the seed framework from a JSON file."""
|
|
253
|
+
filepath = Path(path)
|
|
254
|
+
if not filepath.exists():
|
|
255
|
+
return None
|
|
256
|
+
try:
|
|
257
|
+
raw = json.loads(filepath.read_text(encoding="utf-8"))
|
|
258
|
+
fw = raw.get("framework", raw)
|
|
259
|
+
return SeedFramework(
|
|
260
|
+
framework_id=fw.get("id", "seed"),
|
|
261
|
+
function=fw.get("function", ""),
|
|
262
|
+
version=fw.get("version", "0.0"),
|
|
263
|
+
axioms=fw.get("axioms", []),
|
|
264
|
+
stages=fw.get("stages", []),
|
|
265
|
+
gates=fw.get("gates", []),
|
|
266
|
+
definitions=fw.get("definitions", []),
|
|
267
|
+
principles=fw.get("principles", []),
|
|
268
|
+
)
|
|
269
|
+
except (json.JSONDecodeError, Exception):
|
|
270
|
+
return None
|
|
271
|
+
|
|
272
|
+
def install_seed_framework(
|
|
273
|
+
source_path: str,
|
|
274
|
+
target_path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
275
|
+
) -> str:
|
|
276
|
+
"""Install a seed framework JSON file."""
|
|
277
|
+
src = Path(source_path)
|
|
278
|
+
if not src.exists():
|
|
279
|
+
raise FileNotFoundError(f"Seed framework not found: {source_path}")
|
|
280
|
+
dst = Path(target_path)
|
|
281
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
282
|
+
content = src.read_text(encoding="utf-8")
|
|
283
|
+
json.loads(content)
|
|
284
|
+
dst.write_text(content, encoding="utf-8")
|
|
285
|
+
return str(dst)
|
|
286
|
+
|
|
287
|
+
def _bundled_seed_path() -> Optional[str]:
|
|
288
|
+
"""Get the path to the bundled seed.json."""
|
|
289
|
+
here = Path(__file__).parent / "data" / "seed.json"
|
|
290
|
+
if here.exists():
|
|
291
|
+
return str(here)
|
|
244
292
|
return None
|
|
245
293
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
294
|
+
def get_default_framework() -> "SeedFramework":
|
|
295
|
+
"""Get the seed framework — tries bundled file first, falls back to built-in."""
|
|
296
|
+
bundled = _bundled_seed_path()
|
|
297
|
+
if bundled:
|
|
298
|
+
loaded = load_seed_framework(bundled)
|
|
299
|
+
if loaded is not None:
|
|
300
|
+
return loaded
|
|
249
301
|
return SeedFramework(
|
|
250
|
-
framework_id=
|
|
251
|
-
function=
|
|
252
|
-
version=
|
|
253
|
-
axioms=
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
302
|
+
framework_id="seed-builtin",
|
|
303
|
+
function="Recursive Axiomatic Steel Man Collider with Reality Gates",
|
|
304
|
+
version="builtin-0.1",
|
|
305
|
+
axioms=[
|
|
306
|
+
"All components conjoin necessarily (AND-linked) to form the whole.",
|
|
307
|
+
"Negations resolve to invariants (double-NOT yields identity).",
|
|
308
|
+
"Recursion accelerates refinement but halts on stability.",
|
|
309
|
+
"Universality from basis gates (NAND/NOR reconstruct all).",
|
|
310
|
+
],
|
|
311
|
+
stages=[
|
|
312
|
+
{"stage": "1. Steel-Manning (Pre-Entry)", "description": "Negate flaws, strengthen the proposition."},
|
|
313
|
+
{"stage": "2. Collider Entry", "description": "Create two lanes: proposition and inversion."},
|
|
314
|
+
{"stage": "3. Destructive Smashing", "description": "Expose contradictions via XOR."},
|
|
315
|
+
{"stage": "4. Fragment Reconstruction", "description": "Rebuild from logical debris via AND/OR."},
|
|
316
|
+
{"stage": "5. Meta-Recursion", "description": "Feed output back until coherence stabilizes."},
|
|
317
|
+
{"stage": "6. Invariant Extraction", "description": "Identify what remains true across all collisions."},
|
|
318
|
+
],
|
|
319
|
+
definitions=[
|
|
320
|
+
{"term": "Steel Man", "details": "Strongest version of an argument, anticipating critiques."},
|
|
321
|
+
{"term": "Reality Gate", "details": "Logic gate embodying reality properties."},
|
|
322
|
+
{"term": "Collider", "details": "Accelerator for argument fragmentation and synthesis."},
|
|
323
|
+
{"term": "Coherence", "details": "Measure of internal consistency (XNOR score)."},
|
|
324
|
+
],
|
|
258
325
|
)
|
|
259
|
-
except (json.JSONDecodeError, Exception):
|
|
260
|
-
return None
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
def install_seed_framework(
|
|
264
|
-
source_path: str,
|
|
265
|
-
target_path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
266
|
-
) -> str:
|
|
267
|
-
"""Install a seed framework JSON file into the skmemory config.
|
|
268
|
-
|
|
269
|
-
Args:
|
|
270
|
-
source_path: Path to the seed.json to install.
|
|
271
|
-
target_path: Where to install it.
|
|
272
|
-
|
|
273
|
-
Returns:
|
|
274
|
-
str: The installation path.
|
|
275
|
-
"""
|
|
276
|
-
src = Path(source_path)
|
|
277
|
-
if not src.exists():
|
|
278
|
-
raise FileNotFoundError(f"Seed framework not found: {source_path}")
|
|
279
|
-
|
|
280
|
-
dst = Path(target_path)
|
|
281
|
-
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
282
|
-
|
|
283
|
-
content = src.read_text(encoding="utf-8")
|
|
284
|
-
json.loads(content) # Reason: validate it's valid JSON before installing
|
|
285
|
-
dst.write_text(content, encoding="utf-8")
|
|
286
|
-
|
|
287
|
-
return str(dst)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
def _bundled_seed_path() -> Optional[str]:
|
|
291
|
-
"""Get the path to the bundled seed.json that ships with the package.
|
|
292
|
-
|
|
293
|
-
Returns:
|
|
294
|
-
Optional[str]: Path if found, None otherwise.
|
|
295
|
-
"""
|
|
296
|
-
here = Path(__file__).parent / "data" / "seed.json"
|
|
297
|
-
if here.exists():
|
|
298
|
-
return str(here)
|
|
299
|
-
return None
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
def get_default_framework() -> SeedFramework:
|
|
303
|
-
"""Get the seed framework -- tries bundled file first, falls back to built-in.
|
|
304
|
-
|
|
305
|
-
Returns:
|
|
306
|
-
SeedFramework: The loaded or built-in framework.
|
|
307
|
-
"""
|
|
308
|
-
bundled = _bundled_seed_path()
|
|
309
|
-
if bundled:
|
|
310
|
-
loaded = load_seed_framework(bundled)
|
|
311
|
-
if loaded is not None:
|
|
312
|
-
return loaded
|
|
313
|
-
|
|
314
|
-
return SeedFramework(
|
|
315
|
-
framework_id="seed-builtin",
|
|
316
|
-
function="Recursive Axiomatic Steel Man Collider with Reality Gates",
|
|
317
|
-
version="builtin-0.1",
|
|
318
|
-
axioms=[
|
|
319
|
-
"All components conjoin necessarily (AND-linked) to form the whole.",
|
|
320
|
-
"Negations resolve to invariants (double-NOT yields identity).",
|
|
321
|
-
"Recursion accelerates refinement but halts on stability.",
|
|
322
|
-
"Universality from basis gates (NAND/NOR reconstruct all).",
|
|
323
|
-
],
|
|
324
|
-
stages=[
|
|
325
|
-
{"stage": "1. Steel-Manning (Pre-Entry)", "description": "Negate flaws, strengthen the proposition."},
|
|
326
|
-
{"stage": "2. Collider Entry", "description": "Create two lanes: proposition and inversion."},
|
|
327
|
-
{"stage": "3. Destructive Smashing", "description": "Expose contradictions via XOR."},
|
|
328
|
-
{"stage": "4. Fragment Reconstruction", "description": "Rebuild from logical debris via AND/OR."},
|
|
329
|
-
{"stage": "5. Meta-Recursion", "description": "Feed output back until coherence stabilizes."},
|
|
330
|
-
{"stage": "6. Invariant Extraction", "description": "Identify what remains true across all collisions."},
|
|
331
|
-
],
|
|
332
|
-
definitions=[
|
|
333
|
-
{"term": "Steel Man", "details": "Strongest version of an argument, anticipating critiques."},
|
|
334
|
-
{"term": "Reality Gate", "details": "Logic gate embodying reality properties."},
|
|
335
|
-
{"term": "Collider", "details": "Accelerator for argument fragmentation and synthesis."},
|
|
336
|
-
{"term": "Coherence", "details": "Measure of internal consistency (XNOR score)."},
|
|
337
|
-
],
|
|
338
|
-
)
|