Skip to content
Novyx Core Capability

Hygiene

Automatic context persistence for Claude Code. One command to install, then it just works.

bash
pip install novyx-hygiene
hygiene install

That's it. Your sessions now survive /compact, /clear, and restarts — no export, no paste, no manual steps.

Built for Claude CodeRead the full guide →

Before & After

Without Hygiene

Manual loop

1
/exportCopy everything
2
/clearReset context
3
pasteRe-inject context
4
???Re-establish state
5
repeatEvery. Single. Time.
With Hygiene

Automatic

1
workWrite code normally
/compactHygiene auto-saves before
resumeContext injected automatically

Claude just knows where you left off.

bash
pip install novyx-hygiene && hygiene install

That's it. Two commands, zero ongoing effort.

How It Works

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.md file keeps Claude oriented between sessions.

See It in Action

zsh
$ pip install novyx-hygiene
Successfully installed novyx-hygiene-2.0.0
$ hygiene install
✓ Hooks installed in .claude/settings.local.json
✓ PreCompact: hygiene save --auto
✓ SessionStart: hygiene inject (compact, clear, resume)
// ... you work for 2 hours, context fills up ...
claude > /compact
[PreCompact] Session saved: auth-flow-0311
Compacting conversation...
claude > new session starts
[SessionStart] Injecting context from auth-flow-0311...
✓ Task: Building auth flow - JWT login done, registration next
✓ Branch: feat/auth-flow (3 files modified)
✓ 2 key decisions restored
Claude picks up exactly where you left off. Zero manual steps.

Hook Workflow

After hygiene install, your .claude/settings.local.json gets:

json
{
  "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

Auto-save

Before context is lost

SessionStart

Auto-inject

When session resumes

On disk

.claude/hygiene.md

Claude reads it natively

  • Hooks are additive — they won't overwrite your existing Claude Code hooks

What Gets Saved

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

Example .claude/hygiene.md (auto-generated):

markdown
# Session Context
## Task
Building auth flow - JWT login done, registration next

## Key Decisions
- Use Stripe Intents API for payments
- Keep backward compat with v1 tokens

## Status
In progress — registration endpoint scaffolded

## Git State
Branch: feat/auth-flow
Modified: src/auth.py, src/routes/register.py
Staged: src/middleware/jwt.py
Recent: "feat: add JWT login endpoint" (2m ago)

## Working Directory
~/Code/novyx-core

Commands

hygiene install

Wire up Claude Code hooks. Run once per project or globally.

bash
hygiene install          # Project-level (.claude/settings.local.json)
hygiene install --user   # User-level (~/.claude/settings.json)

hygiene save <task>

Manually save session state. Also auto-writes .claude/hygiene.md.

bash
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"

hygiene resume [session-id]

Print session context for pasting (useful without hooks installed).

bash
hygiene resume                    # Most recent session
hygiene resume auth-flow-0309     # Specific session

hygiene score [session-id]

Check context health: freshness, file sprawl, decision tracking.

bash
$ 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.

bash
hygiene list
hygiene list -n 5

hygiene config

Configure cloud sync and other settings.

bash
hygiene config set api_key nram_xxx    # Enable cloud sync
hygiene config show

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:

bash
pip install novyx-hygiene[novyx]
hygiene config set api_key nram_your_key_here

Free to start, cloud sync on paid tiers

Local mode works with zero configuration. Cloud sync requires a Novyx API key.

Free: 5,000 memoriesStarter: $12/moPro: $39/mo
See full pricing →

Uninstall

bash
hygiene uninstall          # Remove project hooks
hygiene uninstall --user   # Remove user-level hooks

Why not just a CLAUDE.md file?

CLAUDE.mdStatic
  • Written once, goes stale
  • Doesn't know your git state
  • Lost on /compact
  • No session history
  • Manual maintenance
hygiene.mdLive
  • Auto-updates every session
  • Captures branch, modified files, staged changes
  • Saved before /compact via hooks
  • Full session history — resume any state by ID
  • Health scoring: freshness, sprawl, mixed concerns

CLAUDE.md is great for project-level instructions. Hygiene handles session-level state that changes every hour.

Stop exporting. Start shipping.

Two commands. Your sessions survive everything. Context that just works.

bash
pip install novyx-hygiene
hygiene install

Start Free

Enter your email to create your developer account.

View on PyPI