Tack
Guides

Scoped Rules

Inject project conventions into agent prompts based on file scope.

What are Rules?

Rules are markdown files with YAML frontmatter that inject project-specific guidance into agent prompts. Every rule you add makes all future agents smarter about your codebase.

Rules are scoped by file patterns — an agent working on src/payments/** gets payment-specific rules, while an agent on src/ui/** gets UI rules.

Creating Rules

Place rule files in .tack/rules/:

---
scope: "src/payments/**"
priority: high
---

## Payment Module Conventions

- Use integer cents for all monetary amounts, never floating point
- All payment mutations must be wrapped in a database transaction
- Log every payment state change to the audit table

Rule Fields

FieldTypeDescription
scopeglobFile pattern this rule applies to (e.g., src/**, *.ts)
prioritystringhigh or normal (default). High-priority rules are injected first.
toolsobjectOptional tool restrictions (include/exclude lists)

Tool Restrictions

Rules can restrict which tools agents have access to:

---
scope: "src/database/**"
tools:
  include:
    - "mcp:postgres:*"
  exclude:
    - "mcp:filesystem:delete"
---

Database modules should use the Postgres MCP tools.

How Rules Are Applied

  1. When an agent spawns, Tack collects all rules whose scope matches the stream's file scope
  2. Rules are sorted by priority (high first), then by source path
  3. Rule bodies are injected into the agent's system prompt
  4. Tool restrictions are applied to the agent's available tool set

On this page