openclaw-alignment 1.0.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.
- openclaw_alignment-1.0.0/CHANGELOG.md +60 -0
- openclaw_alignment-1.0.0/CODE_OF_CONDUCT.md +14 -0
- openclaw_alignment-1.0.0/CODE_OF_CONDUCT.zh-CN.md +14 -0
- openclaw_alignment-1.0.0/CONTRIBUTING.md +42 -0
- openclaw_alignment-1.0.0/CONTRIBUTING.zh-CN.md +42 -0
- openclaw_alignment-1.0.0/LICENSE +21 -0
- openclaw_alignment-1.0.0/MANIFEST.in +22 -0
- openclaw_alignment-1.0.0/PKG-INFO +144 -0
- openclaw_alignment-1.0.0/README.md +103 -0
- openclaw_alignment-1.0.0/README_EN.md +103 -0
- openclaw_alignment-1.0.0/RELEASING.md +27 -0
- openclaw_alignment-1.0.0/RELEASING.zh-CN.md +27 -0
- openclaw_alignment-1.0.0/SECURITY.md +23 -0
- openclaw_alignment-1.0.0/SECURITY.zh-CN.md +23 -0
- openclaw_alignment-1.0.0/SUPPORT.md +14 -0
- openclaw_alignment-1.0.0/SUPPORT.zh-CN.md +14 -0
- openclaw_alignment-1.0.0/audit/baseline.md +20 -0
- openclaw_alignment-1.0.0/audit/final-report.md +61 -0
- openclaw_alignment-1.0.0/audit/findings.md +58 -0
- openclaw_alignment-1.0.0/audit/fix-log.md +100 -0
- openclaw_alignment-1.0.0/config/config.example.json +25 -0
- openclaw_alignment-1.0.0/config/config.json +25 -0
- openclaw_alignment-1.0.0/docs/architecture.md +20 -0
- openclaw_alignment-1.0.0/docs/architecture.zh-CN.md +20 -0
- openclaw_alignment-1.0.0/docs/configuration.md +9 -0
- openclaw_alignment-1.0.0/docs/configuration.zh-CN.md +9 -0
- openclaw_alignment-1.0.0/docs/phase3-optional-deps.md +16 -0
- openclaw_alignment-1.0.0/docs/phase3-optional-deps.zh-CN.md +16 -0
- openclaw_alignment-1.0.0/docs/release/OPEN_SOURCE_SCOPE.md +14 -0
- openclaw_alignment-1.0.0/docs/reward-model.md +10 -0
- openclaw_alignment-1.0.0/docs/reward-model.zh-CN.md +10 -0
- openclaw_alignment-1.0.0/lib/__init__.py +82 -0
- openclaw_alignment-1.0.0/lib/agent.py +594 -0
- openclaw_alignment-1.0.0/lib/collector.py +198 -0
- openclaw_alignment-1.0.0/lib/contracts.py +44 -0
- openclaw_alignment-1.0.0/lib/distributed_trainer.py +537 -0
- openclaw_alignment-1.0.0/lib/environment.py +488 -0
- openclaw_alignment-1.0.0/lib/experience_replay.py +228 -0
- openclaw_alignment-1.0.0/lib/hyperparameter_tuner.py +582 -0
- openclaw_alignment-1.0.0/lib/integration.py +219 -0
- openclaw_alignment-1.0.0/lib/learner.py +376 -0
- openclaw_alignment-1.0.0/lib/monitoring.py +584 -0
- openclaw_alignment-1.0.0/lib/nn_model.py +278 -0
- openclaw_alignment-1.0.0/lib/paths.py +89 -0
- openclaw_alignment-1.0.0/lib/performance_optimizer.py +601 -0
- openclaw_alignment-1.0.0/lib/reward.py +668 -0
- openclaw_alignment-1.0.0/lib/trainer.py +358 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/PKG-INFO +144 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/SOURCES.txt +72 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/dependency_links.txt +1 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/entry_points.txt +2 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/requires.txt +18 -0
- openclaw_alignment-1.0.0/openclaw_alignment.egg-info/top_level.txt +1 -0
- openclaw_alignment-1.0.0/pyproject.toml +75 -0
- openclaw_alignment-1.0.0/requirements-dev.txt +8 -0
- openclaw_alignment-1.0.0/requirements-full.txt +7 -0
- openclaw_alignment-1.0.0/requirements.txt +1 -0
- openclaw_alignment-1.0.0/scripts/check_docs_consistency.py +150 -0
- openclaw_alignment-1.0.0/scripts/install.py +43 -0
- openclaw_alignment-1.0.0/scripts/install_unix.sh +6 -0
- openclaw_alignment-1.0.0/scripts/install_windows.ps1 +13 -0
- openclaw_alignment-1.0.0/setup.cfg +4 -0
- openclaw_alignment-1.0.0/skills//346/204/217/345/233/276/345/257/271/351/275/220.md +216 -0
- openclaw_alignment-1.0.0/tests/test_agent_policy.py +64 -0
- openclaw_alignment-1.0.0/tests/test_alignment.py +109 -0
- openclaw_alignment-1.0.0/tests/test_contracts.py +23 -0
- openclaw_alignment-1.0.0/tests/test_docs_consistency.py +23 -0
- openclaw_alignment-1.0.0/tests/test_environment.py +438 -0
- openclaw_alignment-1.0.0/tests/test_experience_replay.py +33 -0
- openclaw_alignment-1.0.0/tests/test_integration_cli.py +21 -0
- openclaw_alignment-1.0.0/tests/test_integration_engine.py +40 -0
- openclaw_alignment-1.0.0/tests/test_learner_history.py +25 -0
- openclaw_alignment-1.0.0/tests/test_phase3.py +437 -0
- openclaw_alignment-1.0.0/tests/test_reward.py +467 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on Keep a Changelog and this project follows Semantic Versioning.
|
|
6
|
+
|
|
7
|
+
## [1.0.0] - 2026-03-01
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Packaging metadata and entrypoints via `pyproject.toml`, including `openclaw-alignment` CLI.
|
|
12
|
+
- Cross-platform installer scripts:
|
|
13
|
+
- `scripts/install.py`
|
|
14
|
+
- `scripts/install_unix.sh`
|
|
15
|
+
- `scripts/install_windows.ps1`
|
|
16
|
+
- Release governance and community docs:
|
|
17
|
+
- `CONTRIBUTING*.md`
|
|
18
|
+
- `SECURITY*.md`
|
|
19
|
+
- `SUPPORT*.md`
|
|
20
|
+
- `CODE_OF_CONDUCT*.md`
|
|
21
|
+
- `RELEASING*.md`
|
|
22
|
+
- CI/CD workflow templates:
|
|
23
|
+
- cross-platform matrix CI
|
|
24
|
+
- package build validation
|
|
25
|
+
- release publishing workflow
|
|
26
|
+
- dependency security audit workflow
|
|
27
|
+
- Path abstraction utilities for cross-platform config/cache/state directories (`lib/paths.py`).
|
|
28
|
+
- Audit artifacts and release scope docs under `audit/` and `docs/release/`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Stabilized environment input normalization:
|
|
33
|
+
- invalid `task_type` falls back safely
|
|
34
|
+
- invalid/out-of-range `time_of_day` is normalized
|
|
35
|
+
- explicit precondition error when `step()` is called before `reset()`
|
|
36
|
+
- Deterministic policy behavior for inference (`explore=False` now uses greedy selection).
|
|
37
|
+
- Improved config update behavior to preserve wrapper schema and create parent dirs automatically.
|
|
38
|
+
- Unified state/action dimension contracts through `lib/contracts.py` and consistent references.
|
|
39
|
+
- Updated README/README_EN to match actual install paths, dependencies, and support matrix.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- CLI parser option bug that previously caused `python -m lib.integration --help` to fail.
|
|
44
|
+
- Action decoding now returns explicit validation errors for malformed/overflow indices.
|
|
45
|
+
- Docs consistency checker now handles both pytest collection output formats.
|
|
46
|
+
- Removed generated model artifacts from source tracking to avoid dirty-tree churn and release noise.
|
|
47
|
+
|
|
48
|
+
### Security
|
|
49
|
+
|
|
50
|
+
- Added private vulnerability reporting policy and response SLO documentation.
|
|
51
|
+
- Added scheduled dependency audit workflow (`pip-audit`).
|
|
52
|
+
|
|
53
|
+
### Breaking Changes
|
|
54
|
+
|
|
55
|
+
- None.
|
|
56
|
+
|
|
57
|
+
### Known Limitations
|
|
58
|
+
|
|
59
|
+
- Phase3 full dependency installation is heavier (includes optional ML/monitoring stack).
|
|
60
|
+
- Legacy OpenClaw config/model paths are still supported for backward compatibility.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
We are committed to a welcoming and harassment-free community.
|
|
4
|
+
|
|
5
|
+
## Our Standards
|
|
6
|
+
|
|
7
|
+
- Be respectful and constructive.
|
|
8
|
+
- Assume good intent and discuss technical details in good faith.
|
|
9
|
+
- No harassment, abuse, discrimination, or doxxing.
|
|
10
|
+
|
|
11
|
+
## Enforcement
|
|
12
|
+
|
|
13
|
+
Report incidents to project maintainers via private channels listed in `SECURITY.md`.
|
|
14
|
+
Maintainers may remove content or contributors violating this code.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for contributing to OpenClaw Alignment.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/412984588/openclaw-alignment.git
|
|
9
|
+
cd openclaw-alignment
|
|
10
|
+
python3 scripts/install.py --dev --editable
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. Create a feature branch.
|
|
16
|
+
2. Write/adjust tests first for behavior changes.
|
|
17
|
+
3. Keep commits focused and reviewable.
|
|
18
|
+
4. Run checks before opening PR.
|
|
19
|
+
|
|
20
|
+
## Local Checks
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python3 -m pytest tests/ -v
|
|
24
|
+
python3 scripts/check_docs_consistency.py
|
|
25
|
+
python3 -m build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Pull Requests
|
|
29
|
+
|
|
30
|
+
- Explain problem, solution, and test evidence.
|
|
31
|
+
- Link issue if available.
|
|
32
|
+
- Update docs/changelog for user-visible changes.
|
|
33
|
+
|
|
34
|
+
## Commit Style
|
|
35
|
+
|
|
36
|
+
Use Conventional Commits:
|
|
37
|
+
|
|
38
|
+
- `feat: ...`
|
|
39
|
+
- `fix: ...`
|
|
40
|
+
- `docs: ...`
|
|
41
|
+
- `chore: ...`
|
|
42
|
+
- `test: ...`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
感谢你为 OpenClaw Alignment 贡献代码。
|
|
4
|
+
|
|
5
|
+
## 开发环境
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/412984588/openclaw-alignment.git
|
|
9
|
+
cd openclaw-alignment
|
|
10
|
+
python3 scripts/install.py --dev --editable
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 工作流
|
|
14
|
+
|
|
15
|
+
1. 从主分支切功能分支。
|
|
16
|
+
2. 行为改动优先补测试。
|
|
17
|
+
3. 提交保持小而清晰。
|
|
18
|
+
4. 提交 PR 前完成本地检查。
|
|
19
|
+
|
|
20
|
+
## 本地检查
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python3 -m pytest tests/ -v
|
|
24
|
+
python3 scripts/check_docs_consistency.py
|
|
25
|
+
python3 -m build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## PR 要求
|
|
29
|
+
|
|
30
|
+
- 说明问题、方案与测试结果。
|
|
31
|
+
- 有 issue 则关联 issue。
|
|
32
|
+
- 用户可见变更需同步文档与 changelog。
|
|
33
|
+
|
|
34
|
+
## 提交信息规范
|
|
35
|
+
|
|
36
|
+
建议使用 Conventional Commits:
|
|
37
|
+
|
|
38
|
+
- `feat: ...`
|
|
39
|
+
- `fix: ...`
|
|
40
|
+
- `docs: ...`
|
|
41
|
+
- `chore: ...`
|
|
42
|
+
- `test: ...`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenClaw Community
|
|
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,22 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include README_EN.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include CHANGELOG.md
|
|
5
|
+
include CONTRIBUTING.md
|
|
6
|
+
include CONTRIBUTING.zh-CN.md
|
|
7
|
+
include SECURITY.md
|
|
8
|
+
include SECURITY.zh-CN.md
|
|
9
|
+
include SUPPORT.md
|
|
10
|
+
include SUPPORT.zh-CN.md
|
|
11
|
+
include CODE_OF_CONDUCT.md
|
|
12
|
+
include CODE_OF_CONDUCT.zh-CN.md
|
|
13
|
+
include RELEASING.md
|
|
14
|
+
include RELEASING.zh-CN.md
|
|
15
|
+
include requirements.txt
|
|
16
|
+
include requirements-full.txt
|
|
17
|
+
include requirements-dev.txt
|
|
18
|
+
recursive-include config *.json
|
|
19
|
+
recursive-include skills *.md
|
|
20
|
+
recursive-include audit *.md
|
|
21
|
+
recursive-include docs *.md
|
|
22
|
+
recursive-include scripts *.py *.sh *.ps1
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openclaw-alignment
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Reinforcement-learning driven alignment engine for OpenClaw workflows
|
|
5
|
+
Author: OpenClaw Alignment Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/412984588/openclaw-alignment
|
|
8
|
+
Project-URL: Repository, https://github.com/412984588/openclaw-alignment
|
|
9
|
+
Project-URL: Issues, https://github.com/412984588/openclaw-alignment/issues
|
|
10
|
+
Keywords: reinforcement-learning,alignment,openclaw,actor-critic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: MacOS
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Provides-Extra: phase3
|
|
26
|
+
Requires-Dist: redis>=5.0; extra == "phase3"
|
|
27
|
+
Requires-Dist: celery>=5.3; extra == "phase3"
|
|
28
|
+
Requires-Dist: torch>=2.2; extra == "phase3"
|
|
29
|
+
Requires-Dist: tensorboard>=2.15; extra == "phase3"
|
|
30
|
+
Requires-Dist: numba>=0.59; extra == "phase3"
|
|
31
|
+
Requires-Dist: scipy>=1.11; extra == "phase3"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pip-audit>=2.7; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# OpenClaw Alignment System
|
|
43
|
+
|
|
44
|
+
> Reinforcement-learning driven workflow alignment engine (Actor-Critic)
|
|
45
|
+
|
|
46
|
+
**English** | **[简体中文](README.md)**
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Actor-Critic RL core pipeline
|
|
51
|
+
- Four-dimensional reward system (objective/behavior/explicit/pattern)
|
|
52
|
+
- Optional Phase3 modules (distributed training, tuning, monitoring, performance)
|
|
53
|
+
- Contract drift guards (state/action dimensions + docs consistency)
|
|
54
|
+
- Cross-platform support: Windows / macOS / Linux
|
|
55
|
+
|
|
56
|
+
## Support Matrix
|
|
57
|
+
|
|
58
|
+
- Python: 3.10, 3.11, 3.12, 3.13
|
|
59
|
+
- OS: Windows, macOS, Linux
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### 1) PyPI (Recommended)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install openclaw-alignment
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Optional Phase3 extras:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install "openclaw-alignment[phase3]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2) Install from source
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/412984588/openclaw-alignment.git
|
|
79
|
+
cd openclaw-alignment
|
|
80
|
+
python3 scripts/install.py
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Development install:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python3 scripts/install.py --dev --editable
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Quick Verification
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python3 -m pytest tests/ -v
|
|
93
|
+
python3 scripts/check_docs_consistency.py
|
|
94
|
+
openclaw-alignment --help
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Architecture
|
|
98
|
+
|
|
99
|
+
### Core (Phase 1-2)
|
|
100
|
+
|
|
101
|
+
- `lib/reward.py`: reward calculation engine
|
|
102
|
+
- `lib/environment.py`: interaction environment
|
|
103
|
+
- `State`: State data class (17 dimensions)
|
|
104
|
+
- `Action`: Action data class (11 dimensions)
|
|
105
|
+
- `lib/agent.py`: Actor-Critic agent
|
|
106
|
+
- `lib/learner.py`: online learner
|
|
107
|
+
- `lib/trainer.py`: training loop
|
|
108
|
+
- `lib/contracts.py`: single source of truth for dimensions
|
|
109
|
+
|
|
110
|
+
### Optional (Phase 3)
|
|
111
|
+
|
|
112
|
+
- `lib/distributed_trainer.py`
|
|
113
|
+
- `lib/hyperparameter_tuner.py`
|
|
114
|
+
- `lib/monitoring.py`
|
|
115
|
+
- `lib/performance_optimizer.py`
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
- Architecture: `docs/architecture.md`
|
|
120
|
+
- Reward model: `docs/reward-model.md`
|
|
121
|
+
- Configuration: `docs/configuration.md`
|
|
122
|
+
- Optional dependencies: `docs/phase3-optional-deps.md`
|
|
123
|
+
- Contributing: `CONTRIBUTING.md`
|
|
124
|
+
- Security: `SECURITY.md`
|
|
125
|
+
- Support: `SUPPORT.md`
|
|
126
|
+
|
|
127
|
+
## Test Coverage
|
|
128
|
+
|
|
129
|
+
- **Total Tests**: 80
|
|
130
|
+
- **Pass Rate**: 100%
|
|
131
|
+
- **Core RL + integration**: 54 tests ✅
|
|
132
|
+
- **Phase 2**: 1 test ✅
|
|
133
|
+
- **Phase 3**: 21 tests ✅
|
|
134
|
+
- **Docs/contract drift guards**: 4 tests ✅
|
|
135
|
+
|
|
136
|
+
## Release and Versioning
|
|
137
|
+
|
|
138
|
+
- Versioning: SemVer (stable branch: `release/1.0.x`)
|
|
139
|
+
- Release runbook: `RELEASING.md` / `RELEASING.zh-CN.md`
|
|
140
|
+
- Changelog: `CHANGELOG.md`
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# OpenClaw 意图对齐系统
|
|
2
|
+
|
|
3
|
+
> 强化学习驱动的工作流对齐引擎(Actor-Critic)
|
|
4
|
+
|
|
5
|
+
**[English](README_EN.md)** | **简体中文**
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- Actor-Critic 强化学习主链路
|
|
10
|
+
- 四维度奖励系统(客观指标/行为信号/显性反馈/模式偏好)
|
|
11
|
+
- 可选 Phase3(分布式训练、自动调参、监控、性能优化)
|
|
12
|
+
- 契约防漂移检查(状态/动作维度与文档一致性)
|
|
13
|
+
- 跨平台支持:Windows / macOS / Linux
|
|
14
|
+
|
|
15
|
+
## 支持矩阵
|
|
16
|
+
|
|
17
|
+
- Python: 3.10, 3.11, 3.12, 3.13
|
|
18
|
+
- OS: Windows, macOS, Linux
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
### 1) PyPI(推荐)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install openclaw-alignment
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
可选 Phase3 依赖:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "openclaw-alignment[phase3]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2) 源码安装
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/412984588/openclaw-alignment.git
|
|
38
|
+
cd openclaw-alignment
|
|
39
|
+
python3 scripts/install.py
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
开发安装:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python3 scripts/install.py --dev --editable
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 快速验证
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python3 -m pytest tests/ -v
|
|
52
|
+
python3 scripts/check_docs_consistency.py
|
|
53
|
+
openclaw-alignment --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 架构
|
|
57
|
+
|
|
58
|
+
### Core(Phase 1-2)
|
|
59
|
+
|
|
60
|
+
- `lib/reward.py`: 四维度奖励计算
|
|
61
|
+
- `lib/environment.py`: 交互环境
|
|
62
|
+
- State: 状态数据类(17维)
|
|
63
|
+
- Action: 动作数据类(11维)
|
|
64
|
+
- `lib/agent.py`: Actor-Critic 智能体
|
|
65
|
+
- `lib/learner.py`: 在线学习器
|
|
66
|
+
- `lib/trainer.py`: 训练循环
|
|
67
|
+
- `lib/contracts.py`: 维度契约唯一来源
|
|
68
|
+
|
|
69
|
+
### Optional(Phase 3)
|
|
70
|
+
|
|
71
|
+
- `lib/distributed_trainer.py`
|
|
72
|
+
- `lib/hyperparameter_tuner.py`
|
|
73
|
+
- `lib/monitoring.py`
|
|
74
|
+
- `lib/performance_optimizer.py`
|
|
75
|
+
|
|
76
|
+
## 文档
|
|
77
|
+
|
|
78
|
+
- 架构:`docs/architecture.zh-CN.md`
|
|
79
|
+
- 奖励模型:`docs/reward-model.zh-CN.md`
|
|
80
|
+
- 配置:`docs/configuration.zh-CN.md`
|
|
81
|
+
- 可选依赖:`docs/phase3-optional-deps.zh-CN.md`
|
|
82
|
+
- 贡献:`CONTRIBUTING.zh-CN.md`
|
|
83
|
+
- 安全:`SECURITY.zh-CN.md`
|
|
84
|
+
- 支持:`SUPPORT.zh-CN.md`
|
|
85
|
+
|
|
86
|
+
## 测试覆盖
|
|
87
|
+
|
|
88
|
+
- **总测试数**: 80个
|
|
89
|
+
- **通过率**: 100%
|
|
90
|
+
- **核心RL与集成**: 54个测试 ✅
|
|
91
|
+
- **Phase 2**: 1个测试 ✅
|
|
92
|
+
- **Phase 3**: 21个测试 ✅
|
|
93
|
+
- **文档/契约防漂移**: 4个测试 ✅
|
|
94
|
+
|
|
95
|
+
## 发布与版本
|
|
96
|
+
|
|
97
|
+
- 版本策略:SemVer(稳定分支:`release/1.0.x`)
|
|
98
|
+
- 发布流程:见 `RELEASING.zh-CN.md` / `RELEASING.md`
|
|
99
|
+
- 变更记录:`CHANGELOG.md`
|
|
100
|
+
|
|
101
|
+
## 许可证
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# OpenClaw Alignment System
|
|
2
|
+
|
|
3
|
+
> Reinforcement-learning driven workflow alignment engine (Actor-Critic)
|
|
4
|
+
|
|
5
|
+
**English** | **[简体中文](README.md)**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Actor-Critic RL core pipeline
|
|
10
|
+
- Four-dimensional reward system (objective/behavior/explicit/pattern)
|
|
11
|
+
- Optional Phase3 modules (distributed training, tuning, monitoring, performance)
|
|
12
|
+
- Contract drift guards (state/action dimensions + docs consistency)
|
|
13
|
+
- Cross-platform support: Windows / macOS / Linux
|
|
14
|
+
|
|
15
|
+
## Support Matrix
|
|
16
|
+
|
|
17
|
+
- Python: 3.10, 3.11, 3.12, 3.13
|
|
18
|
+
- OS: Windows, macOS, Linux
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### 1) PyPI (Recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install openclaw-alignment
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Optional Phase3 extras:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "openclaw-alignment[phase3]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2) Install from source
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/412984588/openclaw-alignment.git
|
|
38
|
+
cd openclaw-alignment
|
|
39
|
+
python3 scripts/install.py
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Development install:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python3 scripts/install.py --dev --editable
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Verification
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python3 -m pytest tests/ -v
|
|
52
|
+
python3 scripts/check_docs_consistency.py
|
|
53
|
+
openclaw-alignment --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Architecture
|
|
57
|
+
|
|
58
|
+
### Core (Phase 1-2)
|
|
59
|
+
|
|
60
|
+
- `lib/reward.py`: reward calculation engine
|
|
61
|
+
- `lib/environment.py`: interaction environment
|
|
62
|
+
- `State`: State data class (17 dimensions)
|
|
63
|
+
- `Action`: Action data class (11 dimensions)
|
|
64
|
+
- `lib/agent.py`: Actor-Critic agent
|
|
65
|
+
- `lib/learner.py`: online learner
|
|
66
|
+
- `lib/trainer.py`: training loop
|
|
67
|
+
- `lib/contracts.py`: single source of truth for dimensions
|
|
68
|
+
|
|
69
|
+
### Optional (Phase 3)
|
|
70
|
+
|
|
71
|
+
- `lib/distributed_trainer.py`
|
|
72
|
+
- `lib/hyperparameter_tuner.py`
|
|
73
|
+
- `lib/monitoring.py`
|
|
74
|
+
- `lib/performance_optimizer.py`
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
- Architecture: `docs/architecture.md`
|
|
79
|
+
- Reward model: `docs/reward-model.md`
|
|
80
|
+
- Configuration: `docs/configuration.md`
|
|
81
|
+
- Optional dependencies: `docs/phase3-optional-deps.md`
|
|
82
|
+
- Contributing: `CONTRIBUTING.md`
|
|
83
|
+
- Security: `SECURITY.md`
|
|
84
|
+
- Support: `SUPPORT.md`
|
|
85
|
+
|
|
86
|
+
## Test Coverage
|
|
87
|
+
|
|
88
|
+
- **Total Tests**: 80
|
|
89
|
+
- **Pass Rate**: 100%
|
|
90
|
+
- **Core RL + integration**: 54 tests ✅
|
|
91
|
+
- **Phase 2**: 1 test ✅
|
|
92
|
+
- **Phase 3**: 21 tests ✅
|
|
93
|
+
- **Docs/contract drift guards**: 4 tests ✅
|
|
94
|
+
|
|
95
|
+
## Release and Versioning
|
|
96
|
+
|
|
97
|
+
- Versioning: SemVer (stable branch: `release/1.0.x`)
|
|
98
|
+
- Release runbook: `RELEASING.md` / `RELEASING.zh-CN.md`
|
|
99
|
+
- Changelog: `CHANGELOG.md`
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- CI is green on all supported platforms.
|
|
6
|
+
- `python3 -m pytest tests/ -v` passes.
|
|
7
|
+
- `python3 scripts/check_docs_consistency.py` passes.
|
|
8
|
+
- `CHANGELOG.md` updated.
|
|
9
|
+
|
|
10
|
+
## Release Steps
|
|
11
|
+
|
|
12
|
+
1. Bump version in `pyproject.toml` and changelog.
|
|
13
|
+
2. Create release branch/tag:
|
|
14
|
+
- `git tag vX.Y.Z`
|
|
15
|
+
- `git push origin vX.Y.Z`
|
|
16
|
+
3. Build package:
|
|
17
|
+
- `python3 -m build`
|
|
18
|
+
4. Validate artifacts:
|
|
19
|
+
- `python3 -m twine check dist/*`
|
|
20
|
+
5. Publish:
|
|
21
|
+
- TestPyPI first, then PyPI.
|
|
22
|
+
6. Create GitHub Release and paste changelog summary.
|
|
23
|
+
|
|
24
|
+
## Post-release
|
|
25
|
+
|
|
26
|
+
- Monitor issues for 7 days.
|
|
27
|
+
- Prepare `X.Y.(Z+1)` hotfix if needed.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 发布流程
|
|
2
|
+
|
|
3
|
+
## 前置条件
|
|
4
|
+
|
|
5
|
+
- CI 在所有支持平台通过。
|
|
6
|
+
- `python3 -m pytest tests/ -v` 全绿。
|
|
7
|
+
- `python3 scripts/check_docs_consistency.py` 通过。
|
|
8
|
+
- `CHANGELOG.md` 已更新。
|
|
9
|
+
|
|
10
|
+
## 发布步骤
|
|
11
|
+
|
|
12
|
+
1. 更新 `pyproject.toml` 与 changelog 版本号。
|
|
13
|
+
2. 打 tag 并推送:
|
|
14
|
+
- `git tag vX.Y.Z`
|
|
15
|
+
- `git push origin vX.Y.Z`
|
|
16
|
+
3. 构建包:
|
|
17
|
+
- `python3 -m build`
|
|
18
|
+
4. 校验包:
|
|
19
|
+
- `python3 -m twine check dist/*`
|
|
20
|
+
5. 发布:
|
|
21
|
+
- 先 TestPyPI,再正式 PyPI。
|
|
22
|
+
6. 创建 GitHub Release 并附变更摘要。
|
|
23
|
+
|
|
24
|
+
## 发布后
|
|
25
|
+
|
|
26
|
+
- 首周跟踪 issue。
|
|
27
|
+
- 必要时发布 `X.Y.(Z+1)` 热修版本。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
- `1.0.x`: supported
|
|
6
|
+
- `<1.0.0`: best effort only
|
|
7
|
+
|
|
8
|
+
## Reporting a Vulnerability
|
|
9
|
+
|
|
10
|
+
Please report vulnerabilities privately:
|
|
11
|
+
|
|
12
|
+
- GitHub private advisory: https://github.com/412984588/openclaw-alignment/security/advisories/new
|
|
13
|
+
- Security email: security@openclaw-alignment.example
|
|
14
|
+
|
|
15
|
+
Before public release, maintainers must replace the placeholder email with the real security contact.
|
|
16
|
+
|
|
17
|
+
Do **not** open public issues for unpatched vulnerabilities.
|
|
18
|
+
|
|
19
|
+
## Response Targets
|
|
20
|
+
|
|
21
|
+
- Initial response: within 72 hours
|
|
22
|
+
- Triage decision: within 7 days
|
|
23
|
+
- Patch target: based on severity and impact
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 安全策略
|
|
2
|
+
|
|
3
|
+
## 支持版本
|
|
4
|
+
|
|
5
|
+
- `1.0.x`:官方支持
|
|
6
|
+
- `<1.0.0`:尽力支持
|
|
7
|
+
|
|
8
|
+
## 漏洞上报
|
|
9
|
+
|
|
10
|
+
请使用私密方式上报:
|
|
11
|
+
|
|
12
|
+
- GitHub 私有安全通告:https://github.com/412984588/openclaw-alignment/security/advisories/new
|
|
13
|
+
- 安全邮箱:security@openclaw-alignment.example
|
|
14
|
+
|
|
15
|
+
发布前请将上述占位邮箱替换为真实安全联系方式。
|
|
16
|
+
|
|
17
|
+
**不要**在公开 issue 中披露未修复漏洞。
|
|
18
|
+
|
|
19
|
+
## 响应目标
|
|
20
|
+
|
|
21
|
+
- 首次响应:72 小时内
|
|
22
|
+
- 分级结论:7 天内
|
|
23
|
+
- 修复时限:按严重级别与影响范围确定
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Support
|
|
2
|
+
|
|
3
|
+
## Where to Ask Questions
|
|
4
|
+
|
|
5
|
+
- Usage questions: GitHub Discussions
|
|
6
|
+
- Bug reports: GitHub Issues
|
|
7
|
+
- Security issues: see `SECURITY.md`
|
|
8
|
+
|
|
9
|
+
## What to Include
|
|
10
|
+
|
|
11
|
+
- OS and Python version
|
|
12
|
+
- Install method (`pip`/source)
|
|
13
|
+
- Minimal reproduction steps
|
|
14
|
+
- Error logs/traceback
|