@aigis-ai/cli 2.0.1 → 2.1.0

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 (111) hide show
  1. package/README.md +97 -178
  2. package/bin/aigis.js +139 -8
  3. package/content/resolvers/triggers.json +363 -41
  4. package/content/skills/areas/audit-logging.md +33 -0
  5. package/content/skills/areas/bias-monitoring.md +34 -0
  6. package/content/skills/areas/confidence-scoring.md +23 -0
  7. package/content/skills/areas/data-integrity.md +25 -0
  8. package/content/skills/areas/eu-ai-act-art-13-deployer-transparency.md +133 -0
  9. package/content/skills/areas/eu-ai-act-art-50-transparency-disclosure.md +134 -0
  10. package/content/skills/areas/eu-ai-act-art-73-incident-reporting.md +149 -0
  11. package/content/skills/areas/eu-ai-act-art-9-risk-management.md +141 -0
  12. package/content/skills/areas/fallback-patterns.md +28 -0
  13. package/content/skills/areas/human-oversight.md +38 -0
  14. package/content/skills/areas/input-validation.md +27 -0
  15. package/content/skills/areas/monitoring.md +29 -0
  16. package/content/skills/areas/prompt-security.md +29 -0
  17. package/content/templates/eu-ai-act-annex-iv.md +193 -0
  18. package/docs/frontmatter-schema.md +75 -0
  19. package/docs/screenshots/README.md +17 -0
  20. package/docs/screenshots/agent-flow.png +0 -0
  21. package/docs/screenshots/setup.png +0 -0
  22. package/docs/screenshots/verify.png +0 -0
  23. package/lib/auto-verify.js +70 -1
  24. package/lib/build.js +101 -12
  25. package/lib/classify.js +8 -2
  26. package/lib/init.js +269 -5
  27. package/lib/jurisdiction.js +137 -0
  28. package/lib/report.js +331 -0
  29. package/package.json +1 -1
  30. package/scripts/area-controls-baseline.json +188 -0
  31. package/scripts/area-frontmatter.schema.json +61 -0
  32. package/scripts/validate-area-frontmatter.js +228 -0
  33. package/cli-python/LICENSE +0 -21
  34. package/cli-python/README.md +0 -32
  35. package/cli-python/aigis_cli/SKILL.md +0 -70
  36. package/cli-python/aigis_cli/__init__.py +0 -3
  37. package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
  38. package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
  39. package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
  40. package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
  41. package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
  42. package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
  43. package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
  44. package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
  45. package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
  46. package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
  47. package/cli-python/aigis_cli/annotate.py +0 -45
  48. package/cli-python/aigis_cli/auto_verify.py +0 -518
  49. package/cli-python/aigis_cli/build.py +0 -470
  50. package/cli-python/aigis_cli/checksum.py +0 -22
  51. package/cli-python/aigis_cli/classify.py +0 -192
  52. package/cli-python/aigis_cli/cli.py +0 -618
  53. package/cli-python/aigis_cli/content/index/audit-scan.md +0 -217
  54. package/cli-python/aigis_cli/content/index/auto-verify-rules.json +0 -439
  55. package/cli-python/aigis_cli/content/index/context-rules.json +0 -90
  56. package/cli-python/aigis_cli/content/index/frameworks.md +0 -82
  57. package/cli-python/aigis_cli/content/index/guardrails.json +0 -23
  58. package/cli-python/aigis_cli/content/index/taxonomy.md +0 -81
  59. package/cli-python/aigis_cli/content/resolvers/triggers.json +0 -229
  60. package/cli-python/aigis_cli/content/skills/areas/audit-logging.md +0 -176
  61. package/cli-python/aigis_cli/content/skills/areas/bias-monitoring.md +0 -172
  62. package/cli-python/aigis_cli/content/skills/areas/confidence-scoring.md +0 -180
  63. package/cli-python/aigis_cli/content/skills/areas/data-integrity.md +0 -257
  64. package/cli-python/aigis_cli/content/skills/areas/explainability.md +0 -174
  65. package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +0 -200
  66. package/cli-python/aigis_cli/content/skills/areas/human-oversight.md +0 -220
  67. package/cli-python/aigis_cli/content/skills/areas/input-validation.md +0 -380
  68. package/cli-python/aigis_cli/content/skills/areas/monitoring.md +0 -207
  69. package/cli-python/aigis_cli/content/skills/areas/output-sanitization.md +0 -183
  70. package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +0 -189
  71. package/cli-python/aigis_cli/content/skills/areas/prompt-security.md +0 -153
  72. package/cli-python/aigis_cli/content/skills/areas/rag-security.md +0 -230
  73. package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +0 -246
  74. package/cli-python/aigis_cli/content/skills/areas/supply-chain.md +0 -193
  75. package/cli-python/aigis_cli/content/skills/core.md +0 -62
  76. package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +0 -202
  77. package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -169
  78. package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +0 -167
  79. package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -86
  80. package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +0 -54
  81. package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +0 -39
  82. package/cli-python/aigis_cli/content/templates/risk-characterization.md +0 -34
  83. package/cli-python/aigis_cli/content/templates/third-party-assessment.md +0 -41
  84. package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +0 -13
  85. package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -13
  86. package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -13
  87. package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +0 -12
  88. package/cli-python/aigis_cli/content/verify/checklist-explainability.md +0 -13
  89. package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -13
  90. package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +0 -14
  91. package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +0 -16
  92. package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +0 -13
  93. package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +0 -14
  94. package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +0 -14
  95. package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +0 -13
  96. package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +0 -12
  97. package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +0 -13
  98. package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +0 -13
  99. package/cli-python/aigis_cli/fetch.py +0 -232
  100. package/cli-python/aigis_cli/init_ide.py +0 -159
  101. package/cli-python/aigis_cli/keywords.py +0 -73
  102. package/cli-python/aigis_cli/search.py +0 -69
  103. package/cli-python/aigis_cli.egg-info/PKG-INFO +0 -59
  104. package/cli-python/aigis_cli.egg-info/SOURCES.txt +0 -56
  105. package/cli-python/aigis_cli.egg-info/dependency_links.txt +0 -1
  106. package/cli-python/aigis_cli.egg-info/entry_points.txt +0 -2
  107. package/cli-python/aigis_cli.egg-info/requires.txt +0 -6
  108. package/cli-python/aigis_cli.egg-info/top_level.txt +0 -1
  109. package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
  110. package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
  111. package/cli-python/pyproject.toml +0 -49
package/README.md CHANGED
@@ -1,236 +1,155 @@
1
1
  # Aigis
2
2
 
3
- AI governance guardrails for coding agents. Curated, agent-consumable security and compliance patterns from NIST AI RMF, OWASP Top 10 for LLMs, and ISO/IEC 42001.
3
+ **AI governance that ships with your code.**
4
4
 
5
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
- [![npm](https://img.shields.io/npm/v/@aigis-ai/cli)](https://www.npmjs.com/package/@aigis-ai/cli)
7
- [![PyPI](https://img.shields.io/pypi/v/aigis-cli)](https://pypi.org/project/aigis-cli/)
8
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
9
- [![Python](https://img.shields.io/badge/python-%3E%3D3.9-blue)](https://www.python.org/)
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.
10
6
 
11
- ## The problem
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.
12
8
 
13
- Coding agents hallucinate security patterns and build AI systems without governance controls. When your agent writes an LLM-powered endpoint, it doesn't know about prompt injection, PII redaction, bias monitoring, or the compliance documentation your organization needs.
14
-
15
- ## What Aigis does
16
-
17
- Aigis gives your coding agent curated governance patterns it can fetch via a simple CLI. The agent reads the patterns, applies them when writing code, and verifies its own output against checklists — all mapped to real framework control IDs.
18
-
19
- ```
20
- Without Aigis With Aigis
21
- ─────────────────── ─────────────────
22
- Agent writes LLM code Agent classifies the system
23
- No input validation Fetches governance patterns
24
- No PII redaction Writes code with controls built in
25
- No audit logging Self-verifies against checklists
26
- Compliance team finds gaps later Compliance documentation generated alongside code
27
- Rework cycle Ships compliant on first pass
28
- ```
29
-
30
- ## Quick start
31
-
32
- Install the CLI with **npm** (JavaScript / Node.js) or **pip** (Python). Both packages expose the same `aigis` command and behavior.
33
-
34
- **JavaScript developers — npm**
9
+ ## Install
35
10
 
36
11
  ```bash
37
12
  npm install -g @aigis-ai/cli
38
- ```
39
-
40
- **Python developers — pip**
41
-
42
- ```bash
13
+ # or
43
14
  pip install aigis-cli
44
- ```
45
15
 
46
- **After installing (either toolchain)**
47
-
48
- ```bash
49
- # Set up for your IDE
50
- aigis init cursor # or: claude-code, windsurf, copilot
51
-
52
- # Classify your system
53
- aigis classify --traits uses-llm,accepts-user-input,processes-pii,is-external
16
+ cd your-project
17
+ aigis init cursor # or: claude-code, copilot, windsurf
18
+ ```
54
19
 
55
- # Fetch patterns
56
- aigis get input-validation pii-handling audit-logging
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.
57
21
 
58
- # After writing code, verify
59
- aigis verify input-validation pii-handling audit-logging
22
+ ![One command and you're done — your agent takes over.](docs/screenshots/setup.png)
60
23
 
61
- # Generate compliance documentation (if HIGH/MEDIUM risk)
62
- aigis template ai-impact-assessment intended-purpose-doc
63
- ```
24
+ ## Quick start
64
25
 
65
- ## How it works
26
+ Open the project in your IDE. In the agent chat, just describe what you're building:
66
27
 
67
- Aigis has three layers:
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.*
68
29
 
69
- **1. Classify** — Describe what you're building using 22 system traits. Aigis determines the risk tier (HIGH/MEDIUM/LOW) and tells you which governance files to fetch.
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:
70
31
 
71
- **2. Implement** — Fetch the relevant pattern files. Each file contains concrete code patterns (Python + JavaScript) for one security/governance concern, tagged with NIST, OWASP, and ISO control IDs.
32
+ ![Your agent reads the rules file, classifies the project, fetches the brief, and implements — without you opening a separate terminal.](docs/screenshots/agent-flow.png)
72
33
 
73
- **3. Verify** — After writing code, fetch the matching checklists. The agent evaluates its own code against each check and reports PASS/FAIL with evidence.
34
+ When the agent is done, you can verify deterministically:
74
35
 
75
- ## Commands
36
+ ```bash
37
+ aigis verify input-validation --auto . --jurisdiction eu
38
+ ```
76
39
 
77
- | Command | Purpose |
78
- |---------|---------|
79
- | `aigis classify --traits <list>` | Classify system, get risk tier and recommended files |
80
- | `aigis classify "<description>"` | Same, using natural language (keyword matching) |
81
- | `aigis get <id> [id...]` | Fetch implementation pattern files |
82
- | `aigis get <id> --lang py\|js` | Fetch filtered to one language |
83
- | `aigis verify <id> [id...]` | Fetch verification checklists |
84
- | `aigis template <id> [id...]` | Fetch compliance documentation templates |
85
- | `aigis audit --scan` | Get structured prompt for auditing existing codebases |
86
- | `aigis audit --traits <list>` | Run full audit (classify + all checklists bundled) |
87
- | `aigis search <query>` | Search content by keyword or control ID |
88
- | `aigis search --list` | List all available files |
89
- | `aigis annotate <id> "<note>"` | Attach a local note for future sessions |
90
- | `aigis init <ide>` | Set up for cursor, claude-code, windsurf, or copilot |
91
- | `aigis traits` | List all 22 classification traits |
40
+ ![aigis verify cites OWASP + NIST + ISO + EU AI Act controls per check, with file:line evidence.](docs/screenshots/verify.png)
92
41
 
93
- ## Classification traits (22)
42
+ The whole loop — describe, implement, verify — happens without leaving the IDE. You stay in the chat; the agent uses the CLI.
94
43
 
95
- **AI architecture:** uses-llm, uses-rag, uses-finetuned, uses-thirdparty-api, is-agentic, is-multimodal
44
+ ## What `aigis init` actually did
96
45
 
97
- **Data sensitivity:** processes-pii, handles-financial, handles-health, handles-proprietary, handles-minors
46
+ When you ran `aigis init cursor`, three things landed in your repo:
98
47
 
99
- **Impact scope:** influences-decisions, accepts-user-input, is-external, is-internal, is-high-volume
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.
100
51
 
101
- **Output type:** generates-code, generates-content, multi-model-pipeline
52
+ Optional add-ons at init time:
102
53
 
103
- **Jurisdiction:** jurisdiction-eu, jurisdiction-us-regulated, jurisdiction-global
54
+ ```bash
55
+ aigis init cursor --ci github # drops .github/workflows/aigis.yml
56
+ aigis init cursor --hook # installs .git/hooks/pre-commit
57
+ ```
104
58
 
105
- ## Governance content (15 pattern files)
59
+ Both surfaces read a single `.aigisrc.json` config:
106
60
 
107
- Each file covers one security/governance concern with Python + JavaScript code patterns, anti-patterns, edge cases, and cross-references to related files.
61
+ ```json
62
+ { "areas": ["pii-handling", "audit-logging"], "jurisdiction": "eu" }
63
+ ```
108
64
 
109
- | File | OWASP | What it covers |
110
- |------|-------|----------------|
111
- | input-validation | LLM01 | Sanitization, length limits, prompt separation, schema enforcement, injection detection |
112
- | output-sanitization | LLM05 | HTML encoding, parameterized queries, code sandboxing, content type validation |
113
- | pii-handling | LLM02 | PII detection/redaction, data minimization, output filtering, separated storage |
114
- | prompt-security | LLM07 | No secrets in prompts, minimal prompts, leakage detection, server-side enforcement |
115
- | human-oversight | LLM06 | Tool allowlists, approval gates, action rate limiting, override mechanisms |
116
- | supply-chain | LLM03 | Model version pinning, regression testing, fallback providers, version tracking |
117
- | data-integrity | LLM04 | Data provenance, RAG validation, checksums, distribution monitoring, batch rollback |
118
- | rag-security | LLM08 | Vector DB access control, tenant isolation, context validation, permission inheritance |
119
- | confidence-scoring | LLM09 | Confidence metadata, grounding verification, recommendation framing |
120
- | rate-limiting | LLM10 | Per-user limits, token budgets, cost monitoring, request timeouts |
121
- | audit-logging | — | Structured entries, trace ID propagation, decision records |
122
- | bias-monitoring | — | Fairness metadata, distribution monitoring, periodic reports |
123
- | fallback-patterns | — | Default safe responses, circuit breakers, kill switches |
124
- | monitoring | — | Key metrics, drift detection, user feedback, incident logging |
125
- | explainability | — | Decision explanations, model cards, audit-friendly records |
65
+ The CI workflow runs `aigis verify` on every PR; the pre-commit hook runs it before each commit. Configure once, both run.
126
66
 
127
- ## Compliance templates (4)
67
+ ## What's new in v2.1
128
68
 
129
- | Template | Framework | When required |
130
- |----------|-----------|---------------|
131
- | ai-impact-assessment | ISO 42001 Clause 8.4 | HIGH risk, EU jurisdiction, decisions about individuals |
132
- | intended-purpose-doc | NIST MAP 1.1 | HIGH and MEDIUM risk |
133
- | risk-characterization | NIST MAP 5.1 | HIGH risk |
134
- | third-party-assessment | GOVERN 6 / LLM03 | Third-party API at MEDIUM or HIGH risk |
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)
135
75
 
136
- ## Auditing existing projects
76
+ ## The principle behind Aigis
137
77
 
138
- Aigis can audit codebases that already exist, not just new code:
78
+ Governance isn't a content problem. It's an interface problem.
139
79
 
140
- ```bash
141
- # Get the structured scan prompt
142
- aigis audit --scan
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.
143
81
 
144
- # The agent scans the codebase following the prompt, detects traits, then:
145
- aigis audit --traits uses-llm,processes-pii,is-external
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)
146
85
 
147
- # Output: classification + all relevant checklists
148
- # Agent evaluates existing code against each check → gap report
149
- ```
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.
150
87
 
151
- ## Self-improving agents
88
+ ## Manual CLI reference (for CI, scripting, audit prep, power users)
152
89
 
153
- Aigis supports a learning loop where agents get smarter over time:
90
+ The CLI exists in case you want to drive Aigis directly — for CI workflows, audit prep, debugging, or one-off invocations.
154
91
 
155
92
  ```bash
156
- # Agent discovers a workaround during coding
157
- aigis annotate input-validation "Needs raw body for webhook verification"
158
-
159
- # Next session, the annotation appears automatically
160
- aigis get input-validation
161
- # ... content includes annotation at the bottom
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
162
118
  ```
163
119
 
164
- ## Agent-agnostic design
165
-
166
- Aigis works with any coding agent that can execute shell commands:
167
-
168
- - **Cursor** — `aigis init cursor` writes `.cursorrules`
169
- - **Claude Code** — `aigis init claude-code` creates `~/.claude/skills/aigis/SKILL.md`
170
- - **Windsurf** — `aigis init windsurf` writes `.windsurfrules`
171
- - **GitHub Copilot** — `aigis init copilot` writes `.github/copilot-instructions.md`
172
- - **Any agent** — if it can run a terminal command and read stdout, it works
120
+ Run `aigis --help` for full options.
173
121
 
174
- ## Framework coverage
122
+ ## Honest about what this isn't
175
123
 
176
- Aigis maps every code pattern to specific control IDs across three frameworks:
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.
177
128
 
178
- - **OWASP Top 10 for LLM Applications (2025)** — all 10 risks covered
179
- - **NIST AI Risk Management Framework (AI RMF 1.0)** — 25 subcategories mapped
180
- - **ISO/IEC 42001:2023** — 15 control references mapped
129
+ ## Benchmark results
181
130
 
182
- Control IDs are in each file's YAML frontmatter, enabling compliance teams to trace code decisions back to framework requirements.
131
+ v2.0 was benchmarked at every iteration. Final numbers, against the same 10 descriptions:
183
132
 
184
- ## Architecture
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
185
135
 
186
- The governance content lives under `content/` and is shared by both CLIs.
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.
187
137
 
188
- **npm package** [`@aigis-ai/cli`](https://www.npmjs.com/package/@aigis-ai/cli) (Node.js)
138
+ ## Supported agents
189
139
 
190
- ```
191
- @aigis-ai/cli
192
- ├── bin/aigis.js # CLI entry point (commander.js)
193
- ├── lib/
194
- │ ├── classify.js # Classification engine + guardrails
195
- │ ├── fetch.js # Content reader + annotation injection
196
- │ ├── keywords.js # Natural language → trait mapping
197
- │ ├── search.js # Content search
198
- │ ├── annotate.js # Local annotation store
199
- │ └── init.js # IDE setup
200
- ├── content/
201
- │ ├── implement/ # 15 governance pattern files
202
- │ ├── verify/ # 15 verification checklists
203
- │ ├── templates/ # 4 compliance doc templates
204
- │ └── index/ # Taxonomy, frameworks index, guardrails, audit scan
205
- ├── SKILL.md # Portable agent skill file
206
- └── package.json
207
- ```
208
-
209
- **PyPI package** [`aigis-cli`](https://pypi.org/project/aigis-cli/) (Python)
210
-
211
- ```
212
- cli-python/
213
- ├── pyproject.toml
214
- └── aigis_cli/ # click + rich + python-frontmatter; mirrors the JS CLI
215
- ├── cli.py
216
- ├── classify.py, fetch.py, keywords.py, search.py, annotate.py, init_ide.py
217
- ├── content/ # same markdown + JSON as above (bundled as package data)
218
- └── SKILL.md
219
- ```
140
+ - Cursor
141
+ - Claude Code
142
+ - GitHub Copilot
143
+ - Windsurf
220
144
 
221
- No network calls. No telemetry. No LLM API calls. No databases. Everything runs locally, reads local files, prints to stdout.
145
+ Each maps to a different rules file location. `aigis init <ide>` handles the difference; `--refresh` updates safely.
222
146
 
223
147
  ## Contributing
224
148
 
225
- Content is plain markdown with YAML frontmatter, submitted as pull requests. See the existing files in `content/implement/` for the format.
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`.
226
150
 
227
- To add a new governance pattern:
228
- 1. Create `content/implement/your-pattern.md` following the existing format
229
- 2. Create `content/verify/checklist-your-pattern.md` with verification checks
230
- 3. Add the pattern to the trait-to-file mapping in `content/index/taxonomy.md`
231
- 4. Add control IDs to the YAML frontmatter
232
- 5. Submit a PR
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.
233
152
 
234
153
  ## License
235
154
 
236
- [MIT](LICENSE)
155
+ MIT
package/bin/aigis.js CHANGED
@@ -5,6 +5,7 @@ const chalk = require('chalk');
5
5
  const { classify } = require('../lib/classify');
6
6
  const { get, getTemplate, getAuditScan, getWorkflow, listWorkflows, getInfra, listInfras } = require('../lib/fetch');
7
7
  const { buildBrief, buildList, BriefTooLargeError } = require('../lib/build');
8
+ const { getUserJurisdictions, filterAreasByJurisdiction } = require('../lib/jurisdiction');
8
9
  const { verify } = require('../lib/fetch');
9
10
  const { search, listAll } = require('../lib/search');
10
11
  const { annotate, listAnnotations, clearAnnotation } = require('../lib/annotate');
@@ -17,7 +18,7 @@ const program = new Command();
17
18
  program
18
19
  .name('aigis')
19
20
  .description('AI governance guardrails for coding agents')
20
- .version('2.0.0');
21
+ .version('2.1.0');
21
22
 
22
23
  // ============================================================
23
24
  // aigis classify
@@ -29,6 +30,7 @@ program
29
30
  .option('--json', 'Output as JSON (also enabled automatically when stdout is not a TTY)')
30
31
  .option('--confirm <ids>', 'Comma-separated low-confidence suggestion IDs to confirm (no interactive prompt)')
31
32
  .option('--reject <ids>', 'Comma-separated low-confidence suggestion IDs to reject (no interactive prompt)')
33
+ .option('--jurisdiction <codes>', 'Comma-separated jurisdiction codes (eu, us-regulated, global). Adds the matching jurisdiction-* traits to your set, overriding resolver detection.')
32
34
  .argument('[description]', 'Natural language description (resolved via content/resolvers/triggers.json)')
33
35
  .action(async (description, opts) => {
34
36
  // Three modes: --traits only, description only, both (additive).
@@ -72,8 +74,11 @@ program
72
74
  }
73
75
 
74
76
  const resolved = applyConfirmations(detection, decisions);
75
- // Merge with --traits
76
- const finalTraits = [...new Set([...resolved.final_traits, ...traitsFromFlag])].sort();
77
+ // Merge with --traits + --jurisdiction-derived traits
78
+ const jurisdictionTraits = opts.jurisdiction
79
+ ? opts.jurisdiction.split(',').map((s) => s.trim()).filter(Boolean).map((c) => `jurisdiction-${c}`)
80
+ : [];
81
+ const finalTraits = [...new Set([...resolved.final_traits, ...traitsFromFlag, ...jurisdictionTraits])].sort();
77
82
 
78
83
  // Build a resolver report for transparency (in both JSON and text modes when description was given)
79
84
  const resolverReport = description ? {
@@ -103,6 +108,18 @@ program
103
108
  console.error(chalk.red(e.message));
104
109
  process.exit(1);
105
110
  }
111
+
112
+ // v2.1: jurisdiction filter. classify produces conceptually-relevant areas;
113
+ // we drop EU-tagged areas if user is not in EU jurisdiction (and same for
114
+ // any other jurisdiction-gated area). Universal areas pass through.
115
+ const userJurisdictions = getUserJurisdictions(finalTraits);
116
+ const beforeFilter = result.implement_files.length;
117
+ result.implement_files = filterAreasByJurisdiction(result.implement_files, userJurisdictions);
118
+ result.filtered_by_jurisdiction = {
119
+ user_jurisdictions: [...userJurisdictions],
120
+ dropped_count: beforeFilter - result.implement_files.length,
121
+ };
122
+
106
123
  if (resolverReport) result.resolver = resolverReport;
107
124
 
108
125
  if (jsonMode) {
@@ -207,6 +224,7 @@ program
207
224
  .argument('<files...>', 'File IDs to verify')
208
225
  .option('--auto <path>', 'Run deterministic scanner against the project at <path> instead of returning the blank checklist')
209
226
  .option('--json', 'Output auto-verify results as JSON (only with --auto)')
227
+ .option('--jurisdiction <codes>', 'Comma-separated jurisdiction codes (eu, us-regulated). Surfaces jurisdiction-specific control citations (e.g. EU AI Act articles) in the report.')
210
228
  .action((files, opts) => {
211
229
  if (!opts.auto) {
212
230
  // Backward-compatible behavior: fetch the blank checklist markdown
@@ -223,10 +241,15 @@ program
223
241
  process.exit(1);
224
242
  }
225
243
 
244
+ // v2.1: parse --jurisdiction once, applied to every area's verify run.
245
+ const jurisdictions = opts.jurisdiction
246
+ ? opts.jurisdiction.split(',').map((s) => s.trim()).filter(Boolean)
247
+ : [];
248
+
226
249
  const results = [];
227
250
  for (const area of files) {
228
251
  try {
229
- const r = autoVerifyArea(area, projectDir);
252
+ const r = autoVerifyArea(area, projectDir, { jurisdictions });
230
253
  results.push(r);
231
254
  } catch (e) {
232
255
  console.error(chalk.red(`Error verifying "${area}": ${e.message}`));
@@ -307,6 +330,8 @@ program
307
330
  .option('--list', 'Shape A: print area names + traits + pre-built --confirm/--reject flags only')
308
331
  .option('--confirm <ids>', 'Comma-separated low-confidence trigger ids/slugs to confirm (no interactive prompt)')
309
332
  .option('--reject <ids>', 'Comma-separated low-confidence trigger ids/slugs to reject (no interactive prompt)')
333
+ .option('--jurisdiction <codes>', 'Comma-separated jurisdiction codes (eu, us-regulated). Adds jurisdiction-* traits and gates EU AI Act / regional content accordingly.')
334
+ .option('--tight', 'Experimental: require ≥2 trait matches for area inclusion (vs default ≥1). Produces smaller briefs; trades some recall for precision.')
310
335
  .option('--json', 'Output JSON (brief + meta) instead of plain markdown to stdout')
311
336
  .action(async (description, opts) => {
312
337
  if (opts.full && opts.compact) {
@@ -318,10 +343,15 @@ program
318
343
  process.exit(1);
319
344
  }
320
345
 
346
+ // v2.1: parse --jurisdiction flag once, used by all paths below.
347
+ const extraJurisdictions = opts.jurisdiction
348
+ ? opts.jurisdiction.split(',').map((s) => s.trim()).filter(Boolean)
349
+ : [];
350
+
321
351
  // --list short-circuit (Shape A)
322
352
  if (opts.list) {
323
353
  try {
324
- process.stdout.write(buildList({ description }));
354
+ process.stdout.write(buildList({ description, extraJurisdictions, tight: !!opts.tight }));
325
355
  } catch (err) {
326
356
  console.error(chalk.red(err.message));
327
357
  process.exit(1);
@@ -383,7 +413,7 @@ program
383
413
 
384
414
  let result;
385
415
  try {
386
- result = buildBrief({ description, decisions, mode });
416
+ result = buildBrief({ description, decisions, extraJurisdictions, tight: !!opts.tight, mode });
387
417
  } catch (err) {
388
418
  if (err instanceof BriefTooLargeError) {
389
419
  console.error(chalk.red(err.message));
@@ -537,6 +567,105 @@ program
537
567
  process.exit(1);
538
568
  });
539
569
 
570
+ // ============================================================
571
+ // aigis report (v2.1)
572
+ // ============================================================
573
+ program
574
+ .command('report')
575
+ .description('Compile an audit-ready compliance report (verify across multiple areas + cross-framework citations + evidence)')
576
+ .option('--areas <ids>', 'Comma-separated area ids to evaluate (e.g. pii-handling,audit-logging)')
577
+ .option('--from-classify <description>', 'Auto-detect areas: run aigis classify on this description first, then report on the recommended areas')
578
+ .option('--all', 'Evaluate every area in content/skills/areas/ (warning: large output)')
579
+ .option('--project <path>', 'Path to project to scan (default: current directory)', '.')
580
+ .option('--jurisdiction <codes>', 'Comma-separated jurisdiction codes (eu, us-regulated). Surfaces jurisdiction-specific control citations.')
581
+ .option('--format <fmt>', 'Output format: markdown | json (default markdown)', 'markdown')
582
+ .option('--output <path>', 'Write report to file instead of stdout')
583
+ .action(async (opts) => {
584
+ const { buildReport, formatReportMarkdown, formatReportJSON } = require('../lib/report');
585
+ const fs2 = require('fs');
586
+ const pathMod = require('path');
587
+
588
+ const projectDir = pathMod.resolve(opts.project);
589
+ if (!fs2.existsSync(projectDir)) {
590
+ console.error(chalk.red(`Project path does not exist: ${projectDir}`));
591
+ process.exit(1);
592
+ }
593
+
594
+ // Resolve area list — exactly one source must be provided.
595
+ const sources = [opts.areas, opts.fromClassify, opts.all].filter(Boolean).length;
596
+ if (sources === 0) {
597
+ console.error(chalk.red('Provide one of --areas <ids>, --from-classify "<description>", or --all.'));
598
+ console.error(chalk.dim(' aigis report --areas pii-handling,audit-logging --project .'));
599
+ console.error(chalk.dim(' aigis report --from-classify "EU credit scoring system" --project .'));
600
+ console.error(chalk.dim(' aigis report --all --project .'));
601
+ process.exit(1);
602
+ }
603
+ if (sources > 1) {
604
+ console.error(chalk.red('Pass exactly one of --areas, --from-classify, --all.'));
605
+ process.exit(1);
606
+ }
607
+
608
+ let areas = [];
609
+ const jurisdictions = opts.jurisdiction
610
+ ? opts.jurisdiction.split(',').map((s) => s.trim()).filter(Boolean)
611
+ : [];
612
+
613
+ if (opts.areas) {
614
+ areas = opts.areas.split(',').map((s) => s.trim()).filter(Boolean);
615
+ } else if (opts.fromClassify) {
616
+ // Run classify, take its (jurisdiction-filtered) implement_files.
617
+ const { detectTraitsFromText, applyConfirmations } = require('../lib/keywords');
618
+ const detection = detectTraitsFromText(opts.fromClassify);
619
+ const decisions = {};
620
+ for (const sug of detection.low_confidence_matches) decisions[sug.id] = 'no'; // conservative for non-interactive report
621
+ const resolved = applyConfirmations(detection, decisions);
622
+ const jurisdictionTraits = jurisdictions.map((c) => `jurisdiction-${c}`);
623
+ const finalTraits = [...new Set([...resolved.final_traits, ...jurisdictionTraits])].sort();
624
+ if (finalTraits.length === 0) {
625
+ console.error(chalk.red('No traits resolved from --from-classify description. Try --areas <list> instead, or pass a more specific description.'));
626
+ process.exit(1);
627
+ }
628
+ const cls = classify(finalTraits);
629
+ areas = filterAreasByJurisdiction(cls.implement_files, getUserJurisdictions(finalTraits));
630
+ } else {
631
+ // --all: every area markdown file
632
+ const areasDir = pathMod.join(__dirname, '..', 'content', 'skills', 'areas');
633
+ areas = fs2.readdirSync(areasDir)
634
+ .filter((f) => f.endsWith('.md'))
635
+ .map((f) => f.replace(/\.md$/, ''))
636
+ .sort();
637
+ // Apply jurisdiction filter so EU areas don't show for non-EU reports
638
+ areas = filterAreasByJurisdiction(areas, getUserJurisdictions(jurisdictions.map((c) => `jurisdiction-${c}`)));
639
+ }
640
+
641
+ if (areas.length === 0) {
642
+ console.error(chalk.red('No areas to evaluate after jurisdiction filtering. Pass --jurisdiction or different --areas.'));
643
+ process.exit(1);
644
+ }
645
+
646
+ let report;
647
+ try {
648
+ report = buildReport({ projectDir, areas, jurisdictions });
649
+ } catch (err) {
650
+ console.error(chalk.red(err.message));
651
+ process.exit(1);
652
+ }
653
+
654
+ const fmt = (opts.format || 'markdown').toLowerCase();
655
+ let output;
656
+ if (fmt === 'json') output = formatReportJSON(report);
657
+ else if (fmt === 'markdown' || fmt === 'md') output = formatReportMarkdown(report);
658
+ else { console.error(chalk.red(`Unknown --format "${opts.format}". Use markdown or json.`)); process.exit(1); }
659
+
660
+ if (opts.output) {
661
+ fs2.writeFileSync(opts.output, output + (output.endsWith('\n') ? '' : '\n'));
662
+ console.error(chalk.green(`Report written to ${opts.output} (${output.length} chars, ${areas.length} area${areas.length === 1 ? '' : 's'} evaluated)`));
663
+ } else {
664
+ process.stdout.write(output);
665
+ if (!output.endsWith('\n')) process.stdout.write('\n');
666
+ }
667
+ });
668
+
540
669
  // ============================================================
541
670
  // aigis search
542
671
  // ============================================================
@@ -634,11 +763,13 @@ program
634
763
  // ============================================================
635
764
  program
636
765
  .command('init')
637
- .description('Set up aigis for your IDE (writes core skill + resolver block)')
766
+ .description('Set up aigis for your IDE (writes core skill + resolver block). Optional --ci and --hook activation surfaces.')
638
767
  .argument('<ide>', 'IDE to configure: cursor, claude-code, windsurf, copilot')
639
768
  .option('--refresh', 'Overwrite existing aigis content (destructive — use after Aigis updates or to fix a stale resolver block checksum)')
769
+ .option('--ci <provider>', 'Install CI workflow file. Currently supports: github (drops .github/workflows/aigis.yml).')
770
+ .option('--hook', 'Install .git/hooks/pre-commit that runs aigis verify on areas declared in .aigisrc.json.')
640
771
  .action((ide, opts) => {
641
- init(ide, { refresh: !!opts.refresh });
772
+ init(ide, { refresh: !!opts.refresh, ci: opts.ci, hook: !!opts.hook });
642
773
  });
643
774
 
644
775
  // ============================================================