Inspiration

Rebuilding or migrating an app often starts with someone clicking through the old version and taking notes about what each screen does and which services it talks to. Those notes take time to write and quickly go stale.

I built Retrace to record an app being used normally and turn that recording into documentation a team can review, correct, and build from.

What it does

Retrace is a native macOS menu bar app. Pick a running app, press Start Observing App Activity, and use it normally. There’s no task description to fill in.

While the chosen app is in front, Retrace records:

  • Clicks and scrolls, kept only when the element under the pointer belongs to that app.
  • Named keys and shortcuts such as return, arrows, and cmd+s. Typing appears as a redacted burst; the characters are never stored.
  • Accessibility metadata, including roles, titles, labels, and window titles. Field contents are never read, and secure fields retain only their role.
  • Screenshots of the app’s windows before an action, just afterward, and once the screen settles.

Capture pauses automatically when you switch apps, lock the screen, or open the Retrace menu.

Press Stop & Review to inspect every frame and event. You can omit evidence and strip window or element titles before confirming the review. Nothing leaves your Mac until you press Upload & Analyze, and only the evidence you kept is uploaded.

The local workspace processes the reviewed evidence through four bounded analysis stages to produce a UI flow and associate captured API traffic with the actions that triggered it.

The dashboard groups recordings by app. Each app card provides:

  • API docs: endpoints grouped by host, method, and normalized path, such as /api/invoices/{id}/send. Entries include call counts, status codes, query parameters, redacted example URLs, first and last sightings, and links to the associated UI actions.
  • Export for FigJam: an evidence-validated flow graph downloaded as JSON.
  • Board link: a saved link to the FigJam board where you imported the flow.

The FigJam plugin turns the exported graph into editable shapes and connectors. Steps follow the recorded interaction order, long flows wrap into a snake layout, and API calls appear below their associated actions. Shapes retain their evidence IDs, and human-corrected labels are marked with ✎.

How I built it

  • macOS recorder: Swift 6.2, SwiftUI MenuBarExtra, ScreenCaptureKit, and the Accessibility API with global event monitors. A separate RetraceCore module handles manifests, validation, review and redaction, local storage, Keychain credentials, and multipart uploads. It can be tested without macOS capture permissions.
  • Backend: FastAPI and Pydantic for loopback-only device connection, evidence ingestion, and the four-stage analysis pipeline.
  • Shared state: SpacetimeDB for private per-viewer state, incremental analysis jobs, and preserved human corrections.
  • Web: Next.js for the landing page and local workspace, with authorized SpacetimeDB subscriptions. Recording grouping and API documentation generation are pure functions with their own tests.
  • FigJam plugin: validates exported graph JSON and creates editable FigJam objects. Its layout logic runs under node --test without the Figma API.
  • Network capture: an optional mitmproxy helper captures local traffic and exports sanitized evidence.

Challenges I ran into

  • Keeping capture inside one app. Global event monitors see activity across the system. Each click must be checked against the Accessibility element or top window under the pointer and discarded if it belongs to another process.
  • Recording shortcuts without recording text. Retrace classifies key codes against an allow-list without reading characters, so ordinary typing becomes a redacted burst.
  • Keeping evidence in order. Events use the monotonic uptime clock shared by NSEvent.timestamp, preventing wall-clock changes from reordering a session.
  • Handling macOS permissions. Ad hoc signed rebuilds can appear as a new app to macOS, requiring Accessibility, Screen Recording, and Keychain permissions to be granted again.
  • Making the flow readable. The first dashboard used a free-form graph canvas that was difficult to follow. I moved the editable flow into FigJam and focused the dashboard on a practical lookup task: finding which endpoints an app calls.

Accomplishments I’m proud of

  • Enforcing privacy in code: sessions use 0700/0600 permissions, are excluded from backups, and have their frames re-hashed before upload. The device token is sent only to loopback addresses.
  • Building retrace-cli validate to check manifest UUIDs, event ordering, frame references, allowed keys, and secure-field stripping.
  • Recording a real macOS Mail session with app-only screenshots and automatic capture pauses when Mail lost focus.
  • Generating API documentation from captured traffic, with normalized paths, redacted query secrets, and references back to the recorded interactions.

What I learned

Privacy guarantees need to be enforced where data is captured. Never reading AXValue and never storing typed characters removed entire categories of sensitive data from the recording.

Separating those rules into a permission-free core module also made them easier to test. I could verify the privacy behavior directly instead of relying entirely on manual recording sessions.

What’s next for Retrace

  • Add vision-based screenshot analysis to enrich the recorded UI flow.
  • Integrate network capture into the recorder so it requires no separate helper setup.
  • Add Developer ID signing and notarization to make installation and updates smoother.
  • Verify the full export and import workflow on a live FigJam board.

Built With

  • fastapi
  • figma-plugin-api
  • macos-accessibility
  • next.js
  • nvidia-nemotron
  • pydantic
  • python
  • react
  • screencapturekit
  • spacetimedb
  • swift
  • swiftui
  • typescript
Share this project:

Updates

Submission history