@rex_koh/subagent-budget-guard 0.1.8 → 0.2.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/.claude-plugin/plugin.json +3 -3
- package/README.md +11 -11
- package/bin/agent-guard.js +69 -0
- package/bin/setup.js +21 -6
- package/lib/guard.js +16 -10
- package/lib/verifier.js +14 -10
- package/package.json +4 -2
- package/skills/doctor/SKILL.md +20 -0
- package/skills/init/SKILL.md +42 -0
- package/skills/report/SKILL.md +6 -4
- package/skills/setup/SKILL.md +7 -5
- package/skills/status/SKILL.md +18 -0
- package/skills/verify/SKILL.md +6 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"displayName": "
|
|
2
|
+
"name": "agent-guard",
|
|
3
|
+
"displayName": "Agent Guard",
|
|
4
4
|
"description": "Hard-deny subagent launches, record verified subagent usage, and enforce a session budget against Claude Code's 5-hour rate-limit percentage.",
|
|
5
|
-
"version": "0.1
|
|
5
|
+
"version": "0.2.1",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ClaudeSubAgentSuppressor"
|
|
8
8
|
},
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agent Guard
|
|
2
2
|
|
|
3
|
-
Claude Code plugin that
|
|
3
|
+
Claude Code plugin that guards subagent usage, records verified subagent tokens, and enforces a session budget against Claude Code's 5-hour usage percentage.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,17 +8,17 @@ Recommended Claude Code install:
|
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
/plugin marketplace add rexkoh425/ClaudeSubAgentSuppressor
|
|
11
|
-
/plugin install
|
|
12
|
-
/
|
|
13
|
-
/
|
|
11
|
+
/plugin install agent-guard@subagent-budget-tools
|
|
12
|
+
/agent-guard:init
|
|
13
|
+
/agent-guard:doctor
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
After `/
|
|
16
|
+
After `/agent-guard:init`, fully exit and reopen Claude Code before verification so the statusLine bridge from `settings.json` is active. Some Claude Code builds do not provide an in-session plugin reload command.
|
|
17
17
|
|
|
18
18
|
Useful after install:
|
|
19
19
|
|
|
20
20
|
```text
|
|
21
|
-
/
|
|
21
|
+
/agent-guard:status
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## NPM Package
|
|
@@ -29,7 +29,7 @@ Claude Code plugin discovery is marketplace-based, so npm is mainly useful as a
|
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
npm install -g @rex_koh/subagent-budget-guard
|
|
32
|
-
|
|
32
|
+
agent-guard doctor --offline
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Maintainer publish command:
|
|
@@ -44,7 +44,7 @@ Offline verification:
|
|
|
44
44
|
node bin/verify.js --offline
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
The plugin is strict before setup: `max_concurrent_subagents` defaults to `0`, so normal subagent launches are blocked unless raised. Run `/
|
|
47
|
+
The plugin is strict before setup: `max_concurrent_subagents` defaults to `0`, so normal subagent launches are blocked unless raised. Run `/agent-guard:init` to choose defaults or custom values:
|
|
48
48
|
|
|
49
49
|
```text
|
|
50
50
|
max_concurrent_subagents=1
|
|
@@ -60,13 +60,13 @@ For existing installs, setup also removes obsolete `max_subagents_per_session` a
|
|
|
60
60
|
The setup skill can also ask for custom values. For direct terminal setup, use:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
|
|
63
|
+
agent-guard init
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
Or pass explicit values:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
|
|
69
|
+
agent-guard init \
|
|
70
70
|
--config max_concurrent_subagents=2 \
|
|
71
71
|
--config max_subagent_tokens_per_session=250000 \
|
|
72
72
|
--config subagent_token_warning_threshold_percent=90 \
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const BIN_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
const COMMANDS = Object.freeze({
|
|
9
|
+
init: {
|
|
10
|
+
script: 'setup.js',
|
|
11
|
+
help: 'initialize settings and the statusLine bridge'
|
|
12
|
+
},
|
|
13
|
+
status: {
|
|
14
|
+
script: 'report.js',
|
|
15
|
+
help: 'show the current guard report'
|
|
16
|
+
},
|
|
17
|
+
doctor: {
|
|
18
|
+
script: 'verify.js',
|
|
19
|
+
help: 'verify the install without spending Claude quota'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function usage() {
|
|
24
|
+
return [
|
|
25
|
+
'Usage: agent-guard <command> [options]',
|
|
26
|
+
'',
|
|
27
|
+
'Commands:',
|
|
28
|
+
...Object.entries(COMMANDS).map(([name, info]) => ` ${name.padEnd(8)} ${info.help}`),
|
|
29
|
+
'',
|
|
30
|
+
'Examples:',
|
|
31
|
+
' agent-guard init',
|
|
32
|
+
' agent-guard init --defaults',
|
|
33
|
+
' agent-guard status',
|
|
34
|
+
' agent-guard doctor --offline'
|
|
35
|
+
].join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function main() {
|
|
39
|
+
const [command, ...args] = process.argv.slice(2);
|
|
40
|
+
|
|
41
|
+
if (!command || command === '--help' || command === '-h') {
|
|
42
|
+
process.stdout.write(`${usage()}\n`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const target = COMMANDS[command];
|
|
47
|
+
if (!target) {
|
|
48
|
+
process.stderr.write(`Unknown command "${command}".\n\n${usage()}\n`);
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const child = spawnSync(process.execPath, [path.join(BIN_DIR, target.script), ...args], {
|
|
54
|
+
stdio: 'inherit',
|
|
55
|
+
env: process.env,
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
windowsHide: true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (child.error) {
|
|
61
|
+
process.stderr.write(`${child.error.message}\n`);
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
process.exitCode = child.status ?? 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
package/bin/setup.js
CHANGED
|
@@ -15,7 +15,7 @@ const CONFIG_KEY_SET = new Set(CONFIG_KEYS);
|
|
|
15
15
|
|
|
16
16
|
function usage() {
|
|
17
17
|
return [
|
|
18
|
-
'Usage:
|
|
18
|
+
'Usage: agent-guard init [--defaults] [--interactive] [--config key=value ...]',
|
|
19
19
|
'',
|
|
20
20
|
'Config keys:',
|
|
21
21
|
...CONFIG_KEYS.map((key) => ` ${key} (default ${SETUP_CONFIG[key]})`)
|
|
@@ -39,6 +39,7 @@ function parseConfigPair(pair) {
|
|
|
39
39
|
function parseArgs(args) {
|
|
40
40
|
const options = {
|
|
41
41
|
interactive: false,
|
|
42
|
+
defaults: false,
|
|
42
43
|
overrides: {}
|
|
43
44
|
};
|
|
44
45
|
|
|
@@ -52,6 +53,10 @@ function parseArgs(args) {
|
|
|
52
53
|
options.interactive = true;
|
|
53
54
|
continue;
|
|
54
55
|
}
|
|
56
|
+
if (arg === '--defaults' || arg === '--yes' || arg === '-y') {
|
|
57
|
+
options.defaults = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
55
60
|
if (arg === '--config') {
|
|
56
61
|
const pair = args[index + 1];
|
|
57
62
|
if (!pair) throw new Error('--config requires key=value');
|
|
@@ -71,7 +76,7 @@ function parseArgs(args) {
|
|
|
71
76
|
return options;
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
async function promptForConfig(defaults) {
|
|
79
|
+
async function promptForConfig(defaults, { askMode = true } = {}) {
|
|
75
80
|
const rl = createInterface({
|
|
76
81
|
input: process.stdin,
|
|
77
82
|
output: process.stderr
|
|
@@ -79,6 +84,13 @@ async function promptForConfig(defaults) {
|
|
|
79
84
|
const answers = {};
|
|
80
85
|
|
|
81
86
|
try {
|
|
87
|
+
if (askMode) {
|
|
88
|
+
const useDefaults = await rl.question('Use recommended defaults? [Y/n]: ');
|
|
89
|
+
if (!useDefaults.trim() || /^y(es)?$/i.test(useDefaults.trim())) {
|
|
90
|
+
return buildSetupConfig(defaults);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
for (const key of CONFIG_KEYS) {
|
|
83
95
|
const answer = await rl.question(`${key} [${defaults[key]}]: `);
|
|
84
96
|
if (answer.trim()) {
|
|
@@ -94,9 +106,12 @@ async function promptForConfig(defaults) {
|
|
|
94
106
|
|
|
95
107
|
async function main() {
|
|
96
108
|
const options = parseArgs(process.argv.slice(2));
|
|
109
|
+
const defaults = buildSetupConfig(options.overrides);
|
|
97
110
|
const setupConfig = options.interactive
|
|
98
|
-
? await promptForConfig(
|
|
99
|
-
:
|
|
111
|
+
? await promptForConfig(defaults, { askMode: false })
|
|
112
|
+
: !options.defaults && Object.keys(options.overrides).length === 0 && process.stdin.isTTY
|
|
113
|
+
? await promptForConfig(defaults)
|
|
114
|
+
: defaults;
|
|
100
115
|
const result = await installStatusLineBridge({
|
|
101
116
|
homeDir: getHomeDir(process.env),
|
|
102
117
|
pluginRoot: getPluginRoot(process.env),
|
|
@@ -106,8 +121,8 @@ async function main() {
|
|
|
106
121
|
|
|
107
122
|
process.stdout.write(
|
|
108
123
|
[
|
|
109
|
-
'
|
|
110
|
-
'
|
|
124
|
+
'Agent Guard statusLine bridge installed.',
|
|
125
|
+
'Plugin config applied:',
|
|
111
126
|
` max_concurrent_subagents=${result.pluginConfigOptions.max_concurrent_subagents}`,
|
|
112
127
|
` max_subagent_tokens_per_session=${result.pluginConfigOptions.max_subagent_tokens_per_session}`,
|
|
113
128
|
` subagent_token_warning_threshold_percent=${result.pluginConfigOptions.subagent_token_warning_threshold_percent}`,
|
package/lib/guard.js
CHANGED
|
@@ -17,8 +17,9 @@ import { fileURLToPath } from 'node:url';
|
|
|
17
17
|
|
|
18
18
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
19
|
|
|
20
|
-
export const PLUGIN_NAME = '
|
|
21
|
-
export const PLUGIN_ID = '
|
|
20
|
+
export const PLUGIN_NAME = 'agent-guard';
|
|
21
|
+
export const PLUGIN_ID = 'agent-guard@subagent-budget-tools';
|
|
22
|
+
export const LEGACY_PLUGIN_ID = 'subagent-budget-guard@subagent-budget-tools';
|
|
22
23
|
|
|
23
24
|
export const DEFAULT_CONFIG = Object.freeze({
|
|
24
25
|
max_concurrent_subagents: 0,
|
|
@@ -87,7 +88,9 @@ function readSettingsOptions(env) {
|
|
|
87
88
|
try {
|
|
88
89
|
const text = readFileSync(settingsPath, 'utf8');
|
|
89
90
|
const settings = JSON.parse(text.replace(/^\uFEFF/, ''));
|
|
90
|
-
const options =
|
|
91
|
+
const options =
|
|
92
|
+
settings?.pluginConfigs?.[PLUGIN_ID]?.options ||
|
|
93
|
+
settings?.pluginConfigs?.[LEGACY_PLUGIN_ID]?.options;
|
|
91
94
|
return isPlainObject(options) ? options : {};
|
|
92
95
|
} catch (error) {
|
|
93
96
|
if (error.code === 'ENOENT') return {};
|
|
@@ -673,10 +676,7 @@ export async function handleUserPromptSubmit(input, env = process.env) {
|
|
|
673
676
|
const sessionId = input?.session_id || 'unknown-session';
|
|
674
677
|
const config = loadConfig(env);
|
|
675
678
|
const state = await readState(sessionId, env);
|
|
676
|
-
const
|
|
677
|
-
includeWarning: false
|
|
678
|
-
});
|
|
679
|
-
const reason = tokenBudgetReason?.reason || fiveHourBudgetDecision(state, config);
|
|
679
|
+
const reason = fiveHourBudgetDecision(state, config);
|
|
680
680
|
|
|
681
681
|
if (!reason) {
|
|
682
682
|
return { exitCode: 0, stdout: null, stderr: '' };
|
|
@@ -760,7 +760,7 @@ export function formatReport(report) {
|
|
|
760
760
|
const { state, config, summary } = report;
|
|
761
761
|
const fiveHour = state.rateLimits.fiveHour;
|
|
762
762
|
const lines = [
|
|
763
|
-
`
|
|
763
|
+
`Agent Guard report for ${report.sessionId}`,
|
|
764
764
|
`Enforcement: ${config.enforcement_enabled ? 'enabled' : 'disabled'}`,
|
|
765
765
|
`Subagents: allowed ${state.subagents.allowed}, denied ${state.subagents.denied}, active ${state.subagents.active}, lifecycle starts ${state.subagents.lifecycleStarted}, lifecycle stops ${state.subagents.lifecycleStopped}`,
|
|
766
766
|
`Verified usage: ${summary.verifiedTokenLabel}, ${state.subagents.totalToolUseCount} subagent tool calls, ${state.subagents.totalDurationMs} ms`,
|
|
@@ -776,7 +776,7 @@ export function formatReport(report) {
|
|
|
776
776
|
);
|
|
777
777
|
} else {
|
|
778
778
|
lines.push(
|
|
779
|
-
'5-hour latest: unavailable. Run /
|
|
779
|
+
'5-hour latest: unavailable. Run /agent-guard:init so the statusLine bridge can capture rate_limits.five_hour.used_percentage.'
|
|
780
780
|
);
|
|
781
781
|
}
|
|
782
782
|
|
|
@@ -822,9 +822,12 @@ function applySetupPluginConfig(
|
|
|
822
822
|
settings.pluginConfigs = {};
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
+
const legacyEntry = isPlainObject(settings.pluginConfigs[LEGACY_PLUGIN_ID])
|
|
826
|
+
? settings.pluginConfigs[LEGACY_PLUGIN_ID]
|
|
827
|
+
: {};
|
|
825
828
|
const currentEntry = isPlainObject(settings.pluginConfigs[pluginId])
|
|
826
829
|
? settings.pluginConfigs[pluginId]
|
|
827
|
-
:
|
|
830
|
+
: legacyEntry;
|
|
828
831
|
const currentOptions = isPlainObject(currentEntry.options)
|
|
829
832
|
? currentEntry.options
|
|
830
833
|
: {};
|
|
@@ -843,6 +846,9 @@ function applySetupPluginConfig(
|
|
|
843
846
|
...currentEntry,
|
|
844
847
|
options: nextOptions
|
|
845
848
|
};
|
|
849
|
+
if (pluginId !== LEGACY_PLUGIN_ID) {
|
|
850
|
+
delete settings.pluginConfigs[LEGACY_PLUGIN_ID];
|
|
851
|
+
}
|
|
846
852
|
|
|
847
853
|
return nextOptions;
|
|
848
854
|
}
|
package/lib/verifier.js
CHANGED
|
@@ -104,14 +104,14 @@ export async function runOfflineVerification({
|
|
|
104
104
|
const marketplace = await readJson(marketplacePath);
|
|
105
105
|
assert(marketplace.name === 'subagent-budget-tools', 'marketplace name mismatch');
|
|
106
106
|
assert(Array.isArray(marketplace.plugins), 'marketplace.plugins must be an array');
|
|
107
|
-
const entry = marketplace.plugins.find((plugin) => plugin.name === '
|
|
108
|
-
assert(entry, '
|
|
107
|
+
const entry = marketplace.plugins.find((plugin) => plugin.name === 'agent-guard');
|
|
108
|
+
assert(entry, 'agent-guard entry missing');
|
|
109
109
|
assert(entry.source?.source === 'npm', 'marketplace source must use npm');
|
|
110
110
|
assert(
|
|
111
111
|
entry.source?.package === '@rex_koh/subagent-budget-guard',
|
|
112
112
|
'marketplace npm package mismatch'
|
|
113
113
|
);
|
|
114
|
-
assert(entry.source?.version === '0.1
|
|
114
|
+
assert(entry.source?.version === '0.2.1', 'marketplace npm version mismatch');
|
|
115
115
|
return marketplacePath;
|
|
116
116
|
});
|
|
117
117
|
} else {
|
|
@@ -129,7 +129,7 @@ export async function runOfflineVerification({
|
|
|
129
129
|
await withCheck(result, 'plugin-manifest-no-install-config', async () => {
|
|
130
130
|
const manifestPath = path.join(root, '.claude-plugin', 'plugin.json');
|
|
131
131
|
const manifest = await readJson(manifestPath);
|
|
132
|
-
assert(manifest.name === '
|
|
132
|
+
assert(manifest.name === 'agent-guard', 'plugin name mismatch');
|
|
133
133
|
assert(
|
|
134
134
|
manifest.hooks === undefined,
|
|
135
135
|
'manifest.hooks must be omitted for default hooks/hooks.json to avoid duplicate loading'
|
|
@@ -168,12 +168,16 @@ export async function runOfflineVerification({
|
|
|
168
168
|
await withCheck(result, 'script-paths', async () => {
|
|
169
169
|
const scripts = [
|
|
170
170
|
'bin/hook.js',
|
|
171
|
+
'bin/agent-guard.js',
|
|
171
172
|
'bin/statusline.js',
|
|
172
173
|
'bin/setup.js',
|
|
173
174
|
'bin/report.js',
|
|
174
175
|
'bin/verify.js',
|
|
175
176
|
'lib/guard.js',
|
|
176
177
|
'lib/verifier.js',
|
|
178
|
+
'skills/init/SKILL.md',
|
|
179
|
+
'skills/status/SKILL.md',
|
|
180
|
+
'skills/doctor/SKILL.md',
|
|
177
181
|
'skills/setup/SKILL.md',
|
|
178
182
|
'skills/report/SKILL.md',
|
|
179
183
|
'skills/verify/SKILL.md'
|
|
@@ -408,12 +412,12 @@ export async function runLiveVerification({
|
|
|
408
412
|
const list = await runCommand('claude', ['plugin', 'list'], { cwd: repoRoot });
|
|
409
413
|
assert(list.code === 0, list.stderr || list.stdout || 'claude plugin list failed');
|
|
410
414
|
assert(
|
|
411
|
-
list.stdout.includes('
|
|
412
|
-
'
|
|
415
|
+
list.stdout.includes('agent-guard'),
|
|
416
|
+
'agent-guard is not installed'
|
|
413
417
|
);
|
|
414
418
|
assert(
|
|
415
|
-
!/
|
|
416
|
-
'
|
|
419
|
+
!/agent-guard@subagent-budget-tools[\s\S]*failed to load/i.test(list.stdout),
|
|
420
|
+
'agent-guard is installed but failed to load'
|
|
417
421
|
);
|
|
418
422
|
return 'claude plugin list returned output';
|
|
419
423
|
});
|
|
@@ -427,7 +431,7 @@ export async function runLiveVerification({
|
|
|
427
431
|
typeof settings.statusLine?.command === 'string' &&
|
|
428
432
|
settings.statusLine.command.includes('statusline.js') &&
|
|
429
433
|
settings.statusLine.command.includes('--data'),
|
|
430
|
-
'statusLine bridge is not installed; run /
|
|
434
|
+
'statusLine bridge is not installed; run /agent-guard:init'
|
|
431
435
|
);
|
|
432
436
|
return settings.statusLine.command;
|
|
433
437
|
});
|
|
@@ -438,7 +442,7 @@ export async function runLiveVerification({
|
|
|
438
442
|
|
|
439
443
|
export function formatVerificationResult(result) {
|
|
440
444
|
const lines = [
|
|
441
|
-
`
|
|
445
|
+
`Agent Guard ${result.mode} verification`,
|
|
442
446
|
result.ok ? 'PASS' : 'FAIL'
|
|
443
447
|
];
|
|
444
448
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rex_koh/subagent-budget-guard",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Claude Code plugin that blocks subagents by default, records verified subagent usage, and enforces 5-hour usage budgets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ClaudeSubAgentSuppressor",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"LICENSE"
|
|
33
33
|
],
|
|
34
34
|
"bin": {
|
|
35
|
+
"agent-guard": "bin/agent-guard.js",
|
|
36
|
+
"ag": "bin/agent-guard.js",
|
|
35
37
|
"subagent-budget-guard-report": "bin/report.js",
|
|
36
38
|
"subagent-budget-guard-setup": "bin/setup.js",
|
|
37
39
|
"subagent-budget-guard-verify": "bin/verify.js"
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"test": "node --test test/*.test.js",
|
|
44
46
|
"verify:offline": "node bin/verify.js --offline",
|
|
45
47
|
"verify:live": "node bin/verify.js --live",
|
|
46
|
-
"prepack": "node --check bin/hook.js && node --check bin/statusline.js && node --check bin/setup.js && node --check bin/report.js && node --check bin/verify.js && node --check lib/guard.js && node --check lib/verifier.js"
|
|
48
|
+
"prepack": "node --check bin/hook.js && node --check bin/statusline.js && node --check bin/setup.js && node --check bin/report.js && node --check bin/verify.js && node --check bin/agent-guard.js && node --check lib/guard.js && node --check lib/verifier.js"
|
|
47
49
|
},
|
|
48
50
|
"engines": {
|
|
49
51
|
"node": ">=20"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Verify Agent Guard installation and offline behavior.
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Doctor Agent Guard
|
|
7
|
+
|
|
8
|
+
For default offline verification, run:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --offline
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
For live local installation checks, run:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --live
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The live verifier does not submit Claude prompts. It checks local plugin shape, `claude plugin validate` when available, plugin listing shape, and statusLine bridge setup.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize Agent Guard settings and the statusLine bridge.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Init Agent Guard
|
|
6
|
+
|
|
7
|
+
Ask the user whether to use recommended defaults or custom values.
|
|
8
|
+
|
|
9
|
+
Recommended defaults:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
max_concurrent_subagents=1
|
|
13
|
+
max_subagent_tokens_per_session=100000
|
|
14
|
+
subagent_token_warning_threshold_percent=95
|
|
15
|
+
session_five_hour_budget_percent=25
|
|
16
|
+
absolute_five_hour_ceiling_percent=95
|
|
17
|
+
enforcement_enabled=true
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If they choose defaults, run:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" init --defaults
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If they choose custom values, ask for each value. Accept a blank answer as the default, then run:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" init \
|
|
30
|
+
--config max_concurrent_subagents=<value> \
|
|
31
|
+
--config max_subagent_tokens_per_session=<value> \
|
|
32
|
+
--config subagent_token_warning_threshold_percent=<value> \
|
|
33
|
+
--config session_five_hour_budget_percent=<value> \
|
|
34
|
+
--config absolute_five_hour_ceiling_percent=<value> \
|
|
35
|
+
--config enforcement_enabled=<true-or-false>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then tell the user to fully exit and reopen Claude Code, interact once so the statusLine bridge receives fresh session JSON, and run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --live
|
|
42
|
+
```
|
package/skills/report/SKILL.md
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Compatibility alias for /agent-guard:status.
|
|
3
3
|
disable-model-invocation: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Report
|
|
6
|
+
# Report Agent Guard Usage
|
|
7
|
+
|
|
8
|
+
Prefer `/agent-guard:status`.
|
|
7
9
|
|
|
8
10
|
Run this command:
|
|
9
11
|
|
|
10
12
|
```bash
|
|
11
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
13
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" status
|
|
12
14
|
```
|
|
13
15
|
|
|
14
16
|
If the user asks for machine-readable output, run:
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
19
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" status --json
|
|
18
20
|
```
|
package/skills/setup/SKILL.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Compatibility alias for /agent-guard:init.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Setup
|
|
5
|
+
# Setup Agent Guard
|
|
6
|
+
|
|
7
|
+
Prefer `/agent-guard:init`.
|
|
6
8
|
|
|
7
9
|
Ask the user whether to use the recommended defaults or customize the values. If they choose defaults, run:
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
12
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" init --defaults
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
If they choose custom values, ask for each value below. The value in parentheses is the default; accept a blank answer as the default.
|
|
@@ -24,7 +26,7 @@ enforcement_enabled=true
|
|
|
24
26
|
Then run setup with the chosen values:
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
29
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" init \
|
|
28
30
|
--config max_concurrent_subagents=<value> \
|
|
29
31
|
--config max_subagent_tokens_per_session=<value> \
|
|
30
32
|
--config subagent_token_warning_threshold_percent=<value> \
|
|
@@ -36,7 +38,7 @@ node "${CLAUDE_PLUGIN_ROOT}/bin/setup.js" \
|
|
|
36
38
|
Then tell the user to fully exit and reopen Claude Code, interact once so the statusLine bridge receives fresh session JSON, and run:
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
41
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --live
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
The live verifier does not submit Claude prompts. It checks local plugin shape, Claude plugin validation when `claude` is on `PATH`, and whether the statusLine bridge is configured.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show the current Agent Guard report.
|
|
3
|
+
disable-model-invocation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Status Agent Guard
|
|
7
|
+
|
|
8
|
+
Run:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" status
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If the user asks for machine-readable output, run:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" status --json
|
|
18
|
+
```
|
package/skills/verify/SKILL.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Compatibility alias for /agent-guard:doctor.
|
|
3
3
|
disable-model-invocation: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Verify
|
|
6
|
+
# Verify Agent Guard
|
|
7
|
+
|
|
8
|
+
Prefer `/agent-guard:doctor`.
|
|
7
9
|
|
|
8
10
|
For default offline verification, run:
|
|
9
11
|
|
|
10
12
|
```bash
|
|
11
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
13
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --offline
|
|
12
14
|
```
|
|
13
15
|
|
|
14
16
|
For live local installation checks, run:
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/
|
|
19
|
+
node "${CLAUDE_PLUGIN_ROOT}/bin/agent-guard.js" doctor --live
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
The live verifier does not submit Claude prompts. It checks local plugin shape, `claude plugin validate` when available, plugin listing shape, and statusLine bridge setup.
|