# Todo 11 Prompt Workspace Plan **Status:** done ## Result Implemented by subagent and committed as `ee2334f feat: add prompt workspace persistence`. Main-session verification: ```bash uv run pytest tests/test_websocket_api.py uv run pytest ``` Results: - focused static/WebSocket tests: `14 passed, 1 warning in 0.23s` - full suite: `25 passed, 1 warning in 0.18s` ## Goal Improve prompt and pre-message editing with browser-side persistence and reusable prompt sets. ## Why The original requirement expects editing multiple system prompts and pre-messages. The MVP supports editing them, but every refresh loses the setup. A local prompt workspace lets a debugger quickly switch between prompt configurations without introducing a backend database. ## Scope This todo covers: - Browser-side prompt set save/load/delete using `localStorage`. - Saving system prompts, pre-messages, and current ChatAgent/EventAgent parameter values. - A small UI section for prompt set name, saved-set selector, save, load, and delete. - Tests that verify the static page exposes prompt workspace controls and JS uses stable storage keys. This todo does not cover: - Server-side persistence. - Sharing prompt sets between users. - Import/export files. - Rich prompt templating. ## Files - Modify: `src/agent_lab/presentation/static/index.html` - Modify: `src/agent_lab/presentation/static/app.js` - Modify: `src/agent_lab/presentation/static/styles.css` only if needed for compact layout. - Modify/add tests, preferably `tests/test_websocket_api.py` or a new focused static UI test. - Do not modify: `docs/plans/todos.md`. ## Design Use `localStorage` key `agent-lab.prompt-sets.v1`. Store JSON: ```json { "sets": { "default debugger": { "system_prompts": ["..."], "pre_messages": [{"role": "user", "content": "..."}], "chat_agent": {"model": "", "temperature": 0.2, "max_tokens": 800}, "event_agent": {"enabled_tools": ["handoff_note"], "max_event_loops": 3} } } } ``` The UI should include: - prompt set name input; - saved set selector; - save button; - load button; - delete button. Saving reads the current form. Loading restores fields and tool checkboxes after tools are loaded. Deleting removes the selected set. ## Steps 1. Add failing static tests for: - `index.html` contains prompt workspace controls. - `app.js` contains `agent-lab.prompt-sets.v1` and functions for save/load/delete. 2. Implement prompt workspace controls in HTML. 3. Implement localStorage helpers in JS. 4. Ensure loading a prompt set can restore dynamic tool checkboxes after `/api/tools` finishes. 5. Run: ```bash uv run pytest tests/test_websocket_api.py uv run pytest ``` 6. If successful, commit implementation files only with message: ```bash git commit -m "feat: add prompt workspace persistence" ``` ## Verification Expected result: - Static tests prove controls and storage key exist. - Existing WebSocket/API tests still pass. - Full suite passes.