From 4dbed5ff5bfea0663f5f0893d2cd58399e0f73f6 Mon Sep 17 00:00:00 2001 From: seto Date: Mon, 13 Apr 2026 16:11:33 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20cubic-dev-ai=20round=202=20=E2=80=94=203?= =?UTF-8?q?=20issues=20across=20SKILL.md=20+=20pruning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P1: Gate message asked for raw production data records — changed to "redacted or synthetic values" to prevent sensitive data exfiltration P2: SKILL.md description now includes MultiEdit (was missing after MultiEdit gate was added in previous commit) P2: Session key pruning now caps __prefixed keys at 50 to prevent unbounded growth even in theoretical edge cases 9/9 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/hooks/gateguard-fact-force.js | 5 ++++- skills/gateguard/SKILL.md | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/hooks/gateguard-fact-force.js b/scripts/hooks/gateguard-fact-force.js index 4290c7d3..1133cae4 100644 --- a/scripts/hooks/gateguard-fact-force.js +++ b/scripts/hooks/gateguard-fact-force.js @@ -64,7 +64,10 @@ function saveState(state) { if (state.checked.length > MAX_CHECKED_ENTRIES) { const sessionKeys = state.checked.filter(k => k.startsWith('__')); const fileKeys = state.checked.filter(k => !k.startsWith('__')); - state.checked = [...sessionKeys, ...fileKeys.slice(-(MAX_CHECKED_ENTRIES - sessionKeys.length))]; + // Cap session keys at 50 to prevent unbounded growth + const cappedSession = sessionKeys.length > 50 ? sessionKeys.slice(-50) : sessionKeys; + const remaining = MAX_CHECKED_ENTRIES - cappedSession.length; + state.checked = [...cappedSession, ...fileKeys.slice(-Math.max(remaining, 0))]; } fs.mkdirSync(STATE_DIR, { recursive: true }); // Atomic write: temp file + rename prevents partial reads diff --git a/skills/gateguard/SKILL.md b/skills/gateguard/SKILL.md index 4802b64b..903e9145 100644 --- a/skills/gateguard/SKILL.md +++ b/skills/gateguard/SKILL.md @@ -1,6 +1,6 @@ --- name: gateguard -description: Fact-forcing gate that blocks Edit/Write/Bash and demands concrete investigation (importers, data schemas, user instruction) before allowing the action. Measurably improves output quality by +2.25 points vs ungated agents. +description: Fact-forcing gate that blocks Edit/MultiEdit/Write/Bash and demands concrete investigation (importers, data schemas, user instruction) before allowing the action. Measurably improves output quality by +2.25 points vs ungated agents. origin: community --- @@ -52,8 +52,8 @@ Before editing {file_path}, present these facts: 1. List ALL files that import/require this file (use Grep) 2. List the public functions/classes affected by this change -3. If this file reads/writes data files, cat one real record - and show actual field names, structure, and date format +3. If this file reads/writes data files, show field names, structure, + and date format (use redacted or synthetic values, not raw production data) 4. Quote the user's current instruction verbatim ```