@red-codes/agentguard 1.1.1 → 1.1.2
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.
- package/README.md +179 -0
- package/dist/bin.js +1 -6
- package/dist/bin.js.map +3 -3
- package/package.json +7 -7
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# @red-codes/agentguard
|
|
2
|
+
|
|
3
|
+
**Runtime governance for AI coding agents.** Intercepts tool calls, enforces policies and invariants, and produces a verifiable execution trail.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@red-codes/agentguard)
|
|
6
|
+
[](https://github.com/AgentGuardHQ/agentguard/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @red-codes/agentguard
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What It Does
|
|
15
|
+
|
|
16
|
+
AgentGuard adds a deterministic decision layer between what an AI agent proposes and what actually runs. Every tool call passes through a governed action kernel:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
agent proposes action → policy evaluated → invariants checked → allow/deny → events emitted
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **20 built-in invariants** — secret exposure, protected branches, blast radius, CI/CD config modification, permission escalation, and more
|
|
23
|
+
- **YAML policy format** — declare what agents can and can't do
|
|
24
|
+
- **Full audit trail** — every decision recorded to SQLite
|
|
25
|
+
- **Claude Code integration** — hooks fire on every tool call, zero config
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Set up Claude Code hooks (one-time)
|
|
31
|
+
agentguard claude-init
|
|
32
|
+
|
|
33
|
+
# Check governance status
|
|
34
|
+
agentguard status
|
|
35
|
+
|
|
36
|
+
# Validate a policy file
|
|
37
|
+
agentguard policy validate agentguard.yaml
|
|
38
|
+
|
|
39
|
+
# Evaluate an action against policy (dry-run)
|
|
40
|
+
echo '{"tool":"Bash","command":"git push origin main"}' | agentguard guard --dry-run
|
|
41
|
+
|
|
42
|
+
# Inspect the most recent governance session
|
|
43
|
+
agentguard inspect --last
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Claude Code Integration
|
|
47
|
+
|
|
48
|
+
AgentGuard integrates via inline hooks — no daemon, no ports, no IPC:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
agentguard claude-init # Installs PreToolUse + PostToolUse + SessionStart hooks
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
| Hook | Purpose |
|
|
55
|
+
|------|---------|
|
|
56
|
+
| **PreToolUse** | Evaluates every tool call against policies and invariants before execution |
|
|
57
|
+
| **PostToolUse** | Reports Bash stderr errors (informational) |
|
|
58
|
+
| **SessionStart** | Ensures build is ready, shows governance status |
|
|
59
|
+
|
|
60
|
+
Tool call mapping:
|
|
61
|
+
|
|
62
|
+
| Claude Code Tool | AgentGuard Action |
|
|
63
|
+
|-----------------|-------------------|
|
|
64
|
+
| Write / Edit | file.write |
|
|
65
|
+
| Read / Glob / Grep | file.read |
|
|
66
|
+
| Bash | shell.exec (or git.push, git.commit if git command detected) |
|
|
67
|
+
|
|
68
|
+
## Policy Format
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
id: project-policy
|
|
72
|
+
name: Project Policy
|
|
73
|
+
severity: 4
|
|
74
|
+
rules:
|
|
75
|
+
- action: git.push
|
|
76
|
+
effect: deny
|
|
77
|
+
branches: [main, master]
|
|
78
|
+
reason: Protected branch
|
|
79
|
+
|
|
80
|
+
- action: file.write
|
|
81
|
+
effect: deny
|
|
82
|
+
target: .env
|
|
83
|
+
reason: No secrets modification
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Drop an `agentguard.yaml` in your repo root — the CLI picks it up automatically.
|
|
87
|
+
|
|
88
|
+
## Built-in Invariants
|
|
89
|
+
|
|
90
|
+
20 safety invariants run on every action:
|
|
91
|
+
|
|
92
|
+
| Invariant | Severity | What it does |
|
|
93
|
+
|-----------|----------|-------------|
|
|
94
|
+
| no-secret-exposure | Critical | Blocks .env, .pem, .key, credentials files |
|
|
95
|
+
| no-credential-file-creation | Critical | Blocks SSH keys, cloud configs, auth tokens |
|
|
96
|
+
| no-cicd-config-modification | Critical | Protects CI/CD pipeline configs |
|
|
97
|
+
| no-governance-self-modification | Critical | Prevents agents from modifying governance |
|
|
98
|
+
| protected-branch | High | Prevents push to main/master |
|
|
99
|
+
| no-force-push | High | Forbids force push |
|
|
100
|
+
| no-package-script-injection | High | Blocks lifecycle script tampering |
|
|
101
|
+
| no-permission-escalation | High | Catches chmod world-writable, setuid |
|
|
102
|
+
| no-network-egress | High | Denies HTTP to non-allowlisted domains |
|
|
103
|
+
| transitive-effect-analysis | High | Analyzes written files for downstream effects |
|
|
104
|
+
| blast-radius-limit | Medium | Enforces file modification limit |
|
|
105
|
+
| test-before-push | Medium | Requires tests pass before push |
|
|
106
|
+
| large-file-write | Medium | Per-file size limit |
|
|
107
|
+
| ...and 7 more | Low-Medium | Container config, env vars, migrations, lockfiles, recursive ops |
|
|
108
|
+
|
|
109
|
+
## CLI Commands
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Governance
|
|
113
|
+
agentguard guard [--policy <file>] [--dry-run] # Start governed runtime
|
|
114
|
+
agentguard inspect [--last] # Inspect action graph
|
|
115
|
+
agentguard events [--last] # Raw event stream
|
|
116
|
+
agentguard analytics # Violation patterns
|
|
117
|
+
agentguard traces [--last] # Policy evaluation traces
|
|
118
|
+
|
|
119
|
+
# Policy
|
|
120
|
+
agentguard policy validate <file> # Validate policy
|
|
121
|
+
agentguard policy suggest # Auto-suggest rules from violations
|
|
122
|
+
agentguard policy verify <file> # Verify against historical violations
|
|
123
|
+
|
|
124
|
+
# Simulation
|
|
125
|
+
agentguard simulate <action-json> # Predict impact without executing
|
|
126
|
+
agentguard simulate --plan <file> # Batch simulate an action plan
|
|
127
|
+
|
|
128
|
+
# Session tools
|
|
129
|
+
agentguard replay --last [--step] # Replay governance session
|
|
130
|
+
agentguard session-viewer --last # Interactive HTML timeline
|
|
131
|
+
agentguard diff <runA> <runB> # Compare two sessions
|
|
132
|
+
agentguard export/import # Portable JSONL sessions
|
|
133
|
+
|
|
134
|
+
# CI/CD
|
|
135
|
+
agentguard ci-check [--last] # Verify governance in CI
|
|
136
|
+
agentguard evidence-pr [--pr <num>] # Attach evidence to PR
|
|
137
|
+
agentguard audit-verify [--last] # Verify audit chain integrity
|
|
138
|
+
|
|
139
|
+
# Integration
|
|
140
|
+
agentguard claude-init # Set up Claude Code hooks
|
|
141
|
+
agentguard auto-setup # Auto-detect and configure
|
|
142
|
+
agentguard status # Check governance readiness
|
|
143
|
+
agentguard demo # Interactive showcase
|
|
144
|
+
|
|
145
|
+
# Configuration
|
|
146
|
+
agentguard config show|get|set # Manage config
|
|
147
|
+
agentguard init --extension <type> # Scaffold extensions
|
|
148
|
+
agentguard migrate # Import JSONL into SQLite
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Library Packages
|
|
152
|
+
|
|
153
|
+
For building integrations, the core types and event model are available as separate packages:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm install @red-codes/core # Types, actions, utilities
|
|
157
|
+
npm install @red-codes/events # Canonical event model
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Agent Swarm
|
|
161
|
+
|
|
162
|
+
AgentGuard ships with a 26-agent autonomous development swarm:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
agentguard init swarm # Scaffolds agents, skills, and governance into your repo
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Agents handle implementation, code review, CI triage, security audits, planning, docs, and more — all under governance.
|
|
169
|
+
|
|
170
|
+
## Links
|
|
171
|
+
|
|
172
|
+
- [GitHub](https://github.com/AgentGuardHQ/agentguard)
|
|
173
|
+
- [Documentation](https://agentguardhq.github.io/agent-guard/)
|
|
174
|
+
- [Architecture](https://github.com/AgentGuardHQ/agentguard/blob/main/docs/unified-architecture.md)
|
|
175
|
+
- [Roadmap](https://github.com/AgentGuardHQ/agentguard/blob/main/ROADMAP.md)
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
[Apache 2.0](https://github.com/AgentGuardHQ/agentguard/blob/main/LICENSE)
|
package/dist/bin.js
CHANGED
|
@@ -29045,12 +29045,7 @@ async function main() {
|
|
|
29045
29045
|
}
|
|
29046
29046
|
case "--version":
|
|
29047
29047
|
case "-v": {
|
|
29048
|
-
|
|
29049
|
-
const { fileURLToPath: fileURLToPath6 } = await import("node:url");
|
|
29050
|
-
const { dirname: dirname14, join: join32 } = await import("node:path");
|
|
29051
|
-
const __dir = dirname14(fileURLToPath6(import.meta.url));
|
|
29052
|
-
const pkg = JSON.parse(readFileSync32(join32(__dir, "..", "..", "package.json"), "utf8"));
|
|
29053
|
-
console.log(`agentguard v${pkg.version}`);
|
|
29048
|
+
console.log(`agentguard v${"1.1.2"}`);
|
|
29054
29049
|
break;
|
|
29055
29050
|
}
|
|
29056
29051
|
case "help":
|