Skip to content

Local Configuration Directory Support#6

Closed
t4kamura wants to merge 1 commit intoyagi-agent:mainfrom
t4kamura:local-config-dir
Closed

Local Configuration Directory Support#6
t4kamura wants to merge 1 commit intoyagi-agent:mainfrom
t4kamura:local-config-dir

Conversation

@t4kamura
Copy link
Copy Markdown
Contributor

Hi!

I want to separate configuration directories for each project.
For example, I wanted to keep skills that are only used in a specific project grouped together.
Therefore, I changed the behavior so that if a .yagi/ directory exists in the current directory, it is prioritized over ~/.config/yagi/.

I also considered allowing the configuration directory to be specified via an environment variable (e.g., YAGI_CONFIG_DIR=/path/to/project/.yagi).
However, even if configuration via environment variables were supported, I thought it would be clearer to support non-global configuration directories by default.

Furthermore, in the future, it might be necessary to have a feature that merges files from global and local configuration directories (e.g., allowing skills from both ~/.config/yagi/skills/ and .yagi/skills/ to be used).

Please point out any better naming conventions or smarter methods if you have them.

@mattn
Copy link
Copy Markdown
Collaborator

mattn commented Feb 26, 2026

Thank you for the PR.

However, auto-loading .yagi/ from the current directory has a serious security risk. If a user clones a malicious repository containing a .yagi/ directory, the following are loaded without any user approval:

  • .yagi/tools/*.go — arbitrary code execution via yaegi (unrestricted.Symbols)
  • .yagi/IDENTITY.md — system prompt override (prompt injection)
  • .yagi/mcp.json — launches attacker-controlled commands

If you want to use auto-loading .yagi, this needs at minimum an explicit opt-in (e.g., confirmation prompt on first use) or restricting which files can be loaded from local config.

Specifying the config directory explicitly (e.g., via YAGI_CONFIG_DIR environment variable or a command-line flag) would be safe since it requires user intent. The concern is with automatic detection of .yagi/ in the working directory.

@t4kamura
Copy link
Copy Markdown
Contributor Author

t4kamura commented Mar 1, 2026

@mattn
Thanks for the detailed reply!
Totally get the security concerns with auto-loading—makes total sense.
I'll tweak it to use YAGI_CONFIG_DIR for explicit control, building on the current setup (PR coming soon).
Closing this PR.

@t4kamura t4kamura closed this Mar 1, 2026
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.

2 participants