nexo-brain 5.3.26 → 5.3.27

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.
Files changed (211) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/server.py +3 -0
  4. package/src/tools_sessions.py +6 -1
  5. package/src/dashboard/static/favicon 2.svg +0 -32
  6. package/src/dashboard/static/nexo-logo 2.png +0 -0
  7. package/src/dashboard/static/nexo-logo 2.svg +0 -40
  8. package/src/dashboard/static/style 2.css +0 -2458
  9. package/src/dashboard/templates/adaptive 2.html +0 -118
  10. package/src/dashboard/templates/artifacts 2.html +0 -133
  11. package/src/dashboard/templates/backups 2.html +0 -136
  12. package/src/dashboard/templates/base 2.html +0 -417
  13. package/src/dashboard/templates/calendar 2.html +0 -591
  14. package/src/dashboard/templates/chat 2.html +0 -356
  15. package/src/dashboard/templates/claims 2.html +0 -259
  16. package/src/dashboard/templates/cortex 2.html +0 -321
  17. package/src/dashboard/templates/credentials 2.html +0 -128
  18. package/src/dashboard/templates/crons 2.html +0 -370
  19. package/src/dashboard/templates/dashboard 2.html +0 -494
  20. package/src/dashboard/templates/dreams 2.html +0 -252
  21. package/src/dashboard/templates/email 2.html +0 -160
  22. package/src/dashboard/templates/evolution 2.html +0 -189
  23. package/src/dashboard/templates/feed 2.html +0 -249
  24. package/src/dashboard/templates/followup_health 2.html +0 -170
  25. package/src/dashboard/templates/graph 2.html +0 -201
  26. package/src/dashboard/templates/guard 2.html +0 -259
  27. package/src/dashboard/templates/inbox 2.html +0 -251
  28. package/src/dashboard/templates/memory 2.html +0 -420
  29. package/src/dashboard/templates/operations 2.html +0 -608
  30. package/src/dashboard/templates/plugins 2.html +0 -185
  31. package/src/dashboard/templates/protocol 2.html +0 -199
  32. package/src/dashboard/templates/rules 2.html +0 -246
  33. package/src/dashboard/templates/sentiment 2.html +0 -247
  34. package/src/dashboard/templates/sessions 2.html +0 -218
  35. package/src/dashboard/templates/skills 2.html +0 -329
  36. package/src/dashboard/templates/somatic 2.html +0 -73
  37. package/src/dashboard/templates/triggers 2.html +0 -133
  38. package/src/dashboard/templates/trust 2.html +0 -360
  39. package/src/db/__init__ 2.py +0 -259
  40. package/src/db/_core 2.py +0 -437
  41. package/src/db/_credentials 2.py +0 -124
  42. package/src/db/_episodic 2.py +0 -762
  43. package/src/db/_evolution 2.py +0 -54
  44. package/src/db/_fts 2.py +0 -406
  45. package/src/db/_goal_profiles 2.py +0 -376
  46. package/src/db/_hot_context 2.py +0 -660
  47. package/src/db/_outcomes 2.py +0 -800
  48. package/src/db/_personal_scripts 2.py +0 -582
  49. package/src/db/_sessions 2.py +0 -330
  50. package/src/db/_tasks 2.py +0 -91
  51. package/src/db/_watchers 2.py +0 -173
  52. package/src/doctor/formatters 2.py +0 -52
  53. package/src/doctor/models 2.py +0 -69
  54. package/src/doctor/planes 2.py +0 -87
  55. package/src/doctor/providers/__init__ 2.py +0 -1
  56. package/src/doctor/providers/deep 2.py +0 -367
  57. package/src/evolution_cycle 2.py +0 -519
  58. package/src/hooks/auto_capture 2.py +0 -208
  59. package/src/hooks/caffeinate-guard 2.sh +0 -8
  60. package/src/hooks/capture-session 2.sh +0 -21
  61. package/src/hooks/capture-tool-logs 2.sh +0 -158
  62. package/src/hooks/daily-briefing-check 2.sh +0 -33
  63. package/src/hooks/heartbeat-enforcement 2.py +0 -90
  64. package/src/hooks/heartbeat-posttool 2.sh +0 -18
  65. package/src/hooks/inbox-hook 2.sh +0 -76
  66. package/src/hooks/post-compact 2.sh +0 -152
  67. package/src/hooks/pre-compact 2.sh +0 -169
  68. package/src/hooks/protocol-guardrail 2.sh +0 -10
  69. package/src/hooks/protocol-pretool-guardrail 2.sh +0 -9
  70. package/src/hooks/session-stop 2.sh +0 -52
  71. package/src/kg_populate 2.py +0 -292
  72. package/src/maintenance 2.py +0 -53
  73. package/src/memory_backends 2.py +0 -71
  74. package/src/migrate_embeddings 2.py +0 -124
  75. package/src/nexo_sdk 2.py +0 -103
  76. package/src/observability 2.py +0 -199
  77. package/src/plugin_loader 2.py +0 -217
  78. package/src/plugins/__init__ 2.py +0 -0
  79. package/src/plugins/artifact_registry 2.py +0 -450
  80. package/src/plugins/backup 2.py +0 -127
  81. package/src/plugins/claims_tools 2.py +0 -119
  82. package/src/plugins/cognitive_memory 2.py +0 -609
  83. package/src/plugins/core_rules 2.py +0 -252
  84. package/src/plugins/cortex 2.py +0 -1155
  85. package/src/plugins/entities 2.py +0 -67
  86. package/src/plugins/episodic_memory 2.py +0 -560
  87. package/src/plugins/evolution 2.py +0 -167
  88. package/src/plugins/goal_engine 2.py +0 -142
  89. package/src/plugins/guard 2.py +0 -862
  90. package/src/plugins/impact 2.py +0 -29
  91. package/src/plugins/knowledge_graph_tools 2.py +0 -137
  92. package/src/plugins/media_memory_tools 2.py +0 -98
  93. package/src/plugins/memory_export 2.py +0 -196
  94. package/src/plugins/outcomes 2.py +0 -130
  95. package/src/plugins/personal_scripts 2.py +0 -117
  96. package/src/plugins/preferences 2.py +0 -47
  97. package/src/plugins/protocol 2.py +0 -1449
  98. package/src/plugins/simple_api 2.py +0 -106
  99. package/src/plugins/skills 2.py +0 -341
  100. package/src/plugins/state_watchers 2.py +0 -79
  101. package/src/plugins/update 2.py +0 -986
  102. package/src/plugins/user_state_tools 2.py +0 -43
  103. package/src/plugins/workflow 2.py +0 -588
  104. package/src/protocol_settings 2.py +0 -59
  105. package/src/public_contribution 2.py +0 -466
  106. package/src/public_evolution_queue 2.py +0 -241
  107. package/src/requirements 2.txt +0 -14
  108. package/src/retroactive_learnings 2.py +0 -373
  109. package/src/rules/__init__ 2.py +0 -0
  110. package/src/rules/core-rules 2.json +0 -331
  111. package/src/rules/migrate 2.py +0 -207
  112. package/src/runtime_power 2.py +0 -874
  113. package/src/script_registry 2.py +0 -1559
  114. package/src/scripts/check-context 2.py +0 -272
  115. package/src/scripts/deep-sleep/apply_findings 2.py +0 -2327
  116. package/src/scripts/deep-sleep/collect 2.py +0 -928
  117. package/src/scripts/deep-sleep/extract 2.py +0 -330
  118. package/src/scripts/deep-sleep/extract-prompt 2.md +0 -285
  119. package/src/scripts/deep-sleep/synthesize 2.py +0 -312
  120. package/src/scripts/deep-sleep/synthesize-prompt 2.md +0 -336
  121. package/src/scripts/nexo-agent-run 2.py +0 -75
  122. package/src/scripts/nexo-auto-update 2.py +0 -6
  123. package/src/scripts/nexo-backup 2.sh +0 -25
  124. package/src/scripts/nexo-brain-activation 2.sh +0 -140
  125. package/src/scripts/nexo-catchup 2.py +0 -300
  126. package/src/scripts/nexo-cognitive-decay 2.py +0 -257
  127. package/src/scripts/nexo-cortex-cycle 2.py +0 -293
  128. package/src/scripts/nexo-cron-wrapper 2.sh +0 -53
  129. package/src/scripts/nexo-daily-self-audit 2.py +0 -2161
  130. package/src/scripts/nexo-dashboard 2.sh +0 -29
  131. package/src/scripts/nexo-deep-sleep 2.sh +0 -86
  132. package/src/scripts/nexo-evolution-run 2.py +0 -1664
  133. package/src/scripts/nexo-followup-hygiene 2.py +0 -139
  134. package/src/scripts/nexo-hook-record 2.py +0 -42
  135. package/src/scripts/nexo-immune 2.py +0 -936
  136. package/src/scripts/nexo-impact-scorer 2.py +0 -117
  137. package/src/scripts/nexo-inbox-hook 2.sh +0 -74
  138. package/src/scripts/nexo-install 2.py +0 -6
  139. package/src/scripts/nexo-learning-housekeep 2.py +0 -401
  140. package/src/scripts/nexo-learning-validator 2.py +0 -266
  141. package/src/scripts/nexo-migrate 2.py +0 -260
  142. package/src/scripts/nexo-outcome-checker 2.py +0 -127
  143. package/src/scripts/nexo-postmortem-consolidator 2.py +0 -456
  144. package/src/scripts/nexo-pre-commit 2.py +0 -120
  145. package/src/scripts/nexo-prevent-sleep 2.sh +0 -35
  146. package/src/scripts/nexo-proactive-dashboard 2.py +0 -354
  147. package/src/scripts/nexo-reflection 2.py +0 -256
  148. package/src/scripts/nexo-runtime-preflight 2.py +0 -274
  149. package/src/scripts/nexo-sleep 2.py +0 -631
  150. package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
  151. package/src/scripts/nexo-sync-clients 2.py +0 -16
  152. package/src/scripts/nexo-synthesis 2.py +0 -475
  153. package/src/scripts/nexo-tcc-approve 2.sh +0 -79
  154. package/src/scripts/nexo-update 2.sh +0 -306
  155. package/src/scripts/nexo-watchdog 2.sh +0 -1207
  156. package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
  157. package/src/scripts/rehydrate_learnings_from_archive 2.py +0 -245
  158. package/src/server 2.py +0 -1296
  159. package/src/skills/run-nexo-audit-phase/guide 2.md +0 -43
  160. package/src/skills/run-nexo-audit-phase/skill 2.json +0 -59
  161. package/src/skills/run-nexo-core-fix-cycle/guide 2.md +0 -17
  162. package/src/skills/run-nexo-core-fix-cycle/script 2.py +0 -276
  163. package/src/skills/run-nexo-core-fix-cycle/skill 2.json +0 -58
  164. package/src/skills/run-release-final-audit/guide 2.md +0 -16
  165. package/src/skills/run-release-final-audit/script 2.py +0 -259
  166. package/src/skills/run-release-final-audit/skill 2.json +0 -77
  167. package/src/skills/run-runtime-doctor/guide 2.md +0 -12
  168. package/src/skills/run-runtime-doctor/script 2.py +0 -21
  169. package/src/skills/run-runtime-doctor/skill 2.json +0 -25
  170. package/src/skills_runtime 2.py +0 -932
  171. package/src/state_watchers_runtime 2.py +0 -475
  172. package/src/storage_router 2.py +0 -32
  173. package/src/system_catalog 2.py +0 -786
  174. package/src/tools_coordination 2.py +0 -103
  175. package/src/tools_credentials 2.py +0 -68
  176. package/src/tools_drive 2.py +0 -487
  177. package/src/tools_hot_context 2.py +0 -163
  178. package/src/tools_learnings 2.py +0 -612
  179. package/src/tools_menu 2.py +0 -229
  180. package/src/tools_reminders 2.py +0 -88
  181. package/src/tools_reminders_crud 2.py +0 -363
  182. package/src/tools_sessions 2.py +0 -1054
  183. package/src/tools_system_catalog 2.py +0 -19
  184. package/src/tools_task_history 2.py +0 -57
  185. package/src/tools_transcripts 2.py +0 -98
  186. package/src/transcript_utils 2.py +0 -412
  187. package/src/user_context 2.py +0 -46
  188. package/src/user_data_portability 2.py +0 -328
  189. package/src/user_state_model 2.py +0 -170
  190. package/templates/CLAUDE.md 2.template +0 -108
  191. package/templates/CODEX.AGENTS.md 2.template +0 -66
  192. package/templates/launchagents/README 2.md +0 -132
  193. package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +0 -39
  194. package/templates/launchagents/com.nexo.catchup 2.plist +0 -39
  195. package/templates/launchagents/com.nexo.cognitive-decay 2.plist +0 -40
  196. package/templates/launchagents/com.nexo.dashboard 2.plist +0 -43
  197. package/templates/launchagents/com.nexo.deep-sleep 2.plist +0 -43
  198. package/templates/launchagents/com.nexo.evolution 2.plist +0 -44
  199. package/templates/launchagents/com.nexo.followup-hygiene 2.plist +0 -45
  200. package/templates/launchagents/com.nexo.immune 2.plist +0 -41
  201. package/templates/launchagents/com.nexo.postmortem 2.plist +0 -45
  202. package/templates/launchagents/com.nexo.self-audit 2.plist +0 -47
  203. package/templates/launchagents/com.nexo.synthesis 2.plist +0 -45
  204. package/templates/launchagents/com.nexo.watchdog 2.plist +0 -37
  205. package/templates/nexo_helper 2.py +0 -301
  206. package/templates/openclaw 2.json +0 -13
  207. package/templates/plugin-template 2.py +0 -40
  208. package/templates/script-template 2.py +0 -59
  209. package/templates/script-template 2.sh +0 -13
  210. package/templates/skill-script-template 2.py +0 -48
  211. package/templates/skill-template 2.md +0 -33
@@ -1,43 +0,0 @@
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.
@@ -1,59 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
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.
@@ -1,276 +0,0 @@
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())
@@ -1,58 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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`.