Summary
sivtr copy appears to require the current working directory to be inside a git repository before terminal session logs can be created or read.
When running in a normal directory without a .git parent, the zsh shell integration is active and SIVTR_TERMINAL_ID is set, but sivtr flush does not create any session log files and sivtr copy reports:
sivtr: no session log found
hint: run `sivtr init <shell>`, restart the shell, then run some commands
The hint is misleading in this case because the shell integration is already installed and active.
Environment
Shell: zsh
Platform: Linux
Working directory: /home/yewfence/code/tmp
Reproduction
- Use a directory that is not inside a git repository.
cd /home/yewfence/code/tmp
git rev-parse --show-toplevel
Output:
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
- Verify that shell integration is installed.
Output:
bash: not installed (/home/yewfence/.bashrc)
zsh: installed in /home/yewfence/.zshrc
nushell: not installed (no profile at /home/yewfence/.config/nushell/config.nu)
tmux: not installed (no config)
session log dir: /home/yewfence/.local/state/sivtr
- Verify that the current shell has the sivtr hook environment.
echo "$SHELL"
echo "$SIVTR_TERMINAL_ID"
echo "$SIVTR_NEXT_COMMAND_CWD"
Output:
/usr/bin/zsh
session_104522
/home/yewfence/code/tmp
- Run
sivtr flush and look for generated session files.
sivtr flush
find "${XDG_CONFIG_HOME:-$HOME/.config}/sivtr" -name '*.capture' -o -name '*.jsonl' -o -name '*.state'
Output:
- Run
sivtr copy.
Output:
sivtr: no session log found
hint: run `sivtr init <shell>`, restart the shell, then run some commands
Actual Behavior
No session log is created in a non-git directory, even though the zsh hook is installed and active.
sivtr copy only reports that no session log was found and suggests installing the shell hook.
Expected Behavior
One of these would be more understandable:
-
Terminal session logging works outside git repositories by falling back to a workspace key derived from the current directory.
-
Terminal session logging works outside git repositories by using a global terminal workspace.
-
sivtr copy and sivtr flush report that terminal session logging requires a git repository, if that is an intentional design constraint.
Implementation Notes
Based on a quick source inspection, the behavior seems to come from workspace resolution.
crates/sivtr-core/src/workspace.rs resolves a workspace through git_root(cwd).
If no .git directory or file is found in the current directory or its parents, resolve_workspace_for_dir returns Ok(None).
terminal_log_path_for_dir then returns Ok(None).
src/commands/flush.rs calls scrollback::command_session_log_path() and exits quietly if it receives None:
let Some(session_log_path) = scrollback::command_session_log_path()? else {
return Ok(());
};
That makes the command a silent no-op outside git repositories.
Why This Is Confusing
The installed hook status and environment variables suggest the shell integration is working:
zsh: installed in /home/yewfence/.zshrc
SIVTR_TERMINAL_ID=session_104522
SIVTR_NEXT_COMMAND_CWD=/home/yewfence/code/tmp
The visible error only points users toward sivtr init <shell>, so it is natural to keep debugging shell setup even though the missing git repository is the deciding condition.
Suggested Fix
Allow non-git directories to become terminal workspaces, or update the diagnostic message to mention the git repository requirement explicitly.
For example:
sivtr: no session log found
hint: shell integration is active, but the current directory is not inside a git repository
hint: run from a git repository, run `git init`, or use pipe mode
Summary
sivtr copyappears to require the current working directory to be inside a git repository before terminal session logs can be created or read.When running in a normal directory without a
.gitparent, the zsh shell integration is active andSIVTR_TERMINAL_IDis set, butsivtr flushdoes not create any session log files andsivtr copyreports:The hint is misleading in this case because the shell integration is already installed and active.
Environment
Reproduction
cd /home/yewfence/code/tmp git rev-parse --show-toplevelOutput:
Output:
Output:
sivtr flushand look for generated session files.Output:
sivtr copy.Output:
Actual Behavior
No session log is created in a non-git directory, even though the zsh hook is installed and active.
sivtr copyonly reports that no session log was found and suggests installing the shell hook.Expected Behavior
One of these would be more understandable:
Terminal session logging works outside git repositories by falling back to a workspace key derived from the current directory.
Terminal session logging works outside git repositories by using a global terminal workspace.
sivtr copyandsivtr flushreport that terminal session logging requires a git repository, if that is an intentional design constraint.Implementation Notes
Based on a quick source inspection, the behavior seems to come from workspace resolution.
crates/sivtr-core/src/workspace.rsresolves a workspace throughgit_root(cwd).If no
.gitdirectory or file is found in the current directory or its parents,resolve_workspace_for_dirreturnsOk(None).terminal_log_path_for_dirthen returnsOk(None).src/commands/flush.rscallsscrollback::command_session_log_path()and exits quietly if it receivesNone:That makes the command a silent no-op outside git repositories.
Why This Is Confusing
The installed hook status and environment variables suggest the shell integration is working:
The visible error only points users toward
sivtr init <shell>, so it is natural to keep debugging shell setup even though the missing git repository is the deciding condition.Suggested Fix
Allow non-git directories to become terminal workspaces, or update the diagnostic message to mention the git repository requirement explicitly.
For example: