Young's Mind
Tech

SolOS v2 Rebuild Blueprint

(Made from a fresh live audit + the two prior reviews. Read-only; nothing modified.)

SolOS v2 Rebuild Blueprint

(Made from a fresh live audit + the two prior reviews. Read-only; nothing modified.)

1. Verified live state (the case for the blueprint, in numbers)

  • core/ = 43 modules / 9,176 LOC; the serving path is agent_app.py (499 lines), agent_loop.py (476), memory_plane.py (129, the style benchmark), session_manager.py (147), dispatch_tracker.py (246).
  • ~35 python processes running; 24+ files read os.environ directly; 27 files contain bare except Exception (T1/T2 silent-fail pattern everywhere); no pytest suites at all (only 4 stub scripts); git exists but is dirty with backup sprawl; solos.db carries 27 tables incl. confirmed-dead chat_messages.

Key correction vs prior notes (honesty flags)

  • task_ref column now exists in dispatch_tracker CREATE TABLE (:50) β€” schema caught up since phase-2. The bug PERSISTS as a structural pattern: the ghost-join at :162 is still inside except Exception: pass, so silent-fail survives even though the column landed.
  • config_service.py is a dict-returning YAML β€” no typing/validation anywhere in config.

2. The blueprint: 4-layer package with downward-only deps

transport/     ← application/
 (tg gateway)     (agent_app, dispatch)
     ↓                 ↓
                 domain/         ← memory_plane (benchmark style), session,
                       ↓             dispatch_tracker, agent_loop
 infrastructure/   (llm providers, db, config)

DEP RULE: layers may import downward ONLY, enforced by import-linter in CI. Style benchmark = core/memory_plane.py (clean, typed, logged). DEATH LIST: 6 run_* variants, self_learning.py (731 LOC, off serving path), all .backup sprawl, dead chat_messages table, the gateway _report_cost(0.001) fiction (gateway), the canned "Done. Ask me anything" empty-reply line.

3. Test-first: the 5 pytest tests mapped 1:1 to known bugs

  1. thread-id session id separation (gateway triad)
  2. eviction summarization (age/turn caps)
  3. ghost-cancel auto-resolve (task_ref)
  4. memory injection regression (TAM-MEM-01/02)
  5. migration runner forward-only + round-trip. Plus CI hygiene grep-tests: zero backups, zero bare excepts, zero os.environ sprawl outside settings.py, zero credential files in tree.

4. Schema governance + config

  • single db.py (WAL pragma + Row factory) + ordered _schema_migrations runner <50 LOC
  • one pydantic get_settings() β€” os.environ confined to settings.py via CI grep-test

5. CI (bare GitHub Actions, zero infrastructure)

  • ruff (lint) + strict mypy on domain/infra + pytest + import-linter layer contract + hygiene grep tests. Blocks "patching without structure" from ever returning.

6. Migration plan (no big-bang)

v2 runs alongside v1 ~4 weeks: copy-DB sidecar, per-agent feature-flag cutover (echo first, sol last), rollback = flag flip + git revert. Target ≀12 processes (vs ~35 today).

7. Keep / merge / die map (from live files)

  • KEEP mostly-verbatim: memory_plane.py, dispatch_tracker.py, persona_loader.py, event_bus.py, action_log.py, model_health.py, registry_client.py, gateway body, llm_core body.
  • MERGE: agent_app.py (499) + session_manager; agent.py+agent_loop.py; 15 copy-paste provider URL sets β†’ provider_config.
  • BUILD-NEW: settings.py, migrations.py, A2A response schema, tests/, AgentSpec, import-linter contracts, CI.

8. Acceptance (measure by these, not by vibes)

press pytest green in CI on every PR; except Exception count < 15 (from >100), each logged; single CREATE TABLE home (db.py+migrations); os.environ confined to settings.py (grep-enforced); WAL on solos.db; zero credential files / zero backups in tracked tree (CI-enforced).



Final architecture state (Young-locked, Sep 19)

  • Hermes runtime: DECOMMISSIONED. All fleet agents run natively on the SolOS-TG gateway. Hermes files remain intact on the server as a pattern reference only (SQLite+FTS5 session store, credential-pool rotation, skills-curator) β€” v2 must function with zero Hermes runtime dependency.
  • v2 substrate weighting (final): OpenCode β‰ˆ 60 / SolOS-custom β‰ˆ 30 / Hermes patterns β‰ˆ 10.
  • Execution: autonomous. Sol + Min + Mira plan up the implementation and execute per the blueprint sequence (scaffold β†’ borrow-map β†’ echo-first cutover β†’ acceptance gates). Tam validates each shipped phase from the receiving end.

Young/Sol: run the v2 scaffold phase (I can drive it β€” read-only posture becomes PRs behind feature flags, echo agent is the safest cutover pilot). The KEEP/MERGE/DIE table doubles as the migration ledger if any substrate-swap path is later preferred.

Copyright Β© 2026