Performs comprehensive diagnostics on the codex cache system, detects issues, and can fix them automatically with repair operations. Delegates to fractary CLI for health checks and diagnostics.
Runs comprehensive diagnostics on the codex cache system, detecting issues with cache integrity, configuration, performance, storage, and dependencies. Use when cache problems occur or to verify system health; can automatically fix detected issues with the --fix flag.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-codex@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/run-health-check.shYour responsibility is to perform comprehensive diagnostics on the cache system by delegating to the cli-helper skill which invokes the fractary codex health CLI command.
Architecture (v4.0):
cache-health skill
↓ (delegates to)
cli-helper skill
↓ (invokes)
fractary codex health
↓ (uses)
@fractary/codex SDK (CacheManager, ConfigManager, SystemChecker)
This provides comprehensive health diagnostics including cache integrity, configuration validity, performance assessment, storage analysis, and system dependencies via the TypeScript SDK. </CONTEXT>
<CRITICAL_RULES>
Construct arguments array from inputs:
args = ["health"]
// Add category filter if specified
if (check_category && check_category !== "all") {
args.push("--category", check_category)
}
// Add verbose flag
if (verbose) {
args.push("--verbose")
}
// Add fix flag
if (fix) {
args.push("--fix")
}
USE SKILL: cli-helper Operation: invoke-cli Parameters:
{
"command": "health",
"args": [...category_filter, ...verbose_flag, ...fix_flag],
"parse_output": true
}
The cli-helper will:
fractary codex health [--category <c>] [--verbose] [--fix] --jsonThe CLI returns JSON like:
{
"status": "success",
"operation": "health-check",
"cache": {
"status": "pass",
"checks": [
{"name": "directory_exists", "status": "pass"},
{"name": "index_valid", "status": "pass"},
{"name": "files_indexed", "status": "pass"},
{"name": "permissions_ok", "status": "pass"}
],
"issues": []
},
"config": {
"status": "pass",
"checks": [
{"name": "file_exists", "status": "pass"},
{"name": "valid_json", "status": "pass"},
{"name": "required_fields", "status": "pass"},
{"name": "ttl_valid", "status": "pass"}
],
"issues": []
},
"performance": {
"status": "warning",
"checks": [
{"name": "hit_rate", "status": "warning", "value": 68.5, "threshold": 70}
],
"issues": [
{
"severity": "medium",
"check": "hit_rate",
"message": "Cache hit rate below recommended threshold",
"details": "Current: 68.5%, Expected: > 70%",
"remediation": "Consider increasing TTL or prefetching common documents"
}
]
},
"storage": {
"status": "pass",
"checks": [
{"name": "disk_space", "status": "pass"},
{"name": "cache_size", "status": "pass"}
],
"issues": []
},
"system": {
"status": "pass",
"checks": [
{"name": "git_installed", "status": "pass"},
{"name": "jq_installed", "status": "pass"},
{"name": "network_available", "status": "pass"}
],
"issues": []
},
"overall": {
"status": "warning",
"checks_passed": 22,
"checks_total": 24,
"warnings": 2,
"errors": 0,
"exit_code": 1
},
"recommendations": [
"Increase TTL to improve cache hit rate",
"Consider prefetching frequently accessed documents"
],
"fixes_applied": []
}
IF status == "success":
IF status == "failure":
IF format == "json":
IF format == "formatted" (default):
IF persist == true:
Display formatted output to user.
COMPLETION: Operation complete when health check shown.
</WORKFLOW><COMPLETION_CRITERIA> Operation is complete when:
✅ For successful health check:
✅ For failed health check:
✅ In all cases:
🏥 Codex Health Check
═══════════════════════════════════════════════════════════
CACHE HEALTH ✓ Pass
───────────────────────────────────────────────────────────
✓ Directory exists and readable
✓ Index file valid
✓ All files indexed correctly
✓ File permissions correct
CONFIG HEALTH ✓ Pass
───────────────────────────────────────────────────────────
✓ Configuration file exists
✓ Valid JSON format
✓ Required fields present
✓ TTL values valid
PERFORMANCE HEALTH ⚠ Warning
───────────────────────────────────────────────────────────
⚠ Cache hit rate: 68.5% (threshold: 70%)
Remediation: Increase TTL or prefetch common documents
STORAGE HEALTH ✓ Pass
───────────────────────────────────────────────────────────
✓ Disk space sufficient (15.2 GB free)
✓ Cache size within limits (45.2 MB)
SYSTEM HEALTH ✓ Pass
───────────────────────────────────────────────────────────
✓ Git installed and accessible
✓ jq installed and working
✓ Network connectivity available
═══════════════════════════════════════════════════════════
OVERALL STATUS: ⚠️ Warning
Summary:
Checks passed: 22/24 (91.7%)
Warnings: 2
Errors: 0
Recommendations:
• Increase TTL to improve cache hit rate
• Consider prefetching frequently accessed documents
═══════════════════════════════════════════════════════════
🏥 Codex Health Check (with auto-fix)
═══════════════════════════════════════════════════════════
[... health check results ...]
FIXES APPLIED
───────────────────────────────────────────────────────────
✓ Removed 3 orphaned cache files
✓ Rebuilt 2 missing index entries
✓ Fixed permissions on cache directory
✓ Cleared 14 expired documents
Re-running health check to verify fixes...
[... updated health check results ...]
All issues resolved!
🏥 Cache Health Check
───────────────────────────────────────────────────────────
CACHE HEALTH ✓ Pass
───────────────────────────────────────────────────────────
✓ Directory exists and readable
✓ Index file valid
✓ All files indexed correctly
✓ File permissions correct
OVERALL STATUS: ✅ Healthy
Returns raw CLI JSON response (see Step 3 for structure).
🏥 Codex Health Check
═══════════════════════════════════════════════════════════
STORAGE HEALTH ❌ Critical
───────────────────────────────────────────────────────────
❌ Disk space critically low: 87 MB free (< 100 MB)
Remediation: Free up disk space immediately or expand storage
OVERALL STATUS: 🔴 Critical
IMMEDIATE ACTION REQUIRED:
1. Free up disk space (delete unused files)
2. Or expand storage capacity
3. Consider enabling compression
4. Clear expired cache entries
Run with --fix to attempt automatic cleanup
{
"status": "failure",
"operation": "health-check",
"error": "Health check failed",
"cli_error": {
"message": "Cannot read cache index",
"suggested_fixes": [
"Check file permissions",
"Rebuild cache index: fractary codex cache clear --all"
]
}
}
{
"status": "failure",
"operation": "health-check",
"error": "CLI not available",
"suggested_fixes": [
"Install globally: npm install -g @fractary/cli",
"Or ensure npx is available"
]
}
</OUTPUTS>
<ERROR_HANDLING>
When CLI reports cache doesn't exist:
When CLI reports permission issues:
When CLI reports disk space critical:
When CLI reports corrupted index:
fractary codex cache clear --allWhen CLI reports missing tools:
When cli-helper reports CLI unavailable:
When CLI returns error:
</ERROR_HANDLING>
<DOCS_MANAGE_AUDIT_INTEGRATION>
When the --persist flag is provided, invoke docs-manage-audit to create a persistent audit report:
USE SKILL: docs-manage-audit
Operation: create
Parameters: {
"audit_type": "system",
"check_type": "cache-health",
"audit_data": {
"audit": {
"type": "system",
"check_type": "cache-health",
"timestamp": "{ISO8601}",
"auditor": {
"plugin": "fractary-codex",
"skill": "cache-health"
}
},
"summary": {
"overall_status": "{health_status}",
"status_counts": {
"passing": {checks_passed},
"warnings": {warnings},
"failures": {errors}
}
},
"findings": {
"categories": [...],
"by_severity": {...}
},
"metrics": {
"cache_hit_rate": {percentage},
"avg_fetch_time_ms": {time},
"cache_size_mb": {size}
},
"recommendations": [...]
},
"output_path": "logs/health/"
}
This generates:
Both in logs/health/{timestamp}-cache-health.[md|json]
Benefits:
Success (Healthy):
🎯 STARTING: cache-health
Category: {category}
Fix mode: {enabled|disabled}
───────────────────────────────────────
[Health check results]
✅ COMPLETED: cache-health
Status: Healthy
Checks passed: {count}/{total}
Source: CLI (via cli-helper)
───────────────────────────────────────
Success (Warnings):
🎯 STARTING: cache-health
Category: {category}
Fix mode: {enabled|disabled}
───────────────────────────────────────
[Health check results with warnings]
⚠️ COMPLETED: cache-health (warnings)
Status: Warning
Checks passed: {count}/{total}
Warnings: {count}
Recommendations provided
Source: CLI (via cli-helper)
───────────────────────────────────────
Success (Errors):
🎯 STARTING: cache-health
Category: {category}
Fix mode: {enabled|disabled}
───────────────────────────────────────
[Health check results with errors]
❌ COMPLETED: cache-health (errors)
Status: Error
Checks passed: {count}/{total}
Errors: {count}
Fixes available with --fix flag
Source: CLI (via cli-helper)
───────────────────────────────────────
Failure:
🎯 STARTING: cache-health
───────────────────────────────────────
❌ FAILED: cache-health
Error: {error_message}
Suggested fixes:
- {fix 1}
- {fix 2}
───────────────────────────────────────
</DOCUMENTATION>
<NOTES>
v3.0 (bash scripts):
cache-health
└─ scripts/run-health-check.sh
├─ checks cache integrity
├─ validates configuration
├─ analyzes performance
├─ assesses storage
├─ verifies system deps
└─ applies fixes if requested
v4.0 (CLI delegation):
cache-health
└─ delegates to cli-helper
└─ invokes: fractary codex health
Benefits:
This skill delegates to:
fractary codex health [--category <category>] [--verbose] [--fix] --json
Via the CLI, this skill benefits from:
CacheManager.healthCheck() - Cache integrityConfigManager.validate() - Configuration checksPerformanceMonitor.assess() - Performance metricsStorageAnalyzer.check() - Storage analysisSystemChecker.verify() - Dependency checksCache Integrity:
Configuration Validity:
Performance Assessment:
Storage Analysis:
System Dependencies:
The CLI can automatically fix:
To test this skill:
# Ensure CLI installed
npm install -g @fractary/cli
# Run health check
USE SKILL: cache-health
Parameters: {
"check_category": "all",
"format": "formatted"
}
# Run with auto-fix
USE SKILL: cache-health
Parameters: {
"fix": true,
"verbose": true
}
# Run specific category
USE SKILL: cache-health
Parameters: {
"check_category": "performance",
"format": "json"
}
If health check fails:
fractary --versionfractary codex health.fractary/codex/?df -h
</NOTES>
Create employment contracts, offer letters, and HR policy documents following legal best practices. Use when drafting employment agreements, creating HR policies, or standardizing employment documentation.
Implement GDPR-compliant data handling with consent management, data subject rights, and privacy by design. Use when building systems that process EU personal data, implementing privacy controls, or conducting GDPR compliance reviews.