Skip to main content
This agent automatically keeps your stack documentation synchronized with code and data changes. When datasets or pipelines are modified in a pull request, the agent profiles the affected components in your warehouse, updates the documentation in the context layer repository to reflect the current structure, validates the changes, and commits the updated docs.

Simple Example

name: docs_updater
description: Auto-update stack documentation on PRs

prompt: |
  When datasets or pipelines change:
  1. Profile the affected components (row count, columns, types)
  2. Update the documentation repository with current structure
  3. Validate the documentation format
  4. If valid: commit changes to the context layer repository
  5. If invalid: comment with error

triggers:
  - event: pull_request
    types: ['opened', 'synchronize']
    includes:
      - "models/**/*.sql"

Production Example

Full profiling, documentation standards, and error handling:
name: docs_updater
description: Keep stack documentation synchronized with code and data

prompt: |
  For each changed dataset or pipeline in this PR:
  
  ## 1. Detect change type
  - New component (no existing docs): Generate full documentation
  - Existing component: Update only what changed
  - Deleted component: Remove documentation (if exists)
  
  ## 2. Profile the component
  Use RetrieveMetadata to get:
  - Total row count (approximate is fine)
  - Column list with data types
  - Null percentage per column
  - For categoricals (<20 unique): list common values
  - For numerics: typical range (min/max/median)
  
  ## 3. Generate/update documentation
  Follow our standards:
  - Component description: Include purpose, grain, ~row count
  - Column descriptions: Business meaning + data type
  - Note null rates if > 5%
  - Use sentence case, end with period
  - Preserve any existing descriptions that are still accurate
  
  ## 4. Validate
  Validate the documentation format and structure.
  
  ## 5. Take action based on result
  If validation passes:
    - Commit changes to the context layer repository
    - Add comment: "📝 Updated docs for [component_names]"
  
  If validation fails:
    - Do NOT commit
    - Comment on PR with validation error
    - Suggest fix if possible
  
  ## 6. Summary
  At the end, comment with:
  - How many components were documented
  - How many columns were described
  - Any issues encountered

triggers:
  - event: pull_request
    types: ['opened', 'synchronize']
    includes:
      - "models/**/*.sql"
    branches: ['main', 'develop']
    auto_commit: false