context-canary

Detects context degradation in long agent sessions using a per-turn canary signal and recovery protocol.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/ZimriJahdai/HaircutFiveFriends-Full --skill context-canary-zimrijahdai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-canary
Source: https://github.com/ZimriJahdai/HaircutFiveFriends-Full/tree/main/.claude/.agents/skills/context-canary
Command: npx skills add https://github.com/ZimriJahdai/HaircutFiveFriends-Full --skill context-canary-zimrijahdai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Context degradation in long AI sessions is silent and gradual: models stop attending to early instructions, compaction summaries drop standing instructions, and nothing announces the failure. This Skill installs a trivially checkable per-turn signal (a canary) so the moment context rot, drift, or compaction occurs, it becomes visible instead of silently corrupting your work. ## Core Features & Use Cases - Canary contract installation: Sets up a byte-stable first line on every response containing the user's name, a turn counter, and an honest self-check status (ctx ok / aging / thin), each field probing a different failure mode. - Trip detection and calibration: Distinguishes a single missed canary (warning) from a confirmed trip (two consecutive misses, counter discontinuity, or agent self-declaration) to avoid false alarms. - Recovery protocol: On a confirmed trip, checkpoints durable state to a file, re-anchors against project instructions, recommends a fresh session, and re-installs the canary with a new generation counter. - Use Case: At the start of a long refactoring session, ask the agent to install a context canary. Eighty turns later, after an auto-compaction event, the turn counter resets — you immediately know the summary dropped state and can checkpoint before continuing. ## Quick Start Ask the agent to install a context canary using your name so every reply starts with a name, turn counter, and context status line.

Frequently Asked Questions about context-canary

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect context rot in long AI agent sessions?

Install a context canary: a standing instruction like starting every reply with your name and a turn counter. Because compliance costs almost nothing, its disappearance is strong evidence that early instructions fell out of effective context.

What is a context canary for LLM conversations?

A context canary is a trivially checkable per-turn signal, such as a name prefix plus turn counter, whose only job is to fail visibly. When it goes missing or the counter breaks, it indicates instruction drift, compaction, or continuity loss.

How do I know if compaction dropped my agent's instructions?

Watch the canary's turn counter. Summaries rarely preserve exact counts, so a reset, skip, or vague counter after a compaction event reveals the discontinuity within a turn or two, even if the name instruction survives.

Does a working canary guarantee my context is healthy?

No. The test is one-sided: a missing canary is strong evidence of degradation, but a present canary is only weak evidence of health. Cheap stylistic habits can survive while harder constraints quietly rot, so stay suspicious past roughly half the context window.

What should I do when the context canary trips?

Stop trusting drifted state, checkpoint durable state (goal, decisions, files touched, next step) into a file, re-read project instructions, restate the task for user confirmation, then start a fresh session seeded with the checkpoint and reinstall the canary.

Should I put the canary in CLAUDE.md or agent memory files?

Only if you want a cross-session habit, and know it measures something different. A file-based canary survives compaction by design, so it tests file-instruction attention rather than conversation context survival. The session canary is the one that detects degradation.