What is before-compact?
before-compact is a Claude Code mod by walterreid that keeps your last turns, verbatim, across compaction. PreCompact hooks save the last turns verbatim, yours and the assistant's as two bundles (and the full arc beside them); SessionStart. It is listed under Context & memory and has no public popularity data yet.
| Type | Claude code mod |
|---|---|
| Author | walterreid |
| Repository | walterreid/before-compact |
| Popularity | no public popularity data yet |
| Category | Context & memory |
| Security | Review before installing (60/100) |
| Rank | #9,099 of 9,397 Claude Code mods; #809 in Context & memory |
| License | MIT |
| Last commit | 2026-10-28 |
| Hooks | 7 events |
| Sees | classic hooks, compaction |
| Draws on | Pane |
Is before-compact safe to install?
before-compact scores 60/100 on the MCPMods security check: Review before installing. Things to review: starts processes outside the sandbox; writes files or config; reads environment variables. It passed 4 of 8 checks.
Mod footprints come from claude plugin validate, which lists every event a mod hooks and every API call it makes without running it.
| Check | Result |
|---|---|
| No network access | Pass |
| Starts processes outside the sandbox | Review |
| Writes files or config | Review |
| Reads environment variables | Review |
| Only sees the events it hooks | Pass |
| Drives Claude (model calls, prompts) | Note |
| Passes claude plugin validate | Pass |
| Has an open-source license | Pass |
API calls in its code
| Call | What it means |
|---|---|
$.clock.every | |
$.command.register | |
$.env.get | reads env vars |
$.fs.exists | reads files |
$.fs.list | reads files |
$.fs.read | reads files |
$.fs.stat | reads files |
$.fs.write | writes files |
$.model.complete | drives Claude |
$.process.run | runs processes |
$.session.cwd | |
$.session.id | |
$.session.messages | reads the transcript |
$.session.usage | |
$.state.get | |
$.state.set | |
$.ui.invalidate | draws interface |
$.ui.log | draws interface |
$.ui.open | draws interface |
$.ui.resolve | draws interface |
$.ui.toast | draws interface |
How do I install before-compact?
- Check your Claude Code version. Mods need Claude Code 2.1.287 or later and are on by default.
claude --version
- Read its footprint. This lists every event it hooks and every API call it makes, without running it.
git clone https://github.com/walterreid/before-compact claude plugin validate ./before-compact/before-compact
- Install it. Run this in your terminal, then /reload-plugins in an open session.
claude plugin marketplace add walterreid/before-compact && claude plugin install before-compact@walterreid-plugins
Or ask Claude to set it up
Paste this into Claude Code and it installs before-compact for you:
Install the "before-compact" Claude Code mod from https://github.com/walterreid/before-compact/tree/main/before-compact. Run claude plugin validate on it first and show me what it can access before you enable it.