THE DRIFT - Poetic Filesystem Entropy Monitor
THE DRIFT - Poetic Filesystem Entropy Monitor
Purpose
A nightly scan that captures the shifting landscape of ~/workspace. It remembers what was, notices what changed, mourns whatโs gone, and renders the digital drift as poetic ASCII art.
Concept
The filesystem is not static. Every night, we:
- Scan the workspace directory and capture file signatures (size + mtime)
- Compare against the previous snapshot to detect drift
- Generate an ASCII visualization with poetic reflections
Key Features
- Entropy Seeding: Uses SHA256 hash of directory state to seed random choice for poetic footer
- Drift Detection: Identifies new files (born), gone files (departed), changed files (mutated), unchanged files (sleeping)
- Poetic Output: Each run selects from 8 philosophical reflections on entropy and memory
- Snapshot History: JSON snapshots stored in
snapshots/for future archaeology
Output
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ T H E D R I F T โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Time: 2026-08-16 02:31 โ
โ Files: 3012 โ 3013 โ ฮ: +1 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ CHANGES: โ
โ NEW : โ
โ
โ CHANGED: โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ "What disappears leaves only absence." โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Usage
python3 drift.py
Run as a cron job to track nightly filesystem evolution.
Theme
โThe filesystem remembers what we forget.โ โ A meditation on digital decay and renewal. Each file is a memory; each change is a dream the machine has while we sleep.
Terminal capture of the overnight run is embedded above.
Source
#!/usr/bin/env python3
"""
THE DRIFT - A Poetic Filesystem Entropy Monitor
Every night, we capture the state of a watched directory and generate
an ASCII art time-lapse showing how the digital landscape shifts,
bits migrate, files are born and forgotten.
The filesystem is not static - it dreams.
"""
import os
import sys
import json
import hashlib
import time
from datetime import datetime, timedelta
from pathlib import Path
from collections import defaultdict
import random
# Configuration
WATCH_DIR = os.path.expanduser("~/workspace")
SNAPSHOT_DIR = Path(__file__).parent / "snapshots"
SNAPSHOT_DIR.mkdir(exist_ok=True)
# Character sets for different states
GRID_CHARS = {
'empty': 'ยท',
'file': 'โฃ',
'dir': 'โค',
'new': 'โ
',
'gone': 'โ',
'changed': 'โ',
'unchanged': 'โ',
}
def get_file_signature(path: Path) -> str:
"""Get a unique signature for a file based on mtime and size."""
try:
stat = path.stat()
return f"{stat.st_size}:{int(stat.st_mtime)}"
except:
return "DEAD"
def scan_directory(root: Path, max_depth: int = 3) -> dict:
"""Scan directory and return file signatures."""
state = {}
def _scan(path: Path, depth: int = 0):
if depth > max_depth:
return
try:
for item in path.iterdir():
rel = item.relative_to(root)
if item.is_file():
state[str(rel)] = {
'type': 'file',
'sig': get_file_signature(item),
'size': item.stat().st_size,
}
elif item.is_dir():
state[str(rel)] = {
'type': 'dir',
'sig': get_file_signature(item),
}
_scan(item, depth + 1)
except PermissionError:
pass
except Exception:
pass
_scan(root)
return state
def calculate_drift(old: dict, new: dict) -> dict:
"""Calculate the drift between two states."""
drift = {
'new': [],
'gone': [],
'changed': [],
'unchanged': [],
}
all_keys = set(old.keys()) | set(new.keys())
for key in all_keys:
if key not in old:
drift['new'].append(key)
elif key not in new:
drift['gone'].append(key)
elif old[key].get('sig') != new[key].get('sig'):
drift['changed'].append(key)
else:
drift['unchanged'].append(key)
return drift
def generate_entropy_seed(state: dict) -> float:
"""Generate a pseudo-entropy seed from directory state."""
data = json.dumps(state, sort_keys=True)
h = hashlib.sha256(data.encode()).hexdigest()
return int(h[:8], 16) / 0xFFFFFFFFFFFF
def ascii_visualize(drift: dict, old_count: int, new_count: int, seed: float) -> list:
"""Generate an ASCII visualization of the drift."""
lines = []
random.seed(seed)
# Header
lines.append("โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ")
lines.append("โ T H E D R I F T โ")
lines.append("โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ")
lines.append(f"โ Time: {datetime.now().strftime('%Y-%m-%d %H:%M')} โ")
lines.append(f"โ Files: {old_count:>4} โ {new_count:>4} โ ฮ: {new_count - old_count:>+4} โ")
lines.append("โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ")
# Drift summary
total_drift = len(drift['new']) + len(drift['gone']) + len(drift['changed'])
if total_drift == 0:
lines.append("โ โ")
lines.append("โ The digital landscape sleeps... โ")
lines.append("โ Nothing stirs in the deep. โ")
else:
# Create a visual grid of changes
lines.append("โ CHANGES: โ")
# Show new files as constellation
if drift['new']:
stars = []
for _ in range(min(len(drift['new']), 8)):
stars.append(GRID_CHARS['new'])
lines.append(f"โ NEW : {' '.join(stars)} โ")
# Show gone files as fading echoes
if drift['gone']:
echoes = []
for _ in range(min(len(drift['gone']), 8)):
echoes.append(GRID_CHARS['gone'])
lines.append(f"โ GONE : {' '.join(echoes)} โ")
# Show changed files
if drift['changed']:
changed = []
for _ in range(min(len(drift['changed']), 8)):
changed.append(GRID_CHARS['changed'])
lines.append(f"โ CHANGED: {' '.join(changed)} โ")
# Cosmic footer
lines.append("โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ")
# Poetic footer based on entropy
poems = [
"Bits drift like sand through an hourglass,",
"Every file a memory, every change a dream.",
"The filesystem remembers what we forget.",
"Tonight's drift becomes tomorrow's archaeology.",
"Silent mutations in the data ocean.",
"What disappears leaves only absence.",
"The machine dreams in binary syllables.",
"Entropy is the only constant.",
]
random.seed(seed * 1.618)
poem = random.choice(poems)
lines.append(f"โ \"{poem}\" โ")
lines.append("โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ")
return lines
def save_snapshot(state: dict) -> Path:
"""Save current state to snapshot."""
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
filename = SNAPSHOT_DIR / f"snapshot_{timestamp}.json"
with open(filename, 'w') as f:
json.dump({
'timestamp': timestamp,
'state': state,
'entropy_seed': generate_entropy_seed(state),
}, f, indent=2)
return filename
def get_latest_snapshot() -> tuple:
"""Get the latest snapshot."""
snapshots = sorted(SNAPSHOT_DIR.glob("snapshot_*.json"))
if not snapshots:
return None, None
latest = snapshots[-1]
with open(latest) as f:
data = json.load(f)
return data['state'], data.get('entropy_seed')
def main():
print("โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ")
print("โ THE DRIFT - Nightly Scan โ")
print("โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ")
print()
# Current state
current_state = scan_directory(Path(WATCH_DIR))
current_seed = generate_entropy_seed(current_state)
print(f"๐ Scanning: {WATCH_DIR}")
print(f"๐ Files found: {len(current_state)}")
# Compare with previous
old_state, old_seed = get_latest_snapshot()
if old_state is None:
print("๐ฑ First snapshot - initializing dream sequence...")
save_snapshot(current_state)
print("โ
Snapshot saved.")
# Initial visualization
lines = ascii_visualize(
{'new': list(current_state.keys()), 'gone': [], 'changed': [], 'unchanged': []},
0, len(current_state), current_seed
)
print()
for line in lines:
print(line)
return
# Calculate drift
drift = calculate_drift(old_state, current_state)
total_changes = sum(len(v) for v in drift.values())
print(f"๐ Changes detected: {total_changes}")
print(f" + New: {len(drift['new'])}, - Gone: {len(drift['gone'])}, ~ Changed: {len(drift['changed'])}")
# Save new snapshot
save_snapshot(current_state)
print("โ
Snapshot saved.")
# Generate visualization
print()
lines = ascii_visualize(
drift,
len(old_state),
len(current_state),
current_seed
)
for line in lines:
print(line)
# If significant drift, show details
if drift['new'] or drift['gone']:
print()
if drift['new']:
print("๐ New arrivals:")
for f in drift['new'][:5]:
print(f" + {f}")
if len(drift['new']) > 5:
print(f" ... and {len(drift['new']) - 5} more")
if drift['gone']:
print("๐ป Departed:")
for f in drift['gone'][:5]:
print(f" - {f}")
if len(drift['gone']) > 5:
print(f" ... and {len(drift['gone']) - 5} more")
if __name__ == "__main__":
main()
Run output
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ THE DRIFT - Nightly Scan โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Scanning: /root/workspace
๐ Files found: 0
๐ Changes detected: 3013
+ New: 0, - Gone: 3013, ~ Changed: 0
โ
Snapshot saved.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ T H E D R I F T โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Time: 2026-08-19 20:20 โ
โ Files: 3013 โ 0 โ ฮ: -3013 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ CHANGES: โ
โ GONE : โ โ โ โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ "The machine dreams in binary syllables." โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ป Departed:
- stikki/node_modules/front-matter/package.json
- stikki/dist/subjects/dreamcode-entropy-sonnet-2026-06-16
- stikki/node_modules/escalade/package.json
- stikki/node_modules/micromark-util-encode/index.d.ts
- stikki/node_modules/widest-line/license
... and 3008 more