Issue keys in branch names, status synced
Require every branch to name its Jira issue, refuse commits on main, and keep each issue's status in step with its pull request.
You'll: make every branch name its issue (feat/shop-142-cart), refuse commits on main, and have the agent move the Jira issue when its pull request moves.
Before you start
You need the kit installed and your hooks synced; see Quick start. The Jira adapter reads JIRA_EMAIL and JIRA_API_TOKEN from the environment, and the GitHub forge uses the gh command line. The
Jira and GitHub pages set them up.
Add the configuration
import { defineConfig } from '@microeinhundert/harness-kit';
/**
* Every branch names its Jira issue (`feat/shop-142-checkout`), nothing is committed on `main`, and each issue's status
* follows its pull request on GitHub: In Progress while it is a draft, In Review once it is ready, Done once merged.
*/
export default defineConfig({
adapters: {
forge: {
options: {
repository: 'acme/shop',
},
use: 'github',
},
tracker: {
options: {
credentials: {
emailVariable: 'JIRA_EMAIL',
tokenVariable: 'JIRA_API_TOKEN',
},
site: 'https://acme.atlassian.net',
writes: {
cliPatterns: ['^jira issue (edit|move|assign)'],
createPatterns: ['^jira issue create'],
mcpTools: [],
},
},
use: 'jira',
},
},
policies: [
{
id: 'branch-name',
options: {
taskTypes: ['feat', 'fix', 'chore'],
},
use: 'branch-name',
},
{
id: 'status-sync',
options: {
roles: [
{
role: 'in_flight',
status: 'In Progress',
},
{
role: 'first_review',
status: 'In Review',
},
{
role: 'deploy_queue',
status: 'Done',
},
],
},
use: 'status-sync',
},
],
});Then run npx harness-kit settings sync.
Try it
The agent made a branch feature/checkout and commits on it:
Blocked: the branch name feature/checkout does not follow <task type>/<issue key>-<slug>: its prefix feature is not a task type (feat, fix, chore).
Fix: Rename the branch while it has no commits of its own: git branch -m <task type>/<issue key>-<slug>, then commit as a separate command.It renames the branch to feat/shop-142-checkout and commits: allow
Status follows the pull request
At every stop, status-sync compares each issue its branches name with that branch's pull request:
| Pull request | Role asked | Jira status |
|---|---|---|
| draft | in_flight | In Progress |
| ready to review | first_review | In Review |
| merged | deploy_queue | Done |
An issue behind its pull request blocks the stop: block-stop. The fix names the command that moves it, harness-kit tracker transition SHOP-142 "In Review", so the agent catches the board up itself.
If it does not work
- The status never moves. Check that
JIRA_EMAILandJIRA_API_TOKENare set in the environment Claude Code starts in, and thatghis signed in. The adapter pages list the setup. - A branch is refused that should pass. Run the call through
harness-kit explain; see A call is refused that should pass. - The agent is blocked again and again at the stop. See A stop check blocks again and again.
Related
- Git and forge:
branch-nameand every other git Policy. - Stop checks and hand-off:
status-syncand the other hand-off checks.
Format every edited file
Run the project's own Prettier on each file the agent edits, right after the edit, without ever blocking it.
A complete setup: this repository's own
The configuration harness-kit's own repository runs on, part by part, from session-start checks to a read-only verifier subagent and a docs reminder at the stop.