Repository navigation
Closed
Labels
Description
Overview
Give a play its own user-owned on/off switch, enabled. Record the engine's verdicts as device-local suspensions that survive a restart and never change the user's switch. Make "does this play run" one check (ADR-087 §5).
Problem Statement
lifecycle_statusis the play's on/off switch.- Startup loads only
activeplays (packages/core/src/playbook/engine.rs,query_nodes_by_type("play", Some("active"))). handle_play_createdandhandle_play_updatedcompare lifecycle with the in-memory state.nodespace playbook enable|disable(packages/cli/src/commands/playbook.rs) writeslifecycle_status.packages/skill/references/cli.mdteaches--lifecycle-status archivedas the way to disable a play, and contradicts itself: it says no bespoke enable/disable commands exist, then documentsplaybook enable|disable.
- Startup loads only
- Engine disables are memory only.
PlaybookLifecycleManager::disable_play(packages/core/src/playbook/lifecycle.rs) is called on validation failure, the cycle-depth limit and action failure. The node staysactive, no API can see the disable, and a restart undoes it. - Engine defects:
- After an action failure, later rules of the same play still run in that work item.
handle_play_created's disable is a no-op.- A parse failure on update drops the play entirely.
- Rule validation runs on any patch.
validate_play_rulesruns on anypropertiespatch, so a switch-only write is refused for a play with now-invalid rules. - A nonexistent command is advertised. CLI help advertises
playbook logs, which doesn't exist.
Proposed Solution
- Declare
enabledon theplayschema: boolean, defaulttrue, synced. It is changed only by a user or agent:playbook enable|disable, the Plays UI,node update. - Declare the suspension fields
suspended_reason(enum:validation_failed,action_failed,cycle_limit,schema_drift),suspended_messageandsuspended_at. They are system-owned andlocal_only, written without a version bump, and they emit a node-updated event. - Runnable = participates (the governance check) ∧
enabled∧ the rules are valid ∧ not suspended. Replace every play-specific lifecycle comparison in the engine with this one check. - Clearing a suspension: setting
enabled: true(even when it's already true) or saving new rules clears it; the engine re-validates and suspends again if the problem remains. - Rule validation runs only when
ruleschange, so a switch-only write always succeeds. - Fix the three engine defects. After an action failure, skip that play's remaining rules for the work item; make the created-disable effective; a parse failure suspends the play instead of dropping it.
- The ADR-060 §8 seeded-play warning fires on
enabledgoingtrue → false, or on rule edits. - CLI:
playbook enable|disablewritesenabled;playbook listshows on / off / suspended (with reason and time); removelogsfrom the help. - Skill guidance: update
packages/skill/references/cli.mdandSKILL.mdto teachplaybook enable|disableandenabled, remove--lifecycle-statusas a play switch, and resolve the contradiction. RegenerateSKILL.md(drift check).
Architecture Impact
Implements decisions/087-lifecycle-status-is-governance-and-one-participation-rule.md §3 and §5 (nodespace-docs), with ADR-060 §8 (the seeded-play warning) and ADR-073 (per-device engine). architecture/playbook-system.md and playbook-engine.md need their enable/disable and suspension sections updated in the same PR.
Acceptance Criteria
- The
playschema declaresenabledand the threelocal_onlysuspension fields - The engine never reads a play's
lifecycle_status; runnable is the single check above (tests: disabled, suspended, archived and invalid plays don't run) - An engine failure writes a suspension that survives a daemon restart and leaves
enabledunchanged (test) - Setting
enabled: true, or saving fixed rules, clears a suspension (test) - A switch-only write succeeds for a play with invalid rules (test)
- After an action failure, the play's later rules don't run in that work item (test); the created-disable and parse-failure defects are fixed (tests)
-
nodespace playbook enable|disable|listuseenabledand the suspension fields;logsis gone from the help (CLI tests) - Skill guidance (
cli.md, generatedSKILL.md) teaches the new switch and no longer teaches lifecycle as a play switch; the drift check passes - Follows
development/node-type-sequence.md; thenode-types.mdplay sheet and the playbook docs updated in the same PR -
bun run test:changedpasses;bun run quality:fixclean
Technical Specifications
Reference Files
packages/core/src/models/core_schemas.rs(playschema)packages/core/src/playbook/engine.rs(handle_play_created,handle_play_updated, startup load, thedisable_playcall sites)packages/core/src/playbook/lifecycle.rs(PlaybookLifecycleManager)packages/core/src/playbook/validation.rs(validate_play_rules)packages/cli/src/commands/playbook.rspackages/skill/references/cli.md,packages/skill/SKILL.md,packages/cli/examples/gen_skill_md.rs
Dependencies
- Make one governance check decide whether an archived node participates anywhere #3443 (the governance participation check). If this issue lands first, it can use a temporary local check, with a note to switch to Make one governance check decide whether an archived node participates anywhere #3443's.
Non-Goals
- Typed play rules and selectors (separate issue)
- The Plays navigation section (Add a 'Plays' navigation section: list plays with their state and open them (Labs Playbooks-gated) #3270)
Activity
malibio commentedon Oct 2, 2026
Baseline — Frontend: 303 test files passed, 5559 tests passed
Give plays a user-owned enabled switch and persist engine suspensions (…
Give plays a user-owned enabled switch and persist engine suspensions (…