aigis-cli 2.0.2__tar.gz → 2.1.1__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.
Files changed (81) hide show
  1. aigis_cli-2.1.1/PKG-INFO +182 -0
  2. aigis_cli-2.1.1/README.md +155 -0
  3. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/__init__.py +1 -1
  4. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/auto_verify.py +61 -1
  5. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/build.py +73 -12
  6. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/classify.py +8 -2
  7. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/cli.py +120 -10
  8. aigis_cli-2.1.1/aigis_cli/content/resolvers/triggers.json +551 -0
  9. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/audit-logging.md +33 -0
  10. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/bias-monitoring.md +34 -0
  11. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/confidence-scoring.md +23 -0
  12. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/data-integrity.md +25 -0
  13. aigis_cli-2.1.1/aigis_cli/content/skills/areas/eu-ai-act-art-13-deployer-transparency.md +133 -0
  14. aigis_cli-2.1.1/aigis_cli/content/skills/areas/eu-ai-act-art-50-transparency-disclosure.md +134 -0
  15. aigis_cli-2.1.1/aigis_cli/content/skills/areas/eu-ai-act-art-73-incident-reporting.md +149 -0
  16. aigis_cli-2.1.1/aigis_cli/content/skills/areas/eu-ai-act-art-9-risk-management.md +141 -0
  17. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/fallback-patterns.md +28 -0
  18. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/human-oversight.md +38 -0
  19. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/input-validation.md +27 -0
  20. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/monitoring.md +29 -0
  21. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/prompt-security.md +29 -0
  22. aigis_cli-2.1.1/aigis_cli/content/templates/eu-ai-act-annex-iv.md +193 -0
  23. aigis_cli-2.1.1/aigis_cli/init_ide.py +390 -0
  24. aigis_cli-2.1.1/aigis_cli/jurisdiction.py +115 -0
  25. aigis_cli-2.1.1/aigis_cli/report.py +297 -0
  26. aigis_cli-2.1.1/aigis_cli.egg-info/PKG-INFO +182 -0
  27. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli.egg-info/SOURCES.txt +7 -0
  28. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/pyproject.toml +1 -1
  29. aigis_cli-2.0.2/PKG-INFO +0 -133
  30. aigis_cli-2.0.2/README.md +0 -106
  31. aigis_cli-2.0.2/aigis_cli/content/resolvers/triggers.json +0 -229
  32. aigis_cli-2.0.2/aigis_cli/init_ide.py +0 -159
  33. aigis_cli-2.0.2/aigis_cli.egg-info/PKG-INFO +0 -133
  34. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/LICENSE +0 -0
  35. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/SKILL.md +0 -0
  36. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/annotate.py +0 -0
  37. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/checksum.py +0 -0
  38. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/audit-scan.md +0 -0
  39. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/auto-verify-rules.json +0 -0
  40. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/context-rules.json +0 -0
  41. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/frameworks.md +0 -0
  42. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/guardrails.json +0 -0
  43. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/index/taxonomy.md +0 -0
  44. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/explainability.md +0 -0
  45. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/output-sanitization.md +0 -0
  46. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/pii-handling.md +0 -0
  47. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/rag-security.md +0 -0
  48. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/rate-limiting.md +0 -0
  49. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/areas/supply-chain.md +0 -0
  50. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/core.md +0 -0
  51. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/infrastructure/logging.md +0 -0
  52. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -0
  53. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/infrastructure/secrets.md +0 -0
  54. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -0
  55. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/templates/ai-impact-assessment.md +0 -0
  56. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/templates/intended-purpose-doc.md +0 -0
  57. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/templates/risk-characterization.md +0 -0
  58. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/templates/third-party-assessment.md +0 -0
  59. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-audit-logging.md +0 -0
  60. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -0
  61. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -0
  62. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-data-integrity.md +0 -0
  63. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-explainability.md +0 -0
  64. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -0
  65. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-human-oversight.md +0 -0
  66. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-input-validation.md +0 -0
  67. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-monitoring.md +0 -0
  68. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-output-sanitization.md +0 -0
  69. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-pii-handling.md +0 -0
  70. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-prompt-security.md +0 -0
  71. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-rag-security.md +0 -0
  72. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-rate-limiting.md +0 -0
  73. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/content/verify/checklist-supply-chain.md +0 -0
  74. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/fetch.py +0 -0
  75. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/keywords.py +0 -0
  76. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli/search.py +0 -0
  77. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli.egg-info/dependency_links.txt +0 -0
  78. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli.egg-info/entry_points.txt +0 -0
  79. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli.egg-info/requires.txt +0 -0
  80. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/aigis_cli.egg-info/top_level.txt +0 -0
  81. {aigis_cli-2.0.2 → aigis_cli-2.1.1}/setup.cfg +0 -0
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: aigis-cli
3
+ Version: 2.1.1
4
+ Summary: AI governance guardrails for coding agents. Framework-aligned security and compliance patterns from NIST AI RMF, OWASP Top 10 for LLMs, and ISO/IEC 42001.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/NayanKanaparthi/aigis
7
+ Project-URL: Repository, https://github.com/NayanKanaparthi/aigis
8
+ Keywords: ai,governance,security,compliance,llm,owasp,nist,iso42001,guardrails,coding-agent
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Security
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: click>=8.0
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: python-frontmatter>=1.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.0; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # Aigis
29
+
30
+ **AI governance that ships with your code.**
31
+
32
+ Aigis sits between you and your coding agent (Cursor, Claude Code, GitHub Copilot, Windsurf) and gives the agent curated AI governance patterns mapped to NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act.
33
+
34
+ You don't run Aigis. Your agent does. After one setup command, you describe what you're building and your agent picks the right governance patterns, implements them, and verifies the result, all in the same chat where you write code.
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ pip install aigis-cli
40
+ # or
41
+ npm install -g @aigis-ai/cli
42
+
43
+ cd your-project
44
+ aigis init cursor # or: claude-code, copilot, windsurf
45
+ ```
46
+
47
+ That's it. `aigis init` writes a single rules file (`.cursorrules` for Cursor, `.github/copilot-instructions.md` for Copilot, etc.) that teaches your agent the Aigis workflow. Your agent reads it on every interaction in this project.
48
+
49
+ ![One command and you're done; your agent takes over.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/setup.png)
50
+
51
+ ## Quick start
52
+
53
+ Open the project in your IDE. In the agent chat, just describe what you're building:
54
+
55
+ > *Build me an EU AI Act compliant customer support chatbot for an e-commerce site. Use aigis to figure out the governance patterns and apply them.*
56
+
57
+ Your agent will read `.cursorrules`, classify the description against the resolver, fetch the relevant procedures, and implement them, invoking `aigis` itself as it works:
58
+
59
+ ![Your agent reads the rules file, classifies the project, fetches the brief, and implements, without you opening a separate terminal.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/agent-flow.png)
60
+
61
+ When the agent is done, you can verify deterministically:
62
+
63
+ ```bash
64
+ aigis verify input-validation --auto . --jurisdiction eu
65
+ ```
66
+
67
+ ![aigis verify cites OWASP + NIST + ISO + EU AI Act controls per check, with file:line evidence.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/verify.png)
68
+
69
+ The whole loop, describe, implement, verify, happens without leaving the IDE. You stay in the chat; the agent uses the CLI.
70
+
71
+ ## What `aigis init` actually did
72
+
73
+ When you ran `aigis init cursor`, three things landed in your repo:
74
+
75
+ 1. **`.cursorrules`** — the Aigis "core skill" your agent loads on every interaction. It documents the workflow (`classify → build → implement → verify → report`) and embeds a 39-phrase resolver block (high-confidence and low-confidence triggers) the agent uses to pick traits from your description.
76
+ 2. **A checksum** at the top of the resolver block. When Aigis updates, `aigis init <ide> --refresh` overwrites cleanly; mismatched checksums error out so you can see what changed.
77
+ 3. **No hidden services. No telemetry. No background processes.** Just a markdown file your agent reads.
78
+
79
+ Optional add-ons at init time:
80
+
81
+ ```bash
82
+ aigis init cursor --ci github # drops .github/workflows/aigis.yml
83
+ aigis init cursor --hook # installs .git/hooks/pre-commit
84
+ ```
85
+
86
+ Both surfaces read a single `.aigisrc.json` config:
87
+
88
+ ```json
89
+ { "areas": ["pii-handling", "audit-logging"], "jurisdiction": "eu" }
90
+ ```
91
+
92
+ The CI workflow runs `aigis verify` on every PR; the pre-commit hook runs it before each commit. Configure once, both run.
93
+
94
+ ## What's new in v2.1
95
+
96
+ - **EU AI Act mapping** — Articles 9, 10, 12, 13, 14, 15, 50, 72, 73 mapped to runnable governance patterns, plus an Annex IV technical documentation template
97
+ - **`--jurisdiction` flag** (`eu`, `us-regulated`) — gates content by where you ship. EU AI Act citations only surface when you're shipping to EU users
98
+ - **`aigis report`** — generates audit-ready compliance documentation with cross-framework citations (NIST + OWASP + ISO + EU AI Act) and file:line evidence per check
99
+ - **Activation surfaces** — `aigis init --ci github` drops a GitHub Action; `aigis init --hook` installs a pre-commit hook
100
+ - **`--tight` flag** (experimental) — minimal briefs for users who want less context. Requires ≥2 trait matches per area instead of ≥1
101
+ - **Resolver expansion** — 27 new triggers covering modern AI project types (internal coding assistants, agentic code review, document Q&A, image generation, enterprise search) and EU Annex III high-risk categories (biometric ID, credit scoring, hiring, law enforcement)
102
+
103
+ ## The principle behind Aigis
104
+
105
+ Governance isn't a content problem. It's an interface problem.
106
+
107
+ NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act are all rigorous, all published, and all sit in documents that engineering teams never read. Aigis treats governance as an **agent-computer interface** problem: how the right content reaches an LM agent at the right time, in the right shape.
108
+
109
+ - Context layered for on-demand loading (core skill always loaded; per-area procedures fetched when needed)
110
+ - Deterministic rules where accuracy isn't negotiable (resolver triggers, brief generation, verify regexes)
111
+ - Flexible reasoning where real projects don't fit rigid templates (the brief tells the agent to skip areas that don't apply, with a written reason)
112
+
113
+ Inspired by [SWE-agent's work on agent-computer interfaces](https://arxiv.org/abs/2405.15793), the idea that *how* information reaches an LM agent matters as much as *what* reaches it.
114
+
115
+ ## Manual CLI reference (for CI, scripting, audit prep, power users)
116
+
117
+ The CLI exists in case you want to drive Aigis directly, for CI workflows, audit prep, debugging, or one-off invocations.
118
+
119
+ ```bash
120
+ # Classification + brief
121
+ aigis classify "<description>" # detect traits + recommended areas
122
+ aigis build "<description>" # the consolidated brief (the main command)
123
+ aigis build "..." --jurisdiction eu # surface EU AI Act content for EU-bound systems
124
+ aigis build "..." --tight # minimal brief: ≥2 trait matches required (experimental)
125
+ aigis build "..." --list # area names + traits, no procedure content
126
+ aigis build "..." --compact # pointer-only brief
127
+
128
+ # Per-area work
129
+ aigis get <area> # fetch a single governance procedure
130
+ aigis infra <area> # fetch infrastructure pattern (rate-limiting, secrets, logging)
131
+ aigis workflow <type> # fetch workflow template
132
+
133
+ # Verify + audit
134
+ aigis verify <area> --auto . # deterministic check on your implementation
135
+ aigis verify <area> --auto . --jurisdiction eu # surfaces EU AI Act citations in output
136
+ aigis report --from-classify "<desc>" --jurisdiction eu --output audit.md
137
+ # audit-ready compliance documentation
138
+ aigis audit --scan # discovery prompt for auditing existing code
139
+ aigis audit --traits <list> # scoped audit with deterministic denominator
140
+
141
+ # Misc
142
+ aigis search --list # list all available areas
143
+ aigis traits # list classification traits
144
+ aigis template <id> # compliance documentation template
145
+ ```
146
+
147
+ Run `aigis --help` for full options.
148
+
149
+ ## Honest about what this isn't
150
+
151
+ - **Not a certification.** EU AI Act conformity assessment requires a notified body. `aigis report` is preparation material; it does not certify.
152
+ - **Not a security audit.** `aigis verify` is heuristic regex over your source. It catches common misimplementations; it doesn't replace SAST, code review, or penetration testing.
153
+ - **Doesn't run your code or call your APIs.** The agent does the work. Aigis provides the brief, the verifier, and the audit doc.
154
+ - **Local. No cloud. No telemetry.** Aigis ships nothing back to a server. Your descriptions, your code, and your verify results stay on your machine.
155
+
156
+ ## Benchmark results
157
+
158
+ v2.0 was benchmarked at every iteration. Final numbers, against the same 10 descriptions:
159
+
160
+ - Baseline (no Aigis): P=0.737, R=0.905, F1=0.790
161
+ - v2.0 (`aigis build`): P=0.847, R=0.851, F1=0.837
162
+
163
+ F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default in v2.2 is pending a confirmation benchmark. Methodology, per-run tables, and the v2.1 manual end-to-end test live in the [`benchmarks/`](https://github.com/NayanKanaparthi/aigis) directory.
164
+
165
+ ## Supported agents
166
+
167
+ - Cursor
168
+ - Claude Code
169
+ - GitHub Copilot
170
+ - Windsurf
171
+
172
+ Each maps to a different rules file location. `aigis init <ide>` handles the difference; `--refresh` updates safely.
173
+
174
+ ## Contributing
175
+
176
+ Aigis is built around a curated trigger map for classification. Trigger contributions are welcome, with a one-sentence use-case justification per the template in `.github/PULL_REQUEST_TEMPLATE/trigger_mapping.md`.
177
+
178
+ See `CONTRIBUTING.md` for the full contributor workflow, including how to add new governance areas, workflows, infrastructure patterns, or EU AI Act article mappings.
179
+
180
+ ## License
181
+
182
+ MIT
@@ -0,0 +1,155 @@
1
+ # Aigis
2
+
3
+ **AI governance that ships with your code.**
4
+
5
+ Aigis sits between you and your coding agent (Cursor, Claude Code, GitHub Copilot, Windsurf) and gives the agent curated AI governance patterns mapped to NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act.
6
+
7
+ You don't run Aigis. Your agent does. After one setup command, you describe what you're building and your agent picks the right governance patterns, implements them, and verifies the result, all in the same chat where you write code.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install aigis-cli
13
+ # or
14
+ npm install -g @aigis-ai/cli
15
+
16
+ cd your-project
17
+ aigis init cursor # or: claude-code, copilot, windsurf
18
+ ```
19
+
20
+ That's it. `aigis init` writes a single rules file (`.cursorrules` for Cursor, `.github/copilot-instructions.md` for Copilot, etc.) that teaches your agent the Aigis workflow. Your agent reads it on every interaction in this project.
21
+
22
+ ![One command and you're done; your agent takes over.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/setup.png)
23
+
24
+ ## Quick start
25
+
26
+ Open the project in your IDE. In the agent chat, just describe what you're building:
27
+
28
+ > *Build me an EU AI Act compliant customer support chatbot for an e-commerce site. Use aigis to figure out the governance patterns and apply them.*
29
+
30
+ Your agent will read `.cursorrules`, classify the description against the resolver, fetch the relevant procedures, and implement them, invoking `aigis` itself as it works:
31
+
32
+ ![Your agent reads the rules file, classifies the project, fetches the brief, and implements, without you opening a separate terminal.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/agent-flow.png)
33
+
34
+ When the agent is done, you can verify deterministically:
35
+
36
+ ```bash
37
+ aigis verify input-validation --auto . --jurisdiction eu
38
+ ```
39
+
40
+ ![aigis verify cites OWASP + NIST + ISO + EU AI Act controls per check, with file:line evidence.](https://github.com/NayanKanaparthi/aigis/raw/main/docs/screenshots/verify.png)
41
+
42
+ The whole loop, describe, implement, verify, happens without leaving the IDE. You stay in the chat; the agent uses the CLI.
43
+
44
+ ## What `aigis init` actually did
45
+
46
+ When you ran `aigis init cursor`, three things landed in your repo:
47
+
48
+ 1. **`.cursorrules`** — the Aigis "core skill" your agent loads on every interaction. It documents the workflow (`classify → build → implement → verify → report`) and embeds a 39-phrase resolver block (high-confidence and low-confidence triggers) the agent uses to pick traits from your description.
49
+ 2. **A checksum** at the top of the resolver block. When Aigis updates, `aigis init <ide> --refresh` overwrites cleanly; mismatched checksums error out so you can see what changed.
50
+ 3. **No hidden services. No telemetry. No background processes.** Just a markdown file your agent reads.
51
+
52
+ Optional add-ons at init time:
53
+
54
+ ```bash
55
+ aigis init cursor --ci github # drops .github/workflows/aigis.yml
56
+ aigis init cursor --hook # installs .git/hooks/pre-commit
57
+ ```
58
+
59
+ Both surfaces read a single `.aigisrc.json` config:
60
+
61
+ ```json
62
+ { "areas": ["pii-handling", "audit-logging"], "jurisdiction": "eu" }
63
+ ```
64
+
65
+ The CI workflow runs `aigis verify` on every PR; the pre-commit hook runs it before each commit. Configure once, both run.
66
+
67
+ ## What's new in v2.1
68
+
69
+ - **EU AI Act mapping** — Articles 9, 10, 12, 13, 14, 15, 50, 72, 73 mapped to runnable governance patterns, plus an Annex IV technical documentation template
70
+ - **`--jurisdiction` flag** (`eu`, `us-regulated`) — gates content by where you ship. EU AI Act citations only surface when you're shipping to EU users
71
+ - **`aigis report`** — generates audit-ready compliance documentation with cross-framework citations (NIST + OWASP + ISO + EU AI Act) and file:line evidence per check
72
+ - **Activation surfaces** — `aigis init --ci github` drops a GitHub Action; `aigis init --hook` installs a pre-commit hook
73
+ - **`--tight` flag** (experimental) — minimal briefs for users who want less context. Requires ≥2 trait matches per area instead of ≥1
74
+ - **Resolver expansion** — 27 new triggers covering modern AI project types (internal coding assistants, agentic code review, document Q&A, image generation, enterprise search) and EU Annex III high-risk categories (biometric ID, credit scoring, hiring, law enforcement)
75
+
76
+ ## The principle behind Aigis
77
+
78
+ Governance isn't a content problem. It's an interface problem.
79
+
80
+ NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act are all rigorous, all published, and all sit in documents that engineering teams never read. Aigis treats governance as an **agent-computer interface** problem: how the right content reaches an LM agent at the right time, in the right shape.
81
+
82
+ - Context layered for on-demand loading (core skill always loaded; per-area procedures fetched when needed)
83
+ - Deterministic rules where accuracy isn't negotiable (resolver triggers, brief generation, verify regexes)
84
+ - Flexible reasoning where real projects don't fit rigid templates (the brief tells the agent to skip areas that don't apply, with a written reason)
85
+
86
+ Inspired by [SWE-agent's work on agent-computer interfaces](https://arxiv.org/abs/2405.15793), the idea that *how* information reaches an LM agent matters as much as *what* reaches it.
87
+
88
+ ## Manual CLI reference (for CI, scripting, audit prep, power users)
89
+
90
+ The CLI exists in case you want to drive Aigis directly, for CI workflows, audit prep, debugging, or one-off invocations.
91
+
92
+ ```bash
93
+ # Classification + brief
94
+ aigis classify "<description>" # detect traits + recommended areas
95
+ aigis build "<description>" # the consolidated brief (the main command)
96
+ aigis build "..." --jurisdiction eu # surface EU AI Act content for EU-bound systems
97
+ aigis build "..." --tight # minimal brief: ≥2 trait matches required (experimental)
98
+ aigis build "..." --list # area names + traits, no procedure content
99
+ aigis build "..." --compact # pointer-only brief
100
+
101
+ # Per-area work
102
+ aigis get <area> # fetch a single governance procedure
103
+ aigis infra <area> # fetch infrastructure pattern (rate-limiting, secrets, logging)
104
+ aigis workflow <type> # fetch workflow template
105
+
106
+ # Verify + audit
107
+ aigis verify <area> --auto . # deterministic check on your implementation
108
+ aigis verify <area> --auto . --jurisdiction eu # surfaces EU AI Act citations in output
109
+ aigis report --from-classify "<desc>" --jurisdiction eu --output audit.md
110
+ # audit-ready compliance documentation
111
+ aigis audit --scan # discovery prompt for auditing existing code
112
+ aigis audit --traits <list> # scoped audit with deterministic denominator
113
+
114
+ # Misc
115
+ aigis search --list # list all available areas
116
+ aigis traits # list classification traits
117
+ aigis template <id> # compliance documentation template
118
+ ```
119
+
120
+ Run `aigis --help` for full options.
121
+
122
+ ## Honest about what this isn't
123
+
124
+ - **Not a certification.** EU AI Act conformity assessment requires a notified body. `aigis report` is preparation material; it does not certify.
125
+ - **Not a security audit.** `aigis verify` is heuristic regex over your source. It catches common misimplementations; it doesn't replace SAST, code review, or penetration testing.
126
+ - **Doesn't run your code or call your APIs.** The agent does the work. Aigis provides the brief, the verifier, and the audit doc.
127
+ - **Local. No cloud. No telemetry.** Aigis ships nothing back to a server. Your descriptions, your code, and your verify results stay on your machine.
128
+
129
+ ## Benchmark results
130
+
131
+ v2.0 was benchmarked at every iteration. Final numbers, against the same 10 descriptions:
132
+
133
+ - Baseline (no Aigis): P=0.737, R=0.905, F1=0.790
134
+ - v2.0 (`aigis build`): P=0.847, R=0.851, F1=0.837
135
+
136
+ F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default in v2.2 is pending a confirmation benchmark. Methodology, per-run tables, and the v2.1 manual end-to-end test live in the [`benchmarks/`](https://github.com/NayanKanaparthi/aigis) directory.
137
+
138
+ ## Supported agents
139
+
140
+ - Cursor
141
+ - Claude Code
142
+ - GitHub Copilot
143
+ - Windsurf
144
+
145
+ Each maps to a different rules file location. `aigis init <ide>` handles the difference; `--refresh` updates safely.
146
+
147
+ ## Contributing
148
+
149
+ Aigis is built around a curated trigger map for classification. Trigger contributions are welcome, with a one-sentence use-case justification per the template in `.github/PULL_REQUEST_TEMPLATE/trigger_mapping.md`.
150
+
151
+ See `CONTRIBUTING.md` for the full contributor workflow, including how to add new governance areas, workflows, infrastructure patterns, or EU AI Act article mappings.
152
+
153
+ ## License
154
+
155
+ MIT
@@ -1,3 +1,3 @@
1
1
  """aigis-cli: AI governance guardrails for coding agents."""
2
2
 
3
- __version__ = "2.0.0"
3
+ __version__ = "2.1.1"
@@ -406,7 +406,13 @@ _SPECIAL_REGISTRY = {
406
406
 
407
407
  # ── Public API ─────────────────────────────────────────────────────────
408
408
 
409
- def auto_verify_area(area_id: str, project_dir: str) -> dict[str, Any]:
409
+ def auto_verify_area(area_id: str, project_dir: str, jurisdictions: list[str] | None = None) -> dict[str, Any]:
410
+ """v2.1: jurisdictions list (e.g. ['eu']) gates EU AI Act control citations
411
+ in the report. Default empty — verify is conservative; eu_ai_act citations
412
+ only appear when the user explicitly opts in via --jurisdiction eu.
413
+ """
414
+ user_jurisdictions = set(jurisdictions or [])
415
+
410
416
  rules = load_rules()
411
417
  area = rules.get(area_id)
412
418
  if not area:
@@ -414,6 +420,10 @@ def auto_verify_area(area_id: str, project_dir: str) -> dict[str, Any]:
414
420
  f"No auto-verify rules for pattern area '{area_id}'. "
415
421
  f"Known: {', '.join(rules.keys())}"
416
422
  )
423
+
424
+ # v2.1: read area frontmatter controls for citation in the report.
425
+ all_controls = _read_area_controls(area_id)
426
+
417
427
  root = Path(project_dir).resolve()
418
428
  files = _load_files(root)
419
429
 
@@ -455,6 +465,17 @@ def auto_verify_area(area_id: str, project_dir: str) -> dict[str, Any]:
455
465
  auto_fail = sum(1 for r in auto_results.values() if r["status"] == "FAIL")
456
466
  overclaims_raised = sum(1 for r in overclaim_results.values() if r["raised"])
457
467
 
468
+ # v2.1: assemble cited controls. EU AI Act gated on jurisdiction.
469
+ show_eu = "eu" in user_jurisdictions
470
+ cited = None
471
+ if all_controls:
472
+ cited = {
473
+ "owasp": all_controls["owasp"],
474
+ "nist": all_controls["nist"],
475
+ "iso42001": all_controls["iso42001"],
476
+ "eu_ai_act": all_controls["eu_ai_act"] if show_eu else [],
477
+ }
478
+
458
479
  return {
459
480
  "area": area_id,
460
481
  "project_dir": str(root),
@@ -469,9 +490,34 @@ def auto_verify_area(area_id: str, project_dir: str) -> dict[str, Any]:
469
490
  "auto_checks": auto_results,
470
491
  "overclaim_checks": overclaim_results,
471
492
  "judgment_checks": judgment_results,
493
+ "cited_controls": cited,
494
+ "user_jurisdictions": sorted(user_jurisdictions),
472
495
  }
473
496
 
474
497
 
498
+ def _read_area_controls(area_id: str) -> dict[str, list[str]] | None:
499
+ """Read an area's frontmatter `controls` block (all four frameworks).
500
+ Returns None on missing file or parse failure.
501
+ """
502
+ try:
503
+ import frontmatter # local import to keep top-of-file imports lean
504
+ from pathlib import Path
505
+ areas_dir = Path(__file__).resolve().parent / "content" / "skills" / "areas"
506
+ filepath = areas_dir / f"{area_id}.md"
507
+ if not filepath.exists():
508
+ return None
509
+ fm = frontmatter.loads(filepath.read_text(encoding="utf-8")).metadata
510
+ c = fm.get("controls", {}) or {}
511
+ return {
512
+ "owasp": c.get("owasp", []) or [],
513
+ "nist": c.get("nist", []) or [],
514
+ "iso42001": c.get("iso42001", []) or [],
515
+ "eu_ai_act": c.get("eu_ai_act", []) or [],
516
+ }
517
+ except Exception:
518
+ return None
519
+
520
+
475
521
  def format_text_report(result: dict[str, Any]) -> str:
476
522
  lines: list[str] = []
477
523
  lines.append(f"═══ AUTO-VERIFY: {result['area']} ═══\n")
@@ -482,6 +528,20 @@ def format_text_report(result: dict[str, Any]) -> str:
482
528
  lines.append(f"Overclaim recognizers raised: {s['overclaims_raised']}")
483
529
  lines.append(f"Judgment required: {s['judgment_required']} check(s)\n")
484
530
 
531
+ # v2.1: cite framework controls. Mirror of lib/auto-verify.js.
532
+ cited = result.get("cited_controls")
533
+ if cited:
534
+ total_cited = len(cited["owasp"]) + len(cited["nist"]) + len(cited["iso42001"]) + len(cited["eu_ai_act"])
535
+ if total_cited > 0:
536
+ all_pass = s["auto_pass"] == s["auto_total"] and s["auto_fail"] == 0
537
+ header = "Controls satisfied (all auto checks PASS):" if all_pass else "Controls in scope (partial — fix FAIL/OVERCLAIM to fully satisfy):"
538
+ lines.append(f"── {header} ──")
539
+ if cited["owasp"]: lines.append(f" OWASP LLM Top 10: {', '.join(cited['owasp'])}")
540
+ if cited["nist"]: lines.append(f" NIST AI RMF: {', '.join(cited['nist'])}")
541
+ if cited["iso42001"]: lines.append(f" ISO/IEC 42001: {', '.join(cited['iso42001'])}")
542
+ if cited["eu_ai_act"]:lines.append(f" EU AI Act: {', '.join(cited['eu_ai_act'])}")
543
+ lines.append("")
544
+
485
545
  if result["auto_checks"]:
486
546
  lines.append("── AUTO CHECKS ──")
487
547
  for cid, r in result["auto_checks"].items():
@@ -23,6 +23,11 @@ import frontmatter
23
23
  from .classify import classify
24
24
  from .keywords import detect_traits_from_text
25
25
  from .fetch import get_infra
26
+ from .jurisdiction import (
27
+ get_user_jurisdictions,
28
+ filter_areas_by_jurisdiction,
29
+ strip_jurisdiction_gated_sections,
30
+ )
26
31
 
27
32
  CONTENT_DIR = Path(__file__).resolve().parent / "content"
28
33
 
@@ -169,7 +174,21 @@ def _read_version() -> str:
169
174
  return "unknown"
170
175
 
171
176
 
172
- def _prepare(description: str, decisions: dict) -> dict:
177
+ def _read_area_system_traits(area_id: str) -> list[str] | None:
178
+ """v2.1: read an area's `system_traits` frontmatter for --tight matching."""
179
+ try:
180
+ filepath = CONTENT_DIR / "skills" / "areas" / f"{area_id}.md"
181
+ if not filepath.exists():
182
+ return None
183
+ fm = frontmatter.loads(filepath.read_text(encoding="utf-8")).metadata
184
+ st = fm.get("system_traits")
185
+ return list(st) if isinstance(st, list) else None
186
+ except Exception:
187
+ return None
188
+
189
+
190
+ def _prepare(description: str, decisions: dict, extra_jurisdictions: list[str] | None = None, tight: bool = False) -> dict:
191
+ extra_jurisdictions = extra_jurisdictions or []
173
192
  normalized = normalize_description(description)
174
193
  if not normalized:
175
194
  raise ValueError('Provide a description in quotes. Example: aigis build "customer chatbot with RAG"')
@@ -185,13 +204,39 @@ def _prepare(description: str, decisions: dict) -> dict:
185
204
  numeric_decisions[m["id"]] = decisions[m["id"]]
186
205
 
187
206
  resolved = resolve_traits(detection_with_slugs, numeric_decisions, uncertain_as_included=True)
188
- if not resolved["all_traits"]:
207
+
208
+ # v2.1: --jurisdiction flag adds jurisdiction-* traits before classify.
209
+ extra_jurisdiction_traits = [f"jurisdiction-{c}" for c in (extra_jurisdictions or []) if c]
210
+ all_traits_with_jurisdiction = sorted(set(resolved["all_traits"]) | set(extra_jurisdiction_traits))
211
+
212
+ if not all_traits_with_jurisdiction:
189
213
  raise ValueError(
190
214
  "No traits resolved from description. Try a more specific description, "
191
215
  'or use `aigis classify --traits ...` directly.'
192
216
  )
193
- cls = classify(resolved["all_traits"])
194
- areas = cls["implement_files"]
217
+ cls = classify(all_traits_with_jurisdiction)
218
+
219
+ # v2.1: jurisdiction filter on the area list.
220
+ user_jurisdictions = get_user_jurisdictions(all_traits_with_jurisdiction)
221
+ areas_before_filter = cls["implement_files"]
222
+ areas = filter_areas_by_jurisdiction(areas_before_filter, user_jurisdictions)
223
+
224
+ # v2.1 --tight mode: require ≥2 of the user's traits to match an area's system_traits.
225
+ areas_before_tight: list[str] | None = None
226
+ tight_dropped: list[dict] = []
227
+ if tight:
228
+ areas_before_tight = list(areas)
229
+ user_trait_set = set(all_traits_with_jurisdiction)
230
+ kept: list[str] = []
231
+ for area in areas:
232
+ sys_traits = _read_area_system_traits(area) or []
233
+ match_count = sum(1 for t in sys_traits if t in user_trait_set)
234
+ if match_count >= 2:
235
+ kept.append(area)
236
+ else:
237
+ tight_dropped.append({"area": area, "match_count": match_count})
238
+ areas = kept
239
+
195
240
  infra_ids = collect_infra_references(areas)
196
241
 
197
242
  return {
@@ -202,6 +247,11 @@ def _prepare(description: str, decisions: dict) -> dict:
202
247
  "resolved": resolved,
203
248
  "cls": cls,
204
249
  "areas": areas,
250
+ "areas_before_jurisdiction_filter": areas_before_filter,
251
+ "areas_before_tight_filter": areas_before_tight,
252
+ "tight_dropped": tight_dropped,
253
+ "tight_mode": bool(tight),
254
+ "user_jurisdictions": sorted(user_jurisdictions),
205
255
  "infra_ids": infra_ids,
206
256
  }
207
257
 
@@ -303,11 +353,13 @@ def _render_verification(*, areas, resolved, cls):
303
353
 
304
354
 
305
355
  def build_compact(description: str, decisions: dict | None = None, *,
356
+ extra_jurisdictions: list[str] | None = None,
357
+ tight: bool = False,
306
358
  timestamp: datetime | None = None,
307
359
  version_string: str | None = None,
308
360
  fell_back_from_full: bool = False) -> dict:
309
361
  decisions = decisions or {}
310
- prep = _prepare(description, decisions)
362
+ prep = _prepare(description, decisions, extra_jurisdictions, tight=tight)
311
363
  ts = _iso_ms(timestamp)
312
364
  version = version_string or _read_version()
313
365
 
@@ -352,11 +404,13 @@ def build_compact(description: str, decisions: dict | None = None, *,
352
404
 
353
405
 
354
406
  def build_full(description: str, decisions: dict | None = None, *,
407
+ extra_jurisdictions: list[str] | None = None,
408
+ tight: bool = False,
355
409
  char_cap: int = FULL_HARD_CAP,
356
410
  timestamp: datetime | None = None,
357
411
  version_string: str | None = None) -> dict:
358
412
  decisions = decisions or {}
359
- prep = _prepare(description, decisions)
413
+ prep = _prepare(description, decisions, extra_jurisdictions, tight=tight)
360
414
  ts = _iso_ms(timestamp)
361
415
  version = version_string or _read_version()
362
416
 
@@ -365,6 +419,10 @@ def build_full(description: str, decisions: dict | None = None, *,
365
419
  cls=prep["cls"], resolved=prep["resolved"], areas=prep["areas"], infra_ids=prep["infra_ids"],
366
420
  )
367
421
 
422
+ # v2.1: for non-EU users, strip `## EU AI Act extensions` sections from
423
+ # universal-area content before inlining (parity with lib/build.js).
424
+ user_j = set(prep["user_jurisdictions"])
425
+
368
426
  s.append("## Areas")
369
427
  s.append("")
370
428
  for i, area in enumerate(prep["areas"], 1):
@@ -373,6 +431,7 @@ def build_full(description: str, decisions: dict | None = None, *,
373
431
  except FileNotFoundError:
374
432
  continue
375
433
  stripped = strip_frontmatter_raw(raw)
434
+ stripped = strip_jurisdiction_gated_sections(stripped, user_j)
376
435
  s.append(f"### {i}. {area}")
377
436
  s.append("")
378
437
  s.append(stripped)
@@ -406,23 +465,25 @@ def build_full(description: str, decisions: dict | None = None, *,
406
465
 
407
466
 
408
467
  def build_brief(description: str, decisions: dict | None = None, *,
468
+ extra_jurisdictions: list[str] | None = None,
469
+ tight: bool = False,
409
470
  mode: str = "auto",
410
471
  timestamp: datetime | None = None,
411
472
  version_string: str | None = None) -> dict:
412
473
  """Dispatcher. mode ∈ {'auto', 'full', 'compact'}."""
413
474
  decisions = decisions or {}
414
475
  if mode == "compact":
415
- r = build_compact(description, decisions, timestamp=timestamp, version_string=version_string)
476
+ r = build_compact(description, decisions, extra_jurisdictions=extra_jurisdictions, tight=tight, timestamp=timestamp, version_string=version_string)
416
477
  return {**r, "mode": "compact", "auto_fallback": False}
417
478
  if mode == "full":
418
- r = build_full(description, decisions, char_cap=FULL_HARD_CAP, timestamp=timestamp, version_string=version_string)
479
+ r = build_full(description, decisions, extra_jurisdictions=extra_jurisdictions, tight=tight, char_cap=FULL_HARD_CAP, timestamp=timestamp, version_string=version_string)
419
480
  return {**r, "mode": "full", "auto_fallback": False}
420
481
  # auto
421
482
  try:
422
- r = build_full(description, decisions, char_cap=AUTO_FULL_CAP, timestamp=timestamp, version_string=version_string)
483
+ r = build_full(description, decisions, extra_jurisdictions=extra_jurisdictions, tight=tight, char_cap=AUTO_FULL_CAP, timestamp=timestamp, version_string=version_string)
423
484
  return {**r, "mode": "full", "auto_fallback": False}
424
485
  except BriefTooLargeError as e:
425
- compact = build_compact(description, decisions, timestamp=timestamp, version_string=version_string, fell_back_from_full=True)
486
+ compact = build_compact(description, decisions, extra_jurisdictions=extra_jurisdictions, tight=tight, timestamp=timestamp, version_string=version_string, fell_back_from_full=True)
426
487
  return {
427
488
  **compact,
428
489
  "mode": "compact",
@@ -432,9 +493,9 @@ def build_brief(description: str, decisions: dict | None = None, *,
432
493
  }
433
494
 
434
495
 
435
- def build_list(description: str) -> str:
496
+ def build_list(description: str, extra_jurisdictions: list[str] | None = None, tight: bool = False) -> str:
436
497
  """Shape A — text output for `aigis build --list`."""
437
- prep = _prepare(description, {})
498
+ prep = _prepare(description, {}, extra_jurisdictions, tight=tight)
438
499
  lines: list[str] = []
439
500
  lines.append(f"Description: {prep['normalized']}")
440
501
  lines.append(f"Risk tier: {prep['cls']['risk_tier']}")
@@ -6,10 +6,11 @@ ALL_TRAITS = [
6
6
  "influences-decisions", "accepts-user-input", "is-external", "is-internal", "is-high-volume",
7
7
  "generates-code", "generates-content", "multi-model-pipeline",
8
8
  "jurisdiction-eu", "jurisdiction-us-regulated", "jurisdiction-global",
9
+ "is-eu-high-risk", # v2.1: EU AI Act Annex III gating trait
9
10
  ]
10
11
 
11
12
  TRAIT_FILES: dict[str, list[str]] = {
12
- "uses-llm": ["input-validation", "output-sanitization", "prompt-security", "audit-logging", "monitoring"],
13
+ "uses-llm": ["input-validation", "output-sanitization", "prompt-security", "audit-logging", "monitoring", "eu-ai-act-art-50-transparency-disclosure"],
13
14
  "uses-rag": ["rag-security", "data-integrity"],
14
15
  "uses-finetuned": ["data-integrity", "supply-chain"],
15
16
  "uses-thirdparty-api": ["supply-chain"],
@@ -21,7 +22,7 @@ TRAIT_FILES: dict[str, list[str]] = {
21
22
  "handles-proprietary": ["pii-handling", "prompt-security"],
22
23
  "handles-minors": ["pii-handling", "bias-monitoring", "human-oversight"],
23
24
  "influences-decisions": ["bias-monitoring", "confidence-scoring", "human-oversight", "explainability"],
24
- "accepts-user-input": ["input-validation", "output-sanitization"],
25
+ "accepts-user-input": ["input-validation", "output-sanitization", "eu-ai-act-art-50-transparency-disclosure"],
25
26
  "is-external": ["rate-limiting", "confidence-scoring"],
26
27
  "is-internal": [],
27
28
  "is-high-volume": ["rate-limiting", "monitoring", "fallback-patterns"],
@@ -31,6 +32,11 @@ TRAIT_FILES: dict[str, list[str]] = {
31
32
  "jurisdiction-eu": [],
32
33
  "jurisdiction-us-regulated": [],
33
34
  "jurisdiction-global": [],
35
+ "is-eu-high-risk": [
36
+ "eu-ai-act-art-9-risk-management",
37
+ "eu-ai-act-art-13-deployer-transparency",
38
+ "eu-ai-act-art-73-incident-reporting",
39
+ ], # v2.1: pulls EU AI Act high-risk areas; brief assembly filters by jurisdiction-eu
34
40
  }
35
41
 
36
42
  FILE_CONTROLS: dict[str, dict[str, list[str]]] = {