Skip to content

Let agents fetch NodeSpace's skills and schemas by intent: make skill guidance return them, and embed schemas #3502

Closed

Description

@malibio

Overview

An external agent (Claude Code, Codex, Antigravity) should be able to pull NodeSpace's skills on demand, the way it loads skills in its own harness. That covers the core skills (for example "Schema Creation", "Relationship Management"), user-authored skills and Playbook skills. Mechanically this is a CLI fetch, not the harness's skill loader, but the agent should treat what it fetches as instructions for the operation at hand.

SKILL.md then stops carrying NodeSpace's procedures itself. It teaches the agent how to find and fetch them.

A fetch should return the schemas relevant to the same intent alongside the skills, so the agent gets both the procedure and the shape of the types it is working with.

Today this cannot work, for three reasons:

  1. Fetching returns nothing. nodespace skill guidance "<task>" never matches a non-empty query.
  2. Core skill content is written for the wrong agent. The stored bodies use the in-app agent's tool names, which an external agent does not have.
  3. Schemas are never embedded, so no schema can be found by meaning, in-app or out.

Problem Statement

1. skill guidance never matches

Reproduced on a fresh database with the embedding model loaded and all 15 skill nodes embedded (stale = 0, error_count = 0, every embedding.id present in vec_embeddings, unit-norm vectors):

nodespace skill guidance "delete a node"        → no match
nodespace skill guidance "start the sprint"     → no match (verbatim from the "Sprints and Cycles" description)
nodespace skill guidance ""                     → returns guidance
nodespace search "delete a node" --type skill --threshold 0.01 --json   → {"count": 0, "nodes": []}
nodespace search "" --type skill --json         → count 15

Root cause.

  • skill guidance reuses the generic SearchNodes RPC with node_types: ["skill"] (build_guidance_request, packages/cli/src/commands/skill.rs). The daemon handler (search_nodes, packages/daemon/src/services/node_service.rs) passes scope: None, which resolves to the default Knowledge scope.
  • should_skip_scope_filter (packages/core/src/ops/search_ops.rs) bypasses that scope only for enumerate queries (is_enumerate && has_node_types && scope_is_default).
  • skill is a system type, not in KNOWLEDGE_CORE_TYPES, so matches_scope drops every result.
  • This has been true since the command was added.

Further problems on the same path:

  • build_guidance_request sends threshold: 0.0 meaning "no floor"; the handler treats 0.0 as unset and search_semantic applies its default of 0.7. The in-app router uses no floor (SKILL_SEARCH_THRESHOLD = 0.0, packages/core/src/ops/skill_ops.rs).
  • The generic path runs a global KNN, then filters by type, so in a large graph the few skill vectors can fall outside the top-k window. skill_ops::find_skills uses an exact scan over one type (semantic_search_nodes_of_type_with_vector) plus the exclusion re-rank.

2. Core skill bodies use in-app tool names

  • SkillSeed::template resolves rule includes with RuleForm::Agent (packages/agent/src/skill_pipeline.rs). The stored body therefore says CALL create_relationship NOW, get_related_nodes, search_semantic.
  • Fixing retrieval alone would hand an external agent commands it cannot run.
  • The rule fragments in packages/agent/src/skill_rules.rs already carry both forms (RuleForm::Agent and RuleForm::SkillMd). The skill bodies around them are written for the in-app agent only.

3. Content drift found in the same skills

These bodies become what external agents read, so they are fixed here:

  • A heading that repeats the skill. Every core skill body opens with # <Name> Guidance (enforced by the starts_with("# ") test in skill_pipeline.rs). It becomes the skill's only direct child and repeats the skill's name, which users read as a duplicate skill. The prompt already prints the name and purpose (render_candidates_for_prompt, routing.rs). The 5 agent-guidance bodies have no heading, and Playbook skills use their plain title.
  • An orphan rule. relationship-reverse-traversal is registered in skill_rules.rs but no seed skill includes it, so the in-app agent never sees the canonical reverse-traversal rule. relationship-management.md's TRAVERSING line covers only part of it. No test checks that every rule's agent form reaches a skill.
  • SKILL.md contradicts the CLI reference on relationships. SKILL.md says relationships must be defined on a schema before use, contradicting the four universal names (member_of, has_child, mentions, has_role) in references/cli.md and the tool description. The direction rule ("reversing them records the opposite fact and still reports success") appears in neither SKILL.md nor cli.md.

4. Schemas are never embedded, so they cannot be found by meaning

Schemas are designed to be found semantically:

  • SchemaNodeBehavior aggregates a schema's description subtree for embedding (packages/core/src/behaviors/mod.rs);
  • Schema is in KNOWLEDGE_CORE_TYPES;
  • bm25_search_titles leaves schemas out of keyword search on the grounds that "a schema is still found by meaning, through its embedding";
  • skill_ops::find_skills runs a semantic schema search next to the skill search.

Yet no schema is embedded. The fresh database above has 26 schema nodes (including the user-defined cycle and issue) and 0 schema rows in embedding.

Root cause.

  • create_schema (packages/core/src/schema/mod.rs) writes the schema through create_node_with_parent_in_tx, which deliberately does not queue an embedding marker. Its doc comment (packages/core/src/services/node_service/crud.rs) says a caller needing one should queue after commit, and that handle_create_schema "does not need to (schema nodes are not embedded root content)". That contradicts every consumer listed above.
  • Core schema seeding writes with store.create_node (packages/core/src/services/node_service/mod.rs), which also queues nothing.

So the schema half of find_skills returns nothing in-app too, and so does any "is there a type for this?" query.

Decisions

  • External agents can fetch every NodeSpace skill: core, user-authored and Playbook, through nodespace skill guidance, ranked the way the in-app agent ranks skills.

  • A fetch returns the relevant skills and the relevant schemas together, as find_skills does in-app. The agent forms the query from the intent it has narrowed — the user's request or the task at hand — and gets back both how to do the operation (skills) and the shape of the types it touches (schemas: fields, relationships, descriptions). For a workspace domain such as Issues or Cycles, that means the domain's skill and its schemas arrive in one fetch.

  • SKILL.md teaches the fetch, not the procedures. It says when to fetch (before a nontrivial operation), how to fetch (by task, or list all), and that what comes back is the operation's instructions. Procedure moves out of SKILL.md into the skill nodes.

  • SKILL.md says outright that more instructions live in NodeSpace, beyond what it carries. Two kinds:

    • instructions for operating NodeSpace itself (creating schemas, managing relationships, importing, …);
    • instructions specific to this workspace's own domains: the types and workflows installed in it, such as Issues and Cycles, or whatever schema structure the user has set up.

    The agent should expect the workspace to have its own conventions, and fetch them before working in one of its domains rather than guessing from generic knowledge. The wording names domains, types and workflows, never "Playbook" (Keep Playbooks out of the agent's vocabulary: agents work Plays and schemas, and Playbooks install only from the app #3506): to the agent, an installed setup is just schemas, Plays and skills.

  • A skill node is the one source of a procedure for both audiences. What an external agent receives names CLI commands; what the in-app agent receives names its tools.

  • Always-on agent-guidance stays as it is: in-app identity and policy only, never fetched as a skill.

Proposed Solution

Retrieval

  • Serve skill guidance from the typed skill search behind skill_ops::find_skills: exact scan over skill nodes, no score floor, exclusion re-rank, subtree markdown attached. This needs a daemon RPC, since none exists for skill search.
  • Return matching schemas alongside matching skills, from the same query embedding, as find_skills already does in-app. Each schema result carries what an agent needs to work with the type: name, description, fields (with their descriptions and enum values) and declared relationships. In the external rendering it is a separate section from the skills.
  • Keep the empty query as "list every skill", with names and descriptions, so an agent can browse what exists.

Schema embeddings

  • Queue a schema for embedding on every path that creates or changes one: create_schema (after its transaction commits), update_schema when the description, fields or relationships change, core schema seeding, and schemas a Playbook install creates.
  • Correct the create_node_with_parent_in_tx doc comment, which says schema nodes are not embedded.
  • What is embedded for a schema is its description subtree plus enough of its shape (name, field names and descriptions) to match an intent phrased in the user's words, for example "billing" finding "Invoice".
  • Fix the related silent zero: nodespace search "<query>" --type <system type> returns that type's matches. An explicit node_types filter takes precedence over the default Knowledge allowlist for real queries, as it already does for enumerate queries. An unfiltered search still excludes system types.

One body, two audiences

  • Render a seeded skill for the caller. The in-app agent keeps RuleForm::Agent; an external fetch gets the same skill with rule includes resolved as RuleForm::SkillMd, and the surrounding prose names CLI commands.
  • Rewrite the core skill bodies so the prose outside rule includes does not name in-app-only tools. Where a tool name is needed, put it in a rule fragment with both forms.
  • User-authored and user-modified skills are served as stored.

Content

  • Drop the # <Name> Guidance heading from the 11 core seed bodies. Change the test to forbid a leading H1.
  • Include relationship-reverse-traversal in relationship-management.md in place of its TRAVERSING line.
  • Add a test that every interaction and schema rule's agent form is included by at least one seed skill, or is listed in SCHEMA_RULES_NOT_IN_PROMPT.
  • Make the relationship direction rule a shared fragment, so both forms carry it.
  • Rewrite SKILL.md around fetching. Keep only what an agent needs before its first fetch: what NodeSpace is, the trust boundary in references/graph-authored-guidance.md, and when and how to fetch. Remove procedures that now live in skills, including the relationship text that contradicted cli.md. references/cli.md stays as the command reference.

Architecture Impact

This changes ADR-064 §5 (../nodespace-docs/decisions/064-instruction-channel-doctrine.md, amendment of 2026-08-31). It currently makes SKILL.md the external mirror of the seeded skills: procedure in CLI verbs, derived from the seeded nodes and "must not trail them on substance". Under this change, SKILL.md is the entry point that teaches fetching, and the skill nodes serve both audiences directly.

Trade-off the amendment must address. ADR-064 §5 cites ADR-038 Finding 2: guidance returned as a tool result performed worse than the same text in prompt context (continuation dropped from 100% to 44%). Fetched skill content arrives as command output. The amendment should say how this is mitigated — for example, SKILL.md instructs the agent to treat fetched content as its operating instructions — and the external-agent eval should measure it.

Companion nodespace-docs changes, required in the same change:

  • amend ADR-064 §5;
  • update architecture/prompt-skill-system.md: core skills serve both audiences, the H1 shape is gone, and the stale flatten_subtree_content reference becomes render_subtree_markdown;
  • correct ADR-057's description of the seeds if it is still cited as current.

Acceptance Criteria

  • nodespace skill guidance "<task>" returns the matching skills' instructions for a non-empty query, with the provenance envelope unchanged; a query from a skill's own description returns that skill first
  • Core, user-authored and Playbook skills are all returned; ranking matches the in-app skill search for the same query, with no fixed 0.7 floor
  • Guidance still matches when the graph holds far more non-skill embeddings than the KNN window
  • nodespace skill guidance "" lists every skill with its name and description
  • A guidance query also returns the schemas relevant to it, with name, description, fields and relationships. For example, "add an issue to the current cycle" on the Linear-style setup returns the issue and cycle skills and the issue and cycle schemas
  • Every schema is embedded, whether created by create_schema, a Playbook install or core seeding. On a fresh database, every schema node has a non-stale embedding once the processor has run, and a test fails if a schema create path leaves none
  • Changing a schema's description, fields or relationships re-queues its embedding
  • In-app find_skills returns schema matches; a test covers the schema half with real embeddings
  • Guidance served to an external agent names no in-app-only tool; a test fails if a seeded skill's external rendering contains one
  • The in-app agent's skill rendering is unchanged apart from the content fixes below
  • nodespace search "<query>" --type skill returns matching skills; an unfiltered nodespace search still excludes system types
  • No core skill body opens with an H1, and no skill shows a child that repeats its name
  • relationship-reverse-traversal reaches the in-app agent, and a coverage test fails if any registered rule's agent form reaches no seed skill
  • The relationship direction rule reaches both audiences from one fragment
  • SKILL.md teaches when and how to fetch skills and carries no procedure that a skill now owns; nothing in it contradicts references/cli.md
  • SKILL.md states that NodeSpace holds further instructions, both for operating NodeSpace and for the workspace's own domains (installed types and workflows such as Issues or Cycles), and tells the agent to fetch them before working in such a domain. The wording does not say "Playbook"
  • An external agent asked to work in an installed domain (for example "add an issue to the current cycle" on a workspace with the Linear-style setup) fetches that domain's skill before acting
  • Prompt and routing golden snapshots regenerated with UPDATE_GOLDEN=1 and the diff reviewed
  • ADR-064 §5 and prompt-skill-system.md updated as listed under Architecture Impact
  • Regression test runs a non-empty guidance query end to end against embedded skill nodes and fails without the fix
  • Code passes bun run quality:fix
  • Tests pass (bun run test:changed)

Technical Specifications

Reference Files

  • packages/cli/src/commands/skill.rs — build_guidance_request, run_guidance, print_guidance
  • packages/daemon/src/services/node_service.rs — search_nodes: maps threshold == 0.0 to unset, passes scope: None
  • packages/core/src/ops/search_ops.rs — should_skip_scope_filter, search_semantic
  • packages/core/src/services/embedding_service.rs — KNOWLEDGE_CORE_TYPES, matches_scope, semantic_search_nodes_of_type_with_vector
  • packages/core/src/ops/skill_ops.rs — find_skills, SKILL_SEARCH_THRESHOLD, rerank_with_exclusions
  • packages/agent/src/skill_pipeline.rs — SkillSeed::template, the leading-H1 test
  • packages/core/src/schema/mod.rs — create_schema (transactional write with no embedding queue), update_schema
  • packages/core/src/services/node_service/crud.rs — create_node_with_parent_in_tx and its doc comment; queue_created_root_for_embedding
  • packages/core/src/services/node_service/mod.rs — core schema seeding (store.create_node), is_embeddable_type
  • packages/core/src/behaviors/mod.rs — SchemaNodeBehavior::get_aggregated_content
  • packages/core/src/methodology/install.rs — Playbook schema creation
  • packages/agent/src/skill_rules.rs — RuleForm, resolve_includes, relationship-reverse-traversal
  • packages/agent/src/seeds/skills/*.md — core skill bodies
  • packages/agent/src/local_agent/routing.rs — render_candidates_for_prompt
  • packages/skill/SKILL.md, packages/skill/references/cli.md, packages/cli/examples/gen_skill_md.rs — the external skill and its generator
  • packages/cli/tests/it/cli_integration.rs — existing skill guidance tests

Implementation Details

  • Rendering for the external audience has to work from what is stored or from the seed template. A user-modified seeded skill (ADR-072 guidance_modified) is served as stored.
  • A new RPC means regenerating proto stubs. Resolve types through the registry (CoreNodeType), not a "skill" literal.
  • should_skip_scope_filter's doc comment and unit tests argue for the old rule and change with it.
  • Seed content changes require a database reset, not a backfill.
  • The nodespace CLI output changes, so SKILL.md and references/cli.md change in the same PR.

Related Issues

Non-Goals

  • Changing always-on agent-guidance content or making it fetchable
  • Changing in-app routing scores or bars
  • Changing the default Knowledge scope for an unfiltered search

Activity

  1. added
    bug
    on Oct 2, 2026
  2. changed the title [-]Make nodespace skill guidance return the skills that match a query[/-] [+]Let external agents fetch every NodeSpace skill as instructions, and make skill guidance return them[/+] on Oct 3, 2026
  3. changed the title [-]Let external agents fetch every NodeSpace skill as instructions, and make skill guidance return them[/-] [+]Let agents fetch NodeSpace's skills and schemas by intent: make skill guidance return them, and embed schemas[/+] on Oct 3, 2026
  4. malibio commented on Oct 4, 2026

    @malibio
    CollaboratorAuthor

    Baseline before starting — Frontend: 312 test files passed (5635 tests)

  5. self-assigned this
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions