Repository navigation
Closed
Labels
Description
Overview
A saved query is the way a team defines a view, and under ADR-094 it is also how a queue of work is defined: "Ready tasks", "Awaiting review", or anything a team saves. Today a saved query can only be opened in the app. It cannot be run from the CLI or by the built-in agent, it cannot say "none of" or "is not", and it cannot filter on a value inside a link or object field. This issue makes saved queries runnable and expressive enough to serve as queues.
Problem Statement
- No way to run one.
ExecuteQuerytakes an inline definition. No RPC or CLI command takes a query node's id, so an agent has to fetch the node and copy its filters intonodespace queryby hand. The only backend code that loads and runs a saved query is a Play's scheduled selector. - No narrowing. One "Ready tasks" query cannot be run for a single project without saving a copy per project.
- No negation. Filters are ANDed and existential. "Has no unfinished blocker", "has no plan that is not approved" and "has no assignee" cannot be written.
- No path into a structured value. A property filter's name may not contain a dot, so
repository.urlon a link field is refused. Finding the project for a git remote needs it.
Proposed Solution
nodespace query run <id|title>executes a saved query node and returns its nodes, with the global--json. The built-in agent gets the same as a tool.- Extra filters given at run time are ANDed with the stored ones.
- Any filter can be negated, including a
Relatedfilter and the filter nested inside one. - A property filter and a sort can name a field inside an object or link value, validated against the schema.
Nothing here knows any type or workflow.
Documentation
- ADR-094 §1 - a queue is a saved query; run by id or title; run-time narrowing; negation; paths into object and link values. Build order step 1
- ADR-091 - saved queries, relative dates, where saved views appear
- ADR-093 §1 and §4 - running a saved query is part of a coding agent's interface; the project for a checkout is found by an ordinary query
- Relationship paths - the paths a
Relatedfilter follows - Updates: the saved-query sections of
architecture/data-layer.mdor the query component doc (negation, structured paths, run by id),packages/skill/references/cli.mdandSKILL.md
Architecture Impact
Implements ADR-094 §1. It extends the query filter vocabulary and adds an execution path; it changes no existing decision.
Acceptance Criteria
-
nodespace query run <id>andnodespace query run "<title>"return the nodes the saved query matches, honouring its filters, sorting, limit and relative dates;--jsonreturns the node list - A title that matches no saved query, or more than one, fails with a message that says which
- Filters given at run time are ANDed with the stored filters and do not change the stored query
- A filter can be negated; a negated
Relatedfilter means "the path reaches no node matching the nested filter"; the nested filter can be negated too - "Tasks with no
blocked_bytask whose status is notdoneorcancelled" and "tasks with no plan whoseplan_statusis notapproved" can each be written as a saved query and return the right tasks, including tasks with no blocker and no plan at all - A property filter and a sort accept a path into an object or link field (
repository.url); a path that the schema does not declare is refused at save time and at run time with a message naming it - A filter name still cannot break out of the JSON path: quotes, whitespace and unknown segments are refused
- The built-in agent has a tool that runs a saved query by id or title, and the tool is in the tool registry with its CLI command
- A Play's scheduled selector keeps working, and accepts the new filter forms
- The app's query builder still loads and saves every query it could before; a query using a form the builder cannot edit is shown read-only rather than rewritten
-
references/cli.mdandSKILL.mddocumentquery run, run-time narrowing and negation, andbun run skill:checkpasses - 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/query.rs-FilterType,FilterOperator,QueryFilter,SortConfig,QueryFieldspackages/core/src/services/query_service/mod.rs- filter compilation,validate_identifier, theRelatedfilter and its nesting limit, sortingpackages/core/src/ops/query_ops.rs-execute_query_nodespackages/core/src/playbook/selectors.rs- the one place that loads a saved query node and runs itpackages/proto/proto/node_service.proto,packages/daemon/src/services/node_service.rs-ExecuteQuery,CountQuerypackages/cli/src/commands/query.rs-nodespace querypackages/agent/src/local_agent/tools.rs,packages/agent/src/skill_pipeline.rs- the built-in agent's tools and the seeded tool nodespackages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte- the app's query viewer
Implementation Details
QueryFilteris a wire type: change it once innodespace-types, regenerate TypeScript, and keepdeny_unknown_fields.- Negation is one optional flag on a filter, not a set of new operators.
- A structured path is a list of segments checked against the schema's declared
fields, not a string spliced into SQL. - Resolve types through the registry, never a literal
node_typecomparison. - The filter shape changes with no migration: reset the database.
Related Issues
- Add a link field type: a title and URL pair for schema fields #3541 (the
linkfield type the structured path reaches into)
Non-Goals
- OR between filters
- A filter that asks whether a change would be allowed
- Returning each node's context or skills with a run
Activity
malibio commentedon Oct 5, 2026
Baseline — Frontend: 317 test files passed, 5733 tests passed
WIP: Workflow skills, queues and task context paths are seeded; routi…
WIP: Workflow skills, queues and task context paths are seeded; routi…