返回 DeepSeek-Reasonix
2026-06-29-autoresearch-runtime-implementation.md
根目录 / docs / superpowers / plans / 2026-06-29-autoresearch-runtime-implementation.md
1 # AutoResearch Runtime Implementation Plan
2
3 > Superseded historical plan. The standalone runtime and desktop surfaces were
4 > later removed in favor of the unified Goal runtime.
5
6 > **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.
7
8 **Goal:** Implement the host-managed AutoResearch runtime from the design spec, including durable state, controller integration, desktop API, and frontend visibility.
9
10 **Architecture:** Add `internal/autoresearch` as the source of truth for task state under `.reasonix/autoresearch/<task-id>/`. Goal controller code creates, resumes, summarizes, heartbeats, and gates completion through that package. Desktop and frontend read compact status metadata for the active tab and fetch heavier details on demand.
11
12 **Tech Stack:** Go standard library, existing `internal/control` goal FSM, desktop Wails bindings, React/TypeScript frontend, existing Go and frontend test runners.
13
14 ---
15
16 ## Implementation Tasks
17
18 ### Task 1: AutoResearch Store And Schema
19
20 **Files:**
21 - Create: `internal/autoresearch/task.go`
22 - Create: `internal/autoresearch/store.go`
23 - Create: `internal/autoresearch/schema.go`
24 - Create: `internal/autoresearch/store_test.go`
25
26 - [ ] Write failing tests that prove `CreateTask` creates `.reasonix/autoresearch/<task-id>/state` and `logs`, writes `task_spec.json`, `progress.json`, empty JSONL files, and validates required fields.
27 - [ ] Run: `go test ./internal/autoresearch -run 'TestCreateTask|TestValidateTask' -count=1`
28 - [ ] Implement types, task id generation, atomic JSON writes, JSONL append validation, `CreateTask`, `LoadTask`, `ValidateTask`.
29 - [ ] Run: `go test ./internal/autoresearch -count=1`
30
31 ### Task 2: Findings, Directions, Summary, Readiness
32
33 **Files:**
34 - Create: `internal/autoresearch/summary.go`
35 - Create: `internal/autoresearch/readiness.go`
36 - Modify: `internal/autoresearch/store.go`
37 - Modify: `internal/autoresearch/store_test.go`
38
39 - [ ] Write failing tests for `AppendFinding`, `RecordDirection`, stale/pivot thresholds, `Summary`, and `Readiness`.
40 - [ ] Run: `go test ./internal/autoresearch -run 'TestAppendFinding|TestRecordDirection|TestReadiness|TestSummary' -count=1`
41 - [ ] Implement accepted evidence lookup, direction fingerprint tracking, stale count updates, pivot requirement, readiness blocking, and compact summary generation.
42 - [ ] Run: `go test ./internal/autoresearch -count=1`
43
44 ### Task 3: Goal Controller Runtime Integration
45
46 **Files:**
47 - Modify: `internal/control/goal.go`
48 - Modify: `internal/control/input.go`
49 - Modify: `internal/control/controller.go`
50 - Modify: `internal/control/turn_orchestrator.go`
51 - Modify: `internal/control/goal_test.go`
52 - Modify: `internal/control/input_test.go`
53
54 - [ ] Write failing tests that `/goal --research` creates or resumes an AutoResearch task and stores `AutoResearchTaskID` in persisted goal state.
55 - [ ] Write failing tests that `Compose` injects a host-generated `<autoresearch-runtime>` summary only in the current user turn.
56 - [ ] Write failing tests that goal completion is intercepted when AutoResearch readiness fails.
57 - [ ] Run targeted control tests for the new cases.
58 - [ ] Implement store wiring, create/resume, heartbeat hooks, runtime summary injection, and readiness intercept.
59 - [ ] Run: `go test ./internal/control -count=1`
60
61 ### Task 4: Desktop API Surface
62
63 **Files:**
64 - Modify: `desktop/app.go`
65 - Modify: `desktop/tabs.go`
66 - Modify: `desktop/app_test.go`
67 - Modify: `desktop/tab_profile_test.go`
68
69 - [ ] Write failing tests for `AutoResearchStatus`, `AutoResearchCurrent`, `AutoResearchFindings`, and compact tab metadata.
70 - [ ] Implement view structs and methods that call `internal/autoresearch` without parsing prompt text.
71 - [ ] Ensure findings are capped and loaded on demand.
72 - [ ] Run: `go test ./desktop -run 'AutoResearch|MetaReports' -count=1`
73
74 ### Task 5: Frontend Status And Detail UI
75
76 **Files:**
77 - Modify: `desktop/frontend/src/lib/statusBarItems.ts`
78 - Modify: `desktop/frontend/src/components/StatusBar.tsx`
79 - Modify: `desktop/frontend/src/components/ContextPanel.tsx`
80 - Modify: `desktop/frontend/src/bridge.ts`
81 - Modify: `desktop/frontend/src/__tests__/statusbar-workspace.test.tsx`
82 - Add frontend tests for AutoResearch detail rendering.
83
84 - [ ] Write failing frontend tests for hidden chip, running/pivot/blocked labels, opening the detail panel, and rendering loaded findings.
85 - [ ] Implement compact status chip, tooltip, detail section, refresh hooks, and on-demand findings loading.
86 - [ ] Run: `pnpm --dir desktop/frontend test`
87
88 ### Task 6: End-To-End Verification
89
90 **Files:**
91 - Update generated Wails bindings if required.
92 - No broad refactors.
93
94 - [ ] Run: `go test ./internal/autoresearch ./internal/control ./desktop -count=1`
95 - [ ] Run: `pnpm --dir desktop/frontend test`
96 - [ ] Run the desktop app through the project dev command when feasible and manually verify a research goal shows the chip and panel state.
97 - [ ] Audit each design-spec goal against implementation and record remaining gaps before marking the goal complete.
98
98 lines MARKDOWN