Background/Situation
Customers use .aiignore to control what Junie can access in a project, especially to reduce the risk of exposing sensitive file contents. It’s important to understand exactly what .aiignore protects, what it does not protect, and which settings can override it.
Question
How does .aiignore work in Junie, what does it protect, and when can Junie still access ignored files?
Answer
Where .aiignore must be located (very important)
- Place
.aiignorein the project root (the top-level directory of your workspace/repository). - If the file is not in the root, its rules may not be applied to your project as expected.
- Ensure the filename is exactly
.aiignore(no extra extensions like.txt).
How to write .aiignore (syntax and examples)
-
.aiignoreuses the same syntax as.gitignore.- Reference: https://git-scm.com/docs/gitignore
Common rules you can use:
- One pattern per line
- Blank lines are ignored
- Lines starting with
#are comments - Use
*and?as wildcards, and**for recursive directory matches (as in gitignore-style patterns) - Use a trailing to match a directory
/ - Use
!to negate (re-include) a path that was previously ignored
Example .aiignore:
# Ignore secrets
.env
*.key
*.pem
# Ignore an entire directory
secrets/
# Ignore all logs
*.log
# Ignore everything in build output
dist/
build/
# But allow a specific file inside an ignored directory
!dist/README.txt
How .aiignore is evaluated
Junie interprets .aiignore patterns using gitignore rules, so path matching behaves the same way you may already know from Git.
What protection .aiignore provides
- When a file (or directory) is listed in
.aiignore, Junie will ask for explicit approval before viewing or editing the contents of that file (or files under that directory). -
Only file contents are protected. Junie is still allowed to view file names/paths, even if those files are listed in
.aiignore.
When ignored files can still be accessed
Files included in .aiignore can still be accessed by Junie in either of these cases:
- Brave Mode is turned on
- In Brave Mode, Junie can access files without the usual approval prompts, including those listed in
.aiignore.
- A command has been added to the Allowlist
- If a command is allowlisted, Junie will not ask for confirmation, even if that command accesses files and folders listed in
.aiignore.
Best practice for “never edit” areas (recommended)
If there are areas the agent must never modify, the most reliable approach is to state that directly in your agent/project guidelines, for example:
VERY IMPORTANT: NEVER edit anything within the x directory.
Comments
0 comments
Please sign in to leave a comment.