一键导入
oss-pr-plan
Plan phase for oss-pr-lessons playbook — load state, determine next batch of PRs to analyze for any repository
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Plan phase for oss-pr-lessons playbook — load state, determine next batch of PRs to analyze for any repository
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Make Codex CLI behave more like Claude Code for Kookr by preserving the known fork, branch, build, deploy, daily upstream sync, and live-verification workflow for Claude-compatible skills, agents, settings, hooks, and related UX.
Kookr-internal extension to rfc-iterative-review that captures append-only critic traces for later meta-analysis of RFC reviewer subagents.
Analyze an open question by casting 3-5 deliberately conflicting expert roles, running them in parallel and blind to each other, sharpening them in a debate round, attacking their consensus with a devil's advocate, then synthesizing a verdict that preserves disagreement instead of averaging it. Use for decisions, strategy, idea generation, hypothesis triage, experiment post-mortems, or any question where a single lens would return "it depends".
Iterative RFC drafting workflow — draft in worktree, run parallel critic subagents, incorporate feedback over N rounds, present to user before any action
How to create, structure, and launch Kookr playbook tasks — reusable agent task templates with dynamic sources and project identity
Build a Ralph-like sequential Kookr task chain where each task completes one independent unit, records durable state, and spawns the next task with the same continuation contract. Use for issue batches, queue drains, staged migrations, or other long runs that should proceed one task at a time without relying on conversation memory.
| name | oss-pr-plan |
| description | Plan phase for oss-pr-lessons playbook — load state, determine next batch of PRs to analyze for any repository |
| keywords | oss, pr, plan, batch, pagination, state, open source, contribution, analyze |
| related | ["oss-pr-critic","oss-pr-state","oss-pr-threshold","oss-pr-distill"] |
Load state and determine the next batch of PRs to analyze. Generalized version of codex-pr-plan that works for any repository.
Invoked at the start of each oss-pr-lessons iteration.
| # | Rule | Violation Example | Correct Pattern |
|---|---|---|---|
| 1 | Always read state.json before fetching PRs | Fetching PRs without checking processed list | cat ~/.claude/{repoSlug}-pr-lessons/state.json first |
| 2 | Batch size is exactly 5 | Processing 10 or 20 PRs at once | Fetch 5 closed PRs per iteration |
| 3 | Use cursor for pagination | Re-fetching from page 1 every time | Use state.json.cursor |
| 4 | Skip already-processed PRs | Analyzing PR #123 that's in processed_prs | Filter out all IDs in processed_prs and skipped_prs |
| 5 | Include both merged AND closed-unmerged PRs | Only looking at merged PRs | Closed-unmerged PRs teach what NOT to do |
| 6 | Validate the batch manifest against state before critic work starts | Selecting #123, then noticing later it was already processed | Print the final 5 IDs and confirm none exist in processed_prs or skipped_prs |
owner/repo (e.g., microsoft/vscode)microsoft-vscode)Before planning PR analysis, check if the repo is eligible. (~/.claude/hooks/oss-registry-check is not yet implemented; the 126/127 branch below already degrades gracefully when it is absent.)
REPO="{{repoFullName}}"
RESULT=$(~/.claude/hooks/oss-registry-check "$REPO" 2>&1)
RC=$?
echo "$RESULT"
case $RC in
0) ;; # Eligible — proceed
1) # Ineligible (anti-ai or blocked)
echo "Cannot analyze PRs: repo is not eligible for AI contributions."
exit 0
;;
2) # Unknown — not in registry
echo "Repo not in registry. Run oss-repo-recon first to assess eligibility."
exit 0
;;
126|127) # Resolver missing
echo "WARNING: oss-registry-check not found. Proceeding without eligibility check."
;;
esac
SLUG="{{repoSlug}}"
REPO="{{repoFullName}}"
mkdir -p ~/.claude/${SLUG}-pr-lessons
if [ ! -f ~/.claude/${SLUG}-pr-lessons/state.json ]; then
cat > ~/.claude/${SLUG}-pr-lessons/state.json << EOF
{
"repo": "${REPO}",
"version": 1,
"processed_prs": [],
"skipped_prs": [],
"total_processed": 0,
"total_skipped": 0,
"distillation_count": 0,
"last_batch_at": null,
"last_distillation_at": null,
"cursor": 1,
"notes": "State file for ${REPO} PR lessons."
}
EOF
fi
if [ ! -f ~/.claude/${SLUG}-pr-lessons/learnings-raw.md ]; then
cat > ~/.claude/${SLUG}-pr-lessons/learnings-raw.md << EOF
# Raw PR Learnings
Accumulated observations from analyzing closed PRs in ${REPO}.
Each batch appends a section below. When this file exceeds 200 lines, distillation is triggered.
---
EOF
fi
cat ~/.claude/${SLUG}-pr-lessons/state.json
CURSOR=$(jq '.cursor // 1' ~/.claude/${SLUG}-pr-lessons/state.json)
gh api "repos/${REPO}/pulls?state=closed&sort=updated&direction=desc&per_page=20&page=${CURSOR}" \
--jq '.[] | {number, title, merged_at, closed_at, user: .user.login, additions, deletions, changed_files, body: (.body[:200])}'
From the fetched PRs:
processed_prs or skipped_prsskipped_prsskipped_prsrelease, bump version, chore(release)) — add to skipped_prsReturn a list of PR numbers and titles for the critic phase to process.
Before the critic phase starts, validate the exact selected IDs against state again:
SLUG="{{repoSlug}}"
SELECTED='[123,124,125,126,127]'
jq --argjson selected "${SELECTED}" '
{
processed_hits: [ $selected[] as $id | select(.processed_prs | index($id)) | $id ],
skipped_hits: [ $selected[] as $id | select(.skipped_prs | index($id)) | $id ]
}
' ~/.claude/${SLUG}-pr-lessons/state.json
Correct pattern:
processed_hits and skipped_hits are both emptyoss-pr-criticIf any selected PR appears in processed_prs or skipped_prs, stop and re-filter before analysis.
Add to skipped_prs (never revisit):
chore(deps):)cursor in state.json is the GitHub API page number (starts at 1)