The llm/ directory manages how the synchronization script interacts with Large Language Models. It is decoupled from the main routing and file I/O logic. The core responsibility of this folder is defining what is sent to the model (prompts) and how it is transmitted (client).
Key Components
prompts.mjs: Contains prompt builders for different dispatch kinds (code-change, release, manual-update) and a SHARED_RULES block. This is the primary file to edit if you want to change the model's instructions or behavior.client.mjs: Manages communication with Coinbase's internal LLM Gateway. It handles authentication, retries, backoff, and benchmark logging. It follows a simple "pass a string, get a string back" contract.
The Interaction Contract
The main loop in ../index.mjs follows this pattern:
- Build: A pure function transforms context into a prompt string.
- Call: An asynchronous call sends the prompt to the Gateway and logs performance metrics.
Note that benchmarking data is accumulated in BENCH_LOG and flushed to a JSONL file at the end of a run, which is then uploaded as a sync-bench-<run_id> artifact.
import { buildClaudePrompt } from "./llm/prompts.mjs";
import { callClaude, BENCH_LOG } from "./llm/client.mjs";
const prompt = buildClaudePrompt(kind, ctx); // pure: ctx → string
const output = await callClaude(prompt, page); // side-effect: Gateway call + bench