Files
claudetools/.claude/hooks/update_to_invisible.ps1
Mike Swanson 25f3759ecc [Config] Add coding guidelines and code-fixer agent
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>
2026-01-17 12:51:43 -07:00

86 lines
2.7 KiB
PowerShell

# Quick Update - Make Existing Periodic Save Task Invisible
# This script updates the existing task to run without showing a window
$TaskName = "ClaudeTools - Periodic Context Save"
Write-Host "Updating task '$TaskName' to run invisibly..."
Write-Host ""
# Check if task exists
$Task = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
if (-not $Task) {
Write-Host "ERROR: Task '$TaskName' not found."
Write-Host "Run setup_periodic_save.ps1 to create it first."
exit 1
}
# Find pythonw.exe path
$PythonExe = (Get-Command python).Source
$PythonDir = Split-Path $PythonExe -Parent
$PythonwPath = Join-Path $PythonDir "pythonw.exe"
if (-not (Test-Path $PythonwPath)) {
Write-Host "ERROR: pythonw.exe not found at $PythonwPath"
Write-Host "Please reinstall Python to get pythonw.exe"
exit 1
}
Write-Host "Found pythonw.exe at: $PythonwPath"
# Update the action to use pythonw.exe
$NewAction = New-ScheduledTaskAction -Execute $PythonwPath `
-Argument "D:\ClaudeTools\.claude\hooks\periodic_save_check.py" `
-WorkingDirectory "D:\ClaudeTools"
# Update settings to be hidden
$NewSettings = New-ScheduledTaskSettingsSet `
-AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries `
-StartWhenAvailable `
-ExecutionTimeLimit (New-TimeSpan -Minutes 5) `
-Hidden
# Update principal to run in background (S4U = Service-For-User)
$NewPrincipal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType S4U
# Get existing trigger (preserve it)
$ExistingTrigger = $Task.Triggers
# Update the task
Set-ScheduledTask -TaskName $TaskName `
-Action $NewAction `
-Settings $NewSettings `
-Principal $NewPrincipal `
-Trigger $ExistingTrigger | Out-Null
Write-Host ""
Write-Host "[SUCCESS] Task updated successfully!"
Write-Host ""
Write-Host "Changes made:"
Write-Host " 1. Changed executable: python.exe -> pythonw.exe"
Write-Host " 2. Set task to Hidden"
Write-Host " 3. Changed LogonType: Interactive -> S4U (background)"
Write-Host ""
Write-Host "Verification:"
# Show current settings
$UpdatedTask = Get-ScheduledTask -TaskName $TaskName
$Settings = $UpdatedTask.Settings
$Action = $UpdatedTask.Actions[0]
$Principal = $UpdatedTask.Principal
Write-Host " Executable: $($Action.Execute)"
Write-Host " Hidden: $($Settings.Hidden)"
Write-Host " LogonType: $($Principal.LogonType)"
Write-Host ""
if ($Settings.Hidden -and $Action.Execute -like "*pythonw.exe" -and $Principal.LogonType -eq "S4U") {
Write-Host "[OK] All settings correct - task will run invisibly!"
} else {
Write-Host "[WARNING] Some settings may not be correct - please verify manually"
}
Write-Host ""
Write-Host "The task will now run invisibly without showing any console window."
Write-Host ""