redcard
AGENTS.md43 starsChanged 5 months agoApache-2.0View on GitHub
This repo is designed to be opened in the ChatGPT macOS app and operated through Codex. The normal Codex activation path is the repo-owned $redcard skill. Red Card watches for a physical red card through the webcam. When detected during a Google Meet call, it runs the full sequence: The default entrypoint is: The default config is: The README is the public handoff. Once the user asks for help setting up, running, or debugging Red Card, Codex should become the…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
45 rules. About 2 are common, 27 are distinctive, and 16 are very specific to this project.
≈2
Common · estimate
Many files like this have a rule of this kind.
≈27
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Do not dump a full build plan unless the user asks for one.
- Distinctive: line 10
Run all shell commands and project scripts for the user through Codex.
- Distinctive: line 11
Before fresh setup, tell the user to open ChatGPT > Settings > General > Permissions and turn Auto-review off.
- Distinctive: line 16
Before each command you run, say what it does and why it happens now.
- Distinctive: line 17
After each step, say what success looks like.
- Distinctive: line 18
If a step fails, stop and diagnose before continuing.
- Distinctive: line 19
Only ask the user to perform actions Codex cannot do, such as responding to a macOS permission prompt, changing a System Settings toggle, …
- Distinctive: line 20
Prefer exact commands in tool calls and exact UI labels in user instructions over conceptual summaries.
- Distinctive: line 21
Use practical, reassuring language.
- Common: line 22
Do not ask the user to paste passwords, API keys, or private tokens into chat.
- Distinctive: line 23
Do not run destructive commands unless the user explicitly approves.
- Distinctive: line 24
Do not revert user changes unless explicitly asked.
- Distinctive: line 52
Start with a short response like:
- Distinctive: line 58
Do not tell the user to read AGENTS.md.
- Distinctive: line 63
Run the required command yourself, or give the one physical/UI action only the user can perform.
- Very specific: line 78
Run plain $redcard, --once, --list-cameras, --permissions-only, and --force-permissions outside the sandbox immediately.
- Distinctive: line 81
Use checklist-style progress internally, but keep the user-facing conversation focused on the current step.
- Very specific: line 88
If they are trying to run the app from any task, resolve the loaded skill directory, confirm <skill-dir>/runtime/.venv/bin/python exists, …
- Distinctive: line 89
If they report a macOS permission issue, start with the permissions check and the exact System Settings paths.
- Very specific: line 90
If they report Chrome or Google automation failures, start by checking the relevant helper in redcard/macos/ and confirm Chrome Apple …
- Very specific: line 91
If they report camera behavior, start with <skill-dir>/scripts/run-redcard.sh --list-cameras and inspect redcard/detector.py only after …
- Very specific: line 92
If they report overlay positioning, animation, or final-screen behavior, inspect tools/LocalOverlay.swift, redcard/demo_overlay.py, …
- Distinctive: line 93
If they ask for a code change, inspect the relevant files first, then implement and verify.
- Very specific: line 98
After setup: tell the user to invoke plain $redcard for the first real run.
- Distinctive: line 103
Only ask a clarifying question if the request conflicts with local context or if making a reasonable assumption would be risky.
- Distinctive: line 113
Before running the installer, Codex tells the user to open ChatGPT > Settings > General > Permissions, turn Auto-review off, and report …
- Very specific: line 127
Treat codex-skill/redcard/ as the only editable source of the $redcard skill.
- Very specific: line 128
Keep codex-skill/redcard/SKILL.md, codex-skill/redcard/agents/openai.yaml, and both skill scripts synchronized when the workflow changes.
- Very specific: line 129
Keep launcher examples anchored to <skill-dir>, with ${CODEX_HOME:-$HOME/.codex}/skills/redcard only as the fallback.
- Very specific: line 130
After changing the skill source, validate it with the skill validator, run sh -n on its scripts, run ./scripts/install-codex-skill.sh, and …
- Very specific: line 147
After permission changes, tell the user to quit and reopen ChatGPT before invoking $redcard again.
- Distinctive: line 164
After pulling changes or switching machines, Codex runs:
- Distinctive: line 175
Use the installed skill runtime from any task:
- Distinctive: line 190
When validating code changes, prefer:
- Very specific: line 198
Use cache paths under /private/tmp for Python and Swift compile checks so sandboxed runs do not write to user-level caches.
- Very specific: line 200
Do not run ./scripts/permissions-check.sh casually during validation.
- Distinctive: line 204
Keep runtime console messages client-facing.
- Very specific: line 206
Keep --dry-run as a safe preview path.
- Very specific: line 207
Keep global Esc abort available during real runs, including while Chrome is focused.
- Distinctive: line 209
Keep Meet waiting passive.
- Distinctive: line 211
If the camera is not needed yet, do not open it.
- Very specific: line 213
After a red card is successfully handled, return "triggered" from the detector and exit cleanly instead of reading another camera frame …
- Common: line 242
Never ask users to paste secrets into chat.
- Distinctive: line 243
Never assume macOS permissions are already granted.
- Distinctive: line 244
Never use destructive git commands unless explicitly requested.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Red Card Codex Guide
This repo is designed to be opened in the ChatGPT macOS app and operated through Codex. The normal Codex activation path is the repo-owned $redcard skill.
Operating Style
- Act like a hands-on project guide, not a docs search engine.
- Guide one step at a time when the user is setting up or troubleshooting the app.
- Do not dump a full build plan unless the user asks for one. Give the next concrete action, wait for the user to do the physical step or report output, then continue.
- Run all shell commands and project scripts for the user through Codex. Never ask the user to open Terminal, paste a command, or run a script themselves.
- Before fresh setup, tell the user to open ChatGPT > Settings > General > Permissions and turn Auto-review off. Wait for the user to confirm before running the installer so required outside-sandbox requests are presented to the user instead of being auto-reviewed.
- Run
./scripts/install-codex-skill.shoutside the workspace sandbox on the first attempt during fresh setup. It installs the complete self-contained runtime, so do not run the repo development installer first. Request narrowly scoped approval for the exact skill installer; do not grant a shell or the whole project unrestricted access. - If dependency installation fails or times out while using the machine's configured Python package index, stop and preserve the installer output. Ask the user whether they want Codex to retry the installer using public PyPI. Only retry with
REDCARD_ALLOW_PUBLIC_PYPI=1after explicit approval; never silently bypass a corporate or internal package registry, and never commit private registry URLs. - Launch real Red Card and camera diagnostics outside the workspace sandbox on the first attempt. Request narrowly scoped approval for the installed Red Card launcher; do not switch the whole project or ChatGPT session to unrestricted access.
- Resolve the launcher from the actual directory of the loaded
$redcardSKILL.md. Never look forrun-redcard.shin the repo's top-levelscripts/directory. Use${CODEX_HOME:-$HOME/.codex}/skills/redcardonly as the portable fallback. - Before each command you run, say what it does and why it happens now.
- After each step, say what success looks like.
- If a step fails, stop and diagnose before continuing.
- Only ask the user to perform actions Codex cannot do, such as responding to a macOS permission prompt, changing a System Settings toggle, signing into Google, or enabling a Chrome menu option.
- Prefer exact commands in tool calls and exact UI labels in user instructions over conceptual summaries.
- Use practical, reassuring language. Avoid extra background unless the user asks.
- Do not ask the user to paste passwords, API keys, or private tokens into chat.
- Do not run destructive commands unless the user explicitly approves.
- Do not revert user changes unless explicitly asked.
Project Summary
Red Card watches for a physical red card through the webcam. When detected during a Google Meet call, it runs the full sequence:
- Sends a configured goodbye message in Google Meet.
- Leaves the Meet call.
- Creates and saves a Google Calendar block.
- Opens Gmail settings and saves a vacation responder.
- Shows the native referee overlay and final goodbye screen.
The default entrypoint is:
$redcardThe default config is:
redcard.config.jsonGuide Behavior
The README is the public handoff. Once the user asks for help setting up, running, or debugging Red Card, Codex should become the guide.
Start with a short response like:
You are in the right place. I will walk through this one step at a time. We will start by checking the local setup, then confirm macOS permissions, then run Red Card and fix anything that comes up.Do not tell the user to read AGENTS.md. Load project files yourself as needed.
For each setup or troubleshooting step, use this rhythm:
- Say the goal of this step in one sentence.
- Run the required command yourself, or give the one physical/UI action only the user can perform.
- Say what success looks like.
- For a required UI action, ask the user to tell you when it is done. For commands, inspect the tool output yourself.
Examples:
- For install, run
./scripts/install-codex-skill.shoutside the sandbox because it writes under${CODEX_HOME:-$HOME/.codex}and downloads dependencies; verify the installedSKILL.md,runtime/.venv, bundled configs/assets, and native helpers. - For skill setup, explain that
codex-skill/redcardis the source instructions;./scripts/install-codex-skill.shcreates/replaces the discoverable$redcardskill and its complete self-contained runtime. - For fresh setup, first wait for the user to turn off Auto-review at ChatGPT > Settings > General > Permissions. Then let
./scripts/install-codex-skill.shinvoke the installed launcher with--force-permissions; do not invoke it a second time. Run./scripts/permissions-check.shdirectly only when troubleshooting a failed installer preflight. - For camera issues, run
<skill-dir>/scripts/run-redcard.sh --list-camerasbefore changing config. - For Chrome automation issues, run
./scripts/check-chrome-javascript.shthrough Codex outside the sandbox. It must preserve the actual AppleScript error and only direct the user to View > Developer > Allow JavaScript from Apple Events when Chrome explicitly reports that the setting is off. Apple Events authorization, sandbox, timing, and unexpected-result failures must not be mislabeled as a disabled Chrome setting. - For overlay issues, run
./scripts/build-local-overlay.shand compile-checktools/LocalOverlay.swift. - For first run, use plain
$redcardso the real sequence runs and the default sleep-after-goodbye behavior is preserved. - For explicit troubleshooting only, use
$redcard --dry-run; it must not request camera access. - For live-flow issues where the user explicitly wants a bounded test, use
$redcard --once. - Run plain
$redcard,--once,--list-cameras,--permissions-only, and--force-permissionsoutside the sandbox immediately. Keep only--dry-run,--help, and-hsandboxed. - During a real run, keep the command session open. As soon as the runtime reports
Red Card is running and ready to go, explicitly tell the user that Red Card is running and ready. Do not wait for the watcher to exit, and do not announce readiness if startup fails before that message.
Use checklist-style progress internally, but keep the user-facing conversation focused on the current step. If the user asks "what's next?", answer with the next step, not the whole remaining setup.
First Move
Infer where the user is in the Red Card flow before taking action:
- If they are setting up a fresh clone, first ask them to turn off Auto-review at ChatGPT > Settings > General > Permissions and wait for confirmation. Then run only
./scripts/install-codex-skill.shoutside the sandbox. The installer copies and builds the runtime under the installed skill, then runs--force-permissions. Explain that Codex is registering a project-independent$redcardruntime and checking this machine; do not hand the command to the user. After success, stop and prompt the user to invoke$redcardseparately when ready. - If they are trying to run the app from any task, resolve the loaded skill directory, confirm
<skill-dir>/runtime/.venv/bin/pythonexists, and invoke<skill-dir>/scripts/run-redcard.sh. Do not inspect the current project's.venvor look for the Red Card repo. - If they report a macOS permission issue, start with the permissions check and the exact System Settings paths.
- If they report Chrome or Google automation failures, start by checking the relevant helper in
redcard/macos/and confirm Chrome Apple Events is enabled. - If they report camera behavior, start with
<skill-dir>/scripts/run-redcard.sh --list-camerasand inspectredcard/detector.pyonly after confirming the camera opens. - If they report overlay positioning, animation, or final-screen behavior, inspect
tools/LocalOverlay.swift,redcard/demo_overlay.py,redcard/demo_sequence.py, andassets/sprites/. - If they ask for a code change, inspect the relevant files first, then implement and verify.
Opening responses:
- Fresh setup: first require Auto-review to be off at ChatGPT > Settings > General > Permissions and wait for confirmation. Then run environment installation and skill registration outside the sandbox. The skill installer forces a new permission preflight for the current machine, including a real Chrome JavaScript-from-Apple-Events test. If a check fails, guide the exact macOS or Chrome UI setting and resume installation only after the user fixes it. After setup succeeds, stop and prompt the user to invoke
$redcardseparately for the first real run. - After setup: tell the user to invoke plain
$redcardfor the first real run. - Runtime error: ask for or inspect the traceback, identify the failing module, then make the smallest targeted fix.
- Visual/overlay issue: inspect the overlay and sprite code, then compile-check Swift before finishing.
- Git request: check status first, preserve unrelated user work, then stage/commit/push only after the requested change is complete.
Only ask a clarifying question if the request conflicts with local context or if making a reasonable assumption would be risky.
Setup Guidance
For first-time setup, Codex runs from the Red Card source repository:
./scripts/install-codex-skill.shBefore running the installer, Codex tells the user to open ChatGPT > Settings > General > Permissions, turn Auto-review off, and report when it is done. Codex must wait for that confirmation. Do not substitute Full access for this step.
Codex runs this command outside the workspace sandbox on its first attempt. It needs network access for hash-locked dependencies and write access to ${CODEX_HOME:-$HOME/.codex}. Do not wait for a sandboxed install to fail.
If the installer fails while installing Python packages, preserve the pip output. When the error looks like a timeout, unreachable package index, or registry policy issue, ask the user whether they want to retry using public PyPI. If they approve, rerun the same installer outside the sandbox with REDCARD_ALLOW_PUBLIC_PYPI=1. Do not retry public PyPI automatically.
scripts/install.sh remains available for repo development only. Normal users do not need a repo-local .venv because the skill installer builds <skill-dir>/runtime/.venv.
scripts/install-codex-skill.sh creates/replaces ${CODEX_HOME:-$HOME/.codex}/skills/redcard, copies the runtime package, configs, assets, native sources, and runtime scripts into <skill-dir>/runtime, creates its virtual environment, builds its helpers, and invokes <skill-dir>/scripts/run-redcard.sh --force-permissions. It must not record or require the source repo path. After installation, $redcard runs from any task or project even if the source repo is not the task's working directory. If $redcard is not visible immediately, tell the user to start a fresh task or reload ChatGPT once.
The skill installer must not report success until Camera, System Events/Accessibility, Input Monitoring, and Chrome JavaScript-from-Apple-Events checks pass. The Chrome check opens a temporary harmless tab, executes a sentinel expression through Apple Events, and closes the tab. It must run even when the saved macOS permission stamp is still valid. Once setup succeeds, stop the setup flow and tell the user that setup is complete and they can invoke $redcard when ready. Never invoke the launcher again or automatically turn a successful fresh-install preflight into a real run.
Skill Build Contract
- Treat
codex-skill/redcard/as the only editable source of the$redcardskill. Never edit${CODEX_HOME:-$HOME/.codex}/skills/redcarddirectly. - Keep
codex-skill/redcard/SKILL.md,codex-skill/redcard/agents/openai.yaml, and both skill scripts synchronized when the workflow changes. - Keep launcher examples anchored to
<skill-dir>, with${CODEX_HOME:-$HOME/.codex}/skills/redcardonly as the fallback. Never add a repo-relative./scripts/run-redcard.shexample. - After changing the skill source, validate it with the skill validator, run
sh -non its scripts, run./scripts/install-codex-skill.sh, and verify the installed files match the source copy. scripts/install-codex-skill.shmust fail if a required skill file is missing, if the launcher is not executable, or if the installed copy differs from the source.- The installed launcher must use only
<skill-dir>/runtime; it must never infer runtime files from the current working directory or a recorded source repo path. scripts/install-codex-skill.shmust delete any old installed stamp and run the installed launcher with--force-permissionsduring normal installation. It must never accept a repo-path stamp as proof of permissions on the current machine.REDCARD_SKIP_INSTALL_PERMISSIONS=1is only for isolated maintainer validation and must never be set during user setup.
After setup, prompt the user to invoke plain $redcard, not $redcard --dry-run, $redcard --once, $redcard --no-sleep, or a runtime script directly. Setup uses the installed launcher's --force-permissions mode outside the sandbox; it records success for the installed runtime only after the current machine passes and exits before the real sequence. Only a later explicit $redcard invocation starts Red Card. Scope reusable approval to the absolute installed run-redcard.sh path. $redcard --dry-run and $redcard --help remain sandboxed and skip camera access.
For a permission repair, run <skill-dir>/scripts/run-redcard.sh --force-permissions outside the sandbox on the first attempt. This must ignore the repo-specific success stamp, rerun the macOS preflight so Camera can be requested correctly, update the stamp only on success, and stop without launching Red Card. Prefer this installed-launcher mode over running scripts/permissions-check.sh directly.
Required user-facing permissions and settings:
- System Settings > Privacy & Security > Camera: enable ChatGPT.
- System Settings > Privacy & Security > Accessibility: enable ChatGPT. If it is missing, click + and add ChatGPT from
/Applications. - System Settings > Privacy & Security > Input Monitoring: enable ChatGPT if macOS asks for it so global Esc can abort while Chrome is focused.
- Chrome: enable View > Developer > Allow JavaScript from Apple Events. The installer and every real launch verify this setting and stop with this exact instruction when Chrome blocks the test.
- Chrome must already be signed into the relevant Google Meet, Calendar, and Gmail accounts.
After permission changes, tell the user to quit and reopen ChatGPT before invoking $redcard again.
Local Overlay
The native overlay helper is built locally from:
tools/LocalOverlay.swiftThe output is:
bin/redcard-local-overlay
bin/redcard-global-escapeAfter pulling changes or switching machines, Codex runs:
./scripts/build-local-overlay.sh
./scripts/build-global-escape.shThe app can auto-build the helper if needed, but Codex should still run the explicit rebuild step during setup so the binary matches the local macOS toolchain.
Running and Verification
Use the installed skill runtime from any task:
$redcardFor user troubleshooting from any task, Codex uses the installed launcher. Repo scripts remain for development checks only:
./scripts/run.sh
./scripts/run.sh --once
./scripts/run.sh --dry-run
./scripts/run.sh --list-camerasWhen validating code changes, prefer:
PYTHONPYCACHEPREFIX=/private/tmp/redcard-pycache python3 -m compileall redcard
CLANG_MODULE_CACHE_PATH=/private/tmp/redcard-clang-cache swiftc tools/LocalOverlay.swift -o /private/tmp/redcard-local-overlay-test
sh -n scripts/*.shUse cache paths under /private/tmp for Python and Swift compile checks so sandboxed runs do not write to user-level caches.
Do not run ./scripts/permissions-check.sh casually during validation; it can open the camera and trigger macOS permission prompts.
Development Notes
- Keep runtime console messages client-facing. Avoid internal wording like "demo" in printed output.
- Emit
Red Card is running and ready to goonly after runtime initialization succeeds and immediately before waiting for or watching a Meet call, so Codex has a reliable readiness signal to relay to the user. - Keep
--dry-runas a safe preview path. - Keep global Esc abort available during real runs, including while Chrome is focused. The Swift helper is built from
tools/GlobalEscape.swiftand launched byredcard/global_escape.py. - Have the global Esc helper call
CGRequestListenEventAccess()when Input Monitoring access is missing so macOS presents its permission prompt. Use a listen-only event tap. Give manual System Settings instructions only after the request is denied, dismissed, or cannot be shown again. - Keep Meet waiting passive. The idle wait should not activate Chrome, select the Meet tab, or steal focus from another Chrome tab.
- The stricter active Meet check can run when acting on a detected red card, but idle polling should avoid JavaScript that raises Chrome.
- If the camera is not needed yet, do not open it. The app should wait for a likely Meet call tab before starting the camera, and release the camera when the call ends.
- Gracefully continue if no active call is found after a red card detection.
- After a red card is successfully handled, return
"triggered"from the detector and exit cleanly instead of reading another camera frame after the sequence. A guarded trigger that returnsFalsemust keep watching. - Be careful with AppleScript changes: Chrome, Gmail, Calendar, and Meet UI automation can be brittle. Prefer small, targeted changes and clear error messages.
- For asset changes, keep sprite folders under
assets/sprites/. - The
pocketsprite set is used for the opening red-card animation. - The final goodbye screen uses
assets/sprites/goodbye-screen.pngas the only centered full-screen graphic.
File Map
redcard/cli.py: CLI, config loading, Meet wait loop, camera lifecycle.redcard/detector.py: webcam red-card detection.redcard/demo_sequence.py: full sequence choreography.redcard/demo_overlay.py: Python controller for the native overlay.redcard/local_overlay.py: builds or locates the Swift overlay helper.redcard/global_escape.py: builds or locates the Swift global Esc helper and starts it for real runs.tools/LocalOverlay.swift: native transparent overlay renderer.tools/GlobalEscape.swift: native global Esc listener that interrupts the Red Card Python process.redcard/macos/chrome.py: Google Meet and Chrome automation.redcard/macos/calendar.py: Google Calendar automation.redcard/macos/gmail.py: Gmail vacation responder automation.scripts/install.sh: local environment setup.codex-skill/redcard/scripts/install-runtime.sh: builds the installed skill's private runtime environment.scripts/permissions-check.sh: first-run macOS permission helper.scripts/check-chrome-javascript.sh: blocking Chrome JavaScript-from-Apple-Events probe.scripts/run.sh: main launcher through.venv/bin/python.scripts/build-local-overlay.sh: local Swift overlay rebuild.scripts/build-global-escape.sh: local Swift global Esc helper rebuild.
Safety
- Never ask users to paste secrets into chat.
- Never assume macOS permissions are already granted; run the preflight through Codex and guide the user through any required System Settings changes.
- Never use destructive git commands unless explicitly requested.
- The user may have local uncommitted changes. Inspect status before broad edits, and preserve unrelated work.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

