Skip to main content

Overview

The llms.txt Generator supports automatic updates to keep your generated files synchronized with website changes. When enabled, sites are enrolled in a scheduled recrawl system that monitors for changes and regenerates content automatically.
Auto-updates run on AWS Lambda triggered by EventBridge (CloudWatch Events) every 6 hours by default.

Architecture

How It Works

1

Enrollment

When a user enables auto-update during crawl, the site is enrolled:
backend/main.py
2

Scheduled Trigger

Lambda function is invoked by EventBridge on a schedule:
backend/recrawl.py
3

Sitemap Change Detection

Before crawling, check if the sitemap has changed:
backend/recrawl.py
4

Recrawl & Compare

If sitemap changed (or no sitemap), perform full crawl and compare hash:
backend/recrawl.py
5

Update Storage

If content changed, upload new file and update database:
backend/recrawl.py
6

Schedule Next Crawl

Calculate next crawl time based on interval:
backend/scheduling.py

Sitemap Change Detection

To avoid unnecessary crawls, the system checks sitemap <lastmod> timestamps:
backend/sitemap_utils.py
Performance benefit: Sites with unchanged sitemaps skip the expensive crawl operation entirely, saving time and costs.

Configuration

Enable During Crawl

Pass auto-update parameters in WebSocket request:
boolean
default:"false"
Enable scheduled recrawls for this site
integer
default:"10080"
Minutes between recrawls. Common values:
  • 360 = 6 hours
  • 1440 = 1 day
  • 10080 = 7 days (default)
  • 43200 = 30 days

Lambda Trigger Setup

The Lambda function is triggered via EventBridge:
backend/main.py
EventBridge Rule:

Webhook Trigger

For immediate updates when content changes, use webhook triggers:
backend/main.py

Webhook Usage

Trigger recrawl from your CI/CD pipeline:
This is useful for documentation sites that want to update llms.txt immediately after deploying new content.

Database Schema

Site metadata is stored in Supabase:

Recrawl Results

The Lambda function returns summary statistics:
CloudWatch Logs:

Adaptive Scheduling (Future)

The system includes scaffolding for adaptive scheduling based on observed change frequency:
backend/scheduling.py
Adaptive scheduling is currently disabled (adaptive_enabled=False). When enabled, sites that change frequently are crawled more often, while stable sites are crawled less frequently.

Cost Optimization

Auto-updates are designed to minimize costs:

Sitemap Check First

Fast HEAD request to sitemap before expensive crawl

Hash Comparison

Only upload new files if content actually changed

Configurable Intervals

Set longer intervals for stable sites

Lambda Coldstart

Lambda coldstart ~2-3 seconds, warm execution under 1s
Typical costs per site/month:
  • Lambda execution: ~$0.01-0.05
  • Supabase reads/writes: ~$0.001
  • R2 storage: ~$0.01
  • Bright Data (if needed): ~$0.10-0.50
Total: $0.02-0.60/site/month depending on crawl frequency and site complexity.

Best Practices

  • Documentation sites: 7 days (10080 minutes)
  • Blog/news sites: 1 day (1440 minutes)
  • Frequently updated: 6 hours (360 minutes)
  • Stable content: 30 days (43200 minutes)
Keep your sitemap’s <lastmod> timestamps up to date. This enables efficient change detection and avoids unnecessary crawls.
For documentation sites, trigger webhooks from your CI/CD pipeline after deploying new content instead of waiting for scheduled crawls.
Regularly check CloudWatch logs for errors or performance issues. Set up alarms for high error rates.

Troubleshooting

Check: next_crawl_at in database is in the pastCheck: Lambda function is being triggered by EventBridgeCheck: Site’s sitemap hasn’t indicated changes (review sentinel_last_modified)
Check: Lambda has correct environment variables (API keys, secrets)Check: Lambda has network access to external services (Supabase, R2, target sites)Check: Lambda timeout is sufficient (recommend 300 seconds)
Cause: Sitemap <lastmod> not updated, or hash collision (extremely rare)Solution: Manually trigger recrawl via webhook, or update next_crawl_at to force immediate crawl
Cause: Too many enrolled sites, or intervals too shortSolution: Increase recrawl intervals, or remove inactive sites from database

Next Steps

API Reference

Webhook endpoint documentation

Deployment Guide

Deploy Lambda functions and EventBridge rules