# DS4Server implementation plan Only unfinished implementation work belongs here. DwarfStar remains the behavioral oracle for model execution, token processing, context accounting, KV-cache behavior, the HTTP API, and the built-in agent loop. Numbers in #xx format are issues that can be reaad with tea and have details about the respective topic in it. ## 1. Fix local-session behavior - Store model-dependent generation and runtime preferences per model and restore them when switching models. (#35) - Replace the default system prompt with a concise coding-agent prompt and edit it through a multiline Preferences field. (#30) - Add the selected project's `AGENTS.md` to the initial prompt when the first user message starts a session. Keep title generation based on the user conversation, and reuse a shared prompt KV prefix if measurement justifies the extra cache lifecycle. (#29) - Order ordinary sessions by most recent use while keeping pinned and archived sections intact. (#31) - Confirm every session deletion path before deleting metadata and its KV checkpoint. (#32) - Keep chat pinned to the end only while the user is already there; append new streamed content without fighting manual scrolling and remove the current jitter. (#34) ## 2. Add A2UI local-chat surfaces - Use the public [A2UI protocol](https://a2ui.org/) as the normative reference. Implement its versioned, streaming JSON messages and keep `../bDS2` only as a reference for the research-oriented components and presentation we want. - Define a DS4Server catalog and native Iced renderer for the A2UI Basic Catalog plus useful research surfaces such as charts, tables, metrics, timelines, maps, mind maps, tabs, cards, lists, and forms. - Support `createSurface`, incremental `updateComponents` and `updateDataModel` messages, and `deleteSurface`. The model must be able to add, replace, and update components and data over multiple responses without recreating the whole surface. - Persist A2UI messages with the chat and restore the resulting surfaces after relaunch. Validate messages against the selected catalog, report validation failures back to the model, and retain a readable fallback in the transcript. - Implement catalog-declared local functions and agent events. UI-local edits update the surface immediately; agent events return the action and current data to the conversation so the model can respond with further A2UI updates. The existing approval flow applies only if the resulting agent turn invokes an ordinary side-effecting tool such as shell or file mutation. ## 3. Run local sessions independently - Give each active local session its own agent task so users can switch projects, start another session, and continue working while earlier turns are still active. The shared model owner remains responsible for safe inference scheduling and resident KV state. (#33) - Show active state in the session list, route Stop and queued guidance to the correct session, and isolate failures, tool jobs, approvals, compaction, and checkpoints between sessions. (#33) - Confirm application exit while any session still has generation or tool work in progress. (#33) ## 4. Finish native project and chat controls - Show the active project and Git branch in the chat status area. Add branch selection and safe branch switching in the project directory. (#23) - Add functional File, View, and Help menus; update native menu enabled state from the focused control; complete undo/redo behavior; and make transcript text selectable and copyable. - Explain model/checkpoint mismatches where a session must rebuild context instead of resuming its existing checkpoint. ## 5. Add Dev Brain support - Let the user select one Obsidian vault and give the local agent bounded Markdown search, read, create, and append operations outside project folders. - Load vault-backed skills on demand and advertise their Markdown entry points in the initial local-session prompt. (#6) - Maintain `memory/SOUL.md` and `memory/USER.md` in the vault and include them in new local-session prompts. (#18) ## 6. Expand agent tools - Add configurable structured-search providers while retaining the current browser-backed Google search as a provider. (#20) - Add local stdio and HTTP MCP server configuration and expose connected MCP tools only to local project chat. (#5) - Add a collapsed right sidebar with a project tree, Git status and per-file diffs, plus an inventory of built-in tools, MCP servers, and skills. (#8)