Novyx Hygiene
Automatic context persistence for Claude Code. One command to install, then it just works.
Your sessions survive /compact, /clear, and restarts — no export, no paste, no manual steps.
How It Works
pip install novyx-hygiene
hygiene install
That's it. From now on:
- Before
/compact: Hygiene auto-saves your session (task, decisions, files, git state) - After compact/clear/resume: Hygiene injects your context back into Claude automatically
- On disk: A
.claude/hygiene.mdfile keeps Claude oriented between sessions
No commands to remember. No context to paste. Claude just knows where you left off.
The Problem
Context fills up. You /compact or /clear. Now Claude has amnesia.
The manual workaround:
/exportto copy everything/clearto reset- Paste context back
- Re-establish where you were
- Repeat every time
Worse: if compaction hits automatically, you lose context without warning.
Novyx Hygiene makes this automatic.
Commands
hygiene install
Wire up Claude Code hooks. Run once per project (or --user for all projects).
hygiene install # Project-level (.claude/settings.local.json)
hygiene install --user # User-level (~/.claude/settings.json)
Installs hooks for:
PreCompact— auto-save before context compactionSessionStart— auto-inject after compact, clear, or resume
hygiene save <task>
Manually save session state. Also auto-writes .claude/hygiene.md.
hygiene save "Building auth flow - JWT login done, registration next"
hygiene save "Refactoring payments" -d "Use Stripe Intents API" -d "Keep backward compat"
hygiene save "Bug fix" -s "Root cause found, writing test"
Options:
-d/--decision— Record a key decision (repeatable)-s/--status— Set status (default: "In progress")-i/--session-id— Custom session ID--no-md— Skip writing.claude/hygiene.md
hygiene resume [session-id]
Print session context for pasting (useful without hooks installed).
hygiene resume # Most recent session
hygiene resume auth-flow-0309 # Specific session
hygiene inject
Emit context to stdout — used by Claude Code hooks internally. You don't need to call this directly.
hygiene score [session-id]
Check context health: freshness, file sprawl, decision tracking, mixed concerns.
$ hygiene score
Context Health: B (80/100)
========================================
Issues:
- 12 files in flight
- Changes span 5 top-level directories — possible mixed concerns
Tips:
- Consider committing completed work before continuing
- Consider splitting into focused sessions
hygiene list
List all saved sessions.
hygiene list
hygiene list -n 5
hygiene uninstall
Remove hooks.
hygiene uninstall
hygiene uninstall --user
hygiene config
hygiene config set api_key nram_xxx # Enable cloud sync
hygiene config show
What Gets Saved
Every session snapshot captures:
- Task description — what you're working on
- Key decisions — architectural choices, tradeoffs
- Status — where you left off
- Git state — branch, modified/staged/untracked files, recent commits
- Working directory — so you resume in the right place
- Timestamp — for freshness scoring
Cloud Sync (Optional)
By default, sessions are saved locally to ~/.novyx_hygiene/sessions/.
Add a Novyx API key for cloud persistence, semantic search across sessions, and cross-machine sync:
pip install novyx-hygiene[novyx]
hygiene config set api_key nram_your_key_here
How Hooks Work
After hygiene install, your .claude/settings.local.json gets:
{
"hooks": {
"PreCompact": [
{ "hooks": [{ "type": "command", "command": "hygiene save --auto --quiet", "timeout": 10 }] }
],
"SessionStart": [
{ "matcher": "compact", "hooks": [{ "type": "command", "command": "hygiene inject", "timeout": 5 }] },
{ "matcher": "clear", "hooks": [{ "type": "command", "command": "hygiene inject", "timeout": 5 }] },
{ "matcher": "resume", "hooks": [{ "type": "command", "command": "hygiene inject", "timeout": 5 }] }
]
}
}
- PreCompact hook runs
hygiene save --autobefore compaction, capturing your current state - SessionStart hooks run
hygiene injectwhich outputs your last session context to stdout — Claude reads this automatically - Hooks are additive: they won't overwrite your existing Claude Code hooks
License
MIT
Built by Novyx Labs. Stop exporting and start shipping.
Release files for novyx-hygiene 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| novyx_hygiene-2.0.0.tar.gz | 18.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| novyx_hygiene-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:33.3 kB
Release files / novyx_hygiene-2.0.0.tar.gz
| Download URL | novyx_hygiene-2.0.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b6ef8860a104df6943471e9989f635de7bd2f855a95e802c5209733dead66dd
|
|
BLAKE2b-256 checksum How to use checksums |
822d06b0e7a91e25ac719e3df8981ddb8d93536ef0f80beb04c8616aeee6671b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / novyx_hygiene-2.0.0-py3-none-any.whl
| Download URL | novyx_hygiene-2.0.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52068610cae95f44dc7c966431e778f8349d95099908cca6db7378c37e0bce94
|
|
BLAKE2b-256 checksum How to use checksums |
ca037ae8aaa02b61fef38a4b8746b609bede3ec2c42372029fcacdd321a31bcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|