@f4bioo/berry-shield 2026.3.3-1
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/CONTRIBUTING.md +32 -0
- package/LICENSE +201 -0
- package/README.md +251 -0
- package/SECURITY_AUDIT.md +96 -0
- package/docs/wiki/README.md +108 -0
- package/docs/wiki/decision/README.md +48 -0
- package/docs/wiki/decision/modes.md +176 -0
- package/docs/wiki/decision/patterns.md +137 -0
- package/docs/wiki/decision/posture.md +68 -0
- package/docs/wiki/deploy/README.md +51 -0
- package/docs/wiki/deploy/auditing.md +56 -0
- package/docs/wiki/deploy/build.md +92 -0
- package/docs/wiki/deploy/github-ci-cd.md +107 -0
- package/docs/wiki/deploy/installation.md +348 -0
- package/docs/wiki/engine/README.md +53 -0
- package/docs/wiki/engine/match-engine.md +91 -0
- package/docs/wiki/engine/performance.md +114 -0
- package/docs/wiki/engine/redaction.md +120 -0
- package/docs/wiki/layers/README.md +68 -0
- package/docs/wiki/layers/leaf.md +126 -0
- package/docs/wiki/layers/pulp.md +139 -0
- package/docs/wiki/layers/root.md +130 -0
- package/docs/wiki/layers/stem.md +139 -0
- package/docs/wiki/layers/thorn.md +139 -0
- package/docs/wiki/layers/vine.md +154 -0
- package/docs/wiki/operation/README.md +31 -0
- package/docs/wiki/operation/cli/README.md +122 -0
- package/docs/wiki/operation/cli/add.md +157 -0
- package/docs/wiki/operation/cli/help.md +83 -0
- package/docs/wiki/operation/cli/init.md +52 -0
- package/docs/wiki/operation/cli/list.md +78 -0
- package/docs/wiki/operation/cli/mode.md +93 -0
- package/docs/wiki/operation/cli/policy.md +202 -0
- package/docs/wiki/operation/cli/profile.md +98 -0
- package/docs/wiki/operation/cli/remove.md +96 -0
- package/docs/wiki/operation/cli/report.md +66 -0
- package/docs/wiki/operation/cli/reset.md +99 -0
- package/docs/wiki/operation/cli/rules.md +161 -0
- package/docs/wiki/operation/cli/status.md +103 -0
- package/docs/wiki/operation/cli/test.md +119 -0
- package/docs/wiki/operation/cli/toggle.md +90 -0
- package/docs/wiki/operation/cli/vine.md +193 -0
- package/docs/wiki/operation/web/README.md +27 -0
- package/docs/wiki/tutorials/README.md +40 -0
- package/docs/wiki/tutorials/audit-to-enforce-rollout.md +99 -0
- package/docs/wiki/tutorials/build-custom-rules.md +99 -0
- package/docs/wiki/tutorials/choose-profile.md +91 -0
- package/docs/wiki/tutorials/incident-triage-report.md +99 -0
- package/docs/wiki/tutorials/secure-session.md +115 -0
- package/docs/wiki/tutorials/tune-policy.md +111 -0
- package/openclaw.plugin.json +293 -0
- package/package.json +70 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield add` (create custom security rules via wizard or direct arguments)"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need to add custom secret, file, or command rules
|
|
5
|
+
- You want interactive rule creation with guided prompts
|
|
6
|
+
title: "add"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield add`
|
|
10
|
+
|
|
11
|
+
Add one custom Berry Shield rule, either through an interactive wizard or direct command arguments.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Opens the rule wizard when required arguments are missing.
|
|
15
|
+
- Supports direct rule creation with command arguments.
|
|
16
|
+
- Stores the new custom rule in persistent custom rule storage.
|
|
17
|
+
- Prints operation success or failure details.
|
|
18
|
+
|
|
19
|
+
## When to use
|
|
20
|
+
- Adding organization-specific token patterns.
|
|
21
|
+
- Adding custom sensitive file patterns.
|
|
22
|
+
- Adding custom destructive command patterns.
|
|
23
|
+
|
|
24
|
+
## Syntax
|
|
25
|
+
|
|
26
|
+
### Interactive mode
|
|
27
|
+
Use this to create a rule with guided prompts.
|
|
28
|
+
```bash
|
|
29
|
+
openclaw bshield add
|
|
30
|
+
```
|
|
31
|
+
Expected: Wizard prompts for type, pattern details, and confirmation.
|
|
32
|
+
|
|
33
|
+
### Direct mode
|
|
34
|
+
Use this when rule values are already known.
|
|
35
|
+
```bash
|
|
36
|
+
openclaw bshield add [type] --name <name> --pattern <regex>
|
|
37
|
+
```
|
|
38
|
+
Expected: CLI adds the rule directly and prints summary details.
|
|
39
|
+
|
|
40
|
+
## Options
|
|
41
|
+
Positional argument:
|
|
42
|
+
- `[type]`: rule category selected by wizard or passed directly.
|
|
43
|
+
|
|
44
|
+
Flags:
|
|
45
|
+
- `--name <name>`: technical identifier for secret, file, and command rules.
|
|
46
|
+
- `--pattern <regex>`: regex pattern to match.
|
|
47
|
+
- `--placeholder <text>`: redaction placeholder for secret rules.
|
|
48
|
+
- `--force`: overwrite existing custom rule with same identifier.
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
### Add a secret rule directly
|
|
53
|
+
Use this when you already have a validated token regex.
|
|
54
|
+
```bash
|
|
55
|
+
openclaw bshield add secret --name MyToken --pattern "sk_live_[0-9a-z]{24}"
|
|
56
|
+
```
|
|
57
|
+
Result: Rule is persisted as a custom secret rule.
|
|
58
|
+
|
|
59
|
+
### Add a sensitive file rule directly
|
|
60
|
+
Use this for local paths that should be treated as sensitive.
|
|
61
|
+
```bash
|
|
62
|
+
openclaw bshield add file --name team-key --pattern "/srv/app/keys/team.key"
|
|
63
|
+
```
|
|
64
|
+
Result: Rule is persisted as a custom sensitive file rule (`id: file:team-key`).
|
|
65
|
+
|
|
66
|
+
### Add a destructive command rule directly
|
|
67
|
+
Use this for command patterns that should be blocked as destructive.
|
|
68
|
+
```bash
|
|
69
|
+
openclaw bshield add command --name dangerous-rm-tmp --pattern "^(?:rm\\s+-rf\\s+/tmp/smoke)$"
|
|
70
|
+
```
|
|
71
|
+
Result: Rule is persisted as a custom destructive command rule (`id: command:dangerous-rm-tmp`).
|
|
72
|
+
|
|
73
|
+
## Common errors
|
|
74
|
+
|
|
75
|
+
### Invalid regex pattern
|
|
76
|
+
Use this when pattern compilation is invalid.
|
|
77
|
+
```bash
|
|
78
|
+
openclaw bshield add secret --name BrokenRegex --pattern "(abc"
|
|
79
|
+
```
|
|
80
|
+
Expected: CLI fails with pattern validation/storage error.
|
|
81
|
+
|
|
82
|
+
Other frequent failure causes:
|
|
83
|
+
- Missing required values in direct mode.
|
|
84
|
+
- Duplicate rule identifier without `--force`.
|
|
85
|
+
|
|
86
|
+
## Interactive wizard flow
|
|
87
|
+
|
|
88
|
+
### Step 1: Rule type selection
|
|
89
|
+
The first prompt offers:
|
|
90
|
+
- secret
|
|
91
|
+
- file
|
|
92
|
+
- command
|
|
93
|
+
- cancel
|
|
94
|
+
|
|
95
|
+
If cancel is selected, the wizard exits without persisting data.
|
|
96
|
+
|
|
97
|
+
### Step 2: Preset or custom pattern
|
|
98
|
+
After choosing type, the wizard offers:
|
|
99
|
+
- custom pattern
|
|
100
|
+
- built-in presets for the selected type
|
|
101
|
+
- cancel
|
|
102
|
+
|
|
103
|
+
If a preset is selected, name/pattern/placeholder values are prefilled from that preset.
|
|
104
|
+
If custom is selected, manual inputs are requested.
|
|
105
|
+
|
|
106
|
+
### Step 3: Manual inputs (custom path)
|
|
107
|
+
For secret type:
|
|
108
|
+
- name is required
|
|
109
|
+
- pattern is required and regex-validated
|
|
110
|
+
- placeholder is optional
|
|
111
|
+
|
|
112
|
+
For file/command type:
|
|
113
|
+
- name is required
|
|
114
|
+
- pattern is required and regex-validated
|
|
115
|
+
|
|
116
|
+
Invalid regex can block progress until a valid pattern is entered or the user cancels.
|
|
117
|
+
|
|
118
|
+
### Step 4: Broad-pattern confirmation
|
|
119
|
+
If the pattern is detected as broad, the wizard asks explicit confirmation.
|
|
120
|
+
If the user does not confirm, the wizard exits without saving.
|
|
121
|
+
|
|
122
|
+
### Step 5: Preview and validation loop
|
|
123
|
+
Before save, the wizard enters a loop with sample tests:
|
|
124
|
+
- select one preview sample or skip
|
|
125
|
+
- see match/no-match result
|
|
126
|
+
- see expectation status
|
|
127
|
+
|
|
128
|
+
Then choose one action:
|
|
129
|
+
- save rule
|
|
130
|
+
- test another sample
|
|
131
|
+
- edit pattern
|
|
132
|
+
- cancel
|
|
133
|
+
|
|
134
|
+
If edit pattern is selected, the wizard returns to pattern input and repeats validation.
|
|
135
|
+
If cancel is selected, no data is persisted.
|
|
136
|
+
|
|
137
|
+
### Step 6: Save result
|
|
138
|
+
When save is selected, the command persists the rule and prints:
|
|
139
|
+
- rule type
|
|
140
|
+
- rule identifier
|
|
141
|
+
- stored pattern
|
|
142
|
+
- redaction placeholder (when available)
|
|
143
|
+
|
|
144
|
+
### Cancellation behavior
|
|
145
|
+
Cancel exits immediately and no new custom rule is written.
|
|
146
|
+
|
|
147
|
+
## Related commands
|
|
148
|
+
- [index](README.md)
|
|
149
|
+
- [list](list.md)
|
|
150
|
+
- [remove](remove.md)
|
|
151
|
+
- [test](test.md)
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Navigation
|
|
156
|
+
- [Back to CLI Index](README.md)
|
|
157
|
+
- [Back to Wiki Index](../../README.md)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield --help` and command-specific help output"
|
|
3
|
+
read_when:
|
|
4
|
+
- You are discovering available Berry Shield commands
|
|
5
|
+
- You need exact syntax for one command before execution
|
|
6
|
+
title: "help"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield --help`
|
|
10
|
+
|
|
11
|
+
Show Berry Shield command discovery output and command-specific usage details.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Lists available Berry Shield subcommands.
|
|
15
|
+
- Shows command arguments and options.
|
|
16
|
+
- Provides per-command help output for targeted usage checks.
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
- First contact with Berry Shield CLI.
|
|
20
|
+
- Before scripting command execution.
|
|
21
|
+
- During troubleshooting for wrong argument shape.
|
|
22
|
+
|
|
23
|
+
## Syntax
|
|
24
|
+
|
|
25
|
+
### Global help
|
|
26
|
+
Use this form to inspect the full Berry Shield command surface.
|
|
27
|
+
```bash
|
|
28
|
+
openclaw bshield --help
|
|
29
|
+
```
|
|
30
|
+
Expected: CLI prints the list of available bshield subcommands and basic usage.
|
|
31
|
+
|
|
32
|
+
### Command-specific help
|
|
33
|
+
Use this form to inspect usage for one command.
|
|
34
|
+
```bash
|
|
35
|
+
openclaw bshield mode --help
|
|
36
|
+
```
|
|
37
|
+
Expected: CLI prints the mode command syntax and accepted argument values.
|
|
38
|
+
|
|
39
|
+
## Options
|
|
40
|
+
Help output is exposed through standard help flags:
|
|
41
|
+
- `--help`
|
|
42
|
+
- `-h`
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Inspect one command before execution
|
|
47
|
+
Use this when you need argument details for policy operations.
|
|
48
|
+
```bash
|
|
49
|
+
openclaw bshield policy --help
|
|
50
|
+
```
|
|
51
|
+
Result: Output describes policy command usage, including action and argument format.
|
|
52
|
+
|
|
53
|
+
## Common errors
|
|
54
|
+
|
|
55
|
+
### Mistyped command name
|
|
56
|
+
Use this check when help output is missing because the command name is invalid.
|
|
57
|
+
```bash
|
|
58
|
+
openclaw bshiled --help
|
|
59
|
+
```
|
|
60
|
+
Expected: Shell or CLI returns command-not-found or unknown command output.
|
|
61
|
+
|
|
62
|
+
### Running global openclaw help by mistake
|
|
63
|
+
Use this check when output is too broad and not Berry Shield-specific.
|
|
64
|
+
```bash
|
|
65
|
+
openclaw --help
|
|
66
|
+
```
|
|
67
|
+
Expected: OpenClaw global command index is shown instead of bshield-only help.
|
|
68
|
+
|
|
69
|
+
## Related commands
|
|
70
|
+
- [index](README.md)
|
|
71
|
+
- [init](init.md)
|
|
72
|
+
- [status](status.md)
|
|
73
|
+
- [mode](mode.md)
|
|
74
|
+
- [policy](policy.md)
|
|
75
|
+
- [vine](vine.md)
|
|
76
|
+
- [rules](rules.md)
|
|
77
|
+
- [reset](reset.md)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Navigation
|
|
82
|
+
- [Back to CLI Index](README.md)
|
|
83
|
+
- [Back to Wiki Index](../../README.md)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield init` (initialize Berry Shield config with defaults)"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need to bootstrap Berry Shield configuration on a new environment
|
|
5
|
+
- You want to ensure the plugin config entry exists before running other commands
|
|
6
|
+
title: "init"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield init`
|
|
10
|
+
|
|
11
|
+
Initialize Berry Shield configuration if it does not exist.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Checks whether the Berry Shield plugin config entry already exists.
|
|
15
|
+
- If config already exists, it exits successfully without overwriting it.
|
|
16
|
+
- If config is missing, it writes default Berry Shield settings.
|
|
17
|
+
- Sets the Berry Shield enabled flag during initialization.
|
|
18
|
+
|
|
19
|
+
## When to use
|
|
20
|
+
- First setup on a new host/profile.
|
|
21
|
+
- Recovery after config resets where the plugin entry is missing.
|
|
22
|
+
- Preflight before mode/profile/policy commands on unknown environments.
|
|
23
|
+
|
|
24
|
+
## Syntax
|
|
25
|
+
|
|
26
|
+
### Initialize config
|
|
27
|
+
Use this to create Berry Shield config only when it is missing.
|
|
28
|
+
```bash
|
|
29
|
+
openclaw bshield init
|
|
30
|
+
```
|
|
31
|
+
Expected: CLI shows either `Configuration already exists.` or `Initialized successfully with default settings.`
|
|
32
|
+
|
|
33
|
+
## Common errors
|
|
34
|
+
|
|
35
|
+
### Write or config backend failure
|
|
36
|
+
Use this when init reports operation failure during config write/bootstrap.
|
|
37
|
+
Expected: CLI prints `Failed to initialize: ...` and exits with a non-zero code.
|
|
38
|
+
|
|
39
|
+
Possible causes:
|
|
40
|
+
- No write permission to the OpenClaw config/state path.
|
|
41
|
+
- Runtime/config backend unavailable.
|
|
42
|
+
- Invalid or corrupted config store state.
|
|
43
|
+
|
|
44
|
+
## Related commands
|
|
45
|
+
- [index](README.md)
|
|
46
|
+
- [status](status.md)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Navigation
|
|
51
|
+
- [Back to CLI Index](README.md)
|
|
52
|
+
- [Back to Wiki Index](../../README.md)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield rules list` (compact vs detailed inventory)"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need to inspect current baseline/custom rule state
|
|
5
|
+
- You need to confirm ENABLED or DISABLED status after rule changes
|
|
6
|
+
title: "list"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield rules list`
|
|
10
|
+
|
|
11
|
+
Show current Berry Shield rule inventory grouped by source and status.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Loads rule state from plugin config/runtime.
|
|
15
|
+
- Prints two sections: baseline and custom.
|
|
16
|
+
- Shows each rule with status marker:
|
|
17
|
+
- `[ENABLED]`
|
|
18
|
+
- `[DISABLED]`
|
|
19
|
+
- In detailed mode, adds one `pattern:` line per rule.
|
|
20
|
+
|
|
21
|
+
## When to use
|
|
22
|
+
- Before rule updates to capture a state snapshot.
|
|
23
|
+
- After `rules enable` or `rules disable` to confirm final state.
|
|
24
|
+
- During troubleshooting when behavior and expected coverage differ.
|
|
25
|
+
|
|
26
|
+
## Syntax
|
|
27
|
+
|
|
28
|
+
### Compact inventory
|
|
29
|
+
Use this for quick state checks.
|
|
30
|
+
```bash
|
|
31
|
+
openclaw bshield rules list
|
|
32
|
+
```
|
|
33
|
+
Expected:
|
|
34
|
+
- Prints Baseline and Custom sections.
|
|
35
|
+
- Shows IDs and status markers only.
|
|
36
|
+
|
|
37
|
+
### Detailed inventory
|
|
38
|
+
Use this when you need exact regex visibility.
|
|
39
|
+
```bash
|
|
40
|
+
openclaw bshield rules list --detailed
|
|
41
|
+
```
|
|
42
|
+
Expected:
|
|
43
|
+
- Prints the same sections and statuses as compact mode.
|
|
44
|
+
- Adds one `pattern:` line for each rule entry.
|
|
45
|
+
|
|
46
|
+
### Short flag for detailed mode
|
|
47
|
+
Use this as a compact equivalent of `--detailed`.
|
|
48
|
+
```bash
|
|
49
|
+
openclaw bshield rules list -d
|
|
50
|
+
```
|
|
51
|
+
Expected: same output as `--detailed`.
|
|
52
|
+
|
|
53
|
+
## Options
|
|
54
|
+
- `--detailed` (`-d`): include raw pattern details for all listed entries.
|
|
55
|
+
|
|
56
|
+
## Common errors
|
|
57
|
+
|
|
58
|
+
### Runtime/config read failure
|
|
59
|
+
Use this when command output is incomplete or the command fails unexpectedly while reading runtime/config state.
|
|
60
|
+
Expected: CLI reports a runtime/config read error.
|
|
61
|
+
|
|
62
|
+
Possible causes:
|
|
63
|
+
- Invalid custom rule structure in config.
|
|
64
|
+
- Read failure on plugin config storage path.
|
|
65
|
+
|
|
66
|
+
## Related commands
|
|
67
|
+
- [index](README.md)
|
|
68
|
+
- [rules](rules.md)
|
|
69
|
+
- [add](add.md)
|
|
70
|
+
- [remove](remove.md)
|
|
71
|
+
- [reset](reset.md)
|
|
72
|
+
- [test](test.md)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Navigation
|
|
77
|
+
- [Back to CLI Index](README.md)
|
|
78
|
+
- [Back to Wiki Index](../../README.md)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield mode` (set runtime mode to audit or enforce)"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need to switch Berry Shield runtime behavior
|
|
5
|
+
- You are validating security behavior in audit vs enforce mode
|
|
6
|
+
title: "mode"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield mode`
|
|
10
|
+
|
|
11
|
+
Set Berry Shield runtime mode to `audit` or `enforce`.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Writes mode value to plugin config (`audit` or `enforce`).
|
|
15
|
+
- Validates mode argument before write.
|
|
16
|
+
- Returns explicit success or failure output.
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
- Before security behavior tests.
|
|
20
|
+
- Before production hardening checks.
|
|
21
|
+
- When switching between observation and active protection workflows.
|
|
22
|
+
|
|
23
|
+
## Audit semantics (important)
|
|
24
|
+
- `audit` is shadow mode for block/redact decisions.
|
|
25
|
+
- `audit` does not mean "Berry Shield fully disabled" or "100 percent passive".
|
|
26
|
+
- Policy behavior (profile/adaptive injection strategy) still applies.
|
|
27
|
+
- Message hygiene safeguards can still apply (for example leaked policy-block stripping).
|
|
28
|
+
|
|
29
|
+
## Syntax
|
|
30
|
+
|
|
31
|
+
### Set enforce mode
|
|
32
|
+
Use this form for active blocking behavior.
|
|
33
|
+
```bash
|
|
34
|
+
openclaw bshield mode enforce
|
|
35
|
+
```
|
|
36
|
+
Expected: CLI confirms switch to ENFORCE mode.
|
|
37
|
+
|
|
38
|
+
### Set audit mode
|
|
39
|
+
Use this form for shadow behavior and monitoring.
|
|
40
|
+
```bash
|
|
41
|
+
openclaw bshield mode audit
|
|
42
|
+
```
|
|
43
|
+
Expected: CLI confirms switch to AUDIT mode.
|
|
44
|
+
|
|
45
|
+
## Options
|
|
46
|
+
Positional argument:
|
|
47
|
+
- `<mode>`: accepted values are `audit` or `enforce`.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Switch to enforce before deny tests
|
|
52
|
+
Use the enforce syntax command shown above before testing blocked behavior for sensitive operations.
|
|
53
|
+
Result: Subsequent checks run under enforce behavior.
|
|
54
|
+
|
|
55
|
+
### Switch to audit for observation
|
|
56
|
+
Use the audit syntax command shown above when validating policy behavior without active block expectations.
|
|
57
|
+
Result: Mode is set to audit for shadow-mode style verification.
|
|
58
|
+
|
|
59
|
+
### Confirm mode after switch
|
|
60
|
+
Use this to verify runtime state after mode change.
|
|
61
|
+
```bash
|
|
62
|
+
openclaw bshield status
|
|
63
|
+
```
|
|
64
|
+
Result: Status output mode field matches the last configured mode.
|
|
65
|
+
|
|
66
|
+
## Common errors
|
|
67
|
+
|
|
68
|
+
### Invalid mode value
|
|
69
|
+
Use this to see expected validation behavior for wrong input.
|
|
70
|
+
```bash
|
|
71
|
+
openclaw bshield mode monitor
|
|
72
|
+
```
|
|
73
|
+
Expected: CLI fails with message: invalid mode, use `audit` or `enforce`.
|
|
74
|
+
|
|
75
|
+
### Mode write failure
|
|
76
|
+
Use this when a valid mode command (for example `openclaw bshield mode enforce`) reports operation failure.
|
|
77
|
+
Expected: On failure, CLI prints operation failure and returns non-zero exit code.
|
|
78
|
+
|
|
79
|
+
Possible causes:
|
|
80
|
+
- Config write permission issue.
|
|
81
|
+
- Config backend/runtime error.
|
|
82
|
+
|
|
83
|
+
## Related commands
|
|
84
|
+
- [index](README.md)
|
|
85
|
+
- [status](status.md)
|
|
86
|
+
- [profile](profile.md)
|
|
87
|
+
- [policy](policy.md)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Navigation
|
|
92
|
+
- [Back to CLI Index](README.md)
|
|
93
|
+
- [Back to Wiki Index](../../README.md)
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "CLI reference for `openclaw bshield policy` (interactive wizard, deterministic get/set)"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need to edit policy settings beyond profile-only changes
|
|
5
|
+
- You want deterministic policy operations for scripts and agents
|
|
6
|
+
title: "policy"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `openclaw bshield policy`
|
|
10
|
+
|
|
11
|
+
Manage Berry Shield policy values through an interactive wizard or deterministic get/set actions.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
- Launches interactive policy wizard when called without action.
|
|
15
|
+
- Supports deterministic set for one allowed path.
|
|
16
|
+
- Supports deterministic get for full policy or one allowed path.
|
|
17
|
+
- Validates value types and ranges before write.
|
|
18
|
+
|
|
19
|
+
## When to use
|
|
20
|
+
- Interactive manual tuning of adaptive/retention values.
|
|
21
|
+
- Reproducible policy changes in scripts or CI.
|
|
22
|
+
- Debugging current policy values quickly.
|
|
23
|
+
|
|
24
|
+
## Syntax
|
|
25
|
+
|
|
26
|
+
### Launch policy wizard
|
|
27
|
+
Use this to edit policy values interactively with prompts and confirmation.
|
|
28
|
+
```bash
|
|
29
|
+
openclaw bshield policy
|
|
30
|
+
```
|
|
31
|
+
Expected: Wizard prompts for profile, adaptive values, and retention values.
|
|
32
|
+
|
|
33
|
+
### Set one policy value
|
|
34
|
+
Use this to update one specific policy path deterministically.
|
|
35
|
+
```bash
|
|
36
|
+
openclaw bshield policy set <path> <value>
|
|
37
|
+
```
|
|
38
|
+
Expected: CLI confirms the updated path and value.
|
|
39
|
+
|
|
40
|
+
### Read policy values
|
|
41
|
+
Use this to print policy values, either full tree or one path.
|
|
42
|
+
```bash
|
|
43
|
+
openclaw bshield policy get [path]
|
|
44
|
+
```
|
|
45
|
+
Expected: CLI prints policy rows for all values or for the selected path.
|
|
46
|
+
|
|
47
|
+
## Options
|
|
48
|
+
Supported actions:
|
|
49
|
+
- set
|
|
50
|
+
- get
|
|
51
|
+
|
|
52
|
+
Supported paths:
|
|
53
|
+
- `profile`
|
|
54
|
+
- `adaptive.staleAfterMinutes`
|
|
55
|
+
- `adaptive.escalationTurns`
|
|
56
|
+
- `adaptive.heartbeatEveryTurns`
|
|
57
|
+
- `adaptive.allowGlobalEscalation`
|
|
58
|
+
- `retention.maxEntries`
|
|
59
|
+
- `retention.ttlSeconds`
|
|
60
|
+
|
|
61
|
+
Validation rules:
|
|
62
|
+
- `profile`: `strict | balanced | minimal`
|
|
63
|
+
- `adaptive.allowGlobalEscalation`: `true | false`
|
|
64
|
+
- `adaptive.staleAfterMinutes`: integer `>= 1`
|
|
65
|
+
- `adaptive.escalationTurns`: integer `>= 1`
|
|
66
|
+
- `adaptive.heartbeatEveryTurns`: integer `>= 0`
|
|
67
|
+
- `retention.maxEntries`: integer `>= 1`
|
|
68
|
+
- `retention.ttlSeconds`: integer `>= 1`
|
|
69
|
+
|
|
70
|
+
## Tuning guide
|
|
71
|
+
|
|
72
|
+
| Field | Change when | Typical direction | Tradeoff |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `profile` | You need broader or quieter policy injection behavior | `balanced -> strict` for stronger visibility, `balanced -> minimal` for lower noise | Stronger profiles improve policy visibility but can increase prompt overhead |
|
|
75
|
+
| `adaptive.allowGlobalEscalation` | Session identity is missing and escalation still must apply | `false -> true` only in controlled single-session contexts | Useful fallback for missing identity, risky in multi-session environments |
|
|
76
|
+
| `adaptive.escalationTurns` | Full-policy escalation feels too short or too long after denied events | Increase for stronger persistence, decrease for faster recovery | Higher values improve guard persistence but increase context load |
|
|
77
|
+
| `adaptive.heartbeatEveryTurns` | Long sessions need periodic reminder, or reminder noise is too high | Increase interval to reduce reminders, set `0` to disable | More heartbeat improves continuity, less heartbeat reduces token usage |
|
|
78
|
+
| `adaptive.staleAfterMinutes` | Session is considered stale too early or too late | Increase for longer continuity, decrease for faster stale detection | Longer windows reduce resets, shorter windows refresh posture sooner |
|
|
79
|
+
| `retention.maxEntries` | High session churn or memory pressure appears | Decrease on constrained hosts, increase for larger workloads | Lower values save memory, higher values keep more adaptive history |
|
|
80
|
+
| `retention.ttlSeconds` | Adaptive state expires too fast or remains too long | Increase for longer correlation, decrease for faster cleanup | Longer TTL helps continuity, shorter TTL reduces stale state risk |
|
|
81
|
+
|
|
82
|
+
## Examples
|
|
83
|
+
|
|
84
|
+
### Open wizard for manual policy updates
|
|
85
|
+
Use the wizard command shown in Syntax when tuning multiple policy values in one flow.
|
|
86
|
+
Result: Interactive flow collects values and asks for save confirmation.
|
|
87
|
+
|
|
88
|
+
### Set profile through deterministic path
|
|
89
|
+
Use this in scripts where profile change must be explicit.
|
|
90
|
+
```bash
|
|
91
|
+
openclaw bshield policy set profile balanced
|
|
92
|
+
```
|
|
93
|
+
Result: CLI confirms `profile = balanced`.
|
|
94
|
+
|
|
95
|
+
### Set stale timeout deterministically
|
|
96
|
+
Use this for adaptive timeout tuning.
|
|
97
|
+
```bash
|
|
98
|
+
openclaw bshield policy set adaptive.staleAfterMinutes 30
|
|
99
|
+
```
|
|
100
|
+
Result: CLI confirms `adaptive.staleAfterMinutes = 30`.
|
|
101
|
+
|
|
102
|
+
### Read full policy
|
|
103
|
+
Use this to inspect all policy values in one command.
|
|
104
|
+
```bash
|
|
105
|
+
openclaw bshield policy get
|
|
106
|
+
```
|
|
107
|
+
Result: CLI prints profile, adaptive values, and retention values.
|
|
108
|
+
|
|
109
|
+
### Read one policy path
|
|
110
|
+
Use this for focused checks in scripts.
|
|
111
|
+
```bash
|
|
112
|
+
openclaw bshield policy get adaptive.allowGlobalEscalation
|
|
113
|
+
```
|
|
114
|
+
Result: CLI prints only the selected path value.
|
|
115
|
+
|
|
116
|
+
## Common errors
|
|
117
|
+
|
|
118
|
+
### Invalid action
|
|
119
|
+
Use this to verify action validation behavior.
|
|
120
|
+
```bash
|
|
121
|
+
openclaw bshield policy edit profile strict
|
|
122
|
+
```
|
|
123
|
+
Expected: CLI fails with message indicating valid actions are get and set.
|
|
124
|
+
|
|
125
|
+
### Invalid path
|
|
126
|
+
Use this to verify path allowlist enforcement.
|
|
127
|
+
```bash
|
|
128
|
+
openclaw bshield policy set adaptive.unknownField 1
|
|
129
|
+
```
|
|
130
|
+
Expected: CLI fails with usage/error message listing allowed paths.
|
|
131
|
+
|
|
132
|
+
### Invalid typed value
|
|
133
|
+
Use this to verify numeric/boolean/profile validation.
|
|
134
|
+
```bash
|
|
135
|
+
openclaw bshield policy set adaptive.staleAfterMinutes zero
|
|
136
|
+
```
|
|
137
|
+
Expected: CLI fails with an integer validation message.
|
|
138
|
+
|
|
139
|
+
## Interactive wizard flow
|
|
140
|
+
|
|
141
|
+
### Wizard entry
|
|
142
|
+
Use the wizard command shown in Syntax to edit policy values interactively in one guided flow.
|
|
143
|
+
Expected: Wizard prompts for profile, adaptive fields, and retention fields.
|
|
144
|
+
|
|
145
|
+
### Step 1: Profile selection
|
|
146
|
+
The first prompt offers:
|
|
147
|
+
- strict
|
|
148
|
+
- balanced
|
|
149
|
+
- minimal
|
|
150
|
+
- cancel
|
|
151
|
+
|
|
152
|
+
If cancel is selected, the wizard exits without changes.
|
|
153
|
+
|
|
154
|
+
### Step 2: Adaptive numeric inputs
|
|
155
|
+
The wizard requests these values:
|
|
156
|
+
- adaptive.staleAfterMinutes (integer >= 1)
|
|
157
|
+
- adaptive.escalationTurns (integer >= 1)
|
|
158
|
+
- adaptive.heartbeatEveryTurns (integer >= 0)
|
|
159
|
+
|
|
160
|
+
Each field is validated inline and rejects invalid values until corrected or canceled.
|
|
161
|
+
|
|
162
|
+
### Step 3: Adaptive boolean input
|
|
163
|
+
The wizard asks for:
|
|
164
|
+
- adaptive.allowGlobalEscalation (confirm prompt)
|
|
165
|
+
|
|
166
|
+
Cancel exits without writing policy changes.
|
|
167
|
+
|
|
168
|
+
### Step 4: Retention numeric inputs
|
|
169
|
+
The wizard requests:
|
|
170
|
+
- retention.maxEntries (integer >= 1)
|
|
171
|
+
- retention.ttlSeconds (integer >= 1)
|
|
172
|
+
|
|
173
|
+
Each field has inline numeric validation.
|
|
174
|
+
|
|
175
|
+
### Step 5: Review screen
|
|
176
|
+
Before persistence, the wizard prints a policy review table with:
|
|
177
|
+
- selected profile
|
|
178
|
+
- adaptive values
|
|
179
|
+
- retention values
|
|
180
|
+
|
|
181
|
+
### Step 6: Save confirmation
|
|
182
|
+
Final prompt: save policy changes.
|
|
183
|
+
|
|
184
|
+
If confirmed, each policy path is written to config.
|
|
185
|
+
If canceled or declined, no policy values are written.
|
|
186
|
+
|
|
187
|
+
### Wizard cancellation behavior
|
|
188
|
+
Use this to validate safe exit before persistence while running the interactive wizard command.
|
|
189
|
+
Result: Any cancel branch exits the flow and preserves previous policy values.
|
|
190
|
+
|
|
191
|
+
## Related commands
|
|
192
|
+
- [index](README.md)
|
|
193
|
+
- [profile](profile.md)
|
|
194
|
+
- [status](status.md)
|
|
195
|
+
- [mode](mode.md)
|
|
196
|
+
- [vine](vine.md)
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Navigation
|
|
201
|
+
- [Back to CLI Index](README.md)
|
|
202
|
+
- [Back to Wiki Index](../../README.md)
|