Agent Workflow: End-to-End Task Lifecycle
This document describes the full lifecycle of a task in the ai-workarea Claude Code workspace, from the moment a human creates a YouTrack issue through autonomous implementation, review-feedback resolution, and final merge.
Overview
Human creates YouTrack issue
|
v
[issue-resolver] ------> Feature branch + Pull Request (PR)
|
v
[pr-reviewer] ----------> Reviews PR; posts feedback or approves + merges
|
(if feedback)
v
[pr-resolver] ----------> Addresses review comments, re-labels PR as Ready
|
v
[pr-reviewer] ----------> Re-reviews, approves, merges, deletes branch, marks YouTrack Done
The pipeline can cycle between pr-reviewer and pr-resolver more than once if the reviewer requests additional changes. The pipeline ends when pr-reviewer successfully merges the PR.
Stage 1 — Human Creates a YouTrack Issue
Required Fields
| Field | Required Value | Notes |
|---|---|---|
| AI State | Ready |
Signals the issue is ready for autonomous pickup |
| Stage | To Do or In Progress |
Either value is accepted by get-open-issue |
| Summary | Brief, imperative sentence | e.g., "Add login endpoint to API" |
| Description | Concrete scope and deliverable | Enough detail for the agent to act without clarification |
Conventions
- Write the description as if briefing a developer: state what to change and where. Vague issues cause the agent to leave a clarification comment and stop.
- Link related issues using YouTrack's link types (e.g., "subtask of", "relates to") to give the agent context.
- Do not pre-assign a branch name or PR title — the agent derives these from the issue ID and summary.
Agent reads: AI State, Stage, Summary, Description, comments.
Stage 2 — issue-resolver Agent
Definition: .claude/agents/issue-resolver.md
The issue-resolver agent picks up a ready issue (either the next available one or a specific ID) and drives it to a merged-ready PR.
Workflow Steps
- Query YouTrack for issues where
AI State = ReadyandStage = To Do / In Progress(via theget-open-issueskill). - Fetch full issue details and comments.
- If the issue is ambiguous, post a clarification comment and stop.
- Set
Stage = In ProgressandAI State = Progressingon the YouTrack issue. - Create a feature branch off
main:- Naming convention:
<type>/<issue-id>-<short-slug> - Examples:
feat/COR-42-add-login,fix/COR-99-null-pointer,docs/COR-1011-agent-workflow
- Naming convention:
- Implement the minimal change required by the issue.
- Run the project's build/test suite (prefixed with
rtk). - Commit using a conventional-commit prefix, referencing the issue ID in the body:
feat: add login endpoint Resolves COR-42 https://youtrack.davidhsaiou.com/issue/COR-42 - Push the branch and open a PR targeting
main. The PR body must include the YouTrack issue URL. - Post a comment on the YouTrack issue with the PR URL and commit SHA, then set
AI State = Done.
YouTrack Fields Written
| Field | Value Set |
|---|---|
Stage |
In Progress (step 4) |
AI State |
Progressing (step 4), Done (step 10) |
Gitea PR Labels Written
None at creation — the PR starts unlabeled.
Skills Used
get-open-issue, get-issue-detail, add-issue-comment, update-issue-status, create-pull-request
Stage 3 — pr-reviewer Agent (First Pass)
Definition: .claude/agents/pr-reviewer.md
The pr-reviewer agent reviews open PRs that carry the Ready label, approves and merges them, or leaves specific feedback and labels them Need Changes.
Workflow Steps
- List open PRs in the target Gitea repository (via
get-open-prskill). - Select the first PR that has the
Readylabel. If no PR carriesReady, the agent stops. - Load the full PR diff and description via
view-pull-request. - Evaluate correctness, convention adherence (per CLAUDE.md), base branch, and completeness.
- If the PR looks good:
- Approve via
approve-pull-request. - Merge via
merge-pull-request. - Delete the source branch via
delete-branch. - If the PR description references a YouTrack issue, set
Stage = Doneon that issue.
- Approve via
- If the PR needs changes:
- Post specific, actionable review feedback via
comment-pull-request. - Apply the
Need Changeslabel vialabel-pull-request. - Do not approve or merge.
- Post specific, actionable review feedback via
Note: After
issue-resolveropens a PR, the PR has no label.pr-reviewerrequires theReadylabel to pick up a PR. This means a human (or another agent) must apply theReadylabel beforepr-reviewerwill process it — or thepr-resolveragent applies it after addressing feedback.
YouTrack Fields Written
| Field | Value Set |
|---|---|
Stage |
Done (after successful merge only) |
Gitea PR Labels Written
| Label | When Applied |
|---|---|
Need Changes |
PR requires changes before merging |
Skills Used
get-open-pr, view-pull-request, approve-pull-request, merge-pull-request, delete-branch, comment-pull-request, label-pull-request, update-issue-status
Stage 4 — pr-resolver Agent
Definition: .claude/agents/pr-resolver.md
The pr-resolver agent handles PRs that have review comments requesting changes. It reads the feedback, applies fixes, and re-labels the PR as Ready so pr-reviewer can take another pass.
Workflow Steps
- List open PRs in the target Gitea repository (via
get-open-pr). - Filter to PRs that have at least one review in
REQUEST_CHANGESstate. - Load the PR diff, description, and all review comments.
- Locate and read the relevant source files.
- Apply the minimal code changes to address each review comment.
- Run build/test (prefixed with
rtk). - Commit and push on the PR's existing source branch:
fix: address review feedback Addresses review feedback on PR #42 - Apply the
Readylabel to the PR vialabel-pull-request.
YouTrack Fields Written
None — pr-resolver does not touch YouTrack.
Gitea PR Labels Written
| Label | When Applied |
|---|---|
Ready |
After all review feedback is addressed |
Skills Used
get-open-pr, view-pull-request, comment-pull-request, label-pull-request
Handoff Summary
| From | To | Trigger |
|---|---|---|
| Human | issue-resolver |
AI State = Ready, Stage = To Do / In Progress |
issue-resolver |
pr-reviewer |
PR opened + Ready label applied (manually or by pr-resolver) |
pr-reviewer |
pr-resolver |
PR labeled Need Changes by reviewer |
pr-resolver |
pr-reviewer |
PR re-labeled Ready by pr-resolver |
pr-reviewer |
YouTrack | PR merged → Stage = Done set on linked issue |
Agent and Skill File Locations
Agents
| Agent | File |
|---|---|
issue-resolver |
.claude/agents/issue-resolver.md |
pr-resolver |
.claude/agents/pr-resolver.md |
pr-reviewer |
.claude/agents/pr-reviewer.md |
Skills
| Skill | File |
|---|---|
get-open-issue |
.claude/skills/get-open-issue/ |
get-issue-detail |
.claude/skills/get-issue-detail/ |
add-issue-comment |
.claude/skills/add-issue-comment/ |
update-issue-status |
.claude/skills/update-issue-status/ |
get-open-pr |
.claude/skills/get-open-pr/ |
view-pull-request |
.claude/skills/view-pull-request/ |
create-pull-request |
.claude/skills/create-pull-request/ |
approve-pull-request |
.claude/skills/approve-pull-request/ |
merge-pull-request |
.claude/skills/merge-pull-request/ |
delete-branch |
.claude/skills/delete-branch/ |
comment-pull-request |
.claude/skills/comment-pull-request/ |
label-pull-request |
.claude/skills/label-pull-request/ |
All paths above are relative to the root of the ai-workarea repository.