Never Lose Coding Progress Again: How I Built a Hybrid Auto-Logger for VS Code

A simple, offline-first script that auto-documents your coding sessions — per project and per file — so you never lose context or work again.
Published: September 5, 2025 | By Tracy Rivas
VSCode Productivity Automation DevJournal Beginners macOS Scripting

Introduction

I was debugging for hours… then my Mac froze. All that work — gone.
That moment has haunted me more than once.

We've all been there:

  • You're deep in the zone, refactoring a complex function.
  • Your internet cuts out mid-push.
  • Your laptop kernel panics.
  • Or worse — you just forget what you did yesterday.

And when you come back?
You're staring at code like, "Wait… why did I change this?"

GitHub Copilot doesn't remember.
Your brain is foggy.
And git log only tells part of the story.

So I built a hybrid auto-logger that silently documents:

  • ✅ What project I'm working on
  • ✅ Which file I'm editing
  • ✅ How long I've been active
  • ✅ All without internet, and even if my Mac dies

And best of all? It runs in the background — zero effort required.

Let me show you how.


💡 The Problem: We Code, But We Don't Document

We use AI. We commit code. But we rarely capture the process.

We jump between files, tweak logic, debug edge cases — but unless we write notes or commit with good messages, that context vanishes.

And if your machine fails? Good luck reconstructing a full day of work.

What if my editor could quietly journal my progress — automatically?

🛠️ The Solution: A Silent Dev Logger for VS Code (macOS)

I built a lightweight script that:

  • Runs every 10 minutes via cron
  • Logs project-wide activity
  • Detects your active file in VS Code using AppleScript
  • Writes clean, readable logs to .devlogs/
  • Works 100% offline

No internet? No problem.
Mac dies? I can recover my workflow.
Back from vacation? I can pick up right where I left off.

It's like a black box for developers.


📁 How It Works

The system uses:

  • A Bash script (runs quietly)
  • Cron (scheduling)
  • AppleScript (to read VS Code's active file)
  • Simple Markdown-style logs

Folder Structure

my-project/
├── .devlogs/
│   ├── project.log        # Overall progress
│   ├── auth.js.devlog    # File-specific log
│   └── cron.log          # Script logs
├── hybrid-devlog.sh      # The magic script
└── …

📝 Sample Logs

project.log — Your Daily Pulse

2025-04-05
⏱️ 09:15:00: Session started
⏱️ 09:25:00: Still working…
⏱️ 09:35:00: Still working…

auth.js.devlog — Deep Work on One File

Dev Log: auth.js
2025-04-05
09:15: Active edit session
09:25: Added JWT token refresh logic

These logs act like a time machine for your development process.


🚀 Step-by-Step: Set It Up in 5 Minutes

1. Create the Script

touch hybrid-devlog.sh
chmod +x hybrid-devlog.sh
code hybrid-devlog.sh

2. Paste This Script

#!/bin/bash

# === CONFIGURATION ===
PROJECT_DIR="/your/project/path" # ← CHANGE THIS
PROJECT_NAME="My Project"
LOGS_DIR="$PROJECT_DIR/.devlogs"
PROJECT_LOG="$LOGS_DIR/project.log"
DATE=$(date +"%Y-%m-%d")
TIME=$(date +"%H:%M:%S")
TIMESTAMP="[$DATE $TIME]"

mkdir -p "$LOGS_DIR"

# === PER-PROJECT LOG ===
if [ ! -f "$PROJECT_LOG" ]; then
  echo "# Development Log for '$PROJECT_NAME'" > "$PROJECT_LOG"
  echo "" >> "$PROJECT_LOG"
fi

if ! grep -q "## $DATE" "$PROJECT_LOG"; then
  echo "" >> "$PROJECT_LOG"
  echo "## $DATE" >> "$PROJECT_LOG"
  echo "- ⏱️ $TIME: Session started" >> "$PROJECT_LOG"
else
  LAST_LINE=$(tail -n 1 "$PROJECT_LOG" | sed 's/.$//')
  if [[ "$LAST_LINE" == "- ⏱️ " ]]; then
    sed -i '' '$d' "$PROJECT_LOG"
    echo "${LAST_LINE}.." >> "$PROJECT_LOG"
  else
    echo "- ⏱️ $TIME: Still working…" >> "$PROJECT_LOG"
  fi
fi

# === PER-FILE LOG ===
FRONT_APP=$(osascript -e 'tell application "System Events" to get name of first application process whose frontmost is true')

if [[ "$FRONT_APP" == "Code" || "$FRONT_APP" == "Visual Studio Code" ]]; then
  FILENAME=$(osascript -e '
tell application "Visual Studio Code"
try
return name of active document of front window
on error
return "untitled"
end try
end tell
' 2>/dev/null)

  if [ ! -z "$FILENAME" ] && [ "$FILENAME" != "untitled" ]; then
    FILE_LOG="$LOGS_DIR/${FILENAME//\//_}.devlog"

    if [ ! -f "$FILE_LOG" ]; then
      echo "# Dev Log: $FILENAME" > "$FILE_LOG"
      echo "" >> "$FILE_LOG"
      echo "## $DATE" >> "$FILE_LOG"
    fi

    if ! grep -q "## $DATE" "$FILE_LOG"; then
      echo "" >> "$FILE_LOG"
      echo "## $DATE" >> "$FILE_LOG"
    fi

    echo "- $TIME: Active edit session" >> "$FILE_LOG"
  fi
fi

echo "$TIMESTAMP Hybrid devlog updated"

# 🔁 Don't forget to update PROJECT_DIR!

3. Grant Permissions

Go to:
System Settings > Privacy & Security > Automation
Allow your terminal (e.g. Terminal, iTerm) to control Visual Studio Code.

4. Schedule with Cron

crontab -e

Add:

*/10 * * * * /bin/bash /your/project/path/hybrid-devlog.sh >> /your/project/path/.devlogs/cron.log 2>&1

That's it! It now runs every 10 minutes.


🎯 Why This Matters

This isn't just about logging — it's about preserving context.

  • ✅ Recover from crashes with confidence
  • ✅ Document your process without effort
  • ✅ Reflect on where you spend time
  • ✅ Show progress in standups or portfolios
  • ✅ Never lose a day's work again

It's the closest thing to a developer memory extender.


🔄 What's Next?

I'm extending this to:

  • Auto-commit with smart messages
  • Generate weekly reports
  • Sync logs to Obsidian or Notion
  • Detect idle time and pause logging

And yes — I'll open-source it soon.


💬 Your Turn

Have you lost hours of work to a crash or bad connection?

Try this system. Tweak it. Make it yours.

And if you do — let me know in the comments. I'd love to hear how you're using it.

Because coding isn't just about the code.
It's about the journey.

And now, I finally have a map.


🔗 Resources


Like this?
Follow me for more dev tools, automation hacks, and ways to code smarter — not harder.

#vscode #productivity #automation #devjournal #beginners #macos #scripting #git #developerexperience

🚀 Share This Article

Help other developers never lose coding progress again! Share this auto-logger solution for VS Code:

About the Author

Tracy Rivas is an experienced IT leader and cloud architect specializing in enterprise technology strategy, digital transformation, and team leadership. With expertise spanning cloud engineering, cybersecurity, and organizational development, Tracy shares practical insights to help modern IT professionals navigate complex technology landscapes with efficiency and strategic clarity.