aws / aws/amazon-q-developer-cli

Shell integration adds ~1.3s to zsh startup (kiro-cli init subprocess called twice on every shell open)

Open
#3,767 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

macOS 26.4.1 (25E253)

### Expected behaviour

Shell integration should add <50ms. Suggested fixes:
- Pre-generate init output to a static file and source it (no subprocess per shell)
- Gate expensive logic with env vars to no-op in nested/already-initialized shells
- Make kiro-cli-term PTY wrapping async or lazy

### Actual behaviour

The kiro-cli shell integration blocks shell startup by approximately 1.3 seconds, compared to a baseline of ~13ms without any rc files loaded:

# With kiro shell integration active:
zsh -i -c exit → 1.379s total

# Baseline (no rc files):
zsh --no-rcs -i -c exit → 0.013s total

That is a ~106x slowdown attributable to the kiro integration.

Root cause (observed)

zshrc.pre.zsh calls:
eval "$(~/.local/bin/kiro-cli init zsh pre --rcfile zshrc)"

zshrc.post.zsh calls:
eval "$(~/.local/bin/kiro-cli init zsh post --rcfile zshrc)"

Both run kiro-cli as a subprocess on every shell start, paying process spawn + execution cost twice. The init zsh post output alone is 37KB of shell code being eval'd synchronously. This includes PTY detection, session management, and figterm launch logic — all blocking the prompt.

### Steps to reproduce

1. Install kiro-cli 2.0.1 and let it inject its hooks into .zshrc
2. Add zmodload zsh/zprof at top of .zshrc and zprof at the bottom
3. Open a new terminal and observe the profiling output — kiro-cli init appears near the top

### Environment

```yaml
- kiro-cli: 2.0.1
- kiro (IDE): 0.11.131
- Shell: zsh on macOS Darwin 25.4.0

[system-info]
os = "macOS 26.4.1 (25E253)"
chip = "Apple M3 Pro"
total-cores = 11
memory = "18.00 GB"

[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "macOS"
install-method = "unknown"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.