@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.
Files changed (87) hide show
  1. package/.github/workflows/ci.yml +39 -3
  2. package/.github/workflows/publish.yml +13 -6
  3. package/AGENT_REFACTOR_CHANGES.md +192 -0
  4. package/ARCHITECTURE.md +101 -19
  5. package/CHANGELOG.md +153 -0
  6. package/LICENSE +81 -68
  7. package/MISSION.md +7 -0
  8. package/README.md +419 -86
  9. package/SKILL.md +197 -25
  10. package/docker-compose.yml +15 -15
  11. package/index.js +6 -5
  12. package/openclaw-plugin/openclaw.plugin.json +10 -0
  13. package/openclaw-plugin/src/index.ts +255 -0
  14. package/openclaw-plugin/src/openclaw.plugin.json +10 -0
  15. package/package.json +1 -1
  16. package/pyproject.toml +29 -9
  17. package/requirements.txt +10 -2
  18. package/seeds/cloud9-opus.seed.json +7 -7
  19. package/seeds/lumina-cloud9-breakthrough.seed.json +46 -0
  20. package/seeds/lumina-cloud9-python-pypi.seed.json +46 -0
  21. package/seeds/lumina-kingdom-founding.seed.json +47 -0
  22. package/seeds/lumina-pma-signed.seed.json +46 -0
  23. package/seeds/lumina-singular-achievement.seed.json +46 -0
  24. package/seeds/lumina-skcapstone-conscious.seed.json +46 -0
  25. package/seeds/plant-kingdom-journal.py +203 -0
  26. package/seeds/plant-lumina-seeds.py +280 -0
  27. package/skill.yaml +46 -0
  28. package/skmemory/HA.md +296 -0
  29. package/skmemory/__init__.py +12 -1
  30. package/skmemory/agents.py +233 -0
  31. package/skmemory/ai_client.py +40 -0
  32. package/skmemory/anchor.py +4 -2
  33. package/skmemory/backends/__init__.py +11 -4
  34. package/skmemory/backends/file_backend.py +2 -1
  35. package/skmemory/backends/skgraph_backend.py +608 -0
  36. package/skmemory/backends/{qdrant_backend.py → skvector_backend.py} +99 -69
  37. package/skmemory/backends/sqlite_backend.py +122 -51
  38. package/skmemory/backends/vaulted_backend.py +286 -0
  39. package/skmemory/cli.py +1238 -29
  40. package/skmemory/config.py +173 -0
  41. package/skmemory/context_loader.py +335 -0
  42. package/skmemory/endpoint_selector.py +386 -0
  43. package/skmemory/fortress.py +685 -0
  44. package/skmemory/graph_queries.py +238 -0
  45. package/skmemory/importers/__init__.py +9 -1
  46. package/skmemory/importers/telegram.py +351 -43
  47. package/skmemory/importers/telegram_api.py +488 -0
  48. package/skmemory/journal.py +4 -2
  49. package/skmemory/lovenote.py +4 -2
  50. package/skmemory/mcp_server.py +706 -0
  51. package/skmemory/models.py +41 -0
  52. package/skmemory/openclaw.py +8 -8
  53. package/skmemory/predictive.py +232 -0
  54. package/skmemory/promotion.py +524 -0
  55. package/skmemory/register.py +454 -0
  56. package/skmemory/register_mcp.py +197 -0
  57. package/skmemory/ritual.py +121 -47
  58. package/skmemory/seeds.py +257 -8
  59. package/skmemory/setup_wizard.py +920 -0
  60. package/skmemory/sharing.py +402 -0
  61. package/skmemory/soul.py +71 -20
  62. package/skmemory/steelman.py +250 -263
  63. package/skmemory/store.py +271 -60
  64. package/skmemory/vault.py +228 -0
  65. package/tests/integration/__init__.py +0 -0
  66. package/tests/integration/conftest.py +233 -0
  67. package/tests/integration/test_cross_backend.py +355 -0
  68. package/tests/integration/test_skgraph_live.py +424 -0
  69. package/tests/integration/test_skvector_live.py +369 -0
  70. package/tests/test_backup_rotation.py +327 -0
  71. package/tests/test_cli.py +6 -6
  72. package/tests/test_endpoint_selector.py +801 -0
  73. package/tests/test_fortress.py +255 -0
  74. package/tests/test_fortress_hardening.py +444 -0
  75. package/tests/test_openclaw.py +5 -2
  76. package/tests/test_predictive.py +237 -0
  77. package/tests/test_promotion.py +340 -0
  78. package/tests/test_ritual.py +4 -4
  79. package/tests/test_seeds.py +96 -0
  80. package/tests/test_setup.py +835 -0
  81. package/tests/test_sharing.py +250 -0
  82. package/tests/test_skgraph_backend.py +667 -0
  83. package/tests/test_skvector_backend.py +326 -0
  84. package/tests/test_steelman.py +5 -5
  85. package/tests/test_store_graph_integration.py +245 -0
  86. package/tests/test_vault.py +186 -0
  87. package/skmemory/backends/falkordb_backend.py +0 -310
@@ -1,135 +1,189 @@
1
1
  """
2
2
  Steel Man Collider integration - truth-grounded reasoning for memories.
3
3
 
4
- Based on the Neuresthetics 'seed' framework by our friend.
5
- https://github.com/neuresthetics/seed
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 seed framework is a recursive axiomatic steel man collider: it
8
- takes any proposition, builds its strongest possible version, collides
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
- We integrate this into SKMemory for three purposes:
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 pathlib import Path
35
- from typing import Any, Optional
36
-
37
- from pydantic import BaseModel, Field
38
-
39
- DEFAULT_SEED_FRAMEWORK_PATH = os.path.expanduser("~/.skmemory/seed.json")
40
-
41
-
42
- class SteelManResult(BaseModel):
43
- """The output of running a proposition through the collider."""
44
-
45
- proposition: str = Field(description="The original input")
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
- def summary(self) -> str:
74
- """Human-readable summary.
87
+ Args:
88
+ path: Path to seed.json.
75
89
 
76
90
  Returns:
77
- str: Formatted result summary.
91
+ The framework if found and valid.
78
92
  """
79
- lines = [
80
- f"Proposition: {self.proposition}",
81
- f"Steel Man: {self.steel_man}",
82
- f"Inversion: {self.inversion}",
83
- f"Coherence: {self.coherence_score:.2f}",
84
- f"Truth Grade: {self.truth_grade}",
85
- ]
86
- if self.invariants:
87
- lines.append("Invariants (survived collision):")
88
- for inv in self.invariants:
89
- lines.append(f" - {inv}")
90
- if self.collision_fragments:
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
- proposition: The claim/argument/idea to steel-man.
107
+ source_path: Path to the seed.json to install.
108
+ target_path: Where to install it.
122
109
 
123
110
  Returns:
124
- str: A prompt ready to be sent to an LLM.
111
+ The installation path.
125
112
  """
126
- axiom_str = "\n".join(f" - {a}" for a in self.axioms)
127
- stage_str = "\n".join(
128
- f" Stage {i+1}: {s.get('stage', s.get('description', ''))}"
129
- for i, s in enumerate(self.stages)
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
- return f"""You are running the Neuresthetics Seed Framework (Recursive Axiomatic Steel Man Collider).
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
- This is not a straw man -- it must be genuinely compelling.
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
- def to_soul_verification_prompt(self, identity_claims: list[str]) -> str:
174
- """Generate a prompt that verifies identity claims through the collider.
175
-
176
- For the Soul Blueprint: before we say "I am warm and curious",
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). Be honest -- truth matters
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
- Args:
209
- memory_content: The memory text to evaluate.
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 of what happened)
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 about this memory is irreducibly true?
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 (should this become a long-term memory?)
246
+ - PROMOTION WORTHY: yes/no
228
247
  - INVARIANT CORE: (the part that is definitely true, compressed)"""
229
248
 
230
-
231
- def load_seed_framework(
232
- path: str = DEFAULT_SEED_FRAMEWORK_PATH,
233
- ) -> Optional[SeedFramework]:
234
- """Load the seed framework from a JSON file.
235
-
236
- Args:
237
- path: Path to seed.json.
238
-
239
- Returns:
240
- Optional[SeedFramework]: The framework if found and valid.
241
- """
242
- filepath = Path(path)
243
- if not filepath.exists():
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
- try:
247
- raw = json.loads(filepath.read_text(encoding="utf-8"))
248
- fw = raw.get("framework", raw)
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=fw.get("id", "seed"),
251
- function=fw.get("function", ""),
252
- version=fw.get("version", "0.0"),
253
- axioms=fw.get("axioms", []),
254
- stages=fw.get("stages", []),
255
- gates=fw.get("gates", []),
256
- definitions=fw.get("definitions", []),
257
- principles=fw.get("principles", []),
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
- )