[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77MSESM9DBSPH93DJA841PZ":3,"skill-same:01M77MSESM9DBSPH93DJA841PZ":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M77MSESM9DBSPH93DJA841PZ","claude-code-context-monitor",null,"Load this skill when implementing context-window monitoring, auto-flush, or pause\u002Fresume logic in Claude Code. Covers the statusline JSON contract (token and percentage fields), the full hook-event catalogue and their absence of token data, the PreCompact\u002FPostCompact\u002FSessionStart(compact|clear) snapshot pattern, the HANDOFF.md snapshot recipe, and the go\u002Fno-go verdict for fully-automatic 35%-threshold flushing. Triggers: files named *context-monitor*, *autoflush*, *handoff*, *precompact*, or any code reading `.context_window.used_percentage` from statusline JSON.","HexingBot\u002Fhivemind","HexingBot","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F296674764?v=4","01M77MMXMW5SWSXKHB0VA4N1FF","01M77MMXNV3PZA3795D6PYX5C9",1,"MIT","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Fskills\u002Fclaude-code-context-monitor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: claude-code-context-monitor\ndescription: >\n  Load this skill when implementing context-window monitoring, auto-flush, or\n  pause\u002Fresume logic in Claude Code. Covers the statusline JSON contract (token\n  and percentage fields), the full hook-event catalogue and their absence of\n  token data, the PreCompact\u002FPostCompact\u002FSessionStart(compact|clear) snapshot\n  pattern, the HANDOFF.md snapshot recipe, and the go\u002Fno-go verdict for\n  fully-automatic 35%-threshold flushing. Triggers: files named *context-monitor*,\n  *autoflush*, *handoff*, *precompact*, or any code reading\n  `.context_window.used_percentage` from statusline JSON.\n---\n\n# claude-code-context-monitor — Context Usage, Hooks, and Flush Design\n\n## When to Use This Skill\n\nUse when building or extending the context-autoflush feature shipped by the\nhivemind plugin (`context-monitor\u002F` scripts), or any feature that reads\nlive context-window usage, detects a threshold, or orchestrates a\nsnapshot-clear-resume cycle inside Claude Code.\n\n---\n\n## 1. Context-Usage Measurement\n\n### 1a. Statusline script (authoritative, live token data)\n\nClaude Code pipes a JSON object to a statusline command on stdin after every\nassistant message, after `\u002Fcompact`, and when permission mode toggles.\n\nKey fields (Claude Code >= v2.1.132):\n\n```\ncontext_window.total_input_tokens     — tokens currently in the window (input side)\ncontext_window.total_output_tokens    — output tokens from the most recent turn\ncontext_window.context_window_size    — max window size (200 000 or 1 000 000)\ncontext_window.used_percentage        — pre-calculated %; input-only formula\ncontext_window.remaining_percentage   — 100 - used_percentage\ncontext_window.current_usage          — per-component breakdown (input_tokens,\n                                        output_tokens, cache_creation_input_tokens,\n                                        cache_read_input_tokens)\nexceeds_200k_tokens                   — boolean; fixed 200 k threshold regardless\n                                        of actual window size\n```\n\n`used_percentage` = (input_tokens + cache_creation_input_tokens +\n                    cache_read_input_tokens) \u002F context_window_size * 100\n\n`current_usage` is `null` before the first API call and again immediately after\n`\u002Fcompact` until the next call repopulates it. Handle with `\u002F\u002F 0` (jq) or `or 0`\n(Python).\n\nThe statusline script CANNOT trigger actions (hooks\u002Fcommands) — it is purely\ndisplay output.\n\n### 1b. Hooks — token data availability\n\nNo hook event receives token counts or `used_percentage`. This is an open feature\nrequest (GitHub issue #11008, unimplemented as of June 2026). Hook common input\nfields are: `session_id`, `transcript_path`, `cwd`, `permission_mode`,\n`hook_event_name`. No usage fields.\n\n`agent_id`\u002F`agent_type` (TASK-219 empirical verification, Claude Code\n2.1.233, refined across two probe rounds): `agent_id` was present and\nnon-empty in every capture (26\u002F26 in the latest sample). `agent_type` is NOT\nalways non-empty — a `SubagentStop` can fire with `agent_type: \"\"`. The\n**stable, structural** finding (held across every probe round, independent\nof sample size — this is the fact to design against, not a raw count):\nevery `SubagentStop` observed with an empty `agent_type` fired for an\n`agent_id` that never had a matching `SubagentStart`. A raw fraction (e.g.\n\"N of M stops\") is a moving target — the probe kept running and kept\ncapturing after the finding was first made, so any specific count recorded\nhere would already be stale by the time this file is read; if a count is\nuseful context, scope and date it explicitly (e.g. \"4 of 15 SubagentStop\nevents in a 26-record sample captured 2026-08-15 during TASK-219\") rather\nthan stating it as a system constant. Both fields are for subagents spawned\nvia the `Agent`\u002FTask-spawn tool (both with and without an explicit `name`);\nnot tested for forked sessions or workflow-originated agents, so treat\n`agent_id` as reliably *present* (key exists, non-empty) for tool-spawned\nsubagents specifically, but do NOT assume `agent_type`'s *value* is always a\nreal, non-empty type — code reading it must handle `\"\"` as equivalent to\nabsent. `agent_type` returns the spawn's `name` when one was passed, and the\n`subagent_type` only when it wasn't — it is not a trustworthy role\nidentifier on its own. See `src\u002Fsubagent-log.js` (TASK-219) for a consumer\nthat normalizes both fields (and every other string field) to `null` when\nempty, whitespace-only, or absent.\n\nThe complete hook-event catalogue with token-data verdict. **Matcher?**\n(added TASK-219) records only what has actually been checked against real\nClaude Code behavior or is directly documented elsewhere in this file —\n`Unverified` means nobody has confirmed matcher support for that event in\nthis codebase, not that it lacks one:\n\n| Hook event          | Fires on                        | Can block? | Token\u002Fcontext data? | Matcher? |\n|---------------------|---------------------------------|------------|---------------------|----------|\n| SessionStart        | startup, resume, clear, compact | No         | No                  | Yes — event-defined values (`startup\\|resume\\|clear\\|compact`) |\n| Setup               | init, maintenance               | No         | No                  | Unverified |\n| SessionEnd          | clear, resume, logout, other    | No         | No                  | Unverified |\n| UserPromptSubmit    | every user prompt               | Yes (exit 2)| No                 | Unverified |\n| UserPromptExpansion | slash-command expansion         | Yes        | No                  | Unverified |\n| Stop                | Claude finishes a turn          | Yes (exit 2)| No                 | No — inherited from §7, never independently verified; `claude doctor` accepting a matcher on Stop neither confirms nor rules out actual support |\n| StopFailure         | API error ends a turn           | No         | No                  | Unverified |\n| PreToolUse          | before each tool call           | Yes        | No                  | Unverified |\n| PermissionRequest   | permission dialog appears       | Yes        | No                  | Unverified |\n| PermissionDenied    | tool denied by auto classifier  | No         | No                  | Unverified |\n| PostToolUse         | after tool succeeds             | No*        | No                  | Unverified |\n| PostToolUseFailure  | after tool fails                | No         | No                  | Unverified |\n| PostToolBatch       | after parallel batch resolves   | Yes        | No                  | Unverified |\n| **PreCompact**      | **before compaction**           | **Yes (exit 2)**| **No**         | Yes — `\"auto\"` \u002F `\"manual\"` |\n| **PostCompact**     | **after compaction**            | **No**     | **No**              | Unverified |\n| SubagentStart       | subagent's turn begins (per-TURN, not per-lifetime — a long-lived subagent re-fires this on every continuation message it receives, TASK-219 empirical) | No | No | Unverified |\n| SubagentStop        | subagent's turn ends (per-TURN, not per-lifetime — same subagent, same `agent_id`, can accumulate many `SubagentStop` events across its life, TASK-219 empirical; see `state\u002FREADME.md`'s \"Granularity\" note) | **Yes — deliberately NOT used** (TASK-219: exiting 2 keeps the subagent running instead of finishing, which cannot create the missing record and only makes the underlying problem worse; see `hooks\u002Fpersist-subagent.mjs`, always exits 0) | No | Yes — matches against `agent_type` (TASK-219 empirical verification), but **fails open when `agent_type` is empty**: a matcher deliberately crafted to match nothing still fired for a payload where `agent_type` was `\"\"` — a matcher is unreliable in both directions (misses agents spawned with a custom `name`, over-fires when `agent_type` is absent), reinforcing rather than weakening the decision not to use one here; the hivemind hook is registered with no matcher so it fires unconditionally |\n| TaskCreated\u002FCompleted| task lifecycle                 | Yes        | No                  | Unverified |\n| TeammateIdle        | team agent idle                 | Yes        | No                  | Unverified |\n| InstructionsLoaded  | CLAUDE.md loaded                | No         | No                  | Unverified |\n| ConfigChange        | settings file changes           | Yes        | No                  | Unverified |\n| FileChanged         | watched file changes            | No         | No                  | Unverified |\n| CwdChanged          | working dir changes             | No         | No                  | Unverified |\n| WorktreeCreate\u002FRemove| worktree lifecycle             | Yes\u002FNo     | No                  | Unverified |\n| MessageDisplay      | assistant text displayed        | No         | No                  | Unverified |\n| Notification        | system notification             | No         | No                  | Unverified |\n| Elicitation\u002FResult  | MCP elicitation                 | Yes        | No                  | Unverified |\n\n**PreCompact** fires with `matcher: \"auto\"` (automatic compaction) or\n`\"manual\"` (`\u002Fcompact` command). Its payload is the common fields only — no\ntoken counts. It CAN block compaction by exiting 2, and it CAN write side\neffects (e.g., snapshot to HANDOFF.md) before returning.\n\n### 1c. Transcript JSONL parsing\n\nPath: `~\u002F.claude\u002Fprojects\u002F\u003Cproject-slug>\u002F\u003Csession-id>.jsonl`\n(also exposed as `transcript_path` in statusline JSON and hook inputs).\n\nEach line is a JSONL entry. Message entries contain `message.usage` with the\nsame Anthropic API usage fields (`input_tokens`, `output_tokens`,\n`cache_creation_input_tokens`, `cache_read_input_tokens`). A script can tail\nthis file and compute a running total, but it will lag the live context state\n(Claude Code's internal accounting may differ slightly) and requires the session\nID to locate the file.\n\n---\n\n## 2. Flush Trigger Mechanisms\n\n### 2a. What hooks CAN do\n\n- **PreCompact hook (exit 2):** blocks automatic compaction. Use this to\n  intercept auto-compaction, write a HANDOFF.md snapshot, then let compaction\n  proceed by returning 0, OR exit 2 to suppress compaction entirely.\n- **Stop hook (exit 2 + reason):** blocks Claude from finishing a\n  turn and injects a system-level message Claude reads. Can instruct Claude to\n  write a snapshot file and then type `\u002Fclear`. This is model-driven, not\n  deterministic — Claude decides whether to comply.\n- **SessionStart(compact|clear) hook:** fires after compaction or `\u002Fclear`;\n  can inject `additionalContext` or `initialUserMessage` to restore context\n  from a snapshot.\n\n### 2b. What hooks CANNOT do\n\n- **No hook can programmatically invoke `\u002Fclear`.** Hooks are passive\n  responders; they cannot issue interactive commands or session lifecycle\n  operations.\n- **No hook can call `\u002Fcompact` on the model's behalf.** Same restriction.\n- **No hook receives token\u002Fusage data** to self-detect the 35% threshold.\n\n### 2c. The shipped auto-flush design (three components)\n\nThree components work together:\n\n**Component A — Statusline threshold indicator**\nA statusline script reads `context_window.used_percentage` and displays a\ncolor-coded bar. When usage crosses 35%, it changes color and prints a\nprominent warning. This is the reliable, always-accurate signal.\n\n**Component B — Statusline-driven side-effect file (bridge)**\nThe statusline script writes a flag file (`\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.flush-\u003Cid>`)\nwhen `used_percentage >= 35`. This file acts as a shared signal between the\ndisplay layer and the hook layer.\n\n**Component C — Stop hook polling the flag file**\nA `Stop` hook reads the flag file. If it exists, the hook responds with\n`decision: \"block\"` and `reason` instructing Claude to:\n1. Write HANDOFF.md (snapshot all in-flight work).\n2. Type `\u002Fclear`.\nThe hook writes an instructed sentinel so the instruction fires only once.\n\n**Limitation:** The Stop hook fires after each assistant turn, not instantly\nwhen the threshold is crossed mid-turn. The actual flush happens at the next\nturn boundary after the threshold is reached, not at exactly 35%. At 35% this\nis acceptable — there is ample headroom before quality degrades.\n\n**Component D — SessionStart(clear|compact) hook restoring HANDOFF.md**\nOn `\u002Fclear` or `\u002Fcompact`, `SessionStart` with matcher `\"clear|compact\"` fires.\nThe hook reads HANDOFF.md and injects it via `hookSpecificOutput.additionalContext`.\n\n---\n\n## 3. Go\u002FNo-Go Verdict\n\n**TRUE fully-automatic 35%-flush is NOT achievable today.**\n\nReason: No hook receives token\u002Fusage data, so no hook can detect the 35%\nthreshold deterministically. The gap requires the model (Claude) to cooperate\nwhen the Stop hook instructs it to flush — this is model-driven, not\ndeterministic.\n\n**What IS achievable (closest feasible design):**\n\n| Component | Automatable? | Mechanism |\n|-----------|-------------|-----------|\n| Display % in statusline | Yes, fully | `context_window.used_percentage` |\n| Color-code at 35% threshold | Yes, fully | statusline script threshold |\n| Write flag file at 35% | Yes, fully | statusline script side-effect |\n| Detect flag file at turn end | Yes, fully | Stop hook reads file |\n| Write HANDOFF.md snapshot | Yes, via model | Stop hook injects instruction |\n| Execute `\u002Fclear` | No (model-driven) | Stop hook instructs Claude; model must type it |\n| Restore HANDOFF.md after `\u002Fclear` | Yes, fully | SessionStart(clear|compact) hook |\n\n**Closest feasible design summary:** Semi-automatic. The threshold detection\nand HANDOFF.md snapshot are reliable. The `\u002Fclear` execution requires Claude\nto follow the hook's instruction, which it reliably does but is not 100%\ndeterministic. In practice this is one-keystroke or zero-keystroke for the\nuser in the modal sense: the model types `\u002Fclear` without user intervention\nif it follows the hook instruction.\n\n---\n\n## 4. HANDOFF.md Snapshot Recipe\n\nMinimal fields for a snapshot that restores context across `\u002Fclear`:\n\n```markdown\n# HANDOFF.md — Context Snapshot\n**Flushed at:** \u003CISO timestamp>\n**Session:** \u003Csession_id>\n**Context at flush:** \u003Cused_percentage>%\n\n## Active Task\n\u003Cticket key, acceptance criteria summary>\n\n## Current Progress\n\u003Cwhat has been done since last flush>\n\n## Open Questions\n\u003Cunresolved items>\n\n## Next Action\n\u003Cexact next step for the resumed session>\n```\n\nThe Stop hook's `reason` message instructs Claude to write this file. The\nSessionStart hook re-injects it.\n\n---\n\n## 5. Shipped Script Contracts\n\n### 5a. statusline.mjs\n\n- Input: statusline JSON on stdin (includes `session_id`, `cwd`, `context_window`).\n- Output: one-line color-coded bar + percentage to stdout.\n- Side-effect: writes `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.flush-\u003Csession_id>` when\n  `used_percentage >= THRESHOLD`; removes both sentinels when usage drops below.\n\n### 5b. stop-hook.mjs\n\n- Input: hook JSON on stdin (includes `session_id`, `cwd`).\n- Output (armed, not yet instructed):\n  `{ \"decision\": \"block\", \"reason\": \"\u003Cinstruction>\" }`\n  **`reason` is the correct field**; `additionalContext` is silently ignored by Stop.\n- Output (not armed OR already instructed): exit 0 silently (no stdout).\n- Side-effect: writes `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.instructed-\u003Csession_id>`\n  on first block to prevent double-instruction.\n\n### 5c. session-start.mjs\n\n- Input: hook JSON on stdin (includes `session_id`, `cwd`).\n- Matcher: `clear|compact`\n- Output (HANDOFF.md exists):\n  ```json\n  {\n    \"hookSpecificOutput\": {\n      \"hookEventName\": \"SessionStart\",\n      \"additionalContext\": \"A HANDOFF.md snapshot was found...\"\n    }\n  }\n  ```\n  **`hookSpecificOutput` envelope is required**; bare top-level `additionalContext`\n  is silently ignored by Claude Code for SessionStart.\n- Output (no HANDOFF.md): exit 0 silently.\n- Side-effect: removes both sentinels from `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F`.\n\n### 5d. usage.mjs\n\nPure functions (no I\u002FO) imported by the three scripts above:\n- `THRESHOLD` — 35 (the only magic number)\n- `readUsagePercent(data)` — extracts `context_window.used_percentage`\n- `shouldFlush(percent, alreadyFlagged)` — pure decision\n- `armedFlagName(sessionId)` — returns `.flush-\u003Cid>`\n- `instructedFlagName(sessionId)` — returns `.instructed-\u003Cid>`\n\n---\n\n## 6. Sentinel Location Design\n\nAll scripts resolve sentinels from the project `cwd` (read off their stdin JSON),\nNOT from `__dirname`. This is the **relocation-safety** requirement:\n\n- `__dirname` would point to the plugin directory (shared across all projects,\n  potentially read-only after installation).\n- `cwd` points to the consuming project's working directory, which is always\n  writable and project-scoped.\n\nSentinel directory: `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F`\nThis directory is created on demand (no pre-requisite setup).\n\n---\n\n## 7. Settings.json Scaffold (init-project)\n\nThe `init-project` scaffold writes\u002Fmerges `.claude\u002Fsettings.json` with these\nentries (deep-merge, never clobbers pre-existing keys or hooks). **The\nhooks.Stop\u002FSessionStart entries use the documented NESTED shape** (TASK-210)\n— the command lives inside a `hooks: [...]` array, never directly on the\nmatcher-group element. Per the official hooks reference: \"You cannot place a\nhandler directly on the matcher group. Handlers must nest inside the hooks\narray.\" A flat `{ \"type\": \"command\", \"command\": ... }` sitting directly on\nthe array element is invalid settings — `claude doctor` rejects it\n(`hooks.Stop.0.hooks: Expected array, but received undefined`) and the hook\nnever fires. `statusLine` is a *different*, unrelated settings key with a\ndifferent (flat, genuinely-honoured) shape — it is not part of the hooks\nschema and stays flat.\n\n\u003C!-- SETTINGS-SCAFFOLD-EXAMPLE:START -->\n```json\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fstatusline.mjs\\\"\"\n  },\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fstop-hook.mjs\\\"\"\n          }\n        ]\n      }\n    ],\n    \"SessionStart\": [\n      {\n        \"matcher\": \"clear|compact\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fsession-start.mjs\\\"\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\u003C!-- SETTINGS-SCAFFOLD-EXAMPLE:END -->\n\nNote `Stop` carries no `matcher` key at all — Stop does not support one.\n`SessionStart` does, and keeps `matcher: \"clear|compact\"`.\n\nProjects initialized before this fix carry the old flat shape on disk. They\nare migrated automatically, with no user action required, by\n`context-monitor\u002Fsettings-migrate.mjs` — a plugin-level `SessionStart` hook\n(registered in `hooks\u002Fhooks.json` alongside `repin.mjs`) that rewrites any\nlegacy flat entry to the nested shape in place on the very next session. See\n`src\u002Fclaude-settings.js`'s `migrateContextMonitorShape` \u002F `mergeContextMonitorSettings`\nfor the pure migration logic.\n\n`\u003CABSOLUTE_PLUGIN_ROOT>` is resolved at init time from:\n```js\nprocess.env.CLAUDE_PLUGIN_ROOT ?? resolve(fileURLToPath(import.meta.url), '..\u002F..')\n```\nThe literal absolute path is baked in — `${CLAUDE_PLUGIN_ROOT}` is NOT\nexpanded in project-level `settings.json` (see `claude-code-plugin-path-resolution`\nskill for the full rationale).\n\n---\n\n## Best Practices\n\n- **Do** use `used_percentage` directly — it is pre-calculated and accurate as\n  of Claude Code v2.1.132+. Before v2.1.132, `total_input_tokens` was\n  cumulative (not current); check version if deploying on older installs.\n- **Do** write the flag file atomically (temp + rename) to avoid race\n  conditions on Windows (see `windows-atomic-rename-not-truly-atomic` KB entry).\n- **Do** scope the flag file to `session_id` so concurrent sessions don't\n  interfere.\n- **Do not** rely on PreCompact alone for 35% detection — it fires only when\n  Claude Code decides to compact (typically much later than 35%).\n- **Do not** use PostToolUse for threshold checking — it fires per tool call,\n  not per turn, and does not have token data.\n- **Do not** use `exceeds_200k_tokens` as the threshold signal — it is a hard\n  200 k boolean, not configurable.\n\n---\n\n## Common Pitfalls\n\n- **`current_usage` is null after `\u002Fcompact`:** guard with `|| 0` before the\n  next API call repopulates it.\n- **Statusline fires on events, not on a timer:** during long tool-only turns,\n  the statusline may not update. Set `refreshInterval: 5` in settings to poll.\n- **Stop hook always blocking:** gate the `\"block\"` decision on the flag file\n  existence. A hook that unconditionally returns block creates an infinite loop.\n- **Hook not firing:** check `disableAllHooks: false` in settings. The statusline\n  is also disabled when `disableAllHooks: true`.\n- **`reason` vs `additionalContext`:** Stop hook uses `{ decision, reason }`.\n  SessionStart uses `hookSpecificOutput.additionalContext`. These are NOT\n  interchangeable — using the wrong field causes silent no-ops.\n\n---\n\n## References\n\n- [Statusline docs](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fstatusline) — full JSON schema and field descriptions.\n- [Hooks reference](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fhooks) — all hook events, input contracts, output contracts.\n- [GitHub issue #11008](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F11008) — open request to add token data to hook inputs (unimplemented).\n- [GitHub issue #13783](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F13783) — bug: statusline `context_window` pre-v2.1.132 was cumulative, not current.\n- [Context handoff repo](https:\u002F\u002Fgithub.com\u002Fwho96\u002Fclaude-code-context-handoff) — community PreCompact+SessionStart snapshot pattern.\n\n---\n\n## Provenance\n\n- **Authored by:** Developer subagent on behalf of ticket `TASK-008`.\n- **Primary sources:**\n  - https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fstatusline\n  - https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fhooks\n  - https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F11008\n  - https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F13783\n  - https:\u002F\u002Fgithub.com\u002Fwho96\u002Fclaude-code-context-handoff\n- **Last verified:** 2026-06-17.\n- **TASK-219 update (2026-08-15):** `agent_id`\u002F`agent_type` presence and the\n  SubagentStop matcher\u002Fblock-vs-persist findings (§1b) are empirical, against\n  Claude Code 2.1.233, captured live via a real hook probe (not from docs) —\n  see `src\u002Fsubagent-log.js` and `state\u002FREADME.md`'s \"Subagent result\n  persistence\" section for the consumer built on these findings.\n","# claude-code-context-monitor — Context Usage, Hooks, and Flush Design\n\n## When to Use This Skill\n\nUse when building or extending the context-autoflush feature shipped by the\nhivemind plugin (`context-monitor\u002F` scripts), or any feature that reads\nlive context-window usage, detects a threshold, or orchestrates a\nsnapshot-clear-resume cycle inside Claude Code.\n\n---\n\n## 1. Context-Usage Measurement\n\n### 1a. Statusline script (authoritative, live token data)\n\nClaude Code pipes a JSON object to a statusline command on stdin after every\nassistant message, after `\u002Fcompact`, and when permission mode toggles.\n\nKey fields (Claude Code >= v2.1.132):\n\n```\ncontext_window.total_input_tokens     — tokens currently in the window (input side)\ncontext_window.total_output_tokens    — output tokens from the most recent turn\ncontext_window.context_window_size    — max window size (200 000 or 1 000 000)\ncontext_window.used_percentage        — pre-calculated %; input-only formula\ncontext_window.remaining_percentage   — 100 - used_percentage\ncontext_window.current_usage          — per-component breakdown (input_tokens,\n                                        output_tokens, cache_creation_input_tokens,\n                                        cache_read_input_tokens)\nexceeds_200k_tokens                   — boolean; fixed 200 k threshold regardless\n                                        of actual window size\n```\n\n`used_percentage` = (input_tokens + cache_creation_input_tokens +\n                    cache_read_input_tokens) \u002F context_window_size * 100\n\n`current_usage` is `null` before the first API call and again immediately after\n`\u002Fcompact` until the next call repopulates it. Handle with `\u002F\u002F 0` (jq) or `or 0`\n(Python).\n\nThe statusline script CANNOT trigger actions (hooks\u002Fcommands) — it is purely\ndisplay output.\n\n### 1b. Hooks — token data availability\n\nNo hook event receives token counts or `used_percentage`. This is an open feature\nrequest (GitHub issue #11008, unimplemented as of June 2026). Hook common input\nfields are: `session_id`, `transcript_path`, `cwd`, `permission_mode`,\n`hook_event_name`. No usage fields.\n\n`agent_id`\u002F`agent_type` (TASK-219 empirical verification, Claude Code\n2.1.233, refined across two probe rounds): `agent_id` was present and\nnon-empty in every capture (26\u002F26 in the latest sample). `agent_type` is NOT\nalways non-empty — a `SubagentStop` can fire with `agent_type: \"\"`. The\n**stable, structural** finding (held across every probe round, independent\nof sample size — this is the fact to design against, not a raw count):\nevery `SubagentStop` observed with an empty `agent_type` fired for an\n`agent_id` that never had a matching `SubagentStart`. A raw fraction (e.g.\n\"N of M stops\") is a moving target — the probe kept running and kept\ncapturing after the finding was first made, so any specific count recorded\nhere would already be stale by the time this file is read; if a count is\nuseful context, scope and date it explicitly (e.g. \"4 of 15 SubagentStop\nevents in a 26-record sample captured 2026-08-15 during TASK-219\") rather\nthan stating it as a system constant. Both fields are for subagents spawned\nvia the `Agent`\u002FTask-spawn tool (both with and without an explicit `name`);\nnot tested for forked sessions or workflow-originated agents, so treat\n`agent_id` as reliably *present* (key exists, non-empty) for tool-spawned\nsubagents specifically, but do NOT assume `agent_type`'s *value* is always a\nreal, non-empty type — code reading it must handle `\"\"` as equivalent to\nabsent. `agent_type` returns the spawn's `name` when one was passed, and the\n`subagent_type` only when it wasn't — it is not a trustworthy role\nidentifier on its own. See `src\u002Fsubagent-log.js` (TASK-219) for a consumer\nthat normalizes both fields (and every other string field) to `null` when\nempty, whitespace-only, or absent.\n\nThe complete hook-event catalogue with token-data verdict. **Matcher?**\n(added TASK-219) records only what has actually been checked against real\nClaude Code behavior or is directly documented elsewhere in this file —\n`Unverified` means nobody has confirmed matcher support for that event in\nthis codebase, not that it lacks one:\n\n| Hook event          | Fires on                        | Can block? | Token\u002Fcontext data? | Matcher? |\n|---------------------|---------------------------------|------------|---------------------|----------|\n| SessionStart        | startup, resume, clear, compact | No         | No                  | Yes — event-defined values (`startup\\|resume\\|clear\\|compact`) |\n| Setup               | init, maintenance               | No         | No                  | Unverified |\n| SessionEnd          | clear, resume, logout, other    | No         | No                  | Unverified |\n| UserPromptSubmit    | every user prompt               | Yes (exit 2)| No                 | Unverified |\n| UserPromptExpansion | slash-command expansion         | Yes        | No                  | Unverified |\n| Stop                | Claude finishes a turn          | Yes (exit 2)| No                 | No — inherited from §7, never independently verified; `claude doctor` accepting a matcher on Stop neither confirms nor rules out actual support |\n| StopFailure         | API error ends a turn           | No         | No                  | Unverified |\n| PreToolUse          | before each tool call           | Yes        | No                  | Unverified |\n| PermissionRequest   | permission dialog appears       | Yes        | No                  | Unverified |\n| PermissionDenied    | tool denied by auto classifier  | No         | No                  | Unverified |\n| PostToolUse         | after tool succeeds             | No*        | No                  | Unverified |\n| PostToolUseFailure  | after tool fails                | No         | No                  | Unverified |\n| PostToolBatch       | after parallel batch resolves   | Yes        | No                  | Unverified |\n| **PreCompact**      | **before compaction**           | **Yes (exit 2)**| **No**         | Yes — `\"auto\"` \u002F `\"manual\"` |\n| **PostCompact**     | **after compaction**            | **No**     | **No**              | Unverified |\n| SubagentStart       | subagent's turn begins (per-TURN, not per-lifetime — a long-lived subagent re-fires this on every continuation message it receives, TASK-219 empirical) | No | No | Unverified |\n| SubagentStop        | subagent's turn ends (per-TURN, not per-lifetime — same subagent, same `agent_id`, can accumulate many `SubagentStop` events across its life, TASK-219 empirical; see `state\u002FREADME.md`'s \"Granularity\" note) | **Yes — deliberately NOT used** (TASK-219: exiting 2 keeps the subagent running instead of finishing, which cannot create the missing record and only makes the underlying problem worse; see `hooks\u002Fpersist-subagent.mjs`, always exits 0) | No | Yes — matches against `agent_type` (TASK-219 empirical verification), but **fails open when `agent_type` is empty**: a matcher deliberately crafted to match nothing still fired for a payload where `agent_type` was `\"\"` — a matcher is unreliable in both directions (misses agents spawned with a custom `name`, over-fires when `agent_type` is absent), reinforcing rather than weakening the decision not to use one here; the hivemind hook is registered with no matcher so it fires unconditionally |\n| TaskCreated\u002FCompleted| task lifecycle                 | Yes        | No                  | Unverified |\n| TeammateIdle        | team agent idle                 | Yes        | No                  | Unverified |\n| InstructionsLoaded  | CLAUDE.md loaded                | No         | No                  | Unverified |\n| ConfigChange        | settings file changes           | Yes        | No                  | Unverified |\n| FileChanged         | watched file changes            | No         | No                  | Unverified |\n| CwdChanged          | working dir changes             | No         | No                  | Unverified |\n| WorktreeCreate\u002FRemove| worktree lifecycle             | Yes\u002FNo     | No                  | Unverified |\n| MessageDisplay      | assistant text displayed        | No         | No                  | Unverified |\n| Notification        | system notification             | No         | No                  | Unverified |\n| Elicitation\u002FResult  | MCP elicitation                 | Yes        | No                  | Unverified |\n\n**PreCompact** fires with `matcher: \"auto\"` (automatic compaction) or\n`\"manual\"` (`\u002Fcompact` command). Its payload is the common fields only — no\ntoken counts. It CAN block compaction by exiting 2, and it CAN write side\neffects (e.g., snapshot to HANDOFF.md) before returning.\n\n### 1c. Transcript JSONL parsing\n\nPath: `~\u002F.claude\u002Fprojects\u002F\u003Cproject-slug>\u002F\u003Csession-id>.jsonl`\n(also exposed as `transcript_path` in statusline JSON and hook inputs).\n\nEach line is a JSONL entry. Message entries contain `message.usage` with the\nsame Anthropic API usage fields (`input_tokens`, `output_tokens`,\n`cache_creation_input_tokens`, `cache_read_input_tokens`). A script can tail\nthis file and compute a running total, but it will lag the live context state\n(Claude Code's internal accounting may differ slightly) and requires the session\nID to locate the file.\n\n---\n\n## 2. Flush Trigger Mechanisms\n\n### 2a. What hooks CAN do\n\n- **PreCompact hook (exit 2):** blocks automatic compaction. Use this to\n  intercept auto-compaction, write a HANDOFF.md snapshot, then let compaction\n  proceed by returning 0, OR exit 2 to suppress compaction entirely.\n- **Stop hook (exit 2 + reason):** blocks Claude from finishing a\n  turn and injects a system-level message Claude reads. Can instruct Claude to\n  write a snapshot file and then type `\u002Fclear`. This is model-driven, not\n  deterministic — Claude decides whether to comply.\n- **SessionStart(compact|clear) hook:** fires after compaction or `\u002Fclear`;\n  can inject `additionalContext` or `initialUserMessage` to restore context\n  from a snapshot.\n\n### 2b. What hooks CANNOT do\n\n- **No hook can programmatically invoke `\u002Fclear`.** Hooks are passive\n  responders; they cannot issue interactive commands or session lifecycle\n  operations.\n- **No hook can call `\u002Fcompact` on the model's behalf.** Same restriction.\n- **No hook receives token\u002Fusage data** to self-detect the 35% threshold.\n\n### 2c. The shipped auto-flush design (three components)\n\nThree components work together:\n\n**Component A — Statusline threshold indicator**\nA statusline script reads `context_window.used_percentage` and displays a\ncolor-coded bar. When usage crosses 35%, it changes color and prints a\nprominent warning. This is the reliable, always-accurate signal.\n\n**Component B — Statusline-driven side-effect file (bridge)**\nThe statusline script writes a flag file (`\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.flush-\u003Cid>`)\nwhen `used_percentage >= 35`. This file acts as a shared signal between the\ndisplay layer and the hook layer.\n\n**Component C — Stop hook polling the flag file**\nA `Stop` hook reads the flag file. If it exists, the hook responds with\n`decision: \"block\"` and `reason` instructing Claude to:\n1. Write HANDOFF.md (snapshot all in-flight work).\n2. Type `\u002Fclear`.\nThe hook writes an instructed sentinel so the instruction fires only once.\n\n**Limitation:** The Stop hook fires after each assistant turn, not instantly\nwhen the threshold is crossed mid-turn. The actual flush happens at the next\nturn boundary after the threshold is reached, not at exactly 35%. At 35% this\nis acceptable — there is ample headroom before quality degrades.\n\n**Component D — SessionStart(clear|compact) hook restoring HANDOFF.md**\nOn `\u002Fclear` or `\u002Fcompact`, `SessionStart` with matcher `\"clear|compact\"` fires.\nThe hook reads HANDOFF.md and injects it via `hookSpecificOutput.additionalContext`.\n\n---\n\n## 3. Go\u002FNo-Go Verdict\n\n**TRUE fully-automatic 35%-flush is NOT achievable today.**\n\nReason: No hook receives token\u002Fusage data, so no hook can detect the 35%\nthreshold deterministically. The gap requires the model (Claude) to cooperate\nwhen the Stop hook instructs it to flush — this is model-driven, not\ndeterministic.\n\n**What IS achievable (closest feasible design):**\n\n| Component | Automatable? | Mechanism |\n|-----------|-------------|-----------|\n| Display % in statusline | Yes, fully | `context_window.used_percentage` |\n| Color-code at 35% threshold | Yes, fully | statusline script threshold |\n| Write flag file at 35% | Yes, fully | statusline script side-effect |\n| Detect flag file at turn end | Yes, fully | Stop hook reads file |\n| Write HANDOFF.md snapshot | Yes, via model | Stop hook injects instruction |\n| Execute `\u002Fclear` | No (model-driven) | Stop hook instructs Claude; model must type it |\n| Restore HANDOFF.md after `\u002Fclear` | Yes, fully | SessionStart(clear|compact) hook |\n\n**Closest feasible design summary:** Semi-automatic. The threshold detection\nand HANDOFF.md snapshot are reliable. The `\u002Fclear` execution requires Claude\nto follow the hook's instruction, which it reliably does but is not 100%\ndeterministic. In practice this is one-keystroke or zero-keystroke for the\nuser in the modal sense: the model types `\u002Fclear` without user intervention\nif it follows the hook instruction.\n\n---\n\n## 4. HANDOFF.md Snapshot Recipe\n\nMinimal fields for a snapshot that restores context across `\u002Fclear`:\n\n```markdown\n# HANDOFF.md — Context Snapshot\n**Flushed at:** \u003CISO timestamp>\n**Session:** \u003Csession_id>\n**Context at flush:** \u003Cused_percentage>%\n\n## Active Task\n\u003Cticket key, acceptance criteria summary>\n\n## Current Progress\n\u003Cwhat has been done since last flush>\n\n## Open Questions\n\u003Cunresolved items>\n\n## Next Action\n\u003Cexact next step for the resumed session>\n```\n\nThe Stop hook's `reason` message instructs Claude to write this file. The\nSessionStart hook re-injects it.\n\n---\n\n## 5. Shipped Script Contracts\n\n### 5a. statusline.mjs\n\n- Input: statusline JSON on stdin (includes `session_id`, `cwd`, `context_window`).\n- Output: one-line color-coded bar + percentage to stdout.\n- Side-effect: writes `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.flush-\u003Csession_id>` when\n  `used_percentage >= THRESHOLD`; removes both sentinels when usage drops below.\n\n### 5b. stop-hook.mjs\n\n- Input: hook JSON on stdin (includes `session_id`, `cwd`).\n- Output (armed, not yet instructed):\n  `{ \"decision\": \"block\", \"reason\": \"\u003Cinstruction>\" }`\n  **`reason` is the correct field**; `additionalContext` is silently ignored by Stop.\n- Output (not armed OR already instructed): exit 0 silently (no stdout).\n- Side-effect: writes `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F.instructed-\u003Csession_id>`\n  on first block to prevent double-instruction.\n\n### 5c. session-start.mjs\n\n- Input: hook JSON on stdin (includes `session_id`, `cwd`).\n- Matcher: `clear|compact`\n- Output (HANDOFF.md exists):\n  ```json\n  {\n    \"hookSpecificOutput\": {\n      \"hookEventName\": \"SessionStart\",\n      \"additionalContext\": \"A HANDOFF.md snapshot was found...\"\n    }\n  }\n  ```\n  **`hookSpecificOutput` envelope is required**; bare top-level `additionalContext`\n  is silently ignored by Claude Code for SessionStart.\n- Output (no HANDOFF.md): exit 0 silently.\n- Side-effect: removes both sentinels from `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F`.\n\n### 5d. usage.mjs\n\nPure functions (no I\u002FO) imported by the three scripts above:\n- `THRESHOLD` — 35 (the only magic number)\n- `readUsagePercent(data)` — extracts `context_window.used_percentage`\n- `shouldFlush(percent, alreadyFlagged)` — pure decision\n- `armedFlagName(sessionId)` — returns `.flush-\u003Cid>`\n- `instructedFlagName(sessionId)` — returns `.instructed-\u003Cid>`\n\n---\n\n## 6. Sentinel Location Design\n\nAll scripts resolve sentinels from the project `cwd` (read off their stdin JSON),\nNOT from `__dirname`. This is the **relocation-safety** requirement:\n\n- `__dirname` would point to the plugin directory (shared across all projects,\n  potentially read-only after installation).\n- `cwd` points to the consuming project's working directory, which is always\n  writable and project-scoped.\n\nSentinel directory: `\u003Ccwd>\u002F.claude\u002Fcontext-monitor\u002F`\nThis directory is created on demand (no pre-requisite setup).\n\n---\n\n## 7. Settings.json Scaffold (init-project)\n\nThe `init-project` scaffold writes\u002Fmerges `.claude\u002Fsettings.json` with these\nentries (deep-merge, never clobbers pre-existing keys or hooks). **The\nhooks.Stop\u002FSessionStart entries use the documented NESTED shape** (TASK-210)\n— the command lives inside a `hooks: [...]` array, never directly on the\nmatcher-group element. Per the official hooks reference: \"You cannot place a\nhandler directly on the matcher group. Handlers must nest inside the hooks\narray.\" A flat `{ \"type\": \"command\", \"command\": ... }` sitting directly on\nthe array element is invalid settings — `claude doctor` rejects it\n(`hooks.Stop.0.hooks: Expected array, but received undefined`) and the hook\nnever fires. `statusLine` is a *different*, unrelated settings key with a\ndifferent (flat, genuinely-honoured) shape — it is not part of the hooks\nschema and stays flat.\n\n\u003C!-- SETTINGS-SCAFFOLD-EXAMPLE:START -->\n```json\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fstatusline.mjs\\\"\"\n  },\n  \"hooks\": {\n    \"Stop\": [\n      {\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fstop-hook.mjs\\\"\"\n          }\n        ]\n      }\n    ],\n    \"SessionStart\": [\n      {\n        \"matcher\": \"clear|compact\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"node \\\"\u003CABSOLUTE_PLUGIN_ROOT>\u002Fcontext-monitor\u002Fsession-start.mjs\\\"\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\u003C!-- SETTINGS-SCAFFOLD-EXAMPLE:END -->\n\nNote `Stop` carries no `matcher` key at all — Stop does not support one.\n`SessionStart` does, and keeps `matcher: \"clear|compact\"`.\n\nProjects initialized before this fix carry the old flat shape on disk. They\nare migrated automatically, with no user action required, by\n`context-monitor\u002Fsettings-migrate.mjs` — a plugin-level `SessionStart` hook\n(registered in `hooks\u002Fhooks.json` alongside `repin.mjs`) that rewrites any\nlegacy flat entry to the nested shape in place on the very next session. See\n`src\u002Fclaude-settings.js`'s `migrateContextMonitorShape` \u002F `mergeContextMonitorSettings`\nfor the pure migration logic.\n\n`\u003CABSOLUTE_PLUGIN_ROOT>` is resolved at init time from:\n```js\nprocess.env.CLAUDE_PLUGIN_ROOT ?? resolve(fileURLToPath(import.meta.url), '..\u002F..')\n```\nThe literal absolute path is baked in — `${CLAUDE_PLUGIN_ROOT}` is NOT\nexpanded in project-level `settings.json` (see `claude-code-plugin-path-resolution`\nskill for the full rationale).\n\n---\n\n## Best Practices\n\n- **Do** use `used_percentage` directly — it is pre-calculated and accurate as\n  of Claude Code v2.1.132+. Before v2.1.132, `total_input_tokens` was\n  cumulative (not current); check version if deploying on older installs.\n- **Do** write the flag file atomically (temp + rename) to avoid race\n  conditions on Windows (see `windows-atomic-rename-not-truly-atomic` KB entry).\n- **Do** scope the flag file to `session_id` so concurrent sessions don't\n  interfere.\n- **Do not** rely on PreCompact alone for 35% detection — it fires only when\n  Claude Code decides to compact (typically much later than 35%).\n- **Do not** use PostToolUse for threshold checking — it fires per tool call,\n  not per turn, and does not have token data.\n- **Do not** use `exceeds_200k_tokens` as the threshold signal — it is a hard\n  200 k boolean, not configurable.\n\n---\n\n## Common Pitfalls\n\n- **`current_usage` is null after `\u002Fcompact`:** guard with `|| 0` before the\n  next API call repopulates it.\n- **Statusline fires on events, not on a timer:** during long tool-only turns,\n  the statusline may not update. Set `refreshInterval: 5` in settings to poll.\n- **Stop hook always blocking:** gate the `\"block\"` decision on the flag file\n  existence. A hook that unconditionally returns block creates an infinite loop.\n- **Hook not firing:** check `disableAllHooks: false` in settings. The statusline\n  is also disabled when `disableAllHooks: true`.\n- **`reason` vs `additionalContext`:** Stop hook uses `{ decision, reason }`.\n  SessionStart uses `hookSpecificOutput.additionalContext`. These are NOT\n  interchangeable — using the wrong field causes silent no-ops.\n\n---\n\n## References\n\n- [Statusline docs](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fstatusline) — full JSON schema and field descriptions.\n- [Hooks reference](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fhooks) — all hook events, input contracts, output contracts.\n- [GitHub issue #11008](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F11008) — open request to add token data to hook inputs (unimplemented).\n- [GitHub issue #13783](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F13783) — bug: statusline `context_window` pre-v2.1.132 was cumulative, not current.\n- [Context handoff repo](https:\u002F\u002Fgithub.com\u002Fwho96\u002Fclaude-code-context-handoff) — community PreCompact+SessionStart snapshot pattern.\n\n---\n\n## Provenance\n\n- **Authored by:** Developer subagent on behalf of ticket `TASK-008`.\n- **Primary sources:**\n  - https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fstatusline\n  - https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fhooks\n  - https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F11008\n  - https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code\u002Fissues\u002F13783\n  - https:\u002F\u002Fgithub.com\u002Fwho96\u002Fclaude-code-context-handoff\n- **Last verified:** 2026-06-17.\n- **TASK-219 update (2026-08-15):** `agent_id`\u002F`agent_type` presence and the\n  SubagentStop matcher\u002Fblock-vs-persist findings (§1b) are empirical, against\n  Claude Code 2.1.233, captured live via a real hook probe (not from docs) —\n  see `src\u002Fsubagent-log.js` and `state\u002FREADME.md`'s \"Subagent result\n  persistence\" section for the consumer built on these findings.\n",{"name":5,"description":7},"main","c8856147b7a3246a1e54b66126d093183805d1f3","skills\u002Fclaude-code-context-monitor",0,"https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind","https:\u002F\u002Fhivemind-ef84a.web.app","https:\u002F\u002Fgithub.com\u002FHexingBot","2026-10-10 00:50:01",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add HexingBot\u002Fhivemind --skill claude-code-context-monitor",{"tool":37,"command":38},"bunx","bunx skills add HexingBot\u002Fhivemind --skill claude-code-context-monitor",{"tool":40,"command":41},"pnpm","pnpm dlx skills add HexingBot\u002Fhivemind --skill claude-code-context-monitor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Fskills\u002Fclaude-code-context-monitor\u002FSKILL.md",true,[],[46,53,62,70,77,85],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M77MWBWY2AK0GJ91MMKAPZ0M","unknown-skill","A demo skill with no license signal at all, used to exercise the \"unknown\" classification branch of the human license gate (TASK-135).","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Funknown-skill\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":57,"licenseFileUrl":58,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M77MW9H43Z0ATZ15421K8J7D","spoofed-license-skill","A demo skill used to test TASK-150's SPDX-header-vs-LICENSE-file conflict surfacing.","GPL-3.0","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fspoofed-license-skill\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fspoofed-license-skill\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":66,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M77MW7715ENRZN6F01FDM81J","permissive-skill","A demo skill used to test assimilation of a permissively-licensed third party skill.","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fpermissive-skill\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fpermissive-skill\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M77MW3CRAPWETDAZT7E08BVS","malicious-skill","A fixture skill deliberately carrying risky content patterns, used only to exercise src\u002Fskill-scan.js (TASK-122). Never assimilated for real.","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fmalicious-skill\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":57,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M77MW1RSWW1MTQGM9TY3X37G","copyleft-skill","A demo skill used to test the human license gate for a copyleft third party skill.","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fcopyleft-skill\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskills\u002Fcopyleft-skill\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M77MVWT1EVEJ8ZYZTCG4CENE","watch","Watch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video. (assimilated for Hivemind)","https:\u002F\u002Fgithub.com\u002FHexingBot\u002Fhivemind\u002Fblob\u002Fmain\u002Fskills\u002Fwatch\u002FSKILL.md",[],[]]