[FEATURE]: Global config with custom rules #2833

Open
opened 2026-02-16 17:37:28 -05:00 by yindo · 4 comments
Owner

Originally created by @marcinpz on GitHub (Nov 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Hi,
What is missing for me:
I want to have global rules (~/.config/openspec/config.json).
So for example I would like for:

  • proposal command to stop before implementing change (now it just continues)
  • apply command to make sure git status is clean, we are on main branch -> create new git branch
  • on the apply finish - commit/push/create PR
Originally created by @marcinpz on GitHub (Nov 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Hi, What is missing for me: I want to have global rules (~/.config/openspec/config.json). So for example I would like for: - proposal command to stop before implementing change (now it just continues) - apply command to make sure git status is clean, we are on main branch -> create new git branch - on the apply finish - commit/push/create PR
yindo added the discussion label 2026-02-16 17:37:28 -05:00
Author
Owner

@pakar commented on GitHub (Nov 15, 2025):

This brings up a important topic.

I have also had issues where opencode starts doing commits even with *** CRITICAL *** directions that it must ask for approval. Relying on the LLM to follow instructions 100% is problematic.

A simple toggle you could switch on/off to allow commits/branches etc would be useful, or perhaps a popup approval-request to the user.
This would still allow it to use git log/diff/status etc while blocking dangerous things, unless approved by the user.
If the LLM tries to execute a git commit without approval it would result in it receiving a automated "To perform this git commit you must first ask the user for permission and present a description of the commit" or similar.

This could be expanded a bit more. This might be useful for more than git, like preventing the LLM from trying to build things by itself without using scripts/makefiles for the project. Lets say you don't want it be allowed to run "go run" but still allowed to run "go build" you can have responses that steer it back to using preferred ways. and if you don't want it to run any go build/run by itself you would set a response for that tool to say "Use X for building"

Just throwing out a rough idea i have had the last few days regarding this issue, just to get it documented.

@pakar commented on GitHub (Nov 15, 2025): This brings up a important topic. I have also had issues where opencode starts doing commits even with *** CRITICAL *** directions that it must ask for approval. Relying on the LLM to follow instructions 100% is problematic. A simple toggle you could switch on/off to allow commits/branches etc would be useful, or perhaps a popup approval-request to the user. This would still allow it to use git log/diff/status etc while blocking dangerous things, unless approved by the user. If the LLM tries to execute a git commit without approval it would result in it receiving a automated "To perform this git commit you must first ask the user for permission and present a description of the commit" or similar. This could be expanded a bit more. This might be useful for more than git, like preventing the LLM from trying to build things by itself without using scripts/makefiles for the project. Lets say you don't want it be allowed to run "go run" but still allowed to run "go build" you can have responses that steer it back to using preferred ways. and if you don't want it to run any go build/run by itself you would set a response for that tool to say "Use X for building" Just throwing out a rough idea i have had the last few days regarding this issue, just to get it documented.
Author
Owner

@doodhout commented on GitHub (Nov 15, 2025):

Isn't this already possible using permissions in the opencode.json file? Cf. https://opencode.ai/docs/permissions/#agents

@doodhout commented on GitHub (Nov 15, 2025): Isn't this already possible using permissions in the opencode.json file? Cf. https://opencode.ai/docs/permissions/#agents
Author
Owner

@rekram1-node commented on GitHub (Nov 16, 2025):

Yeah like @doodhout is saying I would highly recommend using permissions @pakar, I use them myself:

  "permission": {
    "bash": {
      "rm*": "ask",
      "git push*": "ask",
      "git checkout*": "ask",
      "git commit*": "ask",
    },
  },

^^ This is in my ~/.config/opencode/opencode.json

@rekram1-node commented on GitHub (Nov 16, 2025): Yeah like @doodhout is saying I would highly recommend using permissions @pakar, I use them myself: ``` "permission": { "bash": { "rm*": "ask", "git push*": "ask", "git checkout*": "ask", "git commit*": "ask", }, }, ``` ^^ This is in my ~/.config/opencode/opencode.json
Author
Owner

@pakar commented on GitHub (Nov 23, 2025):

@rekram1-node

I think you have misunderstood the point i was trying to make.

This is about being able to steer the LLM away from trying to do things not permitted during stages. Having to exit the CLI and modify the config files for these things when you want a changed behavior is not what i was talking about. Sure you can use different agents but then you would have to manage a much more complex setup of agents and subagents.

But to take a few examples of what i could see today during some testing:

  • I managed to erase the full .git folder in the folder.
  • It managed to call "git config" to set global configs for the user (LLM hallucinating?) even with:
permissions:
  bash:
    "rm *": "ask"
    "git config *": "deny"
  • It started looking outside of the project-folder because it failed to find a go.mod file. The file was actually in a subfolder within the project, but it still broke out of the project-root and started looking 2 parent-folders up before i stopped it.

There seems to be a multitude of ways it tries to modify files when one option gets denied, but not sure how it could have gotten past the "git config *": "deny"

This is why i was speaking about being able to give more feedback to the llm instead of just a basic "allow" "deny" or "ask".

I did not see these things happen with "Grok Code Fast 1" and only with "Big Pickle" so i assume it's the LLM that figures out how to bypass the local permissions when it initially gets denied.

So far i'm just working in a test-project so no real harm, but when it broke out of the project-folder it started to become dangerous.

@pakar commented on GitHub (Nov 23, 2025): @rekram1-node I think you have misunderstood the point i was trying to make. This is about being able to steer the LLM away from trying to do things not permitted during stages. Having to exit the CLI and modify the config files for these things when you want a changed behavior is not what i was talking about. Sure you can use different agents but then you would have to manage a much more complex setup of agents and subagents. But to take a few examples of what i could see today during some testing: - I managed to *erase* the full .git folder in the folder. - It managed to call "git config" to set global configs for the user (LLM hallucinating?) even with: ``` permissions: bash: "rm *": "ask" "git config *": "deny" ``` - It started looking outside of the project-folder because it failed to find a go.mod file. The file was actually in a subfolder within the project, but it still broke out of the project-root and started looking 2 parent-folders up before i stopped it. There seems to be a multitude of ways it tries to modify files when one option gets denied, but not sure how it could have gotten past the "git config *": "deny" This is why i was speaking about being able to give more feedback to the llm instead of just a basic "allow" "deny" or "ask". I did not see these things happen with "Grok Code Fast 1" and only with "Big Pickle" so i assume it's the LLM that figures out how to bypass the local permissions when it initially gets denied. So far i'm just working in a test-project so no real harm, but when it broke out of the project-folder it started to become dangerous.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2833