@mndrk/memx 0.3.1 → 0.3.2

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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "memx",
3
+ "description": "Persistent memory for AI agents - git-backed, branch-per-task state management",
4
+ "version": "0.3.1",
5
+ "author": "mndrk",
6
+ "repository": "https://github.com/ramarlina/memx",
7
+ "mcp": "./.mcp.json"
8
+ }
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "mem": {
4
+ "command": "node",
5
+ "args": ["${CLAUDE_PLUGIN_ROOT}/mcp.js"]
6
+ }
7
+ }
8
+ }
package/README.md CHANGED
@@ -152,6 +152,21 @@ mem cron export
152
152
 
153
153
  ## For AI Agents
154
154
 
155
+ ### Claude Code Plugin
156
+
157
+ Install as a Claude Code plugin for automatic skill loading and slash commands:
158
+
159
+ ```bash
160
+ claude plugin install github:ramarlina/memx
161
+ ```
162
+
163
+ This adds:
164
+ - **Skill**: Claude learns how to use mem automatically
165
+ - **MCP Server**: Direct tool access
166
+ - **Commands**: `/mem:status`, `/mem:checkpoint`, `/mem:context`
167
+
168
+ ### Manual Setup
169
+
155
170
  Install the skill so LLMs know how to use mem:
156
171
 
157
172
  ```bash
@@ -0,0 +1,19 @@
1
+ # /mem:checkpoint - Save Progress
2
+
3
+ Save a checkpoint with a message describing current progress.
4
+
5
+ ## Usage
6
+ ```
7
+ /mem:checkpoint <message>
8
+ ```
9
+
10
+ ## Arguments
11
+ - `$ARGUMENTS` - The checkpoint message describing what was accomplished
12
+
13
+ ## Implementation
14
+
15
+ ```bash
16
+ mem checkpoint "$ARGUMENTS"
17
+ ```
18
+
19
+ Confirm the checkpoint was saved.
@@ -0,0 +1,16 @@
1
+ # /mem:context - Load Full Context
2
+
3
+ Load the complete task context including goal, state, and learnings.
4
+
5
+ ## Usage
6
+ ```
7
+ /mem:context
8
+ ```
9
+
10
+ ## Implementation
11
+
12
+ ```bash
13
+ mem context
14
+ ```
15
+
16
+ Display the full context to understand the current task state.
@@ -0,0 +1,24 @@
1
+ # /mem:status - Show Memory Status
2
+
3
+ Show the current task status, progress, and next step.
4
+
5
+ ## Usage
6
+ ```
7
+ /mem:status
8
+ ```
9
+
10
+ ## Implementation
11
+
12
+ Run `mem status` to get the current state:
13
+
14
+ ```bash
15
+ mem status
16
+ ```
17
+
18
+ Then run `mem progress` to see completion percentage:
19
+
20
+ ```bash
21
+ mem progress
22
+ ```
23
+
24
+ Report both outputs to the user in a clear summary.
package/index.js CHANGED
@@ -191,11 +191,19 @@ function findMemDir(startDir = process.cwd()) {
191
191
  // Then check central ~/.mem with index
192
192
  if (fs.existsSync(CENTRAL_MEM) && fs.existsSync(path.join(CENTRAL_MEM, '.git'))) {
193
193
  const index = loadIndex();
194
- const taskBranch = index[startDir];
195
- if (taskBranch) {
196
- return { memDir: CENTRAL_MEM, isLocal: false, taskBranch };
194
+ // Exact match first
195
+ if (index[startDir]) {
196
+ return { memDir: CENTRAL_MEM, isLocal: false, taskBranch: index[startDir] };
197
197
  }
198
- // Central exists but no mapping for this dir
198
+ // Check parent directories (for monorepo/subdirectory usage)
199
+ let checkDir = startDir;
200
+ while (checkDir !== path.dirname(checkDir)) {
201
+ checkDir = path.dirname(checkDir);
202
+ if (index[checkDir]) {
203
+ return { memDir: CENTRAL_MEM, isLocal: false, taskBranch: index[checkDir] };
204
+ }
205
+ }
206
+ // Central exists but no mapping for this dir or parents
199
207
  return { memDir: CENTRAL_MEM, isLocal: false, taskBranch: null, unmapped: true };
200
208
  }
201
209
 
@@ -1646,8 +1654,13 @@ function cmdCronExport(memDir) {
1646
1654
  return;
1647
1655
  }
1648
1656
 
1657
+ // Detect PATH from current environment for cron (which has minimal PATH)
1658
+ const nodeBin = path.dirname(process.execPath);
1659
+ const pathDirs = [nodeBin, '/usr/local/bin', '/usr/bin', '/bin'];
1660
+ const pathPrefix = `PATH=${pathDirs.join(':')}`;
1661
+
1649
1662
  const command = frontmatter.wake_command || `cd ${memDir} && mem context`;
1650
- const entry = `${cron} ${command}`;
1663
+ const entry = `${cron} ${pathPrefix} && ${command}`;
1651
1664
 
1652
1665
  // Just output the cron line (can be piped/appended)
1653
1666
  console.log(entry);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mndrk/memx",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Persistent memory for AI agents - git-backed, branch-per-task, CLI interface",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,88 @@
1
+ # mem - Persistent Agent Memory
2
+
3
+ Use `mem` to maintain state, track progress, and accumulate learnings across sessions. Git-backed, branch-per-task architecture.
4
+
5
+ ## When to Use
6
+
7
+ - **Long-running tasks** that span multiple sessions
8
+ - **Tracking progress** with explicit checkpoints
9
+ - **Accumulating learnings** that persist beyond context window
10
+ - **Coordinating work** across wake/sleep cycles
11
+
12
+ ## Architecture
13
+
14
+ ```
15
+ ~/.mem/
16
+ goal.md # Objective + success criteria
17
+ state.md # Progress, next step, blockers, wake schedule
18
+ memory.md # Task-specific learnings
19
+ playbook.md # Global learnings (shared across tasks)
20
+ ```
21
+
22
+ Each task is a git branch. Learnings stay isolated until promoted to playbook.
23
+
24
+ ## Core Commands
25
+
26
+ ### On Wake (Start of Session)
27
+ ```bash
28
+ mem context # Load full state: goal + progress + learnings
29
+ mem status # Quick summary
30
+ mem next # See what to work on
31
+ ```
32
+
33
+ ### During Work
34
+ ```bash
35
+ mem checkpoint "<msg>" # Save progress point
36
+ mem learn "<insight>" # Record learning (-g for global)
37
+ mem next "<step>" # Set next step
38
+ mem stuck "<reason>" # Mark blocker (use "clear" to remove)
39
+ ```
40
+
41
+ ### Task Lifecycle
42
+ ```bash
43
+ mem init <name> "<goal>" # Start new task (creates branch)
44
+ mem criteria add "..." # Add success criterion
45
+ mem criteria <n> # Mark criterion #n complete
46
+ mem progress # Show % complete
47
+ mem done # Complete task, merge learnings
48
+ ```
49
+
50
+ ### Wake System
51
+ ```bash
52
+ mem wake "every 15m" # Set wake schedule
53
+ mem wake "every 15m" --run "cmd" # Set schedule + command
54
+ mem cron export # Output crontab entry
55
+ mem wake clear # Clear schedule
56
+ ```
57
+
58
+ ## Typical Session Loop
59
+
60
+ 1. `mem context` — Load state on wake
61
+ 2. `mem next` — See what to work on
62
+ 3. Do work
63
+ 4. `mem checkpoint "..."` — Save progress
64
+ 5. `mem learn "..."` — Capture insights
65
+ 6. `mem next "..."` — Set next step for future self
66
+
67
+ ## Output Markers (for automated parsing)
68
+
69
+ When working in an agx-managed loop, use these markers in your output:
70
+
71
+ ```
72
+ [checkpoint: message] # Parsed → mem checkpoint
73
+ [learn: insight] # Parsed → mem learn
74
+ [next: step] # Parsed → mem next
75
+ [criteria: N] # Parsed → mem criteria N
76
+ [done] # Task complete, clear wake
77
+ [blocked: reason] # Stop, notify human
78
+ [pause] # Stop, resume on next wake
79
+ ```
80
+
81
+ ## MCP Integration
82
+
83
+ mem provides an MCP server for direct tool access:
84
+
85
+ ```bash
86
+ mem mcp # Start MCP server (stdio)
87
+ mem mcp config # Show Claude Desktop config
88
+ ```