Skip to content

Separate Input Root

The --input-root <path> flag lets you point rulesync generate at a .rulesync/ source directory that is different from the current working directory. This decouples where your rule definitions live from where the generated tool configuration files are written.

Currently supported on generate only. At present, --input-root is wired into the rulesync generate command only. Other commands (import, convert, gitignore, install, fetch, init) still read .rulesync/ from the current working directory. To use the same source directory with those commands, cd into the input-root directory first.

Primary use case: centralized rules across all repos

A common workflow is to keep a single set of AI rules in a shared directory (e.g. ~/.aiglobal) and apply them to every project without switching directories:

bash
# In any project directory — rules are read from ~/.aiglobal/.rulesync/
rulesync generate --input-root ~/.aiglobal --targets "*" --features rules

Without --input-root, you would have to cd ~/.aiglobal && rulesync generate and then cd - back, and the output files would land in ~/.aiglobal instead of the current project.

Step-by-step setup

  1. Create and initialize a shared rules directory:

    bash
    mkdir -p ~/.aiglobal
    cd ~/.aiglobal
    rulesync init
  2. Edit your shared rules (~/.aiglobal/.rulesync/rules/overview.md, etc.) to your preferences.

  3. From any project, generate configurations using the shared rules:

    bash
    # In your project directory
    rulesync generate --input-root ~/.aiglobal --targets claudecode --features rules

Comparison with --global

These two flags serve different but complementary purposes:

--input-root--global
ChangesSource location (where .rulesync/ is read from)Output location (writes to user-scope config paths, e.g. ~/.claude/)
Use whenYour rule definitions live in a non-CWD directoryYou want the output to go to the tool's global (user-scope) config

They can be combined. For example, to read rules from ~/.aiglobal and write them to Claude Code's global settings:

bash
rulesync generate --input-root ~/.aiglobal --global --targets claudecode --features rules

--input-root does not enable --global. When --input-root is explicitly provided, Rulesync reads .rulesync/ from that directory, but output scope still follows the CLI flags: use --global for user-scope output, and omit it for project-scope output. A "global": true setting in the rulesync.jsonc under --input-root is not applied unless you also pass --global, and Rulesync will emit a warning when dropping it so the override is visible.

--input-root is resolve()-ed to an absolute path before being used, but symbolic links inside the resolved directory are not dereferenced via realpath. If a symlink inside the input root points outside it, Rulesync will follow it transparently. Because --input-root is a deliberate user-supplied flag, treat it like any other source directory: only point Rulesync at trees you control.

Released under the MIT License.