feat: Add directives system and DOS management utilities
Implemented comprehensive directives system for agent coordination: - Created directives.md (590 lines) - Core operational rules defining coordinator vs executor roles, agent delegation patterns, and coding standards (NO EMOJIS, ASCII markers only) - Added DIRECTIVES_ENFORCEMENT.md - Documentation of enforcement mechanisms and checklist for validating compliance - Created refresh-directives command - Allows reloading directives after Gitea updates without restarting Claude Code - Updated checkpoint and save commands to verify directives compliance - Updated .claude/claude.md to mandate reading directives.md first Added DOS system management PowerShell utilities: - check-bat-on-nas.ps1 - Verify BAT files on NAS match source - check-latest-errors.ps1 - Scan DOS error logs for recent issues - check-plink-references.ps1 - Find plink.exe usage in scripts - check-scp-errors.ps1 - Analyze SCP transfer errors - check-sync-log.ps1 (modified) - Enhanced sync log analysis - check-sync-status.ps1 - Monitor sync process status - copy-to-nas-now.ps1 - Manual NAS file deployment - find-error-logging.ps1 - Locate error logging patterns - fix-copy-tonas-logging.ps1 - Repair logging in copy scripts - fix-dos-files.ps1 - Batch DOS file corrections - fix-line-break.ps1 - Fix line ending issues - fix-plink-usage.ps1 - Modernize plink.exe to WinRM - push-fixed-bat-files.ps1 - Deploy corrected BAT files - run-sync-direct.ps1 - Direct sync execution - test-error-logging.ps1 - Validate error logging functionality - trigger-sync-push.ps1 - Initiate sync push operations - verify-error-logging.ps1 - Confirm error logging working - scripts/fix-ad2-error-logging.ps1 - Fix AD2 error logging Added Gitea password management scripts: - Reset-GiteaPassword.ps1 - Windows PowerShell password reset - reset-gitea-password.sh - Unix shell password reset Key architectural decisions: - Directives system establishes clear separation between Main Claude (coordinator) and specialized agents (executors) - DOS utilities modernize legacy plink.exe usage to WinRM - Error logging enhancements improve troubleshooting capabilities - All scripts follow PSScriptAnalyzer standards Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -153,6 +153,13 @@ Please create a comprehensive checkpoint that captures BOTH git changes AND sess
|
||||
- Confirm database save succeeded (check API response)
|
||||
- Report both statuses to user
|
||||
|
||||
8. **Refresh directives** (MANDATORY):
|
||||
- After checkpoint completion, auto-invoke `/refresh-directives`
|
||||
- Re-read `directives.md` to prevent shortcut-taking
|
||||
- Perform self-assessment for any violations
|
||||
- Confirm commitment to agent coordination rules
|
||||
- Report directives refreshed to user
|
||||
|
||||
## Benefits of Dual Checkpoint
|
||||
|
||||
**Git Checkpoint:**
|
||||
|
||||
306
.claude/commands/refresh-directives.md
Normal file
306
.claude/commands/refresh-directives.md
Normal file
@@ -0,0 +1,306 @@
|
||||
# /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
|
||||
@@ -61,6 +61,12 @@ Format credentials as:
|
||||
1. Commit with message: "Session log: [brief description of work done]"
|
||||
2. Push to gitea remote (if configured)
|
||||
3. Confirm push was successful
|
||||
4. **Refresh directives** (MANDATORY):
|
||||
- Auto-invoke `/refresh-directives`
|
||||
- Re-read `directives.md` to prevent shortcut-taking
|
||||
- Perform self-assessment for violations
|
||||
- Confirm commitment to coordination rules
|
||||
- Report directives refreshed
|
||||
|
||||
## Purpose
|
||||
|
||||
|
||||
Reference in New Issue
Block a user