<< All versions

Skill v1.0.0

currentAutomated scan100/100
electricjack/agent-queue/aq-workspaces-and-git
──Details
PublishedNovember 27, 2026 at 04:55 PM
Content Hashsha256:511a70dc4e4fcc1c...
Git SHA0816a021348e
──Files
Files (1 file, 9.0 KB)
SKILL.md9.0 KBactive
SKILL.md · 219 lines · 9.0 KB

name: aq-workspaces-and-git description: Covers workspace and git operations for aq worker sessions — locating the assigned worktree and task branch, committing, updating the branch with aq git pull, publishing with the guarded aq git push (including an exact-lease rewrite after a squash), opening a PR with aq git create-pr, read-only reviewer workspaces, and the operator workspace admin commands (list, doctor, reap, retire-claim, clear-sentinel, release). Use when checking where a session works, committing or pushing task work, rewriting a published branch, opening a pull request, or diagnosing a workspace lock. allowed-tools:

  • Bash

metadata: version: "1.0.0"


aq workspaces + git

Contents

  • Where am I working? · Local git work · Updating your task branch
  • Committing your work (with the publish-before-close checklist)
  • Opening a PR · Stacked branches · Never leave commits only in your worktree
  • Reviewers and read-only workspaces · Workspace admin commands · Release

Where am I working?

Every worker task acquires a workspace at start. Two places tell you where you are:

bash
pwd # the working directory the daemon put you in
echo "$AQ_WORK_DIR" # the same path, from the session environment
aq prime # restates work_dir + branch for the held task

The branch is on the task row; the workspace path is not, so read the path from the environment above rather than from the task:

bash
aq --json task show <task_id> | jq -r '.data.branch_name'

An operator (not a worker token) can see every workspace and its lock holder:

bash
aq project list-workspaces --project-id <pid> # every workspace + who holds each lock

Local Git work

git is on PATH in every worker session. Use it for local status, history, edits and commits. Use aq git for network publication: the daemon supplies the project's GitHub credentials, including an App credential when configured. The worker shell does not receive a GitHub App credential.

bash
git status
git log --oneline -10
git diff <base>..HEAD --stat
git branch --show-current

Updating your task branch

Use aq git pull --branch <project-default-or-dependency> to bring remote changes into your assigned worktree using daemon-managed credentials. The current checkout must still be your live task branch. This updates your branch locally; publication remains the guarded aq git push workflow.

Committing your work

Every task closes with commits on its branch. The typical pattern:

bash
git add -A # or targeted paths
git commit -m "$(cat <<'EOF'
feat(scope): concise subject
Longer body explaining the *why*, not the *what*.
Co-Authored-By: <your-agent-attribution>
EOF
)"
aq git push # guarded first publication of a new task branch

Use the same guarded command for a later fast-forward update. A rewrite of an already-published branch needs the exact lease below.

Commit rules:

  • Never `--no-verify` — pre-commit hooks catch regressions before

anyone else has to.

  • Never amend a pushed commit — always create a new commit.
  • One commit per logical change where practical — unless your prime or

task says otherwise. A task that asks for a single squashed commit (common for reviewed or integration-train work) wins over this default.

For a review workflow that asks you to squash a branch already pushed, record the full OID you last observed for your own branch (normally the oid that aq git push reported, which is git rev-parse HEAD at that push). After the local squash, run:

bash
aq git push --expected-remote-oid <previously-pushed-oid>

Before you close, work through this checklist:

- [ ] git status is clean (commit or deliberately discard every change)
- [ ] commits follow the task's shape (squash only if prime or the task asks)
- [ ] aq git push succeeded; for a rewrite, --expected-remote-oid named the
OID you last pushed
- [ ] the pushed oid equals git rev-parse HEAD
- [ ] a PR exists if the task or project requires one (aq git create-pr)
- [ ] the workspace is on the task branch, not detached, before aq task close

This is an exact lease on your task branch, not a way to overwrite another worker's commits. If the remote moved, stop and report the conflict. aq git push publishes only your held task's branch, to your task's repository, and refuses daemon-owned paths such as .aq/; it never hands your shell a credential. An all-zero 40-digit OID creates a branch only if it is still absent. Do not force push reviewed or delivered history.

Opening a PR

When your prime, task or project requires a pull request:

bash
aq git create-pr --title "..." --body "..."

Integration and anyone auditing the task read the branch from origin/<branch>, so push it before you call aq task close.

Stacked branches

Use the prepared task branch and its configured project baseline. Stack on a prerequisite task's branch only when the work cannot build or run without it: declare the dependency on that task and say so in your close summary.

Delivery to the default branch belongs to the project's configured integration owner, not to the last task in a stack (software-factory policy, docs/concepts/factory-policy.md). Follow the delivery section of your prime: open a PR only when your task or project asks for one, and never merge it yourself.

A PR merged into a feature branch has shipped nothing to main. The tasks close COMPLETED and dependents are released, but main does not have the code. aq doctor --check pools.stranded_feature_branches lists branches in that state.

Never leave commits only in your worktree

Your slot is reset for the next task as soon as you let go of it. Commits that no remote branch carries are unreachable from that point on — not by a retry, not by a reviewer, not by you.

bash
aq git push # guarded first or fast-forward publication before close
git rev-parse HEAD # local commit to compare with the push result

A close with --outcome fail and unpushed commits is not silently accepted: the daemon pushes them to aq/<task-id> (or aq/<task-id>-wip) and records the branch in your completion summary. If the push fails, the close is refused and the task stays yours until you fix the problem and retry aq git push.

If aq git push or aq git create-pr reports a missing profile grant, tell the supervisor. The operator can run aq doctor --check profiles.system_drift and add only the missing worker-template grants with aq agent profile-reseed --profile-id worker-<harness> --grants-only. This preserves customized vault profiles; a full reseed replaces their text.

Reviewers and read-only workspaces

If your profile has read_only: true (reviewer / final-reviewer), you hold an ordinary slot worktree — it is yours for the task and nobody else is writing to it. read_only is a statement about intent, not about isolation: don't git commit or git push, because reviewing is not the job that produces commits. Stick to git log --oneline, git show <sha>, git diff <base>..<branch>.

Your work_dir is never the project's base checkout — that clone exists for fetch and git worktree bookkeeping and is often a human's own working tree, so the daemon refuses to launch a session in it.

Workspace admin commands

These are operator reads: a plain worker or reviewer token gets out of scope: <command> back, and reaping is elevated on top of that.

bash
aq project list-workspaces --project-id <pid> # all workspaces + lock holders
aq project workspace-doctor --project-id <pid> # check locks + git health
aq project workspace-reap --workspace-id <slot-id> # (elevated) reap one retired slot
aq project workspace-reap --all-retired --project-id <pid> # deliberate retired-slot sweep

There is no per-workspace show command — list-workspaces is the detail view, filtered by project. It answers within --deadline-seconds (default 10s); each row's owner.classification, presence and git_status say what was proven, and timeout / not_started / unknown / unverified mean not known — never "stale" or "free". --no-git skips the checkout probes. Decide reaps and releases with workspace-doctor / workspace-reap, not from a partial listing.

Recovery controls have separate ownership proofs:

bash
aq project workspace-retire-claim --workspace-id <slot-id>
aq project workspace-clear-sentinel --workspace-id <slot-id>

The first retires a leftover claim only when the slot is unlocked, its holder has let go and no live session works there. The second clears a terminal/gone task's sentinel only with no task lock, claim, live claiming session, integration owner or job pin, a clean tree and published HEAD. A worker reports the blocker to its supervisor; it never removes these files itself.

Release

You do not normally release the workspace — task close does it. If you absolutely need to (e.g. hand off mid-run), the supervisor should call aq project release-workspace --workspace-id <id> on your behalf.

All versions