Skip to content

Open source CapCut alternative.

TypeScript

Added the pointer and updated plans

David Lea4afd4336fb1
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 00000000..79c0f3db
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,18 @@
+# Agent Guide
+
+This repo has two kinds of written context:
+
+- `docs/`: supported product behavior and engineering guidance.
+- `plans/`: exploratory or historical implementation planning.
+
+Start with `docs/README.md` when changing supported behavior. Use `plans/` only for background unless the user explicitly asks to plan.
+
+## Working Rules
+
+- Ask before creating any new plan document.
+- Manage plans deliberately: move a plan to `plans/done/` when its work is complete, and create or keep plans only for work that remains.
+- Over time, prefer shrinking active `plans/` by completing work and moving finished plans to `plans/done/`.
+- When a completed capability changes, update the relevant guide in `docs/guides/`.
+- Keep guides explanatory. Describe supported behavior, boundaries, and engineering intent; do not duplicate code or maintain long file inventories.
+- Link to source paths only when a maintainer needs an entrypoint.
+- Keep this file stable and lightweight.
diff --git a/READ.ME b/READ.ME
index 203b32d5..8ee2742a 100644
--- a/READ.ME
+++ b/READ.ME
@@ -10,7 +10,7 @@ Gaming is the first proof point because it makes latency obvious. If the agent c
> A real-time desktop agent that sees your screen and controls your computer with low latency.
-Gaming is the demo.
+Gaming is the first production proving ground.
Desktop automation is the larger platform.
---
@@ -85,4 +85,9 @@ Action Engine
↓
Keyboard / Mouse / Controller Input
↓
-Game
\ No newline at end of file
+Game
+```
+
+## Supported Product Guides
+
+Implemented and supported capabilities are documented in [docs/README.md](docs/README.md). Plans are exploratory; docs are the maintained guide layer for completed product behavior and technical rules.
diff --git a/apps/Donkey/Package.swift b/apps/Donkey/Package.swift
new file mode 100644
index 00000000..a4445fc8
--- /dev/null
+++ b/apps/Donkey/Package.swift
@@ -0,0 +1,46 @@
+// swift-tools-version: 6.0
+
+import PackageDescription
+
+let package = Package(
+ name: "Donkey",
+ platforms: [
+ .macOS(.v14)
+ ],
+ products: [
+ .executable(
+ name: "Donkey",
+ targets: ["Donkey"]
+ ),
+ .library(
+ name: "DonkeyContracts",
+ targets: ["DonkeyContracts"]
+ )
+ ],
+ targets: [
+ .target(
+ name: "DonkeyContracts"
+ ),
+ .target(
+ name: "DonkeyRuntime",
+ dependencies: ["DonkeyContracts"]
+ ),
+ .target(
+ name: "DonkeyAI",
+ dependencies: ["DonkeyContracts"]
+ ),
+ .target(
+ name: "DonkeyUI",
+ dependencies: ["DonkeyContracts"]
+ ),
+ .executableTarget(
+ name: "Donkey",
+ dependencies: [
+ "DonkeyAI",
+ "DonkeyContracts",
+ "DonkeyRuntime",
+ "DonkeyUI"
+ ]
+ )
+ ]
+)
diff --git a/apps/Donkey/README.md b/apps/Donkey/README.md
new file mode 100644
index 00000000..80c2724a
--- /dev/null
+++ b/apps/Donkey/README.md
@@ -0,0 +1,23 @@
+# Donkey
+
+SwiftUI macOS app for the production pointer prompt UI.
+
+This slice renders a floating screenshot-style pointer and ChatGPT-style `Make this so` composer. Command-click anywhere to activate Donkey, show the agent pointer, and focus the prompt input. The composer includes a text area plus room for controls such as add context, voice, and send. The overlay follows the mouse at the bottom right by default, flips around an invisible cursor-centered box near screen edges, and clamps itself inside the visible screen.
+
+It does not request Accessibility, Screen Recording, model access, capture-loop, or input-control permissions.
+
+Guides:
+
+- [Pointer Prompt Overlay](../../docs/guides/pointer-prompt-overlay.md)
+- [Swift MVC Guide](../../docs/guides/swift-mvc.md)
+
+```sh
+swift build
+swift run Donkey
+```
+
+Customize the pointer accent color with a six-digit hex value:
+
+```sh
+DONKEY_POINTER_ACCENT=0A84FF swift run Donkey
+```
diff --git a/apps/Donkey/Sources/Donkey/Donkey.swift b/apps/Donkey/Sources/Donkey/Donkey.swift
new file mode 100644
index 00000000..d483f5b0
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/Donkey.swift
@@ -0,0 +1,12 @@
+import SwiftUI
+
+@main
+struct Donkey: App {
+ @NSApplicationDelegateAdaptor(DonkeyAppDelegate.self) private var appDelegate
+
+ var body: some Scene {
+ Settings {
+ EmptyView()
+ }
+ }
+}
diff --git a/apps/Donkey/Sources/Donkey/DonkeyAppDelegate.swift b/apps/Donkey/Sources/Donkey/DonkeyAppDelegate.swift
new file mode 100644
index 00000000..8b8033cd
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/DonkeyAppDelegate.swift
@@ -0,0 +1,21 @@
+import AppKit
+
+@MainActor
+final class DonkeyAppDelegate: NSObject, NSApplicationDelegate {
+ private var overlayController: PointerPromptOverlayController?
+
+ func applicationDidFinishLaunching(_ notification: Notification) {
+ let model = PointerPromptOverlayModel()
+ let controller = PointerPromptOverlayController(model: model)
+ overlayController = controller
+ controller.show()
+ }
+
+ func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
+ false
+ }
+
+ func applicationWillTerminate(_ notification: Notification) {
+ overlayController?.stop()
+ }
+}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift
new file mode 100644
index 00000000..f1f5d092
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift
@@ -0,0 +1,332 @@
+import AppKit
+import DonkeyContracts
+import SwiftUI
+
+@MainActor
+final class PointerPromptOverlayController {
+ static let contentSize = CGSize(width: 448, height: 166)
+
+ private let model: PointerPromptOverlayModel
+ private let pointerGap: CGFloat = 18
+ private let screenPadding: CGFloat = 8
+ private let routeStepInterval: TimeInterval = 0.15
+ private let followSmoothing: CGFloat = 0.34
+ private let flipSmoothing: CGFloat = 0.22
+
+ private var panel: NSPanel?
+ private var timer: Timer?
+ private var globalCommandClickMonitor: Any?
+ private var localCommandClickMonitor: Any?
+ private var currentFrame: CGRect?
+ private var displayPlacement: PointerPromptPlacement = .bottomRight
+ private var finalPlacement: PointerPromptPlacement = .bottomRight
+ private var pendingPlacements: [PointerPromptPlacement] = []
+ private var lastRouteStepAt = Date.distantPast
+
+ init(model: PointerPromptOverlayModel) {
+ self.model = model
+ }
+
+ func show() {
+ let rootView = PointerPromptOverlayRootView(model: model)
+ let hostingView = NSHostingView(rootView: rootView)
+ hostingView.frame = CGRect(origin: .zero, size: Self.contentSize)
+ hostingView.wantsLayer = true
+ hostingView.layer?.backgroundColor = NSColor.clear.cgColor
+
+ let panel = PointerPromptPanel(
+ contentRect: CGRect(origin: .zero, size: Self.contentSize),
+ styleMask: [.borderless],
+ backing: .buffered,
+ defer: false
+ )
+ panel.title = "Donkey"
+ panel.contentView = hostingView
+ panel.backgroundColor = .clear
+ panel.isOpaque = false
+ panel.hasShadow = false
+ panel.hidesOnDeactivate = false
+ panel.isReleasedWhenClosed = false
+ panel.level = .floating
+ panel.collectionBehavior = [
+ .canJoinAllSpaces,
+ .fullScreenAuxiliary,
+ .ignoresCycle,
+ .stationary
+ ]
+
+ self.panel = panel
+ panel.orderOut(nil)
+ startCommandClickMonitoring()
+ startTimer()
+ }
+
+ func stop() {
+ timer?.invalidate()
+ timer = nil
+ stopCommandClickMonitoring()
+ panel?.close()
+ panel = nil
+ }
+
+ private func startCommandClickMonitoring() {
+ stopCommandClickMonitoring()
+
+ globalCommandClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown]) { [weak self] event in
+ guard event.modifierFlags.contains(.command) else { return }
+
+ Task { @MainActor in
+ self?.activateAtCurrentMouseLocation()
+ }
+ }
+
+ localCommandClickMonitor = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown]) { [weak self] event in
+ if event.modifierFlags.contains(.command) {
+ Task { @MainActor in
+ self?.activateAtCurrentMouseLocation()
+ }
+ }
+
+ return event
+ }
+ }
+
+ private func stopCommandClickMonitoring() {
+ if let globalCommandClickMonitor {
+ NSEvent.removeMonitor(globalCommandClickMonitor)
+ self.globalCommandClickMonitor = nil
+ }
+
+ if let localCommandClickMonitor {
+ NSEvent.removeMonitor(localCommandClickMonitor)
+ self.localCommandClickMonitor = nil
+ }
+ }
+
+ private func activateAtCurrentMouseLocation() {
+ activate(at: NSEvent.mouseLocation)
+ }
+
+ private func activate(at mouseLocation: CGPoint) {
+ guard let panel else { return }
+
+ model.activate()
+ currentFrame = nil
+ displayPlacement = .bottomRight
+ finalPlacement = .bottomRight
+ pendingPlacements = []
+ tick(mouseLocation: mouseLocation)
+
+ NSApp.activate(ignoringOtherApps: true)
+ panel.makeKeyAndOrderFront(nil)
+ }
+
+ private func startTimer() {
+ timer?.invalidate()
+ let timer = Timer(timeInterval: 1.0 / 60.0, repeats: true) { [weak self] _ in
+ Task { @MainActor in
+ self?.tick()
+ }
+ }
+ RunLoop.main.add(timer, forMode: .common)
+ self.timer = timer
+ }
+
+ private func tick(mouseLocation explicitMouseLocation: CGPoint? = nil) {
+ guard let panel else { return }
+ guard model.promptState.isActive else { return }
+
+ let mouseLocation = explicitMouseLocation ?? NSEvent.mouseLocation
+ guard let screen = screen(containing: mouseLocation) else { return }
+
+ let now = Date()
+ let targetPlacement = preferredPlacement(
+ for: mouseLocation,
+ visibleFrame: screen.visibleFrame
+ )
+ updateRoute(to: targetPlacement, now: now)
+ advanceRoute(now: now)
+
+ let targetFrame = clampedFrame(
+ frame(for: displayPlacement, mouseLocation: mouseLocation),
+ in: screen.visibleFrame
+ )
+ let nextFrame = smoothedFrame(toward: targetFrame, in: screen.visibleFrame)
+ currentFrame = nextFrame
+ panel.setFrame(nextFrame, display: true)
+
+ if model.placement != displayPlacement {
+ model.placement = displayPlacement
+ }
+ }
+
+ private func updateRoute(to targetPlacement: PointerPromptPlacement, now: Date) {
+ guard targetPlacement != finalPlacement else { return }
+
+ finalPlacement = targetPlacement
+ pendingPlacements = route(from: displayPlacement, to: targetPlacement)
+ lastRouteStepAt = now.addingTimeInterval(-routeStepInterval)
+ }
+
+ private func advanceRoute(now: Date) {
+ guard !pendingPlacements.isEmpty else { return }
+ guard now.timeIntervalSince(lastRouteStepAt) >= routeStepInterval else { return }
+
+ displayPlacement = pendingPlacements.removeFirst()
+ lastRouteStepAt = now
+ }
+
+ private func route(
+ from currentPlacement: PointerPromptPlacement,
+ to targetPlacement: PointerPromptPlacement
+ ) -> [PointerPromptPlacement] {
+ guard currentPlacement != targetPlacement else { return [] }
+
+ if currentPlacement.placesContentOnLeft != targetPlacement.placesContentOnLeft,
+ currentPlacement.placesContentAbovePointer != targetPlacement.placesContentAbovePointer {
+ let horizontalFirst = placement(
+ left: targetPlacement.placesContentOnLeft,
+ above: currentPlacement.placesContentAbovePointer
+ )
+ return [horizontalFirst, targetPlacement]
+ }
+
+ return [targetPlacement]
+ }
+
+ private func preferredPlacement(
+ for mouseLocation: CGPoint,
+ visibleFrame: CGRect
+ ) -> PointerPromptPlacement {
+ let preferredFrame = frame(for: .bottomRight, mouseLocation: mouseLocation)
+ let overflowsRight = preferredFrame.maxX > visibleFrame.maxX - screenPadding
+ let overflowsBottom = preferredFrame.minY < visibleFrame.minY + screenPadding
+
+ let preferredPlacement = placement(left: overflowsRight, above: overflowsBottom)
+ let candidates = [
+ preferredPlacement,
+ PointerPromptPlacement.bottomRight,
+ .bottomLeft,
+ .topRight,
+ .topLeft
+ ]
+
+ for candidate in candidates where fits(
+ frame(for: candidate, mouseLocation: mouseLocation),
+ in: visibleFrame
+ ) {
+ return candidate
+ }
+
+ return preferredPlacement
+ }
+
+ private func placement(left: Bool, above: Bool) -> PointerPromptPlacement {
+ switch (left, above) {
+ case (false, false):
+ .bottomRight
+ case (true, false):
+ .bottomLeft
+ case (true, true):
+ .topLeft
+ case (false, true):
+ .topRight
+ }
+ }
+
+ private func frame(
+ for placement: PointerPromptPlacement,
+ mouseLocation: CGPoint
+ ) -> CGRect {
+ let size = Self.contentSize
+
+ switch placement {
+ case .bottomRight:
+ return CGRect(
+ x: mouseLocation.x + pointerGap,
+ y: mouseLocation.y - size.height - pointerGap,
+ width: size.width,
+ height: size.height
+ )
+ case .bottomLeft:
+ return CGRect(
+ x: mouseLocation.x - size.width - pointerGap,
+ y: mouseLocation.y - size.height - pointerGap,
+ width: size.width,
+ height: size.height
+ )
+ case .topLeft:
+ return CGRect(
+ x: mouseLocation.x - size.width - pointerGap,
+ y: mouseLocation.y + pointerGap,
+ width: size.width,
+ height: size.height
+ )
+ case .topRight:
+ return CGRect(
+ x: mouseLocation.x + pointerGap,
+ y: mouseLocation.y + pointerGap,
+ width: size.width,
+ height: size.height
+ )
+ }
+ }
+
+ private func fits(_ frame: CGRect, in visibleFrame: CGRect) -> Bool {
+ frame.minX >= visibleFrame.minX + screenPadding &&
+ frame.maxX <= visibleFrame.maxX - screenPadding &&
+ frame.minY >= visibleFrame.minY + screenPadding &&
+ frame.maxY <= visibleFrame.maxY - screenPadding
+ }
+
+ private func clampedFrame(_ frame: CGRect, in visibleFrame: CGRect) -> CGRect {
+ var origin = frame.origin
+ let size = frame.size
+
+ let minX = visibleFrame.minX + screenPadding
+ let maxX = visibleFrame.maxX - size.width - screenPadding
+ let minY = visibleFrame.minY + screenPadding
+ let maxY = visibleFrame.maxY - size.height - screenPadding
+
+ if minX <= maxX {
+ origin.x = min(max(origin.x, minX), maxX)
+ } else {
+ origin.x = visibleFrame.midX - size.width / 2
+ }
+
+ if minY <= maxY {
+ origin.y = min(max(origin.y, minY), maxY)
+ } else {
+ origin.y = visibleFrame.midY - size.height / 2
+ }
+
+ return CGRect(origin: origin, size: size)
+ }
+
+ private func smoothedFrame(toward targetFrame: CGRect, in visibleFrame: CGRect) -> CGRect {
+ guard let currentFrame else { return targetFrame }
+
+ let smoothing = pendingPlacements.isEmpty ? followSmoothing : flipSmoothing
+ let origin = CGPoint(
+ x: currentFrame.origin.x + (targetFrame.origin.x - currentFrame.origin.x) * smoothing,
+ y: currentFrame.origin.y + (targetFrame.origin.y - currentFrame.origin.y) * smoothing
+ )
+ return clampedFrame(CGRect(origin: origin, size: targetFrame.size), in: visibleFrame)
+ }
+
+ private func screen(containing point: CGPoint) -> NSScreen? {
+ NSScreen.screens.first { screen in
+ screen.frame.contains(point)
+ } ?? NSScreen.main ?? NSScreen.screens.first
+ }
+}
+
+private final class PointerPromptPanel: NSPanel {
+ override var canBecomeKey: Bool {
+ true
+ }
+
+ override var canBecomeMain: Bool {
+ true
+ }
+}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
new file mode 100644
index 00000000..6afcdcf3
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
@@ -0,0 +1,85 @@
+import DonkeyAI
+import DonkeyContracts
+import DonkeyRuntime
+import Foundation
+import SwiftUI
+
+@MainActor
+final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink {
+ @Published private(set) var promptState: PointerPromptState
+ @Published var messageText = ""
+ @Published var placement: PointerPromptPlacement = .bottomRight
+
+ private let runtimeProvider: any RuntimeStatusProviding
+ private let aiProvider: any AIHarnessSnapshotProviding
+
+ init(
+ runtimeProvider: any RuntimeStatusProviding = OffTheShelfRunLoopBoundary(),
+ aiProvider: any AIHarnessSnapshotProviding = AIHarnessBoundary(),
+ theme: PointerPromptTheme = PointerPromptOverlayModel.configuredTheme()
+ ) {
+ self.runtimeProvider = runtimeProvider
+ self.aiProvider = aiProvider
+
+ let runtimeSnapshot = runtimeProvider.snapshot()
+ let aiSnapshot = aiProvider.snapshot()
+ promptState = PointerPromptState(
+ promptText: aiSnapshot.suggestedPromptText,
+ isPrimaryActionEnabled: true,
+ leadingSignalLevel: runtimeSnapshot.isReady ? .ready : .idle,
+ isActive: false,
+ theme: theme
+ )
+ }
+
+ func activate() {
+ promptState.isActive = true
+ promptState.isPrimaryActionEnabled = true
+ promptState.leadingSignalLevel = .ready
+ }
+
+ func handle(_ intent: PointerPromptIntent) {
+ switch intent {
+ case .addContextRequested:
+ promptState.leadingSignalLevel = .ready
+ case .voiceInputRequested:
+ promptState.leadingSignalLevel = .ready
+ case .primaryActionRequested:
+ promptState.leadingSignalLevel = .thinking
+ case .messageSubmitted(let text):
+ let trimmedText = text.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !trimmedText.isEmpty else { return }
+
+ messageText = ""
+ promptState.leadingSignalLevel = .thinking
+ case .dismissed:
+ promptState.isPrimaryActionEnabled = false
+ promptState.isActive = false
+ }
+ }
+
+ private static func configuredTheme() -> PointerPromptTheme {
+ guard let hexColor = ProcessInfo.processInfo.environment["DONKEY_POINTER_ACCENT"],
+ let color = PointerPromptColor(hexRGB: hexColor) else {
+ return .defaultBlue
+ }
+
+ return .accent(color)
+ }
+}
+
+private extension PointerPromptColor {
+ init?(hexRGB: String) {
+ let trimmed = hexRGB.trimmingCharacters(in: CharacterSet(charactersIn: "# "))
+ guard trimmed.count == 6, let value = Int(trimmed, radix: 16) else {
+ return nil
+ }
+
+ self.init(
+ red: Double((value >> 16) & 0xFF) / 255.0,
+ green: Double((value >> 8) & 0xFF) / 255.0,
+ blue: Double(value & 0xFF) / 255.0,
+ alpha: 1
+ )
+ }
+}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayRootView.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayRootView.swift
new file mode 100644
index 00000000..097eded3
--- /dev/null
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayRootView.swift
@@ -0,0 +1,19 @@
+import DonkeyUI
+import SwiftUI
+
+struct PointerPromptOverlayRootView: View {
+ @ObservedObject var model: PointerPromptOverlayModel
+
+ var body: some View {
+ PointerPromptStageView(
+ state: model.promptState,
+ messageText: $model.messageText,
+ placement: model.placement,
+ intentSink: model
+ )
+ .frame(
+ width: PointerPromptOverlayController.contentSize.width,
+ height: PointerPromptOverlayController.contentSize.height
+ )
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift b/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift
new file mode 100644
index 00000000..d328cd9f
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyAI/AIHarnessBoundary.swift
@@ -0,0 +1,18 @@
+import DonkeyContracts
+import Foundation
+
+public protocol AIHarnessSnapshotProviding: Sendable {
+ func snapshot() -> AIHarnessSnapshot
+}
+
+public struct AIHarnessBoundary: AIHarnessSnapshotProviding {
+ public init() {}
+
+ public func snapshot() -> AIHarnessSnapshot {
+ AIHarnessSnapshot(
+ isPlannerAvailable: false,
+ suggestedPromptText: "Make this so",
+ sourcePlan: "plans/19-ai-harness.md"
+ )
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyContracts/PlaceholderSnapshots.swift b/apps/Donkey/Sources/DonkeyContracts/PlaceholderSnapshots.swift
new file mode 100644
index 00000000..8db7424c
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyContracts/PlaceholderSnapshots.swift
@@ -0,0 +1,29 @@
+import Foundation
+
+public struct RuntimeStatusSnapshot: Equatable, Sendable {
+ public var isReady: Bool
+ public var summary: String
+ public var sourcePlan: String
+
+ public init(isReady: Bool, summary: String, sourcePlan: String) {
+ self.isReady = isReady
+ self.summary = summary
+ self.sourcePlan = sourcePlan
+ }
+}
+
+public struct AIHarnessSnapshot: Equatable, Sendable {
+ public var isPlannerAvailable: Bool
+ public var suggestedPromptText: String
+ public var sourcePlan: String
+
+ public init(
+ isPlannerAvailable: Bool,
+ suggestedPromptText: String,
+ sourcePlan: String
+ ) {
+ self.isPlannerAvailable = isPlannerAvailable
+ self.suggestedPromptText = suggestedPromptText
+ self.sourcePlan = sourcePlan
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift b/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift
new file mode 100644
index 00000000..018651df
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyContracts/PointerPromptContracts.swift
@@ -0,0 +1,125 @@
+import Foundation
+
+public struct PointerPromptState: Equatable, Sendable {
+ public var promptText: String
+ public var isPrimaryActionEnabled: Bool
+ public var leadingSignalLevel: SignalLevel
+ public var isActive: Bool
+ public var theme: PointerPromptTheme
+
+ public init(
+ promptText: String,
+ isPrimaryActionEnabled: Bool = true,
+ leadingSignalLevel: SignalLevel = .idle,
+ isActive: Bool = false,
+ theme: PointerPromptTheme = .defaultBlue
+ ) {
+ self.promptText = promptText
+ self.isPrimaryActionEnabled = isPrimaryActionEnabled
+ self.leadingSignalLevel = leadingSignalLevel
+ self.isActive = isActive
+ self.theme = theme
+ }
+
+ public static let productionDefault = PointerPromptState(
+ promptText: "Make this so",
+ leadingSignalLevel: .ready,
+ isActive: true
+ )
+}
+
+public struct PointerPromptTheme: Equatable, Sendable {
+ public var accent: PointerPromptColor
+ public var fill: PointerPromptColor
+ public var pointerFill: PointerPromptColor
+ public var activeShadow: PointerPromptColor
+
+ public init(
+ accent: PointerPromptColor,
+ fill: PointerPromptColor,
+ pointerFill: PointerPromptColor,
+ activeShadow: PointerPromptColor
+ ) {
+ self.accent = accent
+ self.fill = fill
+ self.pointerFill = pointerFill
+ self.activeShadow = activeShadow
+ }
+
+ public static let defaultBlue = PointerPromptTheme(
+ accent: PointerPromptColor(red: 0.05, green: 0.43, blue: 0.85, alpha: 1),
+ fill: PointerPromptColor(red: 0.88, green: 0.94, blue: 1.0, alpha: 1),
+ pointerFill: PointerPromptColor(red: 0.82, green: 0.93, blue: 1.0, alpha: 1),
+ activeShadow: PointerPromptColor(red: 0.0, green: 0.14, blue: 0.32, alpha: 0.26)
+ )
+
+ public static func accent(_ accent: PointerPromptColor) -> PointerPromptTheme {
+ PointerPromptTheme(
+ accent: accent,
+ fill: accent.mixed(with: .white, accentWeight: 0.13, alpha: 1),
+ pointerFill: accent.mixed(with: .white, accentWeight: 0.24, alpha: 1),
+ activeShadow: PointerPromptColor(
+ red: accent.red,
+ green: accent.green,
+ blue: accent.blue,
+ alpha: 0.26
+ )
+ )
+ }
+}
+
+public struct PointerPromptColor: Equatable, Sendable {
+ public var red: Double
+ public var green: Double
+ public var blue: Double
+ public var alpha: Double
+
+ public init(red: Double, green: Double, blue: Double, alpha: Double = 1) {
+ self.red = red
+ self.green = green
+ self.blue = blue
+ self.alpha = alpha
+ }
+
+ public static let white = PointerPromptColor(red: 1, green: 1, blue: 1, alpha: 1)
+
+ public func mixed(
+ with other: PointerPromptColor,
+ accentWeight: Double,
+ alpha: Double
+ ) -> PointerPromptColor {
+ let baseWeight = 1 - accentWeight
+ return PointerPromptColor(
+ red: red * accentWeight + other.red * baseWeight,
+ green: green * accentWeight + other.green * baseWeight,
+ blue: blue * accentWeight + other.blue * baseWeight,
+ alpha: alpha
+ )
+ }
+}
+
+public enum SignalLevel: String, Equatable, Sendable {
+ case idle
+ case ready
+ case thinking
+}
+
+public enum PointerPromptIntent: Equatable, Sendable {
+ case addContextRequested
+ case voiceInputRequested
+ case primaryActionRequested(promptText: String)
+ case messageSubmitted(text: String)
+ case dismissed
+}
+
+@MainActor
+public protocol PointerPromptIntentSink: AnyObject {
+ func handle(_ intent: PointerPromptIntent)
+}
+
+@MainActor
+public final class NoopPointerPromptIntentSink: PointerPromptIntentSink {
+ public init() {}
+
+ public func handle(_ intent: PointerPromptIntent) {}
+}
diff --git a/apps/Donkey/Sources/DonkeyContracts/PointerPromptPlacement.swift b/apps/Donkey/Sources/DonkeyContracts/PointerPromptPlacement.swift
new file mode 100644
index 00000000..f8d7cb06
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyContracts/PointerPromptPlacement.swift
@@ -0,0 +1,24 @@
+public enum PointerPromptPlacement: Equatable, Sendable {
+ case bottomRight
+ case bottomLeft
+ case topLeft
+ case topRight
+
+ public var placesContentOnLeft: Bool {
+ switch self {
+ case .bottomLeft, .topLeft:
+ true
+ case .bottomRight, .topRight:
+ false
+ }
+ }
+
+ public var placesContentAbovePointer: Bool {
+ switch self {
+ case .topLeft, .topRight:
+ true
+ case .bottomLeft, .bottomRight:
+ false
+ }
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/OffTheShelfRunLoopBoundary.swift b/apps/Donkey/Sources/DonkeyRuntime/OffTheShelfRunLoopBoundary.swift
new file mode 100644
index 00000000..91b59846
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyRuntime/OffTheShelfRunLoopBoundary.swift
@@ -0,0 +1,18 @@
+import DonkeyContracts
+import Foundation
+
+public protocol RuntimeStatusProviding: Sendable {
+ func snapshot() -> RuntimeStatusSnapshot
+}
+
+public struct OffTheShelfRunLoopBoundary: RuntimeStatusProviding {
+ public init() {}
+
+ public func snapshot() -> RuntimeStatusSnapshot {
+ RuntimeStatusSnapshot(
+ isReady: false,
+ summary: "Real-time run loop integration boundary",
+ sourcePlan: "plans/20-off-the-shelf-run-loop.md"
+ )
+ }
+}
diff --git a/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
new file mode 100644
index 00000000..ec0fd044
--- /dev/null
+++ b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
@@ -0,0 +1,304 @@
+import DonkeyContracts
+import SwiftUI
+
+public struct PointerPromptStageView: View {
+ private let state: PointerPromptState
+ @Binding private var messageText: String
+ private let placement: PointerPromptPlacement
+ private weak var intentSink: (any PointerPromptIntentSink)?
+
+ public init(
+ state: PointerPromptState,
+ messageText: Binding<String>,
+ placement: PointerPromptPlacement = .bottomRight,
+ intentSink: any PointerPromptIntentSink
+ ) {
+ self.state = state
+ self._messageText = messageText
+ self.placement = placement
+ self.intentSink = intentSink
+ }
+
+ public var body: some View {
+ promptContent
+ .padding(.horizontal, 8)
+ .padding(.vertical, 10)
+ .background(Color.clear)
+ .accessibilityElement(children: .contain)
+ }
+
+ @ViewBuilder
+ private var promptContent: some View {
+ if placement.placesContentOnLeft {
+ HStack(alignment: .bottom, spacing: 16) {
+ composer
+ pointer
+ }
+ } else {
+ HStack(alignment: .bottom, spacing: 16) {
+ pointer
+ composer
+ }
+ }
+ }
+
+ private var pointer: some View {
+ AgentPointerView(
+ placement: placement,
+ theme: state.theme,
+ isActive: state.isActive
+ )
+ .frame(width: 58, height: 68)
+ .offset(y: placement.placesContentAbovePointer ? 20 : -22)
+ }
+
+ private var composer: some View {
+ PointerPromptComposer(
+ state: state,
+ messageText: $messageText,
+ addContext: {
+ intentSink?.handle(.addContextRequested)
+ },
+ voiceInput: {
+ intentSink?.handle(.voiceInputRequested)
+ },
+ submit: {
+ intentSink?.handle(.messageSubmitted(text: messageText))
+ }
+ )
+ .frame(width: 350, height: 142)
+ }
+}
+
+private struct PointerPromptComposer: View {
+ let state: PointerPromptState
+ @Binding var messageText: String
+ let addContext: @MainActor () -> Void
+ let voiceInput: @MainActor () -> Void
+ let submit: @MainActor () -> Void
+ @FocusState private var isFocused: Bool
+
+ var body: some View {
+ VStack(spacing: 13) {
+ TextField(state.promptText, text: $messageText)
+ .textFieldStyle(.plain)
+ .font(.system(size: 26, weight: .semibold, design: .rounded))
+ .foregroundStyle(Color(promptColor: state.theme.accent))
+ .lineLimit(1)
+ .minimumScaleFactor(0.7)
+ .focused($isFocused)
+ .onSubmit(submit)
+ .accessibilityLabel("Message for Donkey")
+ .frame(maxWidth: .infinity, minHeight: 36, alignment: .leading)
+
+ HStack(spacing: 10) {
+ ComposerIconButton(
+ systemName: "plus",
+ label: "Add context",
+ theme: state.theme,
+ action: addContext
+ )
+
+ ComposerSignalButton(
+ level: state.leadingSignalLevel,
+ theme: state.theme,
+ action: voiceInput
+ )
+
+ Spacer(minLength: 12)
+
+ ComposerIconButton(
+ systemName: "arrow.up",
+ label: "Send message",
+ theme: state.theme,
+ isProminent: true,
+ isDisabled: messageText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
+ action: submit
+ )
+ }
+ }
+ .padding(.leading, 24)
+ .padding(.trailing, 18)
+ .padding(.top, 24)
+ .padding(.bottom, 16)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background {
+ RoundedRectangle(cornerRadius: 38, style: .continuous)
+ .fill(Color(promptColor: state.theme.fill))
+ }
+ .overlay {
+ RoundedRectangle(cornerRadius: 38, style: .continuous)
+ .stroke(Color(promptColor: state.theme.accent), lineWidth: 2.4)
+ }
+ .shadow(
+ color: Color(promptColor: state.theme.accent).opacity(state.isActive ? 0.13 : 0.08),
+ radius: state.isActive ? 12 : 8,
+ x: 0,
+ y: state.isActive ? 5 : 3
+ )
+ .onAppear(perform: focusIfActive)
+ .onChange(of: state.isActive) { _, _ in
+ focusIfActive()
+ }
+ }
+
+ private func focusIfActive() {
+ guard state.isActive else { return }
+
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
+ isFocused = true
+ }
+ }
+}
+
+private struct ComposerIconButton: View {
+ let systemName: String
+ let label: String
+ let theme: PointerPromptTheme
+ var isProminent = false
+ var isDisabled = false
+ let action: @MainActor () -> Void
+
+ var body: some View {
+ Button(action: action) {
+ Image(systemName: systemName)
+ .font(.system(size: isProminent ? 17 : 16, weight: .semibold))
+ .foregroundStyle(foregroundColor)
+ .frame(width: 34, height: 34)
+ .background {
+ Circle()
+ .fill(backgroundColor)
+ }
+ .overlay {
+ Circle()
+ .stroke(borderColor, lineWidth: isProminent ? 0 : 1.4)
+ }
+ }
+ .buttonStyle(.plain)
+ .disabled(isDisabled)
+ .opacity(isDisabled ? 0.38 : 1)
+ .accessibilityLabel(label)
+ }
+
+ private var foregroundColor: Color {
+ isProminent ? Color(promptColor: theme.fill) : Color(promptColor: theme.accent)
+ }
+
+ private var backgroundColor: Color {
+ isProminent ? Color(promptColor: theme.accent) : Color.white.opacity(0.32)
+ }
+
+ private var borderColor: Color {
+ Color(promptColor: theme.accent).opacity(0.38)
+ }
+}
+
+private struct ComposerSignalButton: View {
+ let level: SignalLevel
+ let theme: PointerPromptTheme
+ let action: @MainActor () -> Void
+
+ var body: some View {
+ Button(action: action) {
+ HStack(alignment: .center, spacing: 5) {
+ ForEach(Array(barHeights.enumerated()), id: \.offset) { _, height in
+ Capsule()
+ .fill(Color(promptColor: theme.accent).opacity(level == .idle ? 0.38 : 0.66))
+ .frame(width: 4.5, height: height)
+ }
+ }
+ .frame(width: 44, height: 34)
+ .background {
+ Capsule()
+ .fill(Color.white.opacity(0.32))
+ }
+ .overlay {
+ Capsule()
+ .stroke(Color(promptColor: theme.accent).opacity(0.28), lineWidth: 1.4)
+ }
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel("Voice input")
+ }
+
+ private var barHeights: [CGFloat] {
+ switch level {
+ case .idle:
+ [7, 18, 10]
+ case .ready:
+ [8, 24, 15]
+ case .thinking:
+ [17, 26, 21]
+ }
+ }
+}
+
+private struct AgentPointerView: View {
+ let placement: PointerPromptPlacement
+ let theme: PointerPromptTheme
+ let isActive: Bool
+
+ var body: some View {
+ ZStack(alignment: .bottom) {
+ if isActive {
+ Ellipse()
+ .fill(Color(promptColor: theme.activeShadow))
+ .frame(width: 42, height: 13)
+ .blur(radius: 4)
+ .offset(y: 2)
+ }
+
+ AgentPointerShape()
+ .fill(Color(promptColor: theme.pointerFill))
+ .overlay {
+ AgentPointerShape()
+ .stroke(Color(promptColor: theme.accent), lineWidth: 2.3)
+ }
+ .shadow(
+ color: Color(promptColor: theme.accent).opacity(isActive ? 0.18 : 0.08),
+ radius: isActive ? 8 : 4,
+ x: 0,
+ y: isActive ? 4 : 2
+ )
+ .frame(width: 48, height: 58)
+ .rotationEffect(rotation)
+ .scaleEffect(x: placement.placesContentOnLeft ? -1 : 1, y: 1)
+ .offset(y: -7)
+ }
+ .accessibilityHidden(true)
+ }
+
+ private var rotation: Angle {
+ placement.placesContentAbovePointer ? .degrees(18) : .degrees(-14)
+ }
+}
+
+private struct AgentPointerShape: Shape {
+ func path(in rect: CGRect) -> Path {
+ var path = Path()
+ let w = rect.width
+ let h = rect.height
+
+ path.move(to: CGPoint(x: w * 0.12, y: h * 0.04))
+ path.addLine(to: CGPoint(x: w * 0.86, y: h * 0.55))
+ path.addLine(to: CGPoint(x: w * 0.52, y: h * 0.62))
+ path.addLine(to: CGPoint(x: w * 0.68, y: h * 0.95))
+ path.addLine(to: CGPoint(x: w * 0.49, y: h * 1.0))
+ path.addLine(to: CGPoint(x: w * 0.34, y: h * 0.69))
+ path.addLine(to: CGPoint(x: w * 0.12, y: h * 0.88))
+ path.closeSubpath()
+
+ return path
+ }
+}
+
+private extension Color {
+ init(promptColor: PointerPromptColor) {
+ self.init(
+ red: promptColor.red,
+ green: promptColor.green,
+ blue: promptColor.blue,
+ opacity: promptColor.alpha
+ )
+ }
+}
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 00000000..b6c78f9a
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,20 @@
+# Donkey Docs
+
+This folder is the product and engineering source of truth for capabilities that are already supported.
+
+Plans describe what we might build. Guides describe what Donkey currently supports and how to maintain it.
+
+## Product Guides
+
+- [Pointer Prompt Overlay](guides/pointer-prompt-overlay.md): command-click agent pointer and ChatGPT-style `Make this so` composer that follows the mouse and stays on screen.
+
+## Engineering Guides
+
+- [Swift MVC Guide](guides/swift-mvc.md): Swift/AppKit/SwiftUI organization rules for model-view-controller boundaries.
+
+## Navigation Rules
+
+- Add a guide here when a plan moves to `plans/done/`.
+- 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/README.md b/docs/guides/README.md
new file mode 100644
index 00000000..d5dd7c1e
--- /dev/null
+++ b/docs/guides/README.md
@@ -0,0 +1,11 @@
+# Guides
+
+Guides explain what Donkey supports and how to maintain it. They should stay readable and avoid duplicating code.
+
+## Product Support
+
+- [Pointer Prompt Overlay](pointer-prompt-overlay.md)
+
+## Technical Guidelines
+
+- [Swift MVC Guide](swift-mvc.md)
diff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.md
new file mode 100644
index 00000000..9abb3cc3
--- /dev/null
+++ b/docs/guides/pointer-prompt-overlay.md
@@ -0,0 +1,55 @@
+# Pointer Prompt Overlay
+
+## Supported Behavior
+
+Donkey supports a floating macOS pointer prompt overlay:
+
+- command-click anywhere to activate the agent pointer and focus the prompt composer
+- shows a cursor-style agent pointer and rounded ChatGPT-style `Make this so` composer
+- includes a text input area plus room for controls such as add context, voice, and send
+- follows the user mouse at bottom right by default while active
+- stays fully inside the current screen visible frame
+- flips to the left, top, or top-left side when the default position would leave the screen
+- animates side changes along an invisible box around the user pointer
+- renders a shadow underneath the agent pointer when active
+- supports accent-color customization through `DONKEY_POINTER_ACCENT`
+- keeps runtime and AI harness behavior behind explicit integration boundaries
+
+This is a visual UI capability. It does not capture the screen, send input, call models, or require Accessibility permission.
+
+## Technical Guidelines
+
+- The overlay window is an `NSPanel` owned by `PointerPromptOverlayController`.
+- SwiftUI rendering stays in `DonkeyUI`; it receives `PointerPromptState` and `PointerPromptPlacement` from `DonkeyContracts`.
+- Product state stays in `PointerPromptOverlayModel`.
+- Treat the composer like a ChatGPT input box: one surface can contain typed text, submission, and adjacent controls.
+- Composer controls should emit typed `PointerPromptIntent` values instead of reaching into runtime, AI, or controller code.
+- Pointer colors live in `PointerPromptTheme`; views must not hard-code product colors.
+- Placement is one of `bottomRight`, `bottomLeft`, `topLeft`, or `topRight`.
+- The controller must clamp the final panel frame to `NSScreen.visibleFrame` before applying it.
+- Diagonal placement changes should route through a side placement first, so bottom-right overflow can animate to left and then top-left.
+- Command-click handling belongs in `PointerPromptOverlayController`, not the SwiftUI view.
+- Keep the overlay non-invasive: no capture loop, input execution, Accessibility prompt, or LLM call in this feature.
+
+## Verification
+
+From `apps/Donkey/`:
+
+```sh
+swift build
+swift run Donkey
+```
+
+Command-click anywhere and confirm the composer appears with keyboard focus. Type a message, confirm the send control enables, and move the mouse near the bottom-right screen edge to confirm the prompt moves left, then top-left if needed, without clipping off screen.
+
+To verify color customization:
+
+```sh
+DONKEY_POINTER_ACCENT=FF375F swift run Donkey
+```
+
+## Source Entry Points
+
+- App orchestration starts in `apps/Donkey/Sources/Donkey/`.
+- Reusable SwiftUI rendering lives in `apps/Donkey/Sources/DonkeyUI/`.
+- Historical completion notes live in `plans/done/21-swiftui-pointer-ui.md`.
diff --git a/docs/guides/swift-mvc.md b/docs/guides/swift-mvc.md
new file mode 100644
index 00000000..613500ae
--- /dev/null
+++ b/docs/guides/swift-mvc.md
@@ -0,0 +1,40 @@
+# Swift MVC Guide
+
+## Purpose
+
+Donkey Swift code should keep product state, UI rendering, and AppKit orchestration separate. This keeps the pointer UI easy to change without coupling it to future real-time runtime or AI harness work.
+
+## Pattern
+
+- Model owns observable product state and intent handling.
+- View renders state and emits typed intents.
+- Controller owns AppKit lifecycle, windows, timers, geometry, and side effects.
+- App entry wires the first model and controller, then gets out of the way.
+
+## Technical Guidelines
+
+- Keep SwiftUI views value-like: pass state in, pass typed intent sinks out, and avoid timers, global mouse reads, model providers, or window management inside views.
+- Keep models on `@MainActor` when they publish UI state. Models may depend on narrow provider protocols, but not on AppKit windows or timers.
+- Keep controllers on `@MainActor` when they touch AppKit. Controllers may read `NSEvent.mouseLocation`, monitor command-click activation, own `NSPanel`, and translate geometry into model state.
+- Keep app entry files small. They should define `@main`, delegate adaptation, and little else.
+- Prefer target-level separation for reusable contracts and UI: `DonkeyContracts`, `DonkeyUI`, `DonkeyRuntime`, and `DonkeyAI`.
+- Keep shared UI state types in `DonkeyContracts`, not in `DonkeyUI`, when models and views both need them.
+- Do not let `DonkeyUI` import runtime or AI modules. Future runtime and LLM work must cross through contracts, not view internals.
+- Name files after their MVC role when a feature grows past one screen: `FeatureModel.swift`, `FeatureRootView.swift`, `FeatureController.swift`.
+
+## Current Donkey Shape
+
+The pointer overlay follows this split:
+
+- model state covers prompt text, typed input, placement, theme, and typed intents
+- views render the composer and pointer from model state
+- the controller owns AppKit-only work such as the floating panel, command-click activation, screen bounds, and movement timing
+- app entry bootstraps the feature and avoids owning product behavior
+
+## Review Checklist
+
+- A SwiftUI view should not call `NSEvent.mouseLocation`, create an `NSPanel`, start a `Timer`, or import `DonkeyAI`/`DonkeyRuntime`.
+- A model should not import `DonkeyUI`; shared display state belongs in `DonkeyContracts`.
+- A model should not know about frames, screens, windows, or animation timing.
+- A controller should not store business text or decide model-provider behavior beyond presenting existing model state.
+- New product behavior should add or extend a guide in `docs/guides/`.
diff --git a/plans/00-overview.md b/plans/00-overview.md
index f11b42ba..384051e8 100644
--- a/plans/00-overview.md
+++ b/plans/00-overview.md
@@ -60,7 +60,7 @@ Every frame should use local, bounded-cost logic:
- [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 prototype to demo
+- [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
- [10-gaps-to-expand.md](10-gaps-to-expand.md): remaining gaps needed to make the system real
@@ -87,7 +87,7 @@ Every frame should use local, bounded-cost logic:
8. DOM signals over vision when the target is web-based and the DOM is available.
9. Off-the-shelf components before custom model work.
-## First Target Demo
+## First Supported Target
Start with iPhone Mirroring targets that have:
@@ -105,7 +105,7 @@ Good first candidates:
- Subway Surfers after swipe calibration works
- local iPhone Safari test pages as measurement harnesses
-Avoid for the first demo:
+Avoid for the first supported target:
- competitive multiplayer games
- games with anti-cheat
diff --git a/plans/01-latency-budget.md b/plans/01-latency-budget.md
index 524ccffc..75ca23a3 100644
--- a/plans/01-latency-budget.md
+++ b/plans/01-latency-budget.md
@@ -72,6 +72,6 @@ Do not preserve every frame if the system falls behind. A real-time agent should
## Acceptance Criteria
- Every action trace includes capture timestamp, perception timestamp, decision timestamp, and input timestamp.
-- p50 reflex latency is under 60ms for the first demo.
-- p95 reflex latency is under 100ms for the first demo.
+- p50 reflex latency is under 60ms for the first supported target.
+- p95 reflex latency is under 100ms for the first supported target.
- Stale-frame actions are counted and visible in metrics.
diff --git a/plans/02-capture-and-perception.md b/plans/02-capture-and-perception.md
index 02e748b8..90b44736 100644
--- a/plans/02-capture-and-perception.md
+++ b/plans/02-capture-and-perception.md
@@ -85,14 +85,14 @@ For web targets, slow-path snapshots may include compact DOM summaries alongside
1. Capture a selected window at stable frame rate.
2. Measure capture latency and copy cost.
3. Build a region cropper.
-4. Add simple object detection for the first demo game.
+4. Add simple object detection for the first supported game.
5. Emit a world-state JSON event each frame.
6. Record traces for replay.
7. Benchmark screenshot-to-model inference on cropped regions.
## Acceptance Criteria
-- Capture can run at 30 FPS minimum for the first demo.
+- Capture can run at 30 FPS minimum for the first supported target.
- Perception p95 stays under 50ms.
- The controller never reads raw screenshots directly.
- Full-resolution snapshots are outside the reflex loop.
diff --git a/plans/03-fast-controller.md b/plans/03-fast-controller.md
index 2e122e1a..1dfe6b9c 100644
--- a/plans/03-fast-controller.md
+++ b/plans/03-fast-controller.md
@@ -105,7 +105,7 @@ The fast controller should treat planner output as configuration, not a blocking
## First Milestones
1. Define the world-state schema the controller consumes.
-2. Implement deterministic policies for the first demo game.
+2. Implement deterministic policies for the first supported game.
3. Add policy-selection logic.
4. Add confidence-aware fallback behavior.
5. Record every chosen action with the state snapshot id.
diff --git a/plans/05-action-engine.md b/plans/05-action-engine.md
index 1651a690..d9581a51 100644
--- a/plans/05-action-engine.md
+++ b/plans/05-action-engine.md
@@ -80,7 +80,7 @@ Movement keys should be represented as desired direction first, then converted t
3. Add input tracing.
4. Add focus guard.
5. Add emergency release.
-6. Calibrate mouse movement for first demo.
+6. Calibrate mouse movement for the first supported target.
## Acceptance Criteria
diff --git a/plans/06-benchmarking.md b/plans/06-benchmarking.md
index 3ccb4d89..f3473c26 100644
--- a/plans/06-benchmarking.md
+++ b/plans/06-benchmarking.md
@@ -79,7 +79,7 @@ This is the time from captured frame to input command execution inside the agent
capture_end -> perception_end -> controller_end -> input_execute
```
-This is the easiest latency to measure and should be present from the first prototype.
+This is the easiest latency to measure and should be present from the first supported build.
### Reflex Latency
@@ -237,7 +237,7 @@ Alerts should include the stage that regressed, the previous baseline, and the w
## Regression Gates
-For the first demo:
+For the first supported target:
- capture p95 under 15ms
- perception p95 under 50ms
@@ -269,7 +269,7 @@ Replay should support:
## Baselines
-Keep explicit baselines for each demo target and machine class.
+Keep explicit baselines for each supported target and machine class.
Example:
@@ -314,6 +314,6 @@ Do not compare runs across different machines without labeling them. Hardware di
- A single command can print the latest latency report.
- Trace files can explain why an action happened.
-- Performance regressions are visible before demo time.
+- Performance regressions are visible before release time.
- Latency trends can be compared across runs from different days.
- The system can identify whether capture, perception, controller, or input caused a regression.
diff --git a/plans/07-rollout.md b/plans/07-rollout.md
index c8d83e3a..9e0d4e64 100644
--- a/plans/07-rollout.md
+++ b/plans/07-rollout.md
@@ -1,8 +1,8 @@
# Rollout Plan
-## Phase 0: Prototype Target
+## Phase 0: First Supported Target
-Pick the first iPhone Mirroring target and define the minimum viable agent behavior.
+Pick the first iPhone Mirroring target and define the initial supported agent behavior.
Deliverables:
@@ -39,7 +39,7 @@ Success:
- input can be stopped safely
- taps/swipes are blocked when the wrong window has focus
-## Phase 2: Competent iPhone Game Demo
+## Phase 2: Competent iPhone Game Target
Expand from one reaction to a short playable loop.
@@ -111,12 +111,12 @@ Deliverables:
Success:
-- a second demo can reuse the same loop
+- a second target can reuse the same loop
- only perception and policy adapters need major changes
## Open Decisions
-- First iPhone demo game.
+- First supported iPhone game.
- Primary implementation language.
- macOS capture backend.
- macOS synthetic input backend.
diff --git a/plans/09-screenshot-model-inference.md b/plans/09-screenshot-model-inference.md
index 544de8e0..d75c492a 100644
--- a/plans/09-screenshot-model-inference.md
+++ b/plans/09-screenshot-model-inference.md
@@ -59,7 +59,7 @@ Pick the runtime based on measured latency in the target environment:
- platform-native acceleration when available
- ONNX Runtime for portable local inference
- TensorRT/Core ML/DirectML/OpenVINO where they reduce p95 latency
-- WebGPU/WebNN for browser-contained demos when practical
+- WebGPU/WebNN for browser-contained targets when practical
- CPU inference only when the model is tiny and predictable
Local LLM runners such as Ollama are useful for slow-path reasoning, planning, dialogue, UI understanding, and trace analysis. They should not be assumed suitable for the gameplay hot path just because they run locally. For per-frame control, prefer off-the-shelf detectors, segmenters, OCR, templates, classical CV, and deterministic policies that are benchmarked under the target p95 latency budget.
@@ -172,7 +172,7 @@ Slow-path outputs should become hints or updated configuration. They should not
1. Build raw screenshot capture into a fixed-size tensor.
2. Measure crop, resize, normalize, and copy costs separately.
-3. Add a tiny placeholder model or model stub with identical input/output shape.
+3. Add a tiny compatibility model with identical input/output shape.
4. Add one real low-latency model for the first visual task.
5. Emit model results into the common world-state schema.
6. Add latency and quality reports for recorded frames.
@@ -180,7 +180,7 @@ Slow-path outputs should become hints or updated configuration. They should not
## Acceptance Criteria
-- Screenshot-to-model p95 latency is under the perception budget for the first demo.
+- Screenshot-to-model p95 latency is under the perception budget for the first supported target.
- No PNG/JPEG encode/decode occurs in the reflex loop.
- Model cold-start/warmup is measured separately from steady-state latency.
- The controller receives structured world-state updates, not raw screenshots or tensors.
diff --git a/plans/10-gaps-to-expand.md b/plans/10-gaps-to-expand.md
index 1a15d8b4..abf96c5a 100644
--- a/plans/10-gaps-to-expand.md
+++ b/plans/10-gaps-to-expand.md
@@ -12,7 +12,7 @@ The architecture needs one concrete game or app to force decisions.
Open questions:
-- Which exact first game or browser demo?
+- Which exact first game or browser target?
- What is the minimum behavior that counts as success?
- What frame rate and reflex latency does that target require?
- Does the target expose DOM, pixels only, or both?
@@ -35,7 +35,7 @@ Expand into:
- macOS capture backend
- Windows capture backend
- Linux capture backend, if needed
-- browser-only capture path, if using a web demo
+- browser-only capture path, if using a web target
- input backend per OS
- permission setup and failure handling
@@ -211,7 +211,7 @@ Deliverable:
Why it matters:
-This is how the project avoids hardcoding one demo while still staying latency-first.
+This is how the project avoids hardcoding one target while still staying latency-first.
## Priority 3: Model Lifecycle
@@ -291,7 +291,7 @@ The project needs commands that make latency work pleasant.
Expand into:
-- run live demo
+- run live validation
- record trace
- replay trace
- print latency report
diff --git a/plans/11-game-targets.md b/plans/11-game-targets.md
index 268b27d4..42b51965 100644
--- a/plans/11-game-targets.md
+++ b/plans/11-game-targets.md
@@ -187,7 +187,7 @@ Why:
- it proves the system can handle fast visual mobile gameplay
- it stresses swipes, timing, perception, and latency
-- it gives a compelling demo
+- it gives a compelling production proving ground
## Decision Matrix
@@ -196,7 +196,7 @@ Why:
| iPhone Safari harness | high | high | low | low | start here |
| iPhone tap game | medium | high | low-medium | low-medium | second |
| iPhone swipe puzzle/game | medium-high | high | medium | medium | second |
-| Subway Surfers via iPhone Mirroring | high | high | high | medium-high | flagship demo |
+| Subway Surfers via iPhone Mirroring | high | high | high | medium-high | flagship target |
| Controller-supported iPhone game | high | high | medium | high | later backend |
| Local browser game | high | low-medium | low | low | support harness |
| Atari/Gymnasium | high | low | medium | medium | policy harness |
@@ -233,4 +233,3 @@ Then run the same agent architecture against:
3. Subway Surfers through iPhone Mirroring
4. controller-supported iPhone games once the controller backend is solved
5. browser/emulator targets only as supporting harnesses
-
diff --git a/plans/13-subway-surfers-target.md b/plans/13-subway-surfers-target.md
index cd02d621..f74bb1b6 100644
--- a/plans/13-subway-surfers-target.md
+++ b/plans/13-subway-surfers-target.md
@@ -4,7 +4,7 @@
Use Subway Surfers as a high-pressure iPhone Mirroring target for low-latency screenshot perception and swipe control.
-This is a strong demo candidate, but not the first prototype. The game is fast, visual, and swipe-driven, so it should come after the agent can reliably capture, calibrate, and input into the iPhone Mirroring window.
+This is a strong production-readiness target, but not the first supported target. The game is fast, visual, and swipe-driven, so it should come after the agent can reliably capture, calibrate, and input into the iPhone Mirroring window.
## Why Subway Surfers
diff --git a/plans/16-iphone-gameplay-roadmap.md b/plans/16-iphone-gameplay-roadmap.md
index b9efd6df..add30fd0 100644
--- a/plans/16-iphone-gameplay-roadmap.md
+++ b/plans/16-iphone-gameplay-roadmap.md
@@ -78,7 +78,7 @@ Target:
Purpose:
-- flagship latency and perception demo
+- flagship latency and perception target
- lane tracking
- obstacle detection
- left/right/up/down swipe control
@@ -134,7 +134,7 @@ Measure both latency and game competence:
## Immediate Build Order
-1. Finish the macOS synthetic controller prototype.
+1. Finish the macOS synthetic controller foundation.
2. Add iPhone Mirroring window/content detection.
3. Add a calibration command for tap and four swipe directions.
4. Add screenshot capture of the calibrated content rectangle.
diff --git a/plans/20-off-the-shelf-run-loop.md b/plans/20-off-the-shelf-run-loop.md
index bab85cc8..4577ee6c 100644
--- a/plans/20-off-the-shelf-run-loop.md
+++ b/plans/20-off-the-shelf-run-loop.md
@@ -247,7 +247,7 @@ Do not use LLMs for:
LLM output must become validated hints, not direct actions.
-## First Demo Recommendation
+## First Supported Target Recommendation
Pick one game and one task.
diff --git a/plans/done/21-swiftui-pointer-ui.md b/plans/done/21-swiftui-pointer-ui.md
new file mode 100644
index 00000000..de3974a5
--- /dev/null
+++ b/plans/done/21-swiftui-pointer-ui.md
@@ -0,0 +1,27 @@
+# SwiftUI Pointer UI
+
+## Goal
+
+Add the production macOS SwiftUI pointer prompt UI while keeping the future real-time run loop and AI harness decoupled behind explicit integration boundaries.
+
+## Completed Shape
+
+- SwiftPM macOS app lives under `apps/Donkey/`.
+- UI renders the supported pointer prompt as a floating SwiftUI/AppKit overlay.
+- Command-click anywhere activates the agent pointer and focuses the prompt input.
+- 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/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.
+
+## Acceptance
+
+- `swift build` succeeds from `apps/Donkey/`.
+- No Swift test target is included because the local Command Line Tools install does not provide `XCTest` or Swift `Testing`.
+- `swift run Donkey` launches the Donkey pointer UI.
+
+## Guide
+
+- Product support guide: `docs/guides/pointer-prompt-overlay.md`