openclaw-ontology-engine 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. openclaw_ontology_engine-0.1.0/LICENSE +21 -0
  2. openclaw_ontology_engine-0.1.0/PACKAGE_README.md +75 -0
  3. openclaw_ontology_engine-0.1.0/PKG-INFO +117 -0
  4. openclaw_ontology_engine-0.1.0/README.md +656 -0
  5. openclaw_ontology_engine-0.1.0/ontology/CONSTITUTION.md +292 -0
  6. openclaw_ontology_engine-0.1.0/ontology/__init__.py +2 -0
  7. openclaw_ontology_engine-0.1.0/ontology/convergence.py +1501 -0
  8. openclaw_ontology_engine-0.1.0/ontology/convergence_ontology.yaml +675 -0
  9. openclaw_ontology_engine-0.1.0/ontology/diff.py +537 -0
  10. openclaw_ontology_engine-0.1.0/ontology/domain_ontology.yaml +268 -0
  11. openclaw_ontology_engine-0.1.0/ontology/engine.py +1122 -0
  12. openclaw_ontology_engine-0.1.0/ontology/governance_checker.py +2010 -0
  13. openclaw_ontology_engine-0.1.0/ontology/governance_ontology.yaml +9745 -0
  14. openclaw_ontology_engine-0.1.0/ontology/llm_cron_audit.py +445 -0
  15. openclaw_ontology_engine-0.1.0/ontology/poc_semantic_query.py +162 -0
  16. openclaw_ontology_engine-0.1.0/ontology/policy_ontology.yaml +236 -0
  17. openclaw_ontology_engine-0.1.0/ontology/three_gate.py +468 -0
  18. openclaw_ontology_engine-0.1.0/ontology/tool_ontology.yaml +379 -0
  19. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/PKG-INFO +117 -0
  20. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/SOURCES.txt +24 -0
  21. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/dependency_links.txt +1 -0
  22. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/entry_points.txt +3 -0
  23. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/requires.txt +1 -0
  24. openclaw_ontology_engine-0.1.0/openclaw_ontology_engine.egg-info/top_level.txt +1 -0
  25. openclaw_ontology_engine-0.1.0/pyproject.toml +79 -0
  26. openclaw_ontology_engine-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bisdom-cell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,75 @@
1
+ # openclaw-ontology-engine
2
+
3
+ Declarative governance + tool-ontology engine for Agent Runtime control planes.
4
+ **Bring your own YAML (Layer 2), get tool governance + semantic query +
5
+ governance audit + declared-state convergence (Layer 1).**
6
+
7
+ Extracted from a production Agent Runtime ([openclaw-model-bridge](https://github.com/bisdom-cell/openclaw-model-bridge))
8
+ that runs 40+ scheduled jobs against a multi-provider LLM gateway — every rule
9
+ in this engine exists because a real production incident demanded it
10
+ (90 invariants, 23 meta-rules, 14 silent-failure scanners and counting).
11
+
12
+ ## Two-layer architecture
13
+
14
+ | Layer | What | Who writes it |
15
+ |---|---|---|
16
+ | **Layer 1 — engine** (this package) | Tool Ontology engine, 5 check executors, meta-rule discovery (MRD) scanners, convergence framework, three-stage gates | project-agnostic, `pip install` |
17
+ | **Layer 2 — config** (your repo) | `tool_ontology.yaml`, `governance_ontology.yaml`, `domain_ontology.yaml`, `policy_ontology.yaml`, `convergence_ontology.yaml` | you |
18
+
19
+ The engine never hardcodes your project: all Layer 2 config is injected via
20
+ two environment variables.
21
+
22
+ ## Quick start
23
+
24
+ ```bash
25
+ pip install openclaw-ontology-engine
26
+
27
+ # Point the engine at YOUR config + YOUR project root
28
+ export ONTOLOGY_CONFIG_DIR=/path/to/your/ontology
29
+ export ONTOLOGY_PROJECT_ROOT=/path/to/your/repo
30
+
31
+ # Audit your invariants (exit 1 on violation — CI-friendly)
32
+ openclaw-ontology-audit
33
+
34
+ # Query your tool ontology
35
+ openclaw-ontology-query
36
+ ```
37
+
38
+ ```python
39
+ from ontology_engine.engine import ToolOntology, evaluate_policy, find_by_domain
40
+ from ontology_engine import governance_checker
41
+
42
+ onto = ToolOntology() # reads ONTOLOGY_CONFIG_DIR
43
+ print(onto.allowed_tools()) # your declared tool whitelist
44
+ print(find_by_domain("Actor")) # your domain instances
45
+ print(evaluate_policy("max-tools-per-agent")) # your declared policy limits
46
+ ```
47
+
48
+ ## What you get
49
+
50
+ 1. **Tool governance** — declarative whitelist / schema / alias resolution /
51
+ semantic classification, replacing hardcoded tool lists.
52
+ 2. **Governance audit** — invariants with declaration + runtime verification
53
+ layers, executed by 5 check types (`file_contains`, `file_not_contains`,
54
+ `python_assert`, …).
55
+ 3. **Meta-rule discovery (MRD)** — proactive scanners for whole bug *classes*
56
+ (silent `except: pass`, log-to-stdout pollution, push-route bypasses, …)
57
+ with project patterns supplied via `mrd_scan_patterns` in your YAML.
58
+ 4. **Convergence framework** — verifies your *declared* state (job registry,
59
+ service list) actually matches *runtime* state (crontab, launchd), with
60
+ per-spec dry-run/machine-sync escalation.
61
+ 5. **Three-stage gates** — pre-check / runtime-gate / post-verify policy
62
+ observation at the request boundary (shadow mode by default).
63
+
64
+ A complete worked example (a fictional WeatherBot runtime, nothing shared
65
+ with the host project) lives in
66
+ [`examples/minimal_consumer/`](https://github.com/bisdom-cell/openclaw-model-bridge/tree/main/examples/minimal_consumer).
67
+
68
+ ## Documentation
69
+
70
+ - [Extension guide](https://github.com/bisdom-cell/openclaw-model-bridge/blob/main/docs/ontology_engine_extension_guide.md) — 60-second onboarding
71
+ - [Packaging design](https://github.com/bisdom-cell/openclaw-model-bridge/blob/main/docs/ontology_engine_packaging.md) — architecture & roadmap
72
+
73
+ ## License
74
+
75
+ MIT
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: openclaw-ontology-engine
3
+ Version: 0.1.0
4
+ Summary: Declarative governance + tool-ontology engine for Agent Runtime control planes — bring your own YAML (Layer 2), get tool governance + semantic query + governance audit (Layer 1).
5
+ Author: bisdom
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 bisdom-cell
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/bisdom-cell/openclaw-model-bridge
29
+ Project-URL: Documentation, https://github.com/bisdom-cell/openclaw-model-bridge/blob/main/docs/ontology_engine_packaging.md
30
+ Keywords: ontology,governance,agent-runtime,control-plane,llm,tool-calling,policy-engine
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3 :: Only
35
+ Classifier: Topic :: Software Development :: Libraries
36
+ Classifier: Topic :: System :: Monitoring
37
+ Requires-Python: >=3.9
38
+ Description-Content-Type: text/markdown
39
+ License-File: LICENSE
40
+ Requires-Dist: pyyaml>=5.4
41
+ Dynamic: license-file
42
+
43
+ # openclaw-ontology-engine
44
+
45
+ Declarative governance + tool-ontology engine for Agent Runtime control planes.
46
+ **Bring your own YAML (Layer 2), get tool governance + semantic query +
47
+ governance audit + declared-state convergence (Layer 1).**
48
+
49
+ Extracted from a production Agent Runtime ([openclaw-model-bridge](https://github.com/bisdom-cell/openclaw-model-bridge))
50
+ that runs 40+ scheduled jobs against a multi-provider LLM gateway — every rule
51
+ in this engine exists because a real production incident demanded it
52
+ (90 invariants, 23 meta-rules, 14 silent-failure scanners and counting).
53
+
54
+ ## Two-layer architecture
55
+
56
+ | Layer | What | Who writes it |
57
+ |---|---|---|
58
+ | **Layer 1 — engine** (this package) | Tool Ontology engine, 5 check executors, meta-rule discovery (MRD) scanners, convergence framework, three-stage gates | project-agnostic, `pip install` |
59
+ | **Layer 2 — config** (your repo) | `tool_ontology.yaml`, `governance_ontology.yaml`, `domain_ontology.yaml`, `policy_ontology.yaml`, `convergence_ontology.yaml` | you |
60
+
61
+ The engine never hardcodes your project: all Layer 2 config is injected via
62
+ two environment variables.
63
+
64
+ ## Quick start
65
+
66
+ ```bash
67
+ pip install openclaw-ontology-engine
68
+
69
+ # Point the engine at YOUR config + YOUR project root
70
+ export ONTOLOGY_CONFIG_DIR=/path/to/your/ontology
71
+ export ONTOLOGY_PROJECT_ROOT=/path/to/your/repo
72
+
73
+ # Audit your invariants (exit 1 on violation — CI-friendly)
74
+ openclaw-ontology-audit
75
+
76
+ # Query your tool ontology
77
+ openclaw-ontology-query
78
+ ```
79
+
80
+ ```python
81
+ from ontology_engine.engine import ToolOntology, evaluate_policy, find_by_domain
82
+ from ontology_engine import governance_checker
83
+
84
+ onto = ToolOntology() # reads ONTOLOGY_CONFIG_DIR
85
+ print(onto.allowed_tools()) # your declared tool whitelist
86
+ print(find_by_domain("Actor")) # your domain instances
87
+ print(evaluate_policy("max-tools-per-agent")) # your declared policy limits
88
+ ```
89
+
90
+ ## What you get
91
+
92
+ 1. **Tool governance** — declarative whitelist / schema / alias resolution /
93
+ semantic classification, replacing hardcoded tool lists.
94
+ 2. **Governance audit** — invariants with declaration + runtime verification
95
+ layers, executed by 5 check types (`file_contains`, `file_not_contains`,
96
+ `python_assert`, …).
97
+ 3. **Meta-rule discovery (MRD)** — proactive scanners for whole bug *classes*
98
+ (silent `except: pass`, log-to-stdout pollution, push-route bypasses, …)
99
+ with project patterns supplied via `mrd_scan_patterns` in your YAML.
100
+ 4. **Convergence framework** — verifies your *declared* state (job registry,
101
+ service list) actually matches *runtime* state (crontab, launchd), with
102
+ per-spec dry-run/machine-sync escalation.
103
+ 5. **Three-stage gates** — pre-check / runtime-gate / post-verify policy
104
+ observation at the request boundary (shadow mode by default).
105
+
106
+ A complete worked example (a fictional WeatherBot runtime, nothing shared
107
+ with the host project) lives in
108
+ [`examples/minimal_consumer/`](https://github.com/bisdom-cell/openclaw-model-bridge/tree/main/examples/minimal_consumer).
109
+
110
+ ## Documentation
111
+
112
+ - [Extension guide](https://github.com/bisdom-cell/openclaw-model-bridge/blob/main/docs/ontology_engine_extension_guide.md) — 60-second onboarding
113
+ - [Packaging design](https://github.com/bisdom-cell/openclaw-model-bridge/blob/main/docs/ontology_engine_packaging.md) — architecture & roadmap
114
+
115
+ ## License
116
+
117
+ MIT