Remind agents to monitor CI after filing a PR (extend closing-reminder to gh pr create, cross-agent)
- Dominant language
- TypeScript
- Stars
- 79
- Forks
- 9
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 42
Description
## Scenario / problem
A recurring failure mode with coding agents (Claude Code **and** Codex): the agent **files a PR and then stops** — it never watches CI, so lint/test failures land silently and the human finds a red PR later. Painful in multi-agent repos where several agents share a tree.
tbd already has the *right rule* — it just isn't reinforced at the moment a PR is created.
## What tbd already does well (build on, not around)
- **`tbd closing`** emits a strong Session Closing Protocol: "Start CI watch (BLOCKS): `gh pr checks --watch` … If CI failed: fix, re-push, restart … **Work is not done until pushed, CI passes, and tbd is synced.**"
- **`tbd-closing-reminder.sh`** is installed as a PostToolUse Bash hook that runs `tbd closing` — but it matches **`git push`**, not PR creation.
- **`tbd setup --surfaces portable,agents-md,claude,codex|all`** already installs hooks across agent surfaces. This is the key strength: tbd owns cross-agent install.
## The gap
1. The reminder fires on `git push`, not at **`gh pr create`** — the exact moment an agent is most likely to declare "done" and stop.
2. Per-surface hook config is tbd-generated and often **gitignored** (in our repo `.codex/` is gitignored; `.claude/` is committed). So a repo-local, hand-added hook **cannot propagate cross-agent** — it has to come from tbd's own templates to reach Codex et al. This is why we're filing here rather than keeping it local.
## What we tried (tentative — sharing for discussion, not a finished design)
A separate PostToolUse Bash hook matching `gh pr create`, recovering the PR number from the command output, emitting a sharp "you are not done" nudge that **defers to `tbd closing`** as the source of truth. We wired it into both `.claude/settings.json` and `.codex/hooks.json` by hand — which immediately exposed that `.codex/` is regenerated by `tbd setup`, so the hand-wiring isn't durable.
```bash
#!/bin/bash
# Fires on `gh pr create`; emits a blocking-watch reminder, defers to `tbd closing`.
input=$(cat)
command=$(echo "$input" | jq -r '.tool_input.command // empty')
case "$command" in *"gh pr create"*) ;; *) exit 0 ;; esac
pr_url=$(echo "$input" | jq -r '(.tool_response.stdout // .tool_response // "")' \
| grep -oE 'https://github[.]com/[^ ]+/pull/[0-9]+' | head -1)
pr_num=$(echo "$pr_url" | grep -oE '[0-9]+$')
cat <} --watch
2. If ANY check fails: open the log, fix, commit, push, re-watch.
3. Only report success once CI is fully green.
This is tbd's closing protocol -- run "tbd closing" for the full checklist.
MSG
exit 0
```
## Proposed direction (tentative)
Rather than a second hook, **extend tbd's own `tbd-closing-reminder.sh` template** to also match `gh pr create` (and recover the PR number). Then `tbd setup --surfaces all` installs the same behavior into `.claude/`, `.codex/`, and any future surface by construction — single source, multi-agent, survives re-setup. The committed `tbd closing` checklist stays the canonical content.
## Open questions to experiment on
- **Trigger**: `gh pr create` only, or also `git push` (already covered) and `gh pr ready`?
- **Strength**: advisory stdout (current convention) vs a harder feedback channel (exit 2 / structured `additionalContext`) — and how each agent surfaces PostToolUse output differs.
- **PR-number recovery**: parsing `tool_response` is best-effort and may differ across agents/CLIs; is there a more robust source?
- **Portable surface**: should the `agents-md`/`portable` surfaces also get a one-line "monitor CI after a PR" rule for agents with no hook runtime?
Happy to PR a draft of the extended `tbd-closing-reminder.sh` if that direction sounds right. Flagging as **tentative** — we expect to iterate.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.