clinicalguard 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.
- clinicalguard-1.0.0/.gitignore +131 -0
- clinicalguard-1.0.0/Dockerfile +48 -0
- clinicalguard-1.0.0/PKG-INFO +125 -0
- clinicalguard-1.0.0/README.md +94 -0
- clinicalguard-1.0.0/__init__.py +9 -0
- clinicalguard-1.0.0/agent.py +497 -0
- clinicalguard-1.0.0/constitution/healthcare_v1.yaml +344 -0
- clinicalguard-1.0.0/docs/clinicalguard-one-pager.md +33 -0
- clinicalguard-1.0.0/docs/deployment.md +83 -0
- clinicalguard-1.0.0/main.py +44 -0
- clinicalguard-1.0.0/pyproject.toml +44 -0
- clinicalguard-1.0.0/setup.py +3 -0
- clinicalguard-1.0.0/site/index.html +193 -0
- clinicalguard-1.0.0/skills/__init__.py +0 -0
- clinicalguard-1.0.0/skills/audit_query.py +62 -0
- clinicalguard-1.0.0/skills/healthcare_validators.py +302 -0
- clinicalguard-1.0.0/skills/hipaa_checker.py +121 -0
- clinicalguard-1.0.0/skills/validate_clinical.py +482 -0
- clinicalguard-1.0.0/tests/__init__.py +0 -0
- clinicalguard-1.0.0/tests/test_a2a_protocol.py +225 -0
- clinicalguard-1.0.0/tests/test_adversarial.py +610 -0
- clinicalguard-1.0.0/tests/test_demo_scenarios.py +354 -0
- clinicalguard-1.0.0/tests/test_healthcare_validators.py +239 -0
- clinicalguard-1.0.0/tests/test_validate_clinical.py +226 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Build artifacts
|
|
2
|
+
**/target/
|
|
3
|
+
dist/
|
|
4
|
+
build/
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.pyc
|
|
9
|
+
*.pyo
|
|
10
|
+
*.egg-info/
|
|
11
|
+
*.so
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.mypy_cache/
|
|
14
|
+
|
|
15
|
+
# Coverage
|
|
16
|
+
.coverage
|
|
17
|
+
coverage.json
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# Databases / local state
|
|
21
|
+
*.db
|
|
22
|
+
mlruns/
|
|
23
|
+
|
|
24
|
+
# Codex CLI
|
|
25
|
+
.codex-home/
|
|
26
|
+
.codex-readiness-unit-test/
|
|
27
|
+
.codex_write_check
|
|
28
|
+
|
|
29
|
+
# AI agent / coding-assistant dev stacks (local tooling, not project source)
|
|
30
|
+
.gstack/
|
|
31
|
+
.openclaw/
|
|
32
|
+
.agents/
|
|
33
|
+
!.agents/
|
|
34
|
+
!.agents/archive/
|
|
35
|
+
!.agents/archive/**
|
|
36
|
+
!.agents/skills/
|
|
37
|
+
!.agents/skills/**
|
|
38
|
+
.claude/
|
|
39
|
+
.mcp.json
|
|
40
|
+
.playwright-cli/
|
|
41
|
+
|
|
42
|
+
# Research / paper artefacts (local LaTeX workspace)
|
|
43
|
+
src/research/docs/research/
|
|
44
|
+
docs/papers/
|
|
45
|
+
docs/generated/
|
|
46
|
+
|
|
47
|
+
# Autoresearch experiment logs & scratch files
|
|
48
|
+
autoresearch/run_perf_*.log
|
|
49
|
+
autoresearch/candidate_scenarios/*
|
|
50
|
+
!autoresearch/candidate_scenarios/
|
|
51
|
+
!autoresearch/candidate_scenarios/*.json
|
|
52
|
+
!autoresearch/candidate_scenarios/*.patch
|
|
53
|
+
autoresearch/paper_extracts/
|
|
54
|
+
autoresearch/raw_dataset_adapter.md
|
|
55
|
+
autoresearch/build_paper_adapter_manifest.py
|
|
56
|
+
autoresearch/render_candidate_promotion_patch.py
|
|
57
|
+
autoresearch/review_candidate_promotion.py
|
|
58
|
+
autoresearch/sourced_pack_review.md
|
|
59
|
+
|
|
60
|
+
# Playwright / browser automation local cache
|
|
61
|
+
packages/acgs-lite/.playwright-cli/
|
|
62
|
+
packages/acgs-lite/output/
|
|
63
|
+
|
|
64
|
+
# Identity / personality prompts (local agent configuration)
|
|
65
|
+
HEARTBEAT.md
|
|
66
|
+
IDENTITY.md
|
|
67
|
+
SOUL.md
|
|
68
|
+
TOOLS.md
|
|
69
|
+
USER.md
|
|
70
|
+
prompts/
|
|
71
|
+
|
|
72
|
+
# Local dev docs
|
|
73
|
+
claudedocs/enhanced-agent-bus-reorg-plan-20260321.md
|
|
74
|
+
docs/brand-architecture.md
|
|
75
|
+
|
|
76
|
+
# Demo harness
|
|
77
|
+
demo/
|
|
78
|
+
|
|
79
|
+
# One-off scripts
|
|
80
|
+
scripts/generate_project_technical_breakthroughs_pdf.py
|
|
81
|
+
scripts/package_health.py
|
|
82
|
+
scripts/test_segment_timing.py
|
|
83
|
+
|
|
84
|
+
# Package health manifest (generated)
|
|
85
|
+
package-health.manifest.json
|
|
86
|
+
|
|
87
|
+
# Environment
|
|
88
|
+
.env
|
|
89
|
+
.env.*
|
|
90
|
+
!.env.example
|
|
91
|
+
.venv/
|
|
92
|
+
.uv-cache/
|
|
93
|
+
|
|
94
|
+
# Node
|
|
95
|
+
node_modules/
|
|
96
|
+
|
|
97
|
+
# Wrangler (Cloudflare Workers local state)
|
|
98
|
+
.wrangler/
|
|
99
|
+
|
|
100
|
+
# IDE
|
|
101
|
+
.vscode/
|
|
102
|
+
.idea/
|
|
103
|
+
|
|
104
|
+
# Claude Code worktrees (embedded git repos — not submodules)
|
|
105
|
+
.claude/worktrees/
|
|
106
|
+
.claude/settings.local.json
|
|
107
|
+
|
|
108
|
+
# Demo harnesses (local only)
|
|
109
|
+
constitutional-sentinel-demo/
|
|
110
|
+
|
|
111
|
+
# OS
|
|
112
|
+
.DS_Store
|
|
113
|
+
Thumbs.db
|
|
114
|
+
|
|
115
|
+
# Screenshots (local captures)
|
|
116
|
+
screenshot*.png
|
|
117
|
+
|
|
118
|
+
# Revenue logs (operational data)
|
|
119
|
+
x402_revenue.jsonl
|
|
120
|
+
|
|
121
|
+
# Legacy / stale copies
|
|
122
|
+
src/acgs_lite/
|
|
123
|
+
src/fix_imports.py
|
|
124
|
+
src/split_engine.py
|
|
125
|
+
.gstack/
|
|
126
|
+
.python-version
|
|
127
|
+
.github/workflows/docs-pdf.yml
|
|
128
|
+
|
|
129
|
+
# Per-rule eval harness output
|
|
130
|
+
eval_results/
|
|
131
|
+
.omx/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# System deps
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
7
|
+
curl \
|
|
8
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
# Create non-root user for runtime
|
|
11
|
+
RUN groupadd -r clinicalguard && useradd -r -g clinicalguard -d /app -s /sbin/nologin clinicalguard
|
|
12
|
+
|
|
13
|
+
# Copy packages
|
|
14
|
+
COPY packages/acgs-lite /app/packages/acgs-lite
|
|
15
|
+
COPY packages/clinicalguard /app/packages/clinicalguard
|
|
16
|
+
|
|
17
|
+
# Install Python deps
|
|
18
|
+
RUN pip install --no-cache-dir \
|
|
19
|
+
starlette \
|
|
20
|
+
"uvicorn[standard]" \
|
|
21
|
+
pyyaml \
|
|
22
|
+
anthropic \
|
|
23
|
+
httpx \
|
|
24
|
+
pydantic \
|
|
25
|
+
&& pip install --no-cache-dir -e /app/packages/acgs-lite
|
|
26
|
+
|
|
27
|
+
# clinicalguard is resolved via PYTHONPATH (flat layout)
|
|
28
|
+
ENV PYTHONPATH=/app/packages
|
|
29
|
+
|
|
30
|
+
# Create data directory for audit log with correct ownership
|
|
31
|
+
RUN mkdir -p /data /home/clinicalguard \
|
|
32
|
+
&& chown clinicalguard:clinicalguard /data /home/clinicalguard
|
|
33
|
+
|
|
34
|
+
# Default audit log to persistent volume, not /tmp
|
|
35
|
+
ENV CLINICALGUARD_AUDIT_LOG=/data/clinicalguard_audit.json
|
|
36
|
+
ENV HOME=/home/clinicalguard
|
|
37
|
+
|
|
38
|
+
VOLUME /data
|
|
39
|
+
|
|
40
|
+
EXPOSE 8080
|
|
41
|
+
|
|
42
|
+
# Switch to non-root user
|
|
43
|
+
USER clinicalguard
|
|
44
|
+
|
|
45
|
+
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
|
|
46
|
+
CMD curl -f http://localhost:8080/health || exit 1
|
|
47
|
+
|
|
48
|
+
CMD ["uvicorn", "clinicalguard.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clinicalguard
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Constitutional AI governance for clinical decision support — Agents Assemble hackathon
|
|
5
|
+
Project-URL: Homepage, https://acgs.ai
|
|
6
|
+
Project-URL: Documentation, https://github.com/acgs2_admin/acgs/tree/main/packages/clinicalguard
|
|
7
|
+
Project-URL: Repository, https://github.com/acgs2_admin/acgs
|
|
8
|
+
Project-URL: Issues, https://github.com/acgs2_admin/acgs/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/acgs2_admin/acgs/releases
|
|
10
|
+
Project-URL: PyPI, https://pypi.org/project/clinicalguard/
|
|
11
|
+
License-Expression: AGPL-3.0-or-later
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: httpx>=0.27
|
|
14
|
+
Requires-Dist: pydantic>=2.0
|
|
15
|
+
Requires-Dist: pyyaml>=6.0
|
|
16
|
+
Requires-Dist: starlette>=0.37
|
|
17
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Requires-Dist: anthropic>=0.30; extra == 'all'
|
|
20
|
+
Requires-Dist: openai>=1.0; extra == 'all'
|
|
21
|
+
Provides-Extra: anthropic
|
|
22
|
+
Requires-Dist: anthropic>=0.30; extra == 'anthropic'
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: httpx; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
28
|
+
Provides-Extra: openai
|
|
29
|
+
Requires-Dist: openai>=1.0; extra == 'openai'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# clinicalguard
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/clinicalguard/)
|
|
35
|
+
[](https://pypi.org/project/clinicalguard/)
|
|
36
|
+
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
37
|
+
|
|
38
|
+
**Constitutional AI governance for healthcare agents.**
|
|
39
|
+
|
|
40
|
+
`clinicalguard` is a Starlette-based A2A service for validating proposed clinical
|
|
41
|
+
actions against a healthcare constitution. It combines deterministic ACGS validation,
|
|
42
|
+
healthcare-specific validators, JSON-RPC 2.0 endpoints, and audit-trail persistence.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
`clinicalguard` supports Python 3.11+.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install acgs-lite clinicalguard
|
|
50
|
+
pip install clinicalguard[anthropic]
|
|
51
|
+
pip install clinicalguard[openai]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`clinicalguard` currently relies on `acgs-lite` at runtime; install it alongside the
|
|
55
|
+
package when working from PyPI or source checkouts.
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
### Run the Service
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uvicorn clinicalguard.main:app --host 0.0.0.0 --port 8080
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Validate a Clinical Action
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
curl -X POST http://localhost:8080/ \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"jsonrpc": "2.0",
|
|
72
|
+
"id": 1,
|
|
73
|
+
"method": "tasks/send",
|
|
74
|
+
"params": {
|
|
75
|
+
"id": "task-001",
|
|
76
|
+
"message": {
|
|
77
|
+
"parts": [{
|
|
78
|
+
"text": "validate_clinical_action: Patient SYNTH-042 on Warfarin. Propose Aspirin 325mg daily."
|
|
79
|
+
}]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Build the App in Python
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from clinicalguard.agent import ClinicalGuardApp
|
|
89
|
+
|
|
90
|
+
guard = ClinicalGuardApp.create(
|
|
91
|
+
constitution_path="constitution/healthcare_v1.yaml",
|
|
92
|
+
audit_log_path="audit.jsonl",
|
|
93
|
+
)
|
|
94
|
+
app = guard.build_starlette_app()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Key Features
|
|
98
|
+
|
|
99
|
+
- Healthcare-focused constitutional validation with MACI-style self-approval blocking.
|
|
100
|
+
- A2A skills for clinical validation, HIPAA checks, and audit-trail queries.
|
|
101
|
+
- Starlette service surface with agent-card, health, and JSON-RPC endpoints.
|
|
102
|
+
- Audit-log persistence and restoration for forensic review.
|
|
103
|
+
- Optional Anthropic and OpenAI reasoning layers on top of deterministic checks.
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
| Variable | Default | Purpose |
|
|
108
|
+
| --- | --- | --- |
|
|
109
|
+
| `CLINICALGUARD_API_KEY` | unset | Optional `X-API-Key` protection for request handling |
|
|
110
|
+
| `CLINICALGUARD_URL` | unset | Optional published service URL for agent-card metadata |
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
AGPL-3.0-or-later. Commercial licensing is available; contact `hello@acgs.ai`.
|
|
115
|
+
|
|
116
|
+
## Links
|
|
117
|
+
|
|
118
|
+
- [Homepage](https://acgs.ai)
|
|
119
|
+
- [Documentation](https://github.com/acgs2_admin/acgs/tree/main/packages/clinicalguard)
|
|
120
|
+
- [PyPI](https://pypi.org/project/clinicalguard/)
|
|
121
|
+
- [Repository](https://github.com/acgs2_admin/acgs)
|
|
122
|
+
- [Issues](https://github.com/acgs2_admin/acgs/issues)
|
|
123
|
+
- [Changelog](https://github.com/acgs2_admin/acgs/releases)
|
|
124
|
+
|
|
125
|
+
Constitutional Hash: `608508a9bd224290`
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# clinicalguard
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/clinicalguard/)
|
|
4
|
+
[](https://pypi.org/project/clinicalguard/)
|
|
5
|
+
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
6
|
+
|
|
7
|
+
**Constitutional AI governance for healthcare agents.**
|
|
8
|
+
|
|
9
|
+
`clinicalguard` is a Starlette-based A2A service for validating proposed clinical
|
|
10
|
+
actions against a healthcare constitution. It combines deterministic ACGS validation,
|
|
11
|
+
healthcare-specific validators, JSON-RPC 2.0 endpoints, and audit-trail persistence.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
`clinicalguard` supports Python 3.11+.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install acgs-lite clinicalguard
|
|
19
|
+
pip install clinicalguard[anthropic]
|
|
20
|
+
pip install clinicalguard[openai]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`clinicalguard` currently relies on `acgs-lite` at runtime; install it alongside the
|
|
24
|
+
package when working from PyPI or source checkouts.
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Run the Service
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uvicorn clinicalguard.main:app --host 0.0.0.0 --port 8080
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Validate a Clinical Action
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
curl -X POST http://localhost:8080/ \
|
|
38
|
+
-H "Content-Type: application/json" \
|
|
39
|
+
-d '{
|
|
40
|
+
"jsonrpc": "2.0",
|
|
41
|
+
"id": 1,
|
|
42
|
+
"method": "tasks/send",
|
|
43
|
+
"params": {
|
|
44
|
+
"id": "task-001",
|
|
45
|
+
"message": {
|
|
46
|
+
"parts": [{
|
|
47
|
+
"text": "validate_clinical_action: Patient SYNTH-042 on Warfarin. Propose Aspirin 325mg daily."
|
|
48
|
+
}]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Build the App in Python
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from clinicalguard.agent import ClinicalGuardApp
|
|
58
|
+
|
|
59
|
+
guard = ClinicalGuardApp.create(
|
|
60
|
+
constitution_path="constitution/healthcare_v1.yaml",
|
|
61
|
+
audit_log_path="audit.jsonl",
|
|
62
|
+
)
|
|
63
|
+
app = guard.build_starlette_app()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Key Features
|
|
67
|
+
|
|
68
|
+
- Healthcare-focused constitutional validation with MACI-style self-approval blocking.
|
|
69
|
+
- A2A skills for clinical validation, HIPAA checks, and audit-trail queries.
|
|
70
|
+
- Starlette service surface with agent-card, health, and JSON-RPC endpoints.
|
|
71
|
+
- Audit-log persistence and restoration for forensic review.
|
|
72
|
+
- Optional Anthropic and OpenAI reasoning layers on top of deterministic checks.
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
| Variable | Default | Purpose |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `CLINICALGUARD_API_KEY` | unset | Optional `X-API-Key` protection for request handling |
|
|
79
|
+
| `CLINICALGUARD_URL` | unset | Optional published service URL for agent-card metadata |
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
AGPL-3.0-or-later. Commercial licensing is available; contact `hello@acgs.ai`.
|
|
84
|
+
|
|
85
|
+
## Links
|
|
86
|
+
|
|
87
|
+
- [Homepage](https://acgs.ai)
|
|
88
|
+
- [Documentation](https://github.com/acgs2_admin/acgs/tree/main/packages/clinicalguard)
|
|
89
|
+
- [PyPI](https://pypi.org/project/clinicalguard/)
|
|
90
|
+
- [Repository](https://github.com/acgs2_admin/acgs)
|
|
91
|
+
- [Issues](https://github.com/acgs2_admin/acgs/issues)
|
|
92
|
+
- [Changelog](https://github.com/acgs2_admin/acgs/releases)
|
|
93
|
+
|
|
94
|
+
Constitutional Hash: `608508a9bd224290`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""ClinicalGuard: Constitutional AI Governance for Healthcare Agents.
|
|
2
|
+
|
|
3
|
+
An A2A agent that validates proposed clinical actions against a 20-rule
|
|
4
|
+
Healthcare AI Constitution using LLM reasoning + MACI enforcement.
|
|
5
|
+
|
|
6
|
+
Constitutional Hash: 608508a9bd224290
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "1.0.0"
|