---
title: "Cite the primary source for every rule · Agent Wranglers"
url: https://agentwranglers.se/playbook/engineering/documentation/cite-primary-sources
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Cite the primary source for every rule

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

For AI agents: [llms.txt](https://agentwranglers.se/llms.txt) is a short guide that sends you to the rules your problem needs, and [rules.json](https://agentwranglers.se/playbook/engineering/rules.json) holds every rule of this playbook as JSON.

- Level: Recommended
- Chapter: [Documentation](https://agentwranglers.se/playbook/engineering/documentation)
- Rule: Link every rule that follows a specification, standard or law to that text. Fail the build on a citation from a host outside an allow list of authorities.
- How: Give each rule a sources field with one to three links. Cite the text that binds, such as an IETF RFC, a W3C or WHATWG spec, a law on EUR-Lex or a regulator's own page. Never cite blogs, tutorials, encyclopedias or vendor marketing, because they go stale and repeat each other. Keep the allow list of hosts in one place in the code. Link to the current version and the exact section where the page has stable anchors. Fetch every link once before you add it, so no address comes from memory. Then let code watch the sources, as [Watch cited sources in code](https://agentwranglers.se/playbook/engineering/documentation/watch-cited-sources) says.
- Check: Add a source from a blog host to any rule. The build stops and names the host. A rule whose text names an RFC number with no source also stops it.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
const AUTHORITIES = ['rfc-editor.org', 'w3.org', 'spec.whatwg.org', 'europa.eu', 'gov', 'owasp.org'];
const isAuthority = host => AUTHORITIES.some(domain => host === domain || host.endsWith(`.${domain}`));

export function checkSources(rule) {
  const outsider = rule.sources.find(source => !isAuthority(new URL(source.url).hostname));
  if (outsider) throw new Error(`${rule.name} cites ${outsider.url}, which is not an authority`);
}
```

### Python example

```python
from urllib.parse import urlparse

AUTHORITIES = ["rfc-editor.org", "w3.org", "spec.whatwg.org", "europa.eu", "gov", "owasp.org"]

def is_authority(host: str) -> bool:
    return any(host == domain or host.endswith("." + domain) for domain in AUTHORITIES)

def check_sources(rule: dict) -> None:
    for source in rule["sources"]:
        if not is_authority(urlparse(source["url"]).hostname):
            raise ValueError(f"{rule['name']} cites {source['url']}, which is not an authority")
```

## Related rules

- [Watch cited sources in code](https://agentwranglers.se/playbook/engineering/documentation/watch-cited-sources) in Engineering
- [Give the glossary its own page](https://agentwranglers.se/playbook/website/seo/glossary-page) in Website

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/engineering/documentation/cite-primary-sources">Agent Wranglers engineering playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Give every doc an owner and a review date](https://agentwranglers.se/playbook/engineering/documentation/doc-ownership)
- Next: [Watch cited sources in code](https://agentwranglers.se/playbook/engineering/documentation/watch-cited-sources)
- [Documentation](https://agentwranglers.se/playbook/engineering/documentation)
