How to build a DeepSeek Harness plugin and prove it actually runs
Build a local headline checker for DeepSeek Harness. Download the code, test it without an API key, connect it to the Web profile, and remove it after the experiment.

DeepSeek Harness lets you give an AI assistant a tool of your own. Imagine asking for five subject lines under 60 characters. Four fit. The fifth looks good, but the assistant has counted it incorrectly. You could ask for another count, or you could give the assistant a small program that measures the actual string. The model still writes the copy. The program returns the length and the space left. This is useful anywhere an editor has to fit text into a newsletter, a product card or a notification.
We built that program as a DeepSeek Harness plugin called headline_fit. It takes a headline and an optional limit. You can run the calculation on your computer before opening a chat or paying for a model. We also loaded the tool into the actual Harness tool registry, called its registered handler, removed it and repeated the cycle. The download includes the same code we tested. If you prefer to build through conversation, there is a Creator Mode brief below you can adapt to your own publication. Download the plugin and tests · An introduction to DeepSeek Harness.
Start with an answer you can check by hand
Take AI update without the bold formatting. Two letters, one space and six more letters make nine characters. With a budget of nine, the tool should return a length of 9, a remaining allowance of 0 and fits: true. That last value matters. A validator that rejects a title exactly at the limit will force an editor to shorten perfectly good text. Change the budget to eight and the text should fail by precisely one character.
Now try Новая камера 👩💻. The words contain five and six letters. The two spaces count, and the programmer emoji is perceived as one character. The total is fourteen. At a limit of thirteen our tool returns 14, −1 and false. It also returns the normalized text it actually measured. You can use this example even if you cannot read Russian. Its purpose is to catch mistakes that an English-only test with plain letters would miss.
Before adopting the checker, find out how your destination measures a title. A database column may limit bytes. A mobile card may wrap according to the width of the typeface. An editorial policy might simply ask for a maximum number of visible characters. This download implements the last rule. Two headlines that both pass can still wrap onto different numbers of lines on a phone. A screenshot of the finished card answers a different question from the numeric result.
Get the download running without an API key
Extract the ZIP into a new folder. It contains headline.mjs, the tool itself, check.mjs, its test cases, and make-patch.mjs, which helps you connect it to Harness. Open a terminal in the extracted folder. On macOS, one way to get there is to type cd followed by a space and drag the folder into the terminal window. On Windows, open the folder in Explorer and choose Open in Terminal. Use Node.js 24 to reproduce our setup. Download Node.js.
node --version
node check.mjs
The last output line should read 12 checks passed. Seven inputs exercise valid headlines, including an exact fit, extra whitespace, a multi-part emoji, a decomposed letter and a missing optional limit. Five others exercise rejected inputs, including blank text and an invalid budget. There are no dependencies to install for this step. The script needs no account, API key or cloud model. If it fails here, fix the folder, Node installation or local code before troubleshooting a conversation with the assistant.
To try your own wording, change the text in the example below. This shell command works on macOS and Linux. An alternative on any operating system is to add your own line to the cases array in check.mjs with the number you expect, then run the tests again. Keep at least one input whose answer you counted independently. Copying an expected number from the function under test can make the test repeat the same mistake.
node --input-type=module -e 'import {measureHeadline} from "./headline.mjs"; console.log(measureHeadline("AI update", 9))'
What counts as a character in this plugin?
The tool first normalizes Unicode text to NFC. A letter can arrive as a single character or as a base letter followed by a combining mark. The Russian word ёлка is a good example. It should take the same space in our budget when the dots above the first letter arrive separately. The function also strips whitespace from the ends and replaces runs of whitespace inside the headline with a single ordinary space. Text pasted from a document often contains a line break where the writer intended a space.
It then uses Intl.Segmenter to count grapheme clusters, which approximate the written units a reader perceives. JavaScript's ordinary .length counts UTF-16 code units. It can return several units for one visible emoji. The tool reports its normalized string alongside the result so the next step can use the exact copy that passed. If your publication deliberately preserves a nonbreaking space, adapt the whitespace rule and add a test for it. Nothing in the utility changes the original document. Intl.Segmenter reference.
There are two pieces to the code. The plain function measureHeadline owns the editorial rule. The plugin's apply function registers a named operation through ctx.tools.register. Its inject = ["tools"] declaration tells Harness which service must be available. When called, the handler returns a JSON string containing the normalized text, length, limit, remaining budget and pass/fail value. If you change the limit from 60 to 45 for a newsletter, the calculation remains in one place. DeepSeek's tool authoring tutorial.
Connect the local plugin to DeepSeek Harness Web
Start with a separate Web profile for the experiment. The user interface will open in a browser, while the plugin runs on the computer hosting that instance. From the extracted folder, generate its cordis.yml file with the first command below. The file records the absolute path to headline.mjs. Generate it again if you move or rename the folder. The redirection writes a file, so run this in the example folder where it will not replace another project's configuration.
node make-patch.mjs > cordis.yml
DSH_HOME="$PWD/demo-profile" npx @deepseek-ai/dsh@0.2.2-rc.5 web --patch "$PWD/cordis.yml" --host 127.0.0.1 --port 3080
The commands above use macOS/Linux shell syntax. In PowerShell, use node make-patch.mjs | Out-File -Encoding utf8 cordis.yml and then $env:DSH_HOME = "$PWD/demo-profile" before running the same npx command. The initial package download needs an internet connection. The command pins the client version and binds the Web listener to your own computer. Developers working from a repository checkout can follow DeepSeek's source-based route with pnpm dsh web --patch. Official local plugin setup.
Connect a tool-capable model in the interface. Ask it to “call headline_fit with text ‘AI update’ and limit 8, then show the tool result unchanged.” Look at the actual tool call in the conversation. Check its name, the string supplied and the integer limit. A plausible JSON block typed directly by the model does not establish that it used the plugin. We launched the 0.2.2-rc.5 Web profile on macOS with Node.js 24.22.3. A second test module in that process called the loaded tool and measured 14 characters against a limit of 13. In our separate registry test, the tool disappeared after unloading in both cycles. These checks ran without a cloud model.
Give Creator Mode a brief with an acceptance test
The Desktop application advertises a Creator Mode for building extensions through chat. A request such as “review this headline” can be satisfied with one reply in an ordinary session. If you want a reusable feature, describe the operation that should appear in Harness, the arguments it takes and the test it must pass when installed. Give the agent an empty working folder for its first attempt. DeepSeek's Creator Mode demonstration.
Build a local DeepSeek Harness tool named headline_fit. Accept a text string and a whole character limit from 1 to 500, default 60. Normalize whitespace and count grapheme clusters. Return the normalized string, the count, remaining space and fits. It needs no access to my editorial files. Show me the implementation before connecting it. After installation, call it twice on “AI update”, first at 9 and then at 8. Show both tool results and how to disable it.
This is a development brief. The agent may produce a Desktop bundle with a different file structure. Our ZIP is a worked Web-profile example, so use its cases to evaluate the generated version. If the numbers change after you ask for an interface improvement, you have found a regression. A useful next change is a choice of two named budgets, such as “newsletter subject” and “catalog card”. That gives the editor more control without changing what a character means.
What it costs and which alternative fits the job
| What you need | Suitable approach | Cost and trade-off |
|---|---|---|
| Measure an existing line of copy | Run the local function with Node.js | Zero model calls. You supply the final text |
| Generate and check several candidates in one conversation | Harness with a model and headline_fit |
Cloud usage follows the selected provider's terms |
| Validate a batch of finished titles | Reuse the function in a script | No model required. You provide the input and output steps |
| Get an opinion on meaning or tone | Ask in an ordinary chat | Useful editorial feedback. Verify hard limits independently |
On November 24, 2026, DeepSeek's direct Flash API lists uncached input at $0.15 per million tokens off-peak and $0.30 at peak. Output is $0.60 and $1.20 per million respectively. As an illustration, 10,000 uncached input tokens and 1,000 output tokens in total would cost $0.0021 off-peak or $0.0042 at peak. This estimate assumes all usage falls within the stated rate window. A longer conversation can include the tool description, several candidates and returned results on subsequent model turns. Other providers and subscriptions have their own billing rules. DeepSeek prices and peak hours · Understanding DeepSeek API costs.
Use it in an editorial workflow and roll it back
Ask the assistant for three titles that preserve the facts in a source paragraph. Give it your chosen limit and request one tool call per candidate. Compare the meaning of the candidates that pass. If one misses by three characters, ask for a shorter version and measure that new string. Use the text from the final result when pasting into your CMS. A brand name or date appended afterward counts too. Preview the final card at phone width before publication.
To disconnect the Web example, stop that instance with Ctrl+C and launch the same profile again without --patch. The plugin is attached through the launch configuration. For a bundle installed separately in Desktop, use the Plugins controls in the profile where you installed it. Keep the three downloaded files if you want a quick regression check when you upgrade Harness.
FAQ
Do I need a DeepSeek API key to build the plugin?
The local function and twelve tests run without a key. A chat with a cloud model needs access to the provider you choose. Text pasted into that chat can be included in its request. For an unpublished headline that must stay on your computer, use the local Node.js function directly.
Why does the tool disappear after restarting Harness?
Check the profile, the --patch argument and the absolute path in the generated file. Moving the folder out of Downloads is enough to invalidate that path. Regenerate the configuration, restart the instance, then ask for one explicit headline_fit call and inspect the corresponding event in the interface.
Can I use this to set the length of an SEO title?
Yes, as an internal writing budget. Search engines may present a title differently depending on the query, device and result layout. A budget of 60 is an editorial choice in this example. The checker can flag a candidate for review, while the editor still decides whether the title says the right thing and looks right in context.
Tools
Tools
Tools