Decide which stale doc references an agent may fix

Agent buildEasy10 minStripe style

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 written kind: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:

  1. Split at the first :. If there is no :: "human-review".
  2. Trim spaces from both ends of both parts, and lowercase the kind. If the kind is not symbol, endpoint, flag or config, or the ref is empty: "human-review".
  3. If the ref is exactly equal to one of live_symbols: "fresh".
  4. 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
Inputtriage_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
Inputtriage_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
Inputtriage_doc_anchors(["symbol:parseJd", "symbol:parse_jd"], ["parse_jd", "parse_jd"])
Output["patch", "fresh"]