Auto-discovery
agentprose’s first design rule is the page is the API: use what sites already publish before asking for configuration. There are two levels.
The current page
Section titled “The current page”get_current_article, get_table_of_contents and get_section read the page the visitor has open and need no network at all. agentprose looks at:
- JSON-LD (
Article,BlogPostingand friends), OpenGraph and<meta>tags for title, authors, dates, tags, summary and image; - the article body:
<article>, common content containers, or yourdata-contentselector, minus navigation,aria-hidden,[hidden], scripts, styles and anything indata-ignore; - the headings, which become the section outline.
A page counts as an article when it has Article/BlogPosting JSON-LD, og:type=article, or a single dated <article>.
The whole site
Section titled “The whole site”Site-wide tools (search, lists, related posts, citations of other posts) need a list of posts. The first time an agent calls one, agentprose builds that list, in this order:
- A prebuilt index:
agentprose.jsonat the site root, the URL in<link rel="agentprose-index">, ordata-index. Built byagentprose build, it carries clean metadata and full Markdown per post. If it is there, feeds and sitemaps are skipped. - Feeds: RSS 2.0, RSS 1.0, Atom or JSON Feed, from
<link rel="alternate">in the page,data-feed, or common paths (feed.json,index.xml,feed.xml,atom.xml,rss.xml,feed/,rss/). - The sitemap:
sitemap.xml(ordata-sitemap), including sitemap indexes, post sitemaps first. Tag, category, author, pagination and asset URLs are skipped. llms.txt, which adds the pages it lists with their titles, plus the site’s name and description.- Pagefind: if the site ships a Pagefind index (Starlight and many static themes do),
search_postsuses it for full-text search.
Records for the same URL are merged, and the current page is always included. The result is cached in sessionStorage for 10 minutes (data-cache), without post bodies.
Bounds
Section titled “Bounds”| Limit | Default | Attribute |
|---|---|---|
| Posts held in the client index | 2,000 | data-max-posts |
| Sitemaps followed | 5 | (maxSitemaps in code) |
| Characters per answer | 20,000 | data-max-chars |
Feed and sitemap discovery handles a few thousand posts well. Beyond that, or for search over full text instead of feed excerpts, build an index.
Same-origin only
Section titled “Same-origin only”agentprose only fetches URLs on your site’s own origin (pages, feeds, sitemaps, llms.txt, the index), and get_post refuses URLs on other origins. It never acts as an open proxy.
When your site lives under a sub-path
Section titled “When your site lives under a sub-path”Tell agentprose where the site root is, so it looks for agentprose.json, feeds and the sitemap in the right place:
<script src="https://cdn.jsdelivr.net/npm/agentprose@0/dist/agentprose.min.js" defer data-base="https://example.com/blog/"></script>When there is no feed or sitemap
Section titled “When there is no feed or sitemap”Use a CMS adapter, point data-index at a JSON file, or run agentprose build on your built site.