Skip to content

daimyo Integration

aifred-tk ships an optional integration with daimyo, a rules engine for AI coding assistants. When installed, it registers two daimyo plugins that expose the currently enabled aifred-tk tools to daimyo rule templates.

This integration is not an aifred-tk plugin. It lives in the daimyo.plugins entry point group and is loaded by daimyo, not by aifred-tk.

Installation

Install the bugyo extra:

pip install "aifred-tk[bugyo]"

Or with uv:

uv add "aifred-tk[bugyo]"

No further configuration is required. daimyo discovers the plugins automatically via entry points.

Plugins

aifred.context

Provides the aifred_tools context variable in daimyo rule templates.

aifred_tools is a mapping of tool_id to a dict with two keys:

Key Type Description
name str Human-readable tool name
description str Tool description

Only tools that are installed and enabled in the current project's aifred-tk settings appear in aifred_tools.

aifred.filters

Provides the aifred_tool_available Jinja2 test. The test returns True when the given tool_id is both installed and enabled.

Template usage

Both plugins convey the same information; choose whichever reads more naturally in your rule template.

Using the context variable:

{% if "commit" in aifred_tools %}
Use the aifred-tk commit tool to generate conventional commit messages.
{% endif %}

Using the Jinja2 test:

{% if "commit" is aifred_tool_available %}
Use the aifred-tk commit tool to generate conventional commit messages.
{% endif %}

Accessing tool metadata:

{% for tool_id, tool in aifred_tools.items() %}
- `{{ tool_id }}` — {{ tool.description }}
{% endfor %}

How it works

aifred-tk[bugyo] registers two entry points under daimyo.plugins:

[project.entry-points."daimyo.plugins"]
aifred_context = "aifred_tk.bugyo.plugins:AifredContextPlugin"
aifred_filters = "aifred_tk.bugyo.plugins:AifredFilterPlugin"

When daimyo renders a scope, it calls each registered plugin. AifredContextPlugin loads the aifred-tk registry for the current working directory (result is cached per process) and injects the aifred_tools mapping. AifredFilterPlugin registers the aifred_tool_available test against the same cached registry.

Enabled/disabled state follows the standard aifred-tk tools.<tool_id>.enabled setting. See Configuration for details.