3.0 KiB
DSH AI Supervision Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Add a tool-first AI supervision layer with deterministic auto-remediation and optional human chat to the task center.
Architecture: Keep all mutation in the existing service. Add small Python modules for snapshots, rules, action validation, and an OpenAI-compatible client; connect them to a Qt dialog and the existing error path.
Tech Stack: Python 3.12, dataclasses, urllib, PySide6, pytest.
Spec: docs/superpowers/specs/2026-10-30-dsh-ai-supervision-design.md
Global Constraints
- Model output is advisory JSON and never execution evidence.
- Only fixed allowlisted actions may reach the service.
- Missing model configuration must not disable deterministic supervision.
Task 1: DSH core contracts
Files: Create src/dx_productivity/dsh/__init__.py, snapshot.py, rules.py, actions.py, client.py, supervisor.py; Test tests/dsh/test_core.py.
- Define immutable
TaskSnapshot,Issue,ActionProposal, andChatReplyrecords. - Implement redaction and issue classification with stable JSON-safe dictionaries.
- Implement allowlisted action validation and idempotency keys.
- Implement an OpenAI-compatible HTTP client with strict JSON parsing and a disabled configuration path.
- Implement supervisor event handling that invokes only injected handlers.
- Add tests for redaction, classification, malformed JSON, unknown actions, and retry idempotency.
Task 2: Service adapter and automatic remediation
Files: Create src/dx_productivity/dsh/service_adapter.py; Modify src/dx_productivity/trial_task_center/ui/main_window.py; Test tests/dsh/test_service_adapter.py.
- Adapt
prepare_failed_quick_run,pause_task, and read-only feedback behind fixed action names. - Connect UI error reporting to supervisor observation without changing existing error messages.
- Auto-run only retryable failures and record outcomes.
- Add tests using a fake service and verify duplicate events do not repeat actions.
Task 3: Human assistant panel
Files: Create src/dx_productivity/trial_task_center/ui/dsh_panel.py; Modify main_window.py; Test tests/ui/test_dsh_panel.py.
- Add a compact Qt dialog with issue summary, action cards, chat input, send/stop state, and local audit list.
- Display an explicit unconfigured-model state and keep local actions usable.
- Require confirmation for proposals marked
requires_confirmation. - Cover offscreen rendering and send/response state with fake client.
Task 4: Documentation and regression verification
- Document configuration and limits in
docs/user/dsh-ai-supervision.md. - Run DSH tests and the existing UI/service regression suites.
- Run
python -m compileall srcand record results.