# Jira sync

> Pull issues from a Jira project into your repository as Kanbus files, so coding agents can read the context with the same tools they use for code.

Canonical: https://kanb.us/features/jira-sync.html

If your organization plans work in Jira, Kanbus can bring that work into the repository. `kbs jira pull` fetches every issue in a configured Jira project and writes each one as a Kanbus JSON file in `project/issues/`. After that, agents read titles, descriptions, statuses, priorities, assignees and comments from disk, with no Jira credentials in the agent session and no API calls while it works.

::video{src="https://dmhqusv90xmye.cloudfront.net/kanbus-feature-videos/jira-sync.mp4" poster="https://dmhqusv90xmye.cloudfront.net/kanbus-feature-videos/jira-sync.jpg" title="Jira Sync"}

## Configure the connection

Add a `jira` block to `.kanbus.yml` with the site URL, the Jira project key and a mapping from Jira issue types to Kanbus types. Keep secrets out of the file: the API token and account email come from environment variables.

```yaml
jira:
  url: https://yourcompany.atlassian.net
  project_key: AQA
  sync_direction: pull
  type_mappings:
    Story: story
    Bug: bug
    Task: task
    Workstream: epic
```

```bash
export JIRA_API_TOKEN=your-atlassian-api-token
export JIRA_USER_EMAIL=you@yourcompany.com
```

You can also put the two variables in a project `.env` file or store them once per machine with `kbs setup env JIRA_API_TOKEN`.

## Pull issues

```bash
# Show what would be written, without touching any files
kbs jira pull --dry-run

# Write or update the issue files
kbs jira pull

kbs list
```

The pull is idempotent. Each synced issue records its Jira key, and later pulls update the matching file in place instead of creating a duplicate, so Kanbus IDs stay stable across runs. Jira parent links are translated to Kanbus parent IDs, and Jira priority names are mapped to Kanbus's numeric priorities.

:::note{title="One direction only"}
Sync runs from Jira into the repository. Changes you make to synced issues in Kanbus are not sent back to Jira, and the next pull replaces each synced issue with Jira's current version, including its comments. Treat synced issues as read-only context and make changes in Jira.
:::

## What agents get

Synced issues are ordinary Kanbus files. Agents can use `kbs list` and `kbs show`, or simply read `project/issues/`. Because the files are in the repository, they travel with the branch and remain available offline. Run the pull again whenever you want fresher context.

## Learn more

- [CLI reference](https://github.com/AnthusAI/Kanbus/blob/main/docs/CLI_REFERENCE.md) for listing and showing synced issues.
- [Configuration](https://github.com/AnthusAI/Kanbus/blob/main/docs/CONFIGURATION.md) for how `.kanbus.yml` and `.env` are loaded.
- Related features: [Git-native storage](/features/git-native-storage.html), [Command line](/features/core-management.html), [Virtual projects](/features/virtual-projects.html).
