Repository navigation
Description
Overview
The play viewer's Edit opens a new native chat already set up for editing that play (ADR-090 §3–§5). Two things that don't exist yet make that work:
- a chat that pins nodes;
- routing that always offers a chat's pinned skills.
Today every turn routes from scratch. Nothing lets a chat start with a skill attached, or keep a node in view.
Proposed Solution
-
pinsrelationship onai-chat-native: chat → any node, many, reversepinned_in. Declared through the node-type sequence. -
Routing: in a chat with pinned skills, each pinned skill is added to Stage 2's candidate block, with its instructions and
schema_metadata, beside retrieval's top-K. It counts toward the offered set like any linked candidate. -
Entity list: every pinned node that isn't a skill is always included, exempt from the recency cap, and re-read live before a tool acts on it.
-
Edit chat: the viewer's Edit creates a new
ai-chat-nativechat titledEdit <play title>, with:- pins to the play-authoring skill and the play;
- an opening assistant message written by the system with no model call. Its content asks what to change and links the play, with
outcome: clarifiedandoptionsChange when it runs, Change a condition, Change an action, Add a rule, Remove a rule.
It then opens the chat in its viewer.
Documentation
- ADR-090 §3 (Edit chat and its opening message), §4 (
pins), §5 (routing with pinned skills) - AI Chat Node — A chat bound to a node, plus Messages are nodes and Memory across turns: message fields,
options, the entity list - Prompt and Skill System — Pinned skills
- Seeded Nodes — Routed turns are held to the linked set
- ADR-088: a chat may be an edge source, not a target; message rules
- Node Types — ai-chat: the
pinsrelationship - Node type sequence: mandatory for the new relationship
- Updates: none expected
Architecture Impact
Implements ADR-090 §3–§5. That ADR amends ADR-038 and ADR-064 (pinned skills are always Stage-2 candidates) and ADR-088 (ai-chat-native declares pins). The docs are already updated (nodespace-docs 88cc64b).
Acceptance Criteria
-
ai-chat-nativedeclarespins/pinned_in(target: any node);node-types:checkpasses; generated types committed if the wire changes - Routing:
- in a chat with a pinned skill, every turn's Stage-2 candidate block includes it, with instructions and
schema_metadata, beside retrieval's candidates (no duplicate when retrieval also finds it); - it counts toward the offered set;
- a chat without pins routes exactly as before
- in a chat with a pinned skill, every turn's Stage-2 candidate block includes it, with instructions and
- Entity list: a pinned non-skill node is in every turn's entity list, exempt from the recency cap
- Creating the Edit chat:
- one backend operation creates the chat, its pins and its opening message;
- no model call is made;
- the opening message's link records a
mentionsedge from the message to the play, so the play's backlinks list it and lead to the chat
- The opening card renders its options through the existing
optionsrendering; picking one sends it as the user's turn -
PlayNodeViewer's Edit button creates the chat and opens it (Add PlayNodeViewer: a play's rules as a read-only workflow, with its on/off switch and Edit #3518 hides Edit until this lands) - Tests:
- routing with and without pins;
- a pinned skill also found by retrieval;
- the entity list keeps a pinned node past the cap;
- Edit chat creation (pins, opening message fields, mention edge);
- the routing and decisions evals don't regress
- The prompt golden test is updated and reviewed if the assembled prompt changes
-
bun run quality:fixclean;bun run test:changedpasses
Technical Specifications
Reference Files
- Routing:
packages/agent/src/local_agent/routing.rs(candidates,stage2_tools, offered set); the candidate block inpackages/agent/src/local_agent/agent_loop.rs - Entity list and message history:
packages/agent/src/local_agent/agent_loop.rs,packages/agent/src/local_agent/tools.rs(resolved_entities_from) - Core schemas:
packages/core/src/models/core_schemas.rs(ai-chat-native) - Chat creation (frontend):
packages/desktop-app/src/lib/stores/ai-chats.svelte.ts(createChat),services/ai-chat-default-model.ts - Options rendering:
packages/desktop-app/src/lib/components/chat/chat-message.svelte
Implementation Details
- The opening message is a normal
ai-chat-message(roleassistant), written by the system. The first model turn answers the user's reply to it, so turn assembly must treat it like any assistant message. - Pins are written only at creation in this issue. Pinning from the UI later is out of scope.
Dependencies
- Teach the native agent to author plays: a play-authoring skill and typed get_play / update_play tools #3519 (the skill being pinned)
- Add PlayNodeViewer: a play's rules as a read-only workflow, with its on/off switch and Edit #3518 (the Edit button)
Related Issues
Non-Goals
- Pinning or unpinning from the chat UI
- Bound chats for node types other than
play
Activity
malibio commentedon Oct 5, 2026
Baseline — Frontend: 317 test files passed (5733 tests). Classification (node type sequence): a new declared relationship
pins/pinned_inon the core subtypeai-chat-native(category: ai-chat subtype of the abstractai-chatbase); state lives on an edge, no new fields.Address review: hold a pinned destructive skill to its bar, test the …
Address re-review: list an empty inbound group as before, except a ch…
Let a native chat pin a skill and a node: pins relationship, routing …
Open a play's Edit chat bound to it: one backend operation, the viewe…
Offer a pinned skill when skill retrieval is unavailable (#3520)
Describe Edit in the play viewer's header comment (#3520)
Address review: hold a pinned destructive skill to its bar, test the …
Address re-review: list an empty inbound group as before, except a ch…
Let a native chat pin a skill and a node, and open a play's Edit chat…