Commands
info - Display Information About kdn¶
Displays version, available agents, and supported runtimes.
Usage¶
Flags¶
--output, -o <format>- Output format (supported:json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Show info (human-readable format):
Output:Show info in JSON format:
Output:Show info using short flag:
Notes¶
- Agents are discovered from runtimes that support agent configuration (e.g., the Podman runtime reports agents from its configuration files)
- Runtimes are listed based on availability in the current environment (e.g., the Podman runtime only appears if the
podmanCLI is installed) - JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure
init - Register a New Workspace¶
Registers a new workspace with kdn, making it available for agent launch and configuration.
Usage¶
Arguments¶
sources-directory- Path to the directory containing your project source files (optional, defaults to current directory.)
Flags¶
--runtime, -r <type>- Runtime to use for the workspace (required ifKDN_DEFAULT_RUNTIMEis not set)--agent, -a <name>- Agent to use for the workspace (required ifKDN_DEFAULT_AGENTis not set)--model, -m <id>- Model ID to configure for the agent (optional, uses agent's default if not specified)--workspace-configuration <path>- Directory for workspace configuration files (default:<sources-directory>/.kaiden)--name, -n <name>- Human-readable name for the workspace (default: generated from sources directory)--project, -p <identifier>- Custom project identifier to override auto-detection (default: auto-detected from git repository or source directory)--start- Start the workspace after registration (can also be set viaKDN_INIT_AUTO_STARTenvironment variable)--verbose, -v- Show detailed output including all workspace information--output, -o <format>- Output format (supported:json)--show-logs- Show stdout and stderr from runtime commands (cannot be combined with--output json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Register the current directory:
Output:a1b2c3d4e5f6... (workspace ID) Register a specific directory:
Register with a custom name:
Register with a custom project identifier:
Register with custom configuration location:
kdn init /path/to/myproject --runtime podman --agent claude --workspace-configuration /path/to/config
Register with a specific model:
Register and start immediately:
Output:a1b2c3d4e5f6... (workspace ID, workspace is now running) Register and start using environment variable:
Output:a1b2c3d4e5f6... (workspace ID, workspace is now running) View detailed output:
Output:Registered workspace:
ID: a1b2c3d4e5f6...
Name: myproject
Project: /absolute/path/to/myproject
Agent: claude
Sources directory: /absolute/path/to/myproject
Configuration directory: /absolute/path/to/myproject/.kaiden
State: stopped
JSON output (default - ID only):
Output:JSON output with verbose flag (full workspace details):
Output:{
"id": "a1b2c3d4e5f6...",
"name": "myproject",
"agent": "claude",
"project": "/absolute/path/to/myproject",
"state": "stopped",
"paths": {
"source": "/absolute/path/to/myproject",
"configuration": "/absolute/path/to/myproject/.kaiden"
}
}
JSON output with short flags:
Show runtime command output (e.g., image build logs):
Workspace Naming¶
- If
--nameis not provided, the name is automatically generated from the last component of the sources directory path - If a workspace with the same name already exists, kdn automatically appends an increment (
-2,-3, etc.) to ensure uniqueness
Examples:
# First workspace in /home/user/project
kdn init /home/user/project --runtime podman --agent claude
# Name: "project"
# Second workspace with the same directory name
kdn init /home/user/another-location/project --runtime podman --agent claude --name "project"
# Name: "project-2"
# Third workspace with the same name
kdn init /tmp/project --runtime podman --agent claude --name "project"
# Name: "project-3"
Project Detection¶
When registering a workspace, kdn automatically detects and stores a project identifier. This allows grouping workspaces that belong to the same project, even across different branches, forks, or subdirectories.
The project is determined using the following rules:
1. Git repository with remote URL
The project is the repository remote URL (without .git suffix) plus the workspace's relative path within the repository:
- At repository root:
https://github.com/user/repo/ - In subdirectory:
https://github.com/user/repo/sub/path
Remote priority: 1. upstream remote is checked first (useful for forks) 2. origin remote is used if upstream doesn't exist 3. If neither exists, falls back to local repository path (see below)
Example - Fork with upstream:
# Repository setup:
# upstream: https://github.com/kortex-hub/kortex-cli.git
# origin: https://github.com/myuser/kortex-cli.git (fork)
# Workspace at repository root
kdn init /home/user/kortex-cli --runtime podman --agent claude
# Project: https://github.com/kortex-hub/kortex-cli/
# Workspace in subdirectory
kdn init /home/user/kortex-cli/pkg/git --runtime podman --agent claude
# Project: https://github.com/kortex-hub/kortex-cli/pkg/git
This ensures all forks and branches of the same upstream repository are grouped together.
2. Git repository without remote
The project is the repository root directory path plus the workspace's relative path:
- At repository root:
/home/user/my-local-repo - In subdirectory:
/home/user/my-local-repo/sub/path
Example - Local repository:
# Workspace at repository root
kdn init /home/user/local-repo --runtime podman --agent claude
# Project: /home/user/local-repo
# Workspace in subdirectory
kdn init /home/user/local-repo/pkg/utils --runtime podman --agent claude
# Project: /home/user/local-repo/pkg/utils
3. Non-git directory
The project is the workspace source directory path:
Example - Regular directory:
Benefits:
- Cross-branch grouping: Workspaces in different git worktrees or branches of the same repository share the same project
- Fork grouping: Forks reference the upstream repository, grouping all contributors working on the same project
- Subdirectory support: Monorepo subdirectories are tracked with their full path for precise identification
- Custom override: Use
--projectflag to manually group workspaces under a custom identifier (e.g., "client-project") - Future filtering: The project field enables filtering and grouping commands (e.g., list all workspaces for a specific project)
Notes¶
- Runtime is required: You must specify a runtime using either the
--runtimeflag or theKDN_DEFAULT_RUNTIMEenvironment variable - Agent is required: You must specify an agent using either the
--agentflag or theKDN_DEFAULT_AGENTenvironment variable - Model is optional: Use
--modelto specify a model ID for the agent. The flag takes precedence over any model defined in the agent's default settings files (~/.kdn/config/<agent>/). If not provided, the agent uses its default model or the one configured in settings. All agents support model configuration: Claude (via.claude/settings.json), Goose (viaconfig.yaml), and Cursor (via.cursor/cli-config.json) - Project auto-detection: The project identifier is automatically detected from git repository information or source directory path. Use
--projectflag to override with a custom identifier - Auto-start: Use the
--startflag or setKDN_INIT_AUTO_START=1to automatically start the workspace after registration, combininginitandstartinto a single operation - All directory paths are converted to absolute paths for consistency
- The workspace ID is a unique identifier generated automatically
- Workspaces can be listed using the
workspace listcommand - The default configuration directory (
.kaiden) is created inside the sources directory unless specified otherwise - JSON output format is useful for scripting and automation
- Without
--verbose, JSON output returns only the workspace ID - With
--verbose, JSON output includes full workspace details (ID, name, agent, paths) - Use
--show-logsto display the full stdout and stderr from runtime commands (e.g.,podman buildoutput during image creation) - JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure
workspace list - List All Registered Workspaces¶
Lists all workspaces that have been registered with kdn. Also available as the shorter alias list.
Usage¶
Flags¶
--output, -o <format>- Output format (supported:json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
List all workspaces (human-readable format):
Output:ID: a1b2c3d4e5f6...
Name: myproject
Project: /absolute/path/to/myproject
Agent: claude
Sources: /absolute/path/to/myproject
Configuration: /absolute/path/to/myproject/.kaiden
State: running
ID: f6e5d4c3b2a1...
Name: another-project
Project: /absolute/path/to/another-project
Agent: goose
Sources: /absolute/path/to/another-project
Configuration: /absolute/path/to/another-project/.kaiden
State: stopped
Use the short alias:
List workspaces in JSON format:
Output:{
"items": [
{
"id": "a1b2c3d4e5f6...",
"name": "myproject",
"agent": "claude",
"project": "/absolute/path/to/myproject",
"state": "running",
"paths": {
"source": "/absolute/path/to/myproject",
"configuration": "/absolute/path/to/myproject/.kaiden"
}
},
{
"id": "f6e5d4c3b2a1...",
"name": "another-project",
"agent": "goose",
"project": "/absolute/path/to/another-project",
"state": "stopped",
"paths": {
"source": "/absolute/path/to/another-project",
"configuration": "/absolute/path/to/another-project/.kaiden"
}
}
]
}
List with short flag:
Notes¶
- When no workspaces are registered, the command displays "No workspaces registered"
- The JSON output format is useful for scripting and automation
- All paths are displayed as absolute paths for consistency
- JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure
workspace start - Start a Workspace¶
Starts a registered workspace by its name or ID. Also available as the shorter alias start.
Usage¶
Arguments¶
NAME|ID- The workspace name or unique identifier (required)
Flags¶
--output, -o <format>- Output format (supported:json)--show-logs- Show stdout and stderr from runtime commands (cannot be combined with--output json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Start a workspace by ID:
Output:a1b2c3d4e5f6... (ID of started workspace) Start a workspace by name:
Output:a1b2c3d4e5f6... (ID of started workspace) Use the short alias:
View workspace names and IDs before starting:
# First, list all workspaces to find the name or ID
kdn list
# Then start the desired workspace (using either name or ID)
kdn start my-project
JSON output:
Output:JSON output with short flag:
Show runtime command output:
Error Handling¶
Workspace not found (text format):
Output:Workspace not found (JSON format):
Output:Notes¶
- You can specify the workspace using either its name or ID (both can be obtained using the
workspace listorlistcommand) - The command always outputs the workspace ID, even when started by name
- Starting a workspace launches its associated runtime instance
- The workspace runtime state is updated to reflect that it's running
- JSON output format is useful for scripting and automation
- When using
--output json, errors are also returned in JSON format for consistent parsing - JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure
workspace stop - Stop a Workspace¶
Stops a running workspace by its name or ID. Also available as the shorter alias stop.
Usage¶
Arguments¶
NAME|ID- The workspace name or unique identifier (required)
Flags¶
--output, -o <format>- Output format (supported:json)--show-logs- Show stdout and stderr from runtime commands (cannot be combined with--output json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Stop a workspace by ID:
Output:a1b2c3d4e5f6... (ID of stopped workspace) Stop a workspace by name:
Output:a1b2c3d4e5f6... (ID of stopped workspace) Use the short alias:
View workspace names and IDs before stopping:
# First, list all workspaces to find the name or ID
kdn list
# Then stop the desired workspace (using either name or ID)
kdn stop my-project
JSON output:
Output:JSON output with short flag:
Show runtime command output:
Error Handling¶
Workspace not found (text format):
Output:Workspace not found (JSON format):
Output:Notes¶
- You can specify the workspace using either its name or ID (both can be obtained using the
workspace listorlistcommand) - The command always outputs the workspace ID, even when stopped by name
- Stopping a workspace stops its associated runtime instance
- The workspace runtime state is updated to reflect that it's stopped
- JSON output format is useful for scripting and automation
- When using
--output json, errors are also returned in JSON format for consistent parsing - JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure
workspace terminal - Connect to a Running Workspace¶
Connects to a running workspace with an interactive terminal session. Also available as the shorter alias terminal.
Usage¶
Arguments¶
NAME|ID- The workspace name or unique identifier (required)COMMAND...- Optional command to execute instead of the default agent command
Flags¶
--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Connect using the default agent command (by ID):
Connect using the default agent command (by name):
This starts an interactive session with the default agent (typically Claude Code) inside the running workspace container.
Use the short alias:
Run a bash shell:
Run a command with flags (use -- to prevent kdn from parsing them):
The -- separator tells kdn to stop parsing flags and pass everything after it directly to the container. This is useful when your command includes flags that would otherwise be interpreted by kdn.
List workspaces and connect to a running one:
# First, list all workspaces to find the ID
kdn list
# Start a workspace if it's not running
kdn start a1b2c3d4e5f6...
# Then connect with a terminal
kdn terminal a1b2c3d4e5f6...
Error Handling¶
Workspace not found:
Output:Workspace not running:
Output:In this case, you need to start the workspace first:
Notes¶
- The workspace must be in a running state before you can connect to it. Use
workspace startto start a workspace first - You can specify the workspace using either its name or ID (both can be obtained using the
workspace listorlistcommand) - By default (when no command is provided), the runtime uses the
terminal_commandfrom the agent's configuration file - For example, if the workspace was created with
--agent claude, it will use the command defined inclaude.json(typically["claude"]) - This ensures you connect directly to the configured agent
- You can override the default by providing a custom command (e.g.,
bash,python, or any executable available in the container) - Use the
--separator when your command includes flags to prevent kdn from trying to parse them - The terminal session is fully interactive with stdin/stdout/stderr connected to your terminal
- The command execution happens inside the workspace's container/runtime environment
- JSON output is not supported for this command as it's inherently interactive
- Runtime support: The terminal command requires the runtime to implement the Terminal interface. The Podman runtime supports this using
podman exec -it
workspace remove - Remove a Workspace¶
Removes a registered workspace by its name or ID. Also available as the shorter alias remove.
Usage¶
Arguments¶
NAME|ID- The workspace name or unique identifier (required)
Flags¶
--force, -f- Stop the workspace if it is running before removing it--output, -o <format>- Output format (supported:json)--show-logs- Show stdout and stderr from runtime commands (cannot be combined with--output json)--storage <path>- Storage directory for kdn data (default:$HOME/.kdn)
Examples¶
Remove a workspace by ID:
Output:a1b2c3d4e5f6... (ID of removed workspace) Remove a workspace by name:
Output:a1b2c3d4e5f6... (ID of removed workspace) Use the short alias:
View workspace names and IDs before removing:
# First, list all workspaces to find the name or ID
kdn list
# Then remove the desired workspace (using either name or ID)
kdn remove my-project
Remove a running workspace (stops it first):
Output:a1b2c3d4e5f6... (ID of removed workspace) JSON output:
Output:JSON output with short flag:
Show runtime command output:
Error Handling¶
Workspace not found (text format):
Output:Workspace not found (JSON format):
Output:Removing a running workspace without --force:
Attempting to remove a running workspace without --force will fail because the runtime refuses to remove a running instance. Stop the workspace first, or use --force:
# Stop first, then remove
kdn stop a1b2c3d4e5f6...
kdn remove a1b2c3d4e5f6...
# Or remove in one step
kdn remove a1b2c3d4e5f6... --force
Notes¶
- You can specify the workspace using either its name or ID (both can be obtained using the
workspace listorlistcommand) - The command always outputs the workspace ID, even when removed by name
- Removing a workspace only unregisters it from kdn; it does not delete any files from the sources or configuration directories
- If the workspace name or ID is not found, the command will fail with a helpful error message
- Use
--forceto automatically stop a running workspace before removing it; without this flag, removing a running workspace will fail - Tab completion for this command suggests only non-running workspaces by default; when
--forceis specified, all workspaces are suggested - JSON output format is useful for scripting and automation
- When using
--output json, errors are also returned in JSON format for consistent parsing - JSON error handling: When
--output jsonis used, errors are written to stdout (not stderr) in JSON format, and the CLI exits with code 1. Always check the exit code to determine success/failure