AI-powered dynamic Zellij session naming plugin for OpenCode
66
stars
16
commits
TypeScript
primary language
Dec 20, 2025
updated
AI-powered dynamic Zellij session naming for OpenCode.
Automatically renames your Zellij terminal sessions based on what you're working on — project name, task type (feat, fix, debug, etc.), and contextual tags derived from your activity.

The plugin automatically renamed this session to basicsetup-feat-namer — project directory (basicsetup), intent (feat), and contextual tag (namer).
myproject-feat-auth or api-debug-cacheAGENTS.md# Install globally
npm install -g opencode-zellij-namer
# Or add to your OpenCode config
Add to your ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-zellij-namer"]
}
All configuration is via environment variables:
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY | - | Google AI API key for smart naming |
OPENCODE_ZELLIJ_DEBUG | 0 | Set to 1 for debug logging |
OPENCODE_ZELLIJ_COOLDOWN_MS | 300000 | Minimum ms between renames (5 min) |
OPENCODE_ZELLIJ_DEBOUNCE_MS | 5000 | Debounce interval for checks (5 sec) |
OPENCODE_ZELLIJ_MODEL | gemini-3-flash-preview | Gemini model to use |
OPENCODE_ZELLIJ_MAX_SIGNALS | 25 | Max activity signals to retain |
OPENCODE_ZELLIJ_TIMEOUT_MS | 3000 | AI request timeout |
OPENCODE_ZN_INSTRUCTIONS | - | Custom naming instructions for AI |
OPENCODE_ZN_USE_AGENTS_MD | 1 | Set to 0 to disable AGENTS.md reading |
The plugin automatically reads naming guidance from your project's AGENTS.md file. This allows you to define project-specific naming conventions that all contributors will follow.
Supported locations (checked in order):
./AGENTS.md./.github/AGENTS.md./docs/AGENTS.mdExtracted sections (by priority):
## Naming or ## Session Naming — entire section content## Guidelines — lines containing "naming", "session", "tag", or "intent"Example AGENTS.md:
# My Project
## Session Naming
- Use team prefix "acme-" for all sessions
- Prefer ticket numbers as tags (e.g., acme-feat-jira123)
- Use "api" instead of "backend" for backend work
The plugin extracts this guidance and includes it in the AI prompt.
To disable: Set OPENCODE_ZN_USE_AGENTS_MD=0
You can provide custom instructions to guide the AI naming:
export OPENCODE_ZN_INSTRUCTIONS="Use short codenames. Prefer 'api' over 'backend'. Always include ticket numbers from todos."
This is useful for:
When both AGENTS.md and custom instructions are present:
Custom instructions take precedence over AGENTS.md when they conflict. This allows teams to define baseline conventions in AGENTS.md while individual developers can customize for their workflow.
export GEMINI_API_KEY="your-api-key"
export OPENCODE_ZELLIJ_DEBUG=1
export OPENCODE_ZELLIJ_COOLDOWN_MS=600000 # 10 minutes
project-intent[-tag]
feat, fix, debug, refactor, test, doc, ops, review, spikeauth, api, cache (max 15 chars)| Activity | Generated Name |
|---|---|
| Working on new feature | myapp-feat |
| Debugging auth issues | myapp-debug-auth |
| Writing tests | api-test |
| Refactoring database code | backend-refactor-db |
| Reviewing PR | frontend-review |
The plugin listens to these OpenCode events:
session.idle — After each AI turn completesfile.edited — When you edit filescommand.executed — When you run commandstodo.updated — When todos changeWhile Zellij allows duplicate session names, this plugin attempts to generate unique names to help you distinguish between multiple sessions working on the same project.
Disambiguation strategy:
feat/user-auth, adds -auth tagsrc/payments/ adds -payments tag-cache tag-am/-pm/-eve based on time of day-2, -3, etc.Example scenario:
| Session | Context | Generated Name |
|---|---|---|
| Terminal 1 | Working on auth | myapp-feat-auth |
| Terminal 2 | Same project, payments | myapp-feat-payments |
| Terminal 3 | Same project, morning | myapp-feat-am |
This ensures you can identify which terminal is which at a glance, even with multiple sessions on the same project.
When AI naming is enabled, the following data is sent to Google's Gemini API:
| Data | Example | Purpose |
|---|---|---|
| Project name | myapp | Anchor for session name |
| Recent file paths | src/auth/login.ts | Infer working area |
| Command names | npm test | Infer task type |
| Todo summaries | fix login bug | Infer intent |
| Conversation snippets | debug the auth flow | Contextual naming |
What is NOT sent:
To disable AI: Simply don't set GEMINI_API_KEY. The plugin falls back to heuristic naming.
Check OpenCode logs for errors. Enable debug mode:
export OPENCODE_ZELLIJ_DEBUG=1
echo $ZELLIJ_SESSION_NAMEwhich zellijecho $GEMINI_API_KEYgit clone https://github.com/YOUR_USERNAME/opencode-zellij-namer
cd opencode-zellij-namer
package.json with your fork's URL:# Replace YOUR_USERNAME with your GitHub username
sed -i 's/24601/YOUR_USERNAME/g' package.json
npm install
npm run build
npm test
To test your changes with OpenCode, update your config to point to your local build:
{
"plugin": ["/path/to/your/opencode-zellij-namer"]
}
MIT — see LICENSE
See CONTRIBUTING.md
16 commits
TypeScript
100.0%
AI-powered dynamic Zellij session naming plugin for OpenCode
66
stars
16
commits
TypeScript
primary language
Dec 20, 2025
updated
AI-powered dynamic Zellij session naming for OpenCode.
Automatically renames your Zellij terminal sessions based on what you're working on — project name, task type (feat, fix, debug, etc.), and contextual tags derived from your activity.

The plugin automatically renamed this session to basicsetup-feat-namer — project directory (basicsetup), intent (feat), and contextual tag (namer).
myproject-feat-auth or api-debug-cacheAGENTS.md# Install globally
npm install -g opencode-zellij-namer
# Or add to your OpenCode config
Add to your ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-zellij-namer"]
}
All configuration is via environment variables:
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY | - | Google AI API key for smart naming |
OPENCODE_ZELLIJ_DEBUG | 0 | Set to 1 for debug logging |
OPENCODE_ZELLIJ_COOLDOWN_MS | 300000 | Minimum ms between renames (5 min) |
OPENCODE_ZELLIJ_DEBOUNCE_MS | 5000 | Debounce interval for checks (5 sec) |
OPENCODE_ZELLIJ_MODEL | gemini-3-flash-preview | Gemini model to use |
OPENCODE_ZELLIJ_MAX_SIGNALS | 25 | Max activity signals to retain |
OPENCODE_ZELLIJ_TIMEOUT_MS | 3000 | AI request timeout |
OPENCODE_ZN_INSTRUCTIONS | - | Custom naming instructions for AI |
OPENCODE_ZN_USE_AGENTS_MD | 1 | Set to 0 to disable AGENTS.md reading |
The plugin automatically reads naming guidance from your project's AGENTS.md file. This allows you to define project-specific naming conventions that all contributors will follow.
Supported locations (checked in order):
./AGENTS.md./.github/AGENTS.md./docs/AGENTS.mdExtracted sections (by priority):
## Naming or ## Session Naming — entire section content## Guidelines — lines containing "naming", "session", "tag", or "intent"Example AGENTS.md:
# My Project
## Session Naming
- Use team prefix "acme-" for all sessions
- Prefer ticket numbers as tags (e.g., acme-feat-jira123)
- Use "api" instead of "backend" for backend work
The plugin extracts this guidance and includes it in the AI prompt.
To disable: Set OPENCODE_ZN_USE_AGENTS_MD=0
You can provide custom instructions to guide the AI naming:
export OPENCODE_ZN_INSTRUCTIONS="Use short codenames. Prefer 'api' over 'backend'. Always include ticket numbers from todos."
This is useful for:
When both AGENTS.md and custom instructions are present:
Custom instructions take precedence over AGENTS.md when they conflict. This allows teams to define baseline conventions in AGENTS.md while individual developers can customize for their workflow.
export GEMINI_API_KEY="your-api-key"
export OPENCODE_ZELLIJ_DEBUG=1
export OPENCODE_ZELLIJ_COOLDOWN_MS=600000 # 10 minutes
project-intent[-tag]
feat, fix, debug, refactor, test, doc, ops, review, spikeauth, api, cache (max 15 chars)| Activity | Generated Name |
|---|---|
| Working on new feature | myapp-feat |
| Debugging auth issues | myapp-debug-auth |
| Writing tests | api-test |
| Refactoring database code | backend-refactor-db |
| Reviewing PR | frontend-review |
The plugin listens to these OpenCode events:
session.idle — After each AI turn completesfile.edited — When you edit filescommand.executed — When you run commandstodo.updated — When todos changeWhile Zellij allows duplicate session names, this plugin attempts to generate unique names to help you distinguish between multiple sessions working on the same project.
Disambiguation strategy:
feat/user-auth, adds -auth tagsrc/payments/ adds -payments tag-cache tag-am/-pm/-eve based on time of day-2, -3, etc.Example scenario:
| Session | Context | Generated Name |
|---|---|---|
| Terminal 1 | Working on auth | myapp-feat-auth |
| Terminal 2 | Same project, payments | myapp-feat-payments |
| Terminal 3 | Same project, morning | myapp-feat-am |
This ensures you can identify which terminal is which at a glance, even with multiple sessions on the same project.
When AI naming is enabled, the following data is sent to Google's Gemini API:
| Data | Example | Purpose |
|---|---|---|
| Project name | myapp | Anchor for session name |
| Recent file paths | src/auth/login.ts | Infer working area |
| Command names | npm test | Infer task type |
| Todo summaries | fix login bug | Infer intent |
| Conversation snippets | debug the auth flow | Contextual naming |
What is NOT sent:
To disable AI: Simply don't set GEMINI_API_KEY. The plugin falls back to heuristic naming.
Check OpenCode logs for errors. Enable debug mode:
export OPENCODE_ZELLIJ_DEBUG=1
echo $ZELLIJ_SESSION_NAMEwhich zellijecho $GEMINI_API_KEYgit clone https://github.com/YOUR_USERNAME/opencode-zellij-namer
cd opencode-zellij-namer
package.json with your fork's URL:# Replace YOUR_USERNAME with your GitHub username
sed -i 's/24601/YOUR_USERNAME/g' package.json
npm install
npm run build
npm test
To test your changes with OpenCode, update your config to point to your local build:
{
"plugin": ["/path/to/your/opencode-zellij-namer"]
}
MIT — see LICENSE
See CONTRIBUTING.md
16 commits
TypeScript
100.0%