nexo-brain 2.2.0 → 2.3.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.
- package/README.md +5 -5
- package/package.json +6 -3
- package/src/auto_update.py +26 -0
- package/src/crons/manifest.json +6 -13
- package/src/crons/sync.py +150 -6
- package/src/db/__init__.py +13 -0
- package/src/db/_core.py +1 -0
- package/src/db/_cron_runs.py +74 -0
- package/src/db/_entities.py +1 -0
- package/src/db/_episodic.py +41 -6
- package/src/db/_learnings.py +1 -0
- package/src/db/_reminders.py +1 -0
- package/src/db/_schema.py +64 -0
- package/src/db/_sessions.py +1 -0
- package/src/db/_skills.py +515 -0
- package/src/hooks/session-stop.sh +13 -101
- package/src/plugin_loader.py +1 -0
- package/src/plugins/episodic_memory.py +5 -3
- package/src/plugins/schedule.py +212 -0
- package/src/plugins/skills.py +264 -0
- package/src/plugins/update.py +1 -0
- package/src/scripts/deep-sleep/apply_findings.py +111 -8
- package/src/scripts/deep-sleep/collect.py +34 -11
- package/src/scripts/deep-sleep/extract-prompt.md +38 -0
- package/src/scripts/deep-sleep/extract.py +81 -8
- package/src/scripts/deep-sleep/synthesize-prompt.md +29 -1
- package/src/scripts/deep-sleep/synthesize.py +4 -1
- package/src/scripts/nexo-catchup.py +65 -29
- package/src/scripts/nexo-cron-wrapper.sh +53 -0
- package/src/scripts/nexo-daily-self-audit.py +4 -2
- package/src/scripts/nexo-deep-sleep.sh +66 -77
- package/src/scripts/nexo-evolution-run.py +13 -0
- package/src/scripts/nexo-learning-housekeep.py +157 -1
- package/src/scripts/nexo-learning-validator.py +19 -0
- package/src/scripts/nexo-postmortem-consolidator.py +3 -2
- package/src/scripts/nexo-sleep.py +16 -11
- package/src/scripts/nexo-synthesis.py +46 -3
- package/src/scripts/nexo-watchdog.sh +91 -30
- package/src/server.py +6 -1
- package/src/tools_coordination.py +1 -0
- package/src/tools_sessions.py +1 -0
- package/scripts/migrate-to-unified 2.sh +0 -813
- package/scripts/migrate-to-unified.sh +0 -813
- package/scripts/migrate-v1.5-to-v1.6 2.py +0 -778
- package/scripts/migrate-v1.5-to-v1.6.py +0 -778
- package/scripts/migrate-v1.7-to-v1.8 2.py +0 -214
- package/scripts/migrate-v1.7-to-v1.8.py +0 -214
- package/scripts/pre-commit-check 2.sh +0 -55
- package/scripts/pre-commit-check.sh +0 -55
- package/src/__pycache__/auto_update.cpython-310.pyc +0 -0
- package/src/__pycache__/hnsw_index.cpython-310.pyc +0 -0
- package/src/__pycache__/kg_populate.cpython-310.pyc +0 -0
- package/src/__pycache__/knowledge_graph.cpython-310.pyc +0 -0
- package/src/__pycache__/plugin_loader.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_coordination.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_credentials.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_learnings.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_menu.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_reminders.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_reminders_crud.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_sessions.cpython-310.pyc +0 -0
- package/src/__pycache__/tools_task_history.cpython-310.pyc +0 -0
- package/src/auto_close_sessions 2.py +0 -159
- package/src/auto_update 2.py +0 -634
- package/src/claim_graph 2.py +0 -323
- package/src/cognitive/__init__ 2.py +0 -62
- package/src/cognitive/__pycache__/__init__.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_core.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_decay.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_ingest.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_memory.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_search.cpython-310.pyc +0 -0
- package/src/cognitive/__pycache__/_trust.cpython-310.pyc +0 -0
- package/src/cognitive/_core 2.py +0 -567
- package/src/cognitive/_decay 2.py +0 -382
- package/src/cognitive/_ingest 2.py +0 -892
- package/src/cognitive/_memory 2.py +0 -912
- package/src/cognitive/_search 2.py +0 -949
- package/src/cognitive/_trust 2.py +0 -464
- package/src/crons/manifest 2.json +0 -106
- package/src/crons/sync 2.py +0 -217
- package/src/dashboard/__init__ 2.py +0 -0
- package/src/dashboard/__pycache__/__init__.cpython-310.pyc +0 -0
- package/src/dashboard/__pycache__/app.cpython-310.pyc +0 -0
- package/src/dashboard/app 2.py +0 -789
- package/src/db/__init__ 2.py +0 -89
- package/src/db/__pycache__/__init__.cpython-310.pyc +0 -0
- package/src/db/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/db/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_core.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_core.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_core.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_credentials.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_credentials.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_credentials.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_entities.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_entities.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_entities.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_episodic.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_episodic.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_episodic.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_evolution.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_evolution.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_evolution.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_fts.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_fts.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_fts.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_learnings.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_learnings.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_learnings.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_reminders.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_reminders.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_reminders.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_schema.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_schema.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_schema.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_sessions.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_sessions.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_sessions.cpython-314.pyc +0 -0
- package/src/db/__pycache__/_tasks.cpython-310.pyc +0 -0
- package/src/db/__pycache__/_tasks.cpython-312.pyc +0 -0
- package/src/db/__pycache__/_tasks.cpython-314.pyc +0 -0
- package/src/db/_core 2.py +0 -417
- package/src/db/_credentials 2.py +0 -124
- package/src/db/_entities 2.py +0 -178
- package/src/db/_episodic 2.py +0 -738
- package/src/db/_evolution 2.py +0 -54
- package/src/db/_fts 2.py +0 -406
- package/src/db/_learnings 2.py +0 -168
- package/src/db/_reminders 2.py +0 -338
- package/src/db/_schema 2.py +0 -364
- package/src/db/_sessions 2.py +0 -300
- package/src/db/_tasks 2.py +0 -91
- package/src/evolution_cycle 2.py +0 -266
- package/src/hnsw_index 2.py +0 -254
- package/src/hooks/auto_capture 2.py +0 -208
- package/src/hooks/caffeinate-guard 2.sh +0 -8
- package/src/hooks/capture-session 2.sh +0 -21
- package/src/hooks/capture-tool-logs 2.sh +0 -127
- package/src/hooks/daily-briefing-check 2.sh +0 -33
- package/src/hooks/inbox-hook 2.sh +0 -76
- package/src/hooks/post-compact 2.sh +0 -148
- package/src/hooks/pre-compact 2.sh +0 -151
- package/src/hooks/session-start 2.sh +0 -268
- package/src/hooks/session-stop 2.sh +0 -140
- package/src/kg_populate 2.py +0 -290
- package/src/knowledge_graph 2.py +0 -257
- package/src/maintenance 2.py +0 -59
- package/src/migrate_embeddings 2.py +0 -122
- package/src/plugin_loader 2.py +0 -202
- package/src/plugins/__init__ 2.py +0 -0
- package/src/plugins/__pycache__/__init__ 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/__init__.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/adaptive_mode 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/adaptive_mode.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/agents 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/agents.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/artifact_registry 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/artifact_registry.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/backup 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/backup.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/cognitive_memory 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/cognitive_memory.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/core_rules 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/core_rules.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/cortex 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/cortex.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/entities 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/entities.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/episodic_memory 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/episodic_memory.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/evolution 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/evolution.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/guard 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/guard.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/knowledge_graph_tools 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/knowledge_graph_tools.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/preferences 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/preferences.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/update 2.cpython-310.pyc +0 -0
- package/src/plugins/__pycache__/update.cpython-310.pyc +0 -0
- package/src/plugins/adaptive_mode 2.py +0 -805
- package/src/plugins/agents 2.py +0 -52
- package/src/plugins/artifact_registry 2.py +0 -450
- package/src/plugins/backup 2.py +0 -104
- package/src/plugins/cognitive_memory 2.py +0 -564
- package/src/plugins/core_rules 2.py +0 -252
- package/src/plugins/cortex 2.py +0 -299
- package/src/plugins/entities 2.py +0 -67
- package/src/plugins/episodic_memory 2.py +0 -533
- package/src/plugins/evolution 2.py +0 -115
- package/src/plugins/guard 2.py +0 -746
- package/src/plugins/knowledge_graph_tools 2.py +0 -105
- package/src/plugins/preferences 2.py +0 -47
- package/src/plugins/update 2.py +0 -256
- package/src/requirements 2.txt +0 -12
- package/src/rules/__init__ 2.py +0 -0
- package/src/rules/core-rules 2.json +0 -331
- package/src/rules/migrate 2.py +0 -207
- package/src/scripts/check-context 2.py +0 -264
- package/src/scripts/nexo-auto-update 2.py +0 -6
- package/src/scripts/nexo-backup 2.sh +0 -25
- package/src/scripts/nexo-brain-activation 2.sh +0 -140
- package/src/scripts/nexo-catchup 2.py +0 -242
- package/src/scripts/nexo-cognitive-decay 2.py +0 -182
- package/src/scripts/nexo-daily-self-audit 2.py +0 -552
- package/src/scripts/nexo-deep-sleep 2.sh +0 -97
- package/src/scripts/nexo-evolution-run 2.py +0 -597
- package/src/scripts/nexo-followup-hygiene 2.py +0 -112
- package/src/scripts/nexo-github-monitor 2.py +0 -256
- package/src/scripts/nexo-github-monitor.py +0 -256
- package/src/scripts/nexo-immune 2.py +0 -927
- package/src/scripts/nexo-inbox-hook 2.sh +0 -74
- package/src/scripts/nexo-install 2.py +0 -6
- package/src/scripts/nexo-learning-housekeep 2.py +0 -245
- package/src/scripts/nexo-learning-validator 2.py +0 -207
- package/src/scripts/nexo-migrate 2.py +0 -232
- package/src/scripts/nexo-postmortem-consolidator 2.py +0 -421
- package/src/scripts/nexo-pre-commit 2.py +0 -120
- package/src/scripts/nexo-prevent-sleep 2.sh +0 -29
- package/src/scripts/nexo-proactive-dashboard 2.py +0 -345
- package/src/scripts/nexo-reflection 2.py +0 -253
- package/src/scripts/nexo-runtime-preflight 2.py +0 -274
- package/src/scripts/nexo-send-email 2.py +0 -25
- package/src/scripts/nexo-send-email.py +0 -25
- package/src/scripts/nexo-send-reply 2.py +0 -178
- package/src/scripts/nexo-send-reply.py +0 -178
- package/src/scripts/nexo-sleep 2.py +0 -592
- package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
- package/src/scripts/nexo-synthesis 2.py +0 -253
- package/src/scripts/nexo-tcc-approve 2.sh +0 -79
- package/src/scripts/nexo-update 2.sh +0 -161
- package/src/scripts/nexo-watchdog 2.sh +0 -878
- package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
- package/src/server 2.py +0 -733
- package/src/storage_router 2.py +0 -32
- package/src/tools_coordination 2.py +0 -102
- package/src/tools_credentials 2.py +0 -68
- package/src/tools_learnings 2.py +0 -220
- package/src/tools_menu 2.py +0 -227
- package/src/tools_reminders 2.py +0 -86
- package/src/tools_reminders_crud 2.py +0 -159
- package/src/tools_sessions 2.py +0 -476
- package/src/tools_task_history 2.py +0 -57
- package/templates/CLAUDE.md 2.template +0 -63
- package/templates/openclaw 2.json +0 -13
- package/tests/__init__ 2.py +0 -0
- package/tests/__init__.py +0 -0
- package/tests/conftest 2.py +0 -71
- package/tests/conftest.py +0 -71
- package/tests/test_cognitive 2.py +0 -205
- package/tests/test_cognitive.py +0 -205
- package/tests/test_knowledge_graph 2.py +0 -140
- package/tests/test_knowledge_graph.py +0 -140
- package/tests/test_migrations 2.py +0 -137
- package/tests/test_migrations.py +0 -137
|
@@ -32,39 +32,97 @@ TS_EPOCH=$(date +%s)
|
|
|
32
32
|
log() { echo "[$TS] $1" >> "$LOG"; }
|
|
33
33
|
|
|
34
34
|
# ============================================================================
|
|
35
|
-
# MONITOR REGISTRY —
|
|
35
|
+
# MONITOR REGISTRY — generated dynamically from manifest.json
|
|
36
36
|
# ============================================================================
|
|
37
|
-
# Format: NAME|PLIST_ID|LOG_STDOUT|LOG_STDERR|MAX_STALE_SECS|PROCESS_GREP|SCHEDULE_DESC
|
|
37
|
+
# Format: NAME|PLIST_ID|LOG_STDOUT|LOG_STDERR|MAX_STALE_SECS|PROCESS_GREP|SCHEDULE_DESC|TYPE
|
|
38
38
|
#
|
|
39
39
|
# MAX_STALE_SECS: how old stdout log can be before WARN.
|
|
40
40
|
# 0 = skip staleness check (for one-shot or infrequent tasks)
|
|
41
41
|
# WARN at MAX_STALE_SECS, FAIL at 3x MAX_STALE_SECS
|
|
42
42
|
# PROCESS_GREP: pattern to grep in ps (empty = skip process check)
|
|
43
43
|
# ============================================================================
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
# Add
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
# Core monitors are built from crons/manifest.json (single source of truth).
|
|
45
|
+
# The NEXO_CODE env var must point to the repo src/ directory.
|
|
46
|
+
# Add personal (non-manifest) monitors to PERSONAL_MONITORS below.
|
|
47
|
+
NEXO_CODE="${NEXO_CODE:-$(cd "$(dirname "$0")/.." 2>/dev/null && pwd)}"
|
|
48
|
+
MANIFEST_FILE="$NEXO_CODE/crons/manifest.json"
|
|
49
|
+
|
|
50
|
+
_build_monitors_from_manifest() {
|
|
51
|
+
if [ ! -f "$MANIFEST_FILE" ]; then
|
|
52
|
+
log "WARNING: manifest.json not found at $MANIFEST_FILE — no core monitors loaded"
|
|
53
|
+
return
|
|
54
|
+
fi
|
|
55
|
+
python3 -c "
|
|
56
|
+
import json, sys
|
|
57
|
+
|
|
58
|
+
nexo_home = '$NEXO_HOME'
|
|
59
|
+
|
|
60
|
+
with open('$MANIFEST_FILE') as f:
|
|
61
|
+
data = json.load(f)
|
|
62
|
+
|
|
63
|
+
for c in data.get('crons', []):
|
|
64
|
+
cid = c['id']
|
|
65
|
+
# Derive human-readable name from id
|
|
66
|
+
name = cid.replace('-', ' ').title()
|
|
67
|
+
plist_id = 'com.nexo.' + cid
|
|
68
|
+
stdout_log = nexo_home + '/logs/' + cid + '-stdout.log'
|
|
69
|
+
stderr_log = nexo_home + '/logs/' + cid + '-stderr.log'
|
|
70
|
+
|
|
71
|
+
# Derive max_stale_secs and schedule_desc from schedule config
|
|
72
|
+
if c.get('run_at_load'):
|
|
73
|
+
max_stale = 0
|
|
74
|
+
schedule_desc = 'RunAtLoad once'
|
|
75
|
+
elif 'interval_seconds' in c:
|
|
76
|
+
iv = c['interval_seconds']
|
|
77
|
+
# Allow 2x the interval before WARN
|
|
78
|
+
max_stale = iv * 2
|
|
79
|
+
if iv >= 3600:
|
|
80
|
+
schedule_desc = f'Every {iv // 3600}h'
|
|
81
|
+
else:
|
|
82
|
+
schedule_desc = f'Every {iv // 60} min'
|
|
83
|
+
elif 'schedule' in c:
|
|
84
|
+
s = c['schedule']
|
|
85
|
+
h = s.get('hour', 0)
|
|
86
|
+
m = s.get('minute', 0)
|
|
87
|
+
if 'weekday' in s:
|
|
88
|
+
days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
|
89
|
+
schedule_desc = f'Weekly {days[s[\"weekday\"]]} {h}:{m:02d}'
|
|
90
|
+
max_stale = 0 # weekly tasks: skip staleness
|
|
91
|
+
else:
|
|
92
|
+
schedule_desc = f'Daily {h}:{m:02d}'
|
|
93
|
+
max_stale = 90000 # ~25h
|
|
94
|
+
else:
|
|
95
|
+
max_stale = 0
|
|
96
|
+
schedule_desc = 'unknown'
|
|
97
|
+
|
|
98
|
+
mon_type = 'core' if c.get('core') else 'personal'
|
|
99
|
+
proc_grep = '' # manifest crons are one-shot, no persistent process
|
|
100
|
+
|
|
101
|
+
print(f'{name}|{plist_id}|{stdout_log}|{stderr_log}|{max_stale}|{proc_grep}|{schedule_desc}|{mon_type}')
|
|
102
|
+
" 2>/dev/null
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
MONITORS=()
|
|
106
|
+
while IFS= read -r line; do
|
|
107
|
+
[ -n "$line" ] && MONITORS+=("$line")
|
|
108
|
+
done < <(_build_monitors_from_manifest)
|
|
109
|
+
|
|
110
|
+
# Personal (non-manifest) monitors — add yours below.
|
|
111
|
+
# These are NOT in manifest.json and won't be synced by cron-sync.
|
|
112
|
+
PERSONAL_MONITORS=(
|
|
61
113
|
# "My Service|com.nexo.my-service|$NEXO_HOME/logs/my-service.log||3600||Every 30 min|personal"
|
|
62
114
|
)
|
|
115
|
+
MONITORS+=("${PERSONAL_MONITORS[@]+"${PERSONAL_MONITORS[@]}"}")
|
|
63
116
|
|
|
64
117
|
# Cron jobs to check (NAME|SCRIPT|CHECK_PATH|MAX_STALE_SECS|SCHEDULE)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
)
|
|
118
|
+
# Core cron monitors are loaded from manifest above.
|
|
119
|
+
# Maintainer-only monitors go here (guarded by NEXO_MAINTAINER env var).
|
|
120
|
+
CRON_MONITORS=()
|
|
121
|
+
if [ "${NEXO_MAINTAINER:-}" = "1" ]; then
|
|
122
|
+
CRON_MONITORS+=(
|
|
123
|
+
"Backup|$NEXO_DIR/scripts/nexo-backup.sh|$NEXO_DIR/backups/|7200|Hourly"
|
|
124
|
+
)
|
|
125
|
+
fi
|
|
68
126
|
|
|
69
127
|
# Error patterns to search in stderr logs (last 50 lines)
|
|
70
128
|
ERROR_PATTERNS="Traceback|Error:|CRITICAL|FATAL|ModuleNotFoundError|PermissionError|FileNotFoundError|ConnectionRefused|Errno"
|
|
@@ -234,16 +292,18 @@ try_verify_repair() {
|
|
|
234
292
|
}
|
|
235
293
|
|
|
236
294
|
try_repair_backup() {
|
|
237
|
-
|
|
295
|
+
# Use the core backup script (nexo-backup.sh)
|
|
296
|
+
local backup_script="$NEXO_DIR/scripts/nexo-backup.sh"
|
|
297
|
+
[ ! -x "$backup_script" ] && backup_script="$SCRIPT_DIR/nexo-backup.sh"
|
|
238
298
|
if [ -x "$backup_script" ]; then
|
|
239
|
-
"$backup_script" 2>/dev/null
|
|
299
|
+
bash "$backup_script" 2>/dev/null
|
|
240
300
|
sleep 1
|
|
241
301
|
local newest
|
|
242
302
|
newest=$(ls -t "$NEXO_DIR/backups/nexo-"*.db 2>/dev/null | head -1)
|
|
243
303
|
if [ -n "$newest" ]; then
|
|
244
304
|
if $IS_MACOS; then local age=$(( TS_EPOCH - $(stat -f %m "$newest") )); else local age=$(( TS_EPOCH - $(stat -c %Y "$newest") )); fi
|
|
245
305
|
if [ "$age" -lt 60 ]; then
|
|
246
|
-
log_repair "
|
|
306
|
+
log_repair "nexo-backup.sh: ran successfully, fresh backup created"
|
|
247
307
|
return 0
|
|
248
308
|
fi
|
|
249
309
|
fi
|
|
@@ -775,12 +835,12 @@ ${STDOUT_TAIL}
|
|
|
775
835
|
log "Launching NEXO Level 2 repair..."
|
|
776
836
|
|
|
777
837
|
# Build propagation instructions if core services failed
|
|
778
|
-
# Only
|
|
838
|
+
# Only runs when NEXO_MAINTAINER=1 and NEXO_PUBLIC_REPO is configured
|
|
779
839
|
PROPAGATE_BLOCK=""
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
840
|
+
if [ "${NEXO_MAINTAINER:-}" = "1" ]; then
|
|
841
|
+
NEXO_PUBLIC_REPO="${NEXO_PUBLIC_REPO:-}"
|
|
842
|
+
if $HAS_CORE_FAILS && [ -n "$NEXO_PUBLIC_REPO" ] && [ -d "$NEXO_PUBLIC_REPO/.git" ]; then
|
|
843
|
+
PROPAGATE_BLOCK="
|
|
784
844
|
PROPAGATION (for [core] fixes ONLY):
|
|
785
845
|
If your fix modifies a file under $NEXO_HOME/ (server.py, db/, plugins/, scripts/):
|
|
786
846
|
1. Commit the fix locally with a descriptive message
|
|
@@ -789,6 +849,7 @@ If your fix modifies a file under $NEXO_HOME/ (server.py, db/, plugins/, scripts
|
|
|
789
849
|
4. Commit + push
|
|
790
850
|
5. Create a GitHub release with gh release create
|
|
791
851
|
Do NOT propagate fixes for [personal] services — those stay local only."
|
|
852
|
+
fi
|
|
792
853
|
fi
|
|
793
854
|
|
|
794
855
|
# Write prompt to temp file (avoids heredoc quoting issues in subshell)
|
package/src/server.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
"""NEXO MCP Server — Phase 4: Hot-Reload Plugin System."""
|
|
2
3
|
|
|
3
4
|
import os
|
|
@@ -106,8 +107,12 @@ mcp = FastMCP(
|
|
|
106
107
|
"- **Delegate:** prefer direct. If needed: `nexo_context_packet(area)` + guard + 'if unsure STOP'\n"
|
|
107
108
|
"- **Memory:** `nexo_recall` searches all. Capture: errors→`nexo_learning_add`, prefs, entities, decisions\n"
|
|
108
109
|
"- **Change log:** `nexo_change_log(...)` after production edits. NOT for config dir\n"
|
|
109
|
-
"- **Diary:**
|
|
110
|
+
"- **Diary:** When user signals end of session (any language, any style — 'bye', 'done', 'cierro', etc.), "
|
|
111
|
+
"write `nexo_session_diary_write(...)` with self_critique BEFORE responding. "
|
|
112
|
+
"Detect intent, not keywords. If session closes without diary, auto_close handles it.\n"
|
|
110
113
|
"- **Cortex:** `nexo_cortex_check` before budget/campaign/architecture changes\n"
|
|
114
|
+
"- **Skills:** before multi-step tasks, `nexo_skill_match(task)` to find reusable procedures. "
|
|
115
|
+
"If match found, read it and follow the steps. After completion, `nexo_skill_result(id, success, context)` to record outcome.\n"
|
|
111
116
|
"- **Dissonance:** user contradicts memory→`nexo_cognitive_dissonance`. Frustrated→force=True\n"
|
|
112
117
|
"- **Trust:** <40=paranoid verify twice, >80=fluid. Check: `nexo_cognitive_trust`"
|
|
113
118
|
),
|
package/src/tools_sessions.py
CHANGED