Skip to main content

KnightsORT - Role Routing System

    ## Project overview
    
    KnightsORT is a **role routing system** for the Solutions Brewer stack.
    
    It provides executive role definitions (CEO, CFO, CMO, COO), intelligent
    task routing via MindOT (OWL, METROLOGIC, ADVANCED, ENSEMBLE strategies),
    delegation hierarchy, audit logging, and role switching for testing.
    
    ## Overview
    
    KnightsORT is a **role routing system** that provides:
    - Executive role definitions (CEO, CFO, CMO, COO)
    - Intelligent task routing via MindOT (OWL, METROLOGIC, ADVANCED, ENSEMBLE strategies)
    - Delegation hierarchy and audit logging
    - Role switching for testing
    
    ## Features
    
    - **Role Definitions** - Comprehensive role system with permissions, capabilities, and hierarchy
    - **Smart Routing** - Multiple routing strategies (OWL, Metrologic, Advanced, Ensemble)
    - **MindOT Integration** - Data-driven and trend-based decision making
    - **Audit Logging** - Complete task lifecycle tracking
    - **Delegation** - Role-to-role delegation with hierarchy enforcement
    - **CLI Interface** - Command-line tool for managing groups and roles
    
    ## Quick start
    
    ```python
    import kahndor
    from knightsort import Instruct, Logma
    from knightsort.utilities.schema import RoutingStrategy, RoutingDecision
    
    # 1. Load a role decision directly
    role_cfg = kahndor.Instruct("path/to/roles.yaml").select("executives").dikt
    
    # 2. Construct a routing decision
    decision = RoutingDecision(
        role="ceo",
        strategy=RoutingStrategy.ADVANCED,
        score=0.92,
        confidence=0.88,
        rationale="strategic alignment + budget authority",
    )
    
    print(decision.summary())
    # -> Role: ceo (score: 0.92, confidence: 0.88)
    #    Strategy: advanced
    #    Rationale: strategic alignment + budget authority
    ```
    
    ## Installation
    
    ```bash
    # Clone the repository
    git clone https://github.com/solubrew/knightsort.git
    cd knightsort
    
    # Install dependencies
    pip install -e .
    ```
    # Install optional MindOT for advanced routing
    pip install mindot
    ```
    
    ## Architecture
    
    ```
    KnightsORT (Roles & Routing)
    ├── roles/
    │   ├── base.py      # BaseRole abstract class
    │   ├── ceo.py       # CEO role
    │   ├── cfo.py       # CFO role
    │   ├── cmo.py       # CMO role
    │   └── coo.py       # COO role
    ├── router.py        # RoleRouter with MindOT strategies
    ├── switcher.py      # Role switching for testing
    ├── hierarchy.py     # Role hierarchy definitions
    └── audit.py         # Audit logging
    ```
    
    ## ⚠️ IMPORTANT: Scope Limitation
    
    KnightsORT is ONLY responsible for:
    1. **Role definitions** - What each role is, their permissions, capabilities
    2. **Role routing** - Which role should handle a given task
    3. **Delegation** - Can one role delegate to another?
    4. **Metrics** - Track role performance
    
    KnightsORT does NOT handle:
    - ❌ System prompt assembly
    - ❌ Context injection
    - ❌ Memory management
    - ❌ Skills loading
    - ❌ Identity management
    
    Those are LadyOL's responsibilities.
    
    ## Integration with LadyOL
    
    Use `KnightsORTIntegration` from LadyOL to combine role routing with prompt assembly:
    
    ```python
    from ladyol.integration.knightsort import KnightsORTIntegration, create_knightsort_integration
    
    # Create integration
    rt = create_knightsort_integration(
        config_path="../../knightsort/config/routing.yaml",
        mindot_enabled=True
    )
    
    # Route a task
    decision = rt.route_task(
        task_data={"type": "financial_analysis", "priority": "high"},
        context={"user": "alice"}
    )
    print(f"Routed to: {decision.role}")
    
    # Build role-aware prompt
    full_prompt = rt.build_role_aware_prompt(
        base_prompt=ladyol_system_prompt,
        task_context={"type": "budget_approval"}
    )
    ```
    
    ## Available Roles
    
    | Role | Title | Description |
    |------|-------|-------------|
    | CEO | Chief Executive Officer | Strategic vision, final decisions |
    | CFO | Chief Financial Officer | Financial planning, budget |
    | CMO | Chief Marketing Officer | Marketing, communications |
    | COO | Chief Operating Officer | Operations, logistics |
    
    ## Routing Strategies
    
    1. **OWL** - Data-driven suitability scoring
    2. **METROLOGIC** - Trend-based analysis
    3. **ADVANCED** - Combined OWL + Metrologic (default)
    4. **ENSEMBLE** - Voting across all strategies
    
    ## Usage
    
    ```python
    from knightsort import RoleRouter, RoutingStrategy
    from knightsort.knights.knights import get_role, get_all_roles
    
    # Get a specific role
    ceo = get_role("ceo")
    print(ceo.title)  # Chief Executive Officer
    
    # Route a task
    router = RoleRouter(config={"knights": {...}})
    decision = router.route_task(
        task_data={"type": "strategic_decision", "priority": "critical"}
    )
    print(decision.role)  # "ceo"
    print(decision.rationale)
    ```
    
    ## Dependencies
    
    - `mindot` - For intelligent routing (OWL + Metrologic)
    - `pyyaml` - For config files
    
    ## Notes
    
    - KnightsORT roles are designed to work with MindOT for intelligent routing
    - Without MindOT, it falls back to priority-based or round-robin routing
    - Audit logging is optional (enable with `audit_enabled=True`)
    
    ## Development
    
    To set up a development environment and run the test suite locally:
    
    ```bash
    git clone https://github.com/solubrew/knightsort.git
    cd knightsort
    python -m pip install --upgrade pip
    pip install -e ".[dev]"
    pip install pytest
    
    # Run the test suite
    pytest tests/ -v
    
    # Lint (matches CI)
    ruff check knightsort/
    
    # Confirm the package imports cleanly
    python -c "import knightsort; print(knightsort.__version__)"
    
    # Run the CLI
    knightsort status
    ```
    
    Before opening a pull request:
    
    ```bash
    pytest tests/ -v              # all tests pass
    ruff check knightsort/        # no lint errors
    sasquatch analyze -p . --skip-pii-secrets    # audit score >= 90%
    ```
    
    ## License
    
    KnightsORT is licensed under the MIT License. See the [LICENSE](LICENSE.md)
    file for more details.

Metadata

Release files for knightsort 0.0.1.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for knightsort 0.0.1.post1
File Size Uploaded Provenance Actions
knightsort-0.0.1.post1.tar.gz 107.4 kB Without provenance Details for knightsort-0.0.1.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for knightsort 0.0.1.post1
File Interpreter ABI Platform Actions
knightsort-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details for knightsort-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Total release size: 230.8 kB

Release files / knightsort-0.0.1.post1.tar.gz

Download URL knightsort-0.0.1.post1.tar.gz
Size 107.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4c423b0950895408bf3071059d4226acad18fdc17c4ae95957860fc38c922e03
BLAKE2b-256 checksum
How to use checksums
ef293e88daacb38098d289aa5ca777c323570fbb1efaea36dd1f572a0a1b1615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / knightsort-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL knightsort-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 123.4 kB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
c1be670cfdf75bd9c6505bfdec730c51b8e7f32f4a1ec69e25d6a6df19f8f880
BLAKE2b-256 checksum
How to use checksums
da4be9c31454b47522337bc24903e528e371f1196f0a7582c01b679953c4b019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for knightsort 0.0.1.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1.post1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page