Skip to content

one-schema-per-request rule buries the targetType ordering constraint under the don't-invent-types policy, and never states the sequencing fix #2812

Closed

Description

@malibio

Summary

skill_rules.rs:51-52 ("one schema per request") packs two rules of different kinds into one paragraph — a policy about restraint and a mechanical ordering constraint — with the policy leading and supplying all the examples. An agent asked for two explicitly-linked types read the policy, correctly judged it didn't apply, and skimmed past the constraint that did.

Like #2788 and #2790, the prose emits into references/cli.md under BEGIN GENERATED markers, so the fix belongs in skill_rules.rs.

The current text

skill_rules.rs:52 (prose; :51 imperative is equivalent):

One schema per request. Create exactly the type asked for, in a single schema create call, then stop and report it. Don't proactively create related types the user didn't ask for (e.g. asked for "ADR" — don't also create "Ticket" or "Sprint"), and don't follow up with schema update to wire relationships unless explicitly asked. A relationship's targetType must already exist (check nodespace schema list) or be the type this call is creating; if it is neither, omit the relationship rather than creating the other type as a side effect.

Two distinct rules:

  1. Policy — don't invent unrequested types. Leads the paragraph, owns both examples ("Ticket", "Sprint"), and is what "then stop and report it" attaches to.
  2. Ordering constraint — targetType must pre-exist or be self-referential. Arrives last, in a subordinate clause, framed as a side-effect prohibition.

How it failed

A user asked for "Customer + Invoice, linked" — both types explicitly requested, so the policy plainly did not apply. The agent planned a single call creating Customer with an invoices relationship pointing at a not-yet-existent invoice type. That is illegal regardless of what the user asked for, but nothing in the paragraph says so in a way that survives the policy reading: the agent reported reading the rule as being about unrequested types, which "didn't feel like our case."

It caught the error only by re-reading cli.md for unrelated syntax.

Why the framing misleads

  • The two rules fail differently. The policy is about restraint — the answer is "don't." The constraint is about ordering — the answer is "sequence the calls." The paragraph only ever supplies the first answer.
  • The correct action for a legitimately-requested pair is never stated. Two sequential calls: Customer first, then Invoice declaring billed_to → customer, whose required reverseName: "invoices" gives the Customer end its accessor for free. One stored edge, readable from both ends, no schema update needed. The rules already contain every piece of this (:176 covers reverseName; :52 covers self-reference) but never assemble it for the two-type case.
  • "Omit the relationship" is the only escape offered, and it's the wrong one here — it silently produces two unlinked types when the user asked for linked ones. :175 repeats this ("If the target type doesn't exist yet, omit the relationship entirely"), so both places point away from sequencing.
  • "Then stop and report it" implies a hard stop after one call, which sits awkwardly against a user who asked for two types in one breath.

Suggested fix

Split the paragraph so the ordering constraint stands on its own with its own worked example, rather than reading as a supporting detail of the policy. The constraint needs to state the sequencing remedy explicitly:

Creating two linked types. When the user asks for a pair (e.g. "Customer and Invoice, linked"), that is two schema create calls, not one. Create the target type first, then the type that references it, declaring the relationship on the referencing side: Customer, then Invoice with billed_to → customer and reverseName: "invoices". One stored edge, readable from both ends — no schema update follow-up. Declaring invoices → invoice on Customer first is rejected: the target does not exist yet.

Keep the policy rule intact and separate — it is correct and load-bearing.

Found via

External agent session using the nodespace skill (same session as #2788, #2790, #2791). The agent was explicit that it had read the rule and planned around it anyway, and identified the packaging as the reason — this is a framing problem, not a missing rule.

Activity

  1. added
    documentation
    on Sep 22, 2026
  2. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 260 test files passed, 5240 tests passed (63.18s)

  3. self-assigned this
    on Sep 22, 2026
  4. malibio commented on Sep 22, 2026

    @malibio
    CollaboratorAuthor

    Correction on the file path in the description: the rules live in packages/agent/src/skill_rules.rs, not packages/skill/src/skill_rules.rs. The line numbers cited (:51/:52, :175/:176) are correct for that file.

    This matters beyond a typo — packages/agent is where the prompt golden snapshot lives, so editing these strings changes the in-app agent's system prompt and requires regenerating stage2_candidate_block.golden. The packages/skill/ path would have implied a markdown-only change.

    Also worth recording for the next reader: the rules reach two renderers, and the registry alone wires neither.

    • schema_creation_guidance() in packages/agent/src/skill_pipeline.rs — the in-app agent prompt (imperative)
    • render_schema_rules_block() in packages/cli/examples/gen_skill_md.rs — the generated references/cli.md (prose)

    Both use explicit named-substitution templates, so a new rule added to SCHEMA_RULES renders nowhere until it is interpolated into each. A schema_rules_are_wired_or_explicitly_excluded test catches the prompt half; nothing catches the markdown half, which is how a first pass here produced two cross-references pointing at a section that didn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions