Repository navigation
Add --collection to node create/update, and teach it as the one-call form - #2450
Merged
Merged
Conversation
…form (closes #2392) The op layer already assigned a node to a collection by path during create and update, and CollectionService::add_to_collection_by_path resolved that path, created every missing segment and wired the member_of chain in one call. `nodespace node create` never surfaced it, so filing a node cost a lookup, a create and a link — a per-node write cost that argues for a `tags` array over the built-in grouping mechanism. That comparison was an artefact of the missing flag. CLI: - `node create --collection <path>` and `node update --collection <path>`, repeatable, `:`-delimited exactly as `import` and `search` already take. - `--collection-id` (also repeatable) as the ID-based form, mutually exclusive with `--collection` via clap `conflicts_with`, mirroring how `search` pairs `--collection` / `--collection-id`. The ops layer rejects the pair as well, so a non-CLI caller cannot slip past the parser. - `node update --remove-collection-id`, and `--collection` alone is now enough to make an update meaningful (no `--content`/`--property` needed). - A collection that fails to resolve or link fails the command; the node is never left silently uncollected. Plumbing: the singular collection fields become repeated across proto, ops inputs/outputs, the daemon handlers and the local agent's create_node tool, which gains a `collection` parameter accepting a string or an array — an in-app agent told to pass a collection at create time needs a parameter to pass it in. Guidance (both sources of truth, per the CLI guidance rule): - skill_rules.rs: ORG_NEEDS_EXISTING_COLLECTION told agents to have the user pre-create a collection that resolve_path creates automatically. Replaced by COLLECTION_AT_CREATE_TIME, which leads with the one-call form; added GROUPING_IS_COLLECTIONS carrying the updated cost comparison — a collection is one argument on the create call, the same cost as one array element, so the only remaining differences are durability ones. - Both are wired into skill_pipeline.rs (organization_guidance and schema_creation_guidance) and rendered into the shipped skill, with tests pinning that they actually reach the seeded markdown rather than sitting in the rules array unused. - SKILL.md's collection section now shows `node create --collection` as the primary example instead of a post-hoc `relationship create --type member_of`. The Shared Workspaces section was compressed to stay inside the file's 500-line / 5000-token budget without dropping any of its claims. Tests: four CLI integration tests (repeatable paths with auto-created nested segments, update add/remove, error-on-unresolvable, parser-level mutual exclusivity), three local-agent tool tests (one-call filing, array form, and that `collection` is not swept into field_values by the flat-extras scan), and two skill-pipeline wiring tests. Prompt-assembly goldens regenerated — the diff is exactly the new guidance and the new tool parameter. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
`add_to_collections` takes paths; the removal field took ids under an identical suffix. A caller writing `remove_from_collections: ["docs:rust"]` by symmetry matched no edge and got `Ok(())` back — the membership survived while the call reported success. Renamed to `remove_from_collection_ids`, with the reason recorded on the proto field so the asymmetry is not "corrected" back into a silent no-op, and a test pinning it. Also from review: the create path's comment claimed a failure leaves no silently uncollected node, without saying the node itself stays persisted along with any collections already joined — it now describes what actually happens. The `node.ts` @example blocks still named the pre-repeated singular fields, and now show both forms with the paths-vs-ids distinction. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2392.
The gap
CollectionService::add_to_collection_by_pathalready resolved a:-delimited path, created every missing segment, wired themember_ofchain and linked the node — in one call.ops/node_ops.rsalready called it during both create and update.nodespace node createjust never surfaced it, so filing a node cost a lookup, a create and a link. That per-node write cost is what pushed an external agent toward atagsarray instead of collections, and it was an artefact of one missing flag rather than of the model.CLI
node create --collection <path>andnode update --collection <path>— repeatable,:-delimited, the same syntaximportandsearchalready take.--collection-id(also repeatable) as the ID-based form, mutually exclusive with--collectionvia clapconflicts_with, mirroring howsearchpairs the two. The ops layer rejects the pair independently, so a non-CLI caller (daemon, Tauri, local agent) can't slip past the parser.node update --remove-collection-id. Removal stays ID-only becauseremove_from_collectionis ID-only — a path-based removal would need different semantics (resolving a leaf, and creating it as a side effect of a removal).--collectionalone now makes an update meaningful; no--content/--propertyrequired.Plumbing
The singular collection fields become repeated across the proto, ops inputs/outputs, the daemon handlers and the Tauri commands. The local agent's
create_nodetool gains acollectionparameter accepting either a string or an array — an in-app agent told to pass a collection at create time needs a parameter to pass it in, and a model asked for "one or more" reliably sends both shapes.Guidance — both sources of truth
Per the CLI guidance rule, this ships in
skill_rules.rsandpackages/skill/, not the generated reference.ORG_NEEDS_EXISTING_COLLECTIONtold agents to have the user pre-create a collection thatresolve_pathcreates automatically — the most expensive path and an unnecessary stop. Deleted outright (no#[deprecated]), replaced byCOLLECTION_AT_CREATE_TIME, which leads with the one-call form.GROUPING_IS_COLLECTIONSschema rule carries the updated cost comparison: a collection is one argument on the create call, the same cost as one array element, so there is no cheap-versus-thorough tradeoff left to weigh — only durability differences (UI visibility, rename-once, nesting, no schema change to join).skill_pipeline.rs(organization_guidanceandschema_creation_guidance), with tests pinning that they actually reach the seeded markdown rather than sitting unused in a rules array. The regenerated prompt-assembly goldens are the independent confirmation: their diff is exactly the new guidance text and the new tool parameter.SKILL.md's collection section now showsnode create --collectionas the primary example, replacing the post-hocrelationship create --type member_ofrecipe.One judgment call worth reviewing
Adding guidance pushed
SKILL.mdover its 5000-token cap. I first moved the Shared Workspaces section intoreferences/, then reverted that: shipping a new reference file means registering it in fourAGENTSshims lists and changing publish tests that pin "exactly SKILL.md and references/cli.md today". A half-registered reference would ship aSKILL.mdpointing at a file external agents don't have — worse than the status quo. Instead I compressed Shared Workspaces in place, keeping every claim. It now sits at 4992/5000 tokens and 305/500 lines — tight, so the next guidance addition will need to earn its space the same way.Tests
collectionis not swept intofield_valuesby the flat-extras scan (which would silently store the path as a property instead of creating a membership).test:allgreen, matching the pre-change baseline exactly (frontend 233 files / 4900 tests).cargo clippy --all-targetsclean with zero warnings across all four changed crates. The full pre-push gate passed.Deliberately out of scope
Issue #2383 owns the broader guidance rewrite (person-shaped fields, false-friend naming, document decomposition). This PR takes only its "once
node create --collectionexists, make the one-call form the primary documented example" item, which is an acceptance criterion here.🤖 Generated with Claude Code
https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY