selftune
Observe real agent sessions, detect missed triggers, grade execution quality, and evolve skill descriptions toward the language real users actually use.
You are the operator. The user installed this skill so YOU can manage their skill health autonomously. They will say things like "set up selftune", "improve my skills", or "how are my skills doing?" — and you route to the correct workflow below. The user does not run CLI commands directly; you do.
Why this matters
Skills are only useful when they trigger at the right time with the right instructions. But user language drifts — the phrases people use to ask for help rarely match the trigger keywords a skill author imagined. selftune closes this gap by observing real sessions, finding where skills fail to activate or execute poorly, and rewriting descriptions to match actual usage patterns. The result: skills that get better over time without manual tuning.
Communicating with the user
Users range from experienced developers who'll say "evolve the pptx description using the latest eval set" to non-technical users who'll say "make my skills better". Pay attention to context cues:
- If they use terms like "eval set", "routing table", "JSONL" — match their precision
- If they say "improve my skills" or "how's it going" — explain what you're doing in plain language, summarize results, and suggest next steps
- When in doubt, briefly explain what a command does before running it
Bootstrap
If ~/.selftune/config.json does not exist, read Workflows/Initialize.md first. The CLI must be installed (selftune on PATH) before other commands will work. Do not proceed with other commands until initialization is complete.
Command Execution Policy
selftune <command> [options]Commands vary in output format. selftune orchestrate, selftune watch, and selftune evolve --dry-run emit structured JSON on stdout. selftune status, selftune last, and selftune doctor print human-readable text or structured JSON depending on the command. For alpha/bootstrap and health remediation, prefer machine-readable guidance.next_command or top-level next_command when present instead of inferring the next step from prose. selftune dashboard starts a local SPA server — it does not emit data.
Quick Reference
# Ingest group
selftune ingest claude [--since DATE] [--dry-run] [--force] [--verbose]
selftune ingest codex # (experimental)
selftune ingest opencode # (experimental)
selftune ingest openclaw [--agents-dir PATH] [--since DATE] [--dry-run] [--force] [--verbose] # (experimental)
selftune ingest pi [--sessions-dir PATH] [--since DATE] [--dry-run] [--force] [--verbose] # (experimental)
selftune ingest wrap-codex -- <codex args> # (experimental)
# Grade group
selftune grade auto --skill <name> [--expectations "..."] [--agent <name>]
selftune grade baseline --skill <name> --skill-path <path> [--eval-set <path>] [--agent <name>]
# Evolve group
selftune evolve --skill <name> --skill-path <path> [--dry-run]
selftune evolve body --skill <name> --skill-path <path> --target <body|routing> [--dry-run]
selftune evolve rollback --skill <name> --skill-path <path> [--proposal-id <id>]
# Eval group
selftune eval generate --skill <name> [--list-skills] [--stats] [--max N] [--seed N] [--output PATH]
selftune eval unit-test --skill <name> --tests <path> [--run-agent] [--generate]
selftune eval import --dir <path> --skill <name> --output <path> [--match-strategy exact|fuzzy]
selftune eval composability --skill <name> [--window N] [--telemetry-log <path>]
selftune eval family-overlap --prefix <family-> | --skills <a,b,c> [--parent-skill <name>] [--min-overlap 0.3] [--min-shared 2]
# Other commands
selftune watch --skill <name> --skill-path <path> [--auto-rollback]
selftune status
selftune last
selftune doctor
selftune dashboard [--port <port>] [--no-open]
selftune contributions [status|preview <skill>|upload [--dry-run]|approve <skill>|revoke <skill>|default <ask|always|never>|reset]
selftune creator-contributions [status|enable --skill <name>|enable --all [--prefix <value>]|disable --skill <name>]
selftune contribute [--skill NAME] [--preview] [--sanitize LEVEL] [--submit]
selftune cron setup [--dry-run] # auto-detect platform (cron/launchd/systemd)
selftune cron setup --platform openclaw [--dry-run] [--tz <timezone>] # OpenClaw-specific
selftune cron list
selftune cron remove [--dry-run]
selftune telemetry [status|enable|disable]
selftune export [TABLE...] [--output/-o DIR] [--since DATE]
# Autonomous loop
selftune orchestrate [--dry-run] [--review-required] [--auto-approve] [--skill NAME] [--max-skills N] [--recent-window HOURS] [--sync-force] [--max-auto-grade N] [--loop] [--loop-interval SECS]
selftune sync [--since DATE] [--dry-run] [--force] [--no-claude] [--no-codex] [--no-opencode] [--no-openclaw] [--no-pi] [--no-repair] [--json]
# Discovery + badges
selftune workflows [--skill NAME] [--skill-path PATH] [--min-occurrences N] [--window N] [--json] [save --skill NAME --skill-path PATH]
selftune badge --skill <name> [--format svg|markdown|url] [--output PATH]
# Maintenance
selftune quickstart
selftune repair-skill-usage [--since DATE] [--dry-run]
selftune recover [--full] [--force] [--since DATE]
selftune export-canonical [--out FILE] [--platform NAME] [--record-kind KIND] [--pretty] [--push-payload]
selftune uninstall [--dry-run] [--keep-logs] [--npm-uninstall]
# Hook dispatch (for debugging/manual invocation)
selftune hook <name> # prompt-log | session-stop | skill-eval | auto-activate | skill-change-guard | evolution-guard
# Platform hooks (non-Claude-Code agents)
selftune codex hook
selftune codex install [--dry-run] [--uninstall]
selftune opencode hook
selftune opencode install [--dry-run] [--uninstall]
selftune cline hook
selftune cline install [--dry-run] [--uninstall]
selftune pi hook
selftune pi install [--dry-run] [--uninstall]
# Registry (team skill distribution)
selftune registry push [name] [--version=<semver>] [--summary=<text>]
selftune registry install <name> [--global]
selftune registry sync
selftune registry status
selftune registry rollback <name> [--to=<version>] [--reason=<text>]
selftune registry history <name>
selftune registry list
# Alpha enrollment (device-code flow — browser opens automatically)
selftune init --alpha --alpha-email <email>
selftune alpha upload [--dry-run]
selftune alpha relink
selftune status # shows cloud link state + upload readinessWorkflow Routing
| Trigger keywords | Workflow | File |
|---|---|---|
| grade, score, evaluate, assess session, auto-grade | Grade | Workflows/Grade.md |
| evals, eval set, undertriggering, skill stats, eval generate | Evals | Workflows/Evals.md |
| evolve, improve, optimize skills, make skills better, triggers, catch more queries | Evolve | Workflows/Evolve.md |
| evolve body, evolve routing, full body evolution, rewrite skill, teacher student | EvolveBody | Workflows/EvolveBody.md |
| evolve rollback, undo, restore, revert evolution, go back, undo last change | Rollback | Workflows/Rollback.md |
| watch, monitor, regression, post-deploy, keep an eye on | Watch | Workflows/Watch.md |
| doctor, health, hooks, broken, diagnose, not working, something wrong | Doctor | Workflows/Doctor.md |
| ingest, import, codex logs, opencode, openclaw, pi, wrap codex | Ingest | Workflows/Ingest.md |
| replay, backfill, claude transcripts, historical sessions | Replay | Workflows/Replay.md |
| contributions, sharing preferences, opt in creator sharing, opt out creator sharing, approve contributions, revoke contributions, preview contributions, upload contributions, relay queue, contribution upload, contribution preview | Contributions | Workflows/Contributions.md |
| creator contributions, bundle contribution config, selftune.contribute.json, enable creator contribution, disable creator contribution, bulk enable creator contribution, enable all creator contributions, creator prefix config, --all, --prefix | CreatorContributions | Workflows/CreatorContributions.md |
| contribute, share, community, export data, anonymized, give back | Contribute | Workflows/Contribute.md |
| init, setup, set up, bootstrap, first time, install, configure selftune, alpha, enroll, alpha enrollment, cloud link, upload credential | Initialize | Workflows/Initialize.md |
| cron, schedule, automate evolution, run automatically | Cron | Workflows/Cron.md |
| auto-activate, suggestions, activation rules, nag, why suggest | AutoActivation | Workflows/AutoActivation.md |
| dashboard, visual, open dashboard, show dashboard, serve dashboard, live dashboard | Dashboard | Workflows/Dashboard.md |
| evolution memory, session continuity, what happened last | EvolutionMemory | Workflows/EvolutionMemory.md |
| grade baseline, baseline lift, adds value, skill value, no-skill comparison | Baseline | Workflows/Baseline.md |
| eval unit-test, skill test, test skill, generate tests, run tests | UnitTest | Workflows/UnitTest.md |
| eval composability, co-occurrence, skill conflicts, skills together, family overlap, sibling confusion, consolidate skill family | Composability | Workflows/Composability.md |
| eval import, skillsbench, external evals, benchmark tasks | ImportSkillsBench | Workflows/ImportSkillsBench.md |
| telemetry, analytics, disable analytics, opt out, tracking, privacy | Telemetry | Workflows/Telemetry.md |
| orchestrate, autonomous, full loop, improve all skills, run selftune loop | Orchestrate | Workflows/Orchestrate.md |
| sync, refresh, source truth, rescan sessions | Sync | Workflows/Sync.md |
| badge, readme badge, skill badge, health badge | Badge | Workflows/Badge.md |
| workflows, discover workflows, list workflows, multi-skill workflows | Workflows | Workflows/Workflows.md |
| alpha upload, upload data, send alpha data, manual upload, dry run upload | AlphaUpload | Workflows/AlphaUpload.md |
| recover, rebuild sqlite, recover db, legacy backfill, restore from export snapshot | Recover | Workflows/Recover.md |
| quickstart, getting started, onboard, first time setup, new user | Quickstart | Workflows/Quickstart.md |
| uninstall, remove selftune, clean up, teardown | Uninstall | Workflows/Uninstall.md |
| repair, rebuild usage, fix skill usage, trustworthy usage, repair-skill-usage | RepairSkillUsage | Workflows/RepairSkillUsage.md |
| export canonical, canonical export, canonical telemetry, push payload | ExportCanonical | Workflows/ExportCanonical.md |
| hook, run hook, invoke hook, manual hook, debug hook | Hook | Workflows/Hook.md |
| codex hooks, codex install, codex setup, opencode hooks, opencode install, opencode setup, cline hooks, cline install, cline setup, pi hooks, pi install, pi setup, multi-platform, platform hooks, non-claude hooks, multiple agents, multi-agent | PlatformHooks | Workflows/PlatformHooks.md |
| registry, distribute, push skill, install skill, sync skills, team skills, version control skills, rollback skill | Registry | Workflows/Registry.md |
| export, dump, jsonl, export sqlite, debug export | Export | *(direct command — no workflow file)* |
| status, health summary, skill health, how are skills, skills doing, run selftune | Status | *(direct command — no workflow file)* |
| last, last session, recent session, what happened, what changed | Last | *(direct command — no workflow file)* |
Workflows Grade, Evolve, Watch, and Ingest also run autonomously via selftune orchestrate.
Interactive Configuration
Before running mutating workflows (evolve, evolve-body, evals, baseline), consult references/interactive-config.md for the pre-flight configuration pattern, model tier reference, and quick-path rules.
The Feedback Loop
The core idea: observe how users actually talk, find where skills miss, propose better descriptions, validate them, and deploy — with automatic rollback if things get worse. Every step produces evidence so you can explain *why* a change was made.
Observe --> Detect --> Diagnose --> Propose --> Validate --> Audit --> Deploy --> Watch --> Rollback
| |
+--------------------------------------------------------------------+- Observe — Hooks capture every session (queries, triggers, metrics)
- Detect —
selftune eval generateextracts missed-trigger patterns - Diagnose —
selftune gradeevaluates session quality with evidence - Propose —
selftune evolvegenerates description improvements - Validate — Evolution is tested against the eval set before deploying
- Audit — Persist proposal, evidence, and decision metadata for traceability
- Deploy — Updated description replaces the original (backup kept)
- Watch —
selftune watchmonitors for regressions post-deploy - Rollback —
selftune evolve rollbackrestores previous version if needed
Specialized Agents
selftune bundles focused agents in agents/. When you need deeper analysis, read the relevant agent file and follow its instructions — either inline or by spawning a subagent with those instructions as its prompt.
On Claude Code, selftune init also syncs compatibility copies into ~/.claude/agents/ so native --agent <name> calls keep matching these bundled definitions.
Treat these as worker-style subagents:
- pass the required inputs from the parent agent
- expect a structured report back
- do not have them question the user directly unless you explicitly want that
| Trigger keywords | Agent file | When to use |
|---|---|---|
| diagnose, root cause, why failing, debug performance | agents/diagnosis-analyst.md | When one skill has recurring low grades, regressions, or unclear failures after basic doctor/status review |
| patterns, conflicts, cross-skill, overlap, optimize skills | agents/pattern-analyst.md | When multiple skills may overlap, misroute, or interfere, especially after composability flags conflict |
| review evolution, check proposal, safe to deploy | agents/evolution-reviewer.md | Before deploying a dry-run or pending proposal, especially for high-stakes skills or marginal improvements |
| set up selftune, integrate, configure project | agents/integration-guide.md | For complex setup and verification work in monorepos, multi-skill repos, or mixed-platform environments |
Examples
Scenario 1: First-time setup
User says: "Set up selftune" or "Install selftune"
Actions:
- Read
Workflows/Initialize.md - Run
selftune initto bootstrap config (hooks are installed automatically) - Run
selftune doctorto verify
Result: Config at ~/.selftune/config.json, hooks active, ready for session capture.
Scenario 2: Improve a skill
User says: "Make the pptx skill catch more queries" or "Evolve the Research skill"
Actions:
selftune eval generate --skill pptxto find missed triggersselftune evolve --skill pptx --skill-path <path>to propose changesselftune watch --skill pptx --skill-path <path>to monitor post-deploy
Result: Skill description updated to match real user language, with rollback available.
Scenario 3: Check skill health
User says: "How are my skills doing?" or "Run selftune"
Actions:
selftune statusfor overall health summaryselftune lastfor most recent session insightselftune doctorif issues detected
Result: Pass rates, trend data, and actionable recommendations.
Scenario 4: Autonomous operation
User says: "Set up cron jobs" or "Run selftune automatically"
Actions:
selftune cron setupto install OS-level scheduling- Orchestrate loop runs: ingest → grade → evolve → watch
Result: Skills improve continuously without manual intervention.
Troubleshooting
CLI not found
Error: command not found: selftune
Cause: CLI not installed or not on PATH.
Solution:
- Run
npm install -g selftuneor checkbin/selftune.cjsexists - Verify with
which selftune - If using bun:
bun linkin the repo root
No sessions to grade
Error: selftune grade returns empty results.
Cause: Hooks not capturing sessions, or no sessions since last ingest.
Solution:
- Run
selftune doctorto verify hook installation - Run
selftune ingest claude --forceto re-ingest - Check
~/.claude/for telemetry JSONL files
Evolution proposes no changes
Cause: Eval set too small or skill already well-tuned.
Solution:
- Run
selftune eval generate --skill <name> --max 50for a larger eval set - Check
selftune status— if pass rate is >90%, evolution may not be needed - Try
selftune evolve bodyfor deeper structural changes
Dashboard won't serve
Error: Port already in use or blank page.
Solution:
- Try a different port:
selftune dashboard --port 3142 - Check if another process holds the port:
lsof -i:3141 - Use
--no-opento start the server without opening a browser
Negative Examples
These should NOT trigger selftune — note that several are near-misses that share keywords but need different solutions:
- "Fix this React hydration bug" — general debugging, not skill improvement
- "Create a PowerPoint about Q3 results" — this is pptx skill, not selftune
- "Run my unit tests" — project tests, not skill eval tests (even though selftune has "eval unit-test", this is about *project* tests)
- "How do I use the Research skill?" — skill *usage*, not skill *improvement* (route to the Research skill itself)
- "Generate a report from this data" — content generation, not skill evolution
- "My build is failing" — project issue, not selftune health issue (even though "failing" overlaps with skill diagnostics language)
- "Evaluate this code for security issues" — "evaluate" here means code review, not session grading
- "Improve this function's performance" — code optimization, not skill optimization (even though "improve" and "performance" are selftune keywords)
The key distinction: selftune is about improving *skills themselves* (their descriptions, triggers, and execution quality). If the user is trying to accomplish a task *using* a skill, route to that skill instead.
Resource Index
| Resource | Purpose | When to read |
|---|---|---|
SKILL.md | This file — routing, triggers, quick reference | Always loaded |
Workflows/*.md | Step-by-step instructions for each workflow | When routing to a workflow |
agents/diagnosis-analyst.md | Deep-dive skill failure analysis | Spawn when doctor/grades show persistent issues |
agents/pattern-analyst.md | Cross-skill conflict detection | Spawn when composability flags conflicts |
agents/evolution-reviewer.md | Safety gate for evolution proposals | Spawn before deploying high-stakes evolutions |
agents/integration-guide.md | Guided setup for complex projects | Spawn for monorepos, multi-skill setups |
Workflows/Quickstart.md | Guided onboarding: init, ingest, status | First-time setup for new users |
Workflows/Uninstall.md | Clean removal of selftune data and config | When removing selftune completely |
Workflows/RepairSkillUsage.md | Rebuild skill usage from source transcripts | When skill usage data seems inaccurate |
Workflows/Recover.md | Recover SQLite from legacy/exported JSONL | When rebuilding or backfilling SQLite |
Workflows/Contributions.md | Manage creator-directed sharing preferences | When approving or revoking creator contribution |
Workflows/CreatorContributions.md | Manage bundled selftune.contribute.json configs | When preparing a skill package for creator contributions |
Workflows/ExportCanonical.md | Export canonical telemetry for downstream use | When exporting data for external consumption |
Workflows/Hook.md | Manual hook invocation for debugging | When debugging or testing hooks manually |
Workflows/PlatformHooks.md | Non-Claude-Code platform hook install/config | When setting up Codex, OpenCode, Cline, or Pi hooks |
references/logs.md | Log file formats (telemetry, usage, queries, audit) | When parsing or debugging log files |
references/grading-methodology.md | 3-tier grading model, evidence standards | When grading sessions or interpreting grades |
references/invocation-taxonomy.md | 4 invocation types, coverage analysis | When analyzing trigger coverage |
references/interactive-config.md | Pre-flight config pattern, model tiers | Before running mutating workflows |
references/setup-patterns.md | Platform-specific setup patterns | During complex setup scenarios |
Workflows/Registry.md | Registry — team skill distribution commands | When routing to registry workflow |
settings_snippet.json | Claude Code hook configuration template | During initialization |
assets/*.json | Config templates (activation rules, settings) | During initialization |