Open source CapCut alternative.
TypeScript
Add reflex trace latency contracts
David Le2b0c1116dd74
diff --git a/apps/Donkey/Sources/DonkeyContracts/RunLoopContracts.swift b/apps/Donkey/Sources/DonkeyContracts/RunLoopContracts.swiftindex ce2a122c..989d4a42 100644--- a/apps/Donkey/Sources/DonkeyContracts/RunLoopContracts.swift+++ b/apps/Donkey/Sources/DonkeyContracts/RunLoopContracts.swift@@ -154,17 +154,20 @@ public struct ReflexRunEvent: Codable, Equatable, Sendable {public var frameID: String?public var stateID: String?public var actionID: String?+ public var latency: ReflexLatencyBreakdown?public var sampled: Boolpublic init(frameID: String? = nil,stateID: String? = nil,actionID: String? = nil,+ latency: ReflexLatencyBreakdown? = nil,sampled: Bool = true) {self.frameID = frameIDself.stateID = stateIDself.actionID = actionID+ self.latency = latencyself.sampled = sampled}}@@ -289,6 +292,159 @@ public struct RunTraceTimestamp: Codable, Equatable, Sendable {self.wallClock = wallClockself.monotonicUptimeNanoseconds = monotonicUptimeNanoseconds}++ public func milliseconds(until later: RunTraceTimestamp) -> Double? {+ guard later.monotonicUptimeNanoseconds >= monotonicUptimeNanoseconds else {+ return nil+ }++ let elapsedNanoseconds = later.monotonicUptimeNanoseconds - monotonicUptimeNanoseconds+ return Double(elapsedNanoseconds) / 1_000_000+ }+}++public struct ReflexTraceTimeline: Codable, Equatable, Sendable {+ public var captureStart: RunTraceTimestamp?+ public var captureEnd: RunTraceTimestamp?+ public var preprocessStart: RunTraceTimestamp?+ public var preprocessEnd: RunTraceTimestamp?+ public var modelStart: RunTraceTimestamp?+ public var modelEnd: RunTraceTimestamp?+ public var perceptionStart: RunTraceTimestamp?+ public var perceptionEnd: RunTraceTimestamp?+ public var statePublished: RunTraceTimestamp?+ public var controllerStart: RunTraceTimestamp?+ public var controllerEnd: RunTraceTimestamp?+ public var actionEnqueued: RunTraceTimestamp?+ public var inputExecuted: RunTraceTimestamp?++ public init(+ captureStart: RunTraceTimestamp? = nil,+ captureEnd: RunTraceTimestamp? = nil,+ preprocessStart: RunTraceTimestamp? = nil,+ preprocessEnd: RunTraceTimestamp? = nil,+ modelStart: RunTraceTimestamp? = nil,+ modelEnd: RunTraceTimestamp? = nil,+ perceptionStart: RunTraceTimestamp? = nil,+ perceptionEnd: RunTraceTimestamp? = nil,+ statePublished: RunTraceTimestamp? = nil,+ controllerStart: RunTraceTimestamp? = nil,+ controllerEnd: RunTraceTimestamp? = nil,+ actionEnqueued: RunTraceTimestamp? = nil,+ inputExecuted: RunTraceTimestamp? = nil+ ) {+ self.captureStart = captureStart+ self.captureEnd = captureEnd+ self.preprocessStart = preprocessStart+ self.preprocessEnd = preprocessEnd+ self.modelStart = modelStart+ self.modelEnd = modelEnd+ self.perceptionStart = perceptionStart+ self.perceptionEnd = perceptionEnd+ self.statePublished = statePublished+ self.controllerStart = controllerStart+ self.controllerEnd = controllerEnd+ self.actionEnqueued = actionEnqueued+ self.inputExecuted = inputExecuted+ }++ public func latencyBreakdown() -> ReflexLatencyBreakdown {+ ReflexLatencyBreakdown(+ captureMS: milliseconds(from: captureStart, to: captureEnd),+ preprocessMS: milliseconds(from: preprocessStart, to: preprocessEnd),+ modelInferenceMS: milliseconds(from: modelStart, to: modelEnd),+ perceptionMS: milliseconds(from: perceptionStart, to: perceptionEnd),+ decisionMS: milliseconds(from: controllerStart, to: controllerEnd),+ inputMS: milliseconds(from: actionEnqueued, to: inputExecuted),+ softwareLoopMS: milliseconds(from: captureEnd, to: inputExecuted),+ frameAgeMS: milliseconds(from: captureEnd, to: controllerStart),+ stateAgeMS: milliseconds(from: statePublished, to: inputExecuted)+ )+ }++ private func milliseconds(+ from start: RunTraceTimestamp?,+ to end: RunTraceTimestamp?+ ) -> Double? {+ guard let start, let end else { return nil }+ return start.milliseconds(until: end)+ }+}++public struct ReflexLatencyBreakdown: Codable, Equatable, Sendable {+ public var captureMS: Double?+ public var preprocessMS: Double?+ public var modelInferenceMS: Double?+ public var perceptionMS: Double?+ public var decisionMS: Double?+ public var inputMS: Double?+ public var softwareLoopMS: Double?+ public var frameAgeMS: Double?+ public var stateAgeMS: Double?++ public init(+ captureMS: Double? = nil,+ preprocessMS: Double? = nil,+ modelInferenceMS: Double? = nil,+ perceptionMS: Double? = nil,+ decisionMS: Double? = nil,+ inputMS: Double? = nil,+ softwareLoopMS: Double? = nil,+ frameAgeMS: Double? = nil,+ stateAgeMS: Double? = nil+ ) {+ self.captureMS = captureMS+ self.preprocessMS = preprocessMS+ self.modelInferenceMS = modelInferenceMS+ self.perceptionMS = perceptionMS+ self.decisionMS = decisionMS+ self.inputMS = inputMS+ self.softwareLoopMS = softwareLoopMS+ self.frameAgeMS = frameAgeMS+ self.stateAgeMS = stateAgeMS+ }+}++public struct ReflexTraceRecord: Codable, Equatable, Sendable {+ public var traceID: String+ public var frameID: String+ public var stateID: String+ public var actionID: String?+ public var timestamps: ReflexTraceTimeline+ public var latencyBreakdown: ReflexLatencyBreakdown+ public var controllerPolicy: String?+ public var confidence: Double?+ public var plannerHintID: String?+ public var machineProfile: String?+ public var buildID: String?+ public var metadata: [String: String]++ public init(+ traceID: String,+ frameID: String,+ stateID: String,+ actionID: String? = nil,+ timestamps: ReflexTraceTimeline,+ controllerPolicy: String? = nil,+ confidence: Double? = nil,+ plannerHintID: String? = nil,+ machineProfile: String? = nil,+ buildID: String? = nil,+ metadata: [String: String] = [:]+ ) {+ self.traceID = traceID+ self.frameID = frameID+ self.stateID = stateID+ self.actionID = actionID+ self.timestamps = timestamps+ self.latencyBreakdown = timestamps.latencyBreakdown()+ self.controllerPolicy = controllerPolicy+ self.confidence = confidence+ self.plannerHintID = plannerHintID+ self.machineProfile = machineProfile+ self.buildID = buildID+ self.metadata = metadata+ }}public enum RunArtifactKind: String, Codable, Equatable, Sendable {diff --git a/apps/Donkey/Sources/DonkeyRuntime/InMemoryReflexTraceStore.swift b/apps/Donkey/Sources/DonkeyRuntime/InMemoryReflexTraceStore.swiftnew file mode 100644index 00000000..59c1a958--- /dev/null+++ b/apps/Donkey/Sources/DonkeyRuntime/InMemoryReflexTraceStore.swift@@ -0,0 +1,34 @@+import DonkeyContracts+import Foundation++public actor InMemoryReflexTraceStore {+ private let maxRecords: Int+ private var records: [ReflexTraceRecord] = []++ public init(maxRecords: Int = 300) {+ self.maxRecords = max(1, maxRecords)+ }++ @discardableResult+ public func append(_ record: ReflexTraceRecord) -> ReflexTraceRecord {+ records.append(record)++ if records.count > maxRecords {+ records.removeFirst(records.count - maxRecords)+ }++ return record+ }++ public func allRecords() -> [ReflexTraceRecord] {+ records+ }++ public func latestRecord() -> ReflexTraceRecord? {+ records.last+ }++ public func count() -> Int {+ records.count+ }+}diff --git a/apps/Donkey/Sources/DonkeyRuntime/RunCoordinator.swift b/apps/Donkey/Sources/DonkeyRuntime/RunCoordinator.swiftindex 5ab4249c..e782f250 100644--- a/apps/Donkey/Sources/DonkeyRuntime/RunCoordinator.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/RunCoordinator.swift@@ -4,6 +4,7 @@ import Foundationpublic actor RunCoordinator {private let sessionQueue: LatestRunSessionQueueprivate let eventStore: InMemoryRunEventStore+ private let reflexTraceStore: InMemoryReflexTraceStoreprivate let contextAssembler: RunContextAssemblerprivate var currentSession: RunSession?private var lifecycleState: RunLifecycleState = .idle@@ -13,10 +14,12 @@ public actor RunCoordinator {public init(sessionQueue: LatestRunSessionQueue = LatestRunSessionQueue(),eventStore: InMemoryRunEventStore = InMemoryRunEventStore(),+ reflexTraceStore: InMemoryReflexTraceStore = InMemoryReflexTraceStore(),contextAssembler: RunContextAssembler = RunContextAssembler()) {self.sessionQueue = sessionQueueself.eventStore = eventStore+ self.reflexTraceStore = reflexTraceStoreself.contextAssembler = contextAssembler}@@ -152,6 +155,32 @@ public actor RunCoordinator {)}+ @discardableResult+ public func appendReflexTrace(+ _ record: ReflexTraceRecord,+ sampled: Bool = true+ ) async -> RunEvent {+ await reflexTraceStore.append(record)++ return await eventStore.append(+ RunEvent(+ stream: .reflex,+ summary: "Reflex trace recorded",+ payload: .reflex(+ ReflexRunEvent(+ frameID: record.frameID,+ stateID: record.stateID,+ actionID: record.actionID,+ latency: record.latencyBreakdown,+ sampled: sampled+ )+ ),+ traceID: record.traceID,+ metadata: reflexMetadata(for: record)+ )+ )+ }+public func buildContext(latestWorldState: RunWorldStateSummary? = nil,transcriptSummary: String = "",@@ -188,6 +217,14 @@ public actor RunCoordinator {await eventStore.allEvents()}+ public func reflexTraces() async -> [ReflexTraceRecord] {+ await reflexTraceStore.allRecords()+ }++ public func latestReflexTrace() async -> ReflexTraceRecord? {+ await reflexTraceStore.latestRecord()+ }+private func transition(to state: RunLifecycleState,reason: String?,@@ -247,6 +284,26 @@ public actor RunCoordinator {return "Run failed"}}++ private func reflexMetadata(for record: ReflexTraceRecord) -> [String: String] {+ var metadata = record.metadata++ metadata["reflex.frameID"] = record.frameID+ metadata["reflex.stateID"] = record.stateID+ metadata["reflex.actionID"] = record.actionID+ metadata["reflex.controllerPolicy"] = record.controllerPolicy+ metadata["reflex.plannerHintID"] = record.plannerHintID+ metadata["reflex.machineProfile"] = record.machineProfile+ metadata["reflex.buildID"] = record.buildID++ if let confidence = record.confidence {+ metadata["reflex.confidence"] = String(confidence)+ }++ metadata.merge(record.latencyBreakdown.metadata) { current, _ in current }++ return metadata+ }}private extension ToolCallDecision {@@ -261,3 +318,21 @@ private extension ToolCallDecision {}}}++private extension ReflexLatencyBreakdown {+ var metadata: [String: String] {+ var values: [String: String] = [:]++ values["latency.captureMS"] = captureMS.map { String($0) }+ values["latency.preprocessMS"] = preprocessMS.map { String($0) }+ values["latency.modelInferenceMS"] = modelInferenceMS.map { String($0) }+ values["latency.perceptionMS"] = perceptionMS.map { String($0) }+ values["latency.decisionMS"] = decisionMS.map { String($0) }+ values["latency.inputMS"] = inputMS.map { String($0) }+ values["latency.softwareLoopMS"] = softwareLoopMS.map { String($0) }+ values["latency.frameAgeMS"] = frameAgeMS.map { String($0) }+ values["latency.stateAgeMS"] = stateAgeMS.map { String($0) }++ return values+ }+}diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/ReflexTraceTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/ReflexTraceTests.swiftnew file mode 100644index 00000000..a1499e9c--- /dev/null+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/ReflexTraceTests.swift@@ -0,0 +1,130 @@+import DonkeyContracts+@testable import DonkeyRuntime+import Foundation+import Testing++@Suite+struct ReflexTraceTests {+ @Test+ func latencyBreakdownUsesMonotonicTimestamps() {+ let timeline = ReflexTraceTimeline(+ captureStart: timestamp(0),+ captureEnd: timestamp(4),+ preprocessStart: timestamp(4),+ preprocessEnd: timestamp(7),+ modelStart: timestamp(7),+ modelEnd: timestamp(16),+ perceptionStart: timestamp(4),+ perceptionEnd: timestamp(18),+ statePublished: timestamp(19),+ controllerStart: timestamp(24),+ controllerEnd: timestamp(27),+ actionEnqueued: timestamp(28),+ inputExecuted: timestamp(31)+ )++ let breakdown = timeline.latencyBreakdown()++ #expect(breakdown.captureMS == 4)+ #expect(breakdown.preprocessMS == 3)+ #expect(breakdown.modelInferenceMS == 9)+ #expect(breakdown.perceptionMS == 14)+ #expect(breakdown.decisionMS == 3)+ #expect(breakdown.inputMS == 3)+ #expect(breakdown.softwareLoopMS == 27)+ #expect(breakdown.frameAgeMS == 20)+ #expect(breakdown.stateAgeMS == 12)+ }++ @Test+ func reflexTraceStoreKeepsLatestRecordsWithinCapacity() async {+ let store = InMemoryReflexTraceStore(maxRecords: 2)++ await store.append(record(traceID: "trace-1", frameID: "frame-1"))+ await store.append(record(traceID: "trace-2", frameID: "frame-2"))+ await store.append(record(traceID: "trace-3", frameID: "frame-3"))++ let records = await store.allRecords()++ #expect(records.map(\.traceID) == ["trace-2", "trace-3"])+ #expect(await store.count() == 2)+ #expect(await store.latestRecord()?.frameID == "frame-3")+ }++ @Test+ func coordinatorRecordsReflexTraceAndPublishesLatencyEvent() async {+ let coordinator = RunCoordinator()+ let trace = record(+ traceID: "trace-reflex",+ frameID: "frame-9",+ stateID: "state-9",+ actionID: "action-9",+ controllerPolicy: "dodge-lane",+ confidence: 0.875,+ plannerHintID: "hint-1",+ machineProfile: "apple-silicon",+ buildID: "debug"+ )++ let event = await coordinator.appendReflexTrace(trace)++ #expect(event.stream == .reflex)+ #expect(event.traceID == "trace-reflex")+ #expect(event.metadata["reflex.frameID"] == "frame-9")+ #expect(event.metadata["reflex.controllerPolicy"] == "dodge-lane")+ #expect(event.metadata["latency.softwareLoopMS"] == "27.0")++ guard case .reflex(let payload) = event.payload else {+ Issue.record("Expected reflex payload")+ return+ }++ #expect(payload.frameID == "frame-9")+ #expect(payload.stateID == "state-9")+ #expect(payload.actionID == "action-9")+ #expect(payload.latency?.softwareLoopMS == 27)++ #expect(await coordinator.reflexTraces() == [trace])+ #expect(await coordinator.latestReflexTrace() == trace)+ }++ private func record(+ traceID: String,+ frameID: String,+ stateID: String = "state-1",+ actionID: String? = nil,+ controllerPolicy: String? = nil,+ confidence: Double? = nil,+ plannerHintID: String? = nil,+ machineProfile: String? = nil,+ buildID: String? = nil+ ) -> ReflexTraceRecord {+ ReflexTraceRecord(+ traceID: traceID,+ frameID: frameID,+ stateID: stateID,+ actionID: actionID,+ timestamps: ReflexTraceTimeline(+ captureStart: timestamp(0),+ captureEnd: timestamp(4),+ statePublished: timestamp(19),+ controllerStart: timestamp(24),+ controllerEnd: timestamp(27),+ actionEnqueued: timestamp(28),+ inputExecuted: timestamp(31)+ ),+ controllerPolicy: controllerPolicy,+ confidence: confidence,+ plannerHintID: plannerHintID,+ machineProfile: machineProfile,+ buildID: buildID+ )+ }++ private func timestamp(_ milliseconds: UInt64) -> RunTraceTimestamp {+ RunTraceTimestamp(+ wallClock: Date(timeIntervalSince1970: Double(milliseconds) / 1_000),+ monotonicUptimeNanoseconds: milliseconds * 1_000_000+ )+ }+}diff --git a/docs/README.md b/docs/README.mdindex 4f284393..569b0720 100644--- a/docs/README.md+++ b/docs/README.md@@ -11,7 +11,7 @@ Plans describe what we might build. Guides describe what Donkey currently suppor## Engineering Guides- [Swift MVC Guide](guides/swift-mvc.md): Swift/AppKit/SwiftUI organization rules for model-view-controller boundaries.-- [Minimal Run Coordinator](guides/minimal-run-coordinator.md): in-memory run lifecycle, events, policy checks, session queueing, and context compaction boundary.+- [Minimal Run Coordinator](guides/minimal-run-coordinator.md): in-memory run lifecycle, events, policy checks, session queueing, context compaction, manual capture orchestration, and reflex trace boundary.## Navigation Rulesdiff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.mdindex 34e4f9de..eb3a6155 100644--- a/docs/guides/minimal-run-coordinator.md+++ b/docs/guides/minimal-run-coordinator.md@@ -14,6 +14,8 @@ The coordinator can:- mark aborts and timeouts as requiring held-input release- build bounded planner context from the current session, world-state summary, transcript summary, valid hints, and recent failures+Donkey also supports the first real reflex trace shape for the off-the-shelf run loop. Reflex traces can carry monotonic timing checkpoints for capture, preprocessing, model inference, perception, state publication, controller decision, action enqueue, and input execution. The shared contracts derive stage latency, software-loop latency, frame age, and state age from monotonic timestamps only. `RunCoordinator` can append a `ReflexTraceRecord`, retain it in a bounded in-memory trace store, and publish a matching `reflex` event with compact latency metadata.+Donkey also supports a local run artifact store for durable trace data. Installed app runs are stored under `~/Library/Application Support/Donkey/Runs/<run-id>/`; tests and development tools may pass an explicit base directory override. Each prepared run creates:```text@@ -35,7 +37,7 @@ Donkey supports a runtime-level manual target context capture service that wiresThe installed executable also supports a developer-only launch-argument entrypoint for manual verification. `--list-window-candidates` prints the current candidate-list labels and durable `windowID` values. `--manual-capture` runs one manual capture, optionally with `--window-id <id>`, `--run-id <safe-id>`, and `--trace-id <safe-id>`, then prints the run folder and artifact paths. These commands are non-interactive and exit before showing the pointer prompt overlay.-This is a coordination, trace, target-metadata, single-screenshot artifact, read-only Accessibility snapshot, and manual capture orchestration foundation only. It does not run perception models, call LLMs, execute OS input, perform Accessibility actions, provide a manual capture UI, or complete live verification against the full target matrix yet.+This is a coordination, in-memory reflex trace, target-metadata, single-screenshot artifact, read-only Accessibility snapshot, and manual capture orchestration foundation only. It does not run perception models, call LLMs, execute OS input, perform Accessibility actions, provide a manual capture UI, persist high-volume reflex traces to disk, or provide the full real-time capture/perception/controller loop yet.## Technical Guidelines@@ -51,7 +53,9 @@ This is a coordination, trace, target-metadata, single-screenshot artifact, read- Keep mutable installed-app run artifacts in Application Support, not inside the `.app` bundle and not relative to process working directory.- Keep input actions denied unless a caller provides a policy that explicitly allows them.- Preserve latest-request-wins behavior for live-control sessions so stale work cannot build up behind the reflex loop.-- Use sampled or summarized reflex events until a measured trace sink exists.+- Use monotonic timestamps for latency math. Wall-clock timestamps are for human labels and trace correlation only.+- Keep reflex trace retention bounded. The current in-memory store is for recent status and tests, not high-volume replay persistence.+- Use sampled or summarized reflex events until a measured disk trace sink exists.## Verification@@ -61,7 +65,7 @@ From `apps/Donkey/`:swift test```-The runtime tests should cover lifecycle ordering, abort and timeout safety, latest-session queue drops, tool permission denial, event-store ordering, context compaction, artifact path validation, trace folder layout, JSONL event persistence, summary updates, deterministic window resolver behavior through fixture providers, candidate-list label snapshots, screenshot artifact metadata, bounded Accessibility serialization, missing Accessibility trust partial events, unsafe target refusal, overlap-sensitive capture refusal, manual capture event ordering through persisted coordinator events, and debug launch-argument parsing/formatting.+The runtime tests should cover lifecycle ordering, abort and timeout safety, latest-session queue drops, tool permission denial, event-store ordering, context compaction, reflex trace latency math, bounded in-memory reflex trace retention, reflex event publication, artifact path validation, trace folder layout, JSONL event persistence, summary updates, deterministic window resolver behavior through fixture providers, candidate-list label snapshots, screenshot artifact metadata, bounded Accessibility serialization, missing Accessibility trust partial events, unsafe target refusal, overlap-sensitive capture refusal, manual capture event ordering through persisted coordinator events, and debug launch-argument parsing/formatting.Manual smoke commands:@@ -81,6 +85,7 @@ Remaining live verification is environment-dependent. On May 16, 2026, iPhone Mi- Runtime contracts live in `apps/Donkey/Sources/DonkeyContracts/RunLoopContracts.swift`.- Window target contracts live in `apps/Donkey/Sources/DonkeyContracts/WindowTargetContracts.swift`.- Runtime coordination lives in `apps/Donkey/Sources/DonkeyRuntime/`.+- Recent reflex trace retention lives in `apps/Donkey/Sources/DonkeyRuntime/InMemoryReflexTraceStore.swift`.- macOS window resolution lives in `apps/Donkey/Sources/DonkeyRuntime/MacWindowResolver.swift`.- Target-window screenshot capture lives in `apps/Donkey/Sources/DonkeyRuntime/WindowScreenshotCaptureService.swift`.- Accessibility snapshot contracts live in `apps/Donkey/Sources/DonkeyContracts/AccessibilitySnapshotContracts.swift`.@@ -88,4 +93,4 @@ Remaining live verification is environment-dependent. On May 16, 2026, iPhone Mi- Manual target context capture orchestration lives in `apps/Donkey/Sources/DonkeyRuntime/ManualTargetContextCaptureService.swift`.- Manual capture debug command parsing lives in `apps/Donkey/Sources/DonkeyRuntime/ManualCaptureDebugCommand.swift`.- Local artifact persistence lives in `apps/Donkey/Sources/DonkeyRuntime/LocalRunArtifactStore.swift`.-- The manual capture source plan remains active in `plans/master-plan.md`.+- The manual capture source plan is complete in `plans/done/manual-target-context-capture-master-plan.md`.diff --git a/plans/00-overview.md b/plans/00-overview.mdindex acf03446..3e6e5d5c 100644--- a/plans/00-overview.md+++ b/plans/00-overview.md@@ -6,11 +6,11 @@ Build a desktop AI agent that can play iPhone games through Apple's iPhone MirroiPhone games are the first product focus. Gaming is the latency proof. The larger platform is real-time desktop and mobile-app control from the Mac.-## Current Master Plan+## Current Focus-Start with [master-plan.md](master-plan.md).+The manual target context capture milestone is complete in [done/manual-target-context-capture-master-plan.md](done/manual-target-context-capture-master-plan.md).-That plan coordinates the next sequence of edits across capture, Accessibility, trace artifacts, and runtime events. Treat older active plans as background or cleanup targets while `22` is open.+Continue feature work from [20-off-the-shelf-run-loop.md](20-off-the-shelf-run-loop.md), with [02-capture-and-perception.md](02-capture-and-perception.md), [06-benchmarking.md](06-benchmarking.md), and [18-macos-accessibility.md](18-macos-accessibility.md) as the near-term supporting plans.## Near-Term Focus@@ -60,7 +60,7 @@ Every frame should use local, bounded-cost logic:## Plan Breakdown-- [master-plan.md](master-plan.md): current master plan for manual screenshot, Accessibility tree, and trace artifact capture for any target window+- [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- [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 designdiff --git a/plans/20-off-the-shelf-run-loop.md b/plans/20-off-the-shelf-run-loop.mdindex eb0c687c..f6632c64 100644--- a/plans/20-off-the-shelf-run-loop.md+++ b/plans/20-off-the-shelf-run-loop.md@@ -413,6 +413,12 @@ Runtime: native core where the hot path needs it- Transcript and trace writes stay ordered under concurrent model/tool/reflex events.- Context compaction keeps planner input bounded while preserving the latest goal, state, failures, and valid hints.+## Current Supported Slice++The runtime foundation now supports typed reflex trace records for the future hot loop. A trace can carry capture, preprocessing, model, perception, state, controller, action, and input timestamps; derive stage latency, software-loop latency, frame age, and state age from monotonic time; retain recent traces in a bounded in-memory store; and publish matching `reflex` events through `RunCoordinator`.++This is still a boundary and observability slice. It does not capture frames continuously, run detector/OCR/model inference, execute controller actions, or persist high-volume replay traces.+## Where To Look- Ultralytics supported models: https://docs.ultralytics.com/models/diff --git a/plans/master-plan.md b/plans/done/manual-target-context-capture-master-plan.mdsimilarity index 54%rename from plans/master-plan.mdrename to plans/done/manual-target-context-capture-master-plan.mdindex ee199675..33f72120 100644--- a/plans/master-plan.md+++ b/plans/done/manual-target-context-capture-master-plan.md@@ -1,6 +1,6 @@# Manual Target Context Capture Master Plan-This file is the active task queue for the manual target context capture milestone.+This file records the completed manual target context capture milestone.Supported behavior and engineering guidance belong in `docs/guides/minimal-run-coordinator.md`.## Completed Tasks@@ -21,24 +21,15 @@ Supported behavior and engineering guidance belong in `docs/guides/minimal-run-c- [x] Manually verify `--list-window-candidates` against current visible Mac windows.- [x] Manually verify `--manual-capture --window-id <id>` against one normal Mac app window.- [x] Manually verify an explicitly overlapped-window capture uses the true window capture path without requiring overlap-free bounds.+- [x] Close out the milestone after live verification and guide cleanup.-## Remaining Tasks+## Deferred Environment-Dependent Checks-1. Complete the remaining live verification cases.- - Run `swift run Donkey -- --manual-capture --window-id <id>` against iPhone Mirroring when available.- - Blocked on May 16, 2026: no iPhone Mirroring window appeared in the candidate list.- - Verify an Accessibility-trust-missing scenario completes partially with one screenshot artifact and one coordinator permission event.- - Blocked on May 16, 2026: the current process is Accessibility-trusted; do not reset or revoke macOS privacy permissions without explicit user approval.+- Run `swift run Donkey -- --manual-capture --window-id <id>` against iPhone Mirroring when an iPhone Mirroring window is available.+ - Blocked on May 16, 2026: no iPhone Mirroring window appeared in the candidate list.+- Verify an Accessibility-trust-missing scenario completes partially with one screenshot artifact and one coordinator permission event when the process is not already Accessibility-trusted.+ - Blocked on May 16, 2026: the current process is Accessibility-trusted; do not reset or revoke macOS privacy permissions without explicit user approval.-2. Close out the milestone.- - Update `docs/guides/minimal-run-coordinator.md` with any findings from live verification.- - Keep active plans focused on future work only:- - `plans/18-macos-accessibility.md`- - `plans/02-capture-and-perception.md`- - `plans/06-benchmarking.md`- - `plans/20-off-the-shelf-run-loop.md`- - Move this file to `plans/done/` after verification and guide cleanup.+## Completion-## Next Item--Complete the remaining live verification cases.+This milestone is complete. Supported behavior and engineering guidance live in `docs/guides/minimal-run-coordinator.md`; future implementation should continue from the active capture, Accessibility, benchmarking, and off-the-shelf run-loop plans.