Skip to content

Proposal: opt-in repo context for rules that need more than the diff #24

Description

@adelin-b

Version: @coldtea/abide 0.0.7

Many instructions in real AGENTS.md / CLAUDE.md files need more than the diff to judge. Examples: "reuse existing helpers", "deletes must cascade to referencing tables", "use the shared schema types". Today they end up as deferred, or as weak diff-only proxies, because the judge state is only {task, file(s), diff}.

Proposal: an opt-in per rule, check.context: true. Those rules get an extra context string in the state, built by a configurable local command such as contextCommand in the rubric or an env var. The command receives the changed files and symbols and prints bounded text, for example file outlines, callers and callees, and relevant schema definitions.

  • Context rules go in a separate judge call, so every other rule's state stays byte-identical and fast.
  • The context is capped by characters and by a time budget. On error or timeout it is omitted (fails open).
  • Its token usage flows through the existing usage and spend accounting.

I prototyped this locally with a code-graph CLI as the provider.

  • It applies to turn-phase checks and to audit, where the context is built once per file and reused across chunks.
  • A turn check went from about 300–400 ms to about 450–700 ms.
  • An audit of 10 files went from 3.8 s to 8.7 s.

I'm happy to share the patch or open a PR if this direction is welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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