Repository navigation
Description
Overview
A node can be created from a markdown document in three ways today, and none of them gives a node of a chosen type with a short title and a parsed body. nodespace node create --type <type> --content "<markdown>" stores the whole text as the node's content (one node, no children, and a title that is the whole text flattened to one line). nodespace import file parses the body into child nodes, but it makes the root a plain text node and has no way to name the type or the parent. The local agent's create_nodes_from_markdown can attach a parsed body under a parent, but only in the in-app agent. This issue makes node create take the document as markdown the way a file is imported: the first line is the node's title and the rest is parsed into child nodes. It also fixes the import of a file that starts with front matter.
Problem Statement
What exists today, checked against a scratch database:
node create --type decision --content "<multi-block markdown>"creates onedecisionnode with the whole markdown as content (359 characters in the test) and no children. Itstitle, read from a query, is the whole content with the markup stripped, on one line.import filestrips the heading syntax from the root's content (a root starting# Title,## Title, a plain paragraph or a setext heading all come out as a clean title) and parses the body intoheader,text,ordered-listandcode-blockchildren, but the root is always atextnode, and the import request (import_service.proto: file path and options) carries no type and no parent.- A file that starts with YAML front matter imports with a root whose content is
---, the front matter fields as a separatetextchild, ahorizontal-linechild, and the real# Headingas aheaderchild with its#prefix kept. Of 226 non-archived pages in the docs repository, 2 start with front matter. - The in-app agent's
create_nodes_from_markdowntakesmarkdown,parent_idandcollectionand parses under a parent, but there is no CLI or external-agent equivalent, so the CLI cannot create a typed root with a parsed body.
Proposed Solution
node create --contenttakes a document. When the content has more than one block, the first non-empty line becomes the node's own content, with a leading heading marker (#to######) stripped as the importer strips it from a file's first heading, and the remaining blocks are parsed into child nodes under the new node by the importer's parser (prepare_nodes_from_markdown). Content that is a single block behaves as today, so the existing single-line calls do not change.- The type is given by
--type. It is not read from the content. - Which types split. Only types whose node is a document root take part (the types a document can be, such as
decision,spec,plan,taskandtext). The markup types keep multi-line content as it is:code-block,quote-block,tableand the other block types. The exact list is settled in the implementation and stated in the acceptance criteria. - A type whose name comes from a title template (such as
person) keeps rejecting content. - Front matter in an imported file becomes properties of the root. Front matter is metadata about the document, and a node's properties are how NodeSpace holds metadata. A block is front matter when the file's first line is exactly
---, a later line is exactly---(or...), and the lines between them parse as a YAML mapping. Each top-level key is stored on the root with its value kept as the JSON type it has (a string, a number, a boolean, a list, or a nested object). A key that is the exact name of a field the root's type declares is set as that field, validated against the type's rules (for adecision,decision_statusand one ofproposed,accepted,superseded). Any other key is stored ascustom:<key>, because a core type takes only declared fields andcustom:is the namespace for one a user adds to it. The root's type is known when the front matter arrives throughnode create --type <type> --content; an imported file's root is alwaystext, so its keys are allcustom:<key>. The first heading (or first line) after the block is the root's title, and no---node ortextnode is created for the block. A---that does not meet this rule is a horizontal line, as today, and a---anywhere after the first line is always a horizontal line. - A YAML parser is added to core for this (core has none today), and the import result reports how many front matter keys were stored, so a file whose block did not parse is visible.
- The agent's
create_nodetool gets the same behaviour, so the in-app agent and the CLI agree. - Guidance changes in the same issue, because the input of
node createchanges: the shipped skill'sSKILL.mdandreferences/cli.md(and its minimum CLI version stamp), the seeded rules that describenode create, and the graph skills built from them.
Documentation
The decision to keep a node's title as its own content and the body as children is already how a Decision is recorded (the "Recording a Decision" skill). Update components/seeded-nodes.md if the seeded rules change, and the node-type reference only if a type's rules change; this issue adds no node type.
Architecture Impact
Core, daemon and CLI. The create request stays a content string, so the wire type is unchanged, and the parser already exists in core (prepare_nodes_from_markdown in core/src/markdown/mod.rs, used by import and by seeding). The change is in the create path (NodeService::create_node in core/src/services/node_service/crud.rs and the daemon's create_node in daemon/src/services/node_service.rs), and the importer's title handling for front matter. Seeded rules and skills change, so shape:check needs a reconcile change-log entry for each changed seed.
Acceptance Criteria
-
nodespace node create --type decision --content "# Title\n\nbody with a list and a code block"creates adecisionwhose content isTitle(marker stripped) and whose body is parsed into child nodes (headers, text, ordered lists, code blocks), asimport fileparses the same text. - A single-block
--contentcreates one node exactly as before; the existingnode createcalls in the seeded rules,SKILL.mdandreferences/cli.mdneed no change to keep working. - The types that split are listed, and
code-block,quote-blockandtablekeep multi-line content as one node; a test covers a type from each side of the list. - A type with a title template still rejects content.
-
import fileon a file that starts with front matter gives a root whose content is the first heading's text (or first line), with each top-level key stored on the root ascustom:<key>and its value as the matching JSON type (string, number, boolean, list, nested object); a test covers each type, and no node is created for the block. - The import result reports how many front matter keys were stored (a field on the import result in
import_service.proto, regenerated, and printed by the CLI), and a block that does not parse as a YAML mapping is imported as the horizontal lines and text it is today. - A file that starts with a horizontal line
---that is not followed by a closing---around a YAML mapping, and a---after the first line, import as ahorizontal-lineas today; a test covers each. -
node create --type decision --contentwith front matter containingdecision_status: acceptedcreates a decision whosedecision_statusisaccepted; an invalid value is rejected with the field's own message, and nothing is created. - A key that is not a declared field of the node's type is stored as
custom:<key>, with a test for a string, a list and a nested object. - A front matter key that is already namespaced (
custom:x) or reserved (a leading_) is handled by a stated rule and a test, and the node-type sequence is not triggered because no field or type is added. - A file with no front matter imports unchanged.
- The first heading's marker is stripped from the root in every shape the importer already handles (
#,##, a plain first paragraph, a setext heading), and a test pins each. - The agent's
create_nodetool takes the same markdown content and produces the same tree as the CLI. - The shipped skill (
SKILL.md,references/cli.md) describes the new behaviour and its minimum CLI version is raised, and a CLI older than that is flagged by the existing version check. - The seeded rules and graph skills that describe
node createstate the rule once, the prompt snapshots are regenerated and reviewed, andshape:checkpasses with areconcileentry per changed seed. - A test asserts that a body parsed under a new node produces the same child node types and order as importing the same text as a file.
- Code passes
bun run quality:fix;bun run test:changedpasses.
Technical Specifications
Reference Files
packages/core/src/markdown/mod.rs-prepare_nodes_from_markdown,parse_markdownand the importer's title handlingpackages/core/src/services/node_service/crud.rs,packages/daemon/src/services/node_service.rs- the create pathpackages/cli/src/commands/node.rs-createand its help textpackages/agent/src/local_agent/tools.rs-create_nodeandcreate_nodes_from_markdownpackages/skill/SKILL.md,packages/skill/references/cli.md,scripts/stamp-skill-md.tspackages/agent/src/seeds/rules/skill-md/- the rules that runnodespace node create
Implementation Details
Reuse the importer's parser; do not write a second one. Do not add a flag: --content keeps its name. No compatibility shim for the old whole-text behaviour on a multi-block content: it changes outright.
Non-Goals
- A
front-matternode type. Front matter is metadata and is stored as properties, so no type is added. - Writing properties back out as front matter on export.
- Aliases between a front matter key and a declared field of a different name (
statusfordecision_status), and declaring thecustom:keys in a schema. Only an exact name match is set as a declared field; what to do with other keys beyondcustom:is decided later. - A
--titleor--bodyflag. - Changing how a node's
titleis derived from its content.
Related Issues
- Agent guidance for writing markdown into nodes: import it, or create the right node type without typed syntax #4201 (guidance for writing markdown into nodes: import it, or create the right node type without typed syntax)
- Write NodeSpace's live decisions as decision nodes, each stated as it stands today #3729 (writing the live decisions as decision nodes, which needs this to be efficient)
Activity
mstomar125 commentedon Nov 5, 2026
Picking this up (sweep drain).
mstomar125 commentedon Nov 5, 2026
Merged (cf5a5e8):
nodespace node createnow takes a markdown document through a new CreateDocument RPC (the first line is the title, the rest is parsed into child nodes; a bad first line or unparseable front matter is refused and nothing is created), andimporttakes front matter as properties of the root. The generic create RPC, the editor and the agent's tools are unchanged by design.Still open, in the agent's lane (packages/agent): the seeded rules, graph skills and prompt snapshots that should teach an agent to use the document create, plus the shape-record reconcile entries they bring. The minimum CLI version for the skill is stamped at release time; a new CLI against an old daemon answers Unimplemented for
node create.🤖 Generated with Claude Code
mstomar125 commentedon Nov 6, 2026
Picking this up again for the agent-lane part (sweep drain).
mstomar125 commentedon Nov 13, 2026
Picking up the agent-lane part: making the in-app agent's create_node take document markdown the same way as the CLI (Refs #4237).
mstomar125 commentedon Nov 13, 2026
#4275 merged: the in-app agent's
create_nodenow takes a markdown document through the same core function asnodespace node create(first line = title, front matter = fields, rest = child nodes, same type allow-list and caps; non-document types keep content whole). A parity test compares the trees from the agent tool and the CLI path. What is left on this issue: a prompt dump of the changed skills and the newcreate_nodedescription on the local model, and eval scenarios for creating a task, a decision and a split issue through the CLI form (live model, CPU-only small model is approved). The new tool-description wording has not been measured on a live model yet. Minimum CLI version stamp is set at release time (scripts/stamp-skill-md.ts).mstomar125 commentedon Nov 16, 2026
Picking this up. The in-app agent half is merged (#4275); the remaining work is the YAML front matter parsing on import and on node create, the node create document split, the import result's front matter count, and the skill and seeded-rule guidance.
mstomar125 commentedon Nov 16, 2026
Correction to the comment above: the front matter parsing, the node create document split, the import result's front matter count and the skill and seeded-rule guidance are all already on main (#4247 and #4275). Checked against main on 2026-11-16: the create-document tests (19), the front matter unit tests (8), the daemon import tests (47) and the CLI import tests (18) pass. What is left on this issue is only the measurement on the local model: a prompt dump of the changed skills and the new create_node description, and eval scenarios for creating a task, a decision and a split issue through the document form (CPU-only small model).
mstomar125 commentedon Nov 16, 2026
Live measurement of the new create_node document form, on 2026-11-16: CPU only, gemma-4-E4B-it Q4_K_M, 4 threads, nomic-embed-text-v1.5 Q8_0, temperature 0.1, 3 repetitions of each scenario. One turn on the real production tool definitions (create_node, create_nodes_from_markdown, create_task) over a real store; the assertion is on what the store holds afterwards (root type, single-line title without the heading marker, nodes below it).
Nothing failed, so no wording change is proposed. Two observations: when create_task is offered the model prefers it for a task and chose the issue type because the work is a code bug (the tool's own rule); and a paragraph followed by a numbered list nests the list under the paragraph, so a document without headings has one direct child, which is the same split import file makes (the parity test in #4275 pins it).
The create_node description the model was shown begins: 'Create one new record of a type that already exists. Use for a single instance, never to define a new kind of record. STOP if the record is already listed in MENTIONED ENTITIES with the same name and type … For a text, task, project, spec, plan or decision record, a markdown document with more than one block (or front matter) in content is split, exactly as nodespace node create does: its first line is the title, its front matter becomes its fields, and the rest becomes child nodes in order (the result's child_count says how many), so do not create them again.' The content parameter reads 'The record's title and nothing else: the shortest phrase naming what this record IS …', which does not mention the document form; the model used the document form anyway in 9 of 9 reps where it chose create_node.
Not measured: the skill text (SKILL.md and the seeded rules) is for external agents and for the in-app loop's skills, and this harness is a single turn without them; a full-loop run with the skills injected would be the next step if the document form is ever mis-chosen. The test is in the PR for this issue.
mstomar125 commentedon Nov 16, 2026
Done. The code parts of this issue were already on main (the parser and the front matter rules in #4247, the in-app agent's create_node through the document path in #4275). The remaining measurement is merged as a live check in #4278 (d243081): on CPU gemma-4-E4B, 3 reps per scenario over four scenarios (a task with create_task offered, the same task with create_task withheld, a decision, and a spec with three sections), the model uses the document form in 12 of 12 reps and the store holds the right record (type, title without the heading marker, child count and child types). The create_node description's content parameter text does not mention the document form, yet the model used it in every create_node rep, so no wording change is needed. Not measured: a full-loop run with the skills injected; that is only worth doing if the document form is ever chosen wrongly.