KilimcininKorOglu/claude-code-mods/tree/main/plugins/prompt-offload
prompt-offload
임시 파일에 제한 초과 프롬프트를 작성하고 모델에 파일 경로가 포함된 첫 번째 줄을 보내 컨텍스트를 저장하는 Claude Code 플러그인입니다.
이 mod 소개
프롬프트 오프로드는 귀하가 제출한 각 프롬프트를 측정합니다. 제한(기본적으로 2000 문자)보다 긴 것은 모두 $TMPDIR/prompt-offload/<hash>.txt에 기록되는 반면, 모델은 첫 번째 200 문자와 파일 이름을 지정하는 줄, 문자 수 및 줄 수를 수신합니다. session.start, command.run{command=prompt-offload} 및 프롬프트.submit을 연결하고 $.store의 설정을 유지하며 전체 프롬프트를 보려면 one 읽기 호출이 필요합니다. Reach는 L2입니다. 프롬프트 텍스트와 TMPDIR을 읽고, mkdir -p를 실행하고, 파일을 쓰고, 모든 것을 시스템에 유지합니다. claude plugin marketplace add KilimcininKorOglu/claude-code-mods를 통해 설치한 다음 claude plugin install prompt-offload@kilimcininkoroglu-mods를 통해 설치합니다. Claude Code 2.1.288+ 및 다시 시작이 필요합니다.
설치
먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.
claude plugin marketplace add KilimcininKorOglu/claude-code-mods claude plugin install prompt-offload
원문 / README
prompt-offload
You paste a long log, a stack trace or a whole file into the prompt, and all of it stays in the context for the rest of the session, also when the model needed one part of it. This mod writes a long pasted prompt to a file and sends the model its first lines with the path, so one paste does not fill the context.
What it does
- Each prompt you type, or send through Remote Control, is measured. A notification, a peer message, a schedule or another plugin's prompt is left alone.
- A prompt longer than the limit (2000 characters by default) is written to
$TMPDIR/prompt-offload/<hash>.txt, whole and unchanged. The hash covers the text and the time it was sent. - The model reads the first 200 characters of the prompt, then one line naming the file, the character count and the line count, and telling it to read the file before answering. When those 200 characters hold a line break past their middle, the head is cut at the last one.
- The transcript gets one line: how many characters went to the file and where.
- A failed write is not a lost prompt: the whole prompt reaches the model as it is, and the reason is logged once until a different one comes.
In the live check a 2980-character prompt was written to the file, the model read the file with Read and answered the question that only the tail of the prompt held.
Command
/prompt-offload on or off, and the limit
/prompt-offload on | off on by default
/prompt-offload limit <n> at least 500 characters; kept across sessions
Install
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install prompt-offload@kilimcininkoroglu-mods
Function hooks are early access. Claude Code 2.1.288 and later load them by default, so there is nothing to switch on.
After installing
- Allow reading
$TMPDIR/prompt-offload, or answer the permission question the firstReadof a file raises. - Restart Claude Code.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.283:
❯ ./register.ts hooks: session.start, command.run{command=prompt-offload}, prompt.submit
❯ ./register.ts calls: $.clock.now (via offload), $.command.register, $.env.get (via tempDir), $.fs.write (via offload), $.process.run (via tempDir), $.store.get (via readSettings), $.store.set (via setEnabled, setLimit), $.ui.log (via offload, report)
❯ ./register.ts env writes: nothing
❯ ./register.ts env reads: TMPDIR
Reach L2, writes files and runs a process.
1. Reads: the text and origin of each submitted prompt, and TMPDIR
2. Runs: mkdir -p, by argv
3. Sends: the first 200 characters of the prompt and the path to the model; nothing leaves the machine
4. Persists: the whole prompt under $TMPDIR/prompt-offload, and the on/off setting and the limit in $.store
5. Hostile input: only a prompt from the composer or Remote Control is written, the file name is a hash the mod builds, and the path never reaches a shell
Limits
- The file is not deleted by the mod; the system clears the temp directory.
- An attachment, an image or a file reference in the prompt is not counted or moved: the mod measures the text alone.
- The model needs one
Readto see the whole prompt, so a prompt it would have answered at once costs one tool call. - A limit under 500 characters is refused, because a head of 200 characters leaves too little of the prompt behind.
Development
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test
