@red-codes/agentguard 1.1.2 → 1.1.4

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/README.md CHANGED
@@ -157,6 +157,17 @@ npm install @red-codes/core # Types, actions, utilities
157
157
  npm install @red-codes/events # Canonical event model
158
158
  ```
159
159
 
160
+ ## RTK Token Optimization
161
+
162
+ AgentGuard integrates with [RTK](https://github.com/rtk-ai/rtk) to reduce token consumption by 60-90%. When RTK is installed, shell commands are automatically rewritten for compact output after governance approval.
163
+
164
+ ```bash
165
+ npm install -g @anthropic-ai/rtk # Install RTK (optional)
166
+ agentguard status # Confirms: ⚡ Token optimization active
167
+ ```
168
+
169
+ Works with git, npm, cargo, tsc, docker, kubectl, and more. No configuration needed — AgentGuard detects RTK automatically.
170
+
160
171
  ## Agent Swarm
161
172
 
162
173
  AgentGuard ships with a 26-agent autonomous development swarm:
@@ -170,7 +181,7 @@ Agents handle implementation, code review, CI triage, security audits, planning,
170
181
  ## Links
171
182
 
172
183
  - [GitHub](https://github.com/AgentGuardHQ/agentguard)
173
- - [Documentation](https://agentguardhq.github.io/agent-guard/)
184
+ - [Documentation](https://agentguardhq.github.io/agentguard/)
174
185
  - [Architecture](https://github.com/AgentGuardHQ/agentguard/blob/main/docs/unified-architecture.md)
175
186
  - [Roadmap](https://github.com/AgentGuardHQ/agentguard/blob/main/ROADMAP.md)
176
187
 
package/dist/bin.js CHANGED
@@ -9497,6 +9497,20 @@ function resolveAgentIdentity(sessionId) {
9497
9497
  }
9498
9498
  return `claude-code:${simpleHash(sessionId.trim())}`;
9499
9499
  }
9500
+ function normalizeFilePath(filePath) {
9501
+ if (!filePath)
9502
+ return filePath;
9503
+ const normalized = filePath.replace(/\\/g, "/");
9504
+ const isAbsolute = normalized.startsWith("/") || /^[a-zA-Z]:\//.test(normalized);
9505
+ if (!isAbsolute)
9506
+ return normalized;
9507
+ const cwd = process.cwd().replace(/\\/g, "/");
9508
+ if (normalized.startsWith(cwd + "/")) {
9509
+ return normalized.slice(cwd.length + 1);
9510
+ }
9511
+ const lastSlash = normalized.lastIndexOf("/");
9512
+ return lastSlash >= 0 ? normalized.slice(lastSlash + 1) : normalized;
9513
+ }
9500
9514
  function normalizeClaudeCodeAction(payload, persona) {
9501
9515
  const input = payload.tool_input || {};
9502
9516
  const agent = resolveAgentIdentity(payload.session_id);
@@ -9507,7 +9521,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9507
9521
  case "Write":
9508
9522
  baseAction = {
9509
9523
  tool: "Write",
9510
- file: input.file_path,
9524
+ file: normalizeFilePath(input.file_path),
9511
9525
  content: input.content,
9512
9526
  agent,
9513
9527
  metadata: { hook: payload.hook, sessionId: payload.session_id }
@@ -9516,7 +9530,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9516
9530
  case "Edit":
9517
9531
  baseAction = {
9518
9532
  tool: "Edit",
9519
- file: input.file_path,
9533
+ file: normalizeFilePath(input.file_path),
9520
9534
  content: input.new_string,
9521
9535
  agent,
9522
9536
  metadata: {
@@ -9529,7 +9543,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9529
9543
  case "Read":
9530
9544
  baseAction = {
9531
9545
  tool: "Read",
9532
- file: input.file_path,
9546
+ file: normalizeFilePath(input.file_path),
9533
9547
  agent,
9534
9548
  metadata: { hook: payload.hook, sessionId: payload.session_id }
9535
9549
  };
@@ -27540,7 +27554,8 @@ async function claudeHook(hookType, extraArgs = []) {
27540
27554
  if (isPreToolUse) {
27541
27555
  const sessionId = data.session_id || process.env.CLAUDE_SESSION_ID || void 0;
27542
27556
  const payload = { ...data, session_id: sessionId };
27543
- await handlePreToolUse(payload, extraArgs);
27557
+ const denied = await handlePreToolUse(payload, extraArgs);
27558
+ process.exit(denied ? 2 : 0);
27544
27559
  } else {
27545
27560
  handlePostToolUse(data, extraArgs);
27546
27561
  }
@@ -27607,7 +27622,9 @@ async function handlePreToolUse(payload, cliArgs) {
27607
27622
  if (response) {
27608
27623
  process.stdout.write(response);
27609
27624
  }
27625
+ return true;
27610
27626
  }
27627
+ return false;
27611
27628
  }
27612
27629
  function handlePostToolUse(data, cliArgs = []) {
27613
27630
  if (data.tool_name !== "Bash") return;
@@ -29045,7 +29062,7 @@ async function main() {
29045
29062
  }
29046
29063
  case "--version":
29047
29064
  case "-v": {
29048
- console.log(`agentguard v${"1.1.2"}`);
29065
+ console.log(`agentguard v${"1.1.4"}`);
29049
29066
  break;
29050
29067
  }
29051
29068
  case "help":