nexo-brain 5.3.26 → 5.3.28

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 (212) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/hook_guardrails.py +44 -0
  4. package/src/server.py +3 -0
  5. package/src/tools_sessions.py +6 -1
  6. package/src/dashboard/static/favicon 2.svg +0 -32
  7. package/src/dashboard/static/nexo-logo 2.png +0 -0
  8. package/src/dashboard/static/nexo-logo 2.svg +0 -40
  9. package/src/dashboard/static/style 2.css +0 -2458
  10. package/src/dashboard/templates/adaptive 2.html +0 -118
  11. package/src/dashboard/templates/artifacts 2.html +0 -133
  12. package/src/dashboard/templates/backups 2.html +0 -136
  13. package/src/dashboard/templates/base 2.html +0 -417
  14. package/src/dashboard/templates/calendar 2.html +0 -591
  15. package/src/dashboard/templates/chat 2.html +0 -356
  16. package/src/dashboard/templates/claims 2.html +0 -259
  17. package/src/dashboard/templates/cortex 2.html +0 -321
  18. package/src/dashboard/templates/credentials 2.html +0 -128
  19. package/src/dashboard/templates/crons 2.html +0 -370
  20. package/src/dashboard/templates/dashboard 2.html +0 -494
  21. package/src/dashboard/templates/dreams 2.html +0 -252
  22. package/src/dashboard/templates/email 2.html +0 -160
  23. package/src/dashboard/templates/evolution 2.html +0 -189
  24. package/src/dashboard/templates/feed 2.html +0 -249
  25. package/src/dashboard/templates/followup_health 2.html +0 -170
  26. package/src/dashboard/templates/graph 2.html +0 -201
  27. package/src/dashboard/templates/guard 2.html +0 -259
  28. package/src/dashboard/templates/inbox 2.html +0 -251
  29. package/src/dashboard/templates/memory 2.html +0 -420
  30. package/src/dashboard/templates/operations 2.html +0 -608
  31. package/src/dashboard/templates/plugins 2.html +0 -185
  32. package/src/dashboard/templates/protocol 2.html +0 -199
  33. package/src/dashboard/templates/rules 2.html +0 -246
  34. package/src/dashboard/templates/sentiment 2.html +0 -247
  35. package/src/dashboard/templates/sessions 2.html +0 -218
  36. package/src/dashboard/templates/skills 2.html +0 -329
  37. package/src/dashboard/templates/somatic 2.html +0 -73
  38. package/src/dashboard/templates/triggers 2.html +0 -133
  39. package/src/dashboard/templates/trust 2.html +0 -360
  40. package/src/db/__init__ 2.py +0 -259
  41. package/src/db/_core 2.py +0 -437
  42. package/src/db/_credentials 2.py +0 -124
  43. package/src/db/_episodic 2.py +0 -762
  44. package/src/db/_evolution 2.py +0 -54
  45. package/src/db/_fts 2.py +0 -406
  46. package/src/db/_goal_profiles 2.py +0 -376
  47. package/src/db/_hot_context 2.py +0 -660
  48. package/src/db/_outcomes 2.py +0 -800
  49. package/src/db/_personal_scripts 2.py +0 -582
  50. package/src/db/_sessions 2.py +0 -330
  51. package/src/db/_tasks 2.py +0 -91
  52. package/src/db/_watchers 2.py +0 -173
  53. package/src/doctor/formatters 2.py +0 -52
  54. package/src/doctor/models 2.py +0 -69
  55. package/src/doctor/planes 2.py +0 -87
  56. package/src/doctor/providers/__init__ 2.py +0 -1
  57. package/src/doctor/providers/deep 2.py +0 -367
  58. package/src/evolution_cycle 2.py +0 -519
  59. package/src/hooks/auto_capture 2.py +0 -208
  60. package/src/hooks/caffeinate-guard 2.sh +0 -8
  61. package/src/hooks/capture-session 2.sh +0 -21
  62. package/src/hooks/capture-tool-logs 2.sh +0 -158
  63. package/src/hooks/daily-briefing-check 2.sh +0 -33
  64. package/src/hooks/heartbeat-enforcement 2.py +0 -90
  65. package/src/hooks/heartbeat-posttool 2.sh +0 -18
  66. package/src/hooks/inbox-hook 2.sh +0 -76
  67. package/src/hooks/post-compact 2.sh +0 -152
  68. package/src/hooks/pre-compact 2.sh +0 -169
  69. package/src/hooks/protocol-guardrail 2.sh +0 -10
  70. package/src/hooks/protocol-pretool-guardrail 2.sh +0 -9
  71. package/src/hooks/session-stop 2.sh +0 -52
  72. package/src/kg_populate 2.py +0 -292
  73. package/src/maintenance 2.py +0 -53
  74. package/src/memory_backends 2.py +0 -71
  75. package/src/migrate_embeddings 2.py +0 -124
  76. package/src/nexo_sdk 2.py +0 -103
  77. package/src/observability 2.py +0 -199
  78. package/src/plugin_loader 2.py +0 -217
  79. package/src/plugins/__init__ 2.py +0 -0
  80. package/src/plugins/artifact_registry 2.py +0 -450
  81. package/src/plugins/backup 2.py +0 -127
  82. package/src/plugins/claims_tools 2.py +0 -119
  83. package/src/plugins/cognitive_memory 2.py +0 -609
  84. package/src/plugins/core_rules 2.py +0 -252
  85. package/src/plugins/cortex 2.py +0 -1155
  86. package/src/plugins/entities 2.py +0 -67
  87. package/src/plugins/episodic_memory 2.py +0 -560
  88. package/src/plugins/evolution 2.py +0 -167
  89. package/src/plugins/goal_engine 2.py +0 -142
  90. package/src/plugins/guard 2.py +0 -862
  91. package/src/plugins/impact 2.py +0 -29
  92. package/src/plugins/knowledge_graph_tools 2.py +0 -137
  93. package/src/plugins/media_memory_tools 2.py +0 -98
  94. package/src/plugins/memory_export 2.py +0 -196
  95. package/src/plugins/outcomes 2.py +0 -130
  96. package/src/plugins/personal_scripts 2.py +0 -117
  97. package/src/plugins/preferences 2.py +0 -47
  98. package/src/plugins/protocol 2.py +0 -1449
  99. package/src/plugins/simple_api 2.py +0 -106
  100. package/src/plugins/skills 2.py +0 -341
  101. package/src/plugins/state_watchers 2.py +0 -79
  102. package/src/plugins/update 2.py +0 -986
  103. package/src/plugins/user_state_tools 2.py +0 -43
  104. package/src/plugins/workflow 2.py +0 -588
  105. package/src/protocol_settings 2.py +0 -59
  106. package/src/public_contribution 2.py +0 -466
  107. package/src/public_evolution_queue 2.py +0 -241
  108. package/src/requirements 2.txt +0 -14
  109. package/src/retroactive_learnings 2.py +0 -373
  110. package/src/rules/__init__ 2.py +0 -0
  111. package/src/rules/core-rules 2.json +0 -331
  112. package/src/rules/migrate 2.py +0 -207
  113. package/src/runtime_power 2.py +0 -874
  114. package/src/script_registry 2.py +0 -1559
  115. package/src/scripts/check-context 2.py +0 -272
  116. package/src/scripts/deep-sleep/apply_findings 2.py +0 -2327
  117. package/src/scripts/deep-sleep/collect 2.py +0 -928
  118. package/src/scripts/deep-sleep/extract 2.py +0 -330
  119. package/src/scripts/deep-sleep/extract-prompt 2.md +0 -285
  120. package/src/scripts/deep-sleep/synthesize 2.py +0 -312
  121. package/src/scripts/deep-sleep/synthesize-prompt 2.md +0 -336
  122. package/src/scripts/nexo-agent-run 2.py +0 -75
  123. package/src/scripts/nexo-auto-update 2.py +0 -6
  124. package/src/scripts/nexo-backup 2.sh +0 -25
  125. package/src/scripts/nexo-brain-activation 2.sh +0 -140
  126. package/src/scripts/nexo-catchup 2.py +0 -300
  127. package/src/scripts/nexo-cognitive-decay 2.py +0 -257
  128. package/src/scripts/nexo-cortex-cycle 2.py +0 -293
  129. package/src/scripts/nexo-cron-wrapper 2.sh +0 -53
  130. package/src/scripts/nexo-daily-self-audit 2.py +0 -2161
  131. package/src/scripts/nexo-dashboard 2.sh +0 -29
  132. package/src/scripts/nexo-deep-sleep 2.sh +0 -86
  133. package/src/scripts/nexo-evolution-run 2.py +0 -1664
  134. package/src/scripts/nexo-followup-hygiene 2.py +0 -139
  135. package/src/scripts/nexo-hook-record 2.py +0 -42
  136. package/src/scripts/nexo-immune 2.py +0 -936
  137. package/src/scripts/nexo-impact-scorer 2.py +0 -117
  138. package/src/scripts/nexo-inbox-hook 2.sh +0 -74
  139. package/src/scripts/nexo-install 2.py +0 -6
  140. package/src/scripts/nexo-learning-housekeep 2.py +0 -401
  141. package/src/scripts/nexo-learning-validator 2.py +0 -266
  142. package/src/scripts/nexo-migrate 2.py +0 -260
  143. package/src/scripts/nexo-outcome-checker 2.py +0 -127
  144. package/src/scripts/nexo-postmortem-consolidator 2.py +0 -456
  145. package/src/scripts/nexo-pre-commit 2.py +0 -120
  146. package/src/scripts/nexo-prevent-sleep 2.sh +0 -35
  147. package/src/scripts/nexo-proactive-dashboard 2.py +0 -354
  148. package/src/scripts/nexo-reflection 2.py +0 -256
  149. package/src/scripts/nexo-runtime-preflight 2.py +0 -274
  150. package/src/scripts/nexo-sleep 2.py +0 -631
  151. package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
  152. package/src/scripts/nexo-sync-clients 2.py +0 -16
  153. package/src/scripts/nexo-synthesis 2.py +0 -475
  154. package/src/scripts/nexo-tcc-approve 2.sh +0 -79
  155. package/src/scripts/nexo-update 2.sh +0 -306
  156. package/src/scripts/nexo-watchdog 2.sh +0 -1207
  157. package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
  158. package/src/scripts/rehydrate_learnings_from_archive 2.py +0 -245
  159. package/src/server 2.py +0 -1296
  160. package/src/skills/run-nexo-audit-phase/guide 2.md +0 -43
  161. package/src/skills/run-nexo-audit-phase/skill 2.json +0 -59
  162. package/src/skills/run-nexo-core-fix-cycle/guide 2.md +0 -17
  163. package/src/skills/run-nexo-core-fix-cycle/script 2.py +0 -276
  164. package/src/skills/run-nexo-core-fix-cycle/skill 2.json +0 -58
  165. package/src/skills/run-release-final-audit/guide 2.md +0 -16
  166. package/src/skills/run-release-final-audit/script 2.py +0 -259
  167. package/src/skills/run-release-final-audit/skill 2.json +0 -77
  168. package/src/skills/run-runtime-doctor/guide 2.md +0 -12
  169. package/src/skills/run-runtime-doctor/script 2.py +0 -21
  170. package/src/skills/run-runtime-doctor/skill 2.json +0 -25
  171. package/src/skills_runtime 2.py +0 -932
  172. package/src/state_watchers_runtime 2.py +0 -475
  173. package/src/storage_router 2.py +0 -32
  174. package/src/system_catalog 2.py +0 -786
  175. package/src/tools_coordination 2.py +0 -103
  176. package/src/tools_credentials 2.py +0 -68
  177. package/src/tools_drive 2.py +0 -487
  178. package/src/tools_hot_context 2.py +0 -163
  179. package/src/tools_learnings 2.py +0 -612
  180. package/src/tools_menu 2.py +0 -229
  181. package/src/tools_reminders 2.py +0 -88
  182. package/src/tools_reminders_crud 2.py +0 -363
  183. package/src/tools_sessions 2.py +0 -1054
  184. package/src/tools_system_catalog 2.py +0 -19
  185. package/src/tools_task_history 2.py +0 -57
  186. package/src/tools_transcripts 2.py +0 -98
  187. package/src/transcript_utils 2.py +0 -412
  188. package/src/user_context 2.py +0 -46
  189. package/src/user_data_portability 2.py +0 -328
  190. package/src/user_state_model 2.py +0 -170
  191. package/templates/CLAUDE.md 2.template +0 -108
  192. package/templates/CODEX.AGENTS.md 2.template +0 -66
  193. package/templates/launchagents/README 2.md +0 -132
  194. package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +0 -39
  195. package/templates/launchagents/com.nexo.catchup 2.plist +0 -39
  196. package/templates/launchagents/com.nexo.cognitive-decay 2.plist +0 -40
  197. package/templates/launchagents/com.nexo.dashboard 2.plist +0 -43
  198. package/templates/launchagents/com.nexo.deep-sleep 2.plist +0 -43
  199. package/templates/launchagents/com.nexo.evolution 2.plist +0 -44
  200. package/templates/launchagents/com.nexo.followup-hygiene 2.plist +0 -45
  201. package/templates/launchagents/com.nexo.immune 2.plist +0 -41
  202. package/templates/launchagents/com.nexo.postmortem 2.plist +0 -45
  203. package/templates/launchagents/com.nexo.self-audit 2.plist +0 -47
  204. package/templates/launchagents/com.nexo.synthesis 2.plist +0 -45
  205. package/templates/launchagents/com.nexo.watchdog 2.plist +0 -37
  206. package/templates/nexo_helper 2.py +0 -301
  207. package/templates/openclaw 2.json +0 -13
  208. package/templates/plugin-template 2.py +0 -40
  209. package/templates/script-template 2.py +0 -59
  210. package/templates/script-template 2.sh +0 -13
  211. package/templates/skill-script-template 2.py +0 -48
  212. package/templates/skill-template 2.md +0 -33
@@ -1,301 +0,0 @@
1
- """NEXO Helper — vendorable utility for personal scripts.
2
-
3
- Provides stable access to NEXO MCP tools via the CLI.
4
- Copy this file next to your script or keep it in NEXO_HOME/templates/.
5
-
6
- This module does NOT import any NEXO internals (db, server, cognitive).
7
- All communication goes through the stable `nexo scripts call` CLI.
8
- """
9
- from __future__ import annotations
10
-
11
- import json
12
- import os
13
- import shutil
14
- import subprocess
15
- import sys
16
- from pathlib import Path
17
-
18
-
19
- def _detect_nexo_home() -> Path:
20
- env_home = os.environ.get("NEXO_HOME", "").strip()
21
- if env_home:
22
- return Path(env_home).expanduser()
23
-
24
- helper_path = Path(__file__).resolve()
25
- inferred_home = helper_path.parent.parent
26
- if (
27
- helper_path.parent.name == "templates"
28
- and (inferred_home / "scripts").is_dir()
29
- and (inferred_home / "config").is_dir()
30
- ):
31
- return inferred_home
32
-
33
- default_home = Path.home() / ".nexo"
34
- if default_home.is_dir():
35
- return default_home
36
-
37
- claude_home = Path.home() / "claude"
38
- if claude_home.is_dir():
39
- return claude_home
40
-
41
- return default_home
42
-
43
-
44
- NEXO_HOME = _detect_nexo_home()
45
- DEFAULT_ALLOWED_TOOLS = "Read,Write,Edit,Glob,Grep,Bash,mcp__nexo__*"
46
- DEFAULT_NEXO_TIMEOUT_SECONDS = max(15, int(os.environ.get("NEXO_HELPER_TIMEOUT", "90")))
47
-
48
-
49
- def _load_schedule() -> dict:
50
- schedule_path = NEXO_HOME / "config" / "schedule.json"
51
- if not schedule_path.is_file():
52
- return {}
53
- try:
54
- return json.loads(schedule_path.read_text())
55
- except Exception:
56
- return {}
57
-
58
-
59
- def _resolve_automation_backend() -> str:
60
- data = _load_schedule()
61
- return str(data.get("automation_backend", "claude_code") or "claude_code")
62
-
63
-
64
- def _load_bootstrap_prompt() -> str:
65
- backend = _resolve_automation_backend()
66
- if backend == "codex":
67
- path = Path.home() / ".codex" / "AGENTS.md"
68
- else:
69
- path = Path.home() / ".claude" / "CLAUDE.md"
70
- if not path.is_file():
71
- return ""
72
- try:
73
- return path.read_text()
74
- except Exception:
75
- return ""
76
-
77
-
78
- def _resolve_nexo_cli() -> str:
79
- candidates = []
80
-
81
- env_cli = os.environ.get("NEXO_BIN", "").strip()
82
- if env_cli:
83
- candidates.append(Path(env_cli).expanduser())
84
-
85
- candidates.extend(
86
- [
87
- NEXO_HOME / "bin" / "nexo",
88
- Path.home() / ".local" / "bin" / "nexo",
89
- Path.home() / "bin" / "nexo",
90
- ]
91
- )
92
-
93
- for candidate in candidates:
94
- try:
95
- if candidate.is_file() and os.access(candidate, os.X_OK):
96
- return str(candidate)
97
- except OSError:
98
- continue
99
-
100
- return shutil.which("nexo") or "nexo"
101
-
102
-
103
- def run_nexo(args: list[str]) -> str:
104
- """Run a nexo CLI command and return stdout.
105
-
106
- Raises RuntimeError on non-zero exit.
107
- """
108
- env = os.environ.copy()
109
- env.setdefault("NEXO_HOME", str(NEXO_HOME))
110
- result = subprocess.run(
111
- [_resolve_nexo_cli(), *args],
112
- capture_output=True,
113
- text=True,
114
- timeout=DEFAULT_NEXO_TIMEOUT_SECONDS,
115
- env=env,
116
- )
117
- if result.returncode != 0:
118
- raise RuntimeError(result.stderr.strip() or result.stdout.strip() or f"nexo exited {result.returncode}")
119
- return result.stdout
120
-
121
-
122
- def call_tool(name: str, payload: dict | None = None) -> str:
123
- """Call a NEXO MCP tool by name. Returns raw text output."""
124
- args = ["scripts", "call", name, "--input", json.dumps(payload or {})]
125
- return run_nexo(args)
126
-
127
-
128
- def call_tool_text(name: str, payload: dict | None = None) -> str:
129
- """Call a NEXO MCP tool and return text output."""
130
- return call_tool(name, payload)
131
-
132
-
133
- def call_tool_json(name: str, payload: dict | None = None) -> dict:
134
- """Call a NEXO MCP tool and return parsed JSON output."""
135
- args = ["scripts", "call", name, "--input", json.dumps(payload or {}), "--json-output"]
136
- out = run_nexo(args)
137
- return json.loads(out)
138
-
139
-
140
- def _extract_json_object(text: str) -> dict:
141
- raw = str(text or "").strip()
142
- if not raw:
143
- raise RuntimeError("Automation backend returned empty output.")
144
-
145
- if raw.startswith("```"):
146
- lines = raw.splitlines()
147
- if len(lines) >= 2:
148
- end = len(lines)
149
- for i in range(len(lines) - 1, 0, -1):
150
- if lines[i].strip() == "```":
151
- end = i
152
- break
153
- raw = "\n".join(lines[1:end]).strip()
154
-
155
- try:
156
- parsed = json.loads(raw)
157
- if isinstance(parsed, dict):
158
- return parsed
159
- except Exception:
160
- pass
161
-
162
- start = raw.find("{")
163
- if start < 0:
164
- raise RuntimeError("Automation backend did not return a JSON object.")
165
-
166
- depth = 0
167
- in_string = False
168
- escape = False
169
- for idx in range(start, len(raw)):
170
- ch = raw[idx]
171
- if in_string:
172
- if escape:
173
- escape = False
174
- elif ch == "\\":
175
- escape = True
176
- elif ch == '"':
177
- in_string = False
178
- continue
179
-
180
- if ch == '"':
181
- in_string = True
182
- elif ch == "{":
183
- depth += 1
184
- elif ch == "}":
185
- depth -= 1
186
- if depth == 0:
187
- candidate = raw[start : idx + 1]
188
- try:
189
- parsed = json.loads(candidate)
190
- except Exception as exc:
191
- raise RuntimeError(f"Automation backend returned invalid JSON object: {exc}") from exc
192
- if isinstance(parsed, dict):
193
- return parsed
194
- break
195
-
196
- raise RuntimeError("Automation backend did not return a parseable JSON object.")
197
-
198
-
199
- def run_automation_text(
200
- prompt: str,
201
- *,
202
- model: str = "",
203
- reasoning_effort: str = "",
204
- cwd: str = "",
205
- timeout: int | None = None,
206
- allowed_tools: str = DEFAULT_ALLOWED_TOOLS,
207
- append_system_prompt: str = "",
208
- include_bootstrap: bool = True,
209
- ) -> str:
210
- """Run the configured NEXO automation backend and return text output.
211
-
212
- This avoids hardcoding provider CLIs such as `claude -p` inside personal
213
- scripts. The runtime routes the call through the selected backend and its
214
- configured model profile.
215
- """
216
- runner = NEXO_HOME / "scripts" / "nexo-agent-run.py"
217
- if not runner.exists():
218
- raise RuntimeError(f"Automation runner not found: {runner}")
219
-
220
- cmd = [sys.executable, str(runner), "--prompt", prompt, "--output-format", "text"]
221
- if model:
222
- cmd.extend(["--model", model])
223
- if reasoning_effort:
224
- cmd.extend(["--reasoning-effort", reasoning_effort])
225
- if cwd:
226
- cmd.extend(["--cwd", cwd])
227
- merged_system_prompt = []
228
- if include_bootstrap:
229
- bootstrap = _load_bootstrap_prompt()
230
- if bootstrap:
231
- merged_system_prompt.append(bootstrap)
232
- if append_system_prompt:
233
- merged_system_prompt.append(append_system_prompt)
234
- if merged_system_prompt:
235
- cmd.extend(["--append-system-prompt", "\n\n".join(merged_system_prompt)])
236
- if allowed_tools:
237
- cmd.extend(["--allowed-tools", allowed_tools])
238
-
239
- env = os.environ.copy()
240
- env.setdefault("NEXO_HOME", str(NEXO_HOME))
241
- env.setdefault("NEXO_CODE", env.get("NEXO_CODE", str(NEXO_HOME)))
242
- result = subprocess.run(
243
- cmd,
244
- capture_output=True,
245
- text=True,
246
- env=env,
247
- timeout=(int(timeout) if timeout else None),
248
- )
249
- if result.returncode != 0:
250
- raise RuntimeError(result.stderr.strip() or result.stdout.strip() or f"automation backend exited {result.returncode}")
251
- return result.stdout
252
-
253
-
254
- def run_automation_json(
255
- prompt: str,
256
- *,
257
- model: str = "",
258
- reasoning_effort: str = "",
259
- cwd: str = "",
260
- timeout: int | None = None,
261
- allowed_tools: str = DEFAULT_ALLOWED_TOOLS,
262
- append_system_prompt: str = "",
263
- include_bootstrap: bool = True,
264
- ) -> dict:
265
- """Run the configured backend and return a parsed JSON object."""
266
- runner = NEXO_HOME / "scripts" / "nexo-agent-run.py"
267
- if not runner.exists():
268
- raise RuntimeError(f"Automation runner not found: {runner}")
269
-
270
- cmd = [sys.executable, str(runner), "--prompt", prompt, "--output-format", "json"]
271
- if model:
272
- cmd.extend(["--model", model])
273
- if reasoning_effort:
274
- cmd.extend(["--reasoning-effort", reasoning_effort])
275
- if cwd:
276
- cmd.extend(["--cwd", cwd])
277
- merged_system_prompt = []
278
- if include_bootstrap:
279
- bootstrap = _load_bootstrap_prompt()
280
- if bootstrap:
281
- merged_system_prompt.append(bootstrap)
282
- if append_system_prompt:
283
- merged_system_prompt.append(append_system_prompt)
284
- if merged_system_prompt:
285
- cmd.extend(["--append-system-prompt", "\n\n".join(merged_system_prompt)])
286
- if allowed_tools:
287
- cmd.extend(["--allowed-tools", allowed_tools])
288
-
289
- env = os.environ.copy()
290
- env.setdefault("NEXO_HOME", str(NEXO_HOME))
291
- env.setdefault("NEXO_CODE", env.get("NEXO_CODE", str(NEXO_HOME)))
292
- result = subprocess.run(
293
- cmd,
294
- capture_output=True,
295
- text=True,
296
- env=env,
297
- timeout=(int(timeout) if timeout else None),
298
- )
299
- if result.returncode != 0:
300
- raise RuntimeError(result.stderr.strip() or result.stdout.strip() or f"automation backend exited {result.returncode}")
301
- return _extract_json_object(result.stdout)
@@ -1,13 +0,0 @@
1
- {
2
- "mcp": {
3
- "servers": {
4
- "nexo-brain": {
5
- "command": "python3",
6
- "args": ["~/.nexo/server.py"],
7
- "env": {
8
- "NEXO_HOME": "~/.nexo"
9
- }
10
- }
11
- }
12
- }
13
- }
@@ -1,40 +0,0 @@
1
- """Personal NEXO MCP plugin scaffold.
2
-
3
- This file lives in NEXO_HOME/plugins/ and is loaded by the NEXO MCP server.
4
- Edit the handler below to implement your personal capability.
5
-
6
- If this plugin ever needs an autonomous model call, route it through the
7
- configured NEXO automation backend instead of hardcoding `claude -p` or
8
- provider-specific model names directly inside the plugin.
9
- """
10
-
11
- from __future__ import annotations
12
-
13
- import json
14
-
15
-
16
- def handle_example_tool(payload_json: str = "{}") -> str:
17
- """Example personal MCP tool.
18
-
19
- Args:
20
- payload_json: JSON string with your input payload.
21
- """
22
- try:
23
- payload = json.loads(payload_json or "{}")
24
- except Exception as exc:
25
- return json.dumps({"ok": False, "error": f"invalid json: {exc}"}, ensure_ascii=False)
26
-
27
- return json.dumps({
28
- "ok": True,
29
- "message": "Personal plugin scaffold created. Edit this handler in NEXO_HOME/plugins.",
30
- "payload": payload,
31
- }, ensure_ascii=False)
32
-
33
-
34
- TOOLS = [
35
- (
36
- handle_example_tool,
37
- "nexo_example_tool",
38
- "Example personal MCP tool scaffold. Edit it in NEXO_HOME/plugins.",
39
- ),
40
- ]
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env python3
2
- # nexo: name=example-script
3
- # nexo: description=Example personal script using the stable NEXO CLI
4
- # nexo: category=automation
5
- # nexo: runtime=python
6
- # nexo: timeout=60
7
- # nexo: tools=nexo_learning_search,nexo_schedule_status
8
- # nexo: interval_seconds=300
9
- # nexo: schedule_required=false
10
-
11
- """Example personal script for NEXO.
12
-
13
- This template demonstrates:
14
- - Inline metadata for auto-discovery
15
- - Safe CLI calls through nexo_helper
16
- - Optional agent calls through the configured automation backend
17
- - Timeout handling (via metadata)
18
- - argparse for user arguments
19
- - No direct DB access
20
- - Clean exit codes
21
- """
22
-
23
- import argparse
24
- import sys
25
-
26
- # nexo_helper.py is in NEXO_HOME/templates/ — copy it next to your script
27
- # or add the templates dir to your path
28
- try:
29
- from nexo_helper import call_tool_text, run_automation_text
30
- except ImportError:
31
- import os
32
- sys.path.insert(0, os.path.join(os.environ.get("NEXO_HOME", "~/.nexo"), "templates"))
33
- from nexo_helper import call_tool_text, run_automation_text
34
-
35
- # If this script ever needs an autonomous model call:
36
- # 1. use resolve_user_model() to get the user's configured model
37
- # 2. pass it to run_automation_text(...)
38
- # 3. DO NOT hardcode model names — the user picks their model once
39
- # Example:
40
- # from client_preferences import resolve_user_model
41
- # result = run_automation_text(
42
- # "Summarize pending issues",
43
- # model=resolve_user_model(),
44
- # )
45
-
46
-
47
- def main():
48
- parser = argparse.ArgumentParser(description="Example NEXO personal script")
49
- parser.add_argument("--query", default="cron", help="Search query for learnings")
50
- args = parser.parse_args()
51
-
52
- print(f"Searching learnings for: {args.query}")
53
- result = call_tool_text("nexo_learning_search", {"query": args.query})
54
- print(result)
55
- return 0
56
-
57
-
58
- if __name__ == "__main__":
59
- raise SystemExit(main())
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- # nexo: name=example-script
3
- # nexo: description=Example personal shell script using the stable NEXO CLI
4
- # nexo: category=automation
5
- # nexo: runtime=shell
6
- # nexo: timeout=60
7
- # nexo: schedule=08:00
8
- # nexo: schedule_required=false
9
-
10
- set -euo pipefail
11
-
12
- echo "Hello from NEXO personal shell script"
13
- echo "NEXO_HOME=${NEXO_HOME:-}"
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Skill script template.
3
-
4
- This script is meant to be referenced by a Skill v2 definition.
5
- It should use the stable NEXO CLI rather than importing internal DB modules.
6
- If it needs an agentic model call, route it through NEXO's configured
7
- automation backend instead of hardcoding `claude -p` or a provider model.
8
- """
9
-
10
- import argparse
11
- import os
12
- import subprocess
13
- import sys
14
-
15
-
16
- def main() -> int:
17
- parser = argparse.ArgumentParser()
18
- parser.add_argument("--query", default="")
19
- args = parser.parse_args()
20
-
21
- nexo_code = os.environ.get("NEXO_CODE", "")
22
- if not nexo_code:
23
- print("NEXO_CODE not set", file=sys.stderr)
24
- return 1
25
-
26
- cli_py = os.path.join(nexo_code, "cli.py")
27
- cmd = [
28
- sys.executable,
29
- cli_py,
30
- "scripts",
31
- "call",
32
- "nexo_learning_search",
33
- "--input",
34
- '{"query": %r}' % args.query,
35
- ]
36
- result = subprocess.run(cmd, text=True)
37
- return result.returncode
38
-
39
-
40
- # Agentic example for future edits:
41
- # from client_preferences import resolve_user_model
42
- # from nexo_helper import run_automation_text
43
- # result = run_automation_text("Analyze this", model=resolve_user_model())
44
- # print(result)
45
-
46
-
47
- if __name__ == "__main__":
48
- raise SystemExit(main())
@@ -1,33 +0,0 @@
1
- # Skill Template
2
-
3
- Create a directory under one of:
4
- - `NEXO_HOME/skills/<slug>/`
5
- - `src/skills/<slug>/`
6
- - `community/skills/<slug>/`
7
-
8
- Required files:
9
- - `skill.json`
10
- - `guide.md`
11
-
12
- Optional:
13
- - `script.py` or `script.sh`
14
-
15
- Example `skill.json`:
16
-
17
- ```json
18
- {
19
- "id": "SK-EXAMPLE",
20
- "name": "Example Skill",
21
- "description": "What this skill does.",
22
- "level": "draft",
23
- "mode": "guide",
24
- "source_kind": "personal",
25
- "execution_level": "none",
26
- "approval_required": false,
27
- "tags": ["example"],
28
- "trigger_patterns": ["example task"],
29
- "params_schema": {},
30
- "command_template": {},
31
- "stable_after_uses": 10
32
- }
33
- ```