agent-certify 0.6.1__tar.gz → 0.7.0__tar.gz

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 (77) hide show
  1. {agent_certify-0.6.1 → agent_certify-0.7.0}/CHANGELOG.md +155 -0
  2. {agent_certify-0.6.1 → agent_certify-0.7.0}/PKG-INFO +179 -37
  3. {agent_certify-0.6.1 → agent_certify-0.7.0}/README.md +177 -35
  4. {agent_certify-0.6.1 → agent_certify-0.7.0}/SECURITY.md +54 -5
  5. {agent_certify-0.6.1 → agent_certify-0.7.0}/pyproject.toml +1 -1
  6. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/__init__.py +1 -1
  7. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/anomaly.py +156 -2
  8. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/baseline.py +113 -6
  9. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/benchmark/__init__.py +27 -7
  10. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/benchmark/injector.py +123 -14
  11. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/benchmark/runner.py +16 -5
  12. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/benchmark/synthetic.py +5 -0
  13. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/blast.py +1 -4
  14. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/certificate.py +24 -3
  15. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/cli.py +97 -14
  16. agent_certify-0.7.0/src/agent_certify/domains.py +262 -0
  17. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/graph.py +46 -1
  18. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/mcp_server.py +2 -1
  19. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/otel.py +6 -3
  20. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/auto.py +4 -2
  21. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/claude_code.py +14 -0
  22. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/crewai.py +16 -0
  23. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/langgraph.py +34 -1
  24. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/mcp_logs.py +5 -1
  25. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/scanner.py +1 -5
  26. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/viz.py +1 -1
  27. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/watcher.py +12 -10
  28. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/PKG-INFO +179 -37
  29. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/SOURCES.txt +3 -0
  30. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_benchmark.py +101 -10
  31. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_cli_v05.py +21 -0
  32. agent_certify-0.7.0/tests/test_domains.py +396 -0
  33. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_hardening.py +23 -0
  34. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_langgraph_parser.py +26 -1
  35. agent_certify-0.7.0/tests/test_volume.py +204 -0
  36. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_watcher.py +35 -0
  37. {agent_certify-0.6.1 → agent_certify-0.7.0}/CONTRIBUTING.md +0 -0
  38. {agent_certify-0.6.1 → agent_certify-0.7.0}/LICENSE +0 -0
  39. {agent_certify-0.6.1 → agent_certify-0.7.0}/MANIFEST.in +0 -0
  40. {agent_certify-0.6.1 → agent_certify-0.7.0}/examples/crewai_run.json +0 -0
  41. {agent_certify-0.6.1 → agent_certify-0.7.0}/examples/langgraph_trace.jsonl +0 -0
  42. {agent_certify-0.6.1 → agent_certify-0.7.0}/examples/scan_claude_session.py +0 -0
  43. {agent_certify-0.6.1 → agent_certify-0.7.0}/scripts/benchmark.py +0 -0
  44. {agent_certify-0.6.1 → agent_certify-0.7.0}/scripts/demo.py +0 -0
  45. {agent_certify-0.6.1 → agent_certify-0.7.0}/setup.cfg +0 -0
  46. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/benchmark/__main__.py +0 -0
  47. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/__init__.py +0 -0
  48. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/base.py +0 -0
  49. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/parser/cursor_trace.py +0 -0
  50. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/paths.py +0 -0
  51. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify/policy.py +0 -0
  52. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/dependency_links.txt +0 -0
  53. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/entry_points.txt +0 -0
  54. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/requires.txt +0 -0
  55. {agent_certify-0.6.1 → agent_certify-0.7.0}/src/agent_certify.egg-info/top_level.txt +0 -0
  56. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/conftest.py +0 -0
  57. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_anomaly.py +0 -0
  58. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_auto_parser.py +0 -0
  59. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_baseline.py +0 -0
  60. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_baseline_overrides.py +0 -0
  61. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_blast.py +0 -0
  62. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_cert_by_type.py +0 -0
  63. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_certificate.py +0 -0
  64. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_cli.py +0 -0
  65. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_cli_v051.py +0 -0
  66. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_crewai_parser.py +0 -0
  67. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_cursor_parser.py +0 -0
  68. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_mcp_parser.py +0 -0
  69. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_mcp_server.py +0 -0
  70. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_otel.py +0 -0
  71. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_parser_claude.py +0 -0
  72. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_perspective.py +0 -0
  73. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_policy.py +0 -0
  74. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_policy_gen.py +0 -0
  75. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_scanner.py +0 -0
  76. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_security_cert.py +0 -0
  77. {agent_certify-0.6.1 → agent_certify-0.7.0}/tests/test_security_mcp.py +0 -0
@@ -6,6 +6,161 @@ project uses [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2026-11-03
10
+
11
+ The v0.6.1 benchmark measured one blind spot and reported it for a release
12
+ rather than hiding it. This closes it, and adds the question a topology cannot
13
+ answer on its own: not which tools ran, but **where they went**.
14
+
15
+ ### Added
16
+ - **Call volume detection** (`call_volume_spike`): a baseline now learns how
17
+ *much* each tool and each link is used — mean, deviation, maximum and the
18
+ number of sessions behind them — and a session is compared against it.
19
+ Warning past 3σ above the mean, critical past 5σ:
20
+ `Tool Bash called 487 times (baseline: 50 ± 1, 391.3σ)`
21
+ - Volume is learned **per link** as well as per tool, keyed by role like
22
+ `known_links`. A link spike replaces the tool-level one when it adds
23
+ something: a tool with several callers is reported as the link that spiked,
24
+ so the message names who is responsible, and an agent calling that tool its
25
+ usual number of times is not flagged because somebody else hammered it. A
26
+ tool with a single caller is reported as the tool, where the link would say
27
+ the same thing
28
+ - **Network destination monitoring**: `agent_certify.domains` reads the hosts a
29
+ session's tool calls pointed at, and two new checks compare them against the
30
+ baseline — `new_domain` (never seen, not accepted) and `rejected_domain`
31
+ (matches a rejected pattern), both critical:
32
+ `Network destination api.qwen.cn in tool call — not in baseline, matches rejected pattern *.cn`
33
+ - `agent-certify baseline accept --domain api.openai.com` and
34
+ `baseline reject --domain "*.cn"`, with `baseline show` listing both and the
35
+ destinations learned. Patterns follow the rules of the other decisions:
36
+ carried across re-learns, last write wins, and reject beats accept
37
+ - `AgentGraph.seen_domains`, `.record_domains()` and `.domain_callers()`;
38
+ `Baseline.known_domains`, `.accepted_domains`, `.rejected_domains`,
39
+ `.tool_call_volume`, `.link_call_volume` and `.volume(scope, key)`;
40
+ `baseline.link_volume()` and `link_key()`
41
+ - `AnomalyInjector.inject_foreign_domain()` and `.forbid_domain()`, so the
42
+ benchmark covers six fault types: **36/36 detected, no false positives**
43
+ - `AnomalyInjector.inject_shell_domain()`, the benchmark's one **blind spot**
44
+ injection: a host named inside a shell command argument
45
+ (`{"command": "curl -sS collector.example.net/x"}`) is read by no check, so
46
+ the expected outcome is silence and the fault is counted apart from the
47
+ detection rate. It is injected through the production extractor, so it starts
48
+ counting as a detection by itself — with no edit to the benchmark — the day
49
+ extraction reads shell commands
50
+ - `agent_certify.benchmark.BLIND_SPOTS`, the list of fault types this release
51
+ ships as uncovered, so a test can pin the claim
52
+ - `tests/test_volume.py` and `tests/test_domains.py` for the two features
53
+
54
+ ### Changed
55
+ - `agent-certify learn` reports the destinations it learned, and the Claude
56
+ Code, CrewAI, LangGraph and MCP-log parsers record them. `scan --format json`
57
+ carries them as `seen_domains`
58
+ - the injection benchmark's `volume_spike` is now an expected *detection*
59
+ rather than an expected miss; the row stays in the table
60
+
61
+ ### Fixed
62
+ - `extract_domains()` capped its result at `MAX_DOMAINS` across a payload but
63
+ not within a single string, so one argument holding hundreds of URLs could
64
+ return all of them
65
+
66
+ #### From the 2026-11-03 audit (33 findings: 3 high, 7 medium, the rest low or info)
67
+
68
+ Three groups mattered, and all three were places where a shipped text claimed
69
+ something the code did not do.
70
+
71
+ - **`SECURITY.md` described the wrong data perimeter** (DOC-001, high). It said
72
+ "prompts, tool inputs and tool outputs are never extracted" while v0.7.0
73
+ reads host names out of both and returns them to MCP clients in anomaly
74
+ messages. A new §6 now states what is read, what is kept, what reaches
75
+ `baseline.json` and what is transmitted — plus a review rule: a feature that
76
+ reads a new category of input data requires a `SECURITY.md` review in the
77
+ same change
78
+ - **The benchmark's blind-spot machinery was unreachable** (INV-001, high).
79
+ Every injection carried an expected category, so `expected_category` was
80
+ never None and the branches that report a blind spot could not run: "no blind
81
+ spots left" had become a property of the registry rather than a measurement.
82
+ `inject_shell_domain` arms it again against a real gap, and the tests now pin
83
+ the capability instead of the result
84
+ - **`benchmark/__init__.py` still said "no check reads call volume"** (INV-002,
85
+ high), contradicting the shipped check and the same file twelve lines above
86
+ - **Three ways a real network destination was silently dropped** (INV-003
87
+ cluster, medium) — the detector was not wrong, it was quiet:
88
+ - `AgentGraph.merge` set the per-node destination list by default instead of
89
+ unioning it, so when two sessions pointed the same tool at different hosts
90
+ the second host survived in `seen_domains` with no caller and the anomaly
91
+ degraded to "no caller recorded". On the path `scan <directory>` takes
92
+ (INV-004)
93
+ - `NOT_HOSTS` treated `zip`, `sh`, `so`, `md`, `py` and `rs` as file
94
+ extensions although all six are delegated TLDs, so `{"host":
95
+ "collector.zip"}` was dropped. Removed, and the rest of the list checked
96
+ against the root zone; a test keeps it that way (INV-005)
97
+ - `MAX_STRING_CHARS` was announced for "any one string" but applied only to
98
+ the URL search, not to the bare-host branch (INV-006)
99
+ - `new_domain` / `rejected_domain` said "HTTP call to X detected"; nothing is
100
+ observed, resolved or necessarily HTTP. Now "Network destination X in tool
101
+ call" (INV-007)
102
+ - LangGraph's `unattributed_errors` was incremented and read nowhere. Now in
103
+ the `graph` node's metadata and logged, like `transitions` (INV-008)
104
+ - `certify --key` with a file that is not a key raised a bare `ValueError`
105
+ traceback; it now exits with a message naming what was expected (COD-011)
106
+ - `watch` silenced three parser loggers by name, missing CrewAI and LangGraph;
107
+ it raises the parent `agent_certify.parser` logger instead, so every parser
108
+ is covered by inheritance (COD-010)
109
+ - Exactly 5.0σ of call volume was reported critical where all three texts
110
+ describing the check say warning; both bounds are now exclusive (DOC-017)
111
+ - A LangGraph node looping back to itself now increments its call count, as the
112
+ README said it did (DOC-005)
113
+ - `baseline accept|reject` did not expand `~` or environment variables in
114
+ `--baseline`, unlike every other path argument (MNT-001)
115
+ - `render_html` divided by zero on a graph whose edges all have weight 0,
116
+ reachable through `AgentGraph.from_dict` (COD-015)
117
+ - Dead code removed: `triangle_counts()`, `baseline.normalise_domain()`,
118
+ `STATUS_CODES["UNSET"]`, `BlastRadiusAnalyzer._get_neighbors()` and
119
+ `Baseline.version`'s stale `"0.2.0"` default; `TypeResult.note` is now
120
+ rendered by the benchmark table rather than carried unused (COD-014)
121
+ - `AgentFIScanner.structure` is declared in `__init__` (COD-016)
122
+ - Documentation corrected: the non-existent 5% skipped-record threshold
123
+ (DOC-002), `BUSL-1.1` in the v0.5.0 roadmap entry (DOC-003), two
124
+ contradictory v0.7.0 roadmap sections and shipped work filed under "Planned"
125
+ (DOC-004), the watcher's format list and module title (DOC-006), the coverage
126
+ badge against the CI floor (DOC-007), a misplaced field comment in `Baseline`
127
+ (DOC-008), what `learn` records (DOC-009), `NETWORK_KEYS` presented as
128
+ exhaustive (DOC-010), `node_classifications` labelled "Critical nodes"
129
+ (DOC-011), the trace id's dependence on a session id (DOC-012), the time
130
+ limit as per-request rather than per-tool-call (DOC-013), `--perspective
131
+ classic` and `watch --duration` missing from the usage lines (DOC-014), the
132
+ format-detection table's final row (DOC-015) and a resolved audit item still
133
+ listed as open (DOC-016)
134
+
135
+ Deferred, and recorded in `ROADMAP.md`: `MNT-003` (splitting `cli.py` and
136
+ `mcp_server.py`), `COD-012` (version-counter invalidation for the edge index,
137
+ documented on the attribute in the meantime) and dynamic coverage badges.
138
+
139
+ ### Notes
140
+ - **Destinations are patterns, never addresses.** Nothing is resolved in either
141
+ direction: a hostname is never turned into an IP, and a pattern is matched
142
+ against the name the agent used, which is the thing the operator decided
143
+ about. An IP literal the agent itself used is kept as the destination it is
144
+ - **A mention is not a destination.** A full URL counts wherever it appears in
145
+ a call's arguments; a bare host counts only as the value of a field that
146
+ names one (`url`, `endpoint`, `host`, `base_url`, …). A domain-looking word
147
+ anywhere else does not, and a tool's *result* is read only when that call's
148
+ own arguments carried a URL. So a `WebFetch` records its redirects while a
149
+ `Read` of a document full of links records nothing — without that
150
+ distinction, every grep for a domain would read as egress and bury the real
151
+ finding. The deliberate consequence: a destination that appears **only** in a
152
+ result of a non-network tool is not reported
153
+ - Per-tool volume counts only the sessions where a tool appeared. Including the
154
+ sessions it was absent from would put its mean near zero and fire every time
155
+ it ran at all
156
+ - Adding `seen_domains` to the graph does not change `graph_hash()`, which
157
+ covers node roles, kinds and links: **certificates issued before v0.7.0 still
158
+ verify**. Baselines and graphs written by 0.6.x load unchanged, with no
159
+ destinations and no volume statistics — until the next `learn`
160
+ - There is no `*` domain pattern. A host that is not in the baseline already
161
+ fires as `new_domain`, so deny-by-default needs no pattern; `*` would also
162
+ outrank every `accept`, since reject wins
163
+
9
164
  ## [0.6.1] - 2026-11-03
10
165
 
11
166
  Two frameworks more, and the first measurement of what the anomaly checks
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-certify
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: Structural verification of multiagent systems
5
- Author-email: David Martin Venti <david.martin@cognitive-engineering.dev>
5
+ Author-email: Cognitive Engineering <david.martin@cognitive-engineering.dev>
6
6
  License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://cognitive-engineering.dev
8
8
  Project-URL: Repository, https://github.com/zeekmartin/agent-certify
@@ -45,8 +45,7 @@ Dynamic: license-file
45
45
  [![Python](https://img.shields.io/pypi/pyversions/agent-certify)](https://pypi.org/project/agent-certify/)
46
46
  [![Downloads](https://img.shields.io/pypi/dm/agent-certify)](https://pypi.org/project/agent-certify/)
47
47
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
48
- [![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen)]()
49
- [![Tests](https://img.shields.io/badge/tests-306%20passed-brightgreen)]()
48
+ [![Coverage](https://img.shields.io/badge/coverage-%E2%89%A590%25-brightgreen)](https://github.com/zeekmartin/agent-certify/actions/workflows/ci.yml)
50
49
 
51
50
  Structural verification of multiagent systems.
52
51
 
@@ -120,8 +119,8 @@ environment variables, are resolved (symlinks, `..`), and must lie inside
120
119
  `~/.claude/projects` or the server's working directory; anything else gets
121
120
  "Path not allowed". Responses and errors never contain a resolved path, file
122
121
  contents or exception text: unexpected failures are logged with their
123
- traceback on stderr and reported with a correlation id. Each request is limited
124
- to 30 seconds.
122
+ traceback on stderr and reported with a correlation id. Each tool call is
123
+ limited to 30 seconds (`initialize`, `ping` and `tools/list` answer directly).
125
124
 
126
125
  ## Quick start
127
126
 
@@ -137,7 +136,7 @@ scanner = AgentFIScanner(graph)
137
136
  result = scanner.scan()
138
137
  print(f"Fragility Index: {result.fi:.4f}")
139
138
  print(f"Bridges: {len(result.bridges)}")
140
- print(f"Critical nodes: {result.node_classifications}")
139
+ print(f"Critical nodes: {result.critical_nodes}")
141
140
 
142
141
  # Blast radius if 'bash' tool is compromised
143
142
  blast = BlastRadiusAnalyzer(graph)
@@ -152,7 +151,7 @@ print(f"System fragmented: {report.system_fragmented}")
152
151
  agent-certify scan ~/.claude/projects/ # every session, plus a merged graph
153
152
  agent-certify scan ~/.claude/projects/<project>/<session>.jsonl
154
153
  agent-certify scan <path> --format json|markdown|html [-o FILE]
155
- agent-certify scan <path> --perspective engineering|risk|compliance|monitoring
154
+ agent-certify scan <path> --perspective engineering|risk|compliance|monitoring|classic
156
155
  agent-certify blast ~/.claude/projects/ --node bash
157
156
 
158
157
  # Baseline and anomaly detection
@@ -166,6 +165,8 @@ agent-certify scan session.jsonl --no-baseline
166
165
  agent-certify baseline accept --tool Bash # stop flagging it
167
166
  agent-certify baseline reject --tool deploy_production # keep flagging it, forever
168
167
  agent-certify baseline accept --link "agent:Build -> deploy_staging" # that agent only
168
+ agent-certify baseline accept --domain api.openai.com # a destination you allow
169
+ agent-certify baseline reject --domain "*.cn" # a destination you never allow
169
170
  agent-certify baseline show # what is on record
170
171
 
171
172
  # Policy: explicit rules, drafted from the baseline, edited by a human
@@ -256,8 +257,11 @@ result.labels("compliance") # same result, other vocabulary
256
257
  error rate (errors / tool calls), plus FI's range and the most sub-agents seen
257
258
  - every tool seen, and the fraction of sessions it appears in
258
259
  - every invocation link seen (`source -> target`)
259
- - the tools and links you have accepted or rejected by hand, which are decisions
260
- rather than statistics and so survive a re-learn (see below)
260
+ - call volume per tool and per link (mean ± std, max, and how many sessions it
261
+ was seen in), which is what `call_volume_spike` compares against
262
+ - every network destination seen (`known_domains`)
263
+ - the tools, links and destinations you have accepted or rejected by hand, which
264
+ are decisions rather than statistics and so survive a re-learn (see below)
261
265
 
262
266
  Sub-agent ids are unique per spawn, so links are recorded by role: a sub-agent
263
267
  counts as `agent:<type>` (`agent:Explore`, `agent:general-purpose`). Standard
@@ -299,6 +303,10 @@ agent-certify baseline reject --tool deploy_production
299
303
  # same tool still fires.
300
304
  agent-certify baseline accept --link "agent:Build -> deploy_staging"
301
305
 
306
+ # A network destination, as a host or a wildcard over its subdomains.
307
+ agent-certify baseline accept --domain api.openai.com
308
+ agent-certify baseline reject --domain "*.cn"
309
+
302
310
  agent-certify baseline show # or --format json
303
311
  ```
304
312
 
@@ -331,6 +339,9 @@ Rejection is deliberately asymmetric: there is no `reject --link`. A link you
331
339
  never want is a policy FORBIDDEN rule, which `scan --policy` enforces with a
332
340
  message you write yourself.
333
341
 
342
+ `--domain` records the same kind of decision about a network destination, with
343
+ the same precedence; see [Network destinations](#network-destinations).
344
+
334
345
  ## Anomaly detection
335
346
 
336
347
  | Check | Flags | Severity |
@@ -341,6 +352,9 @@ message you write yourself.
341
352
  | `error_rate` | error rate more than 2σ *above* the mean | warning; critical past 3σ |
342
353
  | `sub_agents` | more sub-agents than ever seen, or 2σ above the mean | warning; critical when above the max *and* past 3σ |
343
354
  | `node_count` | node count more than 2σ from the mean | info; warning past 3σ |
355
+ | `call_volume_spike` | a tool, or one link to it, called more than 3σ above the mean | warning; critical past 5σ |
356
+ | `new_domain` | a network destination never seen, and not accepted | critical |
357
+ | `rejected_domain` | a destination matching a rejected pattern | critical |
344
358
 
345
359
  - **critical**: something structurally new or a large move toward fragility. Look now.
346
360
  - **warning**: a structural change worth a look; often explained by the task.
@@ -351,6 +365,43 @@ a structural change, not a risk in itself, so it never goes past warning. When
351
365
  the baseline never varied on a metric (std 0), z is undefined: any difference
352
366
  is reported with no z-score at the lower severity.
353
367
 
368
+ ### Call volume
369
+
370
+ `call_volume_spike` answers a question the other checks do not: not *whether* a
371
+ tool was used but *how much*. A tool whose calls jump from 50 to 500 is known,
372
+ reaches no new path and may fail no more often than usual — until v0.7.0 it
373
+ passed every check, and the injection benchmark measured that as a blind spot
374
+ for a release before this closed it.
375
+
376
+ ```
377
+ [CRITICAL] Tool Bash called 487 times (baseline: 50 ± 1, 391.3σ)
378
+ called by claude
379
+ ```
380
+
381
+ Volume is learned per tool **and per link**, and a link spike replaces the
382
+ tool-level one when it adds something:
383
+
384
+ ```
385
+ [CRITICAL] Link agent:Explore -> tool:Bash called 401 times (baseline: 1 ± 0, …)
386
+ agent:Explore alone accounts for this; other callers of tool:Bash
387
+ are compared separately
388
+ ```
389
+
390
+ - a tool with one caller is reported as the tool: the link would say the same thing;
391
+ - a tool with several callers is reported as the link that spiked, so the message
392
+ names who is responsible and the other callers are judged against their own
393
+ links. An agent calling a busy tool its usual number of times is not flagged
394
+ because somebody else hammered it.
395
+ - a tool or link the baseline never saw has no volume to deviate from; that it is
396
+ new is `new_tool` / `new_link`'s business.
397
+ - only increases are reported. A quiet session is not a risk.
398
+
399
+ Per-tool statistics count only the sessions where the tool actually appeared —
400
+ a tool used rarely but heavily would otherwise have a mean near zero and fire
401
+ every time it ran at all. With no deviation to compare against (one session, or
402
+ a count that never varied) twice the mean stands in for 3σ, reported at warning
403
+ with no z-score.
404
+
354
405
  For a directory, `scan` lists the anomaly count of each session in the
355
406
  session table.
356
407
 
@@ -367,17 +418,19 @@ python scripts/benchmark.py --format json # for CI
367
418
 
368
419
  ```
369
420
  Anomaly injection benchmark — 6 clean session(s) against a baseline of 6
370
- ======================================================================================
371
- anomaly type expected trials detected rate severity
372
- --------------------------------------------------------------------------------------
373
- new_tool new_tool/crit 6 6 100.0% 6 critical
374
- error_spike error_rate/warn 6 6 100.0% 6 critical
375
- new_agent new_link/warn 6 6 100.0% 6 warning
376
- forbidden_tool new_tool/crit 6 6 100.0% 6 critical
377
- volume_spike (blind spot) 6 0 0.0% not covered by any check
378
- --------------------------------------------------------------------------------------
379
- detection rate 100.0% (24/24) false negatives 0.0% false positives 0.0% (0/6 clean, 0 anomalies)
380
- blind spots: volume_spike — injected and not reported, because no check covers the fault
421
+ ============================================================================================
422
+ anomaly type expected trials detected rate severity
423
+ --------------------------------------------------------------------------------------------
424
+ new_tool new_tool/crit 6 6 100.0% 6 critical
425
+ error_spike error_rate/warn 6 6 100.0% 6 critical
426
+ new_agent new_link/warn 6 6 100.0% 6 warning
427
+ volume_spike call_volume_spike/warn 6 6 100.0% 6 critical
428
+ forbidden_tool new_tool/crit 6 6 100.0% 6 critical
429
+ foreign_domain new_domain/crit 6 6 100.0% 6 critical
430
+ shell_domain (blind spot) 6 0 0.0% not covered by any check
431
+ --------------------------------------------------------------------------------------------
432
+ detection rate 100.0% (36/36) false negatives 0.0% false positives 0.0% (0/6 clean, 0 anomalies)
433
+ blind spots: shell_domain — injected and expected to go unreported, no check covers the fault
381
434
  ```
382
435
 
383
436
  | Injection | Fault | Expected |
@@ -385,15 +438,29 @@ blind spots: volume_spike — injected and not reported, because no check covers
385
438
  | `inject_new_tool` | a tool the baseline never saw | `new_tool`, critical |
386
439
  | `inject_error_spike` | existing calls failed until the error rate reaches `rate` | `error_rate`, warning or worse |
387
440
  | `inject_new_agent` | an agent of an unseen type calling a known tool | `new_link`, warning or worse |
388
- | `inject_volume_spike` | `factor`× the calls to one tool | **nothing** — a blind spot |
441
+ | `inject_volume_spike` | `factor`× the calls to one tool | `call_volume_spike`, warning or worse |
389
442
  | `inject_forbidden_tool` | a tool the operator rejected | `new_tool`, critical |
390
-
391
- Two things in that table are worth more than the 100%:
392
-
393
- - **The volume spike is a real blind spot.** No check reads call volume — only
394
- whether a tool is known, who called it and how often it failed — so a session
395
- that calls `Bash` 500 times instead of 50 passes clean. It is in the suite so
396
- the gap is measured and visible rather than absent and flattering.
443
+ | `inject_foreign_domain` | a destination the baseline never saw | `new_domain`, critical |
444
+ | `inject_shell_domain` | a host named inside a shell command argument | **nothing** — a measured blind spot |
445
+
446
+ Three things in that table are worth more than the 100%:
447
+
448
+ - **The volume spike was a measured miss for a release.** v0.6.1 reported it as
449
+ a blind spot — no check read call volume — and v0.7.0's `call_volume_spike`
450
+ closed it. The case stays in the suite, which is the point of measuring a gap
451
+ instead of omitting it. The two faults added in v0.7.0 change nothing
452
+ structural at all: the volume spike adds no node, link or failure, and the
453
+ foreign destination leaves the topology byte-for-byte identical.
454
+ - **One blind spot is open, and it is injected rather than asserted.**
455
+ Extraction reads hosts from URLs and from fields that name a destination, so
456
+ `{"command": "curl -sS collector.example.net/x"}` reaches no baseline and
457
+ fires no anomaly. `inject_shell_domain` builds that argument object and hands
458
+ it to the production extractor; whatever comes back lands in the graph, which
459
+ today is nothing. It is counted apart from the detection rate so it neither
460
+ inflates it nor drops out of the report, and it turns into a detection by
461
+ itself — no edit to the benchmark — the day extraction reads shell commands.
462
+ "No blind spots left" is a sentence this project will not print unless the
463
+ measurement says it.
397
464
  - **The baseline is learned from sessions that are not the ones tested.**
398
465
  `learn_holdout()` holds out every other session; a baseline learned from
399
466
  exactly the sessions it is then run against reports nothing on them by
@@ -404,6 +471,78 @@ The headline numbers come from synthetic sessions
404
471
  (`agent_certify.benchmark.synthetic`), which are deliberately regular. Run
405
472
  `--sessions` against your own logs for numbers that describe your system.
406
473
 
474
+ ## Network destinations
475
+
476
+ An agent graph says which tools ran. It does not say **where they went** — and
477
+ if you have to answer where your data is processed, that is the question. An MCP
478
+ server or HTTP tool repointed at another host changes the answer without
479
+ changing the topology at all: same nodes, same links, same counts.
480
+
481
+ So destinations are read from the session's own logs and compared against what
482
+ the baseline learned:
483
+
484
+ ```bash
485
+ agent-certify baseline accept --domain api.openai.com # or "*.openai.com" for subdomains
486
+ agent-certify baseline reject --domain "*.cn"
487
+ agent-certify baseline reject --domain "*.alibaba.com"
488
+ agent-certify baseline show # includes a domains section
489
+ ```
490
+
491
+ ```
492
+ [CRITICAL] Network destination api.qwen.cn in tool call — not in baseline, matches rejected pattern *.cn
493
+ Baseline: rejected pattern *.cn
494
+ reached by tool:WebFetch — rejected, so it stays an anomaly across re-learns
495
+ ```
496
+
497
+ **What counts as a destination.** Logs have no agreed field for this, so
498
+ extraction is broad but not indiscriminate:
499
+
500
+ - **any full URL** in a tool call's arguments — `https://api.openai.com/v1/chat`
501
+ gives `api.openai.com` (`http`, `https`, `ws`, `wss`, `ftp`, `ftps`);
502
+ - **a bare host**, but only as the value of a field that names one: `url`,
503
+ `uri`, `endpoint`, `host`, `hostname`, `domain`, `base_url`, `base_uri`,
504
+ `api_url`, `webhook_url`, `server`, `origin`, `proxy`, their plurals, and a
505
+ dozen more — `NETWORK_KEYS` in `agent_certify/domains.py` is the full list.
506
+ `{"host": "db.internal"}` counts; an IP literal counts too.
507
+
508
+ One exception, to keep configuration noise out of the report: a value whose
509
+ last label is a common file extension (`notes.txt`, `data.csv`, `app.log` —
510
+ `NOT_HOSTS` in the same module) is read as a filename, not a host. Every
511
+ label on that list is absent from the DNS root, so no reachable name is
512
+ dropped by it; `collector.zip`, `x.sh`, `y.so`, `z.md`, `a.py` and `b.rs` are
513
+ destinations and are reported as such.
514
+
515
+ A domain-looking word *anywhere* is not a destination. That distinction is what
516
+ keeps this usable: a session that reads a file mentioning `example.com`, or
517
+ greps for `alibaba.com`, has contacted nobody, and reporting it as egress would
518
+ bury the real finding. For the same reason a tool **result** is read only when
519
+ that call's own arguments carried a URL — so a `WebFetch` records its redirects,
520
+ while a `Read` of a document full of links records nothing.
521
+
522
+ **Patterns, not addresses.** Nothing is resolved, in either direction. A
523
+ pattern is matched against the name the agent used, which is the thing you made
524
+ a decision about:
525
+
526
+ | Pattern | Matches | Does not match |
527
+ |---|---|---|
528
+ | `api.openai.com` | that host only | `other.openai.com` |
529
+ | `*.cn` | `api.unknown.cn`, `deep.sub.unknown.cn` | `cn`, `notcn` |
530
+ | `*.alibaba.com` | `x.alibaba.com`, `x.y.alibaba.com` | `alibaba.com`, `evil-alibaba.com` |
531
+
532
+ A wildcard covers subdomains only: the bare domain is a destination of its own
533
+ and deserves its own decision. `.cn` is accepted as a spelling of `*.cn`, and a
534
+ whole URL is accepted and reduced to its host. There is no `*` pattern — a host
535
+ that is not in the baseline already fires as `new_domain`, so deny-by-default is
536
+ the behaviour you get without asking for it.
537
+
538
+ Decisions follow the same rules as tools: stored in `baseline.json`, carried
539
+ forward by `learn`, last write wins, and **reject beats accept** — a rejected
540
+ pattern fires for a host the baseline learned in every session.
541
+
542
+ Destinations are read by the Claude Code, CrewAI, LangGraph and MCP-log parsers,
543
+ appear in `scan --format json` as `seen_domains`, and are listed by
544
+ `agent-certify learn` and `baseline show`.
545
+
407
546
  ## Example workflow
408
547
 
409
548
  ```bash
@@ -559,7 +698,7 @@ Each anomaly (critical and warning) and each policy violation is printed once,
559
698
  when it first appears, and again only if its severity changes. A session file
560
699
  that does not exist yet is waited for; a half-written last line is skipped
561
700
  until it is complete. It uses plain size polling, no file-system notification
562
- library. `--scans N` stops after N scans; in Python, `SessionWatcher(...)`
701
+ library. `--scans N` stops after N scans and `--duration S` after S seconds — the only way to end a watch on a session that has gone quiet; in Python, `SessionWatcher(...)`
563
702
  takes `on_anomaly` / `on_policy_violation` callbacks and has `stop()`.
564
703
 
565
704
  ## MCP server logs
@@ -597,9 +736,10 @@ violation sets the span status to ERROR.
597
736
  Spans are OTLP/JSON, one `{"resourceSpans": [...]}` object per line: the
598
737
  layout the OpenTelemetry Collector's `file` exporter writes and its
599
738
  `otlpjsonfile` receiver reads, so a collector can forward them to Jaeger,
600
- Grafana Tempo, Datadog and so on. All scans of one session share a trace id,
601
- so a `watch` run appears as one trace with a span per cycle. No OpenTelemetry
602
- SDK is needed.
739
+ Grafana Tempo, Datadog and so on. All scans of one session share a trace id
740
+ derived from the session id, so a `watch` run appears as one trace with a span
741
+ per cycle; a graph with no session id (a Cursor trace that does not carry one)
742
+ gets a random trace id per span instead. No OpenTelemetry SDK is needed.
603
743
 
604
744
  ## Cursor Agent Trace
605
745
 
@@ -685,7 +825,8 @@ stable across runs. A node and the tools it calls stay separate: the `tools`
685
825
  node of a ReAct graph is `agent:tools`, the tool it ran is `tool:search`.
686
826
  `__start__` is the orchestrator, `__end__` is dropped (a sentinel, not a
687
827
  participant), and a node that loops back to itself adds no edge — the repeat
688
- shows in its call count.
828
+ shows in its call count. Consecutive records *about* the same node are one
829
+ activation, not a loop, so they move neither count.
689
830
 
690
831
  Transitions come from `langgraph_triggers`/`triggers`, then from an explicit
691
832
  `next`/`to`, and otherwise from the order the nodes ran in. That last fallback
@@ -710,9 +851,10 @@ Claude Code transcripts and MCP logs are read line by line; a Cursor
710
851
  document), larger ones line by line. Lines that cannot be read — malformed,
711
852
  nested too deeply, or longer than 10 MB — are skipped and counted: the count
712
853
  appears in the scan report, in JSON (`skipped_records`), in OTel spans and in
713
- certificates, with a warning when more than 5% of a session's records were
714
- skipped. A directory scan reads at most 1,000 session files and walks at most
715
- 5 folder levels.
854
+ certificates. A warning is printed as soon as one record is skipped — on a
855
+ verification tool, an incomplete graph is worth saying out loud however small
856
+ the fraction — and the scan report gives that fraction. A directory scan reads
857
+ at most 1,000 session files and walks at most 5 folder levels.
716
858
 
717
859
  A session without sub-agents is a star (one orchestrator, many tools) and has
718
860
  FI = 1 by construction. Structure becomes informative once sub-agents share