meow-swarm 0.1.1 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +58 -121
  2. package/dist/index.js +208 -254
  3. package/package.json +1 -2
package/README.md CHANGED
@@ -1,174 +1,111 @@
1
1
  # meow-swarm
2
2
 
3
- ![](https://img.shields.io/badge/npm-meow--swarm-blue?style=flat-square) ![](https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat-square) ![](https://img.shields.io/badge/License-MIT-green?style=flat-square) ![](https://img.shields.io/badge/TypeScript-5.0-blue?style=flat-square)
3
+ **The problem:** You want an AI coding agent that runs autonomously — not a chat window you babysit, but a background worker that accepts a task, runs to completion, and reports back. While you sleep. While you work on something else. In CI.
4
4
 
5
- **`meow -p`** the primary interface. Run autonomous coding agents in the background.
5
+ **The solution:** `meow -p "task"` dispatches a self-healing, quality-gated coding agent into the background. It checkpoints every step to SQLite, retries on failure, stops when it's stuck, and surfaces everything in a TUI dashboard.
6
6
 
7
- ```
7
+ ```bash
8
8
  npm install -g meow-swarm
9
- meow -p "fix the auth bug in src/auth.ts"
9
+ meow -p "refactor auth into its own service"
10
10
  ```
11
11
 
12
- meow-swarm is a sovereign, stateful, multi-agent coding harness that runs locally in your terminal. It coordinates L1→L4 specialist agents, checkpoints every task state to SQLite, gates output quality before commit, and exposes a TUI dashboard. You fire it and come back later — it is not a synchronous chat partner.
13
-
14
12
  ---
15
13
 
16
- ## Get Started
14
+ ## Install
15
+
16
+ **Requires:** Node.js 18+ · `ANTHROPIC_API_KEY` env var set
17
17
 
18
18
  ```bash
19
- # Primary: headless mode (no TTY required) — this is meow -p
20
- meow -p "fix the stalled REPL in src/cli/repl.ts"
19
+ npm install -g meow-swarm
20
+ export ANTHROPIC_API_KEY=sk-ant-... # or set in shell profile
21
21
 
22
- # Interactive REPL
23
- meow
22
+ # Primary: headless (no TTY required) — designed for scripts, CI, or background dispatch
23
+ meow -p "fix the race condition in src/queue.ts"
24
24
 
25
- # Interactive TUI
25
+ # Interactive TUI dashboard
26
26
  meow --tui
27
- ```
28
-
29
- **Requirements:** Node.js 18+, `ANTHROPIC_API_KEY` env var. Bun is not supported (better-sqlite3 requires Node.js native addons).
30
-
31
- ---
32
-
33
- ## What is meow-swarm?
34
27
 
35
- A background daemon harness for autonomous coding agents. Think `nohup ./worker.sh &` — you dispatch a task, it runs in the background, you check the TUI or state files later.
36
-
37
- ```
38
- Task arrives
39
-
40
-
41
- L4 SPECIALIST (Claude Code) — implements
42
-
43
-
44
- MISSION REVIEWER — scores output across 7 criteria
45
-
46
- ├── score >= threshold ──► COMMIT
47
-
48
- └── score < threshold ──► RETRY (with review notes)
49
-
50
- ┌──────────────┴──────────────┐
51
- ▼ ▼
52
- CONVERGENCE CHECK STAGNATION CHECK
53
- ─ token budget? ─ 2 iters no improvement?
54
- ─ max iters hit? ─ diminishing returns?
55
- │ │
56
- ▼ ▼
57
- STOP / REPORT ADAPT / DECOMPOSE
28
+ # Interactive REPL
29
+ meow
58
30
  ```
59
31
 
60
- meow-swarm does NOT grind until the user kills it. It evaluates whether continued iteration is productive and stops when it is not.
61
-
62
- ---
63
-
64
- ## Quality Gates
65
-
66
- Every output passes through structural gates before it can be committed:
67
-
68
- | Gate | Checks | Fail action |
69
- |------|--------|-------------|
70
- | `NO_MOCKS` | No `TODO`, `FIXME`, placeholder code | Retry with note |
71
- | `TYPE_CHECK` | `tsc --noEmit` passes | Retry |
72
- | `LINT_CLEAN` | ESLint reports 0 errors | Retry |
73
- | `REAL_TESTS` | Test files exist and non-empty | Warn (non-fatal) |
74
- | `MISSION_COMPLETE` | Goal keywords in output | Retry if missing |
75
- | `SOP_COMPLIANCE` | Think-Plan-Verify in output | Retry if missing |
76
-
77
- ---
78
-
79
- ## Convergence Logic
80
-
81
- meow-swarm stops iterating when:
82
-
83
- - **Stagnation** — No score improvement for 2 consecutive iterations
84
- - **Token budget exceeded** — Cumulative spend crosses threshold
85
- - **Diminishing returns** — Score improvement falls below minimum delta
86
-
87
- ---
88
-
89
- ## Execution Modes
90
-
91
- | Mode | Behavior |
92
- |------|----------|
93
- | `SEQUENTIAL` | One task at a time. Full review between each step. |
94
- | `SHIP` | Pass through all specialists with final review only. |
95
- | `PARALLEL` | Run independent tasks concurrently. |
96
- | `AUDIT_ONLY` | Score existing output without executing. |
32
+ Bun is not supported. `better-sqlite3` requires Node.js native addons.
97
33
 
98
34
  ---
99
35
 
100
- ## Architecture
36
+ ## What it actually does
101
37
 
102
38
  ```
103
- L1 LIAISON — Human-facing. Receives tasks, escalates ambiguity.
104
- L2 ARCHITECT — Mid-layer planner. Breaks tasks, sequences dependencies.
105
- L3 ORCHESTRATOR — Execution coordinator. TaskQueue, convergence checks.
106
- L4 SPECIALISTS — Claude Code / Aider subprocesses.
39
+ you meow -p "task" background → checkpoint → quality gate → done
40
+ stuck?
41
+ retry / adapt / stop + report
107
42
  ```
108
43
 
109
- **Key files:**
110
-
111
- | File | Purpose |
112
- |------|---------|
113
- | `src/index.ts` | CLI entry: `meow -p` for headless, `meow` for REPL, `meow --tui` for TUI |
114
- | `src/agent/agent.ts` | MEOW-3-RULE: 3-retry loop + fixMeow() + suggestUpstreamContribution() |
115
- | `src/agent/summoner.ts` | Spawns specialist agents as subprocesses |
116
- | `src/agent/mission_reviewer.ts` | 7-criterion scoring, quality gates |
117
- | `src/orchestrator/Orchestrator.ts` | Convergence checks, task dispatch |
118
- | `src/kernel/kernel.ts` | Heartbeat loop, watchdog, respawn |
119
- | `src/db/database.ts` | SQLite + sqlite-vec for persistence + checkpointing |
44
+ 1. **Receives a task** via `meow -p` (headless, no TTY) or `meow` (interactive REPL)
45
+ 2. **Dispatches to L4 specialist** (Claude Code subprocess)
46
+ 3. **Mission reviewer scores output** across 7 criteria
47
+ 4. **Quality gate** — if output fails, it retries with reviewer notes
48
+ 5. **Convergence check** stops if stagnating, budget exceeded, or diminishing returns
49
+ 6. **Checkpoints state** to SQLite after every iteration crash-safe
50
+ 7. **TUI dashboard** shows live task progress, queue, and history
120
51
 
121
52
  ---
122
53
 
123
- ## meow -p (the primary interface)
54
+ ## Self-healing: the MEOW-3-RULE
124
55
 
125
- `meow -p` is the primary headless interface — no TTY required, designed for calling from scripts, CI, or other AI agents:
56
+ When `meow -p` fails 3 times, it doesn't just give up. It surfaces a diagnostic:
126
57
 
127
58
  ```
128
- meow -p "your task description"
59
+ Task arrives → meow -p "task" (3 retry attempts)
60
+ ↓ fails × 3
61
+ claude -p "fix meow-swarm" (repairs meow-swarm's own code, NOT the task)
62
+
63
+ you re-run → meow -p "task" (now succeeds)
129
64
  ```
130
65
 
131
- The `-p` / `--plan` flag activates non-interactive mode. Task output goes to stdout. Progress goes to the TTY if available, otherwise to `~/.meow/` state files.
66
+ `claude -p` only fires when meow-swarm's own code/prompts are broken. It fixes meow-swarm, then you re-dispatch the original task. This is the operator loop you never fix tasks manually.
132
67
 
133
68
  ---
134
69
 
135
- ## MEOW-3-RULE
136
-
137
- meow-swarm's self-repair loop:
70
+ ## Quality gates
138
71
 
139
- ```
140
- Task arrives → meow -p "task" (meow-swarm gets 3 retry attempts)
141
- ↓ fails × 3
142
- claude -p "fix meow-swarm" (fixes meow-swarm's own code, NOT the task)
143
-
144
- User re-invokes same task → meow -p → succeeds
145
- ```
72
+ Every output is scored before it can be marked complete:
146
73
 
147
- `claude -p` only runs when meow-swarm's own code/prompts/tools are broken. It patches meow-swarm, then meow-swarm retries and completes the task.
74
+ | Gate | Checks | On fail |
75
+ |------|--------|---------|
76
+ | `NO_MOCKS` | No `TODO`, `FIXME`, placeholder code | Retry with note |
77
+ | `TYPE_CHECK` | `tsc --noEmit` passes | Retry |
78
+ | `LINT_CLEAN` | ESLint 0 errors | Retry |
79
+ | `MISSION_COMPLETE` | Goal keywords present in output | Retry |
80
+ | `SOP_COMPLIANCE` | Think-Plan-Verify pattern | Retry |
148
81
 
149
82
  ---
150
83
 
151
84
  ## Configuration
152
85
 
153
- | Variable | Description | Default |
154
- |----------|-------------|---------|
155
- | `ANTHROPIC_API_KEY` | API key for LLM calls | (required) |
156
- | `ANTHROPIC_BASE_URL` | LLM endpoint | MiniMax gateway |
157
- | `ANTHROPIC_MODEL` | Model name | `claude-sonnet-4` |
158
- | `MEOW_DB` | SQLite database path | `~/.meow/meow.db` |
159
- | `MEOW_MODE` | Execution mode | `SEQUENTIAL` |
86
+ | Variable | Default | Notes |
87
+ |----------|---------|-------|
88
+ | `ANTHROPIC_API_KEY` | *(required)* | API key for LLM calls |
89
+ | `ANTHROPIC_BASE_URL` | *(not set)* | Override for custom LLM endpoints |
90
+ | `ANTHROPIC_MODEL` | `claude-sonnet-4` | Model name |
91
+ | `MEOW_DB` | `~/.meow/meow.db` | SQLite checkpoint store |
92
+ | `MEOW_MODE` | `SEQUENTIAL` | `SEQUENTIAL` · `PARALLEL` · `SHIP` · `AUDIT_ONLY` |
160
93
 
161
94
  ---
162
95
 
163
- ## npm
96
+ ## Architecture
164
97
 
165
98
  ```
166
- npm install -g meow-swarm
167
- https://www.npmjs.com/package/meow-swarm
99
+ L1 LIAISON — Receives tasks, escalates ambiguity to human
100
+ L2 ARCHITECT — Breaks tasks, sequences dependencies
101
+ L3 ORCHESTRATOR — Task queue, convergence checks, dispatch
102
+ L4 SPECIALISTS — Claude Code subprocesses (can be swapped)
168
103
  ```
169
104
 
105
+ State is checkpointed to SQLite after every operation. If the process dies, the next invocation resumes from the last checkpoint.
106
+
170
107
  ---
171
108
 
172
109
  ## License
173
110
 
174
- MIT — see [LICENSE](LICENSE)
111
+ MIT
package/dist/index.js CHANGED
@@ -289,9 +289,9 @@ var init_harvester = __esm({
289
289
  "use strict";
290
290
  init_env();
291
291
  Harvester = class {
292
- quantumMemory;
293
- constructor(quantumMemory) {
294
- this.quantumMemory = quantumMemory;
292
+ agenticMemory;
293
+ constructor(agenticMemory) {
294
+ this.agenticMemory = agenticMemory;
295
295
  }
296
296
  /**
297
297
  * Distill session logs into a SKILL.md file.
@@ -341,7 +341,7 @@ var init_harvester = __esm({
341
341
  const magnitude = Math.sqrt(arr.reduce((sum, val) => sum + val * val, 0)) || 1;
342
342
  return arr.map((v) => v / magnitude);
343
343
  };
344
- const memories = await this.quantumMemory.recall(goal, mockEmbedding(goal));
344
+ const memories = await this.agenticMemory.recall(goal, mockEmbedding(goal));
345
345
  return memories.map((m) => m.content);
346
346
  }
347
347
  /**
@@ -718,8 +718,8 @@ async function summon(agentName, context) {
718
718
  return `\u274C Escalation failed. ${agent.name} error: ${error instanceof Error ? error.message : String(error)}`;
719
719
  }
720
720
  }
721
- async function summonHarvester(goal, complexity, quantumMemory, successfulPatterns = []) {
722
- const harvester = new Harvester(quantumMemory);
721
+ async function summonHarvester(goal, complexity, agenticMemory, successfulPatterns = []) {
722
+ const harvester = new Harvester(agenticMemory);
723
723
  const ctx = {
724
724
  goal,
725
725
  complexity,
@@ -752,7 +752,7 @@ ${blueprint}
752
752
  INSTRUCTIONS:
753
753
  0. BEFORE STARTING: Run 'npx skills find <relevant-topic>' to check the unified ecosystem (https://github.com/stancsz/skills). If a relevant skill exists (see https://github.com/vercel-labs/skills/blob/main/skills/find-skills/SKILL.md), use it to solve the task.
754
754
  1. FIX the immediate issue and ensure all tests pass.
755
- 2. DO NOT TOUCH 'quantum_*.ts' files unless the goal specifically asks for it.
755
+ 2. DO NOT TOUCH 'agentic_*.ts' files unless the goal specifically asks for it.
756
756
  3. DO NOT COMMIT: MEOW is the Expert Taster and will review/commit your work.
757
757
  4. REPORT: Summarize your changes and provide exact steps for MEOW to verify your work.
758
758
  5. RECURSIVE IMPROVEMENT: If you find a missing pattern, create a reusable skill in 'src/skills/'.
@@ -934,10 +934,9 @@ var init_mission_reviewer = __esm({
934
934
  this.agent = agent;
935
935
  }
936
936
  /**
937
- * Performs a Quantum Structural Analysis of the current workspace.
937
+ * Performs a Structural Analysis of the current workspace.
938
938
  */
939
939
  async verify(goal, testCmd) {
940
- console.log(pc2.bold(pc2.cyan("\n\u{1F9D0} [QUANTUM REVIEW] Starting structural analysis...")));
941
940
  let diff = "";
942
941
  try {
943
942
  const { stdout } = await execAsync("git diff HEAD~1", { encoding: "utf-8" });
@@ -988,7 +987,7 @@ var init_mission_reviewer = __esm({
988
987
  }
989
988
  ];
990
989
  const decisionSpace = [{ diff, goal }];
991
- const auditResult = await this.agent.quantumReasoning.solve(decisionSpace, constraints, (msg) => {
990
+ const auditResult = await this.agent.reasoningEngine.solve(decisionSpace, constraints, (msg) => {
992
991
  process.stdout.write(`\r${pc2.dim("Running Logic Audit: " + msg)}`);
993
992
  });
994
993
  process.stdout.write("\n");
@@ -1328,7 +1327,7 @@ Please follow these instructions for the current task.`
1328
1327
  return "Error: Context management system not available.";
1329
1328
  }
1330
1329
  await agent.compressAndOffload();
1331
- return "Successfully archived conversation tail to Quantum Knowledge Base. L1 context is now pruned.";
1330
+ return "Successfully archived conversation tail to Agentic Memory Store. L1 context is now pruned.";
1332
1331
  }
1333
1332
  },
1334
1333
  {
@@ -1462,6 +1461,9 @@ var init_ExtensionManager = __esm({
1462
1461
  });
1463
1462
  for (const file of files) {
1464
1463
  try {
1464
+ if (file.endsWith(".ts")) {
1465
+ continue;
1466
+ }
1465
1467
  const fileUrl = pathToFileURL(file).href;
1466
1468
  const module = await import(fileUrl);
1467
1469
  const extension = module.default || module.extension;
@@ -1473,6 +1475,9 @@ var init_ExtensionManager = __esm({
1473
1475
  });
1474
1476
  }
1475
1477
  } catch (e) {
1478
+ if (e?.code === "ERR_UNKNOWN_FILE_EXTENSION" || e?.code === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
1479
+ continue;
1480
+ }
1476
1481
  console.error(`Failed to discover extension at ${file}:`, e);
1477
1482
  }
1478
1483
  }
@@ -1534,26 +1539,29 @@ var init_ExtensionManager = __esm({
1534
1539
  }
1535
1540
  });
1536
1541
 
1537
- // src/agent/quantum_memory.ts
1538
- import pc3 from "picocolors";
1539
- var QuantumMemory;
1540
- var init_quantum_memory = __esm({
1541
- "src/agent/quantum_memory.ts"() {
1542
+ // src/agent/memory.ts
1543
+ var AgenticMemory;
1544
+ var init_memory = __esm({
1545
+ "src/agent/memory.ts"() {
1542
1546
  "use strict";
1543
- QuantumMemory = class {
1547
+ AgenticMemory = class {
1544
1548
  db;
1545
1549
  kernel;
1546
1550
  reasoning;
1547
- measuredIds = /* @__PURE__ */ new Set();
1551
+ recalledIds = /* @__PURE__ */ new Set();
1548
1552
  constructor(db, kernel, reasoning) {
1549
1553
  this.db = db;
1550
1554
  this.kernel = kernel;
1551
1555
  this.reasoning = reasoning;
1552
1556
  }
1557
+ /**
1558
+ * Recall relevant memories from the semantic store.
1559
+ * Uses sqlite-vec for nearest-neighbor search on embeddings.
1560
+ */
1553
1561
  async recall(queryText, queryEmbedding) {
1554
1562
  let candidates = [];
1555
1563
  try {
1556
- const notInClause = Array.from(this.measuredIds).join(",") || -1;
1564
+ const notInClause = Array.from(this.recalledIds).join(",") || -1;
1557
1565
  candidates = await this.db.query(
1558
1566
  `SELECT
1559
1567
  v.rowid,
@@ -1568,165 +1576,111 @@ var init_quantum_memory = __esm({
1568
1576
  ORDER BY v.distance`,
1569
1577
  [new Float32Array(queryEmbedding)]
1570
1578
  );
1571
- } catch (e) {
1579
+ } catch {
1572
1580
  return [];
1573
1581
  }
1574
1582
  if (candidates.length === 0) return [];
1575
- if (candidates.length === 1) {
1576
- const winner2 = candidates[0];
1577
- this.measuredIds.add(winner2.rowid);
1578
- return [{
1579
- content: winner2.content,
1580
- metadata: JSON.parse(winner2.metadata),
1581
- distance: winner2.distance
1582
- }];
1583
- }
1584
- const winner = await this.reasoning.groverSearch(candidates, queryText, (msg) => {
1585
- process.stdout.write(`\r${pc3.magenta(msg)}`);
1586
- });
1587
- if (!winner) return [];
1588
- this.measuredIds.add(winner.rowid);
1589
- return [{
1590
- content: winner.content,
1591
- metadata: JSON.parse(winner.metadata),
1592
- distance: winner.distance
1593
- }];
1583
+ const best = await this.reasoning.findBest(
1584
+ candidates,
1585
+ queryText,
1586
+ (msg) => this.kernel.log?.(msg, "memory")
1587
+ );
1588
+ if (best) {
1589
+ this.recalledIds.add(best.rowid);
1590
+ }
1591
+ return candidates.map((c) => ({
1592
+ content: c.content,
1593
+ metadata: JSON.parse(c.metadata || "{}"),
1594
+ distance: c.distance
1595
+ }));
1594
1596
  }
1595
1597
  /**
1596
- * Store new context (Unitary Evolution of State)
1598
+ * Store a new memory entry with its embedding.
1599
+ * Used after task completion to record successful patterns.
1597
1600
  */
1598
- store(content, embedding, metadata = {}) {
1599
- this.kernel.push({
1600
- type: "STORE_VECTOR",
1601
- content,
1602
- embedding,
1603
- metadata
1604
- });
1601
+ async store(content, metadata, embedding) {
1602
+ try {
1603
+ await this.db.execute(
1604
+ `INSERT INTO vector_memory_data (content, metadata) VALUES (?, ?)`,
1605
+ [content, JSON.stringify(metadata)]
1606
+ );
1607
+ const rowId = await this.db.query("SELECT last_insert_rowid() as id");
1608
+ if (rowId?.[0]?.id) {
1609
+ await this.db.execute(
1610
+ `INSERT INTO vec_memory (rowid, embedding) VALUES (?, ?)`,
1611
+ [rowId[0].id, new Float32Array(embedding)]
1612
+ );
1613
+ }
1614
+ } catch (e) {
1615
+ this.kernel.log?.(`Memory store failed: ${e}`, "warn");
1616
+ }
1617
+ }
1618
+ /**
1619
+ * Clear the recall session (set-based deduplication reset).
1620
+ */
1621
+ reset() {
1622
+ this.recalledIds.clear();
1605
1623
  }
1606
1624
  };
1607
1625
  }
1608
1626
  });
1609
1627
 
1610
- // src/agent/quantum_reasoning.ts
1611
- import pc4 from "picocolors";
1612
- import QuantumCircuit from "quantum-circuit";
1613
- var QuantumReasoning;
1614
- var init_quantum_reasoning = __esm({
1615
- "src/agent/quantum_reasoning.ts"() {
1628
+ // src/agent/reasoning.ts
1629
+ import pc3 from "picocolors";
1630
+ var ReasoningEngine;
1631
+ var init_reasoning = __esm({
1632
+ "src/agent/reasoning.ts"() {
1616
1633
  "use strict";
1617
- QuantumReasoning = class {
1634
+ ReasoningEngine = class {
1618
1635
  /**
1619
- * Solves a combinatorial optimization problem using a real QAOA circuit simulation.
1620
- * Maps decision space to qubits and applies variational rotations.
1636
+ * Solves a combinatorial optimization problem using weighted constraint scoring.
1637
+ * Evaluates all candidates against constraints and returns the highest-scoring one.
1621
1638
  */
1622
1639
  async solve(space, constraints, onPulse) {
1623
1640
  if (space.length === 0) return null;
1624
1641
  if (space.length === 1) return space[0];
1625
- const numQubits = Math.ceil(Math.log2(space.length));
1626
- if (numQubits === 0) return space[0];
1627
- const circuit = new QuantumCircuit(numQubits);
1628
- let gamma = 0.5;
1629
- let beta = 0.3;
1630
- for (let i = 0; i < numQubits; i++) {
1631
- circuit.addGate("h", i, i);
1632
- }
1633
- const numStates = Math.pow(2, numQubits);
1634
- for (let step = 0; step < 10; step++) {
1635
- for (let s = 0; s < numStates; s++) {
1636
- const choice = space[s % space.length];
1637
- const totalScore = constraints.reduce((acc, c) => acc + (c.evaluate(choice) ? c.weight : 0), 0);
1638
- if (totalScore > 0) {
1639
- for (let q = 0; q < numQubits; q++) {
1640
- if (!(s >> q & 1)) circuit.addGate("x", q, q);
1641
- }
1642
- circuit.addGate("rz", numQubits - 1, numQubits - 1, { params: [gamma * (totalScore / 100)] });
1643
- for (let q = 0; q < numQubits; q++) {
1644
- if (!(s >> q & 1)) circuit.addGate("x", q, q);
1645
- }
1642
+ let best = null;
1643
+ let bestScore = -1;
1644
+ for (const candidate of space) {
1645
+ const totalScore = constraints.reduce((acc, c) => {
1646
+ try {
1647
+ return acc + (c.evaluate(candidate) ? c.weight : 0);
1648
+ } catch {
1649
+ return acc;
1646
1650
  }
1647
- }
1648
- for (let i = 0; i < numQubits; i++) {
1649
- circuit.addGate("rx", i, i, { params: [beta] });
1650
- }
1651
- beta *= 0.95;
1652
- onPulse?.(`\u269B\uFE0F QAOA: \u03B3=${gamma.toFixed(3)} \u03B2=${beta.toFixed(3)} (Step ${step})`);
1653
- await new Promise((r) => setTimeout(r, 20));
1654
- }
1655
- circuit.run();
1656
- const results = circuit.probabilities();
1657
- let maxProb = -1;
1658
- let bestState = 0;
1659
- for (const state in results) {
1660
- if (results[state] > maxProb) {
1661
- maxProb = results[state];
1662
- bestState = parseInt(state, 2);
1651
+ }, 0);
1652
+ if (totalScore > bestScore) {
1653
+ bestScore = totalScore;
1654
+ best = candidate;
1663
1655
  }
1664
1656
  }
1665
- const winner = space[bestState % space.length];
1666
1657
  if (onPulse) {
1667
- onPulse(pc4.green(`\u269B\uFE0F Wavefunction Collapsed: Choice [${bestState % space.length}] Prob ${maxProb.toFixed(4)}`));
1668
- } else {
1669
- console.log(pc4.green(`
1670
- \u269B\uFE0F Wavefunction Collapsed: Choice [${bestState % space.length}] with Prob ${maxProb.toFixed(4)}`));
1658
+ onPulse(pc3.green(`\u2713 ConstraintSolver: Best score ${bestScore}, ${space.length} candidates evaluated`));
1671
1659
  }
1672
- return winner;
1660
+ return best;
1673
1661
  }
1674
1662
  /**
1675
- * Grover's Algorithm Simulation for QRAM Recall.
1676
- * Amplifies the probability of the 'correct' semantic matches in a superposition.
1663
+ * Fast search using keyword-overlap scoring.
1664
+ * Returns the best candidate from a list given a query string.
1677
1665
  */
1678
- async groverSearch(candidates, query, onPulse) {
1666
+ async findBest(candidates, query, onPulse) {
1679
1667
  if (candidates.length === 0) return null;
1680
- const numQubits = Math.ceil(Math.log2(candidates.length));
1681
- if (numQubits === 0) {
1682
- return candidates[0];
1683
- }
1684
- const circuit = new QuantumCircuit(numQubits);
1685
- for (let i = 0; i < numQubits; i++) {
1686
- circuit.addGate("h", i, i);
1687
- }
1688
- const iterations = Math.max(1, Math.floor(Math.sqrt(candidates.length)));
1689
- for (let iter = 0; iter < iterations; iter++) {
1690
- candidates.forEach((c, idx) => {
1691
- const queryTerms = query.toLowerCase().split(/\W+/).filter((t) => t.length > 2);
1692
- const content = JSON.stringify(c).toLowerCase();
1693
- const score = queryTerms.filter((q) => content.includes(q)).length / queryTerms.length;
1694
- if (score > 0.3) {
1695
- for (let q = 0; q < numQubits; q++) {
1696
- if (idx >> q & 1) {
1697
- circuit.addGate("z", q, q);
1698
- }
1699
- }
1700
- }
1701
- });
1702
- for (let i = 0; i < numQubits; i++) circuit.addGate("h", i, i);
1703
- for (let i = 0; i < numQubits; i++) circuit.addGate("x", i, i);
1704
- circuit.addGate("h", numQubits - 1, numQubits - 1);
1705
- circuit.addGate("rz", numQubits - 1, numQubits - 1, { params: [Math.PI] });
1706
- circuit.addGate("h", numQubits - 1, numQubits - 1);
1707
- for (let i = 0; i < numQubits; i++) circuit.addGate("x", i, i);
1708
- for (let i = 0; i < numQubits; i++) circuit.addGate("h", i, i);
1709
- onPulse?.(`\u{1F300} Grover Iteration ${iter + 1}/${iterations}: Amplifying amplitudes...`);
1710
- await new Promise((r) => setTimeout(r, 50));
1711
- }
1712
- circuit.run();
1713
- const results = circuit.probabilities();
1714
- let bestIdx = 0;
1715
- let maxProb = -1;
1716
- for (const state in results) {
1717
- if (results[state] > maxProb) {
1718
- maxProb = results[state];
1719
- bestIdx = parseInt(state, 2);
1668
+ const queryTerms = query.toLowerCase().split(/\W+/).filter((t) => t.length > 2);
1669
+ if (queryTerms.length === 0) return candidates[0];
1670
+ let best = null;
1671
+ let bestScore = -1;
1672
+ for (const c of candidates) {
1673
+ const content = JSON.stringify(c).toLowerCase();
1674
+ const score = queryTerms.filter((q) => content.includes(q)).length / queryTerms.length;
1675
+ if (score > bestScore) {
1676
+ bestScore = score;
1677
+ best = c;
1720
1678
  }
1721
1679
  }
1722
- const winner = candidates[bestIdx % candidates.length];
1723
1680
  if (onPulse) {
1724
- onPulse(pc4.magenta(`\u{1F300} Grover Search Collapsed: Index [${bestIdx % candidates.length}] Prob ${maxProb.toFixed(4)}`));
1725
- } else {
1726
- console.log(pc4.magenta(`
1727
- \u{1F300} Grover Search Collapsed: Index [${bestIdx % candidates.length}] with Prob ${maxProb.toFixed(4)}`));
1681
+ onPulse(pc3.magenta(`\u2713 FastSearch: Best match score ${(bestScore * 100).toFixed(1)}%`));
1728
1682
  }
1729
- return winner;
1683
+ return best;
1730
1684
  }
1731
1685
  };
1732
1686
  }
@@ -1738,7 +1692,7 @@ import { execSync as execSync3 } from "child_process";
1738
1692
  import { basename } from "path";
1739
1693
  import DiffMatchPatch from "diff-match-patch";
1740
1694
  import { resolve as resolve3 } from "path";
1741
- import pc5 from "picocolors";
1695
+ import pc4 from "picocolors";
1742
1696
  var HEAD_PATTERN, DIVIDER_PATTERN, UPDATED_PATTERN, UDIFF_PATTERN, UDIFF_HUNK_PATTERN, REASONING_TAGS, Agent;
1743
1697
  var init_agent = __esm({
1744
1698
  "src/agent/agent.ts"() {
@@ -1748,8 +1702,8 @@ var init_agent = __esm({
1748
1702
  init_discovery();
1749
1703
  init_tool();
1750
1704
  init_ExtensionManager();
1751
- init_quantum_memory();
1752
- init_quantum_reasoning();
1705
+ init_memory();
1706
+ init_reasoning();
1753
1707
  init_env();
1754
1708
  HEAD_PATTERN = /^<{5,9} SEARCH>?\s*$/;
1755
1709
  DIVIDER_PATTERN = /^={5,9}\s*$/;
@@ -1773,8 +1727,8 @@ var init_agent = __esm({
1773
1727
  mcpManager;
1774
1728
  discoveryModule;
1775
1729
  extensionManager;
1776
- quantumMemory;
1777
- quantumReasoning;
1730
+ agenticMemory;
1731
+ reasoningEngine;
1778
1732
  kernel;
1779
1733
  db;
1780
1734
  L1_TOKEN_LIMIT = 4e4;
@@ -1785,7 +1739,7 @@ var init_agent = __esm({
1785
1739
  // Cap recovery attempts to prevent token burning
1786
1740
  MONOLITH_BLUEPRINT = `
1787
1741
  1. SINGLE WRITER PHYSICS: All state mutations (DB/Swarm) MUST go through MeowKernel. No direct writes.
1788
- 2. QUANTUM PRESERVATION: Do NOT modify 'quantum_*.ts' files unless explicitly asked.
1742
+ 2. AGENTIC MEMORY PRESERVATION: Do NOT modify 'agentic_*.ts' files unless explicitly asked.
1789
1743
  3. SERIALIZED EXECUTION: Favor simple synchronous/serial patterns. Avoid complex parallel async logic.
1790
1744
  4. ROT RESISTANCE: Prefer Vanilla JS/TS over external dependencies. Match existing surgical style.
1791
1745
  `.trim();
@@ -1803,14 +1757,14 @@ var init_agent = __esm({
1803
1757
  this.extensionManager = new ExtensionManager();
1804
1758
  this.kernel = config2.kernel;
1805
1759
  this.db = config2.db;
1806
- this.quantumReasoning = new QuantumReasoning();
1807
- this.quantumMemory = new QuantumMemory(config2.db, config2.kernel, this.quantumReasoning);
1760
+ this.reasoningEngine = new ReasoningEngine();
1761
+ this.agenticMemory = new AgenticMemory(config2.db, config2.kernel, this.reasoningEngine);
1808
1762
  }
1809
1763
  async chat(userInput, runTests = false, testCmd, onStatus) {
1810
1764
  this.messages.push({ role: "user", content: userInput });
1811
1765
  this.updateTokenEstimate();
1812
1766
  if (this.currentL1Tokens > this.L1_TOKEN_LIMIT || this.messages.length > 15) {
1813
- onStatus?.("\u269B\uFE0F High-Water Mark: Offloading context to L3...");
1767
+ onStatus?.("\u2192 [Memory] Offloading context to L3...");
1814
1768
  await this.compressAndOffload();
1815
1769
  }
1816
1770
  let lastError = null;
@@ -1858,11 +1812,11 @@ Please fix the code and try again.`
1858
1812
  onStatus?.(`\u{1F527} [LINT-FIX LOOP] Error detected (${this.lintFixAttempts}/${this.LINT_FIX_LOOP_MAX}). Prompting fix...`);
1859
1813
  continue;
1860
1814
  } else if (errorDetected && this.lintFixAttempts >= this.LINT_FIX_LOOP_MAX) {
1861
- console.log(pc5.yellow(`\u26A0\uFE0F [LINT-FIX LOOP] Max recovery attempts (${this.LINT_FIX_LOOP_MAX}) reached. Flagging for human review.`));
1815
+ console.log(pc4.yellow(`\u26A0\uFE0F [LINT-FIX LOOP] Max recovery attempts (${this.LINT_FIX_LOOP_MAX}) reached. Flagging for human review.`));
1862
1816
  result += "\n\n[RECOVERY LOOP EXHAUSTED - Manual intervention required]";
1863
1817
  }
1864
1818
  }
1865
- await this.quantumMemory.store(
1819
+ await this.agenticMemory.store(
1866
1820
  `Tool [${toolName}] result for query [${userInput}]: ${result.substring(0, 500)}`,
1867
1821
  this.mockEmbedding(userInput),
1868
1822
  { tool: toolName, type: "tool_output" }
@@ -2252,12 +2206,12 @@ ${files}
2252
2206
  const lastUserMessage = this.messages.filter((m) => m.role === "user").pop();
2253
2207
  let relevantMemories = [];
2254
2208
  if (lastUserMessage && lastUserMessage.content.trim()) {
2255
- relevantMemories = await this.quantumMemory.recall(lastUserMessage.content, this.mockEmbedding(lastUserMessage.content));
2209
+ relevantMemories = await this.agenticMemory.recall(lastUserMessage.content, this.mockEmbedding(lastUserMessage.content));
2256
2210
  }
2257
2211
  if (relevantMemories.length > 0) {
2258
2212
  prompt += `
2259
2213
 
2260
- # RECALLED QUANTUM CONTEXT (Associative Knowledge):
2214
+ # RECALLED AGENTIC MEMORY (Associative Knowledge):
2261
2215
  `;
2262
2216
  prompt += relevantMemories.map((m) => `- ${m.content}`).join("\n");
2263
2217
  prompt += `
@@ -2627,7 +2581,7 @@ Respond with your fix using SEARCH/REPLACE blocks.`;
2627
2581
  }
2628
2582
  /**
2629
2583
  * Tiered Offloading: Moves older context from L1 (Hot) to L3 (Cold Storage)
2630
- * by summarizing it and archiving the raw content into Quantum Memory.
2584
+ * by summarizing it and archiving the raw content into Agentic Memory.
2631
2585
  */
2632
2586
  async compressAndOffload() {
2633
2587
  const offloadCount = Math.floor(this.messages.length / 2);
@@ -2638,7 +2592,7 @@ Respond with your fix using SEARCH/REPLACE blocks.`;
2638
2592
 
2639
2593
  ${rawContent}`;
2640
2594
  const summary = await this.callLLM("You are a context compression engine.", [{ role: "user", content: anchorPrompt }]);
2641
- await this.quantumMemory.store(
2595
+ await this.agenticMemory.store(
2642
2596
  `CONTEXT_ANCHOR: ${summary}`,
2643
2597
  this.mockEmbedding(summary),
2644
2598
  { type: "archived_context", original_length: rawContent.length }
@@ -3603,28 +3557,28 @@ var init_ResultAggregator = __esm({
3603
3557
  });
3604
3558
 
3605
3559
  // src/architect/Architect.ts
3606
- import pc6 from "picocolors";
3560
+ import pc5 from "picocolors";
3607
3561
  var Architect;
3608
3562
  var init_Architect = __esm({
3609
3563
  "src/architect/Architect.ts"() {
3610
3564
  "use strict";
3611
3565
  init_TaskDecomposer();
3612
3566
  init_FileCoordinator();
3613
- init_quantum_reasoning();
3567
+ init_reasoning();
3614
3568
  Architect = class {
3615
3569
  orchestrator;
3616
3570
  decomposer;
3617
3571
  coordinator;
3618
- quantumReasoning;
3572
+ reasoningEngine;
3619
3573
  config;
3620
3574
  constructor(orchestrator) {
3621
3575
  this.orchestrator = orchestrator;
3622
3576
  this.decomposer = new TaskDecomposer(orchestrator["agent"]);
3623
3577
  this.coordinator = new FileCoordinator();
3624
- this.quantumReasoning = new QuantumReasoning();
3578
+ this.reasoningEngine = new ReasoningEngine();
3625
3579
  this.config = {
3626
3580
  maxParallelWave: 4,
3627
- enableQuantumOptimization: true,
3581
+ enableOptimization: true,
3628
3582
  enableImplicitParallel: true,
3629
3583
  taskTimeoutMs: 12e4
3630
3584
  };
@@ -3634,9 +3588,9 @@ var init_Architect = __esm({
3634
3588
  */
3635
3589
  async plan(brief, options) {
3636
3590
  const opts = { ...this.config, ...options };
3637
- console.log(pc6.cyan(`
3591
+ console.log(pc5.cyan(`
3638
3592
  \u{1F3DB}\uFE0F [ARCHITECT] Planning for mission: ${brief.missionId}`));
3639
- console.log(pc6.dim(` Intent: ${brief.intent} | Domain: ${brief.domain} | Complexity: ${brief.complexity}`));
3593
+ console.log(pc5.dim(` Intent: ${brief.intent} | Domain: ${brief.domain} | Complexity: ${brief.complexity}`));
3640
3594
  const context = {
3641
3595
  availableFiles: brief.targetFiles,
3642
3596
  existingSkills: [],
@@ -3646,13 +3600,13 @@ var init_Architect = __esm({
3646
3600
  maxSubtasks: opts.maxParallelWave * 2,
3647
3601
  enableImplicitParallel: opts.enableImplicitParallel
3648
3602
  });
3649
- console.log(pc6.dim(` Decomposed into ${tasks.length} tasks`));
3603
+ console.log(pc5.dim(` Decomposed into ${tasks.length} tasks`));
3650
3604
  const conflicts = this.detectConflicts(tasks);
3651
3605
  if (conflicts.length > 0) {
3652
- console.log(pc6.yellow(` \u26A0\uFE0F File conflicts detected: ${conflicts.length}`));
3606
+ console.log(pc5.yellow(` \u26A0\uFE0F File conflicts detected: ${conflicts.length}`));
3653
3607
  }
3654
- const parallelWaves = opts.enableQuantumOptimization ? await this.optimizeWithQuantum(tasks, opts) : this.computeSimpleWaves(tasks, opts);
3655
- console.log(pc6.dim(` Scheduled in ${parallelWaves.length} parallel wave(s)`));
3608
+ const parallelWaves = opts.enableOptimization ? await this.optimizeWithSolver(tasks, opts) : this.computeSimpleWaves(tasks, opts);
3609
+ console.log(pc5.dim(` Scheduled in ${parallelWaves.length} parallel wave(s)`));
3656
3610
  const lockedFiles = this.acquireLocks(tasks);
3657
3611
  const complexityScore = this.computeComplexityScore(tasks, brief);
3658
3612
  return {
@@ -3692,11 +3646,11 @@ var init_Architect = __esm({
3692
3646
  * Optimize task scheduling using QUBO-based parallelization.
3693
3647
  * Uses QAOA to minimize task entanglement and maximize parallelism.
3694
3648
  */
3695
- async optimizeWithQuantum(tasks, opts) {
3649
+ async optimizeWithSolver(tasks, opts) {
3696
3650
  if (tasks.length <= 1) {
3697
3651
  return [tasks.map((t) => t.id)];
3698
3652
  }
3699
- console.log(pc6.dim(" \u269B\uFE0F Running QAOA optimization..."));
3653
+ console.log(pc5.dim(" \u2192 Running constraint optimization..."));
3700
3654
  const constraints = [
3701
3655
  {
3702
3656
  id: "DEPENDENCY_CONSTRAINT",
@@ -3739,12 +3693,12 @@ var init_Architect = __esm({
3739
3693
  }
3740
3694
  ];
3741
3695
  const assignments = this.generateWaveAssignments(tasks, opts.maxParallelWave);
3742
- const bestAssignment = await this.quantumReasoning.solve(
3696
+ const bestAssignment = await this.reasoningEngine.solve(
3743
3697
  assignments,
3744
3698
  constraints,
3745
- (msg) => process.stdout.write(`\r ${pc6.dim(msg)}`)
3699
+ (msg) => process.stdout.write(`\r ${pc5.dim(msg)}`)
3746
3700
  );
3747
- console.log(pc6.dim(""));
3701
+ console.log(pc5.dim(""));
3748
3702
  if (bestAssignment) {
3749
3703
  return bestAssignment.waves;
3750
3704
  }
@@ -3774,7 +3728,7 @@ var init_Architect = __esm({
3774
3728
  return assignments;
3775
3729
  }
3776
3730
  /**
3777
- * Simple wave computation without quantum optimization.
3731
+ * Simple sequential computation without optimization.
3778
3732
  * Groups tasks by dependency depth.
3779
3733
  */
3780
3734
  computeSimpleWaves(tasks, opts) {
@@ -4063,7 +4017,7 @@ var init_ExecutionMode = __esm({
4063
4017
  });
4064
4018
 
4065
4019
  // src/orchestrator/QualityConvergenceChecker.ts
4066
- import * as pc7 from "picocolors";
4020
+ import * as pc6 from "picocolors";
4067
4021
  var DEFAULT_CONVERGENCE_CONFIG, QualityConvergenceChecker;
4068
4022
  var init_QualityConvergenceChecker = __esm({
4069
4023
  "src/orchestrator/QualityConvergenceChecker.ts"() {
@@ -4110,7 +4064,7 @@ var init_QualityConvergenceChecker = __esm({
4110
4064
  tokenEfficiency,
4111
4065
  stagnationCount: this.stagnationCount,
4112
4066
  iteration,
4113
- message: pc7.green(`All ${gatesTotal} quality gates passed \u2014 ready to ship`)
4067
+ message: pc6.green(`All ${gatesTotal} quality gates passed \u2014 ready to ship`)
4114
4068
  };
4115
4069
  }
4116
4070
  if (totalTokens > this.config.tokenBudgetPerTask) {
@@ -4123,7 +4077,7 @@ var init_QualityConvergenceChecker = __esm({
4123
4077
  tokenEfficiency,
4124
4078
  stagnationCount: this.stagnationCount,
4125
4079
  iteration,
4126
- message: pc7.red(`Token budget exceeded: ${totalTokens} > ${this.config.tokenBudgetPerTask} \u2014 stopping`)
4080
+ message: pc6.red(`Token budget exceeded: ${totalTokens} > ${this.config.tokenBudgetPerTask} \u2014 stopping`)
4127
4081
  };
4128
4082
  }
4129
4083
  if (qualityDelta < this.config.minQualityDelta) {
@@ -4138,7 +4092,7 @@ var init_QualityConvergenceChecker = __esm({
4138
4092
  tokenEfficiency,
4139
4093
  stagnationCount: this.stagnationCount,
4140
4094
  iteration,
4141
- message: pc7.yellow(
4095
+ message: pc6.yellow(
4142
4096
  `Quality stagnating: +${qualityDelta} pts for ${this.stagnationCount} consecutive iterations \u2014 stopping to preserve tokens`
4143
4097
  )
4144
4098
  };
@@ -4156,7 +4110,7 @@ var init_QualityConvergenceChecker = __esm({
4156
4110
  tokenEfficiency,
4157
4111
  stagnationCount: this.stagnationCount,
4158
4112
  iteration,
4159
- message: pc7.yellow(
4113
+ message: pc6.yellow(
4160
4114
  `Diminishing returns: +${qualityDelta} pts but token efficiency ${tokenEfficiency.toFixed(3)} < ${this.config.minQualityPerToken} pts/1k tokens \u2014 stopping`
4161
4115
  )
4162
4116
  };
@@ -4170,7 +4124,7 @@ var init_QualityConvergenceChecker = __esm({
4170
4124
  tokenEfficiency,
4171
4125
  stagnationCount: this.stagnationCount,
4172
4126
  iteration,
4173
- message: pc7.cyan(
4127
+ message: pc6.cyan(
4174
4128
  `Quality improving: +${qualityDelta} pts (${tokenEfficiency.toFixed(3)} pts/1k tokens), stagnation=${this.stagnationCount} \u2014 continuing`
4175
4129
  )
4176
4130
  };
@@ -4207,7 +4161,7 @@ var init_QualityConvergenceChecker = __esm({
4207
4161
  });
4208
4162
 
4209
4163
  // src/orchestrator/SelfReviewRunner.ts
4210
- import pc8 from "picocolors";
4164
+ import pc7 from "picocolors";
4211
4165
  var DEFAULT_SELF_REVIEW_CONFIG, SelfReviewRunner;
4212
4166
  var init_SelfReviewRunner = __esm({
4213
4167
  "src/orchestrator/SelfReviewRunner.ts"() {
@@ -4243,14 +4197,14 @@ var init_SelfReviewRunner = __esm({
4243
4197
  let iteration = 0;
4244
4198
  let lastResult = null;
4245
4199
  let artifacts = [];
4246
- console.log(pc8.bold(pc8.cyan(`
4200
+ console.log(pc7.bold(pc7.cyan(`
4247
4201
  \u{1F37D}\uFE0F [SELF-REVIEW] Starting ${this.config.mode} execution for task: ${task.id}`)));
4248
4202
  if (this.config.mode === "audit_only" /* AUDIT_ONLY */) {
4249
- console.log(pc8.dim("[SELF-REVIEW] Audit-only mode \u2014 verifying without executing"));
4203
+ console.log(pc7.dim("[SELF-REVIEW] Audit-only mode \u2014 verifying without executing"));
4250
4204
  return this.runAuditOnly(task);
4251
4205
  }
4252
4206
  if (this.config.mode === "parallel" /* PARALLEL */) {
4253
- console.log(pc8.dim("[SELF-REVIEW] Parallel mode \u2014 executing without self-review"));
4207
+ console.log(pc7.dim("[SELF-REVIEW] Parallel mode \u2014 executing without self-review"));
4254
4208
  const result = await executorFn(task);
4255
4209
  return {
4256
4210
  passes: result.success,
@@ -4266,15 +4220,15 @@ var init_SelfReviewRunner = __esm({
4266
4220
  }
4267
4221
  while (iteration < this.config.maxIterations) {
4268
4222
  iteration++;
4269
- console.log(pc8.cyan(`
4223
+ console.log(pc7.cyan(`
4270
4224
  \u{1F4E6} [ITERATION ${iteration}/${this.config.maxIterations}] Executing task...`));
4271
4225
  lastResult = await executorFn(task);
4272
4226
  if (!lastResult.success) {
4273
- console.log(pc8.red(`\u274C [ITERATION ${iteration}] Execution failed: ${lastResult.error}`));
4227
+ console.log(pc7.red(`\u274C [ITERATION ${iteration}] Execution failed: ${lastResult.error}`));
4274
4228
  break;
4275
4229
  }
4276
4230
  artifacts = lastResult.artifacts || [];
4277
- console.log(pc8.cyan(`
4231
+ console.log(pc7.cyan(`
4278
4232
  \u{1F50D} [ITERATION ${iteration}] Running self-review...`));
4279
4233
  const reviewContext = {
4280
4234
  taskId: task.id,
@@ -4286,15 +4240,15 @@ var init_SelfReviewRunner = __esm({
4286
4240
  const qualityScore = this.computeQualityScore(gateResults);
4287
4241
  const issues = gateResults.flatMap((g) => g.issues || []);
4288
4242
  const warnings = gateResults.flatMap((g) => g.warnings || []);
4289
- console.log(pc8.cyan(`
4243
+ console.log(pc7.cyan(`
4290
4244
  \u{1F4CA} [ITERATION ${iteration}] Quality Score: ${qualityScore}% | Gates: ${gateResults.filter((g) => g.passed).length}/${gateResults.length}`));
4291
4245
  if (this.config.enableConvergenceCheck) {
4292
4246
  const tokensThisIteration = this.estimateTokens(lastResult);
4293
4247
  const gatesPassedCount = gateResults.filter((g) => g.passed).length;
4294
4248
  const decision = this.convergenceChecker.check(qualityScore, tokensThisIteration, gatesPassedCount, gateResults.length);
4295
- console.log(pc8.dim(" " + decision.message));
4249
+ console.log(pc7.dim(" " + decision.message));
4296
4250
  if (!decision.shouldContinue) {
4297
- console.log(pc8.yellow("\n\u26A0\uFE0F [ITERATION " + iteration + "] " + decision.reason.toUpperCase() + " \u2014 stopping quality loop"));
4251
+ console.log(pc7.yellow("\n\u26A0\uFE0F [ITERATION " + iteration + "] " + decision.reason.toUpperCase() + " \u2014 stopping quality loop"));
4298
4252
  return {
4299
4253
  passes: false,
4300
4254
  qualityScore,
@@ -4314,7 +4268,7 @@ var init_SelfReviewRunner = __esm({
4314
4268
  return gate?.blocking && !g.passed;
4315
4269
  });
4316
4270
  if (!blockingFailed && qualityScore >= this.config.minQualityScore) {
4317
- console.log(pc8.green(`
4271
+ console.log(pc7.green(`
4318
4272
  \u2705 [ITERATION ${iteration}] Quality gates PASSED \u2014 ready to ship`));
4319
4273
  return {
4320
4274
  passes: true,
@@ -4329,12 +4283,12 @@ var init_SelfReviewRunner = __esm({
4329
4283
  };
4330
4284
  }
4331
4285
  if (iteration >= this.config.maxIterations) {
4332
- console.log(pc8.red(`
4286
+ console.log(pc7.red(`
4333
4287
  \u{1F6AB} [ITERATION ${iteration}] Max iterations reached. Quality gates FAILED.`));
4334
- console.log(pc8.red(` Issues: ${issues.join(", ") || "none"}`));
4335
- console.log(pc8.red(` Score: ${qualityScore}% (min: ${this.config.minQualityScore}%)`));
4288
+ console.log(pc7.red(` Issues: ${issues.join(", ") || "none"}`));
4289
+ console.log(pc7.red(` Score: ${qualityScore}% (min: ${this.config.minQualityScore}%)`));
4336
4290
  if (this.config.allowHumanOverride) {
4337
- console.log(pc8.yellow(`
4291
+ console.log(pc7.yellow(`
4338
4292
  \u26A0\uFE0F [SELF-REVIEW] Prompting for human override...`));
4339
4293
  }
4340
4294
  return {
@@ -4349,10 +4303,10 @@ var init_SelfReviewRunner = __esm({
4349
4303
  timeSpentMs: Date.now() - startTime
4350
4304
  };
4351
4305
  }
4352
- console.log(pc8.yellow(`
4306
+ console.log(pc7.yellow(`
4353
4307
  \u{1F527} [ITERATION ${iteration}] Quality gates FAILED \u2014 refining and retrying...`));
4354
4308
  if (issues.length > 0) {
4355
- console.log(pc8.dim(` Issues to fix: ${issues.join("; ")}`));
4309
+ console.log(pc7.dim(` Issues to fix: ${issues.join("; ")}`));
4356
4310
  }
4357
4311
  await this.sleep(1e3);
4358
4312
  }
@@ -4375,19 +4329,19 @@ var init_SelfReviewRunner = __esm({
4375
4329
  const results = [];
4376
4330
  for (const gate of this.config.qualityGates) {
4377
4331
  try {
4378
- console.log(pc8.dim(` Checking gate: ${gate.name}...`));
4332
+ console.log(pc7.dim(` Checking gate: ${gate.name}...`));
4379
4333
  const result = await gate.check(ctx);
4380
4334
  results.push(result);
4381
4335
  if (result.passed) {
4382
- console.log(pc8.green(` \u2705 ${gate.name}: ${result.details}`));
4336
+ console.log(pc7.green(` \u2705 ${gate.name}: ${result.details}`));
4383
4337
  } else {
4384
- console.log(pc8.red(` \u274C ${gate.name}: ${result.details}`));
4338
+ console.log(pc7.red(` \u274C ${gate.name}: ${result.details}`));
4385
4339
  if (result.issues) {
4386
- result.issues.forEach((issue) => console.log(pc8.red(` - ${issue}`)));
4340
+ result.issues.forEach((issue) => console.log(pc7.red(` - ${issue}`)));
4387
4341
  }
4388
4342
  }
4389
4343
  } catch (error) {
4390
- console.log(pc8.red(` \u274C ${gate.name}: Error \u2014 ${error.message}`));
4344
+ console.log(pc7.red(` \u274C ${gate.name}: Error \u2014 ${error.message}`));
4391
4345
  results.push({
4392
4346
  passed: false,
4393
4347
  details: `Gate error: ${error.message}`,
@@ -5529,7 +5483,7 @@ init_agent();
5529
5483
  init_Liaison();
5530
5484
  init_Orchestrator();
5531
5485
  import * as p from "@clack/prompts";
5532
- import pc9 from "picocolors";
5486
+ import pc8 from "picocolors";
5533
5487
  function createRepl(agent) {
5534
5488
  let orchestrator = null;
5535
5489
  let liaison = null;
@@ -5561,19 +5515,19 @@ function createRepl(agent) {
5561
5515
  return {
5562
5516
  async start() {
5563
5517
  process.stdout.write("\x1Bc");
5564
- console.log(pc9.bold(pc9.cyan("MEOW")) + pc9.dim(" | ") + pc9.white("Layered Agency System"));
5565
- console.log(pc9.dim("L1: Liaison | L2: Architect | L3: Swarm | L4: Auditor\n"));
5518
+ console.log(pc8.bold(pc8.cyan("MEOW")) + pc8.dim(" | ") + pc8.white("Layered Agency System"));
5519
+ console.log(pc8.dim("L1: Liaison | L2: Architect | L3: Swarm | L4: Auditor\n"));
5566
5520
  liaison = new Liaison(agent);
5567
5521
  while (true) {
5568
5522
  const input = await p.text({
5569
- message: pc9.bold(pc9.cyan(">>")),
5523
+ message: pc8.bold(pc8.cyan(">>")),
5570
5524
  placeholder: "",
5571
5525
  validate(value) {
5572
5526
  if (!value || value.length === 0) return "Please enter a message";
5573
5527
  }
5574
5528
  });
5575
5529
  if (p.isCancel(input)) {
5576
- console.log(pc9.cyan("\nGoodbye!"));
5530
+ console.log(pc8.cyan("\nGoodbye!"));
5577
5531
  process.exit(0);
5578
5532
  }
5579
5533
  const text2 = input;
@@ -5583,31 +5537,31 @@ function createRepl(agent) {
5583
5537
  switch (cmd) {
5584
5538
  case "exit":
5585
5539
  case "quit":
5586
- console.log(pc9.cyan("Goodbye!"));
5540
+ console.log(pc8.cyan("Goodbye!"));
5587
5541
  process.exit(0);
5588
5542
  break;
5589
5543
  case "clear":
5590
5544
  process.stdout.write("\x1Bc");
5591
5545
  agent.clearHistory();
5592
- console.log(pc9.bold(pc9.cyan("MEOW")) + pc9.dim(" | ") + pc9.white("Context Cleared\n"));
5546
+ console.log(pc8.bold(pc8.cyan("MEOW")) + pc8.dim(" | ") + pc8.white("Context Cleared\n"));
5593
5547
  break;
5594
5548
  case "help":
5595
- console.log(pc9.bold("\nCommands:"));
5596
- console.log(pc9.cyan(" /add <file> ") + pc9.dim("- Add file to context"));
5597
- console.log(pc9.cyan(" /drop <file> ") + pc9.dim("- Remove file from context"));
5598
- console.log(pc9.cyan(" /files ") + pc9.dim("- List files in context"));
5599
- console.log(pc9.cyan(" /clear ") + pc9.dim("- Clear context and screen"));
5600
- console.log(pc9.cyan(" /parallel ") + pc9.dim("- Toggle parallel orchestrator mode"));
5601
- console.log(pc9.cyan(" /status ") + pc9.dim("- Show orchestrator status"));
5602
- console.log(pc9.cyan(" /exit ") + pc9.dim("- Exit REPL\n"));
5549
+ console.log(pc8.bold("\nCommands:"));
5550
+ console.log(pc8.cyan(" /add <file> ") + pc8.dim("- Add file to context"));
5551
+ console.log(pc8.cyan(" /drop <file> ") + pc8.dim("- Remove file from context"));
5552
+ console.log(pc8.cyan(" /files ") + pc8.dim("- List files in context"));
5553
+ console.log(pc8.cyan(" /clear ") + pc8.dim("- Clear context and screen"));
5554
+ console.log(pc8.cyan(" /parallel ") + pc8.dim("- Toggle parallel orchestrator mode"));
5555
+ console.log(pc8.cyan(" /status ") + pc8.dim("- Show orchestrator status"));
5556
+ console.log(pc8.cyan(" /exit ") + pc8.dim("- Exit REPL\n"));
5603
5557
  break;
5604
5558
  case "files":
5605
5559
  const files = agent.getFiles();
5606
5560
  if (files.length === 0) {
5607
- console.log(pc9.cyan("No files in context."));
5561
+ console.log(pc8.cyan("No files in context."));
5608
5562
  } else {
5609
- console.log(pc9.bold("\nFiles in Context:"));
5610
- files.forEach((f) => console.log(pc9.dim(` - ${f}`)));
5563
+ console.log(pc8.bold("\nFiles in Context:"));
5564
+ files.forEach((f) => console.log(pc8.dim(` - ${f}`)));
5611
5565
  console.log("");
5612
5566
  }
5613
5567
  break;
@@ -5615,27 +5569,27 @@ function createRepl(agent) {
5615
5569
  if (parallelMode) {
5616
5570
  parallelMode = false;
5617
5571
  orchestrator = null;
5618
- console.log(pc9.yellow("Parallel mode disabled [OFF]. Using sequential execution."));
5572
+ console.log(pc8.yellow("Parallel mode disabled [OFF]. Using sequential execution."));
5619
5573
  } else {
5620
5574
  parallelMode = true;
5621
5575
  orchestrator = new Orchestrator(agent);
5622
- console.log(pc9.green("Parallel mode enabled [ON]. Use '/' delimited tasks for parallel execution."));
5576
+ console.log(pc8.green("Parallel mode enabled [ON]. Use '/' delimited tasks for parallel execution."));
5623
5577
  }
5624
5578
  continue;
5625
5579
  case "status":
5626
5580
  if (orchestrator) {
5627
5581
  const status = orchestrator.getStatus();
5628
- console.log(pc9.bold("\n## Orchestrator Status:"));
5629
- console.log(` Queue: ${JSON.stringify(status.queue, null, 2).split("\n").map((l) => pc9.dim(l)).join("\n")}`);
5630
- console.log(pc9.dim(` Workers: ${status.workers}`));
5631
- console.log(pc9.dim(` Locked Files: ${status.lockedFiles}
5582
+ console.log(pc8.bold("\n## Orchestrator Status:"));
5583
+ console.log(` Queue: ${JSON.stringify(status.queue, null, 2).split("\n").map((l) => pc8.dim(l)).join("\n")}`);
5584
+ console.log(pc8.dim(` Workers: ${status.workers}`));
5585
+ console.log(pc8.dim(` Locked Files: ${status.lockedFiles}
5632
5586
  `));
5633
5587
  } else {
5634
- console.log(pc9.dim("Orchestrator not initialized. Use /parallel to enable."));
5588
+ console.log(pc8.dim("Orchestrator not initialized. Use /parallel to enable."));
5635
5589
  }
5636
5590
  continue;
5637
5591
  default:
5638
- console.log(pc9.red(`Unknown command: /${cmd}`));
5592
+ console.log(pc8.red(`Unknown command: /${cmd}`));
5639
5593
  }
5640
5594
  continue;
5641
5595
  }
@@ -5644,7 +5598,7 @@ function createRepl(agent) {
5644
5598
  try {
5645
5599
  let response;
5646
5600
  if (parallelMode || hasExplicitTasks) {
5647
- s.message(pc9.dim("Initializing Architect (L2)..."));
5601
+ s.message(pc8.dim("Initializing Architect (L2)..."));
5648
5602
  if (!orchestrator) {
5649
5603
  orchestrator = new Orchestrator(agent);
5650
5604
  }
@@ -5654,60 +5608,60 @@ function createRepl(agent) {
5654
5608
  tasks: hasExplicitTasks ? text2 : void 0,
5655
5609
  onStatus: (update) => {
5656
5610
  if (update.progress) {
5657
- s.message(pc9.dim(`${update.progress.label}: ${update.progress.current}/${update.progress.total}`));
5611
+ s.message(pc8.dim(`${update.progress.label}: ${update.progress.current}/${update.progress.total}`));
5658
5612
  } else {
5659
- s.message(pc9.dim(update.message));
5613
+ s.message(pc8.dim(update.message));
5660
5614
  }
5661
5615
  }
5662
5616
  }
5663
5617
  );
5664
5618
  response = result.summary;
5665
5619
  } else {
5666
- s.message(pc9.dim("L1: Parsing intent..."));
5620
+ s.message(pc8.dim("L1: Parsing intent..."));
5667
5621
  const liaisonResponse = await liaison.chat(
5668
5622
  text2,
5669
5623
  // Stream callback - shows thoughts as they arrive
5670
5624
  (chunk) => {
5671
5625
  if (!chunk.done && chunk.text) {
5672
- process.stdout.write(pc9.dim(chunk.text));
5626
+ process.stdout.write(pc8.dim(chunk.text));
5673
5627
  }
5674
5628
  },
5675
5629
  // Status callback - updates spinner message
5676
5630
  (status) => {
5677
- s.message(pc9.dim(status));
5631
+ s.message(pc8.dim(status));
5678
5632
  }
5679
5633
  );
5680
5634
  response = liaisonResponse.text;
5681
- console.log(pc9.dim(`
5635
+ console.log(pc8.dim(`
5682
5636
  [Intent: ${liaisonResponse.brief.intent}] [Domain: ${liaisonResponse.brief.domain}] [Complexity: ${liaisonResponse.brief.complexity}]`));
5683
5637
  if (liaisonResponse.brief.complexity > 60) {
5684
- s.message(pc9.dim("Complex request detected. Handing off to Architect (L2)..."));
5638
+ s.message(pc8.dim("Complex request detected. Handing off to Architect (L2)..."));
5685
5639
  if (!orchestrator) {
5686
5640
  orchestrator = new Orchestrator(agent);
5687
5641
  }
5688
5642
  const result = await orchestrator.execute(text2, {
5689
5643
  onStatus: (update) => {
5690
- s.message(pc9.dim(update.message));
5644
+ s.message(pc8.dim(update.message));
5691
5645
  }
5692
5646
  });
5693
5647
  response = result.summary;
5694
5648
  }
5695
5649
  }
5696
- s.stop(pc9.dim("Done"));
5650
+ s.stop(pc8.dim("Done"));
5697
5651
  console.log("");
5698
5652
  const termWidth = getTerminalWidth();
5699
5653
  const usableWidth = Math.max(termWidth - 6, 20);
5700
5654
  const dashLine = boxLine("\u2500", usableWidth);
5701
- const headerLine = pc9.bold(pc9.cyan("\u250C\u2500\u2500 MEOW \u2500" + boxLine("\u2500", usableWidth - 7)));
5702
- const footerLine = pc9.bold(pc9.cyan("\u2514" + dashLine + "\u2500\u2500\u2518"));
5655
+ const headerLine = pc8.bold(pc8.cyan("\u250C\u2500\u2500 MEOW \u2500" + boxLine("\u2500", usableWidth - 7)));
5656
+ const footerLine = pc8.bold(pc8.cyan("\u2514" + dashLine + "\u2500\u2500\u2518"));
5703
5657
  console.log(headerLine);
5704
- const coloredResponse = response.replace(/^# (.*)/gm, (_, m) => pc9.bold(pc9.cyan(m))).replace(/^## (.*)/gm, (_, m) => pc9.bold(pc9.white(m))).replace(/\*\*(.*?)\*\*/g, (_, m) => pc9.bold(pc9.white(m))).replace(/`(.*?)`/g, (_, m) => pc9.yellow(m));
5705
- console.log(coloredResponse.split("\n").map((line) => pc9.bold(pc9.cyan("\u2502 ")) + sanitizeForBox(line)).join("\n"));
5658
+ const coloredResponse = response.replace(/^# (.*)/gm, (_, m) => pc8.bold(pc8.cyan(m))).replace(/^## (.*)/gm, (_, m) => pc8.bold(pc8.white(m))).replace(/\*\*(.*?)\*\*/g, (_, m) => pc8.bold(pc8.white(m))).replace(/`(.*?)`/g, (_, m) => pc8.yellow(m));
5659
+ console.log(coloredResponse.split("\n").map((line) => pc8.bold(pc8.cyan("\u2502 ")) + sanitizeForBox(line)).join("\n"));
5706
5660
  console.log(footerLine);
5707
5661
  console.log("");
5708
5662
  } catch (err) {
5709
5663
  const errorMsg = String(err).length > 100 ? String(err).substring(0, 100) + "..." : String(err);
5710
- s.stop(pc9.red("Error: " + errorMsg));
5664
+ s.stop(pc8.red("Error: " + errorMsg));
5711
5665
  }
5712
5666
  }
5713
5667
  }
@@ -5715,7 +5669,7 @@ function createRepl(agent) {
5715
5669
  }
5716
5670
 
5717
5671
  // src/kernel/kernel.ts
5718
- import pc10 from "picocolors";
5672
+ import pc9 from "picocolors";
5719
5673
  import fs from "fs";
5720
5674
  import path from "path";
5721
5675
  var MeowKernel = class {
@@ -5751,7 +5705,7 @@ var MeowKernel = class {
5751
5705
  this.logDir = logDir;
5752
5706
  this.logFile = path.join(logDir, `meow-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.log`);
5753
5707
  this.logStream = fs.createWriteStream(this.logFile, { flags: "a" });
5754
- this.log(pc10.cyan("\u{1F680} Meow Kernel initialized"), "KERNEL");
5708
+ this.log(pc9.cyan("\u{1F680} Meow Kernel initialized"), "KERNEL");
5755
5709
  }
5756
5710
  logDir = "";
5757
5711
  logFile = "";
@@ -5859,7 +5813,7 @@ var MeowKernel = class {
5859
5813
  [pid]
5860
5814
  );
5861
5815
  this.agentHeartbeats.delete(pid);
5862
- console.log(pc10.cyan(`\u{1F504} [WATCHDOG] Respawning agent for mission: ${mission.goal}`));
5816
+ console.log(pc9.cyan(`\u{1F504} [WATCHDOG] Respawning agent for mission: ${mission.goal}`));
5863
5817
  const { spawn: spawn3 } = __require("child_process");
5864
5818
  const shell = process.platform === "win32";
5865
5819
  const isBun2 = typeof globalThis.Bun !== "undefined";
@@ -5878,7 +5832,7 @@ var MeowKernel = class {
5878
5832
  stdio: "inherit"
5879
5833
  }).pid;
5880
5834
  await this.registerMission(newPid, mission.agent_name, mission.goal);
5881
- console.log(pc10.green(`\u2705 [WATCHDOG] Respawned agent with new PID ${newPid}`));
5835
+ console.log(pc9.green(`\u2705 [WATCHDOG] Respawned agent with new PID ${newPid}`));
5882
5836
  for (const cb of this.respawnCallbacks) {
5883
5837
  cb(pid, newPid);
5884
5838
  }
@@ -5943,7 +5897,7 @@ var MeowKernel = class {
5943
5897
  const entangled = this.monolithEntanglement.get(pid);
5944
5898
  if (entangled && (status === "completed" || status === "failed")) {
5945
5899
  entangled.forEach((partnerPid) => {
5946
- console.log(pc10.magenta(`
5900
+ console.log(pc9.magenta(`
5947
5901
  \u{1F30C} [SPOOKY ACTION] Mission ${pid} collapsed to ${status}. Propagating interference to Partner ${partnerPid}...`));
5948
5902
  this.push({ type: "SET_STATE", key: `interference_${partnerPid}`, value: {
5949
5903
  sourcePid: pid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meow-swarm",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "meow -p: Autonomous multi-agent coding harness. Run coding agents in background, checkpoint state, TUI dashboard.",
6
6
  "main": "dist/index.js",
@@ -33,7 +33,6 @@
33
33
  "js-yaml": "4.1.1",
34
34
  "mathjs": "^15.2.0",
35
35
  "picocolors": "1.1.1",
36
- "quantum-circuit": "^0.9.247",
37
36
  "sqlite-vec": "^0.1.9"
38
37
  },
39
38
  "devDependencies": {