|
1 | | -# ARCO — Claude Code Project Instructions |
| 1 | +# ARCO — Claude Code Instructions |
2 | 2 |
|
3 | | -## Project Identity |
| 3 | +ARCO = BFO/CCO-aligned OWL ontology for deterministic EU AI Act risk classification. OWL-RL reasoning + SHACL validation + SPARQL ASK produce outputs. No LLMs in the pipeline. |
4 | 4 |
|
5 | | -ARCO (Assurance & Regulatory Classification Ontology) is a BFO/CCO-aligned ontological framework for deterministic AI system risk classification under the EU AI Act. It produces regulatory determinations as logical consequences of modeled system structure, not probabilistic assessments. |
6 | | - |
7 | | -## Repository Structure |
8 | | - |
9 | | -``` |
10 | | -03_TECHNICAL_CORE/ |
11 | | - ontology/ |
12 | | - ARCO_core.ttl — Core ontology (BFO-aligned classes, bridge axioms) |
13 | | - ARCO_governance_extension.ttl — Provider roles, documentation workflow |
14 | | - ARCO_instances_sentinel.ttl — Sentinel-ID demo system instances |
15 | | - validation/ |
16 | | - assessment_documentation_shape.ttl — SHACL shapes |
17 | | - reasoning/ |
18 | | - check_high_risk_inference.sparql |
19 | | - check_assessment_traceability.sparql |
20 | | - detect_latent_risk.sparql |
21 | | - ask_provider_role_inheres_in_org.sparql |
22 | | - scripts/ |
23 | | - run_pipeline.py — Main execution pipeline |
24 | | -``` |
25 | | - |
26 | | -## Tech Stack |
27 | | - |
28 | | -- Python 3.10+, rdflib, pyshacl, owlrl |
29 | | -- OWL 2 (Turtle syntax), SHACL, SPARQL ASK queries |
30 | | -- OWL-RL reasoning profile via owlrl library |
31 | | -- GitHub Actions CI (`.github/workflows/arco-demo.yml`) |
32 | | - |
33 | | -## Build & Verify Commands |
| 5 | +## Build & Verify |
34 | 6 |
|
35 | 7 | ```bash |
36 | 8 | pip install -r requirements.txt |
37 | 9 | python 03_TECHNICAL_CORE/scripts/run_pipeline.py |
38 | 10 | ``` |
39 | 11 |
|
40 | | -Pipeline must: load ontology + instances → run OWL-RL reasoning → run SHACL validation → run all SPARQL ASK queries → emit REGULATORY DETERMINATION CERTIFICATE → write artifacts to runs/demo/ |
41 | | - |
42 | | -## Hard Constraints (NEVER violate these) |
43 | | - |
44 | | -1. **BFO/CCO Maximal Alignment**: Every class must trace to a BFO 2020 category. Every relation must use BFO or RO IRIs. No invented object properties. If CCO provides an applicable class or relation, use it. If a new domain class is needed, it must be a proper subclass of an existing BFO/CCO class with explicit justification. When reusing CCO IRIs locally (without full import), declare them with proper OWL typing (`owl:Class`, `owl:ObjectProperty`) — not just `rdfs:label` triples. |
45 | | - |
46 | | -2. **No Ad-Hoc Relations**: Do NOT create custom object properties like `intended_for_use_in`, `deployed_in_context`, `affects_persons`, etc. Use existing BFO/RO/IAO/CCO relations. When modeling "intended use," use the CCO Directive Information Content Entity + `cco:prescribes` pattern (see Ontological Patterns below). |
47 | | - |
48 | | -3. **Backward Compatibility**: Do not delete existing classes, instances, or inference chains. The Sentinel-ID demo must continue to pass all existing checks after any change. New additions must be additive. |
49 | | - |
50 | | -4. **Reality vs. Representation Separation**: System capabilities are reality-side (BFO dispositions inhering in independent continuants). Regulatory provisions, plans, and classifications are representation-side (IAO Information Content Entities). Never conflate these. |
51 | | - |
52 | | -5. **Deterministic Pipeline**: Classification must be derivable via OWL reasoning + SPARQL ASK queries. No probabilistic, scoring, or LLM-based classification in the pipeline itself. |
53 | | - |
54 | | -6. **Relation Vocabulary**: Use `ro:0000091` (has_disposition) for disposition relations, NOT `ro:0000053` (bearer_of). This is already established in the codebase. |
55 | | - |
56 | | -7. **No Future Particulars**: Do NOT create instances of processes that have not occurred. Intent is represented via directive information entities that are *about* universals (classes), not as instantiated future events. If modeling "the system is intended for biometric identification," create a Directive ICE that `cco:prescribes` a process *type* (class) — not a process instance. |
57 | | - |
58 | | -8. **Legal Categories Are Not Biological Kinds**: "Natural person" is a legal designation under EU law, not a biological universal. Model it as `NaturalPersonRole ⊑ bfo:0000023 (Role)`, not as a subclass of Object or Person. Anchor the role to a person continuant (`cco:Person`) so readers know what kind of entity bears it, but do NOT create person instances or role-bearing axioms for the demo. This applies to any legal status or classification. |
59 | | - |
60 | | -## Ontological Patterns (Use These) |
61 | | - |
62 | | -### Modeling "Intended Use" (CCO-Aligned) |
63 | | - |
64 | | -The EU AI Act classifies systems based on "intended use" (Annex III: "AI systems intended to be used for..."). In BFO/CCO, intended use is NOT a relation from system to context. It is a **Directive Information Content Entity** that **prescribes** a process type. |
65 | | - |
66 | | -**CCO Pattern**: `cco:DirectiveInformationContentEntity` uses `cco:prescribes` (domain: DirectiveICE, range: Entity). The `prescribes` relation means "serves as a rule or guide for an Occurrent, or serves as a model for a Continuant." |
67 | | - |
68 | | -**Implementation**: |
69 | | -```turtle |
70 | | -# Class level (in governance extension) |
71 | | -:IntendedUseSpecification rdfs:subClassOf cco:DirectiveInformationContentEntity . |
72 | | -
|
73 | | -# Instance level |
74 | | -:Sentinel_IntendedUse_001 a :IntendedUseSpecification ; |
75 | | - cco:prescribes :RemoteBiometricIdentificationProcessType ; |
76 | | - iao:0000136 :Sentinel_ID_System ; |
77 | | - iao:0000136 :RemoteBiometricIdentificationProcessType . |
78 | | -``` |
79 | | - |
80 | | -This means: "There exists a directive information artifact that is about the Sentinel system and that prescribes a remote biometric identification process type." |
81 | | - |
82 | | -### Modeling Use Scenario Context (CCO-Aligned) |
83 | | - |
84 | | -Annex III items specify not just capability and process, but **affected entities** ("of natural persons"). This context is modeled as a separate Directive ICE — a `UseScenarioSpecification` — that constrains the realization context. It is `iao:0000136` (is_about) the system, the process type, the person universal, and the legal role: |
85 | | - |
86 | | -```turtle |
87 | | -:UseScenarioSpecification rdfs:subClassOf cco:DirectiveInformationContentEntity . |
88 | | -
|
89 | | -:Sentinel_UseScenario_001 a :UseScenarioSpecification ; |
90 | | - iao:0000136 :Sentinel_ID_System ; |
91 | | - iao:0000136 :RemoteBiometricIdentificationProcessType ; |
92 | | - iao:0000136 cco:Person ; |
93 | | - iao:0000136 :NaturalPersonRole . |
94 | | -``` |
95 | | - |
96 | | -This reads: "the scenario concerns persons, specifically under the legal designation natural person." It gives a **three-gate** Annex III classification: capability (reality-side) + intended use (process prescribed) + scenario (who is affected). |
97 | | - |
98 | | -### Modeling Regulatory Provisions |
99 | | - |
100 | | -Annex III conditions are ICE instances. They use `iao:0000136` (is_about) to reference ALL universals they regulate — capability, process type, and affected role. This makes conditions interoperable across systems (different AI systems can be evaluated against the same regulatory condition without bespoke mapping). |
101 | | - |
102 | | -### Modeling Classification Determination |
103 | | - |
104 | | -`HighRiskDetermination` is a subclass of `ComplianceDetermination` (which is an ICE). It is `iao:0000136` (is_about) the system AND the Annex III condition. It is the **output** of a process (`cco:has_output`). |
105 | | - |
106 | | -### Component-Level Disposition Tracing |
107 | | - |
108 | | -AI systems (ObjectAggregate) `bfo:0000051` (has_part) SystemComponents. SystemComponents `ro:0000091` (has_disposition) CapabilityDispositions. This traces regulatory exposure to the component that bears the capability — the "latent capability" insight. Preserve this pattern. |
109 | | - |
110 | | -## EU AI Act Alignment Requirements |
| 12 | +Run after every change. Must print "ALL CHECKS PASSED" and exit 0. |
111 | 13 |
|
112 | | -### Annex III Structure |
113 | | -Every Annex III item follows the pattern: "AI systems **intended to be used** for [capability/process] **of** [affected entities] in [domain context]". Full classification requires: |
114 | | -- The system bears the relevant capability disposition (reality-side) |
115 | | -- There exists an intended use specification prescribing the regulated process type (directive ICE) |
116 | | -- There exists a use scenario specification constraining the realization context to affected entities (directive ICE) |
| 14 | +## Context Selection |
117 | 15 |
|
118 | | -### Article 6(3) Derogation |
119 | | -An Annex III system may NOT be high-risk if it "does not pose a significant risk of harm" — specifically if: |
120 | | -- (a) intended to perform a narrow procedural task |
121 | | -- (b) intended to improve the result of a previously completed human activity |
122 | | -- (c) intended to detect decision-making patterns without replacing/influencing assessment |
123 | | -- (d) intended to perform a preparatory task |
| 16 | +### PRIORITY (auto-load for technical tasks) |
| 17 | +- `03_TECHNICAL_CORE/ontology/*.ttl` — Ontology + instances |
| 18 | +- `03_TECHNICAL_CORE/validation/*.ttl` — SHACL shapes |
| 19 | +- `03_TECHNICAL_CORE/scripts/run_pipeline.py` — Pipeline |
| 20 | +- `03_TECHNICAL_CORE/reasoning/*.sparql` — SPARQL ASK queries |
124 | 21 |
|
125 | | -**Exception to the exception**: profiling of natural persons ALWAYS triggers high-risk. |
| 22 | +### SECONDARY (only if explicitly needed) |
| 23 | +- `01_COMMERCIAL/`, `02_SYSTEM_OVERVIEW/`, `04_DIAGRAMS_AND_MODELS/`, `05_TECHNICAL_IMPLEMENTATION/` |
| 24 | +- `README.md`, `ONTOLOGY_REVIEW.md`, `.github/workflows/` |
126 | 25 |
|
127 | | -Model derogation claims as ICE artifacts (descriptive, asserting non-significance) that can be queried. |
| 26 | +### NEVER AUTOLOAD |
| 27 | +- `runs/demo/*`, `03_TECHNICAL_CORE/.venv/`, generated artifacts, logs |
128 | 28 |
|
129 | | -### Annex III Category 1 — Biometrics (Current Focus) |
130 | | -- 1(a): Remote biometric identification systems (NOT verification-only) |
131 | | -- 1(b): Biometric categorisation by sensitive attributes |
132 | | -- 1(c): Emotion recognition |
| 29 | +## Architectural Memory |
133 | 30 |
|
134 | | -The Sentinel-ID demo covers 1(a). The exclusion for "biometric verification the sole purpose of which is to confirm identity" is important and should eventually be modelable. |
| 31 | +### Classes — Reality-Side (`ARCO_core.ttl`) |
| 32 | +- `System` ⊑ ObjectAggregate — has_part some SystemComponent |
| 33 | +- `SystemComponent` ⊑ Object; `HardwareComponent` ⊑ SystemComponent — has_disposition some CapabilityDisposition |
| 34 | +- `CapabilityDisposition` ⊑ Disposition; `BiometricIdentificationCapability` ⊑ CapabilityDisposition |
| 35 | +- `SoftwareArtifact` ⊑ ICE — NOT a SystemComponent |
135 | 36 |
|
136 | | -## Current Known Issues (Fix These) |
| 37 | +### Classes — Representation-Side (`ARCO_core.ttl`) |
| 38 | +- `ComplianceDetermination` ⊑ ICE; `HighRiskDetermination` ⊑ ComplianceDetermination |
137 | 39 |
|
138 | | -**NOTE: The pipeline (Phase 0) is already fixed and working.** It runs OWL-RL reasoning, all SPARQL queries, SHACL validation, emits the certificate, and prints "ALL CHECKS PASSED." The issues below are what remain: |
| 40 | +### Classes — Governance (`ARCO_governance_extension.ttl`) |
| 41 | +- `IntendedUseSpecification`, `UseScenarioSpecification`, `ComplianceObligationSpecification` ⊑ DirectiveICE |
| 42 | +- `ProviderOrganization` ⊑ Organization; `ProviderRole`, `DeployerRole` ⊑ Role |
| 43 | +- `NaturalPersonRole` ⊑ Role; `RemoteBiometricIdentificationProcess` ⊑ Process |
| 44 | +- `AnnexIII1aApplicableSystem` ≡ 3-gate (capability + intended use + scenario) |
139 | 45 |
|
140 | | -1. **Instance typing**: `HighRisk_Determination_001` is typed as `:ComplianceDetermination` but should be `:HighRiskDetermination` (which subclasses it). |
| 46 | +### Bridge Axioms |
| 47 | +- `AnnexIIITriggeringCapability` ≡ union(BiometricIdentificationCapability) |
| 48 | +- `HighRiskSystem` ≡ System ∩ has_part some (has_disposition some AnnexIIITriggeringCapability) |
141 | 49 |
|
142 | | -2. **No intended use modeling**: Current bridge axiom fires on capability alone without intended use context. This is ontologically incomplete per Annex III. |
| 50 | +### Relations (all BFO/RO/IAO/CCO — no custom properties) |
| 51 | +`bfo:0000051` has_part · `ro:0000091` has_disposition · `iao:0000136` is_about · `cco:prescribes` · `cco:has_output` · `ro:0000057` has_participant · `ro:0000087` has_role |
143 | 52 |
|
144 | | -3. **Hardware-only component constraint**: `SystemShape` SHACL requires hardware components only. Should allow broader `SystemComponent` class. |
| 53 | +### Pipeline Flow |
| 54 | +Load TTL → OWL-RL → SHACL → SPARQL ASK → certificate → `runs/demo/` |
145 | 55 |
|
146 | | -## Regression Testing |
| 56 | +## Execution Rules |
147 | 57 |
|
148 | | -Run `python 03_TECHNICAL_CORE/scripts/run_pipeline.py` after every coherent unit of change. Pass criteria: OWL-RL reasoning runs, all SPARQL queries return True, SHACL conforms, certificate emits, "ALL CHECKS PASSED" prints, exit 0. If a step breaks the pipeline, fix it before proceeding. Do not batch changes that touch existing triples, restrictions, or shapes — test immediately. |
| 58 | +- Use Architectural Memory before reading files. Do not re-derive architecture. Do NOT read TTL files to answer conceptual questions — use the Architectural Memory. Only read TTL files when editing them or verifying exact syntax, unless instructed for an extensive or full review. |
| 59 | +- No repo-wide scanning. Grep within `03_TECHNICAL_CORE/` only. |
| 60 | +- Minimal patches. No full rewrites unless requested. |
| 61 | +- After every change, run pipeline. Do not batch changes to triples/shapes. |
| 62 | +- If usage is low: save state, short summary, stop. |
149 | 63 |
|
150 | | -## What NOT To Do |
| 64 | +## Detail Files (load only when needed) |
151 | 65 |
|
152 | | -- Do not rewrite the HighRiskSystem OWL equivalentClass axiom yet (keep capability-based inference as "latent risk detection") |
153 | | -- Do not model all 8 Annex III categories — biometrics only for now |
154 | | -- Do not create a separate file for every Annex III item |
155 | | -- Do not add CCO as a full import (too heavy) — declare needed CCO classes/relations locally with their IRIs and proper OWL typing |
156 | | -- Do not refactor directory structure |
157 | | -- Do not touch GitHub Actions workflow files unless pipeline output format changes require it |
158 | | -- Do not model NaturalPerson as a biological subclass — if you need a person universal, use `cco:Person`; represent "natural person" as `NaturalPersonRole ⊑ bfo:Role` |
159 | | -- Do not create Person instances or role-bearing axioms for the demo — use aboutness (`iao:0000136`) only |
| 66 | +| File | Read when... | |
| 67 | +|------|-------------| |
| 68 | +| `docs/agent/ontology_rules.md` | Editing TTL, adding classes/relations, modeling new concepts | |
| 69 | +| `docs/agent/coding_rules.md` | Modifying pipeline, scripts, CI, repo structure | |
| 70 | +| `docs/agent/eu_ai_act_rules.md` | Working on Annex III, Article 6, classification logic | |
0 commit comments