Metadata-Version: 2.4
Name: daimyo
Version: 1.19.2
Summary: Rules server for agents with REST and MCP interfaces
Project-URL: Homepage, https://gitlab.com/Kencho1/daimyo
Project-URL: Repository, https://gitlab.com/Kencho1/daimyo
Project-URL: Documentation, https://daimyo.readthedocs.io/en/latest
Project-URL: Issues, https://gitlab.com/Kencho1/daimyo/-/issues
Project-URL: Changelog, https://gitlab.com/Kencho1/daimyo/-/blob/main/CHANGELOG.md
Author: Jesús Alonso Abad
License: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Requires-Dist: cachetools~=7.0
Requires-Dist: dynaconf~=3.2
Requires-Dist: fastapi~=0.127
Requires-Dist: fastmcp<4,>=3.0
Requires-Dist: gitpython~=3.1
Requires-Dist: httpx~=0.28
Requires-Dist: jinja2~=3.1
Requires-Dist: junitparser~=3.0
Requires-Dist: loguru~=0.7
Requires-Dist: packaging~=25.0
Requires-Dist: pydantic~=2.10
Requires-Dist: pyyaml~=6.0
Requires-Dist: typer~=0.15
Requires-Dist: uvicorn[standard]~=0.32
Provides-Extra: docs
Requires-Dist: mkdocs-material~=9.5; extra == 'docs'
Provides-Extra: test
Requires-Dist: mypy~=1.13; extra == 'test'
Requires-Dist: pytest-asyncio~=1.1; extra == 'test'
Requires-Dist: pytest-cov~=7.0; extra == 'test'
Requires-Dist: pytest-httpx~=0.35; extra == 'test'
Requires-Dist: pytest~=9.0; extra == 'test'
Requires-Dist: ruff~=0.8; extra == 'test'
Requires-Dist: tox~=4.0; extra == 'test'
Requires-Dist: types-pyyaml~=6.0; extra == 'test'
Description-Content-Type: text/markdown

# 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

```bash
pip install daimyo
```

Or install from source:

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

## Quick Start

### 1. Set Up Your Rules

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

### 2. Start the Server

```bash
daimyo serve
```

### 3. Access the API

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

```bash
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:

- [Configuration reference](https://daimyo.readthedocs.io/en/latest/configuration/)
- [REST API & MCP usage](https://daimyo.readthedocs.io/en/latest/usage/)
- [Scope and category design best practices](https://daimyo.readthedocs.io/en/latest/best-practices/)
- [Advanced topics](https://daimyo.readthedocs.io/en/latest/advanced/) (federation, templates, sharding)
- [Plugin system](https://daimyo.readthedocs.io/en/latest/plugins/)
- [CLI reference](https://daimyo.readthedocs.io/en/latest/cli/)

## Development

### Running Tests

```bash
pip install -e ".[test]"
pytest
```

### Code Quality

```bash
mypy daimyo
ruff check daimyo
ruff format daimyo
```

## License

MIT
