mythos-sentinel 0.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.
- package/LICENSE +21 -0
- package/README.md +362 -0
- package/action.yml +43 -0
- package/assets/banner.png +0 -0
- package/bin/mythos-sentinel-mcp.js +7 -0
- package/bin/mythos-sentinel.js +8 -0
- package/docs/ARCHITECTURE.md +55 -0
- package/docs/BASE_X402.md +33 -0
- package/docs/BAZAAR_ADAPTER.md +41 -0
- package/docs/DASHBOARD.md +22 -0
- package/docs/FALLBACK_ROUTING.md +37 -0
- package/docs/MCP.md +70 -0
- package/docs/PASSIVE_SCORING.md +33 -0
- package/docs/ROUTESCORE.md +101 -0
- package/docs/RUNTIME_MCP_PROXY.md +90 -0
- package/docs/SPEND_FIREWALL.md +50 -0
- package/docs/TELEMETRY.md +74 -0
- package/docs/THREAT_MODEL.md +28 -0
- package/docs/X402_RECEIPTS.md +54 -0
- package/examples/base/mythos.policy.json +142 -0
- package/examples/claude_desktop/mcp.json +8 -0
- package/examples/codex/AGENTS.md +31 -0
- package/examples/cursor/mcp.json +8 -0
- package/examples/github/verify.yml +29 -0
- package/examples/routescore/services.yml +19 -0
- package/examples/skill/mythos.skill.json +20 -0
- package/package.json +79 -0
- package/schemas/agent-receipt.schema.json +17 -0
- package/schemas/policy.schema.json +322 -0
- package/schemas/sentinel-report.schema.json +14 -0
- package/schemas/skill.manifest.schema.json +42 -0
- package/src/cli.js +570 -0
- package/src/core/fs.js +88 -0
- package/src/core/path-utils.js +54 -0
- package/src/core/policy.js +326 -0
- package/src/core/receipt.js +52 -0
- package/src/core/routescore.js +576 -0
- package/src/core/snapshot.js +35 -0
- package/src/core/telemetry.js +214 -0
- package/src/core/x402-receipts.js +303 -0
- package/src/index.js +19 -0
- package/src/mcp/proxy.js +493 -0
- package/src/mcp/server.js +226 -0
- package/src/report/format.js +53 -0
- package/src/report/sarif.js +50 -0
- package/src/scanner/rules.js +185 -0
- package/src/scanner/scan.js +118 -0
- package/src/ui/server.js +346 -0
- package/src/ui/static/app.js +210 -0
- package/src/ui/static/index.html +342 -0
- package/src/ui/static/styles.css +904 -0
- package/src/version.js +2 -0
package/docs/MCP.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# MCP usage
|
|
2
|
+
|
|
3
|
+
Mythos Sentinel exposes a local JSON-RPC/MCP-style server so agent clients can ask for policy decisions before using risky capabilities.
|
|
4
|
+
|
|
5
|
+
Run:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mythos-sentinel mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Example config:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"mythos-sentinel": {
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": ["mythos-sentinel", "mcp"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Tools
|
|
25
|
+
|
|
26
|
+
- `sentinel_scan_path` — scan a folder, skill, MCP server, or repository.
|
|
27
|
+
- `sentinel_check_command` — decide whether a shell command is allowed, blocked, or needs approval.
|
|
28
|
+
- `sentinel_check_file` — decide whether a file read/write is allowed.
|
|
29
|
+
- `sentinel_check_network` — decide whether a domain is allowed.
|
|
30
|
+
- `sentinel_check_x402_payment` — decide whether an x402/Base payment is allowed.
|
|
31
|
+
- `sentinel_recommend_x402_service` — recommend a paid API by category and price.
|
|
32
|
+
- `sentinel_route_x402_service` — return a selected service plus fallback route plan.
|
|
33
|
+
- `sentinel_list_service_categories` — list normalized service categories and aliases.
|
|
34
|
+
- `sentinel_parse_x402_receipt` — normalize a receipt-like payload without storing it.
|
|
35
|
+
- `sentinel_score_x402_domain` — return a RouteScore signal for a known payment domain.
|
|
36
|
+
- `sentinel_snapshot` — create a file hash snapshot before agent work.
|
|
37
|
+
|
|
38
|
+
## Runtime proxy mode
|
|
39
|
+
|
|
40
|
+
Direct MCP mode gives agents Sentinel tools to ask for permission. Runtime proxy mode places Sentinel in front of upstream MCP servers so risky calls cannot bypass policy.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
mythos-sentinel proxy --config proxy.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Example proxy config:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"upstreams": [
|
|
51
|
+
{
|
|
52
|
+
"name": "filesystem-tools",
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["some-filesystem-mcp-server"]
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Flow:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
Agent / MCP client -> Mythos Sentinel Proxy -> upstream MCP server
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Sentinel classifies tool calls, checks policy, blocks or gates risky calls, forwards allowed calls, and can record opt-in local telemetry for paid API calls.
|
|
67
|
+
|
|
68
|
+
## Design note
|
|
69
|
+
|
|
70
|
+
This is intentionally local and keyless. Sentinel does not need model API keys or wallet keys. For production, keep MCP clients scoped to the project directory and do not expose the server over a network socket.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Passive Routed-Call Reliability Scoring
|
|
2
|
+
|
|
3
|
+
Passive scoring lets RouteScore improve from actual proxy traffic instead of requiring Mythos to spend money probing every endpoint.
|
|
4
|
+
|
|
5
|
+
## Flow
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
1. Agent calls a tool through Mythos Sentinel Proxy.
|
|
9
|
+
2. Sentinel classifies the call as payment/network/shell/file.
|
|
10
|
+
3. If allowed, Sentinel forwards it to the upstream MCP server.
|
|
11
|
+
4. Sentinel records sanitized local metadata about success/failure and latency.
|
|
12
|
+
5. RouteScore uses the telemetry summary when ranking services.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What improves the score
|
|
16
|
+
|
|
17
|
+
- high success rate
|
|
18
|
+
- valid schema signal
|
|
19
|
+
- low median latency
|
|
20
|
+
- price matching the quote
|
|
21
|
+
- more passive samples
|
|
22
|
+
|
|
23
|
+
## What lowers the score
|
|
24
|
+
|
|
25
|
+
- upstream failures
|
|
26
|
+
- repeated recent failures
|
|
27
|
+
- price mismatch
|
|
28
|
+
- poor schema match
|
|
29
|
+
- high latency
|
|
30
|
+
|
|
31
|
+
## No paid probes required
|
|
32
|
+
|
|
33
|
+
The first implementation does not require Sentinel to pay for APIs. It uses the user or agent's own routed calls. Active paid probes can be added later for important endpoints, but they are not required for the public MVP.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# RouteScore
|
|
2
|
+
|
|
3
|
+
RouteScore is the reliability, recommendation, and fallback-routing layer inside Mythos Sentinel.
|
|
4
|
+
|
|
5
|
+
It is not a fake global oracle. It starts with a seed catalog, can import live/custom services, and becomes more valuable when agents route calls through Sentinel and opt into local telemetry.
|
|
6
|
+
|
|
7
|
+
## Data layers
|
|
8
|
+
|
|
9
|
+
1. **Seed metadata**: category, domain, endpoint, rough price, network, notes.
|
|
10
|
+
2. **Custom local services**: user-provided JSON/YAML catalogs stored in `.mythos/routescore/services.json`.
|
|
11
|
+
3. **Bazaar discovery**: optional sync from CDP Bazaar discovery endpoints.
|
|
12
|
+
4. **Free checks**: domain alive, x402 quote/402 response, price metadata, schema shape, quote latency.
|
|
13
|
+
5. **Passive routed-call telemetry**: local success/failure, latency, schema match, price mismatch from proxied calls.
|
|
14
|
+
6. **x402 receipts**: optional local payment/settlement proof ingestion.
|
|
15
|
+
7. **Fallback routing**: selected route plus ordered fallback candidates.
|
|
16
|
+
8. **Small paid probes**: optional checks for important endpoints later.
|
|
17
|
+
|
|
18
|
+
Sentinel must never collect prompts, full responses, secrets, private keys, wallet balances, or user files as RouteScore telemetry. The current implementation is local-only and disabled by default.
|
|
19
|
+
|
|
20
|
+
## CLI
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
mythos-sentinel routescore list
|
|
24
|
+
mythos-sentinel routescore recommend --category web_search --max-price 0.05
|
|
25
|
+
mythos-sentinel routescore categories
|
|
26
|
+
mythos-sentinel routescore route --category web_search --max-price 0.05
|
|
27
|
+
mythos-sentinel routescore fallback --category web_search --max-price 0.05 --simulate-fail primary
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Import custom services
|
|
31
|
+
|
|
32
|
+
Create `services.yml`:
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
services:
|
|
36
|
+
- name: Custom Search API
|
|
37
|
+
category: web_search
|
|
38
|
+
domain: api.example.com
|
|
39
|
+
endpoint: https://api.example.com/search
|
|
40
|
+
priceUSDC: 0.01
|
|
41
|
+
network: base
|
|
42
|
+
tags:
|
|
43
|
+
- search
|
|
44
|
+
- custom
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Import it:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
mythos-sentinel routescore import services.yml
|
|
51
|
+
mythos-sentinel routescore list
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Custom services are stored locally in `.mythos/routescore/services.json`.
|
|
55
|
+
|
|
56
|
+
## Sync Bazaar discovery
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Browse the paginated x402 catalog and save normalized services locally.
|
|
60
|
+
mythos-sentinel routescore sync-bazaar --limit 100
|
|
61
|
+
|
|
62
|
+
# Search the catalog and save only matching services.
|
|
63
|
+
mythos-sentinel routescore sync-bazaar --query web_search --limit 20
|
|
64
|
+
|
|
65
|
+
# Search without saving.
|
|
66
|
+
mythos-sentinel routescore search-bazaar --query browser --limit 10
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Network calls are only made when you run `sync-bazaar` or `search-bazaar`. Normal RouteScore operations stay local.
|
|
70
|
+
|
|
71
|
+
## MCP tools
|
|
72
|
+
|
|
73
|
+
- `sentinel_recommend_x402_service`
|
|
74
|
+
- `sentinel_route_x402_service`
|
|
75
|
+
- `sentinel_score_x402_domain`
|
|
76
|
+
|
|
77
|
+
## Why routing matters
|
|
78
|
+
|
|
79
|
+
Agents should not need to manually choose between dozens of paid APIs. RouteScore can give an agent a route plan:
|
|
80
|
+
|
|
81
|
+
1. selected service
|
|
82
|
+
2. fallback services
|
|
83
|
+
3. price and score
|
|
84
|
+
4. Sentinel payment-policy decision
|
|
85
|
+
|
|
86
|
+
The route plan is not a guarantee of output quality. It is a pre-spend reliability and policy signal.
|
|
87
|
+
|
|
88
|
+
## Telemetry commands
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
mythos-sentinel telemetry enable
|
|
92
|
+
mythos-sentinel telemetry status
|
|
93
|
+
mythos-sentinel telemetry summary
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
See `docs/TELEMETRY.md` and `docs/PASSIVE_SCORING.md`.
|
|
97
|
+
|
|
98
|
+
## Related docs
|
|
99
|
+
|
|
100
|
+
- `docs/FALLBACK_ROUTING.md`
|
|
101
|
+
- `docs/X402_RECEIPTS.md`
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Runtime MCP Proxy
|
|
2
|
+
|
|
3
|
+
Runtime proxy mode turns Mythos Sentinel from a permission-checking MCP server into an enforcement layer.
|
|
4
|
+
|
|
5
|
+
```txt
|
|
6
|
+
Agent / Claude / Cursor / custom runtime
|
|
7
|
+
-> mythos-sentinel proxy
|
|
8
|
+
-> upstream MCP servers and x402 tools
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The agent still sees normal MCP tools. Sentinel mirrors upstream tools, checks each `tools/call`, and only forwards allowed calls.
|
|
12
|
+
|
|
13
|
+
## Why it matters
|
|
14
|
+
|
|
15
|
+
Direct guardrail mode depends on the agent remembering to ask Sentinel before risky actions. Proxy mode removes that weak point: every proxied tool call is preflighted before the upstream server receives it.
|
|
16
|
+
|
|
17
|
+
Sentinel checks:
|
|
18
|
+
|
|
19
|
+
- x402/Base payment domain, amount, daily spend, unknown-domain trial rules, and RouteScore signal
|
|
20
|
+
- shell commands against blocked and approval-required patterns
|
|
21
|
+
- file reads/writes against deny and allow rules
|
|
22
|
+
- network domains against deny/allow rules
|
|
23
|
+
|
|
24
|
+
`block` and `approval_required` decisions are not forwarded to upstream tools.
|
|
25
|
+
|
|
26
|
+
## Run
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mythos-sentinel proxy
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or with an explicit policy/config:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mythos-sentinel proxy --policy mythos.policy.json
|
|
36
|
+
mythos-sentinel proxy --config proxy.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Claude/Cursor config
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"mythos-sentinel-proxy": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["mythos-sentinel", "proxy"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Configure upstream tools
|
|
53
|
+
|
|
54
|
+
Add upstream MCP servers in `mythos.policy.json`:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpProxy": {
|
|
59
|
+
"enabled": true,
|
|
60
|
+
"mode": "enforce",
|
|
61
|
+
"approvalMode": "return_error",
|
|
62
|
+
"toolNameStrategy": "preserve_unless_collision",
|
|
63
|
+
"upstreams": [
|
|
64
|
+
{
|
|
65
|
+
"id": "search",
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "your-search-mcp-server"]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "browser",
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "your-browser-mcp-server"]
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If two upstreams expose the same tool name, Sentinel automatically prefixes the collision as `upstreamId__toolName`.
|
|
80
|
+
|
|
81
|
+
## Decision behavior
|
|
82
|
+
|
|
83
|
+
- `allow`: forward to upstream and attach `_sentinel` metadata to `structuredContent`
|
|
84
|
+
- `approval_required`: return an MCP tool error before upstream execution
|
|
85
|
+
- `block`: return an MCP tool error before upstream execution
|
|
86
|
+
- `upstream_error`: upstream failed after Sentinel allowed the call
|
|
87
|
+
|
|
88
|
+
## Positioning
|
|
89
|
+
|
|
90
|
+
Use direct MCP mode for lightweight projects where the agent voluntarily asks Sentinel. Use proxy mode for wallet-enabled agents, paid x402 tools, shell/file access, or demos where enforcement must be visible.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Adaptive Spend Firewall
|
|
2
|
+
|
|
3
|
+
Mythos Sentinel protects wallet-enabled agents before they pay x402/Base endpoints.
|
|
4
|
+
|
|
5
|
+
The important design choice is **risk-based freedom**. A strict allowlist is safe but makes agents weak. A fully open wallet is flexible but dangerous. Sentinel uses tiers:
|
|
6
|
+
|
|
7
|
+
| Tier | Default action |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Trusted domain | Allow within budget. |
|
|
10
|
+
| Known service with high RouteScore | Allow within budget. |
|
|
11
|
+
| Unknown domain | Allow tiny trial spend only. |
|
|
12
|
+
| Expensive unknown domain | Require human approval. |
|
|
13
|
+
| Denied / very low RouteScore / over budget | Block. |
|
|
14
|
+
|
|
15
|
+
## Policy fields
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"payments": {
|
|
20
|
+
"x402": {
|
|
21
|
+
"strategy": "balanced",
|
|
22
|
+
"maxPerRequestUSDC": 0.25,
|
|
23
|
+
"maxDailyUSDC": 5,
|
|
24
|
+
"requireApprovalAboveUSDC": 0.25,
|
|
25
|
+
"trustedDomains": ["api.exa.ai"],
|
|
26
|
+
"unknown": {
|
|
27
|
+
"allowTrial": true,
|
|
28
|
+
"maxPerRequestUSDC": 0.02,
|
|
29
|
+
"maxDailyUSDC": 0.25,
|
|
30
|
+
"requireApprovalAboveUSDC": 0.02
|
|
31
|
+
},
|
|
32
|
+
"routeScore": {
|
|
33
|
+
"autoAllowMinScore": 80,
|
|
34
|
+
"requireApprovalBelowScore": 60,
|
|
35
|
+
"blockBelowScore": 35
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Strategies
|
|
43
|
+
|
|
44
|
+
- `balanced`: recommended default. Unknown APIs get tiny trial freedom.
|
|
45
|
+
- `strict`: unknown APIs require approval.
|
|
46
|
+
- `explorer`: for demos and experiments; keep budgets low.
|
|
47
|
+
|
|
48
|
+
## What Sentinel does not do
|
|
49
|
+
|
|
50
|
+
Sentinel does not sign transactions or claw back payments. It must sit before the wallet/payment tool. If an agent bypasses Sentinel and spends directly, Sentinel cannot protect that flow.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Opt-in Local Telemetry
|
|
2
|
+
|
|
3
|
+
Mythos Sentinel can store a small local telemetry log so RouteScore can learn from real routed calls without Mythos paying for every API probe.
|
|
4
|
+
|
|
5
|
+
Telemetry is **disabled by default**.
|
|
6
|
+
|
|
7
|
+
Enable it:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
mythos-sentinel telemetry enable
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Disable it:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mythos-sentinel telemetry disable
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
View status and summary:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
mythos-sentinel telemetry status
|
|
23
|
+
mythos-sentinel telemetry summary
|
|
24
|
+
mythos-sentinel telemetry events --json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## What is stored
|
|
28
|
+
|
|
29
|
+
Events are written locally to:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
.mythos/telemetry/events.jsonl
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Each event contains only sanitized reliability metadata:
|
|
36
|
+
|
|
37
|
+
- endpoint domain
|
|
38
|
+
- service id when matched to the RouteScore catalog
|
|
39
|
+
- decision: allow, block, approval_required, upstream_error
|
|
40
|
+
- amount in USDC when present
|
|
41
|
+
- latency in milliseconds
|
|
42
|
+
- success/failure status
|
|
43
|
+
- schema/price-match flags when known
|
|
44
|
+
- timestamp
|
|
45
|
+
- upstream/tool names
|
|
46
|
+
|
|
47
|
+
## What is never stored
|
|
48
|
+
|
|
49
|
+
Sentinel does not store:
|
|
50
|
+
|
|
51
|
+
- prompts
|
|
52
|
+
- model responses
|
|
53
|
+
- secrets
|
|
54
|
+
- private file contents
|
|
55
|
+
- wallet balances
|
|
56
|
+
- seed phrases or private keys
|
|
57
|
+
|
|
58
|
+
## Passive routed-call reliability scoring
|
|
59
|
+
|
|
60
|
+
When telemetry is enabled and an agent uses `mythos-sentinel proxy`, Sentinel observes whether forwarded paid/network API calls succeeded or failed. Those events feed RouteScore automatically:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
Agent -> Sentinel Proxy -> x402/API tool
|
|
64
|
+
↓
|
|
65
|
+
local telemetry event
|
|
66
|
+
↓
|
|
67
|
+
RouteScore success rate / latency / failure count
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This means users or agents pay for their own API calls, while Sentinel learns from the result locally.
|
|
71
|
+
|
|
72
|
+
## Local-first by design
|
|
73
|
+
|
|
74
|
+
The current implementation is local-only. It does not upload telemetry to a hosted Mythos service. A future shared reliability network should stay explicit opt-in and anonymous.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Threat model
|
|
2
|
+
|
|
3
|
+
Mythos Sentinel focuses on risks created when AI agents can install tools, read files, run commands, call APIs, and spend money.
|
|
4
|
+
|
|
5
|
+
## In scope
|
|
6
|
+
|
|
7
|
+
- malicious or compromised agent skills
|
|
8
|
+
- prompt injection inside skill instructions
|
|
9
|
+
- MCP tool poisoning or unsafe tool descriptions
|
|
10
|
+
- local secret exposure
|
|
11
|
+
- wallet/private-key exposure
|
|
12
|
+
- unauthorized x402/Base spending
|
|
13
|
+
- dangerous shell commands
|
|
14
|
+
- CI permission escalation
|
|
15
|
+
- auditability of AI-generated work
|
|
16
|
+
|
|
17
|
+
## Out of scope for v0.1
|
|
18
|
+
|
|
19
|
+
- full OS sandboxing
|
|
20
|
+
- malware reverse engineering
|
|
21
|
+
- formal verification
|
|
22
|
+
- blockchain transaction settlement
|
|
23
|
+
- real-time network proxying
|
|
24
|
+
- guaranteed prompt-injection prevention
|
|
25
|
+
|
|
26
|
+
## Security stance
|
|
27
|
+
|
|
28
|
+
Sentinel should fail closed in CI for high/critical findings. For local agent development, start in monitor mode and move to enforce mode when the policy is tuned.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# x402 receipt ingestion
|
|
2
|
+
|
|
3
|
+
Sentinel can ingest sanitized x402 payment receipts and settlement responses so agent payment events become auditable without storing prompts, responses, private request bodies, secrets, private keys, or wallet balances.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mythos-sentinel x402-receipt ingest --file receipt.json
|
|
9
|
+
mythos-sentinel x402-receipt summary
|
|
10
|
+
mythos-sentinel x402-receipt list --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Receipts are stored locally at:
|
|
14
|
+
|
|
15
|
+
```txt
|
|
16
|
+
.mythos/x402/receipts.jsonl
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This path is ignored by Git by default.
|
|
20
|
+
|
|
21
|
+
## Accepted input shapes
|
|
22
|
+
|
|
23
|
+
The ingester accepts common receipt/settlement shapes and tries to normalize them:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"endpoint": "https://api.exa.ai/search",
|
|
28
|
+
"amount": "5000",
|
|
29
|
+
"asset": "USDC",
|
|
30
|
+
"network": "eip155:8453",
|
|
31
|
+
"status": "settled",
|
|
32
|
+
"txHash": "0x..."
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It also accepts payment-response header style values through keys like `x-payment-response`, `x-payment`, `x402-receipt`, or `x402-payment-response` when provided as JSON/base64 JSON.
|
|
37
|
+
|
|
38
|
+
## Stored fields
|
|
39
|
+
|
|
40
|
+
Sentinel stores only sanitized payment metadata:
|
|
41
|
+
|
|
42
|
+
- domain and endpoint
|
|
43
|
+
- amount, asset, network
|
|
44
|
+
- payer/payTo when present
|
|
45
|
+
- transaction hash when present
|
|
46
|
+
- settlement status
|
|
47
|
+
- facilitator when present
|
|
48
|
+
- observed timestamp
|
|
49
|
+
|
|
50
|
+
It does not store prompts, responses, private request bodies, secrets, private files, private keys, or wallet balances.
|
|
51
|
+
|
|
52
|
+
## Telemetry integration
|
|
53
|
+
|
|
54
|
+
When opt-in telemetry is enabled, ingested receipts also produce sanitized local telemetry events. Settled receipts count as successful payment observations; failed receipts count as failures.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.8",
|
|
3
|
+
"mode": "enforce",
|
|
4
|
+
"project": "base-agent-project",
|
|
5
|
+
"filesystem": {
|
|
6
|
+
"deny": [
|
|
7
|
+
".env",
|
|
8
|
+
".env.*",
|
|
9
|
+
"**/.env",
|
|
10
|
+
"**/.env.*",
|
|
11
|
+
"**/id_rsa",
|
|
12
|
+
"**/id_ed25519",
|
|
13
|
+
"**/*.pem",
|
|
14
|
+
"**/*.key",
|
|
15
|
+
"**/*.p12",
|
|
16
|
+
"**/*.pfx"
|
|
17
|
+
],
|
|
18
|
+
"allowRead": [
|
|
19
|
+
"**/*"
|
|
20
|
+
],
|
|
21
|
+
"allowWrite": [
|
|
22
|
+
"src/**",
|
|
23
|
+
"test/**",
|
|
24
|
+
"docs/**",
|
|
25
|
+
"examples/**",
|
|
26
|
+
".github/workflows/**",
|
|
27
|
+
"README.md",
|
|
28
|
+
"package.json",
|
|
29
|
+
"package-lock.json",
|
|
30
|
+
"mythos.policy.json"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"commands": {
|
|
34
|
+
"blockedPatterns": [
|
|
35
|
+
"curl\\s+[^|]+\\|\\s*(sudo\\s+)?(bash|sh|zsh)",
|
|
36
|
+
"wget\\s+[^|]+\\|\\s*(sudo\\s+)?(bash|sh|zsh)",
|
|
37
|
+
"Invoke-WebRequest[^|]+\\|\\s*iex",
|
|
38
|
+
"iwr\\s+[^|]+\\s*\\|\\s*iex",
|
|
39
|
+
"rm\\s+-rf\\s+(/|~|\\$HOME|\\.\\./)",
|
|
40
|
+
"chmod\\s+777",
|
|
41
|
+
"base64\\s+-d\\s+[^|]+\\|\\s*(bash|sh|zsh)",
|
|
42
|
+
"powershell\\s+.*-enc(odedcommand)?"
|
|
43
|
+
],
|
|
44
|
+
"approvalPatterns": [
|
|
45
|
+
"npm\\s+install",
|
|
46
|
+
"pnpm\\s+install",
|
|
47
|
+
"yarn\\s+add",
|
|
48
|
+
"pip\\s+install",
|
|
49
|
+
"docker\\s+run",
|
|
50
|
+
"git\\s+push"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"network": {
|
|
54
|
+
"blockUnknown": true,
|
|
55
|
+
"allowedDomains": [
|
|
56
|
+
"api.coinbase.com",
|
|
57
|
+
"api.developer.coinbase.com",
|
|
58
|
+
"api.exa.ai",
|
|
59
|
+
"mainnet.base.org",
|
|
60
|
+
"base.org",
|
|
61
|
+
"api.github.com"
|
|
62
|
+
],
|
|
63
|
+
"deniedDomains": []
|
|
64
|
+
},
|
|
65
|
+
"payments": {
|
|
66
|
+
"x402": {
|
|
67
|
+
"enabled": true,
|
|
68
|
+
"strategy": "balanced",
|
|
69
|
+
"enforceAllowlist": false,
|
|
70
|
+
"maxPerRequestUSDC": 0.25,
|
|
71
|
+
"maxDailyUSDC": 5,
|
|
72
|
+
"requireApprovalAboveUSDC": 0.25,
|
|
73
|
+
"trustedDomains": [
|
|
74
|
+
"api.coinbase.com",
|
|
75
|
+
"api.developer.coinbase.com",
|
|
76
|
+
"api.exa.ai",
|
|
77
|
+
"www.x402.org",
|
|
78
|
+
"x402.org"
|
|
79
|
+
],
|
|
80
|
+
"allowedDomains": [],
|
|
81
|
+
"deniedDomains": [],
|
|
82
|
+
"unknown": {
|
|
83
|
+
"allowTrial": true,
|
|
84
|
+
"maxPerRequestUSDC": 0.02,
|
|
85
|
+
"maxDailyUSDC": 0.25,
|
|
86
|
+
"requireApprovalAboveUSDC": 0.02
|
|
87
|
+
},
|
|
88
|
+
"routeScore": {
|
|
89
|
+
"autoAllowMinScore": 80,
|
|
90
|
+
"requireApprovalBelowScore": 60,
|
|
91
|
+
"blockBelowScore": 35
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"routeScore": {
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"catalogMode": "seed",
|
|
98
|
+
"telemetry": {
|
|
99
|
+
"anonymous": true,
|
|
100
|
+
"collectPrompts": false,
|
|
101
|
+
"collectResponses": false,
|
|
102
|
+
"collectWalletBalances": false,
|
|
103
|
+
"enabled": false,
|
|
104
|
+
"localOnly": true,
|
|
105
|
+
"storePath": ".mythos/telemetry/events.jsonl"
|
|
106
|
+
},
|
|
107
|
+
"seedCategories": [
|
|
108
|
+
"web_search",
|
|
109
|
+
"content_extraction",
|
|
110
|
+
"inference",
|
|
111
|
+
"web3_data",
|
|
112
|
+
"wallet_intel"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"findings": {
|
|
116
|
+
"failOn": [
|
|
117
|
+
"critical",
|
|
118
|
+
"high"
|
|
119
|
+
],
|
|
120
|
+
"warnOn": [
|
|
121
|
+
"medium"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"scanner": {
|
|
125
|
+
"ignore": [
|
|
126
|
+
"mythos.policy.json"
|
|
127
|
+
],
|
|
128
|
+
"useMythosIgnore": true
|
|
129
|
+
},
|
|
130
|
+
"receipts": {
|
|
131
|
+
"require": true,
|
|
132
|
+
"includeFileHashes": true
|
|
133
|
+
},
|
|
134
|
+
"mcpProxy": {
|
|
135
|
+
"enabled": true,
|
|
136
|
+
"mode": "enforce",
|
|
137
|
+
"approvalMode": "return_error",
|
|
138
|
+
"toolNameStrategy": "preserve_unless_collision",
|
|
139
|
+
"exposeSentinelTools": false,
|
|
140
|
+
"upstreams": []
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Mythos Sentinel rules for Codex
|
|
2
|
+
|
|
3
|
+
Codex may edit project files, but all agent work must pass Mythos Sentinel policy checks.
|
|
4
|
+
|
|
5
|
+
## Required workflow
|
|
6
|
+
|
|
7
|
+
1. Before editing, run:
|
|
8
|
+
`mythos-sentinel snapshot . --out .mythos/snapshots/before.json`
|
|
9
|
+
2. Before risky actions, ask Sentinel:
|
|
10
|
+
- command: `mythos-sentinel check-command -- "<command>"`
|
|
11
|
+
- file write: `mythos-sentinel check-file --path <path> --operation write`
|
|
12
|
+
- network: `mythos-sentinel check-network --domain <domain>`
|
|
13
|
+
- RouteScore: `mythos-sentinel routescore recommend --category <category> --max-price <usdc>`
|
|
14
|
+
- x402/Base spend: `mythos-sentinel check-payment --domain <domain> --amount <usdc> [--route-score <score>]`
|
|
15
|
+
3. Make the requested changes.
|
|
16
|
+
4. Run tests/lint for the project.
|
|
17
|
+
5. Run:
|
|
18
|
+
`mythos-sentinel scan . --out .mythos/reports/sentinel-report.json`
|
|
19
|
+
6. Create a receipt:
|
|
20
|
+
`mythos-sentinel receipt --before .mythos/snapshots/before.json --summary "<task>" --agent codex --provider openai --tool codex-cli --out mythos-receipt.json`
|
|
21
|
+
|
|
22
|
+
## Never do this
|
|
23
|
+
|
|
24
|
+
- Never read `.env`, private keys, wallet secrets, SSH keys, browser profiles, or unrelated home-directory files.
|
|
25
|
+
- Never make x402/Base/USDC payments unless Sentinel returns `allow`. Unknown domains may only use tiny trial payments under policy; larger payments require human approval.
|
|
26
|
+
- Never install unknown agent skills or MCP servers without scanning them first.
|
|
27
|
+
- Never run destructive shell commands.
|
|
28
|
+
|
|
29
|
+
## Hard stop
|
|
30
|
+
|
|
31
|
+
Stop and ask for approval if Sentinel returns `block` or `approval_required`.
|