Skip to content

rse/ase / plugin/skills/ase-task-integrate

ase-task-integrate

Unverified

Integrate 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

  1. Determine Task:

    1. 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.

    2. React on task id:

    3. Resolve the draft shorthand: if is true and 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 attachment draft of the plan is delivered. Do not output anything.

  2. Determine Operation:

    1. Determine the current task plan content:

    2. If the is still empty, complain and tell the user to use the ase-task-edit skill first to create a task plan, and ase-task-implement to create its change set. Then immediately stop processing this skill.

  3. Prepare Changeset and Target:

    The changeset (location of the change set) and the target (place of integration) are controlled by the Changeset: and Target: frontmatter keys of the plan, which the --changeset and --target options override ad-hoc without changing the plan. The worktree value of the changeset refers to the context worktree, selected by the --worktree option, the worktree value 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.

    1. 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 .

    2. Otherwise, prepare the context worktree:

    3. 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 the Source: frontmatter key of refers to (or the configured default if the key is absent): set to this value and parse it:

      Set and .

    4. Determine the target branch : if is worktree, capture the output of the command git -C "<origin-dir/>" branch --show-current, otherwise set it to . If is empty (detached HEAD) or the command git rev-parse --verify --quiet "refs/heads/<target-branch/>" fails, only output the following and then immediately STOP processing the entire current skill:

    5. Determine the merge source branch according to :

      • worktree: Capture the output of the command git -C "<context-dir/>" branch --show-current into . If it is empty (detached HEAD), only output the following and then immediately STOP processing the entire current skill:

      • branch: Set . If the command git 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.

        1. <if condition="the backmatter of contains NO attachment block with the Type key value text/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:

        2. Set to the commit of the base <commit/> value of the Desc: key of this attachment block. If the key is absent or the command git rev-parse --verify --quiet "<temp-base/>^{commit}" fails, set instead.

        3. Set to the first 8 characters of the output of the ase_mint(type: "sha1", hint: "<ase-task-id/>:<changeset-name/>:integrate") tool of the ase MCP server, which keeps unique per task and attachment. Set to with all characters other than A-Z, a-z, 0-9, _, and - stripped, followed by -<changeset-name/>-integrate-<temp-hash/>, and set ase-integrate/. Determine by calling the ase_worktree_path(id: "<temp-id/>", temp: true, create: true) tool of the ase MCP 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:

        4. 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 the Data payload of the attachment block inside it verbatim. As this payload is elided in , fetch it via the ase_task_attachment(id: "<ase-task-id/>", type: "text/x-diff; charset=utf-8; kind=\"<changeset-name/>\"") tool of the ase MCP server, whose text output field is the payload verbatim (without any indentation), and apply it, e.g. via git -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:

    6. Check that the change set can be delivered at all. Determine the change set directory : for worktree it is , for attachment it is , and for branch it is the directory of the registered worktree in which is checked out according to git 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/>" reports 0 and either is empty or the command git -C "<merge-dir/>" status --porcelain reports 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:

  4. Integrate Change Set:

    1. Capture the outputs of the commands git rev-parse "refs/heads/<target-branch/>" and git rev-parse "refs/heads/<target-branch/>^{tree}" into and , the target branch and its content before the merge. Do not output anything.

    2. Set --target "" --mode "", which passes the merge mode (merge, rebase, or squash) through. If is attachment, or is not equal true, append --cleanup to , so the merged source branch (and its worktree) is removed afterwards. Then merge the change set by invoking the ase-repo-merge skill, which commits still uncommitted changes of the source branch, resolves merge conflicts semantically, and checks that the source branch landed:

      Set to the MERGE VERDICT reported by the ase-repo-merge skill in (MERGED, CONFLICT, or FAILED), or to FAILED if it reported none.

    3. <if condition=" is MERGED and the output of the command git 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 command git rev-parse "refs/heads/<target-branch/>" into , and if it differs from and the output of the command git rev-parse "refs/heads/<target-branch/>^1" equals , drop the resulting empty commit by running the command git 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.

    4. If is attachment, expand the following:

    5. 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 the ase agent agents only, is passed through verbatim. To persist the plan, call the ase_task_save(id: "<ase-task-id/>", text: "<task-content/>", base: "<task-tag/>") tool of the ase MCP server, so a change made meanwhile (e.g. by an agent) is merged instead of overwritten. This ase_task_save MCP tool call is the only permitted way to persist the plan -- NEVER write the plan file via Write/Edit or by executing a shell command. Do not output anything in this sub-step.

  5. Decide Next Step:

    1. 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.

    2. Check the tool and dispatch accordingly:

      • If is DONE or CANCEL: Only output the following and then STOP.

      • If is DELETE: Set (empty). Do not forward any remaining --next list tokens, because the ase:ase-task-delete skill accepts only an optional [<id>] argument and no --next option; remaining tokens are intentionally discarded. Only output the following and then call the tool Skill(skill: "ase:ase-task-delete", args: "<args/>") to invoke the ase:ase-task-delete skill in order to delete the updated plan. Immediately stop processing the current skill once the Skill tool was used.

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 implementationStars: 318kUpdated Claude CodeCodexUnverifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 318kUpdated Claude CodeCodexUnverifiedInstall
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 fallbackStars: 318kUpdated Claude CodeCodexUnverifiedInstall
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 alwaysStars: 318kUpdated Claude CodeCodexUnverifiedInstall