Skip to content

Require a description on every play rule, condition and action, and reject stale ones #3517

Closed

Description

@malibio

Overview

A play's rules carry no human text: a condition is a bare CEL string such as node.child_of.has_child.all(status == 'done'). ADR-090 makes the play's author write what each part means, in the same write as the rule, so the play viewer can show a readable workflow and agents keep rule and intent together. This is a change to the play type and the first of the ADR-090 work: the viewer and the agent's play tools depend on the new rule shape.

Proposed Solution

  • RuleDefinition gains a required description.
  • Conditions change from Vec<String> to objects { expr, description }, both required.
  • Each Action variant gains a required description beside action_type, params and for_each.
  • The trigger gets no description.
  • Save-time validation rejects a blank description and a stale one, as ADR-090 §1 specifies (matching by rule name, then by index; what counts as each component's content).
  • Seeded core plays and bundled playbooks' plays ship descriptions in their seed tables.
  • The CLI reads and prints the new shape; SKILL.md and references/cli.md teach it.

Documentation

Architecture Impact

Implements ADR-090 §1 and §7, which change the play rule shape documented in architecture/playbook-system.md (conditions were CEL strings). The docs were updated first (nodespace-docs 88cc64b). Pre-release: change the shape and reset the database; no migration of stored plays.

Acceptance Criteria

  • RuleDefinition.description, condition { expr, description } and action description exist in nodespace-types, required; bun run gen:types output committed
  • Decoding rejects a missing description and a bare-string condition, naming the rule and field
  • Save-time validation rejects a blank (empty or whitespace) description, naming rule, component and index
  • Save-time validation rejects a stale description per ADR-090 §1: a changed condition expr, a changed action (action_type, params, for_each), or a changed rule trigger/class that keeps its stored description. Tests cover each case, plus an unmatched (new) component, a renamed rule (treated as new), and a write that leaves rules alone (no stale check, so a play with broken rules can still be switched off)
  • The CEL compiler, the engine, get_workflow_state and graph resolution read expr; no behavior change in evaluation (existing engine tests pass with the new shape)
  • Every core play (playbook/core_plays.rs) and every bundled playbook play (methodology/linear.rs, jira.rs, spec_driven.rs) carries descriptions; a test validates every seeded and bundled play through save-time validation
  • _seed.default_rules (reset target) carries the descriptions too
  • CLI: playbook list and node get print the new shape; writing rules through the CLI accepts it and surfaces the validation errors readably
  • SKILL.md / references/cli.md teach descriptions, the condition object and the stale rejection, written as shared rule fragments; the SKILL.md drift check passes
  • components/node-types.md still matches (bun run node-types:check)
  • bun run quality:fix clean; bun run test:changed passes

Technical Specifications

Reference Files

  • Rule types: packages/nodespace-types/src/play.rs (conditions: Vec<String> at the RuleDefinition struct)
  • Core-side rule types: packages/core/src/playbook/types.rs
  • Validation: packages/core/src/playbook/validation.rs (validate_play); the typed update path packages/core/src/services/node_service/schema.rs (update_play_node), which already knows when rules changed
  • CEL: packages/core/src/playbook/cel.rs; graph resolution packages/core/src/playbook/graph_resolver.rs
  • Seeded plays: packages/core/src/playbook/core_plays.rs, packages/core/src/playbook/seeded.rs; bundled: packages/core/src/methodology/
  • CLI: packages/cli/src/commands/playbook.rs
  • Skill: packages/skill/SKILL.md, packages/skill/references/cli.md; fragments under packages/agent/src/seeds/rules/

Implementation Details

  • The stale check needs the stored rules and the incoming rules together, so it belongs where the typed update compares them, not in decode.
  • The error text is consumed by agents: name the rule by name, the component kind and its 1-based index, and say what to change.

Related Issues

Activity

  1. malibio commented on Oct 4, 2026

    @malibio
    CollaboratorAuthor

    Baseline (fresh worktree, machine under load from other sessions — 2001s run): Frontend 5591 passed, 22 failed across 17 files, before any change. Kind: structured core type (play), category unchanged; the change is to the nested RuleDefinition shape (rule description, condition { expr, description }, action description).

  2. self-assigned this
    on Oct 4, 2026
  3. added a commit that references this issue on Oct 4, 2026
    2c3882b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendenhancementfoundation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions