AGENT SKILL

Context 分支变基与冲突解决

rebase-context

在 context 仓库中将一个 context 分支变基(rebase)到另一个分支上,并同步解决术语表(glossary)与 ADR 冲突。当分支派生自的基础分支已前进,或需要为 context 分支重新指定父分支时使用。区别于 merge-context(通过合并整合到主干)和 offload-context(仅提交并推送,不涉及跨分支)。

License 许可
MIT
所属仓库
epr3/dotfiles
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
rebase-context
description
Rebase one context branch onto another in the context repo, resolving glossary + ADR conflicts as you go. Use when the base a branch forked from has advanced, or to re-parent a context branch. Distinct from merge-context (reconcile into trunk via merge) and offload-context (commit + push, no cross-branch).
argument-hint
<source> onto <onto>: branch whose context to rebase, and the branch to rebase it onto (source defaults to the current branch; onto defaults to its base)
disable-model-invocation
true

03 SKILL.md 正文

Rebase Context

Resolve the context store first: GLOSSARY-FORMAT.md → Resolving the context store. In-repo context → this skill is a no-op; say so and stop.

Under a context repo, replay a source context branch's commits on top of a target so its history sits linearly on top of where it's now based. This is git rebase between two context branches plus conflict resolution with the glossary discipline in merge-context. See GLOSSARY-FORMAT.md → Publish + reconcile across branches.

Typical use: a branch's context was forked off its base (e.g. feature-3 off feature-2); the base has since advanced, so you rebase the branch's context onto the updated base to stay current and linear. Bringing a branch into the context trunk is reconciliation (a merge), not a rebase; use merge-context.

Process

1. Resolve source + onto

Parse the argument as [<source>] onto <onto>. Source context branch: the named branch, else the current code branch's context. Onto: the named target, else the source's recorded base: the fork parent ctx-init.sh persisted for that context branch at fork time; read it at ${AGENT_CONTEXT_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/agent/ctx}/<slug>/.git/info/fork-parent/<branch> (slug formula in GLOSSARY-FORMAT.md → Layout), with cwd inside the code repo. An absent record falls back to the designated master. An explicit named onto always wins. Both are branches in this repo's context repo, their context worktrees pairing 1:1 with the code branches. Resolve the source context worktree; ensure onto exists (materialise its context worktree if needed). Confirm direction before any rewrite: the rebase rewrites the source branch on top of onto; onto is read, never changed.

2. Rebase

In the source context worktree, replay onto the target: git rebase <onto>. Clean commits apply untouched; the first conflicting commit stops the rebase for resolution. git rebase --abort at any point restores the branch exactly; nothing is lost.

3. Resolve each conflict by meaning

At each stop git marks the conflicted files. Resolve by meaning, not just markers, running merge-context's classify-and-interview discipline over the conflicted glossary and unioning ADRs by date-slug (superseding, never deleting). Pause the rebase on any divergence, alias clash, or ADR contradiction for review; never auto-pick meaning.

Stage the resolved files (git add) and git rebase --continue; repeat until the rebase finishes.

4. Ground against the source's code

The authoritative universe after a rebase is the source code worktree, never onto's. Take its path universe via <setup-context skill dir>/manifest.sh, invoked by path with cwd anywhere inside the source code worktree. Follow Running the helper scripts in GLOSSARY-FORMAT.md. A <dir>/GLOSSARY.md, a term keyed to a missing module, or an ADR about absent code that the source's manifest lacks is dangling: surface it as a report + question and keep all context content until the user decides: never silently keep or drop anything. A dangling base-inherited path (present on onto, absent from the source) says "context rebased before code".

Source-only feature paths stay valid: they exist on the source, just not on the base. This step completes once every dangling reference is surfaced and decided; grounding alone drops nothing.

5. Finish

Refresh the index with <setup-context skill dir>/ctx-index.sh. Report: rebased <source> onto <onto>, conflicts resolved, anything held or flagged dangling. Because the history is rewritten, republishing an already-pushed branch needs git push --force-with-lease; a deliberate act. Never force a shared trunk.

04 同仓库更多 Skills

epr3
epr3/dotfiles

智能体技能文档编写

writing-for-agents

为智能体编写文档。在创建或编辑技能(skill),或修改 AGENTS.md、CLAUDE.md 时使用。

AI 工程师智能体开发
★ 0
epr3
epr3/dotfiles

交互式 Bash 向导生成

wizard

生成交互式 bash 向导,引导人类逐步完成只有本人才能执行的步骤。适用于配置基础设施、设置凭证或 CI 密钥、熟悉陌生的第三方仪表板,或执行一次性迁移/切换。不要将其用于智能体自身即可执行的步骤。

SRE 工程师部署与发布管理
★ 0
epr3
epr3/dotfiles

大型任务决策规划

wayfinder

将大量工作(超出单个 agent 会话可承载的范围)规划为问题跟踪器上的决策工单共享地图,并逐个解决,直到通往目标的路径清晰明了。

项目经理任务规划与分解
★ 0
epr3
epr3/dotfiles

重述上一条消息

wait-what

停。上一条消息没有被理解:重新表述它。

普通用户回复风格与输出控制
★ 0
epr3
epr3/dotfiles

工单与 PR 分诊

triage

让问题和外部 PR 经过分诊角色的状态机流转,进行分类、验证,必要时深入质询,并编写可供 agent 直接使用的简报。

开源社区运营专员工单与问题跟踪管理
★ 0
epr3
epr3/dotfiles

计划拆解为工单

to-tickets

将计划、规格说明或当前对话拆分为一系列环环相扣的工单,每个工单声明其阻塞依赖关系,并发布到配置的跟踪器(本地以文本形式记录在每个工单一个文件中,或在真实跟踪器上使用原生阻塞链接)。

项目经理工单与问题跟踪管理
★ 0