Skip to content

feat(junie): read one subdirectory level of agents and commands - #3983

Merged
dyoshikawa merged 4 commits into
mainfrom
resolve-issue-3888-junie-nested
Nov 26, 2026
Merged

dyoshikawa merged 4 commits into
mainfrom
resolve-issue-3888-junie-nested

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Finishes #3888. The optional description, strictJsonOutput and name-normalization items already landed (#3892, #3943, #3946); this PR adds the last one: Junie reads one subdirectory level of subagents and commands.

Upstream (re-checked 2026-11-26):

  • Subagents: "Junie CLI treats Markdown files in these directories and their immediate subdirectories as subagent definitions ... except files in skills/ directories." The name comes from frontmatter name or "the file name without the .md or .agent.md extension".
  • Custom slash commands: Junie "treats Markdown files in command directories and their immediate subdirectories as command definitions", and "the file name supplies the command name". The page documents no namespacing by directory.

Changes

  • Subagents processor: new maxNestingDepth and excludedSubdirectories factory meta, and filePattern may now be a list of globs. Junie uses ["*.md", "*/*.md"], supportsNestedPaths: true, maxNestingDepth: 1, excludedSubdirectories: ["skills"].
    • Generate keeps a one-level path (.rulesync/subagents/review/security.md -> .junie/agents/review/security.md). Sources nested deeper, or under skills/, are skipped with a warning.
    • Import and the orphan sweep scan .junie/agents/ and its immediate subdirectories, leaving out skills/. The import-only shared .agents/ root stays flat (*.md, new importOnlyRootFilePattern meta).
    • The existing nested-path duplicate-name warning (generate) and import identity de-duplication now apply to Junie.
  • JunieSubagent: the name derived from the file name now uses the basename, so review/security.md is security and not review/security.
  • Commands processor: new maxSubdirectoryDepth meta. Junie switches to supportsSubdirectory: true with depth 1, so import and the sweep glob ["*.md", "*/*.md"] and deeper sources are skipped with a warning on generate.
  • JunieCommand.validateRulesyncCommands: warns when two targeted commands share a file name (commit.md and git/commit.md are both /commit). This follows the existing Letta Code hook.
  • Docs: Junie notes in docs/reference/file-formats.md (subagents and commands), plus regenerated docs content.
  • Tests: import, generate, skipping deeper sources, excluding skills/ in both roots, the orphan sweep, nested naming and the duplicate-name warnings.

Design decisions

  • Layout mirrors the rulesync path. Nested targets already keep the relative path (Claude Code, Kiro). Junie reads one level deep, so .rulesync/<feature>/<dir>/<name>.md <-> .junie/<feature>/<dir>/<name>.md round-trips without a new naming scheme.
  • Depth cap rather than flattening. Deeper sources are skipped with a warning, the same way flat targets already skip nested subagents. Flattening them would silently move files and could collide.
  • The shared .agents/ root is imported flat. Junie also reads one nested level there, but .agents/ holds other tools' trees (.agents/commands/, .agents/workflows/, .agents/skills/), and reading them would import those files as subagents. Nested Junie agents belong in .junie/agents/. (Changed after review.)
  • --delete now sweeps one nested level of .junie/agents/ and .junie/commands/, so hand-written files there that no rulesync source produces are removed. The docs say so.
  • skills/ is excluded only at the top level of each agent root. With a depth cap of 1, that is the only place a skills/ directory can hold an agent file that Junie would otherwise read.
  • Name clashes warn and do not fail. Junie documents no conflict resolution. Both files are written and the user is told only one may load. This matches the existing nested-subagent and Letta Code behavior.
  • The command clash warning lives in a validateRulesyncCommands hook, as in Letta Code, and not behind a new processor flag. It ignores commands nested deeper than Junie reads, because those are skipped anyway.
  • No .gitignore change: the existing .junie/agents/ and .junie/commands/ entries already cover the subdirectories.

Skipped items

None.

Closes #3888

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 4 commits November 26, 2026 16:40
Junie treats Markdown files in its agent and command directories and their
immediate subdirectories as definitions (agents except `skills/`). Generate,
import and orphan-sweep one nested level for the junie target, skip deeper
sources and `skills/` agents with a warning, name nested agents after their
file alone, and warn when two Junie commands share a file name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
The shared .agents/ root also holds other tools' trees (commands/,
workflows/, ...), so reading it one level deep imported those files as
Junie subagents. Read nested agents only under .junie/agents/, document
that --delete now sweeps one nested level, and share one depth helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Keep both the Junie nesting meta and the new maxSubagents setting; regenerate docs content.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…nie-nested

# Conflicts:
#	src/generated/docs-content.ts
@dyoshikawa
dyoshikawa merged commit 63c2e00 into main Nov 26, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-3888-junie-nested branch November 26, 2026 08:44
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.

Follow up JetBrains Junie upstream updates: optional subagent description breaks import, nested agents/commands, hook strictJsonOutput dropped

1 participant