Secure HydraDB automation for Claude Code with markdown-first workspace sync, prompt-time recall, and configurable memory capture modes.
The plugin gives Claude Code persistent, cross-session memory powered by HydraDB. It hooks into the Claude Code lifecycle to automatically recall relevant context at prompt time, sync workspace documentation into HydraDB, and capture conversation content as durable memories.
- Automatic recall — injects relevant memories and knowledge into Claude's context on every prompt
- Workspace sync — syncs markdown-first documentation (
*.md,*.mdx,CLAUDE.md) into HydraDB - Session capture — saves conversation content as evolving session memories or isolated turn memories
- Graph context — surfaces entity path chains and chunk-level relations from HydraDB's knowledge graph
- Secret redaction — removes the secret formats listed in the redaction contract before any data leaves the workspace
- Configurable modes — fine-grained control over capture, search, and ingestion behavior
- Node.js >= 18
- npm
- A HydraDB account with an API key and a database — sign up at hydradb.com
- Claude Code installed
Set your credentials in the shell that starts Claude Code:
export HYDRADB_API_KEY="your-api-key"
export HYDRADB_DATABASE="your-database"
# Optional. When it is not set, the plugin uses the database's default collection.
export HYDRADB_COLLECTION="your-collection"Install the plugin in Claude Code:
/plugin marketplace add hydra-db/hydradb-claude-code
/plugin install hydradb@hydradb
Restart Claude Code and run /hydradb:status. It must show configured: true.
git clone https://github.com/hydra-db/hydradb-claude-code.git
cd hydradb-claude-code
make bootstrapThe bootstrap script:
- Checks that Node.js >= 18 and npm are installed
- Runs
npm install - Creates
config.jsonin the checkout fromconfig.example.json(if it does not exist) - Runs the checks
- Prints the next steps
The plugin reads config.json only when HYDRADB_PLUGIN_CONFIG names it. To use the file, put your values in it and set:
export HYDRADB_PLUGIN_CONFIG="/absolute/path/to/hydradb-claude-code/config.json"Then install from the checkout:
/plugin marketplace add /absolute/path/to/hydradb-claude-code
/plugin install hydradb@hydradb
The plugin resolves configuration from multiple layers (later layers override earlier ones):
- Built-in defaults
HYDRADB_PLUGIN_CONFIGenvironment variable${CLAUDE_PLUGIN_DATA}/config.json./.hydradb-plugin-data/config.json.hydradb-plugin.json.hydradb-plugin.local.json- Environment variable overrides
{
"apiBaseUrl": "https://api.hydradb.com",
"apiKey": "${HYDRADB_API_KEY}",
"tenantId": "${HYDRADB_DATABASE}",
"subTenantId": "",
"autoRecall": true,
"autoIngest": true,
"captureMode": "session-upsert",
"searchMode": "memory",
"ingestionMode": "memory"
}| Field | Default | Description |
|---|---|---|
apiBaseUrl |
https://api.hydradb.com |
HydraDB API endpoint |
apiKey |
— | HydraDB API key (use ${HYDRADB_API_KEY} to reference env var) |
tenantId |
— | HydraDB database (use ${HYDRADB_DATABASE} to reference env var) |
subTenantId |
"" |
HydraDB collection; "" uses the database's default collection |
userName |
— | Display name attached to captured memories |
autoRecall |
true |
Automatically recall HydraDB context on each user prompt |
autoIngest |
true |
Automatically sync workspace docs on session start |
captureMode |
session-upsert |
turn, session-upsert, both, or off |
searchMode |
memory |
memory, knowledge, or both |
ingestionMode |
memory |
memory, knowledge, or auto |
recallMode |
thinking |
Recall strategy passed to HydraDB |
graphContext |
true |
Include graph entity paths and relations in recall |
maxContextChars |
7000 |
Max characters injected into Claude's context per prompt. Recall keeps 1200 characters of each chunk (700 when injected); a cut chunk or block ends with a [truncated: N more characters ...] marker |
maxMemoryResults |
6 |
Max memory chunks returned per recall |
maxKnowledgeResults |
4 |
Max knowledge chunks returned per recall |
requestTimeoutMs |
15000 |
Timeout for HydraDB read requests |
writeTimeoutMs |
15000 |
Timeout for HydraDB write requests |
maxFileSizeBytes |
52428800 |
Max file size for workspace sync (50 MB) |
maxFilesPerSync |
25 |
Max files synced per workspace sync run |
includeGlobs |
["CLAUDE.md", ".claude/**/*.md", "**/*.md", "**/*.mdx"] |
File patterns to include in workspace sync |
excludeGlobs |
(see config.example.json) | File patterns to exclude from workspace sync |
ignoreMarker |
hydra-ignore |
Marker string to skip capture/sync for specific files or prompts |
memoryCustomInstructions |
(see config.example.json) | Instructions for memory extraction from conversations |
workspaceMemoryCustomInstructions |
(see config.example.json) | Instructions for memory extraction from workspace docs |
debug |
false |
Enable JSONL debug logging |
| Variable | Overrides |
|---|---|
HYDRADB_API_KEY |
apiKey |
HYDRADB_DATABASE |
tenantId |
HYDRADB_COLLECTION |
subTenantId |
HYDRADB_BASE_URL |
apiBaseUrl |
HYDRADB_USER_NAME |
userName |
HYDRADB_REQUEST_TIMEOUT_MS |
requestTimeoutMs |
HYDRADB_WRITE_TIMEOUT_MS |
writeTimeoutMs |
HYDRADB_DEBUG |
debug |
HYDRADB_TENANT_ID and HYDRADB_SUB_TENANT_ID are deprecated names for HYDRADB_DATABASE and HYDRADB_COLLECTION. They still work, and the plugin prints a warning when you use them.
| Command | Description |
|---|---|
/hydradb:setup |
Configure the plugin for the current workspace |
/hydradb:status |
Inspect plugin configuration and sync state |
/hydradb:search <query> |
Manually query HydraDB using the configured search mode |
/hydradb:remember <text> |
Store a durable note, preference, or decision in HydraDB |
/hydradb:save-session |
Save the current session as an evolving memory in HydraDB |
/hydradb:sync-workspace [--force] |
Force an immediate workspace doc sync |
/hydradb:last-recall |
Inspect the most recent auto-recall payload for debugging |
The plugin registers hooks into the Claude Code lifecycle:
- SessionStart — prints HydraDB status and triggers async workspace sync
- UserPromptSubmit — recalls relevant context from HydraDB and injects it as a
<hydradb-context>block - PostToolUse — captures file-write activity for incremental sync
- Stop — captures the completed turn (user prompt + assistant response) into HydraDB
| Mode | Behavior |
|---|---|
turn |
Save isolated user/assistant pairs as individual memories |
session-upsert |
Keep one evolving session transcript that gets upserted after each response |
both |
Do both |
off |
No automatic conversation capture (use /hydradb:remember or /hydradb:save-session manually) |
| Mode | Behavior |
|---|---|
memory |
Recall memories only |
knowledge |
Recall knowledge only |
both |
Recall memories and knowledge in parallel |
| Mode | Behavior |
|---|---|
memory |
Sync workspace docs into memory using infer |
knowledge |
Sync workspace docs as knowledge |
auto |
Prefer memory, fall back to knowledge for larger files |
Tip: If you use
ingestionMode: "auto", pair it withsearchMode: "both"so recall can see both storage paths.
Add hydra-ignore (or your custom ignoreMarker) to:
- A file — to exclude it from workspace sync
- A prompt — to skip saving that prompt and its reply
Note: The ignore marker skips capture and sync. It does not disable recall for that prompt.
- Run
/hydradb:last-recallto inspect whether prompt-time recall fired and what was returned - Start Claude Code with
HYDRADB_DEBUG=truefor a JSONL trace in${CLAUDE_PLUGIN_DATA}/debug.log - Run
/hydradb:statusto check configuration and tracked state
├── .claude-plugin/ # Claude Code plugin manifest
│ ├── plugin.json
│ └── marketplace.json
├── docs/ # Documentation
│ ├── usage.md # Detailed usage guide
│ └── security.md # Security and reliability notes
├── hooks/ # Claude Code lifecycle hooks
│ └── hooks.json
├── scripts/ # Plugin runtime scripts
│ ├── bootstrap.sh # Zero-to-running setup script
│ ├── run-plugin.sh # Hook runner (finds node, invokes plugin.mjs)
│ ├── plugin.mjs # Main plugin entry point
│ ├── check.mjs # Syntax and integration checks
│ └── lib/ # Core modules
│ ├── config.mjs
│ ├── context-format.mjs
│ ├── hydra-client.mjs
│ ├── sanitize.mjs
│ ├── state.mjs
│ └── workspace-sync.mjs
├── skills/ # Slash command definitions
│ ├── auto-recall/ # Proactive context recall (model-invoked)
│ ├── hydradb-context/ # Background guidance for injected context
│ ├── last-recall/ # /hydradb:last-recall
│ ├── recall/ # Deprecated alias → /hydradb:search
│ ├── reindex/ # Deprecated alias → /hydradb:sync-workspace
│ ├── remember/ # /hydradb:remember
│ ├── save-session/ # /hydradb:save-session
│ ├── search/ # /hydradb:search
│ ├── setup/ # /hydradb:setup
│ ├── status/ # /hydradb:status
│ └── sync-workspace/ # /hydradb:sync-workspace
├── config.example.json # Full config template
├── .hydradb-plugin.json.example # Workspace config template
├── Makefile # Build and development targets
├── package.json
├── LICENSE # Apache 2.0
└── README.md
| Target | Description |
|---|---|
make help |
Show available targets (default) |
make bootstrap |
Zero-to-running setup: install deps, create config, run checks |
make install |
Install npm dependencies |
make check |
Run syntax and integration checks |
make clean |
Remove node_modules/ |
- Fork the repository
- Create a feature branch:
git checkout -b my-feature - Make your changes
- Run checks:
make check - Commit with a descriptive message
- Open a pull request
Please keep changes focused and include relevant context in your PR description.
Apache 2.0 — Copyright (c) 2026 HydraDB