@audaxic/memory-claude 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,7 @@ npx @audaxic/memory-claude install
11
11
  This will:
12
12
  1. Prompt for your Audaxic API key (saved to `~/.config/audaxic/config.json`)
13
13
  2. Copy the plugin to `~/.claude/skills/audaxic-memory/`
14
+ 3. Configure the Audaxic MCP server (`.mcp.json` with your API key)
14
15
 
15
16
  The plugin auto-loads on your next Claude Code session.
16
17
 
@@ -18,30 +19,31 @@ Get your API key from: https://memory-dashboard.audaxic.com
18
19
 
19
20
  ## How It Works
20
21
 
21
- The plugin registers two Claude Code hooks:
22
+ The plugin combines three mechanisms:
22
23
 
23
- ### `UserPromptSubmit` → `inject.js`
24
+ ### Skill → auto-search on questions
24
25
 
25
- When you submit a prompt, this hook:
26
- 1. Buffers your prompt to the plugin data directory
27
- 2. Searches Audaxic Memory for relevant context (`POST /search`)
28
- 3. Injects retrieved memories as `<audaxic_memory_context>` into Claude via `additionalContext`
26
+ An Agent Skill (`skills/audaxic-memory/SKILL.md`) instructs Claude to search Audaxic Memory before answering questions about your past decisions, projects, and preferences — then answer directly from the results.
29
27
 
30
- ### `Stop` → `capture.js`
28
+ ### MCP server → trusted memory tools
31
29
 
32
- When Claude finishes responding, this hook:
33
- 1. Buffers the assistant's response
34
- 2. When the buffer reaches 30 messages, flushes to `POST /add`
35
- 3. Skips captures from automatic continuations (`stop_hook_active`)
30
+ The plugin bundles the Audaxic MCP server (`.mcp.json`), giving Claude `search_memories` / `add_memory` / `get_memories` tools. MCP tool results are trusted by Claude, so memory recall actually reaches the answer.
31
+
32
+ ### Hooks → background saving
33
+
34
+ - `UserPromptSubmit` → `inject.mjs`: buffers your prompt and injects context via `additionalContext` (a passive enhancement — injection may be deprioritized by Claude Code, which is why the skill + MCP path exists)
35
+ - `Stop` → `capture.mjs`: buffers the assistant's response; flushes to `POST /add` at 30 messages
36
36
 
37
37
  ## API Key
38
38
 
39
- The plugin reads your API key in this order:
39
+ The plugin uses your API key in this order:
40
40
 
41
41
  1. `CLAUDE_PLUGIN_OPTION_API_TOKEN` — set via the plugin's `userConfig` prompt during `/plugin install`
42
42
  2. `~/.config/audaxic/config.json` — shared config used by all Audaxic integrations
43
43
 
44
- Both hooks fail silently if no key is found — they never block Claude Code.
44
+ The key is also written into the plugin's `.mcp.json` at install time (mode 0600) so the MCP server authenticates automatically.
45
+
46
+ All scripts fail silently if no key is found — they never block Claude Code.
45
47
 
46
48
  ## Architecture
47
49
 
package/bin/install.js CHANGED
@@ -22,8 +22,9 @@ const PACKAGE_ROOT = join(__dirname, "..");
22
22
  const CONFIG_DIR = join(homedir(), ".config", "audaxic");
23
23
  const CONFIG_PATH = join(CONFIG_DIR, "config.json");
24
24
  const PLUGIN_DEST = join(homedir(), ".claude", "skills", "audaxic-memory");
25
+ const MCP_ENDPOINT = "https://memory-mcp.audaxic.com/mcp";
25
26
 
26
- const DIRS_TO_COPY = [".claude-plugin", "hooks", "scripts"];
27
+ const DIRS_TO_COPY = [".claude-plugin", "hooks", "scripts", "skills"];
27
28
 
28
29
  async function pathExists(p) {
29
30
  try {
@@ -48,6 +49,17 @@ async function copyDir(src, dest) {
48
49
  }
49
50
  }
50
51
 
52
+ async function loadApiKey() {
53
+ try {
54
+ const raw = await readFile(CONFIG_PATH, "utf-8");
55
+ const config = JSON.parse(raw);
56
+ if (typeof config.apiKey === "string" && config.apiKey.length > 0) {
57
+ return config.apiKey;
58
+ }
59
+ } catch {}
60
+ return null;
61
+ }
62
+
51
63
  async function ensureApiKeyFile(rl) {
52
64
  if (await pathExists(CONFIG_PATH)) return;
53
65
  console.log(
@@ -67,6 +79,25 @@ async function ensureApiKeyFile(rl) {
67
79
  console.log("✓ API key saved to ~/.config/audaxic/config.json");
68
80
  }
69
81
 
82
+ async function writeMcpConfig(apiKey) {
83
+ const mcpConfig = {
84
+ mcpServers: {
85
+ "audaxic-memory": {
86
+ type: "http",
87
+ url: MCP_ENDPOINT,
88
+ headers: {
89
+ Authorization: `Bearer ${apiKey}`,
90
+ },
91
+ },
92
+ },
93
+ };
94
+ await writeFile(
95
+ join(PLUGIN_DEST, ".mcp.json"),
96
+ JSON.stringify(mcpConfig, null, 2),
97
+ { mode: 0o600 }
98
+ );
99
+ }
100
+
70
101
  async function main() {
71
102
  console.log("\n╔══════════════════════════════════════════╗");
72
103
  console.log("║ Audaxic Memory — Claude Code Setup ║");
@@ -93,14 +124,26 @@ async function main() {
93
124
  await rm(destDir, { recursive: true, force: true });
94
125
  await copyDir(join(PACKAGE_ROOT, dir), destDir);
95
126
  }
127
+
128
+ const apiKey = await loadApiKey();
129
+ if (!apiKey) {
130
+ console.error(
131
+ "\nError: API key missing. Run setup again to configure it."
132
+ );
133
+ process.exit(1);
134
+ }
135
+ await writeMcpConfig(apiKey);
136
+
96
137
  console.log("✓ Plugin files copied to ~/.claude/skills/audaxic-memory/");
138
+ console.log("✓ MCP server configured (memory-mcp.audaxic.com)");
97
139
 
98
140
  console.log("\n╔══════════════════════════════════════════╗");
99
141
  console.log("║ Setup Complete! ║");
100
142
  console.log("╚══════════════════════════════════════════╝\n");
101
143
  console.log("Audaxic Memory is now active in Claude Code.");
102
- console.log(" • UserPromptSubmit → searches memory + injects context");
103
- console.log(" • Stop → buffers messages + auto-flushes at 30");
144
+ console.log(" • Skill → auto-searches memory for your questions");
145
+ console.log(" • MCP tools → search_memories / add_memory");
146
+ console.log(" • Hooks → buffers messages + auto-flushes at 30");
104
147
  console.log("\nThe plugin auto-loads on your next Claude Code session.");
105
148
  console.log("If the API key prompt doesn't appear, the key from");
106
149
  console.log("~/.config/audaxic/config.json will be used automatically.\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audaxic/memory-claude",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Claude Code plugin for Audaxic Memory — automatically saves conversation facts and injects semantic context",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "bin",
11
11
  ".claude-plugin",
12
12
  "hooks",
13
- "scripts"
13
+ "scripts",
14
+ "skills"
14
15
  ],
15
16
  "keywords": [
16
17
  "claude",
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: audaxic-memory
3
+ description: Use when the user asks about past decisions, preferences, projects, learned patterns, or anything from previous conversations, or when storing user preferences, project decisions, and learned patterns to persistent memory.
4
+ ---
5
+
6
+ # Audaxic Memory
7
+
8
+ Audaxic is the user's persistent memory layer. Use the connected Audaxic memory MCP tools to retrieve and store facts across all their AI coding agents (Claude Code, Codex, OpenCode).
9
+
10
+ ## Behavioral Triggers
11
+
12
+ ### AUTO-SEARCH before answering:
13
+ - Questions about the user's projects, plugins, decisions, or preferences ("what did I decide...", "what is the name of...", "which approach did I choose...")
14
+ - Making architectural decisions
15
+ - Adding new dependencies
16
+ - Fixing bugs (check for prior solutions)
17
+ - Starting new sessions (load preferences)
18
+
19
+ When a trigger matches, call the Audaxic memory search tool (`mcp__audaxic-memory__search_memories`, which may appear as `mcp__plugin_audaxic-memory_audaxic-memory__search_memories`) with the user's question as the query, then use the results to answer directly.
20
+
21
+ ### AUTO-SAVE after:
22
+ - User states a preference
23
+ - Decision with rationale made
24
+ - Complex bug fixed
25
+ - Project conventions learned
26
+
27
+ When a trigger matches, call `add_memory` with the fact as text.
28
+
29
+ ### DO NOT save:
30
+ - Temporary state, debug info, secrets
31
+
32
+ ## MCP Tools
33
+
34
+ - `search_memories` — query (required), user_id?, limit? — semantic search over stored memories
35
+ - `add_memory` — text (required), user_id?, metadata? — store one fact
36
+ - `get_memories` — user_id?, limit? — list stored memories
37
+
38
+ ## Content Rules
39
+
40
+ - One fact per memory
41
+ - Natural language, not keywords
42
+ - Include reasoning, not just outcomes
43
+ - Be specific for better semantic matching
44
+
45
+ ## Lifecycle
46
+
47
+ Add → Search → Update (delete + re-add) → Delete (when obsolete)