Skip to content

An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.

fix: close blind-review minors — alert survives bad .env, perms set before secrets land

smixs5550e843489d
diff --git a/scripts/notify.sh b/scripts/notify.sh
index e330637..149b705 100755
--- a/scripts/notify.sh
+++ b/scripts/notify.sh
@@ -6,11 +6,16 @@ set -euo pipefail
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
ENV_FILE="$PROJECT_DIR/.env"
+# Last-resort alert handler: a malformed .env line must not abort us
+# before curl. `|| true` does NOT reliably shield a sourced file under
+# errexit — drop -e around the load instead.
if [ -f "$ENV_FILE" ]; then
+ set +e
set -a
# shellcheck disable=SC1090
- . "$ENV_FILE"
+ . "$ENV_FILE" 2>/dev/null
set +a
+ set -e
fi
MSG="${1:-d-brain alert}"
diff --git a/setup.sh b/setup.sh
index 3e51e54..f26af28 100755
--- a/setup.sh
+++ b/setup.sh
@@ -320,9 +320,9 @@ configure_git_remote() {
read -r GITHUB_USER
fi
- git remote set-url origin "https://[email protected]/$GITHUB_USER/agent-second-brain.git"
- # The token lives in .git/config — keep that file owner-only.
+ # The token will live in .git/config — owner-only BEFORE it's written.
chmod 600 .git/config
+ git remote set-url origin "https://[email protected]/$GITHUB_USER/agent-second-brain.git"
success "Git remote configured for push"
}
diff --git a/src/d_brain/services/cron_store.py b/src/d_brain/services/cron_store.py
index 86eb533..71bf141 100644
--- a/src/d_brain/services/cron_store.py
+++ b/src/d_brain/services/cron_store.py
@@ -162,10 +162,11 @@ class CronStore:
self.cron_dir.mkdir(parents=True, exist_ok=True)
payload = {"version": STORE_VERSION, "jobs": [asdict(j) for j in jobs]}
tmp = self.jobs_file.with_suffix(".json.tmp")
- tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2))
- # Prompts and chat ids are private — owner-only before the rename
- # so a world-readable window never exists.
+ # Prompts and chat ids are private — owner-only BEFORE the payload
+ # is written, so a world-readable window never exists.
+ tmp.touch()
os.chmod(tmp, 0o600)
+ tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2))
os.replace(tmp, self.jobs_file)
@contextmanager