clearframe 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.
- clearframe-0.1.0/CONTRIBUTING.md +38 -0
- clearframe-0.1.0/LICENSE +58 -0
- clearframe-0.1.0/PKG-INFO +295 -0
- clearframe-0.1.0/README.md +203 -0
- clearframe-0.1.0/clearframe/__init__.py +13 -0
- clearframe-0.1.0/clearframe/cli.py +131 -0
- clearframe-0.1.0/clearframe/core/__init__.py +0 -0
- clearframe-0.1.0/clearframe/core/audit.py +159 -0
- clearframe-0.1.0/clearframe/core/config.py +52 -0
- clearframe-0.1.0/clearframe/core/manifest.py +88 -0
- clearframe-0.1.0/clearframe/core/session.py +192 -0
- clearframe-0.1.0/clearframe/core/vault.py +151 -0
- clearframe-0.1.0/clearframe/gateway/__init__.py +0 -0
- clearframe-0.1.0/clearframe/gateway/isolation.py +117 -0
- clearframe-0.1.0/clearframe/monitor/__init__.py +0 -0
- clearframe-0.1.0/clearframe/monitor/goal_monitor.py +181 -0
- clearframe-0.1.0/clearframe/monitor/rtl.py +78 -0
- clearframe-0.1.0/clearframe/ops/__init__.py +0 -0
- clearframe-0.1.0/clearframe/ops/server.py +143 -0
- clearframe-0.1.0/clearframe/plugins/__init__.py +0 -0
- clearframe-0.1.0/pyproject.toml +61 -0
- clearframe-0.1.0/tests/__init__.py +0 -0
- clearframe-0.1.0/tests/test_audit.py +43 -0
- clearframe-0.1.0/tests/test_goal_monitor.py +68 -0
- clearframe-0.1.0/tests/test_vault.py +55 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing to ClearFrame
|
|
2
|
+
|
|
3
|
+
ClearFrame is Apache 2.0 licensed. All contributions are welcome.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/ibrahimmukherjee-boop/clearframe
|
|
9
|
+
cd clearframe
|
|
10
|
+
python -m venv .venv && source .venv/bin/activate
|
|
11
|
+
pip install -e ".[dev]"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Running tests
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pytest tests/ -v --cov=clearframe
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Code style
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
ruff check clearframe/ tests/
|
|
24
|
+
mypy clearframe/
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Submitting a PR
|
|
28
|
+
|
|
29
|
+
1. Fork the repo
|
|
30
|
+
2. Create a branch: `git checkout -b feat/my-feature`
|
|
31
|
+
3. Write tests for any new behaviour
|
|
32
|
+
4. Run `pytest` and `ruff` β both must pass
|
|
33
|
+
5. Open a PR with a clear description of the change
|
|
34
|
+
|
|
35
|
+
## Reporting security issues
|
|
36
|
+
|
|
37
|
+
Please **do not** open a public issue for security vulnerabilities.
|
|
38
|
+
Email the maintainers directly or use GitHub's private security advisory feature.
|
clearframe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity.
|
|
18
|
+
|
|
19
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
20
|
+
exercising permissions granted by this License.
|
|
21
|
+
|
|
22
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
23
|
+
including but not limited to software source code, documentation
|
|
24
|
+
source, and configuration files.
|
|
25
|
+
|
|
26
|
+
"Object" form shall mean any form resulting from mechanical
|
|
27
|
+
transformation or translation of a Source form, including but
|
|
28
|
+
not limited to compiled object code, generated documentation,
|
|
29
|
+
and conversions to other media types.
|
|
30
|
+
|
|
31
|
+
"Work" shall mean the work of authorship made available under
|
|
32
|
+
the License, as indicated by a copyright notice that is included in
|
|
33
|
+
or attached to the work.
|
|
34
|
+
|
|
35
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
36
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
37
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
38
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
39
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
40
|
+
Work and such Derivative Works in Source or Object form.
|
|
41
|
+
|
|
42
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
43
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
44
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
45
|
+
patent license to make, have made, use, offer to sell, sell,
|
|
46
|
+
import, and otherwise transfer the Work.
|
|
47
|
+
|
|
48
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
49
|
+
you may not use this file except in compliance with the License.
|
|
50
|
+
You may obtain a copy of the License at
|
|
51
|
+
|
|
52
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
53
|
+
|
|
54
|
+
Unless required by applicable law or agreed to in writing, software
|
|
55
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
56
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
57
|
+
See the License for the specific language governing permissions and
|
|
58
|
+
limitations under the License.
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clearframe
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open-source AI agent protocol with auditability, safety controls, and a live AgentOps control plane.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ibrahimmukherjee-boop/clearframe
|
|
6
|
+
Project-URL: Documentation, https://github.com/ibrahimmukherjee-boop/clearframe#readme
|
|
7
|
+
Project-URL: Issues, https://github.com/ibrahimmukherjee-boop/clearframe/issues
|
|
8
|
+
Author: ClearFrame Contributors
|
|
9
|
+
License: Apache License
|
|
10
|
+
Version 2.0, January 2004
|
|
11
|
+
http://www.apache.org/licenses/
|
|
12
|
+
|
|
13
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
14
|
+
|
|
15
|
+
1. Definitions.
|
|
16
|
+
|
|
17
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
18
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
19
|
+
|
|
20
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
21
|
+
the copyright owner that is granting the License.
|
|
22
|
+
|
|
23
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
24
|
+
other entities that control, are controlled by, or are under common
|
|
25
|
+
control with that entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to software source code, documentation
|
|
32
|
+
source, and configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship made available under
|
|
40
|
+
the License, as indicated by a copyright notice that is included in
|
|
41
|
+
or attached to the work.
|
|
42
|
+
|
|
43
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
44
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
45
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
46
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
47
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
48
|
+
Work and such Derivative Works in Source or Object form.
|
|
49
|
+
|
|
50
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
51
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
52
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
53
|
+
patent license to make, have made, use, offer to sell, sell,
|
|
54
|
+
import, and otherwise transfer the Work.
|
|
55
|
+
|
|
56
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
57
|
+
you may not use this file except in compliance with the License.
|
|
58
|
+
You may obtain a copy of the License at
|
|
59
|
+
|
|
60
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
61
|
+
|
|
62
|
+
Unless required by applicable law or agreed to in writing, software
|
|
63
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
64
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
65
|
+
See the License for the specific language governing permissions and
|
|
66
|
+
limitations under the License.
|
|
67
|
+
License-File: LICENSE
|
|
68
|
+
Keywords: agentic,ai-agents,auditability,llm,mcp-alternative,safety
|
|
69
|
+
Classifier: Development Status :: 3 - Alpha
|
|
70
|
+
Classifier: Intended Audience :: Developers
|
|
71
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
72
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
73
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
74
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
75
|
+
Requires-Python: >=3.11
|
|
76
|
+
Requires-Dist: anyio>=4.3
|
|
77
|
+
Requires-Dist: cryptography>=42.0
|
|
78
|
+
Requires-Dist: fastapi>=0.110
|
|
79
|
+
Requires-Dist: httpx>=0.27
|
|
80
|
+
Requires-Dist: pydantic>=2.6
|
|
81
|
+
Requires-Dist: rich>=13.7
|
|
82
|
+
Requires-Dist: typer[all]>=0.12
|
|
83
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
84
|
+
Provides-Extra: dev
|
|
85
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
86
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
87
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
88
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
89
|
+
Requires-Dist: pytest>=8.1; extra == 'dev'
|
|
90
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
91
|
+
Description-Content-Type: text/markdown
|
|
92
|
+
|
|
93
|
+
# ClearFrame
|
|
94
|
+
|
|
95
|
+
> The open-source AI agent protocol built for auditability, safety, and control.
|
|
96
|
+
|
|
97
|
+
[](LICENSE)
|
|
98
|
+
[](https://python.org)
|
|
99
|
+
[]()
|
|
100
|
+
|
|
101
|
+
ClearFrame is a drop-in alternative to OpenClaw and MCP that puts **you** in control of your AI agents. Every tool call is scored for alignment, every reasoning step is captured, every credential is encrypted, and every action is logged to a tamper-evident audit trail.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Why ClearFrame?
|
|
106
|
+
|
|
107
|
+
| Problem with OpenClaw / MCP | ClearFrame's answer |
|
|
108
|
+
|---|---|
|
|
109
|
+
| Single process reads untrusted content AND executes tools β prompt injection | **Reader/Actor isolation** β two sandboxed processes, typed pipe between them |
|
|
110
|
+
| Credentials stored in plaintext `~/.env` | **Encrypted Vault** β AES-256-GCM, memory-locked, auto-locks on session end |
|
|
111
|
+
| No audit trail β forensics impossible | **HMAC-chained Audit Log** β tamper-evident, cryptographically verifiable |
|
|
112
|
+
| No concept of what the agent is *supposed* to do | **Goal Monitor** β every tool call scored for alignment; drift triggers auto-pause |
|
|
113
|
+
| Chain-of-thought never captured | **Reasoning Transparency Layer (RTL)** β full trace as queryable JSON |
|
|
114
|
+
| No visibility into what context the model received | **Context Feed Auditor** β every token source-tagged and hashed |
|
|
115
|
+
| No operator control plane | **AgentOps** β live REST + WebSocket dashboard to approve, block, or tweak |
|
|
116
|
+
| Plugin ecosystem with no signing or review | **Signed Plugin Registry** β Ed25519 signatures, hash pinning, sandboxed execution |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Quick Start
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install clearframe
|
|
124
|
+
|
|
125
|
+
# Initialise a new agent project
|
|
126
|
+
clearframe init my-agent
|
|
127
|
+
cd my-agent
|
|
128
|
+
|
|
129
|
+
# Edit agent.py, then run
|
|
130
|
+
python agent.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Minimal example
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import asyncio
|
|
137
|
+
from clearframe import AgentSession, ClearFrameConfig
|
|
138
|
+
from clearframe.core.manifest import GoalManifest, ToolPermission
|
|
139
|
+
|
|
140
|
+
async def main():
|
|
141
|
+
config = ClearFrameConfig()
|
|
142
|
+
manifest = GoalManifest(
|
|
143
|
+
goal="Search for the latest AI safety papers and summarise them",
|
|
144
|
+
permitted_tools=[
|
|
145
|
+
ToolPermission(tool_name="web_search", max_calls_per_session=5),
|
|
146
|
+
],
|
|
147
|
+
)
|
|
148
|
+
async with AgentSession(config, manifest) as session:
|
|
149
|
+
result = await session.call_tool("web_search", query="AI safety 2026")
|
|
150
|
+
print(result)
|
|
151
|
+
|
|
152
|
+
asyncio.run(main())
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Architecture
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
161
|
+
β AgentSession β
|
|
162
|
+
β β
|
|
163
|
+
β ββββββββββββββββ typed pipe ββββββββββββββββββββββββ β
|
|
164
|
+
β β ReaderSandboxβ ββββββββββββββΊ β ActorSandbox β β
|
|
165
|
+
β β (untrusted β β (tool execution only) β β
|
|
166
|
+
β β content) β β never reads raw input β β
|
|
167
|
+
β ββββββββββββββββ ββββββββββββββββββββββββ β
|
|
168
|
+
β β β β
|
|
169
|
+
β βΌ βΌ β
|
|
170
|
+
β ββββββββββββββββ βββββββββββββββββββββββββ β
|
|
171
|
+
β βContext Feed β β Goal Monitor β β
|
|
172
|
+
β βAuditor β β alignment scoring β β
|
|
173
|
+
β βsource-tags + β β auto-pause on drift β β
|
|
174
|
+
β βhashes every β β operator queue β β
|
|
175
|
+
β βtoken β βββββββββββββββββββββββββ β
|
|
176
|
+
β ββββββββββββββββ β β
|
|
177
|
+
β βΌ β
|
|
178
|
+
β βββββββββββββββββββββββββ β
|
|
179
|
+
β β RTL (Reasoning β β
|
|
180
|
+
β β Transparency Layer) β β
|
|
181
|
+
β β hash-verified traces β β
|
|
182
|
+
β βββββββββββββββββββββββββ β
|
|
183
|
+
β β β
|
|
184
|
+
β βΌ β
|
|
185
|
+
β βββββββββββββββββββββββββ β
|
|
186
|
+
β β HMAC-Chained Audit β β
|
|
187
|
+
β β Log (tamper-evident) β β
|
|
188
|
+
β βββββββββββββββββββββββββ β
|
|
189
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
190
|
+
β
|
|
191
|
+
βΌ
|
|
192
|
+
βββββββββββββββββββββββββ
|
|
193
|
+
β AgentOps Server β
|
|
194
|
+
β REST + WebSocket β
|
|
195
|
+
β localhost:7477 β
|
|
196
|
+
βββββββββββββββββββββββββ
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Core Concepts
|
|
202
|
+
|
|
203
|
+
### GoalManifest
|
|
204
|
+
Declare **what the agent is allowed to do** before it starts. The runtime enforces it.
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from clearframe.core.manifest import GoalManifest, ToolPermission, ResourceScope
|
|
208
|
+
|
|
209
|
+
manifest = GoalManifest(
|
|
210
|
+
goal="Book a flight to London for next Friday",
|
|
211
|
+
permitted_tools=[
|
|
212
|
+
ToolPermission(tool_name="web_search", max_calls_per_session=10),
|
|
213
|
+
ToolPermission(tool_name="web_fetch", max_calls_per_session=5),
|
|
214
|
+
ToolPermission(tool_name="send_email", max_calls_per_session=1, require_approval=True),
|
|
215
|
+
],
|
|
216
|
+
allow_file_write=False,
|
|
217
|
+
allow_code_execution=False,
|
|
218
|
+
max_steps=30,
|
|
219
|
+
resource_scope=ResourceScope(
|
|
220
|
+
allowed_domains=["flights.example.com", "*.airline.com"],
|
|
221
|
+
),
|
|
222
|
+
)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Vault
|
|
226
|
+
Never store credentials in plaintext again.
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from clearframe.core.vault import Vault
|
|
230
|
+
from clearframe.core.config import VaultConfig
|
|
231
|
+
|
|
232
|
+
vault = Vault(VaultConfig())
|
|
233
|
+
vault.unlock("your-master-password")
|
|
234
|
+
vault.set("openai_api_key", "sk-...")
|
|
235
|
+
key = vault.get("openai_api_key")
|
|
236
|
+
vault.lock() # auto-zeroises memory
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Audit Log
|
|
240
|
+
Cryptographically verify nothing was tampered with.
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
clearframe audit-verify
|
|
244
|
+
# β Audit log integrity verified β no tampering detected.
|
|
245
|
+
|
|
246
|
+
clearframe audit-tail --lines 50
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### AgentOps Server
|
|
250
|
+
Start the live control plane:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
clearframe ops-start
|
|
254
|
+
# AgentOps running at http://localhost:7477
|
|
255
|
+
# Auth token: <printed once to console>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## CLI Reference
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
clearframe init <name> Create a new agent project
|
|
264
|
+
clearframe audit-verify Verify audit log HMAC chain integrity
|
|
265
|
+
clearframe audit-tail Show recent audit entries
|
|
266
|
+
clearframe ops-start Start AgentOps control plane
|
|
267
|
+
clearframe version Show version
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Comparison vs OpenClaw / MCP
|
|
273
|
+
|
|
274
|
+
| Feature | OpenClaw | MCP | **ClearFrame** |
|
|
275
|
+
|---|---|---|---|
|
|
276
|
+
| Reader/Actor isolation | β | β | β
|
|
|
277
|
+
| Goal alignment scoring | β | β | β
|
|
|
278
|
+
| Reasoning trace capture | β | Partial | β
Full JSON |
|
|
279
|
+
| Tamper-evident audit log | β | β | β
HMAC chain |
|
|
280
|
+
| Encrypted credential vault | β | β | β
AES-256-GCM |
|
|
281
|
+
| Context feed hashing | β | β | β
|
|
|
282
|
+
| Live operator control plane | β | β | β
|
|
|
283
|
+
| Signed plugin registry | β | β | β
Ed25519 |
|
|
284
|
+
| Auto-pause on drift | β | β | β
|
|
|
285
|
+
| Open source | β
| β
| β
Apache 2.0 |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Contributing
|
|
290
|
+
|
|
291
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). All contributions welcome β open an issue first for large changes.
|
|
292
|
+
|
|
293
|
+
## License
|
|
294
|
+
|
|
295
|
+
Apache 2.0 β see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# ClearFrame
|
|
2
|
+
|
|
3
|
+
> The open-source AI agent protocol built for auditability, safety, and control.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://python.org)
|
|
7
|
+
[]()
|
|
8
|
+
|
|
9
|
+
ClearFrame is a drop-in alternative to OpenClaw and MCP that puts **you** in control of your AI agents. Every tool call is scored for alignment, every reasoning step is captured, every credential is encrypted, and every action is logged to a tamper-evident audit trail.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why ClearFrame?
|
|
14
|
+
|
|
15
|
+
| Problem with OpenClaw / MCP | ClearFrame's answer |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Single process reads untrusted content AND executes tools β prompt injection | **Reader/Actor isolation** β two sandboxed processes, typed pipe between them |
|
|
18
|
+
| Credentials stored in plaintext `~/.env` | **Encrypted Vault** β AES-256-GCM, memory-locked, auto-locks on session end |
|
|
19
|
+
| No audit trail β forensics impossible | **HMAC-chained Audit Log** β tamper-evident, cryptographically verifiable |
|
|
20
|
+
| No concept of what the agent is *supposed* to do | **Goal Monitor** β every tool call scored for alignment; drift triggers auto-pause |
|
|
21
|
+
| Chain-of-thought never captured | **Reasoning Transparency Layer (RTL)** β full trace as queryable JSON |
|
|
22
|
+
| No visibility into what context the model received | **Context Feed Auditor** β every token source-tagged and hashed |
|
|
23
|
+
| No operator control plane | **AgentOps** β live REST + WebSocket dashboard to approve, block, or tweak |
|
|
24
|
+
| Plugin ecosystem with no signing or review | **Signed Plugin Registry** β Ed25519 signatures, hash pinning, sandboxed execution |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install clearframe
|
|
32
|
+
|
|
33
|
+
# Initialise a new agent project
|
|
34
|
+
clearframe init my-agent
|
|
35
|
+
cd my-agent
|
|
36
|
+
|
|
37
|
+
# Edit agent.py, then run
|
|
38
|
+
python agent.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Minimal example
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import asyncio
|
|
45
|
+
from clearframe import AgentSession, ClearFrameConfig
|
|
46
|
+
from clearframe.core.manifest import GoalManifest, ToolPermission
|
|
47
|
+
|
|
48
|
+
async def main():
|
|
49
|
+
config = ClearFrameConfig()
|
|
50
|
+
manifest = GoalManifest(
|
|
51
|
+
goal="Search for the latest AI safety papers and summarise them",
|
|
52
|
+
permitted_tools=[
|
|
53
|
+
ToolPermission(tool_name="web_search", max_calls_per_session=5),
|
|
54
|
+
],
|
|
55
|
+
)
|
|
56
|
+
async with AgentSession(config, manifest) as session:
|
|
57
|
+
result = await session.call_tool("web_search", query="AI safety 2026")
|
|
58
|
+
print(result)
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Architecture
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
69
|
+
β AgentSession β
|
|
70
|
+
β β
|
|
71
|
+
β ββββββββββββββββ typed pipe ββββββββββββββββββββββββ β
|
|
72
|
+
β β ReaderSandboxβ ββββββββββββββΊ β ActorSandbox β β
|
|
73
|
+
β β (untrusted β β (tool execution only) β β
|
|
74
|
+
β β content) β β never reads raw input β β
|
|
75
|
+
β ββββββββββββββββ ββββββββββββββββββββββββ β
|
|
76
|
+
β β β β
|
|
77
|
+
β βΌ βΌ β
|
|
78
|
+
β ββββββββββββββββ βββββββββββββββββββββββββ β
|
|
79
|
+
β βContext Feed β β Goal Monitor β β
|
|
80
|
+
β βAuditor β β alignment scoring β β
|
|
81
|
+
β βsource-tags + β β auto-pause on drift β β
|
|
82
|
+
β βhashes every β β operator queue β β
|
|
83
|
+
β βtoken β βββββββββββββββββββββββββ β
|
|
84
|
+
β ββββββββββββββββ β β
|
|
85
|
+
β βΌ β
|
|
86
|
+
β βββββββββββββββββββββββββ β
|
|
87
|
+
β β RTL (Reasoning β β
|
|
88
|
+
β β Transparency Layer) β β
|
|
89
|
+
β β hash-verified traces β β
|
|
90
|
+
β βββββββββββββββββββββββββ β
|
|
91
|
+
β β β
|
|
92
|
+
β βΌ β
|
|
93
|
+
β βββββββββββββββββββββββββ β
|
|
94
|
+
β β HMAC-Chained Audit β β
|
|
95
|
+
β β Log (tamper-evident) β β
|
|
96
|
+
β βββββββββββββββββββββββββ β
|
|
97
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
98
|
+
β
|
|
99
|
+
βΌ
|
|
100
|
+
βββββββββββββββββββββββββ
|
|
101
|
+
β AgentOps Server β
|
|
102
|
+
β REST + WebSocket β
|
|
103
|
+
β localhost:7477 β
|
|
104
|
+
βββββββββββββββββββββββββ
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Core Concepts
|
|
110
|
+
|
|
111
|
+
### GoalManifest
|
|
112
|
+
Declare **what the agent is allowed to do** before it starts. The runtime enforces it.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from clearframe.core.manifest import GoalManifest, ToolPermission, ResourceScope
|
|
116
|
+
|
|
117
|
+
manifest = GoalManifest(
|
|
118
|
+
goal="Book a flight to London for next Friday",
|
|
119
|
+
permitted_tools=[
|
|
120
|
+
ToolPermission(tool_name="web_search", max_calls_per_session=10),
|
|
121
|
+
ToolPermission(tool_name="web_fetch", max_calls_per_session=5),
|
|
122
|
+
ToolPermission(tool_name="send_email", max_calls_per_session=1, require_approval=True),
|
|
123
|
+
],
|
|
124
|
+
allow_file_write=False,
|
|
125
|
+
allow_code_execution=False,
|
|
126
|
+
max_steps=30,
|
|
127
|
+
resource_scope=ResourceScope(
|
|
128
|
+
allowed_domains=["flights.example.com", "*.airline.com"],
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Vault
|
|
134
|
+
Never store credentials in plaintext again.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from clearframe.core.vault import Vault
|
|
138
|
+
from clearframe.core.config import VaultConfig
|
|
139
|
+
|
|
140
|
+
vault = Vault(VaultConfig())
|
|
141
|
+
vault.unlock("your-master-password")
|
|
142
|
+
vault.set("openai_api_key", "sk-...")
|
|
143
|
+
key = vault.get("openai_api_key")
|
|
144
|
+
vault.lock() # auto-zeroises memory
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Audit Log
|
|
148
|
+
Cryptographically verify nothing was tampered with.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
clearframe audit-verify
|
|
152
|
+
# β Audit log integrity verified β no tampering detected.
|
|
153
|
+
|
|
154
|
+
clearframe audit-tail --lines 50
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### AgentOps Server
|
|
158
|
+
Start the live control plane:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
clearframe ops-start
|
|
162
|
+
# AgentOps running at http://localhost:7477
|
|
163
|
+
# Auth token: <printed once to console>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## CLI Reference
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
clearframe init <name> Create a new agent project
|
|
172
|
+
clearframe audit-verify Verify audit log HMAC chain integrity
|
|
173
|
+
clearframe audit-tail Show recent audit entries
|
|
174
|
+
clearframe ops-start Start AgentOps control plane
|
|
175
|
+
clearframe version Show version
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Comparison vs OpenClaw / MCP
|
|
181
|
+
|
|
182
|
+
| Feature | OpenClaw | MCP | **ClearFrame** |
|
|
183
|
+
|---|---|---|---|
|
|
184
|
+
| Reader/Actor isolation | β | β | β
|
|
|
185
|
+
| Goal alignment scoring | β | β | β
|
|
|
186
|
+
| Reasoning trace capture | β | Partial | β
Full JSON |
|
|
187
|
+
| Tamper-evident audit log | β | β | β
HMAC chain |
|
|
188
|
+
| Encrypted credential vault | β | β | β
AES-256-GCM |
|
|
189
|
+
| Context feed hashing | β | β | β
|
|
|
190
|
+
| Live operator control plane | β | β | β
|
|
|
191
|
+
| Signed plugin registry | β | β | β
Ed25519 |
|
|
192
|
+
| Auto-pause on drift | β | β | β
|
|
|
193
|
+
| Open source | β
| β
| β
Apache 2.0 |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). All contributions welcome β open an issue first for large changes.
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
Apache 2.0 β see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ClearFrame β Open-source AI agent protocol with auditability,
|
|
3
|
+
goal monitoring, Reader/Actor isolation, and safety controls.
|
|
4
|
+
|
|
5
|
+
A production-grade alternative to OpenClaw and MCP.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from clearframe.core.config import ClearFrameConfig
|
|
9
|
+
from clearframe.core.manifest import GoalManifest
|
|
10
|
+
from clearframe.core.session import AgentSession
|
|
11
|
+
|
|
12
|
+
__version__ = "0.1.0"
|
|
13
|
+
__all__ = ["ClearFrameConfig", "GoalManifest", "AgentSession", "__version__"]
|