Skip to Content
harness-kit

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

harness.config.ts
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:

What the agent reads
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 requestRole askedJira status
draftin_flightIn Progress
ready to reviewfirst_reviewIn Review
mergeddeploy_queueDone

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_EMAIL and JIRA_API_TOKEN are set in the environment Claude Code starts in, and that gh is 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.

On this page