Live Nov 18 · Cohort 3Nov 18, 19:00 MSK — free hands-on AI agents live workshop · Live Cohort 3 starts Nov 23Join Nov 18 Live →Cohort 3 (Nov 23)
ReleaseResearch Paper · For R&DHabr AI→ original

Claude Code with Kimi waited 22.6 s on command checks — a faster model cut it to 9.9 s

In Claude Code with Kimi K3.1 Pro, Auto mode is slow. Before a git push or a test run, a separate model call decides whether the command is safe. Across 646 actions in the logs, that check took 22.6 seconds on average, and for 30 subagents it ate 23.8% of their time. The author moved frequent commands into explicit allow rules that skip the model entirely and handed everything else to the fast Kimi K2.8. The average check dropped to 9.9 seconds from 22.6.

AI-processed from Habr AI; edited by Hamidun News
Claude Code with Kimi waited 22.6 s on command checks — a faster model cut it to 9.9 s
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Rules live in three placesglobal, project-level, and local ones for releases
Key metric #2K2.8 runs checks 2.3 times faster than K3.1 Pro, but this is not a benchmark
Key metric #3The rules protect against accidental mistakes but do not replace a sandbox

You ask the agent in Claude Code to run tests or do a git push. The main model has already replied, but the command doesn't start: the cursor freezes for seconds, sometimes for minutes. That is the problem one developer hit after Anthropic blocked his account and he switched to Kimi K3.1 Pro while staying in the familiar Claude Code. Slow code generation isn't to blame. A hidden check is: before a command runs, a second model call decides whether it is safe. If you run Claude Code with a third-party model and your agents "hang," this breakdown shows where to look for the cause and how to remove it.

Why the agent freezes before git push

The switch is technically simple: you change the API endpoint and model names in Claude Code's settings. On his own tasks, the author didn't feel that Kimi was noticeably worse than Opus 5.5. The downsides lie elsewhere. Kimi is more expensive, which means smaller limits on the subscription, and in his assessment Kimi's own Kimi Code is short on features and inconvenient compared with Claude Code. The author uses the VS Code extensions, so he compares only those. He hasn't yet found any worthwhile alternative harnesses (the wrappers around a model).

The problems began in Auto mode, where the agent receives permissions for tool calls automatically. Claude Code sends part of the conversation and the planned action to a separate classifier and waits for its verdict. At Anthropic, this is built as an extension of the protocol between the harness and the model (server-side review).

It apparently runs in parallel with the main model, and its cost doesn't count against quotas. Kimi and most other frontier models have no such extension. For them there is a compatibility mode: the CLAUDE_CODE_AUTO_MODE_SERVER variable set to "0".

The check then becomes an ordinary synchronous request to the model, and the agent stands still until the answer arrives. It is also a noticeable cost line.

What the logs showed

The author analyzed the logs of two large tasks involving agents and subagents. Across 646 actions, K3.1 Pro spent 22.6 seconds on average on the permission check alone. A single-stage check took 15.6 seconds, a multi-stage one 35.8. Some checks were canceled by timeout at 120 seconds. By the author's estimate, the classifier took up 23.8% of the active time of 30 subagents.

The fix: rules instead of a second model

The core idea: not every action needs an LLM decision. The author added explicit permissions.allow entries to the settings, such as the exact command git push origin HEAD or a run of a formatting script. Actions that match a rule never call the classifier at all. He split the rules into three groups:

  • Shared across all projects: non-destructive Git and gh operations. These go into the global ~/.claude/settings.json.
  • Project-level: calls to compilers, linters, and tests. These live in the repository's .claude/settings.json. Claude Code merges local and global lists automatically.
  • Release and management commands. The agent prepares the list of commands in advance, the author adds exact rules with full parameters to .claude/settings.local.json, and after that the agent runs the whole chain quickly. For a rare force-push, it is simpler to switch to Manual and confirm the action once.

For everything the rules don't cover, the author assigned kimi-for-coding (K2.8) as the classifier via the CLAUDE_CODE_AUTO_MODE_MODEL variable. In first tests, the average check time was 9.9 seconds versus 22.6 for K3.1 Pro, roughly 2.3 times faster. This is not a full benchmark, but it works as a reference point for his tasks.

Limitations and takeaways

The main warning concerns security: permission rules protect against accidental destructive actions but are not a security boundary. An agent can rewrite your files even without Bash, so real isolation requires other measures.

In practice, the sequence is as follows. First, check the logs to see how much time goes into permission checks. Then move frequent, safe commands into explicit allow rules and leave ambiguous ones to a model, preferably a fast and inexpensive one. Deterministic rules are faster, cheaper, and more predictable, and the LLM should be kept for genuinely unclear cases. The author showed the configuration and release workflow in PR #34 of the Quoll project.

Story

Key Questions Answered

Why the agent freezes before git push?

The switch is technically simple: you change the API endpoint and model names in Claude Code's settings. On his own tasks, the author didn't feel that Kimi was noticeably worse than Opus 5.5. The downsides lie elsewhere. Kimi is more expensive, which means smaller limits on the subscription, and in his assessment Kimi's own Kimi Code is short on features and inconvenient compared with Claude Code. The author uses the VS Code extensions, so he compares only those.

What the logs showed?

The author analyzed the logs of two large tasks involving agents and subagents. Across 646 actions, K3.1 Pro spent 22.6 seconds on average on the permission check alone. A single-stage check took 15.6 seconds, a multi-stage one 35.8. Some checks were canceled by timeout at 120 seconds. By the author's estimate, the classifier took up 23.8% of the active time of 30 subagents.

What are the key details on The fix: rules instead of a second model?

The core idea: not every action needs an LLM decision. The author added explicit permissions.allow entries to the settings, such as the exact command git push origin HEAD or a run of a formatting script. Actions that match a rule never call the classifier at all. He split the rules into three groups: Shared across all projects: non-destructive Git and gh operations. These go into the global ~/.claude/settings.json. Project-level: calls to compilers, linters, and tests.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…