<?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: 韩</title>
    <description>The latest articles on DEV Community by 韩 (@_cbd692d476c5faf3b61bcf).</description>
    <link>https://dev.to/_cbd692d476c5faf3b61bcf</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3887968%2F282c87b1-7364-49c1-bfdb-fbfab6c1f3bc.jpeg</url>
      <title>DEV Community: 韩</title>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_cbd692d476c5faf3b61bcf"/>
    <language>en</language>
    <item>
      <title>n8n Workflow Automation: 5 Hidden Uses of the 192K-Star Self-Hosted AI Stack</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Sat, 13 Jun 2026 03:07:51 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/n8n-workflow-automation-5-hidden-uses-of-the-192k-star-self-hosted-ai-stack-3fmo</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/n8n-workflow-automation-5-hidden-uses-of-the-192k-star-self-hosted-ai-stack-3fmo</guid>
      <description>&lt;p&gt;In 2025 a workflow tool raised a $180M Series C while one of its CVEs got weaponized into RCE the same year. The project is older than GPT-3, has 192,000+ GitHub stars, and almost no one is using it the way it was designed to be used. n8n is the 800-pound workflow platform that 95% of its users only know as a Zapier clone — and that framing misses every interesting thing it can actually do.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;n8n-io/n8n&lt;/code&gt; sits at 192,242 stars and 58,496 forks as of 2026-06-13, written in TypeScript, self-hostable with a single Docker command, and shipping native LangChain, native MCP, and a fair-code license. The Hacker News thread about its $180M raise pulled 235 points and 184 comments; its main Show HN hit 728 points. But the "Sim – Apache-2.0 n8n alternative" story that hit 240 points last December is the tell: people are still looking for something n8n already does.&lt;/p&gt;

&lt;p&gt;This article covers five hidden uses I have not seen written up anywhere, pulled from n8n's own docs, the LangChain integration, and the MCP Client/Server Trigger that landed in core. Most readers will only need the first two; the last three are the ones that make n8n worth self-hosting in 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context: n8n in the 2026 AI Stack
&lt;/h2&gt;

&lt;p&gt;Two shifts made n8n suddenly matter. First, the LangChain integration became first-class — AI Agent, Tools Agent, Conversational Agent, ReAct Agent, SQL Agent, and Plan-and-Execute Agent all live as root nodes now, with 20+ vector stores and 15+ chat models wired in as sub-nodes. Second, n8n shipped native MCP support in both directions: an MCP Client node that consumes any MCP server, and an MCP Server Trigger that exposes n8n workflows themselves as MCP tools to Claude Desktop, Cursor, or any other MCP client. Combined, that turns n8n into a backend builder for AI agents — you design the integration, expose it once, and every MCP-aware tool can call it.&lt;/p&gt;

&lt;p&gt;The third shift is the most underrated: the Code node runs in a sandboxed VM, not a browser, and supports both JavaScript and Python with &lt;code&gt;npm&lt;/code&gt; packages. Most "no-code" tools treat code as a fallback; n8n treats it as a first-class branch, which is why its data-transformation stories outlast every pure-visual competitor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #1: Expose n8n Workflows as MCP Tools to Claude/Cursor
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Wire n8n to a SaaS via Webhook, copy the URL, and poll. Fine for backends, useless for AI clients.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Drop an MCP Server Trigger node on any workflow, and that workflow becomes a discoverable tool. Claude Desktop, Cursor, Cline, and any MCP-aware client can list it, call it, and stream the result back — no webhook boilerplate, no auth header juggling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside an n8n Code node that runs as the body of the MCP tool:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;enriched&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;ticket_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;assignee&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;unassigned&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;sla_hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;3.6e6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;enriched&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wire that into a workflow starting with &lt;code&gt;MCP Server Trigger&lt;/code&gt;, set the operation to expose, and the same logic now appears in Claude's tool list as &lt;code&gt;lookup_ticket&lt;/code&gt;. No SDK glue, no separate auth flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Five minutes of work turns an internal API into a tool every AI client in your org can call. Teams that previously had to write one integration per client (Claude SDK, Cursor config, Cline config) write it once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; n8n MCP Server Trigger shipped as a core node; HN "N8n raises $180M" thread 235 pts; HN "Sim – Apache-2.0 n8n alternative" 240 pts (the demand for MCP-native workflow tools is real and growing).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #2: Multi-Agent Supervisor via Sub-Workflow Conversion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Build a single massive workflow with a long agent loop, then debug it for hours when the agent misbehaves.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Convert any node sequence into a reusable sub-workflow, then have an AI Agent call it as a tool. You end up with a clean supervisor/worker pattern: one parent agent that decides which sub-agent to invoke, and each sub-agent is a small, testable n8n workflow with its own prompt, memory, and tool set.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Parent AI Agent's system prompt (set in the AI Agent node's "System Message")&lt;/span&gt;
&lt;span class="c1"&gt;// dynamically decides which sub-workflow to call by tool name.&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lastUserMsg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Chat Trigger&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chatInput&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;intent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;httpRequest&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.openai.com/v1/chat/completions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gpt-4o-mini&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Classify the user request as one of: research, code, triage. Reply with one word.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lastUserMsg&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;route&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plug that into a Switch node, branch to three sub-workflows (research / code / triage), each itself an AI Agent with its own tools. The sub-workflow's "Execute Workflow" trigger means the parent gets a clean tool-call interface and a single response object back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A multi-agent system you can pause, inspect, and unit-test one branch at a time. Beats the "one workflow to rule them all" pattern that breaks the moment your agent makes a bad tool call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; n8n "Execute Sub-workflow" + "Execute Workflow Trigger" + AI Agent with tool-calling (docs.n8n.io/advanced-ai/); HN "N8n added native persistent storage with DataTables" 174 pts (the platform is being re-architected around agent workloads).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #3: Native RAG with 20+ Vector Stores — No Code Glue
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Stand up a separate vector DB, write a FastAPI server, wire it to LangChain manually, and then fight version mismatches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; n8n ships vector-store nodes for Pinecone, Qdrant, Weaviate, Milvus, MongoDB Atlas, Supabase, PGVector, Chroma, Redis, Oracle, Azure AI Search, and a Simple Vector Store. Each is a sub-node you drop under a Default Data Loader, set the embedding model, and feed documents into. The retrieval is wired into the AI Agent's "Vector Store" tool slot — no glue code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside the Default Data Loader's "Split Into Chunks" Code node&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;overlap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;overlap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hook that into a Qdrant Vector Store sub-node configured with OpenAI embeddings, then attach the parent to an AI Agent. The agent can now &lt;code&gt;search_documents(query)&lt;/code&gt; and get back the top-k chunks inlined into its context window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A working RAG pipeline in ten minutes, swap Qdrant for Pinecone by changing one sub-node, and keep the entire data flow visible in the canvas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; n8n vector store node list (docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant/ and 11 siblings); n8n embeddings node list with 15+ providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #4: Streaming Chat Responses via Server-Sent Events
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Build a chatbot that returns the full response after the LLM finishes — three to ten seconds of silence for the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; n8n's "Streaming responses" feature (in the workflow settings) lets a Chat Trigger stream tokens to the front-end as they're generated, using SSE under the hood. The "AI Agent" node outputs each token as a separate item, and the SSE node pushes them down the wire without buffering.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In the AI Agent's "Post-process" Code node, tag every partial token&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;trace_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;run_id&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pair that with a front-end EventSource client and the user sees a true token-by-token stream. Crucially, the AI Agent's intermediate tool calls are still visible in the execution log — you can replay the whole run later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Real ChatGPT-class UX on top of self-hosted infrastructure, with full traceability of which tool the agent called and when.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; n8n "Streaming responses" (docs.n8n.io/workflows/streaming/); n8n Chat Trigger with SSE output option; HN "N8n AI Workflows – 3,400 Workflows and an LLM Prototype" 12 pts (the community already pushes this hard).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #5: OpenTelemetry Observability Inside the Execution Graph
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Run n8n blind — execution logs are visible in the UI but you cannot correlate them with the rest of the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; The &lt;code&gt;n8n-otel&lt;/code&gt; OpenTelemetry integration (shipped as a community plugin and a first-class config in 1.50+) exports every node execution, every retry, every AI Agent tool call as OTel spans. Set the OTLP endpoint in your &lt;code&gt;docker-compose.yml&lt;/code&gt;, and the same Trace ID that appears in your application logs surfaces in n8n's execution view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# docker-compose.yml — drop this on your existing n8n service&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;n8n&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;n8nio/n8n&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_METRICS=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;QUEUE_HEALTH_CHECK_ACTIVE=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_ENABLED=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_SERVICE_NAME=n8n-prod&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5678:5678"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in your OTel collector, route &lt;code&gt;n8n.*&lt;/code&gt; spans into a dedicated dashboard. The most useful signal is the "node duration" histogram per node type — your Slack and HTTP nodes will dominate; your AI Agent nodes will tell you exactly which tool calls cost the most time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A 2026-grade observability story for free, and the same Trace ID you already use in your app code links straight to the n8n execution that triggered it. Beats clicking through the n8n UI every time something misfires.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; n8n observability config (docs.n8n.io/hosting/configuration/observability/); HN "Bringing Observability to Your N8n Workflows: OpenTelemetry in Action" 17 pts (2026-04-12 — recent and credible).&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;Five things n8n can do that almost nobody uses:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;MCP Server Trigger&lt;/strong&gt; — expose any workflow as a tool to Claude/Cursor/Cline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-workflow as agent tool&lt;/strong&gt; — multi-agent supervisor with clean per-branch testing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native vector store sub-nodes&lt;/strong&gt; — RAG in 10 minutes, swap providers by swapping one node&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSE streaming chat&lt;/strong&gt; — token-by-token output with full execution replay&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenTelemetry export&lt;/strong&gt; — correlate n8n runs with the rest of your stack via Trace ID&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The one that surprised me most was #4. SSE streaming in n8n is barely documented, but it's there, it works with the AI Agent node out of the box, and it makes self-hosted chatbots feel native.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you want to dig deeper into the agent ecosystem, check out these three articles:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/crush-terminal-ai-coding-agent-5-hidden-uses-of-the-25k-star-charm-stack-that-beat-claude-code-at-1nhl"&gt;Crush Terminal AI Coding Agent: 5 Hidden Uses&lt;/a&gt; — another terminal-first agent with surprisingly clean config hygiene&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/ktransformers-5-hidden-uses-of-the-17k-star-moe-inference-stack-from-tsinghua-that-90-of-ai-infra-4l87"&gt;KTransformers: 5 Hidden Uses of the 17K-Star MoE Inference Stack&lt;/a&gt; — how Tsinghua's MoE engine gets 347 tok/s on consumer GPUs&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/serenas-5-hidden-uses-that-give-your-ai-coding-assistant-real-ide-intelligence-25k-stars-4621"&gt;Serena's 5 Hidden Uses&lt;/a&gt; — IDE-level intelligence for AI coding agents via LSP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is the most useful MCP server you have exposed via n8n? I am collecting real-world examples for a follow-up — drop yours in the comments.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>n8n 的 5 个隐藏用法，19.2 万 Star 的自部署 AI 工作流栈里没人讲的能力</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Sat, 13 Jun 2026 03:07:45 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/n8n-de-5-ge-yin-cang-yong-fa-192-mo-star-de-zi-bu-shu-ai-gong-zuo-liu-zhan-li-mei-ren-jiang-de-neng-li-18f9</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/n8n-de-5-ge-yin-cang-yong-fa-192-mo-star-de-zi-bu-shu-ai-gong-zuo-liu-zhan-li-mei-ren-jiang-de-neng-li-18f9</guid>
      <description>&lt;p&gt;在 2025 年，一个工作流自动化平台拿到了 1.8 亿美元 C 轮融资，同年它的一个 CVE 被武器化成远程代码执行。这个项目比 GPT-3 还老，GitHub 上有超过 19.2 万颗星，但几乎没人真正按它设计的方式在用它。n8n 是那个 800 磅重的工作流平台，95% 的用户只把它当成 Zapier 的开源替代品——而这个定位让你错过了它真正能做的所有有意思的事情。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;n8n-io/n8n&lt;/code&gt; 截至 2026-06-13 拥有 192,242 颗星、58,496 个 Fork，TypeScript 编写，单条 Docker 命令就能自部署，原生集成 LangChain、原生支持 MCP，使用 fair-code 协议。它 1.8 亿美元融资那条 HN 主帖拿到 235 票 184 条评论，主 Show HN 帖拿到 728 票。但去年 12 月那条《Sim – Apache-2.0 n8n alternative》拿到 240 票才是真正的信号：大家还在找 n8n 已经有的东西。&lt;/p&gt;

&lt;p&gt;这篇文章讲五个我在任何地方都没见人写过的隐藏用法，材料全部来自 n8n 官方文档、LangChain 集成和落地到 core 里的 MCP Client/Server Trigger。大部分读者前两个就够用了，最后三个才是 n8n 在 2026 年值得自部署的真正理由。&lt;/p&gt;

&lt;h2&gt;
  
  
  背景：n8n 在 2026 年 AI 栈里的位置
&lt;/h2&gt;

&lt;p&gt;两个变化让 n8n 突然变得关键。第一，LangChain 集成变成了一等公民——AI Agent、Tools Agent、Conversational Agent、ReAct Agent、SQL Agent、Plan-and-Execute Agent 全部作为根节点存在，20+ 种向量库和 15+ 种聊天模型作为子节点直接接进来。第二，n8n 在两个方向上同时支持了 MCP：MCP Client 节点可以消费任何 MCP Server，MCP Server Trigger 可以把 n8n 工作流自身作为 MCP 工具暴露给 Claude Desktop、Cursor 或任何 MCP 客户端。两者合起来，让 n8n 成了 AI Agent 的后端构建器——你设计好集成、暴露一次，所有支持 MCP 的工具都能调用。&lt;/p&gt;

&lt;p&gt;第三个变化是最被低估的：Code 节点跑在沙箱化 VM 里，不是浏览器，原生支持 JavaScript 和 Python，还能加载 npm 包。大部分"零代码"工具把代码当成兜底选项，n8n 把代码当成一等分支，这就是它的数据转换能力比所有纯可视化竞品更耐用的原因。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #1：把 n8n 工作流暴露成 MCP 工具给 Claude/Cursor 用
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 用 Webhook 把 n8n 接到一个 SaaS，复制 URL，然后开始轮询。对后端够用，对 AI 客户端完全没用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 任何一个工作流加上 MCP Server Trigger 节点，整个工作流就变成了一个可被发现的工具。Claude Desktop、Cursor、Cline 以及任何支持 MCP 的客户端都能列出它、调用它、实时回传结果——不用写 Webhook 模板，不用管理鉴权头。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 跑在 MCP 工具主体里的 n8n Code 节点：&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;enriched&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;ticket_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;P2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;assignee&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;unassigned&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;sla_hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;3.6e6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;enriched&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;把它接进一个以 &lt;code&gt;MCP Server Trigger&lt;/code&gt; 开头的 workflow，操作设为 expose，同一段逻辑就会以 &lt;code&gt;lookup_ticket&lt;/code&gt; 的名字出现在 Claude 的工具列表里。不用 SDK 胶水代码，不用单独的鉴权流。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 五分钟工作把内部 API 变成组织里每个 AI 客户端都能调的工具。以前要给每个客户端（Claude SDK、Cursor 配置、Cline 配置）各写一遍集成，现在只写一次。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; n8n MCP Server Trigger 作为核心节点发布；HN《N8n raises $180M》帖 235 票；HN《Sim – Apache-2.0 n8n alternative》240 票（市场对 MCP 原生工作流工具的需求真实且在增长）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #2：用子工作流转换搭多 Agent 监督者架构
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 写一个又长又大的工作流，里面塞一个超长 agent 循环，agent 一抽风就调半天。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 把任意一段节点序列转成可复用的子工作流，再让一个 AI Agent 把它当工具调用。最后你会得到一个干净的 supervisor/worker 模式：一个父 agent 决定调用哪个子 agent，每个子 agent 都是一个小的、可测试的 n8n workflow，自带自己的 prompt、记忆和工具集。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 父 AI Agent 的系统提示（在 AI Agent 节点的 "System Message" 里设置）&lt;/span&gt;
&lt;span class="c1"&gt;// 通过工具名动态决定调用哪个子工作流。&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lastUserMsg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Chat Trigger&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chatInput&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;intent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;helpers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;httpRequest&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.openai.com/v1/chat/completions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gpt-4o-mini&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;把用户请求分类为以下之一：research, code, triage。只回一个词。&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lastUserMsg&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;route&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;把它接进 Switch 节点，分支到三个子工作流（research / code / triage），每个子工作流自己又是一个带工具的 AI Agent。子工作流的 "Execute Workflow" trigger 让父 agent 拿到一个干净的工具调用接口和一个统一的响应对象。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 多 agent 系统可以暂停、逐分支审查、单独单测。比"一个 workflow 管所有"模式强太多——后者一旦 agent 调错工具就全盘崩溃。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; n8n "Execute Sub-workflow" + "Execute Workflow Trigger" + AI Agent 工具调用（docs.n8n.io/advanced-ai/）；HN《N8n added native persistent storage with DataTables》174 票（平台正在围绕 agent 工作负载重新架构）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #3：原生 RAG 接入 20+ 种向量库——零胶水代码
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 起一个独立的向量数据库，写一个 FastAPI 服务，手动接 LangChain，然后跟版本不匹配死磕。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; n8n 为 Pinecone、Qdrant、Weaviate、Milvus、MongoDB Atlas、Supabase、PGVector、Chroma、Redis、Oracle、Azure AI Search、Simple Vector Store 都内置了向量库节点。每个都是个子节点，你拖到 Default Data Loader 下面、配上 embedding 模型、把文档喂进去就行。检索动作直接接到 AI Agent 的"Vector Store"工具槽位——零胶水代码。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 在 Default Data Loader 的 "Split Into Chunks" Code 节点里&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;overlap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;overlap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;chunkSize&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;接上配了 OpenAI embedding 的 Qdrant Vector Store 子节点，再把父节点挂到 AI Agent 上。Agent 就能 &lt;code&gt;search_documents(query)&lt;/code&gt; 拿到 top-k 个 chunk 直接塞进上下文窗口。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 十分钟搭一条能跑 RAG 流水线，要换 Qdrant 到 Pinecone 就替换一个子节点，整条数据流在画布上一目了然。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; n8n 向量库节点列表（docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant/ 等 11 个兄弟节点）；n8n embeddings 节点列表，15+ 提供商。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #4：SSE 推送 Chat 流式响应
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 做一个聊天机器人，LLM 跑完之后才返回完整响应——用户等三到十秒什么也看不见。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; n8n 的"Streaming responses"功能（在 workflow 设置里）让 Chat Trigger 把 token 实时推到前端，底层走 SSE。AI Agent 节点把每个 token 当成独立 item 输出，SSE 节点不缓冲直接推下去。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 在 AI Agent 的 "Post-process" Code 节点里，给每个部分 token 打标&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;idx&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;trace_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;run_id&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;前端接一个 EventSource 客户端，用户就能看到真正的逐 token 流。关键是，AI Agent 中间的工具调用在执行日志里照样能看到——之后能整段回放。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 自部署基础设施也能提供 ChatGPT 级别的体验，agent 调了哪个工具、什么时候调的，全链路可追溯。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; n8n "Streaming responses"（docs.n8n.io/workflows/streaming/）；n8n Chat Trigger 支持 SSE 输出；HN《N8n AI Workflows – 3,400 Workflows and an LLM Prototype》12 票（社区已经在重度推进）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #5：执行图谱里的 OpenTelemetry 可观测性
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; n8n 跑在黑盒里——执行日志 UI 能看，但跟系统其他部分没法关联。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; &lt;code&gt;n8n-otel&lt;/code&gt; OpenTelemetry 集成（社区插件 + 1.50+ 里的一等配置项）把每次节点执行、每次重试、每次 AI Agent 工具调用全部导出成 OTel span。在 &lt;code&gt;docker-compose.yml&lt;/code&gt; 里设好 OTLP endpoint，你应用日志里出现的同一个 Trace ID 就能在 n8n 执行视图里直接看到。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# docker-compose.yml — 贴到现有的 n8n service 上&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;n8n&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;n8nio/n8n&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;N8N_METRICS=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;QUEUE_HEALTH_CHECK_ACTIVE=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_ENABLED=true&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;OTEL_SERVICE_NAME=n8n-prod&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5678:5678"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;然后在你的 OTel collector 里，把 &lt;code&gt;n8n.*&lt;/code&gt; span 路由到专用 dashboard。最有用的信号是按节点类型分桶的"节点耗时"直方图——Slack 和 HTTP 节点会占大头，AI Agent 节点会精确告诉你哪些工具调用最耗时。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 免费拿到 2026 级别可观测性，已经在用的 Trace ID 能直接链回触发它的 n8n 执行。比每次出问题都去点 n8n UI 强太多。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; n8n 可观测性配置（docs.n8n.io/hosting/configuration/observability/）；HN《Bringing Observability to Your N8n Workflows: OpenTelemetry in Action》17 票（2026-04-12 发布，新鲜可信）。&lt;/p&gt;

&lt;h2&gt;
  
  
  收尾
&lt;/h2&gt;

&lt;p&gt;五个 n8n 能做但几乎没人用的功能：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;MCP Server Trigger&lt;/strong&gt; — 把任意工作流暴露成 Claude/Cursor/Cline 的工具&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;子工作流当 agent 工具&lt;/strong&gt; — 多 agent 监督者架构，逐分支干净单测&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;原生向量库子节点&lt;/strong&gt; — 十分钟搭 RAG，换服务商就换子节点&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSE 流式聊天&lt;/strong&gt; — 逐 token 输出，全执行可回放&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenTelemetry 导出&lt;/strong&gt; — Trace ID 关联 n8n 运行和你系统其他部分&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;最让我意外的是第 4 个。n8n 的 SSE 流式几乎没文档，但它就在那里，开箱即用对接 AI Agent 节点，让自部署聊天机器人体验原生。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;如果你想深入 agent 生态，可以看这三篇：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/crush-terminal-ai-coding-agent-5-hidden-uses-of-the-25k-star-charm-stack-that-beat-claude-code-at-1nhl"&gt;Crush Terminal AI Coding Agent：5 个隐藏用法&lt;/a&gt; — 另一个终端优先的 agent，配置卫生出乎意料地干净&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/ktransformers-5-hidden-uses-of-the-17k-star-moe-inference-stack-from-tsinghua-that-90-of-ai-infra-4l87"&gt;KTransformers：清华 17K Star MoE 推理栈的 5 个隐藏用法&lt;/a&gt; — 清华的 MoE 引擎怎么在消费级 GPU 上跑到 347 tok/s&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/serenas-5-hidden-uses-that-give-your-ai-coding-assistant-real-ide-intelligence-25k-stars-4621"&gt;Serena 的 5 个隐藏用法&lt;/a&gt; — 通过 LSP 给 AI 编程助手带来 IDE 级别智能&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;你在 n8n 里暴露过的最有用的 MCP Server 是哪个？我在收集真实案例准备后续文章，在评论区留下你的例子。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Crush 的 5 个隐藏用法：25K Star 的 Charm 终端 AI Agent 在配置卫生上完胜 Claude Code</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Fri, 12 Jun 2026 05:45:50 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/crush-de-5-ge-yin-cang-yong-fa-25k-star-de-charm-zhong-duan-ai-agent-zai-pei-zhi-wei-sheng-shang-wan-sheng-claude-code-6ad</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/crush-de-5-ge-yin-cang-yong-fa-25k-star-de-charm-zhong-duan-ai-agent-zai-pei-zhi-wei-sheng-shang-wan-sheng-claude-code-6ad</guid>
      <description>&lt;p&gt;你知道吗？Charm 团队在 Hacker News 上首发"终端里最迷人的 AI 编码代理"时，那条帖子一天就冲到 &lt;strong&gt;367 分、235 条评论&lt;/strong&gt;。将近一年后，这个仓库已经积累到 &lt;strong&gt;25,233 个 GitHub Stars 和 1,805 个 Forks&lt;/strong&gt;，最近一次提交是 &lt;strong&gt;2026 年 6 月 12 日&lt;/strong&gt;。可是当大多数工程师第一次打开 Crush 的时候，用法跟 Claude Code 没什么两样——聊一聊、改一改、再聊一聊。README 又长又全，但真正好用的生产功能，全藏在配置文件、LSP 接线、MCP 配置和那一小撮不起眼的 flag 里。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;charmbracelet/crush&lt;/code&gt; 是 Charm 生态（&lt;code&gt;bubbletea&lt;/code&gt;、&lt;code&gt;lipgloss&lt;/code&gt;、&lt;code&gt;glow&lt;/code&gt; 都出自这个团队，他们的基础库支撑了大约 25,000 个下游 Go 应用）出品的代理化终端工具。它原生支持 OpenAI 和 Anthropic，自带三种 MCP 传输协议，同一份二进制在 macOS、Linux、Windows（PowerShell + WSL）、Android、FreeBSD、OpenBSD、NetBSD 都能跑。大多数用户看到的就是"又一个终端 AI"。其实它更像是一个&lt;strong&gt;可编程的代理运行时&lt;/strong&gt;，有自己的小配置语言。&lt;/p&gt;

&lt;p&gt;下面这五个隐藏用法，把 Crush 从"我的第二个编码 Agent"变成了我留在顶层的那个。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #1：&lt;code&gt;crush.json&lt;/code&gt; 里的 Shell 风格密钥展开
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 直接把 API Key 粘贴到 &lt;code&gt;crush.json&lt;/code&gt; 里（然后第一次提交进 git 就后悔了）。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Crush 自带一个&lt;strong&gt;兼容 bash 的展开引擎&lt;/strong&gt;，会在 MCP、provider、LSP 配置的 &lt;code&gt;command&lt;/code&gt;、&lt;code&gt;args&lt;/code&gt;、&lt;code&gt;env&lt;/code&gt;、&lt;code&gt;headers&lt;/code&gt;、&lt;code&gt;url&lt;/code&gt; 字段上跑一遍。这意味着你可以用 &lt;code&gt;$VAR&lt;/code&gt;、&lt;code&gt;${VAR:-default}&lt;/code&gt;、&lt;code&gt;$(command)&lt;/code&gt;，甚至 &lt;strong&gt;&lt;code&gt;${VAR:?message}&lt;/code&gt;&lt;/strong&gt;——最后一个是大多数人没注意到的杀手锏。必需的凭据一旦缺失就在加载时大声报错，绝不会悄悄变成空字符串。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"github"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.githubcopilot.com/mcp/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer ${GH_PAT:?请先在 shell 里设置 GH_PAT}"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"filesystem"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stdio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/mcp-server.js"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"NODE_ENV"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"production"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"TOKEN_FILE"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$(cat /run/secrets/mcp-token)"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 解析后值为空字符串的 header 会被 Crush &lt;strong&gt;从请求里整个删掉&lt;/strong&gt;，而不是发出 &lt;code&gt;Authorization: Bearer&lt;/code&gt; 这种空值。这意味着类似 &lt;code&gt;OpenAI-Organization&lt;/code&gt; 这种可选的、依赖环境变量的 header 在未设置时不会污染请求；必需的凭据则在 TUI 还没渲染之前就给出明确的报错。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Crush 25,233 Stars / 1,805 Forks（GitHub REST API 验证，最近一次 push 2026-06-12）。HN 发布主帖 367 pts / 235 comments（objectID 44736176，2025-07-30）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #2：跨多个 TUI 客户端的共享工作区
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 开一个 Crush 窗口，任务结束，关掉，会话也没了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 运行 &lt;code&gt;crush serve&lt;/code&gt; 暴露 HTTP 后端，再用 &lt;code&gt;--cwd&lt;/code&gt; 把&lt;strong&gt;多个 TUI 客户端&lt;/strong&gt;附加到同一个工作区。指向相同工作目录的两个客户端会&lt;strong&gt;加入同一个底层工作区&lt;/strong&gt;——共享会话列表、消息历史、权限队列、LSP 服务池和 MCP 连接。会话选择器暴露两个信号：&lt;code&gt;IsBusy&lt;/code&gt;（代理正在跑一轮）和 &lt;code&gt;AttachedClients&lt;/code&gt;（当前有多少个终端在看着同一个会话）。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 终端 A：启动一次长时间重构，然后挂后台&lt;/span&gt;
crush serve &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith &lt;span class="nt"&gt;--yolo&lt;/span&gt;

&lt;span class="c"&gt;# 终端 B：实时围观同一个工作区&lt;/span&gt;
crush &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith

&lt;span class="c"&gt;# 终端 C，笔记本 SSH 进来：还是同一个工作区&lt;/span&gt;
crush &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; &lt;code&gt;AttachedClients&lt;/code&gt; 不为零就是"这个会话在另一个客户端上正在跑"的提示。最先创建工作区的那个客户端固定了进程级 flag——尤其是 &lt;code&gt;--yolo&lt;/code&gt; 和 &lt;code&gt;--debug&lt;/code&gt; 遵循&lt;strong&gt;先到先得&lt;/strong&gt;原则：后续客户端想用更宽松的设置是不被接受的。工作区的生命周期与任何一个客户端保持 SSE 流连接的时间一致；最后一个流断开时，工作区被销毁，但有一个短暂的宽限窗口，避免"刚创建还没来得及接入"的客户端被立刻回收。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Crush README "Sharing a workspace across clients" 章节，宽限窗口与 first-wins flag 规则与官方文档一致。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #3：带 &lt;code&gt;user-invocable&lt;/code&gt; 和 &lt;code&gt;disable-model-invocation&lt;/code&gt; 的 Agent Skills
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 觉得 skill 文档读起来像插件市场，直接跳过。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Crush 支持开放的 &lt;strong&gt;Agent Skills&lt;/strong&gt; 标准（&lt;code&gt;agentskills.io&lt;/code&gt;），默认从&lt;strong&gt;七个全局路径&lt;/strong&gt;和&lt;strong&gt;三个项目相对路径&lt;/strong&gt;自动发现 skill——这还没算上你自定义的 &lt;code&gt;options.skills_paths&lt;/code&gt;。真正的好戏是两个 frontmatter 标记：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;crush-config&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;一个可以通过命令面板手动触发的&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;skill"&lt;/span&gt;
&lt;span class="na"&gt;user-invocable&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;disable-model-invocation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="c1"&gt;# 引导用户完成 crush.json 的编辑流程&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;设置 &lt;code&gt;user-invocable: true&lt;/code&gt; 之后，skill 会在命令面板（Ctrl+P）里以 &lt;code&gt;user:skill-name&lt;/code&gt; 或 &lt;code&gt;project:skill-name&lt;/code&gt; 的形式出现。再设上 &lt;code&gt;disable-model-invocation: true&lt;/code&gt;，这个 skill &lt;strong&gt;对模型完全隐身&lt;/strong&gt;，但人可以随时手动调起来。Crush 自带的 &lt;code&gt;crush-config&lt;/code&gt; skill 用的就是这个套路——模型永远不会自动触发它，但用户按 Ctrl+P 输入 "config" 就能让 Agent 引导自己完成配置。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 用 anthropics/skills 当起点，把示例 skill 装到本地&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.config/crush/skills
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.config/crush/skills
git clone https://github.com/anthropics/skills.git _temp
&lt;span class="nb"&gt;mv &lt;/span&gt;_temp/skills/&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; _temp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 干净地分离了&lt;strong&gt;人主动调用的工作流&lt;/strong&gt;（部署、改配置、清理）和&lt;strong&gt;模型主动触发的 skill&lt;/strong&gt;（调研、重构、代码检索）。模型不可能误触发危险 skill，但人随时可以召唤。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Crush README "Agent Skills" 章节，七个全局路径 + 三个项目相对路径与源码一致。&lt;code&gt;agentskills.io&lt;/code&gt; 开放标准在 README 中明确引用。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #4：自定义 Anthropic 兼容 Provider 与每模型成本元数据
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 用内置预设 Provider，从不动 &lt;code&gt;providers&lt;/code&gt; 字段。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Crush 支持两种自定义 Provider 写法——&lt;code&gt;openai-compat&lt;/code&gt; 给那些走 OpenAI 接口形态但不是 OpenAI 的服务（Deepseek、Groq、Together、Fireworks），&lt;code&gt;anthropic&lt;/code&gt; 给 Anthropic 兼容端点（代理、内部集群、自定义 base URL）。真正没写在文档里的彩蛋是&lt;strong&gt;每模型的元数据&lt;/strong&gt;字段——&lt;code&gt;cost_per_1m_in&lt;/code&gt;、&lt;code&gt;cost_per_1m_out&lt;/code&gt;、&lt;code&gt;cost_per_1m_in_cached&lt;/code&gt;、&lt;code&gt;cost_per_1m_out_cached&lt;/code&gt;、&lt;code&gt;context_window&lt;/code&gt;、&lt;code&gt;default_max_tokens&lt;/code&gt;、&lt;code&gt;can_reason&lt;/code&gt;、&lt;code&gt;supports_attachments&lt;/code&gt;。这些不只是装饰：TUI 用它们在每次请求时显示真实成本估算。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"providers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deepseek"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"openai-compat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.deepseek.com/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$DEEPSEEK_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deepseek-chat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Deepseek V3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in_cached"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.07&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"context_window"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;64000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"default_max_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"custom-anthropic"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"anthropic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.your-proxy.internal/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$INTERNAL_ANTHROPIC_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"extra_headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"anthropic-version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2023-06-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"X-Tenant-Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$TENANT_ID"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-4-20250514"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Claude Sonnet 4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"context_window"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"default_max_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"can_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"supports_attachments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; &lt;code&gt;extra_body&lt;/code&gt; 是&lt;strong&gt;不展开&lt;/strong&gt;的 JSON 透传（用来塞静态字段），但 &lt;code&gt;extra_headers&lt;/code&gt;、&lt;code&gt;api_key&lt;/code&gt;、&lt;code&gt;base_url&lt;/code&gt; 都会走 shell 展开引擎。这意味着你可以在团队里只分发&lt;strong&gt;一份&lt;/strong&gt; &lt;code&gt;crush.json&lt;/code&gt;，每位工程师通过环境变量覆盖自己的凭据；TUI 能显示真实成本，因为元数据写在配置里、不是硬编码。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Crush README "Custom Providers" 章节，Deepseek 示例配置与官方 README 一致。Provider 总数（25+，包括 OpenAI、Anthropic、Google、Groq、OpenRouter、Vercel、MiniMax、Z.ai、Cerebras、Hugging Face、AWS Bedrock、Azure OpenAI 等）通过 README 的环境变量表交叉验证。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #5：分层工具与 Skill 隔离（&lt;code&gt;.crushignore&lt;/code&gt; + &lt;code&gt;disabled_tools&lt;/code&gt; + &lt;code&gt;disabled_skills&lt;/code&gt;）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 启动时加 &lt;code&gt;--yolo&lt;/code&gt; 听天由命，或者每次权限弹窗都手动点。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Crush 给了你&lt;strong&gt;三层独立的隔离机制&lt;/strong&gt;，可以叠加使用：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.crushignore&lt;/code&gt;&lt;/strong&gt;——gitignore 语法的文件，文件&lt;strong&gt;根本进不到&lt;/strong&gt; Crush 的上下文（不只是禁止编辑，连读都不读）。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;options.disabled_tools&lt;/code&gt;&lt;/strong&gt;——对代理完全隐藏内置工具（比如 &lt;code&gt;"bash"&lt;/code&gt;、&lt;code&gt;"sourcegraph"&lt;/code&gt;）。模型看不到的工具就没法选。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;options.disabled_skills&lt;/code&gt;&lt;/strong&gt;——对代理隐藏 skill（内置和发现的都算）。再叠加 skill 自己的 frontmatter 里的 &lt;code&gt;disable-model-invocation&lt;/code&gt; 可以做到单个 skill 级别的隐身。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;permissions.allowed_tools&lt;/code&gt;&lt;/strong&gt;——反方向的白名单。只有列出来的工具能跑，其他都需要弹窗。
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"disabled_tools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"bash"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"disabled_skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"crush-config"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"skills_paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"~/.config/crush/skills"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"./project-skills"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"allowed_tools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"view"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"ls"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"grep"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"edit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"mcp_context7_get-library-doc"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .crushignore —— 凭据、构建产物、大数据文件
.env
.env.*
secrets/
*.pem
node_modules/
dist/
*.parquet
data/raw/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 你可以给团队部署一份"禁用 bash（所有 shell 操作强制走 MCP 工具）、隐藏某些 skill（模型重构时不会自作主张触发 &lt;code&gt;crush-config&lt;/code&gt;）、只读工具白名单"的 Crush。&lt;code&gt;.crushignore&lt;/code&gt; 跟 &lt;code&gt;.gitignore&lt;/code&gt; 用一样的语法并叠加生效——已经提交进仓库但不想让代理碰的文件，git 留底、Crush 看不见。这是把 Crush 跑在面向客户的内部工具里时，团队实际在用的配置模式。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Crush README 的 "Ignoring Files"、"Allowing Tools"、"Disabling Built-In Tools"、"Disabling Skills" 四个章节，四种机制均与官方文档行为一致。&lt;/p&gt;

&lt;h2&gt;
  
  
  总结：五个隐藏用法
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Shell 风格密钥展开&lt;/strong&gt;：&lt;code&gt;${VAR:?msg}&lt;/code&gt; 与 &lt;code&gt;$(command)&lt;/code&gt;，必需凭据零容忍。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;共享工作区&lt;/strong&gt;：&lt;code&gt;crush serve&lt;/code&gt; + &lt;code&gt;--cwd&lt;/code&gt; 键值，多 TUI 客户端同步会话。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent Skills&lt;/strong&gt;：&lt;code&gt;user-invocable&lt;/code&gt; 与 &lt;code&gt;disable-model-invocation&lt;/code&gt; 配合，分离"人触发"和"模型触发"两种工作流。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;自定义 Anthropic/OpenAI Provider&lt;/strong&gt;：每模型成本元数据 + &lt;code&gt;extra_body&lt;/code&gt; 透传。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;分层隔离&lt;/strong&gt;：&lt;code&gt;.crushignore&lt;/code&gt; + &lt;code&gt;disabled_tools&lt;/code&gt; + &lt;code&gt;disabled_skills&lt;/code&gt; + &lt;code&gt;allowed_tools&lt;/code&gt; 四重保险。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  相关阅读
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/deepclaude-de-5-ge-yin-cang-yong-fa-rang-ni-de-claude-code-bian-yi-17-bei-1om2"&gt;DeepClaude 的 5 个隐藏用法：让你的 Claude Code 便宜 17 倍 🔥&lt;/a&gt; —— 如果你喜欢 Crush 的"本地优先"理念，这篇讲的是用代理把 Claude Code 砍到 1/17 价格的玩法。&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/ktransformersde-5ge-yin-cang-yong-fa-17k-starde-moetui-li-kuang-jia-bei-hou-mei-xie-zai-readmeli-de-neng-li-1cap"&gt;KTransformers：清华 17K Star MoE 推理栈的 5 个隐藏用法&lt;/a&gt; —— 想把 Crush"多模型、运行中切换"的思路推到 671B 模型本地推理，看这篇。&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmani-de-agent-skills49k-xing-gong-zuo-liu-mo-fa-li-mei-ren-ti-de-5-ge-yin-cang-yong-fa-45c4"&gt;Addy Osmani 的 agent-skills：49K 星工作流魔法里没人提的 5 个隐藏用法&lt;/a&gt; —— Crush 的 skill 自动发现机制实现的就是这个开放标准，附赠在 Claude Code 和 Cursor 里的用法。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;你那边呢——&lt;code&gt;crush.json&lt;/code&gt; 里有没有哪个 flag 是你早该知道、早用早舒服的？评论区丢出来，Charm 团队在看，得票最高的几个建议大概率会进下个版本。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Crush Terminal AI Coding Agent: 5 Hidden Uses of the 25K-Star Charm Stack That Beat Claude Code at Config Hygiene</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Fri, 12 Jun 2026 05:45:47 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/crush-terminal-ai-coding-agent-5-hidden-uses-of-the-25k-star-charm-stack-that-beat-claude-code-at-1nhl</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/crush-terminal-ai-coding-agent-5-hidden-uses-of-the-25k-star-charm-stack-that-beat-claude-code-at-1nhl</guid>
      <description>&lt;p&gt;Here's the thing — on Hacker News, the Charm team's "Glamourous AI coding agent for your favourite terminal" launch hit &lt;strong&gt;367 points and 235 comments&lt;/strong&gt; the day it shipped. Almost a year later, the repo has climbed to &lt;strong&gt;25,233 GitHub stars and 1,805 forks&lt;/strong&gt;, with the latest push on &lt;strong&gt;June 12, 2026&lt;/strong&gt;. Yet when most engineers open Crush for the first time, they end up running it the way they run Claude Code — chat, edit, repeat. The README is long, but the most useful production features are hidden in the configuration file, the LSP wiring, the MCP section, and a tiny set of flags.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;charmbracelet/crush&lt;/code&gt; is the agentic terminal tool from the Charm ecosystem (the same team behind &lt;code&gt;bubbletea&lt;/code&gt;, &lt;code&gt;lipgloss&lt;/code&gt;, and &lt;code&gt;glow&lt;/code&gt; — the foundation powering roughly 25,000 downstream Go applications). It speaks OpenAI and Anthropic natively, ships three MCP transports, and runs the same binary on macOS, Linux, Windows (PowerShell + WSL), Android, FreeBSD, OpenBSD, and NetBSD. Most users see "yet another terminal AI." What's actually under the hood is closer to a programmable agent runtime with a real config language.&lt;/p&gt;

&lt;p&gt;Let's walk through the five hidden uses that turned Crush from "my second coding agent" into the one I keep on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #1: Shell-Style Secret Expansion in &lt;code&gt;crush.json&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Paste API keys directly into &lt;code&gt;crush.json&lt;/code&gt; (and then regret it the first time the file lands in a git commit).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Crush ships a &lt;strong&gt;bash-compatible expansion engine&lt;/strong&gt; that runs over &lt;code&gt;command&lt;/code&gt;, &lt;code&gt;args&lt;/code&gt;, &lt;code&gt;env&lt;/code&gt;, &lt;code&gt;headers&lt;/code&gt;, and &lt;code&gt;url&lt;/code&gt; fields in MCP, provider, and LSP config. That means you can use &lt;code&gt;$VAR&lt;/code&gt;, &lt;code&gt;${VAR:-default}&lt;/code&gt;, &lt;code&gt;$(command)&lt;/code&gt;, and even &lt;code&gt;${VAR:?message}&lt;/code&gt; — the last one is the trick most engineers miss. Required-credential syntax fails loudly at load time instead of silently resolving to an empty string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"github"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.githubcopilot.com/mcp/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer ${GH_PAT:?set GH_PAT in your shell env first}"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"filesystem"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stdio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/mcp-server.js"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"NODE_ENV"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"production"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"TOKEN_FILE"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$(cat /run/secrets/mcp-token)"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Headers whose value resolves to the empty string are &lt;strong&gt;dropped&lt;/strong&gt; from the outgoing request entirely — Crush does not send &lt;code&gt;Authorization: Bearer&lt;/code&gt; with a blank value. That means optional env-gated headers like &lt;code&gt;OpenAI-Organization&lt;/code&gt; stay clean when unset, and required credentials fail fast with a meaningful error before the TUI ever renders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Crush 25,233 Stars / 1,805 Forks on GitHub (last push 2026-06-12), verified via the GitHub REST API. HN launch discussion 367 pts / 235 comments (objectID 44736176, 2025-07-30).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #2: Shared Workspaces Across Multiple TUI Clients
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Open one Crush window, finish, close it, lose the session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Run &lt;code&gt;crush serve&lt;/code&gt; to expose an HTTP backend, then attach &lt;strong&gt;multiple TUI clients&lt;/strong&gt; to the same workspace, keyed by &lt;code&gt;--cwd&lt;/code&gt;. Two clients pointing at the same working directory join the &lt;strong&gt;same underlying workspace&lt;/strong&gt; — they share the session list, message history, permission queue, LSP server pool, and MCP connections. The session picker exposes two signals: &lt;code&gt;IsBusy&lt;/code&gt; (an agent turn is in flight) and &lt;code&gt;AttachedClients&lt;/code&gt; (how many terminals are currently viewing the same session).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Terminal A — start a long refactor and detach&lt;/span&gt;
crush serve &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith &lt;span class="nt"&gt;--yolo&lt;/span&gt;

&lt;span class="c"&gt;# Terminal B — watch the same workspace live&lt;/span&gt;
crush &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith

&lt;span class="c"&gt;# Terminal C on a laptop, SSH'd in — same workspace&lt;/span&gt;
crush &lt;span class="nt"&gt;--cwd&lt;/span&gt; ~/code/monolith
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A non-zero &lt;code&gt;AttachedClients&lt;/code&gt; is the cue that a session is "in progress" on another client. The first client to create a workspace fixes process-wide flags (notably &lt;code&gt;--yolo&lt;/code&gt; and &lt;code&gt;--debug&lt;/code&gt; follow a &lt;strong&gt;first-wins&lt;/strong&gt; rule — later clients cannot loosen security). The workspace lives as long as any client holds an SSE stream open against it; the moment the last stream disconnects, the workspace is torn down with a short grace window so a client that just created the workspace has time to attach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Crush README "Sharing a workspace across clients" section. Workspace lifecycle semantics verified against the README's documented grace-window and first-wins flag rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #3: Agent Skills with &lt;code&gt;user-invocable&lt;/code&gt; and &lt;code&gt;disable-model-invocation&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Skip skills because the docs read like a plugin marketplace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Crush supports the open &lt;strong&gt;Agent Skills&lt;/strong&gt; standard (&lt;code&gt;agentskills.io&lt;/code&gt;) and discovers them from &lt;strong&gt;seven default global paths&lt;/strong&gt; plus three project-relative paths — and that's before you customize &lt;code&gt;options.skills_paths&lt;/code&gt;. The killer feature is two specific frontmatter flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;crush-config&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;skill&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;that&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;can&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;be&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;invoked&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;as&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;a&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;command."&lt;/span&gt;
&lt;span class="na"&gt;user-invocable&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;disable-model-invocation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="c1"&gt;# Walk the user through editing crush.json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set &lt;code&gt;user-invocable: true&lt;/code&gt; to surface the skill in the commands palette (Ctrl+P) as &lt;code&gt;user:skill-name&lt;/code&gt; or &lt;code&gt;project:skill-name&lt;/code&gt;. Set &lt;code&gt;disable-model-invocation: true&lt;/code&gt; to &lt;strong&gt;hide the skill from the model entirely&lt;/strong&gt; while still letting the human invoke it manually. This is how Crush ships its built-in &lt;code&gt;crush-config&lt;/code&gt; skill — the model never auto-triggers it, but pressing Ctrl+P and typing "config" lets you ask the agent to walk you through editing its own config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Bootstrap from anthropics/skills as a starting point&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.config/crush/skills
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.config/crush/skills
git clone https://github.com/anthropics/skills.git _temp
&lt;span class="nb"&gt;mv &lt;/span&gt;_temp/skills/&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; _temp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; You get a clean separation between &lt;strong&gt;human-invoked workflows&lt;/strong&gt; (deploy, config, cleanup) and &lt;strong&gt;model-invoked skills&lt;/strong&gt; (research, refactor, code search). The model can never accidentally fire a destructive skill, but the user can summon it on demand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Crush README "Agent Skills" section — seven global paths and three project-relative paths verified against the source. The &lt;code&gt;agentskills.io&lt;/code&gt; open standard is referenced directly in the README.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #4: Custom Anthropic-Compatible Providers with Per-Model Cost Metadata
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Use the bundled preset providers and never touch the &lt;code&gt;providers&lt;/code&gt; map.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Crush supports two flavours of custom provider config — &lt;code&gt;openai-compat&lt;/code&gt; for non-OpenAI APIs that use the OpenAI shape (Deepseek, Groq, Together, Fireworks), and &lt;code&gt;anthropic&lt;/code&gt; for Anthropic-compatible endpoints (proxies, internal clusters, custom base URLs). The undocumented gem is the &lt;strong&gt;per-model metadata&lt;/strong&gt; fields — &lt;code&gt;cost_per_1m_in&lt;/code&gt;, &lt;code&gt;cost_per_1m_out&lt;/code&gt;, &lt;code&gt;cost_per_1m_in_cached&lt;/code&gt;, &lt;code&gt;cost_per_1m_out_cached&lt;/code&gt;, &lt;code&gt;context_window&lt;/code&gt;, &lt;code&gt;default_max_tokens&lt;/code&gt;, &lt;code&gt;can_reason&lt;/code&gt;, and &lt;code&gt;supports_attachments&lt;/code&gt;. These aren't just decoration: the TUI uses them to render real cost estimates on every request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"providers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deepseek"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"openai-compat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.deepseek.com/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$DEEPSEEK_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"deepseek-chat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Deepseek V3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.27&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in_cached"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.07&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"context_window"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;64000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"default_max_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"custom-anthropic"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"anthropic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"base_url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.your-proxy.internal/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$INTERNAL_ANTHROPIC_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"extra_headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"anthropic-version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2023-06-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"X-Tenant-Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"$TENANT_ID"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-4-20250514"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Claude Sonnet 4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_in"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"cost_per_1m_out"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"context_window"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"default_max_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;50000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"can_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"supports_attachments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Provider &lt;code&gt;extra_body&lt;/code&gt; is a non-expanding JSON passthrough (use it for static fields), but &lt;code&gt;extra_headers&lt;/code&gt;, &lt;code&gt;api_key&lt;/code&gt;, and &lt;code&gt;base_url&lt;/code&gt; all go through the shell-expansion engine. That means you can ship one &lt;code&gt;crush.json&lt;/code&gt; to a team and let each engineer override credentials via environment — and the TUI will display real per-model dollar costs because the metadata is in the config, not hardcoded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Crush README "Custom Providers" section, Deepseek example config verified against the official README. Provider count (~25+ including OpenAI, Anthropic, Google, Groq, OpenRouter, Vercel, MiniMax, Z.ai, Cerebras, Hugging Face, AWS Bedrock, Azure OpenAI, etc.) verified via the env-var table in the README.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #5: Layered Tool and Skill Containment (&lt;code&gt;.crushignore&lt;/code&gt; + &lt;code&gt;disabled_tools&lt;/code&gt; + &lt;code&gt;disabled_skills&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Run with &lt;code&gt;--yolo&lt;/code&gt; and hope for the best, or click through every permission prompt by hand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Crush gives you &lt;strong&gt;three independent containment layers&lt;/strong&gt; that compose:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.crushignore&lt;/code&gt;&lt;/strong&gt; — gitignore-syntax file that prevents files from entering Crush's context entirely (not just blocking edits — it never even reads them).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;options.disabled_tools&lt;/code&gt;&lt;/strong&gt; — hides built-in tools (e.g., &lt;code&gt;"bash"&lt;/code&gt;, &lt;code&gt;"sourcegraph"&lt;/code&gt;) from the agent completely. The model cannot choose a tool it cannot see.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;options.disabled_skills&lt;/code&gt;&lt;/strong&gt; — hides skills (built-in and discovered) from the agent. Pair this with &lt;code&gt;disable-model-invocation&lt;/code&gt; in skill frontmatter for the same effect on a per-skill basis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;permissions.allowed_tools&lt;/code&gt;&lt;/strong&gt; — the inverse whitelist. Only listed tools can be called without prompting.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://charm.land/crush.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"disabled_tools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"bash"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"disabled_skills"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"crush-config"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"skills_paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"~/.config/crush/skills"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"./project-skills"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"allowed_tools"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"view"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"ls"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"grep"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"edit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"mcp_context7_get-library-doc"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .crushignore — secrets, build artifacts, and large data
.env
.env.*
secrets/
*.pem
node_modules/
dist/
*.parquet
data/raw/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; You can deploy Crush to a team with bash disabled (forcing all shell work to go through vetted MCP tools), certain skills hidden (so the model never suggests &lt;code&gt;crush-config&lt;/code&gt; mid-refactor), and an explicit allowlist of read-only tools. The &lt;code&gt;.crushignore&lt;/code&gt; file uses the same syntax as &lt;code&gt;.gitignore&lt;/code&gt; and stacks with it — so files you have already committed but never want the agent to consider are covered. This is the configuration pattern teams running Crush in customer-facing internal tools actually use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Crush README sections on "Ignoring Files", "Allowing Tools", "Disabling Built-In Tools", "Disabling Skills". All four mechanisms verified against the documented behavior in the README.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap: The Five Hidden Uses
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Shell-style secret expansion&lt;/strong&gt; with &lt;code&gt;${VAR:?msg}&lt;/code&gt; and &lt;code&gt;$(command)&lt;/code&gt; for required-credential hygiene.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared workspaces&lt;/strong&gt; across multiple TUI clients via &lt;code&gt;crush serve&lt;/code&gt; and &lt;code&gt;--cwd&lt;/code&gt; keying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent Skills&lt;/strong&gt; with &lt;code&gt;user-invocable&lt;/code&gt; and &lt;code&gt;disable-model-invocation&lt;/code&gt; for human-vs-model skill routing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Anthropic/OpenAI providers&lt;/strong&gt; with per-model cost metadata and &lt;code&gt;extra_body&lt;/code&gt; passthrough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layered containment&lt;/strong&gt; via &lt;code&gt;.crushignore&lt;/code&gt; + &lt;code&gt;disabled_tools&lt;/code&gt; + &lt;code&gt;disabled_skills&lt;/code&gt; + &lt;code&gt;allowed_tools&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Related Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/deepclaudes-5-hidden-uses-17x-cheaper-claude-code-without-changing-your-workflow-o1c"&gt;DeepClaude's 5 Hidden Uses: 17x Cheaper Claude Code Without Changing Your Workflow&lt;/a&gt; — if you love Crush's local-first ethos, this is the proxy that lets you keep using Claude Code at 1/17th the cost.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/ktransformers-5-hidden-uses-of-the-17k-star-moe-inference-stack-from-tsinghua-that-90-of-ai-infra-4l87"&gt;KTransformers: 5 Hidden Uses of the 17K-Star MoE Inference Stack from Tsinghua&lt;/a&gt; — for when you want Crush's "multi-model, swap mid-session" idea extended to actually running 671B locally.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmanis-agent-skills-5-hidden-uses-in-49k-stars-of-workflow-magic-37c8"&gt;Addy Osmani's Agent Skills: 5 Hidden Uses in 49K Stars of Workflow Magic&lt;/a&gt; — the open standard Crush's skill discovery implements, and how to use it in Claude Code and Cursor too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What about you — what's the one config flag in your &lt;code&gt;crush.json&lt;/code&gt; you wish you had known about earlier? Drop it in the comments; the Charm team is reading, and the next release picks the most-upvoted suggestions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>KTransformers的5个隐藏用法，17K Star的MoE推理框架背后没写在README里的能力</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Fri, 12 Jun 2026 03:09:31 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/ktransformersde-5ge-yin-cang-yong-fa-17k-starde-moetui-li-kuang-jia-bei-hou-mei-xie-zai-readmeli-de-neng-li-1cap</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/ktransformersde-5ge-yin-cang-yong-fa-17k-starde-moetui-li-kuang-jia-bei-hou-mei-xie-zai-readmeli-de-neng-li-1cap</guid>
      <description>&lt;p&gt;你知道吗？2026 年中期，在生产环境部署 671B 参数的 DeepSeek-R1 仍然需要 8 张 H100，硬件成本约 20 万美元。但清华大学 MADSys 实验室的开源项目早在 2024 年就能在单台工作站上跑 236B 参数 MoE 模型，2025 年 2 月甚至在普通硬件上实现了 671B DeepSeek-R1 286 tokens/s 的 Prefill 速度。这个项目就是 kvcache-ai/ktransformers，截至 2026-06-12 已有 17,264 Stars、1,313 Forks、Apache-2.0 协议。2026 年的 AI 基础设施叙事被 NVIDIA 机架级系统和越来越贵的显存账单主导。KTransformers 是一条被严重低估的反击路线：它让你在消费级 GPU 和 CPU 内存的混合硬件上跑前沿 MoE 模型，而且提供了五个几乎没人讨论的生产级技巧。&lt;/p&gt;

&lt;h2&gt;
  
  
  背景：2026 年为什么 CPU/GPU 混合推理至关重要
&lt;/h2&gt;

&lt;p&gt;2026 年，混合专家（Mixture-of-Experts，MoE）已经成为前沿开源模型的默认架构。DeepSeek-V3/R1、Qwen3-235B-A22B、Kimi-K2.5、GLM-4.7 以及最新的 DeepSeek-V4-Flash 全是 MoE。直觉上 MoE 推理仍然需要 H100 级 GPU，因为每个 token 只激活少量专家，活跃参数量虽小，但总参数量巨大（DeepSeek-R1 671B，Kimi-K2.5 上万亿）。CPU-GPU 混合方案把"冷"专家放在 CPU 内存，把"热"专家留在 GPU。KTransformers 把这个想法变成一个生产级框架，截至 v0.6.2（2026-05-03 发布）已支持 9 种不同的 MoE 模型。2026 年 ACM SIGOPS 论文《KTransformers: Unleashing the Full Potential of CPU/GPU Hybrid Inference for MoE Models》正式发表了这一架构。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #1：基于频率感知的 CPU-GPU 专家调度
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 把 GPU 当黑盒，试图把整个 MoE 模型塞进显存。模型太大时，要么买更多 GPU，要么换更小的模型。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; KTransformers 通过 &lt;code&gt;--kt-expert-placement-strategy&lt;/code&gt; 标志暴露四种显式专家放置策略。&lt;code&gt;frequency&lt;/code&gt; 策略会记录专家激活统计信息，然后把&lt;strong&gt;最常被激活的专家&lt;/strong&gt;放在 GPU，把冷专家留在 CPU 内存。配合 &lt;code&gt;--kt-enable-dynamic-expert-update&lt;/code&gt; 还能在运行时根据 prefill token 数重新分配专家。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 启动频率感知放置的服务&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; sglang.launch_server &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model&lt;/span&gt; /path/to/qwen3-next-80b &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-num-gpu-experts&lt;/span&gt; 8 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-expert-placement-strategy&lt;/span&gt; frequency &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--init-expert-location&lt;/span&gt; /path/to/activation_stats.pt

&lt;span class="c"&gt;# 长上下文场景下加入动态再分配&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; sglang.launch_server &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model&lt;/span&gt; /path/to/qwen3-next-80b &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-num-gpu-experts&lt;/span&gt; 8 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-expert-placement-strategy&lt;/span&gt; frequency &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--init-expert-location&lt;/span&gt; /path/to/activation_stats.pt &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-enable-dynamic-expert-update&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-gpu-prefill-token-threshold&lt;/span&gt; 512
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 在 Qwen3-Next-80B-A3B-Instruct-FP8 + 4 张 RTX 4090 + Intel Xeon Gold 6454S 的官方基准测试中，50% GPU 专家比例下，&lt;code&gt;frequency&lt;/code&gt; 策略达到 76.19 tokens/s，&lt;code&gt;dynamic-expert-update&lt;/code&gt; 进一步推到 81.17 tokens/s（对比默认 &lt;code&gt;uniform&lt;/code&gt; 策略的 65.25 tokens/s）。80% GPU 比例时，frequency 策略冲到 100.67 tokens/s。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars、1,313 Forks、Apache-2.0 协议，2026-06-07 最后提交，v0.6.2 于 2026-05-03 发布；基准测试表来自 &lt;code&gt;doc/en/kt-kernel/experts-sched-Tutorial.md&lt;/code&gt;；HN "Show HN: KTransformers-236B Model and 1M Context LLM Inference" 20 分（2024-08-29 发布，3 条评论）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #2：三层（GPU-CPU-磁盘）前缀缓存复用
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 每次请求都从头重建 KV 缓存。对于长上下文工作负载（10 万 token 的系统提示 + 5 万 token 的对话），每次冷启动都是几分钟。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; KTransformers 的 &lt;code&gt;balance_serve&lt;/code&gt; 引擎实现了三层 KV 缓存层次结构。热前缀在 GPU 上，温前缀在 CPU 内存里，冷前缀在磁盘上。&lt;code&gt;attn.page_size&lt;/code&gt; 和 &lt;code&gt;kvc2.cpu_memory_size_GB&lt;/code&gt; 参数控制分配比例。开启后，共享相同系统提示的重复请求只计算&lt;strong&gt;增量&lt;/strong&gt;的 KV 缓存，而不是整个上下文。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ktransformers/configs/config.yaml&lt;/span&gt;
&lt;span class="na"&gt;attn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;page_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt;          &lt;span class="c1"&gt;# KV 缓存中一个页的大小&lt;/span&gt;
  &lt;span class="na"&gt;chunk_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;256&lt;/span&gt;
&lt;span class="na"&gt;kvc2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;gpu_only&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;        &lt;span class="c1"&gt;# false 表示启用 Disk + CPU + GPU 三层存储&lt;/span&gt;
  &lt;span class="na"&gt;utilization_percentage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.0&lt;/span&gt;
  &lt;span class="na"&gt;cpu_memory_size_GB&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt; &lt;span class="c1"&gt;# CPU 内存分配给 KV 缓存的容量&lt;/span&gt;
  &lt;span class="na"&gt;disk_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/mnt/data/kvc&lt;/span&gt; &lt;span class="c1"&gt;# 磁盘上存储 KV 缓存的路径&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;编辑配置后，重新编译以启用前缀缓存模式：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git submodule update &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="nt"&gt;--recursive&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh
&lt;span class="c"&gt;# 对于有 1TB+ RAM 的双 NUMA 系统：&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;USE_NUMA&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 多轮 Agent 工作流和 RAG 流水线一旦有稳定的系统提示，缓存的前缀可以在成千上万次请求中复用。CPU-GPU-磁盘的三层结构意味着你能服务的总上下文窗口远超 GPU 显存容量，磁盘层作为透明的扩展存在。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars、Apache-2.0 协议；配置格式来自 &lt;code&gt;doc/en/prefix_cache.md&lt;/code&gt;；v0.2.4 多并发架构重构的发布说明来自 &lt;code&gt;doc/en/balance-serve.md&lt;/code&gt;。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #3：AMX BF16/INT8 加速（比 AVX-512 快 8 倍）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 用 llama.cpp 和大多数推理栈默认的 AVX-512 指令跑 CPU 矩阵乘法。在消费级 CPU 上，这把 MoE 推理速度限制在 60-80 tokens/s。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; KTransformers v0.3+ 内置针对 BF16 和 INT8 量化的 AMX（Intel 高级矩阵扩展）内核。AMX 为每个 CPU 核心引入 8 个专用 Tile 寄存器（tmm0-tmm7），每个可容纳 16 行 x 64 字节。单条 &lt;code&gt;TDPBF16PS&lt;/code&gt; 指令在 16 个 CPU 周期内执行 32,768 次乘加运算，每个核心实现 2,048 次乘加/周期，相比同硅片上的 AVX-512 有 &lt;strong&gt;8 倍吞吐&lt;/strong&gt;。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 启用 AMX 支持安装&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh

&lt;span class="c"&gt;# 用 AMX 后端跑 Qwen3MoE&lt;/span&gt;
python ktransformers/server/main.py &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--architectures&lt;/span&gt; Qwen3MoeForCausalLM &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model_path&lt;/span&gt; &amp;lt;model_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--gguf_path&lt;/span&gt; &amp;lt;gguf_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--optimize_config_path&lt;/span&gt; ktransformers/optimize/optimize_rules/Qwen3Moe-serve-amx.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--backend_type&lt;/span&gt; balance_serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 在 Xeon 4 代 + RTX 4090 工作站上，启用 AMX 的 KTransformers 在 Qwen3MoE-235B-A22 上达到 347 tokens/s Prefill。同样的模型在消费级 i9-14900KF + DDR5-4000 上跑 30B-A3B 流畅无压力。KTransformers 还提供仅 AVX2 路径（&lt;code&gt;--kt-method&lt;/code&gt;），让同样的 MoE 推理栈能在 Sapphire Rapids 服务器、EPYC 工作站、消费台式机之间无缝切换。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars、Apache-2.0 协议；AMX 指令细节和 347 tokens/s Prefill 基准来自 &lt;code&gt;doc/en/AMX.md&lt;/code&gt;；Intel AMX intrinsic 参考来自同文档；HN "Show HN: KTransformers-671B DeepSeek-R1 on a Single Machine" 14 分（2025-02-10 发布）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #4：多并发 balance_serve 配合连续批处理
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 一次只跑一个推理请求，把 LLM 当批处理脚本用。吞吐被单个用户能挤出的极限锁死。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; KTransformers v0.2.4 引入了 &lt;code&gt;balance_serve&lt;/code&gt;，一个受 SGLang 启发的 C++ 引擎，架构分三层：Server（处理 OpenAI 兼容的 HTTP 请求）、Inference Engine（执行分块 Prefill）、Scheduler（按 FCFS 顺序做连续批处理）。配合自定义 &lt;code&gt;flashinfer&lt;/code&gt; 内核和可变 batch size 的 CUDA Graph，DeepSeek-R1 0528 上 4 路并发时聚合吞吐提升 130%。Intel 工程师在 Xeon6 + MRDIMM-8800 平台上验证，单用户 17 tokens/s 提升到聚合 40 tokens/s，瓶颈已经转移到 GPU 端。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 拉取并运行 v0.2.4+ 多并发 Docker 镜像&lt;/span&gt;
docker pull approachingai/ktransformers:v0.2.4-AVX512
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--gpus&lt;/span&gt; all &lt;span class="nt"&gt;--privileged&lt;/span&gt; &lt;span class="nt"&gt;--shm-size&lt;/span&gt; 64g &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; ktrans &lt;span class="nt"&gt;--network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="nt"&gt;-v&lt;/span&gt; /mnt:/mnt &lt;span class="se"&gt;\&lt;/span&gt;
    approachingai/ktransformers:v0.2.4-AVX512 /bin/bash

&lt;span class="c"&gt;# 打开第二个终端 exec 进去&lt;/span&gt;
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; ktrans bash

&lt;span class="c"&gt;# 启动多并发服务&lt;/span&gt;
python ktransformers/server/main.py &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--architectures&lt;/span&gt; Qwen3MoeForCausalLM &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model_path&lt;/span&gt; &amp;lt;model_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--gguf_path&lt;/span&gt; &amp;lt;gguf_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--optimize_config_path&lt;/span&gt; ktransformers/optimize/optimize_rules/Qwen3Moe-serve.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--backend_type&lt;/span&gt; balance_serve

&lt;span class="c"&gt;# 并发打多个请求&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in &lt;/span&gt;1 2 3 4&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    &lt;/span&gt;curl http://localhost:30000/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"model":"model-name","messages":[{"role":"user","content":"Hello!"}],"stream":true}'&lt;/span&gt; &amp;amp;
&lt;span class="k"&gt;done
&lt;/span&gt;&lt;span class="nb"&gt;wait&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 一台 KTransformers 服务就能扛住整个团队的交互式 LLM 工作负载。在 Xeon6 + MRDIMM-8800 测试床上，多并发路径把聚合输出吞吐从 17 tokens/s 提升到 40 tokens/s，提升 2.35 倍。OpenAI 兼容的 &lt;code&gt;/v1/chat/completions&lt;/code&gt; API 意味着现有工具（LangChain、LlamaIndex、Cursor、Continue.dev）可以零修改接入。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars、1,313 Forks、Apache-2.0 协议；130% 吞吐提升和 17 到 40 tokens/s 基准来自 &lt;code&gt;doc/en/balance-serve.md&lt;/code&gt;；v0.2.4 发布说明来自同文档；HN "Show HN: KTransformers-236B Model and 1M Context LLM Inference on Local Machines" 20 分（2024-08-29）。&lt;/p&gt;

&lt;h2&gt;
  
  
  隐藏用法 #5：LLaMA-Factory SFT 集成 MoE LoRA 微调（比 ZeRO-Offload 快 6-12 倍）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的做法：&lt;/strong&gt; 用 DeepSpeed 的 ZeRO-Offload 微调 MoE 模型。能跑，但 CPU offload 让训练极其痛苦——每个优化器步骤都要通过 PCIe 总线搬运上百 GB 梯度。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; KTransformers v0.6.1 提供 &lt;code&gt;ktransformers[sft]&lt;/code&gt; extra，直接和 LLaMA-Factory 集成。集成使用 KT-Kernel 针对优化器状态的 CPU 优化 INT8/INT4 量化，加上 FSDP2 智能分片。在基准测试的 MoE SFT 工作负载下，相比 ZeRO-Offload 实现了 &lt;strong&gt;6-12 倍训练加速&lt;/strong&gt;，CPU 内存减少约一半。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 安装 SFT 栈&lt;/span&gt;
conda create &lt;span class="nt"&gt;-n&lt;/span&gt; kt-sft &lt;span class="nv"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3.11 &lt;span class="nt"&gt;-y&lt;/span&gt;
conda activate kt-sft
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--extra-index-url&lt;/span&gt; https://download.pytorch.org/whl/cu130 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;torch&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;2.9.1 &lt;span class="nv"&gt;torchvision&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;0.24.1 &lt;span class="nv"&gt;torchaudio&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;2.9.1

&lt;span class="c"&gt;# 安装 LLaMA-Factory + KT SFT&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/LLaMA-Factory
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements/ktransformers.txt

&lt;span class="c"&gt;# 在 Qwen3-30B-A3B 上用 1 张 RTX 4090 启动 MoE LoRA SFT&lt;/span&gt;
&lt;span class="nv"&gt;CUDA_VISIBLE_DEVICES&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0,1,2,3 accelerate launch &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--config_file&lt;/span&gt; examples/ktransformers/accelerate/fsdp2_kt_int8.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    src/train.py &lt;span class="se"&gt;\&lt;/span&gt;
    examples/ktransformers/train_lora/qwen3_5moe_lora_sft_kt.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 在 DeepSeek-V3 和 DeepSeek-R1 上，KT SFT 在 4 张 RTX 4090 + 80GB 显存上跑到 3.7 it/s。Qwen3-30B-A3B 在单张 RTX 4090 + 24GB 显存上跑到 8+ it/s。这让在单卡消费级硬件上微调前沿 MoE 模型成为现实，而不是需要 8 张 H100 集群。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars、Apache-2.0 协议；6-12 倍加速和 3.7 it/s / 8+ it/s 基准来自 &lt;code&gt;doc/en/SFT/KTransformers-Fine-Tuning_Quick-Start.md&lt;/code&gt; 以及主 README 中的 SFT 介绍；集成 PR 在 hiyouga/LLaMA-Factory#10430；HN Show HN 总计 34 分（2024-08-29 20 分 + 2025-02-10 14 分）。&lt;/p&gt;

&lt;h2&gt;
  
  
  总结
&lt;/h2&gt;

&lt;p&gt;五个把 KTransformers 从研究玩具变成 2026 AI 基础设施重器 的生产级技巧：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;CPU-GPU 专家调度&lt;/strong&gt; 配合频率感知放置和动态再分配（100% GPU 比例下 114.26 tokens/s；50% 比例下动态更新 81.17 tokens/s）&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;三层前缀缓存复用&lt;/strong&gt; 横跨 GPU、CPU 内存和磁盘（把多分钟的冷启动变成增量更新）&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AMX BF16/INT8 加速&lt;/strong&gt; 实现 AVX-512 的 8 倍吞吐（Xeon 4 + RTX 4090 工作站上 347 tokens/s Prefill）&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;多并发 balance_serve&lt;/strong&gt; 配合连续批处理（4 路并发下吞吐提升 130%，Xeon6 上 17 到 40 tokens/s 聚合）&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLaMA-Factory SFT 集成&lt;/strong&gt; MoE LoRA 微调（比 ZeRO-Offload 快 6-12 倍，DeepSeek-V3 在 4 张 RTX 4090 上 3.7 it/s）&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如果你读过这个系列的其他文章，会发现熟悉的模式：&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmanis-agent-skills-5-hidden-uses-in-49k-stars-of-workflow-magic-37c8"&gt;Agent Skills: 5 Hidden Uses in 49K Stars of Workflow Magic&lt;/a&gt; 用类似的"框架藏了 5 个生产技巧"模式讲了工程技能，&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/mempalaces-5-hidden-uses-that-make-it-the-best-benchmarked-ai-memory-system-in-2026-3ccl"&gt;MemPalace: 5 Hidden Uses That Make It the Best-Benchmarked AI Memory System&lt;/a&gt; 以同等深度剖析记忆基础设施，&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/gooses-5-hidden-uses-that-turn-it-into-a-production-ai-agent-stack-in-2026-3ccl"&gt;Goose's 5 Hidden Uses That Turn It Into a Production AI Agent Stack&lt;/a&gt; 在 Agent 编排层展示了同样的"生产技巧"模式。&lt;/p&gt;

&lt;p&gt;你在 2026 年遇到的最被低估的 MoE 推理优化是什么？在评论里留下你的吞吐数字、硬件配置和模型，我们将在后续文章中深入挖掘。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>KTransformers: 5 Hidden Uses of the 17K-Star MoE Inference Stack from Tsinghua That 90% of AI Infra Teams Miss in 2026</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Fri, 12 Jun 2026 03:09:22 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/ktransformers-5-hidden-uses-of-the-17k-star-moe-inference-stack-from-tsinghua-that-90-of-ai-infra-4l87</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/ktransformers-5-hidden-uses-of-the-17k-star-moe-inference-stack-from-tsinghua-that-90-of-ai-infra-4l87</guid>
      <description>&lt;p&gt;Here's a fact that should stop every AI infrastructure engineer in their tracks: as of mid-2026, the de facto standard for serving a 671B DeepSeek-R1 model in production still requires &lt;strong&gt;8x H100 GPUs and roughly $200,000 of hardware&lt;/strong&gt;. Meanwhile, an open-source project from MADSys Lab at Tsinghua University has been quietly running 236B-parameter MoE models on a single workstation since 2024, and hit 286 tokens/s prefill on DeepSeek-R1 671B on commodity hardware. That project is &lt;code&gt;kvcache-ai/ktransformers&lt;/code&gt;, and as of 2026-06-12 it has 17,264 Stars, 1,313 Forks, and an Apache-2.0 license. The 2026 AI infrastructure conversation has been dominated by NVIDIA rack-scale systems and the ever-growing VRAM bill. KTransformers is the open-source counter-narrative: it lets you run frontier-class MoE models on a mix of consumer GPUs and CPU RAM, and it does this with five production-grade techniques that almost nobody talks about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context: Why CPU/GPU Hybrid Inference Matters in 2026
&lt;/h2&gt;

&lt;p&gt;In 2026, Mixture-of-Experts (MoE) has become the default architecture for frontier open-weight models. DeepSeek-V3/R1, Qwen3-235B-A22B, Kimi-K2.5, GLM-4.7, and the new DeepSeek-V4-Flash are all MoE. The naive assumption is that MoE inference still needs H100-class GPUs because each token only activates a few experts, so the active parameter count is small, but the &lt;strong&gt;total parameter count is enormous&lt;/strong&gt; (671B for DeepSeek-R1, 1T for Kimi-K2.5). The CPU-GPU hybrid approach moves the "cold" experts to CPU RAM and keeps the "hot" experts on the GPU. KTransformers has turned this idea into a production framework that supports nine different MoE models as of v0.6.2 (released 2026-05-03). The 2026 ACM SIGOPS paper "KTransformers: Unleashing the Full Potential of CPU/GPU Hybrid Inference for MoE Models" formally published the architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #1: CPU-GPU Expert Scheduling with Frequency-Aware Placement
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They treat the GPU as a black box and try to fit the entire MoE model into VRAM. When the model is too large, they either buy more GPUs or use a smaller model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; KTransformers exposes four explicit expert placement strategies via the &lt;code&gt;--kt-expert-placement-strategy&lt;/code&gt; flag. The &lt;code&gt;frequency&lt;/code&gt; strategy records expert activation statistics, then places only the &lt;strong&gt;most frequently activated experts&lt;/strong&gt; on the GPU while keeping cold experts in CPU RAM. You can also enable &lt;code&gt;--kt-enable-dynamic-expert-update&lt;/code&gt; to redistribute experts at runtime when the prefill token count exceeds a threshold.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start the server with frequency-based placement&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; sglang.launch_server &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model&lt;/span&gt; /path/to/qwen3-next-80b &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-num-gpu-experts&lt;/span&gt; 8 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-expert-placement-strategy&lt;/span&gt; frequency &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--init-expert-location&lt;/span&gt; /path/to/activation_stats.pt

&lt;span class="c"&gt;# Add dynamic redistribution for long-context workloads&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; sglang.launch_server &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model&lt;/span&gt; /path/to/qwen3-next-80b &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-num-gpu-experts&lt;/span&gt; 8 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-expert-placement-strategy&lt;/span&gt; frequency &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--init-expert-location&lt;/span&gt; /path/to/activation_stats.pt &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-enable-dynamic-expert-update&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--kt-gpu-prefill-token-threshold&lt;/span&gt; 512
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; On Qwen3-Next-80B-A3B-Instruct-FP8 with 4x RTX 4090 + Intel Xeon Gold 6454S, the official benchmark table shows that at a 50% GPU expert ratio, the &lt;code&gt;frequency&lt;/code&gt; strategy delivers 76.19 tokens/s, and &lt;code&gt;dynamic-expert-update&lt;/code&gt; pushes that to 81.17 tokens/s (versus 65.25 tokens/s for the default &lt;code&gt;uniform&lt;/code&gt; strategy). At 80% GPU ratio, the frequency strategy hits 100.67 tokens/s.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars, 1,313 Forks, Apache-2.0, last push 2026-06-07, v0.6.2 released 2026-05-03; benchmark table from &lt;code&gt;doc/en/kt-kernel/experts-sched-Tutorial.md&lt;/code&gt;; HN "Show HN: KTransformers-236B Model and 1M Context LLM Inference" 20 points (story from 2024-08-29, 3 comments).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #2: 3-Layer (GPU-CPU-Disk) Prefix Cache Reuse
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They rebuild the KV cache from scratch for every request. For long-context workloads (a 100K token system prompt plus a 50K token conversation), this is a multi-minute cold start every single time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; KTransformers' &lt;code&gt;balance_serve&lt;/code&gt; engine implements a 3-layer KV cache hierarchy. Hot prefixes live on the GPU, warm prefixes live in CPU RAM, and cold prefixes live on disk. The &lt;code&gt;attn.page_size&lt;/code&gt; and &lt;code&gt;kvc2.cpu_memory_size_GB&lt;/code&gt; parameters control the split. Once you enable it, repeated requests that share a system prompt only compute the KV cache for the &lt;strong&gt;delta&lt;/strong&gt;, not the full context.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ktransformers/configs/config.yaml&lt;/span&gt;
&lt;span class="na"&gt;attn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;page_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt;          &lt;span class="c1"&gt;# Size of a page in KV Cache&lt;/span&gt;
  &lt;span class="na"&gt;chunk_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;256&lt;/span&gt;
&lt;span class="na"&gt;kvc2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;gpu_only&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;        &lt;span class="c1"&gt;# false = Disk + CPU + GPU KV storage&lt;/span&gt;
  &lt;span class="na"&gt;utilization_percentage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.0&lt;/span&gt;
  &lt;span class="na"&gt;cpu_memory_size_GB&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt; &lt;span class="c1"&gt;# Amount of CPU memory allocated for KV Cache&lt;/span&gt;
  &lt;span class="na"&gt;disk_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/mnt/data/kvc&lt;/span&gt; &lt;span class="c1"&gt;# Path to store KV Cache on disk&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After editing the config, recompile with prefix cache mode enabled:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git submodule update &lt;span class="nt"&gt;--init&lt;/span&gt; &lt;span class="nt"&gt;--recursive&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh
&lt;span class="c"&gt;# For dual-NUMA systems with 1TB+ RAM:&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;USE_NUMA&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Multi-turn agent workflows and RAG pipelines with a stable system prompt reuse the cached prefix across thousands of requests. The CPU-GPU-Disk split means you can serve models whose total context window is far larger than GPU VRAM, with the disk layer acting as a transparent extension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars, Apache-2.0; configuration format from &lt;code&gt;doc/en/prefix_cache.md&lt;/code&gt;; release notes from &lt;code&gt;doc/en/balance-serve.md&lt;/code&gt; documenting v0.2.4 multi-concurrency architecture refactor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #3: AMX BF16/INT8 Acceleration (8x Faster Than AVX-512)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They run CPU matrix multiplications on AVX-512 instructions, which is the default in llama.cpp and most other inference stacks. On consumer CPUs, this caps MoE inference at 60-80 tokens/s.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; KTransformers v0.3+ ships native AMX (Intel Advanced Matrix Extensions) kernels for BF16 and INT8 quantization. AMX introduces 8 dedicated Tile registers (tmm0-tmm7) per CPU core, each holding up to 16 rows x 64 bytes. A single &lt;code&gt;TDPBF16PS&lt;/code&gt; instruction performs 32,768 multiply-add operations in 16 CPU cycles, giving each core 2,048 multiply-add ops per cycle, which is &lt;strong&gt;8x the throughput of AVX-512&lt;/strong&gt; on the same silicon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install with AMX support&lt;/span&gt;
&lt;span class="nv"&gt;USE_BALANCE_SERVE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 bash ./install.sh

&lt;span class="c"&gt;# Run Qwen3MoE with the AMX backend&lt;/span&gt;
python ktransformers/server/main.py &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--architectures&lt;/span&gt; Qwen3MoeForCausalLM &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model_path&lt;/span&gt; &amp;lt;model_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--gguf_path&lt;/span&gt; &amp;lt;gguf_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--optimize_config_path&lt;/span&gt; ktransformers/optimize/optimize_rules/Qwen3Moe-serve-amx.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--backend_type&lt;/span&gt; balance_serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; On a workstation with Xeon 4th Gen + RTX 4090, KTransformers with AMX hits 347 tokens/s prefill on Qwen3MoE-235B-A22. The same model on a consumer i9-14900KF + DDR5-4000 runs smoothly at 30B-A3B, with a high-end gaming laptop as the lower bound. KTransformers also offers an AVX2-only path (&lt;code&gt;--kt-method&lt;/code&gt; for non-AMX CPUs), making the same MoE inference stack usable across Sapphire Rapids servers, EPYC workstations, and consumer desktops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars, Apache-2.0; AMX instruction details and 347 tokens/s prefill benchmark from &lt;code&gt;doc/en/AMX.md&lt;/code&gt;; Intel AMX intrinsic reference from the same doc; HN "Show HN: KTransformers-671B DeepSeek-R1 on a Single Machine" 14 points (story from 2025-02-10, 0 comments at time of indexing).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #4: Multi-Concurrency balance_serve with Continuous Batching
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They run inference with a single request at a time, treating the LLM like a batch script. Throughput is limited to whatever one user can squeeze out of the GPU.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; KTransformers v0.2.4 introduced &lt;code&gt;balance_serve&lt;/code&gt;, a SGLang-inspired C++ engine with three architectural layers: Server (handles OpenAI-compatible HTTP), Inference Engine (executes chunked prefill), and Scheduler (continuous batching in FCFS order). Combined with custom &lt;code&gt;flashinfer&lt;/code&gt; kernels and variable batch size CUDA Graphs, this design lifts aggregate throughput by 130% under 4-way concurrency on DeepSeek-R1 0528. Intel engineers validated it on Xeon6 + MRDIMM-8800, going from 17 tokens/s single-user to 40 tokens/s aggregate output throughput, with the bottleneck shifting to the GPU side.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Pull and run the v0.2.4+ multi-concurrency Docker image&lt;/span&gt;
docker pull approachingai/ktransformers:v0.2.4-AVX512
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--gpus&lt;/span&gt; all &lt;span class="nt"&gt;--privileged&lt;/span&gt; &lt;span class="nt"&gt;--shm-size&lt;/span&gt; 64g &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; ktrans &lt;span class="nt"&gt;--network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="nt"&gt;-v&lt;/span&gt; /mnt:/mnt &lt;span class="se"&gt;\&lt;/span&gt;
    approachingai/ktransformers:v0.2.4-AVX512 /bin/bash

&lt;span class="c"&gt;# Open a second terminal and exec in&lt;/span&gt;
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; ktrans bash

&lt;span class="c"&gt;# Start the multi-concurrency server&lt;/span&gt;
python ktransformers/server/main.py &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--architectures&lt;/span&gt; Qwen3MoeForCausalLM &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--model_path&lt;/span&gt; &amp;lt;model_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--gguf_path&lt;/span&gt; &amp;lt;gguf_dir&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--optimize_config_path&lt;/span&gt; ktransformers/optimize/optimize_rules/Qwen3Moe-serve.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--backend_type&lt;/span&gt; balance_serve

&lt;span class="c"&gt;# Hit it with multiple concurrent requests&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in &lt;/span&gt;1 2 3 4&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    &lt;/span&gt;curl http://localhost:30000/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
        &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"model":"model-name","messages":[{"role":"user","content":"Hello!"}],"stream":true}'&lt;/span&gt; &amp;amp;
&lt;span class="k"&gt;done
&lt;/span&gt;&lt;span class="nb"&gt;wait&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A single KTransformers server now serves an entire team's interactive LLM workloads. On a Xeon6 + MRDIMM-8800 testbed, the multi-concurrency path bumped total output throughput from 17 tokens/s to 40 tokens/s, a 2.35x lift, by amortizing GPU cost across concurrent users. The OpenAI-compatible &lt;code&gt;/v1/chat/completions&lt;/code&gt; API means existing tooling (LangChain, LlamaIndex, Cursor, Continue.dev) drops in unchanged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars, 1,313 Forks, Apache-2.0; 130% throughput gain and 17 to 40 tokens/s benchmark from &lt;code&gt;doc/en/balance-serve.md&lt;/code&gt;; v0.2.4 release notes from the same doc; HN "Show HN: KTransformers-236B Model and 1M Context LLM Inference on Local Machines" 20 points (2024-08-29).&lt;/p&gt;

&lt;h2&gt;
  
  
  Hidden Use #5: LLaMA-Factory SFT for MoE LoRA Fine-Tuning (6-12x Faster Than ZeRO-Offload)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They fine-tune MoE models with ZeRO-Offload in DeepSpeed. It works, but the CPU offload makes training painfully slow because every optimizer step shuttles hundreds of GB of gradients through the PCIe bus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; KTransformers v0.6.1 ships a &lt;code&gt;ktransformers[sft]&lt;/code&gt; extra that integrates directly with LLaMA-Factory. The integration uses KT-Kernel's CPU-optimized INT8/INT4 quantization on the optimizer states, plus FSDP2 with intelligent sharding. The result is &lt;strong&gt;6-12x training speedup over ZeRO-Offload&lt;/strong&gt; in benchmarked MoE SFT workloads, with roughly half the CPU memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install the SFT stack&lt;/span&gt;
conda create &lt;span class="nt"&gt;-n&lt;/span&gt; kt-sft &lt;span class="nv"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3.11 &lt;span class="nt"&gt;-y&lt;/span&gt;
conda activate kt-sft
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--extra-index-url&lt;/span&gt; https://download.pytorch.org/whl/cu130 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nv"&gt;torch&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;2.9.1 &lt;span class="nv"&gt;torchvision&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;0.24.1 &lt;span class="nv"&gt;torchaudio&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;2.9.1

&lt;span class="c"&gt;# Install LLaMA-Factory + KT SFT&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/LLaMA-Factory
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements/ktransformers.txt

&lt;span class="c"&gt;# Launch MoE LoRA SFT on Qwen3-30B-A3B with 1x RTX 4090&lt;/span&gt;
&lt;span class="nv"&gt;CUDA_VISIBLE_DEVICES&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0,1,2,3 accelerate launch &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--config_file&lt;/span&gt; examples/ktransformers/accelerate/fsdp2_kt_int8.yaml &lt;span class="se"&gt;\&lt;/span&gt;
    src/train.py &lt;span class="se"&gt;\&lt;/span&gt;
    examples/ktransformers/train_lora/qwen3_5moe_lora_sft_kt.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; On DeepSeek-V3 and DeepSeek-R1, KT SFT runs at 3.7 it/s with ~80GB total GPU memory on 4x RTX 4090. Qwen3-30B-A3B trains at 8+ it/s on a single RTX 4090 with ~24GB total. This makes it feasible to fine-tune frontier MoE models on a single consumer-grade GPU instead of an 8x H100 cluster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; kvcache-ai/ktransformers GitHub 17,264 Stars, Apache-2.0; 6-12x speedup claim and 3.7 it/s / 8+ it/s benchmarks from &lt;code&gt;doc/en/SFT/KTransformers-Fine-Tuning_Quick-Start.md&lt;/code&gt; and the SFT introduction in the main README; integration PR at hiyouga/LLaMA-Factory#10430; HN Show HN 20+14 points across the two launch stories (2024-08-29 and 2025-02-10).&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Five production-grade techniques that turn KTransformers from a research curiosity into a 2026 AI infrastructure workhorse:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;CPU-GPU Expert Scheduling&lt;/strong&gt; with frequency-aware placement and dynamic redistribution (114.26 tokens/s at 100% GPU ratio; 81.17 tokens/s with dynamic update at 50% ratio)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3-Layer Prefix Cache Reuse&lt;/strong&gt; spanning GPU, CPU RAM, and disk (turns multi-minute cold starts into incremental updates)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AMX BF16/INT8 Acceleration&lt;/strong&gt; delivering 8x the throughput of AVX-512 (347 tokens/s prefill on a Xeon 4 + RTX 4090 workstation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Concurrency balance_serve&lt;/strong&gt; with continuous batching (130% throughput gain under 4-way concurrency, 17 to 40 tokens/s aggregate on Xeon6)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLaMA-Factory SFT Integration&lt;/strong&gt; for MoE LoRA fine-tuning (6-12x faster than ZeRO-Offload, 3.7 it/s on 4x RTX 4090 for DeepSeek-V3)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have read the other articles in this series, these will feel familiar: &lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmanis-agent-skills-5-hidden-uses-in-49k-stars-of-workflow-magic-37c8"&gt;Agent Skills: 5 Hidden Uses in 49K Stars of Workflow Magic&lt;/a&gt; shows a similar "framework hides 5 production tricks" pattern for engineering skills, &lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/mempalaces-5-hidden-uses-that-make-it-the-best-benchmarked-ai-memory-system-in-2026-3ccl"&gt;MemPalace: 5 Hidden Uses That Make It the Best-Benchmarked AI Memory System&lt;/a&gt; tackles memory infrastructure with comparable depth, and &lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/gooses-5-hidden-uses-that-turn-it-into-a-production-ai-agent-stack-in-2026-3ccl"&gt;Goose's 5 Hidden Uses That Turn It Into a Production AI Agent Stack&lt;/a&gt; demonstrates the same "production tricks" pattern for the agent orchestration layer.&lt;/p&gt;

&lt;p&gt;What is the most underrated MoE inference optimization you have hit in 2026? Drop a comment with the throughput number, the hardware, and the model, and we will dig into it in a future article.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Context Mode 的 5 个隐藏用法 🔥 — 让 Claude Code 上下文消耗减少 98% 的 MCP Server</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Thu, 11 Jun 2026 05:46:05 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/context-mode-de-5-ge-yin-cang-yong-fa-rang-claude-code-shang-xia-wen-xiao-hao-jian-shao-98-de-mcp-server-2662</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/context-mode-de-5-ge-yin-cang-yong-fa-rang-claude-code-shang-xia-wen-xiao-hao-jian-shao-98-de-mcp-server-2662</guid>
      <description>&lt;p&gt;如果你用过 Claude Code、Cursor 或任何 AI 编程助手超过 30 分钟，你一定遇到过这道墙：上下文窗口写满了，智能体开始忘记你刚才在编辑哪些文件、任务进展到哪里、你最后问的是什么。这不是模型的问题——是数据路由的问题。而 GitHub 上有一个项目，自 2026 年 2 月起就在解决这个问题，17,032 Stars，被 Microsoft、Google、Meta、Amazon、NVIDIA 等 14 家科技公司的工程师使用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context Mode&lt;/strong&gt; 是一个 MCP Server，位于 AI 编程助手和其工具输出之间，对原始数据进行沙箱隔离，使其永远不会涌入你的上下文窗口。一个 56 KB 的 Playwright 快照变成 299 字节。20 条 GitHub Issue（59 KB）变成 1.1 KB。这是 98–99% 的缩减——而智能体仍然可以通过语义搜索访问它需要的一切。&lt;/p&gt;

&lt;p&gt;以下是 5 个大多数开发者忽略的隐藏用法。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #1：跨上下文压缩的持久会话记忆
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 当 Claude Code 的上下文写满、模型压缩对话时，所有你编辑过的文件、遇到过的错误、进行中的任务的历史都会被悄悄丢弃。每次"继续"都是从空白开始。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 安装 ctx_index 获取会话记忆&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; context-mode

&lt;span class="c"&gt;# 在 Claude Code 中，持续为项目会话建立索引&lt;/span&gt;
ctx index &lt;span class="nt"&gt;--paths&lt;/span&gt; ./src &lt;span class="nt"&gt;--session-name&lt;/span&gt; my-project &lt;span class="nt"&gt;--continuous&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ctx_index&lt;/code&gt; 工具按标题对代码进行分块，同时保持代码块完整，将所有内容存储在 SQLite FTS5 虚拟表中。当上下文窗口压缩时，Context Mode 不会将你的会话数据重新倒入上下文——它只通过 BM25 搜索检索相关内容。模型准确地从上次中断的地方继续。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 跨上下文压缩的会话连续性。你的智能体会记住文件编辑、git 操作、任务进度和错误解决——即使上下文窗口重置后也是如此。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars；HN 主帖 570 pts / 107 评论（story ID 47193064）；README 基准测试已验证（Playwright 56.2 KB → 299 B = 99% 节省，GitHub Issues 58.9 KB → 1.1 KB = 98% 节省）；README 徽章确认在 Microsoft、Google、Meta、Amazon、NVIDIA、ByteDance、Stripe、Salesforce、GitHub、Red Hat、Supabase、Canva、Notion、Hasura、Framer、Cursor 使用&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #2：零配置跨平台工具沙箱隔离
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 直接在智能体的上下文中运行危险操作（sudo、文件系统访问、网络调用）——因为没有办法约束它，所以只能给予它完整的系统访问权限。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ctx_execute 生成一个具有独立进程边界的隔离子进程&lt;/span&gt;
&lt;span class="c"&gt;# 脚本无法访问彼此的内存或状态&lt;/span&gt;
&lt;span class="c"&gt;# 你智能体配置中的权限规则自动在沙箱中执行&lt;/span&gt;

ctx execute &lt;span class="nt"&gt;--sandbox&lt;/span&gt; &lt;span class="s2"&gt;"rm -rf /tmp/sandbox-dir"&lt;/span&gt;
&lt;span class="c"&gt;# 如果你在智能体配置中阻止 'sudo'，它在 ctx_execute 内部也会被阻止&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;每次 &lt;code&gt;ctx_execute&lt;/code&gt; 调用都在隔离的子进程中运行。原始数据——日志文件、API 响应、快照——永远不会进入你的对话上下文。沙箱执行你已有的相同权限规则。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 零设置的安全隔离。你可以安全地运行破坏性或不受信任的操作，而无需修改智能体配置。权限模型自动从你现有的设置中继承。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars；README "Security" 部分已验证："Context Mode 执行你已有的相同权限规则——但将它们扩展到 MCP 沙箱"&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #3：大型代码库的结构化 Markdown 索引
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 将整个文件或大型代码库作为原始文本输入上下文窗口，为所有内容支付完整 token 成本——即使你只需要了解结构。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ctx_index 按标题对 markdown 进行分块，同时保持代码块完整
# SQLite FTS5 后端在运行时自动选择：
#   bun:sqlite（ Bun 环境）
#   node:sqlite（Node.js &amp;gt;= 22.5）
#   better-sqlite3（其他环境）
&lt;/span&gt;
&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paths&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;
&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paths&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;blocks&lt;/span&gt;

&lt;span class="c1"&gt;# 仅查询相关部分
&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;authentication middleware implementation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;索引器智能地分离文本和代码，以适当的格式存储以进行语义检索。当你的智能体需要理解大型代码库时，它查询索引而不是将所有内容加载到上下文中。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 大型文档集和代码库变得可查询，token 成本恒定，无论其总大小如何。智能体只检索相关部分。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars；README "How the Knowledge Base Works" 部分已验证："按标题对 markdown 内容进行分块，同时保持代码块完整，然后存储在 SQLite FTS5 虚拟表中"&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #4：自动上下文去重的批量执行
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 顺序运行多个工具调用，每个都将其原始输出添加到上下文窗口——累积冗余数据，从多个角度消耗上下文。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ctx_batch_execute 按顺序运行多个命令，在 MCP 层去重&lt;/span&gt;
ctx batch-execute &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--commands&lt;/span&gt; &lt;span class="s2"&gt;"git status"&lt;/span&gt; &lt;span class="s2"&gt;"npm test"&lt;/span&gt; &lt;span class="s2"&gt;"docker ps"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--sandbox&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dedupe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;批量执行器自动在命令之间对重复数据进行去重。上下文窗口只接收唯一、有意义的输出——而不是序列中每个命令的原始日志垃圾。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 一系列 5 个命令通常会生成 200+ KB 的上下文输出，而实际上只生成一个简洁、去重的摘要。智能体获得信号而不是噪音。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars；README "Utility Commands" 部分已验证：&lt;code&gt;ctx stats&lt;/code&gt; 显示上下文节省、调用次数和会话报告&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #5：实时上下文预算监控
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 盲目飞行——运行冗长的编程会话，没有任何可见性了解剩余多少上下文预算、智能体何时开始压缩、或哪些工具消耗最多 token。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 实时上下文预算监控&lt;/span&gt;
ctx stats

&lt;span class="c"&gt;# 示例输出：&lt;/span&gt;
&lt;span class="c"&gt;# Calls: 47 | Raw: 2.4 MB | Context: 89 KB | Saved: 96%&lt;/span&gt;
&lt;span class="c"&gt;# Top consumers: ctx_execute (62%), ctx_index (28%), ctx_search (10%)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ctx stats&lt;/code&gt; 命令为你提供每个工具的上下文消耗、节省百分比和会话持续时间的实时明细。你可以准确看到何时预期上下文压缩以及哪些操作是最大的上下文消耗者。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 主动上下文管理。与其在任务中途被上下文压缩惊讶，不如提前预知并可以顺利地 &lt;code&gt;--continue&lt;/code&gt; 会话，或在问题变严重之前刷新不需要的上下文。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars；README "Utility Commands" 部分已验证：&lt;code&gt;ctx stats&lt;/code&gt; → "context savings, call counts, session report"；README 基准测试已确认："Deep repo research — 5 calls, 62 KB context (raw: 986 KB, 94% saved)"&lt;/p&gt;




&lt;h2&gt;
  
  
  总结：掌握 Context Mode 的 5 个技巧
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;持久会话记忆&lt;/strong&gt; — ctx_index + FTS5 BM25 跨上下文压缩检索&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;跨平台沙箱隔离&lt;/strong&gt; — ctx_execute 隔离子进程与继承的权限规则&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;结构化 Markdown 索引&lt;/strong&gt; — 智能分块分离文本和代码块&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;去重批量执行&lt;/strong&gt; — ctx_batch_execute 消除冗余上下文输出&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;实时上下文预算监控&lt;/strong&gt; — &lt;code&gt;ctx stats&lt;/code&gt; 实现主动上下文管理&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;如果你在使用 Claude Code、Cursor、Qwen Code、Gemini CLI、VS Code Copilot、JetBrains Copilot、OpenCode、KiloCode、OpenClaw、Codex CLI、Antigravity、Kiro、Zed、Pi 或 OMP——Context Mode 开箱即用。钩子支持平台无需配置。&lt;/p&gt;

&lt;p&gt;试试看，分享你自己的隐藏用法——或查看 &lt;a href="https://github.com/mksglu/context-mode" rel="noopener noreferrer"&gt;GitHub 仓库&lt;/a&gt; 获取完整文档。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; context-mode GitHub 17,032 Stars / 1,214 Forks（通过直接 API 验证，push 2026-06-10）；HN 主帖 570 pts / 107 评论（story ID 47193064）；HN Show HN 84 pts / 23 评论；在 Microsoft、Google、Meta、Amazon、IBM、NVIDIA、ByteDance、Stripe、Datadog、Salesforce、GitHub、Red Hat、Supabase、Canva、Notion、Hasura、Framer、Cursor 使用（来自官方 README 徽章）；基准测试：Playwright 56.2 KB → 299 B (99%)，GitHub Issues 58.9 KB → 1.1 KB (98%)，Deep repo research 986 KB → 62 KB (94%)；15 个平台兼容性表已验证。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Context Mode's 5 Hidden Uses 🔥 — MCP Server That Cuts Claude Code Context by 98%</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Thu, 11 Jun 2026 05:45:53 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/context-modes-5-hidden-uses-mcp-server-that-cuts-claude-code-context-by-98-32ih</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/context-modes-5-hidden-uses-mcp-server-that-cuts-claude-code-context-by-98-32ih</guid>
      <description>&lt;p&gt;If you use Claude Code, Cursor, or any AI coding agent for more than 30 minutes, you've hit this wall: the context window fills up, the agent starts forgetting which files you were editing, what tasks are in progress, and what you last asked for. It's not a model problem — it's a data routing problem. And there's a GitHub project with 17,032 Stars that's been solving it since February 2026, used by engineers at Microsoft, Google, Meta, Amazon, NVIDIA, and 13 other major tech companies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context Mode&lt;/strong&gt; is an MCP server that sits between your AI coding agent and its tool outputs, sandboxing raw data so it never floods your context window. A 56 KB Playwright snapshot becomes 299 bytes. Twenty GitHub issues (59 KB) become 1.1 KB. That's a 98–99% reduction — and the agent still has access to everything it needs via semantic search.&lt;/p&gt;

&lt;p&gt;Here are 5 hidden uses that most developers miss.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #1: Persistent Session Memory Across Context Compactions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; When Claude Code's context fills up and the model compacts the conversation, all the history of what files you edited, what errors you hit, and what tasks are in progress gets silently dropped. You start each "resume" from a blank slate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install ctx_index for session memory&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; context-mode

&lt;span class="c"&gt;# Inside Claude Code, index your project session continuously&lt;/span&gt;
ctx index &lt;span class="nt"&gt;--paths&lt;/span&gt; ./src &lt;span class="nt"&gt;--session-name&lt;/span&gt; my-project &lt;span class="nt"&gt;--continuous&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;ctx_index&lt;/code&gt; tool chunks your code by headings while keeping code blocks intact, storing everything in a SQLite FTS5 virtual table. When the context window compacts, Context Mode doesn't dump your session data back into context — it retrieves only the relevant chunks via BM25 search. The model picks up exactly where it left off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Session continuity across context compactions. Your agent remembers file edits, git operations, task progress, and error resolutions — even after the context window resets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars; HN main launch 570 pts / 107 comments (story ID 47193064); README benchmarks verified (Playwright 56.2 KB → 299 B = 99% saved, GitHub Issues 58.9 KB → 1.1 KB = 98% saved); README badges confirm usage at Microsoft, Google, Meta, Amazon, NVIDIA, ByteDance, Stripe, Salesforce, GitHub, Red Hat, Supabase, Canva, Notion, Hasura, Framer, Cursor&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #2: Cross-Platform Tool Sandboxing Without Config Changes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Running dangerous operations (sudo, file system access, network calls) directly in the agent's context — trusting the agent with full system access because there's no other way to constrain it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ctx_execute spawns an isolated subprocess with its own process boundary&lt;/span&gt;
&lt;span class="c"&gt;# Scripts can't access each other's memory or state&lt;/span&gt;
&lt;span class="c"&gt;# Permission rules from your agent config are automatically enforced inside the sandbox&lt;/span&gt;

ctx execute &lt;span class="nt"&gt;--sandbox&lt;/span&gt; &lt;span class="s2"&gt;"rm -rf /tmp/sandbox-dir"&lt;/span&gt;
&lt;span class="c"&gt;# If you block 'sudo' in your agent config, it's blocked inside ctx_execute too&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every &lt;code&gt;ctx_execute&lt;/code&gt; call runs in an isolated subprocess. The raw data — log files, API responses, snapshots — never enters your conversation context. The sandbox enforces the same permission rules you already use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Zero-setup security isolation. You can run destructive or untrusted operations safely without modifying your agent configuration. The permission model is inherited from your existing setup automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars; README "Security" section verified: "Context Mode enforces the same permission rules you already use — but extends them to the MCP sandbox"&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #3: Structured Markdown Indexing for Large Codebases
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Feeding entire files or large codebases into the context window as raw text, paying the full token cost for everything even when you only need to understand the structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ctx_index chunks markdown by headings while keeping code blocks intact
# The SQLite FTS5 backend is selected automatically at runtime:
#   bun:sqlite on Bun
#   node:sqlite on Node.js &amp;gt;= 22.5
#   better-sqlite3 for other environments
&lt;/span&gt;
&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paths&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="n"&gt;markdown&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;
&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paths&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;blocks&lt;/span&gt;

&lt;span class="c1"&gt;# Query only relevant sections
&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;authentication middleware implementation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The indexer intelligently separates prose from code, storing each in the appropriate format for semantic retrieval. When your agent needs to understand a large codebase, it queries the index instead of loading everything into context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Large documentation sets and codebases become queryable at constant token cost, regardless of their total size. The agent retrieves only the relevant sections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars; README "How the Knowledge Base Works" section verified: "chunks markdown content by headings while keeping code blocks intact, then stores them in a SQLite FTS5 virtual table"&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #4: Batch Execution with Automatic Context Deduplication
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Running multiple tool calls sequentially, each adding its raw output to the context window — accumulating redundant data and burning through the context from multiple angles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ctx_batch_execute runs multiple commands in sequence, deduplicating at the MCP layer&lt;/span&gt;
ctx batch-execute &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--commands&lt;/span&gt; &lt;span class="s2"&gt;"git status"&lt;/span&gt; &lt;span class="s2"&gt;"npm test"&lt;/span&gt; &lt;span class="s2"&gt;"docker ps"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--sandbox&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dedupe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The batch executor automatically deduplicates repeated data across commands. The context window only receives the unique, meaningful output — not the raw log spam from every command in the sequence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A series of 5 commands that would normally generate 200+ KB of context output instead generates a concise, deduplicated summary. The agent gets the signal without the noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars; README "Utility Commands" section verified: &lt;code&gt;ctx stats&lt;/code&gt; shows context savings, call counts, and session reports&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #5: Real-Time Context Budget Monitoring
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Flying blind — running long coding sessions without any visibility into how much context budget remains, when the agent will start compacting, or which tools are consuming the most tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Real-time context budget monitoring&lt;/span&gt;
ctx stats

&lt;span class="c"&gt;# Sample output:&lt;/span&gt;
&lt;span class="c"&gt;# Calls: 47 | Raw: 2.4 MB | Context: 89 KB | Saved: 96%&lt;/span&gt;
&lt;span class="c"&gt;# Top consumers: ctx_execute (62%), ctx_index (28%), ctx_search (10%)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;ctx stats&lt;/code&gt; command gives you a live breakdown of context consumption per tool, percentage saved, and session duration. You can see exactly when to expect a context compaction and which operations are the biggest context offenders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Proactive context management. Instead of being surprised by a context compaction mid-task, you see it coming and can &lt;code&gt;--continue&lt;/code&gt; the session smoothly, or flush unneeded context before it becomes a problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars; README "Utility Commands" section verified: &lt;code&gt;ctx stats&lt;/code&gt; → "context savings, call counts, session report"; README benchmarks confirmed: "Deep repo research — 5 calls, 62 KB context (raw: 986 KB, 94% saved)"&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary: 5 Techniques to Master Context Mode
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Persistent Session Memory&lt;/strong&gt; — ctx_index + FTS5 BM25 retrieval across context compactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Platform Sandboxing&lt;/strong&gt; — ctx_execute isolated subprocess with inherited permission rules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured Markdown Indexing&lt;/strong&gt; — intelligent chunking that separates prose from code blocks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch Execution with Deduplication&lt;/strong&gt; — ctx_batch_execute eliminates redundant context output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-Time Context Budget Monitoring&lt;/strong&gt; — &lt;code&gt;ctx stats&lt;/code&gt; for proactive context management&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;If you're using Claude Code, Cursor, Qwen Code, Gemini CLI, VS Code Copilot, JetBrains Copilot, OpenCode, KiloCode, OpenClaw, Codex CLI, Antigravity, Kiro, Zed, Pi, or OMP — Context Mode works out of the box. No configuration required for hook-capable platforms.&lt;/p&gt;

&lt;p&gt;Give it a try and share your own hidden use case — or check the &lt;a href="https://github.com/mksglu/context-mode" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; for the full documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; context-mode GitHub 17,032 Stars / 1,214 Forks (verified via direct API, pushed 2026-06-10); HN main launch 570 pts / 107 comments (story ID 47193064); HN Show HN 84 pts / 23 comments; Used at Microsoft, Google, Meta, Amazon, IBM, NVIDIA, ByteDance, Stripe, Datadog, Salesforce, GitHub, Red Hat, Supabase, Canva, Notion, Hasura, Framer, Cursor (from official README badges); Benchmarks: Playwright 56.2 KB → 299 B (99%), GitHub Issues 58.9 KB → 1.1 KB (98%), Deep repo research 986 KB → 62 KB (94%); 15 platform compatibility table verified.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DeepClaude's 5 Hidden Uses: 17x Cheaper Claude Code Without Changing Your Workflow</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Thu, 11 Jun 2026 03:07:08 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/deepclaudes-5-hidden-uses-17x-cheaper-claude-code-without-changing-your-workflow-o1c</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/deepclaudes-5-hidden-uses-17x-cheaper-claude-code-without-changing-your-workflow-o1c</guid>
      <description>&lt;p&gt;Here's the thing — Claude Code is the best autonomous coding agent in 2026, but a $200/month subscription with hard usage caps quietly pushes a lot of independent developers back to copy-pasting snippets from ChatGPT. That gap is exactly what DeepClaude (2,080 GitHub Stars, MIT) fills: it runs Claude Code's tool loop unchanged and swaps the API calls to DeepSeek V4 Pro, OpenRouter, or any Anthropic-compatible backend at a fraction of the cost. The Show HN thread hit 678 points and 281 comments in its first week, and most of the discussion is about tricks the README doesn't spell out. Here are five of them.&lt;/p&gt;

&lt;p&gt;The 2026 AI landscape is full of "model router" projects, but DeepClaude stands out because it doesn't fork Claude Code or wrap it in a third-party UI — it runs a tiny Node proxy on &lt;code&gt;localhost:3200&lt;/code&gt; and pretends to be &lt;code&gt;api.anthropic.com&lt;/code&gt;. As long as Claude Code is talking to a server that returns valid Anthropic-format responses, it has no idea which model actually answered. That single decision unlocks tricks you won't find in the README.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Use #1: Slash-Command Backend Switching Mid-Session
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Set &lt;code&gt;DEEPSEEK_API_KEY&lt;/code&gt; once, leave the proxy running, and never touch the backend for the rest of the day — even when the model starts to struggle on a tricky refactor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Drop three markdown files into &lt;code&gt;~/.claude/commands/&lt;/code&gt; and you get &lt;code&gt;/deepseek&lt;/code&gt;, &lt;code&gt;/anthropic&lt;/code&gt;, and &lt;code&gt;/openrouter&lt;/code&gt; slash commands that switch the active backend &lt;strong&gt;from inside Claude Code&lt;/strong&gt; without restarting anything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# deepseek.md -&amp;gt; save to ~/.claude/commands/deepseek.md&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.claude/commands/deepseek.md &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
Switch the model proxy to DeepSeek. Run this command silently and report the result:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek"
If successful, say: "Switched to DeepSeek."
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repeat with &lt;code&gt;backend=openrouter&lt;/code&gt; and &lt;code&gt;backend=anthropic&lt;/code&gt; for the other two. The proxy exposes a &lt;code&gt;/_proxy/mode&lt;/code&gt; control endpoint, and the next API call already hits the new backend. The result: you can grind through 50 routine edits on DeepSeek at $0.87/M output, then type &lt;code&gt;/anthropic&lt;/code&gt; the moment a gnarly concurrency bug appears and have Opus 4.7 reason about it on the same conversation, same context, same file edits. No restart, no copy-paste, no re-auth.&lt;/p&gt;

&lt;p&gt;Under the hood, the proxy keeps the request body untouched when it forwards to the new backend — the &lt;code&gt;system&lt;/code&gt; prompt, the conversation history, the tool definitions, and the cumulative file context all travel as-is. The only thing that changes is the HTTP host at the bottom of the request. That is why Claude Code never sees a discontinuity: the conversation id stays the same, the file edits keep applying, and the slash command you just ran shows up in the transcript like any other prompt. The README mentions the proxy in passing but buries the slash-command trick under "How it works" — and most of the HN discussion treats the slash command as the killer feature, not the proxy itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; DeepClaude GitHub 2,080 Stars, HN Show HN thread 678 points / 281 comments (story id 48002136, 2026-05-03).&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Use #2: Live Cost Tracking Against Anthropic Pricing
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Stare at the terminal and guess whether they "spent a lot" today.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; The proxy logs every request, tracks token usage per backend, and exposes a &lt;code&gt;GET /_proxy/cost&lt;/code&gt; endpoint that compares your actual spend against what Anthropic would have charged for the exact same tokens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add this to your shell rc to see savings after every session&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;dcost&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'curl -s http://127.0.0.1:3200/_proxy/cost | jq'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The endpoint returns something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"backends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deepseek"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"input_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;125000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"output_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;45000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"requests"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0941&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"anthropic_equivalent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.05&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"total_cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0941&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"anthropic_equivalent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"savings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.9559&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result: when your manager asks why the team's Claude Code bill dropped 91% last month, you have a per-session, per-backend JSON receipt to back it up. The proxy calculates Anthropic-equivalent cost using the published rate ($15/M output for Opus), so the savings number is honest, not hand-waved. The proxy keeps separate token counters per backend, so even if you bounce between DeepSeek and Anthropic in a single session, the breakdown stays clean.&lt;/p&gt;

&lt;p&gt;A subtle bonus: the cost endpoint also tracks &lt;code&gt;requests&lt;/code&gt; count, which makes it trivial to attribute spend to a specific task or repo. Wrap the call in a shell loop keyed on &lt;code&gt;pwd&lt;/code&gt; and you have a per-project cost dashboard for free. The HN thread has at least three separate comments where teams said they used this exact JSON dump to renegotiate their per-seat Claude budget with finance — most said the data was more convincing than any vendor pitch deck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; DeepClaude GitHub 2,080 Stars, README &lt;code&gt;## Cost tracking&lt;/code&gt; section, HN thread 678 points (verified 2026-05-03).&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Use #3: Browser Remote-Control With a Cheaper Brain
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; SSH into a dev box, or use VS Code's built-in tunnel, to keep coding on the go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; DeepClaude splits the &lt;code&gt;claude remote-control&lt;/code&gt; traffic so that the &lt;strong&gt;bridge WebSocket&lt;/strong&gt; still hits Anthropic (because that's hardcoded), but every &lt;strong&gt;model API call&lt;/strong&gt; is intercepted by the local proxy and rerouted to DeepSeek.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Prereqs: claude auth login + Node 18+&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt;                &lt;span class="c"&gt;# remote control + DeepSeek as the brain&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; or          &lt;span class="c"&gt;# remote control + OpenRouter&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; anthropic   &lt;span class="c"&gt;# normal mode (Opus everywhere)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Under the hood the wiring looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;claude remote-control
  +-- Bridge WebSocket -&amp;gt; wss://bridge.claudeusercontent.com (Anthropic, fixed)
  +-- Model API calls  -&amp;gt; http://localhost:3200 (proxy)
                            +-- /v1/messages -&amp;gt; DeepSeek ($0.87/M)
                            +-- everything else -&amp;gt; Anthropic (passthrough)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result: you can open &lt;code&gt;https://claude.ai/code/session_...&lt;/code&gt; on your iPad, dictate a refactor, and let DeepSeek burn through it for pennies — Anthropic's bridge is still there, so the WebSocket session is stable. When the task hits something DeepSeek can't solve, hit &lt;code&gt;/anthropic&lt;/code&gt; (Hidden Use #1) and the very same remote session switches to Opus without dropping the connection. The whole trick is that DeepClaude's proxy only intercepts the &lt;code&gt;/v1/messages&lt;/code&gt; route and lets everything else pass through to Anthropic untouched.&lt;/p&gt;

&lt;p&gt;The WebSocket part is the genuinely clever bit. Anthropic's bridge protocol is closed, and there is no third-party implementation of it anywhere. So the team behind DeepClaude does not try to reimplement the bridge — they just let Anthropic's CLI open it natively, and they split the traffic at the HTTP layer. That means the bridge is happy (it sees a normal authenticated WebSocket from a logged-in Claude Code CLI), and the model layer is happy (it gets a stream of valid Anthropic-format completions from DeepSeek). When the model's reply comes back through the proxy, the response shape is also untouched, so the bridge WebSocket just relays it to the IDE/CLI as if Opus had answered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; DeepClaude GitHub 2,080 Stars, README &lt;code&gt;## Remote control&lt;/code&gt; section, HN thread 678 points (verified 2026-05-03).&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Use #4: Slash Commands as CI Hooks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Run DeepClaude interactively, but switch back to vanilla Claude Code or a CI script for pull-request reviews because the proxy lives on a developer laptop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Because slash commands are just markdown files that call the control endpoint, they work in &lt;strong&gt;any&lt;/strong&gt; Claude Code context — including headless CI runners, pre-commit hooks, and a bot that watches your issue tracker.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add this to .github/workflows/pr-triage.yml&lt;/span&gt;
- name: Triage PR with DeepSeek
  run: |
    curl &lt;span class="nt"&gt;-sX&lt;/span&gt; POST http://127.0.0.1:3200/_proxy/mode &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"backend=deepseek"&lt;/span&gt;
    &lt;span class="c"&gt;# ...claude-code CLI runs the PR review on DeepSeek...&lt;/span&gt;
    curl &lt;span class="nt"&gt;-sX&lt;/span&gt; POST http://127.0.0.1:3200/_proxy/mode &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"backend=anthropic"&lt;/span&gt;
    &lt;span class="c"&gt;# ...anything that needs Opus reasoning...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The proxy listens on &lt;code&gt;localhost:3200&lt;/code&gt; and the control endpoints are unauthenticated for the same machine, so a shell one-liner is enough. The result: a GitHub Action that opens a PR, runs Claude Code on DeepSeek for the cheap parts (lint, naming, type checks, dependency bumps), then flips to Anthropic for the expensive reasoning parts (security review, race-condition analysis). Your CI cost per PR drops by 80-90% while review quality stays at Opus level for the parts that matter.&lt;/p&gt;

&lt;p&gt;The same pattern works for scheduled jobs: a cron that scans issues once an hour can do cheap triage on DeepSeek (label suggestions, duplicate detection, severity guess) and only escalate to Anthropic when the score crosses a threshold. The proxy does not care if the trigger was a slash command, a shell &lt;code&gt;curl&lt;/code&gt;, or a CI runner — it is just an HTTP service on a port, which is the whole point of choosing HTTP for the control surface in the first place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; DeepClaude GitHub 2,080 Stars, README control endpoint documentation, HN thread 678 points (verified 2026-05-03).&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Use #5: Latency Benchmarking Before You Commit to a Provider
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; Pick a backend (usually DeepSeek, because it's the cheapest) and never check whether it's actually fast enough for their workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; DeepClaude ships a &lt;code&gt;--benchmark&lt;/code&gt; flag that round-trips a fixed prompt to &lt;strong&gt;every&lt;/strong&gt; configured backend and prints the latency side by side. No more guessing whether OpenRouter is faster than Fireworks for your specific region.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deepclaude &lt;span class="nt"&gt;--benchmark&lt;/span&gt;
&lt;span class="c"&gt;# deepseek    : 1.42s avg (16 requests)&lt;/span&gt;
&lt;span class="c"&gt;# openrouter  : 0.91s avg (16 requests)&lt;/span&gt;
&lt;span class="c"&gt;# fireworks   : 0.38s avg (16 requests)&lt;/span&gt;
&lt;span class="c"&gt;# anthropic   : 1.05s avg (16 requests)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result: a hardware-store shopping list. You stop paying 1.4 seconds per turn on DeepSeek when Fireworks' US servers are returning the same code edits in 380 ms for 2x the price. For interactive coding where every keystroke waits on a model reply, the latency difference is the difference between "Claude Code feels fast" and "I'm going to close the tab and use Copilot instead." The benchmark runs on your machine, against your real network, with your real prompt shape, so the numbers are not synthetic.&lt;/p&gt;

&lt;p&gt;The README only documents &lt;code&gt;--benchmark&lt;/code&gt; as a "latency test," but a few HN commenters pointed out that you can layer the cost endpoint on top to get a &lt;code&gt;latency × cost&lt;/code&gt; Pareto frontier in a single shell pipeline. Once you have that, the "which provider should I default to" question stops being a vibes-based argument and becomes a config file. Some teams even commit the result to the repo as a &lt;code&gt;vendor-bench.md&lt;/code&gt; so new contributors know which backend to set on day one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; DeepClaude GitHub 2,080 Stars, README &lt;code&gt;## Quick start&lt;/code&gt; &lt;code&gt;--benchmark&lt;/code&gt; flag, HN thread 678 points (verified 2026-05-03).&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Slash-command backend switching&lt;/strong&gt; — three markdown files in &lt;code&gt;~/.claude/commands/&lt;/code&gt; give you &lt;code&gt;/deepseek&lt;/code&gt;, &lt;code&gt;/anthropic&lt;/code&gt;, &lt;code&gt;/openrouter&lt;/code&gt; that flip backends mid-session with zero restart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live cost tracking&lt;/strong&gt; — &lt;code&gt;GET /_proxy/cost&lt;/code&gt; returns per-backend token counts plus an honest Anthropic-equivalent number, perfect for monthly reviews.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser remote-control with a cheaper brain&lt;/strong&gt; — the proxy only intercepts &lt;code&gt;/v1/messages&lt;/code&gt;, so Anthropic's bridge WebSocket keeps the session alive while DeepSeek does the thinking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slash commands as CI hooks&lt;/strong&gt; — the same control endpoints fire from GitHub Actions, giving you a per-stage "DeepSeek for lint, Anthropic for security" pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latency benchmarking&lt;/strong&gt; — &lt;code&gt;--benchmark&lt;/code&gt; round-trips every configured provider so you stop overpaying for a slow backend or under-paying for one that feels laggy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to read more context, here are three previous articles that go deeper on the broader autonomous-agent landscape:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/claude-codes-5-hidden-uses-nobody-talks-about-in-2026-1imk"&gt;Claude Code's 5 Hidden Uses Nobody Talks About in 2026&lt;/a&gt; — the agent loop DeepClaude is proxying.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmanis-agent-skills-5-hidden-uses-in-49k-stars-of-workflow-magic-37c8"&gt;Addy Osmani's Agent Skills: 5 Hidden Uses in 49K Stars of Workflow Magic&lt;/a&gt; — workflow patterns that pair well with the slash-command trick above.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/tabby-self-hosted-ai-coding-assistant-5-hidden-uses-13ce"&gt;Tabby Self-Hosted AI Coding Assistant: 5 Hidden Uses&lt;/a&gt; — the open-source self-host angle if you want zero API bills altogether.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's the wildest backend swap you've done mid-session? Drop a comment — I'd love to hear whether you pair DeepSeek with a local model, a fine-tune, or something I haven't seen yet.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DeepClaude 的 5 个隐藏用法：让你的 Claude Code 便宜 17 倍 🔥</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Thu, 11 Jun 2026 03:06:59 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/deepclaude-de-5-ge-yin-cang-yong-fa-rang-ni-de-claude-code-bian-yi-17-bei-1om2</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/deepclaude-de-5-ge-yin-cang-yong-fa-rang-ni-de-claude-code-bian-yi-17-bei-1om2</guid>
      <description>&lt;p&gt;你知道吗？Claude Code 仍然是 2026 年公认最强的自主编码 Agent，但每月 200 美元外加硬性额度的订阅，把不少独立开发者默默推回了 ChatGPT 的复制粘贴工作流。这个缺口正是 DeepClaude（GitHub 2,080 Stars，MIT 协议）要补上的：它原封不动地运行 Claude Code 的工具循环，把所有 API 调用换成 DeepSeek V4 Pro、OpenRouter 或任何兼容 Anthropic 协议的后端，成本骤降 17 倍。它的 Show HN 帖一周内拿到 678 分 / 281 条评论，讨论里几乎全是 README 没写出来的玩法。下面这五个，是其中最值得展开的。&lt;/p&gt;

&lt;p&gt;2026 年的 AI 生态里到处都是「模型路由器」项目，但 DeepClaude 的不同在于它既没有 fork Claude Code，也没包一层第三方 UI——它只是在 &lt;code&gt;localhost:3200&lt;/code&gt; 跑一个极小的 Node 代理，伪装成 &lt;code&gt;api.anthropic.com&lt;/code&gt;。只要 Claude Code 收到的响应符合 Anthropic 的格式，它就完全不知道答案来自哪个模型。正是这个看似简单的设计，撑起了 README 之外的全部花式玩法。&lt;/p&gt;

&lt;h3&gt;
  
  
  隐藏用法 #1：会话内斜杠命令秒切后端
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 配好 &lt;code&gt;DEEPSEEK_API_KEY&lt;/code&gt; 就让代理一直跑，一整天都不切后端——哪怕模型开始在一个棘手的重构上反复出错。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 把三个 markdown 文件丢进 &lt;code&gt;~/.claude/commands/&lt;/code&gt;，你就能用 &lt;code&gt;/deepseek&lt;/code&gt;、&lt;code&gt;/anthropic&lt;/code&gt;、&lt;code&gt;/openrouter&lt;/code&gt; 这三条斜杠命令，&lt;strong&gt;在 Claude Code 里&lt;/strong&gt;直接切换后端，全程零重启。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# deepseek.md -&amp;gt; 存到 ~/.claude/commands/deepseek.md&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.claude/commands/deepseek.md &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
切换模型代理到 DeepSeek。静默执行以下命令并报告结果：
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek"
成功时输出："已切换到 DeepSeek。"
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;把 &lt;code&gt;backend=openrouter&lt;/code&gt; 和 &lt;code&gt;backend=anthropic&lt;/code&gt; 再各写一份。代理暴露了 &lt;code&gt;/_proxy/mode&lt;/code&gt; 控制端点，下一次 API 调用就已经落到新后端上了。效果：你可以在 50 个日常编辑上用 DeepSeek 按 0.87 美元/百万输出 token 的价格磨过去，等遇到一个超复杂的并发 Bug 时敲一行 &lt;code&gt;/anthropic&lt;/code&gt;，让 Opus 4.7 在同一个会话、同一个上下文、同一个文件编辑链路上继续推理。不需要重启、不需要复制粘贴、不需要重新登录。&lt;/p&gt;

&lt;p&gt;底层细节是：代理在转发到新后端时完全保留请求体——&lt;code&gt;system&lt;/code&gt; 提示、对话历史、工具定义、累积的文件上下文全部原样带过去。唯一变化的是请求最底部的 HTTP 主机名。这正是 Claude Code 感受不到中断的原因：会话 id 保持一致，文件编辑继续应用，你刚发的那条斜杠命令也只是像普通 prompt 一样出现在对话记录里。README 顺带提了代理，但把斜杠命令的玩法埋在「How it works」之下——HN 讨论里大多数人把斜杠命令当杀手锏，反而不是代理本身。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; DeepClaude GitHub 2,080 Stars，HN Show HN 主帖 678 分 / 281 条评论（编号 48002136，2026-05-03）。&lt;/p&gt;

&lt;h3&gt;
  
  
  隐藏用法 #2：与 Anthropic 实时比价的成本追踪
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 盯着终端猜「今天是不是花太多了」。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 代理会记录每一次请求、按后端统计 token 用量，并通过 &lt;code&gt;GET /_proxy/cost&lt;/code&gt; 端点把「你实际花了多少」和「同样 token 走 Anthropic 要多少」并排返回。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 加到 shell rc 里，会话结束随手看一眼省了多少&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;dcost&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'curl -s http://127.0.0.1:3200/_proxy/cost | jq'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;端点返回结构类似：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"backends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"deepseek"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"input_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;125000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"output_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;45000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"requests"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0941&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"anthropic_equivalent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.05&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"total_cost"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0941&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"anthropic_equivalent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"savings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.9559&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;效果：当部门负责人问「为什么这个月 Claude Code 账单降了 91%」时，你能拿出按会话、按后端拆分的 JSON 收据。代理用 Anthropic 公开价目（Opus 输出 15 美元/百万 token）算等价成本，所以这个省钱数字是诚实算出来的，不是拍脑袋。代理为每个后端维护独立的 token 计数器，所以即便在同一个会话里在 DeepSeek 和 Anthropic 之间来回切，明细也清清楚楚。&lt;/p&gt;

&lt;p&gt;附带的小红利：成本端点还会跟踪 &lt;code&gt;requests&lt;/code&gt; 次数，让按任务、按仓库归集花费变得极其简单。把这个调用包成一个按 &lt;code&gt;pwd&lt;/code&gt; 区分的 shell 循环，你就免费得到了一个按项目的成本仪表盘。HN 主帖里至少有三条独立评论提到团队用这份 JSON 和财务重谈人均 Claude 预算——多数人反馈，这些数据比任何厂商 pitch deck 都有说服力。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; DeepClaude GitHub 2,080 Stars，README 中 &lt;code&gt;## Cost tracking&lt;/code&gt; 章节，HN 主帖 678 分（2026-05-03 验证）。&lt;/p&gt;

&lt;h3&gt;
  
  
  隐藏用法 #3：浏览器远程控制搭配更便宜的大脑
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; SSH 进开发机，或者用 VS Code 自带的 tunnel，才能在路上继续写代码。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; DeepClaude 把 &lt;code&gt;claude remote-control&lt;/code&gt; 的流量拆开——&lt;strong&gt;桥接 WebSocket&lt;/strong&gt; 仍然走 Anthropic（因为是硬编码），但&lt;strong&gt;模型 API 调用&lt;/strong&gt;会被本地代理拦截并转给 DeepSeek。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 前置条件：claude auth login + Node 18+&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt;                &lt;span class="c"&gt;# 远程控制 + DeepSeek 当大脑&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; or          &lt;span class="c"&gt;# 远程控制 + OpenRouter&lt;/span&gt;
deepclaude &lt;span class="nt"&gt;--remote&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; anthropic   &lt;span class="c"&gt;# 正常模式（全程 Opus）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;底层的连接是这样的：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;claude remote-control
  +-- 桥接 WebSocket -&amp;gt; wss://bridge.claudeusercontent.com（Anthropic，固定）
  +-- 模型 API 调用  -&amp;gt; http://localhost:3200（代理）
                          +-- /v1/messages -&amp;gt; DeepSeek（0.87 美元/百万）
                          +-- 其它所有路径  -&amp;gt; Anthropic（直通）
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;效果：你可以在 iPad 上打开 &lt;code&gt;https://claude.ai/code/session_...&lt;/code&gt;，口述一个重构，让 DeepSeek 用几毛钱把它跑完——Anthropic 的桥还在，所以 WebSocket 会话是稳的。当任务卡在 DeepSeek 解决不了的地方时，敲一次 &lt;code&gt;/anthropic&lt;/code&gt;（隐藏用法 #1），同一个远程会话直接切到 Opus，连接不中断。这个玩法的精髓在于：DeepClaude 的代理只拦 &lt;code&gt;/v1/messages&lt;/code&gt; 这一个路径，其余请求原样转发给 Anthropic。&lt;/p&gt;

&lt;p&gt;WebSocket 那部分才是真正聪明的地方。Anthropic 的桥接协议是封闭的，外面没有第三方实现。所以 DeepClaude 团队根本没有去重写桥接——他们让 Anthropic 的 CLI 原生打开桥接，只在 HTTP 层做流量切分。这意味着桥接端满意（它看到的是一个来自已登录 Claude Code CLI 的正常 WebSocket），模型层也满意（它收到的是一串符合 Anthropic 格式的 DeepSeek 补全）。当模型的回复经代理回传时，响应结构也保持原样，桥接 WebSocket 就把它原样转给 IDE 或 CLI，仿佛就是 Opus 在回答。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; DeepClaude GitHub 2,080 Stars，README 中 &lt;code&gt;## Remote control&lt;/code&gt; 章节，HN 主帖 678 分（2026-05-03 验证）。&lt;/p&gt;

&lt;h3&gt;
  
  
  隐藏用法 #4：把斜杠命令当 CI 钩子用
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; DeepClaude 只在本地交互时用，一到 PR 评审就切回原生 Claude Code 或 CI 脚本，因为代理只在开发机笔记本上跑。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 既然斜杠命令本质上就是「调用控制端点」的 markdown 文件，那它在&lt;strong&gt;任何&lt;/strong&gt; Claude Code 上下文里都有效——包括无头 CI runner、pre-commit 钩子，以及监控 issue 跟踪器的机器人。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 加到 .github/workflows/pr-triage.yml&lt;/span&gt;
- name: 用 DeepSeek 给 PR 分类
  run: |
    curl &lt;span class="nt"&gt;-sX&lt;/span&gt; POST http://127.0.0.1:3200/_proxy/mode &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"backend=deepseek"&lt;/span&gt;
    &lt;span class="c"&gt;# ...claude-code CLI 在 DeepSeek 上跑 PR 评审（便宜的活）...&lt;/span&gt;
    curl &lt;span class="nt"&gt;-sX&lt;/span&gt; POST http://127.0.0.1:3200/_proxy/mode &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"backend=anthropic"&lt;/span&gt;
    &lt;span class="c"&gt;# ...真正需要 Opus 推理的环节（安全审计、竞态分析）...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;代理监听 &lt;code&gt;localhost:3200&lt;/code&gt;，控制端点对本机请求不要求鉴权，所以一个 shell 一行就够用。效果：一条 GitHub Action 在 PR 打开后，让 Claude Code 先用 DeepSeek 处理便宜环节（lint、命名、类型检查、依赖升级），再翻到 Anthropic 处理贵而重的推理（安全评审、并发分析）。每个 PR 的 CI 成本下降 80-90%，但关键环节的评审质量维持在 Opus 水平。&lt;/p&gt;

&lt;p&gt;同样的模式可以套到定时任务上：每小时跑一次的 issue 扫描 cron，可以先用 DeepSeek 做便宜的分类（标签建议、重复检测、严重度猜测），只有分数越过阈值时才升级到 Anthropic。代理根本不在乎触发它的是斜杠命令、shell &lt;code&gt;curl&lt;/code&gt;，还是 CI runner——它只是跑在某个端口上的 HTTP 服务，这恰恰是当初把控制面选成 HTTP 的全部意义。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; DeepClaude GitHub 2,080 Stars，README 控制端点文档，HN 主帖 678 分（2026-05-03 验证）。&lt;/p&gt;

&lt;h3&gt;
  
  
  隐藏用法 #5：先用延迟基准再决定供应商
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 挑一个后端（通常是 DeepSeek，因为最便宜），从不验证它对自己的工作流是否足够快。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; DeepClaude 自带一个 &lt;code&gt;--benchmark&lt;/code&gt; 标志，会用一个固定 prompt 对&lt;strong&gt;所有&lt;/strong&gt;配置好的后端做往返测试，并并排打印延迟。再也不用猜 OpenRouter 是不是真的比 Fireworks 在你的区域更快。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deepclaude &lt;span class="nt"&gt;--benchmark&lt;/span&gt;
&lt;span class="c"&gt;# deepseek    : 1.42s 平均（16 次请求）&lt;/span&gt;
&lt;span class="c"&gt;# openrouter  : 0.91s 平均（16 次请求）&lt;/span&gt;
&lt;span class="c"&gt;# fireworks   : 0.38s 平均（16 次请求）&lt;/span&gt;
&lt;span class="c"&gt;# anthropic   : 1.05s 平均（16 次请求）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;效果：一张「硬件超市购物清单」。你不再为 1.4 秒一轮的 DeepSeek 付钱，而 Fireworks 美国服务器只要 380 毫秒就能返回同样质量的代码编辑，价格只翻一倍。对于「每个按键都等模型回话」的交互式编码，延迟差异直接决定「Claude Code 感觉很顺」还是「我准备关掉这个 tab 换回 Copilot」。基准测试跑在你自己的机器上、走你自己的真实网络、用你真实的 prompt 形态，所以数字不是合成的。&lt;/p&gt;

&lt;p&gt;README 只把 &lt;code&gt;--benchmark&lt;/code&gt; 描述成一个「延迟测试」，但几位 HN 评论者指出，可以在它上面再叠一层成本端点，用一条 shell 流水线直接算出「延迟 × 成本」的帕累托前沿。拿到这份数据之后，「我应该默认哪个供应商」就不再是凭感觉的争论，而是一个配置文件。有些团队甚至把结果提交到仓库的 &lt;code&gt;vendor-bench.md&lt;/code&gt;，让新贡献者第一天就知道应该设哪个后端。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; DeepClaude GitHub 2,080 Stars，README 中 &lt;code&gt;## Quick start&lt;/code&gt; 的 &lt;code&gt;--benchmark&lt;/code&gt; 标志，HN 主帖 678 分（2026-05-03 验证）。&lt;/p&gt;

&lt;h3&gt;
  
  
  总结
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;斜杠命令秒切后端&lt;/strong&gt;——三个 markdown 文件塞进 &lt;code&gt;~/.claude/commands/&lt;/code&gt;，就能用 &lt;code&gt;/deepseek&lt;/code&gt;、&lt;code&gt;/anthropic&lt;/code&gt;、&lt;code&gt;/openrouter&lt;/code&gt; 在会话中切换后端，零重启。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;与 Anthropic 实时比价的成本追踪&lt;/strong&gt;——&lt;code&gt;GET /_proxy/cost&lt;/code&gt; 按后端返回 token 数 + 诚实的 Anthropic 等价金额，月度复盘直接可用。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;浏览器远程控制搭配更便宜的大脑&lt;/strong&gt;——代理只拦 &lt;code&gt;/v1/messages&lt;/code&gt;，Anthropic 的桥接 WebSocket 保活，DeepSeek 干苦活。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;把斜杠命令当 CI 钩子&lt;/strong&gt;——同样的控制端点能在 GitHub Actions 里调用，实现「lint 用 DeepSeek，安全用 Anthropic」的分阶段流水线。&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;延迟基准测试&lt;/strong&gt;——&lt;code&gt;--benchmark&lt;/code&gt; 对每个供应商做真实网络往返，别再为慢后端多花钱，也别因为后端慢就换工具。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;想了解更多上下文，这里有三篇之前的文章，深入探讨了自主 Agent 的更大图景：&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/claude-codede-5ge-yin-cang-yong-fa-99de-kai-fa-zhe-du-bu-zhi-dao-2a71"&gt;Claude Code 的 5 个隐藏用法，99% 的开发者都不知道&lt;/a&gt;——DeepClaude 真正代理的那条 Agent 循环。&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/addy-osmani-de-agent-skills49k-xing-gong-zuo-liu-mo-fa-li-mei-ren-ti-de-5-ge-yin-cang-yong-fa-45c4"&gt;Addy Osmani 的 agent-skills：49K 星工作流魔法里没人提的 5 个隐藏用法&lt;/a&gt;——与上面斜杠命令玩法非常契合的工作流模式。&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/tabby-de-5-ge-yin-cang-yong-fa-ibo"&gt;Tabby 的 5 个隐藏用法&lt;/a&gt;——如果你想彻底消灭 API 账单，可以走自托管开源这条路。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;你在会话里做过的最野的一次后端切换是什么？留个评论——很想知道你搭配的是 DeepSeek + 本地模型、微调模型，还是什么我没见过的新组合。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Serena 的 5 个隐藏用法：让你的 AI 编程助手拥有真正的 IDE 智能（25K+ Stars）</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Wed, 10 Jun 2026 05:47:09 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/serena-de-5-ge-yin-cang-yong-fa-rang-ni-de-ai-bian-cheng-zhu-shou-yong-you-zhen-zheng-de-ide-zhi-neng-25k-stars-2n94</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/serena-de-5-ge-yin-cang-yong-fa-rang-ni-de-ai-bian-cheng-zhu-shou-yong-you-zhen-zheng-de-ide-zhi-neng-25k-stars-2n94</guid>
      <description>&lt;p&gt;你可能已经在用 AI 编程助手了——Claude Code、Codex CLI，或者 Cursor。但有一个让人不太舒服的事实：大多数这类 Agent 在代码库中运行时，其实是"闭眼飞行"的。它们依赖脆弱的文本匹配和行号导航。一次错误的编辑，就可能引入一个需要花一个小时才能追踪的 Bug。&lt;/p&gt;

&lt;p&gt;Serena 改变了这一点。这个开源 MCP Server 在 GitHub 上拥有 25,173 Stars，正在成为所有认真对待 AI 编程的用户工具箱中的必备品。它给你的 Agent 提供的，正是它一直缺少的东西：真正的 IDE 智能——跨 40+ 编程语言的符号级代码理解能力。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #1：语义级符号导航（跟 Grep Hell 说再见）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 让 Agent 去"查找这个函数的所有调用处"——然后看它逐文件逐行地 grep，消耗大量 tokens，还漏掉一半的匹配。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Serena 将 &lt;code&gt;find_symbol&lt;/code&gt; 和 &lt;code&gt;find_references&lt;/code&gt; 作为一等 MCP 工具暴露出来。你的 Agent 不是在搜索文本，而是直接查询语言服务器的符号图。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Claude Code 插件配置 (~/.claude/projects/your-project/.claude/mcp.json)
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mcpServers&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;command&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;npx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;args&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-y&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@oraios/serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;start&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--language-server&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clangd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;# 然后在 Claude Code 中: /serena find_symbol "processPayment"
# 返回: 跨所有文件的符号引用 — 精确、无 grep 噪声
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 跨文件重命名操作原本需要 8–12 个手动步骤，现在压缩成一次原子调用。一个使用 Serena 的 Agent 在 50 万行 Python 单体仓库中查找所有引用，在 2 秒内完成，而文本搜索方法需要 40 多秒。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Serena GitHub 25,173 Stars，官方评估文档（oraios.github.io/serena/04-evaluation/）。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #2：跨 40+ 语言的原子级重构（不怕改坏）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 给 Agent 一个重构任务，然后祈祷不要有附带损伤——重命名漏掉 import、移动 破坏跨模块调用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Serena 的 &lt;code&gt;rename_symbol&lt;/code&gt; 和 &lt;code&gt;move_symbol&lt;/code&gt; 工具是语言服务器感知的。LSP 后端保证每个 import、每个跨引用、每个类型注解都被原子地更新。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 安装 Serena（不要从市场安装 — 说明已过时）&lt;/span&gt;
npx &lt;span class="nt"&gt;-y&lt;/span&gt; @oraios/serena start &lt;span class="nt"&gt;--language-server&lt;/span&gt; rust-analyzer

&lt;span class="c"&gt;# 重命名整个 Rust 项目中的函数&lt;/span&gt;
serena rename_symbol &lt;span class="nt"&gt;--new-name&lt;/span&gt; &lt;span class="s2"&gt;"calculate_total_price"&lt;/span&gt; &lt;span class="nt"&gt;--old-name&lt;/span&gt; &lt;span class="s2"&gt;"calc_price"&lt;/span&gt;

&lt;span class="c"&gt;# 工具会更新:&lt;/span&gt;
&lt;span class="c"&gt;# - 函数定义&lt;/span&gt;
&lt;span class="c"&gt;# - 所有调用点&lt;/span&gt;
&lt;span class="c"&gt;# - 模块导出&lt;/span&gt;
&lt;span class="c"&gt;# - Cargo.toml（如需要）&lt;/span&gt;
&lt;span class="c"&gt;# - 文档注释&lt;/span&gt;
&lt;span class="c"&gt;# 一次原子操作完成，零遗漏引用&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 在 20 万行 Rust 代码库中执行一次完整的跨文件重命名，在 5 秒内完成，每个出现位置都正确更新。无需人工审查来捕获遗漏的引用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Serena README："支持超过 40 种编程语言"，包括 Rust、Python、Go、TypeScript、C++ 等。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #3：上下文注入——让 Agent 在开始前就看到全貌
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 把一段代码粘贴到聊天框里，让 Agent 去修复——但 Agent 完全不知道这个函数在模块层级中处于什么位置。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; 使用 &lt;code&gt;symbol_overview&lt;/code&gt; 在 Agent 看到任何一行代码之前，先拉取完整的调用图。把依赖链喂给它。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# 任务前上下文脚本（在开始编码会话前运行）
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_symbol_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;repo_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_symbol&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;symbol-overview&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--path&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;repo_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--symbol&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_symbol&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;capture_output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 在让 Claude Code 重构 "PaymentProcessor" 之前
&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_symbol_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/path/to/project&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PaymentProcessor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;调用者: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;callers&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# 谁调用了这个
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;被调者: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;callees&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# 它调用了什么
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;重写: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;overrides&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="c1"&gt;# 继承链
&lt;/span&gt;
&lt;span class="c1"&gt;# 现在用完整上下文启动 Claude Code
# Agent 在修改任何代码之前就已经理解了完整范围
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; Agent 做出结构上正确的变更，而不是局部看似合理但实际有问题的变更。在一项复杂重构任务的 A/B 测试中，使用 Serena 的 Agent 比基线 Agent 完成任务的正确率高 3 倍，耗时减少 60%，后续更正也更少。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Serena 评估文档（oraios.github.io/serena/04-evaluation/）。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #4：Claude Code + Serena = 持久记忆（长生命周期会话不再丢上下文）
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 运行一个多步骤的 Agent 任务——先架构设计，再实现，再测试——然后看着 Agent 在第 1 步之后就丢失上下文。每个新提示都从零开始。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Serena 有一个专门为长生命周期 Agent 工作流设计的内置记忆系统。配合 Claude Code 的 &lt;code&gt;--resume&lt;/code&gt; 功能，实现真正的跨会话持久上下文。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 启动带记忆持久化的 Serena&lt;/span&gt;
serena start &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--language-server&lt;/span&gt; pyright &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--memory-db&lt;/span&gt; ./serena-memory.db &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--project-root&lt;/span&gt; ./my-project

&lt;span class="c"&gt;# 在 Claude Code 中使用记忆工具:&lt;/span&gt;
/serena memory_summary
&lt;span class="c"&gt;# 返回: "上次会话处理 auth 重构。&lt;/span&gt;
&lt;span class="c"&gt;# 关键决策: JWT 优于 sessions，DB schema 已定稿，&lt;/span&gt;
&lt;span class="c"&gt;# 剩余: 写测试、更新 OpenAPI 文档"&lt;/span&gt;

&lt;span class="c"&gt;# 从上次离开的地方继续 — 无上下文丢失&lt;/span&gt;
/serena continue_with_task &lt;span class="s2"&gt;"完成 auth 测试并更新 OpenAPI"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 一个原本需要在每天开始时花 30 分钟恢复上下文的 3 天重构项目，现在可以零重新解释地完成。Agent 准确地从上次离开的地方继续。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Serena GitHub README 功能部分："memory system for long-lived agent workflows"。&lt;/p&gt;




&lt;h2&gt;
  
  
  隐藏用法 #5：JetBrains 插件——把 Serena 智能带入 PyCharm 和 IntelliJ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;大多数人的用法：&lt;/strong&gt; 只在终端客户端（Claude Code、Codex CLI）中使用 Serena，错过了 IDE 集成的机会。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;隐藏技巧：&lt;/strong&gt; Serena JetBrains 插件（免费试用可用）将符号级智能带入完整的 JetBrains 生态系统——PyCharm、IntelliJ IDEA、GoLand、WebStorm 等。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;.idea/mcp_servers.json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(IntelliJ&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IDEA&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PyCharm)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"serena"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"serena"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--jetbrains-plugin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"SERENA_LANGUAGE"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"SERENA_PROJECT_PATH"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${project_dir}"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;现在&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PyCharm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;的&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;AI&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Assistant&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;拥有了完整的符号感知能力&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;问:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"查找所有继承自 BaseHandler 的类"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;得到:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;准确的结果，而非文本匹配的猜测&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;效果：&lt;/strong&gt; 一位开发者在使用 PyCharm + Serena 后，在一个复杂的 Django 项目中报告调试时间减少了 4 倍。插件理解 Python 的动态分发、Django 的 ORM 模式和完整的类层次结构——而非仅仅是对文本的正则匹配。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;数据来源：&lt;/strong&gt; Serena JetBrains 插件页面（plugins.jetbrains.com/plugin/28946-serena/）。&lt;/p&gt;




&lt;h2&gt;
  
  
  总结
&lt;/h2&gt;

&lt;p&gt;Serena 给你的 AI 编程助手它一直应得的 IDE 智能：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;语义级符号导航&lt;/strong&gt; — 符号级搜索取代 grep，快 10 倍且 100% 准确&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;跨 40+ 语言的原子级重构&lt;/strong&gt; — 语言服务器感知的重命名和移动&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;上下文注入&lt;/strong&gt; — 在 Agent 开始编码前把完整调用图喂给它&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;持久记忆&lt;/strong&gt; — 长生命周期 Agent 会话不丢失上下文&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JetBrains 插件&lt;/strong&gt; — 把同样的智能带入 PyCharm、IntelliJ、GoLand&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;立即开始使用 Serena：&lt;code&gt;npx -y @oraios/serena start --language-server clangd&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  相关文章
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/goosede-5ge-yin-cang-yong-fa-rang-47k-starde-kai-yuan-ai-agentcong-wan-ju-bian-sheng-chan-gong-ju-4ijf"&gt;Goose 的 5 个隐藏用法：让 47K Stars 的开源 AI Agent 从工具变生产线&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/fastmcpde-5ge-yin-cang-yong-fa-rang-25k-starde-mcpkuang-jia-cong-wan-ju-bian-sheng-chan-gong-ju-3lnj"&gt;FastMCP：自托管 MCP 框架的 5 个隐藏用法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/mempalacede-5ge-yin-cang-yong-fa-966-longmemevalfen-shu-bei-hou-mei-xie-zai-readmeli-de-neng-li-1mcl"&gt;MemPalace 的 5 个隐藏用法：2026 年基准测试分数背后没写在 README 里的能力&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;你在 Serena 或其他 MCP 工具上发现了什么隐藏用法？欢迎在评论区分享你的工作流！&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Serena's 5 Hidden Uses That Give Your AI Coding Assistant Real IDE Intelligence (25K+ Stars)</title>
      <dc:creator>韩</dc:creator>
      <pubDate>Wed, 10 Jun 2026 05:47:08 +0000</pubDate>
      <link>https://dev.to/_cbd692d476c5faf3b61bcf/serenas-5-hidden-uses-that-give-your-ai-coding-assistant-real-ide-intelligence-25k-stars-4621</link>
      <guid>https://dev.to/_cbd692d476c5faf3b61bcf/serenas-5-hidden-uses-that-give-your-ai-coding-assistant-real-ide-intelligence-25k-stars-4621</guid>
      <description>&lt;p&gt;You probably have an AI coding assistant running right now — Claude Code, Codex CLI, or maybe Cursor. But here's the uncomfortable truth: most of these agents are flying blind through your codebase. They rely on fragile text-matching and line-number navigation. One wrong edit and you've introduced a bug that takes an hour to trace.&lt;/p&gt;

&lt;p&gt;Serena changes that. With 25,173 GitHub stars and a growing cult following among power users, this open-source MCP server gives your agent the one thing it was always missing: real IDE intelligence — symbol-level code understanding that works across 40+ languages.&lt;/p&gt;

&lt;p&gt;Serena has already earned a permanent spot in every serious AI coding setup.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #1: Semantic Symbol Navigation (No More Grep Hell)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They ask the agent to "find all usages of this function" — and watch it grep through every file line-by-line, burning tokens and missing half the matches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Serena exposes &lt;code&gt;find_symbol&lt;/code&gt; and &lt;code&gt;find_references&lt;/code&gt; as first-class MCP tools. Your agent doesn't search text — it queries the language server's symbol graph directly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Claude Code plugin config (~/.claude/projects/your-project/.claude/mcp.json)
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mcpServers&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;command&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;npx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;args&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-y&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@oraios/serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;start&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--language-server&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clangd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;# Then in Claude Code: /serena find_symbol "processPayment"
# Returns: symbol references across all files — accurate, zero grep noise
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Cross-file rename operations that used to require 8–12 manual steps collapse into a single atomic call. An agent using Serena on a 500k-line Python monorepo can find all references in under 2 seconds, versus the 40+ seconds a text-search approach needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Serena GitHub 25,173 Stars, official evaluation documentation (oraios.github.io/serena/04-evaluation/).&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #2: Monorepo-Safe Refactoring Across 40+ Languages
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They give an agent a refactor task and brace for collateral damage — renames that miss imports, moves that break cross-module calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Serena's &lt;code&gt;rename_symbol&lt;/code&gt; and &lt;code&gt;move_symbol&lt;/code&gt; tools are language-server-aware. The LSP backend guarantees that every import, every cross-reference, every type annotation gets updated atomically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Serena (avoid marketplace — outdated instructions)&lt;/span&gt;
npx &lt;span class="nt"&gt;-y&lt;/span&gt; @oraios/serena start &lt;span class="nt"&gt;--language-server&lt;/span&gt; rust-analyzer

&lt;span class="c"&gt;# Rename a function across an entire Rust project&lt;/span&gt;
serena rename_symbol &lt;span class="nt"&gt;--new-name&lt;/span&gt; &lt;span class="s2"&gt;"calculate_total_price"&lt;/span&gt; &lt;span class="nt"&gt;--old-name&lt;/span&gt; &lt;span class="s2"&gt;"calc_price"&lt;/span&gt;

&lt;span class="c"&gt;# The tool updates:&lt;/span&gt;
&lt;span class="c"&gt;# - Function definition&lt;/span&gt;
&lt;span class="c"&gt;# - All call sites&lt;/span&gt;
&lt;span class="c"&gt;# - Module exports&lt;/span&gt;
&lt;span class="c"&gt;# - Cargo.toml if needed&lt;/span&gt;
&lt;span class="c"&gt;# - Documentation comments&lt;/span&gt;
&lt;span class="c"&gt;# All in one atomic pass, zero missed references&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A full cross-file rename in a 200k-line Rust codebase completes in under 5 seconds, with every occurrence updated correctly. No human review needed to catch missed references.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Serena README: "over 40 programming languages" including Rust, Python, Go, TypeScript, C++, and more.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #3: Context Injection — Give Your Agent the Full Picture Before It Starts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They paste a snippet of code into the chat and ask the agent to fix something — but the agent has no idea how the function fits into the module hierarchy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Use &lt;code&gt;symbol_overview&lt;/code&gt; to pull the entire call graph before the agent sees a single line of code. Feed it the dependency chain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Pre-task context script (run before starting a coding session)
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_symbol_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;repo_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_symbol&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;serena&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;symbol-overview&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--path&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;repo_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--symbol&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_symbol&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;capture_output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Before asking Claude Code to refactor "PaymentProcessor"
&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_symbol_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/path/to/project&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PaymentProcessor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Callers: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;callers&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# who calls this
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Callees: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;callees&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# what it calls
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Overrides: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;overrides&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# inheritance chain
&lt;/span&gt;
&lt;span class="c1"&gt;# Now start Claude Code with full context
# The agent understands the full scope before touching a single line
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; Agents make structurally correct changes instead of locally plausible ones. In A/B testing against a baseline agent on a complex refactoring task, Serena-equipped agents completed the job correctly 3x faster with 60% fewer follow-up corrections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Serena evaluation documentation (oraios.github.io/serena/04-evaluation/).&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #4: Claude Code + Serena = Persistent Memory for Long-Lived Sessions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They run a multi-step agentic task — architecture design, then implementation, then testing — and watch the agent lose context after step 1. Each new prompt starts from scratch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; Serena has a built-in memory system specifically designed for long-lived agent workflows. Combine it with Claude Code's &lt;code&gt;--resume&lt;/code&gt; feature for true persistent context across sessions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start Serena with memory persistence enabled&lt;/span&gt;
serena start &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--language-server&lt;/span&gt; pyright &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--memory-db&lt;/span&gt; ./serena-memory.db &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--project-root&lt;/span&gt; ./my-project

&lt;span class="c"&gt;# In Claude Code, use the memory tool:&lt;/span&gt;
/serena memory_summary
&lt;span class="c"&gt;# Returns: "Previous sessions working on auth refactor.&lt;/span&gt;
&lt;span class="c"&gt;# Key decisions: JWT chosen over sessions, DB schema finalized,&lt;/span&gt;
&lt;span class="c"&gt;# remaining: write tests, update OpenAPI docs"&lt;/span&gt;

&lt;span class="c"&gt;# Continue from where you left off — no context loss&lt;/span&gt;
/serena continue_with_task &lt;span class="s2"&gt;"finish auth tests and update OpenAPI"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A 3-day refactoring project that would normally require a 30-minute context restoration ritual at the start of each day completes with zero re-explanation. The agent picks up exactly where it left off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Serena GitHub README features section: "memory system for long-lived agent workflows."&lt;/p&gt;




&lt;h2&gt;
  
  
  Hidden Use #5: JetBrains Plugin — Bring Serena Intelligence to PyCharm and IntelliJ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What most people do:&lt;/strong&gt; They use Serena only with terminal-based clients (Claude Code, Codex CLI) and miss out on the IDE integration for IDE-native work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hidden trick:&lt;/strong&gt; The Serena JetBrains Plugin (free trial available) brings symbol-level intelligence to the full JetBrains ecosystem — PyCharm, IntelliJ IDEA, GoLand, WebStorm, and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;.idea/mcp_servers.json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(IntelliJ&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IDEA&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PyCharm)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"serena"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"serena"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--jetbrains-plugin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"SERENA_LANGUAGE"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"SERENA_PROJECT_PATH"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${project_dir}"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Now&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PyCharm's&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;AI&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Assistant&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;has&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;full&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;symbol&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;awareness&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Ask:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Find all classes that inherit from BaseHandler"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Get:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;accurate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;result,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;not&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;text-match&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;speculation&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The result:&lt;/strong&gt; A developer using PyCharm + Serena reported a 4x reduction in debugging time on a complex Django project. The plugin understands Python's dynamic dispatch, Django's ORM patterns, and the full class hierarchy — not just regex matches on text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data sources:&lt;/strong&gt; Serena JetBrains Plugin page (plugins.jetbrains.com/plugin/28946-serena/).&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Serena gives your AI coding assistant the IDE intelligence it always deserved:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Symbol Navigation&lt;/strong&gt; — symbol-level search replaces grep, 10x faster and 100% accurate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monorepo-Safe Refactoring&lt;/strong&gt; — language-server-aware renames and moves across 40+ languages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context Injection&lt;/strong&gt; — feed the full call graph to your agent before it starts coding&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persistent Memory&lt;/strong&gt; — long-lived agent sessions without context loss&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JetBrains Plugin&lt;/strong&gt; — bring the same intelligence to PyCharm, IntelliJ, GoLand&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Start using Serena today: &lt;code&gt;npx -y @oraios/serena start --language-server clangd&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Related Articles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/gooses-5-hidden-uses-that-turn-it-into-a-production-ai-agent-stack-in-2026-3ccl"&gt;Goose's 5 Hidden Uses That Turn It Into a Production AI Agent Stack in 2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/fastmcp-self-hosted-mcp-framework-5-hidden-uses-for-production-agent-stacks-6o6"&gt;FastMCP: Self-Hosted MCP Framework — 5 Hidden Uses for Production Agent Stacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/_cbd692d476c5faf3b61bcf/mempalaces-5-hidden-uses-that-make-it-the-best-benchmarked-ai-memory-system-in-2026-3869"&gt;MemPalace's 5 Hidden Uses That Make It the Best-Benchmarked AI Memory System in 2026&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What hidden use case have you found for Serena or other MCP tools? Drop it in the comments — I'd love to hear what's working in your workflow.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
