@mndrk/agx 1.4.0 → 1.4.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,7 @@
1
+ {
2
+ "name": "agx",
3
+ "description": "Unified AI agent wrapper with persistent memory integration - spawn background agents that wake and continue",
4
+ "version": "1.4.0",
5
+ "author": "mndrk",
6
+ "repository": "https://github.com/ramarlina/agx"
7
+ }
package/README.md CHANGED
@@ -80,6 +80,18 @@ Agents control state via markers in their output:
80
80
  --daemon Loop on [continue] marker
81
81
  ```
82
82
 
83
+ ## Claude Code Plugin
84
+
85
+ Install as a Claude Code plugin:
86
+
87
+ ```bash
88
+ claude plugin install github:ramarlina/agx
89
+ ```
90
+
91
+ This adds:
92
+ - **Skill**: Claude learns how to spawn background agents
93
+ - **Commands**: `/agx:spawn <goal>`, `/agx:continue`
94
+
83
95
  ## Commands
84
96
 
85
97
  ```bash
@@ -0,0 +1,16 @@
1
+ # /agx:continue - Continue Current Task
2
+
3
+ Continue working on the current task from the last checkpoint.
4
+
5
+ ## Usage
6
+ ```
7
+ /agx:continue
8
+ ```
9
+
10
+ ## Implementation
11
+
12
+ ```bash
13
+ agx claude -p "continue"
14
+ ```
15
+
16
+ This loads the mem context and continues from where the task left off.
@@ -0,0 +1,31 @@
1
+ # /agx:spawn - Spawn Background Agent
2
+
3
+ Spawn a background agent task with automatic wake schedule.
4
+
5
+ ## Usage
6
+ ```
7
+ /agx:spawn <goal>
8
+ ```
9
+
10
+ ## Arguments
11
+ - `$ARGUMENTS` - The goal/task description for the agent
12
+
13
+ ## Implementation
14
+
15
+ First, ensure you're in the correct project directory, then:
16
+
17
+ ```bash
18
+ agx claude --auto-task -p "$ARGUMENTS"
19
+ ```
20
+
21
+ This will:
22
+ 1. Create a mem task branch
23
+ 2. Set wake schedule (every 15m)
24
+ 3. Start the agent working
25
+
26
+ After spawning, install the wake cron:
27
+ ```bash
28
+ (crontab -l 2>/dev/null; mem cron export) | crontab -
29
+ ```
30
+
31
+ Report the task name and confirm wake schedule is set.
package/index.js CHANGED
@@ -160,9 +160,18 @@ function findMemDir(startDir = process.cwd()) {
160
160
  if (fs.existsSync(indexFile)) {
161
161
  try {
162
162
  const index = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
163
+ // Exact match
163
164
  if (index[startDir]) {
164
165
  return globalMem;
165
166
  }
167
+ // Check parent directories (for monorepo/subdirectory usage)
168
+ let checkDir = startDir;
169
+ while (checkDir !== path.dirname(checkDir)) {
170
+ checkDir = path.dirname(checkDir);
171
+ if (index[checkDir]) {
172
+ return globalMem;
173
+ }
174
+ }
166
175
  } catch {}
167
176
  }
168
177
  }
@@ -1340,12 +1349,17 @@ if ((options.autoTask || options.taskName) && !options.memDir && finalPrompt) {
1340
1349
  console.log(`${c.green}✓${c.reset} Mapped: ${c.dim}${process.cwd()} → ${branch}${c.reset}`);
1341
1350
 
1342
1351
  // Auto-set wake schedule for new tasks with proper command
1352
+ // Detect agx path dynamically for cron (no PATH in cron env)
1343
1353
  try {
1344
1354
  const projectDir = process.cwd();
1345
- const wakeCmd = `cd ${projectDir} && agx claude -p "continue"`;
1355
+ let agxPath = 'agx';
1356
+ try {
1357
+ agxPath = execSync('which agx', { encoding: 'utf8' }).trim();
1358
+ } catch {}
1359
+ const wakeCmd = `cd ${projectDir} && ${agxPath} claude -y -p "continue"`;
1346
1360
  execSync(`mem wake "every 15m" --run "${wakeCmd}"`, { cwd: process.cwd(), stdio: 'ignore' });
1347
1361
  console.log(`${c.green}✓${c.reset} Wake: ${c.dim}every 15m (until done)${c.reset}`);
1348
- console.log(`${c.dim} Run: agx claude -p "continue"${c.reset}\n`);
1362
+ console.log(`${c.dim} Run: agx claude -y -p "continue"${c.reset}\n`);
1349
1363
  } catch {}
1350
1364
 
1351
1365
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mndrk/agx",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Unified AI Agent Wrapper for Gemini, Claude, and Ollama",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -27,6 +27,6 @@
27
27
  "url": "https://github.com/ramarlina/agx"
28
28
  },
29
29
  "dependencies": {
30
- "@mndrk/memx": "^0.2.0"
30
+ "@mndrk/memx": "^0.3.0"
31
31
  }
32
32
  }
@@ -0,0 +1,123 @@
1
+ # agx - Unified AI Agent Wrapper
2
+
3
+ Use `agx` to run AI agents (Claude Code, Gemini, Ollama) with persistent memory integration. Spawn background tasks that wake automatically and continue working.
4
+
5
+ ## When to Use
6
+
7
+ - **Spawning background agents** for long-running tasks
8
+ - **Auto-task creation** with wake schedules
9
+ - **Running different AI providers** with unified interface
10
+ - **Autonomous work loops** that continue until done
11
+
12
+ ## Basic Usage
13
+
14
+ ```bash
15
+ agx claude -p "prompt" # Run Claude Code
16
+ agx gemini -p "prompt" # Run Gemini
17
+ agx ollama -p "prompt" # Run Ollama (local)
18
+ ```
19
+
20
+ ## Auto-Task Mode (Recommended)
21
+
22
+ Create a task with automatic wake schedule:
23
+
24
+ ```bash
25
+ cd ~/Projects/my-app
26
+ agx claude --auto-task -p "Build a React todo app with auth"
27
+ # ✓ Created task: build-react-todo
28
+ # ✓ Mapped: ~/Projects/my-app → task/build-react-todo
29
+ # ✓ Wake: every 15m (until done)
30
+ ```
31
+
32
+ This:
33
+ 1. Creates a mem task branch
34
+ 2. Sets wake schedule (every 15m)
35
+ 3. Installs cron to continue automatically
36
+ 4. Agent works until [done] or [blocked]
37
+
38
+ ## Wake Loop
39
+
40
+ ```
41
+ WAKE (cron) → Load context → Agent works → Save state → SLEEP
42
+
43
+ repeat until [done]
44
+ ```
45
+
46
+ Install the wake schedule:
47
+ ```bash
48
+ mem cron export # View entry
49
+ (crontab -l; mem cron export) | crontab - # Install
50
+ ```
51
+
52
+ ## Output Markers
53
+
54
+ Use these in agent output to control the loop:
55
+
56
+ ### Progress (parsed automatically)
57
+ ```
58
+ [checkpoint: message] # Save progress point
59
+ [learn: insight] # Record learning
60
+ [next: step] # Set next step
61
+ [criteria: N] # Mark criterion #N complete
62
+ ```
63
+
64
+ ### Stopping Markers
65
+ ```
66
+ [done] # Task complete, clear wake, stop
67
+ [blocked: reason] # Need human help, pause loop
68
+ [approve: question] # Need approval, wait
69
+ [pause] # Stop, resume on next wake
70
+ ```
71
+
72
+ ### Loop Control
73
+ ```
74
+ [continue] # Keep going (--daemon mode loops locally)
75
+ ```
76
+
77
+ **Default behavior:** Keep working. Only output stopping markers when needed.
78
+
79
+ ## Provider Aliases
80
+
81
+ | Provider | Aliases | Description |
82
+ |----------|---------|-------------|
83
+ | claude | c, cl | Anthropic Claude Code |
84
+ | gemini | g, gem | Google Gemini |
85
+ | ollama | o, oll | Local Ollama |
86
+
87
+ ## Common Flags
88
+
89
+ ```bash
90
+ --auto-task # Auto-create task from prompt
91
+ --task NAME # Specific task name
92
+ --criteria "..." # Success criterion (repeatable)
93
+ --daemon # Loop on [continue] marker
94
+ --until-done # Keep running until [done]
95
+ -y # Skip confirmations
96
+ ```
97
+
98
+ ## Examples
99
+
100
+ ### Quick one-shot
101
+ ```bash
102
+ agx claude -p "Explain this error" -y
103
+ ```
104
+
105
+ ### Background task with wake
106
+ ```bash
107
+ cd ~/Projects/api
108
+ agx claude --auto-task -p "Add user authentication with JWT"
109
+ # Agent works, saves progress, wakes every 15m to continue
110
+ ```
111
+
112
+ ### Check on a running task
113
+ ```bash
114
+ mem status # Quick summary
115
+ mem progress # % complete
116
+ mem context # Full state dump
117
+ ```
118
+
119
+ ### Manual continue
120
+ ```bash
121
+ cd ~/Projects/api
122
+ agx claude -p "continue" # Resume from last checkpoint
123
+ ```