Skip to content

Consolidate subtree-render + drop dead code + expose skill in nav (part of #1699) - #1755

Merged
mstomar125 merged 1 commit into
mainfrom
worktree-issue-1699-skill-markdown-children
Jul 27, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
worktree-issue-1699-skill-markdown-children

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Ships the non-conflicting subset of #1699 (ADR-057). Items 2 (skill guidance → markdown children) and 3 (retire the prompt type) are deferred — see below and the issue comment.

  • Consolidate duplicate subtree-render logic: skill_ops::render_skill_instructions and PromptAssembler::fetch_prompt_body carried two independent copies of the same DFS subtree walk. Extracted one shared flatten_subtree_content util in packages/core (node_service::hierarchy, re-exported at services::), used by both. fetch_prompt_body now also skips empty-content nodes (previously emitted blank \n\n sections) — a harmless unification; nested children are still preserved.
  • Delete dead code: PromptAssembler::assemble_with_skill() (zero callers, leftover from the push-based discovery design ADR-038 replaced).
  • Nav: 'skill' added to SIDENAV_CORE_TYPES — skill nodes browse via the generic path (no new UI; skill is already a core schema).

Why 2 & 3 are deferred

The issue's premise that the prompt type has "zero remaining consumers" is incorrect: the daemon seeds prompt-typed nodes at startup (daemon/services/assembly.rs:229) and PromptAssembler::fetch_prompt_overrides queries node_type == "prompt" every agent turn (agent_loop.rs:298 → assemble(), a live path). Retiring the type would make those internal system-prompt override nodes fall back to the embeddable CustomNodeBehavior → search pollution; item 2 has the same embeddability implication. Retiring prompt needs a design decision (migrate the override mechanism off the type — the agent-config schema the issue gestures at) that's out of scope here. Full detail on the issue.

Verification

flatten_subtree_content is behavior-equivalent to both originals (same pre-order; the only change is the harmless empty-skip). core 973 / agent 301 lib tests pass; clippy clean; the fetch_prompt_body body-drop regression test still passes; pre-push gate green. Independent review: sound.

Part of #1699 (issue stays open for items 2 & 3).

…ll in nav

The non-conflicting subset of #1699 (ADR-057):

- Extract one shared flatten_subtree_content util in core (depth-first
  pre-order over the ordered adjacency list, skips empty content, root
  excluded) and use it from both skill_ops::render_skill_instructions and
  PromptAssembler::fetch_prompt_body, which carried independent copies of
  the same subtree walk. fetch_prompt_body now also skips empty-content
  nodes (it previously emitted blank sections) — a harmless unification.
- Delete PromptAssembler::assemble_with_skill (zero callers).
- Add 'skill' to SIDENAV_CORE_TYPES so skill nodes browse in the left nav.

Items 2 (skill guidance -> markdown children) and 3 (retire the prompt
type) are deferred: the prompt type has a LIVE consumer — the daemon
seeds prompt-typed nodes (daemon/services/assembly.rs) and
PromptAssembler::fetch_prompt_overrides queries them every agent turn —
so retiring it would make those internal system-prompt override nodes
embeddable (search pollution). That needs a re-spec (migrate the override
mechanism off the prompt type). Detail on the issue.

Part of #1699.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE

Independent review — sound, safe to ship:

  • flatten_subtree_content is behavior-equivalent to both originals (identical pre-order stack walk); the only intended change is fetch_prompt_body now skipping empty-content nodes (cosmetic — collapses redundant blank paragraphs; children still walked). The missing-id-in-node_map divergence is a can't-happen store-invariant path that warns identically.
  • Export path clean (nodespace_core::services::flatten_subtree_content); no dangling refs; import cleanup correct.
  • 5 ported skill_ops walk tests + the fetch_prompt_body body-drop regression test cover it. Nav filter (isCore && SIDENAV_CORE_TYPES.has) surfaces skill with no new UI.
  • Items 2/3 fully reverted (prompt schema/behavior intact, skill_pipeline still Some("prompt")).

Merging as part of #1699; issue stays open for the deferred prompt-retirement (needs the override-node re-spec).

@mstomar125
mstomar125 merged commit 4fc2f21 into main Jul 27, 2026
2 checks passed
@mstomar125
mstomar125 deleted the worktree-issue-1699-skill-markdown-children branch July 27, 2026 11:25
malibio added a commit that referenced this pull request Jul 30, 2026
… type; expose skill in nav (#1824)

* Skill guidance becomes real markdown children; retire prompt type for agent-guidance (closes #1699)

seed_skill_nodes() no longer routes children through child_node_type: Some("prompt")
— they now come out as ordinary header/text nodes via markdown type inference,
consistent with every other markdown-ingested document in NodeSpace.

The prompt schema/behavior is retired, but PromptAssembler's base-system-prompt
override nodes had a live, every-turn consumer keyed on node_type == "prompt",
so this introduces a purpose-named agent-guidance schema in its place rather
than leaving that lookup with no valid identity. agent-guidance carries no
discovery metadata (unlike skill, which is matched via search_skills) — it's
simply fetched by type, same mechanism prompt used, just named for what it is.
NON_EMBEDDABLE_CONTAINER_TYPES and its parity test were updated in lockstep so
embeddability stays correctly gated.

The subtree-render consolidation and SIDENAV_CORE_TYPES nav exposure from this
issue's remaining scope already shipped in #1755.

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

* Address review: per-schema seed reconciliation + skill-children type-inference test

Fixes two Important findings from the PR review:

1. seed_core_schemas_if_needed() gated the entire schema-seeding batch on a
   single task_exists check — the exact type-level skip pattern #1818 (06a94ee)
   eliminated for seeded content, just one abstraction level up. On any
   pre-existing dev database, the new agent-guidance schema node introduced by
   this PR would never be created, silently orphaning it. Now checks each core
   schema individually and creates only what's missing, so a schema added after
   a database's first run still reaches that database on the next start.
   Covered by a new test that deletes agent-guidance post-seed, reopens the
   same DB file (mirroring a daemon restart), and confirms it's recreated
   without touching the already-present task schema.

2. No test exercised seed_skill_nodes()'s real templates through the actual
   child_node_type: None inference path and asserted on the resulting
   children's node_type — the literal claim of this PR's item 1. Added a test
   that runs every seeded skill through prepare_nodes_from_template and
   confirms children are header/text (never prompt), with at least one header
   node per skill (every seed's guidance starts with a markdown heading).
   Verified both new tests fail against the pre-fix code and pass against the
   fix, by temporarily reverting each in isolation and confirming the failure
   before restoring.

Suggestions from the same review (markdown_test.rs's inert "prompt" placeholder
strings, core_schemas.rs's longer doc comment, props.rs's doc-example swap,
the reconciliation test's count/comment update) were left as-is per the
reviewer's own assessment that none warranted a change.

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

---------

Co-authored-by: Claude <[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