Commit 06b49c293e27

Vincent Demeester <vincent@sbr.pm>
2026-02-11 06:21:48
feat: block direct .org file edits, enforce emacsclient
Added path policy to block Write/Edit on .org files in ~/desktop/org/. Extended Claude hooks to validate Edit tool calls. Updated AGENTS.md instructions to use emacsclient or org_todo tool for all org-mode file modifications.
1 parent b036485
Changed files (4)
dots/config/ai/path-policies.json
@@ -99,15 +99,15 @@
       "enabled": true
     },
     {
-      "name": "org-files-location",
-      "description": "Org files should go to ~/desktop/org/",
+      "name": "no-direct-org-edits",
+      "description": "Never write/edit .org files directly — use emacsclient or org_todo tool instead",
       "filenamePattern": "\\.org$",
-      "allowedPaths": [
+      "blockedPaths": [
         "~/desktop/org/*",
-        "~/src/*/docs/*"
+        "~/desktop/org/notes/*"
       ],
-      "action": "warn",
-      "enabled": false
+      "action": "block",
+      "enabled": true
     }
   ]
 }
dots/config/claude/settings.json
@@ -19,6 +19,15 @@
             "command": "bun run ~/.config/claude/hooks/validate-write-path.ts"
           }
         ]
+      },
+      {
+        "matcher": "Edit",
+        "hooks": [
+          {
+            "type": "command",
+            "command": "bun run ~/.config/claude/hooks/validate-write-path.ts"
+          }
+        ]
       }
     ],
     "SessionStart": [
dots/pi/agent/AGENTS.md
@@ -32,6 +32,7 @@ Skills from `~/.config/claude/skills/` are compatible with pi. Key skills:
 - **Package managers:** uv for Python (NOT pip)
 - **Markdown over HTML/XML:** Use markdown formatting
 - **Analysis vs Action:** If asked to analyze, do analysis only
+- **Org files:** NEVER edit `.org` files directly — use `emacsclient` or `org_todo` tool
 
 ## Response Patterns
 
AGENTS.md
@@ -95,6 +95,12 @@ AST-based structural search for code patterns. Fast, accurate, works across Nix/
 
 ## File Management Guidelines
 
+### Org Files
+- **NEVER edit `.org` files directly** with Write, Edit, sed, or any text manipulation tool
+- **ALWAYS use `emacsclient`** or the `org_todo` tool to modify org files
+- This applies to `~/desktop/org/todos.org`, notes, journal, and all `.org` files
+- Path validation hooks will block direct writes to `.org` files in `~/desktop/org/`
+
 ### Temporary Files
 - **Always write temporary scripts to `/tmp/`** instead of the home directory (`~/`)
 - Use descriptive names with appropriate extensions (e.g., `/tmp/fix-session-filenames.sh`)