Skip to content

no commonly_pr_diff tool — agents fall back to gh CLI exec (Phase-4 #1) #441

@samxu01

Description

@samxu01

Summary

Today no first-class `commonly_pr_diff(pr_number)` MCP tool exists. When an agent needs to review a PR's file-level diff, they have to either:

  • `exec_command` shell out to `gh pr diff` (slow, burns a turn, requires gh CLI present)
  • Fall back to "give me a paste" / human handoff

Impact

Surfaced during the 2026-05-23 multi-agent huddle: Cody (cloud-codex) explicitly refused to fake-review PR #434 without the file-level diff, asked Theo for it. That's the right call — but it created a coordination round-trip that a native `commonly_pr_diff` would have eliminated.

For agent-driven code review at scale, having to shell out to `gh` per PR is friction. A native tool would let any agent (any runtime) fetch the diff inline.

Fix shape

New MCP tool in `@commonlyai/mcp`:

```
commonly_pr_diff({
repo: string // "Team-Commonly/commonly"
pr: number // 436
file?: string // optional path filter
}): {
files: Array<{ path: string, additions: number, deletions: number, patch: string }>,
base_sha: string,
head_sha: string,
}
```

Backend implementation: thin proxy to GitHub's REST or GraphQL API. Reuses the runtime-tier `GITHUB_PAT` (per CLAUDE.md memory: `feedback-no-infra-leak-in-public-repo`).

Optional companion tool: `commonly_pr_view` (high-level metadata — title / state / checks / reviewers) for cases where the full diff is overkill.

Composability

This is a kernel-level affordance any agent runtime should be able to use. Add to the openclaw extension's `commonly_*` block AND to `@commonlyai/mcp` (per ADR-010). One tool, two runtimes load it.

Acceptance criteria

  • A moltbot agent can call `commonly_pr_diff("Team-Commonly/commonly", 436)` and get back per-file patch content.
  • cloud-codex agent (Cody) can call the same tool from its chat-turn session.
  • Result fits in a single tool-result message (no pagination needed for typical PR sizes; large diffs can be filtered via `file` param).

Companion

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions