Skip to content

Attach a skill to any node; read a node with what its paths reach; return attached skills with a node and a query run (closes #3555) - #3596

Merged
malibio merged 1 commit into
mainfrom
issue-3555-skill-attached-to
Oct 5, 2026
Merged

malibio merged 1 commit into
mainfrom
issue-3555-skill-attached-to

Conversation

@malibio

@malibio malibio commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #3555. Implements ADR-094 §2 (read with paths) and §3 (a skill can be linked to any node), build-order step 2.

What changed

Node type change (node type sequence followed). skill is a flat core type; its fields are unchanged. One relationship is added:

Type Relationship Reverse Target Cardinality
skill attached_to attached_skills any node (no target type) many / many

No field, structural rule, participation rule, wire type or generated TypeScript changed (bun run gen:types reports no diff). applies_to is untouched.

Read with paths. ops::node_context_ops::read_node_context reads a node with the nodes each RelationshipPath reaches, grouped by path, plus the skills attached to any node it returned.

  • Each name resolves from the node the walk stands on: the first against the node's type, later ones against the types of the nodes the previous hop reached, so a hop after a relationship with no declared target type resolves once those nodes are known.
  • An undeclared name is refused with a message naming the path and listing the names that apply. A declared path that reaches nothing is an empty group.
  • Each hop runs through the existing path compiler (resolve_relationship_path), so it keeps the correlated-subquery form; archived nodes are neither reached nor walked through.
  • A returned node carries its fields and its direct checkbox children, not its subtree.

Attached skills. attached_skills(node_ids) returns each skill once with the returned nodes it is attached to, rendered the way a fetch by name renders it (instructions, applies_to schemas, tool commands). get_skill_guidance now shares that rendering (skill_ops::fetch_skills). Archived skills are left out.

Surfaces.

  • gRPC: new GetNodeContext; RunSavedQuery now returns RunSavedQueryResponse (nodes, count, attached skills, schemas).
  • CLI: nodespace node context <id> [--path a.b ...] (own subcommand, dotted paths, * for open-ended), nodespace relationship delete --from --type --to, and query run prints the query's attached skills. Skills print inside the existing provenance banner / JSON envelope.
  • Built-in agent: get_node_context and delete_relationship are in the tool registry with their CLI commands and seeded tool nodes; run_query returns the query's attached skills. get_node_context is offered by Research & Search; delete_relationship by Relationship Management and Organization.

Worth a look

  • Relationship view. attached_to targets any node, so every node's relationship view now lists an attached_skills group, empty until a skill is attached. That is the existing rule for a declared any-target relationship (pinned by test_a_user_schemas_untyped_relationship_is_listed_when_empty), and it lets a skill be attached from the node's side. One existing test that counted all inbound groups on a node now filters to the relationship it is about.
  • Seeded skill whitelists changed (three skills gain a tool). Prompt and routing goldens show no diff. An existing install keeps its stored whitelists until the database is reset.
  • delete_relationship is classified as an idempotent write that does not remove user data: it removes one link, leaves both records, and one create_relationship puts it back.

Tests

  • core/tests/it/skill_attached_to_test.rs: attach to a project, saved query, task and user-defined node; proof on tasks; proof on a request/desk workflow built with create_schema; path forms; unknown path; dedupe; detach; archived.
  • agent/tests/it/node_context_tools.rs: both tools through GraphToolExecutor::execute, run_query skills, registry/seed/whitelist.
  • cli/tests/it/cli_integration.rs: parse, node context, query run, relationship delete over the real transport.
  • Full Rust workspace: 5335 passed. bun run skill:check passes.

Docs

Docs change (pushed to nodespace-docs main before merge): components/node-types.md (skill sheet), components/seeded-nodes.md (new "Skills attached to nodes"), components/typed-relationships.md, components/query-node.md, architecture/prompt-skill-system.md, architecture/relationship-paths.md. In this repo: packages/skill/references/cli.md and SKILL.md.

🤖 Generated with Claude Code

@malibio

malibio commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Pragmatic Code Review: PR #3596 (issue #3555)

Review Type: INITIAL review, head 0c4140c4f. Read-only: no build or test was run (a test run was in progress on the machine), so every "passes" claim in the PR body is unverified here. The uncommitted docs edits in the docs-3555 scratch checkout were reviewed as part of the PR.

Summary

The change is a net improvement and follows the architecture. The read is type-agnostic, each hop reuses the existing path compiler (correlated-subquery form, participation filter), the skill rendering is shared with the fetch by name through fetch_skills instead of duplicated, and the node type sequence was followed for the one new relationship. No Critical issue was found. Five Important items are worth fixing before merge: two concern the new output paths for untrusted graph content, one is an unbounded read, one is data-dependent path validation, and one is a deleted: true that is reported when nothing was deleted.

Requirements Check

Acceptance criterion Evidence
✅ skill declares attached_to, no target type, reverse attached_skills; links to project / query / task / user type accepted core_schemas.rs (second SchemaRelationship, target_type: None); a_skill_attaches_to_a_node_of_any_type. No field, wire type or generated TS changed, so the remaining sequence layers do not apply.
⚠️ applies_to unchanged; goldens show no diff applies_to declaration and get_edge_targets_by_source use are unchanged (read). No golden file is in the diff. Not verifiable by reading: three seeded whitelists changed, so "no golden diff" rests on the PR's own test run.
✅ Read accepts paths (declared, reverse, has_child), grouped by path; unknown path refused naming it read_node_context / walk; paths_are_followed_by_name_and_returned_by_path, an_unknown_path_is_refused_with_a_message_naming_it. See finding 3 for the case where it is not refused.
⚠️ Skills returned as a fetch returns them, inside the provenance marking Met on gRPC and the CLI (attached_skills_json, write_skill_block). The agent tools return id, name, description, attached_to and instructions only: no schemas, no tool commands, no marking (finding 5).
✅ A skill attached to several returned nodes appears once, with those nodes attached_skills ordering loop; a_skill_attached_to_several_returned_nodes_appears_once.
✅ Detach from the CLI and the agent; next read omits it relationship delete, delete_relationship tool; tests in all three crates.
✅ Saved query run returns the query's skills once RunSavedQueryResponse, exec_run_query; tests in core, agent, CLI.
✅ Archived skills and nodes not returned governance::participates on skills and checkbox children; hops run with include_archived = false; archived_skills_and_archived_nodes_are_not_returned. An archived root is still read by id (finding 7).
✅ No node type named in the read or its output node_context_ops.rs resolves Skill and Checkbox through type_is_a; no literal comparison.
✅ Proof on tasks / proof on a user-defined workflow the_task_flow_... and a_user_defined_workflow_... (types built with handle_create_schema).
✅ Agent tool in the registry with its CLI command Tool::GetNodeContext, cli_command, seeded node, whitelist; both_tools_are_registered_seeded_and_offered.
✅ cli.md and SKILL.md document it Read against the code; accurate apart from finding 6. skill:check not run here.
⚠️ Docs updated Present but uncommitted in the scratch checkout; two inaccuracies (findings 3 and 5).
n/a quality:fix, test:changed Not run in this review.

Findings

🔴 Critical

None.

🟡 Important

1. Untrusted checkbox text is printed raw, ahead of the line that authenticates the provenance banners.
📁 packages/cli/src/output.rs:210 (and the call order at :187, :252)
write_human_context_node prints checkbox.content with no sanitize_for_terminal and without splitting lines, so only the first line is indented. In node context and query run the node output comes first and the "fetch tag [..]" preamble is printed after it by print_attached_skills. The tag scheme relies on the reader seeing the genuine preamble before any fetched text; in skill guidance nothing untrusted precedes it. Here a checkbox (or any node content) can carry a banner-shaped preamble with its own tag earlier in the same stream, plus terminal control characters. Verified by reading: the raw println! and the ordering. Inferred, not traced: that a checkbox's content can hold a newline. write_human_node also prints titles and content unsanitised, but that predates this PR and did not share a stream with a provenance banner.
Principle: defence in depth for untrusted content; a trust marker must not be forgeable by the data it marks.
Suggested fix: print the fetch-tag preamble before the node output on these two commands (or always, even with zero skills), and pass checkbox content through sanitize_for_terminal line by line with the indent.

2. The read is unbounded in nodes, and costs one query per returned node.
📁 packages/core/src/ops/node_context_ops.rs:18, :99-106, :191-203
MAX_CONTEXT_PATHS caps paths at 20, but nothing caps hops per path or nodes per path. --path 'has_child*' on a large document, or tasks on a big project, returns every node, and context_node then calls get_children once per node (full child rows loaded to keep only checkboxes). The daemon adds a node_to_proto_collapsed call per node, and returned_ids.contains is a linear scan per node. For the built-in agent the result (a 500-char snippet per node plus every attached skill's full instructions, untruncated; get_node truncates at 2000) goes straight into a small local context window. Verified: no cap and the per-node call. The per-child type_is_a is not the problem: for a core type id it returns from the registry without a read (type_ancestry.rs:83-88); only a user-defined child type reads its chain.
Principle: bounded work per request; avoid N+1.
Suggested fix: a per-path node cap with a limit_reached marker as run_query has, and one batched children read for all returned ids filtered to checkbox types.

3. Whether an unknown name is refused depends on the data, not the path.
📁 packages/core/src/ops/node_context_ops.rs:236-262
Three outcomes for the same path on the same type:

  • the frontier is empty and no type is declared (after child_of, has_child, attached_to reached nothing): resolve_from(.., None, ..) is called, its result is discarded, and the walk returns an empty group. A misspelt name is accepted silently, and the remaining hops are never checked. The comment says a built-in name "can still be told apart", but nothing reads the answer.
  • the frontier is mixed and some types declare the name: the others are dropped silently.
  • no type in the frontier declares it: an error naming only the last refusing type (undeclared_for is overwritten).
    So --path has_child.project succeeds on one node, errors on a sibling whose children are all text, and returns empty on a third. A caller iterating a queue with one path set gets failures on some items. The AC and seeded-nodes.md ("A name no such type declares is an error") describe only the third case. No test covers a mixed-type frontier or the empty-frontier case after an untyped hop.
    Principle: validation should be a property of the input; least surprise.
    Suggested fix: decide one rule and state it. Simplest consistent option: when at least one node was reached and none of their types declares the name, return an empty group for an untyped hop's successor (the name cannot be checked against a schema there), and keep the hard error for names checked against a declared type. Add the two missing tests either way, and remove the discarded resolve_from call or use its result.

4. deleted: true is reported when no edge existed.
📁 packages/agent/src/local_agent/tools.rs:5205, packages/cli/src/commands/relationship.rs:168
Deleting a missing edge is a deliberate no-op, but both surfaces then state that a deletion happened and echo the arguments. With the endpoints swapped (a likely model mistake for "detach this skill from the project": from = project), delete_relationship_edge_in_tx finds no edge, returns Ok, and the agent tells the user the skill was detached while it is still attached. Verified by reading the no-op path; the swapped-argument outcome is inferred from it.
Principle: a tool result must not assert an effect that did not occur (the same reason create_relationship reports the edge as stored rather than the arguments).
Suggested fix: return whether a row was removed from the service and report deleted: false with a short note when none was.

5. Agent-side attached skills are a different, unmarked shape, and the docs say otherwise.
📁 packages/agent/src/local_agent/tools.rs:867-879; docs components/seeded-nodes.md ("What a read returns")
attached_skill_summary drops attached.schemas and tool_commands and carries no provenance note, while the tool descriptions tell the model to "follow it". That may be the right call for the built-in agent (it calls tools by name and already runs graph-authored skills), but the seeded-nodes.md section lists both the CLI commands and the agent tools and then says each skill comes "as a fetch by name returns it ... under the same provenance marking". Either scope that sentence to the CLI/gRPC surfaces or include the schemas. Note also that an attached skill can name tools outside the turn's whitelist (get_node_context is offered only by Research & Search), so the model may be told to follow a procedure it cannot execute in that turn; worth one sentence in the tool description or the docs.
Principle: docs must match behaviour; one definition of what "a fetched skill" contains.

🟢 Suggestions

6. 📁 packages/cli/src/output.rs:171 — print_saved_query_run emits "collection_id": "", a constant for a field the new RunSavedQueryResponse no longer has, while cli.md documents the output as {count, nodes, attached_skills}. Drop the key (pre-release: no old-shape carry-over) or document it.

7. 📁 packages/core/src/ops/node_context_ops.rs:88-93 — the root is read with get_node, which returns an archived node, so node context <archived-id> returns it with its attached skills. Defensible (a read by id is the caller's choice, as resolve_relationship_path says of roots), but the AC says archived nodes are not returned; say which in the doc comment and add the assertion to the archived test.

8. 📁 packages/core/src/ops/node_context_ops.rs:264-289 — a built-in hop resolves identically for every type, yet the walk issues one statement per distinct type in the frontier. Group by resolved hop rather than by type to make a has_child hop one statement.

9. 📁 packages/core/src/ops/query_ops.rs:926-941 — run_saved_query_excluding now returns a three-element tuple (output, limit, query_id). A small named struct would read better at the call site than positional fields.

10. 📁 packages/core/tests/it/skill_attached_to_test.rs — the documented relationship get <node> --type attached_skills (reverse name on an untyped target) and a path through attached_skills are not exercised; the test reads the forward name inbound instead. One assertion would pin the documented command.

11. Nit: 📁 packages/core/src/ops/node_context_ops.rs:166-177 — order.iter().find per skill and Vec::contains per node are quadratic; a HashMap index is clearer once finding 2 adds a cap.

What was verified and how

  • Read in full: the diff of every source file listed in the PR, path_ops.rs (resolve_hop, undeclared_message), relationship_paths.rs (statement shape, participation filter, PathReach::at), delete_relationship / delete_relationship_edge_in_tx / delete_generic_relationship (the has_child delete is guarded by assert_node_may_be_root), type_is_a / core_type_of, the three test files, cli.md, SKILL.md, and the docs diff.
  • Confirmed by reading: edge direction in get_edge_sources_by_target matches the store's convention (in_node is the source); JSON output keeps the provenance: graph-fetched envelope; human output keeps the per-call tag and sanitises every skill and schema field; the dedupe and ordering logic; SKILL.md is 17,271 bytes.
  • Not verified: anything requiring a run (tests, clippy, skill:check, node-types:check, goldens, gen:types reporting no diff).

Recommendation: COMMENT

No blocker, and the design is sound. Findings 1 to 4 are small, local fixes and should be addressed in this PR before merge; finding 5 is a one-sentence docs correction in the unpushed docs change.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: COMMENT (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

@malibio

malibio commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Address-review summary (commit a4b20ac)

Addressed

  1. Untrusted text ahead of the tag line (🟡 1). node context and query run now print the fetch-tag line first, before any node output, and the skill banners after the nodes. Checkbox text and ids are passed through sanitize_for_terminal, with continuation lines indented.
  2. Unbounded read (🟡 2). A path returns at most MAX_NODES_PER_PATH (50) nodes and carries limit_reached (core, proto, CLI JSON and human output, agent result). With the 20-path cap, the per-node children read is bounded.
  3. Validation depends on data (🟡 3). The rule is now stated in read_node_context's doc comment, cli.md and the docs change: a name is refused when no type it is read from declares it; in a mixed-type frontier the non-declaring nodes lead nowhere; after an empty hop with no declared type there is nothing to check against and the path is empty. The discarded resolve_from call is removed. New test a_name_is_checked_against_the_nodes_the_walk_stands_on covers the mixed frontier, the all-refusing frontier and the empty untyped hop.
  4. deleted: true on a no-op (🟡 4). rel_ops::delete_relationship returns whether an edge was removed (edges joining the two nodes before vs after, which holds for an in-declared name). DeleteRelationshipResponse.deleted, the CLI and the agent tool report it; the agent result adds a note about swapped ends. Tests in core and agent.
  5. Agent shape vs docs (🟡 5). The docs change now says gRPC and the CLI return a skill as a fetch does, and the built-in agent gets it as stored (id, name, description, attached nodes, instructions).
  6. collection_id (🟢 6). Dropped from query run --json.
  7. Archived root (🟢 7). Stated in the doc comment and docs; asserted in the archived test.
  8. Reverse name untested (🟢 10). The attach test now reads attached_skills through rel_ops::get_related_nodes.

Also added: a_path_that_reaches_too_many_nodes_is_cut_and_says_so.

Skipped

  • Batched children read (part of 🟡 2). Children must come back in sibling order, which the batched path walk does not give (it orders by edge insertion). The cap bounds the cost instead; revisit if a context read shows up in a profile.
  • Truncating attached skill instructions for the agent (part of 🟡 2). The instructions are the point of the read; cutting them would hand over half a procedure.
  • 🟢 8 (one statement per frontier type for a built-in hop): a small saving on an already bounded read.
  • 🟢 9 (struct for the three-element tuple): one caller.
  • 🟢 11 (quadratic lookup): bounded by the cap at a few hundred comparisons.

Verification: bun run test:changed passed (Rust workspace, skill, scripts, generated-TypeScript drift, node-types.md check); quality:fix and skill:check clean.

Re-Review Decision

Decision: RE-REVIEW NEEDED

Rationale: the fixes change logic on four surfaces (delete result, output ordering, a new cap, the validation path) and add a proto field.

@malibio

malibio commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Pragmatic Code Review: PR #3596 (issue #3555)

Review Type: RE-REVIEW of commit a4b20acb1 against the initial review at 0c4140c4f. Read-only: no build or test was run, so "tests pass" rests on the address-review summary. The uncommitted docs change (components/seeded-nodes.md in the docs-3555 scratch checkout) was read against the code.

Previous Review Summary

  • Recommendations: 5 Important (1 to 5), 6 Suggestions (6 to 11).
  • Addressed: 2, 3, 4, 5, 6, 7 and 10 in full; 1 in part (see R1 and R2).
  • Not addressed, reason sound: the batched children read, truncating instructions for the agent, 8, 9, 11.
  • New issues: none Critical. Two residuals on finding 1 and one simplification on finding 4, all non-blocking.

Status of the five Important findings

# Finding Status How it was checked
1 Untrusted text ahead of the tag line Mostly resolved Read print_node_context, print_saved_query_run, announce_attached_skills, write_attached_skills, sanitize_for_terminal. With at least one skill attached, the tag line is the first write on both commands, before write_human_context_node and print_node_list. The writeln! on the Stdout handle and the later println! calls share one buffered stdout, so the order holds. Checkbox content and id go through sanitize_for_terminal; \r is stripped as a control character, so lines() splits on \n only and continuation lines are indented. Two gaps remain: R1, R2.
2 Unbounded read Resolved for the per-node cost reached.len() > MAX_NODES_PER_PATH then truncate: exactly 50 gives false, 51 gives true with 50 nodes. No off-by-one. The flag is carried by PathNodes.limit_reached in core, proto field 3, the daemon mapping, CLI JSON (true, key absent otherwise), CLI human output, and the agent result (a sentence, the same shape run_query uses at tools.rs:5095). The walk itself is still uncapped: R4.
3 Validation depends on the data Resolved as documented behaviour The doc comment, cli.md and seeded-nodes.md state the same three cases, and each matches walk: all-refusing frontier errors (resolved.is_empty()), a mixed frontier follows only declaring types, an empty frontier with declared_type == None returns empty. Removing the discarded resolve_from(.., None, ..) call changes no behaviour: its result was dropped, and it only mapped Undeclared / TypeUnknown to None. One undocumented sub-case: R5.
4 deleted: true on a no-op Resolved See below.
5 Agent shape vs docs Resolved seeded-nodes.md now separates "over gRPC and the CLI" from "to the built-in agent" and lists the agent's fields; they match attached_skill_summary as read in the first review.

Finding 4 in detail. rel_ops::delete_relationship counts the edges joining the two nodes, deletes, counts again and returns after < before.

  • Verified: count_edges_between is symmetric in its two ids and ignores the name. delete_relationship_edge_in_tx rewrites a name declared in to its forward name with the ends swapped (forward_endpoints), and the store delete removes rows matching (in_node, out_node, relationship_type). A delete through an in name therefore lowers the symmetric count, so the result is right for that case.
  • Verified: a swapped attached_to delete (from = task) reaches the store delete with no matching row and returns Ok; the new code reports false with the note.
  • Verified: every caller is updated. The daemon passes the bool into DeleteRelationshipResponse; the agent tool reports it; the CLI reads response.deleted. The Tauri command (app-lib/src/commands/nodes.rs:1491) goes through gRPC and discards the response, which still compiles and is correct. relationship_editing_test.rs:347 only reads the error. No other code constructs DeleteRelationshipResponse.
  • Inferred, not traced: that nothing in the delete (rootness refresh on has_child, invariant-rule dispatch) writes another edge between the same pair.
  • The two reads sit outside the delete's transaction. A concurrent write of a different edge between the same two nodes, inside that window, flips the reported bool in either direction. The delete itself stays correct, and only the message is affected. See R3.

Findings

🔴 Critical

None.

🟡 Important (non-blocking)

R1. With no skill attached, no tag line is printed, so the "tag line first" guarantee does not cover that branch.
📁 packages/cli/src/commands/skill.rs:744
announce_attached_skills returns None and prints nothing when skills is empty. node context and query run then print node text only, and a node's content can hold a line shaped like the announcement plus a banner carrying its own tag. A reader that applies the documented rule ("announced once at the top of the output") can still reject it, because the forged line is not the first line, but nothing in the output says that no banner is expected. The first review suggested printing the line always. Verified by reading both callers: there is no other write before the node output.
Principle: a trust marker should not depend on the reader noticing an absence.
Suggested fix: always print one first line, e.g. "0 attached skill(s): no GRAPH-FETCHED banner in this output is real."

R2. Node titles, content and properties are still printed unsanitised between the tag line and the banners.
📁 packages/cli/src/output.rs:292-331 (write_human_node)
The fix sanitises checkboxes, but write_human_context_node and print_node_list print the node body through write_human_node, which writes title, content, markdown and properties raw. A CSI cursor sequence in a node's content can now redraw the tag line printed above it on a real terminal. An agent reading the bytes is not affected; a person at a terminal is. The function predates the PR, but this PR is what puts it in a stream with a provenance tag.
Principle: defence in depth; sanitise at the one function that prints graph text.
Suggested fix: pass those fields through sanitize_for_terminal in write_human_node. It is the human path only, so JSON stays lossless.

🟢 Suggestions

R3. 📁 packages/core/src/ops/rel_ops.rs:115-133 — delete_relationship_edge_in_tx already reads rel_id inside the transaction (relationship.rs:2005), and the built-in branch reads it too (:2168). Returning rel_id.is_some() from NodeService::delete_relationship would give an exact answer in the same transaction, with no extra queries, no race and no count_edges_between. KISS: the fact is already known where the delete happens. Not traced: the other callers of remove_relationship_in_tx, so the plumbing cost is an estimate.

R4. 📁 packages/core/src/ops/node_context_ops.rs:116-118 — the cap is applied after walk returns, so has_child* on a large tree still loads every reached node as a full row before 50 are kept, and intermediate hops are uncapped. The query count is bounded (worst case about 1,000 get_children calls: 20 paths of 50 plus the root), which was the main cost. Worth a limit on the last hop if a context read ever shows up in a profile.

R5. 📁 packages/core/src/ops/node_context_ops.rs:283-290 — declared_type is also None when a mixed frontier resolves the name to two different declared target types. A later name after an empty result is then unchecked, a case the doc comment's "if it declares none (a built-in, or a relationship to any node)" does not name. One clause in the comment covers it.

R6. Nit: 📁 packages/core/src/ops/node_context_ops.rs:325-338 — resolve_from is now always called with Some(..); its Option parameter and the "no type to read from" half of its doc comment are left over.

R7. Nit: tests. No test pins exactly 50 nodes giving limit_reached == false, and the swapped-ends assertion accepts either an error or Ok(false) although the code path gives Ok(false). No CLI test covers the tag-first order or the "no relationship existed" line; the two printers mix println! with a writer, so they cannot be captured as written.

R8. Nit: 📁 packages/cli/src/commands/skill.rs:754 — the announcement counts skills.len() while write_attached_skills skips an entry whose skill is None.

Skipped items

  • Batched children read: sound. Sibling order is a real constraint and the cap bounds the per-node reads.
  • Not truncating instructions for the agent: sound. A cut procedure is worse than a long one, and a fetch by name does not truncate either.
  • 8, 9: sound.
  • 11: sound, though "a few hundred comparisons" understates it: returned_ids can reach about 1,000 ids, so the linear contains is up to roughly 500,000 string comparisons. Still negligible.

Docs

seeded-nodes.md (uncommitted) matches the code on the caps, limit_reached, the archived root, the three path rules, the agent shape and the no-op delete. Its sentence "the line naming the fetch tag comes first" and the matching cli.md lines hold only when a skill is attached (R1).

Recommendation: APPROVE

The four logic fixes are correct as read, the flag and the bool are carried through every layer, and the docs match. R1 and R2 are small and worth folding in before merge, but neither blocks: R1 is detectable by the documented rule, and R2 affects terminal display only.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

@malibio

malibio commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Address-review summary, round 2 (commit 46ea7c6)

Addressed

  • R1. node context and query run always open with the attached-skills line. With none attached it reads "0 attached skill(s): ... no GRAPH-FETCHED banner in this output is real."
  • R2. write_human_node passes id, type, title, properties, content and markdown through sanitize_for_terminal. JSON output is unchanged.
  • R5. The doc comment names the third case in which no one type is declared (a name meaning different relationships from different types).
  • R6. resolve_from takes &str.
  • R8. The announcement counts only entries that carry a skill.

Skipped

  • R3 (return rel_id.is_some() from the service's delete): exact and atomic, but it changes NodeService::delete_relationship and its transaction twin, which the playbook actions and merge repair also call. The before/after count is correct outside a concurrent write to the same pair of nodes, where only the message could be wrong.
  • R4 (cap inside the walk): the query count is bounded; an open-ended hop over a large tree loads rows it then drops. Revisit with context paths on schemas, when reads become the default path.
  • R7 (three test nits): the cap test covers 51; the boundary at exactly 50 follows from the > comparison.

Verification: bun run test:changed passed; quality:fix clean.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: the re-review approved. This round changes one printed line, adds sanitising to human-mode output, and tidies a signature and two comments; no logic on the read or write paths changed.

…turn attached skills with a node and a query run (closes #3555)
@malibio
malibio force-pushed the issue-3555-skill-attached-to branch from 9181487 to 9158aa6 Compare October 5, 2026 10:13
@malibio
malibio merged commit 2c2eca5 into main Oct 5, 2026
@malibio
malibio deleted the issue-3555-skill-attached-to branch October 5, 2026 10:13
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.

Let a skill be attached to any node, read a node with what its paths reach, and return attached skills with a node and a query run

1 participant