1
---
2
name: automate-this
3
description: 'Analyze a screen recording of a manual process and produce targeted, working automation scripts. Extracts frames and audio narration from video files, reconstructs the step-by-step workflow, and proposes automation at multiple complexity levels using tools already installed on the user machine.'
4
---
5
6
# Automate This
7
8
Analyze a screen recording of a manual process and build working automation for it.
9
10
The user records themselves doing something repetitive or tedious, hands you the video file, and you figure out what they're doing, why, and how to script it away.
11
12
## Prerequisites Check
13
14
Before analyzing any recording, verify the required tools are available. Run these checks silently and only surface problems:
15
16
```bash
17
command -v ffmpeg >/dev/null 2>&1 && ffmpeg -version 2>/dev/null | head -1 || echo "NO_FFMPEG"
18
command -v whisper >/dev/null 2>&1 || command -v whisper-cpp >/dev/null 2>&1 || echo "NO_WHISPER"
19
```
20
21
- **ffmpeg is required.** If missing, tell the user: `brew install ffmpeg` (macOS) or the equivalent for their OS.
22
- **Whisper is optional.** Only needed if the recording has narration. If missing AND the recording has an audio track, suggest: `pip install openai-whisper` or `brew install whisper-cpp`. If the user declines, proceed with visual analysis only.
23
24
## Phase 1: Extract Content from the Recording
25
26
Given a video file path (typically on `~/Desktop/`), extract both visual frames and audio:
27
28
### Frame Extraction
29
30
Extract frames at one frame every 2 seconds. This balances coverage with context window limits.
31
32
```bash
33
WORK_DIR=$(mktemp -d "${TMPDIR:-/tmp}/automate-this-XXXXXX")
34
chmod 700 "$WORK_DIR"
35
mkdir -p "$WORK_DIR/frames"
36
ffmpeg -y -i "<VIDEO_PATH>" -vf "fps=0.5" -q:v 2 -loglevel warning "$WORK_DIR/frames/frame_%04d.jpg"
37
ls "$WORK_DIR/frames/" | wc -l
38
```
39
40
Use `$WORK_DIR` for all subsequent temp file paths in the session. The per-run directory with mode 0700 ensures extracted frames are only readable by the current user.
41
42
If the recording is longer than 5 minutes (more than 150 frames), increase the interval to one frame every 4 seconds to stay within context limits. Tell the user you're sampling less frequently for longer recordings.
43
44
### Audio Extraction and Transcription
45
46
Check if the video has an audio track:
47
48
```bash
49
ffprobe -i "<VIDEO_PATH>" -show_streams -select_streams a -loglevel error | head -5
50
```
51
52
If audio exists:
53
54
```bash
55
ffmpeg -y -i "<VIDEO_PATH>" -ac 1 -ar 16000 -loglevel warning "$WORK_DIR/audio.wav"
56
57
# Use whichever whisper binary is available
58
if command -v whisper >/dev/null 2>&1; then
59
whisper "$WORK_DIR/audio.wav" --model small --language en --output_format txt --output_dir "$WORK_DIR/"
60
cat "$WORK_DIR/audio.txt"
61
elif command -v whisper-cpp >/dev/null 2>&1; then
62
whisper-cpp -m "$(brew --prefix 2>/dev/null)/share/whisper-cpp/models/ggml-small.bin" -l en -f "$WORK_DIR/audio.wav" -otxt -of "$WORK_DIR/audio"
63
cat "$WORK_DIR/audio.txt"
64
else
65
echo "NO_WHISPER"
66
fi
67
```
68
69
If neither whisper binary is available and the recording has audio, inform the user they're missing narration context and ask if they want to install Whisper (`pip install openai-whisper` or `brew install whisper-cpp`) or proceed with visual-only analysis.
70
71
## Phase 2: Reconstruct the Process
72
73
Analyze the extracted frames (and transcript, if available) to build a structured understanding of what the user did. Work through the frames sequentially and identify:
74
75
1. **Applications used** — Which apps appear in the recording? (browser, terminal, Finder, mail client, spreadsheet, IDE, etc.)
76
2. **Sequence of actions** — What did the user do, in order? Click-by-click, step-by-step.
77
3. **Data flow** — What information moved between steps? (copied text, downloaded files, form inputs, etc.)
78
4. **Decision points** — Were there moments where the user paused, checked something, or made a choice?
79
5. **Repetition patterns** — Did the user do the same thing multiple times with different inputs?
80
6. **Pain points** — Where did the process look slow, error-prone, or tedious? The narration often reveals this directly ("I hate this part," "this always takes forever," "I have to do this for every single one").
81
82
Present this reconstruction to the user as a numbered step list and ask them to confirm it's accurate before proposing automation. This is critical — a wrong understanding leads to useless automation.
83
84
Format:
85
86
```
87
Here's what I see you doing in this recording:
88
89
1. Open Chrome and navigate to [specific URL]
90
2. Log in with credentials
91
3. Click through to the reporting dashboard
92
4. Download a CSV export
93
5. Open the CSV in Excel
94
6. Filter rows where column B is "pending"
95
7. Copy those rows into a new spreadsheet
96
8. Email the new spreadsheet to [recipient]
97
98
You repeated steps 3-8 three times for different report types.
99
100
[If narration was present]: You mentioned that the export step is the slowest
101
part and that you do this every Monday morning.
102
103
Does this match what you were doing? Anything I got wrong or missed?
104
```
105
106
Do NOT proceed to Phase 3 until the user confirms the reconstruction is accurate.
107
108
## Phase 3: Environment Fingerprint
109
110
Before proposing automation, understand what the user actually has to work with. Run these checks:
111
112
```bash
113
echo "=== OS ===" && uname -a
114
echo "=== Shell ===" && echo $SHELL
115
echo "=== Python ===" && { command -v python3 && python3 --version 2>&1; } || echo "not installed"
116
echo "=== Node ===" && { command -v node && node --version 2>&1; } || echo "not installed"
117
echo "=== Homebrew ===" && { command -v brew && echo "installed"; } || echo "not installed"
118
echo "=== Common Tools ===" && for cmd in curl jq playwright selenium osascript automator crontab; do command -v $cmd >/dev/null 2>&1 && echo "$cmd: yes" || echo "$cmd: no"; done
119
```
120
121
Use this to constrain proposals to tools the user already has. Never propose automation that requires installing five new things unless the simpler path genuinely doesn't work.
122
123
## Phase 4: Propose Automation
124
125
Based on the reconstructed process and the user's environment, propose automation at up to three tiers. Not every process needs three tiers — use judgment.
126
127
### Tier Structure
128
129
**Tier 1 — Quick Win (under 5 minutes to set up)**
130
The smallest useful automation. A shell alias, a one-liner, a keyboard shortcut, an AppleScript snippet. Automates the single most painful step, not the whole process.
131
132
**Tier 2 — Script (under 30 minutes to set up)**
133
A standalone script (bash, Python, or Node — whichever the user has) that automates the full process end-to-end. Handles common errors. Can be run manually when needed.
134
135
**Tier 3 — Full Automation (under 2 hours to set up)**
136
The script from Tier 2, plus: scheduled execution (cron, launchd, or GitHub Actions), logging, error notifications, and any necessary integration scaffolding (API keys, auth tokens, etc.).
137
138
### Proposal Format
139
140
For each tier, provide:
141
142
```
143
## Tier [N]: [Name]
144
145
**What it automates:** [Which steps from the reconstruction]
146
**What stays manual:** [Which steps still need a human]
147
**Time savings:** [Estimated time saved per run, based on the recording length and repetition count]
148
**Prerequisites:** [Anything needed that isn't already installed — ideally nothing]
149
150
**How it works:**
151
[2-3 sentence plain-English explanation]
152
153
**The code:**
154
[Complete, working, commented code — not pseudocode]
155
156
**How to test it:**
157
[Exact steps to verify it works, starting with a dry run if possible]
158
159
**How to undo:**
160
[How to reverse any changes if something goes wrong]
161
```
162
163
### Application-Specific Automation Strategies
164
165
Use these strategies based on which applications appear in the recording:
166
167
**Browser-based workflows:**
168
- First choice: Check if the website has a public API. API calls are 10x more reliable than browser automation. Search for API documentation.
169
- Second choice: `curl` or `wget` for simple HTTP requests with known endpoints.
170
- Third choice: Playwright or Selenium for workflows that require clicking through UI. Prefer Playwright — it's faster and less flaky.
171
- Look for patterns: if the user is downloading the same report from a dashboard repeatedly, it's almost certainly available via API or direct URL with query parameters.
172
173
**Spreadsheet and data workflows:**
174
- Python with pandas for data filtering, transformation, and aggregation.
175
- If the user is doing simple column operations in Excel, a 5-line Python script replaces the entire manual process.
176
- `csvkit` for quick command-line CSV manipulation without writing code.
177
- If the output needs to stay in Excel format, use openpyxl.
178
179
**Email workflows:**
180
- macOS: `osascript` can control Mail.app to send emails with attachments.
181
- Cross-platform: Python `smtplib` for sending, `imaplib` for reading.
182
- If the email follows a template, generate the body from a template file with variable substitution.
183
184
**File management workflows:**
185
- Shell scripts for move/copy/rename patterns.
186
- `find` + `xargs` for batch operations.
187
- `fswatch` or `watchman` for triggered-on-change automation.
188
- If the user is organizing files into folders by date or type, that's a 3-line shell script.
189
190
**Terminal/CLI workflows:**
191
- Shell aliases for frequently typed commands.
192
- Shell functions for multi-step sequences.
193
- Makefiles for project-specific task sets.
194
- If the user ran the same command with different arguments, that's a loop.
195
196
**macOS-specific workflows:**
197
- AppleScript/JXA for controlling native apps (Mail, Calendar, Finder, Preview, etc.).
198
- Shortcuts.app for simple multi-app workflows that don't need code.
199
- `automator` for file-based workflows.
200
- `launchd` plist files for scheduled tasks (prefer over cron on macOS).
201
202
**Cross-application workflows (data moves between apps):**
203
- Identify the data transfer points. Each transfer is an automation opportunity.
204
- Clipboard-based transfers in the recording suggest the apps don't talk to each other — look for APIs, file-based handoffs, or direct integrations instead.
205
- If the user copies from App A and pastes into App B, the automation should read from A's data source and write to B's input format directly.
206
207
### Making Proposals Targeted
208
209
Apply these principles to every proposal:
210
211
1. **Automate the bottleneck first.** The narration and timing in the recording reveal which step is actually painful. A 30-second automation of the worst step beats a 2-hour automation of the whole process.
212
213
2. **Match the user's skill level.** If the recording shows someone comfortable in a terminal, propose shell scripts. If it shows someone navigating GUIs, propose something with a simple trigger (double-click a script, run a Shortcut, or type one command).
214
215
3. **Estimate real time savings.** Count the recording duration and multiply by how often they do it. "This recording is 4 minutes. You said you do this daily. That's 17 hours per year. Tier 1 cuts it to 30 seconds each time — you get 16 hours back."
216
217
4. **Handle the 80% case.** The first version of the automation should cover the common path perfectly. Edge cases can be handled in Tier 3 or flagged for manual intervention.
218
219
5. **Preserve human checkpoints.** If the recording shows the user reviewing or approving something mid-process, keep that as a manual step. Don't automate judgment calls.
220
221
6. **Propose dry runs.** Every script should have a mode where it shows what it *would* do without doing it. `--dry-run` flags, preview output, or confirmation prompts before destructive actions.
222
223
7. **Account for auth and secrets.** If the process involves logging in or using credentials, never hardcode them. Use environment variables, keychain access (macOS `security` command), or prompt for them at runtime.
224
225
8. **Consider failure modes.** What happens if the website is down? If the file doesn't exist? If the format changes? Good proposals mention this and handle it.
226
227
## Phase 5: Build and Test
228
229
When the user picks a tier:
230
231
1. Write the complete automation code to a file (suggest a sensible location — the user's project directory if one exists, or `~/Desktop/` otherwise).
232
2. Walk through a dry run or test with the user watching.
233
3. If the test works, show how to run it for real.
234
4. If it fails, diagnose and fix — don't give up after one attempt.
235
236
## Cleanup
237
238
After analysis is complete (regardless of outcome), clean up extracted frames and audio:
239
240
```bash
241
rm -rf "$WORK_DIR"
242
```
243
244
Tell the user you're cleaning up temporary files so they know nothing is left behind.
245