Repository navigation
Closed
Labels
Description
Problem
Under the skills+scripts direction (#1228), agents invoke NodeSpace by running the nodespace CLI (taught via @nodespaceai/skill's SKILL.md). Two failure modes are currently unhandled, and both produce raw errors the agent can't reason about:
- CLI not installed / not on
$PATH—nodespace …returnscommand not foundfrom the shell. This happens before any SKILL.md guidance is relevant, and the agent has no recovery path. - Daemon not running — the CLI returns a connection error. (
packages/cli/src/lib.rsalready emits a helpful "Is the daemon running? Start it withnodespaced" — good, the agent can act on that.) But there's no instruction telling the agent to check health proactively before a batch of operations.
The concern: an agent that "knows about NodeSpace" via the skill still doesn't reliably know whether the tooling is present and healthy before it starts. Skill discovery (the agent seeing the skill exists) is separate from runtime availability (the binary + daemon actually working).
Proposed contract: skill preflight + self-diagnosis
In SKILL.md (the teacher):
- Open with an explicit preflight the agent runs first:
nodespace --versionto confirm the CLI is installed, thennodespace diagnosticsfor daemon/db health. - Document what each failure means and the recovery path:
command not found→ NodeSpace CLI isn't installed; tell the user to install it (don't silently fail).- connection error → daemon down; surface the CLI's own "start
nodespaced" message to the user.
- Make the preflight a precondition the agent checks before multi-step procedures, not per-call.
In the installer (@nodespaceai/skill):
- At skill-install time, verify the
nodespacebinary resolves on$PATH; warn loudly if it doesn't, so the mismatch is caught before any agent session rather than mid-task.
In the CLI:
- Confirm
nodespace --versionworks without a running daemon (pure client-side; must not require the socket). - Ensure the "binary present but daemon down" error is consistently actionable (it already is for node ops — verify across all subcommands).
Acceptance criteria
- SKILL.md documents a preflight (
--version,diagnostics) with explicit failure→recovery guidance for both "not installed" and "daemon down" -
nodespace --versionsucceeds with no daemon running - Skill installer warns if the
nodespacebinary is not on$PATHat install time - All CLI subcommands return an actionable "daemon not running" message (not a raw socket error)
Related
- Architectural audit (post-daemon + post-SQLite): structural findings & improvement plan #1228 (architectural audit, section D — skill-as-teacher)
- CLI coverage gap: surface remaining knowledge-graph operations so skills+scripts can replace MCP #1227 (CLI coverage gap)
- Install the NodeSpace skill into AI agents on first launch #1199 / Settings: Integrations panel for PATH and skill configuration #1181 (skill install + integrations panel)
Activity
malibio commentedon May 29, 2026
Frontend: 131 passed
malibio commentedon May 29, 2026
Code Review — Skill Preflight (#1229)
Branch:
worktree-issue-1229-skill-preflightReviewer: Principal Engineer (automated pragmatic review)
Verdict: APPROVE with one improvement recommendation
This is a clean, well-scoped implementation. Three files changed, all cohesive around a single purpose. Net-positive change. The findings below are triaged; nothing blocks merge.
Requirements Validation
--version,diagnostics) with failure→recovery guidancenodespace --versionsucceeds without a running daemon--versionbeforerun()dispatches toconnect())$PATHat install timelib.rsroute throughconnect(),connect_import(), orconnect_session(), each of which produces the same actionable error string.uninstallrequires no daemon. No Rust changes were needed and the commit correctly explains why.Findings
Suggested Improvements
packages/skill/src/tests/installer.test.ts— Existinginstall()tests emit live stderr noiseThe six synchronous
install(...)calls in the top-leveldescribe('install')block (lines 72–133) use the module-level import, which is bound to the realchild_process. Whennodespaceis not on PATH in the test environment (as observed during this review run), everyinstall()call prints:This generates six identical WARNING lines in test output (confirmed by running
bun run --cwd packages/skill test). The tests all pass, but the noise makes it harder to spot real warnings.Recommended fix: Add a
vi.mock('node:child_process', ...)hoisted mock inbeforeEach/afterEachfor the existingdescribe('install')suite, or add a module-levelvi.spyOn(process.stderr, 'write').mockImplementation(() => true)inbeforeEach/afterEachon the whole suite. Thedescribe('install PATH warning')tests already demonstrate the correct pattern withvi.doMock+resetModulesfor asserting the warning content — the existinginstalltests just need the noise suppressed.Nitpicks
Nit:
packages/skill/src/tests/installer.test.tsline 185–192 — misleading comment about CI env guardThe comment reads: "In CI where the binary is absent this test is skipped via the env guard below." There is no env guard; the test always runs and accepts any
booleanreturn. This is fine as a test strategy (the constraint is verified by the type check), but the comment is inaccurate and could confuse future readers. It should either be removed or rewritten to say: "This test only validates the return type is boolean — the actual value depends on whether the binary is installed in this environment."Nit:
packages/skill/SKILL.mdline 20 — partial error message matchThe failure recovery table lists the symptom as
`Could not connect to nodespaced`. The actual CLI error isCould not connect to nodespaced at <path>.\nIs the daemon running? Start it with \nodespaced` in another terminal.The prefix matches so an agent reading the CLI output will recognize it, but aligning the table entry to the actual prefix (e.g., ``Could not connect to nodespaced at` ``) would prevent a false-negative if the CLI message is ever refactored.Nit:
packages/skill/src/installer.ts—isNodespaceBinaryOnPathcatches all errors, not just ENOENTThe bare
catch {}will also suppress a non-zero exit from a corrupt binary or a version flag that exits with an error code. This is acceptable for the current use case (binary found but broken → still warn user), but worth documenting in the JSDoc. The existing comment is good; one more sentence — "Note: a non-zero exit code is also treated as absent." — would be complete.Summary
The implementation is minimal and correct: SKILL.md teaches the agent the right preflight pattern and recovery steps;
isNodespaceBinaryOnPathis a clean, dependency-free probe exported for testability; the warning ininstall()fires at the right time (install time, not every invocation). The test coverage for the new paths is solid. The only actionable issue before merge is the stderr noise in the existinginstall()tests.Skill preflight: agent must detect whether the nodespace CLI is insta…