Write context-usage snapshots without starting a node process per write
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, shell, typescript
- Ambito
- devtools, performance
Direzione di ricerca
Read .claude/rules/mod-authoring.md, load the built-in plugin-authoring skill, then check the current mods reference for available $.fs calls. Trace writes in plugins/context-usage/hooks/register.tsx and the atomic write, lock, and prune behavior in lib/write-snapshot.mjs; review plugins/context-usage/reference/reader-contract.md and its contract tests. Done means changed writes avoid a process or document the missing filesystem call and chosen floor change, preserve reader-visible content and atomicity, and include before and after start-rate measurements in the PR.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The context-usage mod writes each session's snapshot by starting a separate process:
plugins/context-usage/hooks/register.tsx:642-644 runs node lib/write-snapshot.mjs <target> --prune
through $.process.run whenever the snapshot body changes, and again after FLOOR_MS (60 s, :12)
when it has not. The mod already runs inside Claude Code's process, so each write adds a node start
(and its Defender scan on Windows) for a small JSON file.
Evidence
- Read on
origin/mainthis pass: the spawn atregister.tsx:642-644, the floor at:12, and the
helper's job inlib/write-snapshot.mjs(atomic temp-file write and rename, lock with retries,
hourly prune at:26,:110). - Measured by another session (5-minute Windows process trace, 16 concurrent sessions, 2026-12-04, not
re-measured here):write-snapshot.mjsstarted about 11 times a minute across the sessions. On that
trace Defender CPU tracked process start rate at about 54 ms per start (correlational). $.fs.writeexists in the mod API (used inplugins/session-flow/hooks/register.tsx:45). Not
checked: whether the mod API offers an atomic rename, directory listing and removal, which the
helper's atomic write and prune need.
Proposed approach
- Check the current mods reference for the
$.fscalls available. - If they cover an atomic write, write the snapshot in the mod and keep the helper only for the
hourly prune (or move the prune in too). - If not, raise the floor or write only on a zone change, whichever keeps the documented reader
contract (plugins/context-usage/reference/reader-contract.md).
The helper is shared with rate-limits (scripts/sync-shared-copies.sh); keep the readers' contract
unchanged.
Acceptance criteria
- A snapshot write that changes the body starts no process, or the issue records which
$.fs
call is missing and the floor change taken instead. - Readers see the same file content and atomicity as today (contract tests pass).
- Measured starts per minute for one active session, before and after, in the PR.
Constraints and gotchas
- Follow
.claude/rules/mod-authoring.md(load the built-inplugin-authoringskill first). - A mod hook that throws is skipped (fails open); keep write errors logged once, as today.
Context
Part of the process-start ranking on #20549.
- Lingua principale
- Shell
- Stelle
- 22
- Fork
- 2
- Merge medio
- 3h 20m
- PR unite (30g)
- 956
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di melodic-software/claude-code-plugins
-
harness-ops plugins: recheck the userConfig 'unset key renders the literal placeholder' recordApertahost-run needs-research
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
melodic-software/claude-code-plugins#21140 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
melodic-software/claude-code-plugins#21103 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
host-run
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
melodic-software/claude-code-plugins#21053 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
melodic-software/claude-code-plugins#21021 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
melodic-software/claude-code-plugins#20960 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di melodic-software/claude-code-plugins
Issue simili
-
documentation enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
aws/aws-networking-best-practices#256 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
smores56/homelab-platform#289 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
omacom/omarchy#21787 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno