Skip to main content

From issue tracker stories to pull requests via coding agents. A spirit that works while you sleep.

Project description

yokai

In Japanese folklore, a yokai is a spirit that operates in the background of the human world, often working at night, sometimes mischievous and sometimes helpful. This framework is the helpful kind: it watches your backlog while you sleep and leaves pull requests waiting for you in the morning.

A Python framework for spec-driven development pipelines: turn issue tracker stories into pull requests automatically, using a coding agent of your choice.

+-------------+      +----------+      +---------------+      +---------------+
|   Jira      | ---> | Router   | ---> |  Claude Code  | ---> |  Bitbucket    |
|  (story)    |      |          |      |  (agent)      |      |  (pull req)   |
+-------------+      +----------+      +---------------+      +---------------+

yokai polls your issue tracker for stories tagged with a configurable trigger label, routes each story to its target repository, runs a coding agent inside the local working tree, then commits, pushes, and opens a pull request. It posts the result back as comments on the original story so the human reviewer has full context.

Why this exists

Several commercial offerings cover the same workflow, but they all target cloud SaaS deployments (Jira Cloud, Bitbucket Cloud, GitHub). yokai is the first open-source framework targeted at on-premise enterprise environments: Jira Data Center and Bitbucket Data Center behind firewalls and SSO, where cloud connectors do not work.

It is designed to be runnable from a developer laptop, with no infrastructure requirements beyond Python 3.10+, git, and the chosen coding agent CLI.

Status

Early alpha. The core orchestrator, the Jira Data Center and Bitbucket Data Center adapters, and the Claude Code adapter are working and tested. The API is unstable and may change.

Features

  • Provider-agnostic core: swap any of the issue tracker, repo hosting, coding agent, router, or storage by implementing a small interface.
  • Built-in adapters for Jira Data Center, Bitbucket Data Center, and Claude Code CLI.
  • Parallel processing with per-repository locking: stories on different repos run concurrently, stories on the same repo serialize.
  • In-flight deduplication: a story is never picked up twice while it is being processed, even if the issue tracker label update is delayed.
  • Plugin system with lifecycle hooks: register callbacks for events like after_agent_run or on_failure without forking the framework.
  • Persistent execution state via SQLite, surviving process restarts.
  • Notification sinks (logger, Slack webhook, custom).
  • Token redaction in all log output.
  • Idempotent commands and safe failure recovery.

Quickstart

1. Install

pip install yokai-cli

You also need:

  • Python 3.10 or later
  • git
  • The CLI of your chosen coding agent (e.g. Claude Code: npm install -g @anthropic-ai/claude-code)

2. Generate a starter config

yokai init --output config.yaml

Edit config.yaml and fill in your Jira and Bitbucket details. Tokens should be passed via environment variables and referenced as ${VAR_NAME} in the file.

3. Set credentials

export JIRA_USERNAME=your.username
export JIRA_TOKEN=your-jira-personal-access-token
export BITBUCKET_USERNAME=your.username
export BITBUCKET_TOKEN=your-bitbucket-http-access-token

The Bitbucket token must have repository write permission. Read-only tokens will fail at the push step.

4. Tag a story and run

In Jira, add the label ai-pipeline to a story in the Backlog status. Make sure the story has a component that matches one of the entries in your routing.components map, or add a label like repo:my-repo.

Then run the orchestrator:

yokai run --config config.yaml

It will poll Jira every 30 seconds. When it sees the labelled story, it clones the target repo, runs Claude Code, opens a pull request, and posts two comments back on the Jira story (a short link comment and a detailed agent output comment).

5. Inspect history

yokai status --config config.yaml

Shows the most recent story executions stored in the SQLite state database, with their status and pull request URL.

Architecture

The core of the framework is a small set of abstract interfaces:

Interface Responsibility Built-in implementation
IssueTracker search, comment, label stories JiraDataCenterTracker
RepoHosting clone, branch, commit, push, open PR BitbucketDataCenterHosting
CodingAgent run an AI agent in a working tree ClaudeCodeAgent
StoryRouter resolve a story to a repository ComponentMapRouter, LabelPrefixRouter, ChainRouter
NotificationSink post events to humans LoggerNotificationSink, SlackWebhookSink
ExecutionStore persist execution state InMemoryExecutionStore, SqliteExecutionStore

The Pipeline class depends only on these interfaces. Concrete adapters are constructed by the factory.build_pipeline(config) function from a FrameworkConfig loaded from YAML.

To add support for a different system (GitHub Issues, GitLab, Linear, Aider, OpenCode, etc.), implement the relevant interface and register the new builder. See docs/writing_an_adapter.md.

Concurrency

The orchestrator uses a ThreadPoolExecutor to process multiple stories in parallel up to max_parallel_stories. To prevent two stories from trampling each other's working tree on the same repo, each repository has its own lock. Two stories on different repositories run truly in parallel; two stories on the same repo serialize through the lock.

A separate in-flight registry tracks stories that have been submitted to the pool but have not yet had their tracker label updated, so the polling loop never submits the same story twice.

Hooks

The pipeline emits 9 lifecycle events. Plugins register callbacks for the events they care about. A failing callback never breaks the pipeline, only logs the exception.

Event When it fires Payload keys
before_process Story acquired by worker story
after_resolve_repo Repository resolved story, repo_slug
after_clone Working tree ready story, repo_path
before_agent_run About to invoke agent story, repo_path, prompt
after_agent_run Agent finished story, agent_result
after_commit Local commit created story, commit
after_push Branch pushed story, branch_name
after_pull_request Pull request opened story, pull_request
on_success Full flow succeeded story, pull_request
on_failure Any error in the flow story, error

See examples/example_plugin.py for a working plugin.

Configuration reference

The full configuration is a single YAML file. See examples/enterprise_data_center.yaml for an annotated example.

Sections:

  • issue_tracker — connection and filtering for the issue source
  • repo_hosting — connection and branch policy for the repo host
  • agent — coding agent command and timeouts
  • routing — how to resolve stories to repositories
  • orchestrator — polling and parallelism settings
  • storage — execution state persistence (memory or sqlite)
  • plugins — list of dotted import paths to plugin install functions

Environment variable references like ${VAR_NAME} are expanded at load time. Missing variables raise a clear configuration error.

Development

Clone the repo and install in editable mode with dev extras:

git clone https://github.com/your-org/yokai
cd yokai
pip install -e .[dev]

Run the test suite:

pytest

The test suite has unit tests with HTTP mocking for the Jira and Bitbucket adapters, parallelism tests using fake in-memory adapters, and an integration test that exercises real git operations against a local bare repository (no network needed).

Contributing

This project is maintained as a side effort. Contributions are welcome, especially:

  • Additional issue tracker adapters (Jira Cloud, Linear, GitHub Issues)
  • Additional repo hosting adapters (GitHub, GitLab, Bitbucket Cloud)
  • Additional coding agent adapters (Aider, OpenCode, Cursor CLI)
  • Bug reports from real on-premise enterprise deployments
  • Improvements to documentation

Please open an issue first if you plan a substantial change.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yokai_cli-0.1.0a6.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yokai_cli-0.1.0a6-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file yokai_cli-0.1.0a6.tar.gz.

File metadata

  • Download URL: yokai_cli-0.1.0a6.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for yokai_cli-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 6b5a7fea672628649eedb2c69389593c0f80f8ed4d83d04043e5a7f72495b314
MD5 c8375b54ec1a91b63b7d7084a8d5fcae
BLAKE2b-256 d6ce099b01ea16abfb064780602502b1eaabf762484a05aa7baa3047479e5329

See more details on using hashes here.

File details

Details for the file yokai_cli-0.1.0a6-py3-none-any.whl.

File metadata

  • Download URL: yokai_cli-0.1.0a6-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for yokai_cli-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 be6eaff03b7d44e42599b54e61cd482ce868004d8d9a85da4923a7125cec2d68
MD5 bd14f4fc60b9718aff6f32c1c21c0409
BLAKE2b-256 260f590dc64911cc72f5802ef2666eec0b93e8f0355fd5897d9706ceabaf5309

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page