1332 Commits

Author SHA1 Message Date
Affaan Mustafa
6c67566767 fix: keep gateguard session state alive 2026-04-13 00:58:50 -07:00
Affaan Mustafa
2e44beabc1 test: isolate gateguard state dir cleanup 2026-04-13 00:53:57 -07:00
seto
dd2962ee92 fix: 5 bugs + 2 tests from 3-agent deep bughunt
Bugs fixed:
- B1: JS gate messages still said "cat one real record" -> redacted/synthetic
- B2: Destructive bash key used 200-char truncation (collision bypass) -> SHA256 hash
- B3: sanitizePath only stripped \n\r -> now strips null bytes, bidi overrides, all control chars
- B4: Tool name matching was case-sensitive (latent bypass) -> lookup map normalization
- B5: SKILL.md Gate Types missing MultiEdit -> added with explanation

Tests added:
- T1: MultiEdit gate denies first unchecked file (CRITICAL - was untested)
- T2: MultiEdit allows after all files gated

11/11 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:32:46 +09:00
seto
8cd6378c81 fix: cubic-dev-ai round 3 — SKILL.md consistency
P2: Description now says "Edit/Write/Bash (including MultiEdit)"
    instead of listing MultiEdit as a separate top-level gate

P2: Write Gate and Anti-Patterns now use same "redacted or synthetic
    values" wording as Edit Gate (was still "cat one real record")

All 3 gate doc sections now consistent. 9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:19:01 +09:00
seto
4dbed5ff5b fix: cubic-dev-ai round 2 — 3 issues across SKILL.md + pruning
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) <noreply@anthropic.com>
2026-04-13 16:11:33 +09:00
seto
5540282dcb fix: remove unnecessary disk I/O + fix test cleanup
- isChecked() no longer calls saveState() — read-only operation
  should not write to disk (was causing 3x writes per tool call)
- Test cleanup uses fs.rmSync(recursive) instead of fs.rmdirSync
  which failed with ENOTEMPTY when .tmp files remained

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:41:58 +09:00
seto
67256194a0 fix: P1 test state-file PID mismatch + P2 session key eviction
P1 (cubic-dev-ai): Test process PID differs from spawned hook PID,
so test was seeding/clearing wrong state file. Fix: pass fixed
CLAUDE_SESSION_ID='gateguard-test-session' to spawned hooks.

P2 (cubic-dev-ai): Pruning checked array could evict __bash_session__
and other session keys, causing gates to re-fire mid-session. Fix:
preserve __prefixed keys during pruning, only evict file-path entries.

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:40:13 +09:00
seto
6ed1c643e7 fix: MultiEdit gate bypass — handle edits[].file_path correctly
P1 bug reported by greptile-apps: MultiEdit uses toolInput.edits[].file_path,
not toolInput.file_path. The gate was silently allowing all MultiEdit calls.

Fix: separate MultiEdit into its own branch that iterates edits array
and gates on the first unchecked file_path.

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:37:39 +09:00
seto
45823fcede fix: session-scoped state to prevent cross-session race
Addresses reviewer feedback from @affaan-m:

1. State keyed by CLAUDE_SESSION_ID / ECC_SESSION_ID
   - Falls back to pid-based isolation when env vars absent
   - State file: state-{sessionId}.json (was .session_state.json)

2. Atomic write+rename semantics
   - Write to temp file, then fs.renameSync to final path
   - Prevents partial reads from concurrent hooks

3. Bounded checked list (MAX_CHECKED_ENTRIES = 500)
   - Prunes to last 500 entries when cap exceeded
   - Stale session files auto-deleted after 1 hour

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:30:34 +09:00
seto
9a64e0d271 fix: gate MultiEdit tool alongside Edit/Write
MultiEdit was bypassing the fact-forcing gate because only Edit and
Write were checked. Now MultiEdit triggers the same edit gate (list
importers, public API, data schemas) before allowing file modifications.

Updated both the hook logic and hooks.json matcher pattern.

Addresses coderabbit/greptile/cubic-dev: "MultiEdit bypasses gate"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 18:18:16 +09:00
seto
b6a290d061 fix: allow destructive bash retry after facts presented
Destructive bash gate previously denied every invocation with no
isChecked call, creating an infinite deny loop. Now gates per-command
on first attempt and allows retry after the model presents the required
facts (targets, rollback plan, user instruction).

Addresses greptile P1: "Destructive bash gate permanently blocks"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 18:08:15 +09:00
seto
96139b2dad fix: address P2 review feedback (coderabbitai, cubic-dev-ai)
- GATEGUARD_STATE_DIR env var for test isolation (hook + tests)
- Exit code assertions on all 9 tests (no vacuous passes)
- Non-vacuous allow-path assertions (verify pass-through preserves input)
- Robust newline-injection assertion
- clearState() now reports errors instead of swallowing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 18:04:09 +09:00
seto
8a2d13187c fix: address P1 review feedback from greptile bot
1. Use run-with-flags.js wrapper (supports ECC_HOOK_PROFILE, ECC_DISABLED_HOOKS)
2. Add session timeout (30min inactivity = state reset, fixes "once ever" bug)
3. Add 9 integration tests (deny/allow/timeout/sanitize/disable)

Refactored hook to module.exports.run() pattern for direct require() by
run-with-flags.js (~50-100ms faster per invocation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 17:42:32 +09:00
seto
5a03922934 feat(hooks,skills): add gateguard fact-forcing pre-action gate
A PreToolUse hook that forces Claude to investigate before editing.
Instead of self-evaluation ("are you sure?"), it demands concrete facts:
importers, public API, data schemas, user instruction.

A/B tested: +2.25 quality points (9.0 vs 6.75) across two independent tasks.

- scripts/hooks/gateguard-fact-force.js — standalone Node.js hook
- skills/gateguard/SKILL.md — skill documentation
- hooks/hooks.json — PreToolUse entries for Edit|Write and Bash

Full package with config: pip install gateguard-ai
Repo: https://github.com/zunoworks/gateguard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 11:41:33 +09:00
Affaan Mustafa
125d5e6199 feat: add ecc2 legacy plugin migration import 2026-04-10 11:53:17 -07:00
Affaan Mustafa
4ff5a7169f feat: add ecc2 legacy tool migration import 2026-04-10 11:49:38 -07:00
Affaan Mustafa
cee82417db feat: add ecc2 legacy skill migration import 2026-04-10 11:41:36 -07:00
Affaan Mustafa
f4b1b11e10 feat: add ecc2 legacy env migration import 2026-04-10 11:33:18 -07:00
Affaan Mustafa
e7dd7047b5 feat: add ecc2 legacy remote migration import 2026-04-10 11:23:10 -07:00
Affaan Mustafa
b6426ade32 feat: add ecc2 legacy workspace memory import 2026-04-10 11:10:40 -07:00
Affaan Mustafa
790cb0205c feat: add ecc2 legacy schedule migration import 2026-04-10 11:06:14 -07:00
Affaan Mustafa
046af44065 feat: add ecc2 legacy migration scaffold 2026-04-10 10:57:13 -07:00
Affaan Mustafa
d36e9c48a4 feat: add ecc2 legacy migration plan 2026-04-10 10:54:49 -07:00
Affaan Mustafa
0f028f38f6 feat: add ecc2 legacy migration audit 2026-04-10 10:50:17 -07:00
Affaan Mustafa
feee17ad02 feat: extend ecc2 harness marker coverage 2026-04-10 10:39:21 -07:00
Affaan Mustafa
7b7ec434df feat: add ecc2 package manager harness env 2026-04-10 10:33:07 -07:00
Affaan Mustafa
176efb7623 feat: add ecc2 harness compatibility env 2026-04-10 10:24:33 -07:00
Affaan Mustafa
b51792fe0e feat: auto-resolve ecc2 harnesses from repo markers 2026-04-10 10:12:35 -07:00
Affaan Mustafa
050d9a9707 fix: honor ecc2 default agent in cli commands 2026-04-10 09:55:06 -07:00
Affaan Mustafa
03e52f49e8 feat: normalize ecc2 profiles across harnesses 2026-04-10 09:49:05 -07:00
Affaan Mustafa
30913b2cc4 feat: add ecc2 computer use remote dispatch 2026-04-10 09:40:01 -07:00
Affaan Mustafa
7809518612 feat: add ecc2 remote dispatch intake 2026-04-10 09:21:30 -07:00
Affaan Mustafa
bbed46d3eb feat: detect custom ecc2 harness markers 2026-04-10 09:08:06 -07:00
Affaan Mustafa
4a1f3cbd3f feat: preserve custom ecc2 harness labels 2026-04-10 08:57:59 -07:00
Affaan Mustafa
bcd869d520 feat: add ecc2 configurable harness runners 2026-04-10 08:45:47 -07:00
Affaan Mustafa
2e6eeafabd feat: add ecc2 persistent task scheduling 2026-04-10 08:31:04 -07:00
Affaan Mustafa
52371f5016 feat: prioritize ecc2 handoff queues 2026-04-10 08:16:17 -07:00
Affaan Mustafa
d84c64fa0e feat: canonicalize ecc2 harness aliases 2026-04-10 08:03:25 -07:00
Affaan Mustafa
a4aaa30e93 feat: add ecc2 gemini runner support 2026-04-10 07:58:26 -07:00
Affaan Mustafa
97afd95451 feat: add ecc2 codex and opencode runners 2026-04-10 07:53:54 -07:00
Affaan Mustafa
29ff44e23e feat: add ecc2 harness metadata detection 2026-04-10 07:46:46 -07:00
Affaan Mustafa
9c525009d7 feat: add ecc2 memory connector status reporting 2026-04-10 07:16:41 -07:00
Affaan Mustafa
9c294f7815 feat: add ecc2 pinned memory observations 2026-04-10 07:06:37 -07:00
Affaan Mustafa
766bf31737 feat: add ecc2 memory observation priorities 2026-04-10 06:56:26 -07:00
Affaan Mustafa
9523575721 feat: add ecc2 connector sync checkpoints 2026-04-10 06:44:05 -07:00
Affaan Mustafa
406722b5ef feat: add ecc2 markdown directory memory connector 2026-04-10 06:38:33 -07:00
Affaan Mustafa
5258a75382 feat: add ecc2 bulk memory connector sync 2026-04-10 06:34:40 -07:00
Affaan Mustafa
966af37f89 feat: add ecc2 dotenv memory connectors 2026-04-10 06:30:32 -07:00
Affaan Mustafa
22a5a8de6d feat: add ecc2 markdown memory connectors 2026-04-10 06:26:42 -07:00
Affaan Mustafa
d3b680b6db feat: add ecc2 directory memory connectors 2026-04-10 06:20:15 -07:00