Skip to content

fix(subagents): follow symlinked .rulesync in MCP tools and address #3187 follow-ups - #3232

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3227-subagent-followups
Sep 30, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3227-subagent-followups

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-ups from the #3187 review collected in #3227.

  • (1) MCP symlinked .rulesync — list/get/put/delete no longer run the cwd → .rulesync/subagents realpath check, so a symlinked .rulesync or .rulesync/subagents (e.g. into a dotfiles repo) works again, as it did before fix(claudecode): import nested subagents #3187 and as the CLI generate path does. The check below the subagents directory (subagentsDir → target file) stays for get, put and delete. Decision: get keeps it too (the issue suggested writes/deletes only), and list now applies the same guard per file, so list and get agree: a symlink below .rulesync/subagents/ (file or directory) is neither listed nor read. A missing .rulesync/subagents/ makes get report not found and delete a no-op instead of a misleading symlink error. The existing test that asserted the old rejection is rewritten to assert that list/get/put/delete succeed through both link points.
  • (2) --delete sweep — resolved by 08fb67a in fix(claudecode): import nested subagents #3187 (invalid Markdown is skipped on import and excluded from the sweep). Valid but unmanaged nested agents are still swept; that is documented and matches the top-level behavior, so no change.
  • (3) MCP path contract — the path must be a .md file under .rulesync/subagents/; the directory itself ("" relative path), non-.md paths, paths with a dot-prefixed segment (skipped by list and generate) and bare file names are rejected. Documented in docs/reference/mcp-server.md.
  • (4) Upgrade note in docs/reference/file-formats.md: subdirectories of .rulesync/subagents/ are now loaded.
  • (5) filePattern.startsWith("**/") replaced with an explicit supportsNestedPaths meta flag (claudecode, claudecode-legacy, kimi-code), with a test pinning the flag to the recursive patterns.
  • (6) Generate warns when two targeted subagents of a nested-capable target share a frontmatter name (both are still written).
  • (7) Tests: flat-import dedupe by name; the flat-target skip now covers cursor, DeepAgents and Roo. The case-only path collision test (Review/Agent.md vs review/agent.md) already landed with fix(claudecode): import nested subagents #3187.

Not in this PR

  • (8) Symlink loop guard / depth cap for the recursive loaders. findFilesByGlobs already dedupes results by real file, but two self-referencing links still make the walk grow until ELOOP. A depth cap needs a chosen limit (and silently drops deeper files), so it is left for a separate decision. Hence Refs #3227.

Test plan

  • pnpm cicheck passes locally.

Refs #3227

🤖 Generated with Claude Code

dyoshikawa and others added 3 commits September 30, 2026 06:08
…ested-subagent follow-ups

- MCP subagent tools no longer reject a symlinked `.rulesync` or
  `.rulesync/subagents`; only the part below the subagents directory is
  confined, matching the CLI and the other MCP features.
- MCP subagent paths must be a `.md` file under `.rulesync/subagents/`;
  the directory itself is rejected. Document the path contract.
- Replace the `filePattern.startsWith("**/")` check with an explicit
  `supportsNestedPaths` meta flag.
- Warn when nested subagents targeting a name-keyed tool share a name.
- Document that `.rulesync/subagents/` subdirectories are now loaded.
- Add tests for flat-import name dedupe and the flat-target skip for
  DeepAgents and Roo.

Refs #3227

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… directory

Address review: skip symlinked files in list, reject dot-prefixed path
segments, treat a missing subagents directory as not found / no-op,
tighten test assertions and doc wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dyoshikawa
dyoshikawa force-pushed the resolve-issue-3227-subagent-followups branch from 9d052af to 1bd8823 Compare September 30, 2026 13:09
@dyoshikawa
dyoshikawa merged commit 4de4afa into main Sep 30, 2026
9 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-issue-3227-subagent-followups branch September 30, 2026 13:29
dyoshikawa added a commit that referenced this pull request Oct 1, 2026
…-mcp-followups

fix(subagents): address MCP subagents follow-ups from #3232 review
cacarico pushed a commit to cacarico/rulesync that referenced this pull request Oct 1, 2026
…review

Key the nested duplicate-name warning on the name each tool resolves (Kimi Code override and lowercasing), check supportsNestedPaths in both directions, log intended symlink skips in MCP list at debug level, and document that MCP subagent writes follow a symlinked .rulesync outside the project.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01Y4MwhqMc6s4ct5MzMReGJj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant