Skip to main content

Rules server for agents with REST and MCP interfaces

Project description

Daimyo - Rules Server for Agents

Daimyo (大名) is an extensible Python server providing rules to AI agents through REST and MCP interfaces. Supports scope-based rules with inheritance, categories for filtering, and server federation for distributed rule management.

Features

  • Multiple Interfaces: REST API, MCP (Model Context Protocol), and CLI
  • Scope Inheritance: Single and multiple parent inheritance with priority-based conflict resolution
  • Rule Types: Commandments (MUST) and Suggestions (SHOULD)
  • Categories: Organize rules into hierarchical categories for selective retrieval
  • Server Federation: Distribute scopes across multiple servers with automatic merging
  • Multiple Formats: Output as YAML, JSON, or Markdown
  • Clean Architecture: Domain-driven design with clear separation of concerns
  • Templating System: Rules can use Jinja2 templates to be defined as generic rules that change their form depending on the context
  • Extensibility via Plugins: Plugins can extend the features of daimyo instances
  • Configurable Markdown Formatting: Prologues/epilogues, XML tag wrapping, and aggregated display modes

Installation

pip install daimyo

Or install from source:

git clone https://gitlab.com/Kencho1/daimyo.git
cd daimyo
pip install -e .

Quick Start

1. Set Up Your Rules

mkdir -p .daimyo
cp -r example-daimyo-rules .daimyo/rules

2. Start the Server

daimyo serve

3. Access the API

Visit http://localhost:8000/docs for interactive API documentation.

curl http://localhost:8000/api/v1/scopes/python-general/rules

Core Concepts

Rules are organized into scopes (e.g. company, team, project), each containing commandments (MUST) and suggestions (SHOULD). Scopes can inherit from parent scopes and organize rules into hierarchical categories for selective retrieval. Multiple servers can be federated to distribute scopes across deployments.

Documentation

Full documentation is available at https://daimyo.readthedocs.io/en/latest, including:

Development

Running Tests

pip install -e ".[test]"
pytest

Code Quality

mypy daimyo
ruff check daimyo
ruff format daimyo

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

daimyo-1.19.1.tar.gz (141.4 kB view details)

Uploaded Source

Built Distribution

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

daimyo-1.19.1-py3-none-any.whl (118.2 kB view details)

Uploaded Python 3

File details

Details for the file daimyo-1.19.1.tar.gz.

File metadata

  • Download URL: daimyo-1.19.1.tar.gz
  • Upload date:
  • Size: 141.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for daimyo-1.19.1.tar.gz
Algorithm Hash digest
SHA256 472a5f7aa9c12e7f653db7fc812b2e6d4e0bd9c0bb3a85ba61e353c1def3a1ca
MD5 4979f2a6e5741471082f6067222e5b12
BLAKE2b-256 dfbd48262ea3f4ef77185de656d98ac3fcc0ca1b63c7e6549ec0862293242b8c

See more details on using hashes here.

File details

Details for the file daimyo-1.19.1-py3-none-any.whl.

File metadata

  • Download URL: daimyo-1.19.1-py3-none-any.whl
  • Upload date:
  • Size: 118.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for daimyo-1.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe63360e74a06978c5f50fe8d41b5b090c25eefd9962302cf015daa14d843358
MD5 9f68e97b12356b49e6ee7e52bce0137e
BLAKE2b-256 c277aa2e828c2a2634ab69e79f9a27361a3a33bc61ebc4087697db59cdbd5f11

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