Quick Start
Direct vs Session Mode
| Command | Mode | Description |
|---|---|---|
fresh myfile.txt | Direct | No server. Closing quits everything. |
fresh -a | Session | Background server. Supports detach/reattach. |
How It Works
With-a, Fresh starts a background server. The terminal is a lightweight client relaying input/output.
Commands
Basic Commands
| Command | Description |
|---|---|
fresh -a | Attach to session for current directory (starts server if needed) |
fresh -a <name> | Attach to named session |
fresh --cmd session list | List running sessions |
fresh --cmd session new <name> | Start a new named session |
fresh --cmd session kill | Kill session for current directory |
fresh --cmd session kill <name> | Kill named session |
fresh --cmd session kill --all | Kill all sessions |
Named Sessions
For multiple sessions in the same directory:Opening Files in a Session
Open files in an existing session without attaching to it. If no session is running, one is started and the client attaches interactively:This is useful for integrating Fresh with file managers or other tools—files open in the existing editor without starting a new terminal session.
Blocking Until Done (--wait)
The --wait flag keeps the CLI process alive until the user is done with the file. The process exits when:
- The popup is dismissed (press Escape) — if the file was opened with an
@"message" - The buffer is closed — if no message was given
If no session is running, one is started automatically and the client attaches interactively (
--wait is ignored in this case — quit or detach normally).Use as Git’s Editor
Set Fresh as git’s editor sogit commit, git rebase -i, etc. open in your running session and block until you close the buffer:
Git appends the filename, so the final command becomes e.g.
fresh --cmd session open-file . --wait .git/COMMIT_EDITMSG. The --wait flag can appear anywhere after the session name — files after it are collected normally.Annotated Code Walkthroughs
Combine--wait with range selection and popup messages to walk a user through code one location at a time. Each command blocks until the user presses Escape, then the next location opens:
$'...' quoting for multi-line messages:
Programmatic Integration
The--wait blocking behavior makes session open-file composable with any tool that needs to present files to a user and wait for acknowledgement:
Detaching
Limitations and Pitfalls
Resource Usage
Resource Usage
Each session consumes memory for open files, terminal scrollback, and LSP servers. Use
fresh --cmd session list periodically to check for forgotten sessions.Terminal State
Terminal State
When reattaching, terminal size may differ and some applications may not render correctly after resize. Scrollback is preserved but limited by buffer size.
Platform Differences
Platform Differences
| Platform | IPC Mechanism |
|---|---|
| Linux/macOS | Unix domain sockets |
| Windows | Named pipes |
Known Issues
Known Issues
- Stale sockets: If Fresh crashes, socket files may remain. See Socket Locations for cleanup.
- Signal handling: Some signals don’t propagate to server terminals.
Troubleshooting
Connection refused
Connection refused
Server may have crashed. Run
fresh --cmd session kill to clean up, then fresh -a again.Session not in list
Session not in list
Sessions are keyed by working directory.
~/project and /home/user/project create different sessions—use consistent paths.High memory usage
High memory usage
Check for forgotten sessions with
fresh --cmd session list.Socket Locations
| Platform | Location |
|---|---|
| Linux | $XDG_RUNTIME_DIR/fresh/ or /tmp/fresh-$UID/ |
| macOS | /tmp/fresh-$UID/ |
| Windows | %LOCALAPPDATA%\fresh\sockets\ |