Decide which stale doc references an agent may fix
Your task
Your docs drift as the code changes: renamed flags, moved endpoints, dead examples. An agent checks each reference a doc makes to code, and may only propose a fix when it can prove what the reference should now say.
Write triage_doc_anchors(anchors, live_symbols): the rule your agent follows for each reference.
anchors(list of str): the references the agent found, each writtenkind:ref, for example"flag:--dry-run".live_symbols(list of str): every name that exists in the code today.- Return one decision per anchor, in input order:
"fresh","patch","checklist"or"human-review".
Rules, for each anchor:
- Split at the first
:. If there is no::"human-review". - Trim spaces from both ends of both parts, and lowercase the kind. If the kind is not
symbol,endpoint,flagorconfig, or the ref is empty:"human-review". - If the ref is exactly equal to one of
live_symbols:"fresh". - Otherwise normalize the ref and every live symbol: lowercase, then remove every
_and-. Count the distinct live symbols whose normalized form equals the ref's. Exactly 1:"patch". 0, or more than 1:"checklist".
Examples
triage_doc_anchors(anchors: list[str], live_symbols: list[str]) -> list[str]Example 1
Input
triage_doc_anchors(["symbol:MAX_RETRIES", "flag:--dry-run", "concept:why we shard by tenant"], ["maxRetries", "--dry-run", "MAX_RETRIES_LIMIT"])Output
["patch", "fresh", "human-review"]Example 2
Input
triage_doc_anchors(["endpoint:/v1/users", "config:queue_size", "rationale:tradeoffs of at-least-once"], ["/v1/users", "queueSize", "queue-size"])Output
["fresh", "checklist", "human-review"]Example 3
Input
triage_doc_anchors(["symbol:parseJd", "symbol:parse_jd"], ["parse_jd", "parse_jd"])Output
["patch", "fresh"]