L2 v0.1.0 source

prompt-offload

Uzun bir yapıştırılmış prompt'u bir dosyaya yazan ve modele ilk satırlarını path ile gönderen bir Claude Code Mod'u, böylece tek bir yapıştırma context'i doldurmaz.

Ne yapar

  1. Yazdığınız ya da Remote Control üzerinden gönderdiğiniz her prompt ölçülür. Bir notification, bir peer mesajı, bir schedule ya da başka bir plugin'in prompt'u dokunulmadan bırakılır.
  2. Limitten (varsayılan 2000 karakter) uzun bir prompt $TMPDIR/prompt-offload/<hash>.txt dosyasına, bütün ve değiştirilmeden yazılır. Hash, metni ve gönderildiği zamanı kapsar.
  3. Model prompt'un ilk 200 karakterini okur, baş kısım bir satır sonu taşıyorsa orada kesilir; sonra dosyayı, karakter sayısını ve satır sayısını adlandıran ve cevap vermeden önce dosyayı okumasını söyleyen bir satır.
  4. Transcript bir satır alır: dosyaya kaç karakter gittiği ve nereye.
  5. Başarısız bir yazma kaybolmuş bir prompt değildir: bütün prompt modele olduğu gibi ulaşır ve sebep bir kere log'lanır.

Canlı kontrolde 2980 karakterlik bir prompt dosyaya yazıldı, model dosyayı Read ile okudu ve yalnız prompt'un son kısmında olan soruyu cevapladı.

Komut

/prompt-offload              on ya da off, ve limit
/prompt-offload on | off     varsayılan on
/prompt-offload limit <n>    en az 500 karakter; session'lar arasında tutulur

Kurulum

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install prompt-offload@kilimcininkoroglu-mods

Function hook'lar early access. Flag olmadan hiçbir şey yüklenmez. Flag'i kalıcı yapmak için ~/.claude/settings.json dosyasına ekleyin:

{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }

Kurulumdan sonra

  1. $TMPDIR/prompt-offload okumasına izin verin ya da bir dosyanın ilk Read işleminin sorduğu izin sorusunu cevaplayın.
  2. Claude Code'u yeniden başlatın.

Nereye uzanır

Claude Code 2.1.278 üzerinde claude plugin validate ile doğrulandı:

❯ ./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, $.store.set (via setEnabled, setLimit), $.ui.log (via offload, report)
❯ ./register.ts env writes: nothing
❯ ./register.ts env reads: TMPDIR

Reach L2, dosya yazar ve bir process çalıştırır.

1. Okur:     gönderilen her prompt'un metnini ve origin'ini, ve TMPDIR
2. Çalıştırır: mkdir -p, argv ile
3. Gönderir: prompt'un ilk 200 karakterini ve path'i modele; makineden hiçbir şey çıkmaz
4. Saklar:   bütün prompt'u $TMPDIR/prompt-offload altında, on/off ayarını ve limiti $.store içinde
5. Düşman girdi: yalnız composer ya da Remote Control'den gelen bir prompt yazılır, dosya adı mod'un kurduğu bir hash'tir ve path hiçbir zaman bir shell'e ulaşmaz

Sınırlar

  • Dosya mod tarafından silinmez; temp dizinini sistem temizler.
  • Prompt'taki bir attachment, bir görsel ya da bir dosya referansı sayılmaz ve taşınmaz: mod yalnız metni ölçer.
  • Model bütün prompt'u görmek için bir Read çağrısına ihtiyaç duyar, yani hemen cevaplayacağı bir prompt bir tool çağrısına mal olur.
  • 500 karakterin altındaki bir limit reddedilir, çünkü 200 karakterlik bir baş kısım prompt'tan çok az şey bırakır.

Geliştirme

make install     # eslint, typescript-eslint, typescript
make lint        # complexity limiti 10, üstünde build'i düşürür
make typecheck   # /plugin-types ile üretilen .claude/types/ gerekir
make validate
make test        # claude plugin test

prompt-offload

A Claude Code Mod that 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

  1. 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.
  2. 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.
  3. The model reads the first 200 characters of the prompt, cut at a line break when the head holds one, then one line naming the file, the character count and the line count, and telling it to read the file before answering.
  4. The transcript gets one line: how many characters went to the file and where.
  5. A failed write is not a lost prompt: the whole prompt reaches the model as it is, and the reason is logged once.

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. Nothing loads without the flag. To keep it on, add this to ~/.claude/settings.json:

{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }

After installing

  1. Allow reading $TMPDIR/prompt-offload, or answer the permission question the first Read of a file raises.
  2. Restart Claude Code.

What it can reach

Validated with claude plugin validate on Claude Code 2.1.278:

❯ ./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, $.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 Read to 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, fails the build above it
make typecheck   # needs .claude/types/ from /plugin-types
make validate
make test        # claude plugin test