knowledge-runtime-state-bootstrap-and-observability

knowledge-runtime-state-bootstrap-and-observability is a skill for Claude Code, Codex from echoVic/blade-code. It costs 198 tokens per session (3,741 once invoked), scanned A, a copy of knowledge-session-state-and-context, MIT.

Shared runtime state and diagnostics for the command line, server, web app, agents, tools, and extensions. It tracks working directories, project roots, session IDs, logs, environment details, and registered projects.

In plain words
What is it for?
Use it when changing startup order, isolating workspace state, accessing shared UI state, adding logs or runtime diagnostics, identifying versions and sessions, or selecting and registering projects.
Why use it?
It prevents concurrent operations from using the wrong directory or shared state and makes runtime behavior easier to inspect across different application surfaces.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it when changing startup order, isolating workspace state, accessing shared UI…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/echovic/blade-code/runtime-state-bootstrap-and-observability
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 runtime-state-bootstrap-and-observability
Clone the repo
git clone --depth 1 https://github.com/echoVic/blade-code

Made for: Claude Code, Codex.

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-runtime-state-bootstrap-and-observability

README.md
[![agentmods](https://agentmods.dev/badge/skills/echovic/blade-code/runtime-state-bootstrap-and-observability.svg)](https://agentmods.dev/skills/echovic/blade-code/runtime-state-bootstrap-and-observability)
Your own site
<a href="https://agentmods.dev/skills/echovic/blade-code/runtime-state-bootstrap-and-observability"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/runtime-state-bootstrap-and-observability.svg" alt="Measured on agentmods" height="20"></a>
Per session 198 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,741 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 89% 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.00198 $0.03741
Opus 5 $0.00099 $0.01870
Sonnet 5 $0.00040 $0.00748
Haiku 4.5 $0.00020 $0.00374

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

Security

Grade A, and why

knowledge-runtime-state-bootstrap-and-observability 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

89% identical to knowledge-session-state-and-context — 146 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/runtime-state-bootstrap-and-observability/SKILL.md · 129 lines

How it starts

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

Module Structure

该组件提供各运行表面共享的进程级基础状态与观测入口;它区分启动目录、当前工作区和稳定项目根,并把 UI 状态、日志、环境探测及项目发现收敛到可被 Agent、CLI、Server、工具和扩展复用的 API。

Directory Layout

  • packages/cli/src/bootstrap/state.ts — 惰性初始化的 cwd、originalCwd 与 projectRoot 三态
  • packages/cli/src/store/ — React 与非 React 共用的 Zustand Store、切片、类型和细粒度选择器
  • packages/cli/src/logging/ — 分类 JSONL 日志与独立流式调试日志
  • packages/cli/src/utils/cwd.ts — 基于 AsyncLocalStorage 的并发 cwd 覆写
  • packages/cli/src/utils/environment.ts — 项目根发现、环境提示和目录概览
  • packages/cli/src/utils/packageInfo.ts — 源码与打包布局兼容的运行时包信息
  • packages/cli/src/utils/sessionId.ts — 可安全用于存储路径的 Session ID
  • packages/cli/src/services/DirectoryPicker.ts — macOS、Windows 与 Linux 原生目录选择
  • packages/cli/src/services/ProjectRegistry.ts — 规范化项目路径的持久绑定注册表

Key Entry Points

  • getCwd() / runWithCwdOverride() — 获取当前执行上下文的 workspace,或为异步调用链临时覆写
  • vanillaStore / useBladeStore() / ensureStoreInitialized() — 共享状态实例、React 订阅与幂等配置初始化
  • createLogger() / setLoggerSessionId() / streamDebug() — 分类日志、会话日志路由与流式专项诊断
  • getEnvironmentContext() / getVersion() / createSessionId() — 构造环境上下文、读取运行版本和生成存储安全标识
  • NativeDirectoryPicker.pick() / ProjectRegistry.list() — 选择本机目录并读取规范化项目集合

API Surface

Workspace Location

  • getCwd() — 优先返回当前 AsyncLocalStorage 覆写,否则返回进程级 cwd
  • runWithCwdOverride(cwd, fn) — 在同步及后续异步调用链内隔离 workspace
  • getOriginalCwd() — 返回 CLI 被调用时的原始目录,用于解析用户传入的相对路径
  • getProjectRoot() — 返回启动后保持稳定的项目标识根
  • findProjectRoot(startDir) / setCwd(newPath, relativeTo?) — 发现工作区根并更新规范化的全局 cwd

Shared Store

  • useBladeStore(selector) — React 对共享 Vanilla Store 的细粒度订阅入口
  • getState() — Agent、服务与命令读取当前 Store 快照
  • sessionActions() / appActions() / configActions() — 面向不同状态域的动作入口
  • ensureStoreInitialized() — 以共享 Promise 合并并发配置初始化
  • useCurrentStreamingBuffer() — 以浅比较订阅流式行缓冲、尾部、计数和版本

Observability

  • createLogger(category, options?) — 创建分类日志器,文件输出与终端调试过滤相互独立
  • Logger.setGlobalDebug(config) — 动态设置全局终端日志开关或分类过滤
  • setLoggerSessionId(sessionId) — 切换后续 JSONL 日志的文件名
  • streamDebug(source, message, data?) — 向独立流式诊断文件追加记录且不向调用方抛错
  • getEnvironmentContext(options?) — 组装系统、Git、脚本和目录信息供系统提示使用

Read the full file on GitHub · 129 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 · 129 lines · 198 tokens per session scan A 24c01d1a1eb3

Subscribe to this mod's changes

knowledge-runtime-state-bootstrap-and-observability is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed today), licensed MIT. It adds 198 tokens to every session and 3,741 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. It is 89% identical to knowledge-session-state-and-context, differing in 146 lines, and is treated as a copy.