# CLAUDE.md - OpenClaw Security Guardrails Hook Pack

## Project Overview
A Hook Pack for OpenClaw providing runtime security guardrails. Zero dependencies, TypeScript, installable via `openclaw plugins install`.

## Tech Stack
- TypeScript (strict mode)
- Node.js built-in APIs only (zero npm dependencies)
- JSONL for audit logs

## Code Standards
- Single file max 300 lines
- All handlers: `async (event) => Promise<void>` with internal try-catch, never throw
- Use `os.homedir()` for resolving `~/.openclaw/security/audit.jsonl`
- Performance: all detection < 20ms
- Conventional Commits for git messages
- English comments, clear and concise

## File Structure
```
openclaw-security-guardrails/
├── package.json
├── README.md / README.zh-CN.md
├── LICENSE (MIT)
├── tsconfig.json
├── hooks/{secrets-scanner,prompt-injection-detector,exfiltration-detector,audit-logger,startup-checker}/
│   ├── HOOK.md
│   └── handler.ts
├── src/rules/{secret-patterns,injection-patterns,exfiltration-patterns}.ts
├── src/utils/{logger,alert}.ts
├── src/types.ts
└── tests/{secrets-scanner,prompt-injection,exfiltration}.test.ts
```

## Don't
- Don't use `rm`, use `trash`
- Don't import any npm packages
- Don't exceed 300 lines per file
- Don't throw from handlers
