Skip to content

Commit 3a9a5c9

Browse files
knhn1004claude
andcommitted
refactor: align rule.yaml gate shape with daemon-native policy
The first cut had its own `gate.when` / `gate.on_hit` / `gate.require_strong` shape that the CLI would have to translate before installing. Aligning the schema with what the daemon already understands (`gate.match` / `gate.evaluate`) means an install is a verbatim copy of the gate block into the daemon's policy YAML. `require_strong` is dropped from v1 — once the daemon exposes a strong-signer requirement on individual gates we can re-introduce it. Build-index + site card updated to surface the first evaluator's action instead of the old on_hit field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cbe9d5d commit 3a9a5c9

12 files changed

Lines changed: 742 additions & 34 deletions

docs/adding-a-rule.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Edit `rules/my-new-rule/rule.yaml`. The schema lives at `schema/rule.schema.json
2929
| `description` | 1–3 sentences of why the rule exists. |
3030
| `severity` | `info`, `low`, `medium`, `high`, `critical`. |
3131
| `tags` | Free-form, lowercase. Used by site search. |
32-
| `gate.when` | Match conditions — same shape as the OpenAgentLock policy `when` block. |
33-
| `gate.on_hit` | `allow`, `deny`, `monitor`, or `warn`. |
34-
| `gate.require_strong` | `true` if this rule should refuse weak signers (unattested / software). |
32+
| `gate.match` | Match conditions in OpenAgentLock-native shape: `tool`, `any_command_regex` (array), `any_path_regex`, `any_url_regex`, `path_glob`. |
33+
| `gate.evaluate` | Array of evaluator entries. v1 supports `kind: always` with `action` ∈ {`allow`, `deny`, `monitor`, `warn`}. Richer evaluators (`allowlist`, `typosquat`) are passed through verbatim. |
34+
| `gate.mode` | (optional) Per-gate mode override: `monitor` or `firewall`. |
3535

3636
Then write `README.md` for your rule. Cover:
3737

graphify-out/GRAPH_REPORT.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Graph Report - openagentlock-rules (2026-05-02)
2+
3+
## Corpus Check
4+
- 3 files · ~2,879 words
5+
- Verdict: corpus is large enough that graph structure adds value.
6+
7+
## Summary
8+
- 13 nodes · 19 edges · 3 communities detected
9+
- Extraction: 100% EXTRACTED · 0% INFERRED · 0% AMBIGUOUS
10+
- Token cost: 0 input · 0 output
11+
12+
## Community Hubs (Navigation)
13+
- [[_COMMUNITY_Community 0|Community 0]]
14+
- [[_COMMUNITY_Community 1|Community 1]]
15+
- [[_COMMUNITY_Community 2|Community 2]]
16+
17+
## God Nodes (most connected - your core abstractions)
18+
1. `ruleCard()` - 5 edges
19+
2. `render()` - 5 edges
20+
3. `el()` - 4 edges
21+
4. `main()` - 3 edges
22+
5. `readmeExcerpt()` - 2 edges
23+
6. `buildIndex()` - 2 edges
24+
7. `INSTALL_CMD()` - 2 edges
25+
8. `severityClass()` - 2 edges
26+
9. `activeSeverities()` - 2 edges
27+
28+
## Surprising Connections (you probably didn't know these)
29+
- `ruleCard()` --calls--> `el()` [EXTRACTED]
30+
site/app.js → site/app.js _Bridges community 0 → community 2_
31+
32+
## Communities
33+
34+
### Community 0 - "Community 0"
35+
Cohesion: 0.6
36+
Nodes (4): activeSeverities(), el(), main(), render()
37+
38+
### Community 1 - "Community 1"
39+
Cohesion: 1.0
40+
Nodes (2): buildIndex(), readmeExcerpt()
41+
42+
### Community 2 - "Community 2"
43+
Cohesion: 0.67
44+
Nodes (3): INSTALL_CMD(), ruleCard(), severityClass()
45+
46+
## Knowledge Gaps
47+
- **Thin community `Community 1`** (3 nodes): `buildIndex()`, `readmeExcerpt()`, `build-index.ts`
48+
Too small to be a meaningful cluster - may be noise or needs more connections extracted.
49+
50+
## Suggested Questions
51+
_Questions this graph is uniquely positioned to answer:_
52+
53+
- **Why does `ruleCard()` connect `Community 2` to `Community 0`?**
54+
_High betweenness centrality (0.038) - this node is a cross-community bridge._
55+
- **Why does `render()` connect `Community 0` to `Community 2`?**
56+
_High betweenness centrality (0.028) - this node is a cross-community bridge._
57+
- **Why does `el()` connect `Community 0` to `Community 2`?**
58+
_High betweenness centrality (0.005) - this node is a cross-community bridge._
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"nodes": [{"id": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "label": "build-index.ts", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L1"}, {"id": "build_index_readmeexcerpt", "label": "readmeExcerpt()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L50"}, {"id": "build_index_buildindex", "label": "buildIndex()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L59"}], "edges": [{"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "node_fs", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L8", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "node_path", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L9", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "node_url", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L10", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "yaml", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L11", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "build_index_readmeexcerpt", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L50", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_tools_build_index_ts", "target": "build_index_buildindex", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L59", "weight": 1.0}, {"source": "build_index_buildindex", "target": "build_index_readmeexcerpt", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L87", "weight": 1.0}], "raw_calls": [{"caller_nid": "build_index_readmeexcerpt", "callee": "trim", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L51"}, {"caller_nid": "build_index_readmeexcerpt", "callee": "replace", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L51"}, {"caller_nid": "build_index_readmeexcerpt", "callee": "replace", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L51"}, {"caller_nid": "build_index_readmeexcerpt", "callee": "replace", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L51"}, {"caller_nid": "build_index_readmeexcerpt", "callee": "slice", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L56"}, {"caller_nid": "build_index_buildindex", "callee": "readdirSync", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L61"}, {"caller_nid": "build_index_buildindex", "callee": "join", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L62"}, {"caller_nid": "build_index_buildindex", "callee": "isDirectory", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L63"}, {"caller_nid": "build_index_buildindex", "callee": "statSync", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L63"}, {"caller_nid": "build_index_buildindex", "callee": "join", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L65"}, {"caller_nid": "build_index_buildindex", "callee": "parse", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L66"}, {"caller_nid": "build_index_buildindex", "callee": "readFileSync", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L66"}, {"caller_nid": "build_index_buildindex", "callee": "readFileSync", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L70"}, {"caller_nid": "build_index_buildindex", "callee": "join", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L70"}, {"caller_nid": "build_index_buildindex", "callee": "push", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L75"}, {"caller_nid": "build_index_buildindex", "callee": "trim", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L78"}, {"caller_nid": "build_index_buildindex", "callee": "sort", "source_file": "/Users/oliver/code/openagentlock-rules/tools/build-index.ts", "source_location": "L90"}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"nodes": [{"id": "users_oliver_code_openagentlock_rules_site_app_js", "label": "app.js", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L1"}, {"id": "app_install_cmd", "label": "INSTALL_CMD()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L11"}, {"id": "app_severityclass", "label": "severityClass()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L20"}, {"id": "app_activeseverities", "label": "activeSeverities()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L26"}, {"id": "app_matches", "label": "matches()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L32"}, {"id": "app_el", "label": "el()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L45"}, {"id": "app_rulecard", "label": "ruleCard()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L65"}, {"id": "app_render", "label": "render()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L122"}, {"id": "app_main", "label": "main()", "file_type": "code", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L141"}], "edges": [{"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_install_cmd", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L11", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_severityclass", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L20", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_activeseverities", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L26", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_matches", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L32", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_el", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L45", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_rulecard", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L65", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_render", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L122", "weight": 1.0}, {"source": "users_oliver_code_openagentlock_rules_site_app_js", "target": "app_main", "relation": "contains", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L141", "weight": 1.0}, {"source": "app_rulecard", "target": "app_install_cmd", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L66", "weight": 1.0}, {"source": "app_rulecard", "target": "app_el", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L68", "weight": 1.0}, {"source": "app_rulecard", "target": "app_severityclass", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L70", "weight": 1.0}, {"source": "app_render", "target": "app_activeseverities", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L124", "weight": 1.0}, {"source": "app_render", "target": "app_el", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L131", "weight": 1.0}, {"source": "app_render", "target": "app_rulecard", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L137", "weight": 1.0}, {"source": "app_main", "target": "app_el", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L152", "weight": 1.0}, {"source": "app_main", "target": "app_render", "relation": "calls", "confidence": "EXTRACTED", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L157", "weight": 1.0}], "raw_calls": [{"caller_nid": "app_severityclass", "callee": "includes", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L21"}, {"caller_nid": "app_activeseverities", "callee": "map", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L28"}, {"caller_nid": "app_activeseverities", "callee": "filter", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L28"}, {"caller_nid": "app_matches", "callee": "has", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L33"}, {"caller_nid": "app_matches", "callee": "toLowerCase", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L35"}, {"caller_nid": "app_matches", "callee": "includes", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L37"}, {"caller_nid": "app_matches", "callee": "toLowerCase", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L37"}, {"caller_nid": "app_matches", "callee": "includes", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L38"}, {"caller_nid": "app_matches", "callee": "toLowerCase", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L38"}, {"caller_nid": "app_matches", "callee": "includes", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L39"}, {"caller_nid": "app_matches", "callee": "toLowerCase", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L39"}, {"caller_nid": "app_matches", "callee": "some", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L40"}, {"caller_nid": "app_matches", "callee": "includes", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L41"}, {"caller_nid": "app_matches", "callee": "toLowerCase", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L41"}, {"caller_nid": "app_el", "callee": "createElement", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L46"}, {"caller_nid": "app_el", "callee": "entries", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L48"}, {"caller_nid": "app_el", "callee": "entries", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L51"}, {"caller_nid": "app_el", "callee": "setAttribute", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L52"}, {"caller_nid": "app_el", "callee": "isArray", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L56"}, {"caller_nid": "app_el", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L59"}, {"caller_nid": "app_el", "callee": "createTextNode", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L59"}, {"caller_nid": "app_rulecard", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L74"}, {"caller_nid": "app_rulecard", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L76"}, {"caller_nid": "app_rulecard", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L79"}, {"caller_nid": "app_rulecard", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L87"}, {"caller_nid": "app_rulecard", "callee": "addEventListener", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L99"}, {"caller_nid": "app_render", "callee": "trim", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L123"}, {"caller_nid": "app_render", "callee": "filter", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L125"}, {"caller_nid": "app_render", "callee": "replaceChildren", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L127"}, {"caller_nid": "app_render", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L130"}, {"caller_nid": "app_render", "callee": "appendChild", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L137"}, {"caller_nid": "app_main", "callee": "fetch", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L143"}, {"caller_nid": "app_main", "callee": "json", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L145"}, {"caller_nid": "app_main", "callee": "replaceChildren", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L151"}, {"caller_nid": "app_main", "callee": "addEventListener", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L158"}, {"caller_nid": "app_main", "callee": "addEventListener", "source_file": "/Users/oliver/code/openagentlock-rules/site/app.js", "source_location": "L159"}]}

0 commit comments

Comments
 (0)