Skip to content

Instantly share code, notes, and snippets.

View cl4ntonio's full-sized avatar

Antonio Pérez Barrero cl4ntonio

  • TandemTrace
  • Palma
View GitHub Profile
@cl4ntonio
cl4ntonio / README.md
Created February 11, 2026 12:25
Claude Code PreToolUse hook: auto-approve piped read-only shell commands

Claude Code: Auto-approve piped read-only shell commands

A PreToolUse hook for Claude Code that auto-approves piped/chained shell commands when every segment is a known read-only command.

Problem

Claude Code's permission system is intentionally aware of shell operators (|, &&, ;). A prefix allow rule like Bash(git diff:*) will not match git diff --name-only | grep "\.tsx?$" — the pipe breaks the match. This means you get prompted for approval on common read-only pipelines.

Solution

@cl4ntonio
cl4ntonio / test-intent-sse.ts
Created February 4, 2026 09:54
Test script for AI Agent Intent Mode SSE responses
#!/usr/bin/env npx tsx
/**
* Test Script for AI Agent Intent Mode SSE Responses
*
* Tests classification intent types with streaming enabled:
* - siem_sweep: SIEM entity search (IP, domain, user, hash)
* - context_sweep: Context/baseline search (hosts)
* - ask_direct: AI knowledge queries
* - siem_query: Query generation for SIEM searches
* - ti_sweep: Threat Intelligence IOC lookups