Skip to main content

Agent Workspace Rules

Improve AI responses with business-specific information and guidelines.

Overview

Agent Workspace Rules allows Admins to provide additional context to Hex's AI prompts through a markdown file. This context is used by all AI agents in Hex when generating responses, helping them better understand your business context, data conventions, and preferred practices.

This feature is similar to Claude Projects or Cursor rules - by providing high-level context to your AI agent, you can influence the responses you get and ensure consistency across your team's work.

Since these rules apply to the entire workspace, only workspace Admins can modify the rules.

Configure Agent Workspace Rules

To configure Agent Workspace Rules for your workspace:

  1. Navigate to Settings > Magic
  2. Scroll down to the Context section
  3. Click Edit to open the markdown editor
  4. Add your business context, guidelines, and preferences
  5. Click Save to apply the changes

You can also upload a markdown file directly.

Agent Workspace Rules configuration in Magic admin settings

What to include in Agent Workspace Rules

Your Agent Workspace Rules file can include any information that would help Hex's AI better understand your business context and generate more relevant responses. Here are some examples:

Business context

  • Company-specific terminology and definitions
  • Key metrics and KPIs your team focuses on
  • Business processes and workflows
  • Industry-specific considerations

Data conventions

  • Naming conventions
  • Preferred data formats and standards
  • Common data transformations and calculations
  • Data quality guidelines

Analysis preferences

  • Preferred visualization types for different data scenarios
  • SQL style guidelines and best practices
  • Common analysis patterns and approaches

Example Agent Workspace Rules content

# Data Warehouse Context

## Terminology

- The business is divided into three segments: Small-midsize (SMB), Mid-market (MM), and Enterprise (ENT).
- The key metrics we track are Monthly Recurring Revenue (MRR), Lifetime Value (LTV), and Customer Acquisition Cost (CAC)

## Data Modeling Conventions

- Use snake_case for all table and column names
- Date columns should be named with '_date' suffix
- Currency amounts should be stored as decimals, not integers
- Always include timezone information for timestamp fields

## Analysis Best Practices

- Prefer line charts for time series data
- Use bar charts for categorical comparisons
- Include confidence intervals for statistical analyses
- Always filter out test data (user_id < 1000)
- Add comments for complex logic

Tips

  • Keep it concise: Focus on the most important context that will improve AI responses. Including too much context can distract the model.
  • Focus on general-purpose rules: Limit the rules file to context you want to be included in every prompt. Documentation related to specific tables or columns should live in your data warehouse, the Hex data browser, or other data documentation source.
  • Test and iterate: Try different rules and see how they affect AI responses. Rules should be active instantly, so you can test SQL generation in the notebook or Explore generation from the Ask Magic feature on the home page.

Best practices

See this tutorial for more in depth Agent Workspace Rules best practices.