causal-memory-layer 0.4.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.
- causal_memory_layer-0.4.0/LICENSE +21 -0
- causal_memory_layer-0.4.0/LICENSE_COMMERCIAL.md +74 -0
- causal_memory_layer-0.4.0/PKG-INFO +303 -0
- causal_memory_layer-0.4.0/README.md +237 -0
- causal_memory_layer-0.4.0/api/__init__.py +1 -0
- causal_memory_layer-0.4.0/api/server.py +515 -0
- causal_memory_layer-0.4.0/api/store.py +189 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/PKG-INFO +303 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/SOURCES.txt +47 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/dependency_links.txt +1 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/entry_points.txt +3 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/requires.txt +20 -0
- causal_memory_layer-0.4.0/causal_memory_layer.egg-info/top_level.txt +3 -0
- causal_memory_layer-0.4.0/cli/__init__.py +1 -0
- causal_memory_layer-0.4.0/cli/audit.py +83 -0
- causal_memory_layer-0.4.0/cli/chain.py +113 -0
- causal_memory_layer-0.4.0/cli/main.py +141 -0
- causal_memory_layer-0.4.0/cml/__init__.py +50 -0
- causal_memory_layer-0.4.0/cml/audit.py +440 -0
- causal_memory_layer-0.4.0/cml/chain.py +115 -0
- causal_memory_layer-0.4.0/cml/ctag.py +274 -0
- causal_memory_layer-0.4.0/cml/experimental/__init__.py +4 -0
- causal_memory_layer-0.4.0/cml/experimental/cause_band.py +177 -0
- causal_memory_layer-0.4.0/cml/experimental/cause_band_payload.py +16 -0
- causal_memory_layer-0.4.0/cml/experimental/cause_band_trajectory.py +47 -0
- causal_memory_layer-0.4.0/cml/integrations/__init__.py +1 -0
- causal_memory_layer-0.4.0/cml/integrations/mcp/__init__.py +1 -0
- causal_memory_layer-0.4.0/cml/integrations/mcp/core.py +55 -0
- causal_memory_layer-0.4.0/cml/integrations/mcp/server.py +57 -0
- causal_memory_layer-0.4.0/cml/record.py +196 -0
- causal_memory_layer-0.4.0/cml/report.py +132 -0
- causal_memory_layer-0.4.0/cml/safety_eval.py +189 -0
- causal_memory_layer-0.4.0/pyproject.toml +73 -0
- causal_memory_layer-0.4.0/setup.cfg +4 -0
- causal_memory_layer-0.4.0/tests/test_api_audit_semantics.py +122 -0
- causal_memory_layer-0.4.0/tests/test_api_rate_limit.py +228 -0
- causal_memory_layer-0.4.0/tests/test_api_security.py +279 -0
- causal_memory_layer-0.4.0/tests/test_api_smoke.py +46 -0
- causal_memory_layer-0.4.0/tests/test_audit.py +425 -0
- causal_memory_layer-0.4.0/tests/test_chain.py +98 -0
- causal_memory_layer-0.4.0/tests/test_cli_audit.py +105 -0
- causal_memory_layer-0.4.0/tests/test_cli_main.py +70 -0
- causal_memory_layer-0.4.0/tests/test_ctag.py +161 -0
- causal_memory_layer-0.4.0/tests/test_experimental_cause_band_eval.py +205 -0
- causal_memory_layer-0.4.0/tests/test_mcp_core.py +71 -0
- causal_memory_layer-0.4.0/tests/test_record.py +54 -0
- causal_memory_layer-0.4.0/tests/test_run_safety_eval_script.py +21 -0
- causal_memory_layer-0.4.0/tests/test_safety_eval.py +51 -0
- causal_memory_layer-0.4.0/tests/test_safety_eval_snapshot.py +10 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aleksey Safonov
|
|
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,74 @@
|
|
|
1
|
+
# CML Commercial License
|
|
2
|
+
|
|
3
|
+
> **DRAFT** — Commercial licensing terms are not yet finalised.
|
|
4
|
+
> The MIT-licensed SDK is available today. Pro/Enterprise terms will be
|
|
5
|
+
> published at v0.8 general availability.
|
|
6
|
+
|
|
7
|
+
## Open Core Model
|
|
8
|
+
|
|
9
|
+
The Causal Memory Layer project operates under a dual-license model:
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### 1. MIT License (Community)
|
|
14
|
+
|
|
15
|
+
All code in the following paths is licensed under the **MIT License**
|
|
16
|
+
(see `LICENSE`):
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
cml/ — Core Python SDK
|
|
20
|
+
cli/ — CLI tool
|
|
21
|
+
api/ — REST API server
|
|
22
|
+
vcml/ — Reference implementation and specifications
|
|
23
|
+
examples/ — Example logs and configurations
|
|
24
|
+
tests/ — Test suite
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You may use, copy, modify, distribute, and sublicense this code freely,
|
|
28
|
+
including in commercial products, subject to the MIT License terms.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### 2. Commercial License (Pro / Enterprise)
|
|
33
|
+
|
|
34
|
+
The following components are available under a **commercial license** for
|
|
35
|
+
Pro and Enterprise customers:
|
|
36
|
+
|
|
37
|
+
| Component | Description |
|
|
38
|
+
|-----------|-------------|
|
|
39
|
+
| `enterprise/compliance/` | SOC 2 / GDPR / PCI-DSS report generators |
|
|
40
|
+
| `enterprise/multi_tenant/` | Multi-tenant log isolation and cross-domain audit |
|
|
41
|
+
| `enterprise/integrations/` | SIEM, Splunk, Datadog, Elastic connectors |
|
|
42
|
+
| `enterprise/pdf_reports/` | PDF compliance report rendering |
|
|
43
|
+
| Hosted API infrastructure | Managed service, persistent storage, SLA |
|
|
44
|
+
|
|
45
|
+
To obtain a commercial license, contact: **enterprise@causal-memory.dev**
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### 3. Attribution
|
|
50
|
+
|
|
51
|
+
If you use CML in a published product, paper, or service, we ask (but do not
|
|
52
|
+
require) that you include the following attribution:
|
|
53
|
+
|
|
54
|
+
> "Causal provenance powered by Causal Memory Layer (CML)"
|
|
55
|
+
> https://github.com/safal207/Causal-Memory-Layer
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 4. Patent Notice
|
|
60
|
+
|
|
61
|
+
No patent rights are granted or implied by the MIT License.
|
|
62
|
+
If you build a product based on CML semantics, we encourage contribution
|
|
63
|
+
back to the specification and community.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### 5. Trademark
|
|
68
|
+
|
|
69
|
+
"Causal Memory Layer", "CML", and "vCML" are project identifiers.
|
|
70
|
+
You may not use them to imply official endorsement without permission.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
For licensing questions: **legal@causal-memory.dev**
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: causal-memory-layer
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Causal Memory Layer — SDK for recording, auditing, and analyzing causal chains in systems
|
|
5
|
+
Author-email: CML Project <dev@causal-memory.dev>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Aleksey Safonov
|
|
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/safal207/Causal-Memory-Layer
|
|
29
|
+
Project-URL: Repository, https://github.com/safal207/Causal-Memory-Layer
|
|
30
|
+
Project-URL: Issues, https://github.com/safal207/Causal-Memory-Layer/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/safal207/Causal-Memory-Layer/blob/main/ROADMAP.md
|
|
32
|
+
Keywords: causal,audit,provenance,security,compliance,ebpf,tracing,causal-memory,ai-governance
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: Intended Audience :: Information Technology
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Topic :: Security
|
|
42
|
+
Classifier: Topic :: System :: Logging
|
|
43
|
+
Classifier: Topic :: System :: Monitoring
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
License-File: LICENSE_COMMERCIAL.md
|
|
48
|
+
Requires-Dist: pyyaml>=6.0
|
|
49
|
+
Provides-Extra: api
|
|
50
|
+
Requires-Dist: fastapi>=0.110; extra == "api"
|
|
51
|
+
Requires-Dist: httpx>=0.27; extra == "api"
|
|
52
|
+
Requires-Dist: uvicorn[standard]>=0.29; extra == "api"
|
|
53
|
+
Requires-Dist: python-multipart>=0.0.9; extra == "api"
|
|
54
|
+
Requires-Dist: slowapi>=0.1.9; extra == "api"
|
|
55
|
+
Provides-Extra: mcp
|
|
56
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
59
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
60
|
+
Requires-Dist: fastapi>=0.110; extra == "dev"
|
|
61
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
62
|
+
Requires-Dist: uvicorn[standard]>=0.29; extra == "dev"
|
|
63
|
+
Requires-Dist: python-multipart>=0.0.9; extra == "dev"
|
|
64
|
+
Requires-Dist: slowapi>=0.1.9; extra == "dev"
|
|
65
|
+
Dynamic: license-file
|
|
66
|
+
|
|
67
|
+
# Causal Memory Layer (CML)
|
|
68
|
+
|
|
69
|
+
[](https://github.com/safal207/Causal-Memory-Layer/actions/workflows/ci.yml)
|
|
70
|
+
[](https://github.com/safal207/Causal-Memory-Layer/actions/workflows/python-package-validation.yml)
|
|
71
|
+

|
|
72
|
+

|
|
73
|
+

|
|
74
|
+
[](docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md)
|
|
75
|
+
|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
## Why CML?
|
|
79
|
+
|
|
80
|
+
**Logs show what happened. CML checks why it was allowed.**
|
|
81
|
+
|
|
82
|
+
A workflow can pass every functional test and still be causally invalid: the action succeeded, but the approval, intent, or responsibility lineage is missing, ambiguous, or broken.
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
ordinary log: action completed -> OK
|
|
86
|
+
CML audit: parent_cause=approval-42 -> MISSING_PARENT
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
CML is an open-source causal audit layer for structured action traces, AI-agent workflows, high-trust automation, and reviewable safety infrastructure.
|
|
90
|
+
|
|
91
|
+
> A system may be functionally correct while being causally invalid.
|
|
92
|
+
|
|
93
|
+
**Star this repo if you care about auditable AI agents, deterministic oversight, causal traces, and open-source AI safety infrastructure.**
|
|
94
|
+
|
|
95
|
+
## 30-second demo
|
|
96
|
+
|
|
97
|
+
Run the local API:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
docker compose up --build
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then follow the Docker walkthrough:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Expected example finding:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
CML-AUDIT-R1-MISSING_PARENT
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The action may look operationally valid, but CML asks whether its causal parent exists.
|
|
116
|
+
|
|
117
|
+
## Use CML when you need to audit
|
|
118
|
+
|
|
119
|
+
- AI-agent tool calls and action chains.
|
|
120
|
+
- Human approval handoffs.
|
|
121
|
+
- Automation workflows with high-trust actions.
|
|
122
|
+
- Fintech or review-heavy decision paths.
|
|
123
|
+
- Structured traces where responsibility lineage matters.
|
|
124
|
+
- Research benchmarks for causal validity in agentic systems.
|
|
125
|
+
|
|
126
|
+
## Agent-audit MCP integration
|
|
127
|
+
|
|
128
|
+
CML can also run as an experimental MCP tool server for AI-agent audit workflows.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install -e ".[mcp]"
|
|
132
|
+
cml-mcp
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
See [`docs/integrations/MCP_AGENT_AUDIT.md`](docs/integrations/MCP_AGENT_AUDIT.md) for local MCP client setup and available tools.
|
|
136
|
+
|
|
137
|
+
For a short coding-assistant setup path, see [`docs/integrations/CURSOR_MCP_QUICKSTART.md`](docs/integrations/CURSOR_MCP_QUICKSTART.md).
|
|
138
|
+
|
|
139
|
+
## How CML differs
|
|
140
|
+
|
|
141
|
+
| System type | Usually answers | CML adds |
|
|
142
|
+
| :--- | :--- | :--- |
|
|
143
|
+
| Logs | What happened? | Was the action causally permitted? |
|
|
144
|
+
| Tracing | Where did execution go? | Did responsibility lineage survive the workflow? |
|
|
145
|
+
| Observability | What failed operationally? | What succeeded but had broken causal lineage? |
|
|
146
|
+
| Policy checks | Is this allowed now? | Why was this specific action allowed in this trace? |
|
|
147
|
+
| CML | Why was this action allowed? | Narrow audit primitive, not a full runtime safety stack. |
|
|
148
|
+
|
|
149
|
+
## Fast validation
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install -e ".[dev]"
|
|
153
|
+
pytest
|
|
154
|
+
python scripts/run_safety_eval.py
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Dashboard:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
https://safal207.github.io/Causal-Memory-Layer/
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Review links
|
|
164
|
+
|
|
165
|
+
- Start here: [`docs/START_HERE.md`](docs/START_HERE.md)
|
|
166
|
+
- Reviewer path: [`docs/REVIEWER_PATH.md`](docs/REVIEWER_PATH.md)
|
|
167
|
+
- Research map: [`docs/research/CML_RESEARCH_MAP.md`](docs/research/CML_RESEARCH_MAP.md)
|
|
168
|
+
- Non-claims: [`docs/NON_CLAIMS.md`](docs/NON_CLAIMS.md)
|
|
169
|
+
- Portfolio relationship: [`docs/PORTFOLIO_RELATIONSHIP.md`](docs/PORTFOLIO_RELATIONSHIP.md)
|
|
170
|
+
- Benchmark evidence: [`docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md`](docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md)
|
|
171
|
+
- External validation protocol: [`docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md`](docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md)
|
|
172
|
+
- Technical report outline: [`docs/research/TECHNICAL_REPORT_OUTLINE.md`](docs/research/TECHNICAL_REPORT_OUTLINE.md)
|
|
173
|
+
- Funding / research evidence: [`docs/GRANT_EVIDENCE.md`](docs/GRANT_EVIDENCE.md)
|
|
174
|
+
- Docker walkthrough: [`docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md`](docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md)
|
|
175
|
+
- MCP agent-audit integration: [`docs/integrations/MCP_AGENT_AUDIT.md`](docs/integrations/MCP_AGENT_AUDIT.md)
|
|
176
|
+
- Cursor MCP quickstart: [`docs/integrations/CURSOR_MCP_QUICKSTART.md`](docs/integrations/CURSOR_MCP_QUICKSTART.md)
|
|
177
|
+
- Cause Band concept: [`docs/research/CAUSE_BAND.md`](docs/research/CAUSE_BAND.md)
|
|
178
|
+
- Cause Band trajectory walkthrough: [`docs/demo/CAUSE_BAND_TRAJECTORY_WALKTHROUGH.md`](docs/demo/CAUSE_BAND_TRAJECTORY_WALKTHROUGH.md)
|
|
179
|
+
- Agent intent drift example: [`docs/demo/AGENT_INTENT_DRIFT_CAUSE_BAND_EXAMPLE.md`](docs/demo/AGENT_INTENT_DRIFT_CAUSE_BAND_EXAMPLE.md)
|
|
180
|
+
- Dormant Causal Patterns: [`docs/research/DORMANT_CAUSAL_PATTERNS.md`](docs/research/DORMANT_CAUSAL_PATTERNS.md)
|
|
181
|
+
- Temporal Causal Watchpoints: [`docs/research/TEMPORAL_CAUSAL_WATCHPOINTS.md`](docs/research/TEMPORAL_CAUSAL_WATCHPOINTS.md)
|
|
182
|
+
- Experimental Cause Band audit flag: [`docs/experimental/CAUSE_BAND_AUDIT_FLAG.md`](docs/experimental/CAUSE_BAND_AUDIT_FLAG.md)
|
|
183
|
+
- Quantum causal audit future direction: [`docs/research/QUANTUM_CAUSAL_AUDIT_FUTURE_DIRECTION.md`](docs/research/QUANTUM_CAUSAL_AUDIT_FUTURE_DIRECTION.md)
|
|
184
|
+
- Causal invalidity patterns: [`docs/research/CAUSAL_INVALIDITY_PATTERNS.md`](docs/research/CAUSAL_INVALIDITY_PATTERNS.md)
|
|
185
|
+
- Audit findings glossary: [`docs/audit/FINDINGS_GLOSSARY.md`](docs/audit/FINDINGS_GLOSSARY.md)
|
|
186
|
+
- LTP / CML bridge: [`docs/LTP_CML_BRIDGE.md`](docs/LTP_CML_BRIDGE.md)
|
|
187
|
+
- Roadmap: [`ROADMAP.md`](ROADMAP.md)
|
|
188
|
+
- Security: [`SECURITY.md`](SECURITY.md)
|
|
189
|
+
- License: [`LICENSE`](LICENSE)
|
|
190
|
+
|
|
191
|
+
## Current artifact
|
|
192
|
+
|
|
193
|
+
This repository already contains a working technical artifact, not only a concept.
|
|
194
|
+
|
|
195
|
+
Current components include:
|
|
196
|
+
|
|
197
|
+
- Python causal validation and audit engine;
|
|
198
|
+
- causal chain reconstruction utilities;
|
|
199
|
+
- CLI commands for lineage validation and chain inspection;
|
|
200
|
+
- API layer and store interface;
|
|
201
|
+
- example logs and audit outputs;
|
|
202
|
+
- tests for chain logic, audit rules, and CTAG behavior;
|
|
203
|
+
- API smoke tests for health, audit, and CTAG decode;
|
|
204
|
+
- deterministic safety-eval benchmark with fixtures and tracked results;
|
|
205
|
+
- documentation for vCML semantics and audit rules.
|
|
206
|
+
|
|
207
|
+
Key implementation entry points:
|
|
208
|
+
|
|
209
|
+
- `cml/audit.py`
|
|
210
|
+
- `cml/chain.py`
|
|
211
|
+
- `cli/main.py`
|
|
212
|
+
- `api/server.py`
|
|
213
|
+
- `tests/test_audit.py`
|
|
214
|
+
- `tests/test_api_smoke.py`
|
|
215
|
+
|
|
216
|
+
## Problem
|
|
217
|
+
|
|
218
|
+
Many systems record events, outputs, traces, and metrics, but do not validate the causal structure behind authorization and action.
|
|
219
|
+
|
|
220
|
+
That creates blind spots such as:
|
|
221
|
+
|
|
222
|
+
- actions that appear valid but have no grounded parent cause;
|
|
223
|
+
- ambiguous or malformed root authority;
|
|
224
|
+
- actions that succeed operationally while losing approval lineage;
|
|
225
|
+
- state transitions that cannot be tied back to intent, permission, and responsibility.
|
|
226
|
+
|
|
227
|
+
For agentic systems, this matters because output review alone can miss causally invalid action chains.
|
|
228
|
+
|
|
229
|
+
## What CML does
|
|
230
|
+
|
|
231
|
+
CML checks whether a high-trust action or state transition was causally valid, not only whether it occurred.
|
|
232
|
+
|
|
233
|
+
It focuses on:
|
|
234
|
+
|
|
235
|
+
- validating causal links between actions and prior authorization;
|
|
236
|
+
- preserving responsibility lineage across multi-step workflows;
|
|
237
|
+
- checking intent and permission continuity across transitions;
|
|
238
|
+
- detecting suspicious or invalid lineage such as missing parents, malformed roots, or broken handoffs;
|
|
239
|
+
- validating causal coherence from structured logs and traces.
|
|
240
|
+
|
|
241
|
+
## Evidence snapshot
|
|
242
|
+
|
|
243
|
+
- Deterministic benchmark fixtures with expected audit findings: `benchmarks/fixtures/`
|
|
244
|
+
- Current tracked benchmark result: `6/6 matched`
|
|
245
|
+
- Benchmark runner: `python scripts/run_safety_eval.py`
|
|
246
|
+
- Tracked report: `benchmarks/RESULTS.md`
|
|
247
|
+
- Reviewer-friendly benchmark interpretation: `docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md`
|
|
248
|
+
- Larger-grant expansion path: `docs/evidence/BENCHMARK_EXPANSION_PLAN_50K_100K.md`
|
|
249
|
+
- External validation protocol: `docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md`
|
|
250
|
+
|
|
251
|
+
## External reproducibility evidence
|
|
252
|
+
|
|
253
|
+
External validation notes will be listed here as they are contributed.
|
|
254
|
+
|
|
255
|
+
Current external validation tasks:
|
|
256
|
+
|
|
257
|
+
- Full local validation path: [`#77`](https://github.com/safal207/Causal-Memory-Layer/issues/77)
|
|
258
|
+
- MCP demo runner validation: [`#123`](https://github.com/safal207/Causal-Memory-Layer/issues/123)
|
|
259
|
+
|
|
260
|
+
Validation note template:
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
docs/evidence/external_validation/TEMPLATE_MCP_DEMO_RUNNER.md
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
This section is intentionally evidence-first: it should only list external notes after they are contributed. It does not claim production safety, compliance readiness, enforcement behavior, or stable Cause Band semantics.
|
|
267
|
+
|
|
268
|
+
## Repository map
|
|
269
|
+
|
|
270
|
+
- `cml/`: core Python implementation
|
|
271
|
+
- `cli/`: command-line tooling
|
|
272
|
+
- `api/`: API and store layer
|
|
273
|
+
- `vcml/`: vCML semantics, format, audit, and boundary docs
|
|
274
|
+
- `examples/`: sample logs and reports
|
|
275
|
+
- `benchmarks/`: deterministic benchmark fixtures and results
|
|
276
|
+
- `tests/`: regression coverage
|
|
277
|
+
- `docs/`: supporting docs for review, research, and deployment
|
|
278
|
+
|
|
279
|
+
## Scope
|
|
280
|
+
|
|
281
|
+
CML does not claim to solve all AI safety, security, or compliance problems.
|
|
282
|
+
|
|
283
|
+
It contributes one focused primitive:
|
|
284
|
+
|
|
285
|
+
```text
|
|
286
|
+
causal-validity checking for structured action traces
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
See [`docs/NON_CLAIMS.md`](docs/NON_CLAIMS.md) for the full scope boundary.
|
|
290
|
+
|
|
291
|
+
## Research direction
|
|
292
|
+
|
|
293
|
+
The strongest research direction for CML is causal validity checking for agentic oversight.
|
|
294
|
+
|
|
295
|
+
A useful framing is:
|
|
296
|
+
|
|
297
|
+
> How can we detect actions that appear valid at the surface level but are causally invalid because authorization, approval, or responsibility lineage is missing, ambiguous, or broken?
|
|
298
|
+
|
|
299
|
+
## Bottom line
|
|
300
|
+
|
|
301
|
+
A system may be functionally correct while being causally invalid.
|
|
302
|
+
|
|
303
|
+
CML exists to make that distinction inspectable.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Causal Memory Layer (CML)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/safal207/Causal-Memory-Layer/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/safal207/Causal-Memory-Layer/actions/workflows/python-package-validation.yml)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
[](docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md)
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Why CML?
|
|
13
|
+
|
|
14
|
+
**Logs show what happened. CML checks why it was allowed.**
|
|
15
|
+
|
|
16
|
+
A workflow can pass every functional test and still be causally invalid: the action succeeded, but the approval, intent, or responsibility lineage is missing, ambiguous, or broken.
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
ordinary log: action completed -> OK
|
|
20
|
+
CML audit: parent_cause=approval-42 -> MISSING_PARENT
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
CML is an open-source causal audit layer for structured action traces, AI-agent workflows, high-trust automation, and reviewable safety infrastructure.
|
|
24
|
+
|
|
25
|
+
> A system may be functionally correct while being causally invalid.
|
|
26
|
+
|
|
27
|
+
**Star this repo if you care about auditable AI agents, deterministic oversight, causal traces, and open-source AI safety infrastructure.**
|
|
28
|
+
|
|
29
|
+
## 30-second demo
|
|
30
|
+
|
|
31
|
+
Run the local API:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
docker compose up --build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then follow the Docker walkthrough:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Expected example finding:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
CML-AUDIT-R1-MISSING_PARENT
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The action may look operationally valid, but CML asks whether its causal parent exists.
|
|
50
|
+
|
|
51
|
+
## Use CML when you need to audit
|
|
52
|
+
|
|
53
|
+
- AI-agent tool calls and action chains.
|
|
54
|
+
- Human approval handoffs.
|
|
55
|
+
- Automation workflows with high-trust actions.
|
|
56
|
+
- Fintech or review-heavy decision paths.
|
|
57
|
+
- Structured traces where responsibility lineage matters.
|
|
58
|
+
- Research benchmarks for causal validity in agentic systems.
|
|
59
|
+
|
|
60
|
+
## Agent-audit MCP integration
|
|
61
|
+
|
|
62
|
+
CML can also run as an experimental MCP tool server for AI-agent audit workflows.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e ".[mcp]"
|
|
66
|
+
cml-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
See [`docs/integrations/MCP_AGENT_AUDIT.md`](docs/integrations/MCP_AGENT_AUDIT.md) for local MCP client setup and available tools.
|
|
70
|
+
|
|
71
|
+
For a short coding-assistant setup path, see [`docs/integrations/CURSOR_MCP_QUICKSTART.md`](docs/integrations/CURSOR_MCP_QUICKSTART.md).
|
|
72
|
+
|
|
73
|
+
## How CML differs
|
|
74
|
+
|
|
75
|
+
| System type | Usually answers | CML adds |
|
|
76
|
+
| :--- | :--- | :--- |
|
|
77
|
+
| Logs | What happened? | Was the action causally permitted? |
|
|
78
|
+
| Tracing | Where did execution go? | Did responsibility lineage survive the workflow? |
|
|
79
|
+
| Observability | What failed operationally? | What succeeded but had broken causal lineage? |
|
|
80
|
+
| Policy checks | Is this allowed now? | Why was this specific action allowed in this trace? |
|
|
81
|
+
| CML | Why was this action allowed? | Narrow audit primitive, not a full runtime safety stack. |
|
|
82
|
+
|
|
83
|
+
## Fast validation
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install -e ".[dev]"
|
|
87
|
+
pytest
|
|
88
|
+
python scripts/run_safety_eval.py
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Dashboard:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
https://safal207.github.io/Causal-Memory-Layer/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Review links
|
|
98
|
+
|
|
99
|
+
- Start here: [`docs/START_HERE.md`](docs/START_HERE.md)
|
|
100
|
+
- Reviewer path: [`docs/REVIEWER_PATH.md`](docs/REVIEWER_PATH.md)
|
|
101
|
+
- Research map: [`docs/research/CML_RESEARCH_MAP.md`](docs/research/CML_RESEARCH_MAP.md)
|
|
102
|
+
- Non-claims: [`docs/NON_CLAIMS.md`](docs/NON_CLAIMS.md)
|
|
103
|
+
- Portfolio relationship: [`docs/PORTFOLIO_RELATIONSHIP.md`](docs/PORTFOLIO_RELATIONSHIP.md)
|
|
104
|
+
- Benchmark evidence: [`docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md`](docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md)
|
|
105
|
+
- External validation protocol: [`docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md`](docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md)
|
|
106
|
+
- Technical report outline: [`docs/research/TECHNICAL_REPORT_OUTLINE.md`](docs/research/TECHNICAL_REPORT_OUTLINE.md)
|
|
107
|
+
- Funding / research evidence: [`docs/GRANT_EVIDENCE.md`](docs/GRANT_EVIDENCE.md)
|
|
108
|
+
- Docker walkthrough: [`docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md`](docs/demo/DOCKER_CAUSAL_MEMORY_WALKTHROUGH.md)
|
|
109
|
+
- MCP agent-audit integration: [`docs/integrations/MCP_AGENT_AUDIT.md`](docs/integrations/MCP_AGENT_AUDIT.md)
|
|
110
|
+
- Cursor MCP quickstart: [`docs/integrations/CURSOR_MCP_QUICKSTART.md`](docs/integrations/CURSOR_MCP_QUICKSTART.md)
|
|
111
|
+
- Cause Band concept: [`docs/research/CAUSE_BAND.md`](docs/research/CAUSE_BAND.md)
|
|
112
|
+
- Cause Band trajectory walkthrough: [`docs/demo/CAUSE_BAND_TRAJECTORY_WALKTHROUGH.md`](docs/demo/CAUSE_BAND_TRAJECTORY_WALKTHROUGH.md)
|
|
113
|
+
- Agent intent drift example: [`docs/demo/AGENT_INTENT_DRIFT_CAUSE_BAND_EXAMPLE.md`](docs/demo/AGENT_INTENT_DRIFT_CAUSE_BAND_EXAMPLE.md)
|
|
114
|
+
- Dormant Causal Patterns: [`docs/research/DORMANT_CAUSAL_PATTERNS.md`](docs/research/DORMANT_CAUSAL_PATTERNS.md)
|
|
115
|
+
- Temporal Causal Watchpoints: [`docs/research/TEMPORAL_CAUSAL_WATCHPOINTS.md`](docs/research/TEMPORAL_CAUSAL_WATCHPOINTS.md)
|
|
116
|
+
- Experimental Cause Band audit flag: [`docs/experimental/CAUSE_BAND_AUDIT_FLAG.md`](docs/experimental/CAUSE_BAND_AUDIT_FLAG.md)
|
|
117
|
+
- Quantum causal audit future direction: [`docs/research/QUANTUM_CAUSAL_AUDIT_FUTURE_DIRECTION.md`](docs/research/QUANTUM_CAUSAL_AUDIT_FUTURE_DIRECTION.md)
|
|
118
|
+
- Causal invalidity patterns: [`docs/research/CAUSAL_INVALIDITY_PATTERNS.md`](docs/research/CAUSAL_INVALIDITY_PATTERNS.md)
|
|
119
|
+
- Audit findings glossary: [`docs/audit/FINDINGS_GLOSSARY.md`](docs/audit/FINDINGS_GLOSSARY.md)
|
|
120
|
+
- LTP / CML bridge: [`docs/LTP_CML_BRIDGE.md`](docs/LTP_CML_BRIDGE.md)
|
|
121
|
+
- Roadmap: [`ROADMAP.md`](ROADMAP.md)
|
|
122
|
+
- Security: [`SECURITY.md`](SECURITY.md)
|
|
123
|
+
- License: [`LICENSE`](LICENSE)
|
|
124
|
+
|
|
125
|
+
## Current artifact
|
|
126
|
+
|
|
127
|
+
This repository already contains a working technical artifact, not only a concept.
|
|
128
|
+
|
|
129
|
+
Current components include:
|
|
130
|
+
|
|
131
|
+
- Python causal validation and audit engine;
|
|
132
|
+
- causal chain reconstruction utilities;
|
|
133
|
+
- CLI commands for lineage validation and chain inspection;
|
|
134
|
+
- API layer and store interface;
|
|
135
|
+
- example logs and audit outputs;
|
|
136
|
+
- tests for chain logic, audit rules, and CTAG behavior;
|
|
137
|
+
- API smoke tests for health, audit, and CTAG decode;
|
|
138
|
+
- deterministic safety-eval benchmark with fixtures and tracked results;
|
|
139
|
+
- documentation for vCML semantics and audit rules.
|
|
140
|
+
|
|
141
|
+
Key implementation entry points:
|
|
142
|
+
|
|
143
|
+
- `cml/audit.py`
|
|
144
|
+
- `cml/chain.py`
|
|
145
|
+
- `cli/main.py`
|
|
146
|
+
- `api/server.py`
|
|
147
|
+
- `tests/test_audit.py`
|
|
148
|
+
- `tests/test_api_smoke.py`
|
|
149
|
+
|
|
150
|
+
## Problem
|
|
151
|
+
|
|
152
|
+
Many systems record events, outputs, traces, and metrics, but do not validate the causal structure behind authorization and action.
|
|
153
|
+
|
|
154
|
+
That creates blind spots such as:
|
|
155
|
+
|
|
156
|
+
- actions that appear valid but have no grounded parent cause;
|
|
157
|
+
- ambiguous or malformed root authority;
|
|
158
|
+
- actions that succeed operationally while losing approval lineage;
|
|
159
|
+
- state transitions that cannot be tied back to intent, permission, and responsibility.
|
|
160
|
+
|
|
161
|
+
For agentic systems, this matters because output review alone can miss causally invalid action chains.
|
|
162
|
+
|
|
163
|
+
## What CML does
|
|
164
|
+
|
|
165
|
+
CML checks whether a high-trust action or state transition was causally valid, not only whether it occurred.
|
|
166
|
+
|
|
167
|
+
It focuses on:
|
|
168
|
+
|
|
169
|
+
- validating causal links between actions and prior authorization;
|
|
170
|
+
- preserving responsibility lineage across multi-step workflows;
|
|
171
|
+
- checking intent and permission continuity across transitions;
|
|
172
|
+
- detecting suspicious or invalid lineage such as missing parents, malformed roots, or broken handoffs;
|
|
173
|
+
- validating causal coherence from structured logs and traces.
|
|
174
|
+
|
|
175
|
+
## Evidence snapshot
|
|
176
|
+
|
|
177
|
+
- Deterministic benchmark fixtures with expected audit findings: `benchmarks/fixtures/`
|
|
178
|
+
- Current tracked benchmark result: `6/6 matched`
|
|
179
|
+
- Benchmark runner: `python scripts/run_safety_eval.py`
|
|
180
|
+
- Tracked report: `benchmarks/RESULTS.md`
|
|
181
|
+
- Reviewer-friendly benchmark interpretation: `docs/evidence/BENCHMARK_EVIDENCE_SNAPSHOT.md`
|
|
182
|
+
- Larger-grant expansion path: `docs/evidence/BENCHMARK_EXPANSION_PLAN_50K_100K.md`
|
|
183
|
+
- External validation protocol: `docs/evidence/EXTERNAL_VALIDATION_PROTOCOL.md`
|
|
184
|
+
|
|
185
|
+
## External reproducibility evidence
|
|
186
|
+
|
|
187
|
+
External validation notes will be listed here as they are contributed.
|
|
188
|
+
|
|
189
|
+
Current external validation tasks:
|
|
190
|
+
|
|
191
|
+
- Full local validation path: [`#77`](https://github.com/safal207/Causal-Memory-Layer/issues/77)
|
|
192
|
+
- MCP demo runner validation: [`#123`](https://github.com/safal207/Causal-Memory-Layer/issues/123)
|
|
193
|
+
|
|
194
|
+
Validation note template:
|
|
195
|
+
|
|
196
|
+
```text
|
|
197
|
+
docs/evidence/external_validation/TEMPLATE_MCP_DEMO_RUNNER.md
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
This section is intentionally evidence-first: it should only list external notes after they are contributed. It does not claim production safety, compliance readiness, enforcement behavior, or stable Cause Band semantics.
|
|
201
|
+
|
|
202
|
+
## Repository map
|
|
203
|
+
|
|
204
|
+
- `cml/`: core Python implementation
|
|
205
|
+
- `cli/`: command-line tooling
|
|
206
|
+
- `api/`: API and store layer
|
|
207
|
+
- `vcml/`: vCML semantics, format, audit, and boundary docs
|
|
208
|
+
- `examples/`: sample logs and reports
|
|
209
|
+
- `benchmarks/`: deterministic benchmark fixtures and results
|
|
210
|
+
- `tests/`: regression coverage
|
|
211
|
+
- `docs/`: supporting docs for review, research, and deployment
|
|
212
|
+
|
|
213
|
+
## Scope
|
|
214
|
+
|
|
215
|
+
CML does not claim to solve all AI safety, security, or compliance problems.
|
|
216
|
+
|
|
217
|
+
It contributes one focused primitive:
|
|
218
|
+
|
|
219
|
+
```text
|
|
220
|
+
causal-validity checking for structured action traces
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
See [`docs/NON_CLAIMS.md`](docs/NON_CLAIMS.md) for the full scope boundary.
|
|
224
|
+
|
|
225
|
+
## Research direction
|
|
226
|
+
|
|
227
|
+
The strongest research direction for CML is causal validity checking for agentic oversight.
|
|
228
|
+
|
|
229
|
+
A useful framing is:
|
|
230
|
+
|
|
231
|
+
> How can we detect actions that appear valid at the surface level but are causally invalid because authorization, approval, or responsibility lineage is missing, ambiguous, or broken?
|
|
232
|
+
|
|
233
|
+
## Bottom line
|
|
234
|
+
|
|
235
|
+
A system may be functionally correct while being causally invalid.
|
|
236
|
+
|
|
237
|
+
CML exists to make that distinction inspectable.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# api package
|