Compare commits

...

6 Commits

Author SHA1 Message Date
232af71450 [git] Fix hungryroot signing key 2026-09-21 11:54:31 -04:00
6f53c57412 [ssh] Use correct user for nfs 2026-09-17 19:16:18 -04:00
b75be3a199 [bin] Add asdf install script 2026-09-17 19:09:26 -04:00
d124921dfb [gitignore] some of claudes bin can be ignored 2026-09-17 13:44:27 -04:00
8a851413af [launchd] Sync Claude session state on macOS
Adds a launchd agent that runs the existing claude-save make target
every 30 minutes and at login, so macOS machines commit and push
session state the way the systemd timer does on Linux.

The agent runs through /bin/sh because launchd expands neither ~ nor
$HOME in ProgramArguments, and sets PATH explicitly because agents
inherit no shell environment. The claude target loads it via launchctl
bootstrap on darwin.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 11:37:30 -04:00
1b0f3ef4a5 [systemd] Restore claude-save timer and make targets
The claude and claude-save Makefile targets and both unit files were
dropped when master was rewound upstream, leaving only the enable
symlink in timers.target.wants pointing at a missing unit. The timer
kept firing every 30 minutes and failing with "No rule to make target
'claude-save'", so session state stopped syncing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 11:35:19 -04:00
8 changed files with 196 additions and 24 deletions

36
.gitignore vendored
View File

@ -44,28 +44,7 @@ fish/.config/fish/conf.d/gitnow_config.fish
fish/.config/fish/conf.d/z.fish
fish/.config/fish/functions/fish_mode_prompt.fish
fish/.config/fish/functions/tide.fish
fish/.config/fish/functions/tide/configure/choices/all/finish.fish
fish/.config/fish/functions/tide/configure/choices/all/icons.fish
fish/.config/fish/functions/tide/configure/choices/all/prompt_colors.fish
fish/.config/fish/functions/tide/configure/choices/all/prompt_connection.fish
fish/.config/fish/functions/tide/configure/choices/all/prompt_connection_andor_frame_color.fish
fish/.config/fish/functions/tide/configure/choices/all/prompt_spacing.fish
fish/.config/fish/functions/tide/configure/choices/all/show_time.fish
fish/.config/fish/functions/tide/configure/choices/all/style.fish
fish/.config/fish/functions/tide/configure/choices/classic/classic_prompt_color.fish
fish/.config/fish/functions/tide/configure/choices/classic/classic_prompt_separators.fish
fish/.config/fish/functions/tide/configure/choices/lean/lean_prompt_height.fish
fish/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_frame.fish
fish/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_heads.fish
fish/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_height.fish
fish/.config/fish/functions/tide/configure/choices/powerline/powerline_prompt_tails.fish
fish/.config/fish/functions/tide/configure/choices/rainbow/rainbow_prompt_separators.fish
fish/.config/fish/functions/tide/configure/configs/classic.fish
fish/.config/fish/functions/tide/configure/configs/classic_16color.fish
fish/.config/fish/functions/tide/configure/configs/lean.fish
fish/.config/fish/functions/tide/configure/configs/lean_16color.fish
fish/.config/fish/functions/tide/configure/configs/rainbow.fish
fish/.config/fish/functions/tide/configure/configs/rainbow_16color.fish
fish/.config/fish/functions/tide/*
_fake*
fish/.config/fish/conf.d/virtualfish-loader.fish
fish/.config/fish/functions/fzf_key_bindings.fish
@ -79,3 +58,16 @@ BingWallpaperAppUpdater1.1.3.app
/gnome/.local/share/karabiner/
/gnome/.local/share/atuin/
/gnome/.local/share/doom/
bin/.local/bin/dotenv
bin/.local/bin/fastapi
bin/.local/bin/httpx2
bin/.local/bin/markdown-it
bin/.local/bin/mcp
bin/.local/bin/monet
bin/.local/bin/py.test
bin/.local/bin/pygmentize
bin/.local/bin/pytest
bin/.local/bin/ruff
bin/.local/bin/typer
bin/.local/bin/uvicorn
bin/.local/bin/asdf

View File

@ -1,7 +1,13 @@
.PHONY: os stow deps
.PHONY: all os stow deps claude claude-save
OS_NAME := $(shell uname -s | tr A-Z a-z)
CLAUDE_HISTORY_REPO := git@git.service:secstate/claude-history
CLAUDE_HISTORY_DIR := $(HOME)/.claude-history
CLAUDE_HISTORY_PATHS := projects plans tasks history.jsonl
all: stow claude
stow:
mkdir -p ~/.gnupg && chmod 0700 ~/.gnupg
stow -t ~ */
@ -18,3 +24,43 @@ deps:
os:
@echo $(OS_NAME)
# Clone the private session-state repo and symlink it into ~/.claude so Claude
# Code resumes prior sessions. Sessions only match when the checkout path is
# identical to the one recorded in the project directory name.
claude:
@test -d $(CLAUDE_HISTORY_DIR) || git clone $(CLAUDE_HISTORY_REPO) $(CLAUDE_HISTORY_DIR)
@mkdir -p ~/.claude
@for p in $(CLAUDE_HISTORY_PATHS); do \
test -e $(CLAUDE_HISTORY_DIR)/$$p || continue; \
test -L ~/.claude/$$p && continue; \
if [ -e ~/.claude/$$p ]; then \
echo "claude: ~/.claude/$$p exists and is not a symlink, leaving it alone"; \
continue; \
fi; \
ln -s $(CLAUDE_HISTORY_DIR)/$$p ~/.claude/$$p; \
echo "claude: linked $$p"; \
done
@if [ $(OS_NAME) = "linux" ]; then \
systemctl --user daemon-reload && \
systemctl --user enable --now claude-save.timer; \
fi
@if [ $(OS_NAME) = "darwin" ]; then \
launchctl bootout gui/$$(id -u)/com.powellc.claude-save 2>/dev/null; \
launchctl bootstrap gui/$$(id -u) ~/Library/LaunchAgents/com.powellc.claude-save.plist && \
echo "claude: loaded com.powellc.claude-save"; \
fi
claude-save:
@cd $(CLAUDE_HISTORY_DIR) && \
git add -A && \
if git diff --cached --quiet; then \
echo "claude-save: nothing to commit"; \
else \
git commit -qm "Sync session state" && echo "claude-save: committed"; \
fi && \
if git remote get-url origin >/dev/null 2>&1; then \
git push -q && echo "claude-save: pushed"; \
else \
echo "claude-save: no origin remote, skipping push"; \
fi

78
bin/.local/bin/install_asdf Executable file
View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
# Install asdf (https://asdf-vm.com) from the latest GitHub release.
#
# Usage:
# ./install-asdf.sh # latest, installs to ~/.local/bin
# ./install-asdf.sh v0.20.0 # specific version
# INSTALL_DIR=/usr/local/bin ./install-asdf.sh
set -euo pipefail
REPO="asdf-vm/asdf"
VERSION="${1:-latest}"
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
need() { command -v "$1" >/dev/null 2>&1 || { echo "error: '$1' is required" >&2; exit 1; }; }
need curl
need tar
need install
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$(uname -m)" in
x86_64 | amd64) arch="amd64" ;;
aarch64 | arm64) arch="arm64" ;;
386 | i386 | i686) arch="386" ;;
*) echo "error: unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac
case "$os" in
linux | darwin) ;;
*) echo "error: unsupported OS: $os" >&2; exit 1 ;;
esac
if [ "$VERSION" = "latest" ]; then
VERSION="$(curl -fsSLI -o /dev/null -w '%{url_effective}' \
"https://github.com/$REPO/releases/latest" | sed -E 's#.*/tag/##')"
case "$VERSION" in
v[0-9]*) ;;
*) echo "error: could not determine latest version" >&2; exit 1 ;;
esac
fi
name="asdf-${VERSION}-${os}-${arch}"
base="https://github.com/$REPO/releases/download/$VERSION/$name.tar.gz"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
echo "Downloading $name ..."
curl -fsSL -o "$tmp/asdf.tar.gz" "$base"
curl -fsSL -o "$tmp/asdf.md5" "$base.md5"
expected="$(tr -d '[:space:]' < "$tmp/asdf.md5")"
if command -v md5sum >/dev/null 2>&1; then
actual="$(md5sum "$tmp/asdf.tar.gz" | cut -d' ' -f1)"
else
actual="$(md5 -q "$tmp/asdf.tar.gz")"
fi
if [ "$expected" != "$actual" ]; then
echo "error: checksum mismatch" >&2
echo " expected $expected" >&2
echo " got $actual" >&2
exit 1
fi
tar -xzf "$tmp/asdf.tar.gz" -C "$tmp"
mkdir -p "$INSTALL_DIR"
install -m755 "$tmp/asdf" "$INSTALL_DIR/asdf"
echo "Installed asdf $VERSION -> $INSTALL_DIR/asdf"
"$INSTALL_DIR/asdf" --version
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
echo
echo "note: $INSTALL_DIR is not on your PATH. Add it, e.g.:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
;;
esac

View File

@ -1,3 +1,3 @@
[user]
email = colin.powell@hungryroot.com
signingkey = BB257E06080FE639030D9291819A121699A1FD39
signingkey = 2A2DD36ECA886ADF46FC093C58D3070B9ADA7B67

View File

@ -0,0 +1,35 @@
<?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.powellc.claude-save</string>
<!-- sh expands $HOME; launchd does not expand ~ in ProgramArguments -->
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>make -C "$HOME/.dotfiles" claude-save</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>StartInterval</key>
<integer>1800</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/claude-save.out</string>
<key>StandardErrorPath</key>
<string>/tmp/claude-save.err</string>
</dict>
</plist>

View File

@ -58,6 +58,9 @@ Host bt1.unbl.ink
Host akna.metal
User pi
Host nfs.service
User powellc
# Inside our network, skip strict host key checking
Host *.metal
User powellc

View File

@ -0,0 +1,7 @@
[Unit]
Description="Commit and push Claude Code session state"
Requires=claude-save.timer
[Service]
Type=oneshot
ExecStart=/usr/bin/make -C %h/.dotfiles claude-save

View File

@ -0,0 +1,11 @@
[Unit]
Description="Timer for saving Claude Code session state"
[Timer]
Unit=claude-save.service
OnBootSec=5m
OnCalendar=*:0/30
Persistent=true
[Install]
WantedBy=timers.target