Skip to content

Let rules and queries read a checkbox's checked state, and let the CLI's update and status commands name the version they change #3556

Closed

Description

@malibio

Overview

Two small generic gaps stand between the Play engine and the rules ADR-092 ships. A rule cannot read whether a checkbox is checked except by matching its text, and the CLI's update and status commands cannot say which version of a node they are changing, so two agents can both start the same task. This issue closes both.

Problem Statement

  • Checked state is only in the content. A checkbox stores - [x] or - [x] as a prefix of its content, and its checked state is derived from that. A Play condition or a query filter that needs "is this checked" has to match the prefix as a string. No shipped rule does this today, and a prefix match is fragile (- [X], leading whitespace).
  • Single-node writes carry no version. The daemon refuses a write that names a stale version, but nodespace node update and nodespace node set-status send none, so the daemon applies them to whatever is current. Two sessions that both read an open task and both set it to in_progress both succeed.

Proposed Solution

  • Derived attributes are declared and readable. Each primitive type's derived attributes are declared in the type registry. A Play condition reads one by name on a node map (c.checked), and a query filter can name one. checkbox declares checked.
  • Writes can name a version. nodespace node update and nodespace node set-status accept the version the caller read. A stale version is refused with the version conflict the daemon already produces, and the message says the node changed and what its version is now.

Both are generic: neither knows about tasks or checklists.

Documentation

  • ADR-094 §5 (derived attributes are readable) and §6 (a write names the version it read); Build order step 3
  • ADR-092 §2, §6 and §7 - checklists as criteria, the rules that read checked, and claiming a task by version
  • ADR-086 - the registry; primitive types have no schema fields and their attributes are derived from content by one pure function each
  • Node Types §3 - primitive types and what each derives
  • Playbook system - what a condition can read
  • Updates: components/node-types.md (derived attributes are readable by rules and queries), architecture/playbook-system.md (conditions read derived attributes), packages/skill/references/cli.md and SKILL.md (the version flag and what a conflict means)

Architecture Impact

Implements ADR-094 §5 and §6. Derived attributes stay derived: nothing is stored, in line with ADR-086.

Acceptance Criteria

Derived attributes

  • The registry declares a primitive type's derived attributes; checkbox declares checked (boolean), computed by one function. Only checked is declared: the other derived values (a header's level, a code block's language) stay undeclared until a rule or query reads them
  • A Play condition reads checked on a checkbox reached through has_child: node.has_child.exists(c, c.checked == false) is true for a node with an unchecked checkbox child and false otherwise
  • Save-time validation accepts a derived attribute on the type that declares it and refuses it on a type that does not
  • A query filter can name a derived attribute; "nodes with a checkbox child that is not checked" can be written and returns the right nodes
  • The derived value follows the content: editing a checkbox's prefix changes what the condition and the filter see, with nothing stored
  • A derived attribute cannot be written; a write naming one is refused
  • The engine has no content-prefix matching for checked state; one function decides it

Version on writes

  • nodespace node update and nodespace node set-status accept a version; with one, the write succeeds only if the node is still at that version
  • A stale version exits non-zero with a message that names the node, the version given and the current version; --json carries the same as structured output
  • Without a version the commands behave as today
  • Two writes that name the same version: the first succeeds and the second is refused; a test runs them concurrently
  • The built-in agent's update tool accepts a version the same way

General

  • references/cli.md and SKILL.md document the version flag and tell the agent to re-read a node after a conflict before deciding what to do; bun run skill:check passes
  • Docs updated as listed under Documentation
  • Code passes bun run quality:fix
  • Tests pass (bun run test:changed)

Technical Specifications

Reference Files

  • packages/nodespace-types/src/ - CoreNodeType and the registry entries
  • packages/core/src/behaviors/mod.rs - the checkbox behaviour and its derived state
  • packages/core/src/playbook/cel.rs - node_to_cel_value_at_scope, is_core_key; packages/core/src/playbook/graph_resolver.rs - related-node values; packages/core/src/playbook/validation.rs - save-time path checks
  • packages/core/src/services/query_service/mod.rs - filter targets
  • packages/cli/src/commands/node.rs - update and set_status, which pass version: None today; delete already takes a version
  • packages/core/src/services/error.rs - VersionConflict
  • packages/proto/proto/node_service.proto - the update request's version

Implementation Details

  • A derived attribute is declared once, in the registry, and both the CEL value builder and the query service read that declaration. Do not special-case checkbox in either.
  • In SQL the attribute has to be computed from content; keep the expression next to the Rust function and test that the two agree on the same inputs.
  • The daemon already maps a version conflict to an error; the CLI needs to print it usefully, not as a generic RPC failure.

Related Issues

Non-Goals

  • Recording which session holds a task
  • A lock across devices

Activity

  1. malibio commented on Oct 5, 2026

    @malibio
    CollaboratorAuthor

    Baseline — Frontend: 317 test files passed, 5733 tests passed

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions