knowledge-capacity-lifecycle-and-egress

knowledge-capacity-lifecycle-and-egress is a skill for Claude Code from echoVic/blade-code. It costs 177 tokens per session (3,124 once invoked), scanned A, a copy of knowledge-session-state-and-context, MIT.

A resource-management layer that limits concurrent sessions, tasks, tools, providers, and browser work. It also controls streamed output and cleans up processes during cancellation or shutdown.

In plain words
What is it for?
Use it to investigate resource-exhaustion errors, queue fairness, memory growth, browser limits, stuck shutdowns, or orphaned processes.
Why use it?
It prevents queues from starving, memory and output buffers from growing without bounds, results from arriving out of order, and child processes from being left behind.

Skill for Claude Code

Written for Claude Code: SessionEnd hook event.

Good fit Use it to investigate resource-exhaustion errors, queue fairness, memory growth, browser limits, stuck shutdowns, or orphaned processes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/echovic/blade-code/capacity-lifecycle-and-egress
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add echoVic/blade-code --skill capacity-lifecycle-and-egress
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code.

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 knowledge-capacity-lifecycle-and-egress

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/capacity-lifecycle-and-egress.svg)](https://agentmods.dev/skills/echovic/blade-code/capacity-lifecycle-and-egress)
Your own site
<a href="https://agentmods.dev/skills/echovic/blade-code/capacity-lifecycle-and-egress"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/capacity-lifecycle-and-egress.svg" alt="Measured on agentmods" height="20"></a>
Per session 177 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,124 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 80% copy Near-identical to another mod 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.00177 $0.03124
Opus 5 $0.00088 $0.01562
Sonnet 5 $0.00035 $0.00625
Haiku 4.5 $0.00018 $0.00312

Measured 3d ago against content hash 9afa39002f96, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

knowledge-capacity-lifecycle-and-egress 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 3d 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.

Origin

This is a copy

80% identical to knowledge-session-state-and-context — 117 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.trae/knowledges/workspace-policy-and-shared-foundations/capacity-lifecycle-and-egress/SKILL.md · 96 lines

How it starts

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

Module Structure

该横切域用不同粒度的 reservation、permit、lease 和串行 egress 控制有限资源;每层都拥有独立队列、失败类型和释放责任,不能用一个全局 semaphore 替代。

Directory Layout

  • packages/cli/src/agent/runtime/SessionRuntimeResidency.ts — Web/ACP Runtime 驻留、pin、LRU 和 reservation
  • packages/cli/src/agent/runtime/TaskRunScheduler.ts — 顶层 Task active/pending count 与 retained bytes
  • packages/cli/src/tools/execution/ConcurrencyScheduler.ts — 进程和 Session 两级工具公平准入
  • packages/cli/src/tools/execution/ToolConcurrencyGate.ts — 单 executor 的 shared/exclusive FIFO 屏障
  • packages/cli/src/services/pi/providerRequestAdmission.ts — Provider domain/owner/class 加权准入
  • packages/cli/src/browser/BrowserOperationGate.ts — 单 Session Browser 操作串行化
  • packages/cli/src/browser/BrowserProcessPool.ts — 共享 Chromium 与隔离 Context lease
  • packages/cli/src/utils/BoundedSerialEgress.ts — 通用有界单写者输出
  • packages/cli/src/server/OrderedSseEgress.ts — replay/live 交接和 committed seq 顺序
  • packages/cli/src/services/GracefulShutdown.ts — 信号、清理栈、Hook 和日志关闭
  • packages/cli/src/utils/process/ — owned process tree、admission gate 和 PID identity

Decision Entry

  • SessionRuntimeResidency.reserve() — 初始化前预留 Runtime 容量
  • TaskRunScheduler.admit() — 顶层任务立即运行或进入 FIFO 队列
  • ConcurrencyScheduler.schedule() — 按 Session round-robin 获取工具 permit
  • ProviderRequestAdmissionScheduler.admit() — 按 failure domain、root owner 和 request class 准入
  • BrowserOperationGate.run() / BrowserProcessPool.acquire() — 页面操作与 Chromium Context 两级容量
  • BoundedSerialEgress.offer() — 在保留输出前同步判定 item/byte 上限
  • GracefulShutdownManager.shutdown() — 取消活动命令并有界执行清理

Branching Table

资源 有容量时 等待或可回收时 满载、失败或关闭时
Session Runtime reservation 计数后初始化并 commit lease Web 可驱逐 idle、unpinned、canEvict 的 LRU resident ACP 不驱逐;无候选返回可重试 resident_runtimes
顶层 Task active slot 空闲则立即运行且不计 pending bytes paused 或 active 满时按 FIFO 计 pending count/bytes 任一 pending 上限命中即在执行前拒绝
工具进程级准入 同时满足 global/session total 与 kind 限额后执行 每个 Session 只取队首,跨 Session round-robin queue full 或 180 秒等待超时返回 tool_busy
工具批内 gate 连续 shared 调用并发 exclusive 调用作为 FIFO 屏障 pending 超 64 或 close 时取消未启动调用
Provider stream 未配置并发旋钮时直接请求;配置后取得 physical-attempt permit foreground 优先、owner round-robin,background/internal 可 aging count/bytes/full/timeout 返回脱敏可重试错误
Browser 进程池复用一个 Chromium,每 Session 独立 Context,操作严格 FIFO 最后一个 Context release 时关闭 Chromium Context 或操作队列满分别返回 browser_capacity / browser_busy
Surface egress 单 writer 按接纳顺序输出 flush() 只等待调用时已接纳的 high-water mark overflow、oversized、write failure/timeout 关闭整条通道
进程关闭 cleanup handlers 按注册逆序等待 单项失败继续执行其余 cleanup 4 秒 cleanup budget 后报错,5 秒 hard timeout 强制退出

Read the full file on GitHub · 96 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. 3d ago First seen · 96 lines · 177 tokens per session scan A 9afa39002f96

Subscribe to this mod's changes

knowledge-capacity-lifecycle-and-egress is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 177 tokens to every session and 3,124 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. It is 80% identical to knowledge-session-state-and-context, differing in 117 lines, and is treated as a copy.