feat(agent): arrange_notes tool for on-demand layout - #257
Merged
Conversation
winlp4ever
force-pushed
the
feat/agent-relational-placement
branch
from
August 26, 2026 07:56
ad125e8 to
7c4e1d3
Compare
winlp4ever
force-pushed
the
feat/agent-arrange-tool
branch
from
August 26, 2026 07:56
a20d486 to
47f14c1
Compare
winlp4ever
force-pushed
the
feat/agent-relational-placement
branch
from
August 26, 2026 12:04
7c4e1d3 to
4f04cfb
Compare
winlp4ever
force-pushed
the
feat/agent-arrange-tool
branch
from
August 26, 2026 12:04
47f14c1 to
696aac6
Compare
winlp4ever
force-pushed
the
feat/agent-relational-placement
branch
from
August 26, 2026 12:06
4f04cfb to
9bf4ecb
Compare
winlp4ever
force-pushed
the
feat/agent-arrange-tool
branch
from
August 26, 2026 12:06
696aac6 to
b01a946
Compare
Expose the layout engine as a tool: arrange_notes(note_ids?) tidies the given notes — or the whole current layer when omitted — into a clean mindmap/dagre layout. Unlike the post-turn create-arrange (which drops a new cluster beneath existing content), it reorganizes IN PLACE, keeping the cluster centered where it already sits, so re-tidying doesn't relocate the board. Factors the shared layout step (layoutNodes) out of arrangeCreatedNodes and adds arrangeNodesInPlace. Wires the tool into agentBuildTools, the stream ToolName/label/icon maps, a readable 'Arranged N notes' step output, and the system prompt's tool list. S6 of the board-authoring plan.
- Revert the near-anchor arrange-exclusion: pinning a same-turn auto anchor fragmented a mindmap rooted at it (root dropped from the layout, edges stranded). Arrange now runs on all auto nodes; `near` is for stable/existing anchors (anchoring to a same-turn auto node is the deferred pinned-aware case). - arrangeNodesInPlace re-reads nodes after the async layout and drops any removed concurrently, so the write-back can't throw on a missing node. - link_notes errors (no dangling edge at 0,0) when an endpoint doesn't exist in the current layer. - arrange_notes caps a whole-view arrange (MAX_ARRANGE) so a huge board isn't mass-relocated / re-laid-out in one shot; steer toward passing note_ids. - offsetToOrigin uses a reduce, not Math.min spread, over a possibly large cluster (call-argument-limit safety).
winlp4ever
force-pushed
the
feat/agent-arrange-tool
branch
from
August 26, 2026 12:08
b01a946 to
2eee322
Compare
winlp4ever
changed the base branch from
feat/agent-relational-placement
to
main
August 26, 2026 12:08
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.
PR of the board-authoring plan (
docs/plans/agent-board-authoring-tools.md§4, S6). Stacked on #256 (→ #255 → #253 → #250) — merge those first.What
A new
arrange_notes(note_ids?)tool: tidy notes into a clean auto-layout on demand. Pass ids to arrange just those; omit to tidy the whole current board/folder. Renders as a visible "Arranged N notes" step.Key behavior: in place, not relocated
The post-turn create-arrange drops a new cluster beneath existing content. Re-tidying existing notes shouldn't move the whole cluster elsewhere — so
arrangeNodesInPlacelays them out and keeps the cluster centered where it already sits. (Same mindmap→dagre engine, different translate.)How
layoutNodes) out ofarrangeCreatedNodes; addedarrangeNodesInPlace(returns the count moved; no-op for < 2).arrange_notestool →agentBuildTools; writes go through the current-layer store (sync-correct, same as create-arrange).streamToolName/label/icon maps, a readableagent-event-to-stepoutput ("Arranged N notes"), and the system-prompt tool list so the agent discovers it.Scope
v1 uses the existing single layout (mindmap-first, dagre fallback); the
tree/grid/flowstrategy variants from §4 are deferred. Current-layer only (cross-layer arrange is the S7 headless-emit concern).Tests
arrangeNodesInPlace: tidies while keeping the cluster centered (not shoved beneath); no-op for < 2.arrange_notestool: arranges given ids / whole view, reports count.agent-event-to-step: readable "Arranged N notes" output.check-allclean; agent + arrange suites green (567).