Optional
Let an agent reread rules whose sources changed
When the source watch flags a rule, have an AI agent reread it against the current source. It proposes any fix as a pull request.
How to do it
Start from the list the source watch produces. To catch edits that keep the same address, store a hash of each source's main text and flag it when the hash changes. Give the agent the rule, the current source text and what changed. Ask for a structured answer of "still correct" or "changed", with the edited rule and a quote from the source. Open one pull request per run for a person to merge. Cap each run, such as 20 rules, to bound the cost. Test the agent's prompt as Test changes to the agent setup on fixed tasks says.
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
const VERDICT_SCHEMA = {
type: 'object',
required: ['verdict', 'quote'],
properties: {
verdict: { enum: ['still correct', 'changed'] },
quote: { type: 'string' },
editedRule: { type: 'string' },
},
};
Python example
from typing import Literal, Optional
from pydantic import BaseModel
class Verdict(BaseModel):
verdict: Literal["still correct", "changed"]
quote: str
edited_rule: Optional[str] = None
How to check
Flag one rule whose source contradicts it. The next run opens a pull request that edits that rule and quotes the source.
Related rules
- Watch cited sources in code in Engineering
- Test changes to the agent setup on fixed tasks in AI development
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers engineering playbook with a link to https://agentwranglers.se/playbook/engineering/documentation/recheck-sources-with-an-agent. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.