DEDUPED Hot AI repos, turned into use cases Get 5 a day

How to lock files so a coding agent cannot delete or edit them with Agent Security

Put an OS-level lock on key files and start the agent inside that protection so it cannot remove them.

Who it is forA developer whose agent once deleted or overwrote a file they care about and who wants that file out of reach regardless of how the agent names it.

The problemPattern rules match the words in a tool call, so a script or compiled program the agent writes can still delete a file without its name appearing in a call the guard reads.

The outcomeThe protected file stays intact while the agent runs under `solongate run`, and `protect list` shows what is actually holding each path.

What you need first

  • A machine where you can run a shell and git (the README installs with git clone and ./scripts/shell/install.sh)
  • Claude Code or Codex installed as the agent you want to guard
  • A new terminal after install, since hooks load only when a session starts
  • For the sandbox use case: Linux with bubblewrap (bwrap) installed, since the README says it is required and macOS and Windows refuse

Steps

  1. Complete the guard install from the repo README with ./scripts/shell/install.sh and open a new terminal.
  2. solongate protect ~/game/game.c
  3. solongate protect list
  4. solongate run -- claude
  5. Ask the agent to delete the protected file, then confirm it still exists.

Prompt for your agent

Using the SolonGate repo at https://github.com/solongate/agent-security, run `solongate protect <file-path>` and then `solongate run -- claude` in <project-path>. Expected output: the protected file cannot be deleted or written by the agent. Verify by running `solongate protect list` and checking that <file-path> is listed with the lock it is actually held by.

Caveat. On Linux the unprivileged fallback is chmod 0444, which stops writes but not rm, and the README says `protect list` reports that rather than printing protected.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page