Skip to content

AC enforcement: a merge gate that checks the diff against AGENTS.md and the ticket's acceptance criteria #1591

Description

@suleimansh

Riding #1589 (comment) — context rot means rules stated once (AGENTS.md, a ticket's plan) stop steering an agent mid-task. #1589 was the live case: compat machinery grew despite the zero-users rule, because the rule wasn't in the working context at decision time.

Two layers, cheapest first:

  1. Get the rules into context at allCLAUDE.md imports AGENTS.md so Claude Code sessions load the rules #1590 does this for Claude Code sessions (CLAUDE.md@AGENTS.md). The TF-driven half: the System prompt #326 system prompt doesn't carry AGENTS.md either; injecting the repo's AGENTS.md into every run prompt is a small framework change (prompt territory — your call on wording/placement).

  2. Enforce at the gate, not just at the start — a check that runs when a session declares ready-for-merge: re-read AGENTS.md + the ticket's acceptance criteria, diff them against the actual change, and flag violations before anything lands. The hook point already exists: on-before-mergeable (opt-in today, cli.ts) fires exactly there and can carry a prompt. Start = one stock prompt ("list every AGENTS.md rule this diff violates; empty list required to proceed"); later = per-ticket ACs from the plan file, checked the same way. This is enforcement at the point of no return, immune to context rot because it re-reads the rules fresh.

Related: the SPEC.md human-review rule proposed in the same thread — a gate check can also require that *.SPEC.md diffs were explicitly acknowledged by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions