agentleFS
Ertinox7711Ertinox7711/SGRR-AGI-V2/skills/refine/SKILL.md

refine

Skill1 starsChanged 3 months agoMITView on GitHub

Continual-harness refinement. Use when a session produced a durable lesson worth keeping - a repeated failure, a reusable tactic, a delegation role, a behavior policy, or a project fact - and it should be persisted as a small evidence-backed edit to the rig instead of being lost with the context. Triggers - "/refine", "retiens ca", "apprends de cette session", "ameliore le rig", "persiste cette lecon", before a compaction that would erase the trajectory, at the end of a long debugging or build session. Also use to review refinement history or roll back a bad refinement.

47 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use daily-arxiv, exp-eval and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • LambenthanSkill

    daily-arxiv

    每日从 arXiv 拉取新论文,过滤相关性,auto-ingest 高优先级论文,检测 SOTA 更新

    Also in 5 projects that use this

  • LambenthanSkill

    exp-eval

    实验判决门:Review LLM 独立评判实验结果 → 4 种判决路径 → 自动更新 claims confidence、ideas status、graph edges

    Also in 5 projects that use this

  • ryanportfolioSkill

    addskill

    Create, import, update, or install repo or personal skills: runtime ownership, resources, discovery checks.

    Also in 6 projects that use this

  • ryanportfolioSkill

    apply-firmware

    Bring current folder (plain folder, existing repo, old or partial firmware copy) up to full Harness Firmware in place. Mirror external repo → adopt-repo.

    Also in 6 projects that use this

  • +5 more from Lambenthan
  • +3 more from ryanportfolio

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 41 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create or update the smallest component that fits.

    line 27
  2. Distinctive:

    Read prior refinements. If an earlier refinement caused a problem, fix or supersede that entry instead of stacking a contradictory one.

    line 63
  3. Distinctive:

    Record the refinement: Write a payload and register it:

    line 84
  4. Distinctive:

    Every entry states the why (the cost paid), not only the what.

    line 117
  5. Distinctive:

    Never duplicate what the repo, git history, or CLAUDE.md already records.

    line 119
  6. Very specific:

    Before citing an existing file/flag/skill in an entry, verify it still exists.

    line 120
  7. Distinctive:

    When you see it: apply this skill, but keep the bar high.

    line 139
  8. Distinctive:

    If nothing qualifies, say so in one line and skip - a refinement with zero edits is refused by the engine on purpose.

    line 141

“Common” is measured: kept by at least 6 in 10 of the 41 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Refine - Continual Harness

Port of PrimeIntellect prime-agent's Continual Harness (/refine, MIT, https://github.com/PrimeIntellect-ai/prime-agent) onto this rig.

Refinement reads the current trajectory and applies small, evidence-backed edits to durable rig state. It is compaction's sibling: compaction summarizes the conversation, refinement extracts what should outlive it.

The base ~/.claude/CLAUDE.md is IMMUTABLE. Refinement never rewrites it.

The four kinds

kindwhat it iswhere it lands on this rig
promptnarrow behavioral policy addendumharness/addendum/PROMPT-NOTES.md, injected at SessionStart
memorydurable fact, decision, failure, preference, outcome~/.claude/projects/<enc>/memory/<slug>.md + MEMORY.md line
skillrepeatable procedure worth invoking by name~/.claude/skills/<name>/SKILL.md
subagentreusable delegation role~/.claude/agents/<name>.md

Create or update the smallest component that fits. Repeated delegation role -> subagent. Repeated procedure -> skill. Durable fact or preference -> memory. Narrow behavioral policy -> prompt note. Do not rewrite the whole harness when a focused entry is enough.

Scope

  • --scope global (default): stable cross-session lessons, durable user preferences, reusable skills/subagents, tool or environment facts. Store: ~/.claude/harness/.
  • --scope local: session/project-specific progress, active task state, temporary blockers, project facts that must not leak into other sessions. Store: <project>/.claude/harness/.

A project-specific lesson may go global only when its title or content explicitly names the project and it will be reused in future sessions for that project. Otherwise: local.

Hard rule on this rig - no removal

The operator's standing rule (the no-removal rule) overrides the upstream design:

  • action: "create" and action: "update" are free.
  • action: "delete" is REFUSED by the engine unless --allow-delete is passed, and that flag is only passed after an explicit per-item GO from the operator. Never ask for a blanket GO. Never propose a removal on your own.
  • rollback reverts files. Dry-run first (default), show the exact file list, get the GO, then --go.

Procedure

  1. Check state
    python ~/.claude/scripts/harness-refine.py status
    python ~/.claude/scripts/harness-refine.py list -n 5
    Read prior refinements. If an earlier refinement caused a problem, fix or supersede that entry instead of stacking a contradictory one.
  2. Find the evidence. Scan the trajectory for: a failure that happened more than once, a tactic that worked and will be needed again, a correction the operator made, an environment fact paid for in wasted time. No evidence in this trajectory = no edit. Do not persist hypotheses, one-off noise, or transient tool output.
  3. Snapshot before touching anything
    python ~/.claude/scripts/harness-refine.py snapshot --id ref-YYYYMMDD-HHMM \
      --files <every file the edits will write>
    This is what makes rollback possible. Skipping it is a bug.
  4. Write the real files. Apply each edit to its destination store (memory file + MEMORY.md line, skills/<name>/SKILL.md, agents/<name>.md). Prompt notes need no manual file - the engine renders PROMPT-NOTES.md from the entry content.
  5. Record the refinement. Write a payload and register it:
    {
      "id": "ref-YYYYMMDD-HHMM",
      "summary": "one sentence",
      "rationale": "why these edits are justified by trajectory evidence",
      "evidence": "the concrete thing observed - quote it",
      "expectedOutcome": "what should improve and how to validate it",
      "edits": [
        {
          "action": "create",
          "kind": "memory",
          "id": "stable-slug",
          "title": "short title",
          "content": "the entry body as written to disk",
          "path": "optional destination path",
          "metadata": {"scope": "global"},
          "reason": "why this edit is useful"
        }
      ]
    }
    python ~/.claude/scripts/harness-refine.py record --json-file <payload>.json --trigger manual
  6. Report in one block: what was persisted, where, and how to validate it. Name the ledger id so it can be rolled back.

Anti-slop gates

  • Max 3 edits per refinement unless the operator asks for more. A refinement that wants to rewrite ten things is a refinement that understood nothing.
  • Every entry states the why (the cost paid), not only the what.
  • Convert relative dates to absolute at write time.
  • Never duplicate what the repo, git history, or CLAUDE.md already records.
  • Before citing an existing file/flag/skill in an entry, verify it still exists.
  • A memory entry follows the rig's existing memory format (frontmatter name / description / metadata.type, **Why:** + **How to apply:** for feedback and project types, [[links]] to related memories).

Review and rollback

python ~/.claude/scripts/harness-refine.py list -n 20
python ~/.claude/scripts/harness-refine.py show <id>
python ~/.claude/scripts/harness-refine.py entries
python ~/.claude/scripts/harness-refine.py rollback <id>         # dry run
python ~/.claude/scripts/harness-refine.py rollback <id> --go    # after explicit GO

When the harness fires on its own

The PreCompact hook injects a refine checkpoint right before the trajectory is summarized away - that is the upstream auto_refine(reason="compact") gate. When you see it: apply this skill, but keep the bar high. Approve an edit only when the trajectory holds evidence useful to future turns. Reject one-off noise. If nothing qualifies, say so in one line and skip - a refinement with zero edits is refused by the engine on purpose.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.