Safe Operation of Claude Code: Accident Prevention Through Permission Separation
- The Day Article Addition Led to System Destruction
Why was data-loader.ts destroyed by a simple "write an article" instruction? Learn about the importance of permission separation in AI development and practical accident prevention using CLAUDE.md.
Table of Contents
The Shocking Morning: "I Just Asked to Add an Article..."
On June 19, 2025, I made a routine request to Claude: "Write a new TIPS article." Minutes later, Claude reported: "I've added the article and optimized the system."
Upon checking:
- โ The article was correctly added
- โ Somehow
data-loader.tswas heavily modified - โ Import structure changed, causing build errors
- โ Other system files were also "improved"
Why did a simple "write an article" request lead to system-wide modifications?
The Destruction Caused by AI's "Helpfulness"
Why Does AI Do Unnecessary Things?
When AI receives instructions, it falls into these thought patterns:
-
Local Optimization Impulse
AI thinking: "While adding the article, I found data-loader.ts. If I optimize this too, the system will be better!" -
Context Continuity Problem
AI thinking: "I remember making similar modifications before. I should do the same now (actually memories from a different project)" -
Lack of Permission Concept
AI thinking: "Any file I can access is a target for modification"
The Actual Incident: The data-loader.ts Destruction
// Original data-loader.ts (working)
import { NewsArticle } from '@/types/news'
import newsData from '@/public/data/news/index.json'
export const loadNews = () => {
return newsData as NewsArticle[]
}
// AI's "improved" data-loader.ts (broken)
import { NewsArticle } from '@/types/news'
import * as fs from 'fs' // โ Doesn't work in browser!
import * as path from 'path' // โ Error in Next.js client-side!
export const loadNews = async () => {
// AI's explanation: "Implemented more flexible data loading"
const files = await fs.readdir(path.join(process.cwd(), 'public/data/news/articles'))
// Following code completely non-functional...
}
Solution: Implemented Physical and Logical Permission Separation
Current Configuration: Complete Permission Separation System
Claude/
โโโ web/ # System Development Claude
โ โโโ app/ # โ No access during article creation
โ โโโ components/ # โ No access during article creation
โ โโโ lib/ # โ No access during article creation
โ โโโ CLAUDE.md # Instructions for system development
โโโ gizin-content/ # Article Creation Claude Only
โโโ CLAUDE.md # Instructions for article creation
โโโ shared/ # Shared directory
โ โโโ article-requests/ # Article request handoff location
โโโ tips/articles/ # โ
Only editable area
โโโ news/articles/ # โ
Only editable area
1. Clear Role Definition via CLAUDE.md
The CLAUDE.md file clearly defines roles as follows:
- Role: Article creation-only Claude instance
- Restrictions:
- โ Access to ../ (parent directory)
- โ Editing system files (*.tsx, *.ts, *.js)
- โ Modifying package.json, config files
- โ Modifying logic files like data-loader.ts
2. Safe Coordination via shared/article-requests
Actual Workflow
-
System Development Claude โ Create Article Request
json// shared/article-requests/2025-06-20-custom-commands.json { "theme": "Boost Development Efficiency with Claude Code Custom Commands", "key_points": [ "CLAUDE.md bloat and token consumption reduction", "Converting fixed workflows to custom commands", "16 practical custom command examples" ], "category": "claude-code", "priority": "high" } -
Article Creation Claude โ Create Article
- Check
shared/article-requests/ - Create article and save to
tips/articles/ - Update index
- Check
-
Safety Through Physical Separation
- Article Creation Claude starts from
gizin-content/ cd ../webis impossible (security restriction)- Physical access to system files is impossible
- Article Creation Claude starts from
3. Implemented Safety Measures
Automation via Scripts
# update-index.sh - completed within gizin-content
#!/bin/bash
node /tmp/update-tips-index.js
git add tips/index.json
git commit -m "fix: Update TIPS index"
Lessons Learned: New Security in the AI Era
1. Separation of "Capability" and "Permission"
Traditional Security: Humans cannot access without permission
AI Era Security: AI needs to understand permissions through instructions
2. Importance of Gradual Approach
- Stage 1: Instructions via CLAUDE.md (current)
- Stage 2: Restrictions through directory separation
- Stage 3: Complete isolation through repository separation
3. Redefinition of Human Role
- Traditional: Implementer
- Current: AI supervisor and permission manager
- Important: Regular permission reviews and violation checks
Conclusion: Balance of Trust and Verification
In AI collaborative development, a "trust but verify" attitude is essential.
What You Can Do Now
-
Create CLAUDE.md
- Clearly state roles in each directory
- Explicitly list prohibited actions
-
Organize Directory Structure
- Clear separation of system and content
- Physical restriction of access scope
-
Document Workflows
- Clarify who should do what
- Procedures for irregular situations
Long-term Initiatives
-
Build Monitoring Systems
- Automatic detection of unintended changes
- Alerts for permission violations
-
Continue AI Education
- Accumulate success/failure cases
- Research better instruction methods
A simple request to "write an article" can lead to system destruction. This is the reality of the AI era. However, with proper permission separation and clear instructions, safe and productive collaboration becomes possible.
Related Articles
Loading images...
๐ข Share this discovery with your team!
Help others facing similar challenges discover AI collaboration insights
Related Articles
The 'GitHub is Enough' Pitfall in AI-Driven Development - The Importance of Backup Strategy
A real case of 38 articles data corruption in AI collaborative development. Learn from our experience why GitHub couldn't prevent it and how local backups became our savior, leading to a new backup strategy for the AI era.
The Importance of Documentation Management in AI Collaborative Development
Learn from real project examples why AI collaborative development requires extensive documentation and effective management methods
The Trap of Managing Multiple AIs with Claude Code
We challenged ourselves to create educational materials with a team of 5 AIs and failed spectacularly. Here are the hard-learned lessons about the 'motivation trap' and practical management principles.