Skip to content

Rewrite title_template guidance to state the assemble-vs-single-field premise - #2821

Merged
mstomar125 merged 2 commits into
mainfrom
issue-2790-title-template-guidance
Sep 22, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-2790-title-template-guidance

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

TITLE_TEMPLATE_PLACEHOLDERS in packages/agent/src/skill_rules.rs never stated the actual premise behind title_template: that content is almost always a node's name/identity for entity types (only markdown primitives like text/header use content as a prose body). Without that premise, "identity comes from its fields rather than free-form content" reads as a contrast between structured data and a prose blob — so any entity with fields at all looks like it needs a template, instead of the real contrast: one field vs. several.

This caused two real failures in one session (per the tracking issue): a single-field identity (Customer) got a pointless title_template plus a redundant duplicate field, and a genuinely composed identity (Person) got hand-assembled into content instead of templated.

Changes

  • Rewrote both the imperative and prose forms of TITLE_TEMPLATE_PLACEHOLDERS in packages/agent/src/skill_rules.rs to state the premise (content is the node's name for entity types) and the correct rule (title_template assembles a title from two or more fields; a single-field identity's value goes directly in content, never duplicated into a separate field), including the single-field-identity / composed-identity / markdown-primitive distinction from the issue's own table.
  • Regenerated packages/skill/references/cli.md via bun run skill:gen.
  • Updated packages/agent/tests/golden/prompt_assembly/stage2_candidate_block.golden, which pinned the old wording, via UPDATE_GOLDEN=1 cargo test -p nodespace-agent --test prompt_assembly_snapshot.
  • Added schema_creation_guidance_covers_title_template_discrimination in packages/agent/src/skill_pipeline.rs, mirroring the existing per-rule coverage tests (schema_creation_guidance_covers_unique_field_flags, ..._covers_add_field_values), to pin that the seeded Schema Creation guidance actually carries the premise and the single-field no-duplicate-field rule going forward.

Scope note

The issue also raised a related but separate concern — NO_NAME_TITLE_FIELD's :371 naming-collision framing vs. a semantic duplicate-value rule, and the one-schema-per-request paragraph split. The latter is tracked separately as #2812; the NO_NAME_TITLE_FIELD follow-up was left untouched as out of scope for this fix, which targets only the title_template premise/rule itself.

Closes #2790

Test plan

  • cargo test -p nodespace-agent --lib skill_pipeline:: — 33 passed, including the new regression test
  • cargo test -p nodespace-agent --lib skill_rules:: — 6 passed
  • cargo test -p nodespace-agent --test prompt_assembly_snapshot — 5 passed (golden updated)
  • cargo test -p nodespace-cli --test skill_md_generation — 11 passed, including checked_in_skill_md_is_up_to_date
  • bun run test — 5240 tests, 0 failures attributable to this change (one pre-existing flaky timing test in an unrelated multi-tab-reactivity integration test, confirmed to pass in isolation and untouched by this diff)
  • bun run quality:fix — clean
  • Pre-push gate (test:all + cargo build --bin nodespaced + test:e2e) — all green

🤖 Generated with Claude Code

mstomar125 and others added 2 commits September 22, 2026 11:39
… premise

TITLE_TEMPLATE_PLACEHOLDERS' original wording ("identity comes from its
fields rather than free-form content") never established the premise that
content already holds a node's name for entity types, so it read as a
structured-data-vs-prose contrast instead of the real one: one field vs.
several. That caused two real failures in one session: title_template set
on a single-field identity (plus a redundant duplicate field), and a
composed identity hand-assembled into content instead of templated.

Rewrote both imperative and prose forms in skill_rules.rs to state the
premise (content is the name for entity types; only markdown primitives
like text/header use it as prose), the rule (title_template assembles a
title from two or more fields; a single-field identity's value goes
directly in content, never duplicated into a separate field), and the
three-way distinction from the tracking issue's table (single-field
identity, composed identity, markdown primitive). Regenerated
packages/skill/references/cli.md via skill:gen and updated the
stage2_candidate_block golden that pinned the old wording.

Added schema_creation_guidance_covers_title_template_discrimination,
mirroring the existing per-rule coverage tests in skill_pipeline.rs, to
pin that the seeded guidance actually carries the premise and the
single-field no-duplicate-field rule going forward.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…se the primitive list

pragmatic-code-review on PR #2821 verified two precision gaps against the
real title-computation path (NodeService::compute_title,
packages/core/src/services/node_service/crud.rs):

- "NodeSpace surfaces it as the title automatically" was stated
  unconditionally, but a nested (non-task/collection) node with no parent
  gets no computed title at all regardless of content — scoped the claim to
  "a node created without a parent" in both rule forms.
- The "(text, header, quote-block, code-block)" example list read as
  exhaustive under "Only markdown primitives ... use content as a prose
  body", but several other built-ins (ordered-list, checkbox,
  horizontal-line, table) share the same content-is-not-identity behavior.
  Added "etc." to both forms so the list reads as illustrative, matching
  the prose form's existing "Markdown primitive — text, header, etc."
  bullet, which already hedged this way.

Also added a third assertion to schema_creation_guidance_covers_title_
template_discrimination pinning that the guidance names "markdown
primitives" as the content-is-prose exception, closing a coverage gap the
review flagged in the same pass. Regenerated cli.md and the
stage2_candidate_block golden for the wording change.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Review response (pragmatic-code-review, medium effort)

The review traced the actual title-computation path (NodeService::compute_title, packages/core/src/services/node_service/crud.rs) and found 3 findings, all addressed:

  1. 🟡 Unconditional auto-title claim — "NodeSpace surfaces it as the title automatically" didn't hold for a nested node with no parent (a non-task/collection node with no title_template gets no computed title at all when it has a parent). Scoped the claim to "a node created without a parent" in both imperative and prose forms.
  2. 🟡 Non-exhaustive primitive list read as closed — "Only markdown primitives (text, header, quote-block, code-block)" implied a complete set, but ordered-list, checkbox, horizontal-line, and table share the same content-is-not-identity behavior and weren't named. Added "etc." to both forms, matching the prose bullet list's existing hedge ("text, header, etc.").
  3. 🟢 Test coverage gap — the new regression test didn't assert on the markdown-primitive carve-out sentence. Added a third assertion (md.contains("markdown primitives")) to schema_creation_guidance_covers_title_template_discrimination.

All addressed in commit c469619. Regenerated cli.md and the stage2_candidate_block golden for the wording change; full relevant test suites (skill_pipeline::, skill_rules::, skill_md_generation, prompt_assembly_snapshot) and the pre-push gate all pass.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: All three findings were narrow, surgical text/test edits (scoping one claim, adding "etc." to a list, adding one assertion) — no logic changes, no new code paths, no architectural decisions. The changes are low-risk and straightforward to verify by reading the diff directly.

@mstomar125
mstomar125 merged commit 123af71 into main Sep 22, 2026
@mstomar125
mstomar125 deleted the issue-2790-title-template-guidance branch September 22, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

title_template guidance doesn't convey that it is for titles ASSEMBLED from multiple fields; single-field names belong in content

1 participant