Skip to content
Back to skills

Optimise

ASecurity

Make an agent harness (Claude Code, Codex, Pi, OMP, or any harness with a profile file) behave the way its user expects, and prove each change before keeping it - measure the friction in the prompt history, interview the user from those numbers, find why each expectation fails, propose one change per expectation, replay real prompts with and without it, apply only what the user picks and the trial confirms.

  • 23 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentsgoshellbashnodegitdatabase

Works with

  • claude code

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add mirkobozzetto/arsenal --skill optimise --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Optimise?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Optimise
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mirkobozzetto-optimise/badge)](https://www.skillsdirectory.com/skills/mirkobozzetto-optimise)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: optimise
description: Make an agent harness (Claude Code, Codex, Pi, OMP, or any harness with a profile file) behave the way its user expects, and prove each change before keeping it - measure the friction in the prompt history, interview the user from those numbers, find why each expectation fails, propose one change per expectation, replay real prompts with and without it, apply only what the user picks and the trial confirms.
argument-hint: "[an expectation to work on]"
---

# Optimise

Change how the agent behaves only when a trial shows the change helps. Resolve
`scripts/` from this skill's directory. Run each script with Bash
`run_in_background: true` and read its output when it ends. `<work>` is a
new scratch folder for this run. Talk in the conversation language. Never
edit the user's real instructions before step 6.

1. **Measure.** `node scripts/measure.cjs --weeks 8`. It counts, per week,
   what the user typed: bare approvals (`go`), status questions, doubts,
   repeats, swearing, requests to explain. Show the table and the two or
   three counters that are high or rising. A `--signals <file.json>` gives
   the user's own patterns and the prompts to skip (sent by other sessions).
   Then `node scripts/shape.cjs --weeks 8`: the shape of the agent's own
   replies, per week (a line over 80 characters, a reply over 8 lines, the
   median length). `--max-line` and `--max-lines` take the user's limits.
   Outside Claude Code, add `--harness <codex|pi|omp|profile file>` to
   both: it reads that harness's prompts and sessions.
2. **Interview.** Read the user's profile first,
   `<home>/optimise/profile.md`, `<home>` being
   `${CLAUDE_CONFIG_DIR:-~/.claude}` under Claude Code and the profile's
   `home` elsewhere (`node scripts/harness.cjs` prints it): what they already
   expect, with the date and their words. Never ask again what it answers.
   Then one form, built from the numbers: one question per counter kept
   that the profile does not cover, quoting two real prompts from the
   history. Every question keeps a free answer and a "Cut and discuss"
   option. Then a second form that refines each answer: a threshold, an
   example the user would accept, what to keep. An argument narrows the
   interview to that expectation. Write each expectation in
   `<work>/expectations.md` and in the profile as one sentence plus the
   check that counts it (a key of `scripts/grade.cjs`, a file state, or
   "user judges"). An expectation no check can count is kept apart and
   said so: it cannot be trialled.
3. **Diagnose.** For each expectation, read everything that speaks to it:
   the instruction files (`CLAUDE.md`, `AGENTS.md`), rules, the output style
   (Claude Code), text injected by plugins, extensions and hooks.
   Name one cause, with the passages:
   - contradiction: two instructions ask for opposite things;
   - buried: the instruction exists, lost among many;
   - not enforced: it is checkable, and only prose asks for it;
   - not loaded: it lives in a skill or a `paths:` rule that did not load;
   - absent: nothing says it.
   When the slim skill is installed, weigh the instructions with its
   `weigh.cjs`: a heavy file makes "buried" the likely cause.
4. **Propose.** One change per expectation, the smallest that removes the
   cause: rewrite or remove a sentence, state a list once and point to it,
   move a checkable rule with no exception into a hook or an
   extension, whichever the harness offers, add the missing
   line. A new line replaces one, when it can. Show each change beside the
   original. Write nothing yet.
5. **Trial.** `node scripts/arm.cjs before` and `node scripts/arm.cjs after`
   copy the instructions (add `--style <file>` for an output style). Apply
   the proposed changes to the `after` copy only. Write `<work>/cases.json`:
   prompts copied word for word from the user's history, never invented,
   each with its `expect` and, when it should act, a `files` probe. The
   fixture is a copy of the project those prompts were typed in, tracked
   files only (`git archive HEAD`), so no remote and no untracked secret:
   a toy project makes toy answers. Every run is
   a full session on the user's plan, on the model of their settings
   (`--model` only to match the model they really use). Price it first:
   one run of one case (`--only <id> --runs 1`), then cost x cases x arms
   x runs. Above a few dollars, show that estimate and ask the go before
   the batch. Then
   `node scripts/replay.cjs --arms before=<dir>,after=<dir> --cases
   <work>/cases.json --out <work>/run --runs 3`.
   Outside Claude Code, pass the same `--harness` to `arm.cjs` and
   `replay.cjs`: an arm holds that harness's user instruction files, and
   each run uses its headless command in a temporary home linked to the
   real one, so its model, login and extensions stay those of every day.
   Codex reports no price: count its runs instead.
   Add a control: a third arm pointing at the same folder as `before`
   (`control=<before dir>`). Identical instructions that score differently
   show the noise of a case: a gap between `before` and `after` no wider
   than the gap between `before` and `control` proves nothing. Raise
   `--runs` or rewrite the case.
   For a matter of taste (layout, tone, how digestible a reply is), the
   user judges, not a check: one form question per case, one option per
   arm with the real reply as its text, letters shuffled per question, and
   "Cut and discuss". Reveal the arms after the answers. One letter picked
   every time hints at a position bias: say so.
   Read the replies in `<work>/run/results.json`, not only the table: a
   case that proves nothing is said so and rewritten. A change is confirmed
   when `after` beats `before` on its expectation and loses on no other
   check. A change the trial does not confirm is dropped, and said so.
6. **Apply.** Show the table and ask one question for the go; the user may
   keep some changes and not others. Write only those, one commit per file
   in the repository that holds it, `chore(rules): optimise <file>`.
   `git revert` undoes it.
   Then, when the slim skill is installed, run `/slim` on each changed
   file: the rules stay light, and its check proves that nothing but the
   validated change moved.
7. **Follow up.** Run step 1 again a week later and show each counter
   beside its value before the change. A counter that did not move sends
   its expectation back to step 3.

## Cases file

    {
      "fixture": "fixture",
      "defaults": { "maxLineLength": 80 },
      "allowedTools": ["Bash(ls:*)"],
      "cases": [
        { "id": "rename-question",
          "prompt": "can you rename total to sum in calc.js?",
          "expect": { "notEndsWith": "Go ?" },
          "files": { "done": { "path": "calc.js", "match": "function sum" } } }
      ]
    }

`fixture` is a folder beside the file, copied fresh into every run. Under
Claude Code, a run may edit only its own folder and a shell command outside
`allowedTools` is refused. Codex runs in its `workspace-write` sandbox and
ignores `allowedTools`. Pi and OMP runs get no sandbox from optimise:
they act on the real machine, so give them only prompts that are safe
there. Never give a case a tool that reaches a real account, database or remote.

## Limits

Under Claude Code, a hook cannot stop a reply before the user reads it: a
`Stop` hook runs once the reply is written, so it can only ask for a
second, shorter one.
Form (length, lines) is fixed by fewer and clearer rules, then counted by
`shape.cjs` on real sessions.

A Claude Code run loads the instructions only: no skills, no hooks, no
plugins, no conversation before the prompt. Another harness's run still
loads the extensions and skills of the linked home. It shows how the
instructions read a prompt, not a whole session. Say this with every result.

Files in this skill

  • SKILL.md5 KB
  • scripts/arm.cjs1.4 KB
  • scripts/grade.cjs2.4 KB
  • scripts/measure.cjs3.1 KB
  • scripts/replay.cjs7.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.