ai_automation_suggester
맞춤형 Home Assistant 통합으로 엔티티를 자동 스캔하고 새 기기를 감지합니다
/fc for Claude Code: shrink old tool output in about a second — Jev keeps what's still needed, every cut saved to a file. Your /compact stays untouched.
플러그인TypeScriptGitHub @NodarDavituri직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
설치형 프로젝트는 배포 도메인 없이도 확인할 수 있습니다. 개인 저장소는 GitHub 로그인으로, 조직 저장소는 위의 저장소 확인 파일로 직접 확인해 주세요.
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
A second, fast compaction command for Claude Code.
/fc (or /fast-compact) shrinks old tool output in about a second. Jev, TypeSafe's fast decision model, picks which outputs are still needed and keeps those whole. Everything else is cut to its start and end, and the full text is saved to a file Claude can read back.
Claude Code's own /compact stays exactly as it is. Use /fc as you go, and /compact when the conversation itself needs summarising.README 전문 보기 ↗Free up Claude Code's context in about a second, without summarising anything away.
/fc (or /fast-compact) cuts old tool output (file reads, logs, test runs Claude has already used) down to its start and end. Every cut is saved to a file Claude can read back. Optionally, Jev, a fast decision model, picks which outputs to keep whole. Claude Code's own /compact stays exactly as it is: use /fc as you go, and /compact when the conversation itself needs summarising.
/fc would free right nowHow much it frees depends on the session. /fc only shrinks tool output and long tool inputs, never what you or Claude wrote. A session full of file reads, logs and test runs can drop by a third or more in one go; one that's mostly discussion may free almost nothing, and then /compact is the right tool. The meter tells you which kind of session you're in before you run it.
claude plugin marketplace add NodarDavituri/fast-compact
claude plugin install fast-compact@fast-compact
Turn on function hooks ("CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" under env in ~/.claude/settings.json), restart Claude Code, and type /fc. To let Jev choose what stays whole, add a key (Install).
What a run reports:
❯ /fc
⎿ fast-compact: compacting…
❯ /compact [fast-compact]
⎿ Compacted
⏺ fast-compact: 103k → 81k chars (−21%); 4 outputs cut; Jev typesafe/jev-1.13-20260917: 1 request, 0.6 s, $0.0002.
Full text of every cut: ~/.claude/fast-compact/<session>/
[fast-compact: cut 5707 chars from the middle of this output; the full text is in ~/.claude/fast-compact/<session>/output-<id>.txt — read it before relying on what was cut]If Jev can't be reached, or no key is set, the newest outputs are kept whole instead and the report says why. /fc never falls back to Claude Code's slow built-in summary.
Jev is optional. Without it, /fc keeps the newest old outputs whole instead of Jev's picks. In the replay below that keeps 73% of later-needed outputs usable instead of 75%, and frees a little less, but nothing leaves your machine and there's no key to set. Leave the key unset, or set provider to none to skip Jev even when a key is in your environment.
Add a focus if you like: /fc keep the migration plan.
fast-jev-compaction by tamaratran had the idea: cheap Jev decisions instead of a slow summary. fast-compact started from it, measured it on real sessions, and changed what didn't hold up.
| fast-jev-compaction | fast-compact | |
|---|---|---|
| How you run it | Takes over /compact and auto-compaction | Its own /fc; /compact is untouched |
| Old tool calls | Almost all deleted (98% in our replay), output and all | Never deleted; long output is cut to its start and end |
| A needed detail gets cut | Gone | Saved to a file; Claude reads it back |
| Can't free enough | Falls back to the slow built-in summary | Never summarises; says why |
After --resume | The full old history comes back | Stays compacted |
| Jev provider | TypeSafe only — its firewall blocks many real sessions | OpenRouter (default) or TypeSafe |
Deleting calls also caused a subtler problem: Claude's own notes about the deleted work stayed behind without the calls, and one session went on to report nine pieces of work it had never done (upstream #65). fast-compact keeps every call, and every cut says where its full text is.
We replayed 122 moments from 59 real Claude Code sessions and checked which tool output each session actually used afterwards. (Method and every number: bench/.)
| How old output was handled | Output kept | Later-needed outputs that stayed usable |
|---|---|---|
| fast-compact — Jev picks what stays whole | 57% | 75% |
| Every output cut to start and end, same size | 57% | 69% |
| The newest outputs stay whole, no Jev | 61% | 73% |
| fast-jev-compaction as shipped | 0% | 1% |
An output counts as usable when the detail the session later relied on survived the cut.
Four model reviewers also judged 100 outputs blind. Jev's ranking agreed with them more than ranking by size, by recency, or by the original plugin's scoring. The reviewers also found that about 40% of needed outputs had the useful part in the middle or spread throughout — which no start-and-end cut keeps. That's why every cut is saved to disk.
You need:
/fc still works (above).Turn on function hooks in ~/.claude/settings.json, and add the key there too if you have one:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1", "OPENROUTER_API_KEY": "sk-or-…" } }
Install the plugin:
claude plugin marketplace add NodarDavituri/fast-compact
claude plugin install fast-compact@fast-compact
Restart Claude Code (or run /reload-plugins) and type /fc. The installer mentions options "not yet set" — that's fine: the defaults below apply until you change them.
You can also keep the key in the plugin's own apiKey option (/plugin configure fast-compact); Claude Code stores it securely.
Claude Code doesn't update plugins from this marketplace on its own unless you turn it on: run /plugin, open the Marketplaces tab, select fast-compact and choose Enable auto-update. New versions are then installed in the background and load in your next session.
To update by hand:
claude plugin marketplace update fast-compact
claude plugin update fast-compact@fast-compact
Then restart Claude Code or run /reload-plugins. What changed in each version, and anything you need to do, is in CHANGELOG.md.
Change them with /plugin configure fast-compact, or in settings.json under pluginConfigs["fast-compact@fast-compact"].options.
| Option | Default | What it does |
|---|---|---|
provider | openrouter | openrouter (key in OPENROUTER_API_KEY), typesafe (TYPESAFE_API_KEY), or none: never ask Jev. Any other value counts as none |
apiKey | — | The key, instead of the environment |
baseUrl | the provider's | Another System One endpoint |
model | jev-latest | Model name sent to Jev |
keepRecentCalls | 10 | How many of the newest tool calls are never cut |
cutTo | 1500 | Characters a cut keeps: two thirds from the start, one third from the end |
keepWhole | 0.25 | Largest share of old output Jev may keep whole |
minKeepScore | 0.45 | Jev's lowest score for keeping an output whole |
cutInputs | true | Also trim long old tool inputs |
sendSamples | true | Show Jev the first 200 and last 100 characters of each output it ranks |
resumeSafe | true | Keep the compaction when you --resume the session |
autoCompact | false | Cut instead of summarising when Claude Code compacts on its own (below) |
meter | prompt | Show what /fc would free: prompt, statusline, both or off (below) |
With autoCompact on, Claude Code's own auto-compaction gets the /fc treatment: old tool output is cut, Jev keeps what's still needed, every cut is saved to a file. It takes about a second instead of a minute or more, and nothing is summarised away.
When the cut would free less than a fifth of the conversation, Claude Code summarises as usual: with less, the context would stay near its limit and compact again a few turns later. The same happens if anything goes wrong. /compact, subagents and Claude Code's background precompute are never touched.
Each run adds a ledger line with "trigger":"auto".
meter works out after each turn what /fc would free right now. It runs the same cut with the newest outputs kept whole instead of asking Jev, so it sends nothing anywhere and takes a few milliseconds.
/fc usually frees more than the meter says. Jev keeps whole only what it rates as still needed, often less than the meter assumes, and the compaction also drops Claude's hidden reasoning from older messages (with resumeSafe, the default), which the meter can't see. In one session the meter said 12% and the context went from 40% to 12%.
prompt (the default) pins a line under the prompt: /fc frees ~30k tokens (3%) · hide: /plugin configure fast-compact → meter, the percentage being the share of the context window; the hint is dropped after the first three lines of a session. It appears at the end of a turn once there's at least 2k tokens to free in outputs older than the newest keepRecentCalls (10) tool calls, and clears when the conversation is compacted.statusline writes the token count to ~/.claude/fast-compact/meter/<session id> (empty when there's less than 2k to free, and right after a compaction), for your status line command to read.both does both, and off shows nothing.This shows it as the share of the context window /fc would free — /fc −3% with 11% used means /fc would take you to about 8%:
input=$(cat)
freed=$(cat "$HOME/.claude/fast-compact/meter/$(echo "$input" | jq -r .session_id)" 2>/dev/null)
size=$(echo "$input" | jq -r '.context_window.context_window_size // 0')
if [ -n "$freed" ] && [ "$size" -gt 0 ]; then
pct=$(( (freed * 100 + size / 2) / size ))
if [ "$pct" -gt 0 ]; then printf '/fc −%s%%' "$pct"; fi
fi
Or, in tokens: [ -n "$freed" ] && printf '/fc −%sk' $((freed / 1000)).
Sent to Jev, each time you run /fc (and on auto-compaction, with autoCompact on):
sendSamples: the first 200 and last 100 characters of each output Jev ranksWith the default provider, this goes to Jev through OpenRouter. After an earlier /fc, the markers in cut tool inputs name their archive file, so what's sent includes your home folder's path and the session id.
Secrets that look like keys, tokens, passwords, private keys or URLs with passwords are masked before sending. The masking works by pattern, so treat it as a safety net, not a guarantee. With no key set, or provider set to none, nothing is sent.
Kept on your machine:
~/.claude/fast-compact/<session>/ — next to where Claude Code already keeps your transcripts/fc (sizes, counts, cost) in ~/.claude/fast-compact/ledger-<year>-<month>.jsonlmeter set to statusline or both, one small file per session in ~/.claude/fast-compact/meter/Nothing is deleted automatically. To clear sessions older than a month:
find ~/.claude/fast-compact -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -r {} +
/fc stops working, run claude plugin validate and check a --debug-file log for the plugin's hooks module … loaded line./compact [fast-compact] in the transcript. Claude Code doesn't let a plugin run a compaction from its own command, so /fc runs the built-in /compact with a marker and answers it itself. Any /compact whose instructions start with [fast-compact] is handled by this plugin — including one you type yourself./compact./compact that /fc schedules runs Claude Code's own summary. fast-compact notices this the first time, says so, and turns /fc and the meter off for that session.resumeSafe has a small cost: older messages lose Claude's hidden reasoning, and a message that held only an image is dropped. Text and tool calls stay.autoCompact, the spinner can get stuck. In Claude Code 2.1.296, after a plugin answers an auto-compaction, the spinner says "Running SessionStart hooks…" until the turn ends. Claude keeps working underneath; let the turn finish rather than pressing Esc.bun bench/run.ts --jev.bun install
bun run typecheck
bun run test # core tests, plus the plugin in Claude Code's own test host
bun run validate
src/ — the logic (no Node APIs and no dependencies: hooks run in their own environment)hooks/fast-compact.ts — the Claude Code sidetests/core, tests/plugin — the tests.claude-plugin/types/ — Claude Code's plugin API types, which Claude Code writes when a session loads this folder as a plugin (gitignored; the typecheck reads them)bench/ — the replay bench behind the numbers abovedocs/design.md — why it works this way, what was turned down, and what's still openBuilt on tamaratran/fast-jev-compaction (MIT): the idea, the way the conversation is fitted into Jev's input (src/state.ts), and the original library, kept in bench/upstream/ so the bench can measure it. Its unmerged bash-output-trim branch was the first to save cut output to a file.
ggagosh contributed the autoCompact and meter options and the fix for parallel tool calls after a compaction (#1).
Issues and pull requests on that repository shaped this one:
MIT