Rules & Workflows
FreshRules
Rules are manually defined constraints that guide agent behavior. They can be set at two levels:
| Level | Location | Scope |
|---|---|---|
| Global | ~/.gemini/GEMINI.md | Applies to all workspaces |
| Workspace | .agents/rules/ | Applies to the current workspace only |
Activation Modes
| Mode | Behavior |
|---|---|
| Manual | Only applied when the user explicitly @ mentions the rule in a conversation. |
| Always On | Applied to every agent conversation automatically. |
| Model Decision | The agent decides whether the rule is relevant to the current task. |
| Glob Pattern | Activated when the agent touches files matching the specified glob pattern. |
Rule Features
- Character limit: 12,000 characters per rule
- File references: Use
@mentions to reference specific files within rules - Rules can reference project files to provide context
Workflows
Workflows are series of steps for repetitive tasks. They are saved as markdown files and invoked via /workflow-name in the agent conversation.
Key Features
- Chaining: Workflows can invoke other workflows
- Character limit: 12,000 characters per workflow
- Auto-generation: The agent can automatically generate workflows from conversation history
TIP
If you find yourself giving the agent the same instructions repeatedly, ask it to create a workflow from your conversation history. Invoke it next time with /workflow-name.