opty

score, fix, and optimize AI agent configuration files

npx optymd scan

Why opty exists

AI coding agents read markdown files as their working instructions. Over months, these files grow stale. Duplicates creep in. Secrets get pasted for "just a second" and forgotten. Files swell past the context window until the agent can only read half of what you wrote.

opty is a linter for that problem. It scans the files, scores them on quality dimensions, fixes what is safely fixable, and keeps a backup of every change.


What it scans

file typematchesscored on
agentCLAUDE.md, agent.mdactionability, security, commands, architecture
soulsoul.mdpersona clarity, behavioral rules, conciseness
skillSKILL.mdtrigger clarity, scope boundaries, actionability
memorymemory/*.mdrecency, relevance, no duplicates
hookhooks/*.mdtrigger precision, side-effect warnings
tooltools/*.mdarg clarity, failure modes

Commands

opty init <platform>
Scaffold a baseline config for claude or openclaw.
opty scan [path]
Detect files, surface issues, print a report.
opty score [path]
Calculate a quality score (0–100) and a grade (A–F).
opty fix --dry-run
Preview what will be fixed — nothing is written.
opty fix [path]
Apply safe fixes. A backup is written to .opty/backups/.
opty restore
Roll back the last fix from backup. Use --id <ts> for a specific snapshot.
opty verify [path]
Compare repo rules against git history and workflow evidence. --fail-on-violations exits 2 on violation.

Example report

$ opty scan .

  opty scan — claude
  _______________________________________________________

  5 files  |  Score: 72 / B  |  1 critical  4 warnings

  TRUNCATED FILES
  x  skills/bureau-dev/SKILL.md    2969 / 2000    (33% lost)

  DEAD REFERENCES
  !  skill.md            (referenced 2x)
  !  tailwind.config.js
  !  heartbeat.md

  NOTABLE FILES
  A  CLAUDE.md                       92    no issues
  B  skills/drizzle-ops/SKILL.md     74    no issues
  D  skills/bureau-dev/SKILL.md      47    2 minor

  BY TYPE
  agent    1 file    avg  ##########----  92
  skill    3 files   avg  ######--------  53
  config   1 file    avg  ########------  80

  FIX PRIORITY
  1. Trim 1+ files exceeding token limits
  2. Remove 4 dead file references
  3. Add scope boundaries to 2 skills

Scoring dimensions

Per-file — agent (CLAUDE.md)

actionability22ratio of actionable instructions
security20no leaked secrets
commands15build / test / dev documented
architecture12project structure documented
structure10headers, no placeholders
direction8clear directives, no contradictions
size fitness8within token budget
token efficiency5no duplicates or verbose phrases

Fleet-level — multiplicative factors

Each returns a 0.0–1.0 multiplier applied to the weighted file average:


Auto-fix behavior

opty fix applies only safe, reversible changes. Every run writes a timestamped backup to .opty/backups/. Undo with opty restore.


GitHub action

- uses: AytuncYildizli/opty/action@v1
  with:
    path: .
    fail-below: 50

Use mode: verify with fail-on-violations for CI rule enforcement:

- uses: AytuncYildizli/opty/action@v1
  with:
    path: .
    mode: verify
    fail-on-violations: true

Install

npm install -g optymd

Or one-off:

npx optymd scan
npx optymd scan CLAUDE.md