u/No-Childhood-2502

I got tired of Claude Code silently dying at rate limits during mid task, so I built something
▲ 15 r/ClaudeCode+1 crossposts

I got tired of Claude Code silently dying at rate limits during mid task, so I built something

I got tired of Claude Code silently hitting rate limits, so I decided to build something to address the issue.

Imagine you’re 40 minutes into a refactor. Claude is running tools and making progress, then suddenly, everything stops. The session has reached its rate limit without any warning—no alert saying you’re at 95%, just a complete halt. The usage bars are visible in the UI, but the model itself remains unaware of them.

I discovered that Anthropic has a usage API, and Claude Code already possesses hooks to make it work. This led me to create agent-baton, which reads the usage API and installs hooks to make Claude aware of its limits.

Here are the three hooks you can initiate with one command (baton init):

  1. SessionStart: Fetches usage data and injects it so Claude knows from the first message how much has been used.
  2. UserPromptSubmit: Performs a time-to-live (TTL) aware check that avoids overwhelming the API. It uses smart caching—checking every 15 minutes when usage is low and once a minute when it's nearing the limit.
  3. PreToolUse: This is the crucial one; it checks usage mid-task to prevent the scenario where you “started at 93% and ran out of capacity mid-execution,” catching the problem within 1-2 tool calls.

When the warning threshold is reached, it prompts an interactive question using Claude Code's built-in AskUserQuestion tool:

"Claude 5-hour usage is at 91% — you're in the warning zone."

Options include:

  • Continue this task
  • Write a handoff document
  • Switch to lightweight mode

It also handles full agent handoffs by writing a structured markdown handoff and passing work to Cursor, Codex, or Gemini.

You can install it with the following command:

npm install -g u/codeprakhar25/agent-baton && baton init

For more details, visit the GitHub repository.

u/No-Childhood-2502 — 15 hours ago

Have been obsessed with the field of code security for weeks, and I started with how, if we trace the autonomous code by agents, capturing the prompt that drove it, the intent behind it, and the context the agent had.

I built agentdiff, it hooks into all major coding agents and works with the git hooks, no additional changes- configure & init!

I didn't expect this, but PR review agents got noticeably better once they had access to the traces. More context on what changed and why = fewer false positives, better suggestions.

Opensource here: https://github.com/codeprakhar25/agentdiff

u/No-Childhood-2502 — 19 days ago
▲ 2 r/github+2 crossposts

Have been obsessed with the field of code security for weeks, and I started with how, if we trace the autonomous code by agents, capturing the prompt that drove it, the intent behind it, and the context the agent had.

I built agentdiff, it hooks into all major coding agents and works with the git hooks, no additional changes- configure & init!

I didn't expect this, but PR review agents got noticeably better once they had access to the traces. More context on what changed and why = fewer false positives, better suggestions.

Opensource here: https://github.com/codeprakhar25/agentdiff

u/No-Childhood-2502 — 11 days ago
▲ 4 r/projects+1 crossposts

I released agentdiff today, line-level attribution for AI-generated code, all things code security. Have been working on it for weeks!

When Claude Code or Cursor commits to your repo, git blame tells you the agent's name. It doesn't get you what prompt drove it, what files it had in context, or what it never saw. AgentDiff works on the same, it hooks into your coding agent and captures all of that as a tamper-proof trace — per line, per session, pushed with your code.

I didn't expect this but: PR review agents got noticeably better once they had access to the traces. More context on what changed and why = fewer false positives, better suggestions (More on the PR on agentdiff).

Opensource. Would appreciate some feedback/discussions, and contributions!
https://github.com/codeprakhar25/agentdiff

u/No-Childhood-2502 — 8 days ago

I have been working with code security for some weeks, and thought of whether tracing each line of the codebase could be helpful for the agent, with capturing the prompt that drove it, and the intent behind it!

Tested on the PR attached, and awesome to see the report and how the greptile agent worked.

u/No-Childhood-2502 — 20 days ago

Quite obsessed about the code security with agents writing more and more code, especially in large codebases.

How does the security team see it, Is it being normal as human authored itself?
How do you maintain the same code standard and reviews while the PR is AI-authored?

Code review agents also don't have information about the code contributions through the agents.

reddit.com
u/No-Childhood-2502 — 22 days ago

So, when AI agents like Cursor or Claude Code autonomously write code, and a human commits it, the commit history attributes the work solely to the human. There is no machine-readable record indicating which model, prompt, or session produced specific lines of code. I have been working on a tool to capture this information by hooking into agent callbacks and storing signed per-file attribution, but I am encountering compliance challenges on how it works there.

Specific Questions:

  1. Does any current framework (such as SOC 2 Type II, ISO 27001, PCI-DSS, or HIPAA) explicitly require the disclosure of AI-generated code as a distinct contributor in audit trails?
  2. If a vulnerability is found in AI-generated code, does the lack of attribution create liability exposure that would not exist if a human had written the same code?
  3. Are auditors currently inquiring about the use of AI tools in code review processes, or is this still under the radar?

Looking for anyone who has been through an audit recently where AI agent usage came up, or who knows where the frameworks currently land on this.

reddit.com
u/No-Childhood-2502 — 26 days ago