Skip to content

Skill guidance: teach relationship recognition and document decomposition - #2466

Merged
mstomar125 merged 1 commit into
mainfrom
issue-2383-skill-relationship-and-document-guidance
Sep 8, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-2383-skill-relationship-and-document-guidance

Conversation

@mstomar125

@mstomar125 mstomar125 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses 2 of the 4 skill-guidance defects from issue #2383 (real external-agent sessions on a clean install). The other 2 (collections, JSON property shape) were already fixed by prior PRs (#2450, #2423) before this one landed.

  • Relationship recognition: a field naming a person/team/entity defaults to text, not a relationship, even when the agent has read the existing terse rule — recognizing the field IS a reference is the hard step. Added worked examples + a false-friends list to references/cli.md's schema section, and fixed SKILL.md's own worked example, which declared exactly this kind of field (assignee: text) uncorrected.
  • Document decomposition: a multi-section document (ADR, spec, plan) gets authored as one node's content instead of a root + one child per section — every node create example in SKILL.md was a one-liner, so the working template never showed the alternative. Added a decomposition worked example to cli.md and reframed SKILL.md's bulk-import section.

Budget constraint: SKILL.md's body was already at ~4992 of its 5000-token budget before this change (from a concurrent PR), leaving near-zero room. Detail for both fixes went into references/cli.md instead (no cap — the standard's own on-demand tier), with SKILL.md keeping only the minimal worked-example fix and a cross-reference.

Scope: markdown / external-agent guidance only. This PR touches packages/skill/SKILL.md and packages/skill/references/cli.md only — the markdown skill consumed by external PTY agents. It deliberately does NOT touch packages/agent/src/skill_rules.rs::RELATIONSHIP_VS_FIELD's imperative form, which is what the in-app local agent reads from its system prompt (seed_skill_nodes()) — that's outside the packages/agent boundary for this change. The in-app local agent does not get the relationship-recognition improvement from this PR. Filed as a fast-follow: #2467.

Test plan

Documentation-only change; no new test files needed beyond the existing skill_md_generation.rs suite, which already validates the properties relevant here (generation consistency, size budget, reference-file linkage).

…tion

Two of the four skill-guidance defects from real external-agent
sessions on a clean install (collections and the JSON property shape
were already fixed by prior PRs):

- Person/team/entity fields default to text, not a relationship, even
  when the agent has read the existing (terse) relationship-vs-field
  rule -- recognizing that a field like "deciders" or "assignee" is a
  reference is the hard step, and the rule presumed it. Added worked
  examples and a false-friends list to references/cli.md's schema
  section, and fixed SKILL.md's own worked example, which declared
  exactly this kind of field (assignee: text) uncorrected.
- A ~40-line document (ADR, spec, plan) gets authored as a single
  node's content instead of decomposing into a root plus one child per
  section -- every `node create` example in SKILL.md was a one-liner,
  so the working template never showed the alternative. Added a
  decomposition worked example to cli.md and reframed SKILL.md's bulk
  import section to state the "headings become a tree" rule plainly,
  applicable to any multi-section content, not only migration.

SKILL.md's body was already at ~4992 of its 5000-token budget before
this change (from a concurrent PR), leaving near-zero room -- detail
for both fixes went into references/cli.md (no cap; the standard's
own on-demand tier) instead, with SKILL.md keeping only the minimal
worked-example fix and a cross-reference. Verified via
`cargo test -p nodespace-cli --test skill_md_generation`, including
the body-size-recommendation test, after several rounds of trimming.
@mstomar125

Copy link
Copy Markdown
Contributor Author

Addressed: this PR is scoped to the markdown skill (cli.md's prose form) consumed by external PTY agents — updated the PR description to state that explicitly. The parallel imperative form in packages/agent/src/skill_rules.rs::RELATIONSHIP_VS_FIELD (what the in-app local agent reads) is deliberately not touched here, since that's outside the packages/agent boundary for this change. Filed #2467 as a fast-follow for that half, mirroring how GROUPING_IS_COLLECTIONS already keeps both forms in sync.

Other findings from the review were nits (no other blockers). Merging.

@mstomar125
mstomar125 merged commit 1492dc3 into main Sep 8, 2026
@mstomar125
mstomar125 deleted the issue-2383-skill-relationship-and-document-guidance branch September 8, 2026 10:08
mstomar125 added a commit that referenced this pull request Sep 8, 2026
…e summary (#2470)

* Accept multiple directories in nodespace import dir, combined into one summary

import dir took exactly one directory, forcing a shell loop to import several
unrelated folders -- one process, one connection, one result set per
directory, with no combined summary. The RPC layer already batches an
arbitrary file list into one call; the CLI's own base_directory handling
(needed for --auto-collection-routing to stay relative to each directory's
own root) is what kept it to one directory at a time.

A single directory keeps behaving exactly as before (same code path,
unmodified, including a scan failure aborting the whole command). Two or more
route through a new aggregating path: each directory is walked and imported
against its own base_directory, results combine into one summary, and a
per-directory scan or import failure is recorded without stopping the rest.

Co-Authored-By: Claude <[email protected]>

* Trim SKILL.md wording to stay under the body token budget after rebase

Co-Authored-By: Claude <[email protected]>

* Restore the exact SKILL.md phrase an agent-side interaction rule requires

Trimming for the token budget had reworded "don't follow up with search
calls to verify" away, which broke
skill_rules::tests::skill_md_still_mentions_every_interaction_rule
(bulk-import-no-followup-search's skill_md_key_phrase). Restored the
sentence introduced by #2466 verbatim instead of layering more prose on
top of an already near-full budget; the multi-directory form is taught by
the worked example already in this section plus the dedicated "Import
markdown files" section in references/cli.md.

Co-Authored-By: Claude <[email protected]>

* Fix linting and formatting

Co-Authored-By: Claude <[email protected]>

* Address review: refuse cross-directory identity collisions, propagate exit failure

- Two directories in one `import dir A B` call that each contain a
  same-named file (e.g. both have a top-level README.md) compute the
  identical deterministic root id server-side (derived from each file's
  path relative to that call's own base_directory). Silently proceeding
  either skips the second file as "already imported" or, with --replace,
  overwrites the first's content with the second's -- confirmed via a
  mutation test that reproduces exactly this collision when the new
  pre-flight check is disabled. Now scans every directory before issuing
  any RPC and refuses the whole call, loudly, if any two files would
  collide, so nothing is written rather than something being silently
  lost or corrupted.
- run_multi_dir returned Ok(()) even when every directory failed,
  breaking the exit-code contract run_one_dir already had (a scan
  failure there propagates via `?` to a non-zero process exit). Now
  returns Err when any directory failed, after printing the combined
  summary/JSON, so a caller checking the exit code notices.
- Removed two GitHub issue numbers embedded in doc comments (CLAUDE.md
  rule).

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
mstomar125 added a commit that referenced this pull request Sep 15, 2026
…les' imperative form (#2467) (#2628)

RELATIONSHIP_VS_FIELD's imperative field (read by the in-app local
agent via seed_skill_nodes()) still carried only the terse original
rule after #2383/#2466 added worked examples and a false-friends list
to cli.md's prose form for external PTY agents. The in-app agent got
none of that benefit and would still default fields like
deciders/assignee to text.

Port the same worked-examples + false-friends content into the
imperative field, mirroring how GROUPING_IS_COLLECTIONS already keeps
both forms in sync. Regenerate the affected prompt-assembly golden
(stage2_candidate_block) to match.

Co-authored-by: Claude Sonnet 5 <[email protected]>
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.

1 participant