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.
Python ai-agentsai-automationclaudeclaude-codeebbinghausknowledge-graphllmmemory-systemobsidianpersonal-assistantpkmproductivitypythonsecond-braintelegram-botvoice-assistant
fix(session): the pane transcript is owner-only
smixs4643396e617a
diff --git a/src/d_brain/services/claude_session.py b/src/d_brain/services/claude_session.pyindex c2581c8..49ab84d 100644--- a/src/d_brain/services/claude_session.py+++ b/src/d_brain/services/claude_session.py@@ -99,6 +99,9 @@ class ClaudeSession:self.work_dir = Path(work_dir)self.runtime_dir = Path(runtime_dir)self.runtime_dir.mkdir(parents=True, exist_ok=True)+ # The dir holds the full pane transcript and turn state — owner-only,+ # enforced on every start so pre-existing installs get repaired too.+ os.chmod(self.runtime_dir, 0o700)self.mcp_config = Path(mcp_config) if mcp_config else Noneself.system_prompt_file = (Path(system_prompt_file) if system_prompt_file else None@@ -208,6 +211,10 @@ class ClaudeSession:)# Bigger scrollback so long replies stay within capture range.self._tmux("set-option", "-t", self.session_name, "history-limit", "50000")+ # Pre-create the transcript owner-only: `cat >>` appends and keeps+ # the mode, while letting tmux create it would use the server umask.+ self._pane_log.touch()+ os.chmod(self._pane_log, 0o600)self._tmux("pipe-pane","-t",diff --git a/tests/test_claude_session.py b/tests/test_claude_session.pyindex 965c910..3fd51c0 100644--- a/tests/test_claude_session.py+++ b/tests/test_claude_session.py@@ -413,3 +413,24 @@ def test_is_turn_active_reflects_lock_state(tmp_path, clock):finally:fcntl.flock(lock_fd, fcntl.LOCK_UN)os.close(lock_fd)+++# ── runtime privacy: the pane transcript is owner-only ──────────────────+++def test_runtime_dir_is_owner_only(tmp_path, clock):+ fake = FakeTmux([READY], exists=False)+ make_session(tmp_path, fake, clock)+ mode = (tmp_path / ".dbrain").stat().st_mode & 0o777+ assert mode == 0o700+++def test_pane_log_precreated_owner_only_before_pipe(tmp_path, clock):+ # pipe-pane appends the FULL Claude transcript via `cat >>` under the+ # tmux server's umask — the file must already exist as 0600.+ fake = FakeTmux([READY], exists=False)+ s = make_session(tmp_path, fake, clock)+ s.ensure_session()+ log = tmp_path / ".dbrain" / "pane.log"+ assert log.exists()+ assert (log.stat().st_mode & 0o777) == 0o600diff --git a/upgrade.sh b/upgrade.shindex 89f7e9d..29f7545 100755--- a/upgrade.sh+++ b/upgrade.sh@@ -70,6 +70,15 @@ systemctl --user enable \systemctl --user restart dbrain-bot.service dbrain-watchdog.servicesystemctl --user start dbrain-process.timer dbrain-doctor.timer+# Privacy repair for existing installs: the runtime dir holds the full pane+# transcript (pane.log) and cron prompts — owner-only, whatever umask+# originally created them. New code enforces this; fix what's already there.+if [ -d "$RUNTIME_DIR" ]; then+ chmod 700 "$RUNTIME_DIR"+ find "$RUNTIME_DIR" -type d -exec chmod 700 {} ++ find "$RUNTIME_DIR" -type f -exec chmod 600 {} ++fi+say "7/8 Guard: no claude -p in the hot path"bash "$PROJECT_DIR/scripts/check-no-claude-p.sh"