One note per Claude Code session (incremental, hourly user timer) and a claude.ai data-export importer, written through the Obsidian Local REST API plugin -- whose built-in /mcp/ server is also how Claude reads them back. Transcripts are condensed (tool output dropped, one line per tool call, ~60x smaller), redacted, then summarized by headless `claude -p` on the user's own plan. Three things learned the hard way are encoded here: - --no-session-persistence, or every summary becomes a transcript that the next run summarizes. - A LiteLLM gateway passing through the caller's Claude subscription has no key of its own, so a background job cannot use its claude-* models. - Summaries share the plan's usage limits. A parallel ~100-session backfill exhausted a session limit in minutes. So one job, a per-run cap, and the run stops at the first usage-limit error (exit 75) instead of failing the whole queue; a stop flag, because Future.cancel() cannot stop work a thread already picked up. Covered by an offline test of stop / resume / idempotent rerun. Nothing environment-specific is committed: hosts, keys and paths live in ~/.config/claude-obsidian/ (this repo is public). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KF322NzozeaFjpgWvh4F4g
15 lines
1.1 KiB
Bash
Executable File
15 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Install claude-obsidian-sync for the current user: binary into ~/.local/bin, systemd user
|
|
# timer enabled. Idempotent. Does not create config or secrets -- see README.md.
|
|
set -eu
|
|
HERE="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
mkdir -p "$HOME/.local/bin" "$HOME/.config/systemd/user" "$HOME/.config/claude-obsidian"
|
|
chmod 700 "$HOME/.config/claude-obsidian"
|
|
ln -sf "$HERE/claude-obsidian-sync" "$HOME/.local/bin/claude-obsidian-sync"
|
|
cp "$HERE/systemd/claude-obsidian-sync.service" "$HERE/systemd/claude-obsidian-sync.timer" "$HOME/.config/systemd/user/"
|
|
[ -f "$HOME/.config/claude-obsidian/config.env" ] || { cp "$HERE/config.env.example" "$HOME/.config/claude-obsidian/config.env"; chmod 600 "$HOME/.config/claude-obsidian/config.env"; echo "created config.env from the example -- edit it"; }
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now claude-obsidian-sync.timer
|
|
echo "installed. check: systemctl --user list-timers claude-obsidian-sync.timer"
|
|
echo "timers only run while logged in unless lingering is on: loginctl enable-linger \"\$USER\""
|