Skip to main content
context_get_rules returns a repository’s coding rules, so your agent can follow them before it writes or reviews code. It shares a surface with the unblocked context-get-rules CLI command, which lists every input. Unblocked extracts the rules from the instruction files in your repository, such as AGENTS.md, CLAUDE.md, and .cursorrules, including nested copies in subdirectories. See the recognized files. Each rule has a severity: treat must as a requirement, should as a strong default, and can as optional. To change the rules, edit those files.

Narrow the result

The tool returns the 20 highest-severity rules by default. Your agent should pass:
  • paths — a list of the files it’s changing, such as ["src/app.ts", "src/api/client.ts"]. Rules from a nested file such as <dir>/AGENTS.md apply only to paths inside <dir>/. Root rules always apply.
  • max_rules — a number above 20, only when the response says more rules matched and it needs them.
task (code-review, code-generation, or code-questions) narrows further.

When your agent uses it

  • Before it writes, refactors, or reviews code in a repository.
  • When you ask which rules apply to a change.

When your agent uses something else

  • To learn why a rule exists, such as the pull request or discussion that introduced it, context_research handles it.