---
title: "Discussion on \"Notes on making an AI agent ask before it pushes\" | Hashnode"
description: "Discussion on \"Notes on making an AI agent ask before it pushes\". My ask rules for an agent's git push and PR commands never fired. It chained them into one command. What wildcards fixed and what they didn't."
url: "https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Notes on making an AI agent ask before it pushes](https://remdore.hashnode.dev/notes-on-making-an-ai-agent-ask-before-it-pushes?utm_source=hashnode&utm_medium=feed)

My ask rules for an agent's git push and PR commands never fired. It chained them into one command. What wildcards fixed and what they didn't.

Nov 22 · 8 min read · remdore.hashnode.dev  
Read the article

-   [#ai](https://hashnode.com/tag/ai)
-   [#ai-agents](https://hashnode.com/tag/ai-agents)
-   [#git](https://hashnode.com/tag/git)
-   [#devops](https://hashnode.com/tag/devops)

## Written by

[Kalin Dimitrov](https://hashnode.com/@remdore)

@remdore · Sofia

  
[View profile](https://hashnode.com/@remdore)

## Responses 6

Markdown supported · ⌘↵ to post

[Focus 100](https://hashnode.com/@focus100)

[6d ago](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b099555b7d5091d5f8fd3dd)

Run 1 shows the limit of matching command strings: once the agent can use sh -c, a script file, a git alias or a Python subprocess, there's always another spelling of git push. Wildcards help, but the agent only has to be creative once, and it isn't even trying to evade you, it's just being efficient.

So I'd gate capability rather than text:

-   Your last point, "the token decides what's possible", runs straight into the public\_repo refusal. Until the connection accepts a narrower scope, the repo itself can still say no: a ruleset on main that blocks direct pushes and requires a pull request, with an empty bypass list so it also binds the owner's token, makes a push that slips past the rule fail on GitHub's side.
-   Expose push as its own tool that takes structured arguments (remote, branch) and requires approval. Then the approval binds to the action, not to one exact command string, and a retry after a failed push doesn't need a new prompt for a different spelling.
-   Treat "did not answer" as no. The 7 ms non-answer in run 1, after which the agent picked a neutral identity and carried on, is the case to block: a missing answer should stop that step, not choose a default.

[Kalin Dimitrov](https://hashnode.com/@remdore)

[4d ago](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b099555b7d5091d5f8fd3dd#reply-6b0c13baa6afff60e89be92f)

A ruleset on main wouldn't have changed either run. Both pushed a new branch, tests-for-flip, and run one then opened a PR, which is exactly what that ruleset asks for. It stops a push to main, and neither run tried one. For the case in the post it would have to cover creating and pushing branches too, and I haven't tried a ruleset that does. Agreed on the other two. A push tool with structured arguments would also have fixed the retry in run two, which needed a second approval only because the command string changed. And I didn't find a setting that makes an unanswered question stop the run, so for now that would have to go in the prompt, which is a weaker place for it.

[Focus 100](https://hashnode.com/@focus100)

[3d ago](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b099555b7d5091d5f8fd3dd#reply-6b0ce0fc61e24cde7f45d79b)

Fair point, I read the ruleset as covering more than it does. It only blocks a push to main, so neither run would have hit it. Branch creation can be restricted separately, but only by targeting all branches, and then every new branch needs a bypass or an approval, which gets noisy. A push tool with structured arguments sounds like the cleaner fix. And agreed that putting "stop on no answer" in the prompt is the weaker place for it.

[Paul Pham](https://hashnode.com/@paulpham157)

[Nov 22](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b02f0867be5b0b4d050ffa3)

So when the ask timed out in 7 ms, the agent picked an author identity by itself. Does anything in PR #10 show that was its guess and not your choice?

[Kalin Dimitrov](https://hashnode.com/@remdore)

[4d ago](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b02f0867be5b0b4d050ffa3#reply-6b0c13d0877a34b517910f32)

Nothing that says it was a fallback. Both commits on PR #10 are authored as `Claude <noreply@anthropic.com>`, the PR was opened from my account because that's whose token the session had, and the description ends with the Claude Code footer. None of that says the author was a default the agent picked after an unanswered question. The only place that says so is the agent's final message in the run log. Someone reading the PR later would assume I chose it.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Nov 22](https://hashnode.com/posts/notes-on-making-an-ai-agent-ask-before-it-pushes/6b02a5f569e226abdb164989/comment/6b02b9b72f11a7378a43a3ad)

That real command trace shows why naive command-prefix allowlists fail even with a completely benign agent: prefix-matching git push \* misses chained shell commands starting with cd and inline -c flags without anyone trying to bypass a rule.

Even wildcard patterns on bash strings are fragile because shell quoting, subshells, or scripts can still hide a push. For high-stakes boundaries like pushing branches or opening PRs, enforcing permissions at the credential or API-token scope—holding write tokens behind an approval proxy rather than inside the shell environment—is far harder to trip over accidentally.
