← Tous les articles

Track every AI-generated asset with an agent skill

Generated images arrive signed and lose the credential inside your own repo: sharp, canvas, ffmpeg, a CDN resize. A lockfile of every media file, a LOST line when one changes, and nothing to wire into CI.

Par c2pa.design · Mis à jour le 2026-10-07 · 8 min de lecture

Article 50 is mentioned once below as context; the rest is engineering.

Your coding agent generates a hero image with gpt-image, saves it to public/, and then writes the script that makes a WebP and a thumbnail out of it. The original came back with a C2PA manifest signed by OpenAI. The two files your site actually serves have none. Nobody decided that. A default did.

This happens inside repositories, not on social platforms, and it happens in commits nobody reads for provenance. Game studios with a few hundred sprites, apps that store generated avatars, marketing sites with a folder of campaign art: the credential is there on day one and gone by the next build.

The repo needs a record of which files were signed when they arrived, and a diff that names the first one that stops being signed.

A paper trimmer cuts a sealed interior photo; the narrow cut-off strip loses its seal, which falls in half. Behind it a lockfile sheet has one row outlined in violet.

Who signs what you generate

Source Signs output with C2PA Conforming Products List record
OpenAI (gpt-image API, ChatGPT, Codex imagegen) Yes OpenAI Media Service, conformant 2026-01-28
Google (Gemini, Imagen, Flow) Yes Google Media Processing Services, Google Flow (2026-07-21)
Adobe Yes Adobe Content Authenticity, conformant 2026-10-05
Amazon Bedrock Yes Conformant 2026-07-10
Runway Yes Conformant 2026-09-15

A credential is a signature over exact bytes. It survives copying, git add and a base64 round trip. It does not survive anything that decodes pixels and encodes them again.

Where it breaks inside your own code

Step Typical code What happens to the manifest
Resize or format conversion sharp(buf).resize(800).webp() sharp drops all metadata by default. keepMetadata() keeps EXIF, XMP and ICC; the output is still new bytes, so a manifest would no longer match them.
Browser-side edit canvas.toBlob(cb, 'image/webp') The canvas holds pixels only. The blob has no metadata.
Python pipeline Image.open(p).save(q) Pillow writes a new file; nothing it does not know about is carried.
Video ffmpeg -i in.mp4 -vf scale=1280:-2 out.mp4 A new container and new samples; the C2PA box is not written.
Image optimiser at build next/image, vite-imagetools, imagemin Each variant is a re-encode.
CDN resize ?width=800, format negotiation to AVIF The CDN serves a variant it encoded itself.
Screenshot or copy from a design tool Figma export, macOS screenshot New pixels, no manifest.

Three outcomes come out of that table. The file reads absent because the manifest was dropped. The file reads present_invalid because the manifest was copied onto bytes it does not describe. Or the original stays signed and is never served, which is fine for the record and useless for the user.

The second outcome is the worst. A present_invalid file says "this changed after signing", which a verifier shows as altered when all you did was resize it.

Why the obvious fixes are not enough

Checking once by hand. You can open the generated file in a verifier and see it signed. That tells you about one file on one day. The next generated image goes through a script written last month by someone else's agent.

A CI job. It works if you have CI, if the job sees the media, and if someone maintains it. Most small studios and solo developers generating art have none of those, and a CI job that diffs media needs a baseline anyway.

Grepping for sharp(. It finds the obvious resize and misses the CDN parameter in a template, the canvas call in a React component and the design export someone committed by hand.

What works: a lockfile and a diff

The idea is the same as package-lock.json. Record every media file once, with its hash and what its credential said, and compare every later run against that record. A file that was signed and now is not is the only line anyone needs to read.

1. Install the skill in your agent

The c2pa-check skill follows the open Agent Skills format, so one line installs it for Claude Code, Codex, Cursor, Gemini CLI and Copilot:

npx skills add c2pa-design/skills

In Claude Code you can install it as a plugin instead:

/plugin marketplace add c2pa-design/skills
/plugin install c2pa-check@c2pa-design

Everything runs offline. No account, no upload.

2. Check the generated file before anything touches it

Right after generation, ask the agent to check the file. It runs:

c2pa-check public/hero.png
Content Credentials     VALID_TRUSTED
Signer                  OpenAI
Digital source type     trainedAlgorithmicMedia

If this reads absent straight from the generator, the save step already lost it. Writing decoded base64 to disk is fine. Drawing it on a canvas first is not.

3. Take the baseline

Say "track my assets". From the repo root, the agent runs:

node "$SKILL_DIR/scripts/track.mjs"
214 assets, 38.3% carry a valid Content Credential
  valid_trusted: 82
  absent: 132
added 214, changed 0, removed 0

It walks every media file git ls-files knows, checks each one, and writes .c2pa/assets.lock.json: path, sha256, status, signer, generator, first seen. Commit it or leave it in place. Either way it is the baseline.

What each row records:

Field Why it is there
path Where the file lives in the repo; renames show as one removed and one added
sha256 Detects any byte change, which is exactly what breaks a signature
status The credential.status at the last run: valid_trusted, valid_untrusted, present_invalid, absent or error
signer, generator Who signed it and with which tool, so a later loss can be traced to its source
first_seen The date the file entered the record, signed or not

The file is plain JSON sorted by path, so it diffs cleanly in review. Two branches that add art at the same time produce a merge conflict on the lockfile like they would on any lockfile; resolve it by running the script again on the merged tree.

4. Runs 2, 3, 4 and 5 are the same command

After a batch of new art, before a release, or whenever the agent finishes an image task, the same line runs again and prints only what changed:

231 assets, 37.2% carry a valid Content Credential
  valid_trusted: 84
  absent: 147
added 17, changed 2, removed 0
  LOST  public/hero.webp  (valid_trusted -> absent)
  LOST  public/og/launch.png  (valid_trusted -> present_invalid)

The exit code is 1 when something lost its credential and 0 otherwise. A LOST line names the file; the agent's next step is to search the code that wrote it for sharp(, jimp, convert, ffmpeg, canvas.toBlob, Pillow save( or a resize parameter.

Nothing to configure between runs. New files are new rows. The previous run is the memory, so the fifth run is as cheap as the second.

5. Fix the hop

Found Fix, cheapest first
Resize or WebP conversion in a build script Serve the signed original where the size allows; otherwise re-sign the variant with the original as an ingredient (c2patool, c2pa-node, c2pa-python)
canvas.toBlob before upload Upload the original bytes; do the edit server-side and re-sign
ffmpeg scale or transcode Re-sign the output, or keep the signed master and link to it
present_invalid after an edit Re-sign after the last edit; a manifest on bytes it does not describe is worse than none
CDN variant Turn on the CDN's preserve setting and check a fetched variant, not the dashboard

Run the same command after the fix. The LOST line disappears when the served file is signed again.

6. Push the inventory when you want it watched

A lockfile covers the repo. It cannot see what your CDN serves next Tuesday. With an API key, --push sends hashes and check results to the asset inventory, never the files:

C2PA_API_KEY=… node "$SKILL_DIR/scripts/track.mjs" --push
pushed 19 assets (17 new to the inventory)

The server answers which hashes it already has, and only new or changed ones are sent, so runs 2 through 5 cost a few hundred bytes. From there the inventory is matched against the URLs your site serves and against any stripped copy that passes through the public verifier.

7. Gate CI if you have it

You do not need CI for any of this. If you have it, the same script with --check compares without writing and fails the job on a lost credential:

node "$SKILL_DIR/scripts/track.mjs" --check --json

Why this matters for marking obligations

Under EU AI Act Article 50(2), a provider's generated output has to carry machine-readable marking. A generator that signs is half of it. A repo that strips the signature in its own build undoes that half, and the lockfile is a dated record of which files were signed when they left your hands.

What we are not

The skill reads credentials. It does not decide whether an image is generated, and it never issues a verdict on whether a file is genuine. An absent line means no credential, which is normal for most files and proves nothing about where they came from.

Conclusion

Generated images arrive signed and lose the credential in the first script that touches them. A lockfile of every media file, compared on every run, turns that silent loss into one LOST line with a path, and the fix is usually serving the original or re-signing the variant.

Install it with one line, then tell your agent "track my assets":

npx skills add c2pa-design/skills

Sources

À lire aussi