hk-refine

hk-refine is a skill for Claude Code from deepklarity/harness-kit. It costs 106 tokens per session (2,261 once invoked), scanned A, original, MIT.

A structured method for improving an output through repeated observation, explanation, change, and rerun cycles. It keeps the working notes and previous attempts in a scratch directory instead of filling the conversation.

In plain words
What is it for?
Use it to refine reflections, plans, prompts, pipeline results, or other outputs through several documented iterations.
Why use it?
It provides a record of what was tried, what failed, and why, when the first result is not good enough. This makes refinement more organized and easier to continue.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents; mentions Claude Code.

Good fit Use it to refine reflections, plans, prompts, pipeline results, or other outputs through several documented iterations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/deepklarity/harness-kit/hk-refine
Install

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.

Any agent
npx skills add deepklarity/harness-kit --skill hk-refine
Clone the repo
git clone --depth 1 https://github.com/deepklarity/harness-kit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hk-refine

README.md
[![agentmods](https://agentmods.dev/badge/skills/deepklarity/harness-kit/hk-refine.svg)](https://agentmods.dev/skills/deepklarity/harness-kit/hk-refine)
Your own site
<a href="https://agentmods.dev/skills/deepklarity/harness-kit/hk-refine"><img src="https://agentmods.dev/badge/skills/deepklarity/harness-kit/hk-refine.svg" alt="Measured on agentmods" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,261 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00106 $0.02261
Opus 5 $0.00053 $0.01130
Sonnet 5 $0.00021 $0.00452
Haiku 4.5 $0.00011 $0.00226

Measured 8d ago against content hash 919dd8cb01f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

hk-refine 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 8d ago.

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.

.claude/skills/hk-refine/SKILL.md · 251 lines

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.

/hk-refine — Iterative Output Refinement

You have an open loop: something produced output, the output isn't good enough, and you need to systematically improve it. This skill closes that loop.

The core discipline: everything lives on disk, not in conversation context. The scratch directory is the organized record of what was tried, what worked, and why. Subagents read from disk, write to disk, and report back in 2-3 line summaries. The main conversation only holds the current hypothesis and verdict — never full outputs.

Context

<loop_context> $ARGUMENTS </loop_context>

If the context above is empty or unclear, ask the user:

  1. What produced the output? (command, prompt, pipeline step)
  2. What's wrong with it? (vague is ok — "it's not good enough" is a valid start)
  3. Where should the scratch directory live? (suggest temp_reflections/ or temp_loop/)

The Scratch Directory

This is the product. Not temp files — the organized log of the refinement process.

<scratch_dir>/
├── loop.md                # Live loop state (see template below)
├── baseline/
│   ├── output.md          # Original output that needs improvement
│   ├── critique.md        # Structured critique of what's wrong
│   └── run_command.txt    # Exact command/process that produced the output
├── iter-1/
│   ├── hypothesis.md      # What to change and why
│   ├── changes.md         # What was actually changed (with file paths and diffs)
│   ├── output.md          # New output after changes
│   ├── comparison.md      # Before vs after, structured
│   └── verdict.md         # Better / worse / mixed — with evidence
├── iter-2/
│   └── ...
└── summary.md             # Written when loop closes

loop.md template

This file is the single source of truth for where the loop is. Read it at the start of every iteration. Update it after every verdict.

# Close-the-Loop: [short description]

## Target
What we're improving: [one line]
Run command: [the exact command to re-run]
Quality signal: [how we know it's better — specific, measurable if possible]

## Current State
Iteration: [N]
Best so far: [baseline | iter-N]
Status: [observing | hypothesizing | changing | running | comparing | closed]

## Hypothesis Log
- iter-1: [hypothesis] → [verdict: better/worse/mixed]
- iter-2: [hypothesis] → [verdict]
- ...

## What We've Learned
- [Accumulated insights that carry forward — things that definitely help or definitely don't]

## Next
[What to try next, or "CLOSED: [reason]"]

Read the full file on GitHub · 251 lines

Changes

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.

  1. 8d ago First seen · 251 lines · 106 tokens per session scan A 919dd8cb01f9

Subscribe to this mod's changes

hk-refine is a skill published in the GitHub repository deepklarity/harness-kit (96 stars, last pushed 1mo ago), licensed MIT. It adds 106 tokens to every session and 2,261 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.