File Permissions
"Single-writer principle prevents race conditions – know what you can write to."
When to Use This Skill
Use when:
- Unsure if you can write to a file
- Need to know who owns a specific file
- Resolving file conflicts
Use proactively:
- Before writing to any shared file
- When coordinating between agents
Quick Start
Example 2: Developer updating own status
// ✅ Developer CAN update own agent fields:
{
"agents": {
"developer": { "lastHeartbeat": "2026-01-23T12:00:00Z", "status": "working" } // ✅
}
}
// ❌ CANNOT update other agents' fields
Example 3: QA updating validation results
// ✅ QA CAN update validation fields:
{
"items": [{ "id": "feat-001", "passes": true, "validationResults": {...} }] // ✅
}
Core Principle
Each file has a primary owner to avoid conflicts. Only the owner may write to that file.
File Ownership
| File |
Primary Owner |
Other Agents |
prd.json.session |
PM |
Workers: own agents.{role}.* only |
prd.json.items[{taskId}] |
PM (creates) |
Workers: status, completedAt, commit, retryCount, bugNotes |
prd.json |
PM (fields) |
QA: passes, validationResults, bugs |
| Session files |
PM |
All agents (append-only) |
| Progress files |
Respective agent |
PM (append notes only) |
Permission Rules
- Read-modify-write atomically - See
shared-atomic-updates
- Only update fields you own - Never overwrite another agent's data
- Append-only for logs - Never delete or reorder entries
- Retry on conflict - If write fails, re-read and retry once
- Use per-agent files for frequently updated data
What Each Agent CAN Write To
PM Coordinator
| ✅ Can Write |
❌ Cannot Write |
.claude/session/* |
Source code (src/, server/, public/) |
prd.json - task status fields |
Test files |
prd.json.session |
Configuration files |
prd.json.agents.* |
|
coordinator-progress.txt |
|
*-progress.txt (append notes) |
|
Developer Worker
| ✅ Can Write |
❌ Cannot Write |
Source code (src/, etc.) |
prd.json (except assigned tasks) |
.claude/session/session.log (append) |
coordinator-progress.txt |
developer-progress.txt |
qa-progress.txt |
prd.json.agents.developer |
|
prd.json.items[{taskId}] (assigned) |
|
QA Worker
| ✅ Can Write |
❌ Cannot Write |
.claude/session/session.log (append) |
Source code (read-only) |
qa-progress.txt |
coordinator-progress.txt |
prd.json.agents.qa |
developer-progress.txt |
prd.json.items[{taskId}] (validation) |
|
prd.json (passes, validationResults, bugs) |
|
Tech Artist Worker
| ✅ Can Write |
❌ Cannot Write |
src/assets/ (3D models, textures) |
Core game logic (stores/, hooks/, utils/) |
src/components/**/*.{materials,shaders,effects}* |
Network code (server/) |
src/styles/ |
prd.json task descriptions |
src/vfx/ |
|
techartist-progress.txt |
|
Game Designer Worker
| ✅ Can Write |
❌ Cannot Write |
docs/design/ |
Source code |
| Design artifacts |
prd.json task descriptions |
gamedesigner-progress.txt |
|
Commit Permissions
ALL agents MUST commit their file changes.
| Agent |
Must Commit |
Scope |
| PM |
✅ Yes |
prd.json, session files, retrospectives |
| Developer |
✅ Yes |
Source files, tests, own agent status |
| Tech Artist |
✅ Yes |
Assets, visual components, shaders |
| QA |
✅ Yes |
Validation fields, bug reports |
| Game Designer |
✅ Yes |
Design docs, GDD, artifacts |
No Commit Exceptions: Heartbeat updates, temporary message files.
Concurrency Rules
- Never overwrite entire files - Update specific fields only
- Use atomic updates - Read-modify-write to temp file, then rename
- Check file locks - If
.lock file exists, wait or retry
- Additive updates - For logs, append only
- Field-level ownership - Multiple agents can update different fields in same file
Conflict Resolution
If you encounter a write conflict:
- Re-read the file - Get latest state
- Re-apply your changes - On top of new state
- Write again - Using atomic pattern
- If still conflicts - Log issue and wait 30 seconds
Related Skills
| Skill |
Purpose |
shared-ralph-core |
Session structure and file ownership |
shared-atomic-updates |
Atomic update patterns |
shared-worker-worktree |
Parallel development coordination |
1---2name: shared-file-permissions3description: File read/write permissions for all Ralph agents. Use proactively when unsure about file ownership or write permissions.4---5
6# File Permissions
7
8> "Single-writer principle prevents race conditions – know what you can write to."
9
10## When to Use This Skill
11
12Use **when**:
13- Unsure if you can write to a file
14- Need to know who owns a specific file
15- Resolving file conflicts
16
17Use **proactively**:
18- Before writing to any shared file
19- When coordinating between agents
20
21---
22
23## Quick Start
24
25<examples>
26Example 1: PM writing to prd.json
27```json
28// ✅ PM CAN write these fields:
29{
30 "items": [{ "status": "in_progress" }], // ✅ PM only
31 "session": { "iteration": 5 }, // ✅ PM only
32 "agents": { "developer": { "status": "working" } } // ✅ PM only
33}
34```
35
36Example 2: Developer updating own status
37```json
38// ✅ Developer CAN update own agent fields:
39{
40 "agents": {
41 "developer": { "lastHeartbeat": "2026-01-23T12:00:00Z", "status": "working" } // ✅
42 }
43}
44// ❌ CANNOT update other agents' fields
45```
46
47Example 3: QA updating validation results
48```json
49// ✅ QA CAN update validation fields:
50{
51 "items": [{ "id": "feat-001", "passes": true, "validationResults": {...} }] // ✅
52}
53```
54</examples>
55
56---
57
58## Core Principle
59
60Each file has a **primary owner** to avoid conflicts. Only the owner may write to that file.
61
62---
63
64## File Ownership
65
66| File | Primary Owner | Other Agents |
67|------|---------------|--------------|
68| `prd.json.session` | PM | Workers: own `agents.{role}.*` only |
69| `prd.json.items[{taskId}]` | PM (creates) | Workers: `status`, `completedAt`, `commit`, `retryCount`, `bugNotes` |
70| `prd.json` | PM (fields) | QA: `passes`, `validationResults`, `bugs` |
71| Session files | PM | All agents (append-only) |
72| Progress files | Respective agent | PM (append notes only) |
73
74---
75
76## Permission Rules
77
781. **Read-modify-write atomically** - See `shared-atomic-updates`
792. **Only update fields you own** - Never overwrite another agent's data
803. **Append-only for logs** - Never delete or reorder entries
814. **Retry on conflict** - If write fails, re-read and retry once
825. **Use per-agent files** for frequently updated data
83
84---
85
86## What Each Agent CAN Write To
87
88### PM Coordinator
89
90| ✅ Can Write | ❌ Cannot Write |
91|-------------|----------------|
92| `.claude/session/*` | Source code (`src/`, `server/`, `public/`) |
93| `prd.json` - task status fields | Test files |
94| `prd.json.session` | Configuration files |
95| `prd.json.agents.*` | |
96| `coordinator-progress.txt` | |
97| `*-progress.txt` (append notes) | |
98
99### Developer Worker
100
101| ✅ Can Write | ❌ Cannot Write |
102|-------------|----------------|
103| Source code (`src/`, etc.) | `prd.json` (except assigned tasks) |
104| `.claude/session/session.log` (append) | `coordinator-progress.txt` |
105| `developer-progress.txt` | `qa-progress.txt` |
106| `prd.json.agents.developer` | |
107| `prd.json.items[{taskId}]` (assigned) | |
108
109### QA Worker
110
111| ✅ Can Write | ❌ Cannot Write |
112|-------------|----------------|
113| `.claude/session/session.log` (append) | Source code (read-only) |
114| `qa-progress.txt` | `coordinator-progress.txt` |
115| `prd.json.agents.qa` | `developer-progress.txt` |
116| `prd.json.items[{taskId}]` (validation) | |
117| `prd.json` (`passes`, `validationResults`, `bugs`) | |
118
119### Tech Artist Worker
120
121| ✅ Can Write | ❌ Cannot Write |
122|-------------|----------------|
123| `src/assets/` (3D models, textures) | Core game logic (`stores/`, `hooks/`, `utils/`) |
124| `src/components/**/*.{materials,shaders,effects}*` | Network code (`server/`) |
125| `src/styles/` | `prd.json` task descriptions |
126| `src/vfx/` | |
127| `techartist-progress.txt` | |
128
129### Game Designer Worker
130
131| ✅ Can Write | ❌ Cannot Write |
132|-------------|----------------|
133| `docs/design/` | Source code |
134| Design artifacts | `prd.json` task descriptions |
135| `gamedesigner-progress.txt` | |
136
137---
138
139## Commit Permissions
140
141**ALL agents MUST commit their file changes.**
142
143| Agent | Must Commit | Scope |
144|-------|-------------|-------|
145| **PM** | ✅ Yes | `prd.json`, session files, retrospectives |
146| **Developer** | ✅ Yes | Source files, tests, own agent status |
147| **Tech Artist** | ✅ Yes | Assets, visual components, shaders |
148| **QA** | ✅ Yes | Validation fields, bug reports |
149| **Game Designer** | ✅ Yes | Design docs, GDD, artifacts |
150
151**No Commit Exceptions**: Heartbeat updates, temporary message files.
152
153---
154
155## Concurrency Rules
156
1571. **Never overwrite entire files** - Update specific fields only
1582. **Use atomic updates** - Read-modify-write to temp file, then rename
1593. **Check file locks** - If `.lock` file exists, wait or retry
1604. **Additive updates** - For logs, append only
1615. **Field-level ownership** - Multiple agents can update different fields in same file
162
163---
164
165## Conflict Resolution
166
167If you encounter a write conflict:
168
1691. **Re-read the file** - Get latest state
1702. **Re-apply your changes** - On top of new state
1713. **Write again** - Using atomic pattern
1724. **If still conflicts** - Log issue and wait 30 seconds
173
174---
175
176## Related Skills
177
178| Skill | Purpose |
179|-------|---------|
180| `shared-ralph-core` | Session structure and file ownership |
181| `shared-atomic-updates` | Atomic update patterns |
182| `shared-worker-worktree` | Parallel development coordination |