noctrace: Skill for Claude Code

.claude/skills/context-health/SKILL.md

context-health is a skill for Claude Code from nyktora/noctrace. It costs 37 tokens per session (2,104 once invoked), scanned A, original, MIT.

A scoring algorithm that gives a Claude Code session an A–F context-health grade from its parsed activity, token use, compactions, tool calls, and timing.

In plain words
What is it for?
Use it when implementing or changing the health grade, health bar, compaction-boundary display, or score breakdown panel.
Why use it?
It shows when a session's working context is becoming less reliable, before the degradation is obvious in the output.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions Claude Code.

This is nyktora/noctrace's own configuration. It tells Claude Code how to work on noctrace itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything noctrace configures →

Part of the noctrace plugin — 5 skills, 4 agents, 1 MCP server shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to nyktora/noctrace. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nyktora/noctrace/main/.claude/skills/context-health/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nyktora/noctrace

Made for: Claude Code.

Or install noctrace, the plugin that ships this one along with the rest of its 5 skills, 4 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-health

README.md
[![agentmods](https://agentmods.dev/badge/skills/nyktora/noctrace/context-health/github.svg)](https://agentmods.dev/skills/nyktora/noctrace/context-health)
Your own site
<a href="https://agentmods.dev/skills/nyktora/noctrace/context-health"><img src="https://agentmods.dev/badge/skills/nyktora/noctrace/context-health/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-health

Your own site · 80×15
<a href="https://agentmods.dev/skills/nyktora/noctrace/context-health"><img src="https://agentmods.dev/badge/skills/nyktora/noctrace/context-health.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,104 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.02104
Opus 5 $0.00018 $0.01052
Sonnet 5 $0.00007 $0.00421
Haiku 4.5 $0.00004 $0.00210

Measured 11d ago against content hash 20f241f970c9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

context-health scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/context-health/SKILL.md · 223 lines

How it starts

The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Health Scoring Specification

Purpose

Compute a real-time A-F grade representing the health of a Claude Code session's context window. This warns developers when quality is degrading before they notice it in the output.

Input Data

All data comes from parsed JSONL records. The health scorer receives an array of parsed records (not raw lines) and computes the grade incrementally — it can be called after each new record to update the score.

interface HealthInput {
  assistantRecords: {
    timestamp: number;
    inputTokens: number;
    outputTokens: number;
  }[];
  compactionEvents: {
    timestamp: number;
    preTokens: number;
    trigger: "auto" | "manual";
  }[];
  toolCalls: {
    timestamp: number;
    toolName: string;
    filePath?: string; // for Read calls
    isError: boolean;
  }[];
  sessionStartTime: number;
  sessionEndTime: number | null; // null = still running
}

Signal Computations

1. Context Fill (weight: 40%)

function computeFillScore(input: HealthInput): number {
  const maxWindow = 200_000;
  // Use the most recent assistant record's input_tokens
  const latest = input.assistantRecords.at(-1);
  if (!latest) return 100; // no data = healthy
  const fillPct = latest.inputTokens / maxWindow;

  if (fillPct < 0.50) return 100;  // A
  if (fillPct < 0.65) return 80;   // B
  if (fillPct < 0.80) return 60;   // C
  if (fillPct < 0.90) return 40;   // D
  return 20;                        // F
}

2. Compaction Count (weight: 25%)

function computeCompactionScore(input: HealthInput): number {
  const count = input.compactionEvents.length;
  if (count === 0) return 100;  // A
  if (count === 1) return 75;   // B
  if (count === 2) return 55;   // C
  if (count === 3) return 35;   // D
  return 15;                     // F
}

3. Re-read Ratio (weight: 15%)

Track file paths from Read tool calls. A "re-read" is any Read call targeting a file path that was already read earlier in the session.

Read the full file on GitHub · 223 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 223 lines · 37 tokens per session scan A 20f241f970c9

Subscribe to this mod's changes

context-health is a skill published in the GitHub repository nyktora/noctrace (5 stars, last pushed 4mo ago), licensed MIT. It adds 37 tokens to every session and 2,104 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

langsmith-observability

LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.

davila7/claude-code-templates · 45 tokens

phoenix-observability

Open-source AI observability platform for LLM tracing, evaluation, and monitoring. Use when debugging LLM applications with detailed traces, running evaluations on datasets, or monitoring production AI systems with real-time insights.

davila7/claude-code-templates · 47 tokens

agent-inspect

Local evidence debugger and trajectory-test toolkit for TypeScript AI agents. Use when capturing framework-faithful traces, asserting TraceContract/TraceFacts, packaging Evidence v2, or inspecting local runs over read-only MCP (gettracefacts).

rajudandigam/agent-inspect · 52 tokens

sre-expert

Expert-level site reliability engineering, SLOs, incident management, and operational excellence. Use when the user mentions reliability, monitoring, incident management, SLOs, or observability, or when the task involves SRE Fundamentals, Reliability Practices, SRE Principles, or On-Call.

personamanagmentlayer/pcl · 63 tokens

debugging-workflow

Find the cause of a defect by hypothesis and bisection rather than by guessing, then fix it behind a regression test. Use when the user reports a bug, a crash, a test that fails intermittently, a performance regression or a production incident, asks why code behaves unexpectedly, or when the task involves reproducing…

personamanagmentlayer/pcl · 91 tokens

linkerd-expert

Expert-level Linkerd service mesh management, traffic control, reliability, and production operations. Use when the user mentions service mesh, Kubernetes, microservices, mTLS, or observability, or when the task involves Linkerd Architecture, Mesh Injection, Traffic Management, or Reliability Features.

personamanagmentlayer/pcl · 61 tokens