xiaohongshu
xiaohongshu
kitty-terminal
Configure and control kitty terminal emulator using kitten commands, kitty.conf settings, remote control, and session automation. Use when working with kitty terminal, kittens, kitty.conf, terminal automation, or debugging kitty sessions.
Full skill instructions
kitty - The fast, feature rich terminal emulator
The kitty terminal is run as GUI and controlled through a config file at ~/.config/kitty/kitty.conf. This config file can include additional files (often in the same directory for ease, but absolute paths are supported). The config file is a custom, but simple format, and most functionality is exposed via mappings to kitty 'actions' or from the cli via the kitty cli and self contained actions known as kittens.
For example kitten @ ls will list all current os-windows, tabs and windows, with their foreground processes, ids etc. In fact all kitty behaviour can be controlled programmatically from kitten commands. See manpages and debugging below for more details.
Kitty's windowing model follows the hierarchy of 'os-window' > 'tabs' > 'windows', where the user may be running multiple 'os-windows' which maps to actual GUI instances managed by the operating system, and then each 'os-window' contains one or more tabs, which in turn has one or more 'windows' (which appear as 'splits' in the ui, allowing for side-by-side views within the same tab).
IMPORTANT: The 'os-windows' are managed by the operating system and so it is not possible (on macos) to programmatically move focus between os-windows, this means in practice the user will always have a single 'os-window' (though more may be spawned to create test instances or quick temporary views like viewing a config file).
Kitty has local man pages and these can be searched faster by focusing the manpath:
man -M "/Applications/kitty.app/Contents/Resources/man" kitty
This can be combined with -k for 'apropos' search:
man -k -M "/Applications/kitty.app/Contents/Resources/man" kitty
# =>
# kitten(1) - Fast, statically compiled implementations of various kittens (command line tools for use with kitty)
# kitten-@(1) - Control kitty remotely
# kitten-@-run(1) - Run a program on the computer in which kitty is running and get the output
# ...
man -k -M "/Applications/kitty.app/Contents/Resources/man" remote
# =>
# kitten-@(1) - Control kitty remotely
# kitten-remote-file(1) - kitten Documentation
The full list of pages is as follows:
$ man -k -M "/Applications/kitty.app/Contents/Resources/man" "." | sort:
!man -k -M "/Applications/kitty.app/Contents/Resources/man" "." | sort
kitten @ ls - List all os-windows, tabs, windows with IDs, processes, user variableskitten @ launch --type=tab --cwd=/path - Create new tab in specific directorykitten @ launch --type=window --cwd=/path - Create new window (split)kitten @ set-user-vars VAR=value - Set user variables on windowskitten @ close-window --match all - Close windowskitten @ focus-tab --match id:123 - Focus specific tab by IDkitten @ set-tab-title "title" - Set tab title# Target specific kitty instance
kitten @ --to unix:/path/to/socket command
# Find existing sockets
ls /tmp/mykitty-* 2>/dev/null
Most kittens and kitty actions support a --match flag (and sometimes a --match-tab flag) which is documented as:
The window to match. Match specifications are of the form: field:query. Where field can be one of: id, title, pid, cwd, cmdline, num, env, var, state, neighbor, and recent. query is the expression to match. Expressions can be either a number or a regular expression, and can be combined using Boolean operators.
The special value all matches all windows.
For numeric fields: id, pid, num and recent, the expression is interpreted as a number, not a regular expression. Negative values for id match from the highest id number down, in particular, -1 is the most recently created window.
The field num refers to the window position in the current tab, starting from zero and counting clockwise (this is the same as the order in which the windows are reported by the kitten @ ls command).
The window id of the current window is available as the KITTY_WINDOW_ID environment variable.
The field recent refers to recently active windows in the currently active tab, with zero being the currently active window, one being the previously active window and so on.
The field neighbor refers to a neighbor of the active window in the specified direction, which can be: left, right, top or bottom.
When using the env field to match on environment variables, you can specify only the environment variable name or a name and value, for example, env:MY_ENV_VAR=2.
Similarly, the var field matches on user variables set on the window. You can specify name or name and value as with the env field.
The field state matches on the state of the window. Supported states are: active, focused, needs_attention, parent_active, parent_focused, self, overlay_parent. Active windows are the windows that are active in their parent tab. There is only one focused window and it is the window to which keyboard events are delivered. If no window is focused, the last focused window is matched. The value self matches the window in which the remote control command is run. The value overlay_parent matches the window that is under the self window, when the self window is an overlay.
Note that you can use the kitten @ ls command to get a list of windows.
Kitty supports Python watcher scripts that respond to observable events:
on_load, on_resize, on_focus_change, on_close, on_set_user_var, on_title_change, on_cmd_startstop, on_color_scheme_preference_changeEnable via: watcher script.py in config or --override watcher=script.py
To debug session state from command line (non-TTY contexts):
# Find the kitty socket (has PID suffix)
ls -la /tmp/ | grep mykitty
# Use the socket to query kitty state
kitten @ --to unix:/tmp/mykitty-<PID> ls
# Example with dynamic socket discovery
KITTY_SOCKET=$(ls /tmp/mykitty-* 2>/dev/null | head -1)
kitten @ --to unix:$KITTY_SOCKET ls | jq '.[] | .tabs[] | .windows[] | .user_vars'
When debugging, create a separate test instance to ensure the latest config is loaded:
# 1. Create test kitty instance with test config and optionally override any specific settings
kitty --listen-on unix:/tmp/test-kitty-watcher --detach \
--config=/path/to/test/config.conf \
--override allow_remote_control=yes \
--override watcher=mywatcher.py &
# 2. Wait for startup then test tab creation
sleep 2
kitten @ --to unix:/tmp/test-kitty-watcher launch --type=tab --cwd=/path/to/test
# 3. Inspect variables or other ls information
kitten @ --to unix:/tmp/test-kitty-watcher ls | \
jq '.[] | .tabs[] | .windows[] | {id: .id, cwd: .cwd, user_vars: .user_vars}'
# 4. Manipulate the terminal with various launch commands
kitten @ --to unix:/tmp/test-kitty-watcher launch --type=tab --cwd=/tmp
kitten @ --to unix:/tmp/test-kitty-watcher launch --type=tab --cwd=/Users/username
# 5. Clean up test instance when done
kitten @ --to unix:/tmp/test-kitty-watcher close-window --match all
rm /tmp/test-kitty-watcher
[
{
"id": 1,
"is_focused": true,
"tabs": [
{
"id": 1,
"is_focused": true,
"title": "bash",
"windows": [
{
"id": 1,
"is_focused": true,
"title": "user@hostname",
"pid": 12345,
"cwd": "/Users/username/project",
"user_vars": {
"SESSION": "project"
},
"foreground_processes": [...]
}
]
}
]
}
]
# Get all user variables
kitten @ ls | jq '.[] | .tabs[] | .windows[] | .user_vars'
# Get CWD and other info
kitten @ ls | jq '.[] | .tabs[] | .windows[] | {id, cwd, user_vars}'
# Find tabs with a specific user_var
kitten @ ls | jq '.[] | .tabs[] | select(.windows[].user_vars.SESSION == "project")'
When users ask about kitty terminal, terminal configuration, automating terminal sessions, or debugging terminal issues:
kitten @ lsxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience