Skip to content

fix(agent-setup): link the .md rendering of every docs page an agent receives - #836

Merged
ZacxDev merged 1 commit into
mainfrom
zach/agents-md-markdown-links
Oct 14, 2026
Merged

ZacxDev merged 1 commit into
mainfrom
zach/agents-md-markdown-links

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What

civitai agent-setup --track app writes an AGENTS.md block that tells coding agents the .md suffix serves the agent-readable source. Then it linked three pages by their HTML route. The --track api refusal did the same thing with two more pages. This PR switches all five to their .md twins:

Was Now
/apps/reference/ (both SDK arms) /apps/reference.md
/apps/guide/ /apps/guide.md
/apps/examples /apps/examples.md
/site/ (--track api refusal) /site.md
/orchestration/ (--track api refusal) /orchestration.md

Probed 2026-10-14 without following redirects. Every new spelling returns 200 text/markdown with front matter. Every old one returns 200 text/html with a full <!DOCTYPE html> site shell (77–118 KB). app_submit.go's first-review URL was already .md. I left the human-facing links in app_listing.go, the README and the scaffold READMEs alone.

The size sentence

The line "It is over 100 KB, so page it" is gone. In its place is one line in the shared tail, so both SDK arms get it. It says some reference pages are long enough that a fetch tool cuts them off without saying so. If content is missing, it was probably truncated, so the agent should download the page and search it, or fetch a narrower page if the page links to one. The line names no size and promises no sub-page, so it stays true whether or not the planned hub + sub-page split of the large reference pages has landed. Net cost: +238 template bytes.

Tests

  • New: TestEveryDocsPageURLAnAgentReceivesIsMarkdown. It renders the whole block for every project shape under both {{ if .ElementsSDK }} arms, plus the --track api refusal. Every developer.civitai.com address must end in .md or be /llms.txt. It fails at ca9504b (origin/main) with only the test file added, with 32 findings (3 routes × 10 rendered blocks, plus the refusal's 2), and passes here. TestHTMLRouteDetectorCanFail is its control.
  • wantDocsSection and TestAgentSetupTrackAPIRefuses are updated to the new spellings and wording.
  • TestEveryDocsURLSpellingIsLedgered: each .md golden URL now also contributes its <path>/ form. Without that, 12 ledger rows that link pages under /apps/guide/ (README, the scaffolds' responsive pointer, and others) report "no longer spells ANY" even though none of their URLs changed. The ledger result is the same as on main: 17 ledgered, 4 exempt.
  • Decision 36 gets a dated "Fifth" section with the measurements.

go test ./...: the same 3 top-level failures as on origin/main, all TestOracle* dogfood tests that need a local Chromium/container. The new tests add 2 passes. go vet, gofmt -s -l and make lint are clean.

CIVITAI_CHECK_DOCS_LINKS=1:

  • TestBlockDocsLinksResolve passes: 8 of 8 links live, 0 moved, 0 gone.
  • TestEveryShippedDocsURLResolves fails, with the same 4 moved and 2 gone as origin/main. All six are in test fixtures (/apps/scopes, /apps/submit, /apps/guide in redact fixtures, http://…/apps), and none come from this change.

🤖 Generated with Claude Code

…receives

The managed AGENTS.md block says the `.md` suffix serves the plain-text
source an agent can read, then linked /apps/reference/, /apps/guide/ and
/apps/examples by their HTML routes (200 text/html, full site shell). The
`--track api` refusal did the same with /site/ and /orchestration/. All
five now link their `.md` twins, each probed 200 text/markdown with no
redirect.

The "over 100 KB, so page it" sentence is replaced by a shared-tail line
that names no size and promises no sub-page: a fetch tool may cut a long
reference page off, so missing content was probably truncated - download
and search the page, or fetch a narrower page if it links to one.

New guard TestEveryDocsPageURLAnAgentReceivesIsMarkdown (+ detector
control): every developer.civitai.com address in the whole rendered block,
both SDK arms, and the refusal must be `.md` or /llms.txt. Red at ca9504b
(32 findings), green here. TestEveryDocsURLSpellingIsLedgered now also
derives each `.md` URL's `<path>/` form so the ledger keeps matching the
pages under /apps/guide/ (unchanged result: 17 ledgered, 4 exempt).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev

ZacxDev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Audit round 0 (requirements & deletion) — verdict: proceed to the checklist.

Audited head 439ac06 against base ca9504b. round 0 · requirements: 7 (unattributed: 3) · deletion candidates: 3

D1 — TestEveryDocsPageURLAnAgentReceivesIsMarkdown + TestHTMLRouteDetectorCanFail (110-line new guard; unasked; only unique coverage is the @civitai/sdk arm and future links)
D2 — the 58-line Decision-36 "Fifth" section (repeats PR body, commit message and test header; trim to decision + pointers)
D3 — the shared-tail truncation line, once the docs-repo hub+sub-page split of hooks/cli/generation.md merges (no oversized page left to warn about)

Dispositions: D1=kept:only guard on the @civitai/sdk arm; standing test-coverage default · D2=kept:AGENTS.md routes docs-link changes through decision 36 · D3=kept:true until civitai/civitai-developer-docs#218 merges and worded to survive it; revisit after that merge

🤖 Generated with Claude Code

@ZacxDev

ZacxDev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Audit round 1 (nine-axis checklist) — clean: no 🔴, no 🟡. The audit ladder ends here.

Audited head 439ac06 against base ca9504b (current main).

Re-verified independently rather than taken from the PR body:

  • TestEveryDocsPageURLAnAgentReceivesIsMarkdown fails on base sources with exactly 32 findings (3 block URLs × 5 project shapes × 2 SDK arms, plus the 2 --track api refusal URLs) and passes at head.
  • Mutants caught by the guard's own message: the @civitai/sdk arm reverted to reference/, the refusal reverted to orchestration/, llms.txt → llms; and removing the detector's .md acceptance makes TestHTMLRouteDetectorCanFail fail.
  • Removing the new <path>/ ledger needle reproduces exactly the 12 TestEveryDocsURLSpellingIsLedgered errors the PR describes.
  • Live: all five .md targets return 200 text/markdown; TestBlockDocsLinksResolve with CIVITAI_CHECK_DOCS_LINKS=1: 8/8 live.
  • go test ./...: all packages pass except the same 3 TestOracle* tests that fail on base (no Chromium on the audit host).

🟢 noted, not acted on: hooks.md lost its own "over 100 KB, page it" sentence; the generic truncation line now sits in the shared tail. This stops mattering when civitai/civitai-developer-docs#218 merges, which turns hooks.md into a ~16 KB hub with sub-pages. Revisit only if #218 does not merge.

Not covered by this PR: the .md index pages still link their own sub-pages by HTML route; civitai/civitai-developer-docs#219 rewrites those to absolute .md URLs.

Verdict: safe to merge (advisory).

🤖 Generated with Claude Code

@ZacxDev
ZacxDev merged commit 8591fc4 into main Oct 14, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant