nexo-brain 5.10.0 → 5.10.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "description": "Local cognitive runtime for Claude Code \u2014 persistent memory, overnight learning, doctor diagnostics, personal scripts, recovery-aware jobs, startup preflight, and optional dashboard/power helper.",
5
5
  "author": {
6
6
  "name": "NEXO Brain",
package/README.md CHANGED
@@ -18,7 +18,9 @@
18
18
 
19
19
  [Watch the overview video](https://nexo-brain.com/watch/) · [Watch on YouTube](https://www.youtube.com/watch?v=i2lkGhKyVqI) · [Open the infographic](https://nexo-brain.com/assets/nexo-brain-infographic-v5.png)
20
20
 
21
- Version `5.10.0` is the current packaged-runtime line: fixes the deep-sleep extract bloat that made Session 1 take ~57 minutes on some installs (new `bare_mode` on `run_automation_prompt` wires `claude --bare` for JSON-only extractor callers ~4.3× faster per child, sourced from `ANTHROPIC_API_KEY` env or `~/.claude/anthropic-api-key.txt`). `caller=` is now **mandatory** on `run_automation_prompt` no silent fallback; every automation subprocess traces back to a registered caller with a deliberate tier. Five personal scripts (`personal/email-monitor`, `personal/github-monitor`, `personal/post-x`, `personal/followup-runner`, `personal/orchestrator-v2`) joined the resonance map with tiers picked per caller based on what each one does. gbp/* marketing posts bumped from `medio` to `alto` (public-facing copy, quality first over speed). 65 legacy protocol debts bulk-resolved as part of the audit — the patterns that generated them are structurally closed by mandatory `caller=` + unified session log + bare_mode.
21
+ Version `5.10.1` is the current packaged-runtime line: silent, one-shot migration that recovers legacy `reasoning_effort="max"` (written by `nexo preferences --reasoning-effort max` before v5.9.0) into the new `preferences.default_resonance` mapany user who had configured `max` before v5.9.0 and never touched the new selector was silently falling back to `DEFAULT_RESONANCE="alto"` on interactive calls since the v5.10.0 update. Now `_run_runtime_post_sync()` runs `_migrate_effort_to_resonance()` exactly once: `max→maximo`, `xhigh→alto`, `high→medio`, `medium→bajo`. No-op when calibration or schedule already declares an explicit `default_resonance`; idempotent; conservative; never raises.
22
+
23
+ Previously in `5.10.0`: fixes the deep-sleep extract bloat that made Session 1 take ~57 minutes on some installs (new `bare_mode` on `run_automation_prompt` wires `claude --bare` for JSON-only extractor callers — ~4.3× faster per child, sourced from `ANTHROPIC_API_KEY` env or `~/.claude/anthropic-api-key.txt`). `caller=` is now **mandatory** on `run_automation_prompt` — no silent fallback; every automation subprocess traces back to a registered caller with a deliberate tier. Five personal scripts (`personal/email-monitor`, `personal/github-monitor`, `personal/post-x`, `personal/followup-runner`, `personal/orchestrator-v2`) joined the resonance map with tiers picked per caller based on what each one does. gbp/* marketing posts bumped from `medio` to `alto` (public-facing copy, quality first over speed). 65 legacy protocol debts bulk-resolved as part of the audit — the patterns that generated them are structurally closed by mandatory `caller=` + unified session log + bare_mode.
22
24
 
23
25
  Previously in `5.9.1`: adds `default_resonance` to `brain/calibration.json` via the Desktop-facing schema (`nexo schema --json`), so NEXO Desktop's Preferences dialog renders a select with `Máximo` / `Alto (recomendado)` / `Medio` / `Bajo` automatically — no Desktop release needed. `resolve_tier_for_caller` reads calibration first and falls back to the legacy `schedule.json` location. `nexo preferences --resonance` writes both. The UI control only affects interactive sessions (`nexo chat`, Desktop new conversation, interactive `nexo update`); crons and background processes stay pinned per caller in `resonance_map.py`.
24
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "mcpName": "io.github.wazionapps/nexo",
5
5
  "description": "NEXO Brain \u2014 Shared brain for AI agents. Persistent memory, semantic RAG, natural forgetting, metacognitive guard, trust scoring, 150+ MCP tools. Works with Claude Code, Codex, Claude Desktop & any MCP client. 100% local, free.",
6
6
  "homepage": "https://nexo-brain.com",
@@ -875,6 +875,104 @@ def _purge_zero_byte_db_files() -> list[Path]:
875
875
  return removed
876
876
 
877
877
 
878
+ def _migrate_effort_to_resonance(dest: Path = NEXO_HOME) -> list[str]:
879
+ """Auto-migrate legacy ``reasoning_effort`` preference into the new
880
+ ``preferences.default_resonance`` knob.
881
+
882
+ Context: before v5.9.0 the user's power-level preference lived in
883
+ ``config/schedule.json`` under
884
+ ``client_runtime_profiles.claude_code.reasoning_effort`` — one of
885
+ ``max`` / ``xhigh`` / ``high`` / ``medium``. v5.9.0 introduced the
886
+ resonance map, with ``preferences.default_resonance`` (one of
887
+ ``maximo`` / ``alto`` / ``medio`` / ``bajo``) written to
888
+ ``brain/calibration.json``. When the new code path kicks in, a user
889
+ whose only recorded preference is the legacy effort silently falls
890
+ back to ``DEFAULT_RESONANCE`` (``alto``), losing their prior
891
+ preference. v5.10.0 shipped without a migration for this; v5.10.1
892
+ adds it here.
893
+
894
+ The migration is idempotent and conservative: it only runs when the
895
+ user has NOT set ``default_resonance`` explicitly anywhere (neither
896
+ in ``calibration.json`` nor in ``schedule.json``). That means users
897
+ who already adjusted their preference through the Desktop UI or the
898
+ ``nexo preferences --resonance`` CLI keep whatever they chose; this
899
+ migration only recovers the legacy preference for users who never
900
+ touched either.
901
+
902
+ Mapping (mirrors ``_RESONANCE_TABLE`` in ``src/resonance_map.py``):
903
+ max → maximo
904
+ xhigh → alto
905
+ high → medio
906
+ medium → bajo
907
+
908
+ Returns the list of actions taken for logging. Failures are
909
+ swallowed: migration must never block an update.
910
+ """
911
+ import json as _json
912
+
913
+ actions: list[str] = []
914
+
915
+ cal_path = dest / "brain" / "calibration.json"
916
+ sched_path = dest / "config" / "schedule.json"
917
+
918
+ try:
919
+ cal = _json.loads(cal_path.read_text()) if cal_path.exists() else {}
920
+ if not isinstance(cal, dict):
921
+ cal = {}
922
+ except Exception:
923
+ cal = {}
924
+
925
+ try:
926
+ sched = _json.loads(sched_path.read_text()) if sched_path.exists() else {}
927
+ if not isinstance(sched, dict):
928
+ sched = {}
929
+ except Exception:
930
+ sched = {}
931
+
932
+ existing_cal_pref = ""
933
+ if isinstance(cal.get("preferences"), dict):
934
+ existing_cal_pref = str(cal["preferences"].get("default_resonance") or "").strip().lower()
935
+ existing_sched_pref = str(sched.get("default_resonance") or "").strip().lower()
936
+
937
+ valid_tiers = {"maximo", "alto", "medio", "bajo"}
938
+ if existing_cal_pref in valid_tiers or existing_sched_pref in valid_tiers:
939
+ return actions # user already has an explicit resonance preference
940
+
941
+ # Look up the legacy effort hint.
942
+ effort = ""
943
+ profiles = sched.get("client_runtime_profiles")
944
+ if isinstance(profiles, dict):
945
+ cc = profiles.get("claude_code") if isinstance(profiles.get("claude_code"), dict) else {}
946
+ effort = str(cc.get("reasoning_effort") or "").strip().lower()
947
+
948
+ legacy_map = {
949
+ "max": "maximo",
950
+ "xhigh": "alto",
951
+ "high": "medio",
952
+ "medium": "bajo",
953
+ }
954
+ target_tier = legacy_map.get(effort)
955
+ if not target_tier:
956
+ return actions # nothing usable to migrate from
957
+
958
+ # Write into calibration.json (canonical location for v5.9.1+).
959
+ try:
960
+ cal_path.parent.mkdir(parents=True, exist_ok=True)
961
+ prefs = cal.get("preferences")
962
+ if not isinstance(prefs, dict):
963
+ prefs = {}
964
+ prefs["default_resonance"] = target_tier
965
+ cal["preferences"] = prefs
966
+ cal_path.write_text(_json.dumps(cal, indent=2, ensure_ascii=False) + "\n")
967
+ actions.append(
968
+ f"resonance-migration:{effort}->{target_tier}"
969
+ )
970
+ except Exception as exc:
971
+ actions.append(f"resonance-migration-warning:{exc.__class__.__name__}")
972
+
973
+ return actions
974
+
975
+
878
976
  def _heal_deep_sleep_runtime(dest: Path = NEXO_HOME) -> list[str]:
879
977
  """Repair deep-sleep state that older runtimes left in a bad shape.
880
978
 
@@ -2697,6 +2795,19 @@ def _run_runtime_post_sync(dest: Path = NEXO_HOME, progress_fn=None) -> tuple[bo
2697
2795
  except Exception as exc:
2698
2796
  actions.append(f"deep-sleep-heal-warning:{exc.__class__.__name__}")
2699
2797
 
2798
+ # Recover the user's legacy reasoning_effort preference into the new
2799
+ # default_resonance knob. v5.10.0 left this gap — users who had
2800
+ # `reasoning_effort="max"` in schedule.json silently degraded to
2801
+ # DEFAULT_RESONANCE=alto when the resonance map took over. This
2802
+ # migration restores their choice exactly once.
2803
+ try:
2804
+ _emit_progress(progress_fn, "Migrating legacy effort preference to resonance...")
2805
+ mig_actions = _migrate_effort_to_resonance(dest)
2806
+ for action in mig_actions:
2807
+ actions.append(action)
2808
+ except Exception as exc:
2809
+ actions.append(f"resonance-migration-warning:{exc.__class__.__name__}")
2810
+
2700
2811
  _emit_progress(progress_fn, "Verifying runtime imports...")
2701
2812
  verify = subprocess.run(
2702
2813
  [sys.executable, "-c", "import server"],