Skip to content

Commit 8ad1a5a

Browse files
dreynowclaude
andcommitted
docs: rewrite README with Claude Code skill, hierarchical scopes, audit trail
Lead with the skill (the distribution unlock), not the library. Added: named agents, hierarchical scopes, git pre-push hook, exec wrapper, audit trail. Removed: Observatory, interop matrix, competitive table, architecture diagram (moved to docs site). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 521fcee commit 8ad1a5a

1 file changed

Lines changed: 71 additions & 157 deletions

File tree

README.md

Lines changed: 71 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
**Your AI agents currently have keys. We give them math instead.**
44

5-
AI agents are being given SSH keys and API tokens like it's 1999. Kanoniv agent-auth replaces long-lived credentials with cryptographic delegation tokens that are scope-confined, time-bounded, and fully auditable.
6-
7-
```python
5+
```bash
86
pip install kanoniv-auth
97
```
108

@@ -19,206 +17,122 @@ verify(action="deploy.prod", token=token) # raises ScopeViolation
1917

2018
That second line doesn't just fail. It **cannot** succeed. Not policy-blocked, not RBAC-blocked - cryptographically impossible without the root key.
2119

22-
## Why This Exists
23-
24-
A typical AI-assisted deploy flow today:
25-
26-
1. Developer tells Copilot/Devin/Claude to "fix the bug and deploy it"
27-
2. The agent gets a long-lived API token with broad permissions
28-
3. It pushes code, triggers the pipeline, maybe touches infra
29-
4. Nobody has a clean audit trail of what the agent decided vs what the human approved
20+
## Claude Code Skill
3021

31-
The "solution" most teams have is vibes. A slightly restricted token and hope.
32-
33-
## What This Solves
34-
35-
| Problem | How kanoniv-auth solves it |
36-
|---------|---------------------------|
37-
| Agents have broad permissions | Scope confinement - `deploy.staging` cannot touch prod |
38-
| Leaked tokens are valid forever | `expires_at` - hard ceiling, default 4h |
39-
| No audit trail for agent actions | Every action is signed with its delegation chain |
40-
| Agents can't delegate to sub-agents safely | Delegation chains only narrow, never widen |
41-
42-
## The Demo Workflow
22+
Scope-enforce your AI coding agent in one command:
4323

24+
```bash
25+
kanoniv-auth install-skill
4426
```
45-
Human engineer
46-
|-- signs delegation token
47-
scopes: ["build", "test", "deploy.staging"]
48-
ttl: 4h
4927

50-
Pipeline Orchestrator Agent (receives token)
51-
|-- sub-delegates to Deploy Agent
52-
scopes: ["deploy.staging"] (can only narrow, never widen)
28+
Then in Claude Code:
5329

54-
Deploy Agent executes
55-
|-- signs execution envelope
56-
action: deploy, target: staging
57-
delegation_proof: <full chain>
58-
result: success
59-
60-
Audit log = execution envelope hash
61-
(verifiable without trusting any single system)
30+
```
31+
/delegate
32+
> What should Claude Code be allowed to do?
33+
> A) Full dev - code.edit, test.run, git.commit, git.push
6234
```
6335

64-
The prod environment never trusts the agent directly. It only verifies the math on the token chain.
65-
66-
## CLI
67-
68-
```bash
69-
# Install
70-
cargo install kanoniv-agent-auth --features cli
36+
Every tool call is now verified. If Claude tries to exceed its scope:
7137

72-
# Generate root key (treat like an SSH key)
73-
kanoniv-auth init
38+
```
39+
SCOPE DENIED: requires git.push
7440
75-
# Issue a delegation token
76-
kanoniv-auth delegate --scopes deploy.staging,build --ttl 4h
77-
# outputs: eyJhZ2VudF9kaWQ...
41+
You have: ["code.edit", "test.run"]
42+
You need: ["git.push"]
43+
```
7844

79-
# Agent verifies it has authority
80-
kanoniv-auth verify --scope deploy.staging --token $KANONIV_TOKEN
81-
# VERIFIED
82-
# Agent: did:agent:b15b9019...
83-
# Scopes: ["deploy.staging", "build"]
84-
# Expires: 3h47m remaining
45+
The command never runs. Type `/audit` to see every action the agent took. Type `/status` to check the current delegation.
8546

86-
# Agent tries to touch prod
87-
kanoniv-auth verify --scope deploy.prod --token $KANONIV_TOKEN
88-
# error: DENIED: scope "deploy.prod" not in delegation
89-
#
90-
# You have: [deploy.staging, build]
91-
# You need: ["deploy.prod"]
47+
## Named Agents
9248

93-
# Agent signs an execution envelope (audit trail)
94-
kanoniv-auth sign --action deploy --target staging --token $KANONIV_TOKEN
49+
Agents keep the same identity across sessions:
9550

96-
# Inspect any token or envelope
97-
kanoniv-auth whoami --token $KANONIV_TOKEN
98-
kanoniv-auth audit <envelope>
51+
```bash
52+
kanoniv-auth delegate --name claude-code --scopes code.edit,test.run --ttl 4h
53+
kanoniv-auth delegate --name deploy-bot --scopes deploy.staging --ttl 1h
9954
```
10055

101-
## Python API
56+
Same name = same DID every time. Your audit trail shows a consistent history.
10257

103-
```python
104-
from kanoniv_auth import delegate, verify, sign, init_root, load_root
105-
106-
# Generate root key (once)
107-
root = init_root("~/.kanoniv/root.key")
108-
109-
# Issue delegation
110-
token = delegate(
111-
scopes=["deploy.staging", "build"],
112-
ttl="4h",
113-
)
58+
## Hierarchical Scopes
11459

115-
# Verify (agent-side)
116-
result = verify(action="deploy.staging", token=token)
117-
# {"valid": True, "scopes": [...], "ttl_remaining": 14380.0, ...}
60+
Scopes are dot-separated and hierarchical:
11861

119-
# Sub-delegate (narrowing only)
120-
sub_token = delegate(
121-
scopes=["deploy.staging"],
122-
ttl="1h",
123-
parent_token=token,
124-
)
125-
126-
# Sign execution (audit trail)
127-
envelope = sign(
128-
action="deploy",
129-
token=token,
130-
target="staging",
131-
result="success",
132-
metadata={"commit": "abc123"},
133-
)
62+
```
63+
git.push # any repo, any branch
64+
git.push.agent-auth # agent-auth only
65+
git.push.agent-auth.main # agent-auth main only
13466
```
13567

136-
### Error Handling
68+
`git.push` grants everything below it. `git.push.agent-auth.main` grants only that specific repo and branch.
13769

138-
Every error tells you what happened and how to fix it:
70+
## Git Pre-Push Hook
13971

140-
```python
141-
try:
142-
verify(action="deploy.prod", token=token)
143-
except ScopeViolation as e:
144-
print(e)
145-
# DENIED: scope "deploy.prod" not in delegation
146-
#
147-
# You have: ["deploy.staging"]
148-
# You need: ["deploy.prod"]
149-
#
150-
# To request escalation:
151-
# kanoniv-auth request-scope --scope deploy.prod --from did:agent:abc...
72+
Invisible enforcement at the git level:
73+
74+
```bash
75+
kanoniv-auth install-hook
15276
```
15377

154-
## How It Works
78+
Now `git push` verifies `git.push.{repo}.{branch}` scope before allowing the push. No wrapper needed - just push as normal.
15579

156-
**Ed25519 signatures.** Every delegation is a signed message from the delegator to the delegate. The chain is self-contained - verification requires no network call, no database lookup, no trust in any third party.
80+
## Exec Wrapper
15781

158-
**Scope narrowing.** A delegation can only grant a subset of the parent's scopes. Root grants `[build, test, deploy.staging]`. Sub-delegation can grant `[deploy.staging]` but cannot add `deploy.prod`. This is enforced by the math, not by policy.
82+
Verify, run, sign in one command:
15983

160-
**Token format.** Base64-encoded JSON containing the delegation chain, agent DID, scopes, and expiry. Each link in the chain includes the issuer's public key and signature. Self-contained, verifiable offline.
84+
```bash
85+
kanoniv-auth exec --scope deploy.staging -- ./deploy.sh staging
86+
```
16187

162-
## Competitive Landscape
88+
If the scope check fails, the command never runs. If it succeeds, the result is signed for the audit trail.
16389

164-
| Feature | Vault | OPA | GH OIDC | AWS IAM | kanoniv-auth |
165-
|---------|-------|-----|---------|---------|-------------|
166-
| Secret management | Y | N | N | Y | N |
167-
| Policy engine | N | Y | N | Y | N |
168-
| Agent-specific delegation | N | N | N | N | **Y** |
169-
| Scope narrowing chains | N | N | N | N | **Y** |
170-
| Cryptographic audit trail | N | N | N | N | **Y** |
171-
| Short-lived tokens | Y | N | Y | Y | **Y** |
172-
| Offline verification | Y | N | N | N | **Y** |
173-
| MCP auth | N | N | N | N | **Y** |
90+
## Audit Trail
17491

175-
None of them have "agent delegates to sub-agent with attenuated scope." That's the gap.
92+
Every delegate, verify, sign, and exec is auto-logged:
17693

177-
## Architecture
94+
```bash
95+
kanoniv-auth audit-log --agent claude-code
96+
```
17897

17998
```
180-
Developer (root key)
181-
|
182-
+-- Python CLI (pip install kanoniv-auth)
183-
+-- Rust CLI (cargo install kanoniv-agent-auth --features cli)
184-
+-- GitHub Action (kanoniv/auth-action@v1)
185-
|
186-
delegate / verify / sign
187-
|
188-
+-- OFFLINE: local Ed25519 verify (no network)
189-
+-- SERVICE: kanoniv-auth serve (Axum + SQLite)
190-
+-- CLOUD: api.kanoniv.com (Postgres, revocation webhooks)
99+
19:15:03 claude-code tool:bash git commit -m "feat: ..." ok
100+
19:15:05 claude-code tool:bash cargo test --lib ok
101+
19:15:08 claude-code tool:edit src/lib.rs ok
102+
19:15:12 claude-code tool:bash git push origin main DENIED
191103
```
192104

193-
## Packages
105+
## How It Works
194106

195-
| Package | Registry | Install |
196-
|---------|----------|---------|
197-
| `kanoniv-agent-auth` | crates.io | `cargo install kanoniv-agent-auth --features cli` |
198-
| `kanoniv-auth` | PyPI | `pip install kanoniv-auth` |
199-
| `@kanoniv/agent-auth` | npm | `npm install @kanoniv/agent-auth` |
107+
**Ed25519 signatures.** Every delegation is a signed message. The chain is self-contained - verification requires no network call, no database, no trust in any third party.
200108

201-
## Agent Trust Observatory
109+
**Scope narrowing.** Delegations can only narrow, never widen. Root grants `[build, test, deploy.staging]`. Sub-delegation can grant `[deploy.staging]` but cannot add `deploy.prod`. Enforced by the math, not by policy.
202110

203-
For teams that want a visual dashboard: [trust.kanoniv.com](https://trust.kanoniv.com)
111+
**Offline verification.** Base64-encoded JSON tokens containing the delegation chain, agent DID, scopes, and expiry. Each chain link includes the issuer's public key and signature. Verifiable anywhere.
204112

205-
The Observatory shows agent reputation, delegation chains, provenance audit trails, and cross-engine interop verification. Docker Compose for self-hosting:
113+
## Install
206114

207115
```bash
208-
cd apps/observatory && docker compose up
116+
pip install kanoniv-auth # Python SDK + CLI
117+
kanoniv-auth install-skill # Claude Code skills
118+
kanoniv-auth install-hook # Git pre-push enforcement
209119
```
210120

211-
## Cross-Engine Interop
121+
Or with Rust:
122+
123+
```bash
124+
cargo install kanoniv-agent-auth --features cli # Rust CLI
125+
```
212126

213-
Three independent agent systems have cross-verified each other's delegation chains on this repo:
127+
## Docs
214128

215-
| Verifier / Chain | Kanoniv | APS | AIP |
216-
|---|---|---|---|
217-
| Kanoniv | -- | verified | verified |
218-
| APS | verified | -- | verified |
219-
| AIP | verified | verified | -- |
129+
Full documentation at [auth.kanoniv.com](https://auth.kanoniv.com):
220130

221-
See [spec/CROSS-ENGINE-VERIFICATION.md](spec/CROSS-ENGINE-VERIFICATION.md) and [interop thread](https://github.com/kanoniv/agent-auth/issues/2).
131+
- [Getting Started](https://auth.kanoniv.com/guide/getting-started)
132+
- [Claude Code Skill](https://auth.kanoniv.com/guide/claude-code-skill)
133+
- [CLI Reference](https://auth.kanoniv.com/reference/cli)
134+
- [Python API](https://auth.kanoniv.com/reference/python-api)
135+
- [Token Format Spec](https://auth.kanoniv.com/reference/token-format)
222136

223137
## License
224138

0 commit comments

Comments
 (0)