Repository navigation
Point external agents' name lookups at a command that can see entities (closes #2850) - #2860
Conversation
closes #2850) Measured before writing anything: Claude Code (Sonnet, 2 reps) with the shipped skill never stalls asking for an id, so the local agent's failure does not reproduce externally. What it does instead is start every name lookup with `nodespace search`, which misses. The skill sent it there ("find nodes by keywords or meaning"), but search is embedding-only, and embeddings cover only prose types (ADR-029). So a task, or any user-defined entity type, is unreachable by search at any query. Sonnet recovered each time by trial and error, taking 3 to 7 calls. That also rules out the issue's proposed fallback, `search --type <type> "<name>"`. It returns empty whether the entity exists or not, so paired with "no match means create" it would duplicate every existing record. The guidance now points at `node query --title-contains`, the existing lexical title lookup. No `resolve` verb is added: that command already returns empty on absence and carries node_type, which is all the judgment needs. The rule states the recovery the local tier established, judged on sameness (same name, same type) rather than on an empty list, because the stem fallback also returns records that merely share a word. The rule is a shared `skill_rules` InteractionRule. The seeded Node Creation guidance interpolates its imperative form (byte-identical output), and SKILL.md carries the prose form, pinned by the existing presence test. The two surfaces can no longer drift on substance. Re-measured with the new skill: Sonnet 10/10, with the first lookup always `--title-contains`, zero search misses, and 2 to 4 calls. Haiku (1 rep) moved from 1/5 to 3/5. It still skipped the clarifying question on an ambiguous name and chose the wrong type on a create. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The ordering rule pushed SKILL.md's body to ~5300 tokens, over the Agent
Skills <5000 recommendation that skill_md_generation enforces. The four
`nodespace query --filters` worked examples moved to references/cli.md's
Structured property query section. They are argument shape, which ADR-064
rule 5 keeps out of the body, and that section was pointing back at them
("see the Tool Decision Guide above") from the file they now live in. The
rule's own prose is tightened with no change in substance, and its
skill_rules copy is kept verbatim-identical.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Review Type: Initial Review Code Review SummaryThis change is small and a net improvement. The shared
My findings are about guidance consistency on the external surface, not code correctness. Requirements Check
Code Review Findings 🟡 [Improvement] The on-demand reference still sends name lookups to 🟡 [Improvement] "Typed records never appear in it" contradicts the row directly below it 🟡 [Improvement] The rationale in the doc comment names the wrong mechanism
What actually hides them on the CLI path is the default 🟢 Nit: The parenthetical is incomplete 🟢 Nit: The Delete example resolves by content, not title 🟢 Nit: The "exact substring" row is not strictly exact 🟢 Positive: Building the seed with Recommendation: APPROVE None of these block the merge. The two 🟡 guidance items (cli.md's search-first lookup text, and the "never appear" absolute) are cheap text edits and worth doing in this PR, because they cause the exact wasted-call and false-negative pattern this change exists to remove. The comment fix is a one-line correctness improvement. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
- references/cli.md: the "Find then update", "Find then delete" and relationship-create notes listed `nodespace search` first for locating a record. That reintroduced the search-miss-then-fallback pattern at the moment an agent reads the reference, which is while resolving a named record. Those notes now name `node query --title-contains` for lookup by name, and keep `search` for notes and documents. - SKILL.md: "typed records never appear in it" contradicted the `search "" --type` listing row right above it. It now reads "a name search only matches prose", and the Delete example resolves with `--title-contains`. - skill_rules.rs: corrected the stated reason that search misses entities. User-defined types ARE embedded. What hides them is the default `knowledge` scope (text/header/code-block/schema/table) with no title matching on the CLI path. Only tasks are genuinely unembedded. Skipped: rewording the pre-existing "exact substring" note on `node query`. It predates this PR, and the body sits at ~4986 of its 5000 token cap. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review addressed (b84a9bb)✅ Addressed (5)
⏭️ Skipped (1)
Verification:
Re-review: not needed. These are text-only corrections to guidance and one doc comment, with no logic change, and the seed text and prompt golden are untouched. |
Summary
Propagates entity resolution to the external agent surface (#2850), now that #2841 has landed. The first step was measurement, as the issue required, and it changed the shape of the fix.
Finding: Claude Code (Sonnet) does not stall asking for an id, so the local agent's failure does not reproduce externally. But every name lookup started with a
nodespace searchmiss.searchis embedding-only, and embeddings cover only prose types (ADR-029), so tasks and any user-defined entity type are unreachable bysearchat any query. The skill was sending agents there. This also rules out the issue's proposed fallback,search --type <type> "<name>": it returns empty whether the entity exists or not, so combined with "no match means create" it would duplicate every existing record.Decision (confirmed in conversation): no
resolveverb. The guidance points at the existingnodespace node query --title-contains "<name>". It is deterministic, returns empty on absence, and carriesnode_type.Changes
skill_rules::NAMED_RECORD_RESOLUTION: a new sharedInteractionRule.SKILL.mdcarries the prose form, pinned by the existingskill_md_still_mentions_every_interaction_ruletest. I mutation-checked it: removing the phrase makes the test fail.SKILL.md:query --filtersworked examples moved toreferences/cli.md's Structured property query section. That section had been pointing back at them in the body. The body is now ~4987.Measurement
Harness: an isolated
nodespacedper scenario on a seeded workspace (Northwind Trading, Northwind Logistics, Contoso Ltd, plus noise-word decoys), driven byclaude -pwithSKILL.mdappended. Full tables are on the issue.searchmissHaiku still skipped the clarifying question on the ambiguous "Northwind" and picked
textovercompanyon a create. That's one rep, so the wording wasn't tuned against it.Not in scope, observed
In a fresh database,
searchsurfaces seeded skill/guidance fragments (e.g. a node whose content is justTOOL STRATEGY:). Sonnet flagged them as prompt injection in 4 of 10 baseline runs.Test plan
cargo test -p nodespace-agent: 672 passed, prompt golden unchangedskill_md_generationpasses, including the size cap;bun run skill:checkis clean🤖 Generated with Claude Code