agentleFS
zolowhoszolowhos/antistrefo/.cursor/rules/gate.mdc

antistrefo / rules

Cursor rule4 starsChanged 9 days agoMITView on GitHub

Pre-commit gate rules 0-10 and the narrow exceptions

We split this gate.mdc into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this before claiming anything works.

    line 8
  2. Very specific:

    Every new header under src/utils/ must appear in both docs/util-catalog.md and src/utils/re_util.h, except those two private headers.

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
gate.mdc
---
description: Pre-commit gate rules 0-10 and the narrow exceptions
alwaysApply: true
---

# Gate

Run this before claiming anything works. The style test fails the build.

 powershell -NoProfile -ExecutionPolicy Bypass -File scripts\format.ps1
 # Linux: clang-format -n --Werror --style=file $(git ls-files 'src/**/*.[ch]' 'src/**/*.cpp')
 python scripts\check.py .
 cmake --build --preset clang-release
 ctest --preset clang-release

| Rule | Requirement |
|---|---|
| 0 | Read the util catalog first. No `realloc` (use `re_strbuf` / `re_vec`). No `x &= x - 1` (use `re_bits`) |
| 1 | 500 lines per file. 60-line function bodies. Nesting <= 4 |
| 2 | 4-line banner. Folder <= 15 files under `src/` |
| 3 | Exactly one `#pragma once` per header |
| 4 | ASCII-only source bytes. `.md` is exempt |
| 5 | LF, one final newline, no trailing whitespace, no tabs |
| 6 | No `malloc` / `calloc` / `realloc` / `free` / `strdup` outside `src/utils`. Use `re_arena` |
| 7 | No `printf` / `puts` / `fprintf(stdout)` outside `re_jw*` / `re_text*` |
| 8 | No `strlen` / `strcmp` / `strcpy` / `strcat` / `sprintf` / `strtok` and kin. Use `re_str` / `re_strbuf`. `memcpy` / `memset` / `memcmp` on sized spans are fine |
| 9 | `re_` prefix (clang-tidy, advisory) |
| 10 | clang-format clean |

`tests/` is exempt from rules 7 and 8 only. `re_regex_priv.h` and `re_util.h` stay out of the aggregator and must still appear in the util catalog. `RE_VEC_PUSH` needs an lvalue; assign `f(x)` to a local first.

Every new header under `src/utils/` must appear in both `docs/util-catalog.md` and `src/utils/re_util.h`, except those two private headers.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.