Metadata-Version: 2.4
Name: forge-rules
Version: 0.2.0
Summary: Rules Engine for Forge — context-aware rule packs with conflict resolution and scope intersection detection.
Project-URL: Homepage, https://github.com/angelnicolasc/forge
Project-URL: Repository, https://github.com/angelnicolasc/forge
Project-URL: Issues, https://github.com/angelnicolasc/forge/issues
Project-URL: Changelog, https://github.com/angelnicolasc/forge/blob/main/CHANGELOG.md
Author-email: Angel DiCerutti <angelnicolascorzo@gmail.com>
License-Expression: Apache-2.0
Keywords: agents,context-engineering,forge,governance,rules-engine
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: forge-os-core==0.2.0
Requires-Dist: pydantic<3.0,>=2.7
Requires-Dist: pyyaml>=6.0
Requires-Dist: structlog<26.0,>=24.0
Provides-Extra: intent
Requires-Dist: forge-os-core[intent]; extra == 'intent'
Provides-Extra: opa
Requires-Dist: requests>=2.32; extra == 'opa'
Description-Content-Type: text/markdown

# forge-rules

Rules Engine for Forge — context-aware rule packs with fixed-lattice conflict resolution and scope intersection detection at lint time.

## Features

- **Fixed lattice**: `deny > require > suggest` (non-configurable inter-category precedence)
- **Intra-category strategies**: `MOST_SPECIFIC_WINS` (default) and `PRIORITY_FIRST_MATCH` (opt-in)
- **Scope intersection detection**: lint-time detection of overlapping glob patterns (original contribution)
- **YAML authoring**: human-friendly rule pack format with round-trip support
- **A2A/EventBus integration**: emits `CONTEXT_INJECTED` events for KPI tracking
- **CLI**: `forge rules validate`, `lint`, `explain`, `diff`

## Quick start

```python
from forge_rules import RulesEngine, load_yaml

engine = RulesEngine()
engine.load_yaml("rules/python-safety.yaml")

selection = engine.select(path="src/api/views.py", intent="code_review")
context_block = await engine.inject(selection, run_id="run-001")
```

## Part of Forge

This package is part of [Forge](https://github.com/angelnicolasc/forge) — the universal AI agent harness.
