nexo-brain 5.3.19 → 5.3.21
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/.claude-plugin/plugin.json +1 -1
- package/bin/nexo-brain.js +52 -10
- package/package.json +1 -1
- package/src/auto_update.py +11 -8
- package/src/dashboard/static/favicon 2.svg +32 -0
- package/src/dashboard/static/nexo-logo 2.png +0 -0
- package/src/dashboard/static/nexo-logo 2.svg +40 -0
- package/src/dashboard/static/style 2.css +2458 -0
- package/src/dashboard/templates/adaptive 2.html +118 -0
- package/src/dashboard/templates/artifacts 2.html +133 -0
- package/src/dashboard/templates/backups 2.html +136 -0
- package/src/dashboard/templates/base 2.html +417 -0
- package/src/dashboard/templates/calendar 2.html +591 -0
- package/src/dashboard/templates/chat 2.html +356 -0
- package/src/dashboard/templates/claims 2.html +259 -0
- package/src/dashboard/templates/cortex 2.html +321 -0
- package/src/dashboard/templates/credentials 2.html +128 -0
- package/src/dashboard/templates/crons 2.html +370 -0
- package/src/dashboard/templates/dashboard 2.html +494 -0
- package/src/dashboard/templates/dreams 2.html +252 -0
- package/src/dashboard/templates/email 2.html +160 -0
- package/src/dashboard/templates/evolution 2.html +189 -0
- package/src/dashboard/templates/feed 2.html +249 -0
- package/src/dashboard/templates/followup_health 2.html +170 -0
- package/src/dashboard/templates/graph 2.html +201 -0
- package/src/dashboard/templates/guard 2.html +259 -0
- package/src/dashboard/templates/inbox 2.html +251 -0
- package/src/dashboard/templates/memory 2.html +420 -0
- package/src/dashboard/templates/operations 2.html +608 -0
- package/src/dashboard/templates/plugins 2.html +185 -0
- package/src/dashboard/templates/protocol 2.html +199 -0
- package/src/dashboard/templates/rules 2.html +246 -0
- package/src/dashboard/templates/sentiment 2.html +247 -0
- package/src/dashboard/templates/sessions 2.html +218 -0
- package/src/dashboard/templates/skills 2.html +329 -0
- package/src/dashboard/templates/somatic 2.html +73 -0
- package/src/dashboard/templates/triggers 2.html +133 -0
- package/src/dashboard/templates/trust 2.html +360 -0
- package/src/db/__init__ 2.py +259 -0
- package/src/db/_core 2.py +437 -0
- package/src/db/_credentials 2.py +124 -0
- package/src/db/_episodic 2.py +762 -0
- package/src/db/_evolution 2.py +54 -0
- package/src/db/_fts 2.py +406 -0
- package/src/db/_goal_profiles 2.py +376 -0
- package/src/db/_hot_context 2.py +660 -0
- package/src/db/_outcomes 2.py +800 -0
- package/src/db/_personal_scripts 2.py +582 -0
- package/src/db/_sessions 2.py +330 -0
- package/src/db/_tasks 2.py +91 -0
- package/src/db/_watchers 2.py +173 -0
- package/src/doctor/formatters 2.py +52 -0
- package/src/doctor/models 2.py +69 -0
- package/src/doctor/planes 2.py +87 -0
- package/src/doctor/providers/__init__ 2.py +1 -0
- package/src/doctor/providers/deep 2.py +367 -0
- package/src/evolution_cycle 2.py +519 -0
- package/src/hooks/auto_capture 2.py +208 -0
- package/src/hooks/caffeinate-guard 2.sh +8 -0
- package/src/hooks/capture-session 2.sh +21 -0
- package/src/hooks/capture-tool-logs 2.sh +158 -0
- package/src/hooks/daily-briefing-check 2.sh +33 -0
- package/src/hooks/heartbeat-enforcement 2.py +90 -0
- package/src/hooks/heartbeat-posttool 2.sh +18 -0
- package/src/hooks/inbox-hook 2.sh +76 -0
- package/src/hooks/post-compact 2.sh +152 -0
- package/src/hooks/pre-compact 2.sh +169 -0
- package/src/hooks/protocol-guardrail 2.sh +10 -0
- package/src/hooks/protocol-pretool-guardrail 2.sh +9 -0
- package/src/hooks/session-stop 2.sh +52 -0
- package/src/kg_populate 2.py +292 -0
- package/src/maintenance 2.py +53 -0
- package/src/memory_backends 2.py +71 -0
- package/src/migrate_embeddings 2.py +124 -0
- package/src/nexo_sdk 2.py +103 -0
- package/src/observability 2.py +199 -0
- package/src/plugin_loader 2.py +217 -0
- package/src/plugins/__init__ 2.py +0 -0
- package/src/plugins/artifact_registry 2.py +450 -0
- package/src/plugins/backup 2.py +127 -0
- package/src/plugins/claims_tools 2.py +119 -0
- package/src/plugins/cognitive_memory 2.py +609 -0
- package/src/plugins/core_rules 2.py +252 -0
- package/src/plugins/cortex 2.py +1155 -0
- package/src/plugins/entities 2.py +67 -0
- package/src/plugins/episodic_memory 2.py +560 -0
- package/src/plugins/evolution 2.py +167 -0
- package/src/plugins/goal_engine 2.py +142 -0
- package/src/plugins/guard 2.py +862 -0
- package/src/plugins/impact 2.py +29 -0
- package/src/plugins/knowledge_graph_tools 2.py +137 -0
- package/src/plugins/media_memory_tools 2.py +98 -0
- package/src/plugins/memory_export 2.py +196 -0
- package/src/plugins/outcomes 2.py +130 -0
- package/src/plugins/personal_scripts 2.py +117 -0
- package/src/plugins/preferences 2.py +47 -0
- package/src/plugins/protocol 2.py +1449 -0
- package/src/plugins/simple_api 2.py +106 -0
- package/src/plugins/skills 2.py +341 -0
- package/src/plugins/state_watchers 2.py +79 -0
- package/src/plugins/update 2.py +986 -0
- package/src/plugins/user_state_tools 2.py +43 -0
- package/src/plugins/workflow 2.py +588 -0
- package/src/protocol_settings 2.py +59 -0
- package/src/public_contribution 2.py +466 -0
- package/src/public_evolution_queue 2.py +241 -0
- package/src/requirements 2.txt +14 -0
- package/src/retroactive_learnings 2.py +373 -0
- package/src/rules/__init__ 2.py +0 -0
- package/src/rules/core-rules 2.json +331 -0
- package/src/rules/migrate 2.py +207 -0
- package/src/runtime_power 2.py +874 -0
- package/src/script_registry 2.py +1559 -0
- package/src/scripts/check-context 2.py +272 -0
- package/src/scripts/deep-sleep/apply_findings 2.py +2327 -0
- package/src/scripts/deep-sleep/collect 2.py +928 -0
- package/src/scripts/deep-sleep/extract 2.py +330 -0
- package/src/scripts/deep-sleep/extract-prompt 2.md +285 -0
- package/src/scripts/deep-sleep/synthesize 2.py +312 -0
- package/src/scripts/deep-sleep/synthesize-prompt 2.md +336 -0
- package/src/scripts/nexo-agent-run 2.py +75 -0
- package/src/scripts/nexo-auto-update 2.py +6 -0
- package/src/scripts/nexo-backup 2.sh +25 -0
- package/src/scripts/nexo-brain-activation 2.sh +140 -0
- package/src/scripts/nexo-catchup 2.py +300 -0
- package/src/scripts/nexo-cognitive-decay 2.py +257 -0
- package/src/scripts/nexo-cortex-cycle 2.py +293 -0
- package/src/scripts/nexo-cron-wrapper 2.sh +53 -0
- package/src/scripts/nexo-daily-self-audit 2.py +2161 -0
- package/src/scripts/nexo-dashboard 2.sh +29 -0
- package/src/scripts/nexo-deep-sleep 2.sh +86 -0
- package/src/scripts/nexo-evolution-run 2.py +1664 -0
- package/src/scripts/nexo-followup-hygiene 2.py +139 -0
- package/src/scripts/nexo-hook-record 2.py +42 -0
- package/src/scripts/nexo-immune 2.py +936 -0
- package/src/scripts/nexo-impact-scorer 2.py +117 -0
- package/src/scripts/nexo-inbox-hook 2.sh +74 -0
- package/src/scripts/nexo-install 2.py +6 -0
- package/src/scripts/nexo-learning-housekeep 2.py +401 -0
- package/src/scripts/nexo-learning-validator 2.py +266 -0
- package/src/scripts/nexo-migrate 2.py +260 -0
- package/src/scripts/nexo-outcome-checker 2.py +127 -0
- package/src/scripts/nexo-postmortem-consolidator 2.py +456 -0
- package/src/scripts/nexo-pre-commit 2.py +120 -0
- package/src/scripts/nexo-prevent-sleep 2.sh +35 -0
- package/src/scripts/nexo-proactive-dashboard 2.py +354 -0
- package/src/scripts/nexo-reflection 2.py +256 -0
- package/src/scripts/nexo-runtime-preflight 2.py +274 -0
- package/src/scripts/nexo-sleep 2.py +631 -0
- package/src/scripts/nexo-snapshot-restore 2.sh +35 -0
- package/src/scripts/nexo-sync-clients 2.py +16 -0
- package/src/scripts/nexo-synthesis 2.py +475 -0
- package/src/scripts/nexo-tcc-approve 2.sh +79 -0
- package/src/scripts/nexo-update 2.sh +306 -0
- package/src/scripts/nexo-watchdog 2.sh +1207 -0
- package/src/scripts/nexo-watchdog-smoke 2.py +119 -0
- package/src/scripts/rehydrate_learnings_from_archive 2.py +245 -0
- package/src/server 2.py +1296 -0
- package/src/skills/run-nexo-audit-phase/guide 2.md +43 -0
- package/src/skills/run-nexo-audit-phase/skill 2.json +59 -0
- package/src/skills/run-nexo-core-fix-cycle/guide 2.md +17 -0
- package/src/skills/run-nexo-core-fix-cycle/script 2.py +276 -0
- package/src/skills/run-nexo-core-fix-cycle/skill 2.json +58 -0
- package/src/skills/run-release-final-audit/guide 2.md +16 -0
- package/src/skills/run-release-final-audit/script 2.py +259 -0
- package/src/skills/run-release-final-audit/skill 2.json +77 -0
- package/src/skills/run-runtime-doctor/guide 2.md +12 -0
- package/src/skills/run-runtime-doctor/script 2.py +21 -0
- package/src/skills/run-runtime-doctor/skill 2.json +25 -0
- package/src/skills_runtime 2.py +932 -0
- package/src/state_watchers_runtime 2.py +475 -0
- package/src/storage_router 2.py +32 -0
- package/src/system_catalog 2.py +786 -0
- package/src/tools_coordination 2.py +103 -0
- package/src/tools_credentials 2.py +68 -0
- package/src/tools_drive 2.py +487 -0
- package/src/tools_hot_context 2.py +163 -0
- package/src/tools_learnings 2.py +612 -0
- package/src/tools_menu 2.py +229 -0
- package/src/tools_reminders 2.py +88 -0
- package/src/tools_reminders_crud 2.py +363 -0
- package/src/tools_sessions 2.py +1054 -0
- package/src/tools_system_catalog 2.py +19 -0
- package/src/tools_task_history 2.py +57 -0
- package/src/tools_transcripts 2.py +98 -0
- package/src/transcript_utils 2.py +412 -0
- package/src/user_context 2.py +46 -0
- package/src/user_data_portability 2.py +328 -0
- package/src/user_state_model 2.py +170 -0
- package/templates/CLAUDE.md 2.template +108 -0
- package/templates/CODEX.AGENTS.md 2.template +66 -0
- package/templates/launchagents/README 2.md +132 -0
- package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +39 -0
- package/templates/launchagents/com.nexo.catchup 2.plist +39 -0
- package/templates/launchagents/com.nexo.cognitive-decay 2.plist +40 -0
- package/templates/launchagents/com.nexo.dashboard 2.plist +43 -0
- package/templates/launchagents/com.nexo.deep-sleep 2.plist +43 -0
- package/templates/launchagents/com.nexo.evolution 2.plist +44 -0
- package/templates/launchagents/com.nexo.followup-hygiene 2.plist +45 -0
- package/templates/launchagents/com.nexo.immune 2.plist +41 -0
- package/templates/launchagents/com.nexo.postmortem 2.plist +45 -0
- package/templates/launchagents/com.nexo.self-audit 2.plist +47 -0
- package/templates/launchagents/com.nexo.synthesis 2.plist +45 -0
- package/templates/launchagents/com.nexo.watchdog 2.plist +37 -0
- package/templates/nexo_helper 2.py +301 -0
- package/templates/openclaw 2.json +13 -0
- package/templates/plugin-template 2.py +40 -0
- package/templates/script-template 2.py +59 -0
- package/templates/script-template 2.sh +13 -0
- package/templates/skill-script-template 2.py +48 -0
- package/templates/skill-template 2.md +33 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Run NEXO Audit Phase
|
|
2
|
+
|
|
3
|
+
Usa esta skill cuando haya que ejecutar una fase de auditoria de NEXO y el cuello de botella sea decidir el alcance de `evolution_apply` y arrancar una tanda de items con disciplina empirica.
|
|
4
|
+
|
|
5
|
+
## Pasos
|
|
6
|
+
1. Abre `goal + workflow + task` y fija el terreno real antes de interpretar el informe:
|
|
7
|
+
- repo/runtime activo
|
|
8
|
+
- DB real
|
|
9
|
+
- mecanismo de update
|
|
10
|
+
- tests y estado git
|
|
11
|
+
2. Fija la regla de autonomia antes de empezar:
|
|
12
|
+
- Francisco no quiere checkpoints uno-a-uno para trabajo mecanico
|
|
13
|
+
- NEXO hace branches, PRs, merge y reporta despues con evidencia
|
|
14
|
+
- solo un blast radius arquitectonico enorme merece checkpoint
|
|
15
|
+
3. Trata `evolution_apply` como una decision tecnica de implementacion, no como permiso humano:
|
|
16
|
+
- el camino de apply ya existe via `evolution_log` + `_apply_accepted_proposals`
|
|
17
|
+
- el sandbox/snapshot/rollback protege la materializacion del cambio aceptado
|
|
18
|
+
- no dupliques ese mecanismo en deep sleep ni en el runner de auditoria
|
|
19
|
+
4. Lanza la verificacion empirica de todos los items en paralelo:
|
|
20
|
+
- `grep + read` del codigo
|
|
21
|
+
- SQL/schema real
|
|
22
|
+
- AST/tests/imports/logs cuando aplique
|
|
23
|
+
- asume FP hasta que la evidencia lo contradiga
|
|
24
|
+
5. Clasifica cada item:
|
|
25
|
+
- `real_gap`
|
|
26
|
+
- `casi_fp`
|
|
27
|
+
- `fp`
|
|
28
|
+
6. Ordena solo los `real_gap` por riesgo/blast radius y ejecutalos con worktree aislado si tocan core.
|
|
29
|
+
7. Por cada `real_gap`:
|
|
30
|
+
- `guard_check`
|
|
31
|
+
- `track`
|
|
32
|
+
- branch propia
|
|
33
|
+
- implementacion minima
|
|
34
|
+
- tests adyacentes
|
|
35
|
+
- PR + auto-merge squash
|
|
36
|
+
- seguir al siguiente sin esperar CI salvo bloqueo real
|
|
37
|
+
8. Para `fp` o `casi_fp`, captura learning/patron reusable en vez de reimplementar.
|
|
38
|
+
9. Cierra la fase con evidencia real: PRs, tests, merge status y resultados de verificacion.
|
|
39
|
+
|
|
40
|
+
## Gotchas
|
|
41
|
+
- Learning #198: no confundas "como trabaja NEXO" con "que puede aplicar evolution_apply". Lo primero ya esta resuelto: autonomia total.
|
|
42
|
+
- `apply_findings.py` ya stagea `code_change` en `evolution_log`; `nexo-evolution-run.py` ya consume `accepted` con sandbox/snapshot/rollback. Si el item pide eso, primero verifica si ya existe.
|
|
43
|
+
- En Fase 1+2 la auditoria automatica sobreestimo ~70% de gaps. Si no hay evidencia dura, no abras codigo.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "SK-RUN-NEXO-AUDIT-PHASE",
|
|
3
|
+
"name": "Run NEXO Audit Phase",
|
|
4
|
+
"description": "Workflow para ejecutar una fase de auditoria de NEXO con autonomia total y verificacion empirica. Cubre el patron repetido de decidir el scope de evolution_apply y arrancar una tanda de items sin checkpoints manuales.",
|
|
5
|
+
"level": "published",
|
|
6
|
+
"mode": "guide",
|
|
7
|
+
"source_kind": "core",
|
|
8
|
+
"execution_level": "none",
|
|
9
|
+
"approval_required": false,
|
|
10
|
+
"tags": [
|
|
11
|
+
"nexo",
|
|
12
|
+
"audit",
|
|
13
|
+
"evolution",
|
|
14
|
+
"sandbox",
|
|
15
|
+
"verification",
|
|
16
|
+
"core"
|
|
17
|
+
],
|
|
18
|
+
"trigger_patterns": [
|
|
19
|
+
"evolution_apply sandbox scope",
|
|
20
|
+
"fase 2 item 1",
|
|
21
|
+
"arrancar verificacion empirica",
|
|
22
|
+
"ejecutar fase de auditoria nexo",
|
|
23
|
+
"audit phase nexo",
|
|
24
|
+
"7 items audit"
|
|
25
|
+
],
|
|
26
|
+
"steps": [
|
|
27
|
+
"Abrir goal, workflow y task antes de tocar la auditoria; resolver repo/runtime real, DB real, tests y estado git antes de interpretar el informe.",
|
|
28
|
+
"Fijar la regla de autonomia: NEXO hace branches, PRs, merge y progreso periodico; no pedir checkpoints uno-a-uno a Francisco para trabajo mecanico.",
|
|
29
|
+
"Para `evolution_apply`, separar dos planos: el sandbox es para materializar/aplicar cambios aceptados con snapshot/rollback; no es un freno para el modo de trabajo autonomo del agente.",
|
|
30
|
+
"Lanzar verificacion empirica de TODOS los items en paralelo: grep+read, SQL/schema real, AST/tests, logs. Partir de la hipotesis de FP hasta tener evidencia.",
|
|
31
|
+
"Clasificar cada item en `real_gap`, `casi_fp` o `fp` y ordenar solo los reales por blast radius/riesgo.",
|
|
32
|
+
"Si hay que tocar core, usar worktree aislado; por item real: guard_check -> track -> branch -> implement -> tests adyacentes -> PR -> auto-merge squash.",
|
|
33
|
+
"Para items FP o casi-FP, capturar learning o ajustar el patron reusable en vez de reimplementar.",
|
|
34
|
+
"Cerrar con evidencia de PRs, tests y merge status reales; no usar diarios o workflow text como sustituto."
|
|
35
|
+
],
|
|
36
|
+
"gotchas": [
|
|
37
|
+
"No pedir aprobacion manual a Francisco para cada PR: learning #198 confirma autonomia total con transparencia y reportes periodicos.",
|
|
38
|
+
"No duplicar el sandbox de evolution en otros sitios: el apply de cambios aceptados ya reutiliza evolution_log + sandbox/snapshot/rollback.",
|
|
39
|
+
"El ratio historico de FPs en esta clase de auditoria es alto; si no hay evidencia concreta, el item no se toca."
|
|
40
|
+
],
|
|
41
|
+
"params_schema": {
|
|
42
|
+
"audit_file": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"required": true
|
|
45
|
+
},
|
|
46
|
+
"phase_label": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"required": false,
|
|
49
|
+
"default": ""
|
|
50
|
+
},
|
|
51
|
+
"repo_path": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"required": false,
|
|
54
|
+
"default": ""
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"command_template": {},
|
|
58
|
+
"stable_after_uses": 5
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Run NEXO Core Fix Cycle
|
|
2
|
+
|
|
3
|
+
Usa esta skill cuando haya que implementar y verificar un grupo pequeño de fixes del core de NEXO sin improvisar el plano ni repetir siempre la misma fase de descubrimiento y test.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
1. Fija primero el plano: repo público `nexo`, runtime instalado `~/.nexo` y claims/documentación pública. No mezcles esos tres mundos.
|
|
7
|
+
2. Abre `nexo_task_open(...)` y `nexo_workflow_open(...)` antes de tocar código. Si el fix es de acción, pasa también por `nexo_cortex_decide(...)`.
|
|
8
|
+
3. Ejecuta la skill con `areas` ajustadas al fix. El helper te devuelve el mapa de archivos y corre la batería de tests focalizada para `protocol`, `plane`, `guard`, `cortex` y/o `release`.
|
|
9
|
+
4. Implementa el cambio mínimo defendible solo en la superficie correcta. Si el problema es producto, se arregla en el repo; no en `~/.nexo`.
|
|
10
|
+
5. Reejecuta la skill para revalidar el clúster exacto de tests tocado por el fix.
|
|
11
|
+
6. Cierra con `nexo_task_close(...)` y evidencia real. Si hubo edición real, deja `change_log` y captura learning si cambió una regla canónica.
|
|
12
|
+
|
|
13
|
+
## Gotchas
|
|
14
|
+
- No uses diary, workflow text o intuición como sustituto de git/tests/runtime reales.
|
|
15
|
+
- Si el fix toca doctor o claims públicos, fija el `plane` explícito antes de ejecutar diagnósticos.
|
|
16
|
+
- Si el fix toca release o runtime update, usa la vía oficial (`nexo update`, doctor, skill de release final) y no scripts laterales.
|
|
17
|
+
- Si el helper no encuentra un área, añade la superficie nueva de forma explícita en la skill en vez de seguir repitiendo grep manual disperso.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
AREA_MAP = {
|
|
13
|
+
"protocol": {
|
|
14
|
+
"files": [
|
|
15
|
+
"src/plugins/protocol.py",
|
|
16
|
+
"src/db/_protocol.py",
|
|
17
|
+
"src/db/__init__.py",
|
|
18
|
+
"tests/test_protocol.py",
|
|
19
|
+
],
|
|
20
|
+
"tests": [
|
|
21
|
+
"tests/test_protocol.py",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
"plane": {
|
|
25
|
+
"files": [
|
|
26
|
+
"src/doctor/orchestrator.py",
|
|
27
|
+
"src/plugins/doctor.py",
|
|
28
|
+
"src/server.py",
|
|
29
|
+
"tests/test_doctor.py",
|
|
30
|
+
],
|
|
31
|
+
"tests": [
|
|
32
|
+
"tests/test_doctor.py",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
"guard": {
|
|
36
|
+
"files": [
|
|
37
|
+
"src/hook_guardrails.py",
|
|
38
|
+
"tests/test_hook_guardrails.py",
|
|
39
|
+
],
|
|
40
|
+
"tests": [
|
|
41
|
+
"tests/test_hook_guardrails.py",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
"cortex": {
|
|
45
|
+
"files": [
|
|
46
|
+
"src/plugins/cortex.py",
|
|
47
|
+
"tests/test_cortex_decisions.py",
|
|
48
|
+
],
|
|
49
|
+
"tests": [
|
|
50
|
+
"tests/test_cortex_decisions.py",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
"release": {
|
|
54
|
+
"files": [
|
|
55
|
+
"scripts/verify_release_readiness.py",
|
|
56
|
+
"src/skills/run-release-final-audit/script.py",
|
|
57
|
+
"tests/test_verify_release_readiness.py",
|
|
58
|
+
"tests/test_release_readiness_baseline.py",
|
|
59
|
+
],
|
|
60
|
+
"tests": [
|
|
61
|
+
"tests/test_verify_release_readiness.py",
|
|
62
|
+
"tests/test_release_readiness_baseline.py",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _is_repo_root(candidate: Path) -> bool:
|
|
69
|
+
return (
|
|
70
|
+
(candidate / "package.json").is_file()
|
|
71
|
+
and (candidate / "src" / "server.py").is_file()
|
|
72
|
+
and (candidate / "tests").is_dir()
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _normalize_candidate(raw: str | Path) -> Path:
|
|
77
|
+
candidate = Path(raw).expanduser().resolve()
|
|
78
|
+
if candidate.is_file():
|
|
79
|
+
candidate = candidate.parent
|
|
80
|
+
if candidate.name == "src" and (candidate / "server.py").is_file():
|
|
81
|
+
candidate = candidate.parent
|
|
82
|
+
return candidate
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _resolve_repo_root_from_atlas() -> Path | None:
|
|
86
|
+
homes = []
|
|
87
|
+
env_home = os.environ.get("NEXO_HOME", "").strip()
|
|
88
|
+
if env_home:
|
|
89
|
+
homes.append(Path(env_home).expanduser())
|
|
90
|
+
homes.extend((Path.home() / ".nexo", Path.home() / "claude"))
|
|
91
|
+
|
|
92
|
+
seen = set()
|
|
93
|
+
for home in homes:
|
|
94
|
+
key = str(home)
|
|
95
|
+
if key in seen:
|
|
96
|
+
continue
|
|
97
|
+
seen.add(key)
|
|
98
|
+
atlas_path = home / "brain" / "project-atlas.json"
|
|
99
|
+
if not atlas_path.is_file():
|
|
100
|
+
continue
|
|
101
|
+
try:
|
|
102
|
+
payload = json.loads(atlas_path.read_text(encoding="utf-8"))
|
|
103
|
+
except json.JSONDecodeError:
|
|
104
|
+
continue
|
|
105
|
+
nexo = payload.get("nexo") if isinstance(payload, dict) else None
|
|
106
|
+
locations = nexo.get("locations") if isinstance(nexo, dict) else None
|
|
107
|
+
source = locations.get("mcp_server", "") if isinstance(locations, dict) else ""
|
|
108
|
+
if not isinstance(source, str) or not source.strip():
|
|
109
|
+
continue
|
|
110
|
+
candidate = _normalize_candidate(source)
|
|
111
|
+
if _is_repo_root(candidate):
|
|
112
|
+
return candidate
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _resolve_repo_root(explicit_root: str = "") -> Path:
|
|
117
|
+
if explicit_root.strip():
|
|
118
|
+
candidate = _normalize_candidate(explicit_root)
|
|
119
|
+
if _is_repo_root(candidate):
|
|
120
|
+
return candidate
|
|
121
|
+
|
|
122
|
+
env_code = os.environ.get("NEXO_CODE", "").strip()
|
|
123
|
+
if env_code:
|
|
124
|
+
candidate = _normalize_candidate(env_code)
|
|
125
|
+
if _is_repo_root(candidate):
|
|
126
|
+
return candidate
|
|
127
|
+
|
|
128
|
+
cwd = Path.cwd().resolve()
|
|
129
|
+
for candidate in (cwd, *cwd.parents):
|
|
130
|
+
if _is_repo_root(candidate):
|
|
131
|
+
return candidate
|
|
132
|
+
|
|
133
|
+
atlas_repo = _resolve_repo_root_from_atlas()
|
|
134
|
+
if atlas_repo is not None:
|
|
135
|
+
return atlas_repo
|
|
136
|
+
|
|
137
|
+
script_root = Path(__file__).resolve().parents[3]
|
|
138
|
+
if _is_repo_root(script_root):
|
|
139
|
+
return script_root
|
|
140
|
+
return script_root
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _parse_bool(raw: str, default: bool) -> bool:
|
|
144
|
+
text = (raw or "").strip().lower()
|
|
145
|
+
if not text:
|
|
146
|
+
return default
|
|
147
|
+
if text in {"1", "true", "yes", "on"}:
|
|
148
|
+
return True
|
|
149
|
+
if text in {"0", "false", "no", "off"}:
|
|
150
|
+
return False
|
|
151
|
+
raise SystemExit(f"[core-fix-cycle] invalid boolean: {raw}")
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _normalize_areas(raw: str) -> list[str]:
|
|
155
|
+
text = (raw or "protocol,plane").replace("+", ",")
|
|
156
|
+
parts = [item.strip().lower() for item in text.split(",") if item.strip()]
|
|
157
|
+
if not parts:
|
|
158
|
+
return ["protocol", "plane"]
|
|
159
|
+
unknown = [item for item in parts if item not in AREA_MAP]
|
|
160
|
+
if unknown:
|
|
161
|
+
raise SystemExit(
|
|
162
|
+
f"[core-fix-cycle] unknown area(s): {', '.join(unknown)}. Expected one of: {', '.join(sorted(AREA_MAP))}"
|
|
163
|
+
)
|
|
164
|
+
seen = set()
|
|
165
|
+
ordered = []
|
|
166
|
+
for item in parts:
|
|
167
|
+
if item in seen:
|
|
168
|
+
continue
|
|
169
|
+
seen.add(item)
|
|
170
|
+
ordered.append(item)
|
|
171
|
+
return ordered
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _env(root: Path, nexo_home: str) -> dict[str, str]:
|
|
175
|
+
env = os.environ.copy()
|
|
176
|
+
src_path = str(root / "src")
|
|
177
|
+
existing_pythonpath = env.get("PYTHONPATH", "").strip()
|
|
178
|
+
env["PYTHONPATH"] = (
|
|
179
|
+
f"{src_path}{os.pathsep}{existing_pythonpath}" if existing_pythonpath else src_path
|
|
180
|
+
)
|
|
181
|
+
env["NEXO_CODE"] = src_path
|
|
182
|
+
env["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] = "1"
|
|
183
|
+
if nexo_home.strip():
|
|
184
|
+
env["NEXO_HOME"] = str(Path(nexo_home).expanduser())
|
|
185
|
+
return env
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _command_succeeds(cmd: list[str], *, env: dict[str, str], root: Path) -> bool:
|
|
189
|
+
result = subprocess.run(
|
|
190
|
+
cmd,
|
|
191
|
+
cwd=root,
|
|
192
|
+
env=env,
|
|
193
|
+
stdout=subprocess.DEVNULL,
|
|
194
|
+
stderr=subprocess.DEVNULL,
|
|
195
|
+
)
|
|
196
|
+
return result.returncode == 0
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _resolve_python(root: Path, env: dict[str, str]) -> str:
|
|
200
|
+
candidates = []
|
|
201
|
+
override = os.environ.get("NEXO_RELEASE_PYTHON", "").strip()
|
|
202
|
+
if override:
|
|
203
|
+
candidates.append(override)
|
|
204
|
+
|
|
205
|
+
for name in ("python3", "python"):
|
|
206
|
+
path = shutil.which(name)
|
|
207
|
+
if path:
|
|
208
|
+
candidates.append(path)
|
|
209
|
+
|
|
210
|
+
candidates.append(sys.executable)
|
|
211
|
+
|
|
212
|
+
seen = set()
|
|
213
|
+
for candidate in candidates:
|
|
214
|
+
if not candidate or candidate in seen:
|
|
215
|
+
continue
|
|
216
|
+
seen.add(candidate)
|
|
217
|
+
if _command_succeeds([candidate, "-m", "pytest", "--version"], env=env, root=root):
|
|
218
|
+
return candidate
|
|
219
|
+
|
|
220
|
+
raise SystemExit(
|
|
221
|
+
"[core-fix-cycle] no Python interpreter with pytest available. "
|
|
222
|
+
"Set NEXO_RELEASE_PYTHON or install pytest in the active runtime."
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _run(cmd: list[str], *, env: dict[str, str], root: Path) -> None:
|
|
227
|
+
print(f"[core-fix-cycle] $ {' '.join(cmd)}")
|
|
228
|
+
result = subprocess.run(cmd, cwd=root, env=env)
|
|
229
|
+
if result.returncode != 0:
|
|
230
|
+
raise SystemExit(result.returncode)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def main() -> int:
|
|
234
|
+
areas = _normalize_areas(sys.argv[1] if len(sys.argv) > 1 else "protocol,plane")
|
|
235
|
+
run_tests = _parse_bool(sys.argv[2] if len(sys.argv) > 2 else "true", True)
|
|
236
|
+
repo_root = _resolve_repo_root(sys.argv[3] if len(sys.argv) > 3 else "")
|
|
237
|
+
nexo_home = sys.argv[4] if len(sys.argv) > 4 else ""
|
|
238
|
+
env = _env(repo_root, nexo_home)
|
|
239
|
+
|
|
240
|
+
files: list[str] = []
|
|
241
|
+
tests: list[str] = []
|
|
242
|
+
for area in areas:
|
|
243
|
+
for path in AREA_MAP[area]["files"]:
|
|
244
|
+
if path not in files:
|
|
245
|
+
files.append(path)
|
|
246
|
+
for path in AREA_MAP[area]["tests"]:
|
|
247
|
+
if path not in tests:
|
|
248
|
+
tests.append(path)
|
|
249
|
+
|
|
250
|
+
print(f"[core-fix-cycle] repo_root={repo_root}")
|
|
251
|
+
print(f"[core-fix-cycle] areas={','.join(areas)}")
|
|
252
|
+
print("[core-fix-cycle] file-map:")
|
|
253
|
+
for path in files:
|
|
254
|
+
label = "OK" if (repo_root / path).exists() else "missing"
|
|
255
|
+
print(f"[core-fix-cycle] - {path} [{label}]")
|
|
256
|
+
|
|
257
|
+
if not run_tests:
|
|
258
|
+
print("[core-fix-cycle] tests skipped")
|
|
259
|
+
print("[core-fix-cycle] OK")
|
|
260
|
+
return 0
|
|
261
|
+
|
|
262
|
+
existing_tests = [path for path in tests if (repo_root / path).is_file()]
|
|
263
|
+
if not existing_tests:
|
|
264
|
+
print("[core-fix-cycle] no tests found for selected areas")
|
|
265
|
+
print("[core-fix-cycle] OK")
|
|
266
|
+
return 0
|
|
267
|
+
|
|
268
|
+
python_bin = _resolve_python(repo_root, env)
|
|
269
|
+
print(f"[core-fix-cycle] python={python_bin}")
|
|
270
|
+
_run([python_bin, "-m", "pytest", "-q", *existing_tests], env=env, root=repo_root)
|
|
271
|
+
print("[core-fix-cycle] OK")
|
|
272
|
+
return 0
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
if __name__ == "__main__":
|
|
276
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "SK-RUN-NEXO-CORE-FIX-CYCLE",
|
|
3
|
+
"name": "Run NEXO Core Fix Cycle",
|
|
4
|
+
"description": "Mapea las superficies core impactadas y ejecuta la verificación focalizada para ciclos pequeños de fixes de NEXO sin mezclar repo público, runtime y claims no verificados.",
|
|
5
|
+
"level": "published",
|
|
6
|
+
"mode": "hybrid",
|
|
7
|
+
"source_kind": "core",
|
|
8
|
+
"execution_level": "read-only",
|
|
9
|
+
"approval_required": false,
|
|
10
|
+
"tags": [
|
|
11
|
+
"nexo",
|
|
12
|
+
"core",
|
|
13
|
+
"fix",
|
|
14
|
+
"protocol",
|
|
15
|
+
"plane",
|
|
16
|
+
"verification"
|
|
17
|
+
],
|
|
18
|
+
"trigger_patterns": [
|
|
19
|
+
"dos fixes core nexo",
|
|
20
|
+
"core fix cycle",
|
|
21
|
+
"enforcement protocolario",
|
|
22
|
+
"plano antes del diagnostico",
|
|
23
|
+
"ciclo fix core nexo"
|
|
24
|
+
],
|
|
25
|
+
"params_schema": {
|
|
26
|
+
"areas": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"required": false,
|
|
29
|
+
"default": "protocol,plane"
|
|
30
|
+
},
|
|
31
|
+
"run_tests": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"required": false,
|
|
34
|
+
"default": true
|
|
35
|
+
},
|
|
36
|
+
"repo_root": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"required": false,
|
|
39
|
+
"default": ""
|
|
40
|
+
},
|
|
41
|
+
"nexo_home": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"required": false,
|
|
44
|
+
"default": ""
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"command_template": {
|
|
48
|
+
"argv": [
|
|
49
|
+
"{{file_path}}",
|
|
50
|
+
"{{areas}}",
|
|
51
|
+
"{{run_tests}}",
|
|
52
|
+
"{{repo_root}}",
|
|
53
|
+
"{{nexo_home}}"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"executable_entry": "script.py",
|
|
57
|
+
"stable_after_uses": 5
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Run Release Final Audit
|
|
2
|
+
|
|
3
|
+
Use this before claiming a release/publication is closed when you need a live check that smoke, release contract, public surfaces, runtime update/doctor, and protocol closeout still align.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
1. Run the skill with defaults to audit the current package version. It auto-resolves `release-contracts/v{version}.json` and `scripts/run_vX_Y_smoke.py` when present.
|
|
7
|
+
2. Keep `contract="auto"` and `require_contract_complete=true` for the real final gate. Set `contract="none"` only for pre-contract repo checks.
|
|
8
|
+
3. For the real post-publish closeout, set `final_closeout=true` and pass the release `protocol_task_id` so the audit also verifies GitHub Release, npm, `nexo update`, runtime doctor, `change_log`, and `task_close`.
|
|
9
|
+
4. Treat `ci=true` as repo-only. The last live audit must stay outside CI because `final_closeout` expects a live runtime and a real closed task.
|
|
10
|
+
|
|
11
|
+
## Gotchas
|
|
12
|
+
- A missing auto-resolved contract is a real blocker for the final release audit.
|
|
13
|
+
- Smoke is version-line scoped. If no runner exists, the skill reports the skip explicitly instead of pretending it ran.
|
|
14
|
+
- The script is read-only except for the optional official `nexo update` step during `final_closeout`; it still does not bump versions, tag, publish, or edit website worktrees.
|
|
15
|
+
- `final_closeout` is intentionally stricter than the repo-only readiness pass: it fails if the release task was not closed with evidence or if its `change_log` row is missing.
|
|
16
|
+
- If the touched area includes bootstrap, startup, or public claims, finish with the manual watchpoints in `docs/client-parity-checklist.md`.
|