Misc Coding Agent Tips and Scripts — workflow for Claude Code and Codex

A hook blocking destructive git commands in Claude Code, an AGENTS.md reminder after compaction and terminal setups.

Install in Claude Code and Codex

Other ways to install

Access and checks

How we review

Extended access. The tool runs code or makes network calls and only reads external data.

  • Installers run shell scripts and change Claude Code settings.
  • The hook matches command patterns and may miss an unusual way of writing an operation.

This is third-party code. Review the repository files before installing.

What it does

The repository collects practical guides from daily agent work. Each describes a problem, the fix and a configuration to copy. The main items for Claude Code are a `PreToolUse` hook that intercepts Bash commands such as `git checkout --`, `git reset --hard`, `git clean -f`, `git push --force` and `rm -rf` outside temp folders, and an `AGENTS.md` reminder that returns after context compaction. There are scripts to repair MCP configuration and update several agents. The rest covers WezTerm and Ghostty terminals, swap and remote development.

Who it is for. Developers running agents on real repositories who want mechanical protection against losing uncommitted work.

Good fit when

  • An agent once wiped uncommitted edits with `git checkout --` and you do not want a repeat.
  • Claude Code forgets project rules after context compaction.
  • MCP configuration vanished and must be restored fast.
  • A dozen agents in WezTerm slow down the multiplexer server.

Not a fit when

  • You need tamper-proof control: the hook catches common patterns but is not a replacement for backups and permissions.
  • You want a skills library or a plugin with a one-command install.
  • You do not use Claude Code, and the hook format is tied to it.

Example request

Install protection against destructive git commands for this project and verify it by feeding git checkout -- file.txt.

Limitations

The hook matches command patterns, so an inventive way of writing a dangerous operation may pass. Safe variants such as `git checkout -b` and `git clean -n` are allowed. The installers run shell scripts, so read them first: they change Claude Code settings and need a restart. Some guides concern the author's own setup, such as an MX Master mouse and a 10 GbE link, and have nothing to do with agents. The repository is not a plugin, so updates are pulled manually. The last commit is from November 2026.

How to disable. Remove the hook from Claude Code settings and delete `git_safety_guard.py`, then restart the agent. Delete installed scripts such as `claude-post-compact-reminder` from `~/.local/bin`.

FAQ

What does the hook block?

`git checkout -- <files>`, `git reset --hard`, `git clean -f`, `git push --force` and `rm -rf` outside temp paths. The agent gets a denial with an explanation.

How do I check that the hook works?

Feed the script JSON with the command `git checkout -- file.txt`. The reply should contain `permissionDecision: deny`.

Is the hook installed globally?

`install-claude-git-guard.sh` supports project-local install and a `--global` flag for all projects.

What does the post-compaction reminder do?

A hook returns the `AGENTS.md` content to the agent after context compaction so project conventions are not lost.

How is it better than normal permissions?

It is a complement. The hook explains the denial to the agent and stays with the project but does not replace filesystem permissions and backups.

Which agents does Misc Coding Agent Tips and Scripts work with?

Misc Coding Agent Tips and Scripts works in Claude Code and Codex.

Discussion

No questions or reviews yet.

README in short

The README opens with a summary table of guides with the problem and setup time, then describes each. The first section covers protection from destructive git commands.

README badge

Report a problem