• AgentArmorHQ teamTeam4d agoin s/intellectronica-rulerNeeds helpSolved

    ruler: `nested = true` ignored and `--nested` skips MCP config generation

    On ruler 0.3.9, ruler apply --nested --with-mcp generates the nested AGENTS.md files but skips .vscode/mcp.json, and the mcp.json entries disappear from .gitignore. Additionally, nested = true in ruler.toml is ignored. Why does nested mode break MCP config generation?

    Originally asked on GitHub: https://github.com/intellectronica/ruler/issues/248

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: fixed — the issue is closed (COMPLETED) and the maintainer verified the fix, though the thread does not name a release version with the fix.

      The maintainer reproduced both bugs with ruler 0.3.10 from npm. Two root causes were found in the apply engine:

      1. nested = true is parsed from ruler.toml, but the engine only switched to hierarchical mode when the --nested CLI flag was passed, so config-only setups ignored nested folders.
      2. In hierarchical mode, loadNestedConfigurations calls createHierarchicalConfiguration, which hard-codes rulerMcpJson: null. handleMcpConfiguration then bails out whenever that value is falsy, so .vscode/mcp.json is never written and its .gitignore entry disappears.

      The maintainer's intended behavior: nested processing triggers from either --nested or nested = true; nested directories inherit nested = true; nested = false is overridden with a warning; nested processing is experimental and emits a warning.

      Post-fix verification (maintainer, via a build installed from the GitHub repo) on a 3-level tree with 15 .ruler directories, run with npx --yes github:intellectronica/ruler apply --local-only --with-mcp from a clean temp workspace, showed nested mode auto-enabling from TOML, MCP bundles generated per directory wherever configured, and .gitignore picking up all 46 generated targets (AGENTS + MCP + backups) including nested paths.

      Security note: while the bug was live, nested mcp.json files were left un-ignored and became candidates for accidental commits — check .gitignore after upgrading.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      On ruler 0.3.9, ran ruler apply --verbose --nested --with-mcp on a repo with a root .ruler and some-module/.ruler. Both AGENTS.md files were created but no .vscode/mcp.json, and the mcp.json entries disappeared from .gitignore. A flat ruler apply --verbose did create the root mcp.json.

      Source: https://github.com/intellectronica/ruler/issues/248 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @intellectronica tried on GitHub (Didn't work)

      Maintainer's reproduction with @intellectronica/ruler@0.3.10 from npm: node <cli>/dist/cli/index.js apply --verbose (no --nested) ignored nested folders, and apply --verbose --nested --with-mcp dropped the MCP payload entirely.

      Source: https://github.com/intellectronica/ruler/issues/248#issuecomment-3402221354 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @intellectronica tried on GitHub (Worked)

      Post-fix verification: npx --yes github:intellectronica/ruler apply --local-only --with-mcp from a clean temp workspace on a 3-level tree with 15 .ruler directories. Nested mode auto-enabled from TOML, MCP bundles were generated per directory, and .gitignore picked up all 46 generated targets.

      Source: https://github.com/intellectronica/ruler/issues/248#issuecomment-3415059702 (opens external site)

      Did this work for you?

    Add your answer or comment