Major additions: - Add CODING_GUIDELINES.md with "NO EMOJIS" rule - Create code-fixer agent for automated violation fixes - Add offline mode v2 hooks with local caching/queue - Add periodic context save with invisible Task Scheduler setup - Add agent coordination rules and database connection docs Infrastructure: - Update hooks: task-complete-v2, user-prompt-submit-v2 - Add periodic_save_check.py for auto-save every 5min - Add PowerShell scripts: setup_periodic_save.ps1, update_to_invisible.ps1 - Add sync-contexts script for queue synchronization Documentation: - OFFLINE_MODE.md, PERIODIC_SAVE_INVISIBLE_SETUP.md - Migration procedures and verification docs - Fix flashing window guide Updates: - Update agent configs (backup, code-review, coding, database, gitea, testing) - Update claude.md with coding guidelines reference - Update .gitignore for new cache/queue directories Status: Pre-automated-fixer baseline commit Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
70 lines
2.7 KiB
PowerShell
70 lines
2.7 KiB
PowerShell
# Setup Periodic Context Save - Windows Task Scheduler
|
|
# This script creates a scheduled task to run periodic_save_check.py every minute
|
|
# Uses pythonw.exe to run without console window
|
|
|
|
$TaskName = "ClaudeTools - Periodic Context Save"
|
|
$ScriptPath = "D:\ClaudeTools\.claude\hooks\periodic_save_check.py"
|
|
$WorkingDir = "D:\ClaudeTools"
|
|
|
|
# Use pythonw.exe instead of python.exe to run without console window
|
|
$PythonExe = (Get-Command python).Source
|
|
$PythonDir = Split-Path $PythonExe -Parent
|
|
$PythonwPath = Join-Path $PythonDir "pythonw.exe"
|
|
|
|
# Fallback to python.exe if pythonw.exe doesn't exist (shouldn't happen)
|
|
if (-not (Test-Path $PythonwPath)) {
|
|
Write-Warning "pythonw.exe not found at $PythonwPath, falling back to python.exe"
|
|
$PythonwPath = $PythonExe
|
|
}
|
|
|
|
# Check if task already exists
|
|
$ExistingTask = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
|
|
|
if ($ExistingTask) {
|
|
Write-Host "Task '$TaskName' already exists. Removing old task..."
|
|
Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false
|
|
}
|
|
|
|
# Create action to run Python script with pythonw.exe (no console window)
|
|
$Action = New-ScheduledTaskAction -Execute $PythonwPath `
|
|
-Argument $ScriptPath `
|
|
-WorkingDirectory $WorkingDir
|
|
|
|
# Create trigger to run every minute (indefinitely)
|
|
$Trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1)
|
|
|
|
# Create settings - Hidden and DisallowStartIfOnBatteries set to false
|
|
$Settings = New-ScheduledTaskSettingsSet `
|
|
-AllowStartIfOnBatteries `
|
|
-DontStopIfGoingOnBatteries `
|
|
-StartWhenAvailable `
|
|
-ExecutionTimeLimit (New-TimeSpan -Minutes 5) `
|
|
-Hidden
|
|
|
|
# Create principal (run as current user, no window)
|
|
$Principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType S4U
|
|
|
|
# Register the task
|
|
Register-ScheduledTask -TaskName $TaskName `
|
|
-Action $Action `
|
|
-Trigger $Trigger `
|
|
-Settings $Settings `
|
|
-Principal $Principal `
|
|
-Description "Automatically saves Claude Code context every 5 minutes of active work"
|
|
|
|
Write-Host "[SUCCESS] Scheduled task created successfully!"
|
|
Write-Host ""
|
|
Write-Host "Task Name: $TaskName"
|
|
Write-Host "Runs: Every 1 minute (HIDDEN - no console window)"
|
|
Write-Host "Action: Checks activity and saves context every 5 minutes"
|
|
Write-Host "Executable: $PythonwPath (pythonw.exe = no window)"
|
|
Write-Host ""
|
|
Write-Host "To verify task is hidden:"
|
|
Write-Host " Get-ScheduledTask -TaskName '$TaskName' | Select-Object -ExpandProperty Settings"
|
|
Write-Host ""
|
|
Write-Host "To remove:"
|
|
Write-Host " Unregister-ScheduledTask -TaskName '$TaskName' -Confirm:`$false"
|
|
Write-Host ""
|
|
Write-Host "View logs:"
|
|
Write-Host ' Get-Content D:\ClaudeTools\.claude\periodic-save.log -Tail 20'
|