with-project-directory

Rules for working in specific project directories such as source utilities, command-line scripts, build scripts, and tests. They require checking the matching directory’s README before analysing or editing files there.

In plain words
What is it for?
Use them whenever a file is under one of the listed directories, including nested folders, to find and follow that directory’s additional rules.
Why use it?
They prevent changes from ignoring local instructions that apply only to a particular part of the codebase.

Cursor rule for Cursor

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 rules/zackiles/cursor-config/with-project-directory
Clone the repo
git clone --depth 1 https://github.com/zackiles/cursor-config

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,730 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00000 $0.02730
Opus 5 $0.00000 $0.01365
Sonnet 5 $0.00000 $0.00546
Haiku 4.5 $0.00000 $0.00273

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

Security

Grade A, and why

with-project-directory scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/global/with-project-directory.mdc · 234 lines

How it starts

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

Critical Rules To Be Followed When Analyzing Or Editing Code In These Directories

The following directories are unique project directories that require you to follow all rules described for any files contained anywhere in a folder or sub-folder that matches these glob patterns: src/utils/**, bin/**, scripts/**, test/**

NOTE (Glob Pattern Relative Path): ALL glob patterns are relative to the root of the project or codebase. This is sometimes referred to as the workspace root.

NOTE: Ignore default README.md files mentioned here if there is a README.md in directory AND that README.md talks specifically about the directory.

Rules:

  • Before editing, creating, or analyzing files in one of the mentioned folders, read the folders strict rules defined in the directory-specific README.md contained in the root of the folder. For example, the following README.md files exist: src/utils/README.md, bin/README.md, scripts/README.md, test/README.md .

    # EXAMPLE COMMAND: Check for directory README.md file
    read_file(
      target_file: "<directory>/README.md",
      should_read_entire_file: true,
      explanation: "Reading directory-specific rules"
    )
    
  • Ensure ALL code you generate and any files created or modified in the directory or any of its sub-directories follow each rule defined in the README.md for that directory.

  • All rules in the README.md defined as MUST should always be followed.

  • All rules in the README.md defined as MAY or SHOULD are recommended but can be ignored if it is reasonable to do so.

  • Things a user explicitly asks you to do that violates any of the rules mentioned can be followed, but ensure you remind them after your work is complete of the parts of your solution that didn't adhere to the rules and your rationale of why you didn't adhere to them.

Default README.md Files

When no README.md can be found in the folder that matches the glob patterns of: src/utils/**, bin/**, scripts/**, or test/** then you may use the following as the default rules. Use only the right rules for the right folder below.

Read the full file on GitHub · 234 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 · 234 lines · 0 tokens per session scan A 69398470b18e

Subscribe to this mod's changes

with-project-directory is a cursor rule published in the GitHub repository zackiles/cursor-config (17 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,730 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.