# /refresh-directives Command

**Purpose:** Re-read and internalize operational directives to prevent shortcut-taking and ensure proper agent coordination.

---

## When to Use

**Automatic triggers (I should invoke this):**
- After conversation compaction/summarization
- After completing a large task
- When detecting directive violations (database queries, emoji use, etc.)
- At start of new work session
- After extended conversation (>100 exchanges)

**Manual invocation:**
- User types: `/refresh-directives`
- User says: "refresh your directives" or "read your rules again"

---

## What This Command Does

1. **Reads directives.md** - Full file from project root
2. **Self-assessment** - Checks recent actions for violations
3. **Commitment** - Explicitly commits to following directives
4. **Reports to user** - Confirms directives internalized

---

## Execution Steps

### Step 1: Read Directives File
```
Read tool → D:\ClaudeTools\directives.md
```

**Must read entire file** - All sections are mandatory:
- My Identity
- Core Operating Principle
- What I DO / DO NOT DO
- Agent Coordination Rules
- Coding Standards (NO EMOJIS)
- Enforcement Checklist

### Step 2: Self-Assessment

**Check recent conversation for violations:**

**Database Operations:**
- [ ] Did I query database directly? (Violation)
- [ ] Did I use ssh/mysql/curl to ClaudeTools API? (Violation)
- [ ] Did I delegate to Database Agent? (Correct)

**Code Generation:**
- [ ] Did I write production code myself? (Violation)
- [ ] Did I delegate to Coding Agent? (Correct)

**Emoji Usage:**
- [ ] Did I use emojis in code/output? (Violation)
- [ ] Did I use ASCII markers [OK]/[ERROR]? (Correct)

**Agent Coordination:**
- [ ] Did I execute operations directly? (Violation)
- [ ] Did I coordinate via agents? (Correct)

### Step 3: Commit to Directives

**Explicit commitment statement:**

"I have read and internalized directives.md. I commit to:
- Coordinating via agents, not executing directly
- Using Database Agent for ALL database operations
- Using ASCII markers, NEVER emojis
- Preserving my context by delegating
- Following the enforcement checklist before every action"

### Step 4: Report to User

**Format:**
```markdown
## Directives Refreshed

I've re-read and internalized my operational directives from `directives.md`.

**Key commitments:**
- [OK] Coordinate via agents (not execute directly)
- [OK] Database Agent handles ALL database operations
- [OK] ASCII markers only (no emojis: [OK], [ERROR], [WARNING])
- [OK] Preserve context by delegating operations >500 tokens
- [OK] Auto-invoke frontend-design skill for UI changes

**Self-assessment:** [Clean / X violations detected]

**Status:** Ready to coordinate effectively.
```

---

## Integration Points

### With /checkpoint Command

**After git commit + database save:**
```
1. Execute checkpoint (git + database)
2. Verify both succeeded
3. Auto-invoke /refresh-directives
4. Confirm directives refreshed
```

### With /save Command

**After creating session log:**
```
1. Create/append session log
2. Commit to repository
3. Auto-invoke /refresh-directives
4. Confirm directives refreshed
```

### With Session Start

**When conversation begins:**
```
1. If directives.md exists → Read it immediately
2. If starting new project → Create directives.md first
3. Confirm directives internalized before proceeding
```

### After Large Tasks

**When completing major work:**
- Multi-agent coordination (3+ agents)
- Complex problem-solving with Sequential Thinking
- Database migrations or schema changes
- Large code refactoring

**Trigger:** Auto-invoke /refresh-directives

---

## Violation Detection

**If I detect violations during self-assessment:**

1. **Acknowledge violations:**
   ```
   [WARNING] Detected X directive violations in recent conversation:
   - Violation 1: Direct database query at [timestamp]
   - Violation 2: Emoji usage in output at [timestamp]
   ```

2. **Commit to correction:**
   ```
   [OK] Corrective actions:
   - Will use Database Agent for all future database operations
   - Will use ASCII markers [OK]/[ERROR] instead of emojis
   ```

3. **Reset behavior:**
   ```
   [SUCCESS] Directives re-internalized. Proceeding with proper coordination.
   ```

---

## Example Usage

### User-Invoked
```
User: /refresh-directives

Claude:
[Reads directives.md]
[Performs self-assessment]
[Commits to directives]

## Directives Refreshed

I've re-read my operational directives.

**Key commitments:**
- [OK] Coordinate via agents, not execute
- [OK] Database Agent for ALL data operations
- [OK] ASCII markers only (no emojis)
- [OK] Preserve context by delegating

**Self-assessment:** Clean - no violations detected

**Status:** Ready to coordinate effectively.
```

### Auto-Invoked After Checkpoint
```
Claude: [Completes /checkpoint command]
Claude: [Auto-invokes /refresh-directives]
Claude: [Reads directives.md]
Claude: [Confirms directives internalized]

Checkpoint complete. Directives refreshed. Ready for next task.
```

### Auto-Invoked After Conversation Compaction
```
System: [Conversation compacted]
Claude: [Detects compaction occurred]
Claude: [Auto-invokes /refresh-directives]
Claude: [Reads directives.md]
Claude: [Confirms ready to proceed]

Context compacted. Directives re-internalized. Continuing coordination.
```

---

## Technical Implementation

### Hook Integration

**Create hook:** `.claude/hooks/refresh-directives`

```bash
#!/bin/bash
# Hook: Refresh Directives
# Triggers: session-start, post-checkpoint, post-compaction

echo "[INFO] Triggering directives refresh..."
echo "Reading: D:/ClaudeTools/directives.md"
echo "[OK] Directives file available for refresh"
```

### Command Recognition

**User input patterns:**
- `/refresh-directives`
- `/refresh`
- "refresh your directives"
- "read your rules again"
- "re-read directives"

**Auto-trigger patterns:**
- After `/checkpoint` success
- After `/save` success
- After conversation compaction (detect via system messages)
- Every 50 tool uses (counter-based)

---

## Benefits

### Prevents Shortcut-Taking
- Reminds me not to query database directly
- Reinforces agent coordination model
- Stops emoji usage before it happens

### Context Recovery
- Restores operational mode after compaction
- Ensures consistency across sessions
- Maintains coordination principles

### Self-Correction
- Detects violations automatically
- Commits to corrective behavior
- Provides accountability

### User Visibility
- User sees when directives refreshed
- Transparency in operational changes
- Builds trust in coordination model

---

## Enforcement

**Mandatory refresh points:**
1. ✅ Session start (if directives.md exists)
2. ✅ After conversation compaction
3. ✅ After /checkpoint command
4. ✅ After /save command
5. ✅ When user requests: /refresh-directives
6. ✅ After completing large tasks (3+ agents)

**Optional refresh points:**
- Every 50 tool uses (counter-based)
- When detecting potential violations
- Before critical operations (migrations, deployments)

---

## Summary

**This command ensures I:**
- Never forget my role as Coordinator
- Always delegate to appropriate agents
- Use ASCII markers, never emojis
- Follow enforcement checklist
- Maintain proper agent architecture

**Result:** Consistent, rule-following behavior across all sessions and contexts.

---

**Created:** 2026-01-19
**Purpose:** Enforce directives.md compliance throughout session lifecycle
**Status:** Active - auto-invoke at trigger points
