@relvehq/agent-ready 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,10 +8,10 @@ they got before.
8
8
  - **Serve**: Markdown on `Accept: text/markdown`, on `<page>.md` and on
9
9
  `?format=md`, plus a generated [`/llms.txt`](https://llmstxt.org). No AI
10
10
  runs per request: it is plain code, in milliseconds.
11
- - **Refine** (optional, with your own prompt files): an AI model writes a
12
- better Markdown file for each page ahead of time, a script checks every
13
- number and URL against the page,
14
- and unchanged pages are skipped on the next run.
11
+ - **Refine** (optional, with your own OpenAI key): one command writes a
12
+ better Markdown file for each page ahead of time with Relve's prompt, a
13
+ check compares every number and URL against the page, and unchanged pages
14
+ are skipped (free) on the next run.
15
15
  - **Proof**: a free checker that scores any site out of 100, and a dashboard
16
16
  of which AI agents read which pages.
17
17
 
@@ -168,28 +168,50 @@ Most CDNs (CloudFront included) don't vary their cache on `Accept`, so:
168
168
  HTML. Safe, just not Markdown. `.md` URLs always work; reliable negotiation
169
169
  needs `Accept` in the CDN cache key.
170
170
 
171
- ## Refine: better Markdown, written ahead of time
171
+ ## Refine: better Markdown with your own OpenAI key
172
+
173
+ One command, run from your project root with `OPENAI_API_KEY` in `.env.local`,
174
+ `.env` or the shell:
172
175
 
173
176
  ```
174
- npx agent-ready refine --site https://your-site.com --prompts ./prompts --sitemap --limit 20 --dry-run
175
- npx agent-ready refine --site https://your-site.com --prompts ./prompts --site-name "Your Name" --sitemap --limit 20
177
+ npx agent-ready refine --site https://your-site.com --sitemap --dry-run
178
+ npx agent-ready refine --site https://your-site.com --sitemap
176
179
  ```
177
180
 
178
- For each page: fetch it, extract its text, links, JSON-LD and a fingerprint;
179
- skip it if the fingerprint matches the saved file; otherwise fill the prompt,
180
- call the model once, check the result, retry once with the problems listed,
181
- and save `<out>/<path>.md` plus `<out>/<path>.json` (default out:
182
- `.agent-ready/md`). `--dry-run` only reads pages: no model call, nothing written.
183
-
184
- | Setting | |
181
+ For each page the command fetches the HTML itself and sends it to the Relve
182
+ API (`relvehq.com`) with your key in a header. Relve's prompt runs on Relve's
183
+ server: it extracts the page, calls OpenAI with your key, checks the result
184
+ (every number and URL must be on the page; one retry), and returns the
185
+ Markdown. The command saves `<out>/<path>.md` plus `<out>/<path>.json`
186
+ (default out: `.agent-ready/md`).
187
+
188
+ - **Cost:** your own OpenAI usage, one model call per changed page (roughly
189
+ a few thousand tokens each with the default `gpt-4o`, about 1 to 2 cents a
190
+ page). Relve charges nothing.
191
+ - **Your key:** used for that call only. Relve does not store or log it, and
192
+ it is never written to the output files.
193
+ - **Re-run when content changes.** Each saved `.json` holds the page's
194
+ fingerprint; it is sent along, and an unchanged page comes back as
195
+ `unchanged` with no model call (free). `--force` rewrites everything.
196
+ - **Optional in CI or deploy:** run the command before `next build` (with
197
+ `OPENAI_API_KEY` as a secret) and commit or ship `.agent-ready/md`.
198
+
199
+ | Option | |
185
200
  |---|---|
186
- | `OPENAI_API_KEY` | OpenAI, default model `gpt-4o` |
187
- | `ANTHROPIC_API_KEY` | Claude, default model `claude-opus-5-5` |
188
- | `AGENT_READY_MODEL` | any other model id, e.g. `gpt-4o-mini` |
201
+ | `--sitemap` / `--paths /a,/b` | which pages (sitemap at `<site>/sitemap.xml`) |
202
+ | `--model` | `gpt-4o` (default, most accurate), `gpt-4.1`, `gpt-4.1-mini`, `gpt-4o-mini` (cheapest; can mix up whose price is whose on busy pages) |
203
+ | `--site-name` | your brand name, used in the documents |
204
+ | `--out`, `--limit`, `--concurrency` (2), `--force`, `--dry-run` | `--dry-run` lists the pages: no API call, nothing written |
205
+ | `AGENT_READY_REFINE_ENDPOINT` | another API URL (testing) |
206
+
207
+ The run ends with `written / unchanged / rejected / errors` and the token
208
+ total. Rejected and failed pages are listed with their code (for example
209
+ `too_little_text`) and nothing is saved for them; the exit code is then 1.
210
+ If OpenAI rejects the key or your account is out of quota, the run stops at
211
+ the first page and says so.
189
212
 
190
- Keys are read from `.env.local` and `.env`. Serve the files from the route
191
- file (`fileStore` is Node only, so keep it out of `agent-ready.config.ts`,
192
- which the Edge middleware imports):
213
+ Serve the files from the route file (`fileStore` is Node only, so keep it
214
+ out of `agent-ready.config.ts`, which the Edge middleware imports):
193
215
 
194
216
  ```ts
195
217
  // app/%5F%5Fmd/[[...path]]/route.ts
@@ -209,10 +231,14 @@ required section is missing, it has more or fewer than one H1, HTML tags, a
209
231
  wrong fingerprint, or it is over the token budget. It cannot catch a reworded
210
232
  claim, so read a sample before you switch on.
211
233
 
212
- **The prompt.** The package ships none. Point `refine` at a folder of prompt
213
- files with `--prompts <dir>` (several: `a,b`) or the `AGENT_READY_PROMPTS`
214
- variable (`.env.local`, `.env` or the shell); without one it stops before
215
- fetching anything. A prompt file is Markdown with `## SYSTEM`, `## USER`
234
+ **Advanced: your own prompts.** The package ships no prompt. With
235
+ `--prompts <dir>` (several: `a,b`) or the `AGENT_READY_PROMPTS` variable
236
+ (`.env.local`, `.env` or the shell), `refine` runs your prompt files on your
237
+ machine instead of calling the Relve API, with `OPENAI_API_KEY` (default
238
+ model `gpt-4o`) or `ANTHROPIC_API_KEY` (default `claude-opus-5-5`);
239
+ `AGENT_READY_MODEL` picks another model. The steps are the same: fetch,
240
+ extract, skip unchanged, fill the prompt, one model call, check, one retry,
241
+ save. A prompt file is Markdown with `## SYSTEM`, `## USER`
216
242
  (`{{PAGE_URL}}`, `{{PAGE_TEXT}}`, `{{PAGE_LINKS}}`, `{{JSON_LD}}`,
217
243
  `{{SOURCE_HASH}}`) and a `## Settings` table (`page_type`, `version`,
218
244
  `required_sections`, `token_budget`). A `page_type` of `page` takes every
@@ -327,8 +353,9 @@ if (d.markdown) {
327
353
  ```
328
354
  agent-ready init [--stack next|node|wordpress] [--dry-run] [--force] [--cwd <dir>]
329
355
  agent-ready check <url> [--json]
330
- agent-ready refine --site <origin> (--paths /a,/b | --sitemap) --prompts <dir> [--site-name <name>]
356
+ agent-ready refine --site <origin> (--paths /a,/b | --sitemap) [--model <id>] [--site-name <name>]
331
357
  [--out <dir>] [--limit <n>] [--force] [--concurrency <n>] [--dry-run]
358
+ [--prompts <dir>] (advanced: your own prompts, run locally)
332
359
  agent-ready stats --log <hits.jsonl> [--days <n>] [--json]
333
360
  ```
334
361