Scheduling NeuralMind Operations
Automate NeuralMind commands to run on a schedule for continuous codebase monitoring, audit trail generation, and compliance reporting. This guide covers Windows Task Scheduler, GitHub Actions, and other scheduling approaches for any project.
Table of Contents
- Quick Start
- Understanding Project Paths
- Windows Task Scheduler
- GitHub Actions
- Cron / Linux / macOS
- Running on Multiple Projects
- Examples
- Monitoring & Logs
Quick Start
Canonical Memory-Freshness Step
NeuralMind’s persisted session-start memory (SYNAPSE_MEMORY.md) is derived
from the current graph and learned state, so it can drift after meaningful
repository changes. The canonical maintenance step is:
neuralmind build .
Run it weekly and after significant code changes to refresh the index, the graph view, and the memory artifact the agent loads on session startup.
On Windows
# 1. Create a PowerShell script (see below)
# 2. Run PowerShell as Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# 3. Register the scheduled task (see Windows Task Scheduler section)
On Linux/macOS
# Add to crontab (see Cron section)
crontab -e
On GitHub (any platform)
Push a workflow file to .github/workflows/neuralmind-audit.yml (see GitHub Actions section)
Understanding Project Paths
NeuralMind commands always operate on a project root directory. The structure matters:
your-project/
├── graph.json # Generated by graphify
├── neuralmind.db/ # Generated by neuralmind build
├── src/
├── tools/
└── ...
When scheduling, you need to:
- Know the absolute path to your project
- Ensure
graph.jsonandneuralmind.db/exist (rungraphify build && neuralmind build .once) - Point the scheduler to that path
Common paths:
Windows:
C:\Users\{username}\Projects\video_toolkit
C:\Users\{username}\Projects\ibkr-traderbot
C:\Users\{username}\Projects\neuralmind
Linux/macOS:
/home/{username}/projects/video_toolkit
/home/{username}/projects/neuralmind
~/Code/my-project
Windows Task Scheduler
Always-on neuralmind watch + neuralmind serve (v0.8)
The Linux/macOS analogues live in scripts/systemd/
and scripts/launchd/; the full cross-platform
walkthrough is at
docs/use-cases/always-on.md. On Windows,
register two At-Logon scheduled tasks so the watcher and graph view come
back automatically after every reboot or crash.
# Always-on synapse watcher.
# ExecutionTimeLimit = 0 disables Task Scheduler's default 72-hour cap,
# which would otherwise stop a continuously-running task.
Register-ScheduledTask -TaskName "NeuralMind-Watch" `
-Action (New-ScheduledTaskAction `
-Execute "neuralmind" `
-Argument "watch C:\path\to\your-project --quiet") `
-Trigger (New-ScheduledTaskTrigger -AtLogOn) `
-Settings (New-ScheduledTaskSettingsSet -StartWhenAvailable `
-ExecutionTimeLimit (New-TimeSpan -Seconds 0) `
-RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1))
# Always-on graph view (tokenized URL printed to the task's stdout).
# --no-browser stops it from spawning a browser on every login.
Register-ScheduledTask -TaskName "NeuralMind-Serve" `
-Action (New-ScheduledTaskAction `
-Execute "neuralmind" `
-Argument "serve C:\path\to\your-project --port 8787 --no-browser") `
-Trigger (New-ScheduledTaskTrigger -AtLogOn) `
-Settings (New-ScheduledTaskSettingsSet -StartWhenAvailable `
-ExecutionTimeLimit (New-TimeSpan -Seconds 0) `
-RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1))
# Verify both
Get-ScheduledTask NeuralMind-*
Invoke-WebRequest -UseBasicParsing http://127.0.0.1:8787/healthz
# StatusCode 200, JSON body: {"status": "ok", "version": "0.8.0"}
Invoke-WebRequest calls the unauthenticated /healthz endpoint that
shipped in v0.8 — the same probe Docker HEALTHCHECK and Linux
systemd ExecStartPost use.
Stop and remove:
Unregister-ScheduledTask -TaskName NeuralMind-Watch -Confirm:$false
Unregister-ScheduledTask -TaskName NeuralMind-Serve -Confirm:$false
The Recurring Audit / Benchmark schedule below remains the right shape for the batch job (run nightly, log to a file, exit). Use that for periodic CI-style audits; use the always-on tasks above for the live synapse + graph view.
PowerShell Script (Recommended)
Step 1: Create the script at a persistent location like C:\scripts\run-neuralmind.ps1:
# ============================================================
# NeuralMind Scheduled Suite Runner
# Runs a full NeuralMind analysis on a project and logs output
# ============================================================
param(
[string]$ProjectPath = $(throw "ProjectPath parameter required"),
[string]$LogDir = "$env:USERPROFILE\Documents\neuralmind-logs"
)
# Validate project exists
if (!(Test-Path $ProjectPath)) {
Write-Error "Project path does not exist: $ProjectPath"
exit 1
}
# Ensure log directory exists
if (!(Test-Path $LogDir)) {
New-Item -ItemType Directory -Path $LogDir | Out-Null
}
# Create log file with timestamp
$timestamp = Get-Date -Format "yyyy-MM-dd_HHmmss"
$logFile = "$LogDir\neuralmind-$(Split-Path $ProjectPath -Leaf)_$timestamp.log"
function Log {
param([string]$Message)
$msg = "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] $Message"
Write-Host $msg
Add-Content -Path $logFile -Value $msg
}
try {
Log "=== Starting NeuralMind Suite on $ProjectPath ==="
# Change to project directory
Push-Location $ProjectPath
# Run wakeup
Log "Running neuralmind wakeup..."
neuralmind wakeup . 2>&1 | ForEach-Object { Log $_ }
# Run queries
Log "Running cost tracking query..."
neuralmind query . "How does the cost tracking work?" 2>&1 | ForEach-Object { Log $_ }
Log "Running audio processing query..."
neuralmind query . "What audio processing utilities are available?" 2>&1 | ForEach-Object { Log $_ }
# Run skeletons
Log "Analyzing key files..."
if (Test-Path "tools/sfx.py") {
neuralmind skeleton tools/sfx.py 2>&1 | ForEach-Object { Log $_ }
}
if (Test-Path "tools/cost_tracker.py") {
neuralmind skeleton tools/cost_tracker.py 2>&1 | ForEach-Object { Log $_ }
}
# Run searches
Log "Searching for key entities..."
neuralmind search . "CostTracker" 2>&1 | ForEach-Object { Log $_ }
neuralmind search . "parse_args" 2>&1 | ForEach-Object { Log $_ }
# Export the audit log and check its hash chain
$auditJsonl = "$LogDir\audit_$(Split-Path $ProjectPath -Leaf)_$timestamp.jsonl"
Log "Exporting audit log..."
neuralmind audit export . --format jsonl -o $auditJsonl 2>&1 | ForEach-Object { Log $_ }
neuralmind audit verify . 2>&1 | ForEach-Object { Log $_ }
Log "=== Run Complete ==="
Log "Logs saved to: $logFile"
Log "Audit export: $auditJsonl"
} catch {
Log "ERROR: $_"
exit 1
} finally {
Pop-Location
}
Step 2: Test the script manually
Open PowerShell and run:
# For video_toolkit
C:\scripts\run-neuralmind.ps1 -ProjectPath "C:\Users\dtfro\claudecode\video_toolkit"
# For neuralmind repo itself
C:\scripts\run-neuralmind.ps1 -ProjectPath "C:\Users\dtfro\claudecode\neuralmind"
Step 3: Register scheduled task (run PowerShell as Administrator):
# Set execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# For video_toolkit - daily at 2 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 2am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind.ps1 -ProjectPath 'C:\Users\dtfro\claudecode\video_toolkit'"
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -RunOnlyIfNetworkAvailable
Register-ScheduledTask -TaskName "NeuralMind Suite - video_toolkit" -Trigger $trigger -Action $action -Settings $settings -RunLevel Highest -Description "Daily NeuralMind audit for video_toolkit"
# For neuralmind repo - daily at 3 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 3am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind.ps1 -ProjectPath 'C:\Users\dtfro\claudecode\neuralmind'"
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -RunOnlyIfNetworkAvailable
Register-ScheduledTask -TaskName "NeuralMind Suite - neuralmind" -Trigger $trigger -Action $action -Settings $settings -RunLevel Highest -Description "Daily NeuralMind audit for neuralmind repo"
Step 4: Verify in Task Scheduler GUI
- Open Task Scheduler
- Navigate to Task Scheduler Library
- Find tasks named “NeuralMind Suite - *”
- Right-click → Run to test
- Check logs in
%USERPROFILE%\Documents\neuralmind-logs
Batch Script
For simpler setups without PowerShell scripting, create C:\scripts\run-neuralmind.bat:
@echo off
REM Usage: run-neuralmind.bat "C:\path\to\project"
if "%~1"=="" (
echo Usage: run-neuralmind.bat "C:\path\to\project"
exit /b 1
)
set PROJECT_PATH=%~1
set LOGDIR=%USERPROFILE%\Documents\neuralmind-logs
if not exist "%LOGDIR%" mkdir "%LOGDIR%"
REM Create timestamp
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set mydate=%%c-%%a-%%b
for /f "tokens=1-2 delims=/:" %%a in ('time /t') do set mytime=%%a%%b
set LOGFILE=%LOGDIR%\neuralmind-%mydate%_%mytime%.log
cd /d "%PROJECT_PATH%"
echo Running NeuralMind Suite on %PROJECT_PATH% >> %LOGFILE%
neuralmind wakeup . >> %LOGFILE% 2>&1
neuralmind audit export . --format jsonl -o %LOGDIR%\audit.jsonl >> %LOGFILE% 2>&1
neuralmind audit verify . >> %LOGFILE% 2>&1
echo Done >> %LOGFILE%
Register in Task Scheduler with:
$trigger = New-ScheduledTaskTrigger -Daily -At 2am
$action = New-ScheduledTaskAction -Execute "cmd.exe" -Argument '/c C:\scripts\run-neuralmind.bat "C:\Users\dtfro\claudecode\video_toolkit"'
Register-ScheduledTask -TaskName "NeuralMind - video_toolkit" -Trigger $trigger -Action $action -RunLevel Highest
Setup Instructions
- Save the script to
C:\scripts\run-neuralmind.ps1(createC:\scriptsif needed) - Enable PowerShell (Administrator):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - Test manually before scheduling
- Register tasks for each project you want to monitor
- Monitor logs in
%USERPROFILE%\Documents\neuralmind-logs
GitHub Actions
For continuous, automated auditing within your repository, use GitHub Actions. This works for any project on GitHub.
Basic Setup
Create .github/workflows/neuralmind-audit.yml:
name: NeuralMind Audit Suite
on:
schedule:
# Daily at 2 AM UTC (adjust as needed)
- cron: '0 2 * * *'
workflow_dispatch: # Allow manual trigger
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install NeuralMind and graphify
run: |
pip install neuralmind
git clone https://github.com/Graphify-Labs/graphify.git
cd graphify && pip install -e .
- name: Generate code graph
run: graphify build
- name: Build NeuralMind index
run: neuralmind build .
- name: Run NeuralMind suite
run: |
mkdir -p neuralmind-audit
neuralmind wakeup . > neuralmind-audit/wakeup.txt
neuralmind query . "How does the cost tracking work?" > neuralmind-audit/cost-tracking.txt
neuralmind audit export . --format jsonl -o neuralmind-audit/audit.jsonl
- name: Upload audit artifacts
uses: actions/upload-artifact@v3
with:
name: neuralmind-audit-$
path: neuralmind-audit/
retention-days: 30
A CI runner starts without .neuralmind/, so the exported audit log covers
only that run’s own build, wakeup, and query. To audit how agents use
NeuralMind day to day, export the log on the machines where they run.
Multi-Project Setup
If you want to audit multiple projects from one repo, create separate workflows or use a matrix:
name: Multi-Project NeuralMind Audit
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
audit:
strategy:
matrix:
project:
- name: main-project
path: .
- name: subproject-a
path: ./subprojects/a
- name: subproject-b
path: ./subprojects/b
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install NeuralMind and graphify
run: |
pip install neuralmind
git clone https://github.com/Graphify-Labs/graphify.git
cd graphify && pip install -e .
- name: Generate graph and index for $
run: |
cd $
graphify build
neuralmind build .
- name: Run audit for $
run: |
cd $
mkdir -p ../neuralmind-audit-$
neuralmind wakeup . > ../neuralmind-audit-$/audit.txt
neuralmind audit export . --format jsonl -o ../neuralmind-audit-$/audit.jsonl
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: audit-$-$
path: neuralmind-audit-$/
Cron / Linux / macOS
Crontab Setup
Edit your crontab:
crontab -e
Add entries for each project:
# Daily at 2 AM - video_toolkit
0 2 * * * cd ~/projects/video_toolkit && neuralmind wakeup . >> ~/neuralmind-logs/video_toolkit.log 2>&1
# Daily at 3 AM - neuralmind repo
0 3 * * * cd ~/projects/neuralmind && neuralmind wakeup . >> ~/neuralmind-logs/neuralmind.log 2>&1
# Weekly audit export - every Sunday at 1 AM
0 1 * * 0 cd ~/projects/video_toolkit && neuralmind audit export . --format jsonl -o ~/neuralmind-logs/audit-$(date +\%Y\%m\%d).jsonl 2>&1
# Weekly memory freshness rebuild - every Sunday at 12:30 AM
30 0 * * 0 cd ~/projects/video_toolkit && neuralmind build . >> ~/neuralmind-logs/video_toolkit-build.log 2>&1
Bash Script Wrapper
Create ~/scripts/neuralmind-scheduler.sh:
#!/bin/bash
# NeuralMind scheduler for multiple projects
PROJECTS=(
"/home/user/projects/video_toolkit"
"/home/user/projects/neuralmind"
"/home/user/projects/ibkr-traderbot"
)
LOGDIR="$HOME/neuralmind-logs"
mkdir -p "$LOGDIR"
for PROJECT in "${PROJECTS[@]}"; do
if [ ! -d "$PROJECT" ]; then
echo "Skipping $PROJECT (not found)" >> "$LOGDIR/scheduler.log"
continue
fi
TIMESTAMP=$(date +"%Y-%m-%d_%H%M%S")
LOGFILE="$LOGDIR/$(basename $PROJECT)_$TIMESTAMP.log"
cd "$PROJECT"
echo "=== NeuralMind run for $PROJECT at $TIMESTAMP ===" >> "$LOGFILE"
neuralmind wakeup . >> "$LOGFILE" 2>&1
neuralmind audit export . --format jsonl -o "$LOGDIR/audit-$(basename $PROJECT)-$TIMESTAMP.jsonl" >> "$LOGFILE" 2>&1
echo "Complete" >> "$LOGFILE"
done
Make executable and add to crontab:
chmod +x ~/scripts/neuralmind-scheduler.sh
crontab -e
# Add:
0 2 * * * ~/scripts/neuralmind-scheduler.sh
Running on Multiple Projects
Master Configuration File
Create ~/.neuralmind-scheduler.yaml (or %APPDATA%\neuralmind-scheduler.yaml on Windows):
projects:
- name: video_toolkit
path: C:\Users\dtfro\claudecode\video_toolkit
schedule: "0 2 * * *" # 2 AM daily
commands:
- wakeup
- audit export
- query: "How does the cost tracking work?"
- name: neuralmind
path: C:\Users\dtfro\claudecode\neuralmind
schedule: "0 3 * * *" # 3 AM daily
commands:
- wakeup
- audit export
- search: "CostTracker"
- name: ibkr-traderbot
path: C:\Users\dtfro\claudecode\ibkr-traderbot
schedule: "0 4 * * 0" # 4 AM on Sundays
commands:
- wakeup
logging:
directory: C:\Users\dtfro\Documents\neuralmind-logs
retention_days: 30
Then use a script to read this config and schedule tasks (PowerShell pseudocode):
# Read YAML, loop through projects, register tasks
# (Implementation would require a YAML parser)
Auto-Discovery of Projects (Recommended)
Instead of manually maintaining a config file, use a master discovery script that automatically finds all projects in a root directory that have been initialized with NeuralMind (those with neuralmind.db/ or .neuralmind/).
PowerShell: C:\scripts\run-neuralmind-all.ps1
# ============================================================
# NeuralMind Master Scheduler - Auto-Discovery
# Finds all initialized projects and runs audit suite
# ============================================================
param(
[string]$RootPath = "$env:USERPROFILE\claudecode",
[string]$LogDir = "$env:USERPROFILE\Documents\neuralmind-logs",
[int]$MaxDegreeOfParallelism = 2
)
# Validate root path
if (!(Test-Path $RootPath)) {
Write-Error "Root path does not exist: $RootPath"
exit 1
}
# Ensure log directory exists
if (!(Test-Path $LogDir)) {
New-Item -ItemType Directory -Path $LogDir | Out-Null
}
$masterLogFile = "$LogDir\master_run_$(Get-Date -Format 'yyyy-MM-dd_HHmmss').log"
function Log {
param([string]$Message)
$msg = "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] $Message"
Write-Host $msg
Add-Content -Path $masterLogFile -Value $msg
}
Log "=== NeuralMind Auto-Discovery Started at $RootPath ==="
# Find all projects with NeuralMind index
$projects = Get-ChildItem -Path $RootPath -Directory | Where-Object {
(Test-Path (Join-Path $_.FullName "neuralmind.db")) -or
(Test-Path (Join-Path $_.FullName ".neuralmind"))
} | Select-Object -ExpandProperty FullName
if ($projects.Count -eq 0) {
Log "No initialized NeuralMind projects found in $RootPath"
Log "Initialize a project with: neuralmind build ."
exit 0
}
Log "Found $($projects.Count) initialized project(s)"
# Run audit on each project
foreach ($projectPath in $projects) {
$projectName = Split-Path $projectPath -Leaf
$projectLog = "$LogDir\$(Get-Date -Format 'yyyy-MM-dd_HHmmss')_$projectName.log"
Log "Processing: $projectName"
try {
Push-Location $projectPath
# A native command's non-zero exit doesn't trigger catch, and the next
# command overwrites $LASTEXITCODE, so check it after every step.
# Run wakeup
neuralmind wakeup . 2>&1 | Tee-Object -FilePath $projectLog -Append | ForEach-Object { Log $_ }
if ($LASTEXITCODE -ne 0) { throw "wakeup failed (exit $LASTEXITCODE)" }
# Export the audit log and check its hash chain
$timestamp = Get-Date -Format "yyyy-MM-dd_HHmmss"
$auditJsonl = "$LogDir\audit_${projectName}_$timestamp.jsonl"
neuralmind audit export . --format jsonl -o $auditJsonl 2>&1 | Tee-Object -FilePath $projectLog -Append | ForEach-Object { Log $_ }
if ($LASTEXITCODE -ne 0) { throw "audit export failed (exit $LASTEXITCODE)" }
neuralmind audit verify . 2>&1 | Tee-Object -FilePath $projectLog -Append | ForEach-Object { Log $_ }
if ($LASTEXITCODE -ne 0) { throw "audit verify failed (exit $LASTEXITCODE)" }
Log "✓ Completed: $projectName"
} catch {
Log "✗ Error on $projectName : $_"
} finally {
Pop-Location
}
}
Log "=== Auto-Discovery Complete ==="
Log "Master log: $masterLogFile"
Log "Individual logs and reports in: $LogDir"
Setup: Register this script to run once daily:
# Run PowerShell as Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Register task - runs daily at 2 AM, discovers all projects automatically
$trigger = New-ScheduledTaskTrigger -Daily -At 2:00am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind-all.ps1"
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -RunOnlyIfNetworkAvailable
Register-ScheduledTask -TaskName "NeuralMind Suite - Auto-Discovery" -Trigger $trigger -Action $action -Settings $settings -RunLevel Highest -Description "Daily NeuralMind audit for all initialized projects"
How it works:
- Scans
C:\Users\dtfro\claudecodefor all subdirectories - Identifies projects that have been initialized with NeuralMind (have
neuralmind.db/) - Runs wakeup, audit export, and audit verify on each project
- Logs all output to
Documents\neuralmind-logs\ - No manual task updates needed — new projects are picked up automatically
Bash equivalent for Linux/macOS:
#!/bin/bash
# /home/user/scripts/neuralmind-auto-discovery.sh
ROOT_PATH="${1:-$HOME/projects}"
LOG_DIR="${2:-$HOME/neuralmind-logs}"
mkdir -p "$LOG_DIR"
MASTER_LOG="$LOG_DIR/master_$(date +%Y-%m-%d_%H%M%S).log"
log() {
msg="[$(date '+%Y-%m-%d %H:%M:%S')] $1"
echo "$msg" | tee -a "$MASTER_LOG"
}
log "=== NeuralMind Auto-Discovery Started at $ROOT_PATH ==="
projects=()
while IFS= read -r -d '' project_dir; do
projects+=("$project_dir")
done < <(find "$ROOT_PATH" -maxdepth 1 -type d -exec test -e "{}/.neuralmind" -o -e "{}/neuralmind.db" \; -print0)
if [ ${#projects[@]} -eq 0 ]; then
log "No initialized NeuralMind projects found in $ROOT_PATH"
exit 0
fi
log "Found ${#projects[@]} initialized project(s)"
for project_path in "${projects[@]}"; do
project_name=$(basename "$project_path")
project_log="$LOG_DIR/$(date +%Y-%m-%d_%H%M%S)_${project_name}.log"
log "Processing: $project_name"
# Chain with && so a failing step, such as `audit verify` finding a broken
# hash chain, reaches the || below. (`set -e` is ignored inside a subshell
# on the left of ||.)
(
cd "$project_path" &&
neuralmind wakeup . >> "$project_log" 2>&1 &&
timestamp=$(date +%Y-%m-%d_%H%M%S) &&
neuralmind audit export . --format jsonl -o "$LOG_DIR/audit_${project_name}_$timestamp.jsonl" >> "$project_log" 2>&1 &&
neuralmind audit verify . >> "$project_log" 2>&1 &&
log "✓ Completed: $project_name"
) || log "✗ Error on $project_name"
done
log "=== Auto-Discovery Complete ==="
Add to crontab:
crontab -e
# Add: 0 2 * * * /home/user/scripts/neuralmind-auto-discovery.sh $HOME/claudecode
Scheduling Cloud Repos + Local Projects
For cloud repositories (GitHub, GitLab, etc.), use a cloud sync script that clones/updates repos before auto-discovery runs:
Daily Schedule:
- 1:00 AM — Cloud sync: clone/update repos from GitHub
- 2:00 AM — Auto-discovery: audit all projects (local + synced cloud repos)
Cloud Sync Script (Windows)
Save to C:\scripts\sync-and-audit-cloud-repos.ps1:
# ============================================================
# NeuralMind Cloud Repo Sync
# Clones/updates cloud repos before auto-discovery audits them
# ============================================================
param(
[string]$LocalDir = "$env:USERPROFILE\claudecode",
[string]$LogDir = "$env:USERPROFILE\Documents\neuralmind-logs"
)
$repos = @(
@{ url = "https://github.com/yourname/cloud-repo-1.git"; name = "cloud-repo-1" },
@{ url = "https://github.com/yourname/cloud-repo-2.git"; name = "cloud-repo-2" }
)
if (!(Test-Path $LogDir)) {
New-Item -ItemType Directory -Path $LogDir | Out-Null
}
$logFile = "$LogDir\sync_$(Get-Date -Format 'yyyy-MM-dd_HHmmss').log"
function Log {
param([string]$Message)
$msg = "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] $Message"
Write-Host $msg
Add-Content -Path $logFile -Value $msg
}
Log "=== Cloud Repo Sync Started ==="
foreach ($repo in $repos) {
$repoPath = Join-Path $LocalDir $repo.name
try {
if (Test-Path $repoPath) {
Log "Updating $($repo.name)..."
cd $repoPath
git pull 2>&1 | ForEach-Object { Log $_ }
} else {
Log "Cloning $($repo.name)..."
cd $LocalDir
git clone $repo.url 2>&1 | ForEach-Object { Log $_ }
cd $repoPath
}
# Build index if needed
if (!(Test-Path ".neuralmind") -and !(Test-Path "neuralmind.db")) {
Log "Building NeuralMind index for $($repo.name)..."
graphify build 2>&1 | ForEach-Object { Log $_ }
neuralmind build . 2>&1 | ForEach-Object { Log $_ }
}
Log "✓ Ready: $($repo.name)"
} catch {
Log "✗ Error on $($repo.name): $_"
}
}
Log "=== Sync Complete ==="
Log "Audit will run at 2 AM with auto-discovery"
Register the sync task (in Administrator PowerShell):
$trigger = New-ScheduledTaskTrigger -Daily -At 1:00am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\sync-and-audit-cloud-repos.ps1"
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable
Register-ScheduledTask -TaskName "NeuralMind Cloud Sync" -Trigger $trigger -Action $action -Settings $settings -RunLevel Highest
To add more cloud repos, edit the $repos array in the script:
$repos = @(
@{ url = "https://github.com/yourname/cloud-repo-1.git"; name = "cloud-repo-1" },
@{ url = "https://github.com/yourname/cloud-repo-2.git"; name = "cloud-repo-2" },
@{ url = "https://github.com/yourorg/another-repo.git"; name = "another-repo" }
)
Examples
Schedule for Single Project
Video_toolkit, Windows, daily at 2 AM:
# Save this as C:\scripts\video_toolkit_audit.ps1
$projectPath = "C:\Users\dtfro\claudecode\video_toolkit"
cd $projectPath
neuralmind wakeup .
neuralmind audit export . --format jsonl -o "$env:USERPROFILE\Documents\neuralmind-audit-$(Get-Date -Format 'yyyyMMdd').jsonl"
Register:
$trigger = New-ScheduledTaskTrigger -Daily -At 2am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\scripts\video_toolkit_audit.ps1"
Register-ScheduledTask -TaskName "NeuralMind - video_toolkit" -Trigger $trigger -Action $action -RunLevel Highest
Schedule for Multiple Projects
All projects, Windows, staggered times:
# video_toolkit at 2 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 2:00am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind.ps1 -ProjectPath 'C:\Users\dtfro\claudecode\video_toolkit'"
Register-ScheduledTask -TaskName "NeuralMind - video_toolkit" -Trigger $trigger -Action $action -RunLevel Highest
# neuralmind at 3 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 3:00am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind.ps1 -ProjectPath 'C:\Users\dtfro\claudecode\neuralmind'"
Register-ScheduledTask -TaskName "NeuralMind - neuralmind" -Trigger $trigger -Action $action -RunLevel Highest
# ibkr-traderbot at 4 AM
$trigger = New-ScheduledTaskTrigger -Daily -At 4:00am
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\scripts\run-neuralmind.ps1 -ProjectPath 'C:\Users\dtfro\claudecode\ibkr-traderbot'"
Register-ScheduledTask -TaskName "NeuralMind - ibkr-traderbot" -Trigger $trigger -Action $action -RunLevel Highest
Monitoring & Logs
Log Locations
Windows:
%USERPROFILE%\Documents\neuralmind-logs\
Linux/macOS:
~/neuralmind-logs/
Viewing Logs
Windows PowerShell:
# See all recent runs
Get-ChildItem $env:USERPROFILE\Documents\neuralmind-logs | Sort-Object LastWriteTime -Descending | Select-Object -First 10
# Tail a log (streaming)
Get-Content -Path "$env:USERPROFILE\Documents\neuralmind-logs\latest.log" -Wait
Linux/macOS:
# See all recent runs
ls -lt ~/neuralmind-logs | head
# Tail a log
tail -f ~/neuralmind-logs/latest.log
Setting Up Log Rotation
Windows PowerShell (add to script):
$logDir = "$env:USERPROFILE\Documents\neuralmind-logs"
$cutoffDate = (Get-Date).AddDays(-30)
Get-ChildItem $logDir | Where-Object { $_.LastWriteTime -lt $cutoffDate } | Remove-Item
Linux (crontab):
# Delete logs older than 30 days, weekly
0 0 * * 0 find ~/neuralmind-logs -mtime +30 -delete
Next Steps
- Choose your platform (Windows Task Scheduler, GitHub Actions, or Cron)
- Set up the script for your project path(s)
- Test manually before scheduling
- Monitor logs and adjust schedule as needed
- For compliance: store audit reports in a permanent location
See Integration Guide for MCP and CI/CD details.