|
| 1 | +# Context Compiler (Generate Command) |
| 2 | + |
| 3 | +The generate command uses LLM analysis to produce optimized files that improve your site's LLM readiness. It crawls a URL, sends the content to an LLM, and writes structured output files. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Context Compiler pipeline: |
| 8 | + |
| 9 | +1. **Crawl** -- fetches and renders the target URL |
| 10 | +2. **Extract** -- pulls content, structure, and metadata |
| 11 | +3. **Analyze** -- sends extracted data to an LLM with specialized prompts |
| 12 | +4. **Generate** -- writes output files to `./context-output/` (or custom directory) |
| 13 | + |
| 14 | +## Output Files |
| 15 | + |
| 16 | +### llms.txt |
| 17 | + |
| 18 | +A machine-readable file that tells LLMs how to interact with your site. Placed at `/llms.txt` on your domain, it provides: |
| 19 | + |
| 20 | +- Site description and purpose |
| 21 | +- Content structure guidance |
| 22 | +- Preferred citation format |
| 23 | +- Key pages and their topics |
| 24 | + |
| 25 | +```bash |
| 26 | +context-cli generate example.com |
| 27 | +``` |
| 28 | + |
| 29 | +### schema.jsonld |
| 30 | + |
| 31 | +Optimized Schema.org JSON-LD structured data based on your page content. The compiler analyzes your content and generates appropriate schema types (Article, Product, FAQ, HowTo, etc.) with complete properties. |
| 32 | + |
| 33 | +```bash |
| 34 | +context-cli generate example.com |
| 35 | +``` |
| 36 | + |
| 37 | +### AGENTS.md |
| 38 | + |
| 39 | +An [AGENTS.md](https://docs.google.com/document/d/1ON2MRbDC2RVJpKMIoluHFz-bGDAELz3RjMLErxEDqn4) file that tells AI agents how to interact with your site, including available endpoints, authentication requirements, rate limits, and data formats. |
| 40 | + |
| 41 | +```bash |
| 42 | +context-cli generate example.com --agents-md |
| 43 | +``` |
| 44 | + |
| 45 | +## Batch Mode |
| 46 | + |
| 47 | +Generate assets for multiple URLs from a file: |
| 48 | + |
| 49 | +```bash |
| 50 | +context-cli generate-batch urls.txt |
| 51 | +context-cli generate-batch urls.txt --concurrency 5 --profile ecommerce |
| 52 | +context-cli generate-batch urls.txt --json |
| 53 | +``` |
| 54 | + |
| 55 | +Each URL's output goes to a subdirectory under the output directory. |
| 56 | + |
| 57 | +## Industry Profiles |
| 58 | + |
| 59 | +Tailor the generated output with `--profile`: |
| 60 | + |
| 61 | +```bash |
| 62 | +context-cli generate example.com --profile saas |
| 63 | +``` |
| 64 | + |
| 65 | +Available profiles: |
| 66 | + |
| 67 | +| Profile | Optimized for | |
| 68 | +|---|---| |
| 69 | +| `generic` | General-purpose sites (default) | |
| 70 | +| `cpg` | Consumer packaged goods | |
| 71 | +| `saas` | Software-as-a-Service products | |
| 72 | +| `ecommerce` | E-commerce and product pages | |
| 73 | +| `blog` | Blog and content sites | |
| 74 | + |
| 75 | +Profiles adjust the LLM prompts to emphasize relevant schema types, content structures, and agent interaction patterns for each industry. |
| 76 | + |
| 77 | +## BYOK (Bring Your Own Key) |
| 78 | + |
| 79 | +The generate command auto-detects your LLM provider from environment variables: |
| 80 | + |
| 81 | +| Priority | Env Variable | Default Model | |
| 82 | +|---|---|---| |
| 83 | +| 1 | `OPENAI_API_KEY` | gpt-4o-mini | |
| 84 | +| 2 | `ANTHROPIC_API_KEY` | claude-3-haiku-20240307 | |
| 85 | +| 3 | Ollama running locally | ollama/llama3.2 | |
| 86 | + |
| 87 | +Override with `--model`: |
| 88 | + |
| 89 | +```bash |
| 90 | +context-cli generate example.com --model gpt-4o |
| 91 | +``` |
| 92 | + |
| 93 | +No API key is needed if you have Ollama running locally -- the compiler will use it as a fallback. |
| 94 | + |
| 95 | +## Web Server Config Generation |
| 96 | + |
| 97 | +Generate web server configuration snippets for routing `Accept: text/markdown` requests: |
| 98 | + |
| 99 | +```bash |
| 100 | +context-cli generate-config nginx |
| 101 | +context-cli generate-config apache |
| 102 | +context-cli generate-config caddy |
| 103 | +``` |
| 104 | + |
| 105 | +See [serve-modes.md](serve-modes.md) for details on content negotiation and deployment. |
| 106 | + |
| 107 | +## x402 Payment Config |
| 108 | + |
| 109 | +Generate x402 payment signaling configuration for monetizing AI agent access: |
| 110 | + |
| 111 | +```bash |
| 112 | +context-cli generate-x402 |
| 113 | +``` |
| 114 | + |
| 115 | +This generates configuration for HTTP 402 responses and x402 headers that signal payment-gated access to AI agents. |
0 commit comments