Files
claudetools/INVISIBLE_PERIODIC_SAVE_SUMMARY.md
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

5.6 KiB

Periodic Save Task - Invisible Mode Setup

Problem Solved

The periodic_save_check.py Task Scheduler task was showing a flashing console window every minute. This has been fixed by configuring the task to run completely invisibly.


What Changed

1. Updated Setup Script

File: D:\ClaudeTools\.claude\hooks\setup_periodic_save.ps1

Changes:

  • Uses pythonw.exe instead of python.exe (no console window)
  • Added -Hidden flag to task settings
  • Changed LogonType from Interactive to S4U (Service-For-User = background)
  • Added verification instructions in output

2. Created Update Script

File: D:\ClaudeTools\.claude\hooks\update_to_invisible.ps1

Purpose:

  • Quick one-command update for existing tasks
  • Preserves existing triggers and settings
  • Validates pythonw.exe exists
  • Shows verification output

3. Created Documentation

File: D:\ClaudeTools\.claude\PERIODIC_SAVE_INVISIBLE_SETUP.md

Contents:

  • Automatic setup instructions
  • Manual update procedures (PowerShell and GUI)
  • Verification steps
  • Troubleshooting guide

How to Fix Your Current Task

Run the update script:

# From PowerShell in D:\ClaudeTools
.\.claude\hooks\update_to_invisible.ps1

This will:

  • Find pythonw.exe automatically
  • Update the task to use pythonw.exe
  • Set the task to run hidden
  • Verify all settings are correct

Option 2: Recreate Task

Re-run the setup script (removes old task and creates new one):

# From PowerShell in D:\ClaudeTools
.\.claude\hooks\setup_periodic_save.ps1

Option 3: Manual (GUI)

  1. Open Task Scheduler (Win + R → taskschd.msc)
  2. Find "ClaudeTools - Periodic Context Save"
  3. Right-click → Properties
  4. Actions tab: Change python.exe to pythonw.exe
  5. General tab: Check "Hidden" checkbox
  6. Click OK

Verification

After updating, verify the task is configured correctly:

# Quick verification
Get-ScheduledTask -TaskName "ClaudeTools - Periodic Context Save" |
    Select-Object -ExpandProperty Actions |
    Select-Object Execute

# Should show: ...pythonw.exe (NOT python.exe)

# Check hidden setting
Get-ScheduledTask -TaskName "ClaudeTools - Periodic Context Save" |
    Select-Object -ExpandProperty Settings |
    Select-Object Hidden

# Should show: Hidden: True

Technical Details

pythonw.exe vs python.exe

Executable Console Window Use Case
python.exe Shows console Interactive scripts, debugging
pythonw.exe No console Background tasks, GUI apps

Task Scheduler Settings

Setting Old Value New Value Purpose
Executable python.exe pythonw.exe No console window
Hidden False True Hide from task list
LogonType Interactive S4U Run in background

What is S4U (Service-For-User)?

  • Runs tasks in background session
  • No interactive window
  • Doesn't require user to be logged in
  • Ideal for background automation

Files Modified/Created

Modified

  • D:\ClaudeTools\.claude\hooks\setup_periodic_save.ps1
    • Lines 9-18: Auto-detect pythonw.exe path
    • Line 29: Use pythonw.exe instead of python.exe
    • Line 43: Added -Hidden flag
    • Line 46: Changed LogonType to S4U
    • Lines 59-64: Updated output messages

Created

  • D:\ClaudeTools\.claude\hooks\update_to_invisible.ps1

    • Quick update script for existing tasks
  • D:\ClaudeTools\.claude\PERIODIC_SAVE_INVISIBLE_SETUP.md

    • Complete setup and troubleshooting guide
  • D:\ClaudeTools\INVISIBLE_PERIODIC_SAVE_SUMMARY.md

    • This file - quick reference summary

Testing

After updating, the task will run every minute but you should see:

  • ✓ No console window flashing
  • ✓ No visible task execution
  • ✓ Logs still being written to D:\ClaudeTools\.claude\periodic-save.log

Check logs to verify it's working:

Get-Content D:\ClaudeTools\.claude\periodic-save.log -Tail 20

You should see log entries appearing every minute (when Claude is active) without any visible window.


Troubleshooting

Still seeing console window?

Check executable:

Get-ScheduledTask -TaskName "ClaudeTools - Periodic Context Save" |
    Select-Object -ExpandProperty Actions
  • If shows python.exe - update didn't work, try manual update
  • If shows pythonw.exe - should be invisible (check hidden setting)

Check hidden setting:

Get-ScheduledTask -TaskName "ClaudeTools - Periodic Context Save" |
    Select-Object -ExpandProperty Settings |
    Select-Object Hidden
  • Should show Hidden: True
  • If False, run update script again

Check LogonType:

Get-ScheduledTask -TaskName "ClaudeTools - Periodic Context Save" |
    Select-Object -ExpandProperty Principal
  • Should show LogonType: S4U
  • If Interactive, run update script again

pythonw.exe not found?

# Check Python installation
Get-Command python | Select-Object -ExpandProperty Source

# Check if pythonw.exe exists in same directory
$PythonPath = (Get-Command python).Source
$PythonDir = Split-Path $PythonPath -Parent
Test-Path (Join-Path $PythonDir "pythonw.exe")

If False, reinstall Python. pythonw.exe should always come with Python on Windows.


Current Status

Task Name: ClaudeTools - Periodic Context Save Frequency: Every 1 minute Action: Check activity, save context every 5 minutes of active work Visibility: Hidden (no console window) Logs: D:\ClaudeTools\.claude\periodic-save.log


Last Updated: 2026-01-17 Updated Files: 1 modified, 3 created