A self-improving agent skill system for Claude Code. Helix treats skills as hypotheses, sessions as experiments, and uses an evolution loop (mutate, test, score, keep/discard) to continuously improve skill performance over time.
Helix integrates with Claude Code's hooks system to automatically:
- Plan sessions -- On startup, Helix loads skills, builds a dependency graph, assigns tournament variants, and injects skill context into Claude's conversation.
- Collect signals -- During the session, every tool use, user message, permission denial, and correction is logged to a JSONL event stream.
- Score performance -- On session end, Helix computes completion, correction, and efficiency signals, normalizes against a historical baseline, and produces a composite score.
- Evolve skills -- Scores feed into active tournaments that compare baseline skills against mutant variants. Winners promote; losers are archived (never deleted).
SessionStart SessionEnd
| |
v v
Load skills Read event log
Build graph Compute signals
Assign variants Normalize + score
Inject context -----> Session -----> Feed tournaments
(tool use, |
messages, v
corrections) Promote winners
Helix is a 5-layer stack. Each layer depends only on the layers below it.
| Layer | Directory | Purpose |
|---|---|---|
| 1. Federated State | src/state/ |
Path resolution, config loading with cascade (project -> global -> defaults) |
| 2. Skill Registry | src/skills/ |
Skill parsing, validation, typed contracts |
| 3. Orchestrator | src/orchestrator/, src/graph/ |
Dependency graph, pipeline assembly, advisory reconciliation |
| 4. Metrics Collector | src/metrics/ |
Event logging, signal computation, scoring, session finalization |
| 5. Evolution Engine | src/evolution/ |
Tournaments (5A), mutation generation (5B), variant lifecycle |
| -- Discovery | src/discovery/ |
K-means clustering + LLM-assisted skill discovery from session data |
| -- Hooks Integration | src/hooks/ |
Wires layers 1-5 into Claude Code's session lifecycle |
- Node.js >= 20
- A project where you use Claude Code
# Clone and build
git clone <repo-url> helix
cd helix
npm install
npm run build
npm link # makes 'helix' available as a command
# Initialize in your project
cd /path/to/your/project
helix inithelix init does three things:
- Creates
.helix/withskills/,sessions/,tournaments/, and a defaultconfig.yaml - Copies the 6 built-in skills into
.helix/skills/ - Writes hook registrations to
.claude/settings.local.json(project-scoped, not committed to git)
# Check if Helix is working and how skills are performing
helix status
# List recent sessions with scores
helix sessions
helix sessions 50 # show last 50
# Deep dive into a single tournament
helix tournament debugging
# Run tournament evaluation on accumulated session data
helix evolve
# Scan for mutation candidates (skills that could improve)
helix mutate
# Generate a variant for a specific skill
helix mutate debugging
# List pending variants awaiting approval
helix mutate --list
# Approve or reject a variant
helix mutate --approve debugging/v1
helix mutate --reject debugging/v1
# Import sessions from existing Claude Code transcripts
helix import # auto-discover for current project
helix import path/to/session.jsonl # import specific file
# Discover new skills from session patterns
helix discover # local mode (K-means, zero tokens)
helix discover --llm # LLM-assisted discovery
helix discover --auto # LLM + auto-approve (full pipeline)
helix discover --list # show pending candidates
helix discover --approve exploration # approve a candidate
helix discover --reject exploration # reject a candidate
# View and edit configuration
helix config # show all config values
helix config get evolution.auto_mutate
helix config set evolution.auto_mutate true
# Auto-generate mutations for underperforming skills
helix mutate --auto
# Machine-readable output (works with status, sessions, tournament, import, config)
helix status --json
helix sessions --json
# Remove Helix hooks (preserves session data and tournaments)
helix deinithelix deinitRemoves Helix hook entries from .claude/settings.local.json but preserves .helix/ (your session data and tournament history are kept).
Helix ships with 6 baseline skills that cover the core development loop:
| Skill | Triggers On | Purpose |
|---|---|---|
| task-understanding | Any input (low confidence) | Clarify requirements before acting |
| implementation | Build/implement patterns | Write code following project conventions |
| testing | Test/spec/coverage patterns | Write tests that verify behavior |
| code-review | Review/check patterns | Review for correctness and convention adherence |
| debugging | Error/bug/fail patterns (high confidence) | Diagnose systematically without guessing |
| verification | Post-implementation | Verify work before claiming completion |
Skills are structured markdown files with typed YAML contracts defining inputs, outputs, triggers, dependencies, and metrics. See any file under skills/ for the format.
Helix loads config from .helix/config.yaml with these defaults:
score_weights:
completion: 0.4 # task done, tests passed, committed
correction: 0.35 # human overrides, permission denials
efficiency: 0.25 # tool use relative to baseline
gates:
tier1_min_sessions: 5
tier1_outlier_threshold: 0.15
tier2_min_sessions: 12
tier2_p_value: 0.1
tier3_min_sessions: 20
tier3_p_value: 0.05
efficiency_baseline_window: 20 # sessions for normalization
evolution:
dormancy_days: 14
margin_delta: 0.01
auto_mutate: false
max_active_variants: 3Tiers control statistical rigor: Tier 1 uses deterministic comparison (fast, low confidence), Tier 2 uses bootstrap resampling, and Tier 3 requires more sessions and a tighter p-value. Skills promote through tiers as evidence accumulates.
When Claude Code starts a session with Helix installed:
-
SessionStart fires -> Helix loads the skill registry, builds the dependency graph, runs the orchestrator to produce a pipeline, assigns tournament variants (baseline vs. mutant), writes a
session_planevent to JSONL, and returns skill bodies asadditionalContextinjected into Claude's context. -
Mid-session events (UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, PermissionDenied) are appended to the session's JSONL log.
-
SessionEnd fires -> Helix reads the session plan back from JSONL, calls
finalizeSessionto compute signals and a composite score, saves aSessionLog, and feeds the score into any active tournaments the session participated in.
On resume, Helix skips re-planning and re-injects the same skill context by reading the existing session_plan event.
The evolution engine runs tournaments to compare skill variants:
- Mutation -- Identify underperforming skills, assemble context (baseline, failure patterns, tournament history), generate a variant.
- Assignment -- Each new session is blindly assigned to either the baseline or a variant arm (stratified deficit counter + seeded RNG prevents bias).
- Evaluation -- After enough sessions, the evaluator compares arms using tier-graduated statistical tests.
- Promotion -- Winners replace the baseline. Losers are archived (never deleted -- full audit trail).
- Dormancy -- Skills with no recent sessions are honestly reported as dormant rather than silently stale.
Key principles:
- Skills are hypotheses, sessions are experiments
- Blind assignment prevents placebo effects
- Archival not deletion (rollback always possible)
- Human veto at every gate
- Federated evolution (project-local -> global with evidence)
helix/
src/
state/ Config loading, path resolution
skills/ Parser, registry, validator
graph/ Dependency graph, resolver, pipeline assembly
orchestrator/ Pipeline orchestration, advisory reconciliation
metrics/ Event logging, signals, scoring, finalization
evolution/ Tournaments, assignment, evaluation, mutation
discovery/ Skill discovery from session data (K-means, LLM)
hooks/ Session lifecycle handlers, CLI router, installer
index.ts Barrel exports
skills/ 6 built-in baseline skills
tests/ 430 tests across 57 files
state/ Config, paths
skills/ Parser, registry, validator
graph/ Graph, resolver, pipeline
orchestrator/ Orchestrator, advisory
metrics/ Signals, corrections, scoring, finalization, normalization
evolution/ Tournaments, assignment, evaluation, mutation, bootstrap
discovery/ Features, K-means, interpreter, LLM, candidate store, skill writer
hooks/ Handler, session-start, session-end, install
integration/ Full pipeline, evolution, mutation, metrics, session lifecycle
docs/
specs/ Design specifications
plans/ Implementation plans
# Install dependencies
npm install
# Run tests (430 tests, 57 files)
npm test
# Watch mode
npm run test:watch
# Build
npm run build- Foundation Design -- Layers 1-4, skill contracts, orchestrator
- Tournament Runner Design -- Layer 5A, tier-graduated evaluation
- Mutation Engine Design -- Layer 5B, variant generation
- Session Lifecycle Hooks Design -- End-to-end integration with Claude Code
- Skill Discovery Design -- Mining session data for new skill categories
MIT