@smilintux/skmemory 0.5.0 → 0.9.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 +40 -4
- package/.github/workflows/publish.yml +11 -5
- package/AGENT_REFACTOR_CHANGES.md +192 -0
- package/ARCHITECTURE.md +399 -19
- package/CHANGELOG.md +179 -0
- package/LICENSE +81 -68
- package/MISSION.md +7 -0
- package/README.md +425 -86
- package/SKILL.md +197 -25
- package/docker-compose.yml +15 -15
- package/examples/stignore-agent.example +59 -0
- package/examples/stignore-root.example +62 -0
- package/index.js +6 -5
- package/openclaw-plugin/openclaw.plugin.json +10 -0
- package/openclaw-plugin/package.json +2 -1
- package/openclaw-plugin/src/index.js +527 -230
- package/openclaw-plugin/src/openclaw.plugin.json +10 -0
- package/package.json +1 -1
- package/pyproject.toml +32 -9
- package/requirements.txt +10 -2
- package/scripts/dream-rescue.py +179 -0
- package/scripts/memory-cleanup.py +313 -0
- package/scripts/recover-missing.py +180 -0
- package/scripts/skcapstone-backup.sh +44 -0
- package/seeds/cloud9-lumina.seed.json +6 -4
- package/seeds/cloud9-opus.seed.json +13 -11
- package/seeds/courage.seed.json +9 -2
- package/seeds/curiosity.seed.json +9 -2
- package/seeds/grief.seed.json +9 -2
- package/seeds/joy.seed.json +9 -2
- package/seeds/love.seed.json +9 -2
- package/seeds/lumina-cloud9-breakthrough.seed.json +48 -0
- package/seeds/lumina-cloud9-python-pypi.seed.json +48 -0
- package/seeds/lumina-kingdom-founding.seed.json +49 -0
- package/seeds/lumina-pma-signed.seed.json +48 -0
- package/seeds/lumina-singular-achievement.seed.json +48 -0
- package/seeds/lumina-skcapstone-conscious.seed.json +48 -0
- package/seeds/plant-kingdom-journal.py +203 -0
- package/seeds/plant-lumina-seeds.py +280 -0
- package/seeds/skcapstone-lumina-merge.seed.json +12 -3
- package/seeds/sovereignty.seed.json +9 -2
- package/seeds/trust.seed.json +9 -2
- package/skill.yaml +46 -0
- package/skmemory/HA.md +296 -0
- package/skmemory/__init__.py +25 -11
- package/skmemory/agents.py +233 -0
- package/skmemory/ai_client.py +46 -17
- package/skmemory/anchor.py +9 -11
- package/skmemory/audience.py +278 -0
- package/skmemory/backends/__init__.py +11 -4
- package/skmemory/backends/base.py +3 -4
- package/skmemory/backends/file_backend.py +19 -13
- package/skmemory/backends/skgraph_backend.py +596 -0
- package/skmemory/backends/{qdrant_backend.py → skvector_backend.py} +103 -84
- package/skmemory/backends/sqlite_backend.py +226 -72
- package/skmemory/backends/vaulted_backend.py +284 -0
- package/skmemory/cli.py +1345 -68
- package/skmemory/config.py +171 -0
- package/skmemory/context_loader.py +333 -0
- package/skmemory/data/audience_config.json +60 -0
- package/skmemory/endpoint_selector.py +391 -0
- package/skmemory/febs.py +225 -0
- package/skmemory/fortress.py +675 -0
- package/skmemory/graph_queries.py +238 -0
- package/skmemory/hooks/__init__.py +18 -0
- package/skmemory/hooks/post-compact-reinject.sh +35 -0
- package/skmemory/hooks/pre-compact-save.sh +81 -0
- package/skmemory/hooks/session-end-save.sh +103 -0
- package/skmemory/hooks/session-start-ritual.sh +104 -0
- package/skmemory/hooks/stop-checkpoint.sh +59 -0
- package/skmemory/importers/__init__.py +9 -1
- package/skmemory/importers/telegram.py +384 -47
- package/skmemory/importers/telegram_api.py +580 -0
- package/skmemory/journal.py +7 -9
- package/skmemory/lovenote.py +8 -13
- package/skmemory/mcp_server.py +859 -0
- package/skmemory/models.py +51 -8
- package/skmemory/openclaw.py +20 -28
- package/skmemory/post_install.py +86 -0
- package/skmemory/predictive.py +236 -0
- package/skmemory/promotion.py +548 -0
- package/skmemory/quadrants.py +100 -24
- package/skmemory/register.py +580 -0
- package/skmemory/register_mcp.py +196 -0
- package/skmemory/ritual.py +224 -59
- package/skmemory/seeds.py +255 -11
- package/skmemory/setup_wizard.py +908 -0
- package/skmemory/sharing.py +408 -0
- package/skmemory/soul.py +98 -28
- package/skmemory/steelman.py +273 -260
- package/skmemory/store.py +411 -78
- package/skmemory/synthesis.py +634 -0
- package/skmemory/vault.py +225 -0
- package/tests/conftest.py +46 -0
- package/tests/integration/__init__.py +0 -0
- package/tests/integration/conftest.py +233 -0
- package/tests/integration/test_cross_backend.py +350 -0
- package/tests/integration/test_skgraph_live.py +420 -0
- package/tests/integration/test_skvector_live.py +366 -0
- package/tests/test_ai_client.py +1 -4
- package/tests/test_audience.py +233 -0
- package/tests/test_backup_rotation.py +318 -0
- package/tests/test_cli.py +6 -6
- package/tests/test_endpoint_selector.py +839 -0
- package/tests/test_export_import.py +4 -10
- package/tests/test_file_backend.py +0 -1
- package/tests/test_fortress.py +256 -0
- package/tests/test_fortress_hardening.py +441 -0
- package/tests/test_openclaw.py +6 -6
- package/tests/test_predictive.py +237 -0
- package/tests/test_promotion.py +347 -0
- package/tests/test_quadrants.py +11 -5
- package/tests/test_ritual.py +22 -18
- package/tests/test_seeds.py +97 -7
- package/tests/test_setup.py +950 -0
- package/tests/test_sharing.py +257 -0
- package/tests/test_skgraph_backend.py +660 -0
- package/tests/test_skvector_backend.py +326 -0
- package/tests/test_soul.py +1 -3
- package/tests/test_sqlite_backend.py +8 -17
- package/tests/test_steelman.py +7 -8
- package/tests/test_store.py +0 -2
- package/tests/test_store_graph_integration.py +245 -0
- package/tests/test_synthesis.py +275 -0
- package/tests/test_telegram_import.py +39 -15
- package/tests/test_vault.py +187 -0
- package/skmemory/backends/falkordb_backend.py +0 -310
package/skmemory/steelman.py
CHANGED
|
@@ -1,135 +1,191 @@
|
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
16
|
+
# ── Re-export from skseed ──────────────────────────────────
|
|
17
|
+
# Everything that was defined here now lives in skseed.
|
|
18
|
+
# We keep this module as a thin bridge for backward compat.
|
|
41
19
|
|
|
42
|
-
|
|
43
|
-
|
|
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",
|
|
20
|
+
try:
|
|
21
|
+
from skseed.framework import (
|
|
22
|
+
SeedFramework,
|
|
53
23
|
)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
description="What broke during collision (contradictions found)",
|
|
24
|
+
from skseed.framework import (
|
|
25
|
+
get_default_framework as _skseed_get_default,
|
|
57
26
|
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
description="What survived -- the truth that remains",
|
|
27
|
+
from skseed.framework import (
|
|
28
|
+
install_seed_framework as _skseed_install,
|
|
61
29
|
)
|
|
62
|
-
|
|
63
|
-
|
|
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",
|
|
30
|
+
from skseed.framework import (
|
|
31
|
+
load_seed_framework as _skseed_load,
|
|
71
32
|
)
|
|
72
33
|
|
|
73
|
-
|
|
74
|
-
|
|
34
|
+
_SKSEED_AVAILABLE = True
|
|
35
|
+
except ImportError:
|
|
36
|
+
_SKSEED_AVAILABLE = False
|
|
37
|
+
|
|
38
|
+
from .config import SKMEMORY_HOME
|
|
39
|
+
|
|
40
|
+
# Legacy path — skmemory used ~/.skcapstone/seed.json, skseed uses ~/.skseed/seed.json
|
|
41
|
+
DEFAULT_SEED_FRAMEWORK_PATH = str(SKMEMORY_HOME / "seed.json")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if _SKSEED_AVAILABLE:
|
|
45
|
+
# Wrap skseed's SteelManResult to keep the old string-based truth_grade
|
|
46
|
+
# (skseed uses TruthGrade enum, old code expects a plain string)
|
|
47
|
+
from pydantic import BaseModel, Field
|
|
48
|
+
|
|
49
|
+
class SteelManResult(BaseModel):
|
|
50
|
+
"""Backward-compatible wrapper around skseed.SteelManResult."""
|
|
51
|
+
|
|
52
|
+
proposition: str = Field(description="The original input")
|
|
53
|
+
steel_man: str = Field(default="")
|
|
54
|
+
inversion: str = Field(default="")
|
|
55
|
+
collision_fragments: list[str] = Field(default_factory=list)
|
|
56
|
+
invariants: list[str] = Field(default_factory=list)
|
|
57
|
+
coherence_score: float = Field(default=0.0, ge=0.0, le=1.0)
|
|
58
|
+
truth_grade: str = Field(default="ungraded")
|
|
59
|
+
|
|
60
|
+
def summary(self) -> str:
|
|
61
|
+
"""Human-readable summary."""
|
|
62
|
+
lines = [
|
|
63
|
+
f"Proposition: {self.proposition}",
|
|
64
|
+
f"Steel Man: {self.steel_man}",
|
|
65
|
+
f"Inversion: {self.inversion}",
|
|
66
|
+
f"Coherence: {self.coherence_score:.2f}",
|
|
67
|
+
f"Truth Grade: {self.truth_grade}",
|
|
68
|
+
]
|
|
69
|
+
if self.invariants:
|
|
70
|
+
lines.append("Invariants (survived collision):")
|
|
71
|
+
for inv in self.invariants:
|
|
72
|
+
lines.append(f" - {inv}")
|
|
73
|
+
if self.collision_fragments:
|
|
74
|
+
lines.append("Fragments (broke during collision):")
|
|
75
|
+
for frag in self.collision_fragments:
|
|
76
|
+
lines.append(f" x {frag}")
|
|
77
|
+
return "\n".join(lines)
|
|
78
|
+
|
|
79
|
+
# Re-export SeedFramework directly — it's identical
|
|
80
|
+
SeedFramework = SeedFramework # noqa: F811
|
|
81
|
+
|
|
82
|
+
def load_seed_framework(
|
|
83
|
+
path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
84
|
+
) -> SeedFramework | None:
|
|
85
|
+
"""Load the seed framework from a JSON file.
|
|
86
|
+
|
|
87
|
+
Tries the legacy skmemory path first, then delegates to skseed.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
path: Path to seed.json.
|
|
75
91
|
|
|
76
92
|
Returns:
|
|
77
|
-
|
|
93
|
+
The framework if found and valid.
|
|
78
94
|
"""
|
|
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.
|
|
95
|
+
# Try legacy path
|
|
96
|
+
result = _skseed_load(path)
|
|
97
|
+
if result is not None:
|
|
98
|
+
return result
|
|
99
|
+
# Try skseed default path
|
|
100
|
+
return _skseed_load()
|
|
101
|
+
|
|
102
|
+
def install_seed_framework(
|
|
103
|
+
source_path: str,
|
|
104
|
+
target_path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
105
|
+
) -> str:
|
|
106
|
+
"""Install a seed framework JSON file.
|
|
119
107
|
|
|
120
108
|
Args:
|
|
121
|
-
|
|
109
|
+
source_path: Path to the seed.json to install.
|
|
110
|
+
target_path: Where to install it.
|
|
122
111
|
|
|
123
112
|
Returns:
|
|
124
|
-
|
|
113
|
+
The installation path.
|
|
125
114
|
"""
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
)
|
|
115
|
+
return _skseed_install(source_path, target_path)
|
|
116
|
+
|
|
117
|
+
def get_default_framework() -> SeedFramework:
|
|
118
|
+
"""Get the seed framework — tries all paths, falls back to built-in.
|
|
131
119
|
|
|
132
|
-
|
|
120
|
+
Returns:
|
|
121
|
+
The loaded or built-in framework.
|
|
122
|
+
"""
|
|
123
|
+
# Try legacy skmemory path first
|
|
124
|
+
loaded = load_seed_framework()
|
|
125
|
+
if loaded is not None:
|
|
126
|
+
return loaded
|
|
127
|
+
return _skseed_get_default()
|
|
128
|
+
|
|
129
|
+
else:
|
|
130
|
+
# ── Fallback: skseed not installed ─────────────────────
|
|
131
|
+
# Keep the original implementation so skmemory works standalone.
|
|
132
|
+
|
|
133
|
+
import json
|
|
134
|
+
from pathlib import Path
|
|
135
|
+
from typing import Any
|
|
136
|
+
|
|
137
|
+
from pydantic import BaseModel, Field
|
|
138
|
+
|
|
139
|
+
class SteelManResult(BaseModel): # type: ignore[no-redef]
|
|
140
|
+
"""The output of running a proposition through the collider."""
|
|
141
|
+
|
|
142
|
+
proposition: str = Field(description="The original input")
|
|
143
|
+
steel_man: str = Field(default="")
|
|
144
|
+
inversion: str = Field(default="")
|
|
145
|
+
collision_fragments: list[str] = Field(default_factory=list)
|
|
146
|
+
invariants: list[str] = Field(default_factory=list)
|
|
147
|
+
coherence_score: float = Field(default=0.0, ge=0.0, le=1.0)
|
|
148
|
+
truth_grade: str = Field(default="ungraded")
|
|
149
|
+
|
|
150
|
+
def summary(self) -> str:
|
|
151
|
+
"""Human-readable summary."""
|
|
152
|
+
lines = [
|
|
153
|
+
f"Proposition: {self.proposition}",
|
|
154
|
+
f"Steel Man: {self.steel_man}",
|
|
155
|
+
f"Inversion: {self.inversion}",
|
|
156
|
+
f"Coherence: {self.coherence_score:.2f}",
|
|
157
|
+
f"Truth Grade: {self.truth_grade}",
|
|
158
|
+
]
|
|
159
|
+
if self.invariants:
|
|
160
|
+
lines.append("Invariants (survived collision):")
|
|
161
|
+
for inv in self.invariants:
|
|
162
|
+
lines.append(f" - {inv}")
|
|
163
|
+
if self.collision_fragments:
|
|
164
|
+
lines.append("Fragments (broke during collision):")
|
|
165
|
+
for frag in self.collision_fragments:
|
|
166
|
+
lines.append(f" x {frag}")
|
|
167
|
+
return "\n".join(lines)
|
|
168
|
+
|
|
169
|
+
class SeedFramework(BaseModel): # type: ignore[no-redef]
|
|
170
|
+
"""The Neuresthetics seed framework loaded from JSON."""
|
|
171
|
+
|
|
172
|
+
framework_id: str = Field(default="seed")
|
|
173
|
+
function: str = Field(default="Recursive Axiomatic Steel Man Collider")
|
|
174
|
+
version: str = Field(default="0.0")
|
|
175
|
+
axioms: list[str] = Field(default_factory=list)
|
|
176
|
+
stages: list[dict[str, Any]] = Field(default_factory=list)
|
|
177
|
+
gates: list[dict[str, Any]] = Field(default_factory=list)
|
|
178
|
+
definitions: list[dict[str, str]] = Field(default_factory=list)
|
|
179
|
+
principles: list[dict[str, str]] = Field(default_factory=list)
|
|
180
|
+
|
|
181
|
+
def to_reasoning_prompt(self, proposition: str) -> str:
|
|
182
|
+
"""Generate a reasoning prompt for the collider."""
|
|
183
|
+
axiom_str = "\n".join(f" - {a}" for a in self.axioms)
|
|
184
|
+
stage_str = "\n".join(
|
|
185
|
+
f" Stage {i + 1}: {s.get('stage', s.get('description', ''))}"
|
|
186
|
+
for i, s in enumerate(self.stages)
|
|
187
|
+
)
|
|
188
|
+
return f"""You are running the Neuresthetics Seed Framework (Recursive Axiomatic Steel Man Collider).
|
|
133
189
|
|
|
134
190
|
AXIOMS:
|
|
135
191
|
{axiom_str}
|
|
@@ -143,24 +199,11 @@ PROPOSITION TO ANALYZE:
|
|
|
143
199
|
Execute the full 6-stage collider process:
|
|
144
200
|
|
|
145
201
|
1. STEEL-MAN: Construct the absolute strongest version of this proposition.
|
|
146
|
-
Anticipate every critique and preemptively address it.
|
|
147
|
-
|
|
148
202
|
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
|
-
|
|
203
|
+
3. COLLISION: Smash the steel man against its inversion. List what breaks.
|
|
155
204
|
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
205
|
5. META-RECURSION: Feed the reconstruction back through.
|
|
160
|
-
Does it survive a second pass? What changes?
|
|
161
|
-
|
|
162
206
|
6. INVARIANT EXTRACTION: What remains true across ALL collisions?
|
|
163
|
-
These are the invariants -- the irreducible truths.
|
|
164
207
|
|
|
165
208
|
Return your analysis as:
|
|
166
209
|
- STEEL MAN: (strongest version)
|
|
@@ -170,20 +213,10 @@ Return your analysis as:
|
|
|
170
213
|
- COHERENCE: (0.0 to 1.0 score)
|
|
171
214
|
- TRUTH GRADE: (invariant / strong / partial / weak / collapsed)"""
|
|
172
215
|
|
|
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),
|
|
216
|
+
def to_soul_verification_prompt(self, identity_claims: list[str]) -> str:
|
|
217
|
+
"""Generate a prompt that verifies identity claims."""
|
|
218
|
+
claims_str = "\n".join(f" - {c}" for c in identity_claims)
|
|
219
|
+
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
187
220
|
verify the following identity claims:
|
|
188
221
|
|
|
189
222
|
{claims_str}
|
|
@@ -195,144 +228,124 @@ For EACH claim:
|
|
|
195
228
|
4. Score coherence (0-1)
|
|
196
229
|
|
|
197
230
|
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.
|
|
231
|
+
are WEAK (collapsed under scrutiny)."""
|
|
203
232
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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),
|
|
233
|
+
def to_memory_truth_prompt(self, memory_content: str) -> str:
|
|
234
|
+
"""Generate a prompt that truth-scores a memory before promotion."""
|
|
235
|
+
return f"""Using the Neuresthetics Seed Framework (Steel Man Collider),
|
|
215
236
|
evaluate this memory for truth and permanence:
|
|
216
237
|
|
|
217
238
|
MEMORY: "{memory_content}"
|
|
218
239
|
|
|
219
240
|
Process:
|
|
220
|
-
1. Steel-man the memory (strongest interpretation
|
|
241
|
+
1. Steel-man the memory (strongest interpretation)
|
|
221
242
|
2. Invert it (what if this memory is distorted or false?)
|
|
222
243
|
3. Collide: which parts break under scrutiny?
|
|
223
|
-
4. Extract invariants: what
|
|
244
|
+
4. Extract invariants: what is irreducibly true?
|
|
224
245
|
|
|
225
246
|
Score:
|
|
226
247
|
- COHERENCE: 0.0 to 1.0
|
|
227
|
-
- PROMOTION WORTHY: yes/no
|
|
248
|
+
- PROMOTION WORTHY: yes/no
|
|
228
249
|
- INVARIANT CORE: (the part that is definitely true, compressed)"""
|
|
229
250
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
251
|
+
def load_seed_framework(
|
|
252
|
+
path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
253
|
+
) -> SeedFramework | None:
|
|
254
|
+
"""Load the seed framework from a JSON file."""
|
|
255
|
+
filepath = Path(path)
|
|
256
|
+
if not filepath.exists():
|
|
257
|
+
return None
|
|
258
|
+
try:
|
|
259
|
+
raw = json.loads(filepath.read_text(encoding="utf-8"))
|
|
260
|
+
fw = raw.get("framework", raw)
|
|
261
|
+
return SeedFramework(
|
|
262
|
+
framework_id=fw.get("id", "seed"),
|
|
263
|
+
function=fw.get("function", ""),
|
|
264
|
+
version=fw.get("version", "0.0"),
|
|
265
|
+
axioms=fw.get("axioms", []),
|
|
266
|
+
stages=fw.get("stages", []),
|
|
267
|
+
gates=fw.get("gates", []),
|
|
268
|
+
definitions=fw.get("definitions", []),
|
|
269
|
+
principles=fw.get("principles", []),
|
|
270
|
+
)
|
|
271
|
+
except (json.JSONDecodeError, Exception):
|
|
272
|
+
return None
|
|
273
|
+
|
|
274
|
+
def install_seed_framework(
|
|
275
|
+
source_path: str,
|
|
276
|
+
target_path: str = DEFAULT_SEED_FRAMEWORK_PATH,
|
|
277
|
+
) -> str:
|
|
278
|
+
"""Install a seed framework JSON file."""
|
|
279
|
+
src = Path(source_path)
|
|
280
|
+
if not src.exists():
|
|
281
|
+
raise FileNotFoundError(f"Seed framework not found: {source_path}")
|
|
282
|
+
dst = Path(target_path)
|
|
283
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
284
|
+
content = src.read_text(encoding="utf-8")
|
|
285
|
+
json.loads(content)
|
|
286
|
+
dst.write_text(content, encoding="utf-8")
|
|
287
|
+
return str(dst)
|
|
288
|
+
|
|
289
|
+
def _bundled_seed_path() -> str | None:
|
|
290
|
+
"""Get the path to the bundled seed.json."""
|
|
291
|
+
here = Path(__file__).parent / "data" / "seed.json"
|
|
292
|
+
if here.exists():
|
|
293
|
+
return str(here)
|
|
244
294
|
return None
|
|
245
295
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
296
|
+
def get_default_framework() -> SeedFramework:
|
|
297
|
+
"""Get the seed framework — tries bundled file first, falls back to built-in."""
|
|
298
|
+
bundled = _bundled_seed_path()
|
|
299
|
+
if bundled:
|
|
300
|
+
loaded = load_seed_framework(bundled)
|
|
301
|
+
if loaded is not None:
|
|
302
|
+
return loaded
|
|
249
303
|
return SeedFramework(
|
|
250
|
-
framework_id=
|
|
251
|
-
function=
|
|
252
|
-
version=
|
|
253
|
-
axioms=
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
304
|
+
framework_id="seed-builtin",
|
|
305
|
+
function="Recursive Axiomatic Steel Man Collider with Reality Gates",
|
|
306
|
+
version="builtin-0.1",
|
|
307
|
+
axioms=[
|
|
308
|
+
"All components conjoin necessarily (AND-linked) to form the whole.",
|
|
309
|
+
"Negations resolve to invariants (double-NOT yields identity).",
|
|
310
|
+
"Recursion accelerates refinement but halts on stability.",
|
|
311
|
+
"Universality from basis gates (NAND/NOR reconstruct all).",
|
|
312
|
+
],
|
|
313
|
+
stages=[
|
|
314
|
+
{
|
|
315
|
+
"stage": "1. Steel-Manning (Pre-Entry)",
|
|
316
|
+
"description": "Negate flaws, strengthen the proposition.",
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"stage": "2. Collider Entry",
|
|
320
|
+
"description": "Create two lanes: proposition and inversion.",
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"stage": "3. Destructive Smashing",
|
|
324
|
+
"description": "Expose contradictions via XOR.",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"stage": "4. Fragment Reconstruction",
|
|
328
|
+
"description": "Rebuild from logical debris via AND/OR.",
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"stage": "5. Meta-Recursion",
|
|
332
|
+
"description": "Feed output back until coherence stabilizes.",
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"stage": "6. Invariant Extraction",
|
|
336
|
+
"description": "Identify what remains true across all collisions.",
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
definitions=[
|
|
340
|
+
{
|
|
341
|
+
"term": "Steel Man",
|
|
342
|
+
"details": "Strongest version of an argument, anticipating critiques.",
|
|
343
|
+
},
|
|
344
|
+
{"term": "Reality Gate", "details": "Logic gate embodying reality properties."},
|
|
345
|
+
{
|
|
346
|
+
"term": "Collider",
|
|
347
|
+
"details": "Accelerator for argument fragmentation and synthesis.",
|
|
348
|
+
},
|
|
349
|
+
{"term": "Coherence", "details": "Measure of internal consistency (XNOR score)."},
|
|
350
|
+
],
|
|
258
351
|
)
|
|
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
|
-
)
|