Repository navigation
Description
Overview
../nodespace-docs/architecture/playbook-system.md's "Agent Interface" section specifies nodespace playbook <verb> CLI operations (list, logs, enable, disable, get-workflow-state) for agents to control and introspect playbooks. None of these exist today — no CLI subcommand, no gRPC/proto surface, no local-agent tool.
Problem Statement
This section was previously written as an "MCP Interface," describing MCP tools directly — a framing that predated ../nodespace-docs/decisions/035-skills-replace-mcp.md (ADR-035) and has since been corrected in the doc to describe CLI verbs + skill guidance instead, matching NodeSpace's actual agent-integration surface. But the correction was doc-only; none of the underlying capability exists in code.
This is a gap for both external agents (CLI/skill) and the local agent: packages/agent/src/local_agent/tools.rs has no playbook-related tool builder at all, so this is not merely an "external CLI lags the local agent" situation — neither surface can touch playbook lifecycle or ask the engine anything today.
Proposed Solution
Add the playbook operations as CLI verbs (reducing to existing generic graph verbs wherever possible), wire skill guidance through the existing generated pipeline, and add a matching local-agent tool.
Architecture Impact
This issue implements the Agent Interface section of ../nodespace-docs/architecture/playbook-system.md, and follows:
- The capability-parity obligation in ADR-035 (
../nodespace-docs/decisions/035-skills-replace-mcp.md): every daemon tool the local agent can call must have a correspondingnodespaceCLI verb. - The guidance-parity obligation in the same ADR: skill guidance must be derived from seeded skill nodes, not hand-maintained prose.
- The routing-as-retrieval rationale in
../nodespace-docs/decisions/038-skill-mediated-tool-routing.md(ADR-038).
This issue does not reverse or supersede any ADR — it implements obligations already accepted.
Terminology note: this issue's description uses "playbook" for what nodespace-docs now calls a Play — a single automation rule-set node instance (node_type: "play", per the rename that landed in #2569). "Playbook" correctly stays the name of the engine/subsystem itself. Read this issue's instance-level "playbook" references (the CLI verb subject, enable/disable/list/logs targets) as "Play." The exact CLI verb spelling (nodespace playbook <verb> vs nodespace play <verb>) should be decided as part of this issue's own design work, informed by #2569's renamed code identifiers (already landed — see Dependencies), not assumed from this issue's current prose.
Dependencies
Both prerequisite issues are closed and merged — nothing currently blocks starting this issue:
- Wire playbook engine into daemon startup, hard-gated to local-only events #2562 (playbook engine wired into daemon startup) — closed. The engine now actually runs, so lifecycle control and
get-workflow-statecan be validated against a live system. - Rename node_type "playbook" to "play" and instance-level identifiers in code #2569 (renames
node_type: "playbook"→"play"and instance-level identifiers in code) — closed. The renamed identifiers referenced in the Terminology note above already exist in code; the CLI-verb-naming decision can be made concretely rather than speculatively.
Implementation Approach
Audit before adding new surface
Before adding bespoke CLI/proto surface for list, logs, enable, disable, check whether each already reduces to an existing generic graph verb (node update, node query, etc.) per ADR-035's capability-parity clause. For example, disable may be no more than setting a lifecycle_status property via the existing generic update path — if so, expose it that way rather than adding a new purpose-built verb. get-workflow-state is expected to require purpose-built evaluation regardless, since it runs the engine's condition logic out of band from a live trigger.
get-workflow-state design (resolve before implementing)
This is not a mechanical CLI wrapper — resolve these three questions as part of the design:
- Fired-state scoping: "which rules have fired" cannot be honestly answered in global/cross-device terms while ADR-060's multi-device semantics remain unimplemented (see
../nodespace-docs/decisions/073-playbook-engine-local-only-until-sync-stable.md, ADR-073). Scope the v1 response as explicitly local-device-scoped, and state that limitation in the tool's own output/description — not just in this issue. - Synthetic trigger event: CEL condition evaluation (
packages/core/src/playbook/cel.rs) expects a real triggeringDomainEventfortrigger.property.old_value/trigger.property.new_valuebindings.get-workflow-statehas no such event — it is an out-of-band query, not a live trigger. Define explicitly what gets substituted or omitted for these bindings when evaluating outside a real trigger. - Evaluation scope: candidate rule selection must reuse the engine's
TriggerIndex, not linearly scanActivePlaybooks.
Diagnostic quality is an acceptance requirement
CEL condition path typos silently evaluate to false forever with no error — this is documented existing engine behavior, not something to fix here. But it makes get-workflow-state's diagnostic quality load-bearing for anyone hand-authoring a playbook (schemas and playbooks are intentionally agent/CLI-authored, not UI-authored). get-workflow-state must surface a likely-typo'd or unresolvable graph path clearly and distinctly from "condition legitimately not yet met" — not just report a flat "condition not met" for both cases.
Skill guidance
Wire guidance through the existing generated pipeline — packages/agent/src/skill_rules.rs → seed_skill_nodes() → packages/cli/examples/gen_skill_md.rs — not hand-maintained SKILL.md prose, so it inherits the skill:check CI gate's drift protection.
Sequencing constraint: the CLI-verb change and the skill-guidance change must land in the same PR (or same merge window). skill:check mechanically requires SKILL.md to document any CLI subcommand that exists, so landing a new nodespace playbook verb without matching guidance fails CI.
Local agent
Add matching tool(s) to packages/agent/src/local_agent/tools.rs. This is not solely an external-CLI gap.
Acceptance Criteria
- Explicit audit documented (in the PR) of which of the five operations needed new CLI/proto surface vs. reduced to an existing generic verb
-
get-workflow-state's fired-state scoping, synthetic-event substitution, and evaluation-scope design are resolved and documented before implementation, not decided ad hoc while coding -
get-workflow-statedistinguishes a likely-typo'd/unresolvable condition path from a legitimately-unmet condition in its output - Skill guidance ships via
skill_rules.rs/seed_skill_nodes()/gen_skill_md.rs, andskill:checkpasses - CLI verb(s) and skill guidance land together (same PR)
- Local agent gains the equivalent tool(s) in
packages/agent/src/local_agent/tools.rs - Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
../nodespace-docs/architecture/playbook-system.md— Agent Interface section (the spec this issue implements)packages/core/src/playbook/cel.rs— CEL evaluator,TriggerIndex, binding context constructionpackages/core/src/playbook/lifecycle.rs—PlaybookLifecycleManager, existing internal-onlyenable/disablemethods to build the external surface on top ofpackages/cli/src/commands/schema.rs— working precedent for how a CLI verb wraps acoreoperationpackages/agent/src/skill_rules.rs,seed_skill_nodes()— skill guidance generation pipelinepackages/cli/examples/gen_skill_md.rs—SKILL.mdgeneration and theskill:checkgatepackages/agent/src/local_agent/tools.rs— local agent tool registry
Related Issues
- None currently open — both prior dependencies (Wire playbook engine into daemon startup, hard-gated to local-only events #2562, Rename node_type "playbook" to "play" and instance-level identifiers in code #2569) are closed
Non-Goals
- Building any part of ADR-060's multi-device semantics as part of this issue
- A UI for playbook authoring (playbooks remain CLI/agent-authored, matching how schema nodes are authored today)
Activity
malibio commentedon Sep 13, 2026
Frontend baseline: 240 test files passed, 4951 tests passed (81.84s).
malibio commentedon Sep 13, 2026
Status check: this issue is assigned with a locked worktree (
issue-2563-playbook-agent-interface), but no implementation work has landed yet — the branch sits at the merge-base withorigin/main, working tree clean, no divergent commits either direction.mainhas moved since the worktree was created, including #2586 ("Add add_field_values schema op and enum enforcement for task.status"), which appears to close out the ADR-076 work. The worktree shouldgit pull origin mainbefore implementation begins, per this issue's existing dependency on #2569 (already landed) and #2562 (also already landed, per recentmainhistory).