@hiro-c/agent-gate 1.2.0 → 1.3.0

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
@@ -90,6 +90,8 @@ Full options: see [docs/config.md](docs/config.md) (TODO) or `AgentGatePluginCon
90
90
  | `AGENT_GATE_USE_SDK` | `1` prefers the Anthropic agent SDK over API/CLI (no API key needed; works best with daemon mode) |
91
91
  | `AGENT_GATE_ON_ERROR` | `block` to fail-closed when a rule or AI client throws (default `allow`) |
92
92
  | `AGENT_GATE_DAEMON` | `1` routes through the daemon if it is running |
93
+ | `AGENT_GATE_CACHE_TTL_SEC` | Daemon decision cache TTL in seconds (default `60`) |
94
+ | `AGENT_GATE_CACHE_SIZE` | Daemon decision cache max entries (default `256`) |
93
95
 
94
96
  ## Supported AI tools
95
97
 
@@ -0,0 +1,36 @@
1
+ import { ValidationResult } from '../contracts/types/ValidationResult';
2
+ export interface CacheKey {
3
+ adapter: string;
4
+ toolName: string;
5
+ toolInput: Record<string, unknown>;
6
+ cwd: string;
7
+ }
8
+ export interface DecisionCacheOptions {
9
+ /** Time to live in seconds. Entries past this age miss. */
10
+ ttlSec: number;
11
+ /** Max entries before LRU eviction kicks in. */
12
+ maxEntries: number;
13
+ /** Clock injection for testing. Defaults to Date.now. */
14
+ now?: () => number;
15
+ }
16
+ /**
17
+ * In-process LRU + TTL cache of agent-gate decisions.
18
+ *
19
+ * Most useful inside `agent-gate daemon` where the cache persists
20
+ * across hook invocations. Same {adapter, toolName, toolInput, cwd}
21
+ * within the TTL skips the entire pipeline (deterministic engine,
22
+ * collector, AI call) and returns the prior verdict.
23
+ */
24
+ export declare class DecisionCache {
25
+ private readonly ttlMs;
26
+ private readonly maxEntries;
27
+ private readonly now;
28
+ private readonly store;
29
+ constructor(opts: DecisionCacheOptions);
30
+ private hash;
31
+ get(key: CacheKey): ValidationResult | null;
32
+ set(key: CacheKey, value: ValidationResult): void;
33
+ get size(): number;
34
+ clear(): void;
35
+ }
36
+ //# sourceMappingURL=DecisionCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DecisionCache.d.ts","sourceRoot":"","sources":["../../src/cache/DecisionCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAEtE,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAA;IAClB,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAOD;;;;;;;GAOG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;gBAE1C,IAAI,EAAE,oBAAoB;IAMtC,OAAO,CAAC,IAAI;IASZ,GAAG,CAAC,GAAG,EAAE,QAAQ,GAAG,gBAAgB,GAAG,IAAI;IAc3C,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAWjD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecisionCache = void 0;
4
+ /**
5
+ * In-process LRU + TTL cache of agent-gate decisions.
6
+ *
7
+ * Most useful inside `agent-gate daemon` where the cache persists
8
+ * across hook invocations. Same {adapter, toolName, toolInput, cwd}
9
+ * within the TTL skips the entire pipeline (deterministic engine,
10
+ * collector, AI call) and returns the prior verdict.
11
+ */
12
+ class DecisionCache {
13
+ ttlMs;
14
+ maxEntries;
15
+ now;
16
+ store = new Map();
17
+ constructor(opts) {
18
+ this.ttlMs = opts.ttlSec * 1000;
19
+ this.maxEntries = opts.maxEntries;
20
+ this.now = opts.now ?? Date.now;
21
+ }
22
+ hash(key) {
23
+ return JSON.stringify({
24
+ a: key.adapter,
25
+ t: key.toolName,
26
+ c: key.cwd,
27
+ i: canonicalize(key.toolInput),
28
+ });
29
+ }
30
+ get(key) {
31
+ const k = this.hash(key);
32
+ const entry = this.store.get(k);
33
+ if (!entry)
34
+ return null;
35
+ if (entry.expiresAt <= this.now()) {
36
+ this.store.delete(k);
37
+ return null;
38
+ }
39
+ // Refresh LRU order: re-insert.
40
+ this.store.delete(k);
41
+ this.store.set(k, entry);
42
+ return entry.value;
43
+ }
44
+ set(key, value) {
45
+ const k = this.hash(key);
46
+ this.store.delete(k);
47
+ this.store.set(k, { value, expiresAt: this.now() + this.ttlMs });
48
+ while (this.store.size > this.maxEntries) {
49
+ const oldest = this.store.keys().next().value;
50
+ if (oldest === undefined)
51
+ break;
52
+ this.store.delete(oldest);
53
+ }
54
+ }
55
+ get size() {
56
+ return this.store.size;
57
+ }
58
+ clear() {
59
+ this.store.clear();
60
+ }
61
+ }
62
+ exports.DecisionCache = DecisionCache;
63
+ /**
64
+ * Stable string representation of an arbitrary JSON-like input.
65
+ * Sorts object keys so key-order does not affect cache hits.
66
+ */
67
+ function canonicalize(value) {
68
+ if (Array.isArray(value)) {
69
+ return value.map(canonicalize);
70
+ }
71
+ if (value !== null && typeof value === 'object') {
72
+ const obj = value;
73
+ const sorted = {};
74
+ for (const k of Object.keys(obj).sort()) {
75
+ sorted[k] = canonicalize(obj[k]);
76
+ }
77
+ return sorted;
78
+ }
79
+ return value;
80
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-gate.d.ts","sourceRoot":"","sources":["../../src/cli/agent-gate.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAYtE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAsC7C,wBAAsB,GAAG,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAsGD,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAgCpD"}
1
+ {"version":3,"file":"agent-gate.d.ts","sourceRoot":"","sources":["../../src/cli/agent-gate.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAYtE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAuC7C,wBAAsB,GAAG,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAuHD,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAgCpD"}
@@ -15,6 +15,7 @@ const formatFindings_1 = require("../doctor/formatFindings");
15
15
  const server_1 = require("../daemon/server");
16
16
  const client_1 = require("../daemon/client");
17
17
  const protocol_1 = require("../daemon/protocol");
18
+ const DecisionCache_1 = require("../cache/DecisionCache");
18
19
  const HELP_TEXT = `agent-gate — runtime enforcer for AI coding agent rules
19
20
 
20
21
  Usage:
@@ -75,6 +76,14 @@ function runHookMode(adapter) {
75
76
  }
76
77
  async function runDaemon() {
77
78
  const socketPath = process.env.AGENT_GATE_SOCKET_PATH ?? (0, protocol_1.defaultSocketPath)();
79
+ // Shared decision cache lives for the lifetime of the daemon, so every
80
+ // hook invocation benefits from prior verdicts.
81
+ const ttlSec = parseInt(process.env.AGENT_GATE_CACHE_TTL_SEC ?? '60', 10);
82
+ const maxEntries = parseInt(process.env.AGENT_GATE_CACHE_SIZE ?? '256', 10);
83
+ const cache = new DecisionCache_1.DecisionCache({
84
+ ttlSec: Number.isNaN(ttlSec) ? 60 : ttlSec,
85
+ maxEntries: Number.isNaN(maxEntries) ? 256 : maxEntries,
86
+ });
78
87
  const server = new server_1.DaemonServer({
79
88
  socketPath,
80
89
  handler: async (req) => {
@@ -89,6 +98,7 @@ async function runDaemon() {
89
98
  const result = await (0, processHookData_1.processHookData)(req.payload, {
90
99
  adapter,
91
100
  cwd: req.cwd,
101
+ cache,
92
102
  });
93
103
  return { output: adapter.formatResponse(result) };
94
104
  },
@@ -6,6 +6,7 @@ import { Config } from '../config/Config';
6
6
  import { DeterministicRule } from '../deterministic/types';
7
7
  import { Adapter } from '../adapters/Adapter';
8
8
  import { AgentGateConfig } from '../config/AgentGateConfig';
9
+ import { DecisionCache } from '../cache/DecisionCache';
9
10
  import { EventBus } from '../observability/eventBus';
10
11
  export interface CooldownStore {
11
12
  getLastTime(key: string): number;
@@ -32,6 +33,12 @@ export interface ProcessHookDataDeps {
32
33
  enabled: boolean;
33
34
  path?: string;
34
35
  };
36
+ /**
37
+ * Optional in-process decision cache. Most useful in daemon mode where
38
+ * the cache survives across hook invocations and short-circuits the
39
+ * entire pipeline on a hit.
40
+ */
41
+ cache?: DecisionCache;
35
42
  }
36
43
  export declare function processHookData(input: string, deps?: ProcessHookDataDeps): Promise<ValidationResult>;
37
44
  //# sourceMappingURL=processHookData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processHookData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A;IACjD,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAaD,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CA0K3B"}
@@ -68,6 +68,18 @@ async function processHookData(input, deps) {
68
68
  const { toolName, toolInput } = parsed.action;
69
69
  // Resolve cwd early so the agent-gate config can be loaded relative to it.
70
70
  const cwd = deps?.cwd ?? process.cwd();
71
+ // Cache lookup: if a recent verdict for the exact same (adapter, tool,
72
+ // input, cwd) is still valid, return it without re-running the pipeline.
73
+ if (deps?.cache) {
74
+ const cached = deps.cache.get({
75
+ adapter: adapter.id,
76
+ toolName,
77
+ toolInput,
78
+ cwd,
79
+ });
80
+ if (cached)
81
+ return cached;
82
+ }
71
83
  const agentGateConfig = deps?.agentGateConfig ?? (0, AgentGateConfig_1.loadAgentGateConfig)(cwd);
72
84
  // Build SessionContext (history from adapter, projectRoot defaults to cwd
73
85
  // for v1; future work can detect the actual project root).
@@ -108,7 +120,14 @@ async function processHookData(input, deps) {
108
120
  source: 'deterministic',
109
121
  ruleId: ruleVerdict.ruleId,
110
122
  });
111
- return { decision: 'block', reason: ruleVerdict.reason };
123
+ const verdict = {
124
+ decision: 'block',
125
+ reason: ruleVerdict.reason,
126
+ };
127
+ if (deps?.cache) {
128
+ deps.cache.set({ adapter: adapter.id, toolName, toolInput, cwd }, verdict);
129
+ }
130
+ return verdict;
112
131
  }
113
132
  // Cooldown check (file-based, persists across process invocations)
114
133
  const cooldownStore = config.cooldown > 0
@@ -125,6 +144,9 @@ async function processHookData(input, deps) {
125
144
  const collect = deps?.collectFn ?? collectRuleSources_1.collectRuleSources;
126
145
  const rules = collect(cwd);
127
146
  if (rules.length === 0) {
147
+ if (deps?.cache) {
148
+ deps.cache.set({ adapter: adapter.id, toolName, toolInput, cwd }, PASS);
149
+ }
128
150
  return PASS;
129
151
  }
130
152
  // Get model client
@@ -165,6 +187,9 @@ async function processHookData(input, deps) {
165
187
  reason: result.reason,
166
188
  source,
167
189
  });
190
+ if (deps?.cache) {
191
+ deps.cache.set({ adapter: adapter.id, toolName, toolInput, cwd }, result);
192
+ }
168
193
  return result;
169
194
  }
170
195
  function createModelClient(config, cwd) {
package/dist/index.d.ts CHANGED
@@ -25,6 +25,8 @@ export type { AgentSdkClientOptions, AgentSdkQueryFn, } from './validation/model
25
25
  export { lintRuleSources } from './doctor/lintRuleSources';
26
26
  export { formatFindings } from './doctor/formatFindings';
27
27
  export type { Finding, FindingCode, Severity, } from './doctor/findings';
28
+ export { DecisionCache } from './cache/DecisionCache';
29
+ export type { CacheKey, DecisionCacheOptions, } from './cache/DecisionCache';
28
30
  export { DaemonServer } from './daemon/server';
29
31
  export type { DaemonServerOptions, DaemonHandler } from './daemon/server';
30
32
  export { sendToDaemon } from './daemon/client';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,mBAAmB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ACR,oBAAoB,GACrB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EACL,iBAAiB,IAAI,uBAAuB,GAC7C,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,YAAY,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,GACL,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processHookData = exports.validator = exports.collectRuleSources = exports.JsonlFileSink = exports.EventBus = exports.defaultDaemonSocketPath = exports.sendToDaemon = exports.DaemonServer = exports.formatFindings = exports.lintRuleSources = exports.AgentSdkClient = exports.CompositeModelClient = exports.cursorAdapter = exports.claudeCodeAdapter = exports.buildDefaultDeterministicRules = exports.defaultDeterministicRules = exports.forbidFilePathPattern = exports.forbidContentPattern = exports.forbidCommandPattern = exports.HookDataSchema = exports.loadPluginConfig = exports.loadAgentGateConfig = exports.defineConfig = exports.Config = void 0;
3
+ exports.processHookData = exports.validator = exports.collectRuleSources = exports.JsonlFileSink = exports.EventBus = exports.defaultDaemonSocketPath = exports.sendToDaemon = exports.DaemonServer = exports.DecisionCache = exports.formatFindings = exports.lintRuleSources = exports.AgentSdkClient = exports.CompositeModelClient = exports.cursorAdapter = exports.claudeCodeAdapter = exports.buildDefaultDeterministicRules = exports.defaultDeterministicRules = exports.forbidFilePathPattern = exports.forbidContentPattern = exports.forbidCommandPattern = exports.HookDataSchema = exports.loadPluginConfig = exports.loadAgentGateConfig = exports.defineConfig = exports.Config = void 0;
4
4
  // Config
5
5
  var Config_1 = require("./config/Config");
6
6
  Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return Config_1.Config; } });
@@ -35,6 +35,9 @@ var lintRuleSources_1 = require("./doctor/lintRuleSources");
35
35
  Object.defineProperty(exports, "lintRuleSources", { enumerable: true, get: function () { return lintRuleSources_1.lintRuleSources; } });
36
36
  var formatFindings_1 = require("./doctor/formatFindings");
37
37
  Object.defineProperty(exports, "formatFindings", { enumerable: true, get: function () { return formatFindings_1.formatFindings; } });
38
+ // Cache
39
+ var DecisionCache_1 = require("./cache/DecisionCache");
40
+ Object.defineProperty(exports, "DecisionCache", { enumerable: true, get: function () { return DecisionCache_1.DecisionCache; } });
38
41
  // Daemon
39
42
  var server_1 = require("./daemon/server");
40
43
  Object.defineProperty(exports, "DaemonServer", { enumerable: true, get: function () { return server_1.DaemonServer; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiro-c/agent-gate",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Runtime rule enforcer for AI coding agents. Reads CLAUDE.md / AGENTS.md / .cursorrules and enforces them via Claude Code and Cursor hooks, with a deterministic safety baseline.",
5
5
  "author": "Hiro-Chiba",
6
6
  "license": "MIT",