DMAF AGENTS.md

A set of instructions for working on DMAF, a system that moves WhatsApp photos and videos through face recognition into Google Photos. It explains the system's design and development setup.

In plain words
What is it for?
It helps agents find their way around the codebase, understand the media-processing pipeline, and follow the project's development quickstart.
Why use it?
It gives a coding agent the project context it needs before changing code, reducing the risk of misunderstanding how the parts fit together.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/yhyatt/dmaf/agents-md
Clone the repo
git clone --depth 1 https://github.com/yhyatt/DMAF

Made for: Codex, OpenCode.

Per session 2,828 This file is loaded in full into every session.
When invoked 2,828 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02828 $0.02828
Opus 5 $0.01414 $0.01414
Sonnet 5 $0.00566 $0.00566
Haiku 4.5 $0.00283 $0.00283

Measured 2d ago against content hash 24483da6f556, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

DMAF AGENTS.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

Tests live in `tests/test_mcp_server.py` — all tools mocked via `patch("subprocess.run")`.
AGENTS.md · 282 lines

How it starts

The opening of the file, as written. The whole thing — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DMAF — Coding Agent Guide

For Claude Code, GitHub Copilot, Cursor, and any other AI coding assistant. Read this before touching anything. It will save you hours.


What This Is

DMAF (Don't Miss A Face) — WhatsApp media → face recognition → Google Photos.

Photos and videos arrive from WhatsApp groups, get staged in a GCS bucket, a Cloud Run job scans them with face recognition, and matched media (people you care about) gets uploaded to Google Photos automatically.


Architecture

WhatsApp groups
      │  (photos/videos from other group members)
      ▼
OpenClaw Gateway          ← unofficial WhatsApp Web client (Baileys)
  ~/.openclaw/media/inbound/
      │  (system cron, every 30 min, zero LLM cost)
      ▼
GCS staging bucket        ← gs://your-bucket/
  gs://your-project-whatsapp-media/
      │  (Cloud Scheduler, hourly)
      ▼
Cloud Run Job: dmaf-scan  ← Docker image from Cloud Build
      │  scans each file, face recognition against known_people/
      │  two-layer dedup via Firestore (path + content SHA-256)
      ▼
Google Photos             ← matched faces only, organised into named album

Key constraint: OpenClaw's self-chat protection means your OWN sent photos never reach the pipeline. Only photos sent by others in groups are captured.


Codebase Map

src/dmaf/
├── __main__.py          # CLI entrypoint + Uploader class (on_match / on_match_video)
├── config.py            # Pydantic Settings — all config fields with defaults + docs
├── watcher.py           # Core scan loop: scan_and_process_once, _process_image_file,
│                        #   _process_video_file, NewImageHandler base class
├── video_processor.py   # iter_frames (generator), find_face_in_video (early exit)
├── gcs_watcher.py       # GCS helpers: list_gcs_images, list_gcs_videos,
│                        #   download_gcs_blob, cleanup_temp_file
├── database.py          # SQLiteDatabase (local dev) + FirestoreDatabase (cloud)
│                        #   Both implement: seen, add_file_with_score, mark_uploaded
├── known_refresh.py     # Auto-add high-quality matched frames to known_people
├── alerting/
│   ├── alert_manager.py # AlertManager: batches events, sends email on schedule
│   └── templates.py     # format_error_alert, format_borderline_alert
│                        #   _format_ts(ts, tz_name) — configurable timezone
├── face_recognition/    # Backend factory: dlib, InsightFace, AuraFace
├── google_photos/       # upload_bytes, create_media_item, ensure_album
└── utils/               # retry decorator, sha256_of_file, etc.

deploy/
├── README.md            # Full GCP deployment walkthrough
├── setup-secrets.md     # ALL credentials setup (start here for a new deployment)
└── openclaw-integration.md  # OpenClaw → GCS media sync setup

tests/                   # pytest — mirrors src/dmaf structure
config.cloud.yaml.example  # Annotated config template
cloudbuild.yaml          # Cloud Build: docker build + push to GCR

Read the full file on GitHub · 282 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 282 lines · 2,828 tokens per session scan A 24483da6f556

Subscribe to this mod's changes

DMAF AGENTS.md is an instructions file published in the GitHub repository yhyatt/DMAF (2 stars, last pushed 6mo ago), licensed MIT. It adds 2,828 tokens to every session, about $0.0141 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.