monomind 1.10.4 → 1.10.6

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.
@@ -659,13 +659,31 @@ function getAgentDBStats() {
659
659
  }
660
660
 
661
661
  // Graphify knowledge graph stats
662
+ // Sources, in priority order:
663
+ // 1. .monomind/graph/stats.json — explicit cached stats
664
+ // 2. .monomind/monograph.db — live SQLite (read counts via sqlite3)
665
+ // 3. .monomind/graph/graph.json — legacy JSON dump
662
666
  function getGraphifyStats() {
663
667
  const statsPath = path.join(CWD, '.monomind', 'graph', 'stats.json');
668
+ const dbPath = path.join(CWD, '.monomind', 'monograph.db');
664
669
  const graphPath = path.join(CWD, '.monomind', 'graph', 'graph.json');
670
+
665
671
  try {
666
672
  const s = readJSON(statsPath);
667
673
  if (s && s.nodes !== undefined) return { nodes: s.nodes, edges: s.edges || 0, exists: true };
668
674
  } catch { /* ignore */ }
675
+
676
+ // Live monograph.db — single SQLite call, strict 1s timeout
677
+ try {
678
+ if (fs.existsSync(dbPath)) {
679
+ const out = safeExec(`sqlite3 "${dbPath}" "SELECT (SELECT COUNT(*) FROM nodes), (SELECT COUNT(*) FROM edges);"`, 1000);
680
+ if (out) {
681
+ const [n, e] = out.split('|').map(v => parseInt(v, 10) || 0);
682
+ if (n > 0) return { nodes: n, edges: e, exists: true };
683
+ }
684
+ }
685
+ } catch { /* ignore */ }
686
+
669
687
  try {
670
688
  const stat = safeStat(graphPath);
671
689
  if (stat && stat.size < 10 * 1024 * 1024) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
4
4
  "description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -121,4 +121,4 @@
121
121
  "access": "public",
122
122
  "tag": "latest"
123
123
  }
124
- }
124
+ }
@@ -145,7 +145,7 @@ function getProjectName() {
145
145
  try {
146
146
  const remote = safeExec('git remote get-url origin 2>/dev/null', 2000).trim();
147
147
  if (remote) {
148
- const m = remote.match(/[/:]([\w.-]+)\/([\w.-]+?)(?:\.git)?$/);
148
+ const m = remote.match(/[/:]([\\w.-]+)\\/([\\w.-]+?)(?:\\.git)?$/);
149
149
  if (m) return \`\${m[1]}/\${m[2]}\`;
150
150
  }
151
151
  } catch { /* ignore */ }
@@ -828,6 +828,43 @@ function getTriggerStats() {
828
828
  } catch { return { triggers: 0, agents: 0 }; }
829
829
  }
830
830
 
831
+ // Monograph knowledge graph stats
832
+ // Sources, in priority order:
833
+ // 1. .monomind/graph/stats.json — explicit cached stats
834
+ // 2. .monomind/monograph.db — live SQLite (read counts via sqlite3)
835
+ // 3. .monomind/graph/graph.json — legacy JSON dump
836
+ function getGraphifyStats() {
837
+ const statsPath = path.join(CWD, '.monomind', 'graph', 'stats.json');
838
+ const dbPath = path.join(CWD, '.monomind', 'monograph.db');
839
+ const graphPath = path.join(CWD, '.monomind', 'graph', 'graph.json');
840
+
841
+ try {
842
+ const s = readJSON(statsPath);
843
+ if (s && s.nodes !== undefined) return { nodes: s.nodes, edges: s.edges || 0, exists: true };
844
+ } catch { /* ignore */ }
845
+
846
+ try {
847
+ if (fs.existsSync(dbPath)) {
848
+ const out = safeExec(\`sqlite3 "\${dbPath}" "SELECT (SELECT COUNT(*) FROM nodes), (SELECT COUNT(*) FROM edges);"\`, 1000);
849
+ if (out) {
850
+ const [n, e] = out.split('|').map(v => parseInt(v, 10) || 0);
851
+ if (n > 0) return { nodes: n, edges: e, exists: true };
852
+ }
853
+ }
854
+ } catch { /* ignore */ }
855
+
856
+ try {
857
+ const stat = safeStat(graphPath);
858
+ if (stat && stat.size < 10 * 1024 * 1024) {
859
+ const g = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
860
+ const nodes = Array.isArray(g.nodes) ? g.nodes.length : 0;
861
+ const edges = (Array.isArray(g.edges) ? g.edges : (Array.isArray(g.links) ? g.links : [])).length;
862
+ return { nodes, edges, exists: true };
863
+ }
864
+ } catch { /* ignore */ }
865
+ return { nodes: 0, edges: 0, exists: false };
866
+ }
867
+
831
868
  function getSIBudget() {
832
869
  const SI_LIMIT = 1500;
833
870
  const siPath = path.join(CWD, '.agents', 'shared_instructions.md');
@@ -961,11 +998,18 @@ function generateDashboard() {
961
998
  ? \`\${x.gold}\${progress.patternsLearned >= 1000 ? (progress.patternsLearned / 1000).toFixed(1) + 'k' : progress.patternsLearned} patterns\${x.reset}\`
962
999
  : \`\${x.slate}0 patterns\${x.reset}\`;
963
1000
 
1001
+ // Graph (monograph)
1002
+ const graph = getGraphifyStats();
1003
+ const graphStr = graph.exists
1004
+ ? \`\${x.sky}🔗 \${x.bold}\${graph.nodes}\${x.reset}\${x.slate} nodes · \${x.reset}\${x.sky}\${x.bold}\${graph.edges}\${x.reset}\${x.slate} edges\${x.reset}\`
1005
+ : \`\${x.slate}🔗 no graph\${x.reset}\`;
1006
+
964
1007
  lines.push(
965
1008
  \`\${x.purple}💡 INTEL\${x.reset} \` +
966
1009
  \`\${intellCol}\${intellBar} \${x.bold}\${system.intelligencePct}%\${x.reset} \${DIV} \` +
967
1010
  \`\${knowStr}\${skillStr} \${DIV} \` +
968
- patStr
1011
+ \`\${patStr} \${DIV} \` +
1012
+ graphStr
969
1013
  );
970
1014
  lines.push(SEP);
971
1015
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -112,4 +112,4 @@
112
112
  "access": "public",
113
113
  "tag": "latest"
114
114
  }
115
- }
115
+ }