Skip to content

Commit bf8c8ac

Browse files
Merge docs/shield-readme: Add Shield documentation to CLI README
2 parents 690ea9a + c25d6a5 commit bf8c8ac

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

packages/cli/README.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Run `opena2a init` in any project directory to get an instant security assessmen
5252
MCP config found
5353
-----------------------------------------------
5454
Trust Score 30 / 100 [Grade: F]
55+
Shield Posture 25 / 100 (CRITICAL)
56+
Products 1/7 active
5557
5658
Next Steps
5759
-----------------------------------------------
@@ -177,6 +179,198 @@ opena2a config contribute on # Enable community data sharing
177179
opena2a config llm on # Enable LLM-powered command matching
178180
```
179181

182+
## Shield: Unified Security Orchestration
183+
184+
Shield ties all OpenA2A products into a single security layer for AI coding assistants. It provides a tamper-evident event log, policy evaluation, runtime monitoring, session identification, integrity verification, and LLM-powered analysis.
185+
186+
```bash
187+
opena2a shield init # Full environment scan + policy generation
188+
opena2a shield status # Product availability and integrity state
189+
opena2a shield selfcheck # Run integrity checks across all subsystems
190+
```
191+
192+
### How Shield protects your workstation
193+
194+
| Capability | What it does | Status |
195+
|-----------|-------------|--------|
196+
| **Credential scanning** | Detects hardcoded API keys (Anthropic, OpenAI, AWS, Google, GitHub) | Active |
197+
| **Scope drift detection** | Finds API keys that silently access unintended services (DRIFT-001, DRIFT-002) | Active |
198+
| **Tamper-evident event log** | SHA-256 hash-chained event log -- any modification breaks the chain | Active |
199+
| **Policy evaluation** | Allow/deny rules for processes, credentials, network, filesystem, MCP servers | Active |
200+
| **Session identification** | Detects which AI assistant is running (Claude Code, Cursor, Copilot, Windsurf) | Active |
201+
| **Config integrity** | Signs config files and detects unauthorized modifications | Active |
202+
| **ARP bridge** | Imports runtime protection events from HackMyAgent's ARP into Shield's log | Active |
203+
| **Posture scoring** | 0-100 security score based on active products, policy, hooks, credentials | Active |
204+
| **LLM intelligence** | AI-powered policy suggestions, anomaly explanations, incident triage | Active (opt-in) |
205+
| **Integrity selfcheck** | Verifies policy, shell hooks, event chain, process, and artifact signatures | Active |
206+
| **Lockdown mode** | Enters lockdown when integrity checks fail; requires explicit recovery | Active |
207+
| **Adaptive learning** | Observes agent behavior to build per-agent baselines and suggest policies | Architecture ready |
208+
209+
Shield currently operates in **observation and detection** mode. It logs, classifies, and surfaces security events for the developer to act on. Enforcement (automatic blocking) is on the roadmap once baselines are established through the adaptive learning phase.
210+
211+
### Subcommands
212+
213+
#### `opena2a shield init`
214+
215+
Full environment scan: detects project type, scans for credentials, discovers AI assistants, MCP servers, and OAuth sessions, generates a YAML policy file, installs shell hooks, and writes a genesis event to the tamper-evident log.
216+
217+
```bash
218+
opena2a shield init # Scan current directory
219+
opena2a shield init --dir ./my-agent # Scan specific directory
220+
opena2a shield init --format json # Machine-readable output
221+
```
222+
223+
#### `opena2a shield status`
224+
225+
Shows product availability, policy mode, shell integration, and integrity state.
226+
227+
```bash
228+
opena2a shield status
229+
opena2a shield status --format json
230+
```
231+
232+
#### `opena2a shield log`
233+
234+
Query the tamper-evident event log with filters.
235+
236+
```bash
237+
opena2a shield log # Last 20 events
238+
opena2a shield log --count 50 # Last 50 events
239+
opena2a shield log --severity high # High+ severity only
240+
opena2a shield log --source arp # ARP runtime events
241+
opena2a shield log --agent claude-code # Events from Claude Code
242+
opena2a shield log --since 7d # Last 7 days
243+
opena2a shield log --format json # JSON output
244+
```
245+
246+
#### `opena2a shield selfcheck`
247+
248+
Runs five integrity checks: policy hash, shell hook content, event chain validity, process binary, and artifact signatures. Returns `healthy`, `degraded`, or `compromised` status.
249+
250+
```bash
251+
opena2a shield selfcheck
252+
opena2a shield check # Alias
253+
opena2a shield selfcheck --format json
254+
```
255+
256+
#### `opena2a shield policy`
257+
258+
Show the loaded security policy (mode, rule counts, agent overrides).
259+
260+
```bash
261+
opena2a shield policy
262+
opena2a shield policy --format json
263+
```
264+
265+
#### `opena2a shield evaluate`
266+
267+
Evaluate an action against the loaded policy. Returns `ALLOWED`, `BLOCKED`, or `MONITORED`.
268+
269+
```bash
270+
opena2a shield evaluate --category processes --agent claude-code
271+
opena2a shield evaluate --format json
272+
```
273+
274+
#### `opena2a shield monitor`
275+
276+
Import ARP (Agent Runtime Protection) events into Shield's hash-chained log and display runtime stats.
277+
278+
```bash
279+
opena2a shield monitor # Import events + show stats
280+
opena2a shield monitor --agent cursor # Tag imported events
281+
opena2a shield monitor --since 7d # Stats for last 7 days
282+
opena2a shield monitor --format json
283+
```
284+
285+
#### `opena2a shield report`
286+
287+
Generate a security posture report from event data. Includes severity breakdown, agent activity, policy violations, and top actions.
288+
289+
```bash
290+
opena2a shield report # Last 7 days
291+
opena2a shield report --since 30d # Last 30 days
292+
opena2a shield report --analyze # Include LLM narrative
293+
opena2a shield report --format json
294+
```
295+
296+
#### `opena2a shield session`
297+
298+
Detect the current AI coding assistant session. Identifies Claude Code, Cursor, GitHub Copilot, Windsurf, Aider, and Continue.
299+
300+
```bash
301+
opena2a shield session
302+
opena2a shield session --verbose # Show raw detection signals
303+
opena2a shield session --format json
304+
```
305+
306+
#### `opena2a shield recover`
307+
308+
Exit lockdown mode after integrity failures. Optionally re-verify before lifting lockdown.
309+
310+
```bash
311+
opena2a shield recover # Exit lockdown
312+
opena2a shield recover --verify # Verify first, then exit
313+
```
314+
315+
#### `opena2a shield suggest`
316+
317+
LLM-powered policy suggestion based on observed agent behavior. Requires LLM backend (enable with `opena2a config llm on`).
318+
319+
```bash
320+
opena2a shield suggest # Suggest policy from all events
321+
opena2a shield suggest --agent cursor # For specific agent
322+
opena2a shield suggest --format json
323+
```
324+
325+
#### `opena2a shield explain`
326+
327+
LLM-powered explanation of security events. Provides severity assessment, risk factors, and recommended actions.
328+
329+
```bash
330+
opena2a shield explain # Explain most recent event
331+
opena2a shield explain --count 5 # Explain last 5 events
332+
opena2a shield explain --severity high # High+ severity only
333+
```
334+
335+
#### `opena2a shield triage`
336+
337+
LLM-powered incident classification. Correlates multiple events and classifies as false-positive, suspicious, or confirmed-threat.
338+
339+
```bash
340+
opena2a shield triage # Triage high+ severity events
341+
opena2a shield triage --severity medium # Include medium severity
342+
opena2a shield triage --agent windsurf # For specific agent
343+
```
344+
345+
### Event Log Format
346+
347+
Shield maintains a tamper-evident event log at `~/.opena2a/shield/events.jsonl`. Each event is SHA-256 hash-chained to the previous event, starting from a genesis hash. Any modification to a past event breaks the chain and is detected by `selfcheck`.
348+
349+
```
350+
[2026-03-02T12:00:00Z] [HIGH] process.anomaly -> curl evil.com (monitored)
351+
[2026-03-02T12:01:00Z] [CRITICAL] prompt.threat -> injection-attempt (blocked)
352+
[2026-03-02T12:02:00Z] [INFO] process.spawn -> /usr/bin/ls (allowed)
353+
```
354+
355+
### Quick Start
356+
357+
```bash
358+
# 1. Initialize Shield in your project
359+
opena2a shield init
360+
361+
# 2. Check what AI assistants are running
362+
opena2a shield session
363+
364+
# 3. View security events
365+
opena2a shield log --severity medium
366+
367+
# 4. Generate a posture report
368+
opena2a shield report
369+
370+
# 5. Run integrity verification
371+
opena2a shield selfcheck
372+
```
373+
180374
## Smart Input Modes
181375

182376
The CLI includes built-in intelligence for command discovery:

0 commit comments

Comments
 (0)