﻿# Junie guidelines: project rules and global instructions

Junie CLI guideline discovery and project/global precedence are documented mechanisms; identify the selected source and verify its effect without generalizing CLI rules to every IDE.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-junie-guidelines-precedence/
Language: en

Persistent guidelines help a coding agent discover project conventions without repeating them in every task. Junie CLI documents where it looks for those guidelines and how project guidance relates to global preferences. The discovery order matters when an apparently correct instruction exists on disk but is not the instruction source the current task uses.

## Begin with the documented discovery order

The Junie CLI guide lists a project-local .junie/AGENTS.md first, followed by another project-root arrangement and then legacy guideline locations. This is a selection path, not an instruction to concatenate every file with a familiar name indiscriminately. Imagine a repository with an older style rule and a newer dedicated Junie file. Establish which documented location is selected before explaining why the agent followed one convention. The existence of an unused file does not prove that its contents entered the task.

## Shared project guidance can use a different arrangement

The guide describes the root AGENTS.md combined with .junie/playbook.md and rule files when that arrangement is selected. A repository can therefore separate general project facts from supporting Junie guidance within the documented path. The useful engineering question is what information the selected combination supplies. Duplicating conflicting versions of a build command across locations makes diagnosis harder, while a clear authoritative project command gives the agent a concrete operation whose result the developer can inspect.

## Project and global preferences have explicit precedence

The documentation also describes global guidance and says project guidance takes precedence when the two conflict. Consider a global preference for one package tool and a repository that uses another. The project-specific requirement can explain the expected choice. This is a documented instruction relationship, not proof that a sentence alone changes operating-system permissions. The agent still runs within its configured environment. Persistent guidance provides task context and conventions; execution controls determine what operations the environment permits.

## Verify the effect through a bounded task

After changing guidance, a useful check asks the agent to identify the project’s documented build approach or perform an authorized small task that uses it. Inspect the observed choice rather than assuming that saving a file proves its effect. Keep the interface and guideline locations in the record, particularly when comparing CLI and IDE behavior. The JetBrains chat documentation provides related workflow context but does not make the CLI discovery order universal. Precise scope keeps an instruction explanation useful as the tools evolve.

## Primary sources

- [JetBrains AI chat mode](https://www.jetbrains.com/help/ai-assistant/chat-mode.html).

- [JetBrains AI Chat](https://www.jetbrains.com/help/ai-assistant/ai-chat.html).

- [Junie CLI guidelines and memory](https://junie.jetbrains.com/docs/guidelines-and-memory.html).

Related engineering context: [Choosing an AI development stack](/journal/local-ai-app-stack-selection/); [Git state and undo](/journal/aider-git-dirty-tree-undo/).
