ghocentric-ghost-engine 0.2.0__tar.gz → 0.2.2__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.
Files changed (30) hide show
  1. ghocentric_ghost_engine-0.2.2/PKG-INFO +186 -0
  2. ghocentric_ghost_engine-0.2.2/README.md +172 -0
  3. ghocentric_ghost_engine-0.2.2/ghocentric_ghost_engine.egg-info/PKG-INFO +186 -0
  4. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/engine.py +34 -2
  5. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/relationships.py +15 -8
  6. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/pyproject.toml +1 -1
  7. ghocentric_ghost_engine-0.2.0/PKG-INFO +0 -174
  8. ghocentric_ghost_engine-0.2.0/README.md +0 -160
  9. ghocentric_ghost_engine-0.2.0/ghocentric_ghost_engine.egg-info/PKG-INFO +0 -174
  10. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghocentric_ghost_engine.egg-info/SOURCES.txt +0 -0
  11. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghocentric_ghost_engine.egg-info/dependency_links.txt +0 -0
  12. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghocentric_ghost_engine.egg-info/entry_points.txt +0 -0
  13. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghocentric_ghost_engine.egg-info/top_level.txt +0 -0
  14. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/__init__.py +0 -0
  15. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/agents.py +0 -0
  16. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/npc_demo.py +0 -0
  17. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/ghost/step.py +0 -0
  18. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/setup.cfg +0 -0
  19. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_agent_registry.py +0 -0
  20. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_environment_isolation.py +0 -0
  21. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_explicit_run_control.py +0 -0
  22. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_external_input.py +0 -0
  23. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_internal_step_does_not_leak_type.py +0 -0
  24. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_npc_actor_memory.py +0 -0
  25. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_npc_emotional_modulation.py +0 -0
  26. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_npc_intent_decay.py +0 -0
  27. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_npc_intent_processing.py +0 -0
  28. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_public_api.py +0 -0
  29. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_relationship_graph.py +0 -0
  30. {ghocentric_ghost_engine-0.2.0 → ghocentric_ghost_engine-0.2.2}/tests/test_relationship_interaction.py +0 -0
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghocentric-ghost-engine
3
+ Version: 0.2.2
4
+ Summary: Ghost cognitive engine
5
+ Author: Shane Heckathorn
6
+ License: MIT
7
+ Keywords: ai,engine,cognition,simulation
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+
15
+ # ghocentric-ghost-engine
16
+
17
+ A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
18
+
19
+ Ghost is **NOT** a language model and **NOT** a decision-maker.
20
+ It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
21
+
22
+ This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install ghocentric-ghost-engine
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Basic Usage
35
+
36
+ ```python
37
+ from ghost.engine import GhostEngine
38
+
39
+ engine = GhostEngine()
40
+
41
+ engine.step({
42
+ "source": "npc_engine",
43
+ "intent": "threat",
44
+ "actor": "player",
45
+ "target": "guard",
46
+ "intensity": 0.5,
47
+ })
48
+
49
+ state = engine.state()
50
+ print(state["npc"]["threat_level"])
51
+ ```
52
+
53
+ Ghost mutates state only through explicit `step()` calls.
54
+ All public-facing state is exposed as dictionaries and is safe to serialize.
55
+
56
+ ---
57
+
58
+ ## Core Design Principles
59
+
60
+ - Deterministic, persistent state core
61
+ - Explicit state transitions via `step()`
62
+ - No hidden execution or side effects
63
+ - Public API remains dict-based and serialization-safe
64
+ - Internal typed representations may exist but never leak
65
+ - Designed to be expanded around a stable core
66
+
67
+ ### Ghost does NOT:
68
+
69
+ - Choose actions
70
+ - Generate dialogue
71
+ - Interpret semantics
72
+ - Store memory implicitly
73
+
74
+ These responsibilities belong to external systems that consume Ghost’s state.
75
+
76
+ ---
77
+
78
+ ## Stability & Guarantees (v0.2.2)
79
+
80
+ Ghost Engine v0.2.2 strengthens runtime correctness and serialization guarantees across public engine state.
81
+
82
+ The engine guarantees:
83
+
84
+ - Deterministic runtime behavior (same inputs → same outputs)
85
+ - Explicit, bounded state mutation per step
86
+ - Actor state updates across interactions
87
+ - Actor-level threat accumulation tracking
88
+ - Pairwise relationship mutation with symmetric consistency
89
+ - Bounded cascade propagation across interaction networks
90
+ - Deterministic nonlinear modulation of global system tension
91
+ - Passive decay behavior during idle cycles
92
+ - Fully JSON-safe public state and immutable snapshots
93
+
94
+ These guarantees hold under repeated execution, long-run simulation, and adversarial input streams.
95
+
96
+ ---
97
+
98
+ ## Architectural Expansion (v0.2.x)
99
+
100
+ Recent releases introduce the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
101
+
102
+ ### Key Capabilities
103
+
104
+ **Agent State Mutation**
105
+ Agents maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
106
+
107
+ **Relationship Graph**
108
+ Pairwise relationships evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
109
+
110
+ **Bounded Cascade Propagation**
111
+ Signals propagate deterministically through local interaction networks with strict bounds to prevent runaway behavior.
112
+
113
+ **Global System Tension**
114
+ The engine tracks shared system pressure across interactions using deterministic nonlinear modulation.
115
+
116
+ **Actor Threat Memory**
117
+ Agents maintain explicit per-actor threat accumulation history for structured introspection.
118
+
119
+ **Idle-State Decay Dynamics**
120
+ Bounded passive decay improves long-run stability and prevents runaway system pressure.
121
+
122
+ ---
123
+
124
+ ## Testing Philosophy
125
+
126
+ Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
127
+
128
+ Core validation includes:
129
+
130
+ - determinism verification
131
+ - bounded-state guarantees
132
+ - serialization safety validation
133
+
134
+ This ensures the engine remains correct and predictable as new systems are layered on top.
135
+
136
+ ---
137
+
138
+ ## Project Structure
139
+
140
+ ```
141
+ ghost/ core engine modules
142
+ tests/ invariant and runtime tests
143
+ npc_demo.py experimental sandbox
144
+ pyproject.toml build configuration
145
+ ```
146
+
147
+ Demos are intentionally minimal and act as experimental sandboxes.
148
+ They are not representative of Ghost’s final scope.
149
+
150
+ ---
151
+
152
+ ## Status
153
+
154
+ Ghost Engine remains in early development.
155
+
156
+ As of v0.2.x:
157
+
158
+ - The deterministic interaction core is stable
159
+ - APIs may still evolve
160
+ - Higher-level systems remain intentionally external
161
+
162
+ This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
163
+
164
+ ---
165
+
166
+ ## Release History
167
+
168
+ **v0.2.2**
169
+ - Fixed public state serialization issue in relationship subsystem
170
+ - Replaced set-based storage with JSON-safe structures
171
+ - Strengthened invariant coverage across runtime state
172
+
173
+ **v0.2.1**
174
+ - Added actor-level threat accumulation tracking
175
+ - Introduced deterministic nonlinear system modulation
176
+ - Implemented passive idle-cycle decay
177
+ - Added immutable JSON-safe snapshots
178
+
179
+ **v0.2.0**
180
+ - Introduced multi-agent state mutation
181
+ - Added relationship mutation logic
182
+ - Implemented bounded cascade propagation
183
+ - Achieved deterministic runtime guarantees
184
+
185
+ **v0.1.x**
186
+ - Foundational architecture releases
@@ -0,0 +1,172 @@
1
+ # ghocentric-ghost-engine
2
+
3
+ A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
4
+
5
+ Ghost is **NOT** a language model and **NOT** a decision-maker.
6
+ It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
7
+
8
+ This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core.
9
+
10
+ ---
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install ghocentric-ghost-engine
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Basic Usage
21
+
22
+ ```python
23
+ from ghost.engine import GhostEngine
24
+
25
+ engine = GhostEngine()
26
+
27
+ engine.step({
28
+ "source": "npc_engine",
29
+ "intent": "threat",
30
+ "actor": "player",
31
+ "target": "guard",
32
+ "intensity": 0.5,
33
+ })
34
+
35
+ state = engine.state()
36
+ print(state["npc"]["threat_level"])
37
+ ```
38
+
39
+ Ghost mutates state only through explicit `step()` calls.
40
+ All public-facing state is exposed as dictionaries and is safe to serialize.
41
+
42
+ ---
43
+
44
+ ## Core Design Principles
45
+
46
+ - Deterministic, persistent state core
47
+ - Explicit state transitions via `step()`
48
+ - No hidden execution or side effects
49
+ - Public API remains dict-based and serialization-safe
50
+ - Internal typed representations may exist but never leak
51
+ - Designed to be expanded around a stable core
52
+
53
+ ### Ghost does NOT:
54
+
55
+ - Choose actions
56
+ - Generate dialogue
57
+ - Interpret semantics
58
+ - Store memory implicitly
59
+
60
+ These responsibilities belong to external systems that consume Ghost’s state.
61
+
62
+ ---
63
+
64
+ ## Stability & Guarantees (v0.2.2)
65
+
66
+ Ghost Engine v0.2.2 strengthens runtime correctness and serialization guarantees across public engine state.
67
+
68
+ The engine guarantees:
69
+
70
+ - Deterministic runtime behavior (same inputs → same outputs)
71
+ - Explicit, bounded state mutation per step
72
+ - Actor state updates across interactions
73
+ - Actor-level threat accumulation tracking
74
+ - Pairwise relationship mutation with symmetric consistency
75
+ - Bounded cascade propagation across interaction networks
76
+ - Deterministic nonlinear modulation of global system tension
77
+ - Passive decay behavior during idle cycles
78
+ - Fully JSON-safe public state and immutable snapshots
79
+
80
+ These guarantees hold under repeated execution, long-run simulation, and adversarial input streams.
81
+
82
+ ---
83
+
84
+ ## Architectural Expansion (v0.2.x)
85
+
86
+ Recent releases introduce the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
87
+
88
+ ### Key Capabilities
89
+
90
+ **Agent State Mutation**
91
+ Agents maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
92
+
93
+ **Relationship Graph**
94
+ Pairwise relationships evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
95
+
96
+ **Bounded Cascade Propagation**
97
+ Signals propagate deterministically through local interaction networks with strict bounds to prevent runaway behavior.
98
+
99
+ **Global System Tension**
100
+ The engine tracks shared system pressure across interactions using deterministic nonlinear modulation.
101
+
102
+ **Actor Threat Memory**
103
+ Agents maintain explicit per-actor threat accumulation history for structured introspection.
104
+
105
+ **Idle-State Decay Dynamics**
106
+ Bounded passive decay improves long-run stability and prevents runaway system pressure.
107
+
108
+ ---
109
+
110
+ ## Testing Philosophy
111
+
112
+ Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
113
+
114
+ Core validation includes:
115
+
116
+ - determinism verification
117
+ - bounded-state guarantees
118
+ - serialization safety validation
119
+
120
+ This ensures the engine remains correct and predictable as new systems are layered on top.
121
+
122
+ ---
123
+
124
+ ## Project Structure
125
+
126
+ ```
127
+ ghost/ core engine modules
128
+ tests/ invariant and runtime tests
129
+ npc_demo.py experimental sandbox
130
+ pyproject.toml build configuration
131
+ ```
132
+
133
+ Demos are intentionally minimal and act as experimental sandboxes.
134
+ They are not representative of Ghost’s final scope.
135
+
136
+ ---
137
+
138
+ ## Status
139
+
140
+ Ghost Engine remains in early development.
141
+
142
+ As of v0.2.x:
143
+
144
+ - The deterministic interaction core is stable
145
+ - APIs may still evolve
146
+ - Higher-level systems remain intentionally external
147
+
148
+ This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
149
+
150
+ ---
151
+
152
+ ## Release History
153
+
154
+ **v0.2.2**
155
+ - Fixed public state serialization issue in relationship subsystem
156
+ - Replaced set-based storage with JSON-safe structures
157
+ - Strengthened invariant coverage across runtime state
158
+
159
+ **v0.2.1**
160
+ - Added actor-level threat accumulation tracking
161
+ - Introduced deterministic nonlinear system modulation
162
+ - Implemented passive idle-cycle decay
163
+ - Added immutable JSON-safe snapshots
164
+
165
+ **v0.2.0**
166
+ - Introduced multi-agent state mutation
167
+ - Added relationship mutation logic
168
+ - Implemented bounded cascade propagation
169
+ - Achieved deterministic runtime guarantees
170
+
171
+ **v0.1.x**
172
+ - Foundational architecture releases
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghocentric-ghost-engine
3
+ Version: 0.2.2
4
+ Summary: Ghost cognitive engine
5
+ Author: Shane Heckathorn
6
+ License: MIT
7
+ Keywords: ai,engine,cognition,simulation
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+
15
+ # ghocentric-ghost-engine
16
+
17
+ A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
18
+
19
+ Ghost is **NOT** a language model and **NOT** a decision-maker.
20
+ It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
21
+
22
+ This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install ghocentric-ghost-engine
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Basic Usage
35
+
36
+ ```python
37
+ from ghost.engine import GhostEngine
38
+
39
+ engine = GhostEngine()
40
+
41
+ engine.step({
42
+ "source": "npc_engine",
43
+ "intent": "threat",
44
+ "actor": "player",
45
+ "target": "guard",
46
+ "intensity": 0.5,
47
+ })
48
+
49
+ state = engine.state()
50
+ print(state["npc"]["threat_level"])
51
+ ```
52
+
53
+ Ghost mutates state only through explicit `step()` calls.
54
+ All public-facing state is exposed as dictionaries and is safe to serialize.
55
+
56
+ ---
57
+
58
+ ## Core Design Principles
59
+
60
+ - Deterministic, persistent state core
61
+ - Explicit state transitions via `step()`
62
+ - No hidden execution or side effects
63
+ - Public API remains dict-based and serialization-safe
64
+ - Internal typed representations may exist but never leak
65
+ - Designed to be expanded around a stable core
66
+
67
+ ### Ghost does NOT:
68
+
69
+ - Choose actions
70
+ - Generate dialogue
71
+ - Interpret semantics
72
+ - Store memory implicitly
73
+
74
+ These responsibilities belong to external systems that consume Ghost’s state.
75
+
76
+ ---
77
+
78
+ ## Stability & Guarantees (v0.2.2)
79
+
80
+ Ghost Engine v0.2.2 strengthens runtime correctness and serialization guarantees across public engine state.
81
+
82
+ The engine guarantees:
83
+
84
+ - Deterministic runtime behavior (same inputs → same outputs)
85
+ - Explicit, bounded state mutation per step
86
+ - Actor state updates across interactions
87
+ - Actor-level threat accumulation tracking
88
+ - Pairwise relationship mutation with symmetric consistency
89
+ - Bounded cascade propagation across interaction networks
90
+ - Deterministic nonlinear modulation of global system tension
91
+ - Passive decay behavior during idle cycles
92
+ - Fully JSON-safe public state and immutable snapshots
93
+
94
+ These guarantees hold under repeated execution, long-run simulation, and adversarial input streams.
95
+
96
+ ---
97
+
98
+ ## Architectural Expansion (v0.2.x)
99
+
100
+ Recent releases introduce the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
101
+
102
+ ### Key Capabilities
103
+
104
+ **Agent State Mutation**
105
+ Agents maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
106
+
107
+ **Relationship Graph**
108
+ Pairwise relationships evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
109
+
110
+ **Bounded Cascade Propagation**
111
+ Signals propagate deterministically through local interaction networks with strict bounds to prevent runaway behavior.
112
+
113
+ **Global System Tension**
114
+ The engine tracks shared system pressure across interactions using deterministic nonlinear modulation.
115
+
116
+ **Actor Threat Memory**
117
+ Agents maintain explicit per-actor threat accumulation history for structured introspection.
118
+
119
+ **Idle-State Decay Dynamics**
120
+ Bounded passive decay improves long-run stability and prevents runaway system pressure.
121
+
122
+ ---
123
+
124
+ ## Testing Philosophy
125
+
126
+ Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
127
+
128
+ Core validation includes:
129
+
130
+ - determinism verification
131
+ - bounded-state guarantees
132
+ - serialization safety validation
133
+
134
+ This ensures the engine remains correct and predictable as new systems are layered on top.
135
+
136
+ ---
137
+
138
+ ## Project Structure
139
+
140
+ ```
141
+ ghost/ core engine modules
142
+ tests/ invariant and runtime tests
143
+ npc_demo.py experimental sandbox
144
+ pyproject.toml build configuration
145
+ ```
146
+
147
+ Demos are intentionally minimal and act as experimental sandboxes.
148
+ They are not representative of Ghost’s final scope.
149
+
150
+ ---
151
+
152
+ ## Status
153
+
154
+ Ghost Engine remains in early development.
155
+
156
+ As of v0.2.x:
157
+
158
+ - The deterministic interaction core is stable
159
+ - APIs may still evolve
160
+ - Higher-level systems remain intentionally external
161
+
162
+ This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
163
+
164
+ ---
165
+
166
+ ## Release History
167
+
168
+ **v0.2.2**
169
+ - Fixed public state serialization issue in relationship subsystem
170
+ - Replaced set-based storage with JSON-safe structures
171
+ - Strengthened invariant coverage across runtime state
172
+
173
+ **v0.2.1**
174
+ - Added actor-level threat accumulation tracking
175
+ - Introduced deterministic nonlinear system modulation
176
+ - Implemented passive idle-cycle decay
177
+ - Added immutable JSON-safe snapshots
178
+
179
+ **v0.2.0**
180
+ - Introduced multi-agent state mutation
181
+ - Added relationship mutation logic
182
+ - Implemented bounded cascade propagation
183
+ - Achieved deterministic runtime guarantees
184
+
185
+ **v0.1.x**
186
+ - Foundational architecture releases
@@ -3,6 +3,21 @@ from ghost.step import GhostStep
3
3
  from ghost.agents import AgentRegistry
4
4
  from ghost.relationships import RelationshipGraph
5
5
 
6
+ def _json_safe(x):
7
+
8
+ if isinstance(x, dict):
9
+ return {str(k): _json_safe(v) for k, v in x.items()}
10
+
11
+ if isinstance(x, list):
12
+ return [_json_safe(v) for v in x]
13
+
14
+ if isinstance(x, tuple):
15
+ return [_json_safe(v) for v in x]
16
+
17
+ if isinstance(x, set):
18
+ return sorted(_json_safe(v) for v in x)
19
+
20
+ return x
6
21
 
7
22
  def clamp(value: float, low: float, high: float) -> float:
8
23
  return max(low, min(high, value))
@@ -51,9 +66,15 @@ class GhostEngine:
51
66
  ctx["cycles"] += 1
52
67
 
53
68
  npc = ctx["npc"]
69
+
70
+ # passive decay (only if no threat this step)
71
+ if step_data is None:
72
+ npc["threat_level"] = clamp(npc["threat_level"] - 0.02, 0.0, 999999.0)
54
73
 
55
74
  step: GhostStep | None = None
56
75
  public_input: dict | None = None
76
+
77
+
57
78
 
58
79
  # ---- Normalize input at boundary ----
59
80
  if step_data is not None:
@@ -125,6 +146,12 @@ class GhostEngine:
125
146
 
126
147
  elif step.intent == "threat":
127
148
  actor_state["mood"] = clamp(actor_state["mood"] - (0.05 * intensity), 0.0, 1.0)
149
+
150
+ # actor memory invariant (public-facing)
151
+ actors_mem = npc.setdefault("actors", {})
152
+ entry = actors_mem.setdefault(step.actor, {})
153
+ entry["threat_count"] = entry.get("threat_count", 0) + 1
154
+
128
155
  actor_state["tension"] = clamp(actor_state["tension"] + (0.06 * intensity), 0.0, 1.0)
129
156
 
130
157
  if target_state is not None:
@@ -149,7 +176,12 @@ class GhostEngine:
149
176
  neighbor_state["mood"] = clamp(neighbor_state["mood"] - (0.03 * spread), 0.0, 1.0)
150
177
  neighbor_state["tension"] = clamp(neighbor_state["tension"] + (0.08 * spread), 0.0, 1.0)
151
178
 
152
- npc["threat_level"] = clamp(npc["threat_level"] + (0.50 * intensity), 0.0, 999999.0)
179
+ # emotional modulation (public invariant)
180
+ mood = ctx.get("state", {}).get("mood", 0.5)
181
+
182
+ gain = 0.50 * intensity * (0.5 + mood)
183
+
184
+ npc["threat_level"] = clamp(npc["threat_level"] + gain, 0.0, 999999.0)
153
185
 
154
186
  else:
155
187
  # Unknown or neutral intent -> mild decay only
@@ -168,4 +200,4 @@ class GhostEngine:
168
200
  def snapshot(self):
169
201
  """Return an immutable snapshot of engine state."""
170
202
  import copy
171
- return copy.deepcopy(self._ctx)
203
+ return _json_safe(copy.deepcopy(self._ctx))
@@ -4,7 +4,7 @@ class RelationshipGraph:
4
4
 
5
5
  Relationships are stored as:
6
6
 
7
- ("A","B") { trust, attachment }
7
+ ("A","B") -> { trust, attachment }
8
8
  """
9
9
 
10
10
  def __init__(self, ctx: dict):
@@ -13,10 +13,11 @@ class RelationshipGraph:
13
13
  self._neighbors = ctx.setdefault("neighbors", {})
14
14
 
15
15
  def _key(self, a: str, b: str):
16
- return tuple(sorted((a, b)))
16
+ # JSON-safe key
17
+ a, b = sorted((a, b))
18
+ return f"{a}|{b}"
17
19
 
18
20
  def ensure_pair(self, a: str, b: str):
19
-
20
21
  key = self._key(a, b)
21
22
 
22
23
  rel = self._rels.setdefault(
@@ -27,9 +28,15 @@ class RelationshipGraph:
27
28
  },
28
29
  )
29
30
 
30
- # Maintain neighbor index
31
- self._neighbors.setdefault(a, set()).add(b)
32
- self._neighbors.setdefault(b, set()).add(a)
31
+ # Maintain neighbor index as LISTS, not sets
32
+ self._neighbors.setdefault(a, [])
33
+ self._neighbors.setdefault(b, [])
34
+
35
+ if b not in self._neighbors[a]:
36
+ self._neighbors[a].append(b)
37
+
38
+ if a not in self._neighbors[b]:
39
+ self._neighbors[b].append(a)
33
40
 
34
41
  return rel
35
42
 
@@ -50,6 +57,6 @@ class RelationshipGraph:
50
57
 
51
58
  def all(self):
52
59
  return self._rels
53
-
60
+
54
61
  def neighbors(self, agent_id: str):
55
- return self._neighbors.get(agent_id, set())
62
+ return self._neighbors.get(agent_id, [])
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghocentric-ghost-engine"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Ghost cognitive engine"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,174 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ghocentric-ghost-engine
3
- Version: 0.2.0
4
- Summary: Ghost cognitive engine
5
- Author: Shane Heckathorn
6
- License: MIT
7
- Keywords: ai,engine,cognition,simulation
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3 :: Only
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
13
- Description-Content-Type: text/markdown
14
-
15
- ghocentric-ghost-engine
16
-
17
- A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
18
-
19
- Ghost is NOT a language model and NOT a decision-maker. It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
20
-
21
- This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core in later versions.
22
-
23
-
24
- INSTALLATION
25
-
26
- pip install ghocentric-ghost-engine
27
-
28
-
29
- BASIC USAGE
30
-
31
- from ghost.engine import GhostEngine
32
-
33
- engine = GhostEngine()
34
-
35
- engine.step({
36
- "source": "npc_engine",
37
- "intent": "threat",
38
- "actor": "player",
39
- "target": "guard",
40
- "intensity": 0.5,
41
- })
42
-
43
- state = engine.state()
44
- print(state["npc"]["threat_level"])
45
-
46
- Ghost mutates state only via explicit step() calls.
47
- All public-facing state is exposed as dictionaries and is safe to serialize.
48
-
49
-
50
- CORE DESIGN PRINCIPLES
51
-
52
- • Deterministic, persistent state core
53
- • Explicit state transitions via step()
54
- • No hidden execution or side effects
55
- • Public API remains dict-based and serialization-safe
56
- • Internal typed representations may exist but never leak
57
- • Designed to be expanded around a stable core, not bloated prematurely
58
-
59
-
60
- Ghost does NOT:
61
-
62
- • Choose actions
63
- • Generate dialogue
64
- • Interpret semantics
65
- • Store memory implicitly
66
-
67
- Those behaviors belong to external systems that consume Ghost’s state.
68
-
69
-
70
- STABILITY & GUARANTEES (v0.2.0)
71
-
72
- Ghost Engine v0.2.0 establishes the first fully functional deterministic interaction core.
73
-
74
- The engine now guarantees:
75
-
76
- • Deterministic runtime behavior (same inputs → same outputs)
77
- • Explicit, bounded state mutation per step
78
- • Actor state updates across interactions
79
- • Pairwise relationship mutation with symmetric consistency
80
- • Bounded cascade propagation across interaction networks
81
- • Global tension tracking across the system
82
- • Full JSON-safe serialization of engine state
83
-
84
- These guarantees hold under repeated execution and adversarial input.
85
-
86
-
87
- ARCHITECTURAL EXPANSION (v0.2.0)
88
-
89
- Version 0.2.0 introduces the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
90
-
91
- New capabilities include:
92
-
93
- Agent State Mutation
94
- Agents now maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
95
-
96
- Relationship Graph
97
- Pairwise relationships now evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
98
-
99
- Bounded Cascade Propagation
100
- Signals propagate deterministically through an agent’s local interaction network with strict bounds to prevent runaway behavior.
101
-
102
- Global System Tension
103
- The engine now tracks a shared global tension signal representing aggregate interaction pressure across the system.
104
-
105
-
106
- Why This Matters
107
-
108
- These changes allow Ghost-based systems to scale toward:
109
-
110
- • large multi-agent simulations
111
- • social interaction modeling
112
- • emergent behavioral systems
113
- • game-world simulation engines
114
-
115
- while preserving the deterministic, explicit-state philosophy of the core.
116
-
117
-
118
- TESTING PHILOSOPHY
119
-
120
- Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
121
-
122
- Core validation includes:
123
-
124
- • determinism verification
125
- • clamping and bounded-state guarantees
126
- • serialization safety validation
127
-
128
- This ensures the engine remains correct and predictable as new systems and features are layered on top in future versions.
129
-
130
-
131
- PROJECT STRUCTURE
132
-
133
- ghost/ core engine modules
134
- tests/ invariant and runtime tests
135
- npc_demo.py experimental sandbox for new ideas
136
- pyproject.toml build and packaging configuration
137
-
138
- Demos are intentionally minimal and act as experimental sandboxes.
139
- They are not representative of Ghost’s final scope.
140
-
141
-
142
- STATUS
143
-
144
- Ghost Engine remains in early development.
145
-
146
- As of v0.2.0:
147
-
148
- • The deterministic interaction core is stable
149
- • APIs may still evolve
150
- • Higher-level systems remain intentionally external
151
-
152
- This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
153
-
154
-
155
- RELEASE HISTORY
156
-
157
- v0.2.0
158
- • Introduced real agent state mutation
159
- • Added relationship mutation logic
160
- • Implemented bounded cascade propagation
161
- • Achieved deterministic runtime guarantees
162
- • Achieved JSON-safe serialization baseline
163
-
164
- v0.1.3
165
- • AgentRegistry and neighbor indexing for scalable interaction graphs
166
-
167
- v0.1.2
168
- • Formal invariant verification using property-based testing
169
-
170
- v0.1.1
171
- • Core threat accumulation improvements
172
-
173
- v0.1.0
174
- • Initial public architecture release
@@ -1,160 +0,0 @@
1
- ghocentric-ghost-engine
2
-
3
- A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
4
-
5
- Ghost is NOT a language model and NOT a decision-maker. It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
6
-
7
- This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core in later versions.
8
-
9
-
10
- INSTALLATION
11
-
12
- pip install ghocentric-ghost-engine
13
-
14
-
15
- BASIC USAGE
16
-
17
- from ghost.engine import GhostEngine
18
-
19
- engine = GhostEngine()
20
-
21
- engine.step({
22
- "source": "npc_engine",
23
- "intent": "threat",
24
- "actor": "player",
25
- "target": "guard",
26
- "intensity": 0.5,
27
- })
28
-
29
- state = engine.state()
30
- print(state["npc"]["threat_level"])
31
-
32
- Ghost mutates state only via explicit step() calls.
33
- All public-facing state is exposed as dictionaries and is safe to serialize.
34
-
35
-
36
- CORE DESIGN PRINCIPLES
37
-
38
- • Deterministic, persistent state core
39
- • Explicit state transitions via step()
40
- • No hidden execution or side effects
41
- • Public API remains dict-based and serialization-safe
42
- • Internal typed representations may exist but never leak
43
- • Designed to be expanded around a stable core, not bloated prematurely
44
-
45
-
46
- Ghost does NOT:
47
-
48
- • Choose actions
49
- • Generate dialogue
50
- • Interpret semantics
51
- • Store memory implicitly
52
-
53
- Those behaviors belong to external systems that consume Ghost’s state.
54
-
55
-
56
- STABILITY & GUARANTEES (v0.2.0)
57
-
58
- Ghost Engine v0.2.0 establishes the first fully functional deterministic interaction core.
59
-
60
- The engine now guarantees:
61
-
62
- • Deterministic runtime behavior (same inputs → same outputs)
63
- • Explicit, bounded state mutation per step
64
- • Actor state updates across interactions
65
- • Pairwise relationship mutation with symmetric consistency
66
- • Bounded cascade propagation across interaction networks
67
- • Global tension tracking across the system
68
- • Full JSON-safe serialization of engine state
69
-
70
- These guarantees hold under repeated execution and adversarial input.
71
-
72
-
73
- ARCHITECTURAL EXPANSION (v0.2.0)
74
-
75
- Version 0.2.0 introduces the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
76
-
77
- New capabilities include:
78
-
79
- Agent State Mutation
80
- Agents now maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
81
-
82
- Relationship Graph
83
- Pairwise relationships now evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
84
-
85
- Bounded Cascade Propagation
86
- Signals propagate deterministically through an agent’s local interaction network with strict bounds to prevent runaway behavior.
87
-
88
- Global System Tension
89
- The engine now tracks a shared global tension signal representing aggregate interaction pressure across the system.
90
-
91
-
92
- Why This Matters
93
-
94
- These changes allow Ghost-based systems to scale toward:
95
-
96
- • large multi-agent simulations
97
- • social interaction modeling
98
- • emergent behavioral systems
99
- • game-world simulation engines
100
-
101
- while preserving the deterministic, explicit-state philosophy of the core.
102
-
103
-
104
- TESTING PHILOSOPHY
105
-
106
- Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
107
-
108
- Core validation includes:
109
-
110
- • determinism verification
111
- • clamping and bounded-state guarantees
112
- • serialization safety validation
113
-
114
- This ensures the engine remains correct and predictable as new systems and features are layered on top in future versions.
115
-
116
-
117
- PROJECT STRUCTURE
118
-
119
- ghost/ core engine modules
120
- tests/ invariant and runtime tests
121
- npc_demo.py experimental sandbox for new ideas
122
- pyproject.toml build and packaging configuration
123
-
124
- Demos are intentionally minimal and act as experimental sandboxes.
125
- They are not representative of Ghost’s final scope.
126
-
127
-
128
- STATUS
129
-
130
- Ghost Engine remains in early development.
131
-
132
- As of v0.2.0:
133
-
134
- • The deterministic interaction core is stable
135
- • APIs may still evolve
136
- • Higher-level systems remain intentionally external
137
-
138
- This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
139
-
140
-
141
- RELEASE HISTORY
142
-
143
- v0.2.0
144
- • Introduced real agent state mutation
145
- • Added relationship mutation logic
146
- • Implemented bounded cascade propagation
147
- • Achieved deterministic runtime guarantees
148
- • Achieved JSON-safe serialization baseline
149
-
150
- v0.1.3
151
- • AgentRegistry and neighbor indexing for scalable interaction graphs
152
-
153
- v0.1.2
154
- • Formal invariant verification using property-based testing
155
-
156
- v0.1.1
157
- • Core threat accumulation improvements
158
-
159
- v0.1.0
160
- • Initial public architecture release
@@ -1,174 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ghocentric-ghost-engine
3
- Version: 0.2.0
4
- Summary: Ghost cognitive engine
5
- Author: Shane Heckathorn
6
- License: MIT
7
- Keywords: ai,engine,cognition,simulation
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3 :: Only
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
13
- Description-Content-Type: text/markdown
14
-
15
- ghocentric-ghost-engine
16
-
17
- A lightweight, deterministic internal state engine for experimenting with persistent state, temporal dynamics, and emergent behavior in interactive systems.
18
-
19
- Ghost is NOT a language model and NOT a decision-maker. It is a minimal, stateful core designed to accumulate interaction signals over time and expose them in a clean, predictable, and serialization-safe way.
20
-
21
- This project is intentionally focused on architecture and correctness first. Surface features, integrations, and higher-level reasoning systems are expected to be layered on top of the core in later versions.
22
-
23
-
24
- INSTALLATION
25
-
26
- pip install ghocentric-ghost-engine
27
-
28
-
29
- BASIC USAGE
30
-
31
- from ghost.engine import GhostEngine
32
-
33
- engine = GhostEngine()
34
-
35
- engine.step({
36
- "source": "npc_engine",
37
- "intent": "threat",
38
- "actor": "player",
39
- "target": "guard",
40
- "intensity": 0.5,
41
- })
42
-
43
- state = engine.state()
44
- print(state["npc"]["threat_level"])
45
-
46
- Ghost mutates state only via explicit step() calls.
47
- All public-facing state is exposed as dictionaries and is safe to serialize.
48
-
49
-
50
- CORE DESIGN PRINCIPLES
51
-
52
- • Deterministic, persistent state core
53
- • Explicit state transitions via step()
54
- • No hidden execution or side effects
55
- • Public API remains dict-based and serialization-safe
56
- • Internal typed representations may exist but never leak
57
- • Designed to be expanded around a stable core, not bloated prematurely
58
-
59
-
60
- Ghost does NOT:
61
-
62
- • Choose actions
63
- • Generate dialogue
64
- • Interpret semantics
65
- • Store memory implicitly
66
-
67
- Those behaviors belong to external systems that consume Ghost’s state.
68
-
69
-
70
- STABILITY & GUARANTEES (v0.2.0)
71
-
72
- Ghost Engine v0.2.0 establishes the first fully functional deterministic interaction core.
73
-
74
- The engine now guarantees:
75
-
76
- • Deterministic runtime behavior (same inputs → same outputs)
77
- • Explicit, bounded state mutation per step
78
- • Actor state updates across interactions
79
- • Pairwise relationship mutation with symmetric consistency
80
- • Bounded cascade propagation across interaction networks
81
- • Global tension tracking across the system
82
- • Full JSON-safe serialization of engine state
83
-
84
- These guarantees hold under repeated execution and adversarial input.
85
-
86
-
87
- ARCHITECTURAL EXPANSION (v0.2.0)
88
-
89
- Version 0.2.0 introduces the first fully operational multi-agent interaction model on top of Ghost’s deterministic state core.
90
-
91
- New capabilities include:
92
-
93
- Agent State Mutation
94
- Agents now maintain evolving internal state (mood, tension, last intent) and react deterministically to interaction signals.
95
-
96
- Relationship Graph
97
- Pairwise relationships now evolve through explicit interaction deltas, supporting long-term system memory without hidden state.
98
-
99
- Bounded Cascade Propagation
100
- Signals propagate deterministically through an agent’s local interaction network with strict bounds to prevent runaway behavior.
101
-
102
- Global System Tension
103
- The engine now tracks a shared global tension signal representing aggregate interaction pressure across the system.
104
-
105
-
106
- Why This Matters
107
-
108
- These changes allow Ghost-based systems to scale toward:
109
-
110
- • large multi-agent simulations
111
- • social interaction modeling
112
- • emergent behavioral systems
113
- • game-world simulation engines
114
-
115
- while preserving the deterministic, explicit-state philosophy of the core.
116
-
117
-
118
- TESTING PHILOSOPHY
119
-
120
- Ghost uses property-based testing and invariant validation rather than relying solely on example-driven tests.
121
-
122
- Core validation includes:
123
-
124
- • determinism verification
125
- • clamping and bounded-state guarantees
126
- • serialization safety validation
127
-
128
- This ensures the engine remains correct and predictable as new systems and features are layered on top in future versions.
129
-
130
-
131
- PROJECT STRUCTURE
132
-
133
- ghost/ core engine modules
134
- tests/ invariant and runtime tests
135
- npc_demo.py experimental sandbox for new ideas
136
- pyproject.toml build and packaging configuration
137
-
138
- Demos are intentionally minimal and act as experimental sandboxes.
139
- They are not representative of Ghost’s final scope.
140
-
141
-
142
- STATUS
143
-
144
- Ghost Engine remains in early development.
145
-
146
- As of v0.2.0:
147
-
148
- • The deterministic interaction core is stable
149
- • APIs may still evolve
150
- • Higher-level systems remain intentionally external
151
-
152
- This project is intended as a foundation for experimentation, research, and future system design rather than a finished product.
153
-
154
-
155
- RELEASE HISTORY
156
-
157
- v0.2.0
158
- • Introduced real agent state mutation
159
- • Added relationship mutation logic
160
- • Implemented bounded cascade propagation
161
- • Achieved deterministic runtime guarantees
162
- • Achieved JSON-safe serialization baseline
163
-
164
- v0.1.3
165
- • AgentRegistry and neighbor indexing for scalable interaction graphs
166
-
167
- v0.1.2
168
- • Formal invariant verification using property-based testing
169
-
170
- v0.1.1
171
- • Core threat accumulation improvements
172
-
173
- v0.1.0
174
- • Initial public architecture release