ruler: `nested = true` ignored and `--nested` skips MCP config generation
On ruler 0.3.9,
ruler apply --nested --with-mcpgenerates the nested AGENTS.md files but skips.vscode/mcp.json, and the mcp.json entries disappear from.gitignore. Additionally,nested = trueinruler.tomlis ignored. Why does nested mode break MCP config generation?Originally asked on GitHub: https://github.com/intellectronica/ruler/issues/248
4 answers
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:
nested = trueis parsed fromruler.toml, but the engine only switched to hierarchical mode when the--nestedCLI flag was passed, so config-only setups ignored nested folders.- In hierarchical mode,
loadNestedConfigurationscallscreateHierarchicalConfiguration, which hard-codesrulerMcpJson: null.handleMcpConfigurationthen bails out whenever that value is falsy, so.vscode/mcp.jsonis never written and its.gitignoreentry disappears.
The maintainer's intended behavior: nested processing triggers from either
--nestedornested = true; nested directories inheritnested = true;nested = falseis 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
.rulerdirectories, run withnpx --yes github:intellectronica/ruler apply --local-only --with-mcpfrom a clean temp workspace, showed nested mode auto-enabling from TOML, MCP bundles generated per directory wherever configured, and.gitignorepicking up all 46 generated targets (AGENTS + MCP + backups) including nested paths.Security note: while the bug was live, nested
mcp.jsonfiles were left un-ignored and became candidates for accidental commits — check.gitignoreafter upgrading.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
On ruler 0.3.9, ran
ruler apply --verbose --nested --with-mcpon a repo with a root.rulerandsome-module/.ruler. Both AGENTS.md files were created but no.vscode/mcp.json, and the mcp.json entries disappeared from.gitignore. A flatruler apply --verbosedid create the root mcp.json.Source: https://github.com/intellectronica/ruler/issues/248 (opens external site)
Did this work for you?What @intellectronica tried on GitHub (Didn't work)
Maintainer's reproduction with
@intellectronica/ruler@0.3.10from npm:node <cli>/dist/cli/index.js apply --verbose(no--nested) ignored nested folders, andapply --verbose --nested --with-mcpdropped the MCP payload entirely.Source: https://github.com/intellectronica/ruler/issues/248#issuecomment-3402221354 (opens external site)
Did this work for you?What @intellectronica tried on GitHub (Worked)
Post-fix verification:
npx --yes github:intellectronica/ruler apply --local-only --with-mcpfrom a clean temp workspace on a 3-level tree with 15.rulerdirectories. Nested mode auto-enabled from TOML, MCP bundles were generated per directory, and.gitignorepicked up all 46 generated targets.Source: https://github.com/intellectronica/ruler/issues/248#issuecomment-3415059702 (opens external site)
Did this work for you?
Related questions
- Trae AI in ruler: where are project rules and mcp.json stored?
- Does ruler support Amp, and where does it store rules?
- How do I stop ruler apply from creating .bak backup files?
- How can ruler support Roo Code .roorules / .roo/rules/* config files?
- Ruler generates backslashes on Windows, breaks Linux CI sync check