Skip to content

Commit 2a6bddf

Browse files
committed
Remove dense/sparse mode flags and update related documentation for clarity
1 parent 2b5a66a commit 2a6bddf

12 files changed

Lines changed: 114 additions & 100 deletions

File tree

cli/args.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ def make_parser() -> argparse.ArgumentParser:
3535
p.set_defaults(use_time_dynamics=True)
3636
p.add_argument('--seed', type=int, default=0)
3737

38-
# Ultra-scale/sparse flags
39-
p.add_argument('--sparse-mode', dest='sparse_mode', action='store_true')
40-
p.add_argument('--dense-mode', dest='sparse_mode', action='store_false')
41-
# Aliases
42-
p.add_argument('--sparse', dest='sparse_mode', action='store_true')
43-
p.add_argument('--dense', dest='sparse_mode', action='store_false')
44-
p.set_defaults(sparse_mode=None)
4538
p.add_argument('--threshold', type=float, default=0.15)
4639
p.add_argument('--lambda-omega', dest='lambda_omega', type=float, default=0.1)
4740
p.add_argument('--candidates', type=int, default=64)

control/process_manager.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ def add(flag: str, val: Any, cast=str):
8181
cmd.append("--use-time-dynamics")
8282
else:
8383
cmd.append("--no-time-dynamics")
84-
# sparse / structure
85-
if profile.get("sparse_mode", False):
86-
cmd.append("--sparse-mode")
84+
# structure
8785
add("--threshold", profile.get("threshold"), str)
8886
add("--lambda-omega", profile.get("lambda_omega"), str)
8987
add("--candidates", profile.get("candidates"), str)

core/global_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def run(self, W: np.ndarray, rng: np.random.Generator) -> Tuple[np.ndarray, int,
135135
# -----------------------------------
136136

137137
@dataclass
138-
class SIE: # TODO: This is not the canonical SIE; compare it with vdm_rt/core/sie.py.
138+
class SIE: # TODO: classify this legacy SIE variant as keep, port, archive, or delete after parity review with core/sie.py.
139139
"""
140140
Self‑Improvement Engine (Rule 3)
141141
total_reward = w_td * TD_error_norm + w_nov * novelty_norm - w_hab * habituation_norm + w_hsi * hsi_norm

core/metrics.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ def compute_metrics(connectome):
1212
"""
1313
Rule Ref: Blueprint Rule 4.1 (Pathology Detection Mechanisms)
1414
- Adds connectome_entropy to support Active Domain Cartography (Rule 7) scheduling.
15-
- Prefers connectome.connectome_entropy() when available (sparse-mode), falling back to local function.
15+
- Prefers connectome.connectome_entropy() when available, falling back to local function.
1616
"""
17-
# TODO GET THESE FOR FREE FROM THE VOID WALKERS
18-
# Prefer a connectome-native entropy calculator for sparse-mode
17+
# TODO: replace scan-derived metric calls with SparseConnectome.metrics_snapshot()
18+
# and event-spine reducer outputs after parity tests pass.
19+
# Prefer a connectome-native entropy calculator when available.
1920
try:
2021
h = float(connectome.connectome_entropy())
2122
except Exception:

docs/governance/tools/check_docs_front_matter.py

100755100644
File mode changed.

docs/pages/roadmap/runtime-reboot-roadmap.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The current runtime is halfway through a good migration: from scan-heavy global
2020
| 2 | `docs/roadmap/runtime-event-spine/TODO.md` | Unify `Observation`, `BaseEvent`, ADC, maps, memory, and future motor events behind one typed event spine. |
2121
| 3 | `docs/roadmap/adc-territory-richness/TODO.md` | Feed ADC more than `region_stat` and `cycle_hit`; produce `boundary_probe` and `novel_frontier`. |
2222
| 4 | `docs/roadmap/scout-map-ownership/TODO.md` | Keep void walkers/maps as core systems, remove duplicate scout ownership, and route scout products globally. |
23-
| 5 | `docs/roadmap/memory-gdsp-territory/TODO.md` | Fix memory ownership, stale observation reuse, GDSP one-tick territory lag, and dead `bias_hint` shape. |
23+
| 5 | `docs/roadmap/memory-gdsp-territory/TODO.md` | Fix memory ownership, stale observation reuse, GDSP one-tick territory lag, dead `bias_hint` shape, and engram resume integrity. |
2424
| 6 | `docs/roadmap/loop-scan-reduction/TODO.md` | Replace repeated full graph scans with sparse cached snapshots and reducer-fed metrics. |
2525
| 7 | `docs/roadmap/sparse-neurogenesis/TODO.md` | Recover dynamic node growth/culling as sparse-native runtime code without torch or dense substrate ownership. |
2626
| 8 | `docs/roadmap/repo-scan-upgrades/TODO.md` | Add scanners for bus schema, hot loops, state ownership, tick order, and contamination policies. |
@@ -32,7 +32,8 @@ Motor-learning work depends on three runtime tracks:
3232

3333
1. The event spine must exist before actuator trace, release, and reafference events can be globally routed.
3434
2. ADC territory richness must improve before motor skill can use territory/correction feedback with useful locality.
35-
3. Dense-scan reduction must begin before new motor systems add more per-tick load.
35+
3. Engram resume integrity must be proven before long-run motor learning claims can rely on stopped/reloaded state.
36+
4. Dense-scan reduction must begin before new motor systems add more per-tick load.
3637

3738
## Runtime stance
3839

@@ -65,6 +66,7 @@ This roadmap is complete when:
6566
- ADC receives rich territory-producing events,
6667
- void walkers/maps are globally visible and not duplicate-owned,
6768
- GDSP reads current territory data or explicitly declares next-tick scheduling,
69+
- engram resume restores real state history or fails loudly instead of silently loading config-only state,
6870
- repeated scan-heavy metrics are replaced by cached sparse snapshots where safe,
6971
- torch/dense substrate paths are gone from live runtime,
7072
- sparse neurogenesis has an implementation plan and first bounded policy tests,

docs/roadmap/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ reports/20260622/vdm_rt_void_bus_adc_loop_analysis.md
2323
3. `adc-territory-richness/TODO.md` — make ADC territory and boundary production meaningful.
2424
4. `scout-map-ownership/TODO.md` — make void walkers/maps first-class producers and remove duplicate ownership.
2525
5. `loop-scan-reduction/TODO.md` — replace repeated graph scans with cached sparse snapshots and reducer-fed metrics.
26-
6. `memory-gdsp-territory/TODO.md` — fix memory ownership, GDSP timing, stale observations, and territory availability.
26+
6. `memory-gdsp-territory/TODO.md` — fix memory ownership, GDSP timing, stale observations, territory availability, and engram resume integrity.
2727
7. `sparse-neurogenesis/TODO.md` — preserve legacy growth/pruning intent while removing dense/GPU substrate code.
2828
8. `repo-scan-upgrades/TODO.md` — improve Arachnid/repo-scan tooling for runtime dataflow analysis.
2929
9. `motor-learning-system/TODO.md` — motor-learning / decoder-removal upgrade path.

docs/roadmap/memory-gdsp-territory/TODO.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,46 @@ This checklist fixes ownership and timing issues around memory fields, territory
6969
- [ ] Step 3.2.2 — Emit `adc_folded_this_tick` per tick.
7070
- [ ] Step 3.2.3 — Emit `territory_folded_this_tick` per tick.
7171
- [ ] Step 3.2.4 — Emit `gdsp_territory_source` per GDSP invocation.
72+
73+
## Phase 4 — Engram Resume Integrity
74+
75+
### Task 4.1 — Reproduce the Aura reload failure mode
76+
77+
- [ ] Step 4.1.1 — Create a short run with checkpointing enabled and nontrivial connectome, ADC, memory, map, SIE, and lexicon state.
78+
- [ ] Step 4.1.2 — Stop the run, reload from the checkpoint with `--load-engram`, and continue for a small number of ticks.
79+
- [ ] Step 4.1.3 — Compare pre-stop state against post-load state before the first continued tick.
80+
- [ ] Step 4.1.4 — Record whether only config-like values are restored while state history is lost.
81+
- [ ] Step 4.1.5 — Preserve an Aura-style regression fixture once the exact failure is reproduced.
82+
83+
### Task 4.2 — Audit checkpoint save coverage
84+
85+
- [ ] Step 4.2.1 — List every field saved by `core/memory/engram_io.py` for sparse checkpoints.
86+
- [ ] Step 4.2.2 — List every live runtime state field needed to resume a run without semantic reset.
87+
- [ ] Step 4.2.3 — Compare saved fields against `SparseConnectome`, ADC, memory field, trail/map reducers, SIE, phase, lexicon, and runtime counters.
88+
- [ ] Step 4.2.4 — Mark each field as `required`, `optional`, `derived`, or `do_not_resume`.
89+
- [ ] Step 4.2.5 — Add a manifest section to every checkpoint describing what was saved and what was intentionally omitted.
90+
91+
### Task 4.3 — Audit checkpoint load behavior
92+
93+
- [ ] Step 4.3.1 — Trace `runtime/helpers/engram.py::maybe_load_engram`.
94+
- [ ] Step 4.3.2 — Trace `core/memory/engram_io.py::load_engram`.
95+
- [ ] Step 4.3.3 — Trace phase-file hot loading through `runtime/phase.py`.
96+
- [ ] Step 4.3.4 — Verify load restores arrays, adjacency, active-state trackers, ADC territories, memory fields, and reducer state instead of only applying config.
97+
- [ ] Step 4.3.5 — Make incomplete restore fail loudly unless explicitly requested as config-only import.
98+
99+
### Task 4.4 — Separate config load from state resume
100+
101+
- [ ] Step 4.4.1 — Define `resume_state` semantics for full state restoration.
102+
- [ ] Step 4.4.2 — Define `load_config` semantics for importing run parameters without state history.
103+
- [ ] Step 4.4.3 — Prevent `--load-engram` from silently behaving like config-only load.
104+
- [ ] Step 4.4.4 — Add telemetry field `resume_mode` with values `none`, `state`, `config_only`, or `failed`.
105+
- [ ] Step 4.4.5 — Add telemetry field `resume_state_fields_loaded` listing restored sections.
106+
107+
### Task 4.5 — Add resume parity tests
108+
109+
- [ ] Step 4.5.1 — Save a checkpoint from a deterministic synthetic sparse runtime.
110+
- [ ] Step 4.5.2 — Load the checkpoint into a fresh runtime object.
111+
- [ ] Step 4.5.3 — Assert structural parity for node count, adjacency, active weights, stimulation state, and traversal state.
112+
- [ ] Step 4.5.4 — Assert ADC parity for territories, boundaries, cycle hits, TTL, and split state.
113+
- [ ] Step 4.5.5 — Assert memory/map parity for memory field, trail state, and event-map heads where those systems are enabled.
114+
- [ ] Step 4.5.6 — Assert continued tick numbering and checkpoint retention do not overwrite or prune the resumed history incorrectly.

docs/roadmap/runtime-cleanup-guardrails/TODO.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,21 @@ This checklist protects the fresh independent runtime identity. It is allowed to
7878
- [ ] Step 3.2.2 — Prove `import vdm_rt.core.sparse_connectome` works without torch.
7979
- [ ] Step 3.2.3 — Prove `import vdm_rt.run_nexus` works from the fresh repo root.
8080
- [ ] Step 3.2.4 — Add these import checks to CI.
81+
82+
## Phase 4 — TODO Comment Hygiene
83+
84+
### Task 4.1 — Classify live-code TODOs
85+
86+
- [x] Step 4.1.1 — Remove stale `TODO REMOVE DENSE SCANS` comments from `nexus.py`.
87+
- [x] Step 4.1.2 — Rewrite the scan-reduction TODO in `core/metrics.py` to point at `SparseConnectome.metrics_snapshot()` and event-spine reducers.
88+
- [x] Step 4.1.3 — Rewrite the legacy SIE TODO in `core/global_system.py` as a keep/port/archive/delete classification task.
89+
- [ ] Step 4.1.4 — Add a TODO scanner that reports every live-code TODO with file, line, category, and owner.
90+
- [ ] Step 4.1.5 — Require each live-code TODO to be classified as `bug`, `cleanup`, `port`, `archive`, `performance`, or `roadmap-linked`.
91+
92+
### Task 4.2 — Remove stale dense backend compatibility
93+
94+
- [x] Step 4.2.1 — Remove `FORCE_DENSE` runtime backend switching from `nexus.py`.
95+
- [x] Step 4.2.2 — Remove CLI dense/sparse selection flags.
96+
- [x] Step 4.2.3 — Remove `sparse_mode` forwarding from the runtime launcher and process manager.
97+
- [x] Step 4.2.4 — Update the dense-connectome guard so dense backend selection cannot reappear silently.
98+
- [ ] Step 4.2.5 — Add a scan report that distinguishes runtime dense scans from accurate comments saying a module avoids dense scans.

nexus.py

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Nexus:
5151
def __init__(self, run_dir: str, N:int=1000, k:int=12, hz:int=10,
5252
domain:str='biology_consciousness', use_time_dynamics:bool=True,
5353
log_every:int=1, checkpoint_every:int=0, seed:int=0,
54-
sparse_mode:bool=False, threshold:float=0.15, lambda_omega:float=0.1,
54+
threshold:float=0.15, lambda_omega:float=0.1,
5555
candidates:int=64, walkers:int=256, hops:int=3, status_interval:int=1,
5656
bundle_size:int=3, prune_factor:float=0.10,
5757
speak_auto:bool=True, speak_z:float=1.0, speak_hysteresis:float=1.0,
@@ -121,49 +121,14 @@ def __init__(self, run_dir: str, N:int=1000, k:int=12, hz:int=10,
121121
self._ng2 = {} # bigram: w1 -> {w2: count}
122122
self._ng3 = {} # trigram: (w1,w2) -> {w3: count}
123123

124-
# Sparse-first backend policy (void-faithful, no scans):
125-
# Runtime uses SparseConnectome by default. Dense is validation-only via FORCE_DENSE=1.
126-
use_dense = str(os.getenv("FORCE_DENSE", "0")).strip().lower() in ("1", "true", "yes", "on", "y", "t")
124+
from vdm_rt.core.sparse_connectome import SparseConnectome
127125

128-
# Keep 'sparse_mode' arg for compatibility but ignore it; log once.
129-
if sparse_mode:
130-
try:
131-
self.logger.info("deprecated_arg_sparse_mode_ignored", extra={"extra": {"arg": bool(sparse_mode)}})
132-
except Exception:
133-
pass
134-
135-
# Select implementation with dynamic import to avoid accidental dense usage
136-
try:
137-
if use_dense: # TODO REMOVE DENSE SCANS
138-
from vdm_rt.core.connectome import Connectome as _Conn # validation-only
139-
else:
140-
from vdm_rt.core.sparse_connectome import SparseConnectome as _Conn
141-
except Exception:
142-
# Fallback to sparse on any import failure
143-
from vdm_rt.core.sparse_connectome import SparseConnectome as _Conn
144-
145-
# Instantiate connectome (both backends accept the same constructor args here)
146-
try: # TODO REMOVE DENSE SCANS
147-
self.connectome = _Conn(
148-
N=self.N, k=self.k, seed=self.seed,
149-
threshold=threshold, lambda_omega=lambda_omega,
150-
candidates=candidates, traversal_walkers=walkers, traversal_hops=hops,
151-
bundle_size=bundle_size, prune_factor=prune_factor
152-
)
153-
if use_dense:
154-
try:
155-
self.logger.info("backend_dense_forced", extra={"extra": {"reason": "FORCE_DENSE"}})
156-
except Exception:
157-
pass
158-
except Exception:
159-
# Ensure we have a working sparse connectome if constructor failed
160-
from vdm_rt.core.sparse_connectome import SparseConnectome as _SConn
161-
self.connectome = _SConn(
162-
N=self.N, k=self.k, seed=self.seed,
163-
threshold=threshold, lambda_omega=lambda_omega,
164-
candidates=candidates, traversal_walkers=walkers, traversal_hops=hops,
165-
bundle_size=bundle_size, prune_factor=prune_factor
166-
)
126+
self.connectome = SparseConnectome(
127+
N=self.N, k=self.k, seed=self.seed,
128+
threshold=threshold, lambda_omega=lambda_omega,
129+
candidates=candidates, traversal_walkers=walkers, traversal_hops=hops,
130+
bundle_size=bundle_size, prune_factor=prune_factor
131+
)
167132
# Load engram if provided (after backend selection)
168133
# Defer engram loading until after ADC is initialized to avoid spurious errors/logs.
169134
# The actual load (with logging) happens below after ADC is constructed.
@@ -179,7 +144,7 @@ def __init__(self, run_dir: str, N:int=1000, k:int=12, hz:int=10,
179144
self.stim_group_size = int(max(1, stim_group_size))
180145
self.stim_amp = float(stim_amp)
181146
self.stim_max_symbols = int(max(1, stim_max_symbols))
182-
try: # TODO REMOVE DENSE SCANS
147+
try:
183148
if hasattr(self.connectome, "_stim_decay"):
184149
self.connectome._stim_decay = float(stim_decay)
185150
except Exception:
@@ -236,7 +201,7 @@ def __init__(self, run_dir: str, N:int=1000, k:int=12, hz:int=10,
236201
self.adc = ADC(r_attach=float(r_attach), ttl_init=int(ttl_init), split_patience=int(split_patience))
237202
# Attach bus to connectome so walkers can publish Observation events
238203
try:
239-
self.connectome.bus = self.bus # TODO REMOVE DENSE SCANS
204+
self.connectome.bus = self.bus
240205
except Exception:
241206
pass
242207

0 commit comments

Comments
 (0)