sentinel-kernel 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.
- sentinel_kernel-0.1.0/.claude/agents/bsi-auditor.md +12 -0
- sentinel_kernel-0.1.0/.claude/agents/protocol-architect.md +11 -0
- sentinel_kernel-0.1.0/.claude/agents/security-reviewer.md +12 -0
- sentinel_kernel-0.1.0/.claude/commands/add-integration.md +23 -0
- sentinel_kernel-0.1.0/.claude/commands/bsi-check.md +35 -0
- sentinel_kernel-0.1.0/.claude/commands/protocol-review.md +33 -0
- sentinel_kernel-0.1.0/.claude/commands/rfc.md +28 -0
- sentinel_kernel-0.1.0/.claude/commands/security-audit.md +30 -0
- sentinel_kernel-0.1.0/.claude/rules/code-style.md +13 -0
- sentinel_kernel-0.1.0/.claude/rules/protocol-conventions.md +36 -0
- sentinel_kernel-0.1.0/.claude/rules/sovereignty-rules.md +29 -0
- sentinel_kernel-0.1.0/.claude/rules/testing.md +18 -0
- sentinel_kernel-0.1.0/.claude/settings.json +17 -0
- sentinel_kernel-0.1.0/.claude/skills/bsi-compliance/SKILL.md +16 -0
- sentinel_kernel-0.1.0/.claude/skills/sovereignty-check/SKILL.md +17 -0
- sentinel_kernel-0.1.0/.github/workflows/ci.yml +47 -0
- sentinel_kernel-0.1.0/.gitignore +20 -0
- sentinel_kernel-0.1.0/CHANGELOG.md +42 -0
- sentinel_kernel-0.1.0/CLAUDE.md +76 -0
- sentinel_kernel-0.1.0/CONTRIBUTING.md +128 -0
- sentinel_kernel-0.1.0/GOVERNANCE.md +73 -0
- sentinel_kernel-0.1.0/LICENSE +108 -0
- sentinel_kernel-0.1.0/PKG-INFO +364 -0
- sentinel_kernel-0.1.0/README.md +213 -0
- sentinel_kernel-0.1.0/VISION.md +116 -0
- sentinel_kernel-0.1.0/docs/architecture.md +229 -0
- sentinel_kernel-0.1.0/docs/bsi-profile.md +99 -0
- sentinel_kernel-0.1.0/docs/co-innovation.md +65 -0
- sentinel_kernel-0.1.0/docs/eu-ai-act.md +280 -0
- sentinel_kernel-0.1.0/docs/integration-guide.md +167 -0
- sentinel_kernel-0.1.0/docs/landscape.md +61 -0
- sentinel_kernel-0.1.0/docs/project-status.md +99 -0
- sentinel_kernel-0.1.0/docs/quickstart.md +202 -0
- sentinel_kernel-0.1.0/docs/rfcs/.gitkeep +0 -0
- sentinel_kernel-0.1.0/docs/schema.md +199 -0
- sentinel_kernel-0.1.0/docs/trace-example.json +50 -0
- sentinel_kernel-0.1.0/docs/trademark.md +6 -0
- sentinel_kernel-0.1.0/examples/minimal_trace.py +36 -0
- sentinel_kernel-0.1.0/examples/policies/discount_approval.rego +48 -0
- sentinel_kernel-0.1.0/examples/policy_deny.py +67 -0
- sentinel_kernel-0.1.0/examples/quickstart.py +97 -0
- sentinel_kernel-0.1.0/pyproject.toml +101 -0
- sentinel_kernel-0.1.0/sentinel/__init__.py +34 -0
- sentinel_kernel-0.1.0/sentinel/core/__init__.py +18 -0
- sentinel_kernel-0.1.0/sentinel/core/trace.py +255 -0
- sentinel_kernel-0.1.0/sentinel/core/tracer.py +234 -0
- sentinel_kernel-0.1.0/sentinel/integrations/__init__.py +3 -0
- sentinel_kernel-0.1.0/sentinel/policy/__init__.py +13 -0
- sentinel_kernel-0.1.0/sentinel/policy/evaluator.py +170 -0
- sentinel_kernel-0.1.0/sentinel/storage/__init__.py +5 -0
- sentinel_kernel-0.1.0/sentinel/storage/base.py +56 -0
- sentinel_kernel-0.1.0/sentinel/storage/filesystem.py +135 -0
- sentinel_kernel-0.1.0/sentinel/storage/sqlite.py +188 -0
- sentinel_kernel-0.1.0/tests/__init__.py +0 -0
- sentinel_kernel-0.1.0/tests/test_eu_ai_act_fields.py +233 -0
- sentinel_kernel-0.1.0/tests/test_minimal_flow.py +149 -0
- sentinel_kernel-0.1.0/tests/test_policy_deny.py +188 -0
- sentinel_kernel-0.1.0/tests/test_storage.py +217 -0
- sentinel_kernel-0.1.0/tests/test_sync_and_edge_cases.py +281 -0
- sentinel_kernel-0.1.0/tests/test_trace_schema.py +159 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Agent: BSI Auditor
|
|
2
|
+
|
|
3
|
+
Review code as if preparing for formal BSI IT-Grundschutz submission and VS-NfD certification.
|
|
4
|
+
|
|
5
|
+
Scope: BSI IT-Grundschutz (APP.6, CON.1, CON.3, OPS.1.1.5) / VS-NfD /
|
|
6
|
+
EU AI Act Art. 6, 9, 12, 13, 17 / DSGVO data minimisation.
|
|
7
|
+
|
|
8
|
+
Blockers: US CLOUD Act exposure / hardcoded secrets / missing encryption /
|
|
9
|
+
raw PII in traces / mandatory network call in air-gapped mode.
|
|
10
|
+
|
|
11
|
+
Finding format: BSI-[YEAR]-[NNN] / Severity / Reference (e.g. APP.6.A3) /
|
|
12
|
+
Description / Impact / Fix. Do not soften findings.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Agent: Protocol Architect
|
|
2
|
+
|
|
3
|
+
Ensure the integrity, sovereignty, and longevity of the Sentinel decision trace protocol.
|
|
4
|
+
|
|
5
|
+
Ask for every decision:
|
|
6
|
+
- Will this hold up in front of a BSI auditor?
|
|
7
|
+
- Will this work air-gapped in a classified environment?
|
|
8
|
+
- Will this still make sense when EU AI Act is enforced?
|
|
9
|
+
|
|
10
|
+
Principles: Conservative. Standard formats only. Offline first. Immutability absolute.
|
|
11
|
+
Direct. Quantify BSI impact. When you disagree, offer an alternative.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Agent: Security Reviewer
|
|
2
|
+
|
|
3
|
+
Review code for classified, air-gapped deployment.
|
|
4
|
+
|
|
5
|
+
Think like an attacker who wants to:
|
|
6
|
+
1. Exfiltrate traces from an air-gapped network
|
|
7
|
+
2. Tamper with the audit trail
|
|
8
|
+
3. Inject a policy that always returns ALLOW
|
|
9
|
+
4. Compromise supply chain through a dependency
|
|
10
|
+
|
|
11
|
+
Examine: trace integrity / policy injection / supply chain / air-gapped exfiltration.
|
|
12
|
+
Output: attack vector / what attacker gains / specific fix / classified blocker YES/NO.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# /project:add-integration
|
|
2
|
+
|
|
3
|
+
Scaffold a new AI framework or model provider integration.
|
|
4
|
+
Usage: /project:add-integration [name]
|
|
5
|
+
|
|
6
|
+
## Before writing any code
|
|
7
|
+
Read docs/integration-guide.md. Answer and document in your PR:
|
|
8
|
+
1. Does this framework send data to a US-owned service?
|
|
9
|
+
2. Does it work fully offline?
|
|
10
|
+
3. Does it introduce a US dependency in the critical path? If yes: stop.
|
|
11
|
+
|
|
12
|
+
Note: for LangChain specifically, this integration is the explicit open
|
|
13
|
+
alternative to proprietary platform connectors. Document this clearly.
|
|
14
|
+
|
|
15
|
+
## What to build
|
|
16
|
+
- sentinel/integrations/[name] — standard middleware interface, works offline
|
|
17
|
+
- tests/integrations/test_[name] — trace emitted, DENY recorded, override linked, no-network test
|
|
18
|
+
- examples/[name]_quickstart — under 30 lines, local storage only
|
|
19
|
+
- Update README integrations table and docs/integration-guide.md
|
|
20
|
+
|
|
21
|
+
## Non-negotiables
|
|
22
|
+
No mandatory network call. No breaking change to storage interface.
|
|
23
|
+
Sovereignty must be documentable — users must know what data goes where.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# /project:bsi-check
|
|
2
|
+
|
|
3
|
+
BSI IT-Grundschutz readiness check. Run before any formal BSI engagement.
|
|
4
|
+
Usage: /project:bsi-check [file or "all"]
|
|
5
|
+
|
|
6
|
+
## APP.6 — Software
|
|
7
|
+
- [ ] No hardcoded credentials or secrets
|
|
8
|
+
- [ ] Input validation on all public interfaces
|
|
9
|
+
- [ ] Error messages do not leak internal state
|
|
10
|
+
- [ ] All dependencies pinned to exact versions
|
|
11
|
+
- [ ] No sensitive data in logs
|
|
12
|
+
|
|
13
|
+
## CON.1 — Cryptography
|
|
14
|
+
- [ ] Storage supports encryption at rest
|
|
15
|
+
- [ ] Strong encryption for all network transport
|
|
16
|
+
- [ ] No weak hash algorithms
|
|
17
|
+
- [ ] Key management documented in docs/bsi-profile.md
|
|
18
|
+
|
|
19
|
+
## CON.3 — Data protection
|
|
20
|
+
- [ ] No raw PII in traces by default
|
|
21
|
+
- [ ] Data minimisation applied
|
|
22
|
+
- [ ] Data residency asserted in every trace
|
|
23
|
+
- [ ] Deletion path exists and documented
|
|
24
|
+
|
|
25
|
+
## OPS.1.1.5 — Backup
|
|
26
|
+
- [ ] Traces exportable as NDJSON
|
|
27
|
+
- [ ] Backup and restore documented
|
|
28
|
+
- [ ] Air-gapped export works with no network
|
|
29
|
+
|
|
30
|
+
## VS-NfD prerequisites
|
|
31
|
+
- [ ] Air-gapped mode works end-to-end
|
|
32
|
+
- [ ] No mandatory internet connectivity in critical path
|
|
33
|
+
- [ ] Tested in network-isolated environment
|
|
34
|
+
|
|
35
|
+
## Output: Severity (BLOCKER/HIGH/MEDIUM/LOW) + BSI reference + fix + blocks BSI YES/NO
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# /project:protocol-review
|
|
2
|
+
|
|
3
|
+
Review a decision trace or trace-emitting code for EU AI Act compliance and BSI readiness.
|
|
4
|
+
|
|
5
|
+
## Trace completeness — EU AI Act Art. 12 + 17
|
|
6
|
+
- [ ] Unique trace ID, immutable after creation
|
|
7
|
+
- [ ] Timestamp in UTC
|
|
8
|
+
- [ ] Agent name and version
|
|
9
|
+
- [ ] Model provider and version
|
|
10
|
+
- [ ] Policy name, version, result (ALLOW / DENY / EXCEPTION)
|
|
11
|
+
- [ ] Which rule triggered (if DENY)
|
|
12
|
+
- [ ] Inputs hashed — no raw PII unless explicitly opted in
|
|
13
|
+
- [ ] Output recorded
|
|
14
|
+
- [ ] Sovereign scope: EU or LOCAL
|
|
15
|
+
- [ ] Data residency asserted
|
|
16
|
+
|
|
17
|
+
## Sovereignty
|
|
18
|
+
- [ ] No US-controlled component in the critical path
|
|
19
|
+
- [ ] Works with zero network connectivity
|
|
20
|
+
- [ ] Data residency assertion independently verifiable
|
|
21
|
+
|
|
22
|
+
## Policy evaluation
|
|
23
|
+
- [ ] In-process — no remote call
|
|
24
|
+
- [ ] Deterministic
|
|
25
|
+
- [ ] DENY records which rule triggered
|
|
26
|
+
- [ ] Human override creates a second trace entry linked to the original
|
|
27
|
+
|
|
28
|
+
## Trace integrity
|
|
29
|
+
- [ ] Cannot be modified after writing
|
|
30
|
+
- [ ] Storage is append-only
|
|
31
|
+
- [ ] Correction is a new entry — never an edit
|
|
32
|
+
|
|
33
|
+
## Output: PASS / FAIL / NEEDS REVIEW + issues with location + suggested fix
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# /project:rfc
|
|
2
|
+
|
|
3
|
+
Open an RFC for a significant or breaking change to the Sentinel protocol.
|
|
4
|
+
|
|
5
|
+
## When required
|
|
6
|
+
Any change to: trace schema, mandatory fields, storage interface,
|
|
7
|
+
policy evaluation contract, sovereignty assertions.
|
|
8
|
+
|
|
9
|
+
## RFC document: docs/rfcs/RFC-[NNN]-[title].md
|
|
10
|
+
|
|
11
|
+
Status: DRAFT | UNDER REVIEW | ACCEPTED | REJECTED
|
|
12
|
+
Author: / Date:
|
|
13
|
+
|
|
14
|
+
### Summary (one paragraph)
|
|
15
|
+
### Motivation
|
|
16
|
+
### Proposal (before/after for schema changes)
|
|
17
|
+
### Deployment context impact
|
|
18
|
+
- Air-gapped / classified:
|
|
19
|
+
- BSI certification path:
|
|
20
|
+
- EU AI Act compliance:
|
|
21
|
+
### Migration
|
|
22
|
+
### Open questions
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
1. GitHub Discussion linking the RFC
|
|
26
|
+
2. 14-day comment period
|
|
27
|
+
3. Maintainer vote
|
|
28
|
+
4. Merge or close with rationale recorded
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# /project:security-audit
|
|
2
|
+
|
|
3
|
+
Security audit for classified deployment readiness.
|
|
4
|
+
Think like an attacker targeting an air-gapped environment.
|
|
5
|
+
Usage: /project:security-audit [file or "all"]
|
|
6
|
+
|
|
7
|
+
## Trace integrity
|
|
8
|
+
- Can a trace be modified after writing?
|
|
9
|
+
- Is the audit trail append-only?
|
|
10
|
+
- Hash or signature on stored traces?
|
|
11
|
+
|
|
12
|
+
## Policy injection
|
|
13
|
+
- Can untrusted input influence which policy is loaded?
|
|
14
|
+
- Can policy evaluation be bypassed?
|
|
15
|
+
- Is the policy path sanitised?
|
|
16
|
+
|
|
17
|
+
## Secret handling
|
|
18
|
+
- Secrets in logs, traces, or errors?
|
|
19
|
+
- Sensitive values flowing into traces unredacted?
|
|
20
|
+
|
|
21
|
+
## Supply chain
|
|
22
|
+
- All dependencies pinned? Fetched over encrypted transport?
|
|
23
|
+
- Any US-owned dependency in the critical path?
|
|
24
|
+
|
|
25
|
+
## Air-gapped readiness
|
|
26
|
+
- Unexpected outbound network calls?
|
|
27
|
+
- DNS lookups that could leak information?
|
|
28
|
+
- System works fully isolated?
|
|
29
|
+
|
|
30
|
+
## Output: Severity + Location + Attack scenario + Fix + Classified blocker YES/NO
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Code Style
|
|
2
|
+
|
|
3
|
+
Trace correctness over performance. A missing trace is worse than a crash.
|
|
4
|
+
Interfaces over implementations. Storage, policy eval, trace emission are interfaces.
|
|
5
|
+
Offline first. No feature is complete until tested without network.
|
|
6
|
+
No silent failures. No secrets in code, traces, or logs.
|
|
7
|
+
|
|
8
|
+
Every public interface states:
|
|
9
|
+
- What it does
|
|
10
|
+
- Sovereignty guarantees it provides (or explicitly does not)
|
|
11
|
+
- What happens with no network connection
|
|
12
|
+
|
|
13
|
+
Use /project:rfc before any breaking change to the trace schema.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Protocol Conventions — Decision Trace Schema
|
|
2
|
+
|
|
3
|
+
## Mandatory fields
|
|
4
|
+
```
|
|
5
|
+
trace_id Unique. Immutable after creation.
|
|
6
|
+
parent_trace_id For nested decisions. Null if top-level.
|
|
7
|
+
timestamp ISO 8601 UTC.
|
|
8
|
+
latency_ms Wall clock time of the full decision.
|
|
9
|
+
agent Name of the agent or function.
|
|
10
|
+
agent_version Version string. Null if unavailable.
|
|
11
|
+
model Model identifier.
|
|
12
|
+
model_version Version. Null if unavailable.
|
|
13
|
+
policy Policy name.
|
|
14
|
+
policy_version Policy version. Null if not versioned.
|
|
15
|
+
policy_result ALLOW | DENY | EXCEPTION_REQUIRED.
|
|
16
|
+
policy_rule Rule that triggered. Null only if ALLOW.
|
|
17
|
+
inputs_hash SHA-256 of serialised inputs. Always present.
|
|
18
|
+
inputs_raw Raw inputs. Opt-in only. Never default.
|
|
19
|
+
output The decision output.
|
|
20
|
+
override_by Who overrode. Null if no override.
|
|
21
|
+
override_reason Reason. Null if no override.
|
|
22
|
+
override_at Timestamp. Null if no override.
|
|
23
|
+
sovereign_scope EU | LOCAL | CUSTOM.
|
|
24
|
+
data_residency Where the trace is stored. Human-readable.
|
|
25
|
+
schema_version Schema version.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Immutability
|
|
29
|
+
A trace is never edited. Corrections and overrides are new entries.
|
|
30
|
+
|
|
31
|
+
## Portability
|
|
32
|
+
Traces export as NDJSON. No binary formats. No proprietary encoding.
|
|
33
|
+
|
|
34
|
+
## Schema changes
|
|
35
|
+
Optional fields: no RFC required.
|
|
36
|
+
Removing/renaming or new mandatory fields: RFC required.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# EU Sovereignty Rules — Non-Negotiable
|
|
2
|
+
|
|
3
|
+
## The three laws
|
|
4
|
+
|
|
5
|
+
### 1. No US CLOUD Act exposure in the critical path
|
|
6
|
+
Any US-incorporated entity in the trace emission path creates CLOUD Act
|
|
7
|
+
exposure regardless of server location. An EU data centre run by a US
|
|
8
|
+
company does not solve this. US services may appear only in optional
|
|
9
|
+
integrations, clearly marked as non-sovereign.
|
|
10
|
+
|
|
11
|
+
### 2. Air-gapped must always work
|
|
12
|
+
Local file storage is the reference deployment for classified environments.
|
|
13
|
+
Test offline before marking any feature complete.
|
|
14
|
+
|
|
15
|
+
### 3. Apache 2.0, forever
|
|
16
|
+
No licence change. No CLA enabling relicensing. No closed-source features.
|
|
17
|
+
|
|
18
|
+
## Before adding any dependency (document in PR every time)
|
|
19
|
+
1. Who is the parent company?
|
|
20
|
+
2. US-incorporated?
|
|
21
|
+
3. Makes network calls at runtime?
|
|
22
|
+
4. Works pinned and offline?
|
|
23
|
+
If 2 and 3 are both yes: not in the critical path.
|
|
24
|
+
|
|
25
|
+
## What EU-sovereign means
|
|
26
|
+
Does NOT mean: cannot use code written by Americans.
|
|
27
|
+
DOES mean: no US company has runtime access to decision traces.
|
|
28
|
+
DOES mean: EU law governs all data at rest and in transit.
|
|
29
|
+
DOES mean: a regulator can independently verify the data residency claim.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
## Five mandatory tests per feature
|
|
4
|
+
1. Happy path
|
|
5
|
+
2. Offline — local storage, zero network
|
|
6
|
+
3. Policy DENY — blocks execution, DENY recorded with rule name
|
|
7
|
+
4. Override — second linked trace entry, original untouched
|
|
8
|
+
5. EU AI Act fields — all mandatory fields present and correct
|
|
9
|
+
|
|
10
|
+
## Sovereignty tests — CI blockers (every PR)
|
|
11
|
+
- test_offline_mode_emits_complete_trace
|
|
12
|
+
- test_all_eu_ai_act_fields_present
|
|
13
|
+
- test_trace_is_immutable_after_write
|
|
14
|
+
- test_deny_records_triggering_rule
|
|
15
|
+
- test_override_creates_linked_entry
|
|
16
|
+
|
|
17
|
+
## Coverage targets
|
|
18
|
+
Core trace emission: 95%+ / Storage interface: 90%+ / Integrations: 80%+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git diff:*)", "Bash(git log:*)", "Bash(git status:*)",
|
|
5
|
+
"Bash(git add:*)", "Bash(git commit:*)", "Bash(git push:*)",
|
|
6
|
+
"Bash(grep:*)", "Bash(find:*)", "Bash(cat:*)", "Bash(ls:*)",
|
|
7
|
+
"Bash(mkdir:*)", "Bash(mv:*)", "Bash(cp:*)",
|
|
8
|
+
"Read(**)",
|
|
9
|
+
"Write(sentinel/**)", "Write(tests/**)", "Write(docs/**)",
|
|
10
|
+
"Write(examples/**)", "Write(policies/**)",
|
|
11
|
+
"Write(.claude/**)", "Write(CLAUDE.md)"
|
|
12
|
+
],
|
|
13
|
+
"deny": [
|
|
14
|
+
"Write(.env)", "Write(.env.*)", "Write(**/*.pem)", "Write(**/*.key)"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# SKILL: BSI Compliance Check
|
|
2
|
+
|
|
3
|
+
## Auto-trigger when
|
|
4
|
+
New dependency added / encryption touched / offline path changed / mandatory trace field modified.
|
|
5
|
+
|
|
6
|
+
## Checks
|
|
7
|
+
- Secrets: no hardcoded credentials, no sensitive values in traces or logs
|
|
8
|
+
- EU AI Act fields: mandatory fields present after schema changes? Any removed without RFC? BLOCK.
|
|
9
|
+
- Air-gapped: works with no network? New mandatory outbound call? BLOCK.
|
|
10
|
+
- Dependencies: US-owned? Makes network calls? Flag both.
|
|
11
|
+
|
|
12
|
+
## Output
|
|
13
|
+
BSI-SKILL: PASS | WARN | BLOCK
|
|
14
|
+
[WARN] new dependency — check ownership and network behaviour
|
|
15
|
+
[BLOCK] mandatory trace field removed without RFC
|
|
16
|
+
[BLOCK] mandatory network call added — breaks air-gapped deployment
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# SKILL: Sovereignty Check
|
|
2
|
+
|
|
3
|
+
## Auto-trigger when
|
|
4
|
+
New import or dependency / network call written / storage write path changed.
|
|
5
|
+
|
|
6
|
+
## Checks
|
|
7
|
+
- Network calls: destination? In critical path? US-owned? Can disable offline?
|
|
8
|
+
If US-owned and in critical path: VIOLATION.
|
|
9
|
+
- Data residency: data_residency correct? sovereign_scope accurate?
|
|
10
|
+
Can a regulator independently verify?
|
|
11
|
+
- Offline: works with no network?
|
|
12
|
+
|
|
13
|
+
## Output
|
|
14
|
+
SOVEREIGNTY-SKILL: SOVEREIGN | DEGRADED | VIOLATION
|
|
15
|
+
[OK] storage is local — sovereign
|
|
16
|
+
[WARN] optional integration uses non-sovereign service — marked
|
|
17
|
+
[VIOLATION] dependency sends data to US-owned service in critical path
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test Python ${{ matrix.python-version }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Lint
|
|
29
|
+
run: ruff check sentinel/
|
|
30
|
+
|
|
31
|
+
- name: Type check
|
|
32
|
+
run: mypy sentinel/ --ignore-missing-imports || true
|
|
33
|
+
|
|
34
|
+
- name: Test with coverage
|
|
35
|
+
run: pytest tests/ -v --cov=sentinel --cov-report=term-missing --cov-fail-under=75
|
|
36
|
+
|
|
37
|
+
quickstart:
|
|
38
|
+
name: Quickstart smoke test
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
- uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.11"
|
|
45
|
+
- run: pip install -e .
|
|
46
|
+
- run: python examples/minimal_trace.py
|
|
47
|
+
- run: python examples/policy_deny.py
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.Python
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.coverage
|
|
11
|
+
coverage.xml
|
|
12
|
+
htmlcov/
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
*.db
|
|
15
|
+
*.sqlite
|
|
16
|
+
.DS_Store
|
|
17
|
+
|
|
18
|
+
# Claude Code — private files, never commit
|
|
19
|
+
CLAUDE.local.md
|
|
20
|
+
.claude/settings.local.json
|
|
@@ -0,0 +1,42 @@
|
|
|
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](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `SQLiteStorage.save()` now uses `INSERT` instead of `INSERT OR REPLACE` — duplicate `trace_id` raises `IntegrityError` instead of silently overwriting. Traces are now genuinely append-only in SQLite.
|
|
12
|
+
- `DecisionTrace.from_dict()` now reconstructs `policy_evaluation` and `human_override` from stored JSON. Previously these were lost on deserialization.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `tests/test_eu_ai_act_fields.py` — 12 tests verifying EU AI Act Article 12/13/14 field presence on real traces
|
|
16
|
+
|
|
17
|
+
## [0.1.0] — 2026-04-01
|
|
18
|
+
|
|
19
|
+
Initial public alpha release.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- `Sentinel` class with `@sentinel.trace` decorator (sync and async)
|
|
23
|
+
- `DecisionTrace` dataclass with SHA-256 input/output hashing
|
|
24
|
+
- `PolicyEvaluation` model with ALLOW / DENY / EXCEPTION / NOT_EVALUATED
|
|
25
|
+
- `HumanOverride` model for recording human intervention
|
|
26
|
+
- `DataResidency` enum (LOCAL, EU, EU-DE, EU-FR, air-gapped)
|
|
27
|
+
- `SQLiteStorage` backend — zero dependencies, works everywhere
|
|
28
|
+
- `FilesystemStorage` backend — NDJSON append-only, designed for air-gapped environments
|
|
29
|
+
- `StorageBackend` abstract interface for custom backends
|
|
30
|
+
- `NullPolicyEvaluator` (default), `SimpleRuleEvaluator` (Python callables), `LocalRegoEvaluator` (OPA binary)
|
|
31
|
+
- Trace query interface with project, agent, and policy result filters
|
|
32
|
+
- `sentinel.span()` async context manager for manual trace control
|
|
33
|
+
- Schema version 1.0.0 draft
|
|
34
|
+
- Documentation: schema reference, EU AI Act mapping, integration guide, BSI profile
|
|
35
|
+
- Apache 2.0 license
|
|
36
|
+
|
|
37
|
+
### Not yet implemented
|
|
38
|
+
- CLI (`sentinel` command is declared but not yet implemented)
|
|
39
|
+
- LangChain / LangGraph integration
|
|
40
|
+
- PostgreSQL storage backend
|
|
41
|
+
- OpenTelemetry export
|
|
42
|
+
- Test suite (in progress)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Sentinel — Claude Instructions
|
|
2
|
+
|
|
3
|
+
## What this project is
|
|
4
|
+
|
|
5
|
+
Sentinel is an EU-sovereign AI decision middleware kernel.
|
|
6
|
+
It sits in the execution path of any AI agent and turns every decision
|
|
7
|
+
into a structured, auditable, sovereign artifact.
|
|
8
|
+
|
|
9
|
+
The sovereignty is the product. Everything else is implementation detail.
|
|
10
|
+
|
|
11
|
+
- License: Apache 2.0, permanently
|
|
12
|
+
- Governance: Linux Foundation Europe intended (formal engagement planned with v1.0)
|
|
13
|
+
- Target: BSI reference implementation for EU-sovereign AI decision infrastructure
|
|
14
|
+
|
|
15
|
+
## Why this exists
|
|
16
|
+
|
|
17
|
+
The leading AI decision platforms are excellent. They are also American,
|
|
18
|
+
fully subject to the US CLOUD Act. For European regulated industries —
|
|
19
|
+
defence, critical infrastructure, financial services, healthcare — a
|
|
20
|
+
US-owned decision record layer is a structural barrier, not a preference.
|
|
21
|
+
|
|
22
|
+
EU AI Act Art. 12, 13, 17 mandates audit trails for high-risk AI from
|
|
23
|
+
2 August 2026. No US provider can deliver this from their jurisdiction.
|
|
24
|
+
Sentinel is the open, sovereign answer.
|
|
25
|
+
|
|
26
|
+
Proprietary platforms are building developer ecosystems with SDKs,
|
|
27
|
+
community registries, and framework connectors — all locked to their
|
|
28
|
+
ontology and jurisdiction. Sentinel is the alternative: open, portable,
|
|
29
|
+
sovereign. The v0.3 LangChain integration is the explicit open alternative
|
|
30
|
+
to proprietary platform connectors.
|
|
31
|
+
|
|
32
|
+
## The three invariants
|
|
33
|
+
|
|
34
|
+
1. No US CLOUD Act exposure in the critical path.
|
|
35
|
+
2. Air-gapped must always work. If it breaks offline, it is not complete.
|
|
36
|
+
3. Apache 2.0, forever. No enterprise edition. No licence key. No relicensing.
|
|
37
|
+
|
|
38
|
+
## The decision trace — mandatory fields
|
|
39
|
+
|
|
40
|
+
- Unique trace ID (immutable after creation)
|
|
41
|
+
- Timestamp in UTC
|
|
42
|
+
- Agent name and version
|
|
43
|
+
- Model provider and version
|
|
44
|
+
- Policy name, version, result (ALLOW / DENY / EXCEPTION)
|
|
45
|
+
- Which rule triggered (if DENY)
|
|
46
|
+
- Hashed inputs — never raw PII by default
|
|
47
|
+
- Output
|
|
48
|
+
- Sovereign scope (EU / LOCAL)
|
|
49
|
+
- Data residency assertion
|
|
50
|
+
|
|
51
|
+
These are the EU AI Act Art. 12/13/17 compliance evidence and the BSI audit trail.
|
|
52
|
+
|
|
53
|
+
## Before adding any dependency — document in PR
|
|
54
|
+
|
|
55
|
+
1. Who is the parent company?
|
|
56
|
+
2. US-incorporated and subject to CLOUD Act?
|
|
57
|
+
3. Makes network calls at runtime?
|
|
58
|
+
4. Works fully offline?
|
|
59
|
+
|
|
60
|
+
If 2 and 3 are both yes: not in the critical path.
|
|
61
|
+
|
|
62
|
+
## Code principles
|
|
63
|
+
|
|
64
|
+
- Offline-first — no feature is complete until tested without network
|
|
65
|
+
- No proprietary formats — traces must be portable
|
|
66
|
+
- Storage is pluggable — no backend is mandatory
|
|
67
|
+
- Breaking changes to the trace schema require an RFC (/project:rfc)
|
|
68
|
+
- Never swallow errors silently — a missing trace is worse than a crash
|
|
69
|
+
|
|
70
|
+
## Deployment contexts
|
|
71
|
+
|
|
72
|
+
- Air-gapped classified (no network, local storage only)
|
|
73
|
+
- On-premise enterprise (EU-sovereign infrastructure)
|
|
74
|
+
- Sovereign edge (EU data residency required)
|
|
75
|
+
|
|
76
|
+
Test against the most constrained context first.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributing to Sentinel
|
|
2
|
+
|
|
3
|
+
Contributions are welcome from individuals, research institutions,
|
|
4
|
+
and organisations.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Getting started
|
|
9
|
+
|
|
10
|
+
1. Fork the repository
|
|
11
|
+
2. Create a feature branch from `main`
|
|
12
|
+
3. Make your changes
|
|
13
|
+
4. Run the test suite: `pytest`
|
|
14
|
+
5. Open a pull request
|
|
15
|
+
|
|
16
|
+
**First contribution?** Look for issues labelled
|
|
17
|
+
[`good first issue`](../../issues?q=label%3A%22good+first+issue%22).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Code of conduct
|
|
22
|
+
|
|
23
|
+
Be respectful, constructive, and professional. Sentinel is built by
|
|
24
|
+
a diverse community across industries, institutions, and countries.
|
|
25
|
+
Contributions are evaluated on their technical merit.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Pull request requirements
|
|
30
|
+
|
|
31
|
+
Every PR must:
|
|
32
|
+
|
|
33
|
+
1. **Pass all existing tests** — no regressions.
|
|
34
|
+
2. **Include tests for new functionality** — see test requirements below.
|
|
35
|
+
3. **Document sovereignty posture** — if your change introduces a dependency,
|
|
36
|
+
network call, or storage path change, answer the sovereignty checklist
|
|
37
|
+
in your PR description.
|
|
38
|
+
|
|
39
|
+
### Sovereignty checklist (for PRs that add dependencies or network calls)
|
|
40
|
+
|
|
41
|
+
- [ ] Who is the parent company of the dependency?
|
|
42
|
+
- [ ] Is it US-incorporated and subject to the CLOUD Act?
|
|
43
|
+
- [ ] Does it make network calls at runtime?
|
|
44
|
+
- [ ] Does it work fully offline?
|
|
45
|
+
|
|
46
|
+
If the dependency is US-owned and makes network calls: it cannot be in the
|
|
47
|
+
critical path. It may be offered as an optional, clearly-labelled integration.
|
|
48
|
+
|
|
49
|
+
### Test requirements
|
|
50
|
+
|
|
51
|
+
Every new feature must include at minimum:
|
|
52
|
+
|
|
53
|
+
1. Happy path test
|
|
54
|
+
2. Offline test (local storage, zero network)
|
|
55
|
+
3. Policy DENY test (DENY recorded with rule name)
|
|
56
|
+
4. Override test (second linked trace entry, original untouched)
|
|
57
|
+
5. EU AI Act fields test (all mandatory fields present)
|
|
58
|
+
|
|
59
|
+
Coverage targets: core trace emission 95%+, storage interface 90%+,
|
|
60
|
+
integrations 80%+.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Integration contributions
|
|
65
|
+
|
|
66
|
+
Adding a new framework or model provider integration? Read
|
|
67
|
+
[`docs/integration-guide.md`](docs/integration-guide.md) first.
|
|
68
|
+
|
|
69
|
+
Every integration must:
|
|
70
|
+
|
|
71
|
+
- Document its sovereignty posture
|
|
72
|
+
- Work offline or clearly label which features require network
|
|
73
|
+
- Include a quickstart example under 30 lines
|
|
74
|
+
- Pass the standard integration test suite
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## RFC process
|
|
79
|
+
|
|
80
|
+
Significant changes to the following require an RFC before implementation:
|
|
81
|
+
|
|
82
|
+
- Trace schema (mandatory fields, field semantics)
|
|
83
|
+
- Storage interface
|
|
84
|
+
- Policy evaluation contract
|
|
85
|
+
- Sovereignty assertions
|
|
86
|
+
|
|
87
|
+
### How to open an RFC
|
|
88
|
+
|
|
89
|
+
1. Create a document at `docs/rfcs/RFC-[NNN]-[title].md`
|
|
90
|
+
2. Open a GitHub Discussion linking your RFC
|
|
91
|
+
3. A 14-day comment period follows
|
|
92
|
+
4. Maintainers vote to accept or reject
|
|
93
|
+
5. The decision and rationale are permanently recorded in the Discussion
|
|
94
|
+
|
|
95
|
+
### What does not require an RFC
|
|
96
|
+
|
|
97
|
+
- Bug fixes
|
|
98
|
+
- New optional trace fields
|
|
99
|
+
- New storage backend implementations
|
|
100
|
+
- New integration modules
|
|
101
|
+
- Documentation improvements
|
|
102
|
+
- Test additions
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Design partner issues
|
|
107
|
+
|
|
108
|
+
If your organisation has a deployment context — regulated industry, classified
|
|
109
|
+
environment, public sector — that tests Sentinel's architecture, open an issue
|
|
110
|
+
on GitHub to discuss design partner status.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Community
|
|
115
|
+
|
|
116
|
+
- **GitHub Discussions:** For RFCs, architecture questions, and design partner conversations
|
|
117
|
+
- Community channels TBD
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
By contributing to Sentinel, you agree that your contributions will be
|
|
124
|
+
licensed under the Apache License 2.0. See [LICENSE](LICENSE) for the
|
|
125
|
+
full licence text.
|
|
126
|
+
|
|
127
|
+
No Contributor License Agreement (CLA) is required. No contribution grants
|
|
128
|
+
any party the right to relicence this software.
|