Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore: check for clashing open PRs before starting a task (#94288)

Paul D'Ambrad03ca99de3a1
diff --git a/AGENTS.md b/AGENTS.md
index f578864cadac..3719c68734a0 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -37,6 +37,30 @@
- Dev experience feedback: `hogli devex:feedback "<message>"` sends feedback about repo tooling — hogli, the dev stack, tests, CI, migrations, this setup — straight to the devex team as a `hogli_feedback` event (add `-c bug|idea|praise|question`).
**Local agents must use it too**: when a hogli command or local dev workflow is broken, slow, or confusing, run it — e.g. `hogli devex:feedback -c bug "migrations:run failed with <error>"`. Do not run it from cloud tasks or agent-server sandboxes; the command is a no-op there.
+## Starting a task
+
+Several agents work on this repository at the same time, so the change you plan can already be in flight.
+Before you plan the work or write code, look for open PRs that clash with it.
+This matters most for a broken `master`: the break is visible to everyone, so it attracts duplicate PRs.
+
+Search the open PRs by keyword, then look at each candidate:
+
+```bash
+gh pr list --state open --search "<keywords>" --limit 20
+gh pr diff <number> --name-only # the files it touches
+gh pr diff <number> # the patch, once a candidate looks like a match
+```
+
+Take the keywords from the error message, the failing test, the symbol, or the feature name.
+Run two or three searches with different words, because another author can describe the same problem differently.
+Keep draft PRs in the results, because most agent PRs start as drafts.
+
+Then act on what you find:
+
+- An open PR already makes this change: do not open a second one. Tell the user the PR number, and continue the work on that PR.
+- An open PR changes the same files for a different reason: keep your diff clear of the overlap when possible, and name the other PR in your PR description.
+- Nothing matches: continue with the work.
+
## Commits and Pull Requests
- Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for all commit messages and PR titles.