rse/ase / plugin/skills/ase-task-integrate
ase-task-integrate
UnverifiedIntegrate the change set or implementation draft of the current or given task plan into its target. Use when the user calls to "deliver" or "apply" the change set or draft of the "task" or "plan". For merging a plain Git branch, use `ase-repo-merge` instead.
@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md @${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md @${CLAUDE_SKILL_DIR}/../../meta/ase-dialog.md @${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
$ARGUMENTS
@${CLAUDE_SKILL_DIR}/../../meta/ase-format-task.md @${CLAUDE_SKILL_DIR}/../../meta/ase-common-task.md @${CLAUDE_SKILL_DIR}/../../meta/ase-common-changeset.md
Procedure
-
Determine Task:
-
Set initially, with any leading and trailing whitespace stripped, and set (empty). Inherit the always existing from the current context. Inherit the always existing from the current context. Do not output anything.
-
React on task id:
-
Resolve the draft shorthand: if is
trueand is not empty, only output the following and then immediately STOP processing the entire current skill:Otherwise, if is
true, set attachment:draft, so the implementation draft in the attachmentdraftof the plan is delivered. Do not output anything.
-
-
Determine Operation:
-
Determine the current task plan content:
-
If the is still empty, complain and tell the user to use the
ase-task-editskill first to create a task plan, andase-task-implementto create its change set. Then immediately stop processing this skill.
-
-
Prepare Changeset and Target:
The changeset (location of the change set) and the target (place of integration) are controlled by the
Changeset:andTarget:frontmatter keys of the plan, which the--changesetand--targetoptions override ad-hoc without changing the plan. Theworktreevalue of the changeset refers to the context worktree, selected by the--worktreeoption, theworktreevalue of the target (and of the source it may refer to) to the origin working copy the skill was started in (both are the same without--worktree). An integration never creates a context worktree.-
Set to if it is not empty, otherwise to the value of the
Changeset:frontmatter key of , or to the configured default if the key is absent, and parse it:Set and .
-
Otherwise, prepare the context worktree:
-
Set to if it is not empty, otherwise to the value of the
Target:frontmatter key of , or to the configured default if the key is absent, and parse it:Set and . If is
source, the target is whatever theSource:frontmatter key of refers to (or the configured default if the key is absent): set to this value and parse it:Set and .
-
Determine the target branch : if is
worktree, capture the output of the commandgit -C "<origin-dir/>" branch --show-current, otherwise set it to . If is empty (detachedHEAD) or the commandgit rev-parse --verify --quiet "refs/heads/<target-branch/>"fails, only output the following and then immediately STOP processing the entire current skill: -
Determine the merge source branch according to :
-
worktree: Capture the output of the commandgit -C "<context-dir/>" branch --show-currentinto . If it is empty (detachedHEAD), only output the following and then immediately STOP processing the entire current skill: -
branch: Set . If the commandgit rev-parse --verify --quiet "refs/heads/<merge-source/>"fails, only output the following and then immediately STOP processing the entire current skill: -
attachment: The change set is materialized on a temporary branch at the commit it is based on, so that the merge below can resolve any drift of the target semantically.-
<if condition="the backmatter of contains NO attachment block with the
Typekey valuetext/x-diff; charset=utf-8; kind="<changeset-name/>""> Only output the following , directly followed by the hint, and then immediately STOP processing the entire current skill: -
Set to the commit of the
base <commit/>value of theDesc:key of this attachment block. If the key is absent or the commandgit rev-parse --verify --quiet "<temp-base/>^{commit}"fails, set instead. -
Set to the first 8 characters of the output of the
ase_mint(type: "sha1", hint: "<ase-task-id/>:<changeset-name/>:integrate")tool of theaseMCP server, which keeps unique per task and attachment. Set to with all characters other thanA-Z,a-z,0-9,_, and-stripped, followed by-<changeset-name/>-integrate-<temp-hash/>, and set ase-integrate/. Determine by calling thease_worktree_path(id: "<temp-id/>", temp: true, create: true)tool of theaseMCP server, which places it into the namespace of the temporary worktrees, disjoint from all other worktrees. You MUST NEVER assemble this path yourself.Otherwise, remove any leftover of an earlier run which stopped before its cleanup by expanding the following, and then determine once again the same way:
-
Create the temporary worktree and branch by running the command
git worktree add -b "<temp-branch/>" "<temp-dir/>" "<temp-base/>"(taken exactly as given), and apply theDatapayload of the attachment block inside it verbatim. As this payload is elided in , fetch it via thease_task_attachment(id: "<ase-task-id/>", type: "text/x-diff; charset=utf-8; kind=\"<changeset-name/>\"")tool of theaseMCP server, whosetextoutput field is the payload verbatim (without any indentation), and apply it, e.g. viagit -C "<temp-dir/>" apply --3way, re-applying hunks which no longer apply manually. You MUST NEVER modify anything outside of . Leave the change set uncommitted, as the merge below commits it. Set .
If any of these sub-steps fails, expand the following:
Then only output the following and then immediately STOP processing the entire current skill, leaving the task plan untouched:
-
-
-
Check that the change set can be delivered at all. Determine the change set directory : for
worktreeit is , forattachmentit is , and forbranchit is the directory of the registered worktree in which is checked out according togit worktree list --porcelain(or empty if there is none). Do not output anything, except for the templates below.-
<elseif condition="the command
git rev-list --count "<target-branch/>..<merge-source/>"reports0and either is empty or the commandgit -C "<merge-dir/>" status --porcelainreports no output"> The change set carries neither commits beyond the target nor uncommitted changes, so an integration would report a success without delivering anything. Expand the following, then only output the following and then immediately STOP processing the entire current skill, leaving the plan and the artifacts untouched:
-
-
Integrate Change Set:
-
Capture the outputs of the commands
git rev-parse "refs/heads/<target-branch/>"andgit rev-parse "refs/heads/<target-branch/>^{tree}"into and , the target branch and its content before the merge. Do not output anything. -
Set --target "" --mode "", which passes the merge mode (
merge,rebase, orsquash) through. If isattachment, or is not equaltrue, append--cleanupto , so the merged source branch (and its worktree) is removed afterwards. Then merge the change set by invoking thease-repo-mergeskill, which commits still uncommitted changes of the source branch, resolves merge conflicts semantically, and checks that the source branch landed:Set to the
MERGE VERDICTreported by thease-repo-mergeskill in (MERGED,CONFLICT, orFAILED), or toFAILEDif it reported none. -
<if condition=" is
MERGEDand the output of the commandgit rev-parse "refs/heads/<target-branch/>^{tree}"equals "> The merge succeeded, but the content of the target is unchanged, as the change set already landed earlier (e.g. on a repeated integration), so nothing was delivered: set NOOP. Capture the output of the commandgit rev-parse "refs/heads/<target-branch/>"into , and if it differs from and the output of the commandgit rev-parse "refs/heads/<target-branch/>^1"equals , drop the resulting empty commit by running the commandgit update-ref "refs/heads/<target-branch/>" "<target-before/>" "<target-after/>"(taken exactly as given), which leaves the index and working tree of the target intact, as their content is unchanged. Do not output anything. -
If is
attachment, expand the following: -
Update the frontmatter and backmatter of as follows, but persist them only if anything changed:
The
Modified:key stays untouched, as the "body" is not changed. Apart from the above, the plan MUST stay exactly as loaded -- in particular, a change set snapshot, which is maintained by thease agentagents only, is passed through verbatim. To persist the plan, call thease_task_save(id: "<ase-task-id/>", text: "<task-content/>", base: "<task-tag/>")tool of theaseMCP server, so a change made meanwhile (e.g. by an agent) is merged instead of overwritten. Thisase_task_saveMCP tool call is the only permitted way to persist the plan -- NEVER write the plan file viaWrite/Editor by executing a shell command. Do not output anything in this sub-step.
-
-
Decide Next Step:
-
Determine next step:
Next Step: How would you like to proceed with the plan? DONE: Stop processing and PRESERVE task plan. DELETE: Stop processing and DELETE the task plan.
-
Check the tool and dispatch accordingly:
-
If is
DONEorCANCEL: Only output the following and then STOP. -
If is
DELETE: Set (empty). Do not forward any remaining--nextlist tokens, because thease:ase-task-deleteskill accepts only an optional[<id>]argument and no--nextoption; remaining tokens are intentionally discarded. Only output the following and then call the toolSkill(skill: "ase:ase-task-delete", args: "<args/>")to invoke thease:ase-task-deleteskill in order to delete the updated plan. Immediately stop processing the current skill once theSkilltool was used.
-
-
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |