feat(windsurf): add chat history archive auto-refresh tooling

- refresh.sh: idempotent script, auto-discovers repos, updates symlinks + copies docs/workflows
- launchd plist: scheduled daily at 11 PM + on login
- /refresh-chat-history workflow for on-demand Cascade runs
- README updated with auto-refresh docs and full data inventory
- Repo docs and workflows refreshed from all 4 repos
This commit is contained in:
saravanakumardb1 2026-02-28 00:02:04 -08:00
parent c1a1f86cd6
commit a32978f9c3
13 changed files with 419 additions and 12 deletions

View File

@ -0,0 +1,53 @@
---
description: Refresh the Windsurf chat history archive (re-scan all repos, update symlinks, copy docs/workflows)
---
# Refresh Windsurf Chat History Archive
Refreshes the centralized Windsurf chat history archive at `__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/`.
Auto-discovers new repos, updates symlinks, and re-copies docs + workflows.
## Steps
// turbo
1. Run the refresh script:
```bash
/Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/refresh.sh
```
2. Check the refresh log:
```bash
cat /Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log
```
3. Verify symlinks are valid:
```bash
ls -la /Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/ | grep "^l"
```
## Notes
- The script is **idempotent** — safe to run any number of times.
- It auto-discovers repos under `/Users/sd9235/code/mygh/` that have `docs/WINDSURF/` or `.windsurf/workflows/`.
- A **launchd job** runs this daily at 11 PM: `~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist`.
- Logs: `.last-refresh.log` (stats), `.launchd-stdout.log` / `.launchd-stderr.log` (scheduled run output).
## Manage the scheduled job
```bash
# Check if running
launchctl list | grep windsurf-archive
# Stop
launchctl unload ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
# Start
launchctl load ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
# Force run now
launchctl start com.sd9235.windsurf-archive-refresh
```

View File

@ -1 +1,14 @@
APPS/
.venv/
# Local logs
oss_llm/testNanoGPT/last_run.log
# nanoGPT is cloned by scripts; don't vendor it here
oss_llm/nanoGPT/
# Training artifacts (avoid accidentally committing weights/data bins)
oss_llm/**/out-*/
oss_llm/**/data/**/train.bin
oss_llm/**/data/**/val.bin
oss_llm/**/data/**/meta.pkl

View File

@ -0,0 +1,9 @@
Last refresh: 2026-02-28T07:00:06Z (2026-02-27 23:00:06 PST)
Cascade conversations: 50 (530M)
Memories: 43
Implicit context: 20
Code tracker dirs: 163
File edit history: 1789 entries
Workspace storage: 28 workspaces
Repo docs: 13 files across 3 repos
Repo workflows: 23 files across 4 repos

View File

@ -200,9 +200,62 @@ Copies of `.windsurf/workflows/` (Cascade slash-command definitions) from each r
---
## Auto-Refresh
This archive stays up to date automatically via three mechanisms:
### 1. Scheduled (launchd — daily at 11 PM)
A macOS LaunchAgent runs `refresh.sh --quiet` every night at 11 PM.
```bash
# Check status
launchctl list | grep windsurf-archive
# Force run now
launchctl start com.sd9235.windsurf-archive-refresh
# Stop / Start
launchctl unload ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
launchctl load ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
```
Plist: `~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist`
Source: `./com.sd9235.windsurf-archive-refresh.plist` (copy kept here)
### 2. Manual (CLI)
```bash
./refresh.sh # normal (verbose)
./refresh.sh --quiet # suppress output
./refresh.sh --dry-run # preview without changes
```
### 3. Windsurf workflow (`/refresh-chat-history`)
Run `/refresh-chat-history` in any Windsurf Cascade conversation.
### What refresh does
- Re-creates all symlinks (idempotent)
- **Auto-discovers new repos** under `/Users/sd9235/code/mygh/` that have `docs/WINDSURF/` or `.windsurf/workflows/`
- Re-copies all repo docs and workflows
- Cleans up stale entries for removed repos
- Writes stats to `.last-refresh.log`
### Logs
| File | Contents |
| --------------------- | ---------------------------------------------- |
| `.last-refresh.log` | Stats from last run (counts, sizes, timestamp) |
| `.launchd-stdout.log` | stdout from scheduled runs |
| `.launchd-stderr.log` | stderr from scheduled runs |
---
## Notes
- **Protobuf files** (`.pb`) are binary — not human-readable. They require protobuf deserialization tooling to inspect.
- **Symlinks** point to live data. Changes in the source are immediately visible here.
- **Repo docs/workflows** are copies (not symlinks) — they won't auto-update when the originals change. Re-run the copy commands to refresh.
- **Repo docs/workflows** are copies (not symlinks) — run `./refresh.sh` to update them after changes.
- Created: 2026-02-27

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sd9235.windsurf-archive-refresh</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>/Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/refresh.sh</string>
<string>--quiet</string>
</array>
<!-- Run daily at 11:00 PM -->
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<!-- Also run on load (catch up if machine was off) -->
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.launchd-stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.launchd-stderr.log</string>
</dict>
</plist>

View File

@ -0,0 +1,186 @@
#!/bin/zsh
# refresh.sh — Auto-discover and refresh Windsurf chat history archive
# Safe to run repeatedly (idempotent). Discovers new repos automatically.
#
# Usage:
# ./refresh.sh # normal run
# ./refresh.sh --quiet # suppress output (for scheduled runs)
# ./refresh.sh --dry-run # show what would happen without doing it
#
# Scheduled via: ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
# Manual via: Windsurf workflow /refresh-chat-history
set -eo pipefail
# ── Config ──────────────────────────────────────────────────────────────────
ARCHIVE_DIR="$(cd "$(dirname "$0")" && pwd)"
REPOS_ROOT="/Users/sd9235/code/mygh"
CODEIUM_DIR="$HOME/.codeium/windsurf"
APP_SUPPORT_DIR="$HOME/Library/Application Support/Windsurf"
LOG_FILE="$ARCHIVE_DIR/.last-refresh.log"
QUIET=false
DRY_RUN=false
for arg in "$@"; do
case "$arg" in
--quiet) QUIET=true ;;
--dry-run) DRY_RUN=true ;;
esac
done
log() {
if [ "$QUIET" = false ]; then
echo "$1"
fi
}
run() {
if [ "$DRY_RUN" = true ]; then
log "[dry-run] $*"
else
"$@"
fi
}
STATS_CASCADE=0
STATS_MEMORIES=0
STATS_IMPLICIT=0
STATS_REPOS_DOCS=0
STATS_REPOS_WORKFLOWS=0
STATS_NEW_REPOS=0
# ── 1. Codeium data symlinks ───────────────────────────────────────────────
log "=== Refreshing Codeium data symlinks ==="
link_if_exists() {
local name="$1" target="$2"
if [ -d "$target" ] || [ -f "$target" ]; then
run ln -sfn "$target" "$ARCHIVE_DIR/$name"
log "$name$target"
else
log "$name: target not found ($target)"
fi
}
link_if_exists "cascade_conversations" "$CODEIUM_DIR/cascade"
link_if_exists "memories" "$CODEIUM_DIR/memories"
link_if_exists "implicit_context" "$CODEIUM_DIR/implicit"
link_if_exists "code_tracker" "$CODEIUM_DIR/code_tracker"
link_if_exists "codemaps" "$CODEIUM_DIR/codemaps"
link_if_exists "database" "$CODEIUM_DIR/database"
# Single files
for file in user_settings.pb installation_id; do
if [ -e "$CODEIUM_DIR/$file" ]; then
run ln -sfn "$CODEIUM_DIR/$file" "$ARCHIVE_DIR/$file"
log "$file"
fi
done
# ── 2. App Support symlinks ────────────────────────────────────────────────
log "=== Refreshing App Support symlinks ==="
run ln -sfn "$APP_SUPPORT_DIR" "$ARCHIVE_DIR/app_data"
log " ✓ app_data"
if [ -d "$APP_SUPPORT_DIR/User/History" ]; then
run ln -sfn "$APP_SUPPORT_DIR/User/History" "$ARCHIVE_DIR/file_edit_history"
log " ✓ file_edit_history"
fi
if [ -d "$APP_SUPPORT_DIR/User/workspaceStorage" ]; then
run ln -sfn "$APP_SUPPORT_DIR/User/workspaceStorage" "$ARCHIVE_DIR/workspace_storage"
log " ✓ workspace_storage"
fi
if [ -d "$APP_SUPPORT_DIR/User/globalStorage" ]; then
run ln -sfn "$APP_SUPPORT_DIR/User/globalStorage" "$ARCHIVE_DIR/global_storage"
log " ✓ global_storage"
fi
# ── 3. Auto-discover repos and copy docs/workflows ────────────────────────
log "=== Scanning repos for docs/WINDSURF and .windsurf/workflows ==="
run mkdir -p "$ARCHIVE_DIR/repo_docs"
run mkdir -p "$ARCHIVE_DIR/repo_workflows"
for repo_path in "$REPOS_ROOT"/*/; do
repo_name="$(basename "$repo_path")"
# Copy docs/WINDSURF/ if it exists
if [ -d "$repo_path/docs/WINDSURF" ] && [ "$(ls -A "$repo_path/docs/WINDSURF" 2>/dev/null)" ]; then
run mkdir -p "$ARCHIVE_DIR/repo_docs/$repo_name"
run cp -a "$repo_path/docs/WINDSURF/"* "$ARCHIVE_DIR/repo_docs/$repo_name/"
count=$(ls -1 "$repo_path/docs/WINDSURF/" 2>/dev/null | wc -l | tr -d ' ')
log " ✓ repo_docs/$repo_name ($count files)"
STATS_REPOS_DOCS=$((STATS_REPOS_DOCS + count))
fi
# Copy .windsurf/workflows/ if it exists
if [ -d "$repo_path/.windsurf/workflows" ] && [ "$(ls -A "$repo_path/.windsurf/workflows" 2>/dev/null)" ]; then
run mkdir -p "$ARCHIVE_DIR/repo_workflows/$repo_name"
run cp -a "$repo_path/.windsurf/workflows/"* "$ARCHIVE_DIR/repo_workflows/$repo_name/"
count=$(ls -1 "$repo_path/.windsurf/workflows/" 2>/dev/null | wc -l | tr -d ' ')
log " ✓ repo_workflows/$repo_name ($count workflows)"
STATS_REPOS_WORKFLOWS=$((STATS_REPOS_WORKFLOWS + count))
fi
done
# Clean up repo_docs/repo_workflows dirs for repos that no longer have content
for dir in "$ARCHIVE_DIR/repo_docs"/*/; do
[ -d "$dir" ] || continue
repo_name="$(basename "$dir")"
if [ ! -d "$REPOS_ROOT/$repo_name/docs/WINDSURF" ]; then
log " 🗑 Removing stale repo_docs/$repo_name"
[ "$DRY_RUN" = false ] && rm -rf "$dir"
fi
done
for dir in "$ARCHIVE_DIR/repo_workflows"/*/; do
[ -d "$dir" ] || continue
repo_name="$(basename "$dir")"
if [ ! -d "$REPOS_ROOT/$repo_name/.windsurf/workflows" ]; then
log " 🗑 Removing stale repo_workflows/$repo_name"
[ "$DRY_RUN" = false ] && rm -rf "$dir"
fi
done
# ── 4. Gather stats ───────────────────────────────────────────────────────
if [ "$DRY_RUN" = false ]; then
STATS_CASCADE=$(ls -1 "$CODEIUM_DIR/cascade/"*.pb 2>/dev/null | wc -l | tr -d ' ')
STATS_MEMORIES=$(ls -1 "$CODEIUM_DIR/memories/"*.pb 2>/dev/null | wc -l | tr -d ' ')
STATS_IMPLICIT=$(ls -1 "$CODEIUM_DIR/implicit/"*.pb 2>/dev/null | wc -l | tr -d ' ')
CASCADE_SIZE=$(du -sh "$CODEIUM_DIR/cascade/" 2>/dev/null | cut -f1 | tr -d ' ')
TRACKER_DIRS=$(ls -1 "$CODEIUM_DIR/code_tracker/active/" 2>/dev/null | wc -l | tr -d ' ')
HISTORY_DIRS=$(ls -1 "$APP_SUPPORT_DIR/User/History/" 2>/dev/null | wc -l | tr -d ' ')
WORKSPACE_DIRS=$(ls -1 "$APP_SUPPORT_DIR/User/workspaceStorage/" 2>/dev/null | wc -l | tr -d ' ')
REPO_DOC_REPOS=$(ls -1 "$ARCHIVE_DIR/repo_docs/" 2>/dev/null | wc -l | tr -d ' ')
REPO_WF_REPOS=$(ls -1 "$ARCHIVE_DIR/repo_workflows/" 2>/dev/null | wc -l | tr -d ' ')
fi
# ── 5. Write refresh log ──────────────────────────────────────────────────
if [ "$DRY_RUN" = false ]; then
cat > "$LOG_FILE" <<EOF
Last refresh: $(date -u '+%Y-%m-%dT%H:%M:%SZ') ($(date '+%Y-%m-%d %H:%M:%S %Z'))
Cascade conversations: $STATS_CASCADE ($CASCADE_SIZE)
Memories: $STATS_MEMORIES
Implicit context: $STATS_IMPLICIT
Code tracker dirs: $TRACKER_DIRS
File edit history: $HISTORY_DIRS entries
Workspace storage: $WORKSPACE_DIRS workspaces
Repo docs: $STATS_REPOS_DOCS files across $REPO_DOC_REPOS repos
Repo workflows: $STATS_REPOS_WORKFLOWS files across $REPO_WF_REPOS repos
EOF
fi
# ── 6. Summary ────────────────────────────────────────────────────────────
log ""
log "=== Refresh complete ==="
if [ "$DRY_RUN" = false ]; then
log " Cascade conversations: $STATS_CASCADE ($CASCADE_SIZE)"
log " Memories: $STATS_MEMORIES"
log " Implicit context: $STATS_IMPLICIT"
log " Code tracker: $TRACKER_DIRS dirs"
log " File edit history: $HISTORY_DIRS entries"
log " Repo docs: $STATS_REPOS_DOCS files ($REPO_DOC_REPOS repos)"
log " Repo workflows: $STATS_REPOS_WORKFLOWS files ($REPO_WF_REPOS repos)"
log ""
log " Log: $LOG_FILE"
fi

View File

@ -0,0 +1,53 @@
---
description: Refresh the Windsurf chat history archive (re-scan all repos, update symlinks, copy docs/workflows)
---
# Refresh Windsurf Chat History Archive
Refreshes the centralized Windsurf chat history archive at `__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/`.
Auto-discovers new repos, updates symlinks, and re-copies docs + workflows.
## Steps
// turbo
1. Run the refresh script:
```bash
/Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/refresh.sh
```
2. Check the refresh log:
```bash
cat /Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/.last-refresh.log
```
3. Verify symlinks are valid:
```bash
ls -la /Users/sd9235/code/mygh/learning_ai_common_plat/__LOCAL_LLMs/AI_IDE_CHAT_HISTORY/WINDSURF/ | grep "^l"
```
## Notes
- The script is **idempotent** — safe to run any number of times.
- It auto-discovers repos under `/Users/sd9235/code/mygh/` that have `docs/WINDSURF/` or `.windsurf/workflows/`.
- A **launchd job** runs this daily at 11 PM: `~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist`.
- Logs: `.last-refresh.log` (stats), `.launchd-stdout.log` / `.launchd-stderr.log` (scheduled run output).
## Manage the scheduled job
```bash
# Check if running
launchctl list | grep windsurf-archive
# Stop
launchctl unload ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
# Start
launchctl load ~/Library/LaunchAgents/com.sd9235.windsurf-archive-refresh.plist
# Force run now
launchctl start com.sd9235.windsurf-archive-refresh
```

View File

@ -18,7 +18,7 @@ Run `bash scripts/backup-main.sh` from any repository root
// turbo
```bash
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents; do
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents learning_ai_clock; do
echo "━━━ Pushing $repo ━━━"
(cd ~/code/mygh/$repo && git push origin main 2>&1)
done
@ -36,6 +36,7 @@ echo "✨ All repos pushed!"
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
## When to use:

View File

@ -22,6 +22,7 @@ Run `bash scripts/backup-main.sh` from any repository root
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
## Features:

View File

@ -12,10 +12,11 @@ Scans all repositories for pending changes and commits them in logical order wit
## What it does:
1. **Scans** all 3 repos for changes:
1. **Scans** all 4 repos for changes:
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
2. **Analyzes** changed files to determine:
- Commit scope (auth, ci, docs, feat, chore, etc.)

View File

@ -1,5 +1,5 @@
---
description: Push local main branch to origin for all 3 workspace repos
description: Push local main branch to origin for all 4 workspace repos
---
# Push Repos
@ -9,7 +9,7 @@ Pushes local `main` to `origin/main` for all workspace repositories.
// turbo
```bash
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents; do
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents learning_ai_clock; do
echo "━━━ $repo ━━━"
(cd ~/code/mygh/$repo && git push origin main)
done
@ -17,7 +17,7 @@ done
## What it does:
1. Iterates over all 3 workspace repos
1. Iterates over all 4 workspace repos
2. Runs `git push origin main` in each
3. Fails fast if a repo has diverged from remote (resolve with rebase manually)
@ -26,6 +26,7 @@ done
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
## When to use:

View File

@ -1,5 +1,5 @@
---
description: Pull latest from origin main across all workspace repos
description: Pull latest from origin main across all 4 workspace repos
---
# Sync Repos
@ -9,7 +9,7 @@ Pulls the latest changes from `origin/main` for all workspace repositories.
// turbo
```bash
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents; do
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents learning_ai_clock; do
echo "━━━ $repo ━━━"
(cd ~/code/mygh/$repo && git pull --ff-only origin main)
done
@ -17,7 +17,7 @@ done
## What it does:
1. Iterates over all 3 workspace repos
1. Iterates over all 4 workspace repos
2. Runs `git pull --ff-only origin main` in each
3. Fails fast if there are local divergent commits (use `git pull --rebase` manually in that case)
@ -26,6 +26,7 @@ done
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
## When to use:

View File

@ -1,5 +1,5 @@
---
description: Push local main branch to origin for all 3 workspace repos
description: Push local main branch to origin for all 4 workspace repos
---
# Push Repos
@ -9,7 +9,7 @@ Pushes local `main` to `origin/main` for all workspace repositories.
// turbo
```bash
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents; do
for repo in learning_ai_common_plat learning_voice_ai_agent learning_multimodal_memory_agents learning_ai_clock; do
echo "━━━ $repo ━━━"
(cd ~/code/mygh/$repo && git push origin main)
done
@ -17,7 +17,7 @@ done
## What it does:
1. Iterates over all 3 workspace repos
1. Iterates over all 4 workspace repos
2. Runs `git push origin main` in each
3. Fails fast if a repo has diverged from remote (resolve with rebase manually)
@ -26,6 +26,7 @@ done
- learning_ai_common_plat
- learning_voice_ai_agent
- learning_multimodal_memory_agents
- learning_ai_clock
## When to use: