Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Run automatically on Claude Code events. Claude doesn't decide.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Two hooks that make Claude Code sessions persist into an Ālaya long-term memory server:
scripts/alaya-session-save.sh) — after each turn ends. Extracts 0–3
memories from the transcript via an LLM and POSTs them to Ālaya's /store endpoint, with
gates against saving too often and a dedup threshold to catch LLM rephrases of the same fact.
The hook returns within milliseconds and does the save in a detached copy of itself, so the
save survives the CLI exiting right after its last turn, as SDK-driven runs do.scripts/alaya-precompact.sh) — trigger auto (proactive and reactive
compaction) always passes: Claude Code never shows Claude the block message of an automatic
compaction, so a block there only skips compaction until the session hits the context limit.
Every other trigger (a manual /compact, idle compaction, which Claude Code sends as
manual, or a missing or unknown one) is blocked (exit 2) unless a
mcp__alaya__store_memory call shows up in the last 500 transcript lines, so valuable
context doesn't get compacted away unsaved. When nothing qualifies, Claude writes
ALAYA_NOTHING_TO_SAVE alone as the last line of its reply instead (nothing after it in that
turn, not even a tool call); only Claude's own text
counts, never tool results, user turns or tool inputs, and a mention of the marker inside
a sentence, a quote or a code-block example does not count. Fails closed (blocks) if the transcript or the hook input can't
be read or parsed — treated the same as "no recent save." Individual malformed transcript
lines are skipped, not fatal, but one that follows the marker clears it, so a parse error
can only block.bashjqcurlpython3 (PreCompact stdin parsing; Stop hook reply parsing, and timestamp parsing on macOS/BSD, where GNU date -d is unavailable)claude runs, with ALAYA_API_KEY auth enabled/plugin marketplace add 27b-io/alaya
/plugin install alaya-memory-hooks@alaya
or non-interactively:
claude plugin marketplace add 27b-io/alaya
claude plugin install alaya-memory-hooks@alaya
claude --plugin-dir /path/to/alaya/integrations/claude-code
Runs the hooks straight from a checkout — useful while editing them.
Either way, validate the manifest any time you change it:
claude plugin validate integrations/claude-code --strict
The hooks read plain environment variables — nothing is hardcoded. Copy the values you need
from config/alaya-hook.env.example into your shell profile,
an env file you source before launching claude, or the top-level "env" key in
~/.claude/settings.json.
| Variable | Required | Default | Purpose |
|---|---|---|---|
ALAYA_URL | yes | — | Ālaya /store endpoint |
ALAYA_API_KEY / ALAYA_API_KEY_CMD | yes | — | Ālaya bearer token, direct value or a command that prints it |
ALAYA_LLM_URL | yes | — | OpenAI-chat-completions-compatible endpoint used for extraction |
ALAYA_LLM_API_KEY / ALAYA_LLM_API_KEY_CMD | yes | — | LLM gateway key, direct value or a command that prints it |
ALAYA_LLM_MODEL | no | claude-haiku-4-5 | Extraction model |
ALAYA_MIN_DURATION_SECS | no | 120 | Skip sessions shorter than this |
ALAYA_MIN_NEW_MESSAGES | no | 5 | Skip unless N+ new user messages since the last save |
ALAYA_COOLDOWN_SECS | no | 300 | Skip if saved within this many seconds |
ALAYA_MEMORY_CAP | no | 3 | Max memories stored per Stop |
ALAYA_DEDUP_THRESHOLD | no | 0.70 | dedup_threshold sent to Ālaya's store call |
ALAYA_IMPORTANCE | no | 0.7 | metadata.importance sent to Ālaya's store call |
ALAYA_CLIENT_HOSTNAME | no | claude-code-hook | client_hostname provenance tag |
ALAYA_HOOK_STATE_DIR | no | ~/.cache/alaya-hook | Per-session save state, resolved-secret cache, failures.log |
ALAYA_SECRET_CACHE_MINUTES | no | 720 | How long a _CMD-resolved secret is cached; 0 writes no cache file (see below) |
ALAYA_PRECOMPACT_RECENT_LINES | no | 500 | PreCompact: how far back to scan for a recent save |
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground
npx claudepluginhub 27b-io/alaya --plugin alaya-memory-hooks