---
title: "Give every rule a short ID that never · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project/stable-rule-ids
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Give every rule a short ID that never changes

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Setting up the project](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project.md).

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

- ID: AID-61
- Level: Recommended
- Chapter: [Setting up the project](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project)
- Rule: Give every rule, requirement and acceptance criterion an ID made of a short prefix and a number, such as SEC-12. Never change or reuse an ID.
- How: An agent then cites a rule by its ID in plans, reports, commits and code comments, not by a long title or address. Number rules in the order they are written, not by position. A position such as 3.4 shifts whenever a rule is added above it, so old reports point at the wrong rule. Give each area its own prefix, keep the ID next to the rule in the source, and let the build name the next free number. Retire the ID of a deleted rule. Put the ID in every list an agent reads, and offer a short address that opens a rule from its ID, such as `/r/SEC-12`. Ask the agent to report each rule as pass or fail by ID. The same applies to [acceptance criteria](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/acceptance-criteria) and to [decision notes](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project/record-decisions).
- Check: The build fails when a rule has no ID or when two rules share one. A test compares the IDs of the last release with the current ones. No ID is missing unless it is listed as retired, and no retired ID is in use.

## 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 ID = /^[A-Z]{3}-[1-9]\d*$/;
const seen = new Set();
for (const rule of rules) {
  if (!ID.test(rule.id)) throw new Error(`"${rule.title}" needs an ID such as ${prefix}-${nextFree(rules)}`);
  if (seen.has(rule.id)) throw new Error(`${rule.id} is used twice`);
  seen.add(rule.id);
}
```

### Python example

```python
retired = set(json.loads(Path("retired-ids.json").read_text()))
current = {rule["id"] for rule in rules}
missing = previous_release_ids - current - retired
if missing or current & retired:
    sys.exit(f"Missing IDs: {sorted(missing)}. Reused retired IDs: {sorted(current & retired)}")
```

## Related rules

- [Give every task acceptance criteria](https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/acceptance-criteria) in AI development
- [Write down the decisions agents keep getting wrong](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project/record-decisions) in AI development

**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/ai-assisted-development/setting-up-the-project/stable-rule-ids">Agent Wranglers AI development playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Write down the decisions agents keep getting wrong](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project/record-decisions)
- [Setting up the project](https://agentwranglers.se/playbook/ai-assisted-development/setting-up-the-project)
