amalfa 1.0.11 → 1.0.13

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.
Files changed (3) hide show
  1. package/README.md +41 -1
  2. package/package.json +1 -1
  3. package/src/cli.ts +30 -3
package/README.md CHANGED
@@ -186,12 +186,52 @@ amalfa/
186
186
  ### Key Patterns
187
187
 
188
188
  1. **Hollow Nodes:** Node metadata in SQLite, content on filesystem
189
- 2. **FAFCAS Protocol:** Fast Approximate Fuzzy Cosine Similarity search
189
+ 2. **FAFCAS Protocol:** Embedding normalization that enables scalar product searches (10x faster than cosine similarity)
190
190
  3. **Git-Based Auditing:** All agent augmentations are git commits
191
191
  4. **ServiceLifecycle:** Unified daemon management pattern
192
192
 
193
193
  ---
194
194
 
195
+ ## Example Workflow
196
+
197
+ AMALFA follows a **Brief → Work → Debrief → Playbook** cycle:
198
+
199
+ ```dot
200
+ digraph workflow {
201
+ rankdir=LR;
202
+ node [shape=box, style=filled];
203
+
204
+ // Nodes
205
+ brief [label="Brief\n(Task Spec)", fillcolor=lightyellow];
206
+ work [label="Work\n(Implementation)", fillcolor=lightblue];
207
+ debrief [label="Debrief\n(Lessons Learned)", fillcolor=lightgreen];
208
+ playbook [label="Playbook\n(Codified Pattern)", fillcolor=orange];
209
+ db [label="AMALFA\nKnowledge Graph", shape=cylinder, fillcolor=lightgray];
210
+
211
+ // Flow
212
+ brief -> work [label="guides"];
213
+ work -> debrief [label="captures"];
214
+ debrief -> playbook [label="abstracts to"];
215
+ playbook -> db [label="indexed as"];
216
+ db -> brief [label="informs\nnext task", style=dashed];
217
+
218
+ // Semantic layer
219
+ db -> db [label="semantic search\nvector embeddings\ngraph traversal", style=dotted];
220
+ }
221
+ ```
222
+
223
+ **Example:**
224
+
225
+ 1. **Brief:** "Implement user authentication with JWT tokens"
226
+ 2. **Work:** Agent implements the feature, commits code
227
+ 3. **Debrief:** Document what worked (JWT refresh tokens), what didn't (session storage), lessons learned
228
+ 4. **Playbook:** Extract reusable pattern: "Authentication with stateless JWT tokens"
229
+ 5. **Query:** Later, "How should we handle auth?" → AMALFA retrieves the playbook via semantic search
230
+
231
+ **The magic:** Each document is embedded as a vector (384 dimensions), enabling semantic search across all accumulated knowledge.
232
+
233
+ ---
234
+
195
235
  ## Vision
196
236
 
197
237
  See [VISION-AGENT-LEARNING.md](docs/VISION-AGENT-LEARNING.md) for the full vision.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amalfa",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Local-first knowledge graph engine for AI agents. Transforms markdown into searchable memory with MCP protocol.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/pjsvis/amalfa#readme",
package/src/cli.ts CHANGED
@@ -3,7 +3,7 @@ import { existsSync, statSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { spawn } from "node:child_process";
5
5
 
6
- const VERSION = "1.0.11";
6
+ const VERSION = "1.0.13";
7
7
 
8
8
  // Database path loaded from config (lazy loaded per command)
9
9
  let DB_PATH: string | null = null;
@@ -26,6 +26,7 @@ Commands:
26
26
  doctor Check installation and configuration
27
27
  setup-mcp Generate MCP configuration JSON
28
28
  daemon <action> Manage file watcher (start|stop|status|restart)
29
+ vector <action> Manage vector daemon (start|stop|status|restart)
29
30
  servers [--dot] Show status of all AMALFA services (--dot for graph)
30
31
 
31
32
  Options:
@@ -267,6 +268,28 @@ async function cmdDaemon() {
267
268
  });
268
269
  }
269
270
 
271
+ async function cmdVector() {
272
+ const action = args[1] || "status";
273
+ const validActions = ["start", "stop", "status", "restart"];
274
+
275
+ if (!validActions.includes(action)) {
276
+ console.error(`❌ Invalid action: ${action}`);
277
+ console.error("\nUsage: amalfa vector <start|stop|status|restart>");
278
+ process.exit(1);
279
+ }
280
+
281
+ // Run vector daemon with the specified action
282
+ const vectorPath = join(import.meta.dir, "resonance/services/vector-daemon.ts");
283
+ const proc = spawn("bun", ["run", vectorPath, action], {
284
+ stdio: "inherit",
285
+ cwd: process.cwd(),
286
+ });
287
+
288
+ proc.on("exit", (code) => {
289
+ process.exit(code ?? 0);
290
+ });
291
+ }
292
+
270
293
  async function cmdSetupMcp() {
271
294
  const { resolve } = await import("node:path");
272
295
 
@@ -321,7 +344,7 @@ async function cmdServers() {
321
344
 
322
345
  const SERVICES = [
323
346
  { name: "MCP Server", pidFile: ".mcp.pid", port: "stdio", id: "mcp", cmd: "amalfa serve" },
324
- { name: "Vector Daemon", pidFile: ".vector-daemon.pid", port: "3010", id: "vector", cmd: "(auto-start)" },
347
+ { name: "Vector Daemon", pidFile: ".vector-daemon.pid", port: "3010", id: "vector", cmd: "amalfa vector start" },
325
348
  { name: "File Watcher", pidFile: ".amalfa-daemon.pid", port: "-", id: "watcher", cmd: "amalfa daemon start" },
326
349
  ];
327
350
 
@@ -435,7 +458,7 @@ async function cmdServers() {
435
458
  }
436
459
 
437
460
  console.log("─".repeat(95));
438
- console.log("\n💡 Commands: amalfa serve | amalfa daemon start | amalfa stats\n");
461
+ console.log("\n💡 Commands: amalfa serve | amalfa vector start | amalfa daemon start\n");
439
462
  }
440
463
 
441
464
  async function cmdDoctor() {
@@ -539,6 +562,10 @@ async function main() {
539
562
  await cmdDaemon();
540
563
  break;
541
564
 
565
+ case "vector":
566
+ await cmdVector();
567
+ break;
568
+
542
569
  case "setup-mcp":
543
570
  await cmdSetupMcp();
544
571
  break;