-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Letta Code git bash patch — what we did and why
───────────────────────────────
The Problem
On Windows, Letta Code's RunShellCommand tool defaults to PowerShell or cmd.exe when spawning shells. This caused several friction points on our dev setup:
- HEREDOC syntax (<< 'EOF') doesn't work in PowerShell/cmd
- Bare & operators aren't valid in PowerShell
- Unix path conventions (/c/Users/...) don't work in cmd
- Our Docker commands, pytest invocations, and git operations all assume a Unix-style shell
- We run Git Bash (MINGW64) as our primary terminal and wanted Letta Code to use it too
───────────────────────────────
The Patch
We patched letta.js directly at:
C:\Users<USER>\AppData\Roaming\npm\node_modules@letta-ai\letta-code\letta.js
Inside the windowsLaunchers() function, which controls what shell is tried first when executing a command on Windows, we added a GIT_BASH_PATH override block before the PowerShell fallback:
// GIT_BASH_PATH patch
const gitBash = process.env.GIT_BASH_PATH || "";
if (gitBash) {
pushUnique(launchers, seen, [gitBash, "-c", trimmed]);
}
The original code tried powershell.exe first, then pwsh, then cmd.exe. Our patch inserts Git Bash at position 0 of the launcher list when the GIT_BASH_PATH environment variable is set. If it's not set,
behaviour is identical to stock — making the patch safely opt-in.
then sets in his shell environment:
GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe
───────────────────────────────
Benefits in Letta Code Sessions
Once the patch was applied, the improvement was immediate and substantial:
- All Unix commands work natively — grep, ls, cp, rm, find, cat, wc, sed, awk all execute without Windows-specific workarounds
- Docker commands work — docker exec, docker-compose run exactly as they would on Linux
- Git commands work fully — git diff, git log, git status with full output, including pipes
- Path conventions unified — /c/doc/Programming/... paths work, removing the friction of translating between Windows and Unix path formats
- Parallel tool calls work reliably — the & operator for backgrounding is valid in bash; PowerShell's & has different semantics that caused issues
- Script portability — management commands, pytest runs, and the rlm skill all use standard bash syntax that now executes without modification
- PYTHONIOENCODING and other env var patterns — work as expected in bash; in cmd/PowerShell they require different syntax
The patch is minimal, non-breaking (opt-in via env var), and survives the Letta Code session — though it needs to be reapplied after npm updates the @letta-ai/letta-code package. We've documented this
in session memory so we remember to re-patch after upgrades.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels