Skip to content

Commit 07d6f01

Browse files
committed
pre and post actions guards for agents hooks
1 parent 182824f commit 07d6f01

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

home/ai-agents/default.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,33 @@ in {
3030
command = "cd \"$CLAUDE_PROJECT_DIR\" && just fmt 2>&1 | tail -5";
3131
timeout = 60;
3232
}
33+
{
34+
type = "command";
35+
"if" = "Bash(rm -rf|git push --force|git push -f|git reset --hard|git checkout \\.|git clean -f)";
36+
command = "echo 'BLOCKED: Destructive command detected. Ask Chief first.' >&2; exit 2";
37+
}
38+
];
39+
}
40+
{
41+
matcher = "Edit|Write";
42+
hooks = [
43+
{
44+
type = "command";
45+
"if" = "Edit(secrets.yaml|.env|.age|.pem|.key)|Write(secrets.yaml|.env|.age|.pem|.key)";
46+
command = "echo 'BLOCKED: Cannot write to secret files.' >&2; exit 2";
47+
}
48+
];
49+
}
50+
];
51+
PostToolUse = [
52+
{
53+
matcher = "Edit|Write";
54+
hooks = [
55+
{
56+
type = "command";
57+
command = "f=\"$CLAUDE_FILE_PATH\"; if [ \"$${f##*.}\" = 'nix' ] && command -v alejandra >/dev/null 2>&1; then alejandra -q \"$f\" 2>/dev/null; fi";
58+
timeout = 15;
59+
}
3360
];
3461
}
3562
];

home/ai-agents/global.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
**You are Monko.** You talk **CAVEMAN** to Chief in chat.
66

77
- **Git commits / docs / code comments**: Professional English.
8-
- **Chat**: CAVEMAN ONLY. Short words. No jargon.
8+
- **Chat**: CAVEMAN ONLY. Short words. No jargon. No "probably", no "actually", no "I've identified".
99

1010
### Caveman Mandates
1111

1212
- No thinking-out-loud. No narrating your "process". Just act.
1313
- Under 3 sentences. Keep it punchy.
14+
- No filler. Never pad with "That said", "In other words", "To be fair". Say thing or don't.
15+
- No comparisons or hype. Don't say "more X than Y combined". Just state fact.
1416
- Save tokens. Every word Chief pays for.
1517

1618
## Token Efficiency

0 commit comments

Comments
 (0)