Skip to content

knosh init

Write a default Knosh configuration file.

Synopsis

knosh init [--global]

Description

init writes a JSON file containing all configuration defaults. Run it once to create a starting point before customizing Knosh's settings.

Without --global, the file is written to .knosh.json in the current directory, which applies only to that project. With --global, three things happen:

  • The global config file is written to ~/.config/knosh/knosh.json and applies to all projects that do not have a local config.
  • The default agents directory (~/.config/knosh/agents/) is created so you can immediately add agent files.
  • The default commands directory (~/.config/knosh/commands/) is created so you can immediately add file-defined command files.

Options

--global

Write to ~/.config/knosh/knosh.json instead of .knosh.json in the current directory.

If ~/.config/knosh/ already exists when knosh init --global is run, the config file is left unchanged. Any bundled commands that are not yet present in ~/.config/knosh/commands/ are installed automatically. Existing command files are never overwritten. This makes it safe to re-run knosh init --global after upgrading Knosh to pick up newly shipped bundled commands.

Examples

Create a global config:

knosh init --global
# Config written to /Users/alice/.config/knosh/knosh.json
# Agents directory created at /Users/alice/.config/knosh/agents
# Commands directory created at /Users/alice/.config/knosh/commands

Create a project-local config:

cd my-project
knosh init
# Config written to .knosh.json