/cc-skills-utils:mainfrom cc-skills-utils
Main Cognitive Steering Framework - system health checks and workspace validation (with optional enforcement hooks)
Ships in cc-skills-utils. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
| Mode | Trigger | Enforcement |
|---|---|---|
| Advisory | /main | No hook enforcement |
| Enforced | /main-hooks | PreToolUse gate validates Bash calls to main_health.py |
Both modes run the same health checks. The --hooks flag enables hook enforcement for any invocation.
When /main is invoked, IMMEDIATELY execute:
python P:/packages/.claude-marketplace/plugins/cc-skills-utils/skills/main/scripts/main_health.py
Step 1: Parse CLI flags (from the invocation or infer from context):
| Flag | When to use |
|---|---|
| (none) | Runs cleanup.py --dry-run first, then all health checks |
--quick | Skip slow checks (<5s), still runs cleanup first |
--fix | Auto-remediate safe issues |
--dry-run | Preview what --fix would do (cleanup only) |
--json | Machine-readable output |
--deps | Include dependency audit (CVEs) |
--skip-cve | Skip CVE remediation check |
--quiet | Just pass/fail status line |
--history | Show health score trend |
--upgrade | Upgrade safe packages (minor/patch) |
--upgrade-all | Upgrade all packages including majors |
--suggest | Show skill suggestions at end of run |
Step 2: Run main_health.py.
On invocation (no flags), main_health.py runs cleanup.py --dry-run first with full interactive output, then proceeds to all health checks.
Step 3: Display results — pass through the script's own output verbatim. The script formats its own results.
Step 4: Reflection (opt-in) — do NOT auto-invoke /reflect. After displaying results, ask the user once: "Run /reflect to capture session learnings? (y/n)". Invoke only on explicit affirmation. Skip the prompt entirely if --quick was used.
Execution notes:
main_health.py runs cleanup.py --dry-run first (full interactive output), then all health checksmain_health.py internally runs checks sequentially (core checks always, slow checks skipped in --quick mode)main_health.py handles its own error isolation — individual check failures don't crash the runmain_health.py subprocess calls: pip-audit, pip list, pip install, cleanup.pymain_health.py process exit code: 0 on successful run (regardless of warning/critical findings — those are content, not process failure). main() returns 0/1/2 internally for in-process callers; the script's CLI entry point always exits 0 unless it crashed.DO NOT:
| Command | Description |
|---|---|
python main_health.py | Runs cleanup.py --dry-run first, then all health checks |
python main_health.py --quick | Skip slow checks (<5s) |
python main_health.py --fix | Auto-remediate safe issues |
python main_health.py --dry-run | Preview what --fix would do |
python main_health.py --json | Machine-readable output |
python main_health.py --deps | Include dependency audit (CVEs) |
python main_health.py --outdated | Check for outdated packages |
python main_health.py --skip-cve | Skip CVE remediation check |
python main_health.py --quiet | Just pass/fail status line |
python main_health.py --history | Show health score trend |
python main_health.py --upgrade | Upgrade safe packages (minor/patch) |
python main_health.py --upgrade-all | Upgrade all packages including majors |
python main_health.py --suggest | Show skill suggestions at end of run |
| Check | What It Validates |
|---|---|
| settings | settings.json size, env vars, hooks count |
| hooks | Timeout rates, latency, log bloat |
| workspace | RESTORE_CONTEXT.md, git locks, uncommitted changes |
| cks | Entry count, embedding coverage, staleness |
| skills | Duplicate triggers, alias collisions |
| cve_remediation | pip-audit --fix --dry-run for remediation options |
| filesystem | Filesystem violations (JSON parse of cleanup.py --json --max 100); default invocation runs cleanup.py --dry-run interactively first |
| spec_drift | SKILL.md execution directives reference scripts that don't exist |
| skill_deps | Skill depends_on_skills/suggest references point to missing skills |
| wiki | Wiki vault health — contradictions, orphan pages, broken wikilinks, stale claims (/wiki lint) |
| env_audit | P:/.env presence. File missing/unreadable -> CRITICAL, fail fast (exit 2). No per-key assertion: cc-ccr sources CCR_LOCAL_KEY + provider keys from .env at launch and sets ANTHROPIC_BASE_URL/API_KEY/AUTH_TOKEN itself, so no individual key is universally required. |
| class_a_gate | Class A RCA gate (diagnostic_analysis_quality) decision counts since 0.2.61 — sole source is stop_gate_telemetry.jsonl (diagnostics.db is blind to in-process gates). Informational; surface so the count can't be forgotten between runs. |
| identity_handshake | identity.json for the current terminal matches live CLAUDE_SESSION_ID — stale data misdirects snapshot/CHS/GTO/recap readers. Healthy no-op when run outside a live session. Ported from retired /plugin-doctor. |
| Score | Status | Action |
|---|---|---|
| >=80% | HEALTHY | All systems operational |
| 50-79% | WARNING | Investigate warnings |
| <50% | CRITICAL | Immediate attention required |
Exit Codes: 0 = healthy, 1 = warnings, 2 = critical
Inline Skill Suggestions: When a check fails, actionable skill suggestions appear inline below the check output as 💡 Run /skill-name. Suggestions are capped at 3 per check to avoid verbosity. Use --suggest to see a consolidated summary of all suggestions at end of run.
Periodic Problem Tracking: For ongoing awareness of accumulating issues, consider running /top-problems --diff periodically. The /main health check covers system infrastructure; /top-problems covers evidence-accumulated risks from sessions, premortems, and critiques.
Behavioral Audit Over History: Run /main-review weekly (or after debugging-heavy sessions) for a slower, evidence-first audit of recent transcripts, the diagnostics DB, and gate telemetry — it finds unsupported claims, inert/silent gates, receipt mismatches, regression candidates, and promotion candidates that real-time infrastructure checks can't see. /main probes current state; /main-review probes behavior over the recent window.
Permission Prompt Hygiene: Run /fewer-permission-prompts if it has been more than 5 days since the last run. This scans recent transcripts and refreshes the read-only allowlist in P:/.claude/settings.json to reduce unnecessary prompts. The last known run was 2026-04-19 — run the command to check current transcript coverage if uncertain.
CLAUDE.md Health: Run /claude-md-management:claude-md-improver if it has not been used in more than 5 days. Audits all CLAUDE.md files in the repo, scores them against a quality rubric, and proposes targeted improvements. Run after any significant project structure changes or before major development pushes.
Hook Observability: Run /hook-obs monthly to monitor hook performance and behavioral compliance. Use stats, health, blocks, and escalation for focused diagnostics. The /main health checks provide a compact infrastructure snapshot (timeouts, latency, log bloat); /hook-obs provides deep event-level diagnostics and compliance trends. (Legacy alias: /hook-audit.)
Session Insights: Run /insights monthly to analyze Claude Code session patterns and identify usage trends. Provides visibility into how the system is being used and where workflow improvements may exist.
| Category | Thresholds |
|---|---|
| Settings | Lines <=900, Size <=35KB, Hooks <=60, No dead env vars |
| Hooks | Timeout rate <=20%, Avg latency <=2000ms, Log dir <=10MB |
| CKS | Min entries >=100, Embedding coverage >=90%, Stale: 7 days |
| Workspace | No RESTORE_CONTEXT.md, No stale locks, Uncommitted <=20 |
For comprehensive documentation on each subsystem, see:
| File | Contents |
|---|---|
references/health-check-commands.md | Full command reference, auto-fix details, package upgrades, hook system skills, legacy commands |
references/narrative-intent-detector.md | Narrative intent detector phase migration, behavioral safety verification tests |
references/context-reuse-monitoring.md | Context reuse monitoring procedures, regression detection, tuning guide |
HISTORY.md | Archived sections (Serena validation, arch recommendation gate, system roadmap) |
HISTORY.md (opens in a new tab)references/context-reuse-monitoring.md (opens in a new tab)references/health-check-commands.md (opens in a new tab)references/narrative-intent-detector.md (opens in a new tab)scripts/_health_report.json (opens in a new tab)scripts/check_dream_cycle_findings.py (opens in a new tab)scripts/check_skill_sizes.py (opens in a new tab)scripts/cleanup.py (opens in a new tab)scripts/competence_health_check.py (opens in a new tab)scripts/env_audit.py (opens in a new tab)scripts/health_check.py (opens in a new tab)scripts/hook_health_check.py (opens in a new tab)scripts/main_health.py (opens in a new tab)scripts/repo_upstream_check.py (opens in a new tab)scripts/settings_health_check.py (opens in a new tab)scripts/skill_collision_check.py (opens in a new tab)scripts/suggest_target_check.py (opens in a new tab)scripts/tests/test_main_health.py (opens in a new tab)scripts/tests/test_wiki_health.py (opens in a new tab)scripts/wiki_health_check.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (enduser123/cc-skills-utils) — no native marketplace selected
npx claudepluginhub p/enduser123-cc-skills-utils8 skills in this plugin
/main-reviewSlow, evidence-first maintenance auditor for the main skill family — inspects recent transcripts, diagnostics, and gate telemetry to find unsupported claims, inert gates, receipt mismatches, and regression/promotion candidates.