precondition decides whether the agent runs on this repository at all. where decides which files it reviews.
The precondition gate
Omitprecondition and the agent always runs. Set it with a regex check, a prompt check, or both.
The
regex check runs first and costs nothing. When an agent declares both and the regex check does not match, the agent skips before it reaches the LLM call.
Regex sub-checks
Four sub-checks live underprecondition.regex. Any one match queues the agent.
Each
patterns entry sets regex, an optional label, and optional in and notIn glob lists. An empty in list means any file. No official agent uses directories today, but the schema and the evaluator both support it.
agentgg-agents/agents/mobile/ios-url-scheme.md. The regex check queues the agent for any Swift or Objective-C project. The prompt check narrows further with an LLM call.
The where scope
where sets the files an agent’s tool session starts from. The agent can still read more files with its Read, Glob, and Grep tools.
When both
extensions and filePatterns are empty, the scope is every file in the repository, reviewed in batches.
preFilter anchors
ApreFilter entry narrows the matched files further. A file becomes a candidate only when at least one entry matches a line inside it. The matching line numbers and labels pass to the model as anchors.
Semgrep rules as anchors
AsemgrepRule value is a bare name, never a path and never a registry identifier. The CLI resolves the name in this order: first the directories passed to --semgrep-rules, then the catalog’s own semgrep-rules/ folder. It matches <name>.yml or <name>.yaml in the first directory that has one.
agentgg-agents/agents/auth/missing-access-control-semgrep.md. The name resolves to agentgg-agents/semgrep-rules/http-endpoints.yml, a rule that finds a route handler declared by file position instead of a path string, a pattern a per-line regex cannot express.
A full example
agentgg-agents/agents/auth/js-nextjs-middleware-only-auth.md, trimmed. The precondition queues the agent only for a Next.js project with an exported route handler. The where scope hands the agent those same route files, with the export line as its anchor.
