Skip to content

feat(mcp): reduce redundant diff resolution across multi-tool workflows #2045

Description

@gfargo

What problem does this solve?

A common agent workflow runs multiple operations on the same diff: recap to understand what changed, review to find issues, commit-draft to compose the message. Each call independently resolves the source (runs git diff, computes the digest, applies budget truncation). On a large repo this is 3x the git work and adds latency.

Proposed solution

Two complementary approaches (either or both):

Option A: Accept a pre-resolved digest to skip re-resolution

If a call returns meta.digest: "sha256:abc...", a subsequent call could pass source: { digest: "sha256:abc...", ... } as a hint. If the current diff still matches that digest, skip re-resolution and reuse the cached text. If it doesn't match (working tree changed between calls), resolve normally.

Option B: Composite operation

A new coco_batch tool (or operations array in the input) that runs multiple operations on a single resolved source:

{
  "source": "staged",
  "operations": ["review", "commit-draft"],
  "options": { "conventional": true }
}

Returns an array of envelopes, one per operation, all sharing the same meta.digest.

Trade-offs

  • Option A is simpler to implement but still requires N tool calls
  • Option B reduces round-trips but adds schema complexity
  • Both maintain the read-only safety model

Acceptance criteria

  • At least one approach implemented
  • Shared diff resolution saves measurable git work (test with a large repo)
  • Response envelopes include the shared digest for downstream chaining
  • No regression in single-operation calls

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions