Skip to content

Split schema property naming into name / friendly_name / description #2101

Closed

Description

@malibio

Problem

SchemaField has two name-ish fields doing three jobs:

  • name — unique key within the schema; storage/query key, CEL selector, titleTemplate token
  • description — currently doing double duty as both the human display label and the semantic explanation

Because description is rendered as the UI label (query table headers, kanban group-by, query editor, property forms), there is pressure to keep it short and label-like. The core task schema was authored that way — Some("Status"), Some("Priority"), Some("Due date") (packages/core/src/models/core_schemas.rs:80,111,129) — which reads fine in a header but tells an LLM nothing.

Where a field was authored with a genuine description, the prose leaks into the UI. Person (core_schemas.rs:1150,1168) renders column headers reading:

  • Display name; optional — a person may exist before a name is set
  • Email address; optional at schema level, required in practice for invited teammates

Task only looks correct by accident. The two goals are in direct conflict: a good label is a bad LLM description, and vice versa.

Proposal

Three fields per property, one consumer each:

Field Purpose Consumer
name unique key within the schema storage, queries, CEL, titleTemplate
friendly_name display label all UI surfaces
description what it's for, usage, examples LLM schema comprehension

This unblocks both sides at once: headers get short labels, and description becomes free to carry real semantic content — e.g. task status could become "Current workflow state; drives board columns and completion rollups" at zero UI cost. Given that schema retrieval embeds schema text, richer descriptions should improve retrieval rather than trading against display.

Design decisions

friendly_name is non-optional in storage; always populated. No read-time fallback, no UI branching — every reader does field.friendly_name unconditionally.

Defaulting happens once, at the write boundary. create_schema/update_schema derive friendly_name from name when the caller omits it (due_date → Due date, custom:capacity → Capacity). This keeps the agent-facing tool forgiving — the LLM is not forced to supply a third field per property or lose a turn to a rejected call — while guaranteeing the storage invariant.

Namespace prefixes are stripped for display (custom:capacity → Capacity) — verify against ADR-063 that this does not create ambiguity between a core and a prefixed field of the same base name in the same table.

Implementation notes

No backward compatibility. Pre-release, no users, no migration — reset the database. Per CLAUDE.md, do not add compat paths.

Two traps:

  1. 69 bare struct literals, no Default impl, no builder — SchemaField is constructed as an explicit literal in 69 places (48 in core_schemas.rs; also markdown.rs, schema_node.rs, schema/mod.rs, context_ops.rs, entity_types_block.rs, schema.rs). Adding a field touches all 69. Add #[derive(Default)] or a builder in the same pass so the next field addition is not another 69-site change.

  2. The seeder will not update existing databases. seed_core_schemas_if_needed (packages/core/src/services/node_service/mod.rs:1344) creates only schemas missing from the DB — its own doc says "Existing core schemas are left untouched". friendly_name values added to core_schemas.rs will reach no existing install, making the change look broken on any non-reset database. Either require a DB reset for all devs, or extend the seeder to reconcile fields on existing core schemas. Decide explicitly; this is the same class of gap as previously seen with seeded guidance.

Also update: packages/nodespace-types/src/schema.rs:29-81 (note deny_unknown_fields at :30), TS mirror packages/desktop-app/src/lib/types/schema-node.ts:64-115, and the schema-editing UI so friendly_name is authorable.

Call sites to switch to friendly_name

Query surfaces (three near-duplicate copies of the same description-first regex):

  • packages/desktop-app/src/lib/components/query/table-view.svelte:42-49
  • packages/desktop-app/src/lib/components/query/kanban-view.svelte:177-183
  • packages/desktop-app/src/lib/components/query/query-editor-model.ts:42-49 (labelForField)

Form surfaces:

  • schema-property-form.svelte:385, task-schema-form.svelte:646, generic-schema-form.svelte:163, plus nested-field editors

Consolidate into a single exported label helper; delete the duplicated regex. Stale doc comment at table-view.svelte:6 claims "field.label" — correct it.

Acceptance criteria

  • SchemaField carries name, friendly_name, description with distinct documented purposes
  • friendly_name always populated in storage; derived from name at the write boundary when omitted
  • No read-time fallback or null-branching on friendly_name in any UI surface
  • Person query headers read Name / Email; task headers unchanged
  • Core schema descriptions rewritten as genuine LLM-facing descriptions, no longer constrained to be label-like
  • All UI label sites read friendly_name via one shared helper; duplicated regex removed
  • SchemaField gains Default/builder so future field additions are not 69-site changes
  • Seeder question resolved explicitly (DB reset vs. field reconciliation) and documented
  • deny_unknown_fields still satisfied; Rust and TS types in sync
  • Schema-editing UI allows authoring friendly_name

Activity

  1. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Scope addition — agent-facing tool schemas and skill guidance

    friendly_name is not only a storage/UI change. create_schema and update_schema are LLM-facing tools, and their parameter schemas are what the model reads when authoring a schema. Splitting the fields without updating them leaves the model unable to set friendly_name at all, and still being told the old meaning of description. This is in scope for this issue — shipping the struct change without it would leave the agent path broken.

    1. create_schema tool schema — packages/agent/src/local_agent/tools.rs:758

    Per-field properties are defined at :786-793. Today:

    "description": { "type": "string", "description": "Field description" }
    

    That is circular and tells the model nothing about what to write — under-specified even before this change. Under the split it becomes actively misleading, since description stops being the UI label.

    Required changes:

    • Add friendly_name to the per-field property list, described as the human-readable display label shown in table headers and forms (e.g. "Due date"). State that omitting it is fine — it is derived from name at the write boundary.
    • Rewrite the description guidance to say what it is now for: an explanation of the field's meaning, purpose, and usage — with an example where helpful — consumed by the model when reasoning about the schema. It should encourage more detail, not less. The current one-liner implicitly encourages a terse label.

    2. update_schema tool schema — tools.rs:833

    • add_fields items (:857-865) carry an even barer "description": { "type": "string" } with no description at all. Add friendly_name here and give description the same rewritten guidance.
    • The top-level description parameter (:844-847, "New description (optional)") refers to the schema's description, not a field's — verify it stays unambiguous once field-level description is redefined.
    • Consider whether update_schema needs a way to change a field's friendly_name without touching name.

    3. rename_fields — display vs. identity rename

    rename_fields (tools.rs:877) "rekeys property data on ALL existing nodes of this schema type". Under the split there are now two distinct rename operations:

    • renaming name — an identity change; still requires data migration and remains breaking for titleTemplate tokens, CEL selectors, and query filters
    • renaming friendly_name — display-only; must not trigger any data migration

    The tool must not let the model conflate these. Note rename_fields items use additionalProperties: false (:886), so any new parameter must be added explicitly or calls will be rejected.

    4. Skill guidance content

    The schema-authoring skill (packages/agent/src/skill_pipeline.rs:370) is the retrieval-facing description covering "define fields", "create schema", "update schema", "add a field", "rename a field". Any skill body instructing the agent how to define fields needs to teach the three-field model. Specifically, any guidance that implies description should be short or label-like now says the opposite of what is wanted.

    Seeding caveat — same trap as the core-schema seeder noted in this issue. Skills are DB-seeded nodes and seeding skips by node type, so revised skill text will not reach an existing install without a database reset. Whatever is decided for core-schema reconciliation should cover skills too, or the revision silently fails to take effect and the agent keeps following the old guidance.

    5. Verify, do not assume, the plumbing

    handle_create_schema is imported at tools.rs:15. Trace the full path from tool parameters → SchemaField construction and confirm friendly_name is threaded end to end, including the write-boundary derivation when the model omits it. A parameter accepted by the tool schema but dropped before storage would be worse than not adding it.

    Added acceptance criteria

    • create_schema tool schema exposes friendly_name per field, documented as the display label and as optional
    • update_schema.add_fields exposes friendly_name with the same semantics
    • Field-level description guidance rewritten in both tools to describe LLM-facing semantic content, encouraging meaningful detail rather than a terse label
    • rename_fields distinguishes identity rename (migrates data) from display rename (does not); additionalProperties: false respected
    • Schema-authoring skill content teaches the three-field model
    • friendly_name threaded end to end from tool parameters through to storage, with write-boundary derivation verified when omitted
    • Skill/guidance reseeding addressed alongside core-schema reseeding, so revised text actually reaches installs
  2. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Two corrections to earlier comments, and one blocking prerequisite

    1. BLOCKING — field description is not visible to the LLM today

    The rationale for this issue assumes description becomes LLM-facing semantic content. It currently never reaches the model.

    EntityFieldDescriptor (packages/core/src/ops/entity_types_block.rs:46-56) carries only name, field_type, enum_values, required. from_schema_field (:108-124) drops description entirely, and render_shape (:91) emits just name: type {enums}.

    So splitting the fields and writing rich descriptions achieves nothing for the LLM unless EntityFieldDescriptor, its to_json, and render_shape are widened to carry description into the ENTITY TYPES block.

    This is the load-bearing change of the whole issue — without it, the split is a pure UI fix and the stated LLM benefit does not materialise. Treat it as a prerequisite, not a follow-up.

    Worth measuring rather than assuming: adding per-field descriptions grows every ENTITY TYPES block, and prior work here found a large resident prompt measurably hurt accuracy versus a minimal one. Verify the added context earns its tokens instead of diluting the prompt.

    2. Correction — skills DO auto-propagate; core schemas do not

    An earlier comment claimed revised skill text would not reach existing installs without a DB reset. That is wrong for skills.

    Skills seed through seed_nodes_from_templates (packages/core/src/services/node_service/mod.rs:1464), which uses content-hash reconciliation — compute_seed_version (packages/core/src/markdown/mod.rs:1451) SHA-256s node_type + content + properties, and a changed hash causes the seeded node to be deleted and recreated. Editing the Rust literals therefore propagates automatically.

    The one exception: nodes whose _seed.user_modified == true are skipped (mod.rs:1539-1550).

    The reseeding concern stands only for core schemas, where seed_core_schemas_if_needed (mod.rs:1344) creates only missing schemas and leaves existing ones untouched. That remains a real trap for friendly_name values added to core_schemas.rs.

    3. There is no "keep it short" instruction to invert

    A search for "keep it short" / "short label" / "display label" across packages/agent/src, packages/core/src, and SKILL.md returns no hits. The problem is silence, not wrong instruction — tools.rs:790 says only "Field description", and tools.rs:860 has no description at all. The fix is to add substantive guidance, not to reverse existing guidance.

    Good exemplars of the target style already exist in core_schemas.rs — person name: "Display name; optional — a person may exist before a name is set".

    4. Additional scope discovered

    Few-shot examples dominate model behaviour — these matter more than prose:

    • packages/agent/src/skill_pipeline.rs:67-127 — three worked EXAMPLE blocks (Customer, Invoice, Project). None shows friendly_name or a per-field description.
    • packages/agent/src/skill_rules.rs:123-127 (UNIQUE_FIELD_FLAGS) and :111-115 (TARGET_TYPE_MUST_EXIST) embed inline JSON field examples, rendered into both the seeded skill and SKILL.md.

    Naming collision risk: skill_pipeline.rs:52 currently says "A 'description' field is acceptable when it adds value beyond the title" — that is about a field named description, which becomes badly confusable with the per-field description attribute. Disambiguate regardless of this issue.

    update_schema cannot edit an existing field's description or friendly_name. It offers only add_fields / remove_fields / rename_fields (tools.rs:852-889). Renaming a display label without a data migration is therefore impossible today — a missing capability, not just stale text. Decide whether this issue adds it.

    Wire-format spelling must be settled: SchemaField uses #[serde(rename_all = "camelCase")], so the wire key is friendlyName, while the tool JSON schemas use snake_case elsewhere (title_template). Pick one and apply it consistently across the Rust struct, TS mirror, and tool schema.

    SKILL.md is a hybrid. Only the block between <!-- BEGIN GENERATED: schema-rules --> / <!-- END --> regenerates, via cargo run -p nodespace-agent --bin gen_skill_md -- --write. Everything else is hand-written. gen_skill_md.rs:157 gates the build if the generated block is stale. Also skill_rules.rs:45 skill_md_key_phrase is hand-maintained and asserted by a test — rewording a rule requires updating its key phrase.

    Revised acceptance criteria

    • EntityFieldDescriptor carries description into the ENTITY TYPES block (prerequisite — without this the LLM half is inert)
    • Prompt-size impact of per-field descriptions measured, not assumed
    • Few-shot examples in skill_pipeline.rs:67-127 and the inline JSON in skill_rules.rs updated to show the three-field model
    • description vs. a field named description disambiguated in skill_pipeline.rs:52
    • Decide whether update_schema gains the ability to edit an existing field's friendly_name / description
    • Wire-format spelling (friendlyName vs friendly_name) settled and applied consistently
    • gen_skill_md --write re-run; skill_md_key_phrase values updated if rules reworded
    • Core-schema reseeding resolved (skills self-propagate via content hash and need no action)
  3. mstomar125 commented on Aug 17, 2026

    @mstomar125
    Contributor

    Implemented in #2105.

    Summary of what landed:

    • SchemaField.friendly_name added (non-optional in storage, #[serde(default)]-tolerant on input), derived from name at the create_schema/update_schema write boundary when omitted (derive_friendly_name() — strips namespace prefix, humanizes the rest).
    • SchemaField/SchemaProtectionLevel gained #[derive(Default)], so future field additions can use ..Default::default() instead of touching all 68 construction sites again.
    • All 68 existing SchemaField literals updated (48 in core_schemas.rs, 20 elsewhere).
    • task and project descriptions rewritten as genuine LLM-facing prose; person's were already good examples, just needed friendly_name (Name/Email).
    • All UI label sites (table/kanban headers, query editor, property forms, nested-field editors) now read friendly_name through one shared helper (labelForField()), replacing five independently-duplicated name-humanizing regexes.
    • Seeder question: resolved as requires a database reset, not a seed_core_schemas_if_needed reconciliation pass — full reasoning in the PR description (short version: the storage-format change isn't additive-only-to-core-schemas, it affects every pre-existing schema's field JSON including user-created ones, so a core-schemas-only reconciliation would look complete while leaving custom schemas silently stale — worse than an honest reset).
    • Scope addition from the comment thread (agent-facing create_schema/update_schema tool JSON schemas + skill guidance in packages/agent) is deliberately deferred to Expose friendly_name in create_schema/update_schema tool schemas + skill guidance (agent lane, follow-up to #2101) #2104 — that's a different engineer's lane per this repo's ownership convention, and the underlying plumbing it depends on (the packages/core write boundary) already accepts friendlyName from any caller today.

    Full reasoning, testing, and acceptance-criteria checklist in the PR description.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions