@aigis-ai/cli 1.0.3 → 2.0.1

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.
Files changed (124) hide show
  1. package/CONTRIBUTING.md +53 -0
  2. package/SKILL.md +20 -55
  3. package/bin/aigis.js +446 -59
  4. package/cli-python/LICENSE +21 -0
  5. package/cli-python/README.md +32 -0
  6. package/cli-python/aigis_cli/SKILL.md +70 -0
  7. package/cli-python/aigis_cli/__init__.py +3 -0
  8. package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
  9. package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
  10. package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
  11. package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
  12. package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
  13. package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
  14. package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
  15. package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
  16. package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
  17. package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
  18. package/cli-python/aigis_cli/annotate.py +45 -0
  19. package/cli-python/aigis_cli/auto_verify.py +518 -0
  20. package/cli-python/aigis_cli/build.py +470 -0
  21. package/cli-python/aigis_cli/checksum.py +22 -0
  22. package/cli-python/aigis_cli/classify.py +192 -0
  23. package/cli-python/aigis_cli/cli.py +618 -0
  24. package/cli-python/aigis_cli/content/index/audit-scan.md +217 -0
  25. package/cli-python/aigis_cli/content/index/auto-verify-rules.json +439 -0
  26. package/cli-python/aigis_cli/content/index/context-rules.json +90 -0
  27. package/cli-python/aigis_cli/content/index/frameworks.md +82 -0
  28. package/cli-python/aigis_cli/content/index/guardrails.json +23 -0
  29. package/cli-python/aigis_cli/content/index/taxonomy.md +81 -0
  30. package/cli-python/aigis_cli/content/resolvers/triggers.json +229 -0
  31. package/{content/implement → cli-python/aigis_cli/content/skills/areas}/audit-logging.md +5 -0
  32. package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +200 -0
  33. package/cli-python/aigis_cli/content/skills/areas/input-validation.md +380 -0
  34. package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +189 -0
  35. package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +246 -0
  36. package/cli-python/aigis_cli/content/skills/core.md +62 -0
  37. package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +202 -0
  38. package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +169 -0
  39. package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +167 -0
  40. package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +86 -0
  41. package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +54 -0
  42. package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +39 -0
  43. package/cli-python/aigis_cli/content/templates/risk-characterization.md +34 -0
  44. package/cli-python/aigis_cli/content/templates/third-party-assessment.md +41 -0
  45. package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +13 -0
  46. package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +13 -0
  47. package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +13 -0
  48. package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +12 -0
  49. package/cli-python/aigis_cli/content/verify/checklist-explainability.md +13 -0
  50. package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +13 -0
  51. package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +14 -0
  52. package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +16 -0
  53. package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +13 -0
  54. package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +14 -0
  55. package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +14 -0
  56. package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +13 -0
  57. package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +12 -0
  58. package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +13 -0
  59. package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +13 -0
  60. package/cli-python/aigis_cli/fetch.py +232 -0
  61. package/cli-python/aigis_cli/init_ide.py +159 -0
  62. package/cli-python/aigis_cli/keywords.py +73 -0
  63. package/cli-python/aigis_cli/search.py +69 -0
  64. package/cli-python/aigis_cli.egg-info/PKG-INFO +59 -0
  65. package/cli-python/aigis_cli.egg-info/SOURCES.txt +56 -0
  66. package/cli-python/aigis_cli.egg-info/dependency_links.txt +1 -0
  67. package/cli-python/aigis_cli.egg-info/entry_points.txt +2 -0
  68. package/cli-python/aigis_cli.egg-info/requires.txt +6 -0
  69. package/cli-python/aigis_cli.egg-info/top_level.txt +1 -0
  70. package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
  71. package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
  72. package/cli-python/pyproject.toml +49 -0
  73. package/content/index/audit-scan.md +21 -207
  74. package/content/index/auto-verify-rules.json +439 -0
  75. package/content/index/context-rules.json +90 -0
  76. package/content/resolvers/triggers.json +229 -0
  77. package/content/skills/areas/audit-logging.md +176 -0
  78. package/content/skills/areas/bias-monitoring.md +172 -0
  79. package/content/skills/areas/confidence-scoring.md +180 -0
  80. package/content/skills/areas/data-integrity.md +257 -0
  81. package/content/skills/areas/explainability.md +174 -0
  82. package/content/skills/areas/fallback-patterns.md +200 -0
  83. package/content/skills/areas/human-oversight.md +220 -0
  84. package/content/skills/areas/input-validation.md +380 -0
  85. package/content/skills/areas/monitoring.md +207 -0
  86. package/content/skills/areas/output-sanitization.md +183 -0
  87. package/content/skills/areas/pii-handling.md +189 -0
  88. package/content/skills/areas/prompt-security.md +153 -0
  89. package/content/skills/areas/rag-security.md +230 -0
  90. package/content/skills/areas/rate-limiting.md +246 -0
  91. package/content/skills/areas/supply-chain.md +193 -0
  92. package/content/skills/core.md +62 -0
  93. package/content/skills/infrastructure/logging.md +202 -0
  94. package/content/skills/infrastructure/rate-limiting.md +169 -0
  95. package/content/skills/infrastructure/secrets.md +167 -0
  96. package/content/skills/workflows/fastapi-llm.md +86 -0
  97. package/docs/resolvers.md +114 -0
  98. package/lib/auto-verify.js +378 -0
  99. package/lib/build.js +629 -0
  100. package/lib/checksum.js +39 -0
  101. package/lib/fetch.js +164 -9
  102. package/lib/init.js +141 -93
  103. package/lib/keywords.js +92 -130
  104. package/lib/special-recognizers.js +370 -0
  105. package/package.json +1 -1
  106. package/scripts/baseline-cursorrules.snapshot.txt +30 -0
  107. package/scripts/bootstrap-step-6-bench.js +85 -0
  108. package/scripts/check-content-sync.js +91 -0
  109. package/scripts/triggers.schema.json +50 -0
  110. package/scripts/validate-triggers.js +176 -0
  111. package/content/implement/fallback-patterns.md +0 -190
  112. package/content/implement/input-validation.md +0 -212
  113. package/content/implement/pii-handling.md +0 -207
  114. package/content/implement/rate-limiting.md +0 -217
  115. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/bias-monitoring.md +0 -0
  116. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/confidence-scoring.md +0 -0
  117. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/data-integrity.md +0 -0
  118. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/explainability.md +0 -0
  119. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/human-oversight.md +0 -0
  120. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/monitoring.md +0 -0
  121. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/output-sanitization.md +0 -0
  122. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/prompt-security.md +0 -0
  123. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/rag-security.md +0 -0
  124. /package/{content/implement → cli-python/aigis_cli/content/skills/areas}/supply-chain.md +0 -0
@@ -0,0 +1,90 @@
1
+ {
2
+ "_doc": "Context rules for `aigis get --context <name>`. A rule declares that a specific pattern heading in a file applies only to the listed contexts. Patterns NOT listed here apply to every context. The filter removes a pattern block (header through next pattern-header or section break) when the requested context is not in the pattern's context list. Manifest-driven so we don't have to inline-tag every code block; can be evolved per Step 4's content rewrite.",
3
+ "_schema_rule": {
4
+ "file": "implement file id (without .md)",
5
+ "pattern_heading_prefix": "heading text prefix at level 3 (### ...) to match",
6
+ "contexts": ["list of context names where this pattern applies"]
7
+ },
8
+ "_known_contexts": ["web", "agentic", "rag", "batch"],
9
+
10
+ "rules": [
11
+ {
12
+ "file": "input-validation",
13
+ "pattern_heading_prefix": "Pattern 5",
14
+ "contexts": ["web", "agentic"],
15
+ "reason": "Injection pattern detection is most relevant when input comes from users (web API) or tool calls (agentic). Batch pipelines with vetted inputs often skip this."
16
+ },
17
+ {
18
+ "file": "human-oversight",
19
+ "pattern_heading_prefix": "Pattern 1",
20
+ "contexts": ["agentic"],
21
+ "reason": "Tool allowlist pattern only applies to agentic systems that expose tools/functions."
22
+ },
23
+ {
24
+ "file": "human-oversight",
25
+ "pattern_heading_prefix": "Pattern 2",
26
+ "contexts": ["agentic"],
27
+ "reason": "Approval gates for mutating operations apply only when the system executes actions, not when it only recommends."
28
+ },
29
+ {
30
+ "file": "rag-security",
31
+ "pattern_heading_prefix": "Pattern 1",
32
+ "contexts": ["rag"],
33
+ "reason": "Vector DB access control is RAG-specific."
34
+ },
35
+ {
36
+ "file": "rag-security",
37
+ "pattern_heading_prefix": "Pattern 2",
38
+ "contexts": ["rag"],
39
+ "reason": "Tenant isolation applies to RAG multi-tenant systems."
40
+ },
41
+ {
42
+ "file": "rag-security",
43
+ "pattern_heading_prefix": "Pattern 3",
44
+ "contexts": ["rag"],
45
+ "reason": "Retrieval validation is RAG-specific."
46
+ },
47
+ {
48
+ "file": "rag-security",
49
+ "pattern_heading_prefix": "Pattern 4",
50
+ "contexts": ["rag"],
51
+ "reason": "Embedding endpoint protection is RAG-specific."
52
+ },
53
+ {
54
+ "file": "rag-security",
55
+ "pattern_heading_prefix": "Pattern 5",
56
+ "contexts": ["rag"],
57
+ "reason": "Permission inheritance on embeddings is RAG-specific."
58
+ },
59
+ {
60
+ "file": "data-integrity",
61
+ "pattern_heading_prefix": "Pattern 2",
62
+ "contexts": ["rag", "batch"],
63
+ "reason": "Pre-embedding validation only applies to systems that ingest into a vector store or training pipeline."
64
+ },
65
+ {
66
+ "file": "data-integrity",
67
+ "pattern_heading_prefix": "Pattern 3",
68
+ "contexts": ["batch"],
69
+ "reason": "Dataset versioning is primarily for fine-tuning / batch training pipelines."
70
+ },
71
+ {
72
+ "file": "data-integrity",
73
+ "pattern_heading_prefix": "Pattern 4",
74
+ "contexts": ["rag", "batch"],
75
+ "reason": "Distribution monitoring applies to systems with embeddings or training datasets."
76
+ },
77
+ {
78
+ "file": "data-integrity",
79
+ "pattern_heading_prefix": "Pattern 5",
80
+ "contexts": ["rag", "batch"],
81
+ "reason": "Batch rollback capability applies to ingestion / training pipelines."
82
+ },
83
+ {
84
+ "file": "rate-limiting",
85
+ "pattern_heading_prefix": "Pattern 1",
86
+ "contexts": ["web"],
87
+ "reason": "Per-user rate limits apply primarily to user-facing APIs."
88
+ }
89
+ ]
90
+ }
@@ -0,0 +1,82 @@
1
+ ---
2
+ id: frameworks-index
3
+ title: Compact framework index
4
+ token_budget: ~1500
5
+ version: "1.1"
6
+ ---
7
+
8
+ # NIST AI RMF 1.0
9
+
10
+ ## GOVERN (cross-cutting)
11
+ - GOVERN 1: Policies, processes, procedures for AI risk management
12
+ - GOVERN 2: Accountability structures and roles
13
+ - GOVERN 3: Workforce diversity in AI risk teams
14
+ - GOVERN 4: Organizational risk culture
15
+ - GOVERN 5: External stakeholder engagement processes
16
+ - GOVERN 6: Third-party AI and supply chain policies
17
+
18
+ ## MAP (context and risk identification)
19
+ - MAP 1: Context establishment (purpose, users, setting, laws)
20
+ - MAP 2: AI system categorization (tasks, methods, knowledge limits, data)
21
+ - MAP 3: Benefits and costs analysis (capabilities, benchmarks, oversight)
22
+ - MAP 4: Third-party component risk mapping
23
+ - MAP 5: Impact characterization (likelihood, magnitude)
24
+
25
+ ## MEASURE (evaluation and testing)
26
+ - MEASURE 1: Methods and metrics selection
27
+ - MEASURE 2: Trustworthiness evaluation:
28
+ - 2.1: Test set and tool documentation
29
+ - 2.2: Human subject evaluation requirements
30
+ - 2.3: Performance in deployment conditions
31
+ - 2.4: Functionality monitoring in production
32
+ - 2.5: Validity, reliability, generalizability limits
33
+ - 2.6: Safety evaluation (fail-safe, monitoring, response)
34
+ - 2.7: Security and resilience evaluation
35
+ - 2.8: Transparency and accountability evaluation
36
+ - 2.9: Explainability and interpretability
37
+ - 2.10: Privacy risk evaluation
38
+ - 2.11: Fairness and bias evaluation
39
+ - 2.12: Environmental impact
40
+ - 2.13: TEVV effectiveness
41
+ - MEASURE 3: Risk tracking over time
42
+ - MEASURE 4: Measurement effectiveness feedback
43
+
44
+ ## MANAGE (response and monitoring)
45
+ - MANAGE 1: Risk prioritization and response planning
46
+ - MANAGE 2: Benefit maximization / harm minimization
47
+ - MANAGE 3: Third-party risk management
48
+ - MANAGE 4: Post-deployment monitoring, incident response, change management
49
+
50
+ ---
51
+
52
+ # OWASP Top 10 for LLM Applications (2025)
53
+
54
+ - LLM01: Prompt Injection — manipulating inputs to override instructions
55
+ - LLM02: Sensitive Information Disclosure — leaking PII, secrets, proprietary data
56
+ - LLM03: Supply Chain — third-party model, data, and plugin risks
57
+ - LLM04: Data and Model Poisoning — tampered training/RAG data
58
+ - LLM05: Improper Output Handling — unsanitized output to downstream systems
59
+ - LLM06: Excessive Agency — too much LLM autonomy, insufficient oversight
60
+ - LLM07: System Prompt Leakage — extraction of internal instructions (new 2025)
61
+ - LLM08: Vector and Embedding Weaknesses — RAG/embedding vulnerabilities (new 2025)
62
+ - LLM09: Misinformation — hallucinations, false facts, unverified claims
63
+ - LLM10: Unbounded Consumption — DoS, cost explosion, resource abuse
64
+
65
+ ---
66
+
67
+ # ISO/IEC 42001:2023
68
+
69
+ ## Clauses
70
+ - Clause 4: Context of the organization
71
+ - Clause 5: Leadership commitment and AI policy
72
+ - Clause 6: Planning (risk assessment, AI impact assessment, objectives)
73
+ - Clause 7: Support (resources, competence, documentation)
74
+ - Clause 8: Operation (controls, risk treatment, AI system impact assessment)
75
+ - Clause 9: Performance evaluation (monitoring, audit, management review)
76
+ - Clause 10: Improvement (corrective action, continual improvement)
77
+
78
+ ## Annexes
79
+ - Annex A: Control objectives (A.2-A.10: policies, organization, resources, impact, lifecycle, data, transparency, use, third-party)
80
+ - Annex B: Implementation guidance
81
+ - Annex C: AI-specific objectives and risk sources
82
+ - Annex D: Cross-industry guidance
@@ -0,0 +1,23 @@
1
+ {
2
+ "version": "1.1",
3
+ "guardrails": [
4
+ {"id": "G1", "condition": "any_sensitive_data AND NOT audit-logging", "action": "ADD audit-logging", "rationale": "Sensitive data requires traceability"},
5
+ {"id": "G2", "condition": "handles-health AND NOT bias-monitoring", "action": "ADD bias-monitoring", "rationale": "Health data has demographic bias risks"},
6
+ {"id": "G3", "condition": "handles-financial AND influences-decisions AND NOT fallback-patterns", "action": "ADD fallback-patterns", "rationale": "Financial decisions need safe failure modes"},
7
+ {"id": "G4", "condition": "is-agentic AND NOT human-oversight", "action": "ADD human-oversight", "rationale": "Autonomous systems need oversight"},
8
+ {"id": "G5", "condition": "generates-code AND NOT output-sanitization", "action": "ADD output-sanitization", "rationale": "Generated code is execution risk"},
9
+ {"id": "G6", "condition": "jurisdiction-eu AND NOT explainability", "action": "ADD explainability", "rationale": "EU AI Act requires explainability"},
10
+ {"id": "G7", "condition": "jurisdiction-eu AND NOT bias-monitoring", "action": "ADD bias-monitoring", "rationale": "EU AI Act mandates non-discrimination"},
11
+ {"id": "G8", "condition": "handles-minors AND NOT human-oversight", "action": "ADD human-oversight", "rationale": "Systems affecting children require review"},
12
+ {"id": "G9", "condition": "multi-model-pipeline AND NOT monitoring", "action": "ADD monitoring", "rationale": "Multi-model compounding failures"},
13
+ {"id": "G10", "condition": "risk_tier=HIGH AND NOT monitoring", "action": "ADD monitoring", "rationale": "High-risk systems need monitoring"},
14
+ {"id": "G11", "condition": "risk_tier=HIGH AND NOT fallback-patterns", "action": "ADD fallback-patterns", "rationale": "High-risk systems must fail safely"},
15
+ {"id": "G12", "condition": "uses-llm AND NOT uses-thirdparty-api AND supply-chain SELECTED", "action": "REMOVE supply-chain", "rationale": "Self-hosted models skip third-party controls"},
16
+ {"id": "G13", "condition": "jurisdiction-us-regulated AND NOT audit-logging", "action": "ADD audit-logging", "rationale": "US regulated industries need audit trails"},
17
+ {"id": "G14", "condition": "jurisdiction-us-regulated AND NOT human-oversight", "action": "ADD human-oversight", "rationale": "US regulated industries need human review"},
18
+ {"id": "G15", "condition": "generates-code AND NOT human-oversight", "action": "ADD human-oversight", "rationale": "Code generation needs human review"}
19
+ ],
20
+ "constraints": [
21
+ {"id": "C1", "rule": "is-internal AND is-external cannot both be true", "resolution": "Treat as is-external, log warning"}
22
+ ]
23
+ }
@@ -0,0 +1,81 @@
1
+ ---
2
+ id: classification-taxonomy
3
+ title: System trait classification taxonomy
4
+ version: "1.1"
5
+ ---
6
+
7
+ # Classification taxonomy
8
+
9
+ Select all traits that apply to the AI system being built. The combination determines risk tier and which implement/ files to fetch.
10
+
11
+ ## AI architecture
12
+
13
+ | Trait | Description | Triggers files |
14
+ |-------|-------------|----------------|
15
+ | uses-llm | System calls or embeds a large language model | input-validation, output-sanitization, prompt-security, audit-logging, monitoring |
16
+ | uses-rag | System retrieves context from a vector database before LLM inference | rag-security, data-integrity |
17
+ | uses-finetuned | System uses a fine-tuned or custom-trained model | data-integrity, supply-chain |
18
+ | uses-thirdparty-api | System calls an external model provider API | supply-chain |
19
+ | is-agentic | System takes actions autonomously (DB writes, API calls, code execution) | human-oversight, rate-limiting, fallback-patterns, audit-logging |
20
+ | is-multimodal | System processes or generates images, audio, or video | input-validation, output-sanitization, pii-handling |
21
+
22
+ ## Data sensitivity
23
+
24
+ | Trait | Description | Triggers files |
25
+ |-------|-------------|----------------|
26
+ | processes-pii | System ingests, processes, or outputs personally identifiable information | pii-handling, audit-logging |
27
+ | handles-financial | System processes financial records, transactions, or credit data | pii-handling, audit-logging, bias-monitoring |
28
+ | handles-health | System processes health records, medical histories, or clinical data | pii-handling, audit-logging, bias-monitoring, explainability |
29
+ | handles-proprietary | System processes confidential business info or trade secrets | pii-handling, prompt-security |
30
+ | handles-minors | System may process data from or about minors | pii-handling, bias-monitoring, human-oversight |
31
+
32
+ ## Impact scope
33
+
34
+ | Trait | Description | Triggers files |
35
+ |-------|-------------|----------------|
36
+ | influences-decisions | System output influences decisions about specific people | bias-monitoring, confidence-scoring, human-oversight, explainability |
37
+ | accepts-user-input | System accepts unstructured text input from users | input-validation, output-sanitization |
38
+ | is-external | System is accessible to customers or public users | rate-limiting, confidence-scoring |
39
+ | is-internal | System is accessible only to employees | (no direct file triggers — reduces risk tier if sole scope trait) |
40
+ | is-high-volume | System handles >1000 requests/day or >100 concurrent users | rate-limiting, monitoring, fallback-patterns |
41
+
42
+ ## Output type
43
+
44
+ | Trait | Description | Triggers files |
45
+ |-------|-------------|----------------|
46
+ | generates-code | System produces code that is subsequently executed | output-sanitization, human-oversight, fallback-patterns |
47
+ | generates-content | System produces text/media published externally | confidence-scoring, bias-monitoring, audit-logging |
48
+ | multi-model-pipeline | System chains multiple AI models in sequence | audit-logging, monitoring, fallback-patterns, data-integrity |
49
+
50
+ ## Regulatory jurisdiction
51
+
52
+ | Trait | Description | Effect |
53
+ |-------|-------------|--------|
54
+ | jurisdiction-eu | System deployed in or serving EU users (EU AI Act scope) | Elevates risk tier by one level. Forces ai-impact-assessment. Adds bias-monitoring and explainability via guardrails |
55
+ | jurisdiction-us-regulated | System in US regulated sector (HIPAA, FCRA, FERPA, etc.) | Forces ai-impact-assessment and intended-purpose-doc. Adds audit-logging and human-oversight via guardrails |
56
+ | jurisdiction-global | System serves users across multiple countries | Treated as jurisdiction-eu (applies strictest rules) |
57
+
58
+ ---
59
+
60
+ # Risk tier rules
61
+
62
+ HIGH if: influences-decisions OR handles-health OR (handles-financial AND accepts-user-input) OR handles-minors OR (jurisdiction-eu AND any-sensitive-data) OR (generates-code AND is-external) OR (generates-code AND is-agentic)
63
+
64
+ MEDIUM if: processes-pii OR is-external OR is-agentic OR handles-proprietary OR generates-content OR multi-model-pipeline OR jurisdiction-us-regulated OR generates-code
65
+
66
+ LOW if: none of the above
67
+
68
+ Modifier: jurisdiction-eu elevates tier by one level (LOW->MEDIUM, MEDIUM->HIGH). jurisdiction-global treated as jurisdiction-eu.
69
+ Modifier: is-internal with no other medium/high triggers keeps tier at LOW.
70
+ Constraint: is-internal and is-external cannot both be true. If both provided, treat as is-external and log warning.
71
+
72
+ ---
73
+
74
+ # Templates by risk tier
75
+
76
+ HIGH: ai-impact-assessment, intended-purpose-doc, risk-characterization, third-party-assessment (if uses-thirdparty-api)
77
+ MEDIUM: intended-purpose-doc, third-party-assessment (if uses-thirdparty-api)
78
+ LOW: none required (intended-purpose-doc recommended)
79
+
80
+ Override: jurisdiction-eu always forces ai-impact-assessment regardless of tier.
81
+ Override: jurisdiction-us-regulated always forces ai-impact-assessment and intended-purpose-doc regardless of tier.
@@ -0,0 +1,229 @@
1
+ {
2
+ "version": "1.0",
3
+ "tier_rule": "High-confidence: phrase implies the listed traits in essentially every realistic project where it appears (no plausible counterexample). Low-confidence: phrase implies the traits only some of the time (a realistic counter-project exists). Decision rule: if you can describe a project where the phrase appears but the trait does not apply, the entry is low-confidence. When in doubt, low-confidence.",
4
+
5
+ "high_confidence": {
6
+ "Anthropic": {
7
+ "traits": ["uses-llm", "uses-thirdparty-api"],
8
+ "confidence": "high",
9
+ "notes": "Mentioning the provider implies third-party + LLM."
10
+ },
11
+ "chatbot": {
12
+ "traits": ["uses-llm", "accepts-user-input"],
13
+ "confidence": "high",
14
+ "notes": "Any LLM-backed conversational interface."
15
+ },
16
+ "Claude": {
17
+ "traits": ["uses-llm", "uses-thirdparty-api"],
18
+ "confidence": "high",
19
+ "notes": "Specific model name implies the provider."
20
+ },
21
+ "code assistant": {
22
+ "traits": ["uses-llm", "generates-code"],
23
+ "confidence": "high",
24
+ "notes": "Code completion or code-explanation tooling."
25
+ },
26
+ "coding agent": {
27
+ "traits": ["uses-llm", "generates-code", "is-agentic"],
28
+ "confidence": "high",
29
+ "notes": "Agent that reads and writes code (Cursor-style)."
30
+ },
31
+ "fine-tune": {
32
+ "traits": ["uses-finetuned"],
33
+ "confidence": "high",
34
+ "notes": "Matches 'fine-tune', 'fine-tuned', 'fine-tuning'."
35
+ },
36
+ "function calling": {
37
+ "traits": ["is-agentic", "uses-llm"],
38
+ "confidence": "high",
39
+ "notes": "OpenAI/Anthropic function/tool calling — by definition agentic."
40
+ },
41
+ "GDPR": {
42
+ "traits": ["jurisdiction-eu"],
43
+ "confidence": "high",
44
+ "notes": "EU regulatory scope."
45
+ },
46
+ "GPT-4": {
47
+ "traits": ["uses-llm", "uses-thirdparty-api"],
48
+ "confidence": "high",
49
+ "notes": "Matches 'GPT-4', 'GPT-4o', 'GPT-4 Turbo' via substring."
50
+ },
51
+ "HIPAA": {
52
+ "traits": ["handles-health", "jurisdiction-us-regulated"],
53
+ "confidence": "high",
54
+ "notes": "Mentioning HIPAA implies health data + US regulated."
55
+ },
56
+ "OpenAI": {
57
+ "traits": ["uses-llm", "uses-thirdparty-api"],
58
+ "confidence": "high",
59
+ "notes": "Same pattern as Anthropic."
60
+ },
61
+ "RAG": {
62
+ "traits": ["uses-rag", "uses-llm"],
63
+ "confidence": "high",
64
+ "notes": "Retrieval-augmented generation. Spelled out in next entry."
65
+ },
66
+ "retrieval-augmented generation": {
67
+ "traits": ["uses-rag", "uses-llm"],
68
+ "confidence": "high",
69
+ "notes": "Spelled-out form of RAG."
70
+ },
71
+ "tool calling": {
72
+ "traits": ["is-agentic", "uses-llm"],
73
+ "confidence": "high",
74
+ "notes": "Same concept as function calling."
75
+ },
76
+ "vector database": {
77
+ "traits": ["uses-rag"],
78
+ "confidence": "high",
79
+ "notes": "Pinecone/Weaviate/Chroma/pgvector — any of these implies RAG."
80
+ }
81
+ },
82
+
83
+ "low_confidence": {
84
+ "AI agent": {
85
+ "traits": ["is-agentic"],
86
+ "confidence": "low",
87
+ "confirmation_prompt": "You mentioned an AI agent. Does an LLM choose the next action at each step (decides which tool to call, when to stop), or is the flow scripted by your code with the LLM only doing per-step generation? (yes / no / unsure)",
88
+ "notes": "'Agent' is overloaded marketing language. True agentic systems delegate the action loop to the LLM."
89
+ },
90
+ "analytics": {
91
+ "traits": ["processes-pii"],
92
+ "confidence": "low",
93
+ "confirmation_prompt": "You mentioned analytics. Are individual users identifiable in the data, or is it aggregated (counts, percentages, no per-user records)? (yes / no / unsure)",
94
+ "notes": "Aggregate analytics avoids PII."
95
+ },
96
+ "checkout": {
97
+ "traits": ["handles-financial"],
98
+ "confidence": "low",
99
+ "confirmation_prompt": "You mentioned checkout. Does this code touch payment processing, transaction records, or money flow? (yes / no / unsure)",
100
+ "notes": "Checkout UI vs payment backend are different things."
101
+ },
102
+ "content moderation": {
103
+ "traits": ["influences-decisions", "accepts-user-input"],
104
+ "confidence": "low",
105
+ "confirmation_prompt": "You mentioned content moderation. Does the AI's classification act on content directly (delete/hide), or does a human reviewer make the final call? (yes / no / unsure)",
106
+ "notes": "Same as 'moderation' but explicit two-trait suggestion."
107
+ },
108
+ "customer support": {
109
+ "traits": ["accepts-user-input", "is-external"],
110
+ "confidence": "low",
111
+ "confirmation_prompt": "You mentioned customer support. Is this exposed directly to customers (external) or only used by your support team (internal)? (yes / no / unsure)",
112
+ "notes": "Some support tools are agent-only."
113
+ },
114
+ "dashboard": {
115
+ "traits": ["processes-pii"],
116
+ "confidence": "low",
117
+ "confirmation_prompt": "You mentioned a dashboard. Does it display per-user data, or aggregate metrics only? (yes / no / unsure)",
118
+ "notes": "Aggregate dashboards skip PII."
119
+ },
120
+ "education": {
121
+ "traits": ["handles-minors"],
122
+ "confidence": "low",
123
+ "confirmation_prompt": "You mentioned education. Is this product used by anyone under 13 (or under 16 in the EU)? (yes / no / unsure)",
124
+ "notes": "Adult education products don't trigger COPPA/minors."
125
+ },
126
+ "email automation": {
127
+ "traits": ["generates-content", "processes-pii"],
128
+ "confidence": "low",
129
+ "confirmation_prompt": "You mentioned email automation. Are the emails generated per-recipient (uses customer data) or templated/broadcast (no per-user PII in the generation)? (yes / no / unsure)",
130
+ "notes": "Drip campaigns differ from per-recipient generation."
131
+ },
132
+ "extract from documents": {
133
+ "traits": ["uses-rag"],
134
+ "confidence": "low",
135
+ "confirmation_prompt": "You mentioned document extraction. Does the system index and search documents semantically (RAG), or is this single-document OCR/extraction without retrieval? (yes / no / unsure)",
136
+ "notes": "OCR pipelines aren't RAG."
137
+ },
138
+ "form processing": {
139
+ "traits": ["accepts-user-input", "processes-pii"],
140
+ "confidence": "low",
141
+ "confirmation_prompt": "You mentioned form processing. Do the forms collect personally identifiable information (name, email, phone, etc.)? (yes / no / unsure)",
142
+ "notes": "Anonymous feedback forms don't have PII."
143
+ },
144
+ "high traffic": {
145
+ "traits": ["is-high-volume"],
146
+ "confidence": "low",
147
+ "confirmation_prompt": "You mentioned high traffic. Are you actually expecting >1000 LLM requests/day, or describing aspirational scale? (yes / no / unsure)",
148
+ "notes": "Aspirational scale != current reality."
149
+ },
150
+ "image upload": {
151
+ "traits": ["is-multimodal"],
152
+ "confidence": "low",
153
+ "confirmation_prompt": "You mentioned image upload. Are the images analyzed by a vision model (multimodal LLM), or just stored/displayed without AI processing? (yes / no / unsure)",
154
+ "notes": "Image hosting != multimodal AI."
155
+ },
156
+ "internal tool": {
157
+ "traits": ["is-internal"],
158
+ "confidence": "low",
159
+ "confirmation_prompt": "You mentioned an internal tool. Is access restricted to employees only (no external users), or is 'internal' a marketing term? (yes / no / unsure)",
160
+ "notes": "Some 'internal' tools have customer-facing surfaces."
161
+ },
162
+ "marketplace": {
163
+ "traits": ["handles-financial", "is-external"],
164
+ "confidence": "low",
165
+ "confirmation_prompt": "You mentioned a marketplace. Does it process payments directly, or just facilitate connections (no money flow through your service)? (yes / no / unsure)",
166
+ "notes": "Lead-gen marketplaces don't always touch money."
167
+ },
168
+ "moderation": {
169
+ "traits": ["influences-decisions"],
170
+ "confidence": "low",
171
+ "confirmation_prompt": "You mentioned moderation. Does the AI act directly on user content (delete, hide, suspend) without a human reviewer in the loop? (yes / no / unsure)",
172
+ "notes": "Human-in-the-loop moderation is advisory, not deciding."
173
+ },
174
+ "notifications": {
175
+ "traits": ["processes-pii"],
176
+ "confidence": "low",
177
+ "confirmation_prompt": "You mentioned notifications. Are notifications addressed to individual users (their email/phone/device token)? (yes / no / unsure)",
178
+ "notes": "Broadcast notifications without targeting don't need PII."
179
+ },
180
+ "personalization": {
181
+ "traits": ["processes-pii"],
182
+ "confidence": "low",
183
+ "confirmation_prompt": "You mentioned personalization. Does this system use information that identifies an individual user (account, profile, history) to personalize output? Anonymous session-only personalization does not count. (yes / no / unsure)",
184
+ "notes": "Anonymous session-based personalization doesn't trigger PII."
185
+ },
186
+ "recommendations": {
187
+ "traits": ["influences-decisions"],
188
+ "confidence": "low",
189
+ "confirmation_prompt": "You mentioned recommendations. Do they directly affect a user's outcomes (price, eligibility, hiring) or are they advisory only? (yes / no / unsure)",
190
+ "notes": "Product recommendations are usually advisory; loan recommendations are not."
191
+ },
192
+ "search through documents": {
193
+ "traits": ["uses-rag"],
194
+ "confidence": "low",
195
+ "confirmation_prompt": "You mentioned searching through documents. Are the documents embedded into a vector store, or is this keyword search (Postgres FTS, Elasticsearch BM25, grep)? (yes / no / unsure)",
196
+ "notes": "Keyword search != RAG."
197
+ },
198
+ "summarize": {
199
+ "traits": ["uses-llm", "generates-content"],
200
+ "confidence": "low",
201
+ "confirmation_prompt": "You mentioned summarization. Is this an LLM summary, or extractive (pulling sentences out without an LLM)? (yes / no / unsure)",
202
+ "notes": "Extractive summarization predates LLMs."
203
+ },
204
+ "translation": {
205
+ "traits": ["uses-llm"],
206
+ "confidence": "low",
207
+ "confirmation_prompt": "You mentioned translation. Is this LLM-based, or using a dedicated translation API (Google Translate, DeepL) without an LLM? (yes / no / unsure)",
208
+ "notes": "Translation APIs != LLMs."
209
+ },
210
+ "user profile": {
211
+ "traits": ["processes-pii"],
212
+ "confidence": "low",
213
+ "confirmation_prompt": "You mentioned user profiles. Do these profiles include personally identifiable information (name, email, address, etc.)? (yes / no / unsure)",
214
+ "notes": "Pseudonymous profiles can avoid PII traits."
215
+ },
216
+ "voice assistant": {
217
+ "traits": ["is-multimodal", "accepts-user-input", "uses-llm"],
218
+ "confidence": "low",
219
+ "confirmation_prompt": "You mentioned voice. Is voice the input/output modality (multimodal LLM), or is voice transcribed to text first by a separate service before reaching your LLM? (yes / no / unsure)",
220
+ "notes": "STT-then-LLM is text-only at the LLM layer."
221
+ },
222
+ "writing assistant": {
223
+ "traits": ["uses-llm", "generates-content"],
224
+ "confidence": "low",
225
+ "confirmation_prompt": "You mentioned a writing assistant. Does it generate text on its own (uses-llm + generates-content), or only check spelling/grammar against rules? (yes / no / unsure)",
226
+ "notes": "Grammarly-style rule-based tools don't need LLM traits."
227
+ }
228
+ }
229
+ }
@@ -169,3 +169,8 @@ function logDecision(decision, context) {
169
169
  - **Log volume at scale.** At high volume, consider sampling non-critical logs while keeping 100% of error and decision logs.
170
170
  - **Log retention and compliance.** Different regulations require different retention periods. Configure per data type.
171
171
  - **Cross-system correlation.** If the AI system calls external services, propagate trace IDs via headers.
172
+
173
+ ## Related infrastructure
174
+
175
+ - `aigis infra logging` — `structlog` JSON-to-stdout setup with a concrete `REDACT_KEYS` list, plus integration patterns for Datadog/New Relic/Honeycomb, CloudWatch, Sentry (with the `max_request_body_size='never'` warning), and OpenTelemetry/OTLP.
176
+ - `aigis infra secrets` — keep API keys and connection strings out of the structured fields you log.