Open source CapCut alternative.
TypeScript
Restore active plans for incomplete run loop and AI harness work
David Lee6d3e4fd07c9
diff --git a/apps/Donkey/Sources/DonkeyRuntime/ActionEngineGuardrails.swift b/apps/Donkey/Sources/DonkeyRuntime/ActionEngineGuardrails.swiftindex 3ef30b47..0c4a84f4 100644--- a/apps/Donkey/Sources/DonkeyRuntime/ActionEngineGuardrails.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/ActionEngineGuardrails.swift@@ -248,14 +248,16 @@ public actor ActionEngineGuardrail {}lastAcceptedCommandAt = command.issuedAt- if (command.holdDurationMS ?? 0) > 0 {- heldCommandIDs.insert(command.id)- }guard configuration.liveInputEnabled else {+ if (command.holdDurationMS ?? 0) > 0 {+ heldCommandIDs.insert(command.id)+ }+return appendTrace(command: command,decision: .projectedDryRun,+ executed: false,focusGuardPassed: true,permissionDecision: permissionDecision,rateLimited: false,@@ -268,6 +270,10 @@ public actor ActionEngineGuardrail {}let backendResult = await inputBackend.execute(command)+ if backendResult.executed, (command.holdDurationMS ?? 0) > 0 {+ heldCommandIDs.insert(command.id)+ }+var metadata = backendResult.metadatametadata["heldInputCount"] = String(heldCommandIDs.count)metadata["liveInputCompletedAt"] = String(backendResult.completedAt.monotonicUptimeNanoseconds)@@ -277,6 +283,8 @@ public actor ActionEngineGuardrail {decision: backendResult.executed? .executedLive: .denied(reason: "live input backend did not execute"),+ executed: backendResult.executed,+ recordedAt: backendResult.completedAt,focusGuardPassed: true,permissionDecision: permissionDecision,rateLimited: false,@@ -313,6 +321,8 @@ public actor ActionEngineGuardrail {private func appendTrace(command: ActionEngineCommand,decision: ActionEngineCommandDecision,+ executed: Bool = false,+ recordedAt: RunTraceTimestamp? = nil,focusGuardPassed: Bool,permissionDecision: ToolCallDecision,rateLimited: Bool,@@ -322,8 +332,8 @@ public actor ActionEngineGuardrail {let trace = ActionEngineCommandTrace(command: command,decision: decision,- recordedAt: command.issuedAt,- executed: false,+ recordedAt: recordedAt ?? command.issuedAt,+ executed: executed,liveInputEnabled: configuration.liveInputEnabled,focusGuardPassed: focusGuardPassed,permissionDecision: permissionDecision,diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/ActionEngineGuardrailTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/ActionEngineGuardrailTests.swiftindex f456231e..9edd2a4c 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/ActionEngineGuardrailTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/ActionEngineGuardrailTests.swift@@ -54,9 +54,33 @@ struct ActionEngineGuardrailTests {#expect(trace.focusGuardPassed == true)#expect(trace.permissionDecision.isAllowed == true)#expect(trace.metadata["liveInputBackend"] == "recording")+ #expect(trace.command.issuedAt.monotonicUptimeNanoseconds == 0)+ #expect(trace.recordedAt.monotonicUptimeNanoseconds == 5_000_000)+ #expect(trace.metadata["liveInputCompletedAt"] == "5000000")#expect(await backend.executedCommandIDs() == ["tap-live"])}+ @Test+ func liveBackendRefusalIsDeniedWithoutRecordingHeldInput() async {+ let engine = ActionEngineGuardrail(+ configuration: ActionEngineConfiguration(liveInputEnabled: true),+ inputBackend: UnavailableActionEngineInputBackend()+ )+ let policy = ToolCallPolicy(deniedCapabilities: [])++ let trace = await engine.handle(+ command(id: "key-live-refused", kind: .key, issuedAtMS: 0, holdDurationMS: 50),+ permissionPolicy: policy+ )++ #expect(trace.decision == .denied(reason: "live input backend did not execute"))+ #expect(trace.executed == false)+ #expect(trace.liveInputEnabled == true)+ #expect(trace.metadata["liveInputBackend"] == "notImplemented")+ #expect(trace.metadata["heldInputCount"] == "0")+ #expect(await engine.heldInputCount() == 0)+ }+@Testfunc focusGuardCanDenyInputCommand() async {let engine = ActionEngineGuardrail(focusGuard: DenyingFocusGuard())@@ -171,7 +195,10 @@ private actor RecordingInputBackend: ActionEngineInputBackend {commandIDs.append(command.id)return ActionEngineInputBackendResult(executed: true,- completedAt: command.issuedAt,+ completedAt: RunTraceTimestamp(+ wallClock: command.issuedAt.wallClock.addingTimeInterval(0.005),+ monotonicUptimeNanoseconds: command.issuedAt.monotonicUptimeNanoseconds + 5_000_000+ ),metadata: ["liveInputBackend": "recording"]diff --git a/docs/README.md b/docs/README.mdindex 65689cb8..25c98cb0 100644--- a/docs/README.md+++ b/docs/README.md@@ -4,7 +4,7 @@ This folder is the product and engineering source of truth for capabilities thatPlans describe what we might build. Guides describe what Donkey currently supports and how to maintain it.-There is currently no active plan in `plans/`. The roadmap-era plans have been moved to `plans/done/` as historical context because they either describe already-supported slices or future work that is not actionable in this repo without a fresh product/target decision.+There is an active milestone plan in `plans/master-plan.md`. It tracks the unfinished work needed before the run-loop and AI-harness roadmap can be considered complete, especially fast local navigation from local model/perception output and a slow planner loop that can use both local and online LLM providers.## Product Guides@@ -20,6 +20,7 @@ There is currently no active plan in `plans/`. The roadmap-era plans have been m- Add a guide here when a plan moves to `plans/done/`.- Treat `plans/done/` as background only; do not use archived plans as active implementation instructions.- Ask before creating a new active plan.+- Move active plans to `plans/done/` only after the behavior is implemented, documented, and verified.- Product guides should explain supported behavior, boundaries, and verification.- Engineering guides should explain patterns current code must follow, not speculative architecture.- Guides should not duplicate implementation. Prefer intent, rules, and concise source entrypoints over code listings or long file inventories.diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.mdindex afd1be69..dfa26896 100644--- a/docs/guides/minimal-run-coordinator.md+++ b/docs/guides/minimal-run-coordinator.md@@ -90,7 +90,7 @@ This is a coordination, in-memory reflex trace, hot-loop contract, deterministic- Keep cheap perception deterministic and compact until real pixel/model adapters exist. Perception may summarize fixture or recorded-frame metadata, but controllers must only see typed signals, world state, and action affordances.- Keep controller fallback explicit. Low confidence, stale signals, missing affordances, and missing signals should produce traceable `wait` or `observe` actions, not silent no-ops.- Keep every chosen controller action trace-linked with action id, state id, frame id, policy name, confidence, rationale, and fallback metadata.-- Keep action-engine commands typed and replayable. Guardrails must run before live input and record permission, focus, rate-limit, hold-duration, release, backend, and execution status.+- Keep action-engine commands typed and replayable. Guardrails must run before live input and record permission, focus, rate-limit, hold-duration, release, backend, issued time, backend completion time, and execution status. Live held-input tracking starts only after the backend reports execution.- Keep live OS input disabled unless a caller explicitly configures live mode, allows input in policy, passes focus guard, and supplies an input backend. The default backend does not synthesize OS events.- Use monotonic timestamps for latency math. Wall-clock timestamps are for human labels and trace correlation only.- Use latency reports for any p50/p95/p99 claim. Reports should include dropped frames, stale actions, tick rates, and worst traces.diff --git a/plans/done/01-latency-budget.md b/plans/01-latency-budget.mdsimilarity index 92%rename from plans/done/01-latency-budget.mdrename to plans/01-latency-budget.mdindex 3664a12b..c8f6ffed 100644--- a/plans/done/01-latency-budget.md+++ b/plans/01-latency-budget.md@@ -1,6 +1,6 @@# Latency Budget-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current reports support synthetic and dry-run traces, but this plan is not complete until p50/p95/p99 budgets are measured for a concrete local-model navigation target.## Targetdiff --git a/plans/done/02-capture-and-perception.md b/plans/02-capture-and-perception.mdsimilarity index 94%rename from plans/done/02-capture-and-perception.mdrename to plans/02-capture-and-perception.mdindex 0fb12366..841e54ae 100644--- a/plans/done/02-capture-and-perception.md+++ b/plans/02-capture-and-perception.md@@ -1,6 +1,6 @@# Capture And Perception-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current capture/perception support includes target-window frames and metadata perception, but not measured local model/OCR/segmentation perception for a concrete target.## Goaldiff --git a/plans/done/03-fast-controller.md b/plans/03-fast-controller.mdsimilarity index 93%rename from plans/done/03-fast-controller.mdrename to plans/03-fast-controller.mdindex f5e1c9cc..01a9de89 100644--- a/plans/done/03-fast-controller.md+++ b/plans/03-fast-controller.md@@ -1,6 +1,6 @@# Fast Controller-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current controller support is deterministic and traceable for metadata/local-navigation dry-runs, but not yet proven against local model perception for a real target.## Goaldiff --git a/plans/done/04-slow-planner.md b/plans/04-slow-planner.mdsimilarity index 90%rename from plans/done/04-slow-planner.mdrename to plans/04-slow-planner.mdindex 23a22431..0933cf00 100644--- a/plans/done/04-slow-planner.md+++ b/plans/04-slow-planner.md@@ -1,6 +1,6 @@# Slow Planner-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current slow-planner support includes snapshots, validation, and hint bus scaffolding, but not a provider-backed local/online LLM planner loop.## Goal@@ -94,4 +94,3 @@ If the planner is slow, unavailable, or wrong:- Planner latency does not affect p95 reflex latency.- Controller can run for at least 30 seconds without planner output.- Planner output is validated before it reaches the controller.-diff --git a/plans/done/05-action-engine.md b/plans/05-action-engine.mdsimilarity index 92%rename from plans/done/05-action-engine.mdrename to plans/05-action-engine.mdindex 59149c0d..28692dc6 100644--- a/plans/done/05-action-engine.md+++ b/plans/05-action-engine.md@@ -1,6 +1,6 @@# Action Engine-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current action-engine support provides guardrails, traces, and injected-backend smoke execution, but not a default live OS input backend with measured input latency.## Goaldiff --git a/plans/done/06-benchmarking.md b/plans/06-benchmarking.mdsimilarity index 97%rename from plans/done/06-benchmarking.mdrename to plans/06-benchmarking.mdindex 118bdb63..e5a4003c 100644--- a/plans/done/06-benchmarking.md+++ b/plans/06-benchmarking.md@@ -1,6 +1,6 @@# Benchmarking And Monitoring-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. Current benchmark support can summarize dry-run traces, but not persistent cross-run trends or concrete local-model target baselines.## Goaldiff --git a/plans/done/19-ai-harness.md b/plans/19-ai-harness.mdsimilarity index 96%rename from plans/done/19-ai-harness.mdrename to plans/19-ai-harness.mdindex c34526a6..84748f1a 100644--- a/plans/done/19-ai-harness.md+++ b/plans/19-ai-harness.md@@ -1,6 +1,6 @@# AI Harness-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. The current repo has OpenAI adapter scaffolding, model routing, memory scaffolding, and an optional slow-planner sidecar, but it does not yet provide a complete slow loop that can use both local and online LLM providers.## Goal@@ -610,10 +610,13 @@ The AI harness foundation now supports the optional slow-path sidecar pieces nee- `ValidatedPlannerHintBus` and `PlannerHintAwareControllerPolicy`, which allow validated hints to advise controller metadata without becoming direct input- tests proving planner latency does not move reflex p95 when the harness runs beside the dry-run loop-## Remaining Future Work+This is not complete slow-loop AI. The current `AIModelProvider` supports only OpenAI, and the sidecar consumes an injected `SlowPlannerHintGenerating` implementation instead of owning a provider-backed local/online planner loop.++## Required Before This Plan Is Done- Add embedding-backed semantic memory retrieval and explicit retrieval budgets.-- Add local/Ollama slow-planner providers behind the same hint-generation boundary if needed.+- Add local/Ollama slow-planner providers behind the same hint-generation boundary.+- Wire the slow planner loop so it can route to local and online providers, apply timeout/failure policy, and publish only validated hints.- Add redaction hooks before any screenshot or DOM summary is sent to a remote provider.- Add aggregate model-call observability reports for latency, schema validity, hint acceptance, cost, and recovery success.- Add memory write proposal decoding directly from provider outputs, then route proposals through the deterministic approver.diff --git a/plans/done/20-off-the-shelf-run-loop.md b/plans/20-off-the-shelf-run-loop.mdsimilarity index 95%rename from plans/done/20-off-the-shelf-run-loop.mdrename to plans/20-off-the-shelf-run-loop.mdindex a54339ce..c269c8a8 100644--- a/plans/done/20-off-the-shelf-run-loop.md+++ b/plans/20-off-the-shelf-run-loop.md@@ -1,6 +1,6 @@# Off-The-Shelf Run Loop-> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.+> Active status: not complete. The current repo supports metadata-only local-navigation dry-run scaffolding and guarded live-action smoke, but not fast local navigation using local detector/OCR/segmentation/model inference for a concrete target.## Goal@@ -429,11 +429,12 @@ The runtime foundation now supports a product-shaped local-navigation slice of t- guarded live-action smoke through an injected backend only after dry-run latency evidence, explicit input policy allowance, and focus guard success- optional slow-planner sidecar that publishes only validated hints without blocking reflex latency-This is still not the full off-the-shelf vision stack. It does not ship real detector/OCR/segmentation adapters, continuous streaming capture, a default OS input backend, high-volume persisted replay traces, or target-specific visual calibration.+This is still not the full off-the-shelf vision stack and must not be treated as completion. It does not ship real local detector/OCR/segmentation/model adapters, continuous streaming capture, a default OS input backend, high-volume persisted replay traces, or target-specific visual calibration.-## Remaining Future Work+## Required Before This Plan Is Done-- Add measured local detector/template/OCR adapters for real visual targets.+- Add measured local detector/template/OCR/segmentation adapters for a real visual target.+- Prove fast local navigation from local perception/model output, not only macOS window metadata or supplied browser-tab metadata.- Add continuous streaming capture once queue-depth, stale-result, and trace sinks are ready for longer sessions.- Add a real macOS input backend behind the existing guardrails only after manual operator safety review.- Add durable high-volume replay trace persistence and target-specific benchmark baselines.diff --git a/plans/done/00-overview.md b/plans/done/00-overview.mdindex ff7ac494..da73c3a5 100644--- a/plans/done/00-overview.md+++ b/plans/done/00-overview.md@@ -10,9 +10,9 @@ iPhone games are the first product focus. Gaming is the latency proof. The large## Archived Plan Status-There is no active master plan in `plans/` right now. Start with `docs/README.md` and the supported behavior guides before changing code.+The active master plan is currently `plans/master-plan.md`. Start with `docs/README.md`, the supported behavior guides, and the active master plan before changing code.-This overview and the related roadmap plans are archived background. They mix completed boundaries with ideas that require a fresh target/product decision, so they should not drive implementation directly.+This overview remains archived background. It mixes completed boundaries with broader roadmap ideas, so it should not override the active master plan.## Near-Term Focus@@ -62,14 +62,14 @@ Every frame should use local, bounded-cost logic:## Plan Breakdown-- [done/manual-target-context-capture-master-plan.md](done/manual-target-context-capture-master-plan.md): completed manual screenshot, Accessibility tree, and trace artifact capture milestone-- [master-plan.md](master-plan.md): current master plan for closing out the off-the-shelf run loop and AI harness milestones-- [01-latency-budget.md](01-latency-budget.md): hard timing budget and optimization priorities-- [02-capture-and-perception.md](02-capture-and-perception.md): screen capture, visual parsing, and world-state updates-- [03-fast-controller.md](03-fast-controller.md): real-time controller design-- [04-slow-planner.md](04-slow-planner.md): slow strategy, recovery, and goal-setting layer-- [05-action-engine.md](05-action-engine.md): low-latency keyboard, mouse, and controller output-- [06-benchmarking.md](06-benchmarking.md): latency measurement, monitoring, traces, and regression gates+- [manual-target-context-capture-master-plan.md](manual-target-context-capture-master-plan.md): completed manual screenshot, Accessibility tree, and trace artifact capture milestone+- [../master-plan.md](../master-plan.md): current master plan for closing out the off-the-shelf run loop and AI harness milestones+- [../01-latency-budget.md](../01-latency-budget.md): hard timing budget and optimization priorities+- [../02-capture-and-perception.md](../02-capture-and-perception.md): screen capture, visual parsing, and world-state updates+- [../03-fast-controller.md](../03-fast-controller.md): real-time controller design+- [../04-slow-planner.md](../04-slow-planner.md): slow strategy, recovery, and goal-setting layer+- [../05-action-engine.md](../05-action-engine.md): low-latency keyboard, mouse, and controller output+- [../06-benchmarking.md](../06-benchmarking.md): latency measurement, monitoring, traces, and regression gates- [07-rollout.md](07-rollout.md): phased delivery path from first supported target to production readiness- [08-dom-parsing.md](08-dom-parsing.md): DOM-driven perception for browser games and web apps- [09-screenshot-model-inference.md](09-screenshot-model-inference.md): screenshot capture into low-latency vision models@@ -82,8 +82,8 @@ Every frame should use local, bounded-cost logic:- [16-iphone-gameplay-roadmap.md](16-iphone-gameplay-roadmap.md): iPhone Mirroring gameplay roadmap- [17-ios-control-prompt.md](17-ios-control-prompt.md): iOS control prompt and PhoneAgent reference- [18-macos-accessibility.md](18-macos-accessibility.md): macOS Accessibility tree/action backend-- [19-ai-harness.md](19-ai-harness.md): slow-path memory, LLM/VLM connection, model routing, and update plan-- [20-off-the-shelf-run-loop.md](20-off-the-shelf-run-loop.md): off-the-shelf perception, deterministic control, and low-latency runtime stack+- [../19-ai-harness.md](../19-ai-harness.md): slow-path memory, LLM/VLM connection, model routing, and update plan+- [../20-off-the-shelf-run-loop.md](../20-off-the-shelf-run-loop.md): off-the-shelf perception, deterministic control, and low-latency runtime stack## System Prioritiesdiff --git a/plans/done/21-swiftui-pointer-ui.md b/plans/done/21-swiftui-pointer-ui.mdindex f64adfd0..ee9ed3b9 100644--- a/plans/done/21-swiftui-pointer-ui.md+++ b/plans/done/21-swiftui-pointer-ui.md@@ -14,8 +14,8 @@ Add the production macOS SwiftUI pointer prompt UI while keeping the future real- The prompt follows the mouse at bottom right by default, flips to the opposite side near screen edges, and stays clamped inside the visible screen.- The active pointer renders with a shadow and supports theme-color customization.- Contracts, UI, runtime boundary, AI boundary, and app entrypoint are separate Swift targets.-- Runtime boundary references `plans/done/20-off-the-shelf-run-loop.md`.-- AI boundary references `plans/done/19-ai-harness.md`.+- Runtime boundary references `plans/20-off-the-shelf-run-loop.md`.+- AI boundary references `plans/19-ai-harness.md`.- No Screen Recording, Accessibility, model calls, capture loop, or input execution is included in this slice.## Acceptancediff --git a/plans/done/master-plan.md b/plans/done/master-plan.mddeleted file mode 100644index 9d54aa70..00000000--- a/plans/done/master-plan.md+++ /dev/null@@ -1,86 +0,0 @@-# Real-Time Run Loop And AI Harness Master Plan--> Archived status: historical context only. This file is not an active implementation queue. Supported behavior lives in `docs/`; future work from this idea needs a fresh active plan created deliberately.--This file was the active task queue for closing out the first local-navigation dry-run, slow-planner sidecar, and guarded live-action smoke milestones. It is now archived.--Historical primary plans:--- `plans/done/20-off-the-shelf-run-loop.md`-- `plans/done/19-ai-harness.md`--Historical supporting plans:--- `plans/done/01-latency-budget.md`-- `plans/done/02-capture-and-perception.md`-- `plans/done/03-fast-controller.md`-- `plans/done/04-slow-planner.md`-- `plans/done/05-action-engine.md`-- `plans/done/06-benchmarking.md`--Supported behavior and engineering guidance belong in `docs/guides/`. There is no active queue in this archived file.--## Plan Management Note--This file is no longer the active queue. New work should start from `docs/README.md`, current guides, and code reality. If a future milestone needs plan coordination, create a fresh active plan deliberately instead of treating this archived roadmap as an implementation list.--## Milestone Goal--Build the first product-shaped loop where Donkey can run a local navigation session with bounded reflex behavior and an optional slow AI sidecar:--```text-local desktop/window/browser context- -> focused capture / Accessibility / browser-tab metadata- -> local perception or cheap metadata/template signal- -> compact world state- -> deterministic navigation controller- -> dry-run action trace first, guarded live action later- -> latency report and replayable trace--slow AI harness- -> compact snapshot- -> model router- -> structured planner hint- -> validated hint bus- -> scoped memory proposal-```--The hot path must continue to work with the AI harness disabled.--## Supported Boundary--- Runtime shell: minimal run coordination, ordered events, bounded context assembly, local run artifacts, manual target context capture, in-memory reflex trace retention, and stage-split latency reports are supported.-- Reflex hot path: typed frame/world-state/action contracts, deterministic dry-run loop, bounded target-window frame source, cheap metadata perception, swappable world-state projection, deterministic controller, loop-integrated metadata-only local-navigation dry-run action selection, optional caller-supplied browser-tab metadata, and dry-run action projection are supported. Live OS input is not supported.-- Safety boundary: action-engine command contracts, permission/focus/rate/hold/release guardrails, guarded live-action smoke with an injected backend, and replayable command traces are supported before any default OS input backend exists.-- Slow AI boundary: structured planner hints, validation/expiry/latest-valid selection, loop-adjacent slow-planner trigger/snapshot sidecar, model registry/router, an OpenAI Responses structured-output adapter, source-linked memory, and replay/eval scaffolding are supported as optional sidecar pieces. The hot loop still runs without AI output.-- Source of truth: detailed supported behavior lives in `docs/guides/minimal-run-coordinator.md`; historical implementation details should be found with search in `docs/`, `plans/`, and git history, not duplicated here.--## Non-Negotiable Rules--- No remote model call, chat LLM call, or general VLM call may be required for a reflex tick.-- The reflex path uses latest-frame-wins queues; stale frames are dropped and counted.-- The controller consumes typed world state, not raw screenshots.-- The action engine owns OS input; controller policies emit semantic commands only.-- Input starts in dry-run mode. Live input requires policy allowance, focus guard success, and emergency release support.-- Planner output is a validated, expiring hint. It is never direct input.-- Latency claims require monotonic timestamps and a report.-- Full-resolution snapshots, screenshots for AI, and memory writes stay outside the reflex loop.--## Archived Closeout--The first supported local-navigation runtime slice is documented in `docs/guides/minimal-run-coordinator.md`. The broader roadmap material was moved to `plans/done/` as historical context because its remaining future work is not actionable without a fresh target/product decision.--## What Should Be Done Next--Start with `docs/README.md`. If new work is needed, create a fresh active plan deliberately instead of reviving this archived queue.--## Closeout Outcome--This roadmap is archived because the supported slice is now documented and the remaining ambitions need a fresh target/product decision before they are actionable. The grounded repo state is:--- Fast local navigation can run end to end in dry-run mode.-- Guarded live-action smoke exists only behind dry-run success, latency evidence, policy, focus, and an injected backend.-- Capture, perception, controller, action projection, and input stages use monotonic timing metadata where supported.-- The hot loop works with the AI harness disabled.-- Planner hints, model routing, memory scaffolding, replay/eval scaffolding, and slow-planner sidecar pieces are optional boundaries, not reflex-loop requirements.-- Historical plans are archived in `plans/done/`.diff --git a/plans/master-plan.md b/plans/master-plan.mdnew file mode 100644index 00000000..60fc0c10--- /dev/null+++ b/plans/master-plan.md@@ -0,0 +1,94 @@+# Real-Time Run Loop And AI Harness Master Plan++This is the active task queue again. A past archive commit closed this roadmap too early: the repo has a useful dry-run/local-navigation scaffold and slow-planner sidecar pieces, but the critical features are not complete yet.++Primary plans:++- `plans/20-off-the-shelf-run-loop.md`+- `plans/19-ai-harness.md`++Supporting plans:++- `plans/01-latency-budget.md`+- `plans/02-capture-and-perception.md`+- `plans/03-fast-controller.md`+- `plans/04-slow-planner.md`+- `plans/05-action-engine.md`+- `plans/06-benchmarking.md`++Supported behavior and engineering guidance belong in `docs/guides/`. This file tracks what is still needed before those active plans can move to `plans/done/`.++## Plan Management Note++Keep this queue grounded in code reality. Move a plan to `plans/done/` only after the relevant behavior is implemented, documented, and verified. If a slice is only scaffolding, dry-run, or provider-specific, call that out here instead of treating it as completion.++## Milestone Goal++Build the first product-shaped loop where Donkey can run a local navigation session with bounded reflex behavior and an optional slow AI sidecar:++```text+local desktop/window/browser context+ -> focused capture / Accessibility / browser-tab metadata+ -> local perception or cheap metadata/template signal+ -> compact world state+ -> deterministic navigation controller+ -> dry-run action trace first, guarded live action later+ -> latency report and replayable trace++slow AI harness+ -> compact snapshot+ -> model router+ -> structured planner hint+ -> validated hint bus+ -> scoped memory proposal+```++The hot path must continue to work with the AI harness disabled.++## Supported Boundary++- Runtime shell: minimal run coordination, ordered events, bounded context assembly, local run artifacts, manual target context capture, in-memory reflex trace retention, and stage-split latency reports are supported.+- Reflex hot path: typed frame/world-state/action contracts, deterministic dry-run loop, bounded target-window frame source, cheap metadata perception, swappable world-state projection, deterministic controller, loop-integrated metadata-only local-navigation dry-run action selection, optional caller-supplied browser-tab metadata, and dry-run action projection are supported. This is not yet fast local navigation using local vision/model inference.+- Safety boundary: action-engine command contracts, permission/focus/rate/hold/release guardrails, guarded live-action smoke with an injected backend, and replayable command traces are supported before any default OS input backend exists.+- Slow AI boundary: structured planner hints, validation/expiry/latest-valid selection, loop-adjacent slow-planner trigger/snapshot sidecar, model registry/router, an OpenAI Responses structured-output adapter, source-linked memory, and replay/eval scaffolding are supported as optional sidecar pieces. This is not yet a complete slow loop using both local and online LLM providers.+- Source of truth: detailed supported behavior lives in `docs/guides/minimal-run-coordinator.md`; active unfinished work lives in this plan and its primary/supporting plans.++## Non-Negotiable Rules++- No remote model call, chat LLM call, or general VLM call may be required for a reflex tick.+- The reflex path uses latest-frame-wins queues; stale frames are dropped and counted.+- The controller consumes typed world state, not raw screenshots.+- The action engine owns OS input; controller policies emit semantic commands only.+- Input starts in dry-run mode. Live input requires policy allowance, focus guard success, and emergency release support.+- Planner output is a validated, expiring hint. It is never direct input.+- Latency claims require monotonic timestamps and a report.+- Full-resolution snapshots, screenshots for AI, and memory writes stay outside the reflex loop.++## Current Reality From Commit Review++Recent commits completed these pieces:++- `9b160f8` and `201e76c`: metadata-only local-navigation dry-run, local-navigation controller contracts, memory/replay scaffolding.+- `0e21088`: OpenAI Responses adapter, planner hint contracts, model registry/router scaffolding.+- `9bebfbb`: slow-planner sidecar trigger/snapshot/hint bus and guarded live-action smoke boundary.+- `d6e48c9`: archived plans, which was premature for this milestone.++The code does not yet include local detector/OCR/segmentation/model inference adapters, continuous local-model navigation, a default OS input backend, a local LLM provider, or a provider-backed slow planner loop that can choose between local and online models.++## What Should Be Done Next++1. Implement fast local navigation with local perception/model evidence, not only window/browser metadata.+2. Implement a slow planner loop that can call both an online provider and a local provider behind the same validated hint boundary.+3. Add benchmark/reporting evidence that local perception, controller, action projection, and input stages meet the target p95 budgets for a concrete target.+4. Keep the current dry-run/guarded-live safety boundary: local or online LLM output can only become validated hints, never direct input.++## Completion Gates++Do not move the primary/supporting plans back to `plans/done/` until:++- Fast local navigation runs from local model/perception output for at least one concrete target, with no remote model dependency in the reflex trace.+- The slow loop can generate validated planner hints through an online LLM provider and a local LLM provider, with strict timeout/failure behavior.+- The hot loop continues to run when the slow AI harness is disabled or failing.+- p50/p95/p99 reports cover capture, preprocessing, local model inference/perception, state update, controller, action projection, and input.+- Action traces can explain state, model/perception evidence, selected rule, validated hint influence, and guardrail decisions.+- The relevant guide in `docs/guides/` documents the supported behavior and boundaries.