Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Harness Core

ASecurity

Core harness library providing standardized self-verification, checkpoint management, drift detection, and audit logging utilities for all NeuroClaw skills. This is NOT directly called by users; instead, it is imported as a Python module by other skills for harness-compliant execution, validation, and reproducibility. Use this as a foundation/plugin SDK when building or enhancing other skills. Triggers: none (library import only). This skill provides: HarnessController class, VerificationRunn...

171 stars
0 votes
0 copies
0 views
Added 9/6/2026
ai-agentspythongorailsapi

Works with

api

Security Analysis

A100/100

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

Scanned 9/6/2026

$npx -y skills add BioTender-max/awesome-bio-agent-skills --skill harness-core --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Harness Core?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Harness Core
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/biotender-max-harness-core/badge)](https://www.skillsdirectory.com/skills/biotender-max-harness-core)

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

Download with Pro
Files
SKILL.md
---
name: harness-core
description: "Core harness library providing standardized self-verification, checkpoint management, drift detection, and audit logging utilities for all NeuroClaw skills. This is NOT directly called by users; instead, it is imported as a Python module by other skills for harness-compliant execution, validation, and reproducibility. Use this as a foundation/plugin SDK when building or enhancing other skills. Triggers: none (library import only). This skill provides: HarnessController class, VerificationRunner, CheckpointManager, DriftDetector, AuditLogger, DependencyManifest, and related utilities."
license: MIT License (NeuroClaw custom skill – freely modifiable within the project)
layer: base
skill_type: tool
dependencies: []
---
# Harness Core Library

## Overview

`harness-core` is the **base SDK / plugin library** for implementing NeuroClaw harness engineering standards across all skills.

Instead of reimplementing validation, checkpointing, logging, and drift detection in every skill, `harness-core` provides reusable, well-tested Python classes and utilities that all other skills can import and extend.

**Key design principle**: Harness-awareness is **not optional** — every data-processing, model-execution, and experiment-running skill should import from this library to achieve:
- Standardized self-verification across all skills
- Reproducible, hash-verified experiment logs
- Automatic checkpoint/resume capability
- Drift detection and anomaly alerts
- Privacy-preserving audit trails

### When to Use This Skill

**Directly**: Rarely — this is a library, not a user-facing skill.

**Indirectly (as a dependency)**: 
- When developing or modifying skills like `experiment-controller`, `run_models`, `fmri-skill`, `smri-skill`, etc.
- When using skills that have been enhanced to support harness engineering
- When integrating external tools or models into NeuroClaw (inherit harness patterns)

## Core Components

### 1. HarnessController (Main Orchestrator)

**Purpose**: Manages the full lifecycle of harness-compliant execution.

**Usage**:
```python
from skills.harness_core import HarnessController

controller = HarnessController(
    task_name="fmri_preprocessing",
    session_id="exp_20260405_143000",
    checkpoint_dir="./checkpoints",
    log_dir="./logs"
)

# Automatic environment snapshot capture
controller.initialize()

# Define task phases
controller.add_phase("quality_check", description="Verify input BIDS compliance")
controller.add_phase("preprocessing", description="Apply fMRI preprocessing")
controller.add_phase("feature_extraction", description="Extract ROI time series")

# Execute with auto-checkpointing
for phase_name in ["quality_check", "preprocessing", "feature_extraction"]:
    try:
        phase = controller.get_phase(phase_name)
        result = execute_phase(phase.name)  # User-defined function
        controller.record_phase_success(phase_name, result)
        controller.save_checkpoint(f"after_{phase_name}")
    except Exception as e:
        controller.record_phase_failure(phase_name, str(e))
        controller.save_checkpoint(f"failed_{phase_name}")
        raise

# Auto-generates: audit_report.md, environment_manifest.json, checkpoints/
```

### 2. VerificationRunner

**Purpose**: Automated validation module with pluggable check functions.

**Usage**:
```python
from skills.harness_core import VerificationRunner

verifier = VerificationRunner(task_type="fmri_preprocessing")

# Built-in checks
verifier.add_check("bids_compliance", 
    checker=lambda data: check_bids_format(data),
    severity="error"  # or "warning"
)

verifier.add_check("data_integrity",
    checker=lambda data: check_nan_inf(data),
    severity="error"
)

verifier.add_check("statistical_bounds",
    checker=lambda data: check_intensity_range(data, min=-10, max=10),
    severity="warning"
)

# Run all checks; returns VerificationReport
report = verifier.run(output_data)

if report.failed:
    print(f"Verification FAILED: {report.summary}")
else:
    print(f"All checks passed. Confidence: {report.confidence_score}")
```

### 3. CheckpointManager

**Purpose**: Handles saving/loading of execution state with compression and integrity verification.

**Usage**:
```python
from skills.harness_core import CheckpointManager

checkpoint_mgr = CheckpointManager(
    checkpoint_dir="./checkpoints",
    compression="lz4",  # or "gzip", "zstd"
    hash_algorithm="sha256"
)

# Save state after each task
checkpoint_mgr.save(
    checkpoint_name="after_task_001",
    data={
        "model_state": model.state_dict(),
        "data_cache": processed_data,
        "metadata": {"task": "training", "epoch": 50}
    },
    overwrite=False  # Prevent accidental overwrites
)

# Resume from checkpoint
state = checkpoint_mgr.load("after_task_001")
model.load_state_dict(state["model_state"])
```

### 4. DriftDetector

**Purpose**: Monitor data and model behavior for distribution shifts.

**Usage**:
```python
from skills.harness_core import DriftDetector

detector = DriftDetector(
    reference_data=training_data,
    detector_type="kl_divergence"  # or "ks_test", "wasserstein"
)

# Run detection on new/inference data
drift_report = detector.detect(new_data)

if drift_report.drift_detected:
    print(f"⚠️  Drift detected: KL divergence = {drift_report.divergence}")
    if drift_report.severity == "critical":
        trigger_retraining_alert()
```

### 5. AuditLogger

**Purpose**: Structured, privacy-preserving logging for reproducibility and compliance.

**Usage**:
```python
from skills.harness_core import AuditLogger

logger = AuditLogger(
    log_file="./logs/experiment_audit.jsonl",
    pii_scrubber=True  # Auto-redact sensitive info
)

logger.log_event(
    event_type="skill_execution",
    skill_name="fmri_preprocessing",
    status="started",
    timestamp="2026-04-05T14:22:00Z",
    metadata={"input_file": "sub-001_task-rest_bold.nii.gz", "subjects": 100}
)

logger.log_validation(
    task_name="preprocessing",
    checks_passed=45,
    checks_failed=0,
    warnings=2,
    artifacts_hash={"output_data_sha256": "abc123..."}
)
```

### 6. DependencyManifest

**Purpose**: Generate and verify reproducible dependency specifications.

**Usage**:
```python
from skills.harness_core import DependencyManifest

manifest = DependencyManifest(environment_name="neuroclaw-dl")

# Auto-capture current environment
manifest.capture_current_environment()

# Export to multiple formats
manifest.export_to_conda_yml("environment-lock.yml")
manifest.export_to_pip_txt("requirements-pinned.txt")
manifest.export_to_json("DEPENDENCY_MANIFEST.json")

# Verify environment matches manifest
verified = manifest.verify_current_environment(strict=True)
print(f"Environment verified: {verified.status}")
if not verified.matched:
    print(f"Mismatches: {verified.mismatches}")
```

## Python API Reference

### HarnessController

```python
class HarnessController:
    def __init__(self, task_name, session_id, checkpoint_dir, log_dir):
        """Initialize harness controller."""
    
    def initialize(self):
        """Capture environment snapshot and setup logging."""
    
    def add_phase(self, phase_name, description=""):
        """Register a task phase."""
    
    def execute_phase(self, phase_name, func, *args, **kwargs):
        """Execute function and record result."""
    
    def record_phase_success(self, phase_name, result):
        """Log successful phase completion."""
    
    def record_phase_failure(self, phase_name, error_msg):
        """Log phase failure with error details."""
    
    def save_checkpoint(self, checkpoint_name):
        """Save execution state checkpoint."""
    
    def load_checkpoint(self, checkpoint_name):
        """Restore execution state from checkpoint."""
    
    def finalize(self):
        """Generate final audit report and cleanup."""
```

### VerificationRunner

```python
class VerificationRunner:
    def __init__(self, task_type):
        """Initialize verification runner."""
    
    def add_check(self, check_name, checker, severity="error"):
        """Register a validation check function."""
    
    def run(self, data):
        """Execute all checks; return VerificationReport."""
```

### DriftDetector

```python
class DriftDetector:
    def __init__(self, reference_data, detector_type="kl_divergence"):
        """Initialize drift detector."""
    
    def detect(self, new_data):
        """Run drift detection; return DriftReport."""
```

### AuditLogger

```python
class AuditLogger:
    def __init__(self, log_file, pii_scrubber=True):
        """Initialize audit logger."""
    
    def log_event(self, event_type, **kwargs):
        """Log a structured event."""
    
    def log_validation(self, task_name, **kwargs):
        """Log validation results."""
```

## Integration Best Practices

### For Skill Developers

When creating a new skill or enhancing an existing one:

**1. Import harness-core utilities:**
```python
from skills.harness_core import (
    HarnessController,
    VerificationRunner,
    CheckpointManager,
    AuditLogger
)
```

**2. Wrap main execution in HarnessController:**
```python
def run_skill(input_data, config):
    controller = HarnessController(
        task_name="my_skill",
        session_id=generate_session_id(),
        checkpoint_dir="./checkpoints",
        log_dir="./logs"
    )
    
    controller.initialize()
    
    try:
        result = process_data(input_data)  # Your skill logic
        controller.record_phase_success("processing", result)
        return result
    finally:
        controller.finalize()
```

**3. Add self-verification:**
```python
verifier = VerificationRunner("my_skill_output")
verifier.add_check("output_shape", lambda r: r.shape == expected_shape)
verifier.add_check("no_nan", lambda r: not np.isnan(r).any())

report = verifier.run(result)
if not report.passed:
    raise ValueError(f"Verification failed: {report.summary}")
```

**4. Enable checkpointing for long tasks:**
```python
checkpoint_mgr = CheckpointManager("./checkpoints")

for epoch in range(max_epochs):
    train_one_epoch()
    if epoch % checkpoint_frequency == 0:
        checkpoint_mgr.save(f"epoch_{epoch}", {"model": model, "epoch": epoch})
```

### For Users / Experiment Runners

When executing a skill enhanced with harness-core:

1. **Audit logs are automatically generated** in `./logs/`
2. **Checkpoints are auto-saved** in `./checkpoints/`
3. **Environment manifests** (conda/pip specs) are captured in `experiment_metadata/`
4. **Reproducibility is guaranteed**: Re-run with same input data + environment → identical results

## Output Files Generated

Every harness-compliant skill execution generates:

```
experiment_20260405_143000/
├── audit_report.md                 # Human-readable summary
├── environment_manifest.json        # Dependencies snapshot
├── DEPENDENCY_MANIFEST.json         # Full version specs
├── requirements-pinned.txt          # Pip format
├── environment-lock.yml             # Conda format
├── task_manifest.json               # Task DAG + success/failure status
├── checkpoints/
│   ├── after_phase_001.pkl
│   ├── after_phase_002.pkl
│   └── checkpoint_metadata.json
├── logs/
│   ├── audit.jsonl                  # Structured event log
│   └── verification_report.json     # All validation checks
├── outputs/
│   ├── result_data.pkl
│   └── result_hash_verification.json
└── drift_detection_log.jsonl        # (if applicable)
```

## Installation & Integration

**This skill is provided as a Python package.** Integration steps:

1. **Already included in workspace**: `skills/harness-core/` folder
2. **For other skills to import**:
   ```python
   import sys
   sys.path.insert(0, '{workspace_root}/skills/harness-core')
   from harness_core import HarnessController, VerificationRunner, ...
   ```

3. **Or use relative imports within skills**:
   ```python
   from ..harness_core import HarnessController
   ```

## Extending Harness Core

To add custom checks, verifiers, or detectors:

```python
from skills.harness_core import VerificationRunner

class CustomVerifier(VerificationRunner):
    def add_domain_specific_check(self, data):
        """Add domain-specific validation."""
        self.add_check(
            "my_domain_constraint",
            checker=lambda d: validate_domain(d),
            severity="error"
        )
```

---

Created At: 2026-04-05 01:48 HKT  
Last Updated At: 2026-04-05 02:01 HKT
Author: chengwang96

Attribution

BioTender-maxBioTender-max
View sourceSee grades on GitHubMore from BioTender-max →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →