Skip to content

Write planning sections as ordinary header and text nodes (closes #3757) - #3760

Merged
malibio merged 3 commits into
mainfrom
issue-3757-planning-sections-as-nodes
Oct 12, 2026
Merged

malibio merged 3 commits into
mainfrom
issue-3757-planning-sections-as-nodes

Conversation

@malibio

@malibio malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Settles Give a plan review, a spec's sections and an issue brief a typed home, or decide they stay prose #3757 as: no new types or fields. What the planning procedures write that is not a field or a criterion is an ordinary node tree: a header node named for the section, and one text node per item beneath it.
  • Writing a Spec: objective and boundaries are short statements again; Problem, Solution, User stories, Implementation decisions, Testing decisions (including where the tests go) and Out of scope are header sections beneath the spec. Criteria stay direct checkbox children.
  • Reviewing a Plan: Not in scope and Failure modes are header sections beneath the plan; a gap is an unticked checkbox in Failure modes until closed. risks is a short statement.
  • Splitting a Plan into Tasks: an issue's brief is Behaviour, Interfaces and Out of scope header sections; the checklist stays direct checkbox children.
  • One shared section-create rule (agent and CLI forms) replaces the brief fragment; the skills' iteration limits and applies_to cover headers and text.
  • ADR-092 §8 updated and pushed first.

Test plan

  • bun run test:changed (rust + scripts) passes
  • workflow_seeds: a spec with header sections beside its criteria is approved on the criteria alone; a plan's review sections gate nothing; issue briefs are header sections with text beneath, and only the unblocked issue is ready
  • Retrieval texts are unchanged, so the recorded matrix digest and goldens stand

🤖 Generated with Claude Code

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review Summary

Verdict: REQUEST CHANGES (one blocker, same root cause on four skills; everything else is small).

The write side is correct and well tested: create_node with node_type: "header", parent_id and "## " content works through the real tools, headers and text nodes under a spec, plan or issue break none of the Plays or queries I traced, and PR #3758 conventions (agent plus skill-md rule forms, <!-- include --> use, no paths, the rule registered in PROCEDURE_RULES, stale rule fully deleted with no remaining references) are preserved. The problem is the read side: this PR moves content out of fields that procedures read and into nodes that the read paths those procedures use do not return.

Findings

Critical Issues

  • [Critical/Blocker] Sections are invisible to every procedure that reads the spec or plan. get_node_context returns a node's fields plus its direct checkbox children only ("Never its whole subtree", node_context_ops.rs ContextNode), and the read rules (plan-read-spec: paths [["spec"],["spec","decisions"]]; task-breakdown-read; task-implement-take via run_query with_context) are unchanged. After this PR the Testing decisions, Implementation decisions, Out of scope, Problem/Solution/User stories (spec) and Not in scope and Failure modes (plan) are header/text nodes that none of those reads return. Consequences:
    • reviewing-a-plan.md line 3 still says to read the spec's boundaries, "including where the tests go", and the Tests pass reviews "at the boundary the spec chose". boundaries no longer holds the test boundaries (writing-a-spec now puts them under Testing decisions). The plan reviewer cannot find the thing it is told to review against.
    • splitting-into-issues.md line 7 reads the plan's approach and the spec's boundaries and then writes "Out of scope" for each slice. The plan's Not in scope used to be the tail of approach (which was read); it is now a section node nobody reads. Failure modes used to be risks (read); risks is now one or two sentences.
    • implementing-a-task.md (step 3) and reviewing-a-task.md (step 2) tell the worker to read the spec's boundaries as "what must hold". Implementation decisions and Out of scope are no longer in it.
    • Net: a decision recorded in the spec's Implementation decisions or Testing decisions silently stops governing planning, splitting, implementation and review. That is exactly the "tests chosen before any task is split" guarantee in ADR-092.
      Fix, either: (a) give the read rules the paths that reach sections, ["spec","has_child"] and ["spec","has_child","has_child"] (a header's children), for plan-read-spec, task-breakdown-read, the implement and review reads, and say in the skill text to read the sections; the MAX_NODES_PER_PATH of 50 is fine here; or (b) read with get_node format: "markdown" (children included) as task-review-read already does. Whichever is chosen, update the stale boundaries wording in reviewing-a-plan, splitting-into-issues, implementing-a-task and reviewing-a-task. Add a test that the documented read returns the section text (see Testing).

Suggested Improvements

  • [Improvement] writing-a-spec.md line 9: "record the answer first under Testing decisions" is ambiguous and the spec does not exist yet at this step (it is created several steps later). Say "keep the answer for the Testing decisions section" or move the instruction to the section-writing step.
  • [Improvement] Iteration budgets are tight for what the text now asks. A real spec is create, 6 headers, roughly 15-25 text items, 3-6 criteria, the question and the approve write, which is 28 or more calls against 24. Splitting is about 14-16 calls per issue (issue, 3 headers, 3+ items, 3 checklist, 2-3 links) so 40 covers two or three issues, where the old 16 already ran at about 9 per issue. Reviewing a plan is 20 with decisions recorded via create_node plus create_relationship per decision. If an iteration is one model turn that may batch tool calls this is fine; if not, raise them or tell the skill to batch items. Either way the comments should state the assumed shape.
  • [Improvement] Tests do not exercise the risk the PR describes. a_plans_review_is_ordinary_nodes_and_gates_nothing approves a plan, and plan approval never looks at checkboxes, so the "gap under a header is not a criterion" claim is not tested by anything that would fail if it were wrong. The consumers of "only direct children count" are the task done Play, the spec approval Play (NO_CHECKBOX_CHILD) and Ready tasks. Add: an issue whose only checkbox is under a header is not Ready and cannot be approved or done as having a checklist; an unticked checkbox under a header does not block marking an issue done once its direct checklist is ticked. The spec test only covers the spec-approval happy path with direct criteria.
  • [Improvement] No test that the sections are readable by the paths the read rules name (see the blocker); that is the missing guard that would have caught it.

Nitpicks

  • Nit: reviewing-a-plan.md "no gap is left unticked when the plan is shown for approval" means the user only ever sees ticked gaps; fine, but say where the user sees open ones (the checkbox state is the audit trail).
  • Nit: get_node_context of the plan does not return the Failure modes checkboxes (they are grandchildren), so a later session cannot list open gaps from the standard read; ties into the blocker fix.
  • Nit: the new tests assert counts but not sibling order; a section list reads in creation order, worth one assertion since an outline is order-significant.
  • Nit: applies_to gains Header/Text/Checkbox. It only changes the schema metadata attached to the skill, so harmless, but it widens the skill's scope for guidance about any header or text node; confirm that is wanted.

Checked and fine

  • Tools and CLI: create_node header/text with parent_id and "## " content; nodespace node create --type header --parent <id> --content "## <name>" matches the existing --parent use of the removed rule.
  • Plays and queries: rollup passes over non-task children; NO_CHECKBOX_CHILD and Ready tasks use one-level has_child with a checked derivation, so header and text children neither satisfy nor block them; headers under a spec/plan/issue are accepted.
  • Embedding: spec and plan embed nothing, so sections now give semantic search a better handle (header aggregates its children); no aggregation of gap checkboxes into a parent that matters.
  • Rule registry: section-create registered once, task-breakdown-brief removed from both forms and PROCEDURE_RULES, no stale references in the repo; docs ADR-092 §8 matches the skill text.
  • Not run: I did not run the Rust test tier locally; the merge gate will.

Reviewed against origin/main...HEAD.

@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.

Verdict: REQUEST CHANGES. The write side (header/text sections, direct checkbox criteria, rule forms, iteration limits direction) is correct, but the procedures that read the spec and plan (plan-read-spec, task-breakdown-read, implement and review reads) return only fields plus direct checkboxes, so Testing decisions, Implementation decisions, Out of scope, Not in scope and Failure modes are no longer visible to planning, splitting, implementation or review, and several skills still say boundaries holds the test boundaries. Details and the smaller items are in the PR comment.

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Review addressed (406acf3)

Addressed

  • Blocker: sections were invisible to the procedures that read a spec or plan, because a context read returns only direct checkbox children. New section-read rule (get_node with format markdown, or nodespace node export <id>) is included in Reviewing a Plan, Splitting a Plan into Tasks, Implementing a Task and Reviewing a Task, and get_node is whitelisted where it is used.
  • Stale boundaries wording in those skills, and the Writing a Spec sentence that recorded into a spec that did not exist yet.
  • Iteration limits raised (40 / 30 / 80, a call is an iteration), with the assumption stated.
  • Tests: sections are read back whole and in order; a checkbox beneath a section is no checklist item for readiness, and an unticked one does not stop the direct checklist closing the task.
  • Audit trail: ticked gaps are stated as the record of what the review found and closed.

Not changed

  • applies_to gaining Header, Text and Checkbox is intended: a held turn must be able to write the sections.
  • Sibling order is asserted for the read-back, not for every write: order follows creation, as everywhere.

Agent suite: 1133 passed.

Re-Review Decision

Decision: RE-REVIEW NEEDED

Rationale: the blocker fix adds a rule and changes the reading steps of four procedures, an interconnected change to what an agent reads before acting.

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Re-review of 406acf3 (addresses review of 3dbd577)

Verdict: REQUEST CHANGES. The previous recommendations are addressed in intent and in skill text, but the one mechanism the fix leans on, get_node with format: "markdown", cuts the document at 2,000 bytes on the local agent path, so the tail sections (the ones that matter most) still do not reach a real spec or plan read. One small, targeted fix is needed.

Findings

Critical Issues

  • [Critical/Blocker] get_node markdown is truncated to 2,000 bytes, which drops the tail sections for the local agent. packages/agent/src/local_agent/tools.rs (the format == "markdown" branch, ~L4936) returns truncate(md, BODY_TRUNCATE_FULL) with BODY_TRUNCATE_FULL = 2000, appending [truncated]. Subtree order is creation order: for a spec that is the sections (Problem, Solution, User stories, Implementation decisions, Testing decisions, Out of scope), then the direct criteria; for a plan, Not in scope and Failure modes come last. A realistic spec (user stories "covering every behaviour the user would notice", implementation decisions) is several KB, so Testing decisions, Out of scope and the criteria are exactly what is cut. Recovery is not possible either: the tool exports with include_node_ids: false, so the model never gets a header id to read the rest with its own get_node, and get_node_context returns no headers. Neither the skill text nor the rule mentions the cut. The CLI path (nodespace node export, ExportMarkdown RPC, depth 20, no truncation) is fine, so external agents are unaffected; this is the local agent lane only. The new test passes because its spec is about 150 bytes.
    Fix: give the markdown read its own, larger limit (a separate constant, since BODY_TRUNCATE_FULL is pinned to the Research & Search guidance by research_guidance_states_the_real_markdown_cut), or return it whole, and add a test that reads a spec whose sections exceed 2,000 bytes and asserts the last section is present and [truncated] is absent.

Suggested Improvements

  • [Improvement] Implementing a Task never says to read the task's own brief. implementing-a-task.md step 3 names the spec's boundaries and sections and every decision; the include rule says "spec, plan or task", but the sentence around it does not name the task's Behaviour / Interfaces / Out of scope sections or the plan's sections. The brief is the slice contract and used to ride in a field the context read returned. Say "the task's own brief and the plan's sections" in step 3 (Reviewing a Task already reads the task via task-review-read).
  • [Improvement] Three whole-document reads in procedures with small budgets. Implementing a Task (12) and Reviewing a Task (10) gained up to three get_node calls each and were not raised. The local loop ignores max_iterations (global cap in agent_loop.rs), so this only affects external agents, but the stated rationale ("a call is an iteration") should be applied consistently, or those two limits left with a comment saying why.
  • [Improvement] The new read test covers a spec only. The claim is "spec, plan and task". Add a plan (Not in scope / Failure modes with a gap checkbox) and an issue brief to the same assertion; cheap, and it is the shape the rule is used on.

Nitpicks

  • Nit: splitting-into-issues.md "Read the plan and the spec both." is redundant after the include; drop it.
  • Nit: in reviewing-a-task.md the include sits mid-sentence between two clauses, so the rendered rule sentence lands in the middle of a list; move it to the end of the sentence.

Verified

  • The section-read rule is in all four procedures that read the spec or plan (Reviewing a Plan, Splitting a Plan into Tasks, Implementing a Task, Reviewing a Task), registered once in PROCEDURE_RULES, with both forms (agent get_node markdown, skill-md node export). get_node is whitelisted in all four; Writing a Spec already had it.
  • Core: handle_get_markdown_from_node_id exports the whole subtree (root, then children recursively in order, depth 20, checkboxes from their - [ ] content, headers as ## ), and CLI export defaults to children on. Set fields come back beside the text in properties.
  • The stale boundaries wording and the Writing a Spec "record into a spec that does not exist yet" sentence are fixed; ticked gaps are stated as the record. applies_to widening accepted as intended.
  • Tests: a_checkbox_beneath_a_section_is_not_a_checklist_item would fail if a nested checkbox counted (Ready count 1, and the unticked nested one would block done), so it exercises its claim. a_specs_sections_are_read_back_with_the_markdown_read is real but too small to catch the truncation. I did not run the Rust tier locally; the author reports 1133 passing.

Re-review needed after the fix, since it changes the read this PR depends on.

@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.

Verdict: REQUEST CHANGES. The section-read fix is in all four reading procedures with consistent whitelists, but get_node format markdown truncates at 2,000 bytes on the local agent path and the model gets no ids to read the remainder, so Testing decisions, Out of scope and the criteria of a realistic spec are still cut. Details in the PR comment.

@malibio

malibio commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator Author

Re-review addressed (cf928b6)

Addressed

  • Critical: get_node format markdown was cut at the 2,000-character search-result limit, which dropped the last sections and the criteria of a real spec. It now has its own 16,000-character limit (NODE_MARKDOWN_TRUNCATE); the search-result limit and the guidance pinned to it are untouched. New test: a spec over 4 KB reads back with its last section, its last criterion and no [truncated]; a plan's failure modes with a gap, and an issue's brief, read back the same way.
  • Implementing a Task names the plan's sections and the task's own brief; iteration limits raised for it (20) and Reviewing a Task (16), stating the call-per-iteration assumption.
  • Nits: redundant sentence and mid-sentence include tidied.

Agent suite: 1134 passed.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: the one Critical was a single constant on one read path, proven by a test that fails under the old limit (the fixture exceeds it); the rest is skill-text tidying and limit values. No new behaviour beyond what the review asked for.

malibio and others added 3 commits October 12, 2026 11:53
…ec and plan

- New section-read rule (get_node markdown / node export) included where a
  procedure reads a spec or plan: Reviewing a Plan, Splitting a Plan into
  Tasks, Implementing a Task, Reviewing a Task. A context read returns only
  direct checkbox children, so sections were invisible to them.
- Stale boundaries wording fixed; Writing a Spec no longer says to record
  into a spec that does not exist yet; gap ticks stated as the record.
- Iteration limits raised (a call is an iteration) and get_node whitelisted
  where the new read is used.
- Tests: sections read back in order; a checkbox beneath a section is no
  checklist item for readiness or completion.

Not changed: applies_to gaining Header, Text and Checkbox is intended (held
turns must be able to write the sections).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- get_node markdown read has its own 16,000 character limit; the 2,000
  search-result limit dropped the last sections and the criteria of a real
  spec. A test with a spec over 4 KB asserts the last section, a criterion,
  a plan's gap and an issue's brief read back whole.
- Implementing a Task names the plan's sections and the task's own brief;
  iteration limits raised for it (20) and Reviewing a Task (16).
- Include placement and a redundant sentence tidied.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@malibio
malibio force-pushed the issue-3757-planning-sections-as-nodes branch from cf928b6 to f64cffd Compare October 12, 2026 09:53
@malibio
malibio merged commit c5423cb into main Oct 12, 2026
@malibio
malibio deleted the issue-3757-planning-sections-as-nodes branch October 12, 2026 09:53
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