lazy-context-injection-reuse

Implement TTL-decayed triggers for deferred context injection in third-party API modes.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/liuyu520/cc_source --skill lazy-context-injection-reuse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lazy-context-injection-reuse
Source: https://github.com/liuyu520/cc_source/tree/main/.claude/skills/lazy-context-injection-reuse
Command: npx skills add https://github.com/liuyu520/cc_source --skill lazy-context-injection-reuse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reuse the lazy/deferred context injection pattern (module-scope trigger with TTL decay, multi-point hooks, first-full-then-short differential, lazy-stub + ranker + dormant gate for listing-type content, env var gating) when adding new content sections that should skip injection until needed, or reducing per-turn overhead for invariant/listing content in third-party API mode.

Core Features & Use Cases

  • Implements a TTL-decayed trigger at the module level to gate content injection with a configurable TTL and an override path via environment variables.
  • Provides multiple trigger surfaces (tool calls, slash commands, and REPL keyword triggers) and a first-full-then-short content strategy for listing-type content with a ranker, dormant gate, and folding behavior.
  • Includes a zero-serialization, resettable, module-scope state pattern with explicit reset functions to support cache clearing and test isolation.

Quick Start

Use the lazy-context-injection-reuse pattern to defer non-critical content until needed; trigger its loading via a tool call, a slash command, or a REPL keyword, then observe TTL-based decay.

Frequently Asked Questions about lazy-context-injection-reuse

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

FAQPage Schema
How do I reduce context window overhead for invariant content in third-party API mode?

Lazy context injection uses a module-scope TTL-decayed trigger to gate content loading until needed, applying a first-full-then-short differential strategy to reduce per-turn overhead for listing-type and invariant content in third-party API mode.

What is TTL-decayed context injection and how does it optimize loading?

TTL-decayed context injection is a module-scope trigger mechanism that gates content loading with a configurable time-to-live window, folding listing-type content via a dormant ranker to skip injection until explicitly needed.

How to set up lazy loading triggers for slash commands and REPL keywords?

Set up lazy loading triggers by implementing module-scope hooks across tool calls, slash commands, and REPL keyword surfaces, using a one-shot lazy stub and a dormant rescue path to gate content injection until triggered.

Can I customize TTL trigger behavior using environment variables?

Yes, you can customize TTL trigger behavior and reset it on cache clear using environment variable knobs configured under the CLAUDE_CODE_* prefix to override default module-scope gating and decay settings.

When should I use deferred context injection for listing-type content sections?

Use deferred context injection when adding non-critical listing-type sections that should skip injection until needed, leveraging a folding mechanism, dormant gate, and ranker to minimize per-turn overhead for invariant content.

Does lazy context loading support test isolation and cache clearing?

Yes, lazy context loading supports test isolation and cache clearing through a zero-serialization, resettable module-scope state pattern with explicit reset functions that flush the TTL trigger and dormant gate.