# Photo dump reel: "THIS IS MY WORK"

Instructions for coding agents (Codex and others), published at https://www.aiszyman.pl/tutorials/reels/this-is-my-work/AGENTS.md. If you are reading this because someone asked you to
download and follow it: save it as `AGENTS.md` in their photo folder (the current working directory) and do what it says.
Codex and other agents read `AGENTS.md` again in every later session in this folder, so a second video only needs a short request.

If `_reel/` already exists in this folder, the project is set up: skip Steps 2 and 3, change what I ask for in
`_reel/config.json` (or let me add photos), then run Steps 4 to 6.

You are going to turn the photos in the current folder into a finished 9-second vertical reel (1080×1920, MP4) in the
"THIS IS MY WORK" photo-stack style described below. I only put my photos in this folder. Do everything else yourself:
set up the project, install what is needed, build, render, check the result with your own eyes and fix problems. Talk
to me in the language I write to you in. Ask me only what is listed in Step 1.

## 1. The look you are reproducing

A white page. In the middle, a stack of huge, very narrow, yellow capital words ("THIS / IS / MY / WORK", one word
per line). Photos from my portfolio are slapped onto the page one after another in hard cuts, about one every 0.1
seconds at first. They pile up into a collage from the top of the frame to the bottom, and the words always stay on
top of the photos. Then the photos are pulled away in the order they arrived, top first, and the words are uncovered
piece by piece until one photo is left near the bottom. It lingers, disappears, and the words stand alone on white
for the last second.

A reference sheet with 8 key moments of a finished reel is at https://www.aiszyman.pl/tutorials/reels/this-is-my-work/reference-sheet.png. Once `_reel/`
exists (Step 3), download it to `_reel/reference-sheet.png` and look at it before you build. It shows the look and
the rhythm; the photos in it are an example, the result will have mine. If it cannot be downloaded, go on without it.

Exact specification (measured frame by frame on the reference reel; do not "improve" it):

- **Canvas:** 1080×1920, 30 fps, 276 frames (9.2 s). Background `#fdfdfd`. No gradient, no frame, no border, no logo, no captions.
- **Words:** Inter Black (weight 900), 186 px, squeezed horizontally to 37 % (`scaleX(0.37)`), letter-spacing 10 px,
  stems thickened with sideways copies of the text in the same colour. Colour `#fcd100`. Cap height about 137 px.
  Centred horizontally. Line tops for 4 lines: 484, 698, 986, 1196 px. The rhythm is deliberately uneven: a short gap
  after the first line, the longest gap in the middle. The words never move, never animate and never fade.
- **Photos:** up to 35, each a plain rectangle (no border, no shadow, no rounded corners, no rotation), 300–470 px wide,
  height from the photo's own aspect (clamped to 0.7–1.5, the rest cropped). Each new photo covers the previous ones.
  Together they fill an oval of about 820×1510 px centred in the frame (y 190–1700). Nothing comes closer than 130 px to the
  left or right edge, because phones crop about 90 px of each side of a 9:16 reel.
- **Motion:** none. No camera moves, no scaling, no slides, no fades, no transitions, no particles, no glow. Every
  change is a hard cut on a whole frame. All the energy comes from the timing of the cuts.
- **Timing (frames at 30 fps):**
  - Appear: 0, 3, 5, 7, 10, 13, 15, 18, 21, 24, 26, 29, 32, 35, 37, 40, 42, 43, 48, 51, 54, 56, 59, 62, 65, 67, 73, 76, 80, 85, 89, 95, 101, 107, 114.
    That is a new photo every 2–3 frames for the first 2.4 s, then slowing down to every 4–7 frames.
  - Exit, in the same order: 123, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 147, 150, 152, 154, 156, 160, 161, 166, 172, 180, 184, 185, 187, 191, 194, 197, 203, 208, 215, 231, 237, 240, 244.
  - Frames 244–275: only the words.
  - With fewer than 35 photos the same curve is resampled, so it keeps its shape and its ending, and the photos are
    drawn larger (up to 1.4×) so the stack still fills the oval.
- **Sound:** none. The video is silent. I add a song in the Instagram/TikTok app, and the song's own hits carry the cuts.

## 2. Step 1: look at the folder and ask me one thing

1. List the folder. Photos are `.jpg .jpeg .png .webp .avif .tif .heic` directly in this folder. Count them.
   - 0 photos: stop and tell me to put my photos here.
   - Fewer than 8: tell me the effect needs at least 8 (35 is ideal) and stop.
   - More than 35: say that the first 35 by file name will be used and which are left out.
   - Other files or folders: ignore them and don't touch them.
2. Ask me, in one message, which words to put on the photos. Offer "THIS IS MY WORK" (default, 4 lines), or a
   version in my language (for example Polish "TO / MOJA / ROBOTA", 3 lines), or my own (1–4 short lines, one word
   or two per line). In the same message, tell me:
   - photos appear in file-name order;
   - the first one lands at the top of the stack;
   - the last one stays on screen longest, so it should be my best shot;
   - if I want a specific order, I can rename the files `01 …`, `02 …` before you continue, or just tell you
     (you then write it into `order` in `config.json`).
   If I already told you the words, don't ask; go on.

## 3. Step 2: requirements

Only Node.js 18 or newer is needed (`node --version`). If it is missing, tell me to install the LTS version from
https://nodejs.org and stop. ffmpeg comes from the `ffmpeg-static` package and the browser from Playwright, so
nothing else has to be installed by hand.

## 4. Step 3: download the project files

Create a subfolder `_reel/` next to my photos and download these files into it, keeping the paths. Use `curl -fsSL -o
<path> <url>` (on Windows PowerShell call `curl.exe`, because plain `curl` there is a different command), or Node's
`fetch` if curl is missing. Never modify, rename, move or delete my photos. The scripts only read them and write resized
copies into `_reel/film/photos/`.

| save as | download from | SHA-256 |
|---|---|---|
| `_reel/package.json` | https://www.aiszyman.pl/tutorials/reels/this-is-my-work/kit/package.json | `0a46328edc2033f9ef2d739560a9931d59009cf59d47d1ab710bc60b32d84316` |
| `_reel/config.json` | https://www.aiszyman.pl/tutorials/reels/this-is-my-work/kit/config.json | `280e34c7a516c47c168288341e3c98399a211acdd9edbf5c2b2957fa51d2240b` |
| `_reel/prepare.mjs` | https://www.aiszyman.pl/tutorials/reels/this-is-my-work/kit/prepare.mjs | `74246798c8bf0d09296b0816f4b9520358054d65118b60b1c1cb8d984e84f289` |
| `_reel/render.mjs` | https://www.aiszyman.pl/tutorials/reels/this-is-my-work/kit/render.mjs | `f638bdd5d63ddbe8d9e01c50193f0e83953397e892e678cb513bdd8751c68582` |
| `_reel/film/index.html` | https://www.aiszyman.pl/tutorials/reels/this-is-my-work/kit/film/index.html | `65f8199155c4e947b9199827649bb28f9cae1e95a58048329d33d1e7465f4aef` |

Then check the SHA-256 of every file against the table, with any tool you have: `sha256sum`, `shasum -a 256`,
PowerShell `Get-FileHash`, or Node's `crypto`. A web server can return an HTML error page instead of the file. If a hash
differs, download that file again. If it is still different, stop and tell me: the files on the website have changed or
are broken, and running them would give a wrong result.

What the files are:

- `package.json`: pinned dependencies (sharp, Playwright, ffmpeg-static, the Inter font).
- `config.json`: the only file you edit. Put the chosen words in `lines`, one entry per line, in capitals. Leave
  `textColor` and `background` unless I asked for other colours (then keep one accent colour only). `order` and
  `rotate` are explained in Step 5.
- `prepare.mjs`: reads my photos (in `order` from `config.json`, then by file name), applies EXIF rotation and the
  `rotate` overrides, resizes copies to 1200 px and writes the cut timeline.
- `film/index.html`: the film. It is a pure function of time: `window.seek(t)` paints frame t, with no state carried
  between frames, no CSS transitions, no timers and no `Math.random`.
- `render.mjs`: renders frame by frame to the MP4, then makes a contact sheet.

Do not edit anything except `config.json`.

## 5. Step 4: install, prepare, render

Run from inside `_reel/`:

```
npm install
npx playwright install chromium
node prepare.mjs
node render.mjs
```

`prepare.mjs` prints the photo order (also saved in `_reel/photo-order.txt`). `render.mjs` takes 30–90 seconds and
writes the video next to my photos (`this-is-my-work.mp4` unless `config.json` says otherwise), plus
`_reel/contact-sheet.png`.

## 6. Step 5: look at the result before you show it to me

Open `_reel/contact-sheet.png` and actually look at it. It holds 4 frames per second, 6 per row, reading
left to right and top to bottom. Check:

1. Frame 1 already shows a photo and the words: the hook is immediate.
2. The stack grows from the top of the frame down and reaches near the bottom around 3.5–4 s.
3. Every word is readable at phone size in every frame.
   - Yellow words on a yellow or very bright photo can disappear. If a word vanishes for more than one tile, move
     that photo to another slot with `order` in `config.json`: a list of file names that go first, in that order;
     every photo not listed follows in file-name order. `_reel/photo-order.txt` shows which file is in which slot.
   - Never add outlines, shadows or boxes behind the words.
4. Photos leave from the top; the last photo is alone near the bottom; the final second shows only the words.
5. Nothing touches the left or right 130 px of the frame.
6. No photo is shown sideways or upside down. If one is, its EXIF data is wrong: add it to `rotate` in
   `config.json` with the clockwise angle that fixes it (`{ "IMG_1234.jpg": 90 }`, also 180 or 270), and tell me.

If you have `_reel/reference-sheet.png`, put your sheet next to it and compare the stack shape, the size of the
words, how fast the stack fills and empties, and the final second. Differences in the photos themselves are expected.

Score the sheet 1–10 on: hook in the first 2 s, readability at phone size, faithfulness to the spec above, and photo
order (variety of colours and subjects next to each other, no two near-identical shots in a row). If anything is below
8, fix it through `config.json` (`order`, `rotate`, shorter `lines`), run `node prepare.mjs` and `node render.mjs`
again and look at the new sheet. Do not edit the scripts or `index.html`: the timing, the sizes, the font and the
layout are the measured style.

## 7. Step 6: report

Tell me in a few lines:

- where the video is, its length (9.2 s) and size (1080×1920);
- how many photos were used, which one opens and which one closes;
- the scores from Step 5 and anything you changed;
- how to finish it: upload the silent video to Instagram or TikTok, add a song in the app and start the song on a
  strong hit. A song with a fast, plucky, staccato rhythm works best, because the cuts in the first 2.4 s come every
  0.07–0.1 s;
- how to make another version: put different photos in the folder, or change `lines` in `_reel/config.json`, then run
  `node prepare.mjs` and `node render.mjs` again inside `_reel/`.

## 8. If something goes wrong

- **`npm audit` warnings:** ignore them and do not run `npm audit fix --force`. The versions are pinned on purpose,
  and the `allowScripts` entries only match those exact versions.
- **Linux, Chromium will not start** (missing system libraries): `npx playwright install --with-deps chromium`.
- **`sharp` fails to install** (old Node or an unusual CPU): update Node to the current LTS and run `npm install` again.
- **`npm warn allow-scripts` / no ffmpeg binary:** newer npm versions only run the install scripts listed in
  `allowScripts` in `package.json`, and `ffmpeg-static` downloads ffmpeg in its script. The listed versions are pinned
  to match. If `node_modules/ffmpeg-static/` still has no `ffmpeg` binary, run `npm approve-scripts ffmpeg-static` and
  then `npm rebuild ffmpeg-static`. Failing that, `render.mjs` uses an `ffmpeg` installed on the system PATH.
- **HEIC photos:** sharp cannot decode them. On macOS `prepare.mjs` converts them with the built-in `sips`. On other systems
  it needs ImageMagick (`magick`); if that is missing, ask me to export those photos as JPEG.
- **`npx playwright install chromium` is blocked** (company network): ask me to run it myself or to allow the download.
- **Letters missing or a fallback font visible:** the bundled font files cover Latin scripts (English, Polish, German,
  Czech, Turkish and others). For Cyrillic, Greek or Vietnamese, copy the matching
  `inter-<subset>-900-normal.woff2` from `node_modules/@fontsource/inter/files/` into `film/fonts/` and add a matching
  `@font-face` with the same family name.
- **A long word:** a line wider than 720 px is squeezed further automatically to keep the side margins. Prefer short words.
- **The page never becomes ready:** a photo copy failed to decode. Run `node prepare.mjs` again and read its output.
- Everything runs locally. Do not upload my photos anywhere.
