<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Stanislav Nabatnikov</title>
    <description>The latest articles on DEV Community by Stanislav Nabatnikov (@pathexplorer).</description>
    <link>https://dev.to/pathexplorer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4011047%2F7b803abc-e051-4650-a779-7840995fb0e9.jpg</url>
      <title>DEV Community: Stanislav Nabatnikov</title>
      <link>https://dev.to/pathexplorer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pathexplorer"/>
    <language>en</language>
    <item>
      <title>Why the Cline Extension for VS Code Fails as an "Autonomous Agent" Under Linux ☕️🤖</title>
      <dc:creator>Stanislav Nabatnikov</dc:creator>
      <pubDate>Sat, 11 Jul 2026 13:46:23 +0000</pubDate>
      <link>https://dev.to/pathexplorer/why-the-cline-extension-for-vs-code-fails-as-an-autonomous-agent-under-linux-5ai7</link>
      <guid>https://dev.to/pathexplorer/why-the-cline-extension-for-vs-code-fails-as-an-autonomous-agent-under-linux-5ai7</guid>
      <description>&lt;p&gt;Lately, everyone has been talking about autonomous AI agents. I decided to test the hyped &lt;strong&gt;Cline&lt;/strong&gt; extension in VS Code on a real project under Linux Kubuntu. Spoiler alert: instead of a "revolution," I got the classic logic of a lazy worker. On its very first task, the tool managed to freeze completely twice on elementary operations, eventually turning into a full-blown technical detective story.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episode 1: Background &lt;code&gt;pty&lt;/code&gt; and the Escape Character Trap&lt;/strong&gt;&lt;br&gt;
The agent wasn't even trying to run a heavy script; it was simply supposed to append documentation text into &lt;code&gt;README.md&lt;/code&gt; using a standard &lt;code&gt;cat &amp;gt;&amp;gt; README.md &amp;lt;&amp;lt; 'EOF'&lt;/code&gt; block. Inside the text wrapper, there was a sample Bash function containing a process substitution: &lt;code&gt;$(kwallet-query ...)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhu1wf7neckhp4qrtbqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhu1wf7neckhp4qrtbqc.png" alt=" " width="800" height="1061"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ideally, enclosing &lt;code&gt;EOF&lt;/code&gt; in single quotes should make the shell treat everything inside as a literal string. However, because Cline pipes commands through a &lt;strong&gt;pseudo-terminal (pty)&lt;/strong&gt;—a background Unix/Linux interface—its internal command processor messed up the character escaping during transmission. Instead of writing the text passively to the file, the shell interpreted &lt;code&gt;$(kwallet-query ...)&lt;/code&gt; as an &lt;strong&gt;active live command&lt;/strong&gt; to execute right then and there. Naturally, KDE's security system (KWallet) immediately blocked the background process, waiting for user authentication via a stream descriptor Cline couldn't route back to the UI. With Auto-approve turned on, the extension just sat there in an eternal &lt;code&gt;Thinking&lt;/code&gt; state, entirely oblivious to the fact that it had accidentally locked its own input stream.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episode 2: A Git Commit That Broke the Extension's Parser&lt;/strong&gt;&lt;br&gt;
Next, the model generated a beautiful, detailed multi-line &lt;code&gt;git commit&lt;/code&gt; message listing the completed features. However, the text contained parentheses, colons, and line breaks. Cline's terminal hook suddenly rejected the command, marking it as &lt;code&gt;Skipped&lt;/code&gt; in the interface, and once again went "out to lunch" into an endless &lt;code&gt;Thinking&lt;/code&gt; loop. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr3dw65bovzd0f8vwhldi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr3dw65bovzd0f8vwhldi.png" alt=" " width="800" height="919"&gt;&lt;/a&gt;&lt;br&gt;
The funniest part is that it was impossible to even copy this text manually from the plugin's window—instead of the raw data, the interface copied internal system JSON fragments from the logs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Denouement: How Cline Managed to "Go Blind"&lt;/strong&gt;&lt;br&gt;
I got annoyed, disabled all auto-approvals, restarted VS Code, and hit &lt;strong&gt;Resume&lt;/strong&gt;. Cline wakes up, checks the state via &lt;code&gt;git log&lt;/code&gt;, and says: &lt;em&gt;“Oh, everything is already done, the commit is there, let's move on!”&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo4lzf5sr0r8aj324tip6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo4lzf5sr0r8aj324tip6.png" alt=" " width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As it turned out, the command actually managed to execute successfully in the Linux terminal during the first attempt. Git recorded everything. But why did the plugin freeze then?&lt;/p&gt;

&lt;p&gt;Once again, say hello to the &lt;code&gt;pty&lt;/code&gt; architecture. To understand when a running CLI command has finished its job (since the background terminal stream remains open), Cline appends its own hidden UUID marker to every instruction (like &lt;code&gt;echo "cline_command_done_12345"&lt;/code&gt;). When the command finishes, the plugin searches for this string in the &lt;code&gt;stdout&lt;/code&gt; stream using regular expressions (&lt;strong&gt;Regex&lt;/strong&gt;). When the model generated a commit description filled with colons and parentheses, Cline's internal parser simply broke down over this text. The regex failed to find its completion marker in the output, and the plugin literally "went blind" to the state of its own terminal, waiting for a signal it had missed itself. The only saving grace was a full restart, after which the model (credit where credit is due to DeepSeek) properly read the clean repository log.&lt;/p&gt;

&lt;p&gt;The conclusions are sobering: we are still using raw, experimental alpha versions. It's ironic when the model's intelligence turns out to be higher than the intelligence of the interface wrapping it. If a plugin breaks on a simple text insertion and a git commit due to sloppy regex and broken escaping, forcing the developer to act as a free QA engineer—that's not an assistant; it's just an extra task manager for yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Proof from the VS Code Output Logs&lt;/strong&gt;&lt;br&gt;
The raw extension logs tell the real story. Right after recovering from the crash and executing &lt;code&gt;git log --oneline -3 &amp;amp;&amp;amp; git status --short&lt;/code&gt; via the background &lt;code&gt;TerminalManager&lt;/code&gt;, the system logged this telling sequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LOG [TerminalManager] Terminal 2 completed, setting busy to false
ERROR Error while asking for command output

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This exact error sequence repeated immediately afterward during the tool's final &lt;code&gt;podman compose ps&lt;/code&gt; end-to-end verification step. This is ironclad proof of an internal architectural flaw in Cline's terminal handling. The Linux OS and Git execute the commands perfectly, but Cline's internal manager repeatedly "goes blind" and fails to capture the stream output due to unhandled string formatting or parsing issues. The shell integration completes, but the extension is left completely detached from reality, endlessly waiting for a completion signal it already choked on.&lt;/p&gt;

&lt;p&gt;P.S. For those stuck in a similar loop: If you need to manually rescue your command text when Cline freezes, don't try copying it from the chat UI (it will just copy useless internal extension strings). Instead, go to the VS Code bottom panel, switch to the Output tab, and select Cline from the dropdown menu on the right. You'll find the raw logs and the complete uncorrupted CLI commands right there.&lt;/p&gt;

&lt;h1&gt;
  
  
  ai #development #vscode #linux #cline #git #bugs #pty
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>deepseek</category>
      <category>cline</category>
      <category>linux</category>
    </item>
    <item>
      <title>Tracking DeepSeek's API Dual Pricing in OpenCode via tokscale Config Hot-Swapping (Linux)</title>
      <dc:creator>Stanislav Nabatnikov</dc:creator>
      <pubDate>Wed, 01 Jul 2026 16:29:53 +0000</pubDate>
      <link>https://dev.to/pathexplorer/tracking-deepseeks-api-dual-pricing-in-opencode-via-tokscale-config-hot-swapping-linux-11fl</link>
      <guid>https://dev.to/pathexplorer/tracking-deepseeks-api-dual-pricing-in-opencode-via-tokscale-config-hot-swapping-linux-11fl</guid>
      <description>&lt;h2&gt;
  
  
  The Problem: Outdated Rates and Hidden Context&amp;nbsp;Costs
&lt;/h2&gt;

&lt;p&gt;While working with local setups and various AI APIs in OpenCode, I noticed a huge gap in cost tracking. OpenCode's side panel shows a rough estimate, but it only reflects the basic context size. For instance, it might show a 50k context, but due to how certain models handle caching, &lt;strong&gt;800k tokens&lt;/strong&gt; might actually be sent to the server.&lt;/p&gt;

&lt;p&gt;To get accurate, real-time tracking, I integrated the tokscale utility into my workflow. However, I immediately hit two major roadblocks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Outdated Rates:&lt;/strong&gt; By default, &lt;code&gt;tokscale&lt;/code&gt; pulled rates that were half a year old (ancient history in the AI world), lacking support for newer models like DeepSeek V4. I fixed this by forcing it to read a custom, local custom-pricing.json file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The New Challenge:&lt;/strong&gt; DeepSeek just announced an upcoming time-of-use &lt;strong&gt;dual pricing schedule&lt;/strong&gt; (peak vs. off-peak hours).&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;DeepSeek API service is expected to adopt a peak-valley pricing strategy starting in mid-July, with peak-hour prices being twice the regular price, applicable to all billing items.&amp;nbsp;&lt;br&gt;
Peak hours (in UTC): 1:00–4:00 AM and 6:00–10:00 AM.&lt;br&gt;
(UTC+8 equivalent: 9:00 AM–12:00 noon and 2:00–6:00 PM.)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since &lt;code&gt;tokscale&lt;/code&gt; only reads its config file at startup, it has no native way to handle scheduled dynamic rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Automation via Systemd and&amp;nbsp;Bash
&lt;/h2&gt;

&lt;p&gt;To automate cost tracking under this new dual-tariff system, I built a lightweight automation toolkit that dynamically alters configuration files based on the server's time schedule.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Dynamic Tariff Switching (tokscale-peak-pricing)
&lt;/h2&gt;

&lt;p&gt;Instead of running a heavy background daemon, the switching logic is triggered cleanly via &lt;strong&gt;systemd user timers&lt;/strong&gt; at the exact peak transition hours (UTC 01:00 / 04:00 / 06:00 / 10:00).&lt;br&gt;
The script works as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reads a static base file: &lt;code&gt;~/.config/tokscale/custom-pricing.base.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;During peak hours (UTC 01:00–04:00, 06:00–10:00), it uses &lt;code&gt;jq&lt;/code&gt; to parse the JSON, automatically &lt;strong&gt;doubles the price&lt;/strong&gt; for any model key starting with &lt;code&gt;deepseek-*&lt;/code&gt;, and writes the result to the active &lt;code&gt;custom-pricing.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;During off-peak hours, it restores the base prices.&lt;/li&gt;
&lt;li&gt;To avoid redundant disk writes, it caches the current state in &lt;code&gt;/tmp/tokscale-pricing-zone&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Catch:&lt;/strong&gt; Since &lt;code&gt;tokscale&lt;/code&gt; doesn't hot-reload configs, the script kills running &lt;code&gt;tokscale&lt;/code&gt; processes immediately after a switch to force a fresh configuration read.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. Keeping the TUI Alive (tokscale-loop)
&lt;/h2&gt;

&lt;p&gt;To prevent the dashboard from breaking when the pricing script kills the process, I wrapped the TUI launch in a resilient loop (&lt;code&gt;tokscale-loop&lt;/code&gt;). If &lt;code&gt;tokscale&lt;/code&gt; is terminated during a zone transition, the wrapper waits 0.5 seconds and automatically spins it back up, making the pricing swap completely seamless to the eye.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. The Tmux Dashboard (opencode_tokscale.sh)
&lt;/h2&gt;

&lt;p&gt;To bring everything together, a single script initializes a unified development environment using &lt;code&gt;tmux&lt;/code&gt;. It splits your terminal screen into a highly efficient 3-pane layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────┬──────────────┐
│                      │  tokscale    │
│     opencode         │  TUI pane    │
│                      ├──────────────┤
│                      │  bash shell  │
└──────────────────────┴──────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Left pane (wide)&lt;/strong&gt;: Runs &lt;code&gt;opencode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Top right pane:&lt;/strong&gt; Runs the resilient &lt;code&gt;tokscale-loop&lt;/code&gt; tracking costs for the &lt;code&gt;opencode&lt;/code&gt; context in real time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bottom right pane:&lt;/strong&gt; A free &lt;code&gt;bash&lt;/code&gt; shell for quick commands.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Tip: This specific layout is crucial because it allows OpenCode to instantly peek into the terminal logs in real time - something that only works smoothly when both are multiplexed side-by-side inside &lt;code&gt;tmux&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As a result, checking by command shows dynamically changed prices&lt;br&gt;
&lt;code&gt;tokscale pricing list-overrides&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fldx63k3y3tfpqnatlj9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fldx63k3y3tfpqnatlj9b.png" alt="Terminal screenshot" width="800" height="823"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation &amp;amp; Maintenance
&lt;/h2&gt;

&lt;p&gt;To make this setup easily portable across machines, I wrote an interactive installation script (&lt;code&gt;install-tokscale-peak-pricing.sh&lt;/code&gt;). It checks for dependencies (&lt;code&gt;jq&lt;/code&gt;, &lt;code&gt;tmux&lt;/code&gt;, &lt;code&gt;tokscale&lt;/code&gt;, &lt;code&gt;opencode&lt;/code&gt;), sets up the systemd timers, and even auto-detects your shell (&lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;zsh&lt;/code&gt;, or &lt;code&gt;fish&lt;/code&gt;) to offer a convenient optk alias for a one-command launch.&lt;br&gt;
If DeepSeek ever cancels their peak pricing (or fixes it at a high level), there is a built-in kill switch:&lt;/p&gt;

&lt;h2&gt;
  
  
  Completely disable the timer and permanently restore base rates
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;bash disable-tokscale-peak-pricing.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source Code &amp;amp; Architecture:&lt;/strong&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The full implementation, systemd unit templates, and installation scripts are fully open-source. &lt;br&gt;
Check out the repository here: &lt;a href="https://dev.tourl"&gt;github.com/pathexplorer/tokscale&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>deepseek</category>
      <category>tokscale</category>
      <category>opencode</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
