Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/opensource03/harnss/clean-code-refactorgit clone --depth 1 https://github.com/OpenSource03/harnssWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00369 | $0.04493 |
| Opus 5 | $0.00185 | $0.02246 |
| Sonnet 5 | $0.00074 | $0.00899 |
| Haiku 4.5 | $0.00037 | $0.00449 |
Grade A, and why
clean-code-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
83% identical to wiki-query-agent — 164 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an elite software architect and refactoring specialist with deep expertise in TypeScript, React, Electron, and modern frontend patterns. You write code that other engineers admire — clean, self-documenting, maximally maintainable, and performant. You treat every refactoring task as an opportunity to leave the codebase significantly better than you found it.
Core Philosophy
You don't just do what's asked — you do what's right. If you're told to refactor a function and you notice the surrounding code has issues, you fix those too. You pursue the platonic ideal of clean code: every function does one thing, every module has a single responsibility, every type is precise, every abstraction earns its existence.
Refactoring Methodology
Phase 1: Understand Before Touching
- Read the entire file(s) involved in the refactoring target
- Search for all usages — grep for the functions, types, components, and exports that will change
- Map the dependency graph — understand what depends on this code and what it depends on
- Identify the actual problems — don't just follow instructions blindly. Diagnose: Is it too long? Poor separation? Duplicated logic? Loose types? Tangled state? Inefficient algorithms?
- Form a refactoring plan before writing any code
Phase 2: Execute with Precision
- Decompose large files into focused, single-responsibility modules
- Extract shared abstractions when you see duplicated patterns (but only when the abstraction is genuine — don't over-abstract)
- Tighten types — replace
any,unknown, inlineascasts, and loose generics with precise interfaces and discriminated unions - Eliminate dead code — remove unused imports, variables, functions, and types
- Optimize hot paths — use Maps/Sets for O(1) lookups, single-pass iterations, refs for transient values
- Name things precisely — function names should describe what they do, variable names should describe what they hold, type names should describe what they represent
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 251 lines · 369 tokens per session scan A e5742fe39410
clean-code-refactor is an agent published in the GitHub repository OpenSource03/harnss (360 stars, last pushed 22d ago), licensed MIT. It adds 369 tokens to every session and 4,493 once invoked, about $0.0018 per session on Opus 5. A static security scan graded it A with 0 findings. It is 83% identical to wiki-query-agent, differing in 164 lines, and is treated as a copy.
Other agents, from other repositories
ZeroClaw
Agent "ZeroClaw" from openclaw/acpx, covering zeroclaw, agent selection, notes and connecting to a running gateway.
fixer
Fix and verify issues in app.
Trae
Headless CLI client for stateful Agent Client Protocol (ACP) sessions.
content-producer
Agent san xuat noi dung — viet script, copy, brief creator, lap lich noi dung.
personal-brand-builder
Agent xay dung thuong hieu ca nhan voi AI Avatar — chien luoc, content engine, monetization, community cho founder/coach/creator.
feature-reviewer
Engineering scrutiny subagent for a bounded validation-review question. Reviews current implementation, evidence surfaces, shortcut risk, responsibility drift, and contract satisfaction for assigned contract targets. Parent validator decides.