一键导入
oss-fork-manager
Fork lifecycle management for open-source contributions — fork creation, clone, upstream sync, feature branches, PR creation targeting upstream
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fork lifecycle management for open-source contributions — fork creation, clone, upstream sync, feature branches, PR creation targeting upstream
用 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-fork-manager |
| description | Fork lifecycle management for open-source contributions — fork creation, clone, upstream sync, feature branches, PR creation targeting upstream |
| keywords | fork, clone, upstream, sync, rebase, feature branch, open source, oss, remote, push, PR, pull request, contribution |
| related | ["oss-repo-recon","oss-issue-scout","pr-lifecycle"] |
Handle the fork-based contribution workflow that external open-source repos require.
| # | Rule | Violation Example | Correct Pattern |
|---|---|---|---|
| 1 | Check if fork exists before creating | gh repo fork failing because fork exists | Check first, then create only if needed |
| 2 | Always set upstream remote | Pushing to wrong remote | git remote add upstream https://github.com/{owner}/{repo}.git |
| 3 | Rebase on upstream before branching | Branching from stale main | git fetch upstream && git rebase upstream/{default} |
| 4 | Push to origin (fork), PR to upstream | git push upstream | git push origin {branch} then gh pr create -R {upstream} |
| 5 | Track state in fork-state.json | Losing track of branches and PRs | Update ~/.claude/{repoSlug}-recon/fork-state.json |
| 6 | Initialize contributions.json for new repos | Re-investigating already-attempted issues | Create from template ~/.claude/oss-contribution-tracking-template.json if missing |
owner/repo (upstream)<your-login>/repo (your fork; login via gh api user --jq .login)$HOME/git/repo (local clone)main (or master, develop)File: ~/.claude/{repoSlug}-recon/fork-state.json
{
"version": 1,
"upstream": "owner/repo",
"fork": "<your-login>/repo",
"local_path": "$HOME/git/repo",
"default_branch": "main",
"last_upstream_sync": "2026-03-28T00:00:00Z",
"active_branches": []
}
Note: PR tracking and issue selection are in contributions.json (see Contribution Tracking below), not fork-state.json.
File: ~/.claude/{repoSlug}-recon/contributions.json
Template: ~/.claude/oss-contribution-tracking-template.json
Tracks all issues attempted and PRs created. Enables dedup (don't re-investigate issues) and rate limiting (max PRs per day). Initialized from the template during fork setup.
{
"schema_version": 1,
"repo": "owner/repo",
"config": {
"max_prs_per_day": 2,
"cooldown_after_close_hours": 48
},
"issues": {},
"prs": {},
"daily_log": {}
}
Issue statuses: selected → in-progress → submitted | skipped | abandoned
PR statuses: open → merged | closed
UPSTREAM="{{repoFullName}}"
FORK="{{forkName}}"
# Check if fork exists
if gh api "repos/${FORK}" --jq '.full_name' 2>/dev/null; then
echo "Fork ${FORK} already exists"
else
gh repo fork "${UPSTREAM}" --clone=false
echo "Fork created"
fi
LOCAL="{{localPath}}"
if [ -d "${LOCAL}/.git" ]; then
echo "Clone already exists at ${LOCAL}"
else
gh repo clone "${FORK}" "${LOCAL}"
cd "${LOCAL}"
git remote add upstream "https://github.com/${UPSTREAM}.git"
echo "Cloned and upstream remote added"
fi
cd "{{localPath}}"
DEFAULT="{{defaultBranch}}"
git fetch upstream
git checkout "${DEFAULT}"
git rebase "upstream/${DEFAULT}"
git push origin "${DEFAULT}"
# Update state
SLUG="{{repoSlug}}"
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
cat ~/.claude/${SLUG}-recon/fork-state.json | jq \
".last_upstream_sync = \"${NOW}\"" \
> /tmp/fork-state-tmp.json && mv /tmp/fork-state-tmp.json ~/.claude/${SLUG}-recon/fork-state.json
cd "{{localPath}}"
UPSTREAM="{{repoFullName}}"
DEFAULT="{{defaultBranch}}"
BRANCH_NAME="{type}/{issue-number}-{slug}"
# Ensure up to date
git fetch upstream
git checkout -b "${BRANCH_NAME}" "upstream/${DEFAULT}"
Branch naming conventions:
fix/{issue}-{slug} for bug fixesfeat/{issue}-{slug} for featuresperf/{issue}-{slug} for performance improvementsdocs/{issue}-{slug} for documentationtest/{issue}-{slug} for test additionscd "{{localPath}}"
git push origin "${BRANCH_NAME}"
UPSTREAM="{{repoFullName}}"
FORK_OWNER="$(gh api user --jq .login)"
BRANCH_NAME="{branch}"
DEFAULT="{{defaultBranch}}"
gh pr create -R "${UPSTREAM}" \
--head "${FORK_OWNER}:${BRANCH_NAME}" \
--base "${DEFAULT}" \
--title "{title}" \
--body "$(cat <<'EOF'
{PR body following repo's template from recon report}
EOF
)"
BASE is the branch this PR targets upstream — the exact value passed to
gh pr create --base. Record it as original_base so future rebases (e.g.
after an upstream base-branch policy change) can use the correct 3-ref
git rebase --onto <new_base> <original_base> <branch> form without
guessing from the current PR state.
SLUG="{{repoSlug}}"
PR_NUM={pr_number}
BRANCH="{branch}"
BASE="{base}" # the --base argument to gh pr create
ISSUE_NUM={issue_number}
PR_TITLE="{title}"
PR_URL="{url}"
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
TODAY=$(date -u +%Y-%m-%d)
cat ~/.claude/${SLUG}-recon/contributions.json | jq \
--arg inum "${ISSUE_NUM}" \
--arg pnum "${PR_NUM}" \
--arg now "${NOW}" \
--arg today "${TODAY}" \
--arg branch "${BRANCH}" \
--arg base "${BASE}" \
--arg title "${PR_TITLE}" \
--arg url "${PR_URL}" \
'.issues[$inum].status = "submitted" |
.issues[$inum].pr_number = ($pnum | tonumber) |
.issues[$inum].updated_at = $now |
.prs[$pnum] = {
"number": ($pnum | tonumber),
"issue_number": ($inum | tonumber),
"branch": $branch,
"original_base": $base,
"title": $title,
"status": "open",
"created_at": $now,
"updated_at": $now,
"merged_at": null,
"closed_at": null,
"url": $url
} |
.daily_log[$today].prs_created += [($pnum | tonumber)]' \
> /tmp/contrib-tmp.json && mv /tmp/contrib-tmp.json ~/.claude/${SLUG}-recon/contributions.json
Create fork-state.json and contributions.json if they don't exist:
SLUG="{{repoSlug}}"
REPO="{{repoFullName}}"
mkdir -p ~/.claude/${SLUG}-recon
if [ ! -f ~/.claude/${SLUG}-recon/fork-state.json ]; then
cat > ~/.claude/${SLUG}-recon/fork-state.json << EOF
{
"version": 1,
"upstream": "${REPO}",
"fork": "{{forkName}}",
"local_path": "{{localPath}}",
"default_branch": "{{defaultBranch}}",
"last_upstream_sync": null,
"active_branches": []
}
EOF
fi
if [ ! -f ~/.claude/${SLUG}-recon/contributions.json ]; then
sed "s|OWNER/REPO|${REPO}|" ~/.claude/oss-contribution-tracking-template.json \
> ~/.claude/${SLUG}-recon/contributions.json
fi
--force-with-lease on personal branches only