@siftd/connect-agent 0.2.28 → 0.2.30

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
@@ -9,7 +9,9 @@ Connect Agent runs on your machine and bridges the Connect web app to Claude Cod
9
9
  - **Persistent Memory** - Remembers your preferences, projects, and context across sessions
10
10
  - **Worker Delegation** - Delegates complex tasks to Claude Code CLI workers
11
11
  - **Task Scheduling** - Schedule tasks for future execution
12
- - **Semantic Search** - Finds relevant memories by meaning, not just keywords
12
+ - **Hub System** - Organized workspace at `~/Lia-Hub/` for state management
13
+ - **Gallery View** - See all files your workers create in the UI
14
+ - **Progress Tracking** - Real-time progress bars for running workers
13
15
 
14
16
  ## Quick Start
15
17
 
@@ -23,6 +25,12 @@ npx @siftd/connect-agent pair <CODE> --api-key <YOUR_ANTHROPIC_API_KEY>
23
25
  npx @siftd/connect-agent start
24
26
  ```
25
27
 
28
+ On first start, the agent creates `~/Lia-Hub/` with:
29
+ - `AGENTS.md` - Agent identity
30
+ - `CLAUDE.md` - Your custom instructions
31
+ - `LANDMARKS.md` - Current state
32
+ - `notebook-a/` - Working notes and worker logs
33
+
26
34
  ## Modes
27
35
 
28
36
  ### Orchestrator Mode (Recommended)
@@ -31,6 +39,7 @@ When you provide an Anthropic API key, the agent runs as a **master orchestrator
31
39
  - Maintains persistent memory about you and your projects
32
40
  - Delegates file/code work to Claude Code CLI workers
33
41
  - Schedules future tasks
42
+ - Reads hub files for context on every startup
34
43
 
35
44
  ### Simple Relay Mode
36
45
  Without an API key, the agent acts as a simple relay to `claude -p --continue`.
@@ -59,6 +68,24 @@ connect-agent logout
59
68
  - `/reset` or `/clear` - Clear conversation history
60
69
  - `/mode` - Check current mode (orchestrator vs simple)
61
70
  - `/memory` - Show memory statistics
71
+ - `/verbose` - Toggle verbose tool output
72
+
73
+ ## Hub Structure
74
+
75
+ ```
76
+ ~/Lia-Hub/
77
+ ├── AGENTS.md # Agent identity and capabilities
78
+ ├── CLAUDE.md # Your custom instructions (always followed)
79
+ ├── LANDMARKS.md # Current state, active projects
80
+ ├── MISTAKES.md # Lessons learned (never deleted)
81
+ ├── notebook-a/
82
+ │ ├── SCRATCHPAD.md # Working notes and plans
83
+ │ └── WORKER-LOG.md # All worker history (auto-logged)
84
+ └── shared/
85
+ └── outputs/ # Worker output files
86
+ ```
87
+
88
+ Edit `CLAUDE.md` to customize the orchestrator's behavior!
62
89
 
63
90
  ## How It Works
64
91
 
@@ -72,7 +99,7 @@ connect-agent logout
72
99
  ┌─────────────────┐
73
100
  │ Master │
74
101
  │ Orchestrator │
75
- │ (memory, sched)
102
+ │ (memory, hub)
76
103
  └────────┬────────┘
77
104
  │ delegates
78
105
 
@@ -83,17 +110,32 @@ connect-agent logout
83
110
  ```
84
111
 
85
112
  The orchestrator understands it's the **master**, not a worker. It:
86
- 1. Receives your message from the web
87
- 2. Searches memory for relevant context
88
- 3. Decides what needs to be done
89
- 4. Delegates actual work to Claude Code CLI
90
- 5. Synthesizes results into a clear response
91
- 6. Remembers important things for next time
113
+ 1. Loads hub context (AGENTS.md, CLAUDE.md, LANDMARKS.md)
114
+ 2. Receives your message from the web
115
+ 3. Searches memory for relevant context
116
+ 4. Decides what needs to be done
117
+ 5. Delegates actual work to Claude Code CLI workers
118
+ 6. Shows progress in real-time
119
+ 7. Synthesizes results into a clear response
120
+ 8. Logs workers to WORKER-LOG.md
121
+ 9. Remembers important things for next time
122
+
123
+ ## Customizing Worker Behavior
124
+
125
+ All worker prompts are defined in `src/prompts/worker-system.ts`. Update this file to change how ALL workers behave:
126
+
127
+ ```typescript
128
+ // src/prompts/worker-system.ts
129
+ export const WORKER_IDENTITY = `...`;
130
+ export const WORKER_OUTPUT_FORMAT = `...`;
131
+ export function buildWorkerPrompt(task, options) { ... }
132
+ ```
92
133
 
93
134
  ## Environment Variables
94
135
 
95
136
  - `ANTHROPIC_API_KEY` - Alternative to `--api-key` flag
96
137
  - `VOYAGE_API_KEY` - (Optional) For better semantic search embeddings
138
+ - `DATABASE_URL` - (Optional) PostgreSQL for cloud memory persistence
97
139
 
98
140
  ## Requirements
99
141
 
@@ -101,6 +143,13 @@ The orchestrator understands it's the **master**, not a worker. It:
101
143
  - [Claude Code CLI](https://claude.ai/code) installed and authenticated
102
144
  - Anthropic API key (for orchestrator mode)
103
145
 
146
+ ## Version History
147
+
148
+ - **v0.2.28** - Lia-Hub structure, CLAUDE.md support, standardized worker prompts
149
+ - **v0.2.27** - Fixed workers opening browser tabs
150
+ - **v0.2.26** - Gallery view, worker asset tracking
151
+ - **v0.2.25** - Progress bars, heartbeat system
152
+
104
153
  ## License
105
154
 
106
155
  MIT
package/dist/agent.js CHANGED
@@ -10,13 +10,13 @@ function stripAnsi(str) {
10
10
  return str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');
11
11
  }
12
12
  /**
13
- * Self-update: npm install latest and restart
13
+ * Self-update: npm install latest and auto-restart
14
14
  * Called from webapp banner or update command
15
15
  */
16
16
  async function performSelfUpdate() {
17
17
  console.log('[AGENT] === SELF-UPDATE STARTING ===');
18
18
  try {
19
- // Just do it - npm install latest
19
+ // Install the latest version
20
20
  console.log('[AGENT] Running: npm install -g @siftd/connect-agent@latest');
21
21
  execSync('npm install -g @siftd/connect-agent@latest', {
22
22
  encoding: 'utf8',
@@ -24,13 +24,24 @@ async function performSelfUpdate() {
24
24
  stdio: 'inherit', // Show output in real-time
25
25
  timeout: 180000
26
26
  });
27
- console.log('[AGENT] Update installed. Restarting in 2 seconds...');
28
- // Restart the agent
27
+ console.log('[AGENT] Update installed. Auto-restarting...');
28
+ // Spawn a new agent process that will outlive this one
29
+ // Use a small delay script so the old process can exit cleanly
30
+ const restartScript = `sleep 2 && npx @siftd/connect-agent start`;
31
+ const child = spawn('/bin/bash', ['-c', restartScript], {
32
+ detached: true,
33
+ stdio: 'ignore',
34
+ env: process.env
35
+ });
36
+ // Unref so this process can exit while child continues
37
+ child.unref();
38
+ console.log('[AGENT] === AUTO-RESTART SCHEDULED ===');
39
+ // Give the response time to send, then exit
29
40
  setTimeout(() => {
30
- console.log('[AGENT] === RESTARTING ===');
41
+ console.log('[AGENT] Exiting for restart...');
31
42
  process.exit(0);
32
- }, 2000);
33
- return '✅ Update installed. Restarting...';
43
+ }, 1000);
44
+ return '✅ Update installed. Auto-restarting in 2 seconds...';
34
45
  }
35
46
  catch (error) {
36
47
  const msg = error instanceof Error ? error.message : String(error);
@@ -463,11 +463,26 @@ export class MasterOrchestrator {
463
463
  const memoryContext = await this.getMemoryContext(message);
464
464
  // Build system prompt with hub context, genesis knowledge, and memory context
465
465
  const genesisKnowledge = getKnowledgeForPrompt();
466
- let systemWithContext = SYSTEM_PROMPT + genesisKnowledge;
467
- // Add hub context (landmarks + project bio)
466
+ let systemWithContext = SYSTEM_PROMPT;
467
+ // CRITICAL: Inject hub context IMMEDIATELY after system prompt
468
+ // This ensures the orchestrator sees AGENTS.md, CLAUDE.md, LANDMARKS.md content
468
469
  if (hubContextStr) {
469
- systemWithContext += `\n\n---\n\nHUB CONTEXT:\n${hubContextStr}`;
470
+ systemWithContext += `
471
+
472
+ ═══════════════════════════════════════════════════════════════════════════════
473
+ YOUR HUB FILES (READ THESE FIRST!)
474
+ ═══════════════════════════════════════════════════════════════════════════════
475
+
476
+ The following are the CURRENT CONTENTS of your hub files at ~/Lia-Hub/.
477
+ ALWAYS check these before responding - especially CLAUDE.md for user instructions.
478
+
479
+ ${hubContextStr}
480
+
481
+ ═══════════════════════════════════════════════════════════════════════════════
482
+ `;
470
483
  }
484
+ // Add genesis knowledge and memory context
485
+ systemWithContext += genesisKnowledge;
471
486
  if (memoryContext) {
472
487
  systemWithContext += `\n\nRELEVANT MEMORIES:\n${memoryContext}`;
473
488
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siftd/connect-agent",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "Master orchestrator agent - control Claude Code remotely via web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",