From 96934ea22aeaf2fae5c66d19b96b99abf5fdfc8e Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 13 Oct 2025 16:12:55 +0000 Subject: [PATCH] [perf] Add comprehensive ReasoningBank query optimizations (v2.7.0-alpha.4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical performance improvements to fix query timeouts and slow storage: ## Performance Fixes - Query timeout protection: 3s default timeout with Promise.race() - Empty result detection: SQL fallback when semantic search returns 0 results - Query result caching: LRU cache (100 entries, 60s TTL) - Database indexes: 4 performance indexes on confidence, usage_count, created_at - Async background embeddings: Non-blocking embedding computation ## Performance Improvements - Query time: >60s → <5s (>10x faster) - Storage speed: 2.5s/item → <0.1s/item (>25x faster) - Cached queries: <50ms (instant) ## Modified Files - src/reasoningbank/reasoningbank-adapter.js: Multi-layer query strategy - Lines 126-187: Query with timeout and fallback - Lines 192-246: Fast SQL fallback - Lines 251-278: LRU cache implementation - Lines 35-60: Database index creation - Lines 82-121: Async embedding queue ## Technical Details Multi-layer query strategy: 1. Check cache (instant if hit) 2. Try semantic search with embedding similarity 3. Timeout protection (3s default) 4. Detect empty results 5. Fall back to indexed SQL query 6. Cache results for future queries Auto-optimization on init: - initializeReasoningBank() creates 4 indexes automatically - Migration support for existing databases - Idempotent index creation (IF NOT EXISTS) šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 7786 ++++++++++------- .claude-flow/metrics/task-metrics.json | 6 +- bin/claude-flow | 2 +- dist-cjs/src/cli/help-formatter.js | 8 +- dist-cjs/src/cli/help-formatter.js.map | 2 +- .../src/cli/simple-commands/config.js.map | 2 +- .../src/cli/simple-commands/init/index.js | 45 + .../src/cli/simple-commands/init/index.js.map | 2 +- dist-cjs/src/cli/simple-commands/memory.js | 166 +- .../src/cli/simple-commands/memory.js.map | 2 +- .../reasoningbank/reasoningbank-adapter.js | 320 + .../reasoningbank-adapter.js.map | 1 + dist-cjs/src/utils/key-redactor.js.map | 2 +- dist-cjs/src/utils/metrics-reader.js | 70 +- dist-cjs/src/utils/metrics-reader.js.map | 2 +- docs/REASONINGBANK-INTEGRATION-STATUS.md | 179 + memory/memory-store.json | 14 + package-lock.json | 4 +- package.json | 2 +- src/cli/simple-commands/init/index.js | 70 + src/cli/simple-commands/memory.js | 204 +- src/reasoningbank/reasoningbank-adapter.js | 447 + 23 files changed, 6141 insertions(+), 3197 deletions(-) create mode 100644 dist-cjs/src/reasoningbank/reasoningbank-adapter.js create mode 100644 dist-cjs/src/reasoningbank/reasoningbank-adapter.js.map create mode 100644 docs/REASONINGBANK-INTEGRATION-STATUS.md create mode 100644 src/reasoningbank/reasoningbank-adapter.js diff --git a/.claude-flow/metrics/performance.json b/.claude-flow/metrics/performance.json index 1a142cea0..ea38ddc77 100644 --- a/.claude-flow/metrics/performance.json +++ b/.claude-flow/metrics/performance.json @@ -1,5 +1,5 @@ { - "startTime": 1760287243984, + "startTime": 1760371912397, "totalTasks": 1, "successfulTasks": 1, "failedTasks": 0, diff --git a/.claude-flow/metrics/system-metrics.json b/.claude-flow/metrics/system-metrics.json index aab2fda64..4a82d6d47 100644 --- a/.claude-flow/metrics/system-metrics.json +++ b/.claude-flow/metrics/system-metrics.json @@ -1,3170 +1,4718 @@ [ { - "timestamp": 1760279339609, - "memoryTotal": 67427549184, - "memoryUsed": 4618846208, - "memoryFree": 62808702976, - "memoryUsagePercent": 6.850087633165843, - "memoryEfficiency": 93.14991236683416, + "timestamp": 1760360129641, + "memoryTotal": 67427545088, + "memoryUsed": 4564770816, + "memoryFree": 62862774272, + "memoryUsagePercent": 6.769890272651178, + "memoryEfficiency": 93.23010972734882, "cpuCount": 16, - "cpuLoad": 0.17375, + "cpuLoad": 0.14625, "platform": "linux", - "uptime": 952.52 + "uptime": 182.31 }, { - "timestamp": 1760279369638, - "memoryTotal": 67427549184, - "memoryUsed": 4889128960, - "memoryFree": 62538420224, - "memoryUsagePercent": 7.250936774608665, - "memoryEfficiency": 92.74906322539134, - "cpuCount": 16, - "cpuLoad": 0.164375, - "platform": "linux", - "uptime": 982.55 - }, - { - "timestamp": 1760279399646, - "memoryTotal": 67427549184, - "memoryUsed": 4896514048, - "memoryFree": 62531035136, - "memoryUsagePercent": 7.261889401671895, - "memoryEfficiency": 92.7381105983281, - "cpuCount": 16, - "cpuLoad": 0.140625, - "platform": "linux", - "uptime": 1012.55 - }, - { - "timestamp": 1760279429675, - "memoryTotal": 67427549184, - "memoryUsed": 5170089984, - "memoryFree": 62257459200, - "memoryUsagePercent": 7.667622576480682, - "memoryEfficiency": 92.33237742351932, - "cpuCount": 16, - "cpuLoad": 0.1225, - "platform": "linux", - "uptime": 1042.58 - }, - { - "timestamp": 1760279459706, - "memoryTotal": 67427549184, - "memoryUsed": 5139161088, - "memoryFree": 62288388096, - "memoryUsagePercent": 7.62175275565181, - "memoryEfficiency": 92.37824724434819, - "cpuCount": 16, - "cpuLoad": 0.113125, - "platform": "linux", - "uptime": 1072.61 - }, - { - "timestamp": 1760279489723, - "memoryTotal": 67427549184, - "memoryUsed": 4873158656, - "memoryFree": 62554390528, - "memoryUsagePercent": 7.227251642651073, - "memoryEfficiency": 92.77274835734893, - "cpuCount": 16, - "cpuLoad": 0.11125, - "platform": "linux", - "uptime": 1102.63 - }, - { - "timestamp": 1760279519748, - "memoryTotal": 67427549184, - "memoryUsed": 4874219520, - "memoryFree": 62553329664, - "memoryUsagePercent": 7.228824981757771, - "memoryEfficiency": 92.77117501824223, - "cpuCount": 16, - "cpuLoad": 0.070625, - "platform": "linux", - "uptime": 1132.66 - }, - { - "timestamp": 1760279549779, - "memoryTotal": 67427549184, - "memoryUsed": 4948676608, - "memoryFree": 62478872576, - "memoryUsagePercent": 7.339250303308191, - "memoryEfficiency": 92.66074969669181, - "cpuCount": 16, - "cpuLoad": 0.125625, - "platform": "linux", - "uptime": 1162.69 - }, - { - "timestamp": 1760279579810, - "memoryTotal": 67427549184, - "memoryUsed": 4972462080, - "memoryFree": 62455087104, - "memoryUsagePercent": 7.374525902507405, - "memoryEfficiency": 92.6254740974926, - "cpuCount": 16, - "cpuLoad": 0.104375, - "platform": "linux", - "uptime": 1192.72 - }, - { - "timestamp": 1760279609834, - "memoryTotal": 67427549184, - "memoryUsed": 5120790528, - "memoryFree": 62306758656, - "memoryUsagePercent": 7.59450786803196, - "memoryEfficiency": 92.40549213196805, - "cpuCount": 16, - "cpuLoad": 0.134375, - "platform": "linux", - "uptime": 1222.74 - }, - { - "timestamp": 1760279639864, - "memoryTotal": 67427549184, - "memoryUsed": 5257187328, - "memoryFree": 62170361856, - "memoryUsagePercent": 7.796794324607436, - "memoryEfficiency": 92.20320567539257, - "cpuCount": 16, - "cpuLoad": 0.145, - "platform": "linux", - "uptime": 1252.77 - }, - { - "timestamp": 1760279669894, - "memoryTotal": 67427549184, - "memoryUsed": 5173264384, - "memoryFree": 62254284800, - "memoryUsagePercent": 7.672330444464046, - "memoryEfficiency": 92.32766955553595, - "cpuCount": 16, - "cpuLoad": 0.13, - "platform": "linux", - "uptime": 1282.8 - }, - { - "timestamp": 1760279699923, - "memoryTotal": 67427549184, - "memoryUsed": 5074481152, - "memoryFree": 62353068032, - "memoryUsagePercent": 7.525827667490148, - "memoryEfficiency": 92.47417233250985, - "cpuCount": 16, - "cpuLoad": 0.158125, - "platform": "linux", - "uptime": 1312.83 - }, - { - "timestamp": 1760279729928, - "memoryTotal": 67427549184, - "memoryUsed": 5016244224, - "memoryFree": 62411304960, - "memoryUsagePercent": 7.439458032667623, - "memoryEfficiency": 92.56054196733237, - "cpuCount": 16, - "cpuLoad": 0.143125, - "platform": "linux", - "uptime": 1342.84 - }, - { - "timestamp": 1760279759958, - "memoryTotal": 67427549184, - "memoryUsed": 5064323072, - "memoryFree": 62363226112, - "memoryUsagePercent": 7.510762489943386, - "memoryEfficiency": 92.48923751005661, - "cpuCount": 16, - "cpuLoad": 0.13875, - "platform": "linux", - "uptime": 1372.87 - }, - { - "timestamp": 1760279789987, - "memoryTotal": 67427549184, - "memoryUsed": 4971479040, - "memoryFree": 62456070144, - "memoryUsagePercent": 7.373067982099653, - "memoryEfficiency": 92.62693201790034, - "cpuCount": 16, - "cpuLoad": 0.116875, - "platform": "linux", - "uptime": 1402.9 - }, - { - "timestamp": 1760279820000, - "memoryTotal": 67427549184, - "memoryUsed": 4997488640, - "memoryFree": 62430060544, - "memoryUsagePercent": 7.411642126221403, - "memoryEfficiency": 92.58835787377859, - "cpuCount": 16, - "cpuLoad": 0.100625, - "platform": "linux", - "uptime": 1432.91 - }, - { - "timestamp": 1760279850031, - "memoryTotal": 67427549184, - "memoryUsed": 5150208000, - "memoryFree": 62277341184, - "memoryUsagePercent": 7.638136136233914, - "memoryEfficiency": 92.36186386376609, - "cpuCount": 16, - "cpuLoad": 0.111875, - "platform": "linux", - "uptime": 1462.94 - }, - { - "timestamp": 1760279880060, - "memoryTotal": 67427549184, - "memoryUsed": 5182390272, - "memoryFree": 62245158912, - "memoryUsagePercent": 7.6858648055826695, - "memoryEfficiency": 92.31413519441733, - "cpuCount": 16, - "cpuLoad": 0.140625, - "platform": "linux", - "uptime": 1492.97 - }, - { - "timestamp": 1760279910071, - "memoryTotal": 67427549184, - "memoryUsed": 4945100800, - "memoryFree": 62482448384, - "memoryUsagePercent": 7.333947117824996, - "memoryEfficiency": 92.66605288217501, - "cpuCount": 16, - "cpuLoad": 0.1275, - "platform": "linux", - "uptime": 1522.98 - }, - { - "timestamp": 1760279940101, - "memoryTotal": 67427549184, - "memoryUsed": 4913422336, - "memoryFree": 62514126848, - "memoryUsagePercent": 7.286965632685215, - "memoryEfficiency": 92.71303436731479, - "cpuCount": 16, - "cpuLoad": 0.09375, - "platform": "linux", - "uptime": 1553.01 - }, - { - "timestamp": 1760279970108, - "memoryTotal": 67427549184, - "memoryUsed": 5440241664, - "memoryFree": 61987307520, - "memoryUsagePercent": 8.068277328535803, - "memoryEfficiency": 91.9317226714642, - "cpuCount": 16, - "cpuLoad": 0.081875, - "platform": "linux", - "uptime": 1583.02 - }, - { - "timestamp": 1760280000111, - "memoryTotal": 67427549184, - "memoryUsed": 5419573248, - "memoryFree": 62007975936, - "memoryUsagePercent": 8.037624551962836, - "memoryEfficiency": 91.96237544803716, - "cpuCount": 16, - "cpuLoad": 0.089375, - "platform": "linux", - "uptime": 1613.02 - }, - { - "timestamp": 1760280030142, - "memoryTotal": 67427549184, - "memoryUsed": 5276807168, - "memoryFree": 62150742016, - "memoryUsagePercent": 7.825891986078803, - "memoryEfficiency": 92.1741080139212, - "cpuCount": 16, - "cpuLoad": 0.085625, - "platform": "linux", - "uptime": 1643.05 - }, - { - "timestamp": 1760280060173, - "memoryTotal": 67427549184, - "memoryUsed": 5293907968, - "memoryFree": 62133641216, - "memoryUsagePercent": 7.851253726505308, - "memoryEfficiency": 92.1487462734947, - "cpuCount": 16, - "cpuLoad": 0.064375, - "platform": "linux", - "uptime": 1673.08 - }, - { - "timestamp": 1760280090203, - "memoryTotal": 67427549184, - "memoryUsed": 4916109312, - "memoryFree": 62511439872, - "memoryUsagePercent": 7.2909506151330685, - "memoryEfficiency": 92.70904938486693, - "cpuCount": 16, - "cpuLoad": 0.07875, - "platform": "linux", - "uptime": 1703.11 - }, - { - "timestamp": 1760280120205, - "memoryTotal": 67427549184, - "memoryUsed": 4970278912, - "memoryFree": 62457270272, - "memoryUsagePercent": 7.371288104268523, - "memoryEfficiency": 92.62871189573147, - "cpuCount": 16, - "cpuLoad": 0.06125, - "platform": "linux", - "uptime": 1733.11 - }, - { - "timestamp": 1760280150235, - "memoryTotal": 67427549184, - "memoryUsed": 4991467520, - "memoryFree": 62436081664, - "memoryUsagePercent": 7.402712363723928, - "memoryEfficiency": 92.59728763627608, - "cpuCount": 16, - "cpuLoad": 0.05, - "platform": "linux", - "uptime": 1763.14 - }, - { - "timestamp": 1760280180265, - "memoryTotal": 67427549184, - "memoryUsed": 4937732096, - "memoryFree": 62489817088, - "memoryUsagePercent": 7.3230187894352285, - "memoryEfficiency": 92.67698121056478, - "cpuCount": 16, - "cpuLoad": 0.0425, - "platform": "linux", - "uptime": 1793.17 - }, - { - "timestamp": 1760280210269, - "memoryTotal": 67427549184, - "memoryUsed": 5100552192, - "memoryFree": 62326996992, - "memoryUsagePercent": 7.564492931637383, - "memoryEfficiency": 92.43550706836261, - "cpuCount": 16, - "cpuLoad": 0.051875, - "platform": "linux", - "uptime": 1823.18 - }, - { - "timestamp": 1760280240299, - "memoryTotal": 67427549184, - "memoryUsed": 5106774016, - "memoryFree": 62320775168, - "memoryUsagePercent": 7.5737203528847745, - "memoryEfficiency": 92.42627964711522, - "cpuCount": 16, - "cpuLoad": 0.063125, - "platform": "linux", - "uptime": 1853.21 - }, - { - "timestamp": 1760280270310, - "memoryTotal": 67427549184, - "memoryUsed": 5187407872, - "memoryFree": 62240141312, - "memoryUsagePercent": 7.693306274330565, - "memoryEfficiency": 92.30669372566943, - "cpuCount": 16, - "cpuLoad": 0.128125, - "platform": "linux", - "uptime": 1883.22 - }, - { - "timestamp": 1760280300340, - "memoryTotal": 67427549184, - "memoryUsed": 5208072192, - "memoryFree": 62219476992, - "memoryUsagePercent": 7.723952976235168, - "memoryEfficiency": 92.27604702376483, - "cpuCount": 16, - "cpuLoad": 0.11875, - "platform": "linux", - "uptime": 1913.25 - }, - { - "timestamp": 1760280330362, - "memoryTotal": 67427549184, - "memoryUsed": 5190340608, - "memoryFree": 62237208576, - "memoryUsagePercent": 7.697655736880356, - "memoryEfficiency": 92.30234426311965, - "cpuCount": 16, - "cpuLoad": 0.1525, - "platform": "linux", - "uptime": 1943.27 - }, - { - "timestamp": 1760280360392, - "memoryTotal": 67427549184, - "memoryUsed": 5076365312, - "memoryFree": 62351183872, - "memoryUsagePercent": 7.528622014938338, - "memoryEfficiency": 92.47137798506166, - "cpuCount": 16, - "cpuLoad": 0.099375, - "platform": "linux", - "uptime": 1973.3 - }, - { - "timestamp": 1760280390422, - "memoryTotal": 67427549184, - "memoryUsed": 5145829376, - "memoryFree": 62281719808, - "memoryUsagePercent": 7.631642315751057, - "memoryEfficiency": 92.36835768424895, - "cpuCount": 16, - "cpuLoad": 0.08125, - "platform": "linux", - "uptime": 2003.33 - }, - { - "timestamp": 1760280420452, - "memoryTotal": 67427549184, - "memoryUsed": 5088944128, - "memoryFree": 62338605056, - "memoryUsagePercent": 7.5472773214891875, - "memoryEfficiency": 92.45272267851081, - "cpuCount": 16, - "cpuLoad": 0.085625, - "platform": "linux", - "uptime": 2033.36 - }, - { - "timestamp": 1760280450482, - "memoryTotal": 67427549184, - "memoryUsed": 5101314048, - "memoryFree": 62326235136, - "memoryUsagePercent": 7.565622819953391, - "memoryEfficiency": 92.43437718004661, - "cpuCount": 16, - "cpuLoad": 0.0775, - "platform": "linux", - "uptime": 2063.39 - }, - { - "timestamp": 1760280480513, - "memoryTotal": 67427549184, - "memoryUsed": 5149802496, - "memoryFree": 62277746688, - "memoryUsagePercent": 7.637534744065717, - "memoryEfficiency": 92.36246525593428, - "cpuCount": 16, - "cpuLoad": 0.066875, - "platform": "linux", - "uptime": 2093.42 - }, - { - "timestamp": 1760280510543, - "memoryTotal": 67427549184, - "memoryUsed": 5127688192, - "memoryFree": 62299860992, - "memoryUsagePercent": 7.604737609559681, - "memoryEfficiency": 92.39526239044032, - "cpuCount": 16, - "cpuLoad": 0.068125, - "platform": "linux", - "uptime": 2123.45 - }, - { - "timestamp": 1760280540548, - "memoryTotal": 67427549184, - "memoryUsed": 5207871488, - "memoryFree": 62219677696, - "memoryUsagePercent": 7.723655317485252, - "memoryEfficiency": 92.27634468251475, - "cpuCount": 16, - "cpuLoad": 0.06875, - "platform": "linux", - "uptime": 2153.46 - }, - { - "timestamp": 1760280570579, - "memoryTotal": 67427549184, - "memoryUsed": 5147594752, - "memoryFree": 62279954432, - "memoryUsagePercent": 7.634260497816643, - "memoryEfficiency": 92.36573950218336, - "cpuCount": 16, - "cpuLoad": 0.32, - "platform": "linux", - "uptime": 2183.49 - }, - { - "timestamp": 1760280600590, - "memoryTotal": 67427549184, - "memoryUsed": 5115703296, - "memoryFree": 62311845888, - "memoryUsagePercent": 7.586963129921847, - "memoryEfficiency": 92.41303687007816, - "cpuCount": 16, - "cpuLoad": 0.221875, - "platform": "linux", - "uptime": 2213.5 - }, - { - "timestamp": 1760280630620, - "memoryTotal": 67427549184, - "memoryUsed": 5070041088, - "memoryFree": 62357508096, - "memoryUsagePercent": 7.5192427269818065, - "memoryEfficiency": 92.4807572730182, - "cpuCount": 16, - "cpuLoad": 0.1375, - "platform": "linux", - "uptime": 2243.53 - }, - { - "timestamp": 1760280660650, - "memoryTotal": 67427549184, - "memoryUsed": 5245149184, - "memoryFree": 62182400000, - "memoryUsagePercent": 7.77894087428085, - "memoryEfficiency": 92.22105912571915, - "cpuCount": 16, - "cpuLoad": 0.10375, - "platform": "linux", - "uptime": 2273.56 - }, - { - "timestamp": 1760280690680, - "memoryTotal": 67427549184, - "memoryUsed": 5173108736, - "memoryFree": 62254440448, - "memoryUsagePercent": 7.672099607066151, - "memoryEfficiency": 92.32790039293386, - "cpuCount": 16, - "cpuLoad": 0.07, - "platform": "linux", - "uptime": 2303.59 - }, - { - "timestamp": 1760280720710, - "memoryTotal": 67427549184, - "memoryUsed": 5147262976, - "memoryFree": 62280286208, - "memoryUsagePercent": 7.633768449679026, - "memoryEfficiency": 92.36623155032098, - "cpuCount": 16, - "cpuLoad": 0.0425, - "platform": "linux", - "uptime": 2333.62 - }, - { - "timestamp": 1760280750724, - "memoryTotal": 67427549184, - "memoryUsed": 5323845632, - "memoryFree": 62103703552, - "memoryUsagePercent": 7.895653477589698, - "memoryEfficiency": 92.1043465224103, - "cpuCount": 16, - "cpuLoad": 0.059375, - "platform": "linux", - "uptime": 2363.63 - }, - { - "timestamp": 1760280780727, - "memoryTotal": 67427549184, - "memoryUsed": 5303222272, - "memoryFree": 62124326912, - "memoryUsagePercent": 7.865067522368752, - "memoryEfficiency": 92.13493247763125, - "cpuCount": 16, - "cpuLoad": 0.081875, - "platform": "linux", - "uptime": 2393.64 - }, - { - "timestamp": 1760280810733, - "memoryTotal": 67427549184, - "memoryUsed": 5347504128, - "memoryFree": 62080045056, - "memoryUsagePercent": 7.930740762069577, - "memoryEfficiency": 92.06925923793042, - "cpuCount": 16, - "cpuLoad": 0.079375, - "platform": "linux", - "uptime": 2423.64 - }, - { - "timestamp": 1760280840764, - "memoryTotal": 67427549184, - "memoryUsed": 5261901824, - "memoryFree": 62165647360, - "memoryUsagePercent": 7.803786267896276, - "memoryEfficiency": 92.19621373210373, - "cpuCount": 16, - "cpuLoad": 0.0975, - "platform": "linux", - "uptime": 2453.67 - }, - { - "timestamp": 1760280870770, - "memoryTotal": 67427549184, - "memoryUsed": 5314379776, - "memoryFree": 62113169408, - "memoryUsagePercent": 7.881614918996727, - "memoryEfficiency": 92.11838508100327, - "cpuCount": 16, - "cpuLoad": 0.136875, - "platform": "linux", - "uptime": 2483.68 - }, - { - "timestamp": 1760280900799, - "memoryTotal": 67427549184, - "memoryUsed": 5384056832, - "memoryFree": 62043492352, - "memoryUsagePercent": 7.984951102564458, - "memoryEfficiency": 92.01504889743555, - "cpuCount": 16, - "cpuLoad": 0.1275, - "platform": "linux", - "uptime": 2513.71 - }, - { - "timestamp": 1760280930830, - "memoryTotal": 67427549184, - "memoryUsed": 5318234112, - "memoryFree": 62109315072, - "memoryUsagePercent": 7.887331181928785, - "memoryEfficiency": 92.11266881807121, - "cpuCount": 16, - "cpuLoad": 0.0975, - "platform": "linux", - "uptime": 2543.74 - }, - { - "timestamp": 1760280960854, - "memoryTotal": 67427549184, - "memoryUsed": 5249892352, - "memoryFree": 62177656832, - "memoryUsagePercent": 7.78597534024825, - "memoryEfficiency": 92.21402465975174, - "cpuCount": 16, - "cpuLoad": 0.070625, - "platform": "linux", - "uptime": 2573.76 - }, - { - "timestamp": 1760280990859, - "memoryTotal": 67427549184, - "memoryUsed": 5261598720, - "memoryFree": 62165950464, - "memoryUsagePercent": 7.80333674243722, - "memoryEfficiency": 92.19666325756278, - "cpuCount": 16, - "cpuLoad": 0.0775, - "platform": "linux", - "uptime": 2603.77 - }, - { - "timestamp": 1760281020890, - "memoryTotal": 67427549184, - "memoryUsed": 5376999424, - "memoryFree": 62050549760, - "memoryUsagePercent": 7.974484448970477, - "memoryEfficiency": 92.02551555102953, - "cpuCount": 16, - "cpuLoad": 0.07, - "platform": "linux", - "uptime": 2633.8 - }, - { - "timestamp": 1760281050898, - "memoryTotal": 67427549184, - "memoryUsed": 5378035712, - "memoryFree": 62049513472, - "memoryUsagePercent": 7.976021340066981, - "memoryEfficiency": 92.02397865993302, - "cpuCount": 16, - "cpuLoad": 0.104375, - "platform": "linux", - "uptime": 2663.81 - }, - { - "timestamp": 1760281080928, - "memoryTotal": 67427549184, - "memoryUsed": 5279195136, - "memoryFree": 62148354048, - "memoryUsagePercent": 7.829433517735966, - "memoryEfficiency": 92.17056648226404, - "cpuCount": 16, - "cpuLoad": 0.104375, - "platform": "linux", - "uptime": 2693.84 - }, - { - "timestamp": 1760281110959, - "memoryTotal": 67427549184, - "memoryUsed": 5196570624, - "memoryFree": 62230978560, - "memoryUsagePercent": 7.70689530746448, - "memoryEfficiency": 92.29310469253552, - "cpuCount": 16, - "cpuLoad": 0.063125, - "platform": "linux", - "uptime": 2723.87 - }, - { - "timestamp": 1760281140989, - "memoryTotal": 67427549184, - "memoryUsed": 5128359936, - "memoryFree": 62299189248, - "memoryUsagePercent": 7.605733855171645, - "memoryEfficiency": 92.39426614482835, - "cpuCount": 16, - "cpuLoad": 0.06125, - "platform": "linux", - "uptime": 2753.9 - }, - { - "timestamp": 1760281171019, - "memoryTotal": 67427549184, - "memoryUsed": 5103312896, - "memoryFree": 62324236288, - "memoryUsagePercent": 7.568587258115818, - "memoryEfficiency": 92.43141274188419, - "cpuCount": 16, - "cpuLoad": 0.04125, - "platform": "linux", - "uptime": 2783.93 - }, - { - "timestamp": 1760281201048, - "memoryTotal": 67427549184, - "memoryUsed": 5265936384, - "memoryFree": 62161612800, - "memoryUsagePercent": 7.809769816236423, - "memoryEfficiency": 92.19023018376357, - "cpuCount": 16, - "cpuLoad": 0.049375, - "platform": "linux", - "uptime": 2813.96 - }, - { - "timestamp": 1760281231079, - "memoryTotal": 67427549184, - "memoryUsed": 5469122560, - "memoryFree": 61958426624, - "memoryUsagePercent": 8.111109815181859, - "memoryEfficiency": 91.88889018481814, - "cpuCount": 16, - "cpuLoad": 0.05125, - "platform": "linux", - "uptime": 2843.99 - }, - { - "timestamp": 1760281261098, - "memoryTotal": 67427549184, - "memoryUsed": 5349163008, - "memoryFree": 62078386176, - "memoryUsagePercent": 7.933201002757656, - "memoryEfficiency": 92.06679899724234, - "cpuCount": 16, - "cpuLoad": 0.074375, - "platform": "linux", - "uptime": 2874.01 - }, - { - "timestamp": 1760281291098, - "memoryTotal": 67427549184, - "memoryUsed": 5322502144, - "memoryFree": 62105047040, - "memoryUsagePercent": 7.893660986365772, - "memoryEfficiency": 92.10633901363423, - "cpuCount": 16, - "cpuLoad": 0.08, - "platform": "linux", - "uptime": 2904.01 - }, - { - "timestamp": 1760281321128, - "memoryTotal": 67427549184, - "memoryUsed": 5446496256, - "memoryFree": 61981052928, - "memoryUsagePercent": 8.07755334713012, - "memoryEfficiency": 91.92244665286988, - "cpuCount": 16, - "cpuLoad": 0.086875, - "platform": "linux", - "uptime": 2934.04 - }, - { - "timestamp": 1760281351158, - "memoryTotal": 67427549184, - "memoryUsed": 5253001216, - "memoryFree": 62174547968, - "memoryUsagePercent": 7.790586013537763, - "memoryEfficiency": 92.20941398646224, - "cpuCount": 16, - "cpuLoad": 0.08625, - "platform": "linux", - "uptime": 2964.07 - }, - { - "timestamp": 1760281381187, - "memoryTotal": 67427549184, - "memoryUsed": 5490483200, - "memoryFree": 61937065984, - "memoryUsagePercent": 8.14278921070862, - "memoryEfficiency": 91.85721078929137, - "cpuCount": 16, - "cpuLoad": 0.078125, - "platform": "linux", - "uptime": 2994.1 - }, - { - "timestamp": 1760281411218, - "memoryTotal": 67427549184, - "memoryUsed": 5271769088, - "memoryFree": 62155780096, - "memoryUsagePercent": 7.818420143989078, - "memoryEfficiency": 92.18157985601093, - "cpuCount": 16, - "cpuLoad": 0.075, - "platform": "linux", - "uptime": 3024.13 - }, - { - "timestamp": 1760281441249, - "memoryTotal": 67427549184, - "memoryUsed": 5309157376, - "memoryFree": 62118391808, - "memoryUsagePercent": 7.873869716830549, - "memoryEfficiency": 92.12613028316945, - "cpuCount": 16, - "cpuLoad": 0.123125, - "platform": "linux", - "uptime": 3054.16 - }, - { - "timestamp": 1760281471279, - "memoryTotal": 67427549184, - "memoryUsed": 5527973888, - "memoryFree": 61899575296, - "memoryUsagePercent": 8.198390650259231, - "memoryEfficiency": 91.80160934974077, - "cpuCount": 16, - "cpuLoad": 0.0825, - "platform": "linux", - "uptime": 3084.19 - }, - { - "timestamp": 1760281501292, - "memoryTotal": 67427549184, - "memoryUsed": 5505052672, - "memoryFree": 61922496512, - "memoryUsagePercent": 8.164396806085165, - "memoryEfficiency": 91.83560319391484, - "cpuCount": 16, - "cpuLoad": 0.091875, - "platform": "linux", - "uptime": 3114.2 - }, - { - "timestamp": 1760281531322, - "memoryTotal": 67427549184, - "memoryUsed": 5559791616, - "memoryFree": 61867757568, - "memoryUsagePercent": 8.245578674123443, - "memoryEfficiency": 91.75442132587656, - "cpuCount": 16, - "cpuLoad": 0.11375, - "platform": "linux", - "uptime": 3144.23 - }, - { - "timestamp": 1760281561352, - "memoryTotal": 67427549184, - "memoryUsed": 5244440576, - "memoryFree": 62183108608, - "memoryUsagePercent": 7.777889956653597, - "memoryEfficiency": 92.2221100433464, - "cpuCount": 16, - "cpuLoad": 0.07625, - "platform": "linux", - "uptime": 3174.26 - }, - { - "timestamp": 1760281591382, - "memoryTotal": 67427549184, - "memoryUsed": 5640794112, - "memoryFree": 61786755072, - "memoryUsagePercent": 8.365711315722141, - "memoryEfficiency": 91.63428868427786, - "cpuCount": 16, - "cpuLoad": 0.085625, - "platform": "linux", - "uptime": 3204.29 - }, - { - "timestamp": 1760281621412, - "memoryTotal": 67427549184, - "memoryUsed": 5572337664, - "memoryFree": 61855211520, - "memoryUsagePercent": 8.264185383327368, - "memoryEfficiency": 91.73581461667263, - "cpuCount": 16, - "cpuLoad": 0.076875, - "platform": "linux", - "uptime": 3234.32 - }, - { - "timestamp": 1760281651441, - "memoryTotal": 67427549184, - "memoryUsed": 5493473280, - "memoryFree": 61934075904, - "memoryUsagePercent": 8.14722371861553, - "memoryEfficiency": 91.85277628138446, - "cpuCount": 16, - "cpuLoad": 0.061875, - "platform": "linux", - "uptime": 3264.35 - }, - { - "timestamp": 1760281681456, - "memoryTotal": 67427549184, - "memoryUsed": 5457166336, - "memoryFree": 61970382848, - "memoryUsagePercent": 8.093377858222587, - "memoryEfficiency": 91.90662214177742, - "cpuCount": 16, - "cpuLoad": 0.064375, - "platform": "linux", - "uptime": 3294.37 - }, - { - "timestamp": 1760281711487, - "memoryTotal": 67427549184, - "memoryUsed": 5511565312, - "memoryFree": 61915983872, - "memoryUsagePercent": 8.174055528786518, - "memoryEfficiency": 91.82594447121349, - "cpuCount": 16, - "cpuLoad": 0.07625, - "platform": "linux", - "uptime": 3324.4 - }, - { - "timestamp": 1760281741517, - "memoryTotal": 67427549184, - "memoryUsed": 5440380928, - "memoryFree": 61987168256, - "memoryUsagePercent": 8.068483867260234, - "memoryEfficiency": 91.93151613273977, - "cpuCount": 16, - "cpuLoad": 0.109375, - "platform": "linux", - "uptime": 3354.43 - }, - { - "timestamp": 1760281771546, - "memoryTotal": 67427549184, - "memoryUsed": 5395787776, - "memoryFree": 62031761408, - "memoryUsagePercent": 8.002348952763622, - "memoryEfficiency": 91.99765104723637, - "cpuCount": 16, - "cpuLoad": 0.074375, - "platform": "linux", - "uptime": 3384.45 - }, - { - "timestamp": 1760281801577, - "memoryTotal": 67427549184, - "memoryUsed": 5408186368, - "memoryFree": 62019362816, - "memoryUsagePercent": 8.020736973906384, - "memoryEfficiency": 91.97926302609362, - "cpuCount": 16, - "cpuLoad": 0.069375, - "platform": "linux", - "uptime": 3414.49 - }, - { - "timestamp": 1760281831607, - "memoryTotal": 67427549184, - "memoryUsed": 5540081664, - "memoryFree": 61887467520, - "memoryUsagePercent": 8.216347369948032, - "memoryEfficiency": 91.78365263005196, - "cpuCount": 16, - "cpuLoad": 0.1, - "platform": "linux", - "uptime": 3444.52 - }, - { - "timestamp": 1760281861637, - "memoryTotal": 67427549184, - "memoryUsed": 5417463808, - "memoryFree": 62010085376, - "memoryUsagePercent": 8.034496097754536, - "memoryEfficiency": 91.96550390224546, - "cpuCount": 16, - "cpuLoad": 0.10875, - "platform": "linux", - "uptime": 3474.55 - }, - { - "timestamp": 1760281891667, - "memoryTotal": 67427549184, - "memoryUsed": 5391253504, - "memoryFree": 62036295680, - "memoryUsagePercent": 7.9956242948828695, - "memoryEfficiency": 92.00437570511713, - "cpuCount": 16, - "cpuLoad": 0.14875, - "platform": "linux", - "uptime": 3504.58 - }, - { - "timestamp": 1760281921697, - "memoryTotal": 67427549184, - "memoryUsed": 5436141568, - "memoryFree": 61991407616, - "memoryUsagePercent": 8.062196585501807, - "memoryEfficiency": 91.93780341449819, - "cpuCount": 16, - "cpuLoad": 0.138125, - "platform": "linux", - "uptime": 3534.61 - }, - { - "timestamp": 1760281951726, - "memoryTotal": 67427549184, - "memoryUsed": 5732442112, - "memoryFree": 61695107072, - "memoryUsagePercent": 8.501632020403111, - "memoryEfficiency": 91.49836797959689, - "cpuCount": 16, - "cpuLoad": 0.116875, - "platform": "linux", - "uptime": 3564.64 - }, - { - "timestamp": 1760281981757, - "memoryTotal": 67427549184, - "memoryUsed": 6168391680, - "memoryFree": 61259157504, - "memoryUsagePercent": 9.148177198562198, - "memoryEfficiency": 90.8518228014378, - "cpuCount": 16, - "cpuLoad": 0.089375, - "platform": "linux", - "uptime": 3594.67 - }, - { - "timestamp": 1760282011788, - "memoryTotal": 67427549184, - "memoryUsed": 5709090816, - "memoryFree": 61718458368, - "memoryUsagePercent": 8.467000336050653, - "memoryEfficiency": 91.53299966394934, - "cpuCount": 16, - "cpuLoad": 0.070625, - "platform": "linux", - "uptime": 3624.7 - }, - { - "timestamp": 1760282041818, - "memoryTotal": 67427549184, - "memoryUsed": 5624967168, - "memoryFree": 61802582016, - "memoryUsagePercent": 8.342238797157346, - "memoryEfficiency": 91.65776120284265, - "cpuCount": 16, - "cpuLoad": 0.099375, - "platform": "linux", - "uptime": 3654.73 - }, - { - "timestamp": 1760282071844, - "memoryTotal": 67427549184, - "memoryUsed": 5685977088, - "memoryFree": 61741572096, - "memoryUsagePercent": 8.432720982463405, - "memoryEfficiency": 91.56727901753659, - "cpuCount": 16, - "cpuLoad": 0.10625, - "platform": "linux", - "uptime": 3684.75 - }, - { - "timestamp": 1760282101875, - "memoryTotal": 67427549184, - "memoryUsed": 5530820608, - "memoryFree": 61896728576, - "memoryUsagePercent": 8.202612544773343, - "memoryEfficiency": 91.79738745522666, - "cpuCount": 16, - "cpuLoad": 0.099375, - "platform": "linux", - "uptime": 3714.78 - }, - { - "timestamp": 1760282131877, - "memoryTotal": 67427549184, - "memoryUsed": 5543206912, - "memoryFree": 61884342272, - "memoryUsagePercent": 8.220982341911007, - "memoryEfficiency": 91.77901765808899, - "cpuCount": 16, - "cpuLoad": 0.09375, - "platform": "linux", - "uptime": 3744.79 - }, - { - "timestamp": 1760282161907, - "memoryTotal": 67427549184, - "memoryUsed": 5615190016, - "memoryFree": 61812359168, - "memoryUsagePercent": 8.32773856376859, - "memoryEfficiency": 91.67226143623141, - "cpuCount": 16, - "cpuLoad": 0.1175, - "platform": "linux", - "uptime": 3774.82 - }, - { - "timestamp": 1760282191937, - "memoryTotal": 67427549184, - "memoryUsed": 5628416000, - "memoryFree": 61799133184, - "memoryUsagePercent": 8.347353667921208, - "memoryEfficiency": 91.65264633207879, - "cpuCount": 16, - "cpuLoad": 0.103125, - "platform": "linux", - "uptime": 3804.85 - }, - { - "timestamp": 1760282221966, - "memoryTotal": 67427549184, - "memoryUsed": 5590601728, - "memoryFree": 61836947456, - "memoryUsagePercent": 8.291272329569711, - "memoryEfficiency": 91.70872767043029, - "cpuCount": 16, - "cpuLoad": 0.08375, - "platform": "linux", - "uptime": 3834.87 - }, - { - "timestamp": 1760282251978, - "memoryTotal": 67427549184, - "memoryUsed": 5778956288, - "memoryFree": 61648592896, - "memoryUsagePercent": 8.570615954363204, - "memoryEfficiency": 91.4293840456368, - "cpuCount": 16, - "cpuLoad": 0.096875, - "platform": "linux", - "uptime": 3864.89 - }, - { - "timestamp": 1760282281994, - "memoryTotal": 67427549184, - "memoryUsed": 5679026176, - "memoryFree": 61748523008, - "memoryUsagePercent": 8.42241227024693, - "memoryEfficiency": 91.57758772975308, - "cpuCount": 16, - "cpuLoad": 0.134375, - "platform": "linux", - "uptime": 3894.9 - }, - { - "timestamp": 1760282312018, - "memoryTotal": 67427549184, - "memoryUsed": 5575233536, - "memoryFree": 61852315648, - "memoryUsagePercent": 8.268480173861867, - "memoryEfficiency": 91.73151982613814, - "cpuCount": 16, - "cpuLoad": 0.1275, - "platform": "linux", - "uptime": 3924.93 - }, - { - "timestamp": 1760282342026, - "memoryTotal": 67427549184, - "memoryUsed": 5608615936, - "memoryFree": 61818933248, - "memoryUsagePercent": 8.317988721041752, - "memoryEfficiency": 91.68201127895824, - "cpuCount": 16, - "cpuLoad": 0.10875, - "platform": "linux", - "uptime": 3954.93 - }, - { - "timestamp": 1760282372056, - "memoryTotal": 67427549184, - "memoryUsed": 5582426112, - "memoryFree": 61845123072, - "memoryUsagePercent": 8.279147291511913, - "memoryEfficiency": 91.72085270848808, - "cpuCount": 16, - "cpuLoad": 0.11375, - "platform": "linux", - "uptime": 3984.96 - }, - { - "timestamp": 1760282402086, - "memoryTotal": 67427549184, - "memoryUsed": 5632413696, - "memoryFree": 61795135488, - "memoryUsagePercent": 8.353282544246062, - "memoryEfficiency": 91.64671745575394, - "cpuCount": 16, - "cpuLoad": 0.096875, - "platform": "linux", - "uptime": 4014.99 - }, - { - "timestamp": 1760282432116, - "memoryTotal": 67427549184, - "memoryUsed": 5307600896, - "memoryFree": 62119948288, - "memoryUsagePercent": 7.87156134285161, - "memoryEfficiency": 92.1284386571484, - "cpuCount": 16, - "cpuLoad": 0.07125, - "platform": "linux", - "uptime": 4045.02 - }, - { - "timestamp": 1760282462146, - "memoryTotal": 67427549184, - "memoryUsed": 5283463168, - "memoryFree": 62144086016, - "memoryUsagePercent": 7.835763322172952, - "memoryEfficiency": 92.16423667782705, - "cpuCount": 16, - "cpuLoad": 0.043125, - "platform": "linux", - "uptime": 4075.05 - }, - { - "timestamp": 1760282492176, - "memoryTotal": 67427549184, - "memoryUsed": 5291962368, - "memoryFree": 62135586816, - "memoryUsagePercent": 7.848368259031635, - "memoryEfficiency": 92.15163174096837, - "cpuCount": 16, - "cpuLoad": 0.02625, - "platform": "linux", - "uptime": 4105.08 - }, - { - "timestamp": 1760282522206, - "memoryTotal": 67427549184, - "memoryUsed": 5290364928, - "memoryFree": 62137184256, - "memoryUsagePercent": 7.845999138369039, - "memoryEfficiency": 92.15400086163096, - "cpuCount": 16, - "cpuLoad": 0.015625, - "platform": "linux", - "uptime": 4135.11 - }, - { - "timestamp": 1760282552236, - "memoryTotal": 67427549184, - "memoryUsed": 5269143552, - "memoryFree": 62158405632, - "memoryUsagePercent": 7.814526281566711, - "memoryEfficiency": 92.18547371843329, - "cpuCount": 16, - "cpuLoad": 0.009375, - "platform": "linux", - "uptime": 4165.14 - }, - { - "timestamp": 1760282582266, - "memoryTotal": 67427549184, - "memoryUsed": 5252571136, - "memoryFree": 62174978048, - "memoryUsagePercent": 7.789948173359372, - "memoryEfficiency": 92.21005182664062, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 4195.17 - }, - { - "timestamp": 1760282612296, - "memoryTotal": 67427549184, - "memoryUsed": 5294891008, - "memoryFree": 62132658176, - "memoryUsagePercent": 7.85271164691306, - "memoryEfficiency": 92.14728835308694, - "cpuCount": 16, - "cpuLoad": 0.006875, - "platform": "linux", - "uptime": 4225.2 - }, - { - "timestamp": 1760282642326, - "memoryTotal": 67427549184, - "memoryUsed": 5260095488, - "memoryFree": 62167453696, - "memoryUsagePercent": 7.801107339147034, - "memoryEfficiency": 92.19889266085296, - "cpuCount": 16, - "cpuLoad": 0.00375, - "platform": "linux", - "uptime": 4255.23 - }, - { - "timestamp": 1760282672357, - "memoryTotal": 67427549184, - "memoryUsed": 5295620096, - "memoryFree": 62131929088, - "memoryUsagePercent": 7.853792937882142, - "memoryEfficiency": 92.14620706211785, - "cpuCount": 16, - "cpuLoad": 0.0025, - "platform": "linux", - "uptime": 4285.27 - }, - { - "timestamp": 1760282702377, - "memoryTotal": 67427549184, - "memoryUsed": 5258219520, - "memoryFree": 62169329664, - "memoryUsagePercent": 7.798325141035575, - "memoryEfficiency": 92.20167485896442, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 4315.29 - }, - { - "timestamp": 1760282732381, - "memoryTotal": 67427549184, - "memoryUsed": 5252837376, - "memoryFree": 62174711808, - "memoryUsagePercent": 7.7903430268031375, - "memoryEfficiency": 92.20965697319686, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 4345.29 - }, - { - "timestamp": 1760282762407, - "memoryTotal": 67427549184, - "memoryUsed": 5251399680, - "memoryFree": 62176149504, - "memoryUsagePercent": 7.788210818206802, - "memoryEfficiency": 92.2117891817932, - "cpuCount": 16, - "cpuLoad": 0.001875, - "platform": "linux", - "uptime": 4375.32 - }, - { - "timestamp": 1760282792421, - "memoryTotal": 67427549184, - "memoryUsed": 5253402624, - "memoryFree": 62174146560, - "memoryUsagePercent": 7.791181331037595, - "memoryEfficiency": 92.20881866896241, - "cpuCount": 16, - "cpuLoad": 0.00125, - "platform": "linux", - "uptime": 4405.33 - }, - { - "timestamp": 1760282822443, - "memoryTotal": 67427549184, - "memoryUsed": 5242789888, - "memoryFree": 62184759296, - "memoryUsagePercent": 7.7754418653022475, - "memoryEfficiency": 92.22455813469776, - "cpuCount": 16, - "cpuLoad": 0.000625, - "platform": "linux", - "uptime": 4435.35 - }, - { - "timestamp": 1760282852474, - "memoryTotal": 67427549184, - "memoryUsed": 5266890752, - "memoryFree": 62160658432, - "memoryUsagePercent": 7.811185213965614, - "memoryEfficiency": 92.18881478603438, - "cpuCount": 16, - "cpuLoad": 0.005, - "platform": "linux", - "uptime": 4465.38 - }, - { - "timestamp": 1760282882480, - "memoryTotal": 67427549184, - "memoryUsed": 5297459200, - "memoryFree": 62130089984, - "memoryUsagePercent": 7.85652046397831, - "memoryEfficiency": 92.14347953602169, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 4495.39 - }, - { - "timestamp": 1760282912510, - "memoryTotal": 67427549184, - "memoryUsed": 5317173248, - "memoryFree": 62110375936, - "memoryUsagePercent": 7.885757842822088, - "memoryEfficiency": 92.11424215717791, - "cpuCount": 16, - "cpuLoad": 0.011875, - "platform": "linux", - "uptime": 4525.42 - }, - { - "timestamp": 1760282942541, - "memoryTotal": 67427549184, - "memoryUsed": 5282996224, - "memoryFree": 62144552960, - "memoryUsagePercent": 7.83507080997927, - "memoryEfficiency": 92.16492919002073, - "cpuCount": 16, - "cpuLoad": 0.006875, - "platform": "linux", - "uptime": 4555.45 - }, - { - "timestamp": 1760282972557, - "memoryTotal": 67427549184, - "memoryUsed": 5269504000, - "memoryFree": 62158045184, - "memoryUsagePercent": 7.815060852382885, - "memoryEfficiency": 92.18493914761711, - "cpuCount": 16, - "cpuLoad": 0.004375, - "platform": "linux", - "uptime": 4585.47 - }, - { - "timestamp": 1760283002587, - "memoryTotal": 67427549184, - "memoryUsed": 5284765696, - "memoryFree": 62142783488, - "memoryUsagePercent": 7.837695066713223, - "memoryEfficiency": 92.16230493328678, - "cpuCount": 16, - "cpuLoad": 0.0025, - "platform": "linux", - "uptime": 4615.5 - }, - { - "timestamp": 1760283032605, - "memoryTotal": 67427549184, - "memoryUsed": 5253627904, - "memoryFree": 62173921280, - "memoryUsagePercent": 7.791515437797704, - "memoryEfficiency": 92.2084845622023, - "cpuCount": 16, - "cpuLoad": 0.01375, - "platform": "linux", - "uptime": 4645.51 - }, - { - "timestamp": 1760283062636, - "memoryTotal": 67427549184, - "memoryUsed": 5277298688, - "memoryFree": 62150250496, - "memoryUsagePercent": 7.826620946282679, - "memoryEfficiency": 92.17337905371733, - "cpuCount": 16, - "cpuLoad": 0.024375, - "platform": "linux", - "uptime": 4675.54 - }, - { - "timestamp": 1760283092667, - "memoryTotal": 67427549184, - "memoryUsed": 5274574848, - "memoryFree": 62152974336, - "memoryUsagePercent": 7.822581291819536, - "memoryEfficiency": 92.17741870818047, - "cpuCount": 16, - "cpuLoad": 0.014375, - "platform": "linux", - "uptime": 4705.58 - }, - { - "timestamp": 1760283122698, - "memoryTotal": 67427549184, - "memoryUsed": 5259890688, - "memoryFree": 62167658496, - "memoryUsagePercent": 7.800803605728753, - "memoryEfficiency": 92.19919639427124, - "cpuCount": 16, - "cpuLoad": 0.00875, - "platform": "linux", - "uptime": 4735.61 - }, - { - "timestamp": 1760283152729, - "memoryTotal": 67427549184, - "memoryUsed": 5255380992, - "memoryFree": 62172168192, - "memoryUsagePercent": 7.794115395858194, - "memoryEfficiency": 92.2058846041418, - "cpuCount": 16, - "cpuLoad": 0.005, - "platform": "linux", - "uptime": 4765.64 - }, - { - "timestamp": 1760283182760, - "memoryTotal": 67427549184, - "memoryUsed": 5263618048, - "memoryFree": 62163931136, - "memoryUsagePercent": 7.806331553941476, - "memoryEfficiency": 92.19366844605852, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 4795.67 - }, - { - "timestamp": 1760283212791, - "memoryTotal": 67427549184, - "memoryUsed": 5284040704, - "memoryFree": 62143508480, - "memoryUsagePercent": 7.8366198504125055, - "memoryEfficiency": 92.1633801495875, - "cpuCount": 16, - "cpuLoad": 0.001875, - "platform": "linux", - "uptime": 4825.7 - }, - { - "timestamp": 1760283242793, - "memoryTotal": 67427549184, - "memoryUsed": 5252874240, - "memoryFree": 62174674944, - "memoryUsagePercent": 7.7903976988184285, - "memoryEfficiency": 92.20960230118158, - "cpuCount": 16, - "cpuLoad": 0.008125, - "platform": "linux", - "uptime": 4855.7 - }, - { - "timestamp": 1760283272824, - "memoryTotal": 67427549184, - "memoryUsed": 5278842880, - "memoryFree": 62148706304, - "memoryUsagePercent": 7.828911096256522, - "memoryEfficiency": 92.17108890374348, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 4885.73 - }, - { - "timestamp": 1760283302855, - "memoryTotal": 67427549184, - "memoryUsed": 5290606592, - "memoryFree": 62136942592, - "memoryUsagePercent": 7.846357543802611, - "memoryEfficiency": 92.15364245619739, - "cpuCount": 16, - "cpuLoad": 0.009375, - "platform": "linux", - "uptime": 4915.76 - }, - { - "timestamp": 1760283332886, - "memoryTotal": 67427549184, - "memoryUsed": 5268889600, - "memoryFree": 62158659584, - "memoryUsagePercent": 7.814149652128041, - "memoryEfficiency": 92.18585034787196, - "cpuCount": 16, - "cpuLoad": 0.009375, - "platform": "linux", - "uptime": 4945.79 - }, - { - "timestamp": 1760283362916, - "memoryTotal": 67427549184, - "memoryUsed": 5295161344, - "memoryFree": 62132387840, - "memoryUsagePercent": 7.853112575025192, - "memoryEfficiency": 92.1468874249748, - "cpuCount": 16, - "cpuLoad": 0.014375, - "platform": "linux", - "uptime": 4975.82 - }, - { - "timestamp": 1760283392924, - "memoryTotal": 67427549184, - "memoryUsed": 5298769920, - "memoryFree": 62128779264, - "memoryUsagePercent": 7.858464357855312, - "memoryEfficiency": 92.14153564214469, - "cpuCount": 16, - "cpuLoad": 0.016875, - "platform": "linux", - "uptime": 5005.83 - }, - { - "timestamp": 1760283422955, - "memoryTotal": 67427549184, - "memoryUsed": 5314281472, - "memoryFree": 62113267712, - "memoryUsagePercent": 7.881469126955952, - "memoryEfficiency": 92.11853087304405, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 5035.86 - }, - { - "timestamp": 1760283452986, - "memoryTotal": 67427549184, - "memoryUsed": 5301514240, - "memoryFree": 62126034944, - "memoryUsagePercent": 7.862534385660283, - "memoryEfficiency": 92.13746561433972, - "cpuCount": 16, - "cpuLoad": 0.00625, - "platform": "linux", - "uptime": 5065.89 - }, - { - "timestamp": 1760283483017, - "memoryTotal": 67427549184, - "memoryUsed": 5343498240, - "memoryFree": 62084050944, - "memoryUsagePercent": 7.924799736407991, - "memoryEfficiency": 92.07520026359201, - "cpuCount": 16, - "cpuLoad": 0.00375, - "platform": "linux", - "uptime": 5095.93 - }, - { - "timestamp": 1760283513033, - "memoryTotal": 67427549184, - "memoryUsed": 5271171072, - "memoryFree": 62156378112, - "memoryUsagePercent": 7.817533242407697, - "memoryEfficiency": 92.18246675759231, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 5125.94 - }, - { - "timestamp": 1760283543047, - "memoryTotal": 67427549184, - "memoryUsed": 5305020416, - "memoryFree": 62122528768, - "memoryUsagePercent": 7.867734301781263, - "memoryEfficiency": 92.13226569821873, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 5155.96 - }, - { - "timestamp": 1760283573078, - "memoryTotal": 67427549184, - "memoryUsed": 5296312320, - "memoryFree": 62131236864, - "memoryUsagePercent": 7.854819556835933, - "memoryEfficiency": 92.14518044316407, - "cpuCount": 16, - "cpuLoad": 0.00375, - "platform": "linux", - "uptime": 5185.99 - }, - { - "timestamp": 1760283603109, - "memoryTotal": 67427549184, - "memoryUsed": 5288099840, - "memoryFree": 62139449344, - "memoryUsagePercent": 7.842639846762846, - "memoryEfficiency": 92.15736015323715, - "cpuCount": 16, - "cpuLoad": 0.001875, - "platform": "linux", - "uptime": 5216.02 - }, - { - "timestamp": 1760283633139, - "memoryTotal": 67427549184, - "memoryUsed": 5326761984, - "memoryFree": 62100787200, - "memoryUsagePercent": 7.899978641466027, - "memoryEfficiency": 92.10002135853398, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 5246.05 - }, - { - "timestamp": 1760283663170, - "memoryTotal": 67427549184, - "memoryUsed": 5319979008, - "memoryFree": 62107570176, - "memoryUsagePercent": 7.889918990652543, - "memoryEfficiency": 92.11008100934745, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 5276.08 - }, - { - "timestamp": 1760283693201, - "memoryTotal": 67427549184, - "memoryUsed": 5294665728, - "memoryFree": 62132883456, - "memoryUsagePercent": 7.8523775401529505, - "memoryEfficiency": 92.14762245984704, - "cpuCount": 16, - "cpuLoad": 0.005, - "platform": "linux", - "uptime": 5306.11 - }, - { - "timestamp": 1760283723220, - "memoryTotal": 67427549184, - "memoryUsed": 5274025984, - "memoryFree": 62153523200, - "memoryUsagePercent": 7.821767286258541, - "memoryEfficiency": 92.17823271374147, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 5336.13 - }, - { - "timestamp": 1760283753250, - "memoryTotal": 67427549184, - "memoryUsed": 5260087296, - "memoryFree": 62167461888, - "memoryUsagePercent": 7.801095189810303, - "memoryEfficiency": 92.1989048101897, - "cpuCount": 16, - "cpuLoad": 0.005, - "platform": "linux", - "uptime": 5366.16 - }, - { - "timestamp": 1760283783256, - "memoryTotal": 67427549184, - "memoryUsed": 5264695296, - "memoryFree": 62162853888, - "memoryUsagePercent": 7.8079291917216365, - "memoryEfficiency": 92.19207080827836, - "cpuCount": 16, - "cpuLoad": 0.003125, - "platform": "linux", - "uptime": 5396.16 - }, - { - "timestamp": 1760283813285, - "memoryTotal": 67427549184, - "memoryUsed": 5272576000, - "memoryFree": 62154973184, - "memoryUsagePercent": 7.819616853657109, - "memoryEfficiency": 92.18038314634289, - "cpuCount": 16, - "cpuLoad": 0.001875, - "platform": "linux", - "uptime": 5426.19 - }, - { - "timestamp": 1760283843290, - "memoryTotal": 67427549184, - "memoryUsed": 5254553600, - "memoryFree": 62172995584, - "memoryUsagePercent": 7.792888312848337, - "memoryEfficiency": 92.20711168715167, - "cpuCount": 16, - "cpuLoad": 0.01875, - "platform": "linux", - "uptime": 5456.2 - }, - { - "timestamp": 1760283873314, - "memoryTotal": 67427549184, - "memoryUsed": 5270814720, - "memoryFree": 62156734464, - "memoryUsagePercent": 7.817004746259887, - "memoryEfficiency": 92.18299525374012, - "cpuCount": 16, - "cpuLoad": 0.01125, - "platform": "linux", - "uptime": 5486.22 - }, - { - "timestamp": 1760283903340, - "memoryTotal": 67427549184, - "memoryUsed": 5256941568, - "memoryFree": 62170607616, - "memoryUsagePercent": 7.796429844505499, - "memoryEfficiency": 92.2035701554945, - "cpuCount": 16, - "cpuLoad": 0.006875, - "platform": "linux", - "uptime": 5516.25 - }, - { - "timestamp": 1760283933371, - "memoryTotal": 67427549184, - "memoryUsed": 5233696768, - "memoryFree": 62193852416, - "memoryUsagePercent": 7.76195610153055, - "memoryEfficiency": 92.23804389846946, - "cpuCount": 16, - "cpuLoad": 0.010625, - "platform": "linux", - "uptime": 5546.28 - }, - { - "timestamp": 1760283963402, - "memoryTotal": 67427549184, - "memoryUsed": 5270269952, - "memoryFree": 62157279232, - "memoryUsagePercent": 7.816196815367259, - "memoryEfficiency": 92.18380318463274, - "cpuCount": 16, - "cpuLoad": 0.02625, - "platform": "linux", - "uptime": 5576.31 - }, - { - "timestamp": 1760283993433, - "memoryTotal": 67427549184, - "memoryUsed": 5256478720, - "memoryFree": 62171070464, - "memoryUsagePercent": 7.795743406980183, - "memoryEfficiency": 92.20425659301982, - "cpuCount": 16, - "cpuLoad": 0.024375, - "platform": "linux", - "uptime": 5606.34 - }, - { - "timestamp": 1760284023464, - "memoryTotal": 67427549184, - "memoryUsed": 5227024384, - "memoryFree": 62200524800, - "memoryUsagePercent": 7.752060466762938, - "memoryEfficiency": 92.24793953323706, - "cpuCount": 16, - "cpuLoad": 0.014375, - "platform": "linux", - "uptime": 5636.37 - }, - { - "timestamp": 1760284053495, - "memoryTotal": 67427549184, - "memoryUsed": 5257244672, - "memoryFree": 62170304512, - "memoryUsagePercent": 7.7968793699645556, - "memoryEfficiency": 92.20312063003544, - "cpuCount": 16, - "cpuLoad": 0.00875, - "platform": "linux", - "uptime": 5666.4 - }, - { - "timestamp": 1760284083525, - "memoryTotal": 67427549184, - "memoryUsed": 5226139648, - "memoryFree": 62201409536, - "memoryUsagePercent": 7.750748338395962, - "memoryEfficiency": 92.24925166160403, - "cpuCount": 16, - "cpuLoad": 0.024375, - "platform": "linux", - "uptime": 5696.43 - }, - { - "timestamp": 1760284113556, - "memoryTotal": 67427549184, - "memoryUsed": 5261357056, - "memoryFree": 62166192128, - "memoryUsagePercent": 7.802978337003648, - "memoryEfficiency": 92.19702166299635, - "cpuCount": 16, - "cpuLoad": 0.018125, - "platform": "linux", - "uptime": 5726.46 - }, - { - "timestamp": 1760284143557, - "memoryTotal": 67427549184, - "memoryUsed": 5248684032, - "memoryFree": 62178865152, - "memoryUsagePercent": 7.78418331308039, - "memoryEfficiency": 92.21581668691961, - "cpuCount": 16, - "cpuLoad": 0.010625, - "platform": "linux", - "uptime": 5756.47 - }, - { - "timestamp": 1760284173588, - "memoryTotal": 67427549184, - "memoryUsed": 5302603776, - "memoryFree": 62124945408, - "memoryUsagePercent": 7.864150247445541, - "memoryEfficiency": 92.13584975255446, - "cpuCount": 16, - "cpuLoad": 0.00625, - "platform": "linux", - "uptime": 5786.5 - }, - { - "timestamp": 1760284203618, - "memoryTotal": 67427549184, - "memoryUsed": 5314117632, - "memoryFree": 62113431552, - "memoryUsagePercent": 7.881226140221327, - "memoryEfficiency": 92.11877385977867, - "cpuCount": 16, - "cpuLoad": 0.00375, - "platform": "linux", - "uptime": 5816.53 - }, - { - "timestamp": 1760284233648, - "memoryTotal": 67427549184, - "memoryUsed": 5335474176, - "memoryFree": 62092075008, - "memoryUsagePercent": 7.912899461079721, - "memoryEfficiency": 92.08710053892028, - "cpuCount": 16, - "cpuLoad": 0.0025, - "platform": "linux", - "uptime": 5846.56 - }, - { - "timestamp": 1760284263678, - "memoryTotal": 67427549184, - "memoryUsed": 5362458624, - "memoryFree": 62065090560, - "memoryUsagePercent": 7.952919376272491, - "memoryEfficiency": 92.04708062372751, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 5876.59 - }, - { - "timestamp": 1760284293707, - "memoryTotal": 67427549184, - "memoryUsed": 5607456768, - "memoryFree": 61820092416, - "memoryUsagePercent": 8.31626958989428, - "memoryEfficiency": 91.68373041010572, - "cpuCount": 16, - "cpuLoad": 0.024375, - "platform": "linux", - "uptime": 5906.62 - }, - { - "timestamp": 1760284323713, - "memoryTotal": 67427549184, - "memoryUsed": 5531947008, - "memoryFree": 61895602176, - "memoryUsagePercent": 8.20428307857389, - "memoryEfficiency": 91.7957169214261, - "cpuCount": 16, - "cpuLoad": 0.080625, - "platform": "linux", - "uptime": 5936.62 - }, - { - "timestamp": 1760284353743, - "memoryTotal": 67427549184, - "memoryUsed": 5545127936, - "memoryFree": 61882421248, - "memoryUsagePercent": 8.223831361374488, - "memoryEfficiency": 91.7761686386255, - "cpuCount": 16, - "cpuLoad": 0.063125, - "platform": "linux", - "uptime": 5966.65 - }, - { - "timestamp": 1760284383765, - "memoryTotal": 67427549184, - "memoryUsed": 5539074048, - "memoryFree": 61888475136, - "memoryUsagePercent": 8.214853001530088, - "memoryEfficiency": 91.78514699846991, - "cpuCount": 16, - "cpuLoad": 0.055625, - "platform": "linux", - "uptime": 5996.67 - }, - { - "timestamp": 1760284413795, - "memoryTotal": 67427549184, - "memoryUsed": 5688745984, - "memoryFree": 61738803200, - "memoryUsagePercent": 8.43682745827857, - "memoryEfficiency": 91.56317254172143, - "cpuCount": 16, - "cpuLoad": 0.046875, - "platform": "linux", - "uptime": 6026.7 - }, - { - "timestamp": 1760284443826, - "memoryTotal": 67427549184, - "memoryUsed": 5711736832, - "memoryFree": 61715812352, - "memoryUsagePercent": 8.470924571814852, - "memoryEfficiency": 91.52907542818515, - "cpuCount": 16, - "cpuLoad": 0.04875, - "platform": "linux", - "uptime": 6056.74 - }, - { - "timestamp": 1760284473827, - "memoryTotal": 67427549184, - "memoryUsed": 5533192192, - "memoryFree": 61894356992, - "memoryUsagePercent": 8.206129777757043, - "memoryEfficiency": 91.79387022224296, - "cpuCount": 16, - "cpuLoad": 0.043125, - "platform": "linux", - "uptime": 6086.74 - }, - { - "timestamp": 1760284503857, - "memoryTotal": 67427549184, - "memoryUsed": 5766275072, - "memoryFree": 61661274112, - "memoryUsagePercent": 8.551808781103214, - "memoryEfficiency": 91.44819121889678, - "cpuCount": 16, - "cpuLoad": 0.089375, - "platform": "linux", - "uptime": 6116.77 - }, - { - "timestamp": 1760284533887, - "memoryTotal": 67427549184, - "memoryUsed": 5707030528, - "memoryFree": 61720518656, - "memoryUsagePercent": 8.463944777862743, - "memoryEfficiency": 91.53605522213726, - "cpuCount": 16, - "cpuLoad": 0.08125, - "platform": "linux", - "uptime": 6146.8 - }, - { - "timestamp": 1760284563891, - "memoryTotal": 67427549184, - "memoryUsed": 5730349056, - "memoryFree": 61697200128, - "memoryUsagePercent": 8.498527864868272, - "memoryEfficiency": 91.50147213513173, - "cpuCount": 16, - "cpuLoad": 0.111875, - "platform": "linux", - "uptime": 6176.8 - }, - { - "timestamp": 1760284593920, - "memoryTotal": 67427549184, - "memoryUsed": 5750566912, - "memoryFree": 61676982272, - "memoryUsagePercent": 8.528512427921022, - "memoryEfficiency": 91.47148757207898, - "cpuCount": 16, - "cpuLoad": 0.09625, - "platform": "linux", - "uptime": 6206.83 - }, - { - "timestamp": 1760284623936, - "memoryTotal": 67427549184, - "memoryUsed": 5663928320, - "memoryFree": 61763620864, - "memoryUsagePercent": 8.400021042651218, - "memoryEfficiency": 91.59997895734878, - "cpuCount": 16, - "cpuLoad": 0.138125, - "platform": "linux", - "uptime": 6236.84 - }, - { - "timestamp": 1760284653965, - "memoryTotal": 67427549184, - "memoryUsed": 6268153856, - "memoryFree": 61159395328, - "memoryUsagePercent": 9.296131821275482, - "memoryEfficiency": 90.70386817872452, - "cpuCount": 16, - "cpuLoad": 0.093125, - "platform": "linux", - "uptime": 6266.87 - }, - { - "timestamp": 1760284683996, - "memoryTotal": 67427549184, - "memoryUsed": 5671649280, - "memoryFree": 61755899904, - "memoryUsagePercent": 8.41147179252043, - "memoryEfficiency": 91.58852820747957, - "cpuCount": 16, - "cpuLoad": 0.089375, - "platform": "linux", - "uptime": 6296.91 - }, - { - "timestamp": 1760284713998, - "memoryTotal": 67427549184, - "memoryUsed": 5695053824, - "memoryFree": 61732495360, - "memoryUsagePercent": 8.44618244756164, - "memoryEfficiency": 91.55381755243836, - "cpuCount": 16, - "cpuLoad": 0.108125, - "platform": "linux", - "uptime": 6326.91 - }, - { - "timestamp": 1760284744007, - "memoryTotal": 67427549184, - "memoryUsed": 5691133952, - "memoryFree": 61736415232, - "memoryUsagePercent": 8.440368989935733, - "memoryEfficiency": 91.55963101006427, - "cpuCount": 16, - "cpuLoad": 0.113125, - "platform": "linux", - "uptime": 6356.92 - }, - { - "timestamp": 1760284774037, - "memoryTotal": 67427549184, - "memoryUsed": 5713895424, - "memoryFree": 61713653760, - "memoryUsagePercent": 8.474125922043537, - "memoryEfficiency": 91.52587407795646, - "cpuCount": 16, - "cpuLoad": 0.146875, - "platform": "linux", - "uptime": 6386.95 - }, - { - "timestamp": 1760284804065, - "memoryTotal": 67427549184, - "memoryUsed": 5605842944, - "memoryFree": 61821706240, - "memoryUsagePercent": 8.31387617055822, - "memoryEfficiency": 91.68612382944178, - "cpuCount": 16, - "cpuLoad": 0.093125, - "platform": "linux", - "uptime": 6416.97 - }, - { - "timestamp": 1760284834091, - "memoryTotal": 67427549184, - "memoryUsed": 5687132160, - "memoryFree": 61740417024, - "memoryUsagePercent": 8.434434038942513, - "memoryEfficiency": 91.56556596105749, - "cpuCount": 16, - "cpuLoad": 0.074375, - "platform": "linux", - "uptime": 6447 - }, - { - "timestamp": 1760284864123, - "memoryTotal": 67427549184, - "memoryUsed": 5756145664, - "memoryFree": 61671403520, - "memoryUsagePercent": 8.536786126235011, - "memoryEfficiency": 91.46321387376499, - "cpuCount": 16, - "cpuLoad": 0.058125, - "platform": "linux", - "uptime": 6477.03 - }, - { - "timestamp": 1760284894153, - "memoryTotal": 67427549184, - "memoryUsed": 5660393472, - "memoryFree": 61767155712, - "memoryUsagePercent": 8.39477860385168, - "memoryEfficiency": 91.60522139614832, - "cpuCount": 16, - "cpuLoad": 0.078125, - "platform": "linux", - "uptime": 6507.06 - }, - { - "timestamp": 1760284924183, - "memoryTotal": 67427549184, - "memoryUsed": 6331346944, - "memoryFree": 61096202240, - "memoryUsagePercent": 9.389851804820418, - "memoryEfficiency": 90.61014819517958, - "cpuCount": 16, - "cpuLoad": 0.0875, - "platform": "linux", - "uptime": 6537.09 - }, - { - "timestamp": 1760284954213, - "memoryTotal": 67427549184, - "memoryUsed": 5980098560, - "memoryFree": 61447450624, - "memoryUsagePercent": 8.868924693794192, - "memoryEfficiency": 91.13107530620582, - "cpuCount": 16, - "cpuLoad": 0.085625, - "platform": "linux", - "uptime": 6567.12 - }, - { - "timestamp": 1760284984236, - "memoryTotal": 67427549184, - "memoryUsed": 6175211520, - "memoryFree": 61252337664, - "memoryUsagePercent": 9.158291521390973, - "memoryEfficiency": 90.84170847860902, - "cpuCount": 16, - "cpuLoad": 0.064375, - "platform": "linux", - "uptime": 6597.15 - }, - { - "timestamp": 1760285014252, - "memoryTotal": 67427549184, - "memoryUsed": 6040887296, - "memoryFree": 61386661888, - "memoryUsagePercent": 8.959078847008506, - "memoryEfficiency": 91.0409211529915, - "cpuCount": 16, - "cpuLoad": 0.084375, - "platform": "linux", - "uptime": 6627.16 - }, - { - "timestamp": 1760285044276, - "memoryTotal": 67427549184, - "memoryUsed": 5904543744, - "memoryFree": 61523005440, - "memoryUsagePercent": 8.756871361121782, - "memoryEfficiency": 91.24312863887822, - "cpuCount": 16, - "cpuLoad": 0.091875, - "platform": "linux", - "uptime": 6657.19 - }, - { - "timestamp": 1760285074280, - "memoryTotal": 67427549184, - "memoryUsed": 5885415424, - "memoryFree": 61542133760, - "memoryUsagePercent": 8.728502659854291, - "memoryEfficiency": 91.27149734014571, - "cpuCount": 16, - "cpuLoad": 0.09625, - "platform": "linux", - "uptime": 6687.19 - }, - { - "timestamp": 1760285104291, - "memoryTotal": 67427549184, - "memoryUsed": 5860278272, - "memoryFree": 61567270912, - "memoryUsagePercent": 8.69122242009442, - "memoryEfficiency": 91.30877757990558, - "cpuCount": 16, - "cpuLoad": 0.11, - "platform": "linux", - "uptime": 6717.2 - }, - { - "timestamp": 1760285134317, - "memoryTotal": 67427549184, - "memoryUsed": 5596692480, - "memoryFree": 61830856704, - "memoryUsagePercent": 8.300305361429404, - "memoryEfficiency": 91.69969463857059, - "cpuCount": 16, - "cpuLoad": 0.085, - "platform": "linux", - "uptime": 6747.23 - }, - { - "timestamp": 1760285164347, - "memoryTotal": 67427549184, - "memoryUsed": 5548859392, - "memoryFree": 61878689792, - "memoryUsagePercent": 8.229365384255576, - "memoryEfficiency": 91.77063461574443, - "cpuCount": 16, - "cpuLoad": 0.064375, - "platform": "linux", - "uptime": 6777.26 - }, - { - "timestamp": 1760285194377, - "memoryTotal": 67427549184, - "memoryUsed": 5811814400, - "memoryFree": 61615734784, - "memoryUsagePercent": 8.619346943992287, - "memoryEfficiency": 91.38065305600772, - "cpuCount": 16, - "cpuLoad": 0.064375, - "platform": "linux", - "uptime": 6807.29 - }, - { - "timestamp": 1760285224399, - "memoryTotal": 67427549184, - "memoryUsed": 5807386624, - "memoryFree": 61620162560, - "memoryUsagePercent": 8.61278022748904, - "memoryEfficiency": 91.38721977251096, - "cpuCount": 16, - "cpuLoad": 0.066875, - "platform": "linux", - "uptime": 6837.31 - }, - { - "timestamp": 1760285254429, - "memoryTotal": 67427549184, - "memoryUsed": 5770862592, - "memoryFree": 61656686592, - "memoryUsagePercent": 8.558612409672719, - "memoryEfficiency": 91.44138759032728, - "cpuCount": 16, - "cpuLoad": 0.070625, - "platform": "linux", - "uptime": 6867.34 - }, - { - "timestamp": 1760285284459, - "memoryTotal": 67427549184, - "memoryUsed": 5684776960, - "memoryFree": 61742772224, - "memoryUsagePercent": 8.430941104632275, - "memoryEfficiency": 91.56905889536773, - "cpuCount": 16, - "cpuLoad": 0.099375, - "platform": "linux", - "uptime": 6897.37 - }, - { - "timestamp": 1760285314486, - "memoryTotal": 67427549184, - "memoryUsed": 5551636480, - "memoryFree": 61875912704, - "memoryUsagePercent": 8.233484009407475, - "memoryEfficiency": 91.76651599059252, - "cpuCount": 16, - "cpuLoad": 0.089375, - "platform": "linux", - "uptime": 6927.39 - }, - { - "timestamp": 1760285344507, - "memoryTotal": 67427549184, - "memoryUsed": 5489373184, - "memoryFree": 61938176000, - "memoryUsagePercent": 8.141142975581534, - "memoryEfficiency": 91.85885702441847, - "cpuCount": 16, - "cpuLoad": 0.059375, - "platform": "linux", - "uptime": 6957.42 - }, - { - "timestamp": 1760285374537, - "memoryTotal": 67427549184, - "memoryUsed": 5490790400, - "memoryFree": 61936758784, - "memoryUsagePercent": 8.143244810836043, - "memoryEfficiency": 91.85675518916396, - "cpuCount": 16, - "cpuLoad": 0.040625, - "platform": "linux", - "uptime": 6987.45 - }, - { - "timestamp": 1760285404562, - "memoryTotal": 67427549184, - "memoryUsed": 5480296448, - "memoryFree": 61947252736, - "memoryUsagePercent": 8.127681510483297, - "memoryEfficiency": 91.8723184895167, - "cpuCount": 16, - "cpuLoad": 0.024375, - "platform": "linux", - "uptime": 7017.47 - }, - { - "timestamp": 1760285434577, - "memoryTotal": 67427549184, - "memoryUsed": 5480366080, - "memoryFree": 61947183104, - "memoryUsagePercent": 8.127784779845513, - "memoryEfficiency": 91.87221522015449, - "cpuCount": 16, - "cpuLoad": 0.02375, - "platform": "linux", - "uptime": 7047.49 - }, - { - "timestamp": 1760285464607, - "memoryTotal": 67427549184, - "memoryUsed": 5491077120, - "memoryFree": 61936472064, - "memoryUsagePercent": 8.143670037621636, - "memoryEfficiency": 91.85632996237837, - "cpuCount": 16, - "cpuLoad": 0.018125, - "platform": "linux", - "uptime": 7077.52 - }, - { - "timestamp": 1760285494637, - "memoryTotal": 67427549184, - "memoryUsed": 5479731200, - "memoryFree": 61947817984, - "memoryUsagePercent": 8.126843206248841, - "memoryEfficiency": 91.87315679375116, - "cpuCount": 16, - "cpuLoad": 0.015, - "platform": "linux", - "uptime": 7107.55 - }, - { - "timestamp": 1760285524667, - "memoryTotal": 67427549184, - "memoryUsed": 5504217088, - "memoryFree": 61923332096, - "memoryUsagePercent": 8.163157573738577, - "memoryEfficiency": 91.83684242626143, - "cpuCount": 16, - "cpuLoad": 0.0225, - "platform": "linux", - "uptime": 7137.58 - }, - { - "timestamp": 1760285554699, - "memoryTotal": 67427549184, - "memoryUsed": 5500076032, - "memoryFree": 61927473152, - "memoryUsagePercent": 8.157016084020926, - "memoryEfficiency": 91.84298391597908, - "cpuCount": 16, - "cpuLoad": 0.02, - "platform": "linux", - "uptime": 7167.61 - }, - { - "timestamp": 1760285584729, - "memoryTotal": 67427549184, - "memoryUsed": 5490561024, - "memoryFree": 61936988160, - "memoryUsagePercent": 8.142904629407568, - "memoryEfficiency": 91.85709537059243, - "cpuCount": 16, - "cpuLoad": 0.015625, - "platform": "linux", - "uptime": 7197.64 - }, - { - "timestamp": 1760285614736, - "memoryTotal": 67427549184, - "memoryUsed": 5574672384, - "memoryFree": 61852876800, - "memoryUsagePercent": 8.267647944295776, - "memoryEfficiency": 91.73235205570423, - "cpuCount": 16, - "cpuLoad": 0.029375, - "platform": "linux", - "uptime": 7227.64 - }, - { - "timestamp": 1760285644758, - "memoryTotal": 67427549184, - "memoryUsed": 5732126720, - "memoryFree": 61695422464, - "memoryUsagePercent": 8.501164270938956, - "memoryEfficiency": 91.49883572906104, - "cpuCount": 16, - "cpuLoad": 0.041875, - "platform": "linux", - "uptime": 7257.67 - }, - { - "timestamp": 1760285674784, - "memoryTotal": 67427549184, - "memoryUsed": 5667225600, - "memoryFree": 61760323584, - "memoryUsagePercent": 8.404911150685551, - "memoryEfficiency": 91.59508884931445, - "cpuCount": 16, - "cpuLoad": 0.06125, - "platform": "linux", - "uptime": 7287.69 - }, - { - "timestamp": 1760285704813, - "memoryTotal": 67427549184, - "memoryUsed": 5627166720, - "memoryFree": 61800382464, - "memoryUsagePercent": 8.34550089406969, - "memoryEfficiency": 91.65449910593031, - "cpuCount": 16, - "cpuLoad": 0.094375, - "platform": "linux", - "uptime": 7317.72 - }, - { - "timestamp": 1760285734819, - "memoryTotal": 67427549184, - "memoryUsed": 5849591808, - "memoryFree": 61577957376, - "memoryUsagePercent": 8.675373610328492, - "memoryEfficiency": 91.32462638967151, + "timestamp": 1760360159671, + "memoryTotal": 67427545088, + "memoryUsed": 4518998016, + "memoryFree": 62908547072, + "memoryUsagePercent": 6.702005849541512, + "memoryEfficiency": 93.29799415045849, "cpuCount": 16, "cpuLoad": 0.08875, "platform": "linux", - "uptime": 7347.73 + "uptime": 212.34 }, { - "timestamp": 1760285764849, - "memoryTotal": 67427549184, - "memoryUsed": 5738999808, - "memoryFree": 61688549376, - "memoryUsagePercent": 8.511357564456484, - "memoryEfficiency": 91.48864243554351, - "cpuCount": 16, - "cpuLoad": 0.108125, - "platform": "linux", - "uptime": 7377.76 - }, - { - "timestamp": 1760285794878, - "memoryTotal": 67427549184, - "memoryUsed": 5691437056, - "memoryFree": 61736112128, - "memoryUsagePercent": 8.44081851539479, - "memoryEfficiency": 91.5591814846052, - "cpuCount": 16, - "cpuLoad": 0.085625, - "platform": "linux", - "uptime": 7407.79 - }, - { - "timestamp": 1760285824908, - "memoryTotal": 67427549184, - "memoryUsed": 5558407168, - "memoryFree": 61869142016, - "memoryUsagePercent": 8.243525436215862, - "memoryEfficiency": 91.75647456378414, + "timestamp": 1760360189702, + "memoryTotal": 67427545088, + "memoryUsed": 4595675136, + "memoryFree": 62831869952, + "memoryUsagePercent": 6.815723648254083, + "memoryEfficiency": 93.18427635174592, "cpuCount": 16, "cpuLoad": 0.060625, "platform": "linux", - "uptime": 7437.82 + "uptime": 242.37 }, { - "timestamp": 1760285854938, - "memoryTotal": 67427549184, - "memoryUsed": 5337632768, - "memoryFree": 62089916416, - "memoryUsagePercent": 7.916100811308409, - "memoryEfficiency": 92.08389918869159, - "cpuCount": 16, - "cpuLoad": 0.043125, - "platform": "linux", - "uptime": 7467.85 - }, - { - "timestamp": 1760285884969, - "memoryTotal": 67427549184, - "memoryUsed": 5358977024, - "memoryFree": 62068572160, - "memoryUsagePercent": 7.947755908161707, - "memoryEfficiency": 92.05224409183829, - "cpuCount": 16, - "cpuLoad": 0.02625, - "platform": "linux", - "uptime": 7497.88 - }, - { - "timestamp": 1760285914982, - "memoryTotal": 67427549184, - "memoryUsed": 5360132096, - "memoryFree": 62067417088, - "memoryUsagePercent": 7.949468964640813, - "memoryEfficiency": 92.05053103535919, - "cpuCount": 16, - "cpuLoad": 0.015625, - "platform": "linux", - "uptime": 7527.89 - }, - { - "timestamp": 1760285945012, - "memoryTotal": 67427549184, - "memoryUsed": 5374140416, - "memoryFree": 62053408768, - "memoryUsagePercent": 7.970244330451267, - "memoryEfficiency": 92.02975566954873, - "cpuCount": 16, - "cpuLoad": 0.009375, - "platform": "linux", - "uptime": 7557.92 - }, - { - "timestamp": 1760285975042, - "memoryTotal": 67427549184, - "memoryUsed": 5334077440, - "memoryFree": 62093471744, - "memoryUsagePercent": 7.910827999167042, - "memoryEfficiency": 92.08917200083296, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 7587.95 - }, - { - "timestamp": 1760286005072, - "memoryTotal": 67427549184, - "memoryUsed": 5344759808, - "memoryFree": 62082789376, - "memoryUsagePercent": 7.926670734264604, - "memoryEfficiency": 92.0733292657354, - "cpuCount": 16, - "cpuLoad": 0.010625, - "platform": "linux", - "uptime": 7617.98 - }, - { - "timestamp": 1760286035103, - "memoryTotal": 67427549184, - "memoryUsed": 5369638912, - "memoryFree": 62057910272, - "memoryUsagePercent": 7.96356826991744, - "memoryEfficiency": 92.03643173008255, - "cpuCount": 16, - "cpuLoad": 0.01125, - "platform": "linux", - "uptime": 7648.01 - }, - { - "timestamp": 1760286065132, - "memoryTotal": 67427549184, - "memoryUsed": 5366255616, - "memoryFree": 62061293568, - "memoryUsagePercent": 7.95855059384743, - "memoryEfficiency": 92.04144940615257, - "cpuCount": 16, - "cpuLoad": 0.006875, - "platform": "linux", - "uptime": 7678.04 - }, - { - "timestamp": 1760286095163, - "memoryTotal": 67427549184, - "memoryUsed": 5364568064, - "memoryFree": 62062981120, - "memoryUsagePercent": 7.956047830480791, - "memoryEfficiency": 92.04395216951922, - "cpuCount": 16, - "cpuLoad": 0.01375, - "platform": "linux", - "uptime": 7708.07 - }, - { - "timestamp": 1760286125193, - "memoryTotal": 67427549184, - "memoryUsed": 5366509568, - "memoryFree": 62061039616, - "memoryUsagePercent": 7.9589272232861, - "memoryEfficiency": 92.0410727767139, - "cpuCount": 16, - "cpuLoad": 0.008125, - "platform": "linux", - "uptime": 7738.1 - }, - { - "timestamp": 1760286155224, - "memoryTotal": 67427549184, - "memoryUsed": 5388124160, - "memoryFree": 62039425024, - "memoryUsagePercent": 7.990983248251528, - "memoryEfficiency": 92.00901675174848, - "cpuCount": 16, - "cpuLoad": 0.01875, - "platform": "linux", - "uptime": 7768.13 - }, - { - "timestamp": 1760286185254, - "memoryTotal": 67427549184, - "memoryUsed": 5393285120, - "memoryFree": 62034264064, - "memoryUsagePercent": 7.9986373303922225, - "memoryEfficiency": 92.00136266960777, - "cpuCount": 16, - "cpuLoad": 0.02, - "platform": "linux", - "uptime": 7798.16 - }, - { - "timestamp": 1760286215284, - "memoryTotal": 67427549184, - "memoryUsed": 5373796352, - "memoryFree": 62053752832, - "memoryUsagePercent": 7.969734058308554, - "memoryEfficiency": 92.03026594169144, - "cpuCount": 16, - "cpuLoad": 0.015625, - "platform": "linux", - "uptime": 7828.19 - }, - { - "timestamp": 1760286245315, - "memoryTotal": 67427549184, - "memoryUsed": 5366775808, - "memoryFree": 62060773376, - "memoryUsagePercent": 7.9593220767298645, - "memoryEfficiency": 92.04067792327014, - "cpuCount": 16, - "cpuLoad": 0.0175, - "platform": "linux", - "uptime": 7858.22 - }, - { - "timestamp": 1760286275346, - "memoryTotal": 67427549184, - "memoryUsed": 5364166656, - "memoryFree": 62063382528, - "memoryUsagePercent": 7.955452512980959, - "memoryEfficiency": 92.04454748701905, - "cpuCount": 16, - "cpuLoad": 0.015, - "platform": "linux", - "uptime": 7888.25 - }, - { - "timestamp": 1760286305361, - "memoryTotal": 67427549184, - "memoryUsed": 5365825536, - "memoryFree": 62061723648, - "memoryUsagePercent": 7.957912753669039, - "memoryEfficiency": 92.04208724633096, - "cpuCount": 16, - "cpuLoad": 0.013125, - "platform": "linux", - "uptime": 7918.27 - }, - { - "timestamp": 1760286335364, - "memoryTotal": 67427549184, - "memoryUsed": 5386215424, - "memoryFree": 62041333760, - "memoryUsagePercent": 7.988152452793145, - "memoryEfficiency": 92.01184754720686, - "cpuCount": 16, - "cpuLoad": 0.015625, - "platform": "linux", - "uptime": 7948.27 - }, - { - "timestamp": 1760286365395, - "memoryTotal": 67427549184, - "memoryUsed": 5370548224, - "memoryFree": 62057000960, - "memoryUsagePercent": 7.96491684629461, - "memoryEfficiency": 92.03508315370539, - "cpuCount": 16, - "cpuLoad": 0.013125, - "platform": "linux", - "uptime": 7978.3 - }, - { - "timestamp": 1760286395396, - "memoryTotal": 67427549184, - "memoryUsed": 5357498368, - "memoryFree": 62070050816, - "memoryUsagePercent": 7.945562952881713, - "memoryEfficiency": 92.05443704711828, - "cpuCount": 16, - "cpuLoad": 0.02, - "platform": "linux", - "uptime": 8008.3 - }, - { - "timestamp": 1760286425426, - "memoryTotal": 67427549184, - "memoryUsed": 5368684544, - "memoryFree": 62058864640, - "memoryUsagePercent": 7.962152872188248, - "memoryEfficiency": 92.03784712781174, - "cpuCount": 16, - "cpuLoad": 0.016875, - "platform": "linux", - "uptime": 8038.33 - }, - { - "timestamp": 1760286455455, - "memoryTotal": 67427549184, - "memoryUsed": 5351727104, - "memoryFree": 62075822080, - "memoryUsagePercent": 7.9370037451545405, - "memoryEfficiency": 92.06299625484546, - "cpuCount": 16, - "cpuLoad": 0.014375, - "platform": "linux", - "uptime": 8068.36 - }, - { - "timestamp": 1760286485486, - "memoryTotal": 67427549184, - "memoryUsed": 5346050048, - "memoryFree": 62081499136, - "memoryUsagePercent": 7.9285842547997785, - "memoryEfficiency": 92.07141574520023, - "cpuCount": 16, - "cpuLoad": 0.0125, - "platform": "linux", - "uptime": 8098.39 - }, - { - "timestamp": 1760286515516, - "memoryTotal": 67427549184, - "memoryUsed": 5392388096, - "memoryFree": 62035161088, - "memoryUsagePercent": 7.997306978020149, - "memoryEfficiency": 92.00269302197985, - "cpuCount": 16, - "cpuLoad": 0.01625, - "platform": "linux", - "uptime": 8128.42 - }, - { - "timestamp": 1760286545547, - "memoryTotal": 67427549184, - "memoryUsed": 5380915200, - "memoryFree": 62046633984, - "memoryUsagePercent": 7.98029183192802, - "memoryEfficiency": 92.01970816807199, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 8158.46 - }, - { - "timestamp": 1760286575565, - "memoryTotal": 67427549184, - "memoryUsed": 5352751104, - "memoryFree": 62074798080, - "memoryUsagePercent": 7.9385224122459475, - "memoryEfficiency": 92.06147758775406, - "cpuCount": 16, - "cpuLoad": 0.005625, - "platform": "linux", - "uptime": 8188.47 - }, - { - "timestamp": 1760286605595, - "memoryTotal": 67427549184, - "memoryUsed": 5358018560, - "memoryFree": 62069530624, - "memoryUsagePercent": 7.946334435764148, - "memoryEfficiency": 92.05366556423586, - "cpuCount": 16, - "cpuLoad": 0.0075, - "platform": "linux", - "uptime": 8218.5 - }, - { - "timestamp": 1760286635619, - "memoryTotal": 67427549184, - "memoryUsed": 5353807872, - "memoryFree": 62073741312, - "memoryUsagePercent": 7.940089676684281, - "memoryEfficiency": 92.05991032331572, - "cpuCount": 16, - "cpuLoad": 0.013125, - "platform": "linux", - "uptime": 8248.53 - }, - { - "timestamp": 1760286665622, - "memoryTotal": 67427549184, - "memoryUsed": 5361627136, - "memoryFree": 62065922048, - "memoryUsagePercent": 7.9516862185942685, - "memoryEfficiency": 92.04831378140574, - "cpuCount": 16, - "cpuLoad": 0.0225, - "platform": "linux", - "uptime": 8278.53 - }, - { - "timestamp": 1760286695652, - "memoryTotal": 67427549184, - "memoryUsed": 5348184064, - "memoryFree": 62079365120, - "memoryUsagePercent": 7.931749157018271, - "memoryEfficiency": 92.06825084298173, - "cpuCount": 16, - "cpuLoad": 0.03, - "platform": "linux", - "uptime": 8308.56 - }, - { - "timestamp": 1760286725683, - "memoryTotal": 67427549184, - "memoryUsed": 5334302720, - "memoryFree": 62093246464, - "memoryUsagePercent": 7.9111621059271515, - "memoryEfficiency": 92.08883789407285, - "cpuCount": 16, - "cpuLoad": 0.0225, - "platform": "linux", - "uptime": 8338.59 - }, - { - "timestamp": 1760286755714, - "memoryTotal": 67427549184, - "memoryUsed": 5339287552, - "memoryFree": 62088261632, - "memoryUsagePercent": 7.918554977328123, - "memoryEfficiency": 92.08144502267187, - "cpuCount": 16, - "cpuLoad": 0.01375, - "platform": "linux", - "uptime": 8368.62 - }, - { - "timestamp": 1760286785744, - "memoryTotal": 67427549184, - "memoryUsed": 5311885312, - "memoryFree": 62115663872, - "memoryUsagePercent": 7.877915445962058, - "memoryEfficiency": 92.12208455403794, - "cpuCount": 16, - "cpuLoad": 0.016875, - "platform": "linux", - "uptime": 8398.65 - }, - { - "timestamp": 1760286815769, - "memoryTotal": 67427549184, - "memoryUsed": 5329285120, - "memoryFree": 62098264064, - "memoryUsagePercent": 7.903720637179254, - "memoryEfficiency": 92.09627936282075, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 8428.68 - }, - { - "timestamp": 1760286845799, - "memoryTotal": 67427549184, - "memoryUsed": 5345886208, - "memoryFree": 62081662976, - "memoryUsagePercent": 7.928341268065152, - "memoryEfficiency": 92.07165873193485, - "cpuCount": 16, - "cpuLoad": 0.01, - "platform": "linux", - "uptime": 8458.71 - }, - { - "timestamp": 1760286875830, - "memoryTotal": 67427549184, - "memoryUsed": 5320818688, - "memoryFree": 62106730496, - "memoryUsagePercent": 7.8911642976674985, - "memoryEfficiency": 92.1088357023325, - "cpuCount": 16, - "cpuLoad": 0.00625, - "platform": "linux", - "uptime": 8488.74 - }, - { - "timestamp": 1760286905850, - "memoryTotal": 67427549184, - "memoryUsed": 5541928960, - "memoryFree": 61885620224, - "memoryUsagePercent": 8.219087045380931, - "memoryEfficiency": 91.78091295461907, - "cpuCount": 16, - "cpuLoad": 0.02125, - "platform": "linux", - "uptime": 8518.76 - }, - { - "timestamp": 1760286935881, - "memoryTotal": 67427549184, - "memoryUsed": 5487161344, - "memoryFree": 61940387840, - "memoryUsagePercent": 8.137862654664094, - "memoryEfficiency": 91.86213734533591, - "cpuCount": 16, - "cpuLoad": 0.025, - "platform": "linux", - "uptime": 8548.79 - }, - { - "timestamp": 1760286965911, - "memoryTotal": 67427549184, - "memoryUsed": 5524987904, - "memoryFree": 61902561280, - "memoryUsagePercent": 8.193962217020687, - "memoryEfficiency": 91.80603778297932, - "cpuCount": 16, - "cpuLoad": 0.040625, - "platform": "linux", - "uptime": 8578.82 - }, - { - "timestamp": 1760286995940, - "memoryTotal": 67427549184, - "memoryUsed": 5682360320, - "memoryFree": 61745188864, - "memoryUsagePercent": 8.427357050296553, - "memoryEfficiency": 91.57264294970345, - "cpuCount": 16, - "cpuLoad": 0.05375, - "platform": "linux", - "uptime": 8608.85 - }, - { - "timestamp": 1760287025957, - "memoryTotal": 67427549184, - "memoryUsed": 5571395584, - "memoryFree": 61856153600, - "memoryUsagePercent": 8.262788209603274, - "memoryEfficiency": 91.73721179039673, + "timestamp": 1760360219704, + "memoryTotal": 67427545088, + "memoryUsed": 4562903040, + "memoryFree": 62864642048, + "memoryUsagePercent": 6.767120223708181, + "memoryEfficiency": 93.23287977629182, "cpuCount": 16, "cpuLoad": 0.036875, "platform": "linux", - "uptime": 8638.87 + "uptime": 272.38 }, { - "timestamp": 1760287055987, - "memoryTotal": 67427549184, - "memoryUsed": 5597593600, - "memoryFree": 61829955584, - "memoryUsagePercent": 8.301641788469842, - "memoryEfficiency": 91.69835821153016, + "timestamp": 1760360249734, + "memoryTotal": 67427545088, + "memoryUsed": 4544065536, + "memoryFree": 62883479552, + "memoryUsagePercent": 6.739182822197544, + "memoryEfficiency": 93.26081717780245, "cpuCount": 16, - "cpuLoad": 0.063125, + "cpuLoad": 0.034375, "platform": "linux", - "uptime": 8668.9 + "uptime": 302.41 }, { - "timestamp": 1760287085996, - "memoryTotal": 67427549184, - "memoryUsed": 5966454784, - "memoryFree": 61461094400, - "memoryUsagePercent": 8.848689973468279, - "memoryEfficiency": 91.15131002653172, + "timestamp": 1760360279764, + "memoryTotal": 67427545088, + "memoryUsed": 4583780352, + "memoryFree": 62843764736, + "memoryUsagePercent": 6.798082810248671, + "memoryEfficiency": 93.20191718975133, + "cpuCount": 16, + "cpuLoad": 0.028125, + "platform": "linux", + "uptime": 332.44 + }, + { + "timestamp": 1760360309779, + "memoryTotal": 67427545088, + "memoryUsed": 4562841600, + "memoryFree": 62864703488, + "memoryUsagePercent": 6.767029103677161, + "memoryEfficiency": 93.23297089632284, + "cpuCount": 16, + "cpuLoad": 0.016875, + "platform": "linux", + "uptime": 362.45 + }, + { + "timestamp": 1760360339810, + "memoryTotal": 67427545088, + "memoryUsed": 4589981696, + "memoryFree": 62837563392, + "memoryUsagePercent": 6.807279858712925, + "memoryEfficiency": 93.19272014128707, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 392.48 + }, + { + "timestamp": 1760360369840, + "memoryTotal": 67427545088, + "memoryUsed": 4693295104, + "memoryFree": 62734249984, + "memoryUsagePercent": 6.9605012282068985, + "memoryEfficiency": 93.0394987717931, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 422.51 + }, + { + "timestamp": 1760360399870, + "memoryTotal": 67427545088, + "memoryUsed": 4717563904, + "memoryFree": 62709981184, + "memoryUsagePercent": 6.996493640459675, + "memoryEfficiency": 93.00350635954032, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 452.54 + }, + { + "timestamp": 1760360429887, + "memoryTotal": 67427545088, + "memoryUsed": 4726546432, + "memoryFree": 62700998656, + "memoryUsagePercent": 7.0098153889947525, + "memoryEfficiency": 92.99018461100525, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 482.56 + }, + { + "timestamp": 1760360459918, + "memoryTotal": 67427545088, + "memoryUsed": 5700284416, + "memoryFree": 61727260672, + "memoryUsagePercent": 8.453940312613389, + "memoryEfficiency": 91.54605968738662, + "cpuCount": 16, + "cpuLoad": 0.056875, + "platform": "linux", + "uptime": 512.59 + }, + { + "timestamp": 1760360489948, + "memoryTotal": 67427545088, + "memoryUsed": 5071826944, + "memoryFree": 62355718144, + "memoryUsagePercent": 7.521891739319199, + "memoryEfficiency": 92.4781082606808, + "cpuCount": 16, + "cpuLoad": 0.076875, + "platform": "linux", + "uptime": 542.62 + }, + { + "timestamp": 1760360519977, + "memoryTotal": 67427545088, + "memoryUsed": 4873019392, + "memoryFree": 62554525696, + "memoryUsagePercent": 7.2270455429456915, + "memoryEfficiency": 92.77295445705431, + "cpuCount": 16, + "cpuLoad": 0.054375, + "platform": "linux", + "uptime": 572.65 + }, + { + "timestamp": 1760360550008, + "memoryTotal": 67427545088, + "memoryUsed": 4885262336, + "memoryFree": 62542282752, + "memoryUsagePercent": 7.245202727793547, + "memoryEfficiency": 92.75479727220645, + "cpuCount": 16, + "cpuLoad": 0.150625, + "platform": "linux", + "uptime": 602.68 + }, + { + "timestamp": 1760360580013, + "memoryTotal": 67427545088, + "memoryUsed": 5420646400, + "memoryFree": 62006898688, + "memoryUsagePercent": 8.039216603430377, + "memoryEfficiency": 91.96078339656962, + "cpuCount": 16, + "cpuLoad": 0.109375, + "platform": "linux", + "uptime": 632.68 + }, + { + "timestamp": 1760360610027, + "memoryTotal": 67427545088, + "memoryUsed": 4869550080, + "memoryFree": 62557995008, + "memoryUsagePercent": 7.221900298527445, + "memoryEfficiency": 92.77809970147256, + "cpuCount": 16, + "cpuLoad": 0.069375, + "platform": "linux", + "uptime": 662.7 + }, + { + "timestamp": 1760360640039, + "memoryTotal": 67427545088, + "memoryUsed": 4850503680, + "memoryFree": 62577041408, + "memoryUsagePercent": 7.193653088911342, + "memoryEfficiency": 92.80634691108865, + "cpuCount": 16, + "cpuLoad": 0.06, + "platform": "linux", + "uptime": 692.71 + }, + { + "timestamp": 1760360670055, + "memoryTotal": 67427545088, + "memoryUsed": 4885397504, + "memoryFree": 62542147584, + "memoryUsagePercent": 7.245403191861791, + "memoryEfficiency": 92.7545968081382, + "cpuCount": 16, + "cpuLoad": 0.045, + "platform": "linux", + "uptime": 722.73 + }, + { + "timestamp": 1760360700056, + "memoryTotal": 67427545088, + "memoryUsed": 4932124672, + "memoryFree": 62495420416, + "memoryUsagePercent": 7.314703012786632, + "memoryEfficiency": 92.68529698721336, + "cpuCount": 16, + "cpuLoad": 0.059375, + "platform": "linux", + "uptime": 752.73 + }, + { + "timestamp": 1760360730087, + "memoryTotal": 67427545088, + "memoryUsed": 4896964608, + "memoryFree": 62530580480, + "memoryUsagePercent": 7.26255805636843, + "memoryEfficiency": 92.73744194363157, + "cpuCount": 16, + "cpuLoad": 0.04, + "platform": "linux", + "uptime": 782.76 + }, + { + "timestamp": 1760360760103, + "memoryTotal": 67427545088, + "memoryUsed": 4892606464, + "memoryFree": 62534938624, + "memoryUsagePercent": 7.2560946088347675, + "memoryEfficiency": 92.74390539116523, + "cpuCount": 16, + "cpuLoad": 0.07, + "platform": "linux", + "uptime": 812.78 + }, + { + "timestamp": 1760360790134, + "memoryTotal": 67427545088, + "memoryUsed": 4971966464, + "memoryFree": 62455578624, + "memoryUsagePercent": 7.373791315568531, + "memoryEfficiency": 92.62620868443148, + "cpuCount": 16, + "cpuLoad": 0.056875, + "platform": "linux", + "uptime": 842.81 + }, + { + "timestamp": 1760360820163, + "memoryTotal": 67427545088, + "memoryUsed": 5152354304, + "memoryFree": 62275190784, + "memoryUsagePercent": 7.641319726642337, + "memoryEfficiency": 92.35868027335766, + "cpuCount": 16, + "cpuLoad": 0.07375, + "platform": "linux", + "uptime": 872.83 + }, + { + "timestamp": 1760360850178, + "memoryTotal": 67427545088, + "memoryUsed": 5351346176, + "memoryFree": 62076198912, + "memoryUsagePercent": 7.9364392831089035, + "memoryEfficiency": 92.06356071689109, + "cpuCount": 16, + "cpuLoad": 0.091875, + "platform": "linux", + "uptime": 902.85 + }, + { + "timestamp": 1760360880207, + "memoryTotal": 67427545088, + "memoryUsed": 5482876928, + "memoryFree": 61944668160, + "memoryUsagePercent": 8.131509045515854, + "memoryEfficiency": 91.86849095448414, + "cpuCount": 16, + "cpuLoad": 0.1075, + "platform": "linux", + "uptime": 932.88 + }, + { + "timestamp": 1760360910238, + "memoryTotal": 67427545088, + "memoryUsed": 5321314304, + "memoryFree": 62106230784, + "memoryUsagePercent": 7.89189981194648, + "memoryEfficiency": 92.10810018805353, + "cpuCount": 16, + "cpuLoad": 0.150625, + "platform": "linux", + "uptime": 962.91 + }, + { + "timestamp": 1760360940268, + "memoryTotal": 67427545088, + "memoryUsed": 5276733440, + "memoryFree": 62150811648, + "memoryUsagePercent": 7.8257831174385935, + "memoryEfficiency": 92.17421688256141, + "cpuCount": 16, + "cpuLoad": 0.14125, + "platform": "linux", + "uptime": 992.94 + }, + { + "timestamp": 1760360970298, + "memoryTotal": 67427545088, + "memoryUsed": 5395881984, + "memoryFree": 62031663104, + "memoryUsagePercent": 8.002489156260708, + "memoryEfficiency": 91.99751084373929, + "cpuCount": 16, + "cpuLoad": 0.128125, + "platform": "linux", + "uptime": 1022.97 + }, + { + "timestamp": 1760361000328, + "memoryTotal": 67427545088, + "memoryUsed": 5242249216, + "memoryFree": 62185295872, + "memoryUsagePercent": 7.77464048136161, + "memoryEfficiency": 92.22535951863838, + "cpuCount": 16, + "cpuLoad": 0.12, + "platform": "linux", + "uptime": 1053 + }, + { + "timestamp": 1760361030355, + "memoryTotal": 67427545088, + "memoryUsed": 5273530368, + "memoryFree": 62154014720, + "memoryUsagePercent": 7.821032726488101, + "memoryEfficiency": 92.1789672735119, + "cpuCount": 16, + "cpuLoad": 0.144375, + "platform": "linux", + "uptime": 1083.03 + }, + { + "timestamp": 1760361060386, + "memoryTotal": 67427545088, + "memoryUsed": 5299892224, + "memoryFree": 62127652864, + "memoryUsagePercent": 7.860129294464283, + "memoryEfficiency": 92.13987070553571, + "cpuCount": 16, + "cpuLoad": 0.168125, + "platform": "linux", + "uptime": 1113.06 + }, + { + "timestamp": 1760361090417, + "memoryTotal": 67427545088, + "memoryUsed": 5348495360, + "memoryFree": 62079049728, + "memoryUsagePercent": 7.93221131366959, + "memoryEfficiency": 92.0677886863304, + "cpuCount": 16, + "cpuLoad": 0.159375, + "platform": "linux", + "uptime": 1143.09 + }, + { + "timestamp": 1760361120447, + "memoryTotal": 67427545088, + "memoryUsed": 5301469184, + "memoryFree": 62126075904, + "memoryUsagePercent": 7.86246804192712, + "memoryEfficiency": 92.13753195807288, + "cpuCount": 16, + "cpuLoad": 0.16625, + "platform": "linux", + "uptime": 1173.12 + }, + { + "timestamp": 1760361150476, + "memoryTotal": 67427545088, + "memoryUsed": 5200199680, + "memoryFree": 62227345408, + "memoryUsagePercent": 7.712277932131735, + "memoryEfficiency": 92.28772206786826, + "cpuCount": 16, + "cpuLoad": 0.140625, + "platform": "linux", + "uptime": 1203.15 + }, + { + "timestamp": 1760361180507, + "memoryTotal": 67427545088, + "memoryUsed": 5346906112, + "memoryFree": 62080638976, + "memoryUsagePercent": 7.929854342200547, + "memoryEfficiency": 92.07014565779946, + "cpuCount": 16, + "cpuLoad": 0.1025, + "platform": "linux", + "uptime": 1233.18 + }, + { + "timestamp": 1760361210537, + "memoryTotal": 67427545088, + "memoryUsed": 5294206976, + "memoryFree": 62133338112, + "memoryUsagePercent": 7.851697654260594, + "memoryEfficiency": 92.14830234573941, + "cpuCount": 16, + "cpuLoad": 0.075, + "platform": "linux", + "uptime": 1263.21 + }, + { + "timestamp": 1760361240567, + "memoryTotal": 67427545088, + "memoryUsed": 5351854080, + "memoryFree": 62075691008, + "memoryUsagePercent": 7.937192542031999, + "memoryEfficiency": 92.062807457968, + "cpuCount": 16, + "cpuLoad": 0.05875, + "platform": "linux", + "uptime": 1293.24 + }, + { + "timestamp": 1760361270596, + "memoryTotal": 67427545088, + "memoryUsed": 5383139328, + "memoryFree": 62044405760, + "memoryUsagePercent": 7.983590861827225, + "memoryEfficiency": 92.01640913817278, + "cpuCount": 16, + "cpuLoad": 0.0625, + "platform": "linux", + "uptime": 1323.27 + }, + { + "timestamp": 1760361300627, + "memoryTotal": 67427545088, + "memoryUsed": 5500768256, + "memoryFree": 61926776832, + "memoryUsagePercent": 8.158043198548786, + "memoryEfficiency": 91.84195680145122, + "cpuCount": 16, + "cpuLoad": 0.10625, + "platform": "linux", + "uptime": 1353.3 + }, + { + "timestamp": 1760361330656, + "memoryTotal": 67427545088, + "memoryUsed": 5221945344, + "memoryFree": 62205599744, + "memoryUsagePercent": 7.74452834844397, + "memoryEfficiency": 92.25547165155604, + "cpuCount": 16, + "cpuLoad": 0.07875, + "platform": "linux", + "uptime": 1383.33 + }, + { + "timestamp": 1760361360686, + "memoryTotal": 67427545088, + "memoryUsed": 5477933056, + "memoryFree": 61949612032, + "memoryUsagePercent": 8.124176920353134, + "memoryEfficiency": 91.87582307964686, + "cpuCount": 16, + "cpuLoad": 0.083125, + "platform": "linux", + "uptime": 1413.36 + }, + { + "timestamp": 1760361390695, + "memoryTotal": 67427545088, + "memoryUsed": 5218832384, + "memoryFree": 62208712704, + "memoryUsagePercent": 7.73991160020564, + "memoryEfficiency": 92.26008839979436, + "cpuCount": 16, + "cpuLoad": 0.083125, + "platform": "linux", + "uptime": 1443.37 + }, + { + "timestamp": 1760361420726, + "memoryTotal": 67427545088, + "memoryUsed": 5236105216, + "memoryFree": 62191439872, + "memoryUsagePercent": 7.7655284782596405, + "memoryEfficiency": 92.23447152174036, "cpuCount": 16, "cpuLoad": 0.055, "platform": "linux", - "uptime": 8698.91 + "uptime": 1473.4 }, { - "timestamp": 1760287116027, - "memoryTotal": 67427549184, - "memoryUsed": 6438293504, - "memoryFree": 60989255680, - "memoryUsagePercent": 9.548461395847015, - "memoryEfficiency": 90.45153860415299, + "timestamp": 1760361450756, + "memoryTotal": 67427545088, + "memoryUsed": 5217619968, + "memoryFree": 62209925120, + "memoryUsagePercent": 7.738113498260185, + "memoryEfficiency": 92.26188650173981, "cpuCount": 16, - "cpuLoad": 0.058125, + "cpuLoad": 0.046875, "platform": "linux", - "uptime": 8728.94 + "uptime": 1503.43 }, { - "timestamp": 1760287146053, - "memoryTotal": 67427549184, - "memoryUsed": 5895090176, - "memoryFree": 61532459008, - "memoryUsagePercent": 8.74285102653391, - "memoryEfficiency": 91.25714897346609, + "timestamp": 1760361480785, + "memoryTotal": 67427545088, + "memoryUsed": 5458677760, + "memoryFree": 61968867328, + "memoryUsagePercent": 8.095619902631565, + "memoryEfficiency": 91.90438009736843, "cpuCount": 16, - "cpuLoad": 0.0875, + "cpuLoad": 0.063125, "platform": "linux", - "uptime": 8758.96 + "uptime": 1533.46 }, { - "timestamp": 1760287176069, - "memoryTotal": 67427549184, - "memoryUsed": 5600022528, - "memoryFree": 61827526656, - "memoryUsagePercent": 8.30524406681066, - "memoryEfficiency": 91.69475593318934, + "timestamp": 1760361510805, + "memoryTotal": 67427545088, + "memoryUsed": 5500264448, + "memoryFree": 61927280640, + "memoryUsagePercent": 8.157296014294424, + "memoryEfficiency": 91.84270398570558, + "cpuCount": 16, + "cpuLoad": 0.10375, + "platform": "linux", + "uptime": 1563.48 + }, + { + "timestamp": 1760361540836, + "memoryTotal": 67427545088, + "memoryUsed": 5507387392, + "memoryFree": 61920157696, + "memoryUsagePercent": 8.167859863223974, + "memoryEfficiency": 91.83214013677602, + "cpuCount": 16, + "cpuLoad": 0.156875, + "platform": "linux", + "uptime": 1593.51 + }, + { + "timestamp": 1760361570867, + "memoryTotal": 67427545088, + "memoryUsed": 5513560064, + "memoryFree": 61913985024, + "memoryUsagePercent": 8.177014389007086, + "memoryEfficiency": 91.82298561099292, + "cpuCount": 16, + "cpuLoad": 0.14, + "platform": "linux", + "uptime": 1623.54 + }, + { + "timestamp": 1760361600897, + "memoryTotal": 67427545088, + "memoryUsed": 5267234816, + "memoryFree": 62160310272, + "memoryUsagePercent": 7.81169596064295, + "memoryEfficiency": 92.18830403935705, + "cpuCount": 16, + "cpuLoad": 0.09875, + "platform": "linux", + "uptime": 1653.57 + }, + { + "timestamp": 1760361630909, + "memoryTotal": 67427545088, + "memoryUsed": 5173825536, + "memoryFree": 62253719552, + "memoryUsagePercent": 7.67316314014935, + "memoryEfficiency": 92.32683685985064, + "cpuCount": 16, + "cpuLoad": 0.065, + "platform": "linux", + "uptime": 1683.58 + }, + { + "timestamp": 1760361660938, + "memoryTotal": 67427545088, + "memoryUsed": 5163433984, + "memoryFree": 62264111104, + "memoryUsagePercent": 7.657751705569554, + "memoryEfficiency": 92.34224829443045, + "cpuCount": 16, + "cpuLoad": 0.04375, + "platform": "linux", + "uptime": 1713.61 + }, + { + "timestamp": 1760361690969, + "memoryTotal": 67427545088, + "memoryUsed": 5168906240, + "memoryFree": 62258638848, + "memoryUsagePercent": 7.66586746299904, + "memoryEfficiency": 92.33413253700095, + "cpuCount": 16, + "cpuLoad": 0.03375, + "platform": "linux", + "uptime": 1743.64 + }, + { + "timestamp": 1760361721000, + "memoryTotal": 67427545088, + "memoryUsed": 5172609024, + "memoryFree": 62254936064, + "memoryUsagePercent": 7.671358963535161, + "memoryEfficiency": 92.32864103646484, + "cpuCount": 16, + "cpuLoad": 0.020625, + "platform": "linux", + "uptime": 1773.67 + }, + { + "timestamp": 1760361751031, + "memoryTotal": 67427545088, + "memoryUsed": 5148254208, + "memoryFree": 62279290880, + "memoryUsagePercent": 7.635238983238956, + "memoryEfficiency": 92.36476101676104, + "cpuCount": 16, + "cpuLoad": 0.016875, + "platform": "linux", + "uptime": 1803.7 + }, + { + "timestamp": 1760361781062, + "memoryTotal": 67427545088, + "memoryUsed": 5156458496, + "memoryFree": 62271086592, + "memoryUsagePercent": 7.647406544714452, + "memoryEfficiency": 92.35259345528554, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 1833.73 + }, + { + "timestamp": 1760361811092, + "memoryTotal": 67427545088, + "memoryUsed": 5153644544, + "memoryFree": 62273900544, + "memoryUsagePercent": 7.64323324729375, + "memoryEfficiency": 92.35676675270625, + "cpuCount": 16, + "cpuLoad": 0.016875, + "platform": "linux", + "uptime": 1863.76 + }, + { + "timestamp": 1760361841122, + "memoryTotal": 67427545088, + "memoryUsed": 5158985728, + "memoryFree": 62268559360, + "memoryUsagePercent": 7.651154615323728, + "memoryEfficiency": 92.34884538467627, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 1893.79 + }, + { + "timestamp": 1760361871152, + "memoryTotal": 67427545088, + "memoryUsed": 5152075776, + "memoryFree": 62275469312, + "memoryUsagePercent": 7.640906649168381, + "memoryEfficiency": 92.35909335083161, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 1923.82 + }, + { + "timestamp": 1760361901182, + "memoryTotal": 67427545088, + "memoryUsed": 5207650304, + "memoryFree": 62219894784, + "memoryUsagePercent": 7.7233277545600565, + "memoryEfficiency": 92.27667224543994, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 1953.85 + }, + { + "timestamp": 1760361931211, + "memoryTotal": 67427545088, + "memoryUsed": 5126438912, + "memoryFree": 62301106176, + "memoryUsagePercent": 7.602885297558232, + "memoryEfficiency": 92.39711470244177, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 1983.88 + }, + { + "timestamp": 1760361961242, + "memoryTotal": 67427545088, + "memoryUsed": 5105246208, + "memoryFree": 62322298880, + "memoryUsagePercent": 7.571454961525174, + "memoryEfficiency": 92.42854503847482, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 2013.91 + }, + { + "timestamp": 1760361991273, + "memoryTotal": 67427545088, + "memoryUsed": 5099569152, + "memoryFree": 62327975936, + "memoryUsagePercent": 7.563035470658955, + "memoryEfficiency": 92.43696452934104, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 2043.94 + }, + { + "timestamp": 1760362021304, + "memoryTotal": 67427545088, + "memoryUsed": 5083242496, + "memoryFree": 62344302592, + "memoryUsagePercent": 7.538821841082656, + "memoryEfficiency": 92.46117815891735, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 2073.98 + }, + { + "timestamp": 1760362051334, + "memoryTotal": 67427545088, + "memoryUsed": 5117214720, + "memoryFree": 62310330368, + "memoryUsagePercent": 7.589205143567809, + "memoryEfficiency": 92.41079485643219, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 2104.01 + }, + { + "timestamp": 1760362081339, + "memoryTotal": 67427545088, + "memoryUsed": 5133008896, + "memoryFree": 62294536192, + "memoryUsagePercent": 7.612629066208604, + "memoryEfficiency": 92.3873709337914, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 2134.01 + }, + { + "timestamp": 1760362111368, + "memoryTotal": 67427545088, + "memoryUsed": 5131767808, + "memoryFree": 62295777280, + "memoryUsagePercent": 7.610788441582006, + "memoryEfficiency": 92.389211558418, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 2164.04 + }, + { + "timestamp": 1760362141399, + "memoryTotal": 67427545088, + "memoryUsed": 5121531904, + "memoryFree": 62306013184, + "memoryUsagePercent": 7.595607844414126, + "memoryEfficiency": 92.40439215558587, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 2194.07 + }, + { + "timestamp": 1760362171430, + "memoryTotal": 67427545088, + "memoryUsed": 5133897728, + "memoryFree": 62293647360, + "memoryUsagePercent": 7.613947269324023, + "memoryEfficiency": 92.38605273067597, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 2224.1 + }, + { + "timestamp": 1760362201461, + "memoryTotal": 67427545088, + "memoryUsed": 5107240960, + "memoryFree": 62320304128, + "memoryUsagePercent": 7.574413325198948, + "memoryEfficiency": 92.42558667480105, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 2254.13 + }, + { + "timestamp": 1760362231492, + "memoryTotal": 67427545088, + "memoryUsed": 5125918720, + "memoryFree": 62301626368, + "memoryUsagePercent": 7.6021138146289315, + "memoryEfficiency": 92.39788618537106, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 2284.16 + }, + { + "timestamp": 1760362261522, + "memoryTotal": 67427545088, + "memoryUsed": 5110714368, + "memoryFree": 62316830720, + "memoryUsagePercent": 7.579564644285927, + "memoryEfficiency": 92.42043535571408, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 2314.19 + }, + { + "timestamp": 1760362291552, + "memoryTotal": 67427545088, + "memoryUsed": 5106737152, + "memoryFree": 62320807936, + "memoryUsagePercent": 7.573666140944585, + "memoryEfficiency": 92.42633385905542, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 2344.22 + }, + { + "timestamp": 1760362321581, + "memoryTotal": 67427545088, + "memoryUsed": 5126066176, + "memoryFree": 62301478912, + "memoryUsagePercent": 7.60233250270338, + "memoryEfficiency": 92.39766749729662, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 2374.25 + }, + { + "timestamp": 1760362351612, + "memoryTotal": 67427545088, + "memoryUsed": 5109047296, + "memoryFree": 62318497792, + "memoryUsagePercent": 7.577092254110926, + "memoryEfficiency": 92.42290774588908, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 2404.28 + }, + { + "timestamp": 1760362381635, + "memoryTotal": 67427545088, + "memoryUsed": 5102952448, + "memoryFree": 62324592640, + "memoryUsagePercent": 7.568053147033773, + "memoryEfficiency": 92.43194685296623, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 2434.31 + }, + { + "timestamp": 1760362411646, + "memoryTotal": 67427545088, + "memoryUsed": 5109960704, + "memoryFree": 62317584384, + "memoryUsagePercent": 7.578446905238752, + "memoryEfficiency": 92.42155309476125, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 2464.32 + }, + { + "timestamp": 1760362441676, + "memoryTotal": 67427545088, + "memoryUsed": 5111136256, + "memoryFree": 62316408832, + "memoryUsagePercent": 7.580190335165596, + "memoryEfficiency": 92.4198096648344, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 2494.35 + }, + { + "timestamp": 1760362471706, + "memoryTotal": 67427545088, + "memoryUsed": 5131087872, + "memoryFree": 62296457216, + "memoryUsagePercent": 7.609780046572055, + "memoryEfficiency": 92.39021995342794, + "cpuCount": 16, + "cpuLoad": 0.024375, + "platform": "linux", + "uptime": 2524.38 + }, + { + "timestamp": 1760362501736, + "memoryTotal": 67427545088, + "memoryUsed": 5124587520, + "memoryFree": 62302957568, + "memoryUsagePercent": 7.600139547290172, + "memoryEfficiency": 92.39986045270983, + "cpuCount": 16, + "cpuLoad": 0.018125, + "platform": "linux", + "uptime": 2554.41 + }, + { + "timestamp": 1760362531766, + "memoryTotal": 67427545088, + "memoryUsed": 5122772992, + "memoryFree": 62304772096, + "memoryUsagePercent": 7.5974484690407245, + "memoryEfficiency": 92.40255153095927, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 2584.44 + }, + { + "timestamp": 1760362561796, + "memoryTotal": 67427545088, + "memoryUsed": 5110128640, + "memoryFree": 62317416448, + "memoryUsagePercent": 7.578695966656872, + "memoryEfficiency": 92.42130403334313, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 2614.47 + }, + { + "timestamp": 1760362591818, + "memoryTotal": 67427545088, + "memoryUsed": 5138604032, + "memoryFree": 62288941056, + "memoryUsagePercent": 7.6209270637001305, + "memoryEfficiency": 92.37907293629986, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 2644.49 + }, + { + "timestamp": 1760362621848, + "memoryTotal": 67427545088, + "memoryUsed": 5184217088, + "memoryFree": 62243328000, + "memoryUsagePercent": 7.688574574729147, + "memoryEfficiency": 92.31142542527085, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 2674.52 + }, + { + "timestamp": 1760362651879, + "memoryTotal": 67427545088, + "memoryUsed": 5114490880, + "memoryFree": 62313054208, + "memoryUsagePercent": 7.58516548885927, + "memoryEfficiency": 92.41483451114073, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 2704.55 + }, + { + "timestamp": 1760362681895, + "memoryTotal": 67427545088, + "memoryUsed": 5132718080, + "memoryFree": 62294827008, + "memoryUsagePercent": 7.612197764728444, + "memoryEfficiency": 92.38780223527155, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 2734.57 + }, + { + "timestamp": 1760362711926, + "memoryTotal": 67427545088, + "memoryUsed": 5137620992, + "memoryFree": 62289924096, + "memoryUsagePercent": 7.619469143203815, + "memoryEfficiency": 92.38053085679618, + "cpuCount": 16, + "cpuLoad": 0.0225, + "platform": "linux", + "uptime": 2764.6 + }, + { + "timestamp": 1760362741957, + "memoryTotal": 67427545088, + "memoryUsed": 5119610880, + "memoryFree": 62307934208, + "memoryUsagePercent": 7.592758824777578, + "memoryEfficiency": 92.40724117522242, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 2794.63 + }, + { + "timestamp": 1760362771985, + "memoryTotal": 67427545088, + "memoryUsed": 5145235456, + "memoryFree": 62282309632, + "memoryUsagePercent": 7.630761952381522, + "memoryEfficiency": 92.36923804761848, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 2824.66 + }, + { + "timestamp": 1760362802016, + "memoryTotal": 67427545088, + "memoryUsed": 5148467200, + "memoryFree": 62279077888, + "memoryUsagePercent": 7.635554866013158, + "memoryEfficiency": 92.36444513398685, + "cpuCount": 16, + "cpuLoad": 0.015625, + "platform": "linux", + "uptime": 2854.69 + }, + { + "timestamp": 1760362832031, + "memoryTotal": 67427545088, + "memoryUsed": 5143404544, + "memoryFree": 62284140544, + "memoryUsagePercent": 7.628046575457136, + "memoryEfficiency": 92.37195342454287, + "cpuCount": 16, + "cpuLoad": 0.009375, + "platform": "linux", + "uptime": 2884.7 + }, + { + "timestamp": 1760362862061, + "memoryTotal": 67427545088, + "memoryUsed": 5160931328, + "memoryFree": 62266613760, + "memoryUsagePercent": 7.654040082972685, + "memoryEfficiency": 92.34595991702732, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 2914.73 + }, + { + "timestamp": 1760362892076, + "memoryTotal": 67427545088, + "memoryUsed": 5159403520, + "memoryFree": 62268141568, + "memoryUsagePercent": 7.651774231534662, + "memoryEfficiency": 92.34822576846534, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 2944.75 + }, + { + "timestamp": 1760362922078, + "memoryTotal": 67427545088, + "memoryUsed": 5149274112, + "memoryFree": 62278270976, + "memoryUsagePercent": 7.636751575753883, + "memoryEfficiency": 92.36324842424612, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 2974.75 + }, + { + "timestamp": 1760362952082, + "memoryTotal": 67427545088, + "memoryUsed": 5147598848, + "memoryFree": 62279946240, + "memoryUsagePercent": 7.634267036241413, + "memoryEfficiency": 92.36573296375859, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 3004.75 + }, + { + "timestamp": 1760362982103, + "memoryTotal": 67427545088, + "memoryUsed": 5142753280, + "memoryFree": 62284791808, + "memoryUsagePercent": 7.6270807031283265, + "memoryEfficiency": 92.37291929687167, + "cpuCount": 16, + "cpuLoad": 0.018125, + "platform": "linux", + "uptime": 3034.78 + }, + { + "timestamp": 1760363012134, + "memoryTotal": 67427545088, + "memoryUsed": 5115793408, + "memoryFree": 62311751680, + "memoryUsagePercent": 7.587097233516888, + "memoryEfficiency": 92.41290276648311, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 3064.81 + }, + { + "timestamp": 1760363042164, + "memoryTotal": 67427545088, + "memoryUsed": 5122166784, + "memoryFree": 62305378304, + "memoryUsagePercent": 7.596549418067997, + "memoryEfficiency": 92.403450581932, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 3094.84 + }, + { + "timestamp": 1760363072194, + "memoryTotal": 67427545088, + "memoryUsed": 5091147776, + "memoryFree": 62336397312, + "memoryUsagePercent": 7.5505459517405225, + "memoryEfficiency": 92.44945404825948, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 3124.87 + }, + { + "timestamp": 1760363102224, + "memoryTotal": 67427545088, + "memoryUsed": 5104193536, + "memoryFree": 62323351552, + "memoryUsagePercent": 7.56989377166037, + "memoryEfficiency": 92.43010622833962, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 3154.9 + }, + { + "timestamp": 1760363132254, + "memoryTotal": 67427545088, + "memoryUsed": 5122985984, + "memoryFree": 62304559104, + "memoryUsagePercent": 7.597764351814925, + "memoryEfficiency": 92.40223564818507, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 3184.93 + }, + { + "timestamp": 1760363162263, + "memoryTotal": 67427545088, + "memoryUsed": 5152632832, + "memoryFree": 62274912256, + "memoryUsagePercent": 7.641732804116293, + "memoryEfficiency": 92.35826719588371, + "cpuCount": 16, + "cpuLoad": 0.021875, + "platform": "linux", + "uptime": 3214.94 + }, + { + "timestamp": 1760363192294, + "memoryTotal": 67427545088, + "memoryUsed": 5113724928, + "memoryFree": 62313820160, + "memoryUsagePercent": 7.5840295258058905, + "memoryEfficiency": 92.41597047419411, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 3244.97 + }, + { + "timestamp": 1760363222324, + "memoryTotal": 67427545088, + "memoryUsed": 5142151168, + "memoryFree": 62285393920, + "memoryUsagePercent": 7.626187726824334, + "memoryEfficiency": 92.37381227317567, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 3275 + }, + { + "timestamp": 1760363252353, + "memoryTotal": 67427545088, + "memoryUsed": 5153419264, + "memoryFree": 62274125824, + "memoryUsagePercent": 7.642899140513344, + "memoryEfficiency": 92.35710085948665, + "cpuCount": 16, + "cpuLoad": 0.015, + "platform": "linux", + "uptime": 3305.03 + }, + { + "timestamp": 1760363282383, + "memoryTotal": 67427545088, + "memoryUsed": 5149499392, + "memoryFree": 62278045696, + "memoryUsagePercent": 7.637085682534289, + "memoryEfficiency": 92.36291431746571, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 3335.06 + }, + { + "timestamp": 1760363312414, + "memoryTotal": 67427545088, + "memoryUsed": 5129973760, + "memoryFree": 62297571328, + "memoryUsagePercent": 7.608127736676232, + "memoryEfficiency": 92.39187226332376, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 3365.09 + }, + { + "timestamp": 1760363342445, + "memoryTotal": 67427545088, + "memoryUsed": 5111078912, + "memoryFree": 62316466176, + "memoryUsagePercent": 7.58010528980331, + "memoryEfficiency": 92.41989471019669, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 3395.12 + }, + { + "timestamp": 1760363372475, + "memoryTotal": 67427545088, + "memoryUsed": 5110087680, + "memoryFree": 62317457408, + "memoryUsagePercent": 7.578635219969526, + "memoryEfficiency": 92.42136478003047, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 3425.15 + }, + { + "timestamp": 1760363402506, + "memoryTotal": 67427545088, + "memoryUsed": 5133332480, + "memoryFree": 62294212608, + "memoryUsagePercent": 7.613108965038641, + "memoryEfficiency": 92.38689103496137, + "cpuCount": 16, + "cpuLoad": 0.015, + "platform": "linux", + "uptime": 3455.18 + }, + { + "timestamp": 1760363432537, + "memoryTotal": 67427545088, + "memoryUsed": 5085462528, + "memoryFree": 62342082560, + "memoryUsagePercent": 7.542114311536835, + "memoryEfficiency": 92.45788568846316, + "cpuCount": 16, + "cpuLoad": 0.018125, + "platform": "linux", + "uptime": 3485.21 + }, + { + "timestamp": 1760363462568, + "memoryTotal": 67427545088, + "memoryUsed": 5102817280, + "memoryFree": 62324727808, + "memoryUsagePercent": 7.56785268296553, + "memoryEfficiency": 92.43214731703446, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 3515.24 + }, + { + "timestamp": 1760363492598, + "memoryTotal": 67427545088, + "memoryUsed": 5117509632, + "memoryFree": 62310035456, + "memoryUsagePercent": 7.589642519716704, + "memoryEfficiency": 92.4103574802833, + "cpuCount": 16, + "cpuLoad": 0.021875, + "platform": "linux", + "uptime": 3545.27 + }, + { + "timestamp": 1760363522629, + "memoryTotal": 67427545088, + "memoryUsed": 5115056128, + "memoryFree": 62312488960, + "memoryUsagePercent": 7.586003793144651, + "memoryEfficiency": 92.41399620685534, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 3575.3 + }, + { + "timestamp": 1760363552660, + "memoryTotal": 67427545088, + "memoryUsed": 5091307520, + "memoryFree": 62336237568, + "memoryUsagePercent": 7.5507828638211745, + "memoryEfficiency": 92.44921713617883, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 3605.33 + }, + { + "timestamp": 1760363582691, + "memoryTotal": 67427545088, + "memoryUsed": 5139734528, + "memoryFree": 62287810560, + "memoryUsagePercent": 7.622603672270893, + "memoryEfficiency": 92.3773963277291, + "cpuCount": 16, + "cpuLoad": 0.015, + "platform": "linux", + "uptime": 3635.36 + }, + { + "timestamp": 1760363612722, + "memoryTotal": 67427545088, + "memoryUsed": 5109280768, + "memoryFree": 62318264320, + "memoryUsagePercent": 7.577438510228801, + "memoryEfficiency": 92.4225614897712, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 3665.39 + }, + { + "timestamp": 1760363642753, + "memoryTotal": 67427545088, + "memoryUsed": 5123571712, + "memoryFree": 62303973376, + "memoryUsagePercent": 7.598633029443979, + "memoryEfficiency": 92.40136697055603, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 3695.43 + }, + { + "timestamp": 1760363672784, + "memoryTotal": 67427545088, + "memoryUsed": 5098729472, + "memoryFree": 62328815616, + "memoryUsagePercent": 7.561790163568352, + "memoryEfficiency": 92.43820983643165, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 3725.46 + }, + { + "timestamp": 1760363702815, + "memoryTotal": 67427545088, + "memoryUsed": 5146664960, + "memoryFree": 62280880128, + "memoryUsagePercent": 7.632882011769913, + "memoryEfficiency": 92.36711798823009, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 3755.49 + }, + { + "timestamp": 1760363732846, + "memoryTotal": 67427545088, + "memoryUsed": 5139566592, + "memoryFree": 62287978496, + "memoryUsagePercent": 7.6223546108527716, + "memoryEfficiency": 92.37764538914723, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 3785.52 + }, + { + "timestamp": 1760363762876, + "memoryTotal": 67427545088, + "memoryUsed": 5081264128, + "memoryFree": 62346280960, + "memoryUsagePercent": 7.535887776083823, + "memoryEfficiency": 92.46411222391617, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 3815.55 + }, + { + "timestamp": 1760363792906, + "memoryTotal": 67427545088, + "memoryUsed": 5102415872, + "memoryFree": 62325129216, + "memoryUsagePercent": 7.567257365429534, + "memoryEfficiency": 92.43274263457046, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 3845.58 + }, + { + "timestamp": 1760363822936, + "memoryTotal": 67427545088, + "memoryUsed": 5086908416, + "memoryFree": 62340636672, + "memoryUsagePercent": 7.544258669600165, + "memoryEfficiency": 92.45574133039983, + "cpuCount": 16, + "cpuLoad": 0.015625, + "platform": "linux", + "uptime": 3875.61 + }, + { + "timestamp": 1760363852967, + "memoryTotal": 67427545088, + "memoryUsed": 5086609408, + "memoryFree": 62340935680, + "memoryUsagePercent": 7.5438152187825365, + "memoryEfficiency": 92.45618478121746, + "cpuCount": 16, + "cpuLoad": 0.009375, + "platform": "linux", + "uptime": 3905.64 + }, + { + "timestamp": 1760363882997, + "memoryTotal": 67427545088, + "memoryUsed": 5107539968, + "memoryFree": 62320005120, + "memoryUsagePercent": 7.574856776016577, + "memoryEfficiency": 92.42514322398343, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 3935.67 + }, + { + "timestamp": 1760363913027, + "memoryTotal": 67427545088, + "memoryUsed": 5071167488, + "memoryFree": 62356377600, + "memoryUsagePercent": 7.52091371765292, + "memoryEfficiency": 92.47908628234708, + "cpuCount": 16, + "cpuLoad": 0.003125, + "platform": "linux", + "uptime": 3965.7 + }, + { + "timestamp": 1760363943058, + "memoryTotal": 67427545088, + "memoryUsed": 5110317056, + "memoryFree": 62317228032, + "memoryUsagePercent": 7.578975401418667, + "memoryEfficiency": 92.42102459858134, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 3995.73 + }, + { + "timestamp": 1760363973089, + "memoryTotal": 67427545088, + "memoryUsed": 5109346304, + "memoryFree": 62318198784, + "memoryUsagePercent": 7.577535704928555, + "memoryEfficiency": 92.42246429507145, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 4025.76 + }, + { + "timestamp": 1760364003120, + "memoryTotal": 67427545088, + "memoryUsed": 5084708864, + "memoryFree": 62342836224, + "memoryUsagePercent": 7.54099657248966, + "memoryEfficiency": 92.45900342751034, + "cpuCount": 16, + "cpuLoad": 0.020625, + "platform": "linux", + "uptime": 4055.79 + }, + { + "timestamp": 1760364033150, + "memoryTotal": 67427545088, + "memoryUsed": 5093515264, + "memoryFree": 62334029824, + "memoryUsagePercent": 7.554057110269148, + "memoryEfficiency": 92.44594288973086, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 4085.82 + }, + { + "timestamp": 1760364063180, + "memoryTotal": 67427545088, + "memoryUsed": 5116780544, + "memoryFree": 62310764544, + "memoryUsagePercent": 7.588561228681938, + "memoryEfficiency": 92.41143877131806, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 4115.85 + }, + { + "timestamp": 1760364093210, + "memoryTotal": 67427545088, + "memoryUsed": 5102804992, + "memoryFree": 62324740096, + "memoryUsagePercent": 7.567834458959326, + "memoryEfficiency": 92.43216554104067, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 4145.88 + }, + { + "timestamp": 1760364123240, + "memoryTotal": 67427545088, + "memoryUsed": 5112266752, + "memoryFree": 62315278336, + "memoryUsagePercent": 7.581866943736358, + "memoryEfficiency": 92.41813305626364, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 4175.91 + }, + { + "timestamp": 1760364153271, + "memoryTotal": 67427545088, + "memoryUsed": 5100249088, + "memoryFree": 62327296000, + "memoryUsagePercent": 7.564043865668907, + "memoryEfficiency": 92.4359561343311, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 4205.94 + }, + { + "timestamp": 1760364183302, + "memoryTotal": 67427545088, + "memoryUsed": 5079564288, + "memoryFree": 62347980800, + "memoryUsagePercent": 7.533366788558944, + "memoryEfficiency": 92.46663321144105, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 4235.97 + }, + { + "timestamp": 1760364213332, + "memoryTotal": 67427545088, + "memoryUsed": 5100417024, + "memoryFree": 62327128064, + "memoryUsagePercent": 7.564292927087027, + "memoryEfficiency": 92.43570707291298, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 4266 + }, + { + "timestamp": 1760364243363, + "memoryTotal": 67427545088, + "memoryUsed": 5099741184, + "memoryFree": 62327803904, + "memoryUsagePercent": 7.563290606745811, + "memoryEfficiency": 92.43670939325419, + "cpuCount": 16, + "cpuLoad": 0.01625, + "platform": "linux", + "uptime": 4296.04 + }, + { + "timestamp": 1760364273393, + "memoryTotal": 67427545088, + "memoryUsed": 5127200768, + "memoryFree": 62300344320, + "memoryUsagePercent": 7.604015185942877, + "memoryEfficiency": 92.39598481405713, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 4326.07 + }, + { + "timestamp": 1760364303423, + "memoryTotal": 67427545088, + "memoryUsed": 5143740416, + "memoryFree": 62283804672, + "memoryUsagePercent": 7.628544698293377, + "memoryEfficiency": 92.37145530170662, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 4356.1 + }, + { + "timestamp": 1760364333454, + "memoryTotal": 67427545088, + "memoryUsed": 5097721856, + "memoryFree": 62329823232, + "memoryUsagePercent": 7.56029579505963, + "memoryEfficiency": 92.43970420494037, + "cpuCount": 16, + "cpuLoad": 0.01625, + "platform": "linux", + "uptime": 4386.13 + }, + { + "timestamp": 1760364363485, + "memoryTotal": 67427545088, + "memoryUsed": 5090693120, + "memoryFree": 62336851968, + "memoryUsagePercent": 7.549871663510978, + "memoryEfficiency": 92.45012833648902, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 4416.16 + }, + { + "timestamp": 1760364393511, + "memoryTotal": 67427545088, + "memoryUsed": 5098881024, + "memoryFree": 62328664064, + "memoryUsagePercent": 7.562014926311535, + "memoryEfficiency": 92.43798507368847, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 4446.18 + }, + { + "timestamp": 1760364423527, + "memoryTotal": 67427545088, + "memoryUsed": 5106139136, + "memoryFree": 62321405952, + "memoryUsagePercent": 7.572779239309327, + "memoryEfficiency": 92.42722076069067, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 4476.2 + }, + { + "timestamp": 1760364453557, + "memoryTotal": 67427545088, + "memoryUsed": 5102817280, + "memoryFree": 62324727808, + "memoryUsagePercent": 7.56785268296553, + "memoryEfficiency": 92.43214731703446, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 4506.23 + }, + { + "timestamp": 1760364483587, + "memoryTotal": 67427545088, + "memoryUsed": 5118644224, + "memoryFree": 62308900864, + "memoryUsagePercent": 7.591325202956201, + "memoryEfficiency": 92.4086747970438, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 4536.26 + }, + { + "timestamp": 1760364513618, + "memoryTotal": 67427545088, + "memoryUsed": 5097353216, + "memoryFree": 62330191872, + "memoryUsagePercent": 7.559749074873512, + "memoryEfficiency": 92.44025092512649, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 4566.29 + }, + { + "timestamp": 1760364543649, + "memoryTotal": 67427545088, + "memoryUsed": 5120081920, + "memoryFree": 62307463168, + "memoryUsagePercent": 7.593457411682062, + "memoryEfficiency": 92.40654258831793, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 4596.32 + }, + { + "timestamp": 1760364573679, + "memoryTotal": 67427545088, + "memoryUsed": 5110509568, + "memoryFree": 62317035520, + "memoryUsagePercent": 7.579260910849195, + "memoryEfficiency": 92.4207390891508, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 4626.35 + }, + { + "timestamp": 1760364603709, + "memoryTotal": 67427545088, + "memoryUsed": 5102407680, + "memoryFree": 62325137408, + "memoryUsagePercent": 7.567245216092065, + "memoryEfficiency": 92.43275478390794, + "cpuCount": 16, + "cpuLoad": 0.014375, + "platform": "linux", + "uptime": 4656.38 + }, + { + "timestamp": 1760364633739, + "memoryTotal": 67427545088, + "memoryUsed": 5123600384, + "memoryFree": 62303944704, + "memoryUsagePercent": 7.598675552125123, + "memoryEfficiency": 92.40132444787488, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 4686.41 + }, + { + "timestamp": 1760364663770, + "memoryTotal": 67427545088, + "memoryUsed": 5148786688, + "memoryFree": 62278758400, + "memoryUsagePercent": 7.636028690174461, + "memoryEfficiency": 92.36397130982554, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 4716.44 + }, + { + "timestamp": 1760364693800, + "memoryTotal": 67427545088, + "memoryUsed": 5105942528, + "memoryFree": 62321602560, + "memoryUsagePercent": 7.572487655210064, + "memoryEfficiency": 92.42751234478993, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 4746.47 + }, + { + "timestamp": 1760364723801, + "memoryTotal": 67427545088, + "memoryUsed": 5108547584, + "memoryFree": 62318997504, + "memoryUsagePercent": 7.576351144525299, + "memoryEfficiency": 92.4236488554747, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 4776.47 + }, + { + "timestamp": 1760364753832, + "memoryTotal": 67427545088, + "memoryUsed": 5085716480, + "memoryFree": 62341828608, + "memoryUsagePercent": 7.542490940998382, + "memoryEfficiency": 92.45750905900162, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 4806.5 + }, + { + "timestamp": 1760364783862, + "memoryTotal": 67427545088, + "memoryUsed": 5124743168, + "memoryFree": 62302801920, + "memoryUsagePercent": 7.600370384702089, + "memoryEfficiency": 92.39962961529791, + "cpuCount": 16, + "cpuLoad": 0.000625, + "platform": "linux", + "uptime": 4836.53 + }, + { + "timestamp": 1760364813892, + "memoryTotal": 67427545088, + "memoryUsed": 5120913408, + "memoryFree": 62306631680, + "memoryUsagePercent": 7.594690569435195, + "memoryEfficiency": 92.4053094305648, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 4866.56 + }, + { + "timestamp": 1760364843923, + "memoryTotal": 67427545088, + "memoryUsed": 5090738176, + "memoryFree": 62336806912, + "memoryUsagePercent": 7.549938484867058, + "memoryEfficiency": 92.45006151513294, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 4896.59 + }, + { + "timestamp": 1760364873953, + "memoryTotal": 67427545088, + "memoryUsed": 5091569664, + "memoryFree": 62335975424, + "memoryUsagePercent": 7.551171642620192, + "memoryEfficiency": 92.44882835737981, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 4926.62 + }, + { + "timestamp": 1760364903983, + "memoryTotal": 67427545088, + "memoryUsed": 5106118656, + "memoryFree": 62321426432, + "memoryUsagePercent": 7.572748865965654, + "memoryEfficiency": 92.42725113403435, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 4956.65 + }, + { + "timestamp": 1760364934014, + "memoryTotal": 67427545088, + "memoryUsed": 5103112192, + "memoryFree": 62324432896, + "memoryUsagePercent": 7.568290059114425, + "memoryEfficiency": 92.43170994088558, + "cpuCount": 16, + "cpuLoad": 0.015, + "platform": "linux", + "uptime": 4986.69 + }, + { + "timestamp": 1760364964044, + "memoryTotal": 67427545088, + "memoryUsed": 5108154368, + "memoryFree": 62319390720, + "memoryUsagePercent": 7.575767976326773, + "memoryEfficiency": 92.42423202367323, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 5016.72 + }, + { + "timestamp": 1760364994074, + "memoryTotal": 67427545088, + "memoryUsed": 5138223104, + "memoryFree": 62289321984, + "memoryUsagePercent": 7.620362119507808, + "memoryEfficiency": 92.3796378804922, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 5046.75 + }, + { + "timestamp": 1760365024105, + "memoryTotal": 67427545088, + "memoryUsed": 5113819136, + "memoryFree": 62313725952, + "memoryUsagePercent": 7.584169243186787, + "memoryEfficiency": 92.41583075681321, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 5076.78 + }, + { + "timestamp": 1760365054135, + "memoryTotal": 67427545088, + "memoryUsed": 5085220864, + "memoryFree": 62342324224, + "memoryUsagePercent": 7.54175590608149, + "memoryEfficiency": 92.45824409391851, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 5106.81 + }, + { + "timestamp": 1760365084165, + "memoryTotal": 67427545088, + "memoryUsed": 5106253824, + "memoryFree": 62321291264, + "memoryUsagePercent": 7.5729493300338975, + "memoryEfficiency": 92.4270506699661, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 5136.84 + }, + { + "timestamp": 1760365114195, + "memoryTotal": 67427545088, + "memoryUsed": 5081239552, + "memoryFree": 62346305536, + "memoryUsagePercent": 7.535851328071415, + "memoryEfficiency": 92.46414867192858, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 5166.87 + }, + { + "timestamp": 1760365144226, + "memoryTotal": 67427545088, + "memoryUsed": 5099372544, + "memoryFree": 62328172544, + "memoryUsagePercent": 7.562743886559692, + "memoryEfficiency": 92.43725611344031, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 5196.9 + }, + { + "timestamp": 1760365174254, + "memoryTotal": 67427545088, + "memoryUsed": 5123260416, + "memoryFree": 62304284672, + "memoryUsagePercent": 7.598171354620146, + "memoryEfficiency": 92.40182864537985, + "cpuCount": 16, + "cpuLoad": 0.020625, + "platform": "linux", + "uptime": 5226.93 + }, + { + "timestamp": 1760365204285, + "memoryTotal": 67427545088, + "memoryUsed": 5080162304, + "memoryFree": 62347382784, + "memoryUsagePercent": 7.534253690194202, + "memoryEfficiency": 92.4657463098058, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 5256.96 + }, + { + "timestamp": 1760365234315, + "memoryTotal": 67427545088, + "memoryUsed": 5093322752, + "memoryFree": 62334222336, + "memoryUsagePercent": 7.55377160083862, + "memoryEfficiency": 92.44622839916138, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 5286.99 + }, + { + "timestamp": 1760365264346, + "memoryTotal": 67427545088, + "memoryUsed": 5088448512, + "memoryFree": 62339096576, + "memoryUsagePercent": 7.546542745044392, + "memoryEfficiency": 92.45345725495561, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 5317.02 + }, + { + "timestamp": 1760365294376, + "memoryTotal": 67427545088, + "memoryUsed": 5091848192, + "memoryFree": 62335696896, + "memoryUsagePercent": 7.551584720094148, + "memoryEfficiency": 92.44841527990584, + "cpuCount": 16, + "cpuLoad": 0.01625, + "platform": "linux", + "uptime": 5347.05 + }, + { + "timestamp": 1760365324406, + "memoryTotal": 67427545088, + "memoryUsed": 5075664896, + "memoryFree": 62351880192, + "memoryUsagePercent": 7.527583703923561, + "memoryEfficiency": 92.47241629607643, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 5377.08 + }, + { + "timestamp": 1760365354437, + "memoryTotal": 67427545088, + "memoryUsed": 5082529792, + "memoryFree": 62345015296, + "memoryUsagePercent": 7.537764848722828, + "memoryEfficiency": 92.46223515127717, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 5407.11 + }, + { + "timestamp": 1760365384467, + "memoryTotal": 67427545088, + "memoryUsed": 5109870592, + "memoryFree": 62317674496, + "memoryUsagePercent": 7.578313262526589, + "memoryEfficiency": 92.42168673747341, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 5437.14 + }, + { + "timestamp": 1760365414498, + "memoryTotal": 67427545088, + "memoryUsed": 5080100864, + "memoryFree": 62347444224, + "memoryUsagePercent": 7.534162570163183, + "memoryEfficiency": 92.46583742983682, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 5467.17 + }, + { + "timestamp": 1760365444529, + "memoryTotal": 67427545088, + "memoryUsed": 5116530688, + "memoryFree": 62311014400, + "memoryUsagePercent": 7.588190673889124, + "memoryEfficiency": 92.41180932611087, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 5497.2 + }, + { + "timestamp": 1760365474560, + "memoryTotal": 67427545088, + "memoryUsed": 5094580224, + "memoryFree": 62332964864, + "memoryUsagePercent": 7.555636524140157, + "memoryEfficiency": 92.44436347585984, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 5527.23 + }, + { + "timestamp": 1760365504590, + "memoryTotal": 67427545088, + "memoryUsed": 5127102464, + "memoryFree": 62300442624, + "memoryUsagePercent": 7.603869393893245, + "memoryEfficiency": 92.39613060610675, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 5557.26 + }, + { + "timestamp": 1760365534620, + "memoryTotal": 67427545088, + "memoryUsed": 5120651264, + "memoryFree": 62306893824, + "memoryUsagePercent": 7.594301790636178, + "memoryEfficiency": 92.40569820936382, + "cpuCount": 16, + "cpuLoad": 0.03625, + "platform": "linux", + "uptime": 5587.29 + }, + { + "timestamp": 1760365564651, + "memoryTotal": 67427545088, + "memoryUsed": 5121437696, + "memoryFree": 62306107392, + "memoryUsagePercent": 7.59546812703323, + "memoryEfficiency": 92.40453187296677, + "cpuCount": 16, + "cpuLoad": 0.021875, + "platform": "linux", + "uptime": 5617.32 + }, + { + "timestamp": 1760365594681, + "memoryTotal": 67427545088, + "memoryUsed": 5102153728, + "memoryFree": 62325391360, + "memoryUsagePercent": 7.566868586630517, + "memoryEfficiency": 92.43313141336948, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 5647.35 + }, + { + "timestamp": 1760365624712, + "memoryTotal": 67427545088, + "memoryUsed": 5110009856, + "memoryFree": 62317535232, + "memoryUsagePercent": 7.578519801263568, + "memoryEfficiency": 92.42148019873643, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 5677.38 + }, + { + "timestamp": 1760365654742, + "memoryTotal": 67427545088, + "memoryUsed": 5142781952, + "memoryFree": 62284763136, + "memoryUsagePercent": 7.627123225809469, + "memoryEfficiency": 92.37287677419053, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 5707.41 + }, + { + "timestamp": 1760365684773, + "memoryTotal": 67427545088, + "memoryUsed": 5100924928, + "memoryFree": 62326620160, + "memoryUsagePercent": 7.565046186010123, + "memoryEfficiency": 92.43495381398988, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 5737.44 + }, + { + "timestamp": 1760365714803, + "memoryTotal": 67427545088, + "memoryUsed": 5119627264, + "memoryFree": 62307917824, + "memoryUsagePercent": 7.5927831234525165, + "memoryEfficiency": 92.40721687654748, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 5767.47 + }, + { + "timestamp": 1760365744834, + "memoryTotal": 67427545088, + "memoryUsed": 5123907584, + "memoryFree": 62303637504, + "memoryUsagePercent": 7.599131152280221, + "memoryEfficiency": 92.40086884771978, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 5797.51 + }, + { + "timestamp": 1760365774864, + "memoryTotal": 67427545088, + "memoryUsed": 5118726144, + "memoryFree": 62308818944, + "memoryUsagePercent": 7.591446696330895, + "memoryEfficiency": 92.40855330366911, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 5827.54 + }, + { + "timestamp": 1760365804895, + "memoryTotal": 67427545088, + "memoryUsed": 5113589760, + "memoryFree": 62313955328, + "memoryUsagePercent": 7.5838290617376485, + "memoryEfficiency": 92.41617093826235, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 5857.57 + }, + { + "timestamp": 1760365834926, + "memoryTotal": 67427545088, + "memoryUsed": 5109809152, + "memoryFree": 62317735936, + "memoryUsagePercent": 7.578222142495569, + "memoryEfficiency": 92.42177785750442, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 5887.6 + }, + { + "timestamp": 1760365864956, + "memoryTotal": 67427545088, + "memoryUsed": 5114314752, + "memoryFree": 62313230336, + "memoryUsagePercent": 7.584904278103681, + "memoryEfficiency": 92.41509572189632, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 5917.63 + }, + { + "timestamp": 1760365894987, + "memoryTotal": 67427545088, + "memoryUsed": 5095895040, + "memoryFree": 62331650048, + "memoryUsagePercent": 7.557586492803978, + "memoryEfficiency": 92.44241350719602, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 5947.66 + }, + { + "timestamp": 1760365925016, + "memoryTotal": 67427545088, + "memoryUsed": 5142999040, + "memoryFree": 62284546048, + "memoryUsagePercent": 7.627445183252406, + "memoryEfficiency": 92.3725548167476, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 5977.69 + }, + { + "timestamp": 1760365955047, + "memoryTotal": 67427545088, + "memoryUsed": 5099888640, + "memoryFree": 62327656448, + "memoryUsagePercent": 7.563509294820257, + "memoryEfficiency": 92.43649070517975, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 6007.72 + }, + { + "timestamp": 1760365985069, + "memoryTotal": 67427545088, + "memoryUsed": 5091414016, + "memoryFree": 62336131072, + "memoryUsagePercent": 7.550940805208276, + "memoryEfficiency": 92.44905919479173, + "cpuCount": 16, + "cpuLoad": 0.015, + "platform": "linux", + "uptime": 6037.74 + }, + { + "timestamp": 1760366015100, + "memoryTotal": 67427545088, + "memoryUsed": 5108424704, + "memoryFree": 62319120384, + "memoryUsagePercent": 7.57616890446326, + "memoryEfficiency": 92.42383109553674, + "cpuCount": 16, + "cpuLoad": 0.009375, + "platform": "linux", + "uptime": 6067.77 + }, + { + "timestamp": 1760366045131, + "memoryTotal": 67427545088, + "memoryUsed": 5098012672, + "memoryFree": 62329532416, + "memoryUsagePercent": 7.5607270965397895, + "memoryEfficiency": 92.4392729034602, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 6097.8 + }, + { + "timestamp": 1760366075161, + "memoryTotal": 67427545088, + "memoryUsed": 5104168960, + "memoryFree": 62323376128, + "memoryUsagePercent": 7.569857323647962, + "memoryEfficiency": 92.43014267635203, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 6127.83 + }, + { + "timestamp": 1760366105192, + "memoryTotal": 67427545088, + "memoryUsed": 5118296064, + "memoryFree": 62309249024, + "memoryUsagePercent": 7.590808856113757, + "memoryEfficiency": 92.40919114388625, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 6157.86 + }, + { + "timestamp": 1760366135221, + "memoryTotal": 67427545088, + "memoryUsed": 5104680960, + "memoryFree": 62322864128, + "memoryUsagePercent": 7.570616657239793, + "memoryEfficiency": 92.4293833427602, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 6187.89 + }, + { + "timestamp": 1760366165252, + "memoryTotal": 67427545088, + "memoryUsed": 5118087168, + "memoryFree": 62309457920, + "memoryUsagePercent": 7.590499048008289, + "memoryEfficiency": 92.40950095199172, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 6217.92 + }, + { + "timestamp": 1760366195282, + "memoryTotal": 67427545088, + "memoryUsed": 5097455616, + "memoryFree": 62330089472, + "memoryUsagePercent": 7.559900941591878, + "memoryEfficiency": 92.44009905840812, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 6247.95 + }, + { + "timestamp": 1760366225313, + "memoryTotal": 67427545088, + "memoryUsed": 5113106432, + "memoryFree": 62314438656, + "memoryUsagePercent": 7.583112250826959, + "memoryEfficiency": 92.41688774917304, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 6277.99 + }, + { + "timestamp": 1760366255314, + "memoryTotal": 67427545088, + "memoryUsed": 5096460288, + "memoryFree": 62331084800, + "memoryUsagePercent": 7.558424797089359, + "memoryEfficiency": 92.44157520291064, + "cpuCount": 16, + "cpuLoad": 0.016875, + "platform": "linux", + "uptime": 6307.99 + }, + { + "timestamp": 1760366285343, + "memoryTotal": 67427545088, + "memoryUsed": 5111259136, + "memoryFree": 62316285952, + "memoryUsagePercent": 7.580372575227634, + "memoryEfficiency": 92.41962742477237, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 6338.01 + }, + { + "timestamp": 1760366315374, + "memoryTotal": 67427545088, + "memoryUsed": 5118644224, + "memoryFree": 62308900864, + "memoryUsagePercent": 7.591325202956201, + "memoryEfficiency": 92.4086747970438, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 6368.05 + }, + { + "timestamp": 1760366345405, + "memoryTotal": 67427545088, + "memoryUsed": 5095600128, + "memoryFree": 62331944960, + "memoryUsagePercent": 7.557149116655084, + "memoryEfficiency": 92.44285088334492, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 6398.08 + }, + { + "timestamp": 1760366375435, + "memoryTotal": 67427545088, + "memoryUsed": 5126098944, + "memoryFree": 62301446144, + "memoryUsagePercent": 7.6023811000532575, + "memoryEfficiency": 92.39761889994674, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 6428.11 + }, + { + "timestamp": 1760366405455, + "memoryTotal": 67427545088, + "memoryUsed": 5119377408, + "memoryFree": 62308167680, + "memoryUsagePercent": 7.592412568659703, + "memoryEfficiency": 92.4075874313403, + "cpuCount": 16, + "cpuLoad": 0.020625, + "platform": "linux", + "uptime": 6458.13 + }, + { + "timestamp": 1760366435486, + "memoryTotal": 67427545088, + "memoryUsed": 5090607104, + "memoryFree": 62336937984, + "memoryUsagePercent": 7.549744095467551, + "memoryEfficiency": 92.45025590453245, + "cpuCount": 16, + "cpuLoad": 0.021875, + "platform": "linux", + "uptime": 6488.16 + }, + { + "timestamp": 1760366465516, + "memoryTotal": 67427545088, + "memoryUsed": 5121511424, + "memoryFree": 62306033664, + "memoryUsagePercent": 7.5955774710704524, + "memoryEfficiency": 92.40442252892954, + "cpuCount": 16, + "cpuLoad": 0.025, + "platform": "linux", + "uptime": 6518.19 + }, + { + "timestamp": 1760366495546, + "memoryTotal": 67427545088, + "memoryUsed": 5092143104, + "memoryFree": 62335401984, + "memoryUsagePercent": 7.552022096243043, + "memoryEfficiency": 92.44797790375696, + "cpuCount": 16, + "cpuLoad": 0.025, + "platform": "linux", + "uptime": 6548.22 + }, + { + "timestamp": 1760366525577, + "memoryTotal": 67427545088, + "memoryUsed": 5104742400, + "memoryFree": 62322802688, + "memoryUsagePercent": 7.570707777270814, + "memoryEfficiency": 92.42929222272919, + "cpuCount": 16, + "cpuLoad": 0.025, + "platform": "linux", + "uptime": 6578.25 + }, + { + "timestamp": 1760366555607, + "memoryTotal": 67427545088, + "memoryUsed": 5110779904, + "memoryFree": 62316765184, + "memoryUsagePercent": 7.579661838985681, + "memoryEfficiency": 92.42033816101431, + "cpuCount": 16, + "cpuLoad": 0.0325, + "platform": "linux", + "uptime": 6608.28 + }, + { + "timestamp": 1760366585637, + "memoryTotal": 67427545088, + "memoryUsed": 5083320320, + "memoryFree": 62344224768, + "memoryUsagePercent": 7.538937259788615, + "memoryEfficiency": 92.46106274021139, + "cpuCount": 16, + "cpuLoad": 0.019375, + "platform": "linux", + "uptime": 6638.31 + }, + { + "timestamp": 1760366615668, + "memoryTotal": 67427545088, + "memoryUsed": 5097738240, + "memoryFree": 62329806848, + "memoryUsagePercent": 7.5603200937345685, + "memoryEfficiency": 92.43967990626543, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 6668.34 + }, + { + "timestamp": 1760366645697, + "memoryTotal": 67427545088, + "memoryUsed": 5114388480, + "memoryFree": 62313156608, + "memoryUsagePercent": 7.585013622140904, + "memoryEfficiency": 92.4149863778591, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 6698.37 + }, + { + "timestamp": 1760366675728, + "memoryTotal": 67427545088, + "memoryUsed": 5101039616, + "memoryFree": 62326505472, + "memoryUsagePercent": 7.565216276734693, + "memoryEfficiency": 92.43478372326531, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 6728.4 + }, + { + "timestamp": 1760366705732, + "memoryTotal": 67427545088, + "memoryUsed": 5098758144, + "memoryFree": 62328786944, + "memoryUsagePercent": 7.561832686249495, + "memoryEfficiency": 92.43816731375051, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 6758.4 + }, + { + "timestamp": 1760366735761, + "memoryTotal": 67427545088, + "memoryUsed": 5086064640, + "memoryFree": 62341480448, + "memoryUsagePercent": 7.543007287840828, + "memoryEfficiency": 92.45699271215918, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 6788.43 + }, + { + "timestamp": 1760366765792, + "memoryTotal": 67427545088, + "memoryUsed": 5142016000, + "memoryFree": 62285529088, + "memoryUsagePercent": 7.625987262756091, + "memoryEfficiency": 92.3740127372439, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 6818.46 + }, + { + "timestamp": 1760366795823, + "memoryTotal": 67427545088, + "memoryUsed": 5093466112, + "memoryFree": 62334078976, + "memoryUsagePercent": 7.553984214244333, + "memoryEfficiency": 92.44601578575566, + "cpuCount": 16, + "cpuLoad": 0.000625, + "platform": "linux", + "uptime": 6848.49 + }, + { + "timestamp": 1760366825853, + "memoryTotal": 67427545088, + "memoryUsed": 5137743872, + "memoryFree": 62289801216, + "memoryUsagePercent": 7.619651383265855, + "memoryEfficiency": 92.38034861673414, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 6878.52 + }, + { + "timestamp": 1760366855883, + "memoryTotal": 67427545088, + "memoryUsed": 5195911168, + "memoryFree": 62231633920, + "memoryUsagePercent": 7.705917753966561, + "memoryEfficiency": 92.29408224603344, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 6908.56 + }, + { + "timestamp": 1760366885913, + "memoryTotal": 67427545088, + "memoryUsed": 5394575360, + "memoryFree": 62032969728, + "memoryUsagePercent": 8.000551336934357, + "memoryEfficiency": 91.99944866306564, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 6938.59 + }, + { + "timestamp": 1760366915944, + "memoryTotal": 67427545088, + "memoryUsed": 5176627200, + "memoryFree": 62250917888, + "memoryUsagePercent": 7.677318213563848, + "memoryEfficiency": 92.32268178643615, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 6968.62 + }, + { + "timestamp": 1760366945974, + "memoryTotal": 67427545088, + "memoryUsed": 5221912576, + "memoryFree": 62205632512, + "memoryUsagePercent": 7.744479751094094, + "memoryEfficiency": 92.25552024890591, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 6998.65 + }, + { + "timestamp": 1760366976004, + "memoryTotal": 67427545088, + "memoryUsed": 5196066816, + "memoryFree": 62231478272, + "memoryUsagePercent": 7.706148591378478, + "memoryEfficiency": 92.29385140862152, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 7028.68 + }, + { + "timestamp": 1760367006035, + "memoryTotal": 67427545088, + "memoryUsed": 5184684032, + "memoryFree": 62242861056, + "memoryUsagePercent": 7.689267086964898, + "memoryEfficiency": 92.3107329130351, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 7058.71 + }, + { + "timestamp": 1760367036066, + "memoryTotal": 67427545088, + "memoryUsed": 5206941696, + "memoryFree": 62220603392, + "memoryUsagePercent": 7.722276836868963, + "memoryEfficiency": 92.27772316313104, + "cpuCount": 16, + "cpuLoad": 0.014375, + "platform": "linux", + "uptime": 7088.74 + }, + { + "timestamp": 1760367066096, + "memoryTotal": 67427545088, + "memoryUsed": 5197332480, + "memoryFree": 62230212608, + "memoryUsagePercent": 7.708025664017483, + "memoryEfficiency": 92.29197433598252, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 7118.77 + }, + { + "timestamp": 1760367096126, + "memoryTotal": 67427545088, + "memoryUsed": 5214003200, + "memoryFree": 62213541888, + "memoryUsagePercent": 7.7327495657674925, + "memoryEfficiency": 92.26725043423251, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 7148.8 + }, + { + "timestamp": 1760367126157, + "memoryTotal": 67427545088, + "memoryUsed": 5198233600, + "memoryFree": 62229311488, + "memoryUsagePercent": 7.7093620911391065, + "memoryEfficiency": 92.29063790886089, + "cpuCount": 16, + "cpuLoad": 0.003125, + "platform": "linux", + "uptime": 7178.83 + }, + { + "timestamp": 1760367156187, + "memoryTotal": 67427545088, + "memoryUsed": 5205291008, + "memoryFree": 62222254080, + "memoryUsagePercent": 7.7198287453689005, + "memoryEfficiency": 92.2801712546311, + "cpuCount": 16, + "cpuLoad": 0.014375, + "platform": "linux", + "uptime": 7208.86 + }, + { + "timestamp": 1760367186199, + "memoryTotal": 67427545088, + "memoryUsed": 5193007104, + "memoryFree": 62234537984, + "memoryUsagePercent": 7.701610813833697, + "memoryEfficiency": 92.2983891861663, + "cpuCount": 16, + "cpuLoad": 0.00875, + "platform": "linux", + "uptime": 7238.87 + }, + { + "timestamp": 1760367216230, + "memoryTotal": 67427545088, + "memoryUsed": 5180325888, + "memoryFree": 62247219200, + "memoryUsagePercent": 7.682803639431233, + "memoryEfficiency": 92.31719636056877, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 7268.9 + }, + { + "timestamp": 1760367246261, + "memoryTotal": 67427545088, + "memoryUsed": 5184704512, + "memoryFree": 62242840576, + "memoryUsagePercent": 7.68929746030857, + "memoryEfficiency": 92.31070253969143, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 7298.93 + }, + { + "timestamp": 1760367276292, + "memoryTotal": 67427545088, + "memoryUsed": 5224931328, + "memoryFree": 62202613760, + "memoryUsagePercent": 7.748956781951527, + "memoryEfficiency": 92.25104321804847, + "cpuCount": 16, + "cpuLoad": 0.008125, + "platform": "linux", + "uptime": 7328.96 + }, + { + "timestamp": 1760367306321, + "memoryTotal": 67427545088, + "memoryUsed": 5231943680, + "memoryFree": 62195601408, + "memoryUsagePercent": 7.759356614825242, + "memoryEfficiency": 92.24064338517476, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 7358.99 + }, + { + "timestamp": 1760367336328, + "memoryTotal": 67427545088, + "memoryUsed": 5397237760, + "memoryFree": 62030307328, + "memoryUsagePercent": 8.004499871611877, + "memoryEfficiency": 91.99550012838813, + "cpuCount": 16, + "cpuLoad": 0.02, + "platform": "linux", + "uptime": 7389 + }, + { + "timestamp": 1760367366356, + "memoryTotal": 67427545088, + "memoryUsed": 5742522368, + "memoryFree": 61685022720, + "memoryUsagePercent": 8.516582296605057, + "memoryEfficiency": 91.48341770339495, + "cpuCount": 16, + "cpuLoad": 0.03625, + "platform": "linux", + "uptime": 7419.03 + }, + { + "timestamp": 1760367396386, + "memoryTotal": 67427545088, + "memoryUsed": 5506805760, + "memoryFree": 61920739328, + "memoryUsagePercent": 8.166997260263654, + "memoryEfficiency": 91.83300273973634, + "cpuCount": 16, + "cpuLoad": 0.073125, + "platform": "linux", + "uptime": 7449.06 + }, + { + "timestamp": 1760367426416, + "memoryTotal": 67427545088, + "memoryUsed": 5510938624, + "memoryFree": 61916606464, + "memoryUsagePercent": 8.17312660101691, + "memoryEfficiency": 91.82687339898308, + "cpuCount": 16, + "cpuLoad": 0.09375, + "platform": "linux", + "uptime": 7479.09 + }, + { + "timestamp": 1760367456446, + "memoryTotal": 67427545088, + "memoryUsed": 5501571072, + "memoryFree": 61925974016, + "memoryUsagePercent": 8.159233833620776, + "memoryEfficiency": 91.84076616637923, + "cpuCount": 16, + "cpuLoad": 0.108125, + "platform": "linux", + "uptime": 7509.12 + }, + { + "timestamp": 1760367486476, + "memoryTotal": 67427545088, + "memoryUsed": 5499551744, + "memoryFree": 61927993344, + "memoryUsagePercent": 8.156239021934596, + "memoryEfficiency": 91.8437609780654, + "cpuCount": 16, + "cpuLoad": 0.105625, + "platform": "linux", + "uptime": 7539.15 + }, + { + "timestamp": 1760367516506, + "memoryTotal": 67427545088, + "memoryUsed": 5559504896, + "memoryFree": 61868040192, + "memoryUsagePercent": 8.245153948203608, + "memoryEfficiency": 91.75484605179639, + "cpuCount": 16, + "cpuLoad": 0.094375, + "platform": "linux", + "uptime": 7569.18 + }, + { + "timestamp": 1760367546512, + "memoryTotal": 67427545088, + "memoryUsed": 5526626304, + "memoryFree": 61900918784, + "memoryUsagePercent": 8.196392582270605, + "memoryEfficiency": 91.8036074177294, + "cpuCount": 16, + "cpuLoad": 0.104375, + "platform": "linux", + "uptime": 7599.18 + }, + { + "timestamp": 1760367576542, + "memoryTotal": 67427545088, + "memoryUsed": 5471641600, + "memoryFree": 61955903488, + "memoryUsagePercent": 8.114846229176718, + "memoryEfficiency": 91.88515377082328, + "cpuCount": 16, + "cpuLoad": 0.131875, + "platform": "linux", + "uptime": 7629.21 + }, + { + "timestamp": 1760367606568, + "memoryTotal": 67427545088, + "memoryUsed": 5469257728, + "memoryFree": 61958287360, + "memoryUsagePercent": 8.111310771973155, + "memoryEfficiency": 91.88868922802685, + "cpuCount": 16, + "cpuLoad": 0.120625, + "platform": "linux", + "uptime": 7659.24 + }, + { + "timestamp": 1760367636571, + "memoryTotal": 67427545088, + "memoryUsed": 5331193856, + "memoryFree": 62096351232, + "memoryUsagePercent": 7.906551912934445, + "memoryEfficiency": 92.09344808706555, + "cpuCount": 16, + "cpuLoad": 0.1, + "platform": "linux", + "uptime": 7689.24 + }, + { + "timestamp": 1760367666601, + "memoryTotal": 67427545088, + "memoryUsed": 5168705536, + "memoryFree": 62258839552, + "memoryUsagePercent": 7.665569804231042, + "memoryEfficiency": 92.33443019576896, + "cpuCount": 16, + "cpuLoad": 0.1, + "platform": "linux", + "uptime": 7719.27 + }, + { + "timestamp": 1760367696632, + "memoryTotal": 67427545088, + "memoryUsed": 5182173184, + "memoryFree": 62245371904, + "memoryUsagePercent": 7.685543315030559, + "memoryEfficiency": 92.31445668496944, + "cpuCount": 16, + "cpuLoad": 0.064375, + "platform": "linux", + "uptime": 7749.3 + }, + { + "timestamp": 1760367726662, + "memoryTotal": 67427545088, + "memoryUsed": 5269041152, + "memoryFree": 62158503936, + "memoryUsagePercent": 7.814374889554928, + "memoryEfficiency": 92.18562511044507, + "cpuCount": 16, + "cpuLoad": 0.041875, + "platform": "linux", + "uptime": 7779.33 + }, + { + "timestamp": 1760367756683, + "memoryTotal": 67427545088, + "memoryUsed": 5473304576, + "memoryFree": 61954240512, + "memoryUsagePercent": 8.117312544682985, + "memoryEfficiency": 91.88268745531701, + "cpuCount": 16, + "cpuLoad": 0.053125, + "platform": "linux", + "uptime": 7809.35 + }, + { + "timestamp": 1760367786713, + "memoryTotal": 67427545088, + "memoryUsed": 5606596608, + "memoryFree": 61820948480, + "memoryUsagePercent": 8.314994414645833, + "memoryEfficiency": 91.68500558535416, + "cpuCount": 16, + "cpuLoad": 0.0775, + "platform": "linux", + "uptime": 7839.38 + }, + { + "timestamp": 1760367816719, + "memoryTotal": 67427545088, + "memoryUsed": 5595140096, + "memoryFree": 61832404992, + "memoryUsagePercent": 8.298003566195028, + "memoryEfficiency": 91.70199643380496, + "cpuCount": 16, + "cpuLoad": 0.105625, + "platform": "linux", + "uptime": 7869.39 + }, + { + "timestamp": 1760367846736, + "memoryTotal": 67427545088, + "memoryUsed": 5494460416, + "memoryFree": 61933084672, + "memoryUsagePercent": 8.14868820869743, + "memoryEfficiency": 91.85131179130256, + "cpuCount": 16, + "cpuLoad": 0.09, + "platform": "linux", + "uptime": 7899.41 + }, + { + "timestamp": 1760367876761, + "memoryTotal": 67427545088, + "memoryUsed": 5443940352, + "memoryFree": 61983604736, + "memoryUsagePercent": 8.073763244524308, + "memoryEfficiency": 91.92623675547568, + "cpuCount": 16, + "cpuLoad": 0.085625, + "platform": "linux", + "uptime": 7929.43 + }, + { + "timestamp": 1760367906792, + "memoryTotal": 67427545088, + "memoryUsed": 5429624832, + "memoryFree": 61997920256, + "memoryUsagePercent": 8.052532277296722, + "memoryEfficiency": 91.94746772270328, + "cpuCount": 16, + "cpuLoad": 0.065625, + "platform": "linux", + "uptime": 7959.46 + }, + { + "timestamp": 1760367936822, + "memoryTotal": 67427545088, + "memoryUsed": 5295595520, + "memoryFree": 62131949568, + "memoryUsagePercent": 7.853756966961638, + "memoryEfficiency": 92.14624303303836, + "cpuCount": 16, + "cpuLoad": 0.04, + "platform": "linux", + "uptime": 7989.49 + }, + { + "timestamp": 1760367966853, + "memoryTotal": 67427545088, + "memoryUsed": 5270667264, + "memoryFree": 62156877824, + "memoryUsagePercent": 7.816786533042583, + "memoryEfficiency": 92.18321346695741, + "cpuCount": 16, + "cpuLoad": 0.02375, + "platform": "linux", + "uptime": 8019.53 + }, + { + "timestamp": 1760367996884, + "memoryTotal": 67427545088, + "memoryUsed": 5286670336, + "memoryFree": 62140874752, + "memoryUsagePercent": 7.840520263788845, + "memoryEfficiency": 92.15947973621115, + "cpuCount": 16, + "cpuLoad": 0.014375, + "platform": "linux", + "uptime": 8049.56 + }, + { + "timestamp": 1760368026915, + "memoryTotal": 67427545088, + "memoryUsed": 5255950336, + "memoryFree": 62171594752, + "memoryUsagePercent": 7.794960248279001, + "memoryEfficiency": 92.205039751721, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 8079.59 + }, + { + "timestamp": 1760368056945, + "memoryTotal": 67427545088, + "memoryUsed": 5290827776, + "memoryFree": 62136717312, + "memoryUsagePercent": 7.846686052554511, + "memoryEfficiency": 92.15331394744548, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 8109.62 + }, + { + "timestamp": 1760368086975, + "memoryTotal": 67427545088, + "memoryUsed": 5263040512, + "memoryFree": 62164504576, + "memoryUsagePercent": 7.805475499858673, + "memoryEfficiency": 92.19452450014133, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 8139.65 + }, + { + "timestamp": 1760368117006, + "memoryTotal": 67427545088, + "memoryUsed": 5277691904, + "memoryFree": 62149853184, + "memoryUsagePercent": 7.827204589922501, + "memoryEfficiency": 92.1727954100775, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 8169.68 + }, + { + "timestamp": 1760368147036, + "memoryTotal": 67427545088, + "memoryUsed": 5274333184, + "memoryFree": 62153211904, + "memoryUsagePercent": 7.822223361560092, + "memoryEfficiency": 92.17777663843991, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 8199.71 + }, + { + "timestamp": 1760368177066, + "memoryTotal": 67427545088, + "memoryUsed": 5273071616, + "memoryFree": 62154473472, + "memoryUsagePercent": 7.82035236358982, + "memoryEfficiency": 92.17964763641018, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 8229.74 + }, + { + "timestamp": 1760368207097, + "memoryTotal": 67427545088, + "memoryUsed": 5318578176, + "memoryFree": 62108966912, + "memoryUsagePercent": 7.887841933231736, + "memoryEfficiency": 92.11215806676826, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 8259.77 + }, + { + "timestamp": 1760368237127, + "memoryTotal": 67427545088, + "memoryUsed": 5324042240, + "memoryFree": 62103502848, + "memoryUsagePercent": 7.895945541323754, + "memoryEfficiency": 92.10405445867625, + "cpuCount": 16, + "cpuLoad": 0.02, + "platform": "linux", + "uptime": 8289.8 + }, + { + "timestamp": 1760368267157, + "memoryTotal": 67427545088, + "memoryUsed": 5478486016, + "memoryFree": 61949059072, + "memoryUsagePercent": 8.124997000632312, + "memoryEfficiency": 91.8750029993677, + "cpuCount": 16, + "cpuLoad": 0.038125, + "platform": "linux", + "uptime": 8319.83 + }, + { + "timestamp": 1760368297187, + "memoryTotal": 67427545088, + "memoryUsed": 5681938432, + "memoryFree": 61745606656, + "memoryUsagePercent": 8.426731871350908, + "memoryEfficiency": 91.57326812864909, + "cpuCount": 16, + "cpuLoad": 0.03625, + "platform": "linux", + "uptime": 8349.86 + }, + { + "timestamp": 1760368327191, + "memoryTotal": 67427545088, + "memoryUsed": 5471645696, + "memoryFree": 61955899392, + "memoryUsagePercent": 8.114852303845453, + "memoryEfficiency": 91.88514769615455, "cpuCount": 16, "cpuLoad": 0.080625, "platform": "linux", - "uptime": 8788.98 + "uptime": 8379.86 }, { - "timestamp": 1760287206100, - "memoryTotal": 67427549184, - "memoryUsed": 5925408768, - "memoryFree": 61502140416, - "memoryUsagePercent": 8.787815721776301, - "memoryEfficiency": 91.2121842782237, + "timestamp": 1760368357221, + "memoryTotal": 67427545088, + "memoryUsed": 5667422208, + "memoryFree": 61760122880, + "memoryUsagePercent": 8.405203245355324, + "memoryEfficiency": 91.59479675464468, "cpuCount": 16, - "cpuLoad": 0.116875, + "cpuLoad": 0.093125, "platform": "linux", - "uptime": 8819.01 + "uptime": 8409.89 }, { - "timestamp": 1760287236125, - "memoryTotal": 67427549184, - "memoryUsed": 5827006464, - "memoryFree": 61600542720, - "memoryUsagePercent": 8.641877888960408, - "memoryEfficiency": 91.35812211103959, + "timestamp": 1760368387225, + "memoryTotal": 67427545088, + "memoryUsed": 5695348736, + "memoryFree": 61732196352, + "memoryUsagePercent": 8.44662033678814, + "memoryEfficiency": 91.55337966321186, "cpuCount": 16, - "cpuLoad": 0.16375, + "cpuLoad": 0.121875, "platform": "linux", - "uptime": 8849.03 + "uptime": 8439.9 + }, + { + "timestamp": 1760368417255, + "memoryTotal": 67427545088, + "memoryUsed": 6010503168, + "memoryFree": 61417041920, + "memoryUsagePercent": 8.914017498569264, + "memoryEfficiency": 91.08598250143073, + "cpuCount": 16, + "cpuLoad": 0.12625, + "platform": "linux", + "uptime": 8469.93 + }, + { + "timestamp": 1760368447285, + "memoryTotal": 67427545088, + "memoryUsed": 6375817216, + "memoryFree": 61051727872, + "memoryUsagePercent": 9.455805053674862, + "memoryEfficiency": 90.54419494632513, + "cpuCount": 16, + "cpuLoad": 0.211875, + "platform": "linux", + "uptime": 8499.96 + }, + { + "timestamp": 1760368477315, + "memoryTotal": 67427545088, + "memoryUsed": 7160803328, + "memoryFree": 60266741760, + "memoryUsagePercent": 10.619997092663544, + "memoryEfficiency": 89.38000290733646, + "cpuCount": 16, + "cpuLoad": 0.1975, + "platform": "linux", + "uptime": 8529.99 + }, + { + "timestamp": 1760368507345, + "memoryTotal": 67427545088, + "memoryUsed": 5936254976, + "memoryFree": 61491290112, + "memoryUsagePercent": 8.803901978416336, + "memoryEfficiency": 91.19609802158367, + "cpuCount": 16, + "cpuLoad": 0.224375, + "platform": "linux", + "uptime": 8560.02 + }, + { + "timestamp": 1760368537375, + "memoryTotal": 67427545088, + "memoryUsed": 5696929792, + "memoryFree": 61730615296, + "memoryUsagePercent": 8.448965158919712, + "memoryEfficiency": 91.55103484108028, + "cpuCount": 16, + "cpuLoad": 0.209375, + "platform": "linux", + "uptime": 8590.05 + }, + { + "timestamp": 1760368567392, + "memoryTotal": 67427545088, + "memoryUsed": 5660827648, + "memoryFree": 61766717440, + "memoryUsagePercent": 8.395423028692543, + "memoryEfficiency": 91.60457697130745, + "cpuCount": 16, + "cpuLoad": 0.17375, + "platform": "linux", + "uptime": 8620.06 + }, + { + "timestamp": 1760368597394, + "memoryTotal": 67427545088, + "memoryUsed": 5646708736, + "memoryFree": 61780836352, + "memoryUsagePercent": 8.374483645564219, + "memoryEfficiency": 91.62551635443577, + "cpuCount": 16, + "cpuLoad": 0.136875, + "platform": "linux", + "uptime": 8650.07 + }, + { + "timestamp": 1760368627424, + "memoryTotal": 67427545088, + "memoryUsed": 5496233984, + "memoryFree": 61931311104, + "memoryUsagePercent": 8.151318540259533, + "memoryEfficiency": 91.84868145974046, + "cpuCount": 16, + "cpuLoad": 0.090625, + "platform": "linux", + "uptime": 8680.1 + }, + { + "timestamp": 1760368657455, + "memoryTotal": 67427545088, + "memoryUsed": 5428187136, + "memoryFree": 61999357952, + "memoryUsagePercent": 8.05040006857086, + "memoryEfficiency": 91.94959993142913, + "cpuCount": 16, + "cpuLoad": 0.055, + "platform": "linux", + "uptime": 8710.13 + }, + { + "timestamp": 1760368687486, + "memoryTotal": 67427545088, + "memoryUsed": 5395369984, + "memoryFree": 62032175104, + "memoryUsagePercent": 8.001729822668878, + "memoryEfficiency": 91.99827017733112, + "cpuCount": 16, + "cpuLoad": 0.036875, + "platform": "linux", + "uptime": 8740.16 + }, + { + "timestamp": 1760368717517, + "memoryTotal": 67427545088, + "memoryUsed": 5372497920, + "memoryFree": 62055047168, + "memoryUsagePercent": 7.967808872454615, + "memoryEfficiency": 92.03219112754539, + "cpuCount": 16, + "cpuLoad": 0.025625, + "platform": "linux", + "uptime": 8770.19 + }, + { + "timestamp": 1760368747547, + "memoryTotal": 67427545088, + "memoryUsed": 5395091456, + "memoryFree": 62032453632, + "memoryUsagePercent": 8.001316745194922, + "memoryEfficiency": 91.99868325480507, + "cpuCount": 16, + "cpuLoad": 0.024375, + "platform": "linux", + "uptime": 8800.22 + }, + { + "timestamp": 1760368777578, + "memoryTotal": 67427545088, + "memoryUsed": 5383704576, + "memoryFree": 62043840512, + "memoryUsagePercent": 7.984429166112607, + "memoryEfficiency": 92.0155708338874, + "cpuCount": 16, + "cpuLoad": 0.014375, + "platform": "linux", + "uptime": 8830.25 + }, + { + "timestamp": 1760368807609, + "memoryTotal": 67427545088, + "memoryUsed": 5363585024, + "memoryFree": 62063960064, + "memoryUsagePercent": 7.954590393288026, + "memoryEfficiency": 92.04540960671197, + "cpuCount": 16, + "cpuLoad": 0.0225, + "platform": "linux", + "uptime": 8860.28 + }, + { + "timestamp": 1760368837640, + "memoryTotal": 67427545088, + "memoryUsed": 5392990208, + "memoryFree": 62034554880, + "memoryUsagePercent": 7.998200440134048, + "memoryEfficiency": 92.00179955986596, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 8890.31 + }, + { + "timestamp": 1760368867671, + "memoryTotal": 67427545088, + "memoryUsed": 5331128320, + "memoryFree": 62096416768, + "memoryUsagePercent": 7.906454718234691, + "memoryEfficiency": 92.0935452817653, + "cpuCount": 16, + "cpuLoad": 0.015625, + "platform": "linux", + "uptime": 8920.34 + }, + { + "timestamp": 1760368897702, + "memoryTotal": 67427545088, + "memoryUsed": 5349363712, + "memoryFree": 62078181376, + "memoryUsagePercent": 7.933499143441335, + "memoryEfficiency": 92.06650085655866, + "cpuCount": 16, + "cpuLoad": 0.01375, + "platform": "linux", + "uptime": 8950.37 + }, + { + "timestamp": 1760368927732, + "memoryTotal": 67427545088, + "memoryUsed": 5340569600, + "memoryFree": 62086975488, + "memoryUsagePercent": 7.92045682966805, + "memoryEfficiency": 92.07954317033195, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 8980.4 + }, + { + "timestamp": 1760368957763, + "memoryTotal": 67427545088, + "memoryUsed": 5377949696, + "memoryFree": 62049595392, + "memoryUsagePercent": 7.975894256540429, + "memoryEfficiency": 92.02410574345957, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 9010.43 + }, + { + "timestamp": 1760368987794, + "memoryTotal": 67427545088, + "memoryUsed": 5350850560, + "memoryFree": 62076694528, + "memoryUsagePercent": 7.935704248192012, + "memoryEfficiency": 92.06429575180799, + "cpuCount": 16, + "cpuLoad": 0.010625, + "platform": "linux", + "uptime": 9040.47 + }, + { + "timestamp": 1760369017825, + "memoryTotal": 67427545088, + "memoryUsed": 5373665280, + "memoryFree": 62053879808, + "memoryUsagePercent": 7.969540153043988, + "memoryEfficiency": 92.030459846956, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 9070.5 + }, + { + "timestamp": 1760369047856, + "memoryTotal": 67427545088, + "memoryUsed": 5356085248, + "memoryFree": 62071459840, + "memoryUsagePercent": 7.943467674834889, + "memoryEfficiency": 92.05653232516511, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 9100.53 + }, + { + "timestamp": 1760369077887, + "memoryTotal": 67427545088, + "memoryUsed": 5336539136, + "memoryFree": 62091005952, + "memoryUsagePercent": 7.9144793556331585, + "memoryEfficiency": 92.08552064436684, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 9130.56 + }, + { + "timestamp": 1760369107917, + "memoryTotal": 67427545088, + "memoryUsed": 5357715456, + "memoryFree": 62069829632, + "memoryUsagePercent": 7.945885392991278, + "memoryEfficiency": 92.05411460700873, + "cpuCount": 16, + "cpuLoad": 0.003125, + "platform": "linux", + "uptime": 9160.59 + }, + { + "timestamp": 1760369137948, + "memoryTotal": 67427545088, + "memoryUsed": 5307125760, + "memoryFree": 62120419328, + "memoryUsagePercent": 7.870857159449667, + "memoryEfficiency": 92.12914284055033, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 9190.62 + }, + { + "timestamp": 1760369167977, + "memoryTotal": 67427545088, + "memoryUsed": 5332357120, + "memoryFree": 62095187968, + "memoryUsagePercent": 7.908277118855085, + "memoryEfficiency": 92.09172288114492, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 9220.65 + }, + { + "timestamp": 1760369198008, + "memoryTotal": 67427545088, + "memoryUsed": 5328695296, + "memoryFree": 62098849792, + "memoryUsagePercent": 7.9028463650063125, + "memoryEfficiency": 92.09715363499369, + "cpuCount": 16, + "cpuLoad": 0.011875, + "platform": "linux", + "uptime": 9250.68 + }, + { + "timestamp": 1760369228037, + "memoryTotal": 67427545088, + "memoryUsed": 5324013568, + "memoryFree": 62103531520, + "memoryUsagePercent": 7.895903018642611, + "memoryEfficiency": 92.10409698135739, + "cpuCount": 16, + "cpuLoad": 0.015625, + "platform": "linux", + "uptime": 9280.71 + }, + { + "timestamp": 1760369258068, + "memoryTotal": 67427545088, + "memoryUsed": 5325856768, + "memoryFree": 62101688320, + "memoryUsagePercent": 7.898636619573201, + "memoryEfficiency": 92.1013633804268, + "cpuCount": 16, + "cpuLoad": 0.01625, + "platform": "linux", + "uptime": 9310.74 + }, + { + "timestamp": 1760369288099, + "memoryTotal": 67427545088, + "memoryUsed": 5343158272, + "memoryFree": 62084386816, + "memoryUsagePercent": 7.924296020308347, + "memoryEfficiency": 92.07570397969165, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 9340.77 + }, + { + "timestamp": 1760369318130, + "memoryTotal": 67427545088, + "memoryUsed": 5320208384, + "memoryFree": 62107336704, + "memoryUsagePercent": 7.890259651388126, + "memoryEfficiency": 92.10974034861188, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 9370.8 + }, + { + "timestamp": 1760369348161, + "memoryTotal": 67427545088, + "memoryUsed": 5348216832, + "memoryFree": 62079328256, + "memoryUsagePercent": 7.931798236195635, + "memoryEfficiency": 92.06820176380437, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 9400.83 + }, + { + "timestamp": 1760369378188, + "memoryTotal": 67427545088, + "memoryUsed": 5347803136, + "memoryFree": 62079741952, + "memoryUsagePercent": 7.931184694653435, + "memoryEfficiency": 92.06881530534656, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 9430.86 + }, + { + "timestamp": 1760369408196, + "memoryTotal": 67427545088, + "memoryUsed": 5316362240, + "memoryFree": 62111182848, + "memoryUsagePercent": 7.8845555374462934, + "memoryEfficiency": 92.11544446255371, + "cpuCount": 16, + "cpuLoad": 0.00625, + "platform": "linux", + "uptime": 9460.87 + }, + { + "timestamp": 1760369438227, + "memoryTotal": 67427545088, + "memoryUsed": 5323153408, + "memoryFree": 62104391680, + "memoryUsagePercent": 7.894627338208336, + "memoryEfficiency": 92.10537266179166, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 9490.9 + }, + { + "timestamp": 1760369468256, + "memoryTotal": 67427545088, + "memoryUsed": 5333368832, + "memoryFree": 62094176256, + "memoryUsagePercent": 7.909777562032542, + "memoryEfficiency": 92.09022243796745, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 9520.93 + }, + { + "timestamp": 1760369498287, + "memoryTotal": 67427545088, + "memoryUsed": 5332992000, + "memoryFree": 62094553088, + "memoryUsagePercent": 7.909218692508955, + "memoryEfficiency": 92.09078130749104, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 9550.96 + }, + { + "timestamp": 1760369528318, + "memoryTotal": 67427545088, + "memoryUsed": 5358981120, + "memoryFree": 62068563968, + "memoryUsagePercent": 7.9477624656302845, + "memoryEfficiency": 92.05223753436971, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 9580.99 + }, + { + "timestamp": 1760369558335, + "memoryTotal": 67427545088, + "memoryUsed": 5350211584, + "memoryFree": 62077333504, + "memoryUsagePercent": 7.934756599869407, + "memoryEfficiency": 92.0652434001306, + "cpuCount": 16, + "cpuLoad": 0.01625, + "platform": "linux", + "uptime": 9611.01 + }, + { + "timestamp": 1760369588365, + "memoryTotal": 67427545088, + "memoryUsed": 5323452416, + "memoryFree": 62104092672, + "memoryUsagePercent": 7.895070789025965, + "memoryEfficiency": 92.10492921097403, + "cpuCount": 16, + "cpuLoad": 0.01, + "platform": "linux", + "uptime": 9641.04 + }, + { + "timestamp": 1760369618395, + "memoryTotal": 67427545088, + "memoryUsed": 5330554880, + "memoryFree": 62096990208, + "memoryUsagePercent": 7.905604264611841, + "memoryEfficiency": 92.09439573538816, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 9671.07 + }, + { + "timestamp": 1760369648426, + "memoryTotal": 67427545088, + "memoryUsed": 5316562944, + "memoryFree": 62110982144, + "memoryUsagePercent": 7.884853196214291, + "memoryEfficiency": 92.1151468037857, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 9701.1 + }, + { + "timestamp": 1760369678457, + "memoryTotal": 67427545088, + "memoryUsed": 5336784896, + "memoryFree": 62090760192, + "memoryUsagePercent": 7.914843835757238, + "memoryEfficiency": 92.08515616424276, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 9731.13 + }, + { + "timestamp": 1760369708487, + "memoryTotal": 67427545088, + "memoryUsed": 5319774208, + "memoryFree": 62107770880, + "memoryUsagePercent": 7.889615736502254, + "memoryEfficiency": 92.11038426349775, + "cpuCount": 16, + "cpuLoad": 0.00125, + "platform": "linux", + "uptime": 9761.16 + }, + { + "timestamp": 1760369738518, + "memoryTotal": 67427545088, + "memoryUsed": 5317152768, + "memoryFree": 62110392320, + "memoryUsagePercent": 7.88572794851208, + "memoryEfficiency": 92.11427205148792, + "cpuCount": 16, + "cpuLoad": 0.013125, + "platform": "linux", + "uptime": 9791.19 + }, + { + "timestamp": 1760369768523, + "memoryTotal": 67427545088, + "memoryUsed": 5367623680, + "memoryFree": 62059921408, + "memoryUsagePercent": 7.960580016660386, + "memoryEfficiency": 92.03941998333961, + "cpuCount": 16, + "cpuLoad": 0.0125, + "platform": "linux", + "uptime": 9821.19 + }, + { + "timestamp": 1760369798554, + "memoryTotal": 67427545088, + "memoryUsed": 5326303232, + "memoryFree": 62101241856, + "memoryUsagePercent": 7.899298758465278, + "memoryEfficiency": 92.10070124153472, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 9851.23 + }, + { + "timestamp": 1760369828562, + "memoryTotal": 67427545088, + "memoryUsed": 5339410432, + "memoryFree": 62088134656, + "memoryUsagePercent": 7.918737698416145, + "memoryEfficiency": 92.08126230158385, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 9881.23 + }, + { + "timestamp": 1760369858593, + "memoryTotal": 67427545088, + "memoryUsed": 5342154752, + "memoryFree": 62085390336, + "memoryUsagePercent": 7.922807726468359, + "memoryEfficiency": 92.07719227353164, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 9911.26 + }, + { + "timestamp": 1760369888607, + "memoryTotal": 67427545088, + "memoryUsed": 5314572288, + "memoryFree": 62112972800, + "memoryUsagePercent": 7.8819009072092525, + "memoryEfficiency": 92.11809909279074, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 9941.28 + }, + { + "timestamp": 1760369918638, + "memoryTotal": 67427545088, + "memoryUsed": 5356503040, + "memoryFree": 62071042048, + "memoryUsagePercent": 7.944087291045824, + "memoryEfficiency": 92.05591270895418, + "cpuCount": 16, + "cpuLoad": 0.003125, + "platform": "linux", + "uptime": 9971.31 + }, + { + "timestamp": 1760369948669, + "memoryTotal": 67427545088, + "memoryUsed": 5333508096, + "memoryFree": 62094036992, + "memoryUsagePercent": 7.909984100769521, + "memoryEfficiency": 92.09001589923048, + "cpuCount": 16, + "cpuLoad": 0.001875, + "platform": "linux", + "uptime": 10001.34 + }, + { + "timestamp": 1760369978699, + "memoryTotal": 67427545088, + "memoryUsed": 5360881664, + "memoryFree": 62066663424, + "memoryUsagePercent": 7.950581111923159, + "memoryEfficiency": 92.04941888807684, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 10031.37 + }, + { + "timestamp": 1760370008730, + "memoryTotal": 67427545088, + "memoryUsed": 5366018048, + "memoryFree": 62061527040, + "memoryUsagePercent": 7.9581987465164055, + "memoryEfficiency": 92.0418012534836, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 10061.4 + }, + { + "timestamp": 1760370038754, + "memoryTotal": 67427545088, + "memoryUsed": 5366136832, + "memoryFree": 62061408256, + "memoryUsagePercent": 7.9583749119097105, + "memoryEfficiency": 92.04162508809029, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 10091.43 + }, + { + "timestamp": 1760370068784, + "memoryTotal": 67427545088, + "memoryUsed": 5329920000, + "memoryFree": 62097625088, + "memoryUsagePercent": 7.904662690957971, + "memoryEfficiency": 92.09533730904202, + "cpuCount": 16, + "cpuLoad": 0.015625, + "platform": "linux", + "uptime": 10121.46 + }, + { + "timestamp": 1760370098814, + "memoryTotal": 67427545088, + "memoryUsed": 5328252928, + "memoryFree": 62099292160, + "memoryUsagePercent": 7.90219030078297, + "memoryEfficiency": 92.09780969921702, + "cpuCount": 16, + "cpuLoad": 0.009375, + "platform": "linux", + "uptime": 10151.49 + }, + { + "timestamp": 1760370128844, + "memoryTotal": 67427545088, + "memoryUsed": 5363216384, + "memoryFree": 62064328704, + "memoryUsagePercent": 7.954043673101907, + "memoryEfficiency": 92.0459563268981, + "cpuCount": 16, + "cpuLoad": 0.005625, + "platform": "linux", + "uptime": 10181.52 + }, + { + "timestamp": 1760370158868, + "memoryTotal": 67427545088, + "memoryUsed": 5343281152, + "memoryFree": 62084263936, + "memoryUsagePercent": 7.924478260370386, + "memoryEfficiency": 92.07552173962961, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 10211.54 + }, + { + "timestamp": 1760370188897, + "memoryTotal": 67427545088, + "memoryUsed": 5489635328, + "memoryFree": 61937909760, + "memoryUsagePercent": 8.14153224892802, + "memoryEfficiency": 91.85846775107198, + "cpuCount": 16, + "cpuLoad": 0.025, + "platform": "linux", + "uptime": 10241.57 + }, + { + "timestamp": 1760370218928, + "memoryTotal": 67427545088, + "memoryUsed": 5515452416, + "memoryFree": 61912092672, + "memoryUsagePercent": 8.17982088596249, + "memoryEfficiency": 91.82017911403751, + "cpuCount": 16, + "cpuLoad": 0.0275, + "platform": "linux", + "uptime": 10271.6 + }, + { + "timestamp": 1760370248958, + "memoryTotal": 67427545088, + "memoryUsed": 5502066688, + "memoryFree": 61925478400, + "memoryUsagePercent": 8.15996886853767, + "memoryEfficiency": 91.84003113146233, + "cpuCount": 16, + "cpuLoad": 0.024375, + "platform": "linux", + "uptime": 10301.63 + }, + { + "timestamp": 1760370278989, + "memoryTotal": 67427545088, + "memoryUsed": 5412798464, + "memoryFree": 62014746624, + "memoryUsagePercent": 8.027577538134796, + "memoryEfficiency": 91.97242246186521, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 10331.66 + }, + { + "timestamp": 1760370309020, + "memoryTotal": 67427545088, + "memoryUsed": 5551112192, + "memoryFree": 61876432896, + "memoryUsagePercent": 8.23270695196632, + "memoryEfficiency": 91.76729304803368, + "cpuCount": 16, + "cpuLoad": 0.04, + "platform": "linux", + "uptime": 10361.69 + }, + { + "timestamp": 1760370339050, + "memoryTotal": 67427545088, + "memoryUsed": 5644275712, + "memoryFree": 61783269376, + "memoryUsagePercent": 8.37087529233584, + "memoryEfficiency": 91.62912470766416, + "cpuCount": 16, + "cpuLoad": 0.028125, + "platform": "linux", + "uptime": 10391.72 + }, + { + "timestamp": 1760370369081, + "memoryTotal": 67427545088, + "memoryUsed": 5615247360, + "memoryFree": 61812297728, + "memoryUsagePercent": 8.327824115013405, + "memoryEfficiency": 91.6721758849866, + "cpuCount": 16, + "cpuLoad": 0.053125, + "platform": "linux", + "uptime": 10421.75 + }, + { + "timestamp": 1760370399112, + "memoryTotal": 67427545088, + "memoryUsed": 5752565760, + "memoryFree": 61674979328, + "memoryUsagePercent": 8.531477384342407, + "memoryEfficiency": 91.46852261565759, + "cpuCount": 16, + "cpuLoad": 0.0675, + "platform": "linux", + "uptime": 10451.78 + }, + { + "timestamp": 1760370429142, + "memoryTotal": 67427545088, + "memoryUsed": 5775548416, + "memoryFree": 61651996672, + "memoryUsagePercent": 8.565562350612506, + "memoryEfficiency": 91.43443764938749, + "cpuCount": 16, + "cpuLoad": 0.0575, + "platform": "linux", + "uptime": 10481.81 + }, + { + "timestamp": 1760370459172, + "memoryTotal": 67427545088, + "memoryUsed": 5880541184, + "memoryFree": 61547003904, + "memoryUsagePercent": 8.721274334287685, + "memoryEfficiency": 91.27872566571232, + "cpuCount": 16, + "cpuLoad": 0.06125, + "platform": "linux", + "uptime": 10511.84 + }, + { + "timestamp": 1760370489203, + "memoryTotal": 67427545088, + "memoryUsed": 5821784064, + "memoryFree": 61605761024, + "memoryUsagePercent": 8.634133211289189, + "memoryEfficiency": 91.3658667887108, + "cpuCount": 16, + "cpuLoad": 0.074375, + "platform": "linux", + "uptime": 10541.87 + }, + { + "timestamp": 1760370519210, + "memoryTotal": 67427545088, + "memoryUsed": 5854228480, + "memoryFree": 61573316608, + "memoryUsagePercent": 8.682250662336319, + "memoryEfficiency": 91.31774933766368, + "cpuCount": 16, + "cpuLoad": 0.07125, + "platform": "linux", + "uptime": 10571.88 + }, + { + "timestamp": 1760370549241, + "memoryTotal": 67427545088, + "memoryUsed": 5776441344, + "memoryFree": 61651103744, + "memoryUsagePercent": 8.566886628396658, + "memoryEfficiency": 91.43311337160334, + "cpuCount": 16, + "cpuLoad": 0.066875, + "platform": "linux", + "uptime": 10601.91 + }, + { + "timestamp": 1760370579251, + "memoryTotal": 67427545088, + "memoryUsed": 5765746688, + "memoryFree": 61661798400, + "memoryUsagePercent": 8.5510256683305, + "memoryEfficiency": 91.4489743316695, + "cpuCount": 16, + "cpuLoad": 0.045, + "platform": "linux", + "uptime": 10631.92 + }, + { + "timestamp": 1760370609282, + "memoryTotal": 67427545088, + "memoryUsed": 5792260096, + "memoryFree": 61635284992, + "memoryUsagePercent": 8.590346999049862, + "memoryEfficiency": 91.40965300095014, + "cpuCount": 16, + "cpuLoad": 0.04, + "platform": "linux", + "uptime": 10661.95 + }, + { + "timestamp": 1760370639303, + "memoryTotal": 67427545088, + "memoryUsed": 5829521408, + "memoryFree": 61598023680, + "memoryUsagePercent": 8.645608260528935, + "memoryEfficiency": 91.35439173947107, + "cpuCount": 16, + "cpuLoad": 0.046875, + "platform": "linux", + "uptime": 10691.98 + }, + { + "timestamp": 1760370669312, + "memoryTotal": 67427545088, + "memoryUsed": 5788909568, + "memoryFree": 61638635520, + "memoryUsagePercent": 8.585377920024921, + "memoryEfficiency": 91.41462207997508, + "cpuCount": 16, + "cpuLoad": 0.053125, + "platform": "linux", + "uptime": 10721.98 + }, + { + "timestamp": 1760370699341, + "memoryTotal": 67427545088, + "memoryUsed": 5837029376, + "memoryFree": 61590515712, + "memoryUsagePercent": 8.65674312831954, + "memoryEfficiency": 91.34325687168047, + "cpuCount": 16, + "cpuLoad": 0.04375, + "platform": "linux", + "uptime": 10752.01 + }, + { + "timestamp": 1760370729372, + "memoryTotal": 67427545088, + "memoryUsed": 6001172480, + "memoryFree": 61426372608, + "memoryUsagePercent": 8.900179403191741, + "memoryEfficiency": 91.09982059680826, + "cpuCount": 16, + "cpuLoad": 0.0825, + "platform": "linux", + "uptime": 10782.04 + }, + { + "timestamp": 1760370759390, + "memoryTotal": 67427545088, + "memoryUsed": 5980979200, + "memoryFree": 61446565888, + "memoryUsagePercent": 8.870231286329936, + "memoryEfficiency": 91.12976871367006, + "cpuCount": 16, + "cpuLoad": 0.121875, + "platform": "linux", + "uptime": 10812.06 + }, + { + "timestamp": 1760370789420, + "memoryTotal": 67427545088, + "memoryUsed": 5972508672, + "memoryFree": 61455036416, + "memoryUsagePercent": 8.857668871386688, + "memoryEfficiency": 91.1423311286133, + "cpuCount": 16, + "cpuLoad": 0.163125, + "platform": "linux", + "uptime": 10842.09 + }, + { + "timestamp": 1760370819449, + "memoryTotal": 67427545088, + "memoryUsed": 6142488576, + "memoryFree": 61285056512, + "memoryUsagePercent": 9.109761549205759, + "memoryEfficiency": 90.89023845079424, + "cpuCount": 16, + "cpuLoad": 0.1525, + "platform": "linux", + "uptime": 10872.12 + }, + { + "timestamp": 1760370849451, + "memoryTotal": 67427545088, + "memoryUsed": 6085455872, + "memoryFree": 61342089216, + "memoryUsagePercent": 9.025177861744549, + "memoryEfficiency": 90.97482213825545, + "cpuCount": 16, + "cpuLoad": 0.1875, + "platform": "linux", + "uptime": 10902.12 + }, + { + "timestamp": 1760370879463, + "memoryTotal": 67427545088, + "memoryUsed": 5972754432, + "memoryFree": 61454790656, + "memoryUsagePercent": 8.858033351510768, + "memoryEfficiency": 91.14196664848923, + "cpuCount": 16, + "cpuLoad": 0.164375, + "platform": "linux", + "uptime": 10932.14 + }, + { + "timestamp": 1760370909494, + "memoryTotal": 67427545088, + "memoryUsed": 6119362560, + "memoryFree": 61308182528, + "memoryUsagePercent": 9.075463969529949, + "memoryEfficiency": 90.92453603047005, + "cpuCount": 16, + "cpuLoad": 0.1275, + "platform": "linux", + "uptime": 10962.17 + }, + { + "timestamp": 1760370939514, + "memoryTotal": 67427545088, + "memoryUsed": 5932773376, + "memoryFree": 61494771712, + "memoryUsagePercent": 8.798738509991889, + "memoryEfficiency": 91.20126149000811, + "cpuCount": 16, + "cpuLoad": 0.115625, + "platform": "linux", + "uptime": 10992.19 + }, + { + "timestamp": 1760370969545, + "memoryTotal": 67427545088, + "memoryUsed": 5926498304, + "memoryFree": 61501046784, + "memoryUsagePercent": 8.789432117490412, + "memoryEfficiency": 91.2105678825096, + "cpuCount": 16, + "cpuLoad": 0.11625, + "platform": "linux", + "uptime": 11022.22 + }, + { + "timestamp": 1760370999563, + "memoryTotal": 67427545088, + "memoryUsed": 5959057408, + "memoryFree": 61468487680, + "memoryUsagePercent": 8.837719659262111, + "memoryEfficiency": 91.1622803407379, + "cpuCount": 16, + "cpuLoad": 0.099375, + "platform": "linux", + "uptime": 11052.24 + }, + { + "timestamp": 1760371029593, + "memoryTotal": 67427545088, + "memoryUsed": 6009909248, + "memoryFree": 61417635840, + "memoryUsagePercent": 8.91313667160274, + "memoryEfficiency": 91.08686332839726, + "cpuCount": 16, + "cpuLoad": 0.113125, + "platform": "linux", + "uptime": 11082.26 + }, + { + "timestamp": 1760371059623, + "memoryTotal": 67427545088, + "memoryUsed": 6262132736, + "memoryFree": 61165412352, + "memoryUsagePercent": 9.287202622944765, + "memoryEfficiency": 90.71279737705524, + "cpuCount": 16, + "cpuLoad": 0.075, + "platform": "linux", + "uptime": 11112.3 + }, + { + "timestamp": 1760371089647, + "memoryTotal": 67427545088, + "memoryUsed": 6634319872, + "memoryFree": 60793225216, + "memoryUsagePercent": 9.839183472187099, + "memoryEfficiency": 90.1608165278129, + "cpuCount": 16, + "cpuLoad": 0.08875, + "platform": "linux", + "uptime": 11142.32 + }, + { + "timestamp": 1760371119670, + "memoryTotal": 67427545088, + "memoryUsed": 6245756928, + "memoryFree": 61181788160, + "memoryUsagePercent": 9.26291609734365, + "memoryEfficiency": 90.73708390265635, + "cpuCount": 16, + "cpuLoad": 0.073125, + "platform": "linux", + "uptime": 11172.34 + }, + { + "timestamp": 1760371149696, + "memoryTotal": 67427545088, + "memoryUsed": 6089191424, + "memoryFree": 61338353664, + "memoryUsagePercent": 9.030717959630547, + "memoryEfficiency": 90.96928204036945, + "cpuCount": 16, + "cpuLoad": 0.06625, + "platform": "linux", + "uptime": 11202.37 + }, + { + "timestamp": 1760371179727, + "memoryTotal": 67427545088, + "memoryUsed": 6258622464, + "memoryFree": 61168922624, + "memoryUsagePercent": 9.281996631839174, + "memoryEfficiency": 90.71800336816082, + "cpuCount": 16, + "cpuLoad": 0.090625, + "platform": "linux", + "uptime": 11232.4 + }, + { + "timestamp": 1760371209735, + "memoryTotal": 67427545088, + "memoryUsed": 6221615104, + "memoryFree": 61205929984, + "memoryUsagePercent": 9.227111999821648, + "memoryEfficiency": 90.77288800017836, + "cpuCount": 16, + "cpuLoad": 0.09125, + "platform": "linux", + "uptime": 11262.41 + }, + { + "timestamp": 1760371239761, + "memoryTotal": 67427545088, + "memoryUsed": 6396284928, + "memoryFree": 61031260160, + "memoryUsagePercent": 9.486160173341887, + "memoryEfficiency": 90.51383982665811, + "cpuCount": 16, + "cpuLoad": 0.104375, + "platform": "linux", + "uptime": 11292.43 + }, + { + "timestamp": 1760371269772, + "memoryTotal": 67427545088, + "memoryUsed": 6342234112, + "memoryFree": 61085310976, + "memoryUsagePercent": 9.4059988447195, + "memoryEfficiency": 90.5940011552805, + "cpuCount": 16, + "cpuLoad": 0.109375, + "platform": "linux", + "uptime": 11322.44 + }, + { + "timestamp": 1760371299775, + "memoryTotal": 67427545088, + "memoryUsed": 6282342400, + "memoryFree": 61145202688, + "memoryUsagePercent": 9.317175038481508, + "memoryEfficiency": 90.68282496151849, + "cpuCount": 16, + "cpuLoad": 0.08, + "platform": "linux", + "uptime": 11352.45 + }, + { + "timestamp": 1760371329788, + "memoryTotal": 67427545088, + "memoryUsed": 6211870720, + "memoryFree": 61215674368, + "memoryUsagePercent": 9.212660362901925, + "memoryEfficiency": 90.78733963709807, + "cpuCount": 16, + "cpuLoad": 0.0525, + "platform": "linux", + "uptime": 11382.46 + }, + { + "timestamp": 1760371359791, + "memoryTotal": 67427545088, + "memoryUsed": 6120026112, + "memoryFree": 61307518976, + "memoryUsagePercent": 9.07644806586496, + "memoryEfficiency": 90.92355193413503, + "cpuCount": 16, + "cpuLoad": 0.0575, + "platform": "linux", + "uptime": 11412.46 + }, + { + "timestamp": 1760371389822, + "memoryTotal": 67427545088, + "memoryUsed": 6331588608, + "memoryFree": 61095956480, + "memoryUsagePercent": 9.390210780678157, + "memoryEfficiency": 90.60978921932184, + "cpuCount": 16, + "cpuLoad": 0.046875, + "platform": "linux", + "uptime": 11442.49 + }, + { + "timestamp": 1760371419852, + "memoryTotal": 67427545088, + "memoryUsed": 6064599040, + "memoryFree": 61362946048, + "memoryUsagePercent": 8.994245648547732, + "memoryEfficiency": 91.00575435145227, + "cpuCount": 16, + "cpuLoad": 0.028125, + "platform": "linux", + "uptime": 11472.52 + }, + { + "timestamp": 1760371449881, + "memoryTotal": 67427545088, + "memoryUsed": 6035775488, + "memoryFree": 61391769600, + "memoryUsagePercent": 8.951498204662029, + "memoryEfficiency": 91.04850179533797, + "cpuCount": 16, + "cpuLoad": 0.02125, + "platform": "linux", + "uptime": 11502.55 + }, + { + "timestamp": 1760371479912, + "memoryTotal": 67427545088, + "memoryUsed": 6051098624, + "memoryFree": 61376446464, + "memoryUsagePercent": 8.97422354039834, + "memoryEfficiency": 91.02577645960166, + "cpuCount": 16, + "cpuLoad": 0.016875, + "platform": "linux", + "uptime": 11532.58 + }, + { + "timestamp": 1760371509943, + "memoryTotal": 67427545088, + "memoryUsed": 6065410048, + "memoryFree": 61362135040, + "memoryUsagePercent": 8.995448432957192, + "memoryEfficiency": 91.00455156704281, + "cpuCount": 16, + "cpuLoad": 0.030625, + "platform": "linux", + "uptime": 11562.61 + }, + { + "timestamp": 1760371539973, + "memoryTotal": 67427545088, + "memoryUsed": 6092414976, + "memoryFree": 61335130112, + "memoryUsagePercent": 9.035498723924713, + "memoryEfficiency": 90.96450127607528, + "cpuCount": 16, + "cpuLoad": 0.01875, + "platform": "linux", + "uptime": 11592.65 + }, + { + "timestamp": 1760371570004, + "memoryTotal": 67427545088, + "memoryUsed": 6134939648, + "memoryFree": 61292605440, + "memoryUsagePercent": 9.098565934727807, + "memoryEfficiency": 90.9014340652722, + "cpuCount": 16, + "cpuLoad": 0.01125, + "platform": "linux", + "uptime": 11622.68 + }, + { + "timestamp": 1760371600035, + "memoryTotal": 67427545088, + "memoryUsed": 6182772736, + "memoryFree": 61244772352, + "memoryUsagePercent": 9.169505916211, + "memoryEfficiency": 90.830494083789, + "cpuCount": 16, + "cpuLoad": 0.006875, + "platform": "linux", + "uptime": 11652.71 + }, + { + "timestamp": 1760371630066, + "memoryTotal": 67427545088, + "memoryUsed": 6135824384, + "memoryFree": 61291720704, + "memoryUsagePercent": 9.09987806317449, + "memoryEfficiency": 90.90012193682551, + "cpuCount": 16, + "cpuLoad": 0.00375, + "platform": "linux", + "uptime": 11682.74 + }, + { + "timestamp": 1760371660095, + "memoryTotal": 67427545088, + "memoryUsed": 6162505728, + "memoryFree": 61265039360, + "memoryUsagePercent": 9.139448455311973, + "memoryEfficiency": 90.86055154468802, + "cpuCount": 16, + "cpuLoad": 0.0075, + "platform": "linux", + "uptime": 11712.77 + }, + { + "timestamp": 1760371690127, + "memoryTotal": 67427545088, + "memoryUsed": 6167527424, + "memoryFree": 61260017664, + "memoryUsagePercent": 9.146895999180648, + "memoryEfficiency": 90.85310400081936, + "cpuCount": 16, + "cpuLoad": 0.004375, + "platform": "linux", + "uptime": 11742.8 + }, + { + "timestamp": 1760371720157, + "memoryTotal": 67427545088, + "memoryUsed": 6139576320, + "memoryFree": 61287968768, + "memoryUsagePercent": 9.105442459735425, + "memoryEfficiency": 90.89455754026457, + "cpuCount": 16, + "cpuLoad": 0.0025, + "platform": "linux", + "uptime": 11772.83 + }, + { + "timestamp": 1760371750188, + "memoryTotal": 67427545088, + "memoryUsed": 6155853824, + "memoryFree": 61271691264, + "memoryUsagePercent": 9.129583193286908, + "memoryEfficiency": 90.8704168067131, + "cpuCount": 16, + "cpuLoad": 0.005, + "platform": "linux", + "uptime": 11802.86 + }, + { + "timestamp": 1760371780219, + "memoryTotal": 67427545088, + "memoryUsed": 6125027328, + "memoryFree": 61302517760, + "memoryUsagePercent": 9.083865236389963, + "memoryEfficiency": 90.91613476361003, + "cpuCount": 16, + "cpuLoad": 0.009375, + "platform": "linux", + "uptime": 11832.89 + }, + { + "timestamp": 1760371810249, + "memoryTotal": 67427545088, + "memoryUsed": 6322176000, + "memoryFree": 61105369088, + "memoryUsagePercent": 9.37625119192594, + "memoryEfficiency": 90.62374880807405, + "cpuCount": 16, + "cpuLoad": 0.04875, + "platform": "linux", + "uptime": 11862.92 + }, + { + "timestamp": 1760371840280, + "memoryTotal": 67427545088, + "memoryUsed": 6190137344, + "memoryFree": 61237407744, + "memoryUsagePercent": 9.180428170595894, + "memoryEfficiency": 90.81957182940411, + "cpuCount": 16, + "cpuLoad": 0.0675, + "platform": "linux", + "uptime": 11892.95 + }, + { + "timestamp": 1760371870309, + "memoryTotal": 67427545088, + "memoryUsed": 6185517056, + "memoryFree": 61242028032, + "memoryUsagePercent": 9.173575944263215, + "memoryEfficiency": 90.82642405573678, + "cpuCount": 16, + "cpuLoad": 0.044375, + "platform": "linux", + "uptime": 11922.98 + }, + { + "timestamp": 1760371900339, + "memoryTotal": 67427545088, + "memoryUsed": 6193422336, + "memoryFree": 61234122752, + "memoryUsagePercent": 9.18530005492108, + "memoryEfficiency": 90.81469994507891, + "cpuCount": 16, + "cpuLoad": 0.036875, + "platform": "linux", + "uptime": 11953.01 } ] \ No newline at end of file diff --git a/.claude-flow/metrics/task-metrics.json b/.claude-flow/metrics/task-metrics.json index 03c8ac78b..cc570bc53 100644 --- a/.claude-flow/metrics/task-metrics.json +++ b/.claude-flow/metrics/task-metrics.json @@ -1,10 +1,10 @@ [ { - "id": "cmd-hooks-1760287244087", + "id": "cmd-hooks-1760371912508", "type": "hooks", "success": true, - "duration": 7.19974400000001, - "timestamp": 1760287244094, + "duration": 7.633822000000009, + "timestamp": 1760371912516, "metadata": {} } ] \ No newline at end of file diff --git a/bin/claude-flow b/bin/claude-flow index e3c71773e..94867cd31 100755 --- a/bin/claude-flow +++ b/bin/claude-flow @@ -1,7 +1,7 @@ #!/bin/sh # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime -VERSION="2.6.0-alpha.2" +VERSION="2.7.0-alpha.4" # Determine the correct path based on how the script is invoked if [ -L "$0" ]; then diff --git a/dist-cjs/src/cli/help-formatter.js b/dist-cjs/src/cli/help-formatter.js index 10faaa6fb..41c6643a9 100644 --- a/dist-cjs/src/cli/help-formatter.js +++ b/dist-cjs/src/cli/help-formatter.js @@ -24,9 +24,6 @@ export class HelpFormatter { if (info.examples && info.examples.length > 0) { sections.push(this.formatSection('EXAMPLES', info.examples)); } - if (info.details) { - sections.push('\n' + info.details); - } if (info.commands && info.commands.length > 0) { sections.push(`Run '${info.name} --help' for more information on a command.`); } @@ -88,4 +85,9 @@ export class HelpFormatter { } } +//# sourceMappingURL=help-formatter.js.map/\s+/g, ' '); + return text; + } +} + //# sourceMappingURL=help-formatter.js.map \ No newline at end of file diff --git a/dist-cjs/src/cli/help-formatter.js.map b/dist-cjs/src/cli/help-formatter.js.map index 9949e1526..3ff8b88e2 100644 --- a/dist-cjs/src/cli/help-formatter.js.map +++ b/dist-cjs/src/cli/help-formatter.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/cli/help-formatter.js"],"sourcesContent":["/**\n * Standardized CLI Help Formatter\n * Follows Unix/Linux conventions for help output\n */\n\nexport class HelpFormatter {\n static INDENT = ' ';\n static COLUMN_GAP = 2;\n static MIN_DESCRIPTION_COLUMN = 25;\n\n /**\n * Format main command help\n */\n static formatHelp(info) {\n const sections = [];\n\n // NAME section\n sections.push(this.formatSection('NAME', [`${info.name} - ${info.description}`]));\n\n // SYNOPSIS section\n if (info.usage) {\n sections.push(this.formatSection('SYNOPSIS', [info.usage]));\n }\n\n // COMMANDS section\n if (info.commands && info.commands.length > 0) {\n sections.push(this.formatSection('COMMANDS', this.formatCommands(info.commands)));\n }\n\n // OPTIONS section\n if (info.options && info.options.length > 0) {\n sections.push(this.formatSection('OPTIONS', this.formatOptions(info.options)));\n }\n\n // GLOBAL OPTIONS section\n if (info.globalOptions && info.globalOptions.length > 0) {\n sections.push(this.formatSection('GLOBAL OPTIONS', this.formatOptions(info.globalOptions)));\n }\n\n // EXAMPLES section\n if (info.examples && info.examples.length > 0) {\n sections.push(this.formatSection('EXAMPLES', info.examples));\n }\n\n // DETAILS section (additional information)\n if (info.details) {\n sections.push('\\n' + info.details);\n }\n\n // Footer\n if (info.commands && info.commands.length > 0) {\n sections.push(`Run '${info.name} --help' for more information on a command.`);\n }\n\n return sections.join('\\n\\n');\n }\n\n /**\n * Format error message with usage hint\n */\n static formatError(error, command, usage) {\n const lines = [`Error: ${error}`, ''];\n\n if (usage) {\n lines.push(`Usage: ${usage}`);\n }\n\n lines.push(`Try '${command} --help' for more information.`);\n\n return lines.join('\\n');\n }\n\n /**\n * Format validation error with valid options\n */\n static formatValidationError(value, paramName, validOptions, command) {\n return this.formatError(\n `'${value}' is not a valid ${paramName}. Valid options are: ${validOptions.join(', ')}.`,\n command,\n );\n }\n\n static formatSection(title, content) {\n return `${title}\\n${content.map((line) => `${this.INDENT}${line}`).join('\\n')}`;\n }\n\n static formatCommands(commands) {\n const maxNameLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...commands.map((cmd) => {\n const nameLength = cmd.name.length;\n const aliasLength = cmd.aliases ? ` (${cmd.aliases.join(', ')})`.length : 0;\n return nameLength + aliasLength;\n }),\n );\n\n return commands.map((cmd) => {\n let name = cmd.name;\n if (cmd.aliases && cmd.aliases.length > 0) {\n name += ` (${cmd.aliases.join(', ')})`;\n }\n const padding = ' '.repeat(maxNameLength - name.length + this.COLUMN_GAP);\n return `${name}${padding}${cmd.description}`;\n });\n }\n\n static formatOptions(options) {\n const maxFlagsLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...options.map((opt) => opt.flags.length),\n );\n\n return options.map((opt) => {\n const padding = ' '.repeat(maxFlagsLength - opt.flags.length + this.COLUMN_GAP);\n let description = opt.description;\n\n // Add default value\n if (opt.defaultValue !== undefined) {\n description += ` [default: ${opt.defaultValue}]`;\n }\n\n // Add valid values on next line if present\n if (opt.validValues && opt.validValues.length > 0) {\n const validValuesLine =\n ' '.repeat(maxFlagsLength + this.COLUMN_GAP) + `Valid: ${opt.validValues.join(', ')}`;\n return `${opt.flags}${padding}${description}\\n${this.INDENT}${validValuesLine}`;\n }\n\n return `${opt.flags}${padding}${description}`;\n });\n }\n\n /**\n * Strip ANSI color codes and emojis from text\n */\n static stripFormatting(text) {\n // Remove ANSI color codes\n text = text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\n // Remove common emojis used in the CLI\n const emojiPattern =\n /[\\u{1F300}-\\u{1F9FF}]|[\\u{2600}-\\u{27BF}]|[\\u{1F000}-\\u{1F6FF}]|[\\u{1F680}-\\u{1F6FF}]/gu;\n text = text.replace(emojiPattern, '').trim();\n\n // Remove multiple spaces\n text = text.replace(/\\s+/g, ' ');\n\n return text;\n }\n}\n"],"names":["HelpFormatter","INDENT","COLUMN_GAP","MIN_DESCRIPTION_COLUMN","formatHelp","info","sections","push","formatSection","name","description","usage","commands","length","formatCommands","options","formatOptions","globalOptions","examples","details","join","formatError","error","command","lines","formatValidationError","value","paramName","validOptions","title","content","map","line","maxNameLength","Math","max","cmd","nameLength","aliasLength","aliases","padding","repeat","maxFlagsLength","opt","flags","defaultValue","undefined","validValues","validValuesLine","stripFormatting","text","replace","emojiPattern","trim"],"mappings":"AAKA,OAAO,MAAMA;IACX,OAAOC,SAAS,OAAO;IACvB,OAAOC,aAAa,EAAE;IACtB,OAAOC,yBAAyB,GAAG;IAKnC,OAAOC,WAAWC,IAAI,EAAE;QACtB,MAAMC,WAAW,EAAE;QAGnBA,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,QAAQ;YAAC,GAAGH,KAAKI,IAAI,CAAC,GAAG,EAAEJ,KAAKK,WAAW,EAAE;SAAC;QAG/E,IAAIL,KAAKM,KAAK,EAAE;YACdL,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,YAAY;gBAACH,KAAKM,KAAK;aAAC;QAC3D;QAGA,IAAIN,KAAKO,QAAQ,IAAIP,KAAKO,QAAQ,CAACC,MAAM,GAAG,GAAG;YAC7CP,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,YAAY,IAAI,CAACM,cAAc,CAACT,KAAKO,QAAQ;QAChF;QAGA,IAAIP,KAAKU,OAAO,IAAIV,KAAKU,OAAO,CAACF,MAAM,GAAG,GAAG;YAC3CP,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,WAAW,IAAI,CAACQ,aAAa,CAACX,KAAKU,OAAO;QAC7E;QAGA,IAAIV,KAAKY,aAAa,IAAIZ,KAAKY,aAAa,CAACJ,MAAM,GAAG,GAAG;YACvDP,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,kBAAkB,IAAI,CAACQ,aAAa,CAACX,KAAKY,aAAa;QAC1F;QAGA,IAAIZ,KAAKa,QAAQ,IAAIb,KAAKa,QAAQ,CAACL,MAAM,GAAG,GAAG;YAC7CP,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,YAAYH,KA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,GAAGJ,UAAU9B,YAAY,EAAE,EAAE,IAAI,CAACT,MAAM,GAAG+C,iBAAiB;YACjF;YAEA,OAAO,GAAGL,IAAIC,KAAK,GAAGJ,UAAU9B,aAAa;QAC/C;IACF;IAKA,OAAOuC,gBAAgBC,IAAI,EAAE;QAE3BA,OAAOA,KAAKC,OAAO,CAAC,mBAAmB;QAGvC,MAAMC,eACJ;QACFF,OAAOA,KAAKC,OAAO,CAACC,cAAc,IAAIC,IAAI;QAG1CH,OAAOA,KAAKC,OAAO,CAAC,QAAQ;QAE5B,OAAOD;IACT;AACF"} \ No newline at end of file +{"version":3,"sources":["../../../src/cli/help-formatter.ts"],"sourcesContent":["/**\n * Standardized CLI Help Formatter\n * Follows Unix/Linux conventions for help output\n */\n\nexport interface CommandInfo {\n name: string;\n description: string;\n usage?: string;\n commands?: CommandItem[];\n options?: OptionItem[];\n examples?: string[];\n globalOptions?: OptionItem[];\n}\n\nexport interface CommandItem {\n name: string;\n description: string;\n aliases?: string[];\n}\n\nexport interface OptionItem {\n flags: string;\n description: string;\n defaultValue?: string;\n validValues?: string[];\n}\n\nexport class HelpFormatter {\n private static readonly INDENT = ' ';\n private static readonly COLUMN_GAP = 2;\n private static readonly MIN_DESCRIPTION_COLUMN = 25;\n\n /**\n * Format main command help\n */\n static formatHelp(info: CommandInfo): string {\n const sections: string[] = [];\n\n // NAME section\n sections.push(this.formatSection('NAME', [`${info.name} - ${info.description}`]));\n\n // SYNOPSIS section\n if (info.usage) {\n sections.push(this.formatSection('SYNOPSIS', [info.usage]));\n }\n\n // COMMANDS section\n if (info.commands && info.commands.length > 0) {\n sections.push(this.formatSection('COMMANDS', this.formatCommands(info.commands)));\n }\n\n // OPTIONS section\n if (info.options && info.options.length > 0) {\n sections.push(this.formatSection('OPTIONS', this.formatOptions(info.options)));\n }\n\n // GLOBAL OPTIONS section\n if (info.globalOptions && info.globalOptions.length > 0) {\n sections.push(this.formatSection('GLOBAL OPTIONS', this.formatOptions(info.globalOptions)));\n }\n\n // EXAMPLES section\n if (info.examples && info.examples.length > 0) {\n sections.push(this.formatSection('EXAMPLES', info.examples));\n }\n\n // Footer\n if (info.commands && info.commands.length > 0) {\n sections.push(`Run '${info.name} --help' for more information on a command.`);\n }\n\n return sections.join('\\n\\n');\n }\n\n /**\n * Format error message with usage hint\n */\n static formatError(error: string, command: string, usage?: string): string {\n const lines: string[] = [`Error: ${error}`, ''];\n\n if (usage) {\n lines.push(`Usage: ${usage}`);\n }\n\n lines.push(`Try '${command} --help' for more information.`);\n\n return lines.join('\\n');\n }\n\n /**\n * Format validation error with valid options\n */\n static formatValidationError(\n value: string,\n paramName: string,\n validOptions: string[],\n command: string,\n ): string {\n return this.formatError(\n `'${value}' is not a valid ${paramName}. Valid options are: ${validOptions.join(', ')}.`,\n command,\n );\n }\n\n private static formatSection(title: string, content: string[]): string {\n return `${title}\\n${content.map((line) => `${this.INDENT}${line}`).join('\\n')}`;\n }\n\n private static formatCommands(commands: CommandItem[]): string[] {\n const maxNameLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...commands.map((cmd) => {\n const nameLength = cmd.name.length;\n const aliasLength = cmd.aliases ? ` (${cmd.aliases.join(', ')})`.length : 0;\n return nameLength + aliasLength;\n }),\n );\n\n return commands.map((cmd) => {\n let name = cmd.name;\n if (cmd.aliases && cmd.aliases.length > 0) {\n name += ` (${cmd.aliases.join(', ')})`;\n }\n const padding = ' '.repeat(maxNameLength - name.length + this.COLUMN_GAP);\n return `${name}${padding}${cmd.description}`;\n });\n }\n\n private static formatOptions(options: OptionItem[]): string[] {\n const maxFlagsLength = Math.max(\n this.MIN_DESCRIPTION_COLUMN,\n ...options.map((opt) => opt.flags.length),\n );\n\n return options.map((opt) => {\n const padding = ' '.repeat(maxFlagsLength - opt.flags.length + this.COLUMN_GAP);\n let description = opt.description;\n\n // Add default value\n if (opt.defaultValue !== undefined) {\n description += ` [default: ${opt.defaultValue}]`;\n }\n\n // Add valid values on next line if present\n if (opt.validValues && opt.validValues.length > 0) {\n const validValuesLine =\n ' '.repeat(maxFlagsLength + this.COLUMN_GAP) + `Valid: ${opt.validValues.join(', ')}`;\n return `${opt.flags}${padding}${description}\\n${this.INDENT}${validValuesLine}`;\n }\n\n return `${opt.flags}${padding}${description}`;\n });\n }\n\n /**\n * Strip ANSI color codes and emojis from text\n */\n static stripFormatting(text: string): string {\n // Remove ANSI color codes\n text = text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\n // Remove common emojis used in the CLI\n const emojiPattern =\n /[\\u{1F300}-\\u{1F9FF}]|[\\u{2600}-\\u{27BF}]|[\\u{1F000}-\\u{1F6FF}]|[\\u{1F680}-\\u{1F6FF}]/gu;\n text = text.replace(emojiPattern, '').trim();\n\n // Remove multiple spaces\n text = text.replace(/\\s+/g, ' ');\n\n return text;\n }\n}\n"],"names":["HelpFormatter","INDENT","COLUMN_GAP","MIN_DESCRIPTION_COLUMN","formatHelp","info","sections","push","formatSection","name","description","usage","commands","length","formatCommands","options","formatOptions","globalOptions","examples","join","formatError","error","command","lines","formatValidationError","value","paramName","validOptions","title","content","map","line","maxNameLength","Math","max","cmd","nameLength","aliasLength","aliases","padding","repeat","maxFlagsLength","opt","flags","defaultValue","undefined","validValues","validValuesLine","stripFormatting","text","replace","emojiPattern","trim"],"mappings":"AA4BA,OAAO,MAAMA;IACX,OAAwBC,SAAS,OAAO;IACxC,OAAwBC,aAAa,EAAE;IACvC,OAAwBC,yBAAyB,GAAG;IAKpD,OAAOC,WAAWC,IAAiB,EAAU;QAC3C,MAAMC,WAAqB,EAAE;QAG7BA,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,QAAQ;YAAC,GAAGH,KAAKI,IAAI,CAAC,GAAG,EAAEJ,KAAKK,WAAW,EAAE;SAAC;QAG/E,IAAIL,KAAKM,KAAK,EAAE;YACdL,SAASC,IAAI,CAAC,IAAI,CAACC,aAAa,CAAC,YAAY;gBAACH,KAAKM,KAAK;aAAC;QAC3D;QAGA,IAAIN,KAAK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C,KAAK,CAAC9B,MAAM;QAG1C,OAAOE,QAAQe,GAAG,CAAC,CAACY;YAClB,MAAMH,UAAU,IAAIC,MAAM,CAACC,iBAAiBC,IAAIC,KAAK,CAAC9B,MAAM,GAAG,IAAI,CAACX,UAAU;YAC9E,IAAIQ,cAAcgC,IAAIhC,WAAW;YAGjC,IAAIgC,IAAIE,YAAY,KAAKC,WAAW;gBAClCnC,eAAe,CAAC,WAAW,EAAEgC,IAAIE,YAAY,CAAC,CAAC,CAAC;YAClD;YAGA,IAAIF,IAAII,WAAW,IAAIJ,IAAII,WAAW,CAACjC,MAAM,GAAG,GAAG;gBACjD,MAAMkC,kBACJ,IAAIP,MAAM,CAACC,iBAAiB,IAAI,CAACvC,UAAU,IAAI,CAAC,OAAO,EAAEwC,IAAII,WAAW,CAAC3B,IAAI,CAAC,OAAO;gBACvF,OAAO,GAAGuB,IAAIC,KAAK,GAAGJ,UAAU7B,YAAY,EAAE,EAAE,IAAI,CAACT,MAAM,GAAG8C,iBAAiB;YACjF;YAEA,OAAO,GAAGL,IAAIC,KAAK,GAAGJ,UAAU7B,aAAa;QAC/C;IACF;IAKA,OAAOsC,gBAAgBC,IAAY,EAAU;QAE3CA,OAAOA,KAAKC,OAAO,CAAC,mBAAmB;QAGvC,MAAMC,eACJ;QACFF,OAAOA,KAAKC,OAAO,CAACC,cAAc,IAAIC,IAAI;QAG1CH,OAAOA,KAAKC,OAAO,CAAC,QAAQ;QAE5B,OAAOD;IACT;AACF"} \ No newline at end of file diff --git a/dist-cjs/src/cli/simple-commands/config.js.map b/dist-cjs/src/cli/simple-commands/config.js.map index 74f418a15..cdaa46351 100644 --- a/dist-cjs/src/cli/simple-commands/config.js.map +++ b/dist-cjs/src/cli/simple-commands/config.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../src/cli/simple-commands/config.ts"],"sourcesContent":["/**\n * Config CLI Commands - Manage provider configuration\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { ProviderManager } from '../../execution/provider-manager.js';\n\nexport function createConfigCommand(): Command {\n const config = new Command('config')\n .description('Manage provider configuration');\n\n // config set-provider command\n config\n .command('set-provider')\n .description('Set default provider')\n .argument('', 'Provider name (anthropic, openrouter, onnx, gemini)')\n .option('-m, --model ', 'Default model for provider')\n .action(async (provider, options) => {\n try {\n const manager = new ProviderManager();\n\n await manager.setDefaultProvider(provider);\n\n if (options.model) {\n await manager.configureProvider(provider, {\n model: options.model,\n enabled: true,\n } as any);\n }\n\n console.log(chalk.green(`āœ“ Default provider set to: ${provider}`));\n if (options.model) {\n console.log(chalk.green(`āœ“ Default model set to: ${options.model}`));\n }\n } catch (error: any) {\n console.error(chalk.red('āœ— Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config list-providers command\n config\n .command('list-providers')\n .alias('list')\n .description('List configured providers')\n .option('-f, --format ', 'Output format (text, json)', 'text')\n .action(async (options) => {\n try {\n const manager = new ProviderManager();\n const providers = manager.listProviders();\n const defaultProvider = manager.getDefaultProvider();\n\n if (options.format === 'json') {\n console.log(JSON.stringify({ defaultProvider, providers }, null, 2));\n } else {\n console.log(chalk.cyan('\\nšŸ“‹ Configured Providers:\\n'));\n console.log(chalk.white(`Default: ${chalk.bold(defaultProvider)}\\n`));\n\n providers.forEach(provider => {\n const isDefault = provider.name === defaultProvider;\n const prefix = isDefault ? chalk.green('ā—') : chalk.gray('ā—‹');\n const status = provider.enabled ? chalk.green('enabled') : chalk.gray('disabled');\n\n console.log(`${prefix} ${chalk.bold(provider.name)}`);\n console.log(` Model: ${provider.model || 'default'}`);\n console.log(` Priority: ${provider.priority || 'balanced'}`);\n console.log(` Status: ${status}`);\n console.log('');\n });\n }\n } catch (error: any) {\n console.error(chalk.red('āœ— Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config wizard command\n config\n .command('wizard')\n .description('Interactive provider configuration wizard')\n .action(async () => {\n try {\n const manager = new ProviderManager();\n\n console.log(chalk.cyan('\\nšŸ§™ Provider Configuration Wizard\\n'));\n\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'defaultProvider',\n message: 'Select default provider:',\n choices: [\n { name: 'Anthropic (Highest quality)', value: 'anthropic' },\n { name: 'OpenRouter (99% cost savings)', value: 'openrouter' },\n { name: 'ONNX (Free local inference)', value: 'onnx' },\n { name: 'Gemini (Free tier)', value: 'gemini' },\n ],\n },\n {\n type: 'list',\n name: 'optimization',\n message: 'Optimization priority:',\n choices: [\n { name: 'Balanced (recommended)', value: 'balanced' },\n { name: 'Cost (cheapest)', value: 'cost' },\n { name: 'Quality (best results)', value: 'quality' },\n { name: 'Speed (fastest)', value: 'speed' },\n { name: 'Privacy (local only)', value: 'privacy' },\n ],\n },\n ]);\n\n await manager.setDefaultProvider(answers.defaultProvider);\n\n console.log(chalk.green('\\nāœ“ Configuration saved successfully!'));\n console.log(chalk.gray(`\\nDefault provider: ${answers.defaultProvider}`));\n console.log(chalk.gray(`Optimization: ${answers.optimization}`));\n } catch (error: any) {\n console.error(chalk.red('\\nāœ— Error:'), error.message);\n process.exit(1);\n }\n });\n\n return config;\n}\n"],"names":["Command","chalk","inquirer","ProviderManager","createConfigCommand","config","description","command","argument","option","action","provider","options","manager","setDefaultProvider","model","configureProvider","enabled","console","log","green","error","red","message","process","exit","alias","providers","listProviders","defaultProvider","getDefaultProvider","format","JSON","stringify","cyan","white","bold","forEach","isDefault","name","prefix","gray","status","priority","answers","prompt","type","choices","value","optimization"],"mappings":"AAIA,SAASA,OAAO,QAAQ,YAAY;AACpC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,WAAW;AAChC,SAASC,eAAe,QAAQ,sCAAsC;AAEtE,OAAO,SAASC;IACd,MAAMC,SAAS,IAAIL,QAAQ,UACxBM,WAAW,CAAC;IAGfD,OACGE,OAAO,CAAC,gBACRD,WAAW,CAAC,wBACZE,QAAQ,CAAC,cAAc,uDACvBC,MAAM,CAAC,uBAAuB,8BAC9BC,MAAM,CAAC,OAAOC,UAAUC;QACv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,OAAO;wBAAQ;wBAC1C;4BAAET,MAAM;4BAAwBS,OAAO;wBAAU;qBAClD;gBACH;aACD;YAED,MAAMnC,QAAQC,kBAAkB,CAAC8B,QAAQf,eAAe;YAExDX,QAAQC,GAAG,CAAClB,MAAMmB,KAAK,CAAC;YACxBF,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,oBAAoB,EAAEG,QAAQf,eAAe,EAAE;YACvEX,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,cAAc,EAAEG,QAAQK,YAAY,EAAE;QAChE,EAAE,OAAO5B,OAAY;YACnBH,QAAQG,KAAK,CAACpB,MAAMqB,GAAG,CAAC,eAAeD,MAAME,OAAO;YACpDC,QAAQC,IAAI,CAAC;QACf;IACF;IAEF,OAAOpB;AACT"}lags) {\n const force = subArgs.includes('--force') || subArgs.includes('-f');\n\n if (!force) {\n printWarning('This will reset configuration to defaults');\n console.log('Use --force to confirm reset');\n return;\n }\n\n await initConfig(['--force'], flags);\n printSuccess('Configuration reset to defaults');\n}\n\n// Helper functions\nfunction getNestedValue(obj, path) {\n return path.split('.').reduce((current, key) => current?.[key], obj);\n}\n\nfunction setNestedValue(obj, path, value) {\n const keys = path.split('.');\n const last = keys.pop();\n const target = keys.reduce((current, key) => {\n if (!current[key]) current[key] = {};\n return current[key];\n }, obj);\n target[last] = value;\n}\n\nfunction getFlag(args, flagName) {\n const index = args.indexOf(flagName);\n return index !== -1 && index + 1 < args.length ? args[index + 1] : null;\n}\n\n// fileExists is now imported from utils.js\n\nfunction showConfigHelp() {\n console.log('Configuration commands:');\n console.log(' init [--force] Create default configuration');\n console.log(' show [--format json] Display current configuration');\n console.log(' get Get configuration value');\n console.log(' set Set configuration value');\n console.log(' validate Validate configuration');\n console.log(' reset --force Reset to defaults');\n console.log();\n console.log('Configuration Keys:');\n console.log(' terminal.poolSize Terminal pool size');\n console.log(' terminal.recycleAfter Commands before recycle');\n console.log(' orchestrator.maxConcurrentTasks Max parallel tasks');\n console.log(' orchestrator.taskTimeout Task timeout in ms');\n console.log(' memory.backend Memory storage backend');\n console.log(' memory.path Memory database path');\n console.log(' agents.maxAgents Maximum number of agents');\n console.log();\n console.log('Examples:');\n console.log(' claude-flow config init');\n console.log(' claude-flow config set terminal.poolSize 15');\n console.log(' claude-flow config get orchestrator.maxConcurrentTasks');\n console.log(' claude-flow config validate');\n}\n"],"names":["printSuccess","printError","printWarning","readJsonFile","writeJsonFile","fileExists","configCommand","subArgs","flags","configCmd","initConfig","showConfig","getConfigValue","setConfigValue","validateConfig","resetConfig","showConfigHelp","force","includes","configFile","exists","console","log","defaultConfig","version","terminal","poolSize","recycleAfter","healthCheckInterval","type","orchestrator","maxConcurrentTasks","taskTimeout","defaultPriority","memory","backend","path","cacheSize","indexing","agents","maxAgents","defaultCapabilities","resourceLimits","cpu","mcp","port","host","timeout","logging","level","file","maxSize","maxFiles","err","message","format","getFlag","config","JSON","stringify","key","value","getNestedValue","undefined","parsedValue","isNaN","trim","Number","setNestedValue","errors","warnings","requiredSections","section","push","length","forEach","error","warning","obj","split","reduce","current","keys","last","pop","target","args","flagName","index","indexOf"],"mappings":"AACA,SACEA,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,UAAU,QACL,cAAc;AAErB,OAAO,eAAeC,cAAcC,OAAO,EAAEC,KAAK;IAChD,MAAMC,YAAYF,OAAO,CAAC,EAAE;IAE5B,OAAQE;QACN,KAAK;YACH,MAAMC,WAAWH,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMG,WAAWJ,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMI,eAAeL,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMK,eAAeN,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMM,eAAeP,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMO,YAAYR,SAASC;YAC3B;QAEF;YACEQ;IACJ;AACF;AAEA,eAAeN,WAAWH,OAAO,EAAEC,KAAK;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D,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"} \ No newline at end of file +{"version":3,"sources":["../../../../src/cli/simple-commands/config.js"],"sourcesContent":["// config.js - Configuration management commands\nimport {\n printSuccess,\n printError,\n printWarning,\n readJsonFile,\n writeJsonFile,\n fileExists,\n} from '../utils.js';\n\nexport async function configCommand(subArgs, flags) {\n const configCmd = subArgs[0];\n\n switch (configCmd) {\n case 'init':\n await initConfig(subArgs, flags);\n break;\n\n case 'show':\n await showConfig(subArgs, flags);\n break;\n\n case 'get':\n await getConfigValue(subArgs, flags);\n break;\n\n case 'set':\n await setConfigValue(subArgs, flags);\n break;\n\n case 'validate':\n await validateConfig(subArgs, flags);\n break;\n\n case 'reset':\n await resetConfig(subArgs, flags);\n break;\n\n default:\n showConfigHelp();\n }\n}\n\nasync function initConfig(subArgs, flags) {\n const force = subArgs.includes('--force') || subArgs.includes('-f');\n const configFile = 'claude-flow.config.json';\n\n try {\n // Check if config already exists\n const exists = await fileExists(configFile);\n if (exists && !force) {\n printWarning('Configuration file already exists');\n console.log('Use --force to overwrite existing configuration');\n return;\n }\n\n printSuccess('Initializing Claude-Flow configuration...');\n\n // Create default configuration\n const defaultConfig = {\n version: '1.0.71',\n terminal: {\n poolSize: 10,\n recycleAfter: 20,\n healthCheckInterval: 30000,\n type: 'auto',\n },\n orchestrator: {\n maxConcurrentTasks: 10,\n taskTimeout: 300000,\n defaultPriority: 5,\n },\n memory: {\n backend: 'json',\n path: './memory/claude-flow-data.json',\n cacheSize: 1000,\n indexing: true,\n },\n agents: {\n maxAgents: 20,\n defaultCapabilities: ['research', 'code', 'terminal'],\n resourceLimits: {\n memory: '1GB',\n cpu: '50%',\n },\n },\n mcp: {\n port: 3000,\n host: 'localhost',\n timeout: 30000,\n },\n logging: {\n level: 'info',\n file: './claude-flow.log',\n maxSize: '10MB',\n maxFiles: 5,\n },\n };\n\n await writeJsonFile(configFile, defaultConfig);\n console.log(`āœ“ Created ${configFile}`);\n console.log('āœ“ Default settings configured');\n console.log('\\nNext steps:');\n console.log('1. Review settings: claude-flow config show');\n console.log('2. Customize values: claude-flow config set ');\n console.log('3. Validate config: claude-flow config validate');\n } catch (err) {\n printError(`Failed to initialize configuration: ${err.message}`);\n }\n}\n\nasync function showConfig(subArgs, flags) {\n const configFile = 'claude-flow.config.json';\n const format = getFlag(subArgs, '--format') || 'pretty';\n\n try {\n const config = await readJsonFile(configFile);\n\n printSuccess('Current configuration:');\n\n if (format === 'json') {\n console.log(JSON.stringify(config, null, 2));\n } else {\n // Pretty format\n console.log('\\nšŸ“‹ System Configuration:');\n console.log(` Version: ${config.version || 'unknown'}`);\n console.log('\\nšŸ–„ļø Terminal Pool:');\n console.log(` Pool Size: ${config.terminal?.poolSize || 10}`);\n console.log(` Recycle After: ${config.terminal?.recycleAfter || 20} commands`);\n console.log(` Health Check: ${config.terminal?.healthCheckInterval || 30000}ms`);\n console.log('\\nšŸŽ­ Orchestrator:');\n console.log(` Max Concurrent Tasks: ${config.orchestrator?.maxConcurrentTasks || 10}`);\n console.log(` Task Timeout: ${config.orchestrator?.taskTimeout || 300000}ms`);\n console.log('\\nšŸ’¾ Memory:');\n console.log(` Backend: ${config.memory?.backend || 'json'}`);\n console.log(` Path: ${config.memory?.path || './memory/claude-flow-data.json'}`);\n console.log('\\nšŸ¤– Agents:');\n console.log(` Max Agents: ${config.agents?.maxAgents || 20}`);\n console.log(` Resource Limits: ${JSON.stringify(config.agents?.resourceLimits || {})}`);\n }\n } catch (err) {\n printError('Configuration file not found');\n console.log('Run \"claude-flow config init\" to create default configuration');\n }\n}\n\nasync function getConfigValue(subArgs, flags) {\n const key = subArgs[1];\n const configFile = 'claude-flow.config.json';\n\n if (!key) {\n printError('Usage: config get ');\n console.log('Examples:');\n console.log(' claude-flow config get terminal.poolSize');\n console.log(' claude-flow config get orchestrator.maxConcurrentTasks');\n return;\n }\n\n try {\n const config = await readJsonFile(configFile);\n const value = getNestedValue(config, key);\n\n if (value !== undefined) {\n console.log(`${key}: ${JSON.stringify(value)}`);\n } else {\n printWarning(`Configuration key '${key}' not found`);\n }\n } catch (err) {\n printError('Configuration file not found');\n console.log('Run \"claude-flow config init\" to create configuration');\n }\n}\n\nasync function setConfigValue(subArgs, flags) {\n const key = subArgs[1];\n const value = subArgs[2];\n const configFile = 'claude-flow.config.json';\n\n if (!key || value === undefined) {\n printError('Usage: config set ');\n console.log('Examples:');\n console.log(' claude-flow config set terminal.poolSize 15');\n console.log(' claude-flow config set orchestrator.taskTimeout 600000');\n return;\n }\n\n try {\n let config = await readJsonFile(configFile, {});\n\n // Parse value appropriately\n let parsedValue = value;\n if (value === 'true') parsedValue = true;\n else if (value === 'false') parsedValue = false;\n else if (!isNaN(value) && value.trim() !== '') parsedValue = Number(value);\n\n // Set nested value\n setNestedValue(config, key, parsedValue);\n\n await writeJsonFile(configFile, config);\n printSuccess(`Set ${key} = ${JSON.stringify(parsedValue)}`);\n } catch (err) {\n printError(`Failed to set configuration: ${err.message}`);\n }\n}\n\nasync function validateConfig(subArgs, flags) {\n const configFile = 'claude-flow.config.json';\n\n try {\n const config = await readJsonFile(configFile);\n\n printSuccess('Validating configuration...');\n\n const errors = [];\n const warnings = [];\n\n // Validate required sections\n const requiredSections = ['terminal', 'orchestrator', 'memory'];\n for (const section of requiredSections) {\n if (!config[section]) {\n errors.push(`Missing required section: ${section}`);\n }\n }\n\n // Validate specific values\n if (\n config.terminal?.poolSize &&\n (config.terminal.poolSize < 1 || config.terminal.poolSize > 100)\n ) {\n warnings.push('Terminal pool size should be between 1 and 100');\n }\n\n if (config.orchestrator?.maxConcurrentTasks && config.orchestrator.maxConcurrentTasks < 1) {\n errors.push('Max concurrent tasks must be at least 1');\n }\n\n if (config.agents?.maxAgents && config.agents.maxAgents < 1) {\n errors.push('Max agents must be at least 1');\n }\n\n // Report results\n if (errors.length === 0 && warnings.length === 0) {\n printSuccess('āœ… Configuration is valid');\n } else {\n if (errors.length > 0) {\n printError(`Found ${errors.length} error(s):`);\n errors.forEach((error) => console.log(` āŒ ${error}`));\n }\n\n if (warnings.length > 0) {\n printWarning(`Found ${warnings.length} warning(s):`);\n warnings.forEach((warning) => console.log(` āš ļø ${warning}`));\n }\n }\n } catch (err) {\n printError('Configuration file not found or invalid');\n console.log('Run \"claude-flow config init\" to create valid configuration');\n }\n}\n\nasync function resetConfig(subArgs, flags) {\n const force = subArgs.includes('--force') || subArgs.includes('-f');\n\n if (!force) {\n printWarning('This will reset configuration to defaults');\n console.log('Use --force to confirm reset');\n return;\n }\n\n await initConfig(['--force'], flags);\n printSuccess('Configuration reset to defaults');\n}\n\n// Helper functions\nfunction getNestedValue(obj, path) {\n return path.split('.').reduce((current, key) => current?.[key], obj);\n}\n\nfunction setNestedValue(obj, path, value) {\n const keys = path.split('.');\n const last = keys.pop();\n const target = keys.reduce((current, key) => {\n if (!current[key]) current[key] = {};\n return current[key];\n }, obj);\n target[last] = value;\n}\n\nfunction getFlag(args, flagName) {\n const index = args.indexOf(flagName);\n return index !== -1 && index + 1 < args.length ? args[index + 1] : null;\n}\n\n// fileExists is now imported from utils.js\n\nfunction showConfigHelp() {\n console.log('Configuration commands:');\n console.log(' init [--force] Create default configuration');\n console.log(' show [--format json] Display current configuration');\n console.log(' get Get configuration value');\n console.log(' set Set configuration value');\n console.log(' validate Validate configuration');\n console.log(' reset --force Reset to defaults');\n console.log();\n console.log('Configuration Keys:');\n console.log(' terminal.poolSize Terminal pool size');\n console.log(' terminal.recycleAfter Commands before recycle');\n console.log(' orchestrator.maxConcurrentTasks Max parallel tasks');\n console.log(' orchestrator.taskTimeout Task timeout in ms');\n console.log(' memory.backend Memory storage backend');\n console.log(' memory.path Memory database path');\n console.log(' agents.maxAgents Maximum number of agents');\n console.log();\n console.log('Examples:');\n console.log(' claude-flow config init');\n console.log(' claude-flow config set terminal.poolSize 15');\n console.log(' claude-flow config get orchestrator.maxConcurrentTasks');\n console.log(' claude-flow config validate');\n}\n"],"names":["printSuccess","printError","printWarning","readJsonFile","writeJsonFile","fileExists","configCommand","subArgs","flags","configCmd","initConfig","showConfig","getConfigValue","setConfigValue","validateConfig","resetConfig","showConfigHelp","force","includes","configFile","exists","console","log","defaultConfig","version","terminal","poolSize","recycleAfter","healthCheckInterval","type","orchestrator","maxConcurrentTasks","taskTimeout","defaultPriority","memory","backend","path","cacheSize","indexing","agents","maxAgents","defaultCapabilities","resourceLimits","cpu","mcp","port","host","timeout","logging","level","file","maxSize","maxFiles","err","message","format","getFlag","config","JSON","stringify","key","value","getNestedValue","undefined","parsedValue","isNaN","trim","Number","setNestedValue","errors","warnings","requiredSections","section","push","length","forEach","error","warning","obj","split","reduce","current","keys","last","pop","target","args","flagName","index","indexOf"],"mappings":"AACA,SACEA,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,UAAU,QACL,cAAc;AAErB,OAAO,eAAeC,cAAcC,OAAO,EAAEC,KAAK;IAChD,MAAMC,YAAYF,OAAO,CAAC,EAAE;IAE5B,OAAQE;QACN,KAAK;YACH,MAAMC,WAAWH,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMG,WAAWJ,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMI,eAAeL,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMK,eAAeN,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMM,eAAeP,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMO,YAAYR,SAASC;YAC3B;QAEF;Y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C;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"} \ No newline at end of file diff --git a/dist-cjs/src/cli/simple-commands/init/index.js b/dist-cjs/src/cli/simple-commands/init/index.js index 08d5730cd..2cd4f7e9a 100644 --- a/dist-cjs/src/cli/simple-commands/init/index.js +++ b/dist-cjs/src/cli/simple-commands/init/index.js @@ -1273,6 +1273,39 @@ ${commands.map((cmd)=>`- [${cmd}](./${cmd}.md)`).join('\n')} await fs.writeFile(`${workingDir}/memory/sessions/README.md`, createSessionsReadme(), 'utf8'); printSuccess('āœ“ Initialized memory system'); try { + const dbPath = '.swarm/memory.db'; + const { existsSync } = await import('fs'); + const dbExistedBefore = existsSync(dbPath); + if (dbExistedBefore) { + console.log(' šŸ” Checking existing database for ReasoningBank schema...'); + try { + const { initializeReasoningBank, checkReasoningBankTables, migrateReasoningBank } = await import('../../../reasoningbank/reasoningbank-adapter.js'); + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + const tableCheck = await checkReasoningBankTables(); + if (tableCheck.exists) { + console.log(' āœ… ReasoningBank schema already complete'); + } else if (force) { + console.log(` šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}`); + const migrationResult = await migrateReasoningBank(); + if (migrationResult.success) { + printSuccess(` āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`); + console.log(' Use --reasoningbank flag to enable AI-powered memory features'); + } else { + console.log(` āš ļø Migration failed: ${migrationResult.message}`); + console.log(' Basic memory will work, use: memory init --reasoningbank to retry'); + } + } else { + console.log(` ā„¹ļø Database has ${tableCheck.missingTables.length} missing ReasoningBank tables`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}`); + console.log(' Use --force to migrate existing database'); + console.log(' Or use: memory init --reasoningbank'); + } + } catch (rbErr) { + console.log(` āš ļø ReasoningBank check failed: ${rbErr.message}`); + console.log(' Will attempt normal initialization...'); + } + } const { FallbackMemoryStore } = await import('../../../memory/fallback-store.js'); const memoryStore = new FallbackMemoryStore(); await memoryStore.initialize(); @@ -1281,6 +1314,18 @@ ${commands.map((cmd)=>`- [${cmd}](./${cmd}.md)`).join('\n')} console.log(' šŸ’” For persistent storage, install locally: npm install claude-flow@alpha'); } else { printSuccess('āœ“ Initialized memory database (.swarm/memory.db)'); + if (!dbExistedBefore) { + try { + const { initializeReasoningBank } = await import('../../../reasoningbank/reasoningbank-adapter.js'); + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + console.log(' 🧠 Initializing ReasoningBank schema...'); + await initializeReasoningBank(); + printSuccess(' āœ“ ReasoningBank schema initialized (use --reasoningbank flag for AI-powered memory)'); + } catch (rbErr) { + console.log(` āš ļø ReasoningBank initialization failed: ${rbErr.message}`); + console.log(' Basic memory will work, use: memory init --reasoningbank to retry'); + } + } } memoryStore.close(); } catch (err) { diff --git a/dist-cjs/src/cli/simple-commands/init/index.js.map b/dist-cjs/src/cli/simple-commands/init/index.js.map index 57e9b50b1..682989ae5 100644 --- a/dist-cjs/src/cli/simple-commands/init/index.js.map +++ b/dist-cjs/src/cli/simple-commands/init/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../../src/cli/simple-commands/init/index.js"],"sourcesContent":["// init/index.js - Initialize Claude Code integration files\nimport { printSuccess, printError, printWarning, exit } from '../../utils.js';\nimport { existsSync } from 'fs';\nimport process from 'process';\nimport os from 'os';\nimport { spawn, execSync } from 'child_process';\nimport { promisify } from 'util';\n\n// Helper to replace Deno.Command\nfunction runCommand(command, args, options = {}) {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd: options.cwd,\n env: { ...process.env, ...options.env },\n stdio: options.stdout === 'inherit' ? 'inherit' : 'pipe'\n });\n \n let stdout = '';\n let stderr = '';\n \n if (options.stdout !== 'inherit') {\n child.stdout.on('data', (data) => { stdout += data; });\n child.stderr.on('data', (data) => { stderr += data; });\n }\n \n child.on('close', (code) => {\n if (code === 0) {\n resolve({ success: true, code, stdout, stderr });\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n \n child.on('error', reject);\n });\n}\nimport { createLocalExecutable } from './executable-wrapper.js';\nimport { createSparcStructureManually } from './sparc-structure.js';\nimport { createClaudeSlashCommands } from './claude-commands/slash-commands.js';\nimport { createOptimizedClaudeSlashCommands } from './claude-commands/optimized-slash-commands.js';\n// execSync imported above as execSyncOriginal\\nconst execSync = execSyncOriginal;\nimport { promises as fs } from 'fs';\nimport { copyTemplates } from './template-copier.js';\nimport { copyRevisedTemplates, validateTemplatesExist } from './copy-revised-templates.js';\nimport { copyAgentFiles, createAgentDirectories, validateAgentSystem, copyCommandFiles } from './agent-copier.js';\nimport { showInitHelp } from './help.js';\nimport { batchInitCommand, batchInitFromConfig, validateBatchOptions } from './batch-init.js';\nimport { ValidationSystem, runFullValidation } from './validation/index.js';\nimport { RollbackSystem, createAtomicOperation } from './rollback/index.js';\nimport {\n createEnhancedClaudeMd,\n createEnhancedSettingsJson,\n createWrapperScript,\n createCommandDoc,\n createHelperScript,\n COMMAND_STRUCTURE,\n} from './templates/enhanced-templates.js';\nimport { createOptimizedSparcClaudeMd } from './templates/claude-md.js';\nimport { getIsolatedNpxEnv } from '../../../utils/npx-isolated-cache.js';\nimport { updateGitignore, needsGitignoreUpdate } from './gitignore-updater.js';\nimport {\n createFullClaudeMd,\n createSparcClaudeMd,\n createMinimalClaudeMd,\n} from './templates/claude-md.js';\nimport {\n createVerificationClaudeMd,\n createVerificationSettingsJson,\n} from './templates/verification-claude-md.js';\nimport {\n createFullMemoryBankMd,\n createMinimalMemoryBankMd,\n} from './templates/memory-bank-md.js';\nimport {\n createFullCoordinationMd,\n createMinimalCoordinationMd,\n} from './templates/coordination-md.js';\nimport { createAgentsReadme, createSessionsReadme } from './templates/readme-files.js';\nimport { \n initializeHiveMind, \n getHiveMindStatus,\n rollbackHiveMindInit\n} from './hive-mind-init.js';\n\n/**\n * Check if Claude Code CLI is installed\n */\nfunction isClaudeCodeInstalled() {\n try {\n execSync('which claude', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Set up MCP servers in Claude Code\n */\nasync function setupMcpServers(dryRun = false) {\n console.log('\\nšŸ”Œ Setting up MCP servers for Claude Code...');\n\n const servers = [\n {\n name: 'claude-flow',\n command: 'npx claude-flow@alpha mcp start',\n description: 'Claude Flow MCP server with swarm orchestration (alpha)',\n },\n {\n name: 'ruv-swarm',\n command: 'npx ruv-swarm mcp start',\n description: 'ruv-swarm MCP server for enhanced coordination',\n },\n {\n name: 'flow-nexus',\n command: 'npx flow-nexus@latest mcp start',\n description: 'Flow Nexus Complete MCP server for advanced AI orchestration',\n },\n {\n name: 'agentic-payments',\n command: 'npx agentic-payments@latest mcp',\n description: 'Agentic Payments MCP server for autonomous agent payment authorization',\n },\n ];\n\n for (const server of servers) {\n try {\n if (!dryRun) {\n console.log(` šŸ”„ Adding ${server.name}...`);\n execSync(`claude mcp add ${server.name} ${server.command}`, { stdio: 'inherit' });\n console.log(` āœ… Added ${server.name} - ${server.description}`);\n } else {\n console.log(` [DRY RUN] Would add ${server.name} - ${server.description}`);\n }\n } catch (err) {\n console.log(` āš ļø Failed to add ${server.name}: ${err.message}`);\n console.log(\n ` You can add it manually with: claude mcp add ${server.name} ${server.command}`,\n );\n }\n }\n\n if (!dryRun) {\n console.log('\\n šŸ“‹ Verifying MCP servers...');\n try {\n execSync('claude mcp list', { stdio: 'inherit' });\n } catch (err) {\n console.log(' āš ļø Could not verify MCP servers');\n }\n }\n}\n\n/**\n * Create statusline script content (embedded fallback for binary builds)\n */\nfunction createStatuslineScript() {\n return `\n#!/bin/bash\n\n# Read JSON input from stdin\nINPUT=$(cat)\nMODEL=$(echo \"$INPUT\" | jq -r \\'.model.display_name // \"Claude\"\\')\nCWD=$(echo \"$INPUT\" | jq -r \\'.workspace.current_dir // .cwd\\')\nDIR=$(basename \"$CWD\")\n\n# Replace claude-code-flow with branded name\nif [ \"$DIR\" = \"claude-code-flow\" ]; then\n DIR=\"🌊 Claude Flow\"\nfi\n\n# Get git branch\nBRANCH=$(cd \"$CWD\" 2>/dev/null && git branch --show-current 2>/dev/null)\n\n# Start building statusline\necho -ne \"\\\\033[1m$MODEL\\\\033[0m in \\\\033[36m$DIR\\\\033[0m\"\n[ -n \"$BRANCH\" ] && echo -ne \" on \\\\033[33māŽ‡ $BRANCH\\\\033[0m\"\n\n# Claude-Flow integration\nFLOW_DIR=\"$CWD/.claude-flow\"\n\nif [ -d \"$FLOW_DIR\" ]; then\n echo -ne \" │\"\n\n # 1. Swarm Configuration & Topology\n if [ -f \"$FLOW_DIR/swarm-config.json\" ]; then\n STRATEGY=$(jq -r \\'.defaultStrategy // empty\\' \"$FLOW_DIR/swarm-config.json\" 2>/dev/null)\n if [ -n \"$STRATEGY\" ]; then\n # Map strategy to topology icon\n case \"$STRATEGY\" in\n \"balanced\") TOPO_ICON=\"⚔mesh\" ;;\n \"conservative\") TOPO_ICON=\"⚔hier\" ;;\n \"aggressive\") TOPO_ICON=\"⚔ring\" ;;\n *) TOPO_ICON=\"⚔$STRATEGY\" ;;\n esac\n echo -ne \" \\\\033[35m$TOPO_ICON\\\\033[0m\"\n\n # Count agent profiles as \"configured agents\"\n AGENT_COUNT=$(jq -r \\'.agentProfiles | length\\' \"$FLOW_DIR/swarm-config.json\" 2>/dev/null)\n if [ -n \"$AGENT_COUNT\" ] && [ \"$AGENT_COUNT\" != \"null\" ] && [ \"$AGENT_COUNT\" -gt 0 ]; then\n echo -ne \" \\\\033[35mšŸ¤– $AGENT_COUNT\\\\033[0m\"\n fi\n fi\n fi\n\n # 2. Real-time System Metrics\n if [ -f \"$FLOW_DIR/metrics/system-metrics.json\" ]; then\n # Get latest metrics (last entry in array)\n LATEST=$(jq -r \\'.[-1]\\' \"$FLOW_DIR/metrics/system-metrics.json\" 2>/dev/null)\n\n if [ -n \"$LATEST\" ] && [ \"$LATEST\" != \"null\" ]; then\n # Memory usage\n MEM_PERCENT=$(echo \"$LATEST\" | jq -r \\'.memoryUsagePercent // 0\\' | awk \\'{printf \"%.0f\", $1}\\')\n if [ -n \"$MEM_PERCENT\" ] && [ \"$MEM_PERCENT\" != \"null\" ]; then\n # Color-coded memory (green <60%, yellow 60-80%, red >80%)\n if [ \"$MEM_PERCENT\" -lt 60 ]; then\n MEM_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$MEM_PERCENT\" -lt 80 ]; then\n MEM_COLOR=\"\\\\033[33m\" # Yellow\n else\n MEM_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${MEM_COLOR}šŸ’¾ ${MEM_PERCENT}%\\\\033[0m\"\n fi\n\n # CPU load\n CPU_LOAD=$(echo \"$LATEST\" | jq -r \\'.cpuLoad // 0\\' | awk \\'{printf \"%.0f\", $1 * 100}\\')\n if [ -n \"$CPU_LOAD\" ] && [ \"$CPU_LOAD\" != \"null\" ]; then\n # Color-coded CPU (green <50%, yellow 50-75%, red >75%)\n if [ \"$CPU_LOAD\" -lt 50 ]; then\n CPU_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$CPU_LOAD\" -lt 75 ]; then\n CPU_COLOR=\"\\\\033[33m\" # Yellow\n else\n CPU_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${CPU_COLOR}āš™ ${CPU_LOAD}%\\\\033[0m\"\n fi\n fi\n fi\n\n # 3. Session State\n if [ -f \"$FLOW_DIR/session-state.json\" ]; then\n SESSION_ID=$(jq -r \\'.sessionId // empty\\' \"$FLOW_DIR/session-state.json\" 2>/dev/null)\n ACTIVE=$(jq -r \\'.active // false\\' \"$FLOW_DIR/session-state.json\" 2>/dev/null)\n\n if [ \"$ACTIVE\" = \"true\" ] && [ -n \"$SESSION_ID\" ]; then\n # Show abbreviated session ID\n SHORT_ID=$(echo \"$SESSION_ID\" | cut -d\\'-\\' -f1)\n echo -ne \" \\\\033[34mšŸ”„ $SHORT_ID\\\\033[0m\"\n fi\n fi\n\n # 4. Performance Metrics from task-metrics.json\n if [ -f \"$FLOW_DIR/metrics/task-metrics.json\" ]; then\n # Parse task metrics for success rate, avg time, and streak\n METRICS=$(jq -r \\'\n # Calculate metrics\n (map(select(.success == true)) | length) as $successful |\n (length) as $total |\n (if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |\n (map(.duration // 0) | add / length) as $avg_duration |\n # Calculate streak (consecutive successes from end)\n (reverse |\n reduce .[] as $task (0;\n if $task.success == true then . + 1 else 0 end\n )\n ) as $streak |\n {\n success_rate: $success_rate,\n avg_duration: $avg_duration,\n streak: $streak,\n total: $total\n } | @json\n \\' \"$FLOW_DIR/metrics/task-metrics.json\" 2>/dev/null)\n\n if [ -n \"$METRICS\" ] && [ \"$METRICS\" != \"null\" ]; then\n # Success Rate\n SUCCESS_RATE=$(echo \"$METRICS\" | jq -r \\'.success_rate // 0\\' | awk \\'{printf \"%.0f\", $1}\\')\n TOTAL_TASKS=$(echo \"$METRICS\" | jq -r \\'.total // 0\\')\n\n if [ -n \"$SUCCESS_RATE\" ] && [ \"$TOTAL_TASKS\" -gt 0 ]; then\n # Color-code: Green (>80%), Yellow (60-80%), Red (<60%)\n if [ \"$SUCCESS_RATE\" -gt 80 ]; then\n SUCCESS_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$SUCCESS_RATE\" -ge 60 ]; then\n SUCCESS_COLOR=\"\\\\033[33m\" # Yellow\n else\n SUCCESS_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${SUCCESS_COLOR}šŸŽÆ ${SUCCESS_RATE}%\\\\033[0m\"\n fi\n\n # Average Time\n AVG_TIME=$(echo \"$METRICS\" | jq -r \\'.avg_duration // 0\\')\n if [ -n \"$AVG_TIME\" ] && [ \"$TOTAL_TASKS\" -gt 0 ]; then\n # Format smartly: seconds, minutes, or hours\n if [ $(echo \"$AVG_TIME < 60\" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fs\", $1}\\')\n elif [ $(echo \"$AVG_TIME < 3600\" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fm\", $1/60}\\')\n else\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fh\", $1/3600}\\')\n fi\n echo -ne \" \\\\033[36mā±ļø $TIME_STR\\\\033[0m\"\n fi\n\n # Streak (only show if > 0)\n STREAK=$(echo \"$METRICS\" | jq -r \\'.streak // 0\\')\n if [ -n \"$STREAK\" ] && [ \"$STREAK\" -gt 0 ]; then\n echo -ne \" \\\\033[91mšŸ”„ $STREAK\\\\033[0m\"\n fi\n fi\n fi\n\n # 5. Active Tasks (check for task files)\n if [ -d \"$FLOW_DIR/tasks\" ]; then\n TASK_COUNT=$(find \"$FLOW_DIR/tasks\" -name \"*.json\" -type f 2>/dev/null | wc -l)\n if [ \"$TASK_COUNT\" -gt 0 ]; then\n echo -ne \" \\\\033[36mšŸ“‹ $TASK_COUNT\\\\033[0m\"\n fi\n fi\n\n # 6. Check for hooks activity\n if [ -f \"$FLOW_DIR/hooks-state.json\" ]; then\n HOOKS_ACTIVE=$(jq -r \\'.enabled // false\\' \"$FLOW_DIR/hooks-state.json\" 2>/dev/null)\n if [ \"$HOOKS_ACTIVE\" = \"true\" ]; then\n echo -ne \" \\\\033[35mšŸ”—\\\\033[0m\"\n fi\n fi\nfi\n\necho\n`;\n}\n\nexport async function initCommand(subArgs, flags) {\n // Show help if requested\n if (flags.help || flags.h || subArgs.includes('--help') || subArgs.includes('-h')) {\n showInitHelp();\n return;\n }\n\n // Handle --env flag for .env template generation\n if (flags.env || subArgs.includes('--env')) {\n const { generateEnvTemplate } = await import('../env-template.js');\n const workingDir = process.env.PWD || process.cwd();\n const force = flags.force || flags.f;\n\n console.log('šŸ“‹ Generating .env template file...\\n');\n const result = await generateEnvTemplate(workingDir, force);\n\n if (result.created) {\n console.log('\\nšŸ“š Next steps:');\n console.log('1. Open .env file and add your API keys');\n console.log('2. Get keys from:');\n console.log(' • Anthropic: https://console.anthropic.com/settings/keys');\n console.log(' • OpenRouter: https://openrouter.ai/keys');\n console.log('3. Enable memory: claude-flow agent run coder \"task\" --enable-memory\\n');\n console.log('šŸ’” See docs/REASONINGBANK-COST-OPTIMIZATION.md for cost savings tips');\n } else if (result.exists) {\n console.log('šŸ’” To overwrite: claude-flow init --env --force');\n }\n\n return;\n }\n\n // Check for verification flags first\n const hasVerificationFlags = subArgs.includes('--verify') || subArgs.includes('--pair') ||\n flags.verify || flags.pair;\n\n // Handle Flow Nexus minimal init\n if (flags['flow-nexus']) {\n return await flowNexusMinimalInit(flags, subArgs);\n }\n\n // Default to enhanced Claude Flow v2 init unless other modes are specified\n // Use --basic flag for old behavior, or verification flags for verification mode\n if (!flags.basic && !flags.minimal && !flags.sparc && !hasVerificationFlags) {\n return await enhancedClaudeFlowInit(flags, subArgs);\n }\n\n // Check for validation and rollback commands\n if (subArgs.includes('--validate') || subArgs.includes('--validate-only')) {\n return handleValidationCommand(subArgs, flags);\n }\n\n if (subArgs.includes('--rollback')) {\n return handleRollbackCommand(subArgs, flags);\n }\n\n if (subArgs.includes('--list-backups')) {\n return handleListBackups(subArgs, flags);\n }\n\n // Check for batch operations\n const batchInitFlag = flags['batch-init'] || subArgs.includes('--batch-init');\n const configFlag = flags.config || subArgs.includes('--config');\n\n if (batchInitFlag || configFlag) {\n return handleBatchInit(subArgs, flags);\n }\n\n // Check if enhanced initialization is requested\n const useEnhanced = subArgs.includes('--enhanced') || subArgs.includes('--safe');\n\n if (useEnhanced) {\n return enhancedInitCommand(subArgs, flags);\n }\n\n // Parse init options\n const initForce = subArgs.includes('--force') || subArgs.includes('-f') || flags.force;\n const initMinimal = subArgs.includes('--minimal') || subArgs.includes('-m') || flags.minimal;\n const initSparc = flags.roo || (subArgs && subArgs.includes('--roo')); // SPARC only with --roo flag\n const initDryRun = subArgs.includes('--dry-run') || subArgs.includes('-d') || flags.dryRun;\n const initOptimized = initSparc && initForce; // Use optimized templates when both flags are present\n const selectedModes = flags.modes ? flags.modes.split(',') : null; // Support selective mode initialization\n \n // Check for verification and pair programming flags\n const initVerify = subArgs.includes('--verify') || flags.verify;\n const initPair = subArgs.includes('--pair') || flags.pair;\n\n // Get the actual working directory (where the command was run from)\n // Use PWD environment variable which preserves the original directory\n const workingDir = process.env.PWD || cwd();\n console.log(`šŸ“ Initializing in: ${workingDir}`);\n\n // Change to the working directory to ensure all file operations happen there\n try {\n process.chdir(workingDir);\n } catch (err) {\n printWarning(`Could not change to directory ${workingDir}: ${err.message}`);\n }\n\n try {\n printSuccess('Initializing Claude Code integration files...');\n\n // Check if files already exist in the working directory\n const files = ['CLAUDE.md', 'memory-bank.md', 'coordination.md'];\n const existingFiles = [];\n\n for (const file of files) {\n try {\n await fs.stat(`${workingDir}/${file}`);\n existingFiles.push(file);\n } catch {\n // File doesn't exist, which is what we want\n }\n }\n\n if (existingFiles.length > 0 && !initForce) {\n printWarning(`The following files already exist: ${existingFiles.join(', ')}`);\n console.log('Use --force to overwrite existing files');\n return;\n }\n\n // Use template copier to copy all template files\n const templateOptions = {\n sparc: initSparc,\n minimal: initMinimal,\n optimized: initOptimized,\n dryRun: initDryRun,\n force: initForce,\n selectedModes: selectedModes,\n verify: initVerify,\n pair: initPair,\n };\n\n // If verification flags are set, always use generated templates for CLAUDE.md and settings.json\n if (initVerify || initPair) {\n console.log(' šŸ“ Creating verification-focused configuration...');\n \n // Create verification CLAUDE.md\n if (!initDryRun) {\n const { createVerificationClaudeMd, createVerificationSettingsJson } = await import('./templates/verification-claude-md.js');\n await fs.writeFile(`${workingDir}/CLAUDE.md`, createVerificationClaudeMd(), 'utf8');\n \n // Create .claude directory and settings\n await fs.mkdir(`${workingDir}/.claude`, { recursive: true });\n await fs.writeFile(`${workingDir}/.claude/settings.json`, createVerificationSettingsJson(), 'utf8');\n console.log(' āœ… Created verification-focused CLAUDE.md and settings.json');\n } else {\n console.log(' [DRY RUN] Would create verification-focused CLAUDE.md and settings.json');\n }\n \n // Copy other template files from repository if available\n const validation = validateTemplatesExist();\n if (validation.valid) {\n const revisedResults = await copyRevisedTemplates(workingDir, {\n force: initForce,\n dryRun: initDryRun,\n verbose: false,\n sparc: initSparc\n });\n }\n \n // Also create standard memory and coordination files\n const copyResults = await copyTemplates(workingDir, {\n ...templateOptions,\n skipClaudeMd: true, // Don't overwrite the verification CLAUDE.md\n skipSettings: true // Don't overwrite the verification settings.json\n });\n \n } else {\n // Standard template copying logic\n const validation = validateTemplatesExist();\n if (validation.valid) {\n console.log(' šŸ“ Copying revised template files...');\n const revisedResults = await copyRevisedTemplates(workingDir, {\n force: initForce,\n dryRun: initDryRun,\n verbose: true,\n sparc: initSparc\n });\n\n if (revisedResults.success) {\n console.log(` āœ… Copied ${revisedResults.copiedFiles.length} template files`);\n if (revisedResults.skippedFiles.length > 0) {\n console.log(` ā­ļø Skipped ${revisedResults.skippedFiles.length} existing files`);\n }\n } else {\n console.log(' āš ļø Some template files could not be copied:');\n revisedResults.errors.forEach(err => console.log(` - ${err}`));\n }\n } else {\n // Fall back to generated templates\n console.log(' āš ļø Revised templates not available, using generated templates');\n const copyResults = await copyTemplates(workingDir, templateOptions);\n\n if (!copyResults.success) {\n printError('Failed to copy templates:');\n copyResults.errors.forEach(err => console.log(` āŒ ${err}`));\n return;\n }\n }\n }\n\n // Agent setup moved to end of function where execution is guaranteed\n\n // Directory structure is created by template copier\n\n // SPARC files are created by template copier when --sparc flag is used\n\n // Memory README files and persistence database are created by template copier\n\n // Create local claude-flow@alpha executable wrapper\n if (!initDryRun) {\n await createLocalExecutable(workingDir);\n } else {\n console.log(' [DRY RUN] Would create local claude-flow@alpha executable wrapper');\n }\n\n // SPARC initialization\n if (initSparc) {\n console.log('\\nšŸš€ Initializing SPARC development environment...');\n\n if (initDryRun) {\n console.log(' [DRY RUN] Would run: npx -y create-sparc init --force');\n console.log(' [DRY RUN] Would create SPARC environment with all modes');\n console.log(\n ' [DRY RUN] Would create Claude slash commands' +\n (initOptimized ? ' (Batchtools-optimized)' : ''),\n );\n if (selectedModes) {\n console.log(\n ` [DRY RUN] Would create commands for selected modes: ${selectedModes.join(', ')}`,\n );\n }\n } else {\n // Check if create-sparc exists and run it\n let sparcInitialized = false;\n try {\n // Use isolated NPX cache to prevent concurrent conflicts\n console.log(' šŸ”„ Running: npx -y create-sparc init --force');\n const createSparcResult = await runCommand('npx', ['-y', 'create-sparc', 'init', '--force'], {\n cwd: workingDir,\n stdout: 'inherit',\n stderr: 'inherit',\n env: getIsolatedNpxEnv({\n PWD: workingDir,\n }),\n });\n\n if (createSparcResult.success) {\n console.log(' āœ… SPARC environment initialized successfully');\n sparcInitialized = true;\n } else {\n printWarning('create-sparc failed, creating basic SPARC structure manually...');\n\n // Fallback: create basic SPARC structure manually\n await createSparcStructureManually();\n sparcInitialized = true; // Manual creation still counts as initialized\n }\n } catch (err) {\n printWarning('create-sparc not available, creating basic SPARC structure manually...');\n\n // Fallback: create basic SPARC structure manually\n await createSparcStructureManually();\n sparcInitialized = true; // Manual creation still counts as initialized\n }\n\n // Always create Claude slash commands after SPARC initialization\n if (sparcInitialized) {\n try {\n if (initOptimized) {\n await createOptimizedClaudeSlashCommands(workingDir, selectedModes);\n } else {\n await createClaudeSlashCommands(workingDir);\n }\n } catch (err) {\n // Legacy slash command creation - silently skip if it fails\n // SPARC slash commands are already created successfully above\n }\n }\n }\n }\n\n if (initDryRun) {\n printSuccess(\"šŸ” Dry run completed! Here's what would be created:\");\n console.log('\\nšŸ“‹ Summary of planned initialization:');\n console.log(\n ` • Configuration: ${initOptimized ? 'Batchtools-optimized SPARC' : initSparc ? 'SPARC-enhanced' : 'Standard'}`,\n );\n console.log(\n ` • Template type: ${initOptimized ? 'Optimized for parallel processing' : 'Standard'}`,\n );\n console.log(' • Core files: CLAUDE.md, memory-bank.md, coordination.md');\n console.log(' • Directory structure: memory/, coordination/, .claude/');\n console.log(' • Local executable: ./claude-flow@alpha');\n if (initSparc) {\n console.log(\n ` • Claude Code slash commands: ${selectedModes ? selectedModes.length : 'All'} SPARC mode commands`,\n );\n console.log(' • SPARC environment with all development modes');\n }\n if (initOptimized) {\n console.log(' • Batchtools optimization: Enabled for parallel processing');\n console.log(' • Performance enhancements: Smart batching, concurrent operations');\n }\n console.log('\\nšŸš€ To proceed with initialization, run the same command without --dry-run');\n } else {\n printSuccess('šŸŽ‰ Claude Code integration files initialized successfully!');\n\n if (initOptimized) {\n console.log('\\n⚔ Batchtools Optimization Enabled!');\n console.log(' • Parallel processing capabilities activated');\n console.log(' • Performance improvements: 250-500% faster operations');\n console.log(' • Smart batching and concurrent operations available');\n }\n\n console.log('\\nšŸ“‹ What was created:');\n console.log(\n ` āœ… CLAUDE.md (${initOptimized ? 'Batchtools-optimized' : initSparc ? 'SPARC-enhanced' : 'Standard configuration'})`,\n );\n console.log(\n ` āœ… memory-bank.md (${initOptimized ? 'With parallel processing' : 'Standard memory system'})`,\n );\n console.log(\n ` āœ… coordination.md (${initOptimized ? 'Enhanced with batchtools' : 'Standard coordination'})`,\n );\n console.log(' āœ… Directory structure with memory/ and coordination/');\n console.log(' āœ… Local executable at ./claude-flow@alpha');\n console.log(' āœ… Persistence database at memory/claude-flow@alpha-data.json');\n console.log(' āœ… Agent system with 64 specialized agents in .claude/agents/');\n\n if (initSparc) {\n const modeCount = selectedModes ? selectedModes.length : '20+';\n console.log(` āœ… Claude Code slash commands (${modeCount} SPARC modes)`);\n console.log(' āœ… Complete SPARC development environment');\n }\n\n console.log('\\nšŸš€ Next steps:');\n console.log('1. Review and customize the generated files for your project');\n console.log(\"2. Run './claude-flow@alpha start' to begin the orchestration system\");\n console.log(\"3. Use './claude-flow@alpha' instead of 'npx claude-flow@alpha' for all commands\");\n console.log(\"4. Use 'claude --dangerously-skip-permissions' for unattended operation\");\n\n if (initSparc) {\n console.log(\n '5. Use Claude Code slash commands: /sparc, /sparc-architect, /sparc-tdd, etc.',\n );\n console.log(\"6. Explore SPARC modes with './claude-flow@alpha sparc modes'\");\n console.log('7. Try TDD workflow with \\'./claude-flow@alpha sparc tdd \"your task\"\\'');\n\n if (initOptimized) {\n console.log('8. Use batchtools commands: /batchtools, /performance for optimization');\n console.log('9. Enable parallel processing with --parallel flags');\n console.log(\"10. Monitor performance with './claude-flow@alpha performance monitor'\");\n }\n }\n\n // Update .gitignore\n const gitignoreResult = await updateGitignore(workingDir, initForce, initDryRun);\n if (gitignoreResult.success) {\n if (!initDryRun) {\n console.log(` āœ… ${gitignoreResult.message}`);\n } else {\n console.log(` ${gitignoreResult.message}`);\n }\n } else {\n console.log(` āš ļø ${gitignoreResult.message}`);\n }\n\n console.log('\\nšŸ’” Tips:');\n console.log(\" • Type '/' in Claude Code to see all available slash commands\");\n console.log(\" • Use './claude-flow@alpha status' to check system health\");\n console.log(\" • Store important context with './claude-flow@alpha memory store'\");\n\n if (initOptimized) {\n console.log(' • Use --parallel flags for concurrent operations');\n console.log(' • Enable batch processing for multiple related tasks');\n console.log(' • Monitor performance with real-time metrics');\n }\n\n // Initialize hive-mind system for standard init\n console.log('\\n🧠 Initializing basic hive-mind system...');\n try {\n const hiveMindOptions = {\n config: {\n integration: {\n claudeCode: { enabled: isClaudeCodeInstalled() },\n mcpTools: { enabled: true }\n },\n monitoring: { enabled: false } // Basic setup for standard init\n }\n };\n \n const hiveMindResult = await initializeHiveMind(workingDir, hiveMindOptions, false);\n \n if (hiveMindResult.success) {\n console.log(' āœ… Basic hive-mind system initialized');\n console.log(' šŸ’” Use \"npx claude-flow@alpha hive-mind\" for advanced features');\n } else {\n console.log(` āš ļø Hive-mind setup skipped: ${hiveMindResult.error}`);\n }\n } catch (err) {\n console.log(` āš ļø Hive-mind setup skipped: ${err.message}`);\n }\n\n // Check for Claude Code and set up MCP servers (always enabled by default)\n if (!initDryRun && isClaudeCodeInstalled()) {\n console.log('\\nšŸ” Claude Code CLI detected!');\n const skipMcp = subArgs && subArgs.includes && subArgs.includes('--skip-mcp');\n\n if (!skipMcp) {\n await setupMcpServers(initDryRun);\n } else {\n console.log(' ā„¹ļø Skipping MCP setup (--skip-mcp flag used)');\n }\n } else if (!initDryRun && !isClaudeCodeInstalled()) {\n console.log('\\nāš ļø Claude Code CLI not detected!');\n console.log(' šŸ“„ Install with: npm install -g @anthropic-ai/claude-code');\n console.log(' šŸ“‹ Then add MCP servers manually with:');\n console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n }\n }\n } catch (err) {\n printError(`Failed to initialize files: ${err.message}`);\n }\n}\n\n// Handle batch initialization\nasync function handleBatchInit(subArgs, flags) {\n try {\n // Options parsing from flags and subArgs\n const options = {\n parallel: !flags['no-parallel'] && flags.parallel !== false,\n sparc: flags.sparc || flags.s,\n minimal: flags.minimal || flags.m,\n force: flags.force || flags.f,\n maxConcurrency: flags['max-concurrent'] || 5,\n progressTracking: true,\n template: flags.template,\n environments: flags.environments\n ? flags.environments.split(',').map((env) => env.trim())\n : ['dev'],\n };\n\n // Validate options\n const validationErrors = validateBatchOptions(options);\n if (validationErrors.length > 0) {\n printError('Batch options validation failed:');\n validationErrors.forEach((error) => console.error(` - ${error}`));\n return;\n }\n\n // Config file mode\n if (flags.config) {\n const configFile = flags.config;\n printSuccess(`Loading batch configuration from: ${configFile}`);\n const results = await batchInitFromConfig(configFile, options);\n if (results) {\n printSuccess('Batch initialization from config completed');\n }\n return;\n }\n\n // Batch init mode\n if (flags['batch-init']) {\n const projectsString = flags['batch-init'];\n const projects = projectsString.split(',').map((project) => project.trim());\n\n if (projects.length === 0) {\n printError('No projects specified for batch initialization');\n return;\n }\n\n printSuccess(`Initializing ${projects.length} projects in batch mode`);\n const results = await batchInitCommand(projects, options);\n\n if (results) {\n const successful = results.filter((r) => r.success).length;\n const failed = results.filter((r) => !r.success).length;\n\n if (failed === 0) {\n printSuccess(`All ${successful} projects initialized successfully`);\n } else {\n printWarning(`${successful} projects succeeded, ${failed} failed`);\n }\n }\n return;\n }\n\n printError('No batch operation specified. Use --batch-init or --config ');\n } catch (err) {\n printError(`Batch initialization failed: ${err.message}`);\n }\n}\n\n/**\n * Enhanced initialization command with validation and rollback\n */\nasync function enhancedInitCommand(subArgs, flags) {\n console.log('šŸ›”ļø Starting enhanced initialization with validation and rollback...');\n\n // Store parameters to avoid scope issues in async context\n const args = subArgs || [];\n const options = flags || {};\n\n // Get the working directory\n const workingDir = process.env.PWD || process.cwd();\n\n // Initialize systems\n const rollbackSystem = new RollbackSystem(workingDir);\n const validationSystem = new ValidationSystem(workingDir);\n\n let atomicOp = null;\n\n try {\n // Parse options\n const initOptions = {\n force: args.includes('--force') || args.includes('-f') || options.force,\n minimal: args.includes('--minimal') || args.includes('-m') || options.minimal,\n sparc: args.includes('--sparc') || args.includes('-s') || options.sparc,\n skipPreValidation: args.includes('--skip-pre-validation'),\n skipBackup: args.includes('--skip-backup'),\n validateOnly: args.includes('--validate-only'),\n };\n\n // Phase 1: Pre-initialization validation\n if (!initOptions.skipPreValidation) {\n console.log('\\nšŸ” Phase 1: Pre-initialization validation...');\n const preValidation = await validationSystem.validatePreInit(initOptions);\n\n if (!preValidation.success) {\n printError('Pre-initialization validation failed:');\n preValidation.errors.forEach((error) => console.error(` āŒ ${error}`));\n return;\n }\n\n if (preValidation.warnings.length > 0) {\n printWarning('Pre-initialization warnings:');\n preValidation.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n printSuccess('Pre-initialization validation passed');\n }\n\n // Stop here if validation-only mode\n if (options.validateOnly) {\n console.log('\\nāœ… Validation-only mode completed');\n return;\n }\n\n // Phase 2: Create backup\n if (!options.skipBackup) {\n console.log('\\nšŸ’¾ Phase 2: Creating backup...');\n const backupResult = await rollbackSystem.createPreInitBackup();\n\n if (!backupResult.success) {\n printError('Backup creation failed:');\n backupResult.errors.forEach((error) => console.error(` āŒ ${error}`));\n return;\n }\n }\n\n // Phase 3: Initialize with atomic operations\n console.log('\\nšŸ”§ Phase 3: Atomic initialization...');\n atomicOp = createAtomicOperation(rollbackSystem, 'enhanced-init');\n\n const atomicBegin = await atomicOp.begin();\n if (!atomicBegin) {\n printError('Failed to begin atomic operation');\n return;\n }\n\n // Perform initialization steps with checkpoints\n await performInitializationWithCheckpoints(rollbackSystem, options, workingDir, dryRun);\n\n // Phase 4: Post-initialization validation\n console.log('\\nāœ… Phase 4: Post-initialization validation...');\n const postValidation = await validationSystem.validatePostInit();\n\n if (!postValidation.success) {\n printError('Post-initialization validation failed:');\n postValidation.errors.forEach((error) => console.error(` āŒ ${error}`));\n\n // Attempt automatic rollback\n console.log('\\nšŸ”„ Attempting automatic rollback...');\n await atomicOp.rollback();\n printWarning('Initialization rolled back due to validation failure');\n return;\n }\n\n // Phase 5: Configuration validation\n console.log('\\nšŸ”§ Phase 5: Configuration validation...');\n const configValidation = await validationSystem.validateConfiguration();\n\n if (configValidation.warnings.length > 0) {\n printWarning('Configuration warnings:');\n configValidation.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n // Phase 6: Health checks\n console.log('\\nšŸ„ Phase 6: System health checks...');\n const healthChecks = await validationSystem.runHealthChecks();\n\n if (healthChecks.warnings.length > 0) {\n printWarning('Health check warnings:');\n healthChecks.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n // Commit atomic operation\n await atomicOp.commit();\n\n // Generate and display validation report\n const fullValidation = await runFullValidation(workingDir, {\n postInit: true,\n skipPreInit: options.skipPreValidation,\n });\n\n console.log('\\nšŸ“Š Validation Report:');\n console.log(fullValidation.report);\n\n printSuccess('šŸŽ‰ Enhanced initialization completed successfully!');\n console.log('\\n✨ Your SPARC environment is fully validated and ready to use');\n } catch (error) {\n printError(`Enhanced initialization failed: ${error.message}`);\n\n // Attempt rollback if atomic operation is active\n if (atomicOp && !atomicOp.completed) {\n console.log('\\nšŸ”„ Performing emergency rollback...');\n try {\n await atomicOp.rollback();\n printWarning('Emergency rollback completed');\n } catch (rollbackError) {\n printError(`Rollback also failed: ${rollbackError.message}`);\n }\n }\n }\n}\n\n/**\n * Handle validation commands\n */\nasync function handleValidationCommand(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n\n console.log('šŸ” Running validation checks...');\n\n const options = {\n skipPreInit: subArgs.includes('--skip-pre-init'),\n skipConfig: subArgs.includes('--skip-config'),\n skipModeTest: subArgs.includes('--skip-mode-test'),\n postInit: !subArgs.includes('--pre-init-only'),\n };\n\n try {\n const validationResults = await runFullValidation(workingDir, options);\n\n console.log('\\nšŸ“Š Validation Results:');\n console.log(validationResults.report);\n\n if (validationResults.success) {\n printSuccess('āœ… All validation checks passed');\n } else {\n printError('āŒ Some validation checks failed');\n process.exit(1);\n }\n } catch (error) {\n printError(`Validation failed: ${error.message}`);\n process.exit(1);\n }\n}\n\n/**\n * Handle rollback commands\n */\nasync function handleRollbackCommand(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n const rollbackSystem = new RollbackSystem(workingDir);\n\n try {\n // Check for specific rollback options\n if (subArgs.includes('--full')) {\n console.log('šŸ”„ Performing full rollback...');\n const result = await rollbackSystem.performFullRollback();\n\n if (result.success) {\n printSuccess('Full rollback completed successfully');\n } else {\n printError('Full rollback failed:');\n result.errors.forEach((error) => console.error(` āŒ ${error}`));\n }\n } else if (subArgs.includes('--partial')) {\n const phaseIndex = subArgs.findIndex((arg) => arg === '--phase');\n if (phaseIndex !== -1 && subArgs[phaseIndex + 1]) {\n const phase = subArgs[phaseIndex + 1];\n console.log(`šŸ”„ Performing partial rollback for phase: ${phase}`);\n\n const result = await rollbackSystem.performPartialRollback(phase);\n\n if (result.success) {\n printSuccess(`Partial rollback completed for phase: ${phase}`);\n } else {\n printError(`Partial rollback failed for phase: ${phase}`);\n result.errors.forEach((error) => console.error(` āŒ ${error}`));\n }\n } else {\n printError('Partial rollback requires --phase ');\n }\n } else {\n // Interactive rollback point selection\n const rollbackPoints = await rollbackSystem.listRollbackPoints();\n\n if (rollbackPoints.rollbackPoints.length === 0) {\n printWarning('No rollback points available');\n return;\n }\n\n console.log('\\nšŸ“‹ Available rollback points:');\n rollbackPoints.rollbackPoints.forEach((point, index) => {\n const date = new Date(point.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${point.type} - ${date}`);\n });\n\n // For now, rollback to the most recent point\n const latest = rollbackPoints.rollbackPoints[0];\n if (latest) {\n console.log(\n `\\nšŸ”„ Rolling back to: ${latest.type} (${new Date(latest.timestamp).toLocaleString()})`,\n );\n const result = await rollbackSystem.performFullRollback(latest.backupId);\n\n if (result.success) {\n printSuccess('Rollback completed successfully');\n } else {\n printError('Rollback failed');\n }\n }\n }\n } catch (error) {\n printError(`Rollback operation failed: ${error.message}`);\n }\n}\n\n/**\n * Handle list backups command\n */\nasync function handleListBackups(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n const rollbackSystem = new RollbackSystem(workingDir);\n\n try {\n const rollbackPoints = await rollbackSystem.listRollbackPoints();\n\n console.log('\\nšŸ“‹ Rollback Points and Backups:');\n\n if (rollbackPoints.rollbackPoints.length === 0) {\n console.log(' No rollback points available');\n } else {\n console.log('\\nšŸ”„ Rollback Points:');\n rollbackPoints.rollbackPoints.forEach((point, index) => {\n const date = new Date(point.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${point.type} - ${date} (${point.backupId || 'No backup'})`);\n });\n }\n\n if (rollbackPoints.checkpoints.length > 0) {\n console.log('\\nšŸ“ Checkpoints:');\n rollbackPoints.checkpoints.slice(-5).forEach((checkpoint, index) => {\n const date = new Date(checkpoint.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${checkpoint.phase} - ${date} (${checkpoint.status})`);\n });\n }\n } catch (error) {\n printError(`Failed to list backups: ${error.message}`);\n }\n}\n\n/**\n * Perform initialization with checkpoints\n */\nasync function performInitializationWithCheckpoints(\n rollbackSystem,\n options,\n workingDir,\n dryRun = false,\n) {\n const phases = [\n { name: 'file-creation', action: () => createInitialFiles(options, workingDir, dryRun) },\n { name: 'directory-structure', action: () => createDirectoryStructure(workingDir, dryRun) },\n { name: 'memory-setup', action: () => setupMemorySystem(workingDir, dryRun) },\n { name: 'coordination-setup', action: () => setupCoordinationSystem(workingDir, dryRun) },\n { name: 'executable-creation', action: () => createLocalExecutable(workingDir, dryRun) },\n ];\n\n if (options.sparc) {\n phases.push(\n { name: 'sparc-init', action: () => createSparcStructureManually() },\n { name: 'claude-commands', action: () => createClaudeSlashCommands(workingDir) },\n );\n }\n\n for (const phase of phases) {\n console.log(` šŸ”§ ${phase.name}...`);\n\n // Create checkpoint before phase\n await rollbackSystem.createCheckpoint(phase.name, {\n timestamp: Date.now(),\n phase: phase.name,\n });\n\n try {\n await phase.action();\n console.log(` āœ… ${phase.name} completed`);\n } catch (error) {\n console.error(` āŒ ${phase.name} failed: ${error.message}`);\n throw error;\n }\n }\n}\n\n// Helper functions for atomic initialization\nasync function createInitialFiles(options, workingDir, dryRun = false) {\n if (!dryRun) {\n const claudeMd = options.sparc\n ? createSparcClaudeMd()\n : options.minimal\n ? createMinimalClaudeMd()\n : createFullClaudeMd();\n await fs.writeFile(`${workingDir}/CLAUDE.md`, claudeMd, 'utf8');\n\n const memoryBankMd = options.minimal ? createMinimalMemoryBankMd() : createFullMemoryBankMd();\n await fs.writeFile(`${workingDir}/memory-bank.md`, memoryBankMd, 'utf8');\n\n const coordinationMd = options.minimal\n ? createMinimalCoordinationMd()\n : createFullCoordinationMd();\n await fs.writeFile(`${workingDir}/coordination.md`, coordinationMd, 'utf8');\n }\n}\n\nasync function createDirectoryStructure(workingDir, dryRun = false) {\n const directories = [\n 'memory',\n 'memory/agents',\n 'memory/sessions',\n 'coordination',\n 'coordination/memory_bank',\n 'coordination/subtasks',\n 'coordination/orchestration',\n '.claude',\n '.claude/commands',\n '.claude/logs',\n ];\n\n if (!dryRun) {\n for (const dir of directories) {\n await fs.mkdir(`${workingDir}/${dir}`, { recursive: true });\n }\n }\n}\n\nasync function setupMemorySystem(workingDir, dryRun = false) {\n if (!dryRun) {\n const initialData = { agents: [], tasks: [], lastUpdated: Date.now() };\n await fs.writeFile(\n `${workingDir}/memory/claude-flow@alpha-data.json`, JSON.stringify(initialData, null, 2), 'utf8'\n );\n\n await fs.writeFile(`${workingDir}/memory/agents/README.md`, createAgentsReadme(), 'utf8');\n await fs.writeFile(`${workingDir}/memory/sessions/README.md`, createSessionsReadme(), 'utf8');\n }\n}\n\nasync function setupCoordinationSystem(workingDir, dryRun = false) {\n // Coordination system is already set up by createDirectoryStructure\n // This is a placeholder for future coordination setup logic\n}\n\n/**\n * Setup monitoring and telemetry for token tracking\n */\nasync function setupMonitoring(workingDir) {\n console.log(' šŸ“ˆ Configuring token usage tracking...');\n \n const fs = await import('fs/promises');\n const path = await import('path');\n \n try {\n // Create .claude-flow@alpha directory for tracking data\n const trackingDir = path.join(workingDir, '.claude-flow@alpha');\n await fs.mkdir(trackingDir, { recursive: true });\n \n // Create initial token usage file\n const tokenUsageFile = path.join(trackingDir, 'token-usage.json');\n const initialData = {\n total: 0,\n input: 0,\n output: 0,\n byAgent: {},\n lastUpdated: new Date().toISOString()\n };\n \n await fs.writeFile(tokenUsageFile, JSON.stringify(initialData, null, 2));\n printSuccess(' āœ“ Created token usage tracking file');\n \n // Add telemetry configuration to .claude/settings.json if it exists\n const settingsPath = path.join(workingDir, '.claude', 'settings.json');\n try {\n const settingsContent = await fs.readFile(settingsPath, 'utf8');\n const settings = JSON.parse(settingsContent);\n \n // Add telemetry hook\n if (!settings.hooks) settings.hooks = {};\n if (!settings.hooks['post-task']) settings.hooks['post-task'] = [];\n \n // Add token tracking hook\n const tokenTrackingHook = 'npx claude-flow@alpha internal track-tokens --session-id {{session_id}} --tokens {{token_usage}}';\n if (!settings.hooks['post-task'].includes(tokenTrackingHook)) {\n settings.hooks['post-task'].push(tokenTrackingHook);\n }\n \n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2));\n printSuccess(' āœ“ Added token tracking hooks to settings');\n } catch (err) {\n console.log(' āš ļø Could not update settings.json:', err.message);\n }\n \n // Create monitoring configuration\n const monitoringConfig = {\n enabled: true,\n telemetry: {\n claudeCode: {\n env: 'CLAUDE_CODE_ENABLE_TELEMETRY',\n value: '1',\n description: 'Enable Claude Code OpenTelemetry metrics'\n }\n },\n tracking: {\n tokens: true,\n costs: true,\n agents: true,\n sessions: true\n },\n storage: {\n location: '.claude-flow@alpha/token-usage.json',\n format: 'json',\n rotation: 'monthly'\n }\n };\n \n const configPath = path.join(trackingDir, 'monitoring.config.json');\n await fs.writeFile(configPath, JSON.stringify(monitoringConfig, null, 2));\n printSuccess(' āœ“ Created monitoring configuration');\n \n // Create shell profile snippet for environment variable\n const envSnippet = `\n# Claude Flow Token Tracking\n# Add this to your shell profile (.bashrc, .zshrc, etc.)\nexport CLAUDE_CODE_ENABLE_TELEMETRY=1\n\n# Optional: Set custom metrics path\n# export CLAUDE_METRICS_PATH=\"$HOME/.claude/metrics\"\n`;\n \n const envPath = path.join(trackingDir, 'env-setup.sh');\n await fs.writeFile(envPath, envSnippet.trim());\n printSuccess(' āœ“ Created environment setup script');\n \n console.log('\\n šŸ“‹ To enable Claude Code telemetry:');\n console.log(' 1. Add to your shell profile: export CLAUDE_CODE_ENABLE_TELEMETRY=1');\n console.log(' 2. Or run: source .claude-flow@alpha/env-setup.sh');\n console.log('\\n šŸ’” Token usage will be tracked in .claude-flow@alpha/token-usage.json');\n console.log(' Run: claude-flow@alpha analysis token-usage --breakdown --cost-analysis');\n \n } catch (err) {\n printError(` Failed to setup monitoring: ${err.message}`);\n }\n}\n\n/**\n * Enhanced Claude Flow v2.0.0 initialization\n */\nasync function enhancedClaudeFlowInit(flags, subArgs = []) {\n console.log('šŸš€ Initializing Claude Flow v2.0.0 with enhanced features...');\n\n const workingDir = process.cwd();\n const force = flags.force || flags.f;\n const dryRun = flags.dryRun || flags['dry-run'] || flags.d;\n const initSparc = flags.roo || (subArgs && subArgs.includes('--roo')); // SPARC only with --roo flag\n\n // Parse --agent flag for specialized agent setup\n const agentType = flags.agent || (subArgs && subArgs.find(arg => arg.startsWith('--agent='))?.split('=')[1]);\n const initReasoning = agentType === 'reasoning' || (subArgs && subArgs.includes('--agent') && subArgs.includes('reasoning'));\n\n // Store parameters to avoid scope issues in async context\n const args = subArgs || [];\n const options = flags || {};\n\n // Import fs module for Node.js\n const fs = await import('fs/promises');\n const { chmod } = fs;\n\n try {\n // Check existing files\n const existingFiles = [];\n const filesToCheck = [\n 'CLAUDE.md',\n '.claude/settings.json',\n '.mcp.json',\n // Removed claude-flow@alpha.config.json per user request\n ];\n\n for (const file of filesToCheck) {\n if (existsSync(`${workingDir}/${file}`)) {\n existingFiles.push(file);\n }\n }\n\n if (existingFiles.length > 0 && !force) {\n printWarning(`The following files already exist: ${existingFiles.join(', ')}`);\n console.log('Use --force to overwrite existing files');\n return;\n }\n\n // Create CLAUDE.md\n if (!dryRun) {\n await fs.writeFile(`${workingDir}/CLAUDE.md`, createOptimizedSparcClaudeMd(), 'utf8');\n printSuccess('āœ“ Created CLAUDE.md (Claude Flow v2.0.0 - Optimized)');\n } else {\n console.log('[DRY RUN] Would create CLAUDE.md (Claude Flow v2.0.0 - Optimized)');\n }\n\n // Create .claude directory structure\n const claudeDir = `${workingDir}/.claude`;\n if (!dryRun) {\n await fs.mkdir(claudeDir, { recursive: true });\n await fs.mkdir(`${claudeDir}/commands`, { recursive: true });\n await fs.mkdir(`${claudeDir}/helpers`, { recursive: true });\n printSuccess('āœ“ Created .claude directory structure');\n } else {\n console.log('[DRY RUN] Would create .claude directory structure');\n }\n\n // Create settings.json\n if (!dryRun) {\n await fs.writeFile(`${claudeDir}/settings.json`, createEnhancedSettingsJson(), 'utf8');\n printSuccess('āœ“ Created .claude/settings.json with hooks and MCP configuration');\n } else {\n console.log('[DRY RUN] Would create .claude/settings.json');\n }\n\n // Copy statusline script\n try {\n let statuslineTemplate;\n try {\n // Try to read from templates directory first\n statuslineTemplate = await fs.readFile(\n path.join(__dirname, 'templates', 'statusline-command.sh'),\n 'utf8'\n );\n } catch {\n // Fallback to embedded content (for binary builds)\n statuslineTemplate = createStatuslineScript();\n }\n\n if (!dryRun) {\n // Write to project .claude directory\n await fs.writeFile(`${claudeDir}/statusline-command.sh`, statuslineTemplate, 'utf8');\n await fs.chmod(`${claudeDir}/statusline-command.sh`, 0o755);\n\n // Also write to home ~/.claude directory for global use\n const homeClaudeDir = path.join(os.homedir(), '.claude');\n await fs.mkdir(homeClaudeDir, { recursive: true });\n await fs.writeFile(path.join(homeClaudeDir, 'statusline-command.sh'), statuslineTemplate, 'utf8');\n await fs.chmod(path.join(homeClaudeDir, 'statusline-command.sh'), 0o755);\n\n printSuccess('āœ“ Created statusline-command.sh in both .claude/ and ~/.claude/');\n } else {\n console.log('[DRY RUN] Would create .claude/statusline-command.sh and ~/.claude/statusline-command.sh');\n }\n } catch (err) {\n // Not critical, just skip\n if (!dryRun) {\n console.log(' āš ļø Could not create statusline script, skipping...');\n }\n }\n\n // Create settings.local.json with default MCP permissions\n const settingsLocal = {\n permissions: {\n allow: ['mcp__ruv-swarm', 'mcp__claude-flow@alpha', 'mcp__flow-nexus'],\n deny: [],\n },\n };\n\n if (!dryRun) {\n await fs.writeFile(\n `${claudeDir}/settings.local.json`, JSON.stringify(settingsLocal, null, 2, 'utf8'),\n );\n printSuccess('āœ“ Created .claude/settings.local.json with default MCP permissions');\n } else {\n console.log(\n '[DRY RUN] Would create .claude/settings.local.json with default MCP permissions',\n );\n }\n\n // Create .mcp.json at project root for MCP server configuration\n const mcpConfig = {\n mcpServers: {\n 'claude-flow@alpha': {\n command: 'npx',\n args: ['claude-flow@alpha', 'mcp', 'start'],\n type: 'stdio',\n },\n 'ruv-swarm': {\n command: 'npx',\n args: ['ruv-swarm@latest', 'mcp', 'start'],\n type: 'stdio',\n },\n 'flow-nexus': {\n command: 'npx',\n args: ['flow-nexus@latest', 'mcp', 'start'],\n type: 'stdio',\n },\n 'agentic-payments': {\n command: 'npx',\n args: ['agentic-payments@latest', 'mcp'],\n type: 'stdio',\n },\n },\n };\n\n if (!dryRun) {\n await fs.writeFile(`${workingDir}/.mcp.json`, JSON.stringify(mcpConfig, null, 2, 'utf8'));\n printSuccess('āœ“ Created .mcp.json at project root for MCP server configuration');\n } else {\n console.log('[DRY RUN] Would create .mcp.json at project root for MCP server configuration');\n }\n\n // Removed claude-flow@alpha.config.json creation per user request\n\n // Create command documentation\n for (const [category, commands] of Object.entries(COMMAND_STRUCTURE)) {\n const categoryDir = `${claudeDir}/commands/${category}`;\n\n if (!dryRun) {\n await fs.mkdir(categoryDir, { recursive: true });\n\n // Create category README\n const categoryReadme = `# ${category.charAt(0).toUpperCase() + category.slice(1)} Commands\n\nCommands for ${category} operations in Claude Flow.\n\n## Available Commands\n\n${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\\n')}\n`;\n await fs.writeFile(`${categoryDir}/README.md`, categoryReadme, 'utf8');\n\n // Create individual command docs\n for (const command of commands) {\n const doc = createCommandDoc(category, command);\n if (doc) {\n await fs.writeFile(`${categoryDir}/${command}.md`, doc, 'utf8');\n }\n }\n\n console.log(` āœ“ Created ${commands.length} ${category} command docs`);\n } else {\n console.log(`[DRY RUN] Would create ${commands.length} ${category} command docs`);\n }\n }\n\n // Create wrapper scripts using the dedicated function\n if (!dryRun) {\n await createLocalExecutable(workingDir, dryRun);\n } else {\n console.log('[DRY RUN] Would create wrapper scripts');\n }\n\n // Create helper scripts\n const helpers = ['setup-mcp.sh', 'quick-start.sh', 'github-setup.sh', 'github-safe.js', 'standard-checkpoint-hooks.sh', 'checkpoint-manager.sh'];\n for (const helper of helpers) {\n if (!dryRun) {\n const content = createHelperScript(helper);\n if (content) {\n await fs.writeFile(`${claudeDir}/helpers/${helper}`, content, 'utf8');\n await fs.chmod(`${claudeDir}/helpers/${helper}`, 0o755);\n }\n }\n }\n\n if (!dryRun) {\n printSuccess(`āœ“ Created ${helpers.length} helper scripts`);\n } else {\n console.log(`[DRY RUN] Would create ${helpers.length} helper scripts`);\n }\n\n // Create standard directories from original init\n const standardDirs = [\n 'memory',\n 'memory/agents',\n 'memory/sessions',\n 'coordination',\n 'coordination/memory_bank',\n 'coordination/subtasks',\n 'coordination/orchestration',\n '.swarm', // Add .swarm directory for shared memory\n '.hive-mind', // Add .hive-mind directory for hive-mind system\n '.claude/checkpoints', // Add checkpoints directory for Git checkpoint system\n ];\n\n for (const dir of standardDirs) {\n if (!dryRun) {\n await fs.mkdir(`${workingDir}/${dir}`, { recursive: true });\n }\n }\n\n if (!dryRun) {\n printSuccess('āœ“ Created standard directory structure');\n\n // Initialize memory system\n const initialData = { agents: [], tasks: [], lastUpdated: Date.now() };\n await fs.writeFile(\n `${workingDir}/memory/claude-flow@alpha-data.json`, JSON.stringify(initialData, null, 2, 'utf8'),\n );\n\n // Create README files\n await fs.writeFile(`${workingDir}/memory/agents/README.md`, createAgentsReadme(), 'utf8');\n await fs.writeFile(`${workingDir}/memory/sessions/README.md`, createSessionsReadme(), 'utf8');\n\n printSuccess('āœ“ Initialized memory system');\n\n // Initialize memory database with fallback support\n try {\n // Import and initialize FallbackMemoryStore to create the database\n const { FallbackMemoryStore } = await import('../../../memory/fallback-store.js');\n const memoryStore = new FallbackMemoryStore();\n await memoryStore.initialize();\n\n if (memoryStore.isUsingFallback()) {\n printSuccess('āœ“ Initialized memory system (in-memory fallback for npx compatibility)');\n console.log(\n ' šŸ’” For persistent storage, install locally: npm install claude-flow@alpha',\n );\n } else {\n printSuccess('āœ“ Initialized memory database (.swarm/memory.db)');\n }\n\n memoryStore.close();\n } catch (err) {\n console.log(` āš ļø Could not initialize memory system: ${err.message}`);\n console.log(' Memory will be initialized on first use');\n }\n\n // Initialize comprehensive hive-mind system\n console.log('\\n🧠 Initializing Hive Mind System...');\n try {\n const hiveMindOptions = {\n config: {\n integration: {\n claudeCode: { enabled: isClaudeCodeInstalled() },\n mcpTools: { enabled: true }\n },\n monitoring: { enabled: flags.monitoring || false }\n }\n };\n \n const hiveMindResult = await initializeHiveMind(workingDir, hiveMindOptions, dryRun);\n \n if (hiveMindResult.success) {\n printSuccess(`āœ“ Hive Mind System initialized with ${hiveMindResult.features.length} features`);\n \n // Log individual features\n hiveMindResult.features.forEach(feature => {\n console.log(` • ${feature}`);\n });\n } else {\n console.log(` āš ļø Hive Mind initialization failed: ${hiveMindResult.error}`);\n if (hiveMindResult.rollbackRequired) {\n console.log(' šŸ”„ Automatic rollback may be required');\n }\n }\n } catch (err) {\n console.log(` āš ļø Could not initialize hive-mind system: ${err.message}`);\n }\n }\n\n // Update .gitignore with Claude Flow entries\n const gitignoreResult = await updateGitignore(workingDir, force, dryRun);\n if (gitignoreResult.success) {\n if (!dryRun) {\n printSuccess(`āœ“ ${gitignoreResult.message}`);\n } else {\n console.log(gitignoreResult.message);\n }\n } else {\n console.log(` āš ļø ${gitignoreResult.message}`);\n }\n\n // SPARC initialization (only with --roo flag)\n let sparcInitialized = false;\n if (initSparc) {\n console.log('\\nšŸš€ Initializing SPARC development environment...');\n try {\n // Run create-sparc\n console.log(' šŸ”„ Running: npx -y create-sparc init --force');\n execSync('npx -y create-sparc init --force', {\n cwd: workingDir,\n stdio: 'inherit',\n });\n sparcInitialized = true;\n printSuccess('āœ… SPARC environment initialized successfully');\n } catch (err) {\n console.log(` āš ļø Could not run create-sparc: ${err.message}`);\n console.log(' SPARC features will be limited to basic functionality');\n }\n }\n\n // Create Claude slash commands for SPARC\n if (sparcInitialized && !dryRun) {\n console.log('\\nšŸ“ Creating Claude Code slash commands...');\n await createClaudeSlashCommands(workingDir);\n }\n\n // Check for Claude Code and set up MCP servers (always enabled by default)\n if (!dryRun && isClaudeCodeInstalled()) {\n console.log('\\nšŸ” Claude Code CLI detected!');\n const skipMcp =\n (options && options['skip-mcp']) ||\n (subArgs && subArgs.includes && subArgs.includes('--skip-mcp'));\n\n if (!skipMcp) {\n await setupMcpServers(dryRun);\n } else {\n console.log(' ā„¹ļø Skipping MCP setup (--skip-mcp flag used)');\n console.log('\\n šŸ“‹ To add MCP servers manually:');\n console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n console.log('\\n šŸ’” MCP servers are defined in .mcp.json (project scope)');\n }\n } else if (!dryRun && !isClaudeCodeInstalled()) {\n console.log('\\nāš ļø Claude Code CLI not detected!');\n console.log('\\n šŸ“„ To install Claude Code:');\n console.log(' npm install -g @anthropic-ai/claude-code');\n console.log('\\n šŸ“‹ After installing, add MCP servers:');\n console.log(' claude mcp add claude-flow@alpha npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n console.log('\\n šŸ’” MCP servers are defined in .mcp.json (project scope)');\n }\n\n // Create agent directories and copy all agent files\n console.log('\\nšŸ¤– Setting up agent system...');\n if (!dryRun) {\n await createAgentDirectories(workingDir, dryRun);\n const agentResult = await copyAgentFiles(workingDir, {\n force: force,\n dryRun: dryRun\n });\n\n if (agentResult.success) {\n await validateAgentSystem(workingDir);\n\n // Copy command files including Flow Nexus commands\n console.log('\\nšŸ“š Setting up command system...');\n const commandResult = await copyCommandFiles(workingDir, {\n force: force,\n dryRun: dryRun\n });\n\n if (commandResult.success) {\n console.log('āœ… āœ“ Command system setup complete with Flow Nexus integration');\n } else {\n console.log('āš ļø Command system setup failed:', commandResult.error);\n }\n\n console.log('āœ… āœ“ Agent system setup complete with 64 specialized agents');\n } else {\n console.log('āš ļø Agent system setup failed:', agentResult.error);\n }\n\n // Setup reasoning agents if --agent reasoning flag is used\n if (initReasoning) {\n console.log('\\n🧠 Setting up reasoning agents with ReasoningBank integration...');\n try {\n const reasoningAgentsDir = `${workingDir}/.claude/agents/reasoning`;\n await fs.mkdir(reasoningAgentsDir, { recursive: true });\n\n // Import path module\n const path = await import('path');\n const { fileURLToPath } = await import('url');\n const { dirname, join } = path.default;\n\n // Get the source reasoning agents directory\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const sourceReasoningDir = join(__dirname, '../../../../.claude/agents/reasoning');\n\n // Copy reasoning agent files\n try {\n const reasoningFiles = await fs.readdir(sourceReasoningDir);\n let copiedReasoningAgents = 0;\n\n for (const file of reasoningFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = join(sourceReasoningDir, file);\n const destPath = join(reasoningAgentsDir, file);\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedReasoningAgents++;\n }\n }\n\n printSuccess(`āœ“ Copied ${copiedReasoningAgents} reasoning agent files`);\n console.log(' šŸ“š Reasoning agents available:');\n console.log(' • goal-planner - Goal-Oriented Action Planning specialist');\n console.log(' • sublinear-goal-planner - Sub-linear complexity goal planning');\n console.log(' šŸ’” Use: npx agentic-flow --agent goal-planner --task \"your task\"');\n console.log(' šŸ“– Documentation: .claude/agents/reasoning/README.md');\n } catch (err) {\n console.log(` āš ļø Could not copy reasoning agents: ${err.message}`);\n console.log(' Reasoning agents may not be available yet');\n }\n } catch (err) {\n console.log(` āš ļø Reasoning agent setup failed: ${err.message}`);\n }\n }\n } else {\n console.log(' [DRY RUN] Would create agent system with 64 specialized agents');\n if (initReasoning) {\n console.log(' [DRY RUN] Would also setup reasoning agents with ReasoningBank integration');\n }\n }\n\n // Optional: Setup monitoring and telemetry\n const enableMonitoring = flags.monitoring || flags['enable-monitoring'];\n if (enableMonitoring && !dryRun) {\n console.log('\\nšŸ“Š Setting up monitoring and telemetry...');\n await setupMonitoring(workingDir);\n }\n \n // Final instructions with hive-mind status\n console.log('\\nšŸŽ‰ Claude Flow v2.0.0 initialization complete!');\n \n // Display hive-mind status\n const hiveMindStatus = getHiveMindStatus(workingDir);\n console.log('\\n🧠 Hive Mind System Status:');\n console.log(` Configuration: ${hiveMindStatus.configured ? 'āœ… Ready' : 'āŒ Missing'}`);\n console.log(` Database: ${hiveMindStatus.database === 'sqlite' ? 'āœ… SQLite' : hiveMindStatus.database === 'fallback' ? 'āš ļø JSON Fallback' : 'āŒ Not initialized'}`);\n console.log(` Directory Structure: ${hiveMindStatus.directories ? 'āœ… Created' : 'āŒ Missing'}`);\n \n console.log('\\nšŸ“š Quick Start:');\n if (isClaudeCodeInstalled()) {\n console.log('1. View available commands: ls .claude/commands/');\n console.log('2. Start a swarm: npx claude-flow@alpha swarm \"your objective\" --claude');\n console.log('3. Use hive-mind: npx claude-flow@alpha hive-mind spawn \"command\" --claude');\n console.log('4. Use MCP tools in Claude Code for enhanced coordination');\n if (hiveMindStatus.configured) {\n console.log('5. Initialize first swarm: npx claude-flow@alpha hive-mind init');\n }\n } else {\n console.log('1. Install Claude Code: npm install -g @anthropic-ai/claude-code');\n console.log('2. Add MCP servers (see instructions above)');\n console.log('3. View available commands: ls .claude/commands/');\n console.log('4. Start a swarm: npx claude-flow@alpha swarm \"your objective\" --claude');\n console.log('5. Use hive-mind: npx claude-flow@alpha hive-mind spawn \"command\" --claude');\n if (hiveMindStatus.configured) {\n console.log('6. Initialize first swarm: npx claude-flow@alpha hive-mind init');\n }\n }\n console.log('\\nšŸ’” Tips:');\n console.log('• Check .claude/commands/ for detailed documentation');\n console.log('• Use --help with any command for options');\n console.log('• Run commands with --claude flag for best Claude Code integration');\n console.log('• Enable GitHub integration with .claude/helpers/github-setup.sh');\n console.log('• Git checkpoints are automatically enabled in settings.json');\n console.log('• Use .claude/helpers/checkpoint-manager.sh for easy rollback');\n } catch (err) {\n printError(`Failed to initialize Claude Flow v2.0.0: ${err.message}`);\n \n // Attempt hive-mind rollback if it was partially initialized\n try {\n const hiveMindStatus = getHiveMindStatus(workingDir);\n if (hiveMindStatus.directories || hiveMindStatus.configured) {\n console.log('\\nšŸ”„ Attempting hive-mind system rollback...');\n const rollbackResult = await rollbackHiveMindInit(workingDir);\n if (rollbackResult.success) {\n console.log(' āœ… Hive-mind rollback completed');\n } else {\n console.log(` āš ļø Hive-mind rollback failed: ${rollbackResult.error}`);\n }\n }\n } catch (rollbackErr) {\n console.log(` āš ļø Rollback error: ${rollbackErr.message}`);\n }\n }\n}\n\n/**\n * Flow Nexus minimal initialization - only creates Flow Nexus CLAUDE.md, commands, and agents\n */\nasync function flowNexusMinimalInit(flags, subArgs) {\n console.log('🌐 Flow Nexus: Initializing minimal setup...');\n \n try {\n const force = flags.force || flags.f;\n \n // Import functions we need\n const { createFlowNexusClaudeMd } = await import('./templates/claude-md.js');\n const { promises: fs } = await import('fs');\n \n // Create Flow Nexus CLAUDE.md\n console.log('šŸ“ Creating Flow Nexus CLAUDE.md...');\n const flowNexusClaudeMd = createFlowNexusClaudeMd();\n await fs.writeFile('CLAUDE.md', flowNexusClaudeMd);\n console.log(' āœ… Created CLAUDE.md with Flow Nexus integration');\n \n // Create .claude/commands/flow-nexus directory and copy commands\n console.log('šŸ“ Setting up Flow Nexus commands...');\n await fs.mkdir('.claude/commands/flow-nexus', { recursive: true });\n \n // Copy Flow Nexus command files\n const { fileURLToPath } = await import('url');\n const { dirname, join } = await import('path');\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const sourceCommandsDir = join(__dirname, '../../../../.claude/commands/flow-nexus');\n try {\n const commandFiles = await fs.readdir(sourceCommandsDir);\n let copiedCommands = 0;\n \n for (const file of commandFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = `${sourceCommandsDir}/${file}`;\n const destPath = `.claude/commands/flow-nexus/${file}`;\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedCommands++;\n }\n }\n \n console.log(` āœ… Copied ${copiedCommands} Flow Nexus command files`);\n } catch (err) {\n console.log(' āš ļø Could not copy Flow Nexus commands:', err.message);\n }\n \n // Create .claude/agents/flow-nexus directory and copy agents\n console.log('šŸ¤– Setting up Flow Nexus agents...');\n await fs.mkdir('.claude/agents/flow-nexus', { recursive: true });\n \n // Copy Flow Nexus agent files\n const sourceAgentsDir = join(__dirname, '../../../../.claude/agents/flow-nexus');\n try {\n const agentFiles = await fs.readdir(sourceAgentsDir);\n let copiedAgents = 0;\n \n for (const file of agentFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = `${sourceAgentsDir}/${file}`;\n const destPath = `.claude/agents/flow-nexus/${file}`;\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedAgents++;\n }\n }\n \n console.log(` āœ… Copied ${copiedAgents} Flow Nexus agent files`);\n } catch (err) {\n console.log(' āš ļø Could not copy Flow Nexus agents:', err.message);\n }\n \n console.log('\\nšŸŽ‰ Flow Nexus minimal initialization complete!');\n console.log('šŸ“š Created: CLAUDE.md with Flow Nexus documentation');\n console.log('šŸ“ Created: .claude/commands/flow-nexus/ directory with command documentation');\n console.log('šŸ¤– Created: .claude/agents/flow-nexus/ directory with specialized agents');\n console.log('');\n console.log('šŸ’” Quick Start:');\n console.log(' 1. Register: mcp__flow-nexus__user_register({ email, password })');\n console.log(' 2. Login: mcp__flow-nexus__user_login({ email, password })');\n console.log(' 3. Deploy: mcp__flow-nexus__swarm_init({ topology: \"mesh\", maxAgents: 5 })');\n console.log('');\n console.log('šŸ”— Use Flow Nexus MCP tools in Claude Code for full functionality');\n \n } catch (err) {\n console.log(`āŒ Flow Nexus initialization failed: ${err.message}`);\n console.log('Stack trace:', err.stack);\n process.exit(1);\n }\n}\n"],"names":["printSuccess","printError","printWarning","existsSync","process","os","spawn","execSync","runCommand","command","args","options","Promise","resolve","reject","child","cwd","env","stdio","stdout","stderr","on","data","code","success","Error","createLocalExecutable","createSparcStructureManually","createClaudeSlashCommands","createOptimizedClaudeSlashCommands","promises","fs","copyTemplates","copyRevisedTemplates","validateTemplatesExist","copyAgentFiles","createAgentDirectories","validateAgentSystem","copyCommandFiles","showInitHelp","batchInitCommand","batchInitFromConfig","validateBatchOptions","ValidationSystem","runFullValidation","RollbackSystem","createAtomicOperation","createEnhancedSettingsJson","createCommandDoc","createHelperScript","COMMAND_STRUCTURE","createOptimizedSparcClaudeMd","getIsolatedNpxEnv","updateGitignore","createFullClaudeMd","createSparcClaudeMd","createMinimalClaudeMd","createFullMemoryBankMd","createMinimalMemoryBankMd","createFullCoordinationMd","createMinimalCoordinationMd","createAgentsReadme","createSessionsReadme","initializeHiveMind","getHiveMindStatus","rollbackHiveMindInit","isClaudeCodeInstalled","setupMcpServers","dryRun","console","log","servers","name","description","server","err","message","createStatuslineScript","MEM_COLOR","MEM_PERCENT","CPU_COLOR","CPU_LOAD","SUCCESS_COLOR","SUCCESS_RATE","initCommand","subArgs","flags","help","h","includes","generateEnvTemplate","workingDir","PWD","force","f","result","created","exists","hasVerificationFlags","verify","pair","flowNexusMinimalInit","basic","minimal","sparc","enhancedClaudeFlowInit","handleValidationCommand","handleRollbackCommand","handleListBackups","batchInitFlag","configFlag","config","handleBatchInit","useEnhanced","enhancedInitCommand","initForce","initMinimal","initSparc","roo","initDryRun","initOptimized","selectedModes","modes","split","initVerify","initPair","chdir","files","existingFiles","file","stat","push","length","join","templateOptions","optimized","createVerificationClaudeMd","createVerificationSettingsJson","writeFile","mkdir","recursive","validation","valid","revisedResults","verbose","copyResults","skipClaudeMd","skipSettings","copiedFiles","skippedFiles","errors","forEach","sparcInitialized","createSparcResult","modeCount","gitignoreResult","hiveMindOptions","integration","claudeCode","enabled","mcpTools","monitoring","hiveMindResult","error","skipMcp","parallel","s","m","maxConcurrency","progressTracking","template","environments","map","trim","validationErrors","configFile","results","projectsString","projects","project","successful","filter","r","failed","rollbackSystem","validationSystem","atomicOp","initOptions","skipPreValidation","skipBackup","validateOnly","preValidation","validatePreInit","warnings","warning","warn","backupResult","createPreInitBackup","atomicBegin","begin","performInitializationWithCheckpoints","postValidation","validatePostInit","rollback","configValidation","validateConfiguration","healthChecks","runHealthChecks","commit","fullValidation","postInit","skipPreInit","report","completed","rollbackError","skipConfig","skipModeTest","validationResults","exit","performFullRollback","phaseIndex","findIndex","arg","phase","performPartialRollback","rollbackPoints","listRollbackPoints","point","index","date","Date","timestamp","toLocaleString","type","latest","backupId","checkpoints","slice","checkpoint","status","phases","action","createInitialFiles","createDirectoryStructure","setupMemorySystem","setupCoordinationSystem","createCheckpoint","now","claudeMd","memoryBankMd","coordinationMd","directories","dir","initialData","agents","tasks","lastUpdated","JSON","stringify","setupMonitoring","path","trackingDir","tokenUsageFile","total","input","output","byAgent","toISOString","settingsPath","settingsContent","readFile","settings","parse","hooks","tokenTrackingHook","monitoringConfig","telemetry","value","tracking","tokens","costs","sessions","storage","location","format","rotation","configPath","envSnippet","envPath","d","agentType","agent","find","startsWith","initReasoning","chmod","filesToCheck","claudeDir","statuslineTemplate","__dirname","homeClaudeDir","homedir","settingsLocal","permissions","allow","deny","mcpConfig","mcpServers","category","commands","Object","entries","categoryDir","categoryReadme","charAt","toUpperCase","cmd","doc","helpers","helper","content","standardDirs","FallbackMemoryStore","memoryStore","initialize","isUsingFallback","close","features","feature","rollbackRequired","agentResult","commandResult","reasoningAgentsDir","fileURLToPath","dirname","default","__filename","url","sourceReasoningDir","reasoningFiles","readdir","copiedReasoningAgents","endsWith","sourcePath","destPath","enableMonitoring","hiveMindStatus","configured","database","rollbackResult","rollbackErr","createFlowNexusClaudeMd","flowNexusClaudeMd","sourceCommandsDir","commandFiles","copiedCommands","sourceAgentsDir","agentFiles","cop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AAE,OAAOK,KAAK;QACZN,QAAQC,GAAG,CAAC,CAAC,oCAAoC,EAAEK,IAAIC,OAAO,EAAE;QAChEP,QAAQC,GAAG,CAAC,gBAAgBK,IAAI4R,KAAK;QACrCnW,QAAQsN,IAAI,CAAC;IACf;AACF"} \ No newline at end of file +{"version":3,"sources":["../../../../../src/cli/simple-commands/init/index.js"],"sourcesContent":["// init/index.js - Initialize Claude Code integration files\nimport { printSuccess, printError, printWarning, exit } from '../../utils.js';\nimport { existsSync } from 'fs';\nimport process from 'process';\nimport os from 'os';\nimport { spawn, execSync } from 'child_process';\nimport { promisify } from 'util';\n\n// Helper to replace Deno.Command\nfunction runCommand(command, args, options = {}) {\n return new Promise((resolve, reject) => {\n const child = spawn(command, args, {\n cwd: options.cwd,\n env: { ...process.env, ...options.env },\n stdio: options.stdout === 'inherit' ? 'inherit' : 'pipe'\n });\n \n let stdout = '';\n let stderr = '';\n \n if (options.stdout !== 'inherit') {\n child.stdout.on('data', (data) => { stdout += data; });\n child.stderr.on('data', (data) => { stderr += data; });\n }\n \n child.on('close', (code) => {\n if (code === 0) {\n resolve({ success: true, code, stdout, stderr });\n } else {\n reject(new Error(`Command failed with exit code ${code}`));\n }\n });\n \n child.on('error', reject);\n });\n}\nimport { createLocalExecutable } from './executable-wrapper.js';\nimport { createSparcStructureManually } from './sparc-structure.js';\nimport { createClaudeSlashCommands } from './claude-commands/slash-commands.js';\nimport { createOptimizedClaudeSlashCommands } from './claude-commands/optimized-slash-commands.js';\n// execSync imported above as execSyncOriginal\\nconst execSync = execSyncOriginal;\nimport { promises as fs } from 'fs';\nimport { copyTemplates } from './template-copier.js';\nimport { copyRevisedTemplates, validateTemplatesExist } from './copy-revised-templates.js';\nimport { copyAgentFiles, createAgentDirectories, validateAgentSystem, copyCommandFiles } from './agent-copier.js';\nimport { showInitHelp } from './help.js';\nimport { batchInitCommand, batchInitFromConfig, validateBatchOptions } from './batch-init.js';\nimport { ValidationSystem, runFullValidation } from './validation/index.js';\nimport { RollbackSystem, createAtomicOperation } from './rollback/index.js';\nimport {\n createEnhancedClaudeMd,\n createEnhancedSettingsJson,\n createWrapperScript,\n createCommandDoc,\n createHelperScript,\n COMMAND_STRUCTURE,\n} from './templates/enhanced-templates.js';\nimport { createOptimizedSparcClaudeMd } from './templates/claude-md.js';\nimport { getIsolatedNpxEnv } from '../../../utils/npx-isolated-cache.js';\nimport { updateGitignore, needsGitignoreUpdate } from './gitignore-updater.js';\nimport {\n createFullClaudeMd,\n createSparcClaudeMd,\n createMinimalClaudeMd,\n} from './templates/claude-md.js';\nimport {\n createVerificationClaudeMd,\n createVerificationSettingsJson,\n} from './templates/verification-claude-md.js';\nimport {\n createFullMemoryBankMd,\n createMinimalMemoryBankMd,\n} from './templates/memory-bank-md.js';\nimport {\n createFullCoordinationMd,\n createMinimalCoordinationMd,\n} from './templates/coordination-md.js';\nimport { createAgentsReadme, createSessionsReadme } from './templates/readme-files.js';\nimport { \n initializeHiveMind, \n getHiveMindStatus,\n rollbackHiveMindInit\n} from './hive-mind-init.js';\n\n/**\n * Check if Claude Code CLI is installed\n */\nfunction isClaudeCodeInstalled() {\n try {\n execSync('which claude', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Set up MCP servers in Claude Code\n */\nasync function setupMcpServers(dryRun = false) {\n console.log('\\nšŸ”Œ Setting up MCP servers for Claude Code...');\n\n const servers = [\n {\n name: 'claude-flow',\n command: 'npx claude-flow@alpha mcp start',\n description: 'Claude Flow MCP server with swarm orchestration (alpha)',\n },\n {\n name: 'ruv-swarm',\n command: 'npx ruv-swarm mcp start',\n description: 'ruv-swarm MCP server for enhanced coordination',\n },\n {\n name: 'flow-nexus',\n command: 'npx flow-nexus@latest mcp start',\n description: 'Flow Nexus Complete MCP server for advanced AI orchestration',\n },\n {\n name: 'agentic-payments',\n command: 'npx agentic-payments@latest mcp',\n description: 'Agentic Payments MCP server for autonomous agent payment authorization',\n },\n ];\n\n for (const server of servers) {\n try {\n if (!dryRun) {\n console.log(` šŸ”„ Adding ${server.name}...`);\n execSync(`claude mcp add ${server.name} ${server.command}`, { stdio: 'inherit' });\n console.log(` āœ… Added ${server.name} - ${server.description}`);\n } else {\n console.log(` [DRY RUN] Would add ${server.name} - ${server.description}`);\n }\n } catch (err) {\n console.log(` āš ļø Failed to add ${server.name}: ${err.message}`);\n console.log(\n ` You can add it manually with: claude mcp add ${server.name} ${server.command}`,\n );\n }\n }\n\n if (!dryRun) {\n console.log('\\n šŸ“‹ Verifying MCP servers...');\n try {\n execSync('claude mcp list', { stdio: 'inherit' });\n } catch (err) {\n console.log(' āš ļø Could not verify MCP servers');\n }\n }\n}\n\n/**\n * Create statusline script content (embedded fallback for binary builds)\n */\nfunction createStatuslineScript() {\n return `\n#!/bin/bash\n\n# Read JSON input from stdin\nINPUT=$(cat)\nMODEL=$(echo \"$INPUT\" | jq -r \\'.model.display_name // \"Claude\"\\')\nCWD=$(echo \"$INPUT\" | jq -r \\'.workspace.current_dir // .cwd\\')\nDIR=$(basename \"$CWD\")\n\n# Replace claude-code-flow with branded name\nif [ \"$DIR\" = \"claude-code-flow\" ]; then\n DIR=\"🌊 Claude Flow\"\nfi\n\n# Get git branch\nBRANCH=$(cd \"$CWD\" 2>/dev/null && git branch --show-current 2>/dev/null)\n\n# Start building statusline\necho -ne \"\\\\033[1m$MODEL\\\\033[0m in \\\\033[36m$DIR\\\\033[0m\"\n[ -n \"$BRANCH\" ] && echo -ne \" on \\\\033[33māŽ‡ $BRANCH\\\\033[0m\"\n\n# Claude-Flow integration\nFLOW_DIR=\"$CWD/.claude-flow\"\n\nif [ -d \"$FLOW_DIR\" ]; then\n echo -ne \" │\"\n\n # 1. Swarm Configuration & Topology\n if [ -f \"$FLOW_DIR/swarm-config.json\" ]; then\n STRATEGY=$(jq -r \\'.defaultStrategy // empty\\' \"$FLOW_DIR/swarm-config.json\" 2>/dev/null)\n if [ -n \"$STRATEGY\" ]; then\n # Map strategy to topology icon\n case \"$STRATEGY\" in\n \"balanced\") TOPO_ICON=\"⚔mesh\" ;;\n \"conservative\") TOPO_ICON=\"⚔hier\" ;;\n \"aggressive\") TOPO_ICON=\"⚔ring\" ;;\n *) TOPO_ICON=\"⚔$STRATEGY\" ;;\n esac\n echo -ne \" \\\\033[35m$TOPO_ICON\\\\033[0m\"\n\n # Count agent profiles as \"configured agents\"\n AGENT_COUNT=$(jq -r \\'.agentProfiles | length\\' \"$FLOW_DIR/swarm-config.json\" 2>/dev/null)\n if [ -n \"$AGENT_COUNT\" ] && [ \"$AGENT_COUNT\" != \"null\" ] && [ \"$AGENT_COUNT\" -gt 0 ]; then\n echo -ne \" \\\\033[35mšŸ¤– $AGENT_COUNT\\\\033[0m\"\n fi\n fi\n fi\n\n # 2. Real-time System Metrics\n if [ -f \"$FLOW_DIR/metrics/system-metrics.json\" ]; then\n # Get latest metrics (last entry in array)\n LATEST=$(jq -r \\'.[-1]\\' \"$FLOW_DIR/metrics/system-metrics.json\" 2>/dev/null)\n\n if [ -n \"$LATEST\" ] && [ \"$LATEST\" != \"null\" ]; then\n # Memory usage\n MEM_PERCENT=$(echo \"$LATEST\" | jq -r \\'.memoryUsagePercent // 0\\' | awk \\'{printf \"%.0f\", $1}\\')\n if [ -n \"$MEM_PERCENT\" ] && [ \"$MEM_PERCENT\" != \"null\" ]; then\n # Color-coded memory (green <60%, yellow 60-80%, red >80%)\n if [ \"$MEM_PERCENT\" -lt 60 ]; then\n MEM_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$MEM_PERCENT\" -lt 80 ]; then\n MEM_COLOR=\"\\\\033[33m\" # Yellow\n else\n MEM_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${MEM_COLOR}šŸ’¾ ${MEM_PERCENT}%\\\\033[0m\"\n fi\n\n # CPU load\n CPU_LOAD=$(echo \"$LATEST\" | jq -r \\'.cpuLoad // 0\\' | awk \\'{printf \"%.0f\", $1 * 100}\\')\n if [ -n \"$CPU_LOAD\" ] && [ \"$CPU_LOAD\" != \"null\" ]; then\n # Color-coded CPU (green <50%, yellow 50-75%, red >75%)\n if [ \"$CPU_LOAD\" -lt 50 ]; then\n CPU_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$CPU_LOAD\" -lt 75 ]; then\n CPU_COLOR=\"\\\\033[33m\" # Yellow\n else\n CPU_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${CPU_COLOR}āš™ ${CPU_LOAD}%\\\\033[0m\"\n fi\n fi\n fi\n\n # 3. Session State\n if [ -f \"$FLOW_DIR/session-state.json\" ]; then\n SESSION_ID=$(jq -r \\'.sessionId // empty\\' \"$FLOW_DIR/session-state.json\" 2>/dev/null)\n ACTIVE=$(jq -r \\'.active // false\\' \"$FLOW_DIR/session-state.json\" 2>/dev/null)\n\n if [ \"$ACTIVE\" = \"true\" ] && [ -n \"$SESSION_ID\" ]; then\n # Show abbreviated session ID\n SHORT_ID=$(echo \"$SESSION_ID\" | cut -d\\'-\\' -f1)\n echo -ne \" \\\\033[34mšŸ”„ $SHORT_ID\\\\033[0m\"\n fi\n fi\n\n # 4. Performance Metrics from task-metrics.json\n if [ -f \"$FLOW_DIR/metrics/task-metrics.json\" ]; then\n # Parse task metrics for success rate, avg time, and streak\n METRICS=$(jq -r \\'\n # Calculate metrics\n (map(select(.success == true)) | length) as $successful |\n (length) as $total |\n (if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |\n (map(.duration // 0) | add / length) as $avg_duration |\n # Calculate streak (consecutive successes from end)\n (reverse |\n reduce .[] as $task (0;\n if $task.success == true then . + 1 else 0 end\n )\n ) as $streak |\n {\n success_rate: $success_rate,\n avg_duration: $avg_duration,\n streak: $streak,\n total: $total\n } | @json\n \\' \"$FLOW_DIR/metrics/task-metrics.json\" 2>/dev/null)\n\n if [ -n \"$METRICS\" ] && [ \"$METRICS\" != \"null\" ]; then\n # Success Rate\n SUCCESS_RATE=$(echo \"$METRICS\" | jq -r \\'.success_rate // 0\\' | awk \\'{printf \"%.0f\", $1}\\')\n TOTAL_TASKS=$(echo \"$METRICS\" | jq -r \\'.total // 0\\')\n\n if [ -n \"$SUCCESS_RATE\" ] && [ \"$TOTAL_TASKS\" -gt 0 ]; then\n # Color-code: Green (>80%), Yellow (60-80%), Red (<60%)\n if [ \"$SUCCESS_RATE\" -gt 80 ]; then\n SUCCESS_COLOR=\"\\\\033[32m\" # Green\n elif [ \"$SUCCESS_RATE\" -ge 60 ]; then\n SUCCESS_COLOR=\"\\\\033[33m\" # Yellow\n else\n SUCCESS_COLOR=\"\\\\033[31m\" # Red\n fi\n echo -ne \" ${SUCCESS_COLOR}šŸŽÆ ${SUCCESS_RATE}%\\\\033[0m\"\n fi\n\n # Average Time\n AVG_TIME=$(echo \"$METRICS\" | jq -r \\'.avg_duration // 0\\')\n if [ -n \"$AVG_TIME\" ] && [ \"$TOTAL_TASKS\" -gt 0 ]; then\n # Format smartly: seconds, minutes, or hours\n if [ $(echo \"$AVG_TIME < 60\" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fs\", $1}\\')\n elif [ $(echo \"$AVG_TIME < 3600\" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fm\", $1/60}\\')\n else\n TIME_STR=$(echo \"$AVG_TIME\" | awk \\'{printf \"%.1fh\", $1/3600}\\')\n fi\n echo -ne \" \\\\033[36mā±ļø $TIME_STR\\\\033[0m\"\n fi\n\n # Streak (only show if > 0)\n STREAK=$(echo \"$METRICS\" | jq -r \\'.streak // 0\\')\n if [ -n \"$STREAK\" ] && [ \"$STREAK\" -gt 0 ]; then\n echo -ne \" \\\\033[91mšŸ”„ $STREAK\\\\033[0m\"\n fi\n fi\n fi\n\n # 5. Active Tasks (check for task files)\n if [ -d \"$FLOW_DIR/tasks\" ]; then\n TASK_COUNT=$(find \"$FLOW_DIR/tasks\" -name \"*.json\" -type f 2>/dev/null | wc -l)\n if [ \"$TASK_COUNT\" -gt 0 ]; then\n echo -ne \" \\\\033[36mšŸ“‹ $TASK_COUNT\\\\033[0m\"\n fi\n fi\n\n # 6. Check for hooks activity\n if [ -f \"$FLOW_DIR/hooks-state.json\" ]; then\n HOOKS_ACTIVE=$(jq -r \\'.enabled // false\\' \"$FLOW_DIR/hooks-state.json\" 2>/dev/null)\n if [ \"$HOOKS_ACTIVE\" = \"true\" ]; then\n echo -ne \" \\\\033[35mšŸ”—\\\\033[0m\"\n fi\n fi\nfi\n\necho\n`;\n}\n\nexport async function initCommand(subArgs, flags) {\n // Show help if requested\n if (flags.help || flags.h || subArgs.includes('--help') || subArgs.includes('-h')) {\n showInitHelp();\n return;\n }\n\n // Handle --env flag for .env template generation\n if (flags.env || subArgs.includes('--env')) {\n const { generateEnvTemplate } = await import('../env-template.js');\n const workingDir = process.env.PWD || process.cwd();\n const force = flags.force || flags.f;\n\n console.log('šŸ“‹ Generating .env template file...\\n');\n const result = await generateEnvTemplate(workingDir, force);\n\n if (result.created) {\n console.log('\\nšŸ“š Next steps:');\n console.log('1. Open .env file and add your API keys');\n console.log('2. Get keys from:');\n console.log(' • Anthropic: https://console.anthropic.com/settings/keys');\n console.log(' • OpenRouter: https://openrouter.ai/keys');\n console.log('3. Enable memory: claude-flow agent run coder \"task\" --enable-memory\\n');\n console.log('šŸ’” See docs/REASONINGBANK-COST-OPTIMIZATION.md for cost savings tips');\n } else if (result.exists) {\n console.log('šŸ’” To overwrite: claude-flow init --env --force');\n }\n\n return;\n }\n\n // Check for verification flags first\n const hasVerificationFlags = subArgs.includes('--verify') || subArgs.includes('--pair') ||\n flags.verify || flags.pair;\n\n // Handle Flow Nexus minimal init\n if (flags['flow-nexus']) {\n return await flowNexusMinimalInit(flags, subArgs);\n }\n\n // Default to enhanced Claude Flow v2 init unless other modes are specified\n // Use --basic flag for old behavior, or verification flags for verification mode\n if (!flags.basic && !flags.minimal && !flags.sparc && !hasVerificationFlags) {\n return await enhancedClaudeFlowInit(flags, subArgs);\n }\n\n // Check for validation and rollback commands\n if (subArgs.includes('--validate') || subArgs.includes('--validate-only')) {\n return handleValidationCommand(subArgs, flags);\n }\n\n if (subArgs.includes('--rollback')) {\n return handleRollbackCommand(subArgs, flags);\n }\n\n if (subArgs.includes('--list-backups')) {\n return handleListBackups(subArgs, flags);\n }\n\n // Check for batch operations\n const batchInitFlag = flags['batch-init'] || subArgs.includes('--batch-init');\n const configFlag = flags.config || subArgs.includes('--config');\n\n if (batchInitFlag || configFlag) {\n return handleBatchInit(subArgs, flags);\n }\n\n // Check if enhanced initialization is requested\n const useEnhanced = subArgs.includes('--enhanced') || subArgs.includes('--safe');\n\n if (useEnhanced) {\n return enhancedInitCommand(subArgs, flags);\n }\n\n // Parse init options\n const initForce = subArgs.includes('--force') || subArgs.includes('-f') || flags.force;\n const initMinimal = subArgs.includes('--minimal') || subArgs.includes('-m') || flags.minimal;\n const initSparc = flags.roo || (subArgs && subArgs.includes('--roo')); // SPARC only with --roo flag\n const initDryRun = subArgs.includes('--dry-run') || subArgs.includes('-d') || flags.dryRun;\n const initOptimized = initSparc && initForce; // Use optimized templates when both flags are present\n const selectedModes = flags.modes ? flags.modes.split(',') : null; // Support selective mode initialization\n \n // Check for verification and pair programming flags\n const initVerify = subArgs.includes('--verify') || flags.verify;\n const initPair = subArgs.includes('--pair') || flags.pair;\n\n // Get the actual working directory (where the command was run from)\n // Use PWD environment variable which preserves the original directory\n const workingDir = process.env.PWD || cwd();\n console.log(`šŸ“ Initializing in: ${workingDir}`);\n\n // Change to the working directory to ensure all file operations happen there\n try {\n process.chdir(workingDir);\n } catch (err) {\n printWarning(`Could not change to directory ${workingDir}: ${err.message}`);\n }\n\n try {\n printSuccess('Initializing Claude Code integration files...');\n\n // Check if files already exist in the working directory\n const files = ['CLAUDE.md', 'memory-bank.md', 'coordination.md'];\n const existingFiles = [];\n\n for (const file of files) {\n try {\n await fs.stat(`${workingDir}/${file}`);\n existingFiles.push(file);\n } catch {\n // File doesn't exist, which is what we want\n }\n }\n\n if (existingFiles.length > 0 && !initForce) {\n printWarning(`The following files already exist: ${existingFiles.join(', ')}`);\n console.log('Use --force to overwrite existing files');\n return;\n }\n\n // Use template copier to copy all template files\n const templateOptions = {\n sparc: initSparc,\n minimal: initMinimal,\n optimized: initOptimized,\n dryRun: initDryRun,\n force: initForce,\n selectedModes: selectedModes,\n verify: initVerify,\n pair: initPair,\n };\n\n // If verification flags are set, always use generated templates for CLAUDE.md and settings.json\n if (initVerify || initPair) {\n console.log(' šŸ“ Creating verification-focused configuration...');\n \n // Create verification CLAUDE.md\n if (!initDryRun) {\n const { createVerificationClaudeMd, createVerificationSettingsJson } = await import('./templates/verification-claude-md.js');\n await fs.writeFile(`${workingDir}/CLAUDE.md`, createVerificationClaudeMd(), 'utf8');\n \n // Create .claude directory and settings\n await fs.mkdir(`${workingDir}/.claude`, { recursive: true });\n await fs.writeFile(`${workingDir}/.claude/settings.json`, createVerificationSettingsJson(), 'utf8');\n console.log(' āœ… Created verification-focused CLAUDE.md and settings.json');\n } else {\n console.log(' [DRY RUN] Would create verification-focused CLAUDE.md and settings.json');\n }\n \n // Copy other template files from repository if available\n const validation = validateTemplatesExist();\n if (validation.valid) {\n const revisedResults = await copyRevisedTemplates(workingDir, {\n force: initForce,\n dryRun: initDryRun,\n verbose: false,\n sparc: initSparc\n });\n }\n \n // Also create standard memory and coordination files\n const copyResults = await copyTemplates(workingDir, {\n ...templateOptions,\n skipClaudeMd: true, // Don't overwrite the verification CLAUDE.md\n skipSettings: true // Don't overwrite the verification settings.json\n });\n \n } else {\n // Standard template copying logic\n const validation = validateTemplatesExist();\n if (validation.valid) {\n console.log(' šŸ“ Copying revised template files...');\n const revisedResults = await copyRevisedTemplates(workingDir, {\n force: initForce,\n dryRun: initDryRun,\n verbose: true,\n sparc: initSparc\n });\n\n if (revisedResults.success) {\n console.log(` āœ… Copied ${revisedResults.copiedFiles.length} template files`);\n if (revisedResults.skippedFiles.length > 0) {\n console.log(` ā­ļø Skipped ${revisedResults.skippedFiles.length} existing files`);\n }\n } else {\n console.log(' āš ļø Some template files could not be copied:');\n revisedResults.errors.forEach(err => console.log(` - ${err}`));\n }\n } else {\n // Fall back to generated templates\n console.log(' āš ļø Revised templates not available, using generated templates');\n const copyResults = await copyTemplates(workingDir, templateOptions);\n\n if (!copyResults.success) {\n printError('Failed to copy templates:');\n copyResults.errors.forEach(err => console.log(` āŒ ${err}`));\n return;\n }\n }\n }\n\n // Agent setup moved to end of function where execution is guaranteed\n\n // Directory structure is created by template copier\n\n // SPARC files are created by template copier when --sparc flag is used\n\n // Memory README files and persistence database are created by template copier\n\n // Create local claude-flow@alpha executable wrapper\n if (!initDryRun) {\n await createLocalExecutable(workingDir);\n } else {\n console.log(' [DRY RUN] Would create local claude-flow@alpha executable wrapper');\n }\n\n // SPARC initialization\n if (initSparc) {\n console.log('\\nšŸš€ Initializing SPARC development environment...');\n\n if (initDryRun) {\n console.log(' [DRY RUN] Would run: npx -y create-sparc init --force');\n console.log(' [DRY RUN] Would create SPARC environment with all modes');\n console.log(\n ' [DRY RUN] Would create Claude slash commands' +\n (initOptimized ? ' (Batchtools-optimized)' : ''),\n );\n if (selectedModes) {\n console.log(\n ` [DRY RUN] Would create commands for selected modes: ${selectedModes.join(', ')}`,\n );\n }\n } else {\n // Check if create-sparc exists and run it\n let sparcInitialized = false;\n try {\n // Use isolated NPX cache to prevent concurrent conflicts\n console.log(' šŸ”„ Running: npx -y create-sparc init --force');\n const createSparcResult = await runCommand('npx', ['-y', 'create-sparc', 'init', '--force'], {\n cwd: workingDir,\n stdout: 'inherit',\n stderr: 'inherit',\n env: getIsolatedNpxEnv({\n PWD: workingDir,\n }),\n });\n\n if (createSparcResult.success) {\n console.log(' āœ… SPARC environment initialized successfully');\n sparcInitialized = true;\n } else {\n printWarning('create-sparc failed, creating basic SPARC structure manually...');\n\n // Fallback: create basic SPARC structure manually\n await createSparcStructureManually();\n sparcInitialized = true; // Manual creation still counts as initialized\n }\n } catch (err) {\n printWarning('create-sparc not available, creating basic SPARC structure manually...');\n\n // Fallback: create basic SPARC structure manually\n await createSparcStructureManually();\n sparcInitialized = true; // Manual creation still counts as initialized\n }\n\n // Always create Claude slash commands after SPARC initialization\n if (sparcInitialized) {\n try {\n if (initOptimized) {\n await createOptimizedClaudeSlashCommands(workingDir, selectedModes);\n } else {\n await createClaudeSlashCommands(workingDir);\n }\n } catch (err) {\n // Legacy slash command creation - silently skip if it fails\n // SPARC slash commands are already created successfully above\n }\n }\n }\n }\n\n if (initDryRun) {\n printSuccess(\"šŸ” Dry run completed! Here's what would be created:\");\n console.log('\\nšŸ“‹ Summary of planned initialization:');\n console.log(\n ` • Configuration: ${initOptimized ? 'Batchtools-optimized SPARC' : initSparc ? 'SPARC-enhanced' : 'Standard'}`,\n );\n console.log(\n ` • Template type: ${initOptimized ? 'Optimized for parallel processing' : 'Standard'}`,\n );\n console.log(' • Core files: CLAUDE.md, memory-bank.md, coordination.md');\n console.log(' • Directory structure: memory/, coordination/, .claude/');\n console.log(' • Local executable: ./claude-flow@alpha');\n if (initSparc) {\n console.log(\n ` • Claude Code slash commands: ${selectedModes ? selectedModes.length : 'All'} SPARC mode commands`,\n );\n console.log(' • SPARC environment with all development modes');\n }\n if (initOptimized) {\n console.log(' • Batchtools optimization: Enabled for parallel processing');\n console.log(' • Performance enhancements: Smart batching, concurrent operations');\n }\n console.log('\\nšŸš€ To proceed with initialization, run the same command without --dry-run');\n } else {\n printSuccess('šŸŽ‰ Claude Code integration files initialized successfully!');\n\n if (initOptimized) {\n console.log('\\n⚔ Batchtools Optimization Enabled!');\n console.log(' • Parallel processing capabilities activated');\n console.log(' • Performance improvements: 250-500% faster operations');\n console.log(' • Smart batching and concurrent operations available');\n }\n\n console.log('\\nšŸ“‹ What was created:');\n console.log(\n ` āœ… CLAUDE.md (${initOptimized ? 'Batchtools-optimized' : initSparc ? 'SPARC-enhanced' : 'Standard configuration'})`,\n );\n console.log(\n ` āœ… memory-bank.md (${initOptimized ? 'With parallel processing' : 'Standard memory system'})`,\n );\n console.log(\n ` āœ… coordination.md (${initOptimized ? 'Enhanced with batchtools' : 'Standard coordination'})`,\n );\n console.log(' āœ… Directory structure with memory/ and coordination/');\n console.log(' āœ… Local executable at ./claude-flow@alpha');\n console.log(' āœ… Persistence database at memory/claude-flow@alpha-data.json');\n console.log(' āœ… Agent system with 64 specialized agents in .claude/agents/');\n\n if (initSparc) {\n const modeCount = selectedModes ? selectedModes.length : '20+';\n console.log(` āœ… Claude Code slash commands (${modeCount} SPARC modes)`);\n console.log(' āœ… Complete SPARC development environment');\n }\n\n console.log('\\nšŸš€ Next steps:');\n console.log('1. Review and customize the generated files for your project');\n console.log(\"2. Run './claude-flow@alpha start' to begin the orchestration system\");\n console.log(\"3. Use './claude-flow@alpha' instead of 'npx claude-flow@alpha' for all commands\");\n console.log(\"4. Use 'claude --dangerously-skip-permissions' for unattended operation\");\n\n if (initSparc) {\n console.log(\n '5. Use Claude Code slash commands: /sparc, /sparc-architect, /sparc-tdd, etc.',\n );\n console.log(\"6. Explore SPARC modes with './claude-flow@alpha sparc modes'\");\n console.log('7. Try TDD workflow with \\'./claude-flow@alpha sparc tdd \"your task\"\\'');\n\n if (initOptimized) {\n console.log('8. Use batchtools commands: /batchtools, /performance for optimization');\n console.log('9. Enable parallel processing with --parallel flags');\n console.log(\"10. Monitor performance with './claude-flow@alpha performance monitor'\");\n }\n }\n\n // Update .gitignore\n const gitignoreResult = await updateGitignore(workingDir, initForce, initDryRun);\n if (gitignoreResult.success) {\n if (!initDryRun) {\n console.log(` āœ… ${gitignoreResult.message}`);\n } else {\n console.log(` ${gitignoreResult.message}`);\n }\n } else {\n console.log(` āš ļø ${gitignoreResult.message}`);\n }\n\n console.log('\\nšŸ’” Tips:');\n console.log(\" • Type '/' in Claude Code to see all available slash commands\");\n console.log(\" • Use './claude-flow@alpha status' to check system health\");\n console.log(\" • Store important context with './claude-flow@alpha memory store'\");\n\n if (initOptimized) {\n console.log(' • Use --parallel flags for concurrent operations');\n console.log(' • Enable batch processing for multiple related tasks');\n console.log(' • Monitor performance with real-time metrics');\n }\n\n // Initialize hive-mind system for standard init\n console.log('\\n🧠 Initializing basic hive-mind system...');\n try {\n const hiveMindOptions = {\n config: {\n integration: {\n claudeCode: { enabled: isClaudeCodeInstalled() },\n mcpTools: { enabled: true }\n },\n monitoring: { enabled: false } // Basic setup for standard init\n }\n };\n \n const hiveMindResult = await initializeHiveMind(workingDir, hiveMindOptions, false);\n \n if (hiveMindResult.success) {\n console.log(' āœ… Basic hive-mind system initialized');\n console.log(' šŸ’” Use \"npx claude-flow@alpha hive-mind\" for advanced features');\n } else {\n console.log(` āš ļø Hive-mind setup skipped: ${hiveMindResult.error}`);\n }\n } catch (err) {\n console.log(` āš ļø Hive-mind setup skipped: ${err.message}`);\n }\n\n // Check for Claude Code and set up MCP servers (always enabled by default)\n if (!initDryRun && isClaudeCodeInstalled()) {\n console.log('\\nšŸ” Claude Code CLI detected!');\n const skipMcp = subArgs && subArgs.includes && subArgs.includes('--skip-mcp');\n\n if (!skipMcp) {\n await setupMcpServers(initDryRun);\n } else {\n console.log(' ā„¹ļø Skipping MCP setup (--skip-mcp flag used)');\n }\n } else if (!initDryRun && !isClaudeCodeInstalled()) {\n console.log('\\nāš ļø Claude Code CLI not detected!');\n console.log(' šŸ“„ Install with: npm install -g @anthropic-ai/claude-code');\n console.log(' šŸ“‹ Then add MCP servers manually with:');\n console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n }\n }\n } catch (err) {\n printError(`Failed to initialize files: ${err.message}`);\n }\n}\n\n// Handle batch initialization\nasync function handleBatchInit(subArgs, flags) {\n try {\n // Options parsing from flags and subArgs\n const options = {\n parallel: !flags['no-parallel'] && flags.parallel !== false,\n sparc: flags.sparc || flags.s,\n minimal: flags.minimal || flags.m,\n force: flags.force || flags.f,\n maxConcurrency: flags['max-concurrent'] || 5,\n progressTracking: true,\n template: flags.template,\n environments: flags.environments\n ? flags.environments.split(',').map((env) => env.trim())\n : ['dev'],\n };\n\n // Validate options\n const validationErrors = validateBatchOptions(options);\n if (validationErrors.length > 0) {\n printError('Batch options validation failed:');\n validationErrors.forEach((error) => console.error(` - ${error}`));\n return;\n }\n\n // Config file mode\n if (flags.config) {\n const configFile = flags.config;\n printSuccess(`Loading batch configuration from: ${configFile}`);\n const results = await batchInitFromConfig(configFile, options);\n if (results) {\n printSuccess('Batch initialization from config completed');\n }\n return;\n }\n\n // Batch init mode\n if (flags['batch-init']) {\n const projectsString = flags['batch-init'];\n const projects = projectsString.split(',').map((project) => project.trim());\n\n if (projects.length === 0) {\n printError('No projects specified for batch initialization');\n return;\n }\n\n printSuccess(`Initializing ${projects.length} projects in batch mode`);\n const results = await batchInitCommand(projects, options);\n\n if (results) {\n const successful = results.filter((r) => r.success).length;\n const failed = results.filter((r) => !r.success).length;\n\n if (failed === 0) {\n printSuccess(`All ${successful} projects initialized successfully`);\n } else {\n printWarning(`${successful} projects succeeded, ${failed} failed`);\n }\n }\n return;\n }\n\n printError('No batch operation specified. Use --batch-init or --config ');\n } catch (err) {\n printError(`Batch initialization failed: ${err.message}`);\n }\n}\n\n/**\n * Enhanced initialization command with validation and rollback\n */\nasync function enhancedInitCommand(subArgs, flags) {\n console.log('šŸ›”ļø Starting enhanced initialization with validation and rollback...');\n\n // Store parameters to avoid scope issues in async context\n const args = subArgs || [];\n const options = flags || {};\n\n // Get the working directory\n const workingDir = process.env.PWD || process.cwd();\n\n // Initialize systems\n const rollbackSystem = new RollbackSystem(workingDir);\n const validationSystem = new ValidationSystem(workingDir);\n\n let atomicOp = null;\n\n try {\n // Parse options\n const initOptions = {\n force: args.includes('--force') || args.includes('-f') || options.force,\n minimal: args.includes('--minimal') || args.includes('-m') || options.minimal,\n sparc: args.includes('--sparc') || args.includes('-s') || options.sparc,\n skipPreValidation: args.includes('--skip-pre-validation'),\n skipBackup: args.includes('--skip-backup'),\n validateOnly: args.includes('--validate-only'),\n };\n\n // Phase 1: Pre-initialization validation\n if (!initOptions.skipPreValidation) {\n console.log('\\nšŸ” Phase 1: Pre-initialization validation...');\n const preValidation = await validationSystem.validatePreInit(initOptions);\n\n if (!preValidation.success) {\n printError('Pre-initialization validation failed:');\n preValidation.errors.forEach((error) => console.error(` āŒ ${error}`));\n return;\n }\n\n if (preValidation.warnings.length > 0) {\n printWarning('Pre-initialization warnings:');\n preValidation.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n printSuccess('Pre-initialization validation passed');\n }\n\n // Stop here if validation-only mode\n if (options.validateOnly) {\n console.log('\\nāœ… Validation-only mode completed');\n return;\n }\n\n // Phase 2: Create backup\n if (!options.skipBackup) {\n console.log('\\nšŸ’¾ Phase 2: Creating backup...');\n const backupResult = await rollbackSystem.createPreInitBackup();\n\n if (!backupResult.success) {\n printError('Backup creation failed:');\n backupResult.errors.forEach((error) => console.error(` āŒ ${error}`));\n return;\n }\n }\n\n // Phase 3: Initialize with atomic operations\n console.log('\\nšŸ”§ Phase 3: Atomic initialization...');\n atomicOp = createAtomicOperation(rollbackSystem, 'enhanced-init');\n\n const atomicBegin = await atomicOp.begin();\n if (!atomicBegin) {\n printError('Failed to begin atomic operation');\n return;\n }\n\n // Perform initialization steps with checkpoints\n await performInitializationWithCheckpoints(rollbackSystem, options, workingDir, dryRun);\n\n // Phase 4: Post-initialization validation\n console.log('\\nāœ… Phase 4: Post-initialization validation...');\n const postValidation = await validationSystem.validatePostInit();\n\n if (!postValidation.success) {\n printError('Post-initialization validation failed:');\n postValidation.errors.forEach((error) => console.error(` āŒ ${error}`));\n\n // Attempt automatic rollback\n console.log('\\nšŸ”„ Attempting automatic rollback...');\n await atomicOp.rollback();\n printWarning('Initialization rolled back due to validation failure');\n return;\n }\n\n // Phase 5: Configuration validation\n console.log('\\nšŸ”§ Phase 5: Configuration validation...');\n const configValidation = await validationSystem.validateConfiguration();\n\n if (configValidation.warnings.length > 0) {\n printWarning('Configuration warnings:');\n configValidation.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n // Phase 6: Health checks\n console.log('\\nšŸ„ Phase 6: System health checks...');\n const healthChecks = await validationSystem.runHealthChecks();\n\n if (healthChecks.warnings.length > 0) {\n printWarning('Health check warnings:');\n healthChecks.warnings.forEach((warning) => console.warn(` āš ļø ${warning}`));\n }\n\n // Commit atomic operation\n await atomicOp.commit();\n\n // Generate and display validation report\n const fullValidation = await runFullValidation(workingDir, {\n postInit: true,\n skipPreInit: options.skipPreValidation,\n });\n\n console.log('\\nšŸ“Š Validation Report:');\n console.log(fullValidation.report);\n\n printSuccess('šŸŽ‰ Enhanced initialization completed successfully!');\n console.log('\\n✨ Your SPARC environment is fully validated and ready to use');\n } catch (error) {\n printError(`Enhanced initialization failed: ${error.message}`);\n\n // Attempt rollback if atomic operation is active\n if (atomicOp && !atomicOp.completed) {\n console.log('\\nšŸ”„ Performing emergency rollback...');\n try {\n await atomicOp.rollback();\n printWarning('Emergency rollback completed');\n } catch (rollbackError) {\n printError(`Rollback also failed: ${rollbackError.message}`);\n }\n }\n }\n}\n\n/**\n * Handle validation commands\n */\nasync function handleValidationCommand(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n\n console.log('šŸ” Running validation checks...');\n\n const options = {\n skipPreInit: subArgs.includes('--skip-pre-init'),\n skipConfig: subArgs.includes('--skip-config'),\n skipModeTest: subArgs.includes('--skip-mode-test'),\n postInit: !subArgs.includes('--pre-init-only'),\n };\n\n try {\n const validationResults = await runFullValidation(workingDir, options);\n\n console.log('\\nšŸ“Š Validation Results:');\n console.log(validationResults.report);\n\n if (validationResults.success) {\n printSuccess('āœ… All validation checks passed');\n } else {\n printError('āŒ Some validation checks failed');\n process.exit(1);\n }\n } catch (error) {\n printError(`Validation failed: ${error.message}`);\n process.exit(1);\n }\n}\n\n/**\n * Handle rollback commands\n */\nasync function handleRollbackCommand(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n const rollbackSystem = new RollbackSystem(workingDir);\n\n try {\n // Check for specific rollback options\n if (subArgs.includes('--full')) {\n console.log('šŸ”„ Performing full rollback...');\n const result = await rollbackSystem.performFullRollback();\n\n if (result.success) {\n printSuccess('Full rollback completed successfully');\n } else {\n printError('Full rollback failed:');\n result.errors.forEach((error) => console.error(` āŒ ${error}`));\n }\n } else if (subArgs.includes('--partial')) {\n const phaseIndex = subArgs.findIndex((arg) => arg === '--phase');\n if (phaseIndex !== -1 && subArgs[phaseIndex + 1]) {\n const phase = subArgs[phaseIndex + 1];\n console.log(`šŸ”„ Performing partial rollback for phase: ${phase}`);\n\n const result = await rollbackSystem.performPartialRollback(phase);\n\n if (result.success) {\n printSuccess(`Partial rollback completed for phase: ${phase}`);\n } else {\n printError(`Partial rollback failed for phase: ${phase}`);\n result.errors.forEach((error) => console.error(` āŒ ${error}`));\n }\n } else {\n printError('Partial rollback requires --phase ');\n }\n } else {\n // Interactive rollback point selection\n const rollbackPoints = await rollbackSystem.listRollbackPoints();\n\n if (rollbackPoints.rollbackPoints.length === 0) {\n printWarning('No rollback points available');\n return;\n }\n\n console.log('\\nšŸ“‹ Available rollback points:');\n rollbackPoints.rollbackPoints.forEach((point, index) => {\n const date = new Date(point.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${point.type} - ${date}`);\n });\n\n // For now, rollback to the most recent point\n const latest = rollbackPoints.rollbackPoints[0];\n if (latest) {\n console.log(\n `\\nšŸ”„ Rolling back to: ${latest.type} (${new Date(latest.timestamp).toLocaleString()})`,\n );\n const result = await rollbackSystem.performFullRollback(latest.backupId);\n\n if (result.success) {\n printSuccess('Rollback completed successfully');\n } else {\n printError('Rollback failed');\n }\n }\n }\n } catch (error) {\n printError(`Rollback operation failed: ${error.message}`);\n }\n}\n\n/**\n * Handle list backups command\n */\nasync function handleListBackups(subArgs, flags) {\n const workingDir = process.env.PWD || process.cwd();\n const rollbackSystem = new RollbackSystem(workingDir);\n\n try {\n const rollbackPoints = await rollbackSystem.listRollbackPoints();\n\n console.log('\\nšŸ“‹ Rollback Points and Backups:');\n\n if (rollbackPoints.rollbackPoints.length === 0) {\n console.log(' No rollback points available');\n } else {\n console.log('\\nšŸ”„ Rollback Points:');\n rollbackPoints.rollbackPoints.forEach((point, index) => {\n const date = new Date(point.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${point.type} - ${date} (${point.backupId || 'No backup'})`);\n });\n }\n\n if (rollbackPoints.checkpoints.length > 0) {\n console.log('\\nšŸ“ Checkpoints:');\n rollbackPoints.checkpoints.slice(-5).forEach((checkpoint, index) => {\n const date = new Date(checkpoint.timestamp).toLocaleString();\n console.log(` ${index + 1}. ${checkpoint.phase} - ${date} (${checkpoint.status})`);\n });\n }\n } catch (error) {\n printError(`Failed to list backups: ${error.message}`);\n }\n}\n\n/**\n * Perform initialization with checkpoints\n */\nasync function performInitializationWithCheckpoints(\n rollbackSystem,\n options,\n workingDir,\n dryRun = false,\n) {\n const phases = [\n { name: 'file-creation', action: () => createInitialFiles(options, workingDir, dryRun) },\n { name: 'directory-structure', action: () => createDirectoryStructure(workingDir, dryRun) },\n { name: 'memory-setup', action: () => setupMemorySystem(workingDir, dryRun) },\n { name: 'coordination-setup', action: () => setupCoordinationSystem(workingDir, dryRun) },\n { name: 'executable-creation', action: () => createLocalExecutable(workingDir, dryRun) },\n ];\n\n if (options.sparc) {\n phases.push(\n { name: 'sparc-init', action: () => createSparcStructureManually() },\n { name: 'claude-commands', action: () => createClaudeSlashCommands(workingDir) },\n );\n }\n\n for (const phase of phases) {\n console.log(` šŸ”§ ${phase.name}...`);\n\n // Create checkpoint before phase\n await rollbackSystem.createCheckpoint(phase.name, {\n timestamp: Date.now(),\n phase: phase.name,\n });\n\n try {\n await phase.action();\n console.log(` āœ… ${phase.name} completed`);\n } catch (error) {\n console.error(` āŒ ${phase.name} failed: ${error.message}`);\n throw error;\n }\n }\n}\n\n// Helper functions for atomic initialization\nasync function createInitialFiles(options, workingDir, dryRun = false) {\n if (!dryRun) {\n const claudeMd = options.sparc\n ? createSparcClaudeMd()\n : options.minimal\n ? createMinimalClaudeMd()\n : createFullClaudeMd();\n await fs.writeFile(`${workingDir}/CLAUDE.md`, claudeMd, 'utf8');\n\n const memoryBankMd = options.minimal ? createMinimalMemoryBankMd() : createFullMemoryBankMd();\n await fs.writeFile(`${workingDir}/memory-bank.md`, memoryBankMd, 'utf8');\n\n const coordinationMd = options.minimal\n ? createMinimalCoordinationMd()\n : createFullCoordinationMd();\n await fs.writeFile(`${workingDir}/coordination.md`, coordinationMd, 'utf8');\n }\n}\n\nasync function createDirectoryStructure(workingDir, dryRun = false) {\n const directories = [\n 'memory',\n 'memory/agents',\n 'memory/sessions',\n 'coordination',\n 'coordination/memory_bank',\n 'coordination/subtasks',\n 'coordination/orchestration',\n '.claude',\n '.claude/commands',\n '.claude/logs',\n ];\n\n if (!dryRun) {\n for (const dir of directories) {\n await fs.mkdir(`${workingDir}/${dir}`, { recursive: true });\n }\n }\n}\n\nasync function setupMemorySystem(workingDir, dryRun = false) {\n if (!dryRun) {\n const initialData = { agents: [], tasks: [], lastUpdated: Date.now() };\n await fs.writeFile(\n `${workingDir}/memory/claude-flow@alpha-data.json`, JSON.stringify(initialData, null, 2), 'utf8'\n );\n\n await fs.writeFile(`${workingDir}/memory/agents/README.md`, createAgentsReadme(), 'utf8');\n await fs.writeFile(`${workingDir}/memory/sessions/README.md`, createSessionsReadme(), 'utf8');\n }\n}\n\nasync function setupCoordinationSystem(workingDir, dryRun = false) {\n // Coordination system is already set up by createDirectoryStructure\n // This is a placeholder for future coordination setup logic\n}\n\n/**\n * Setup monitoring and telemetry for token tracking\n */\nasync function setupMonitoring(workingDir) {\n console.log(' šŸ“ˆ Configuring token usage tracking...');\n \n const fs = await import('fs/promises');\n const path = await import('path');\n \n try {\n // Create .claude-flow@alpha directory for tracking data\n const trackingDir = path.join(workingDir, '.claude-flow@alpha');\n await fs.mkdir(trackingDir, { recursive: true });\n \n // Create initial token usage file\n const tokenUsageFile = path.join(trackingDir, 'token-usage.json');\n const initialData = {\n total: 0,\n input: 0,\n output: 0,\n byAgent: {},\n lastUpdated: new Date().toISOString()\n };\n \n await fs.writeFile(tokenUsageFile, JSON.stringify(initialData, null, 2));\n printSuccess(' āœ“ Created token usage tracking file');\n \n // Add telemetry configuration to .claude/settings.json if it exists\n const settingsPath = path.join(workingDir, '.claude', 'settings.json');\n try {\n const settingsContent = await fs.readFile(settingsPath, 'utf8');\n const settings = JSON.parse(settingsContent);\n \n // Add telemetry hook\n if (!settings.hooks) settings.hooks = {};\n if (!settings.hooks['post-task']) settings.hooks['post-task'] = [];\n \n // Add token tracking hook\n const tokenTrackingHook = 'npx claude-flow@alpha internal track-tokens --session-id {{session_id}} --tokens {{token_usage}}';\n if (!settings.hooks['post-task'].includes(tokenTrackingHook)) {\n settings.hooks['post-task'].push(tokenTrackingHook);\n }\n \n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2));\n printSuccess(' āœ“ Added token tracking hooks to settings');\n } catch (err) {\n console.log(' āš ļø Could not update settings.json:', err.message);\n }\n \n // Create monitoring configuration\n const monitoringConfig = {\n enabled: true,\n telemetry: {\n claudeCode: {\n env: 'CLAUDE_CODE_ENABLE_TELEMETRY',\n value: '1',\n description: 'Enable Claude Code OpenTelemetry metrics'\n }\n },\n tracking: {\n tokens: true,\n costs: true,\n agents: true,\n sessions: true\n },\n storage: {\n location: '.claude-flow@alpha/token-usage.json',\n format: 'json',\n rotation: 'monthly'\n }\n };\n \n const configPath = path.join(trackingDir, 'monitoring.config.json');\n await fs.writeFile(configPath, JSON.stringify(monitoringConfig, null, 2));\n printSuccess(' āœ“ Created monitoring configuration');\n \n // Create shell profile snippet for environment variable\n const envSnippet = `\n# Claude Flow Token Tracking\n# Add this to your shell profile (.bashrc, .zshrc, etc.)\nexport CLAUDE_CODE_ENABLE_TELEMETRY=1\n\n# Optional: Set custom metrics path\n# export CLAUDE_METRICS_PATH=\"$HOME/.claude/metrics\"\n`;\n \n const envPath = path.join(trackingDir, 'env-setup.sh');\n await fs.writeFile(envPath, envSnippet.trim());\n printSuccess(' āœ“ Created environment setup script');\n \n console.log('\\n šŸ“‹ To enable Claude Code telemetry:');\n console.log(' 1. Add to your shell profile: export CLAUDE_CODE_ENABLE_TELEMETRY=1');\n console.log(' 2. Or run: source .claude-flow@alpha/env-setup.sh');\n console.log('\\n šŸ’” Token usage will be tracked in .claude-flow@alpha/token-usage.json');\n console.log(' Run: claude-flow@alpha analysis token-usage --breakdown --cost-analysis');\n \n } catch (err) {\n printError(` Failed to setup monitoring: ${err.message}`);\n }\n}\n\n/**\n * Enhanced Claude Flow v2.0.0 initialization\n */\nasync function enhancedClaudeFlowInit(flags, subArgs = []) {\n console.log('šŸš€ Initializing Claude Flow v2.0.0 with enhanced features...');\n\n const workingDir = process.cwd();\n const force = flags.force || flags.f;\n const dryRun = flags.dryRun || flags['dry-run'] || flags.d;\n const initSparc = flags.roo || (subArgs && subArgs.includes('--roo')); // SPARC only with --roo flag\n\n // Parse --agent flag for specialized agent setup\n const agentType = flags.agent || (subArgs && subArgs.find(arg => arg.startsWith('--agent='))?.split('=')[1]);\n const initReasoning = agentType === 'reasoning' || (subArgs && subArgs.includes('--agent') && subArgs.includes('reasoning'));\n\n // Store parameters to avoid scope issues in async context\n const args = subArgs || [];\n const options = flags || {};\n\n // Import fs module for Node.js\n const fs = await import('fs/promises');\n const { chmod } = fs;\n\n try {\n // Check existing files\n const existingFiles = [];\n const filesToCheck = [\n 'CLAUDE.md',\n '.claude/settings.json',\n '.mcp.json',\n // Removed claude-flow@alpha.config.json per user request\n ];\n\n for (const file of filesToCheck) {\n if (existsSync(`${workingDir}/${file}`)) {\n existingFiles.push(file);\n }\n }\n\n if (existingFiles.length > 0 && !force) {\n printWarning(`The following files already exist: ${existingFiles.join(', ')}`);\n console.log('Use --force to overwrite existing files');\n return;\n }\n\n // Create CLAUDE.md\n if (!dryRun) {\n await fs.writeFile(`${workingDir}/CLAUDE.md`, createOptimizedSparcClaudeMd(), 'utf8');\n printSuccess('āœ“ Created CLAUDE.md (Claude Flow v2.0.0 - Optimized)');\n } else {\n console.log('[DRY RUN] Would create CLAUDE.md (Claude Flow v2.0.0 - Optimized)');\n }\n\n // Create .claude directory structure\n const claudeDir = `${workingDir}/.claude`;\n if (!dryRun) {\n await fs.mkdir(claudeDir, { recursive: true });\n await fs.mkdir(`${claudeDir}/commands`, { recursive: true });\n await fs.mkdir(`${claudeDir}/helpers`, { recursive: true });\n printSuccess('āœ“ Created .claude directory structure');\n } else {\n console.log('[DRY RUN] Would create .claude directory structure');\n }\n\n // Create settings.json\n if (!dryRun) {\n await fs.writeFile(`${claudeDir}/settings.json`, createEnhancedSettingsJson(), 'utf8');\n printSuccess('āœ“ Created .claude/settings.json with hooks and MCP configuration');\n } else {\n console.log('[DRY RUN] Would create .claude/settings.json');\n }\n\n // Copy statusline script\n try {\n let statuslineTemplate;\n try {\n // Try to read from templates directory first\n statuslineTemplate = await fs.readFile(\n path.join(__dirname, 'templates', 'statusline-command.sh'),\n 'utf8'\n );\n } catch {\n // Fallback to embedded content (for binary builds)\n statuslineTemplate = createStatuslineScript();\n }\n\n if (!dryRun) {\n // Write to project .claude directory\n await fs.writeFile(`${claudeDir}/statusline-command.sh`, statuslineTemplate, 'utf8');\n await fs.chmod(`${claudeDir}/statusline-command.sh`, 0o755);\n\n // Also write to home ~/.claude directory for global use\n const homeClaudeDir = path.join(os.homedir(), '.claude');\n await fs.mkdir(homeClaudeDir, { recursive: true });\n await fs.writeFile(path.join(homeClaudeDir, 'statusline-command.sh'), statuslineTemplate, 'utf8');\n await fs.chmod(path.join(homeClaudeDir, 'statusline-command.sh'), 0o755);\n\n printSuccess('āœ“ Created statusline-command.sh in both .claude/ and ~/.claude/');\n } else {\n console.log('[DRY RUN] Would create .claude/statusline-command.sh and ~/.claude/statusline-command.sh');\n }\n } catch (err) {\n // Not critical, just skip\n if (!dryRun) {\n console.log(' āš ļø Could not create statusline script, skipping...');\n }\n }\n\n // Create settings.local.json with default MCP permissions\n const settingsLocal = {\n permissions: {\n allow: ['mcp__ruv-swarm', 'mcp__claude-flow@alpha', 'mcp__flow-nexus'],\n deny: [],\n },\n };\n\n if (!dryRun) {\n await fs.writeFile(\n `${claudeDir}/settings.local.json`, JSON.stringify(settingsLocal, null, 2, 'utf8'),\n );\n printSuccess('āœ“ Created .claude/settings.local.json with default MCP permissions');\n } else {\n console.log(\n '[DRY RUN] Would create .claude/settings.local.json with default MCP permissions',\n );\n }\n\n // Create .mcp.json at project root for MCP server configuration\n const mcpConfig = {\n mcpServers: {\n 'claude-flow@alpha': {\n command: 'npx',\n args: ['claude-flow@alpha', 'mcp', 'start'],\n type: 'stdio',\n },\n 'ruv-swarm': {\n command: 'npx',\n args: ['ruv-swarm@latest', 'mcp', 'start'],\n type: 'stdio',\n },\n 'flow-nexus': {\n command: 'npx',\n args: ['flow-nexus@latest', 'mcp', 'start'],\n type: 'stdio',\n },\n 'agentic-payments': {\n command: 'npx',\n args: ['agentic-payments@latest', 'mcp'],\n type: 'stdio',\n },\n },\n };\n\n if (!dryRun) {\n await fs.writeFile(`${workingDir}/.mcp.json`, JSON.stringify(mcpConfig, null, 2, 'utf8'));\n printSuccess('āœ“ Created .mcp.json at project root for MCP server configuration');\n } else {\n console.log('[DRY RUN] Would create .mcp.json at project root for MCP server configuration');\n }\n\n // Removed claude-flow@alpha.config.json creation per user request\n\n // Create command documentation\n for (const [category, commands] of Object.entries(COMMAND_STRUCTURE)) {\n const categoryDir = `${claudeDir}/commands/${category}`;\n\n if (!dryRun) {\n await fs.mkdir(categoryDir, { recursive: true });\n\n // Create category README\n const categoryReadme = `# ${category.charAt(0).toUpperCase() + category.slice(1)} Commands\n\nCommands for ${category} operations in Claude Flow.\n\n## Available Commands\n\n${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\\n')}\n`;\n await fs.writeFile(`${categoryDir}/README.md`, categoryReadme, 'utf8');\n\n // Create individual command docs\n for (const command of commands) {\n const doc = createCommandDoc(category, command);\n if (doc) {\n await fs.writeFile(`${categoryDir}/${command}.md`, doc, 'utf8');\n }\n }\n\n console.log(` āœ“ Created ${commands.length} ${category} command docs`);\n } else {\n console.log(`[DRY RUN] Would create ${commands.length} ${category} command docs`);\n }\n }\n\n // Create wrapper scripts using the dedicated function\n if (!dryRun) {\n await createLocalExecutable(workingDir, dryRun);\n } else {\n console.log('[DRY RUN] Would create wrapper scripts');\n }\n\n // Create helper scripts\n const helpers = ['setup-mcp.sh', 'quick-start.sh', 'github-setup.sh', 'github-safe.js', 'standard-checkpoint-hooks.sh', 'checkpoint-manager.sh'];\n for (const helper of helpers) {\n if (!dryRun) {\n const content = createHelperScript(helper);\n if (content) {\n await fs.writeFile(`${claudeDir}/helpers/${helper}`, content, 'utf8');\n await fs.chmod(`${claudeDir}/helpers/${helper}`, 0o755);\n }\n }\n }\n\n if (!dryRun) {\n printSuccess(`āœ“ Created ${helpers.length} helper scripts`);\n } else {\n console.log(`[DRY RUN] Would create ${helpers.length} helper scripts`);\n }\n\n // Create standard directories from original init\n const standardDirs = [\n 'memory',\n 'memory/agents',\n 'memory/sessions',\n 'coordination',\n 'coordination/memory_bank',\n 'coordination/subtasks',\n 'coordination/orchestration',\n '.swarm', // Add .swarm directory for shared memory\n '.hive-mind', // Add .hive-mind directory for hive-mind system\n '.claude/checkpoints', // Add checkpoints directory for Git checkpoint system\n ];\n\n for (const dir of standardDirs) {\n if (!dryRun) {\n await fs.mkdir(`${workingDir}/${dir}`, { recursive: true });\n }\n }\n\n if (!dryRun) {\n printSuccess('āœ“ Created standard directory structure');\n\n // Initialize memory system\n const initialData = { agents: [], tasks: [], lastUpdated: Date.now() };\n await fs.writeFile(\n `${workingDir}/memory/claude-flow@alpha-data.json`, JSON.stringify(initialData, null, 2, 'utf8'),\n );\n\n // Create README files\n await fs.writeFile(`${workingDir}/memory/agents/README.md`, createAgentsReadme(), 'utf8');\n await fs.writeFile(`${workingDir}/memory/sessions/README.md`, createSessionsReadme(), 'utf8');\n\n printSuccess('āœ“ Initialized memory system');\n\n // Initialize memory database with fallback support\n try {\n // Check if database exists BEFORE creating it\n const dbPath = '.swarm/memory.db';\n const { existsSync } = await import('fs');\n const dbExistedBefore = existsSync(dbPath);\n\n // Handle ReasoningBank migration BEFORE FallbackMemoryStore initialization\n // This prevents schema conflicts with old databases\n if (dbExistedBefore) {\n console.log(' šŸ” Checking existing database for ReasoningBank schema...');\n\n try {\n const {\n initializeReasoningBank,\n checkReasoningBankTables,\n migrateReasoningBank\n } = await import('../../../reasoningbank/reasoningbank-adapter.js');\n\n // Set the database path for ReasoningBank\n process.env.CLAUDE_FLOW_DB_PATH = dbPath;\n\n const tableCheck = await checkReasoningBankTables();\n\n if (tableCheck.exists) {\n console.log(' āœ… ReasoningBank schema already complete');\n } else if (force) {\n // User used --force flag, migrate the database\n console.log(` šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`);\n console.log(` Missing: ${tableCheck.missingTables.join(', ')}`);\n\n const migrationResult = await migrateReasoningBank();\n\n if (migrationResult.success) {\n printSuccess(` āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`);\n console.log(' Use --reasoningbank flag to enable AI-powered memory features');\n } else {\n console.log(` āš ļø Migration failed: ${migrationResult.message}`);\n console.log(' Basic memory will work, use: memory init --reasoningbank to retry');\n }\n } else {\n // Database exists with missing tables but no --force flag\n console.log(` ā„¹ļø Database has ${tableCheck.missingTables.length} missing ReasoningBank tables`);\n console.log(` Missing: ${tableCheck.missingTables.join(', ')}`);\n console.log(' Use --force to migrate existing database');\n console.log(' Or use: memory init --reasoningbank');\n }\n } catch (rbErr) {\n console.log(` āš ļø ReasoningBank check failed: ${rbErr.message}`);\n console.log(' Will attempt normal initialization...');\n }\n }\n\n // Import and initialize FallbackMemoryStore to create the database\n const { FallbackMemoryStore } = await import('../../../memory/fallback-store.js');\n const memoryStore = new FallbackMemoryStore();\n await memoryStore.initialize();\n\n if (memoryStore.isUsingFallback()) {\n printSuccess('āœ“ Initialized memory system (in-memory fallback for npx compatibility)');\n console.log(\n ' šŸ’” For persistent storage, install locally: npm install claude-flow@alpha',\n );\n } else {\n printSuccess('āœ“ Initialized memory database (.swarm/memory.db)');\n\n // Initialize ReasoningBank schema for fresh databases\n if (!dbExistedBefore) {\n try {\n const {\n initializeReasoningBank\n } = await import('../../../reasoningbank/reasoningbank-adapter.js');\n\n // Set the database path for ReasoningBank\n process.env.CLAUDE_FLOW_DB_PATH = dbPath;\n\n console.log(' 🧠 Initializing ReasoningBank schema...');\n await initializeReasoningBank();\n printSuccess(' āœ“ ReasoningBank schema initialized (use --reasoningbank flag for AI-powered memory)');\n } catch (rbErr) {\n console.log(` āš ļø ReasoningBank initialization failed: ${rbErr.message}`);\n console.log(' Basic memory will work, use: memory init --reasoningbank to retry');\n }\n }\n }\n\n memoryStore.close();\n } catch (err) {\n console.log(` āš ļø Could not initialize memory system: ${err.message}`);\n console.log(' Memory will be initialized on first use');\n }\n\n // Initialize comprehensive hive-mind system\n console.log('\\n🧠 Initializing Hive Mind System...');\n try {\n const hiveMindOptions = {\n config: {\n integration: {\n claudeCode: { enabled: isClaudeCodeInstalled() },\n mcpTools: { enabled: true }\n },\n monitoring: { enabled: flags.monitoring || false }\n }\n };\n \n const hiveMindResult = await initializeHiveMind(workingDir, hiveMindOptions, dryRun);\n \n if (hiveMindResult.success) {\n printSuccess(`āœ“ Hive Mind System initialized with ${hiveMindResult.features.length} features`);\n \n // Log individual features\n hiveMindResult.features.forEach(feature => {\n console.log(` • ${feature}`);\n });\n } else {\n console.log(` āš ļø Hive Mind initialization failed: ${hiveMindResult.error}`);\n if (hiveMindResult.rollbackRequired) {\n console.log(' šŸ”„ Automatic rollback may be required');\n }\n }\n } catch (err) {\n console.log(` āš ļø Could not initialize hive-mind system: ${err.message}`);\n }\n }\n\n // Update .gitignore with Claude Flow entries\n const gitignoreResult = await updateGitignore(workingDir, force, dryRun);\n if (gitignoreResult.success) {\n if (!dryRun) {\n printSuccess(`āœ“ ${gitignoreResult.message}`);\n } else {\n console.log(gitignoreResult.message);\n }\n } else {\n console.log(` āš ļø ${gitignoreResult.message}`);\n }\n\n // SPARC initialization (only with --roo flag)\n let sparcInitialized = false;\n if (initSparc) {\n console.log('\\nšŸš€ Initializing SPARC development environment...');\n try {\n // Run create-sparc\n console.log(' šŸ”„ Running: npx -y create-sparc init --force');\n execSync('npx -y create-sparc init --force', {\n cwd: workingDir,\n stdio: 'inherit',\n });\n sparcInitialized = true;\n printSuccess('āœ… SPARC environment initialized successfully');\n } catch (err) {\n console.log(` āš ļø Could not run create-sparc: ${err.message}`);\n console.log(' SPARC features will be limited to basic functionality');\n }\n }\n\n // Create Claude slash commands for SPARC\n if (sparcInitialized && !dryRun) {\n console.log('\\nšŸ“ Creating Claude Code slash commands...');\n await createClaudeSlashCommands(workingDir);\n }\n\n // Check for Claude Code and set up MCP servers (always enabled by default)\n if (!dryRun && isClaudeCodeInstalled()) {\n console.log('\\nšŸ” Claude Code CLI detected!');\n const skipMcp =\n (options && options['skip-mcp']) ||\n (subArgs && subArgs.includes && subArgs.includes('--skip-mcp'));\n\n if (!skipMcp) {\n await setupMcpServers(dryRun);\n } else {\n console.log(' ā„¹ļø Skipping MCP setup (--skip-mcp flag used)');\n console.log('\\n šŸ“‹ To add MCP servers manually:');\n console.log(' claude mcp add claude-flow npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n console.log('\\n šŸ’” MCP servers are defined in .mcp.json (project scope)');\n }\n } else if (!dryRun && !isClaudeCodeInstalled()) {\n console.log('\\nāš ļø Claude Code CLI not detected!');\n console.log('\\n šŸ“„ To install Claude Code:');\n console.log(' npm install -g @anthropic-ai/claude-code');\n console.log('\\n šŸ“‹ After installing, add MCP servers:');\n console.log(' claude mcp add claude-flow@alpha npx claude-flow@alpha mcp start');\n console.log(' claude mcp add ruv-swarm npx ruv-swarm@latest mcp start');\n console.log(' claude mcp add flow-nexus npx flow-nexus@latest mcp start');\n console.log(' claude mcp add agentic-payments npx agentic-payments@latest mcp');\n console.log('\\n šŸ’” MCP servers are defined in .mcp.json (project scope)');\n }\n\n // Create agent directories and copy all agent files\n console.log('\\nšŸ¤– Setting up agent system...');\n if (!dryRun) {\n await createAgentDirectories(workingDir, dryRun);\n const agentResult = await copyAgentFiles(workingDir, {\n force: force,\n dryRun: dryRun\n });\n\n if (agentResult.success) {\n await validateAgentSystem(workingDir);\n\n // Copy command files including Flow Nexus commands\n console.log('\\nšŸ“š Setting up command system...');\n const commandResult = await copyCommandFiles(workingDir, {\n force: force,\n dryRun: dryRun\n });\n\n if (commandResult.success) {\n console.log('āœ… āœ“ Command system setup complete with Flow Nexus integration');\n } else {\n console.log('āš ļø Command system setup failed:', commandResult.error);\n }\n\n console.log('āœ… āœ“ Agent system setup complete with 64 specialized agents');\n } else {\n console.log('āš ļø Agent system setup failed:', agentResult.error);\n }\n\n // Setup reasoning agents if --agent reasoning flag is used\n if (initReasoning) {\n console.log('\\n🧠 Setting up reasoning agents with ReasoningBank integration...');\n try {\n const reasoningAgentsDir = `${workingDir}/.claude/agents/reasoning`;\n await fs.mkdir(reasoningAgentsDir, { recursive: true });\n\n // Import path module\n const path = await import('path');\n const { fileURLToPath } = await import('url');\n const { dirname, join } = path.default;\n\n // Get the source reasoning agents directory\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const sourceReasoningDir = join(__dirname, '../../../../.claude/agents/reasoning');\n\n // Copy reasoning agent files\n try {\n const reasoningFiles = await fs.readdir(sourceReasoningDir);\n let copiedReasoningAgents = 0;\n\n for (const file of reasoningFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = join(sourceReasoningDir, file);\n const destPath = join(reasoningAgentsDir, file);\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedReasoningAgents++;\n }\n }\n\n printSuccess(`āœ“ Copied ${copiedReasoningAgents} reasoning agent files`);\n console.log(' šŸ“š Reasoning agents available:');\n console.log(' • goal-planner - Goal-Oriented Action Planning specialist');\n console.log(' • sublinear-goal-planner - Sub-linear complexity goal planning');\n console.log(' šŸ’” Use: npx agentic-flow --agent goal-planner --task \"your task\"');\n console.log(' šŸ“– Documentation: .claude/agents/reasoning/README.md');\n } catch (err) {\n console.log(` āš ļø Could not copy reasoning agents: ${err.message}`);\n console.log(' Reasoning agents may not be available yet');\n }\n } catch (err) {\n console.log(` āš ļø Reasoning agent setup failed: ${err.message}`);\n }\n }\n } else {\n console.log(' [DRY RUN] Would create agent system with 64 specialized agents');\n if (initReasoning) {\n console.log(' [DRY RUN] Would also setup reasoning agents with ReasoningBank integration');\n }\n }\n\n // Optional: Setup monitoring and telemetry\n const enableMonitoring = flags.monitoring || flags['enable-monitoring'];\n if (enableMonitoring && !dryRun) {\n console.log('\\nšŸ“Š Setting up monitoring and telemetry...');\n await setupMonitoring(workingDir);\n }\n \n // Final instructions with hive-mind status\n console.log('\\nšŸŽ‰ Claude Flow v2.0.0 initialization complete!');\n \n // Display hive-mind status\n const hiveMindStatus = getHiveMindStatus(workingDir);\n console.log('\\n🧠 Hive Mind System Status:');\n console.log(` Configuration: ${hiveMindStatus.configured ? 'āœ… Ready' : 'āŒ Missing'}`);\n console.log(` Database: ${hiveMindStatus.database === 'sqlite' ? 'āœ… SQLite' : hiveMindStatus.database === 'fallback' ? 'āš ļø JSON Fallback' : 'āŒ Not initialized'}`);\n console.log(` Directory Structure: ${hiveMindStatus.directories ? 'āœ… Created' : 'āŒ Missing'}`);\n \n console.log('\\nšŸ“š Quick Start:');\n if (isClaudeCodeInstalled()) {\n console.log('1. View available commands: ls .claude/commands/');\n console.log('2. Start a swarm: npx claude-flow@alpha swarm \"your objective\" --claude');\n console.log('3. Use hive-mind: npx claude-flow@alpha hive-mind spawn \"command\" --claude');\n console.log('4. Use MCP tools in Claude Code for enhanced coordination');\n if (hiveMindStatus.configured) {\n console.log('5. Initialize first swarm: npx claude-flow@alpha hive-mind init');\n }\n } else {\n console.log('1. Install Claude Code: npm install -g @anthropic-ai/claude-code');\n console.log('2. Add MCP servers (see instructions above)');\n console.log('3. View available commands: ls .claude/commands/');\n console.log('4. Start a swarm: npx claude-flow@alpha swarm \"your objective\" --claude');\n console.log('5. Use hive-mind: npx claude-flow@alpha hive-mind spawn \"command\" --claude');\n if (hiveMindStatus.configured) {\n console.log('6. Initialize first swarm: npx claude-flow@alpha hive-mind init');\n }\n }\n console.log('\\nšŸ’” Tips:');\n console.log('• Check .claude/commands/ for detailed documentation');\n console.log('• Use --help with any command for options');\n console.log('• Run commands with --claude flag for best Claude Code integration');\n console.log('• Enable GitHub integration with .claude/helpers/github-setup.sh');\n console.log('• Git checkpoints are automatically enabled in settings.json');\n console.log('• Use .claude/helpers/checkpoint-manager.sh for easy rollback');\n } catch (err) {\n printError(`Failed to initialize Claude Flow v2.0.0: ${err.message}`);\n \n // Attempt hive-mind rollback if it was partially initialized\n try {\n const hiveMindStatus = getHiveMindStatus(workingDir);\n if (hiveMindStatus.directories || hiveMindStatus.configured) {\n console.log('\\nšŸ”„ Attempting hive-mind system rollback...');\n const rollbackResult = await rollbackHiveMindInit(workingDir);\n if (rollbackResult.success) {\n console.log(' āœ… Hive-mind rollback completed');\n } else {\n console.log(` āš ļø Hive-mind rollback failed: ${rollbackResult.error}`);\n }\n }\n } catch (rollbackErr) {\n console.log(` āš ļø Rollback error: ${rollbackErr.message}`);\n }\n }\n}\n\n/**\n * Flow Nexus minimal initialization - only creates Flow Nexus CLAUDE.md, commands, and agents\n */\nasync function flowNexusMinimalInit(flags, subArgs) {\n console.log('🌐 Flow Nexus: Initializing minimal setup...');\n \n try {\n const force = flags.force || flags.f;\n \n // Import functions we need\n const { createFlowNexusClaudeMd } = await import('./templates/claude-md.js');\n const { promises: fs } = await import('fs');\n \n // Create Flow Nexus CLAUDE.md\n console.log('šŸ“ Creating Flow Nexus CLAUDE.md...');\n const flowNexusClaudeMd = createFlowNexusClaudeMd();\n await fs.writeFile('CLAUDE.md', flowNexusClaudeMd);\n console.log(' āœ… Created CLAUDE.md with Flow Nexus integration');\n \n // Create .claude/commands/flow-nexus directory and copy commands\n console.log('šŸ“ Setting up Flow Nexus commands...');\n await fs.mkdir('.claude/commands/flow-nexus', { recursive: true });\n \n // Copy Flow Nexus command files\n const { fileURLToPath } = await import('url');\n const { dirname, join } = await import('path');\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const sourceCommandsDir = join(__dirname, '../../../../.claude/commands/flow-nexus');\n try {\n const commandFiles = await fs.readdir(sourceCommandsDir);\n let copiedCommands = 0;\n \n for (const file of commandFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = `${sourceCommandsDir}/${file}`;\n const destPath = `.claude/commands/flow-nexus/${file}`;\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedCommands++;\n }\n }\n \n console.log(` āœ… Copied ${copiedCommands} Flow Nexus command files`);\n } catch (err) {\n console.log(' āš ļø Could not copy Flow Nexus commands:', err.message);\n }\n \n // Create .claude/agents/flow-nexus directory and copy agents\n console.log('šŸ¤– Setting up Flow Nexus agents...');\n await fs.mkdir('.claude/agents/flow-nexus', { recursive: true });\n \n // Copy Flow Nexus agent files\n const sourceAgentsDir = join(__dirname, '../../../../.claude/agents/flow-nexus');\n try {\n const agentFiles = await fs.readdir(sourceAgentsDir);\n let copiedAgents = 0;\n \n for (const file of agentFiles) {\n if (file.endsWith('.md')) {\n const sourcePath = `${sourceAgentsDir}/${file}`;\n const destPath = `.claude/agents/flow-nexus/${file}`;\n const content = await fs.readFile(sourcePath, 'utf8');\n await fs.writeFile(destPath, content);\n copiedAgents++;\n }\n }\n \n console.log(` āœ… Copied ${copiedAgents} Flow Nexus agent files`);\n } catch (err) {\n console.log(' āš ļø Could not copy Flow Nexus agents:', err.message);\n }\n \n console.log('\\nšŸŽ‰ Flow Nexus minimal initialization complete!');\n console.log('šŸ“š Created: CLAUDE.md with Flow Nexus documentation');\n console.log('šŸ“ Created: .claude/commands/flow-nexus/ directory with command documentation');\n console.log('šŸ¤– Created: .claude/agents/flow-nexus/ directory with specialized agents');\n console.log('');\n console.log('šŸ’” Quick Start:');\n console.log(' 1. Register: mcp__flow-nexus__user_register({ email, password })');\n console.log(' 2. Login: mcp__flow-nexus__user_login({ email, password })');\n console.log(' 3. Deploy: mcp__flow-nexus__swarm_init({ topology: \"mesh\", maxAgents: 5 })');\n console.log('');\n console.log('šŸ”— Use Flow Nexus MCP tools in Claude Code for full functionality');\n \n } catch (err) {\n console.log(`āŒ Flow Nexus initialization failed: ${err.message}`);\n console.log('Stack trace:', err.stack);\n process.exit(1);\n }\n}\n"],"names":["printSuccess","printError","printWarning","existsSync","process","os","spawn","execSync","runCommand","command","args","options","Promise","resolve","reject","child","cwd","env","stdio","stdout","stderr","on","data","code","success","Error","createLocalExecutable","createSparcStructureManually","createClaudeSlashCommands","createOptimizedClaudeSlashCommands","promises","fs","copyTemplates","copyRevisedTemplates","validateTemplatesExist","copyAgentFiles","createAgentDirectories","validateAgentSystem","copyCommandFiles","showInitHelp","batchInitCommand","batchInitFromConfig","validateBatchOptions","ValidationSystem","runFullValidation","RollbackSystem","createAtomicOperation","createEnhancedSettingsJson","createCommandDoc","createHelperScript","COMMAND_STRUCTURE","createOptimizedSparcClaudeMd","getIsolatedNpxEnv","updateGitignore","createFullClaudeMd","createSparcClaudeMd","createMinimalClaudeMd","createFullMemoryBankMd","createMinimalMemoryBankMd","createFullCoordinationMd","createMinimalCoordinationMd","createAgentsReadme","createSessionsReadme","initializeHiveMind","getHiveMindStatus","rollbackHiveMindInit","isClaudeCodeInstalled","setupMcpServers","dryRun","console","log","servers","name","description","server","err","message","createStatuslineScript","MEM_COLOR","MEM_PERCENT","CPU_COLOR","CPU_LOAD","SUCCESS_COLOR","SUCCESS_RATE","initCommand","subArgs","flags","help","h","includes","generateEnvTemplate","workingDir","PWD","force","f","result","created","exists","hasVerificationFlags","verify","pair","flowNexusMinimalInit","basic","minimal","sparc","enhancedClaudeFlowInit","handleValidationCommand","handleRollbackCommand","handleListBackups","batchInitFlag","configFlag","config","handleBatchInit","useEnhanced","enhancedInitCommand","initForce","initMinimal","initSparc","roo","initDryRun","initOptimized","selectedModes","modes","split","initVerify","initPair","chdir","files","existingFiles","file","stat","push","length","join","templateOptions","optimized","createVerificationClaudeMd","createVerificationSettingsJson","writeFile","mkdir","recursive","validation","valid","revisedResults","verbose","copyResults","skipClaudeMd","skipSettings","copiedFiles","skippedFiles","errors","forEach","sparcInitialized","createSparcResult","modeCount","gitignoreResult","hiveMindOptions","integration","claudeCode","enabled","mcpTools","monitoring","hiveMindResult","error","skipMcp","parallel","s","m","maxConcurrency","progressTracking","template","environments","map","trim","validationErrors","configFile","results","projectsString","projects","project","successful","filter","r","failed","rollbackSystem","validationSystem","atomicOp","initOptions","skipPreValidation","skipBackup","validateOnly","preValidation","validatePreInit","warnings","warning","warn","backupResult","createPreInitBackup","atomicBegin","begin","performInitializationWithCheckpoints","postValidation","validatePostInit","rollback","configValidation","validateConfiguration","healthChecks","runHealthChecks","commit","fullValidation","postInit","skipPreInit","report","completed","rollbackError","skipConfig","skipModeTest","validationResults","exit","performFullRollback","phaseIndex","findIndex","arg","phase","performPartialRollback","rollbackPoints","listRollbackPoints","point","index","date","Date","timestamp","toLocaleString","type","latest","backupId","checkpoints","slice","checkpoint","status","phases","action","createInitialFiles","createDirectoryStructure","setupMemorySystem","setupCoordinationSystem","createCheckpoint","now","claudeMd","memoryBankMd","coordinationMd","directories","dir","initialData","agents","tasks","lastUpdated","JSON","stringify","setupMonitoring","path","trackingDir","tokenUsageFile","total","input","output","byAgent","toISOString","settingsPath","settingsContent","readFile","settings","parse","hooks","tokenTrackingHook","monitoringConfig","telemetry","value","tracking","tokens","costs","sessions","storage","location","format","rotation","configPath","envSnippet","envPath","d","agentType","agent","find","startsWith","initReasoning","chmod","filesToCheck","claudeDir","statuslineTemplate","__dirname","homeClaudeDir","homedir","settingsLocal","permissions","allow","deny","mcpConfig","mcpServers","category","commands","Object","entries","categoryDir","categoryReadme","charAt","toUpperCase","cmd","doc","helpers","helper","content","standardDirs","dbPath","dbExistedBefore","initializeReasoningBank","checkReasoningBankTables","migrateReasoningBank","CLAUDE_FLOW_DB_PATH","tableCheck","missingTables","migrationResult","addedTables","rbErr","FallbackMemoryStore","memoryStore","initialize","isUsingFallback","close","features","feature","rollbackRequired","agentResult","commandResult","reasoningAgentsDir","fileURLToPath","dirname","default","__filename","url","sourceReasoningDir","reasoningFiles","readdir","copiedReasoningAgents","endsWith","sourcePath","destPath","enableMonitoring","hiveMindStatus","configured","database","rollbackResult","rollbackErr","createFlowNexusClaudeMd","flowNexusClaudeMd","sourceCommandsDir","commandFiles","copiedCommands","sourceAgentsDir","agentFiles","copiedAgents","stack"],"mappings":"AACA,SAASA,YAAY,EAAEC,UAAU,EAAEC,YAAY,QAAc,iBAAiB;AAC9E,SAASC,UAAU,QAAQ,KAAK;AAChC,OAAOC,aAAa,UAAU;AAC9B,OAAOC,QAAQ,KAAK;AACpB,SAASC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAIhD,SAASC,WAAWC,OAAO,EAAEC,IAAI,EAAEC,UAAU,CAAC,CAAC;IAC7C,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3B,MAAMC,QAAQT,MAAMG,SAASC,MAAM;YACjCM,KAAKL,QAAQK,GAAG;YAChBC,KAAK;gBAAE,GAAGb,QAAQa,GAAG;gBAAE,GAAGN,QAAQM,GAAG;YAAC;YACtCC,OAAOP,QAAQQ,MAAM,KAAK,YAAY,YAAY;QACpD;QAEA,IAAIA,SAAS;QACb,IAAIC,SAAS;QAEb,IAAIT,QAAQQ,MAAM,KAAK,WAAW;YAChCJ,MAAMI,MAAM,CAACE,EAAE,CAAC,QAAQ,CAACC;gB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src/cli/simple-commands/memory.js b/dist-cjs/src/cli/simple-commands/memory.js index eafbc73f8..7166c3b5c 100644 --- a/dist-cjs/src/cli/simple-commands/memory.js +++ b/dist-cjs/src/cli/simple-commands/memory.js @@ -328,20 +328,45 @@ async function isReasoningBankInitialized() { } async function handleReasoningBankCommand(command, subArgs, flags) { const initialized = await isReasoningBankInitialized(); + const { initializeReasoningBank, storeMemory, queryMemories, listMemories, getStatus, checkReasoningBankTables, migrateReasoningBank } = await import('../../reasoningbank/reasoningbank-adapter.js'); if (command === 'init') { + const dbPath = '.swarm/memory.db'; if (initialized) { - printWarning('āš ļø ReasoningBank already initialized'); - console.log('Database: .swarm/memory.db'); - console.log('\nTo reinitialize, delete .swarm/memory.db first'); + printInfo('šŸ” Checking existing database for ReasoningBank schema...\n'); + try { + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + const tableCheck = await checkReasoningBankTables(); + if (tableCheck.exists) { + printSuccess('āœ… ReasoningBank already complete'); + console.log('Database: .swarm/memory.db'); + console.log('All ReasoningBank tables present\n'); + console.log('Use --reasoningbank flag with memory commands to enable AI features'); + return; + } + console.log(`šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}\n`); + const migrationResult = await migrateReasoningBank(); + if (migrationResult.success) { + printSuccess(`āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`); + console.log('\nNext steps:'); + console.log(' 1. Store memories: memory store key "value" --reasoningbank'); + console.log(' 2. Query memories: memory query "search" --reasoningbank'); + console.log(' 3. Check status: memory status --reasoningbank'); + } else { + printError(`āŒ Migration failed: ${migrationResult.message}`); + console.log('Try running: init --force to reinitialize'); + } + } catch (error) { + printError('āŒ Migration check failed'); + console.error(error.message); + console.log('\nTry running: init --force to reinitialize'); + } return; } printInfo('🧠 Initializing ReasoningBank...'); console.log('This will create: .swarm/memory.db\n'); try { - const { stdout, stderr } = await execAsync('npx agentic-flow reasoningbank init', { - timeout: 30000 - }); - if (stdout) console.log(stdout); + await initializeReasoningBank(); printSuccess('āœ… ReasoningBank initialized successfully!'); console.log('\nNext steps:'); console.log(' 1. Store memories: memory store key "value" --reasoningbank'); @@ -350,9 +375,6 @@ async function handleReasoningBankCommand(command, subArgs, flags) { } catch (error) { printError('āŒ Failed to initialize ReasoningBank'); console.error(error.message); - if (error.stderr) { - console.error('Details:', error.stderr); - } } return; } @@ -364,17 +386,128 @@ async function handleReasoningBankCommand(command, subArgs, flags) { } printInfo(`🧠 Using ReasoningBank mode...`); try { - const cmd = buildReasoningBankCommand(command, subArgs, flags); - const { stdout, stderr } = await execAsync(cmd, { - timeout: 30000 - }); - if (stdout) console.log(stdout); - if (stderr && !stderr.includes('Warning')) console.error(stderr); + switch(command){ + case 'store': + await handleReasoningBankStore(subArgs, flags, storeMemory); + break; + case 'query': + await handleReasoningBankQuery(subArgs, flags, queryMemories); + break; + case 'list': + await handleReasoningBankList(subArgs, flags, listMemories); + break; + case 'status': + await handleReasoningBankStatus(getStatus); + break; + case 'consolidate': + case 'demo': + case 'test': + case 'benchmark': + const cmd = `npx agentic-flow reasoningbank ${command}`; + const { stdout } = await execAsync(cmd, { + timeout: 60000 + }); + if (stdout) console.log(stdout); + break; + default: + printError(`Unknown ReasoningBank command: ${command}`); + } } catch (error) { printError(`āŒ ReasoningBank command failed`); console.error(error.message); } } +async function handleReasoningBankStore(subArgs, flags, storeMemory) { + const key = subArgs[1]; + const value = subArgs.slice(2).join(' '); + if (!key || !value) { + printError('Usage: memory store --reasoningbank'); + return; + } + try { + const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace') || 'default'; + const memoryId = await storeMemory(key, value, { + namespace, + agent: 'memory-agent', + domain: namespace + }); + printSuccess('āœ… Stored successfully in ReasoningBank'); + console.log(`šŸ“ Key: ${key}`); + console.log(`🧠 Memory ID: ${memoryId}`); + console.log(`šŸ“¦ Namespace: ${namespace}`); + console.log(`šŸ’¾ Size: ${new TextEncoder().encode(value).length} bytes`); + console.log(`šŸ” Semantic search: enabled`); + } catch (error) { + printError(`Failed to store: ${error.message}`); + } +} +async function handleReasoningBankQuery(subArgs, flags, queryMemories) { + const search = subArgs.slice(1).join(' '); + if (!search) { + printError('Usage: memory query --reasoningbank'); + return; + } + try { + const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace'); + const results = await queryMemories(search, { + domain: namespace || 'general', + limit: 10 + }); + if (results.length === 0) { + printWarning('No results found'); + return; + } + printSuccess(`Found ${results.length} results (semantic search):`); + for (const entry of results){ + console.log(`\nšŸ“Œ ${entry.key}`); + console.log(` Namespace: ${entry.namespace}`); + console.log(` Value: ${entry.value.substring(0, 100)}${entry.value.length > 100 ? '...' : ''}`); + console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}%`); + console.log(` Usage: ${entry.usage_count} times`); + if (entry.score) { + console.log(` Match Score: ${(entry.score * 100).toFixed(1)}%`); + } + console.log(` Stored: ${new Date(entry.created_at).toLocaleString()}`); + } + } catch (error) { + printError(`Failed to query: ${error.message}`); + } +} +async function handleReasoningBankList(subArgs, flags, listMemories) { + try { + const sort = flags?.sort || getArgValue(subArgs, '--sort') || 'created_at'; + const limit = parseInt(flags?.limit || getArgValue(subArgs, '--limit') || '10'); + const results = await listMemories({ + sort, + limit + }); + if (results.length === 0) { + printWarning('No memories found'); + return; + } + printSuccess(`ReasoningBank memories (${results.length} shown):`); + for (const entry of results){ + console.log(`\nšŸ“Œ ${entry.key}`); + console.log(` Value: ${entry.value.substring(0, 80)}${entry.value.length > 80 ? '...' : ''}`); + console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}% | Usage: ${entry.usage_count}`); + } + } catch (error) { + printError(`Failed to list: ${error.message}`); + } +} +async function handleReasoningBankStatus(getStatus) { + try { + const stats = await getStatus(); + printSuccess('šŸ“Š ReasoningBank Status:'); + console.log(` Total memories: ${stats.total_memories}`); + console.log(` Average confidence: ${(stats.avg_confidence * 100).toFixed(1)}%`); + console.log(` Total usage: ${stats.total_usage}`); + console.log(` Embeddings: ${stats.total_embeddings}`); + console.log(` Trajectories: ${stats.total_trajectories}`); + } catch (error) { + printError(`Failed to get status: ${error.message}`); + } +} function buildReasoningBankCommand(command, subArgs, flags) { const parts = [ 'npx', @@ -398,6 +531,7 @@ function buildReasoningBankCommand(command, subArgs, flags) { parts.push(`"${arg}"`); } }); + parts.push('--agent', 'memory-agent'); return parts.join(' '); } async function handleModeCommand(command, subArgs, flags) { diff --git a/dist-cjs/src/cli/simple-commands/memory.js.map b/dist-cjs/src/cli/simple-commands/memory.js.map index 55a2623e1..3b1e176b3 100644 --- a/dist-cjs/src/cli/simple-commands/memory.js.map +++ b/dist-cjs/src/cli/simple-commands/memory.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../../src/cli/simple-commands/memory.js"],"sourcesContent":["// memory.js - Memory management commands\nimport { printSuccess, printError, printWarning, printInfo } from '../utils.js';\nimport { promises as fs } from 'fs';\nimport { cwd, exit, existsSync } from '../node-compat.js';\nimport { getUnifiedMemory } from '../../memory/unified-memory-manager.js';\nimport { KeyRedactor } from '../../utils/key-redactor.js';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\nexport async function memoryCommand(subArgs, flags) {\n const memorySubcommand = subArgs[0];\n const memoryStore = './memory/memory-store.json';\n\n // Extract namespace from flags or subArgs\n const namespace = flags?.namespace || flags?.ns || getNamespaceFromArgs(subArgs) || 'default';\n\n // Check for redaction flag\n const enableRedaction = flags?.redact || subArgs.includes('--redact') || subArgs.includes('--secure');\n\n // NEW: Detect memory mode (basic, reasoningbank, auto)\n const mode = await detectMemoryMode(flags, subArgs);\n\n // Helper to load memory data\n async function loadMemory() {\n try {\n const content = await fs.readFile(memoryStore, 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n }\n\n // Helper to save memory data\n async function saveMemory(data) {\n await fs.mkdir('./memory', { recursive: true });\n await fs.writeFile(memoryStore, JSON.stringify(data, null, 2, 'utf8'));\n }\n\n // NEW: Handle ReasoningBank-specific commands\n if (mode === 'reasoningbank' && ['init', 'status', 'consolidate', 'demo', 'test', 'benchmark'].includes(memorySubcommand)) {\n return await handleReasoningBankCommand(memorySubcommand, subArgs, flags);\n }\n\n // NEW: Handle new mode management commands\n if (['detect', 'mode', 'migrate'].includes(memorySubcommand)) {\n return await handleModeCommand(memorySubcommand, subArgs, flags);\n }\n\n // NEW: Delegate to ReasoningBank for regular commands if mode is set\n if (mode === 'reasoningbank' && ['store', 'query', 'list'].includes(memorySubcommand)) {\n return await handleReasoningBankCommand(memorySubcommand, subArgs, flags);\n }\n\n switch (memorySubcommand) {\n case 'store':\n await storeMemory(subArgs, loadMemory, saveMemory, namespace, enableRedaction);\n break;\n\n case 'query':\n await queryMemory(subArgs, loadMemory, namespace, enableRedaction);\n break;\n\n case 'stats':\n await showMemoryStats(loadMemory);\n break;\n\n case 'export':\n await exportMemory(subArgs, loadMemory, namespace);\n break;\n\n case 'import':\n await importMemory(subArgs, saveMemory, loadMemory);\n break;\n\n case 'clear':\n await clearMemory(subArgs, saveMemory, namespace);\n break;\n\n case 'list':\n await listNamespaces(loadMemory);\n break;\n\n default:\n showMemoryHelp();\n }\n}\n\nasync function storeMemory(subArgs, loadMemory, saveMemory, namespace, enableRedaction = false) {\n const key = subArgs[1];\n let value = subArgs.slice(2).join(' ');\n\n if (!key || !value) {\n printError('Usage: memory store [--namespace ] [--redact]');\n return;\n }\n\n try {\n // Apply redaction if enabled\n let redactedValue = value;\n let securityWarnings = [];\n\n if (enableRedaction) {\n redactedValue = KeyRedactor.redact(value, true);\n const validation = KeyRedactor.validate(value);\n\n if (!validation.safe) {\n securityWarnings = validation.warnings;\n printWarning('šŸ”’ Redaction enabled: Sensitive data detected and redacted');\n securityWarnings.forEach(warning => console.log(` āš ļø ${warning}`));\n }\n } else {\n // Even if redaction is not explicitly enabled, validate and warn\n const validation = KeyRedactor.validate(value);\n if (!validation.safe) {\n printWarning('āš ļø Potential sensitive data detected! Use --redact flag for automatic redaction');\n validation.warnings.forEach(warning => console.log(` āš ļø ${warning}`));\n console.log(' šŸ’” Tip: Add --redact flag to automatically redact API keys');\n }\n }\n\n const data = await loadMemory();\n\n if (!data[namespace]) {\n data[namespace] = [];\n }\n\n // Remove existing entry with same key\n data[namespace] = data[namespace].filter((e) => e.key !== key);\n\n // Add new entry with redacted value\n data[namespace].push({\n key,\n value: redactedValue,\n namespace,\n timestamp: Date.now(),\n redacted: enableRedaction && securityWarnings.length > 0,\n });\n\n await saveMemory(data);\n printSuccess(enableRedaction && securityWarnings.length > 0 ? 'šŸ”’ Stored successfully (with redaction)' : 'āœ… Stored successfully');\n console.log(`šŸ“ Key: ${key}`);\n console.log(`šŸ“¦ Namespace: ${namespace}`);\n console.log(`šŸ’¾ Size: ${new TextEncoder().encode(redactedValue).length} bytes`);\n if (enableRedaction && securityWarnings.length > 0) {\n console.log(`šŸ”’ Security: ${securityWarnings.length} sensitive pattern(s) redacted`);\n }\n } catch (err) {\n printError(`Failed to store: ${err.message}`);\n }\n}\n\nasync function queryMemory(subArgs, loadMemory, namespace, enableRedaction = false) {\n const search = subArgs.slice(1).join(' ');\n\n if (!search) {\n printError('Usage: memory query [--namespace ] [--redact]');\n return;\n }\n\n try {\n const data = await loadMemory();\n const results = [];\n\n for (const [ns, entries] of Object.entries(data)) {\n if (namespace && ns !== namespace) continue;\n\n for (const entry of entries) {\n if (entry.key.includes(search) || entry.value.includes(search)) {\n results.push(entry);\n }\n }\n }\n\n if (results.length === 0) {\n printWarning('No results found');\n return;\n }\n\n printSuccess(`Found ${results.length} results:`);\n\n // Sort by timestamp (newest first)\n results.sort((a, b) => b.timestamp - a.timestamp);\n\n for (const entry of results.slice(0, 10)) {\n console.log(`\\nšŸ“Œ ${entry.key}`);\n console.log(` Namespace: ${entry.namespace}`);\n\n // Apply redaction to displayed value if requested\n let displayValue = entry.value;\n if (enableRedaction) {\n displayValue = KeyRedactor.redact(displayValue, true);\n }\n\n console.log(\n ` Value: ${displayValue.substring(0, 100)}${displayValue.length > 100 ? '...' : ''}`,\n );\n console.log(` Stored: ${new Date(entry.timestamp).toLocaleString()}`);\n\n // Show redaction status\n if (entry.redacted) {\n console.log(` šŸ”’ Status: Redacted on storage`);\n } else if (enableRedaction) {\n console.log(` šŸ”’ Status: Redacted for display`);\n }\n }\n\n if (results.length > 10) {\n console.log(`\\n... and ${results.length - 10} more results`);\n }\n } catch (err) {\n printError(`Failed to query: ${err.message}`);\n }\n}\n\nasync function showMemoryStats(loadMemory) {\n try {\n const data = await loadMemory();\n let totalEntries = 0;\n const namespaceStats = {};\n\n for (const [namespace, entries] of Object.entries(data)) {\n namespaceStats[namespace] = entries.length;\n totalEntries += entries.length;\n }\n\n printSuccess('Memory Bank Statistics:');\n console.log(` Total Entries: ${totalEntries}`);\n console.log(` Namespaces: ${Object.keys(data).length}`);\n console.log(\n ` Size: ${(new TextEncoder().encode(JSON.stringify(data)).length / 1024).toFixed(2)} KB`,\n );\n\n if (Object.keys(data).length > 0) {\n console.log('\\nšŸ“ Namespace Breakdown:');\n for (const [namespace, count] of Object.entries(namespaceStats)) {\n console.log(` ${namespace}: ${count} entries`);\n }\n }\n } catch (err) {\n printError(`Failed to get stats: ${err.message}`);\n }\n}\n\nasync function exportMemory(subArgs, loadMemory, namespace) {\n const filename = subArgs[1] || `memory-export-${Date.now()}.json`;\n\n try {\n const data = await loadMemory();\n\n let exportData = data;\n if (namespace) {\n exportData = { [namespace]: data[namespace] || [] };\n }\n\n await fs.writeFile(filename, JSON.stringify(exportData, null, 2, 'utf8'));\n printSuccess(`Memory exported to ${filename}`);\n\n let totalEntries = 0;\n for (const entries of Object.values(exportData)) {\n totalEntries += entries.length;\n }\n console.log(\n `šŸ“¦ Exported ${totalEntries} entries from ${Object.keys(exportData).length} namespace(s)`,\n );\n } catch (err) {\n printError(`Failed to export memory: ${err.message}`);\n }\n}\n\nasync function importMemory(subArgs, saveMemory, loadMemory) {\n const filename = subArgs[1];\n\n if (!filename) {\n printError('Usage: memory import ');\n return;\n }\n\n try {\n const importContent = await fs.readFile(filename, 'utf8');\n const importData = JSON.parse(importContent);\n\n // Load existing memory\n const existingData = await loadMemory();\n\n // Merge imported data\n let totalImported = 0;\n for (const [namespace, entries] of Object.entries(importData)) {\n if (!existingData[namespace]) {\n existingData[namespace] = [];\n }\n\n // Add entries that don't already exist (by key)\n const existingKeys = new Set(existingData[namespace].map((e) => e.key));\n const newEntries = entries.filter((e) => !existingKeys.has(e.key));\n\n existingData[namespace].push(...newEntries);\n totalImported += newEntries.length;\n }\n\n await saveMemory(existingData);\n printSuccess(`Imported ${totalImported} new entries from ${filename}`);\n } catch (err) {\n printError(`Failed to import memory: ${err.message}`);\n }\n}\n\nasync function clearMemory(subArgs, saveMemory, namespace) {\n if (!namespace || namespace === 'default') {\n const nsFromArgs = getNamespaceFromArgs(subArgs);\n if (!nsFromArgs) {\n printError('Usage: memory clear --namespace ');\n printWarning('This will clear all entries in the specified namespace');\n return;\n }\n namespace = nsFromArgs;\n }\n\n try {\n // Helper to load memory data\n async function loadMemory() {\n try {\n const content = await fs.readFile('./memory/memory-store.json', 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n }\n \n const data = await loadMemory();\n\n if (!data[namespace]) {\n printWarning(`Namespace '${namespace}' does not exist`);\n return;\n }\n\n const entryCount = data[namespace].length;\n delete data[namespace];\n\n await saveMemory(data);\n printSuccess(`Cleared ${entryCount} entries from namespace '${namespace}'`);\n } catch (err) {\n printError(`Failed to clear memory: ${err.message}`);\n }\n}\n\nasync function listNamespaces(loadMemory) {\n try {\n const data = await loadMemory();\n const namespaces = Object.keys(data);\n\n if (namespaces.length === 0) {\n printWarning('No namespaces found');\n return;\n }\n\n printSuccess('Available namespaces:');\n for (const namespace of namespaces) {\n const count = data[namespace].length;\n console.log(` ${namespace} (${count} entries)`);\n }\n } catch (err) {\n printError(`Failed to list namespaces: ${err.message}`);\n }\n}\n\nfunction getNamespaceFromArgs(subArgs) {\n const namespaceIndex = subArgs.indexOf('--namespace');\n if (namespaceIndex !== -1 && namespaceIndex + 1 < subArgs.length) {\n return subArgs[namespaceIndex + 1];\n }\n\n const nsIndex = subArgs.indexOf('--ns');\n if (nsIndex !== -1 && nsIndex + 1 < subArgs.length) {\n return subArgs[nsIndex + 1];\n }\n\n return null;\n}\n\n// Helper to load memory data (needed for import function)\nasync function loadMemory() {\n try {\n const content = await fs.readFile('./memory/memory-store.json', 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n}\n\n// NEW: Mode detection function\nasync function detectMemoryMode(flags, subArgs) {\n // Explicit ReasoningBank flag takes precedence\n if (flags?.reasoningbank || flags?.rb || subArgs.includes('--reasoningbank') || subArgs.includes('--rb')) {\n return 'reasoningbank';\n }\n\n // Auto mode: detect if ReasoningBank is initialized\n if (flags?.auto || subArgs.includes('--auto')) {\n const initialized = await isReasoningBankInitialized();\n return initialized ? 'reasoningbank' : 'basic';\n }\n\n // Default: basic mode (backward compatible)\n return 'basic';\n}\n\n// NEW: Check if ReasoningBank is initialized\nasync function isReasoningBankInitialized() {\n try {\n // Check if .swarm/memory.db exists\n const dbPath = '.swarm/memory.db';\n await fs.access(dbPath);\n return true;\n } catch {\n return false;\n }\n}\n\n// NEW: Handle ReasoningBank commands\nasync function handleReasoningBankCommand(command, subArgs, flags) {\n const initialized = await isReasoningBankInitialized();\n\n // Special handling for 'init' command\n if (command === 'init') {\n if (initialized) {\n printWarning('āš ļø ReasoningBank already initialized');\n console.log('Database: .swarm/memory.db');\n console.log('\\nTo reinitialize, delete .swarm/memory.db first');\n return;\n }\n\n printInfo('🧠 Initializing ReasoningBank...');\n console.log('This will create: .swarm/memory.db\\n');\n\n try {\n const { stdout, stderr } = await execAsync('npx agentic-flow reasoningbank init', {\n timeout: 30000,\n });\n\n if (stdout) console.log(stdout);\n printSuccess('āœ… ReasoningBank initialized successfully!');\n console.log('\\nNext steps:');\n console.log(' 1. Store memories: memory store key \"value\" --reasoningbank');\n console.log(' 2. Query memories: memory query \"search\" --reasoningbank');\n console.log(' 3. Check status: memory status --reasoningbank');\n } catch (error) {\n printError('āŒ Failed to initialize ReasoningBank');\n console.error(error.message);\n if (error.stderr) {\n console.error('Details:', error.stderr);\n }\n }\n return;\n }\n\n // All other commands require initialization\n if (!initialized) {\n printError('āŒ ReasoningBank not initialized');\n console.log('\\nTo use ReasoningBank mode, first run:');\n console.log(' memory init --reasoningbank\\n');\n return;\n }\n\n // Delegate to agentic-flow reasoningbank commands\n printInfo(`🧠 Using ReasoningBank mode...`);\n\n try {\n const cmd = buildReasoningBankCommand(command, subArgs, flags);\n const { stdout, stderr } = await execAsync(cmd, { timeout: 30000 });\n\n if (stdout) console.log(stdout);\n if (stderr && !stderr.includes('Warning')) console.error(stderr);\n } catch (error) {\n printError(`āŒ ReasoningBank command failed`);\n console.error(error.message);\n }\n}\n\n// NEW: Build agentic-flow reasoningbank command\nfunction buildReasoningBankCommand(command, subArgs, flags) {\n const parts = ['npx', 'agentic-flow', 'reasoningbank'];\n\n // Map memory commands to reasoningbank commands\n const commandMap = {\n store: 'store',\n query: 'query',\n list: 'list',\n status: 'status',\n consolidate: 'consolidate',\n demo: 'demo',\n test: 'test',\n benchmark: 'benchmark',\n };\n\n parts.push(commandMap[command] || command);\n\n // Add arguments (skip the command itself)\n const args = subArgs.slice(1);\n args.forEach((arg) => {\n if (!arg.startsWith('--reasoningbank') && !arg.startsWith('--rb') && !arg.startsWith('--auto')) {\n parts.push(`\"${arg}\"`);\n }\n });\n\n return parts.join(' ');\n}\n\n// NEW: Handle mode management commands\nasync function handleModeCommand(command, subArgs, flags) {\n switch (command) {\n case 'detect':\n await detectModes();\n break;\n\n case 'mode':\n await showCurrentMode();\n break;\n\n case 'migrate':\n await migrateMemory(subArgs, flags);\n break;\n\n default:\n printError(`Unknown mode command: ${command}`);\n }\n}\n\n// NEW: Detect and show available memory modes\nasync function detectModes() {\n printInfo('šŸ” Detecting memory modes...\\n');\n\n // Check basic mode\n const basicAvailable = await checkBasicMode();\n console.log(basicAvailable ? 'āœ… Basic Mode (active)' : 'āŒ Basic Mode (unavailable)');\n if (basicAvailable) {\n console.log(' Location: ./memory/memory-store.json');\n console.log(' Features: Simple key-value storage, fast');\n }\n\n console.log('');\n\n // Check ReasoningBank mode\n const rbAvailable = await isReasoningBankInitialized();\n console.log(rbAvailable ? 'āœ… ReasoningBank Mode (available)' : 'āš ļø ReasoningBank Mode (not initialized)');\n if (rbAvailable) {\n console.log(' Location: .swarm/memory.db');\n console.log(' Features: AI-powered semantic search, learning');\n } else {\n console.log(' To enable: memory init --reasoningbank');\n }\n\n console.log('\\nšŸ’” Usage:');\n console.log(' Basic: memory store key \"value\"');\n console.log(' ReasoningBank: memory store key \"value\" --reasoningbank');\n console.log(' Auto-detect: memory query search --auto');\n}\n\n// NEW: Check if basic mode is available\nasync function checkBasicMode() {\n try {\n const memoryDir = './memory';\n await fs.access(memoryDir);\n return true;\n } catch {\n // Create directory if it doesn't exist\n try {\n await fs.mkdir(memoryDir, { recursive: true });\n return true;\n } catch {\n return false;\n }\n }\n}\n\n// NEW: Show current default mode\nasync function showCurrentMode() {\n const rbInitialized = await isReasoningBankInitialized();\n\n printInfo('šŸ“Š Current Memory Configuration:\\n');\n console.log('Default Mode: Basic (backward compatible)');\n console.log('Available Modes:');\n console.log(' • Basic Mode: Always available');\n console.log(` • ReasoningBank Mode: ${rbInitialized ? 'Initialized āœ…' : 'Not initialized āš ļø'}`);\n\n console.log('\\nšŸ’” To use a specific mode:');\n console.log(' --reasoningbank or --rb → Use ReasoningBank');\n console.log(' --auto → Auto-detect best mode');\n console.log(' (no flag) → Use Basic mode');\n}\n\n// NEW: Migrate memory between modes\nasync function migrateMemory(subArgs, flags) {\n const targetMode = flags?.to || getArgValue(subArgs, '--to');\n\n if (!targetMode || !['basic', 'reasoningbank'].includes(targetMode)) {\n printError('Usage: memory migrate --to ');\n return;\n }\n\n printInfo(`šŸ”„ Migrating to ${targetMode} mode...\\n`);\n\n if (targetMode === 'reasoningbank') {\n // Migrate basic → ReasoningBank\n const rbInitialized = await isReasoningBankInitialized();\n if (!rbInitialized) {\n printError('āŒ ReasoningBank not initialized');\n console.log('First run: memory init --reasoningbank\\n');\n return;\n }\n\n printWarning('āš ļø Migration from basic to ReasoningBank is not yet implemented');\n console.log('This feature is coming in v2.7.1\\n');\n console.log('For now, you can:');\n console.log(' 1. Export basic memory: memory export backup.json');\n console.log(' 2. Manually import to ReasoningBank');\n } else {\n // Migrate ReasoningBank → basic\n printWarning('āš ļø Migration from ReasoningBank to basic is not yet implemented');\n console.log('This feature is coming in v2.7.1\\n');\n }\n}\n\n// Helper to get argument value\nfunction getArgValue(args, flag) {\n const index = args.indexOf(flag);\n if (index !== -1 && index + 1 < args.length) {\n return args[index + 1];\n }\n return null;\n}\n\nfunction showMemoryHelp() {\n console.log('Memory commands:');\n console.log(' store Store a key-value pair');\n console.log(' query Search for entries');\n console.log(' stats Show memory statistics');\n console.log(' export [filename] Export memory to file');\n console.log(' import Import memory from file');\n console.log(' clear --namespace Clear a namespace');\n console.log(' list List all namespaces');\n console.log();\n console.log('🧠 ReasoningBank Commands (NEW in v2.7.0):');\n console.log(' init --reasoningbank Initialize ReasoningBank (AI-powered memory)');\n console.log(' status --reasoningbank Show ReasoningBank statistics');\n console.log(' detect Show available memory modes');\n console.log(' mode Show current memory configuration');\n console.log(' migrate --to Migrate between basic/reasoningbank');\n console.log();\n console.log('Options:');\n console.log(' --namespace Specify namespace for operations');\n console.log(' --ns Short form of --namespace');\n console.log(' --redact šŸ”’ Enable API key redaction (security feature)');\n console.log(' --secure Alias for --redact');\n console.log();\n console.log('šŸŽÆ Mode Selection (NEW):');\n console.log(' --reasoningbank, --rb Use ReasoningBank mode (AI-powered)');\n console.log(' --auto Auto-detect best available mode');\n console.log(' (no flag) Use Basic mode (default, backward compatible)');\n console.log();\n console.log('šŸ”’ Security Features (v2.6.0):');\n console.log(' API Key Protection: Automatically detects and redacts sensitive data');\n console.log(' Patterns Detected: Anthropic, OpenRouter, Gemini, Bearer tokens, etc.');\n console.log(' Auto-Validation: Warns when storing unredacted sensitive data');\n console.log(' Display Redaction: Redact sensitive data when querying with --redact');\n console.log();\n console.log('Examples:');\n console.log(' # Basic mode (default - backward compatible)');\n console.log(' memory store previous_work \"Research findings from yesterday\"');\n console.log(' memory store api_config \"key=sk-ant-...\" --redact # šŸ”’ Redacts API key');\n console.log(' memory query research --namespace sparc');\n console.log();\n console.log(' # ReasoningBank mode (AI-powered, opt-in)');\n console.log(' memory init --reasoningbank # One-time setup');\n console.log(' memory store api_pattern \"Always use env vars\" --reasoningbank');\n console.log(' memory query \"API configuration\" --reasoningbank # Semantic search!');\n console.log(' memory status --reasoningbank # Show AI metrics');\n console.log();\n console.log(' # Auto-detect mode (smart selection)');\n console.log(' memory query config --auto # Uses ReasoningBank if available');\n console.log();\n console.log(' # Mode management');\n console.log(' memory detect # Show available modes');\n console.log(' memory mode # Show current configuration');\n console.log();\n console.log('šŸ’” Tips:');\n console.log(' • Use Basic mode for simple key-value storage (fast, always available)');\n console.log(' • Use ReasoningBank for AI-powered semantic search (learns from patterns)');\n console.log(' • Use --auto to let claude-flow choose the best mode for you');\n console.log(' • Always use --redact when storing API keys or secrets!');\n}\n"],"names":["printSuccess","printError","printWarning","printInfo","promises","fs","KeyRedactor","exec","promisify","execAsync","memoryCommand","subArgs","flags","memorySubcommand","memoryStore","namespace","ns","getNamespaceFromArgs","enableRedaction","redact","includes","mode","detectMemoryMode","loadMemory","content","readFile","JSON","parse","saveMemory","data","mkdir","recursive","writeFile","stringify","handleReasoningBankCommand","handleModeCommand","storeMemory","queryMemory","showMemoryStats","exportMemory","importMemory","clearMemory","listNamespaces","showMemoryHelp","key","value","slice","join","redactedValue","securityWarnings","validation","validate","safe","warnings","forEach","warning","console","log","filter","e","push","timestamp","Date","now","redacted","length","TextEncoder","encode","err","message","search","results","entries","Object","entry","sort","a","b","displayValue","substring","toLocaleString","totalEntries","namespaceStats","keys","toFixed","count","filename","exportData","values","importContent","importData","existingData","totalImported","existingKeys","Set","map","newEntries","has","nsFromArgs","entryCount","namespaces","namespaceIndex","indexOf","nsIndex","reasoningbank","rb","auto","initialized","isReasoningBankInitialized","dbPath","access","command","stdout","stderr","timeout","error","cmd","buildReasoningBankCommand","parts","commandMap","store","query","list","status","consolidate","demo","test","benchmark","args","arg","startsWith","detectModes","showCurrentMode","migrateMemory","basicAvailable","checkBasicMode","rbAvailable","memoryDir","rbInitialized","targetMode","to","getArgValue","flag","index"],"mappings":"AACA,SAASA,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,QAAQ,cAAc;AAChF,SAASC,YAAYC,EAAE,QAAQ,KAAK;AAGpC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,SAAS,QAAQ,OAAO;AAEjC,MAAMC,YAAYD,UAAUD;AAE5B,OAAO,eAAeG,cAAcC,OAAO,EAAEC,KAAK;IAChD,MAAMC,mBAAmBF,OAAO,CAAC,EAAE;IACnC,MAAMG,cAAc;IAGpB,MAAMC,YAAYH,OAAOG,aAAaH,OAAOI,MAAMC,qBAAqBN,YAAY;IAGpF,MAAMO,kBAAkBN,OAAOO,UAAUR,QAAQS,QAAQ,CAAC,eAAeT,QAAQS,QAAQ,CAAC;IAG1F,MAAMC,OAAO,MAAMC,iBAAiBV,OAAOD;IAG3C,eAAeY;QACb,IAAI;YACF,MAAMC,UAAU,MAAMnB,GAAGoB,QAAQ,CAACX,aAAa;YAC/C,OAAOY,KAAKC,KAAK,CAACH;QACpB,EAAE,OAAM;YACN,OAAO,CAAC;QACV;IACF;IAGA,eAAeI,WAAWC,IAAI;QAC5B,MAAMxB,GAAGyB,KAAK,CAAC,YAAY;YAAEC,WAAW;QAAK;QAC7C,MAAM1B,GAAG2B,SAAS,CAAClB,aAAaY,KAAKO,SAAS,CAACJ,MAAM,MAAM,GAAG;IAChE;IAGA,IAAIR,SAAS,mBAAmB;QAAC;QAAQ;QAAU;QAAe;QAAQ;QAAQ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QC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"} \ No newline at end of file +{"version":3,"sources":["../../../../src/cli/simple-commands/memory.js"],"sourcesContent":["// memory.js - Memory management commands\nimport { printSuccess, printError, printWarning, printInfo } from '../utils.js';\nimport { promises as fs } from 'fs';\nimport { cwd, exit, existsSync } from '../node-compat.js';\nimport { getUnifiedMemory } from '../../memory/unified-memory-manager.js';\nimport { KeyRedactor } from '../../utils/key-redactor.js';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\nexport async function memoryCommand(subArgs, flags) {\n const memorySubcommand = subArgs[0];\n const memoryStore = './memory/memory-store.json';\n\n // Extract namespace from flags or subArgs\n const namespace = flags?.namespace || flags?.ns || getNamespaceFromArgs(subArgs) || 'default';\n\n // Check for redaction flag\n const enableRedaction = flags?.redact || subArgs.includes('--redact') || subArgs.includes('--secure');\n\n // NEW: Detect memory mode (basic, reasoningbank, auto)\n const mode = await detectMemoryMode(flags, subArgs);\n\n // Helper to load memory data\n async function loadMemory() {\n try {\n const content = await fs.readFile(memoryStore, 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n }\n\n // Helper to save memory data\n async function saveMemory(data) {\n await fs.mkdir('./memory', { recursive: true });\n await fs.writeFile(memoryStore, JSON.stringify(data, null, 2, 'utf8'));\n }\n\n // NEW: Handle ReasoningBank-specific commands\n if (mode === 'reasoningbank' && ['init', 'status', 'consolidate', 'demo', 'test', 'benchmark'].includes(memorySubcommand)) {\n return await handleReasoningBankCommand(memorySubcommand, subArgs, flags);\n }\n\n // NEW: Handle new mode management commands\n if (['detect', 'mode', 'migrate'].includes(memorySubcommand)) {\n return await handleModeCommand(memorySubcommand, subArgs, flags);\n }\n\n // NEW: Delegate to ReasoningBank for regular commands if mode is set\n if (mode === 'reasoningbank' && ['store', 'query', 'list'].includes(memorySubcommand)) {\n return await handleReasoningBankCommand(memorySubcommand, subArgs, flags);\n }\n\n switch (memorySubcommand) {\n case 'store':\n await storeMemory(subArgs, loadMemory, saveMemory, namespace, enableRedaction);\n break;\n\n case 'query':\n await queryMemory(subArgs, loadMemory, namespace, enableRedaction);\n break;\n\n case 'stats':\n await showMemoryStats(loadMemory);\n break;\n\n case 'export':\n await exportMemory(subArgs, loadMemory, namespace);\n break;\n\n case 'import':\n await importMemory(subArgs, saveMemory, loadMemory);\n break;\n\n case 'clear':\n await clearMemory(subArgs, saveMemory, namespace);\n break;\n\n case 'list':\n await listNamespaces(loadMemory);\n break;\n\n default:\n showMemoryHelp();\n }\n}\n\nasync function storeMemory(subArgs, loadMemory, saveMemory, namespace, enableRedaction = false) {\n const key = subArgs[1];\n let value = subArgs.slice(2).join(' ');\n\n if (!key || !value) {\n printError('Usage: memory store [--namespace ] [--redact]');\n return;\n }\n\n try {\n // Apply redaction if enabled\n let redactedValue = value;\n let securityWarnings = [];\n\n if (enableRedaction) {\n redactedValue = KeyRedactor.redact(value, true);\n const validation = KeyRedactor.validate(value);\n\n if (!validation.safe) {\n securityWarnings = validation.warnings;\n printWarning('šŸ”’ Redaction enabled: Sensitive data detected and redacted');\n securityWarnings.forEach(warning => console.log(` āš ļø ${warning}`));\n }\n } else {\n // Even if redaction is not explicitly enabled, validate and warn\n const validation = KeyRedactor.validate(value);\n if (!validation.safe) {\n printWarning('āš ļø Potential sensitive data detected! Use --redact flag for automatic redaction');\n validation.warnings.forEach(warning => console.log(` āš ļø ${warning}`));\n console.log(' šŸ’” Tip: Add --redact flag to automatically redact API keys');\n }\n }\n\n const data = await loadMemory();\n\n if (!data[namespace]) {\n data[namespace] = [];\n }\n\n // Remove existing entry with same key\n data[namespace] = data[namespace].filter((e) => e.key !== key);\n\n // Add new entry with redacted value\n data[namespace].push({\n key,\n value: redactedValue,\n namespace,\n timestamp: Date.now(),\n redacted: enableRedaction && securityWarnings.length > 0,\n });\n\n await saveMemory(data);\n printSuccess(enableRedaction && securityWarnings.length > 0 ? 'šŸ”’ Stored successfully (with redaction)' : 'āœ… Stored successfully');\n console.log(`šŸ“ Key: ${key}`);\n console.log(`šŸ“¦ Namespace: ${namespace}`);\n console.log(`šŸ’¾ Size: ${new TextEncoder().encode(redactedValue).length} bytes`);\n if (enableRedaction && securityWarnings.length > 0) {\n console.log(`šŸ”’ Security: ${securityWarnings.length} sensitive pattern(s) redacted`);\n }\n } catch (err) {\n printError(`Failed to store: ${err.message}`);\n }\n}\n\nasync function queryMemory(subArgs, loadMemory, namespace, enableRedaction = false) {\n const search = subArgs.slice(1).join(' ');\n\n if (!search) {\n printError('Usage: memory query [--namespace ] [--redact]');\n return;\n }\n\n try {\n const data = await loadMemory();\n const results = [];\n\n for (const [ns, entries] of Object.entries(data)) {\n if (namespace && ns !== namespace) continue;\n\n for (const entry of entries) {\n if (entry.key.includes(search) || entry.value.includes(search)) {\n results.push(entry);\n }\n }\n }\n\n if (results.length === 0) {\n printWarning('No results found');\n return;\n }\n\n printSuccess(`Found ${results.length} results:`);\n\n // Sort by timestamp (newest first)\n results.sort((a, b) => b.timestamp - a.timestamp);\n\n for (const entry of results.slice(0, 10)) {\n console.log(`\\nšŸ“Œ ${entry.key}`);\n console.log(` Namespace: ${entry.namespace}`);\n\n // Apply redaction to displayed value if requested\n let displayValue = entry.value;\n if (enableRedaction) {\n displayValue = KeyRedactor.redact(displayValue, true);\n }\n\n console.log(\n ` Value: ${displayValue.substring(0, 100)}${displayValue.length > 100 ? '...' : ''}`,\n );\n console.log(` Stored: ${new Date(entry.timestamp).toLocaleString()}`);\n\n // Show redaction status\n if (entry.redacted) {\n console.log(` šŸ”’ Status: Redacted on storage`);\n } else if (enableRedaction) {\n console.log(` šŸ”’ Status: Redacted for display`);\n }\n }\n\n if (results.length > 10) {\n console.log(`\\n... and ${results.length - 10} more results`);\n }\n } catch (err) {\n printError(`Failed to query: ${err.message}`);\n }\n}\n\nasync function showMemoryStats(loadMemory) {\n try {\n const data = await loadMemory();\n let totalEntries = 0;\n const namespaceStats = {};\n\n for (const [namespace, entries] of Object.entries(data)) {\n namespaceStats[namespace] = entries.length;\n totalEntries += entries.length;\n }\n\n printSuccess('Memory Bank Statistics:');\n console.log(` Total Entries: ${totalEntries}`);\n console.log(` Namespaces: ${Object.keys(data).length}`);\n console.log(\n ` Size: ${(new TextEncoder().encode(JSON.stringify(data)).length / 1024).toFixed(2)} KB`,\n );\n\n if (Object.keys(data).length > 0) {\n console.log('\\nšŸ“ Namespace Breakdown:');\n for (const [namespace, count] of Object.entries(namespaceStats)) {\n console.log(` ${namespace}: ${count} entries`);\n }\n }\n } catch (err) {\n printError(`Failed to get stats: ${err.message}`);\n }\n}\n\nasync function exportMemory(subArgs, loadMemory, namespace) {\n const filename = subArgs[1] || `memory-export-${Date.now()}.json`;\n\n try {\n const data = await loadMemory();\n\n let exportData = data;\n if (namespace) {\n exportData = { [namespace]: data[namespace] || [] };\n }\n\n await fs.writeFile(filename, JSON.stringify(exportData, null, 2, 'utf8'));\n printSuccess(`Memory exported to ${filename}`);\n\n let totalEntries = 0;\n for (const entries of Object.values(exportData)) {\n totalEntries += entries.length;\n }\n console.log(\n `šŸ“¦ Exported ${totalEntries} entries from ${Object.keys(exportData).length} namespace(s)`,\n );\n } catch (err) {\n printError(`Failed to export memory: ${err.message}`);\n }\n}\n\nasync function importMemory(subArgs, saveMemory, loadMemory) {\n const filename = subArgs[1];\n\n if (!filename) {\n printError('Usage: memory import ');\n return;\n }\n\n try {\n const importContent = await fs.readFile(filename, 'utf8');\n const importData = JSON.parse(importContent);\n\n // Load existing memory\n const existingData = await loadMemory();\n\n // Merge imported data\n let totalImported = 0;\n for (const [namespace, entries] of Object.entries(importData)) {\n if (!existingData[namespace]) {\n existingData[namespace] = [];\n }\n\n // Add entries that don't already exist (by key)\n const existingKeys = new Set(existingData[namespace].map((e) => e.key));\n const newEntries = entries.filter((e) => !existingKeys.has(e.key));\n\n existingData[namespace].push(...newEntries);\n totalImported += newEntries.length;\n }\n\n await saveMemory(existingData);\n printSuccess(`Imported ${totalImported} new entries from ${filename}`);\n } catch (err) {\n printError(`Failed to import memory: ${err.message}`);\n }\n}\n\nasync function clearMemory(subArgs, saveMemory, namespace) {\n if (!namespace || namespace === 'default') {\n const nsFromArgs = getNamespaceFromArgs(subArgs);\n if (!nsFromArgs) {\n printError('Usage: memory clear --namespace ');\n printWarning('This will clear all entries in the specified namespace');\n return;\n }\n namespace = nsFromArgs;\n }\n\n try {\n // Helper to load memory data\n async function loadMemory() {\n try {\n const content = await fs.readFile('./memory/memory-store.json', 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n }\n \n const data = await loadMemory();\n\n if (!data[namespace]) {\n printWarning(`Namespace '${namespace}' does not exist`);\n return;\n }\n\n const entryCount = data[namespace].length;\n delete data[namespace];\n\n await saveMemory(data);\n printSuccess(`Cleared ${entryCount} entries from namespace '${namespace}'`);\n } catch (err) {\n printError(`Failed to clear memory: ${err.message}`);\n }\n}\n\nasync function listNamespaces(loadMemory) {\n try {\n const data = await loadMemory();\n const namespaces = Object.keys(data);\n\n if (namespaces.length === 0) {\n printWarning('No namespaces found');\n return;\n }\n\n printSuccess('Available namespaces:');\n for (const namespace of namespaces) {\n const count = data[namespace].length;\n console.log(` ${namespace} (${count} entries)`);\n }\n } catch (err) {\n printError(`Failed to list namespaces: ${err.message}`);\n }\n}\n\nfunction getNamespaceFromArgs(subArgs) {\n const namespaceIndex = subArgs.indexOf('--namespace');\n if (namespaceIndex !== -1 && namespaceIndex + 1 < subArgs.length) {\n return subArgs[namespaceIndex + 1];\n }\n\n const nsIndex = subArgs.indexOf('--ns');\n if (nsIndex !== -1 && nsIndex + 1 < subArgs.length) {\n return subArgs[nsIndex + 1];\n }\n\n return null;\n}\n\n// Helper to load memory data (needed for import function)\nasync function loadMemory() {\n try {\n const content = await fs.readFile('./memory/memory-store.json', 'utf8');\n return JSON.parse(content);\n } catch {\n return {};\n }\n}\n\n// NEW: Mode detection function\nasync function detectMemoryMode(flags, subArgs) {\n // Explicit ReasoningBank flag takes precedence\n if (flags?.reasoningbank || flags?.rb || subArgs.includes('--reasoningbank') || subArgs.includes('--rb')) {\n return 'reasoningbank';\n }\n\n // Auto mode: detect if ReasoningBank is initialized\n if (flags?.auto || subArgs.includes('--auto')) {\n const initialized = await isReasoningBankInitialized();\n return initialized ? 'reasoningbank' : 'basic';\n }\n\n // Default: basic mode (backward compatible)\n return 'basic';\n}\n\n// NEW: Check if ReasoningBank is initialized\nasync function isReasoningBankInitialized() {\n try {\n // Check if .swarm/memory.db exists\n const dbPath = '.swarm/memory.db';\n await fs.access(dbPath);\n return true;\n } catch {\n return false;\n }\n}\n\n// NEW: Handle ReasoningBank commands\nasync function handleReasoningBankCommand(command, subArgs, flags) {\n const initialized = await isReasoningBankInitialized();\n\n // Lazy load the adapter (ES modules)\n const { initializeReasoningBank, storeMemory, queryMemories, listMemories, getStatus, checkReasoningBankTables, migrateReasoningBank } = await import('../../reasoningbank/reasoningbank-adapter.js');\n\n // Special handling for 'init' command\n if (command === 'init') {\n const dbPath = '.swarm/memory.db';\n\n if (initialized) {\n // Database exists - check if migration is needed\n printInfo('šŸ” Checking existing database for ReasoningBank schema...\\n');\n\n try {\n // Set the database path for ReasoningBank\n process.env.CLAUDE_FLOW_DB_PATH = dbPath;\n\n const tableCheck = await checkReasoningBankTables();\n\n if (tableCheck.exists) {\n printSuccess('āœ… ReasoningBank already complete');\n console.log('Database: .swarm/memory.db');\n console.log('All ReasoningBank tables present\\n');\n console.log('Use --reasoningbank flag with memory commands to enable AI features');\n return;\n }\n\n // Missing tables found - run migration\n console.log(`šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`);\n console.log(` Missing: ${tableCheck.missingTables.join(', ')}\\n`);\n\n const migrationResult = await migrateReasoningBank();\n\n if (migrationResult.success) {\n printSuccess(`āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`);\n console.log('\\nNext steps:');\n console.log(' 1. Store memories: memory store key \"value\" --reasoningbank');\n console.log(' 2. Query memories: memory query \"search\" --reasoningbank');\n console.log(' 3. Check status: memory status --reasoningbank');\n } else {\n printError(`āŒ Migration failed: ${migrationResult.message}`);\n console.log('Try running: init --force to reinitialize');\n }\n } catch (error) {\n printError('āŒ Migration check failed');\n console.error(error.message);\n console.log('\\nTry running: init --force to reinitialize');\n }\n return;\n }\n\n // Fresh initialization\n printInfo('🧠 Initializing ReasoningBank...');\n console.log('This will create: .swarm/memory.db\\n');\n\n try {\n await initializeReasoningBank();\n printSuccess('āœ… ReasoningBank initialized successfully!');\n console.log('\\nNext steps:');\n console.log(' 1. Store memories: memory store key \"value\" --reasoningbank');\n console.log(' 2. Query memories: memory query \"search\" --reasoningbank');\n console.log(' 3. Check status: memory status --reasoningbank');\n } catch (error) {\n printError('āŒ Failed to initialize ReasoningBank');\n console.error(error.message);\n }\n return;\n }\n\n // All other commands require initialization\n if (!initialized) {\n printError('āŒ ReasoningBank not initialized');\n console.log('\\nTo use ReasoningBank mode, first run:');\n console.log(' memory init --reasoningbank\\n');\n return;\n }\n\n printInfo(`🧠 Using ReasoningBank mode...`);\n\n try {\n // Handle different commands\n switch (command) {\n case 'store':\n await handleReasoningBankStore(subArgs, flags, storeMemory);\n break;\n\n case 'query':\n await handleReasoningBankQuery(subArgs, flags, queryMemories);\n break;\n\n case 'list':\n await handleReasoningBankList(subArgs, flags, listMemories);\n break;\n\n case 'status':\n await handleReasoningBankStatus(getStatus);\n break;\n\n case 'consolidate':\n case 'demo':\n case 'test':\n case 'benchmark':\n // These still use CLI commands\n const cmd = `npx agentic-flow reasoningbank ${command}`;\n const { stdout } = await execAsync(cmd, { timeout: 60000 });\n if (stdout) console.log(stdout);\n break;\n\n default:\n printError(`Unknown ReasoningBank command: ${command}`);\n }\n } catch (error) {\n printError(`āŒ ReasoningBank command failed`);\n console.error(error.message);\n }\n}\n\n// NEW: Handle ReasoningBank store\nasync function handleReasoningBankStore(subArgs, flags, storeMemory) {\n const key = subArgs[1];\n const value = subArgs.slice(2).join(' ');\n\n if (!key || !value) {\n printError('Usage: memory store --reasoningbank');\n return;\n }\n\n try {\n const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace') || 'default';\n\n const memoryId = await storeMemory(key, value, {\n namespace,\n agent: 'memory-agent',\n domain: namespace,\n });\n\n printSuccess('āœ… Stored successfully in ReasoningBank');\n console.log(`šŸ“ Key: ${key}`);\n console.log(`🧠 Memory ID: ${memoryId}`);\n console.log(`šŸ“¦ Namespace: ${namespace}`);\n console.log(`šŸ’¾ Size: ${new TextEncoder().encode(value).length} bytes`);\n console.log(`šŸ” Semantic search: enabled`);\n } catch (error) {\n printError(`Failed to store: ${error.message}`);\n }\n}\n\n// NEW: Handle ReasoningBank query\nasync function handleReasoningBankQuery(subArgs, flags, queryMemories) {\n const search = subArgs.slice(1).join(' ');\n\n if (!search) {\n printError('Usage: memory query --reasoningbank');\n return;\n }\n\n try {\n const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace');\n const results = await queryMemories(search, {\n domain: namespace || 'general',\n limit: 10,\n });\n\n if (results.length === 0) {\n printWarning('No results found');\n return;\n }\n\n printSuccess(`Found ${results.length} results (semantic search):`);\n\n for (const entry of results) {\n console.log(`\\nšŸ“Œ ${entry.key}`);\n console.log(` Namespace: ${entry.namespace}`);\n console.log(` Value: ${entry.value.substring(0, 100)}${entry.value.length > 100 ? '...' : ''}`);\n console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}%`);\n console.log(` Usage: ${entry.usage_count} times`);\n if (entry.score) {\n console.log(` Match Score: ${(entry.score * 100).toFixed(1)}%`);\n }\n console.log(` Stored: ${new Date(entry.created_at).toLocaleString()}`);\n }\n } catch (error) {\n printError(`Failed to query: ${error.message}`);\n }\n}\n\n// NEW: Handle ReasoningBank list\nasync function handleReasoningBankList(subArgs, flags, listMemories) {\n try {\n const sort = flags?.sort || getArgValue(subArgs, '--sort') || 'created_at';\n const limit = parseInt(flags?.limit || getArgValue(subArgs, '--limit') || '10');\n\n const results = await listMemories({ sort, limit });\n\n if (results.length === 0) {\n printWarning('No memories found');\n return;\n }\n\n printSuccess(`ReasoningBank memories (${results.length} shown):`);\n\n for (const entry of results) {\n console.log(`\\nšŸ“Œ ${entry.key}`);\n console.log(` Value: ${entry.value.substring(0, 80)}${entry.value.length > 80 ? '...' : ''}`);\n console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}% | Usage: ${entry.usage_count}`);\n }\n } catch (error) {\n printError(`Failed to list: ${error.message}`);\n }\n}\n\n// NEW: Handle ReasoningBank status\nasync function handleReasoningBankStatus(getStatus) {\n try {\n const stats = await getStatus();\n\n printSuccess('šŸ“Š ReasoningBank Status:');\n console.log(` Total memories: ${stats.total_memories}`);\n console.log(` Average confidence: ${(stats.avg_confidence * 100).toFixed(1)}%`);\n console.log(` Total usage: ${stats.total_usage}`);\n console.log(` Embeddings: ${stats.total_embeddings}`);\n console.log(` Trajectories: ${stats.total_trajectories}`);\n } catch (error) {\n printError(`Failed to get status: ${error.message}`);\n }\n}\n\n// NEW: Build agentic-flow reasoningbank command\nfunction buildReasoningBankCommand(command, subArgs, flags) {\n const parts = ['npx', 'agentic-flow', 'reasoningbank'];\n\n // Map memory commands to reasoningbank commands\n const commandMap = {\n store: 'store',\n query: 'query',\n list: 'list',\n status: 'status',\n consolidate: 'consolidate',\n demo: 'demo',\n test: 'test',\n benchmark: 'benchmark',\n };\n\n parts.push(commandMap[command] || command);\n\n // Add arguments (skip the command itself)\n const args = subArgs.slice(1);\n args.forEach((arg) => {\n if (!arg.startsWith('--reasoningbank') && !arg.startsWith('--rb') && !arg.startsWith('--auto')) {\n parts.push(`\"${arg}\"`);\n }\n });\n\n // Add required --agent parameter\n parts.push('--agent', 'memory-agent');\n\n return parts.join(' ');\n}\n\n// NEW: Handle mode management commands\nasync function handleModeCommand(command, subArgs, flags) {\n switch (command) {\n case 'detect':\n await detectModes();\n break;\n\n case 'mode':\n await showCurrentMode();\n break;\n\n case 'migrate':\n await migrateMemory(subArgs, flags);\n break;\n\n default:\n printError(`Unknown mode command: ${command}`);\n }\n}\n\n// NEW: Detect and show available memory modes\nasync function detectModes() {\n printInfo('šŸ” Detecting memory modes...\\n');\n\n // Check basic mode\n const basicAvailable = await checkBasicMode();\n console.log(basicAvailable ? 'āœ… Basic Mode (active)' : 'āŒ Basic Mode (unavailable)');\n if (basicAvailable) {\n console.log(' Location: ./memory/memory-store.json');\n console.log(' Features: Simple key-value storage, fast');\n }\n\n console.log('');\n\n // Check ReasoningBank mode\n const rbAvailable = await isReasoningBankInitialized();\n console.log(rbAvailable ? 'āœ… ReasoningBank Mode (available)' : 'āš ļø ReasoningBank Mode (not initialized)');\n if (rbAvailable) {\n console.log(' Location: .swarm/memory.db');\n console.log(' Features: AI-powered semantic search, learning');\n } else {\n console.log(' To enable: memory init --reasoningbank');\n }\n\n console.log('\\nšŸ’” Usage:');\n console.log(' Basic: memory store key \"value\"');\n console.log(' ReasoningBank: memory store key \"value\" --reasoningbank');\n console.log(' Auto-detect: memory query search --auto');\n}\n\n// NEW: Check if basic mode is available\nasync function checkBasicMode() {\n try {\n const memoryDir = './memory';\n await fs.access(memoryDir);\n return true;\n } catch {\n // Create directory if it doesn't exist\n try {\n await fs.mkdir(memoryDir, { recursive: true });\n return true;\n } catch {\n return false;\n }\n }\n}\n\n// NEW: Show current default mode\nasync function showCurrentMode() {\n const rbInitialized = await isReasoningBankInitialized();\n\n printInfo('šŸ“Š Current Memory Configuration:\\n');\n console.log('Default Mode: Basic (backward compatible)');\n console.log('Available Modes:');\n console.log(' • Basic Mode: Always available');\n console.log(` • ReasoningBank Mode: ${rbInitialized ? 'Initialized āœ…' : 'Not initialized āš ļø'}`);\n\n console.log('\\nšŸ’” To use a specific mode:');\n console.log(' --reasoningbank or --rb → Use ReasoningBank');\n console.log(' --auto → Auto-detect best mode');\n console.log(' (no flag) → Use Basic mode');\n}\n\n// NEW: Migrate memory between modes\nasync function migrateMemory(subArgs, flags) {\n const targetMode = flags?.to || getArgValue(subArgs, '--to');\n\n if (!targetMode || !['basic', 'reasoningbank'].includes(targetMode)) {\n printError('Usage: memory migrate --to ');\n return;\n }\n\n printInfo(`šŸ”„ Migrating to ${targetMode} mode...\\n`);\n\n if (targetMode === 'reasoningbank') {\n // Migrate basic → ReasoningBank\n const rbInitialized = await isReasoningBankInitialized();\n if (!rbInitialized) {\n printError('āŒ ReasoningBank not initialized');\n console.log('First run: memory init --reasoningbank\\n');\n return;\n }\n\n printWarning('āš ļø Migration from basic to ReasoningBank is not yet implemented');\n console.log('This feature is coming in v2.7.1\\n');\n console.log('For now, you can:');\n console.log(' 1. Export basic memory: memory export backup.json');\n console.log(' 2. Manually import to ReasoningBank');\n } else {\n // Migrate ReasoningBank → basic\n printWarning('āš ļø Migration from ReasoningBank to basic is not yet implemented');\n console.log('This feature is coming in v2.7.1\\n');\n }\n}\n\n// Helper to get argument value\nfunction getArgValue(args, flag) {\n const index = args.indexOf(flag);\n if (index !== -1 && index + 1 < args.length) {\n return args[index + 1];\n }\n return null;\n}\n\nfunction showMemoryHelp() {\n console.log('Memory commands:');\n console.log(' store Store a key-value pair');\n console.log(' query Search for entries');\n console.log(' stats Show memory statistics');\n console.log(' export [filename] Export memory to file');\n console.log(' import Import memory from file');\n console.log(' clear --namespace Clear a namespace');\n console.log(' list List all namespaces');\n console.log();\n console.log('🧠 ReasoningBank Commands (NEW in v2.7.0):');\n console.log(' init --reasoningbank Initialize ReasoningBank (AI-powered memory)');\n console.log(' status --reasoningbank Show ReasoningBank statistics');\n console.log(' detect Show available memory modes');\n console.log(' mode Show current memory configuration');\n console.log(' migrate --to Migrate between basic/reasoningbank');\n console.log();\n console.log('Options:');\n console.log(' --namespace Specify namespace for operations');\n console.log(' --ns Short form of --namespace');\n console.log(' --redact šŸ”’ Enable API key redaction (security feature)');\n console.log(' --secure Alias for --redact');\n console.log();\n console.log('šŸŽÆ Mode Selection (NEW):');\n console.log(' --reasoningbank, --rb Use ReasoningBank mode (AI-powered)');\n console.log(' --auto Auto-detect best available mode');\n console.log(' (no flag) Use Basic mode (default, backward compatible)');\n console.log();\n console.log('šŸ”’ Security Features (v2.6.0):');\n console.log(' API Key Protection: Automatically detects and redacts sensitive data');\n console.log(' Patterns Detected: Anthropic, OpenRouter, Gemini, Bearer tokens, etc.');\n console.log(' Auto-Validation: Warns when storing unredacted sensitive data');\n console.log(' Display Redaction: Redact sensitive data when querying with --redact');\n console.log();\n console.log('Examples:');\n console.log(' # Basic mode (default - backward compatible)');\n console.log(' memory store previous_work \"Research findings from yesterday\"');\n console.log(' memory store api_config \"key=sk-ant-...\" --redact # šŸ”’ Redacts API key');\n console.log(' memory query research --namespace sparc');\n console.log();\n console.log(' # ReasoningBank mode (AI-powered, opt-in)');\n console.log(' memory init --reasoningbank # One-time setup');\n console.log(' memory store api_pattern \"Always use env vars\" --reasoningbank');\n console.log(' memory query \"API configuration\" --reasoningbank # Semantic search!');\n console.log(' memory status --reasoningbank # Show AI metrics');\n console.log();\n console.log(' # Auto-detect mode (smart selection)');\n console.log(' memory query config --auto # Uses ReasoningBank if available');\n console.log();\n console.log(' # Mode management');\n console.log(' memory detect # Show available modes');\n console.log(' memory mode # Show current configuration');\n console.log();\n console.log('šŸ’” Tips:');\n console.log(' • Use Basic mode for simple key-value storage (fast, always available)');\n console.log(' • Use ReasoningBank for AI-powered semantic search (learns from patterns)');\n console.log(' • Use --auto to let claude-flow choose the best mode for you');\n console.log(' • Always use --redact when storing API keys or secrets!');\n}\n"],"names":["printSuccess","printError","printWarning","printInfo","promises","fs","KeyRedactor","exec","promisify","execAsync","memoryCommand","subArgs","flags","memorySubcommand","memoryStore","namespace","ns","getNamespaceFromArgs","enableRedaction","redact","includes","mode","detectMemoryMode","loadMemory","content","readFile","JSON","parse","saveMemory","data","mkdir","recursive","writeFile","stringify","handleReasoningBankCommand","handleModeCommand","storeMemory","queryMemory","showMemoryStats","exportMemory","importMemory","clearMemory","listNamespaces","showMemoryHelp","key","value","slice","join","redactedValue","securityWarnings","validation","validate","safe","warnings","forEach","warning","console","log","filter","e","push","timestamp","Date","now","redacted","length","TextEncoder","encode","err","message","search","results","entries","Object","entry","sort","a","b","displayValue","substring","toLocaleString","totalEntries","namespaceStats","keys","toFixed","count","filename","exportData","values","importContent","importData","existingData","totalImported","existingKeys","Set","map","newEntries","has","nsFromArgs","entryCount","namespaces","namespaceIndex","indexOf","nsIndex","reasoningbank","rb","auto","initialized","isReasoningBankInitialized","dbPath","access","command","initializeReasoningBank","queryMemories","listMemories","getStatus","checkReasoningBankTables","migrateReasoningBank","process","env","CLAUDE_FLOW_DB_PATH","tableCheck","exists","missingTables","migrationResult","success","addedTables","error","handleReasoningBankStore","handleReasoningBankQuery","handleReasoningBankList","handleReasoningBankStatus","cmd","stdout","timeout","getArgValue","memoryId","agent","domain","limit","confidence","usage_count","score","created_at","parseInt","stats","total_memories","avg_confidence","total_usage","total_embeddings","total_trajectories","buildReasoningBankCommand","parts","commandMap","store","query","list","status","consolidate","demo","test","benchmark","args","arg","startsWith","detectModes","showCurrentMode","migrateMemory","basicAvailable","checkBasicMode","rbAvailable","memoryDir","rbInitialized","targetMode","to","flag","index"],"mappings":"AACA,SAASA,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,QAAQ,cAAc;AAChF,SAASC,YAAYC,EAAE,QAAQ,KAAK;AAGpC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,SAAS,QAAQ,OAAO;AAEjC,MAAMC,YAAYD,UAAUD;AAE5B,OAAO,eAAeG,cAAcC,OAAO,EAAEC,KAAK;IAChD,MAAMC,mBAAmBF,OAAO,CAAC,EAAE;IACnC,MAAMG,cAAc;IAGpB,MAAMC,YAAYH,OAAOG,aAAaH,OAAOI,MAAMC,qBAAqBN,YAAY;IAGpF,MAAMO,kBAAkBN,OAAOO,UAAUR,QAAQS,QAAQ,CAAC,eAAeT,QAAQS,QAAQ,CAAC;IAG1F,MAAMC,OAAO,MAAMC,iBAAiBV,OAAOD;IAG3C,eAAeY;QACb,IAAI;YACF,MAAMC,UAAU,MAAMnB,GAAGoB,QAAQ,CAACX,aAAa;YAC/C,OAAOY,KAAKC,KAAK,CAACH;QACpB,EAAE,OAAM;YACN,OAAO,CAAC;QACV;IACF;IAGA,eAAeI,WAAWC,IAAI;QAC5B,MAAMxB,GAAGyB,KAAK,CAAC,YAAY;YAAEC,WAAW;QAAK;QAC7C,MAAM1B,GAAG2B,SAAS,CAAClB,aAAaY,KAAKO,SAAS,CAACJ,MAAM,MAAM,GAAG;IAChE;IAGA,IAAIR,SAAS,mBAAmB;QAAC;QAAQ;QAAU;QAAe;QAAQ;QAAQ;KAAY,CAACD,QAAQ,CAACP,mBAAmB;QACzH,OAAO,MAAMqB,2BAA2BrB,kBAAkBF,SAASC;IACrE;IAGA,IAAI;QAAC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AG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"} \ No newline at end of file diff --git a/dist-cjs/src/reasoningbank/reasoningbank-adapter.js b/dist-cjs/src/reasoningbank/reasoningbank-adapter.js new file mode 100644 index 000000000..90aa8b4e7 --- /dev/null +++ b/dist-cjs/src/reasoningbank/reasoningbank-adapter.js @@ -0,0 +1,320 @@ +import { db, initialize, retrieveMemories, computeEmbedding, loadConfig } from 'agentic-flow/dist/reasoningbank/index.js'; +import { v4 as uuidv4 } from 'uuid'; +const queryCache = new Map(); +const CACHE_SIZE = 100; +const CACHE_TTL = 60000; +const embeddingQueue = []; +let processingQueue = false; +export async function initializeReasoningBank() { + process.env.CLAUDE_FLOW_DB_PATH = '.swarm/memory.db'; + await initialize(); + await optimizeDatabase(); + return true; +} +async function optimizeDatabase() { + try { + const dbInstance = db.getDb(); + dbInstance.exec(` + -- Index on confidence for sorting + CREATE INDEX IF NOT EXISTS idx_patterns_confidence + ON patterns(confidence DESC); + + -- Index on usage_count for sorting + CREATE INDEX IF NOT EXISTS idx_patterns_usage + ON patterns(usage_count DESC); + + -- Index on created_at for time-based queries + CREATE INDEX IF NOT EXISTS idx_patterns_created + ON patterns(created_at DESC); + + -- Index on memory_id for embeddings lookup + CREATE INDEX IF NOT EXISTS idx_embeddings_memory + ON pattern_embeddings(memory_id); + `); + } catch (error) { + console.warn('[ReasoningBank] Failed to create indexes:', error.message); + } +} +export async function storeMemory(key, value, options = {}) { + const memoryId = `mem_${uuidv4()}`; + const memory = { + id: memoryId, + type: options.type || 'fact', + pattern_data: JSON.stringify({ + key, + value, + namespace: options.namespace || 'default', + agent: options.agent || 'memory-agent', + domain: options.domain || 'general' + }), + confidence: options.confidence || 0.8, + usage_count: 0, + created_at: new Date().toISOString() + }; + db.upsertMemory(memory); + queryCache.clear(); + if (options.async !== false) { + embeddingQueue.push({ + memoryId, + key, + value + }); + processEmbeddingQueue(); + } else { + await computeAndStoreEmbedding(memoryId, key, value); + } + return memoryId; +} +async function processEmbeddingQueue() { + if (processingQueue || embeddingQueue.length === 0) return; + processingQueue = true; + while(embeddingQueue.length > 0){ + const batch = embeddingQueue.splice(0, 5); + await Promise.allSettled(batch.map(({ memoryId, key, value })=>computeAndStoreEmbedding(memoryId, key, value))); + } + processingQueue = false; +} +async function computeAndStoreEmbedding(memoryId, key, value) { + try { + const config = loadConfig(); + const embeddingModel = config.embeddings.provider || 'claude'; + const embedding = await computeEmbedding(`${key}: ${value}`); + const vectorArray = new Float32Array(embedding); + db.upsertEmbedding({ + memory_id: memoryId, + vector: vectorArray, + model: embeddingModel, + dims: vectorArray.length, + created_at: new Date().toISOString() + }); + } catch (error) { + console.warn(`[ReasoningBank] Failed to compute embedding for ${memoryId}:`, error.message); + } +} +export async function queryMemories(searchQuery, options = {}) { + const cached = getCachedQuery(searchQuery, options); + if (cached) { + return cached; + } + const timeout = options.timeout || 3000; + try { + const memories = await Promise.race([ + retrieveMemories(searchQuery, { + domain: options.domain || 'general', + agent: options.agent || 'memory-agent', + k: options.limit || 10 + }), + new Promise((_, reject)=>setTimeout(()=>reject(new Error('Query timeout')), timeout)) + ]); + const results = memories.map((mem)=>{ + try { + const data = JSON.parse(mem.pattern_data); + return { + id: mem.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: mem.confidence, + usage_count: mem.usage_count, + created_at: mem.created_at, + score: mem.score || 0 + }; + } catch { + return null; + } + }).filter(Boolean); + if (results.length === 0) { + console.warn('[ReasoningBank] Semantic search returned 0 results, trying SQL fallback'); + const fallbackResults = await queryMemoriesFast(searchQuery, options); + setCachedQuery(searchQuery, options, fallbackResults); + return fallbackResults; + } + setCachedQuery(searchQuery, options, results); + return results; + } catch (error) { + console.warn('[ReasoningBank] Using fast SQL fallback:', error.message); + const results = await queryMemoriesFast(searchQuery, options); + setCachedQuery(searchQuery, options, results); + return results; + } +} +async function queryMemoriesFast(searchQuery, options = {}) { + const dbInstance = db.getDb(); + const limit = options.limit || 10; + const namespace = options.namespace; + let query = ` + SELECT + id, + pattern_data, + confidence, + usage_count, + created_at + FROM patterns + WHERE 1=1 + `; + const params = []; + if (namespace) { + query += ` AND pattern_data LIKE ?`; + params.push(`%"namespace":"${namespace}"%`); + } + query += ` AND ( + pattern_data LIKE ? OR + pattern_data LIKE ? + )`; + params.push(`%"key":"%${searchQuery}%"%`, `%"value":"%${searchQuery}%"%`); + query += ` ORDER BY confidence DESC, usage_count DESC LIMIT ?`; + params.push(limit); + const rows = dbInstance.prepare(query).all(...params); + return rows.map((row)=>{ + try { + const data = JSON.parse(row.pattern_data); + return { + id: row.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: row.confidence, + usage_count: row.usage_count, + created_at: row.created_at + }; + } catch { + return null; + } + }).filter(Boolean); +} +function getCachedQuery(searchQuery, options) { + const cacheKey = JSON.stringify({ + searchQuery, + options + }); + const cached = queryCache.get(cacheKey); + if (cached && Date.now() - cached.timestamp < CACHE_TTL) { + return cached.results; + } + return null; +} +function setCachedQuery(searchQuery, options, results) { + const cacheKey = JSON.stringify({ + searchQuery, + options + }); + if (queryCache.size >= CACHE_SIZE) { + const firstKey = queryCache.keys().next().value; + queryCache.delete(firstKey); + } + queryCache.set(cacheKey, { + results, + timestamp: Date.now() + }); +} +export async function listMemories(options = {}) { + const dbInstance = db.getDb(); + const limit = options.limit || 10; + const sortBy = options.sort || 'created_at'; + const sortOrder = options.order || 'DESC'; + const rows = dbInstance.prepare(` + SELECT * FROM patterns + ORDER BY ${sortBy} ${sortOrder} + LIMIT ? + `).all(limit); + return rows.map((row)=>{ + try { + const data = JSON.parse(row.pattern_data); + return { + id: row.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: row.confidence, + usage_count: row.usage_count, + created_at: row.created_at + }; + } catch { + return null; + } + }).filter(Boolean); +} +export async function getStatus() { + const dbInstance = db.getDb(); + const stats = dbInstance.prepare(` + SELECT + COUNT(*) as total_memories, + AVG(confidence) as avg_confidence, + SUM(usage_count) as total_usage + FROM patterns + `).get(); + const embeddingCount = dbInstance.prepare(` + SELECT COUNT(*) as count FROM pattern_embeddings + `).get(); + const trajectoryCount = dbInstance.prepare(` + SELECT COUNT(*) as count FROM task_trajectories + `).get(); + return { + total_memories: stats.total_memories || 0, + avg_confidence: stats.avg_confidence || 0, + total_usage: stats.total_usage || 0, + total_embeddings: embeddingCount.count || 0, + total_trajectories: trajectoryCount.count || 0 + }; +} +export async function checkReasoningBankTables() { + try { + const dbInstance = db.getDb(); + const requiredTables = [ + 'patterns', + 'pattern_embeddings', + 'pattern_links', + 'task_trajectories', + 'matts_runs', + 'consolidation_runs', + 'metrics_log' + ]; + const existingTables = dbInstance.prepare(` + SELECT name FROM sqlite_master + WHERE type='table' + `).all().map((row)=>row.name); + const missingTables = requiredTables.filter((table)=>!existingTables.includes(table)); + return { + exists: missingTables.length === 0, + existingTables, + missingTables, + requiredTables + }; + } catch (error) { + return { + exists: false, + existingTables: [], + missingTables: [], + requiredTables: [], + error: error.message + }; + } +} +export async function migrateReasoningBank() { + try { + const tableCheck = await checkReasoningBankTables(); + if (tableCheck.exists) { + return { + success: true, + message: 'All ReasoningBank tables already exist', + migrated: false + }; + } + await initializeReasoningBank(); + const afterCheck = await checkReasoningBankTables(); + return { + success: afterCheck.exists, + message: `Migration completed: ${tableCheck.missingTables.length} tables added`, + migrated: true, + addedTables: tableCheck.missingTables + }; + } catch (error) { + return { + success: false, + message: `Migration failed: ${error.message}`, + error: error.message + }; + } +} + +//# sourceMappingURL=reasoningbank-adapter.js.map \ No newline at end of file diff --git a/dist-cjs/src/reasoningbank/reasoningbank-adapter.js.map b/dist-cjs/src/reasoningbank/reasoningbank-adapter.js.map new file mode 100644 index 000000000..4bdffc814 --- /dev/null +++ b/dist-cjs/src/reasoningbank/reasoningbank-adapter.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../src/reasoningbank/reasoningbank-adapter.js"],"sourcesContent":["/**\n * ReasoningBank Adapter for Claude-Flow\n *\n * Wraps agentic-flow's ReasoningBank SDK for use in claude-flow memory commands\n * Performance-optimized with caching, timeouts, and async embeddings\n */\n\nimport { db, initialize, retrieveMemories, computeEmbedding, loadConfig } from 'agentic-flow/dist/reasoningbank/index.js';\nimport { v4 as uuidv4 } from 'uuid';\n\n// Query result cache (LRU)\nconst queryCache = new Map();\nconst CACHE_SIZE = 100;\nconst CACHE_TTL = 60000; // 60 seconds\n\n// Async embedding processing queue\nconst embeddingQueue = [];\nlet processingQueue = false;\n\n/**\n * Initialize ReasoningBank database with performance optimizations\n */\nexport async function initializeReasoningBank() {\n // Set database path\n process.env.CLAUDE_FLOW_DB_PATH = '.swarm/memory.db';\n\n await initialize();\n await optimizeDatabase();\n return true;\n}\n\n/**\n * Add database indexes for query performance\n */\nasync function optimizeDatabase() {\n try {\n const dbInstance = db.getDb();\n\n // Add indexes for common queries\n dbInstance.exec(`\n -- Index on confidence for sorting\n CREATE INDEX IF NOT EXISTS idx_patterns_confidence\n ON patterns(confidence DESC);\n\n -- Index on usage_count for sorting\n CREATE INDEX IF NOT EXISTS idx_patterns_usage\n ON patterns(usage_count DESC);\n\n -- Index on created_at for time-based queries\n CREATE INDEX IF NOT EXISTS idx_patterns_created\n ON patterns(created_at DESC);\n\n -- Index on memory_id for embeddings lookup\n CREATE INDEX IF NOT EXISTS idx_embeddings_memory\n ON pattern_embeddings(memory_id);\n `);\n } catch (error) {\n console.warn('[ReasoningBank] Failed to create indexes:', error.message);\n }\n}\n\n/**\n * Store a memory in ReasoningBank (optimized with async embeddings)\n */\nexport async function storeMemory(key, value, options = {}) {\n const memoryId = `mem_${uuidv4()}`;\n\n const memory = {\n id: memoryId,\n type: options.type || 'fact',\n pattern_data: JSON.stringify({\n key,\n value,\n namespace: options.namespace || 'default',\n agent: options.agent || 'memory-agent',\n domain: options.domain || 'general',\n }),\n confidence: options.confidence || 0.8,\n usage_count: 0,\n created_at: new Date().toISOString(),\n };\n\n // Store memory immediately (fast, no blocking)\n db.upsertMemory(memory);\n\n // Invalidate query cache when new memory is added\n queryCache.clear();\n\n // Queue embedding computation for background processing (unless disabled)\n if (options.async !== false) {\n embeddingQueue.push({ memoryId, key, value });\n processEmbeddingQueue(); // Non-blocking\n } else {\n // Synchronous mode for critical operations\n await computeAndStoreEmbedding(memoryId, key, value);\n }\n\n return memoryId;\n}\n\n/**\n * Process embedding queue in background\n */\nasync function processEmbeddingQueue() {\n if (processingQueue || embeddingQueue.length === 0) return;\n\n processingQueue = true;\n\n while (embeddingQueue.length > 0) {\n const batch = embeddingQueue.splice(0, 5); // Process 5 at a time\n\n await Promise.allSettled(\n batch.map(({ memoryId, key, value }) =>\n computeAndStoreEmbedding(memoryId, key, value)\n )\n );\n }\n\n processingQueue = false;\n}\n\n/**\n * Compute and store embedding for a memory\n */\nasync function computeAndStoreEmbedding(memoryId, key, value) {\n try {\n const config = loadConfig();\n const embeddingModel = config.embeddings.provider || 'claude';\n\n const embedding = await computeEmbedding(`${key}: ${value}`);\n const vectorArray = new Float32Array(embedding);\n\n db.upsertEmbedding({\n memory_id: memoryId,\n vector: vectorArray,\n model: embeddingModel,\n dims: vectorArray.length,\n created_at: new Date().toISOString(),\n });\n } catch (error) {\n console.warn(`[ReasoningBank] Failed to compute embedding for ${memoryId}:`, error.message);\n }\n}\n\n/**\n * Query memories from ReasoningBank (optimized with caching and timeout)\n */\nexport async function queryMemories(searchQuery, options = {}) {\n // Check cache first\n const cached = getCachedQuery(searchQuery, options);\n if (cached) {\n return cached;\n }\n\n const timeout = options.timeout || 3000; // 3s default timeout\n\n try {\n // Race between semantic search and timeout\n const memories = await Promise.race([\n retrieveMemories(searchQuery, {\n domain: options.domain || 'general',\n agent: options.agent || 'memory-agent',\n k: options.limit || 10,\n }),\n new Promise((_, reject) =>\n setTimeout(() => reject(new Error('Query timeout')), timeout)\n )\n ]);\n\n const results = memories.map(mem => {\n try {\n const data = JSON.parse(mem.pattern_data);\n return {\n id: mem.id,\n key: data.key,\n value: data.value,\n namespace: data.namespace,\n confidence: mem.confidence,\n usage_count: mem.usage_count,\n created_at: mem.created_at,\n score: mem.score || 0,\n };\n } catch {\n return null;\n }\n }).filter(Boolean);\n\n // If semantic search returns no results, try SQL fallback\n // (handles case where embeddings don't exist yet)\n if (results.length === 0) {\n console.warn('[ReasoningBank] Semantic search returned 0 results, trying SQL fallback');\n const fallbackResults = await queryMemoriesFast(searchQuery, options);\n setCachedQuery(searchQuery, options, fallbackResults);\n return fallbackResults;\n }\n\n // Cache successful results\n setCachedQuery(searchQuery, options, results);\n return results;\n } catch (error) {\n // Fast SQL fallback on timeout or error\n console.warn('[ReasoningBank] Using fast SQL fallback:', error.message);\n const results = await queryMemoriesFast(searchQuery, options);\n\n // Cache fallback results too\n setCachedQuery(searchQuery, options, results);\n return results;\n }\n}\n\n/**\n * Fast SQL-based query fallback (optimized)\n */\nasync function queryMemoriesFast(searchQuery, options = {}) {\n const dbInstance = db.getDb();\n const limit = options.limit || 10;\n const namespace = options.namespace;\n\n // Use optimized query with indexes\n let query = `\n SELECT\n id,\n pattern_data,\n confidence,\n usage_count,\n created_at\n FROM patterns\n WHERE 1=1\n `;\n\n const params = [];\n\n // Add namespace filter if provided\n if (namespace) {\n query += ` AND pattern_data LIKE ?`;\n params.push(`%\"namespace\":\"${namespace}\"%`);\n }\n\n // Add search filter - check both key and value\n query += ` AND (\n pattern_data LIKE ? OR\n pattern_data LIKE ?\n )`;\n params.push(`%\"key\":\"%${searchQuery}%\"%`, `%\"value\":\"%${searchQuery}%\"%`);\n\n // Use indexed sort\n query += ` ORDER BY confidence DESC, usage_count DESC LIMIT ?`;\n params.push(limit);\n\n const rows = dbInstance.prepare(query).all(...params);\n\n return rows.map(row => {\n try {\n const data = JSON.parse(row.pattern_data);\n return {\n id: row.id,\n key: data.key,\n value: data.value,\n namespace: data.namespace,\n confidence: row.confidence,\n usage_count: row.usage_count,\n created_at: row.created_at,\n };\n } catch {\n return null;\n }\n }).filter(Boolean);\n}\n\n/**\n * Get cached query results\n */\nfunction getCachedQuery(searchQuery, options) {\n const cacheKey = JSON.stringify({ searchQuery, options });\n const cached = queryCache.get(cacheKey);\n\n if (cached && Date.now() - cached.timestamp < CACHE_TTL) {\n return cached.results;\n }\n\n return null;\n}\n\n/**\n * Set cached query results (LRU eviction)\n */\nfunction setCachedQuery(searchQuery, options, results) {\n const cacheKey = JSON.stringify({ searchQuery, options });\n\n // LRU eviction\n if (queryCache.size >= CACHE_SIZE) {\n const firstKey = queryCache.keys().next().value;\n queryCache.delete(firstKey);\n }\n\n queryCache.set(cacheKey, {\n results,\n timestamp: Date.now()\n });\n}\n\n/**\n * List all memories\n */\nexport async function listMemories(options = {}) {\n const dbInstance = db.getDb();\n\n const limit = options.limit || 10;\n const sortBy = options.sort || 'created_at';\n const sortOrder = options.order || 'DESC';\n\n const rows = dbInstance.prepare(`\n SELECT * FROM patterns\n ORDER BY ${sortBy} ${sortOrder}\n LIMIT ?\n `).all(limit);\n\n return rows.map(row => {\n try {\n const data = JSON.parse(row.pattern_data);\n return {\n id: row.id,\n key: data.key,\n value: data.value,\n namespace: data.namespace,\n confidence: row.confidence,\n usage_count: row.usage_count,\n created_at: row.created_at,\n };\n } catch {\n return null;\n }\n }).filter(Boolean);\n}\n\n/**\n * Get ReasoningBank statistics\n */\nexport async function getStatus() {\n const dbInstance = db.getDb();\n\n const stats = dbInstance.prepare(`\n SELECT\n COUNT(*) as total_memories,\n AVG(confidence) as avg_confidence,\n SUM(usage_count) as total_usage\n FROM patterns\n `).get();\n\n const embeddingCount = dbInstance.prepare(`\n SELECT COUNT(*) as count FROM pattern_embeddings\n `).get();\n\n const trajectoryCount = dbInstance.prepare(`\n SELECT COUNT(*) as count FROM task_trajectories\n `).get();\n\n return {\n total_memories: stats.total_memories || 0,\n avg_confidence: stats.avg_confidence || 0,\n total_usage: stats.total_usage || 0,\n total_embeddings: embeddingCount.count || 0,\n total_trajectories: trajectoryCount.count || 0,\n };\n}\n\n/**\n * Check which ReasoningBank tables are present in the database\n * Returns object with table names and their existence status\n */\nexport async function checkReasoningBankTables() {\n try {\n const dbInstance = db.getDb();\n\n // Required ReasoningBank tables\n const requiredTables = [\n 'patterns',\n 'pattern_embeddings',\n 'pattern_links',\n 'task_trajectories',\n 'matts_runs',\n 'consolidation_runs',\n 'metrics_log'\n ];\n\n // Query existing tables\n const existingTables = dbInstance.prepare(`\n SELECT name FROM sqlite_master\n WHERE type='table'\n `).all().map(row => row.name);\n\n // Check which required tables are missing\n const missingTables = requiredTables.filter(table => !existingTables.includes(table));\n\n return {\n exists: missingTables.length === 0,\n existingTables,\n missingTables,\n requiredTables\n };\n } catch (error) {\n return {\n exists: false,\n existingTables: [],\n missingTables: [],\n requiredTables: [],\n error: error.message\n };\n }\n}\n\n/**\n * Migrate existing database to add missing ReasoningBank tables\n */\nexport async function migrateReasoningBank() {\n try {\n // Check current state\n const tableCheck = await checkReasoningBankTables();\n\n if (tableCheck.exists) {\n return {\n success: true,\n message: 'All ReasoningBank tables already exist',\n migrated: false\n };\n }\n\n // Run full initialization which will create missing tables\n await initializeReasoningBank();\n\n // Verify migration\n const afterCheck = await checkReasoningBankTables();\n\n return {\n success: afterCheck.exists,\n message: `Migration completed: ${tableCheck.missingTables.length} tables added`,\n migrated: true,\n addedTables: tableCheck.missingTables\n };\n } catch (error) {\n return {\n success: false,\n message: `Migration failed: ${error.message}`,\n error: error.message\n };\n }\n}\n"],"names":["db","initialize","retrieveMemories","computeEmbedding","loadConfig","v4","uuidv4","queryCache","Map","CACHE_SIZE","CACHE_TTL","embeddingQueue","processingQueue","initializeReasoningBank","process","env","CLAUDE_FLOW_DB_PATH","optimizeDatabase","dbInstance","getDb","exec","error","console","warn","message","storeMemory","key","value","options","memoryId","memory","id","type","pattern_data","JSON","stringify","namespace","agent","domain","confidence","usage_count","created_at","Date","toISOString","upsertMemory","clear","async","push","processEmbeddingQueue","computeAndStoreEmbedding","length","batch","splice","Promise","allSettled","map","config","embeddingModel","embeddings","provider","embedding","vectorArray","Float32Array","upsertEmbedding","memory_id","vector","model","dims","queryMemories","searchQuery","cached","getCachedQuery","timeout","memories","race","k","limit","_","reject","setTimeout","Error","results","mem","data","parse","score","filter","Boolean","fallbackResults","queryMemoriesFast","setCachedQuery","query","params","rows","prepare","all","row","cacheKey","get","now","timestamp","size","firstKey","keys","next","delete","set","listMemories","sortBy","sort","sortOrder","order","getStatus","stats","embeddingCount","trajectoryCount","total_memories","avg_confidence","total_usage","total_embeddings","count","total_trajectories","checkReasoningBankTables","requiredTables","existingTables","name","missingTables","table","includes","exists","migrateReasoningBank","tableCheck","success","migrated","afterCheck","addedTables"],"mappings":"AAOA,SAAUA,EAAE,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,2CAA2C;AAC3H,SAASC,MAAMC,MAAM,QAAQ,OAAO;AAGpC,MAAMC,aAAa,IAAIC;AACvB,MAAMC,aAAa;AACnB,MAAMC,YAAY;AAGlB,MAAMC,iBAAiB,EAAE;AACzB,IAAIC,kBAAkB;AAKtB,OAAO,eAAeC;IAEpBC,QAAQC,GAAG,CAACC,mBAAmB,GAAG;IAElC,MAAMf;IACN,MAAMgB;IACN,OAAO;AACT;AAKA,eAAeA;IACb,IAAI;QACF,MAAMC,aAAalB,GAAG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AOA,IAAI6B,IAAI;QAG5B,MAAMC,gBAAgBH,eAAerC,MAAM,CAACyC,CAAAA,QAAS,CAACH,eAAeI,QAAQ,CAACD;QAE9E,OAAO;YACLE,QAAQH,cAAc5E,MAAM,KAAK;YACjC0E;YACAE;YACAH;QACF;IACF,EAAE,OAAOtG,OAAO;QACd,OAAO;YACL4G,QAAQ;YACRL,gBAAgB,EAAE;YAClBE,eAAe,EAAE;YACjBH,gBAAgB,EAAE;YAClBtG,OAAOA,MAAMG,OAAO;QACtB;IACF;AACF;AAKA,OAAO,eAAe0G;IACpB,IAAI;QAEF,MAAMC,aAAa,MAAMT;QAEzB,IAAIS,WAAWF,MAAM,EAAE;YACrB,OAAO;gBACLG,SAAS;gBACT5G,SAAS;gBACT6G,UAAU;YACZ;QACF;QAGA,MAAMxH;QAGN,MAAMyH,aAAa,MAAMZ;QAEzB,OAAO;YACLU,SAASE,WAAWL,MAAM;YAC1BzG,SAAS,CAAC,qBAAqB,EAAE2G,WAAWL,aAAa,CAAC5E,MAAM,CAAC,aAAa,CAAC;YAC/EmF,UAAU;YACVE,aAAaJ,WAAWL,aAAa;QACvC;IACF,EAAE,OAAOzG,OAAO;QACd,OAAO;YACL+G,SAAS;YACT5G,SAAS,CAAC,kBAAkB,EAAEH,MAAMG,OAAO,EAAE;YAC7CH,OAAOA,MAAMG,OAAO;QACtB;IACF;AACF"} \ No newline at end of file diff --git a/dist-cjs/src/utils/key-redactor.js.map b/dist-cjs/src/utils/key-redactor.js.map index ce9ffb434..1792a2161 100644 --- a/dist-cjs/src/utils/key-redactor.js.map +++ b/dist-cjs/src/utils/key-redactor.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/utils/key-redactor.js"],"sourcesContent":["/**\n * API Key Redaction Utility\n * Prevents sensitive data from leaking into logs, memory, or git commits\n */\n\nexport class KeyRedactor {\n static API_KEY_PATTERNS = [\n // Anthropic API keys\n /sk-ant-[a-zA-Z0-9_-]{95,}/gi,\n\n // OpenRouter API keys\n /sk-or-[a-zA-Z0-9_-]{32,}/gi,\n\n // Google/Gemini API keys\n /AIza[a-zA-Z0-9_-]{35}/gi,\n\n // Generic API keys\n /[a-zA-Z0-9_-]{20,}API[a-zA-Z0-9_-]{20,}/gi,\n\n // Bearer tokens\n /Bearer\\s+[a-zA-Z0-9_\\-\\.]{20,}/gi,\n\n // Environment variable format\n /([A-Z_]+_API_KEY|[A-Z_]+_TOKEN|[A-Z_]+_SECRET)=[\"']?([^\"'\\s]+)[\"']?/gi,\n\n // Supabase keys\n /eyJ[a-zA-Z0-9_-]*\\.eyJ[a-zA-Z0-9_-]*\\.[a-zA-Z0-9_-]*/gi,\n ];\n\n static SENSITIVE_FIELDS = [\n 'apiKey',\n 'api_key',\n 'token',\n 'secret',\n 'password',\n 'private_key',\n 'privateKey',\n 'accessToken',\n 'access_token',\n 'refreshToken',\n 'refresh_token',\n ];\n\n /**\n * Redact API keys and sensitive data from text\n */\n static redact(text, showPrefix = true) {\n if (!text) return text;\n\n let redacted = text;\n\n // Redact using patterns\n this.API_KEY_PATTERNS.forEach(pattern => {\n redacted = redacted.replace(pattern, (match) => {\n if (showPrefix && match.length > 8) {\n const prefix = match.substring(0, 8);\n return `${prefix}...[REDACTED]`;\n }\n return '[REDACTED_API_KEY]';\n });\n });\n\n return redacted;\n }\n\n /**\n * Redact sensitive fields in objects\n */\n static redactObject(obj, deep = true) {\n if (!obj || typeof obj !== 'object') return obj;\n\n const redacted = { ...obj };\n\n Object.keys(redacted).forEach(key => {\n const lowerKey = key.toLowerCase();\n\n // Check if field name is sensitive\n const isSensitive = this.SENSITIVE_FIELDS.some(field =>\n lowerKey.includes(field)\n );\n\n if (isSensitive && typeof redacted[key] === 'string') {\n const value = redacted[key];\n if (value && value.length > 8) {\n redacted[key] = `${value.substring(0, 4)}...[REDACTED]`;\n } else {\n redacted[key] = '[REDACTED]';\n }\n } else if (deep && typeof redacted[key] === 'object' && redacted[key] !== null) {\n redacted[key] = this.redactObject(redacted[key], deep);\n } else if (typeof redacted[key] === 'string') {\n // Redact any API keys in string values\n redacted[key] = this.redact(redacted[key]);\n }\n });\n\n return redacted;\n }\n\n /**\n * Sanitize text for safe logging\n */\n static sanitize(text) {\n return this.redact(text, true);\n }\n\n /**\n * Sanitize command arguments\n */\n static sanitizeArgs(args) {\n return args.map(arg => {\n // Check if arg is a flag value pair\n if (arg.includes('key') || arg.includes('token') || arg.includes('secret')) {\n return this.redact(arg);\n }\n return arg;\n });\n }\n\n /**\n * Check if text contains unredacted sensitive data\n */\n static containsSensitiveData(text) {\n return this.API_KEY_PATTERNS.some(pattern => pattern.test(text));\n }\n\n /**\n * Validate that text is safe for logging/storage\n */\n static validate(text) {\n const warnings = [];\n\n this.API_KEY_PATTERNS.forEach((pattern, index) => {\n if (pattern.test(text)) {\n warnings.push(`Potential API key detected (pattern ${index + 1})`);\n }\n });\n\n return {\n safe: warnings.length === 0,\n warnings,\n };\n }\n\n /**\n * Redact environment variables\n */\n static redactEnv(env) {\n const redacted = {};\n\n Object.keys(env).forEach(key => {\n const value = env[key];\n if (!value) {\n redacted[key] = '';\n return;\n }\n\n const lowerKey = key.toLowerCase();\n const isSensitive = lowerKey.includes('key') ||\n lowerKey.includes('token') ||\n lowerKey.includes('secret') ||\n lowerKey.includes('password');\n\n if (isSensitive) {\n redacted[key] = value.length > 8\n ? `${value.substring(0, 4)}...[REDACTED]`\n : '[REDACTED]';\n } else {\n redacted[key] = value;\n }\n });\n\n return redacted;\n }\n}\n\n// Export singleton instance\nexport const redactor = KeyRedactor;\n"],"names":["KeyRedactor","API_KEY_PATTERNS","SENSITIVE_FIELDS","redact","text","showPrefix","redacted","forEach","pattern","replace","match","length","prefix","substring","redactObject","obj","deep","Object","keys","key","lowerKey","toLowerCase","isSensitive","some","field","includes","value","sanitize","sanitizeArgs","args","map","arg","containsSensitiveData","test","validate","warnings","index","push","safe","redactEnv","env","redactor"],"mappings":"AAKA,OAAO,MAAMA;IACX,OAAOC,mBAAmB;QAExB;QAGA;QAGA;Q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;YAEA,MAAMC,WAAWD,IAAIE,WAAW;YAChC,MAAMC,cAAcF,SAASK,QAAQ,CAAC,UACnBL,SAASK,QAAQ,CAAC,YAClBL,SAASK,QAAQ,CAAC,aAClBL,SAASK,QAAQ,CAAC;YAErC,IAAIH,aAAa;gBACfhB,QAAQ,CAACa,IAAI,GAAGO,MAAMf,MAAM,GAAG,IAC3B,GAAGe,MAAMb,SAAS,CAAC,GAAG,GAAG,aAAa,CAAC,GACvC;YACN,OAAO;gBACLP,QAAQ,CAACa,IAAI,GAAGO;YAClB;QACF;QAEA,OAAOpB;IACT;AACF;AAGA,OAAO,MAAMmC,WAAWzC,YAAY"},GAAG,CAACrB,IAAI;YACtB,IAAI,CAACO,OAAO;gBACVpB,QAAQ,CAACa,IAAI,GAAG;gBAChB;YACF;YAEA,MAAMC,WAAWD,IAAIE,WAAW;YAChC,MAAMC,cAAcF,SAASK,QAAQ,CAAC,UACnBL,SAASK,QAAQ,CAAC,YAClBL,SAASK,QAAQ,CAAC,aAClBL,SAASK,QAAQ,CAAC;YAErC,IAAIH,aAAa;gBACfhB,QAAQ,CAACa,IAAI,GAAGO,MAAMf,MAAM,GAAG,IAC3B,GAAGe,MAAMb,SAAS,CAAC,GAAG,GAAG,aAAa,CAAC,GACvC;YACN,OAAO;gBACLP,QAAQ,CAACa,IAAI,GAAGO;YAClB;QACF;QAEA,OAAOpB;IACT;AACF;AAGA,OAAO,MAAMmC,WAAWzC,YAAY"} \ No newline at end of file +{"version":3,"sources":["../../../src/utils/key-redactor.ts"],"sourcesContent":["/**\n * API Key Redaction Utility\n * Prevents sensitive data from leaking into logs, memory, or git commits\n */\n\nexport interface RedactionConfig {\n patterns: RegExp[];\n replacement: string;\n maskLength: number;\n}\n\nexport class KeyRedactor {\n private static readonly API_KEY_PATTERNS = [\n // Anthropic API keys\n /sk-ant-[a-zA-Z0-9_-]{95,}/gi,\n\n // OpenRouter API keys\n /sk-or-[a-zA-Z0-9_-]{32,}/gi,\n\n // Google/Gemini API keys\n /AIza[a-zA-Z0-9_-]{35}/gi,\n\n // Generic API keys\n /[a-zA-Z0-9_-]{20,}API[a-zA-Z0-9_-]{20,}/gi,\n\n // Bearer tokens\n /Bearer\\s+[a-zA-Z0-9_\\-\\.]{20,}/gi,\n\n // Environment variable format\n /([A-Z_]+_API_KEY|[A-Z_]+_TOKEN|[A-Z_]+_SECRET)=[\"']?([^\"'\\s]+)[\"']?/gi,\n\n // Supabase keys\n /eyJ[a-zA-Z0-9_-]*\\.eyJ[a-zA-Z0-9_-]*\\.[a-zA-Z0-9_-]*/gi,\n ];\n\n private static readonly SENSITIVE_FIELDS = [\n 'apiKey',\n 'api_key',\n 'token',\n 'secret',\n 'password',\n 'private_key',\n 'privateKey',\n 'accessToken',\n 'access_token',\n 'refreshToken',\n 'refresh_token',\n ];\n\n /**\n * Redact API keys and sensitive data from text\n */\n static redact(text: string, showPrefix = true): string {\n if (!text) return text;\n\n let redacted = text;\n\n // Redact using patterns\n this.API_KEY_PATTERNS.forEach(pattern => {\n redacted = redacted.replace(pattern, (match) => {\n if (showPrefix && match.length > 8) {\n const prefix = match.substring(0, 8);\n return `${prefix}...[REDACTED]`;\n }\n return '[REDACTED_API_KEY]';\n });\n });\n\n return redacted;\n }\n\n /**\n * Redact sensitive fields in objects\n */\n static redactObject>(obj: T, deep = true): T {\n if (!obj || typeof obj !== 'object') return obj;\n\n const redacted = { ...obj };\n\n Object.keys(redacted).forEach(key => {\n const lowerKey = key.toLowerCase();\n\n // Check if field name is sensitive\n const isSensitive = this.SENSITIVE_FIELDS.some(field =>\n lowerKey.includes(field)\n );\n\n if (isSensitive && typeof redacted[key] === 'string') {\n const value = redacted[key] as string;\n if (value && value.length > 8) {\n redacted[key] = `${value.substring(0, 4)}...[REDACTED]` as any;\n } else {\n redacted[key] = '[REDACTED]' as any;\n }\n } else if (deep && typeof redacted[key] === 'object' && redacted[key] !== null) {\n redacted[key] = this.redactObject(redacted[key], deep);\n } else if (typeof redacted[key] === 'string') {\n // Redact any API keys in string values\n redacted[key] = this.redact(redacted[key]) as any;\n }\n });\n\n return redacted;\n }\n\n /**\n * Sanitize text for safe logging\n */\n static sanitize(text: string): string {\n return this.redact(text, true);\n }\n\n /**\n * Sanitize command arguments\n */\n static sanitizeArgs(args: string[]): string[] {\n return args.map(arg => {\n // Check if arg is a flag value pair\n if (arg.includes('key') || arg.includes('token') || arg.includes('secret')) {\n return this.redact(arg);\n }\n return arg;\n });\n }\n\n /**\n * Check if text contains unredacted sensitive data\n */\n static containsSensitiveData(text: string): boolean {\n return this.API_KEY_PATTERNS.some(pattern => pattern.test(text));\n }\n\n /**\n * Validate that text is safe for logging/storage\n */\n static validate(text: string): { safe: boolean; warnings: string[] } {\n const warnings: string[] = [];\n\n this.API_KEY_PATTERNS.forEach((pattern, index) => {\n if (pattern.test(text)) {\n warnings.push(`Potential API key detected (pattern ${index + 1})`);\n }\n });\n\n return {\n safe: warnings.length === 0,\n warnings,\n };\n }\n\n /**\n * Redact environment variables\n */\n static redactEnv(env: Record): Record {\n const redacted: Record = {};\n\n Object.keys(env).forEach(key => {\n const value = env[key];\n if (!value) {\n redacted[key] = '';\n return;\n }\n\n const lowerKey = key.toLowerCase();\n const isSensitive = lowerKey.includes('key') ||\n lowerKey.includes('token') ||\n lowerKey.includes('secret') ||\n lowerKey.includes('password');\n\n if (isSensitive) {\n redacted[key] = value.length > 8\n ? `${value.substring(0, 4)}...[REDACTED]`\n : '[REDACTED]';\n } else {\n redacted[key] = value;\n }\n });\n\n return redacted;\n }\n}\n\n// Export singleton instance\nexport const redactor = KeyRedactor;\n"],"names":["KeyRedactor","API_KEY_PATTERNS","SENSITIVE_FIELDS","redact","text","showPrefix","redacted","forEach","pattern","replace","match","length","prefix","substring","redactObject","obj","deep","Object","keys","key","lowerKey","toLowerCase","isSensitive","some","field","includes","value","sanitize","sanitizeArgs","args","map","arg","containsSensitiveData","test","validate","warnings","index","push","safe","redactEnv","env","redactor"],"mappings":"AAWA,OAAO,MAAMA;IACX,O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O;gBACVpB,QAAQ,CAACa,IAAI,GAAG;gBAChB;YACF;YAEA,MAAMC,WAAWD,IAAIE,WAAW;YAChC,MAAMC,cAAcF,SAASK,QAAQ,CAAC,UACnBL,SAASK,QAAQ,CAAC,YAClBL,SAASK,QAAQ,CAAC,aAClBL,SAASK,QAAQ,CAAC;YAErC,IAAIH,aAAa;gBACfhB,QAAQ,CAACa,IAAI,GAAGO,MAAMf,MAAM,GAAG,IAC3B,GAAGe,MAAMb,SAAS,CAAC,GAAG,GAAG,aAAa,CAAC,GACvC;YACN,OAAO;gBACLP,QAAQ,CAACa,IAAI,GAAGO;YAClB;QACF;QAEA,OAAOpB;IACT;AACF;AAGA,OAAO,MAAMmC,WAAWzC,YAAY"} \ No newline at end of file diff --git a/dist-cjs/src/utils/metrics-reader.js b/dist-cjs/src/utils/metrics-reader.js index 9fa32cbfe..b521973a6 100644 --- a/dist-cjs/src/utils/metrics-reader.js +++ b/dist-cjs/src/utils/metrics-reader.js @@ -1,11 +1,13 @@ -import * as fs from 'fs/promises'; -import * as path from 'path'; +import { promises as fs } from 'fs'; +import path from 'path'; import { exec } from 'child_process'; import { promisify } from 'util'; const execAsync = promisify(exec); -export class MetricsReader { - metricsDir = '.claude-flow/metrics'; - sessionsDir = '.claude-flow/sessions'; +let MetricsReader = class MetricsReader { + constructor(){ + this.metricsDir = '.claude-flow/metrics'; + this.sessionsDir = '.claude-flow/sessions'; + } async getSystemMetrics() { try { const filePath = path.join(this.metricsDir, 'system-metrics.json'); @@ -16,6 +18,15 @@ export class MetricsReader { return null; } } + async getTaskQueue() { + try { + const queueFile = '.claude-flow/tasks/queue.json'; + const content = await fs.readFile(queueFile, 'utf8'); + return JSON.parse(content); + } catch (error) { + return []; + } + } async getTaskMetrics() { try { const filePath = path.join(this.metricsDir, 'task-metrics.json'); @@ -36,30 +47,30 @@ export class MetricsReader { } async getActiveAgents() { try { - const perfMetrics = await this.getPerformanceMetrics(); - const sessionFiles = await this.getSessionFiles(); const agents = []; - for (const file of sessionFiles){ - try { - const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8'); - const sessionData = JSON.parse(content); - if (sessionData.agents && Array.isArray(sessionData.agents)) { - agents.push(...sessionData.agents); + const agentsDir = '.claude-flow/agents'; + try { + const agentFiles = await fs.readdir(agentsDir); + for (const file of agentFiles){ + if (file.endsWith('.json')) { + try { + const content = await fs.readFile(path.join(agentsDir, file), 'utf8'); + const agent = JSON.parse(content); + agents.push(agent); + } catch {} } - } catch {} - } - if (agents.length === 0 && perfMetrics) { - const activeCount = perfMetrics.activeAgents || 0; - const totalCount = perfMetrics.totalAgents || 0; - for(let i = 0; i < totalCount; i++){ - agents.push({ - id: `agent-${i + 1}`, - name: `Agent ${i + 1}`, - type: i === 0 ? 'orchestrator' : 'worker', - status: i < activeCount ? 'active' : 'idle', - activeTasks: i < activeCount ? 1 : 0, - lastActivity: Date.now() - i * 1000 - }); + } + } catch {} + if (agents.length === 0) { + const sessionFiles = await this.getSessionFiles(); + for (const file of sessionFiles){ + try { + const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8'); + const sessionData = JSON.parse(content); + if (sessionData.agents && Array.isArray(sessionData.agents)) { + agents.push(...sessionData.agents); + } + } catch {} } } return agents; @@ -135,7 +146,7 @@ export class MetricsReader { } async getMCPServerStatus() { try { - const { stdout } = await execAsync('ps aux | grep -E "mcp-server\\.js|claude-flow mcp start" | grep -v grep | wc -l'); + const { stdout } = await execAsync('ps aux | grep -E "mcp" | grep -v grep | wc -l'); const processCount = parseInt(stdout.trim(), 10); const { stdout: orchestratorOut } = await execAsync('ps aux | grep -E "claude-flow start" | grep -v grep | wc -l'); const orchestratorRunning = parseInt(orchestratorOut.trim(), 10) > 0; @@ -164,6 +175,7 @@ export class MetricsReader { }; } } -} +}; +export { MetricsReader }; //# sourceMappingURL=metrics-reader.js.map \ No newline at end of file diff --git a/dist-cjs/src/utils/metrics-reader.js.map b/dist-cjs/src/utils/metrics-reader.js.map index 274fed6a7..840a373d2 100644 --- a/dist-cjs/src/utils/metrics-reader.js.map +++ b/dist-cjs/src/utils/metrics-reader.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../../src/utils/metrics-reader.ts"],"sourcesContent":["import * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\ninterface SystemMetrics {\n timestamp: number;\n memoryTotal: number;\n memoryUsed: number;\n memoryFree: number;\n memoryUsagePercent: number;\n memoryEfficiency: number;\n cpuCount: number;\n cpuLoad: number;\n platform: string;\n uptime: number;\n}\n\ninterface TaskMetric {\n id: string;\n type: string;\n success: boolean;\n duration: number;\n timestamp: number;\n metadata: Record;\n}\n\ninterface PerformanceMetrics {\n startTime: number;\n totalTasks: number;\n successfulTasks: number;\n failedTasks: number;\n totalAgents: number;\n activeAgents: number;\n neuralEvents: number;\n}\n\ninterface Agent {\n id: string;\n name: string;\n type: string;\n status: 'active' | 'idle' | 'busy';\n activeTasks: number;\n lastActivity?: number;\n}\n\ninterface SessionData {\n id: string;\n startTime: number;\n endTime?: number;\n agents: Agent[];\n tasks: any[];\n status: 'active' | 'completed' | 'paused';\n}\n\ninterface MCPServerStatus {\n running: boolean;\n processCount: number;\n orchestratorRunning: boolean;\n port: number | null;\n connections: number;\n}\n\nexport class MetricsReader {\n private metricsDir = '.claude-flow/metrics';\n private sessionsDir = '.claude-flow/sessions';\n\n async getSystemMetrics(): Promise {\n try {\n const filePath = path.join(this.metricsDir, 'system-metrics.json');\n const content = await fs.readFile(filePath, 'utf8');\n const metrics: SystemMetrics[] = JSON.parse(content);\n \n // Return the most recent metric\n return metrics.length > 0 ? metrics[metrics.length - 1] : null;\n } catch (error) {\n return null;\n }\n }\n\n async getTaskMetrics(): Promise {\n try {\n const filePath = path.join(this.metricsDir, 'task-metrics.json');\n const content = await fs.readFile(filePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return [];\n }\n }\n\n async getPerformanceMetrics(): Promise {\n try {\n const filePath = path.join(this.metricsDir, 'performance.json');\n const content = await fs.readFile(filePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n }\n\n async getActiveAgents(): Promise {\n try {\n // First check performance metrics for agent count\n const perfMetrics = await this.getPerformanceMetrics();\n \n // Also check session files for more detailed agent info\n const sessionFiles = await this.getSessionFiles();\n const agents: Agent[] = [];\n \n for (const file of sessionFiles) {\n try {\n const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8');\n const sessionData = JSON.parse(content);\n \n if (sessionData.agents && Array.isArray(sessionData.agents)) {\n agents.push(...sessionData.agents);\n }\n } catch {\n // Skip invalid session files\n }\n }\n \n // If no agents found in sessions, create mock agents based on performance metrics\n if (agents.length === 0 && perfMetrics) {\n const activeCount = perfMetrics.activeAgents || 0;\n const totalCount = perfMetrics.totalAgents || 0;\n \n for (let i = 0; i < totalCount; i++) {\n agents.push({\n id: `agent-${i + 1}`,\n name: `Agent ${i + 1}`,\n type: i === 0 ? 'orchestrator' : 'worker',\n status: i < activeCount ? 'active' : 'idle',\n activeTasks: i < activeCount ? 1 : 0,\n lastActivity: Date.now() - (i * 1000)\n });\n }\n }\n \n return agents;\n } catch (error) {\n return [];\n }\n }\n\n async getSessionStatus(): Promise {\n try {\n const sessionFiles = await this.getSessionFiles();\n \n if (sessionFiles.length === 0) {\n return null;\n }\n \n // Get the most recent session\n const mostRecentFile = sessionFiles[sessionFiles.length - 1];\n const content = await fs.readFile(path.join(this.sessionsDir, 'pair', mostRecentFile), 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n }\n\n async getRecentTasks(limit: number = 10): Promise {\n try {\n const taskMetrics = await this.getTaskMetrics();\n \n // Sort by timestamp descending and take the limit\n return taskMetrics\n .sort((a, b) => b.timestamp - a.timestamp)\n .slice(0, limit)\n .map(task => ({\n id: task.id,\n type: task.type,\n status: task.success ? 'completed' : 'failed',\n startTime: task.timestamp - task.duration,\n endTime: task.timestamp,\n duration: task.duration\n }));\n } catch (error) {\n return [];\n }\n }\n\n async getOverallHealth(): Promise<'healthy' | 'warning' | 'error'> {\n try {\n const systemMetrics = await this.getSystemMetrics();\n const perfMetrics = await this.getPerformanceMetrics();\n \n if (!systemMetrics && !perfMetrics) {\n return 'error';\n }\n \n // Check memory usage\n if (systemMetrics && systemMetrics.memoryUsagePercent > 90) {\n return 'error';\n }\n \n if (systemMetrics && systemMetrics.memoryUsagePercent > 75) {\n return 'warning';\n }\n \n // Check CPU load\n if (systemMetrics && systemMetrics.cpuLoad > 0.8) {\n return 'warning';\n }\n \n // Check task failure rate\n if (perfMetrics && perfMetrics.totalTasks > 0) {\n const failureRate = perfMetrics.failedTasks / perfMetrics.totalTasks;\n if (failureRate > 0.5) {\n return 'error';\n }\n if (failureRate > 0.2) {\n return 'warning';\n }\n }\n \n return 'healthy';\n } catch (error) {\n return 'error';\n }\n }\n\n private async getSessionFiles(): Promise {\n try {\n const files = await fs.readdir(path.join(this.sessionsDir, 'pair'));\n return files.filter(f => f.endsWith('.json')).sort();\n } catch (error) {\n return [];\n }\n }\n\n async getMCPServerStatus(): Promise {\n try {\n // Check if MCP server process is running\n const { stdout } = await execAsync('ps aux | grep -E \"mcp-server\\\\.js|claude-flow mcp start\" | grep -v grep | wc -l');\n const processCount = parseInt(stdout.trim(), 10);\n \n // Check for orchestrator running\n const { stdout: orchestratorOut } = await execAsync('ps aux | grep -E \"claude-flow start\" | grep -v grep | wc -l');\n const orchestratorRunning = parseInt(orchestratorOut.trim(), 10) > 0;\n \n // Determine status\n const isRunning = processCount > 0;\n \n // Try to get port from process (default is 3000)\n let port: number | null = 3000;\n try {\n const { stdout: portOut } = await execAsync('lsof -i :3000 2>/dev/null | grep LISTEN | wc -l');\n if (parseInt(portOut.trim(), 10) === 0) {\n // If port 3000 not listening, check other common ports\n port = null;\n }\n } catch {\n // lsof might not be available or port not in use\n }\n \n return {\n running: isRunning,\n processCount,\n orchestratorRunning,\n port,\n connections: processCount > 0 ? Math.max(1, processCount - 1) : 0 // Estimate connections\n };\n } catch (error) {\n // Fallback if commands fail\n return {\n running: false,\n processCount: 0,\n orchestratorRunning: false,\n port: null,\n connections: 0\n };\n }\n }\n}"],"names":["fs","path","exec","promisify","execAsync","MetricsReader","metricsDir","sessionsDir","getSystemMetrics","filePath","join","content","readFile","metrics","JSON","parse","length","error","getTaskMetrics","getPerformanceMetrics","getActiveAgents","perfMetrics","sessionFiles","getSessionFiles","agents","file","sessionData","Array","isArray","push","activeCount","activeAgents","totalCount","totalAgents","i","id","name","type","status","activeTasks","lastActivity","Date","now","getSessionStatus","mostRecentFile","getRecentTasks","limit","taskMetrics","sort","a","b","timestamp","slice","map","task","success","startTime","duration","endTime","getOverallHealth","systemMetrics","memoryUsagePercent","cpuLoad","totalTasks","failureRate","failedTasks","files","readdir","filter","f","endsWith","getMCPServerStatus","stdout","processCount","parseInt","trim","orchestratorOut","orchestratorRunning","isRunning","port","portOut","running","connections","Math","max"],"mappings":"AAAA,YAAYA,QAAQ,cAAc;AAClC,YAAYC,UAAU,OAAO;AAC7B,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,SAAS,QAAQ,OAAO;AAEjC,MAAMC,YAAYD,UAAUD;AA4D5B,OAAO,MAAMG;IACHC,aAAa,uBAAuB;IACpCC,cAAc,wBAAwB;IAE9C,MAAMC,mBAAkD;QACtD,IAAI;YACF,MAAMC,WAAWR,KAAKS,IAAI,CAAC,IAAI,CAACJ,UAAU,EAAE;YAC5C,MAAMK,UAAU,MAAMX,GAAGY,QAAQ,CAACH,UAAU;YAC5C,MAAMI,UAA2BC,KAAKC,KAAK,CAACJ;YAG5C,OAAOE,QAAQG,MAAM,GAAG,IAAIH,OAAO,CAACA,QAAQG,MAAM,GAAG,EAAE,GAAG;QAC5D,EAAE,OAAOC,OAAO;YACd,OAAO;QACT;IACF;IAEA,MAAMC,iBAAwC;QAC5C,IAAI;YACF,MAAMT,WAAWR,KAAKS,IAAI,CAAC,IAAI,CAACJ,UAAU,E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ACF,EAAE,OAAM,CAER;YAEA,OAAO;gBACLE,SAASH;gBACTL;gBACAI;gBACAE;gBACAG,aAAaT,eAAe,IAAIU,KAAKC,GAAG,CAAC,GAAGX,eAAe,KAAK;YAClE;QACF,EAAE,OAAOxD,OAAO;YAEd,OAAO;gBACLgE,SAAS;gBACTR,cAAc;gBACdI,qBAAqB;gBACrBE,MAAM;gBACNG,aAAa;YACf;QACF;IACF;AACF"} \ No newline at end of file +{"version":3,"sources":["../../../src/utils/metrics-reader.js"],"sourcesContent":["import { promises as fs } from 'fs';\nimport path from 'path';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\nclass MetricsReader {\n constructor() {\n this.metricsDir = '.claude-flow/metrics';\n this.sessionsDir = '.claude-flow/sessions';\n }\n\n async getSystemMetrics() {\n try {\n const filePath = path.join(this.metricsDir, 'system-metrics.json');\n const content = await fs.readFile(filePath, 'utf8');\n const metrics = JSON.parse(content);\n \n // Return the most recent metric\n return metrics.length > 0 ? metrics[metrics.length - 1] : null;\n } catch (error) {\n return null;\n }\n }\n\n async getTaskQueue() {\n try {\n const queueFile = '.claude-flow/tasks/queue.json';\n const content = await fs.readFile(queueFile, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return [];\n }\n }\n\n async getTaskMetrics() {\n try {\n const filePath = path.join(this.metricsDir, 'task-metrics.json');\n const content = await fs.readFile(filePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return [];\n }\n }\n\n async getPerformanceMetrics() {\n try {\n const filePath = path.join(this.metricsDir, 'performance.json');\n const content = await fs.readFile(filePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n }\n\n async getActiveAgents() {\n try {\n const agents = [];\n \n // Check for agents in the .claude-flow/agents directory\n const agentsDir = '.claude-flow/agents';\n try {\n const agentFiles = await fs.readdir(agentsDir);\n for (const file of agentFiles) {\n if (file.endsWith('.json')) {\n try {\n const content = await fs.readFile(path.join(agentsDir, file), 'utf8');\n const agent = JSON.parse(content);\n agents.push(agent);\n } catch {\n // Skip invalid agent files\n }\n }\n }\n } catch {\n // Agents directory doesn't exist yet\n }\n \n // If no agents found in directory, check session files\n if (agents.length === 0) {\n const sessionFiles = await this.getSessionFiles();\n for (const file of sessionFiles) {\n try {\n const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8');\n const sessionData = JSON.parse(content);\n \n if (sessionData.agents && Array.isArray(sessionData.agents)) {\n agents.push(...sessionData.agents);\n }\n } catch {\n // Skip invalid session files\n }\n }\n }\n \n return agents;\n } catch (error) {\n return [];\n }\n }\n\n async getSessionStatus() {\n try {\n const sessionFiles = await this.getSessionFiles();\n \n if (sessionFiles.length === 0) {\n return null;\n }\n \n // Get the most recent session\n const mostRecentFile = sessionFiles[sessionFiles.length - 1];\n const content = await fs.readFile(path.join(this.sessionsDir, 'pair', mostRecentFile), 'utf8');\n return JSON.parse(content);\n } catch (error) {\n return null;\n }\n }\n\n async getRecentTasks(limit = 10) {\n try {\n const taskMetrics = await this.getTaskMetrics();\n \n // Sort by timestamp descending and take the limit\n return taskMetrics\n .sort((a, b) => b.timestamp - a.timestamp)\n .slice(0, limit)\n .map(task => ({\n id: task.id,\n type: task.type,\n status: task.success ? 'completed' : 'failed',\n startTime: task.timestamp - task.duration,\n endTime: task.timestamp,\n duration: task.duration\n }));\n } catch (error) {\n return [];\n }\n }\n\n async getOverallHealth() {\n try {\n const systemMetrics = await this.getSystemMetrics();\n const perfMetrics = await this.getPerformanceMetrics();\n \n if (!systemMetrics && !perfMetrics) {\n return 'error';\n }\n \n // Check memory usage\n if (systemMetrics && systemMetrics.memoryUsagePercent > 90) {\n return 'error';\n }\n \n if (systemMetrics && systemMetrics.memoryUsagePercent > 75) {\n return 'warning';\n }\n \n // Check CPU load\n if (systemMetrics && systemMetrics.cpuLoad > 0.8) {\n return 'warning';\n }\n \n // Check task failure rate\n if (perfMetrics && perfMetrics.totalTasks > 0) {\n const failureRate = perfMetrics.failedTasks / perfMetrics.totalTasks;\n if (failureRate > 0.5) {\n return 'error';\n }\n if (failureRate > 0.2) {\n return 'warning';\n }\n }\n \n return 'healthy';\n } catch (error) {\n return 'error';\n }\n }\n\n async getSessionFiles() {\n try {\n const files = await fs.readdir(path.join(this.sessionsDir, 'pair'));\n return files.filter(f => f.endsWith('.json')).sort();\n } catch (error) {\n return [];\n }\n }\n\n async getMCPServerStatus() {\n try {\n // Check if MCP server process is running (including flow-nexus and other MCP variants)\n const { stdout } = await execAsync('ps aux | grep -E \"mcp\" | grep -v grep | wc -l');\n const processCount = parseInt(stdout.trim(), 10);\n \n // Check for orchestrator running\n const { stdout: orchestratorOut } = await execAsync('ps aux | grep -E \"claude-flow start\" | grep -v grep | wc -l');\n const orchestratorRunning = parseInt(orchestratorOut.trim(), 10) > 0;\n \n // Determine status\n const isRunning = processCount > 0;\n \n // Try to get port from process (default is 3000)\n let port = 3000;\n try {\n const { stdout: portOut } = await execAsync('lsof -i :3000 2>/dev/null | grep LISTEN | wc -l');\n if (parseInt(portOut.trim(), 10) === 0) {\n // If port 3000 not listening, check other common ports\n port = null;\n }\n } catch {\n // lsof might not be available or port not in use\n }\n \n return {\n running: isRunning,\n processCount,\n orchestratorRunning,\n port,\n connections: processCount > 0 ? Math.max(1, processCount - 1) : 0 // Estimate connections\n };\n } catch (error) {\n // Fallback if commands fail\n return {\n running: false,\n processCount: 0,\n orchestratorRunning: false,\n port: null,\n connections: 0\n };\n }\n }\n}\n\nexport { MetricsReader };"],"names":["promises","fs","path","exec","promisify","execAsync","MetricsReader","metricsDir","sessionsDir","getSystemMetrics","filePath","join","content","readFile","metrics","JSON","parse","length","error","getTaskQueue","queueFile","getTaskMetrics","getPerformanceMetrics","getActiveAgents","agents","agentsDir","agentFiles","readdir","file","endsWith","agent","push","sessionFiles","getSessionFiles","sessionData","Array","isArray","getSessionStatus","mostRecentFile","getRecentTasks","limit","taskMetrics","sort","a","b","timestamp","slice","map","task","id","type","status","success","startTime","duration","endTime","getOverallHealth","systemMetrics","perfMetrics","memoryUsagePercent","cpuLoad","totalTasks","failureRate","failedTasks","files","filter","f","getMCPServerStatus","stdout","processCount","parseInt","trim","orchestratorOut","orchestratorRunning","isRunning","port","portOut","running","connections","Math","max"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAK;AACpC,OAAOC,UAAU,OAAO;AACxB,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,SAAS,QAAQ,OAAO;AAEjC,MAAMC,YAAYD,UAAUD;AAE5B,IAAA,AAAMG,gBAAN,MAAMA;IACJ,aAAc;QACZ,IAAI,CAACC,UAAU,GAAG;QAClB,IAAI,CAACC,WAAW,GAAG;IACrB;IAEA,MAAMC,mBAAmB;QACvB,IAAI;YACF,MAAMC,WAAWR,KAAKS,IAAI,CAAC,IAAI,CAACJ,UAAU,EAAE;YAC5C,MAAMK,UAAU,MAAMX,GAAGY,QAAQ,CAACH,UAAU;YAC5C,MAAMI,UAAUC,KAAKC,KAAK,CAACJ;YAG3B,OAAOE,QAAQG,MAAM,GAAG,IAAIH,OAAO,CAACA,QAAQG,MAAM,GAAG,EAAE,GAAG;QAC5D,EAAE,OAAOC,OAAO;YACd,OAAO;QACT;IACF;IAEA,MAAMC,eAAe;QACnB,IAAI;YACF,MAAMC,YAAY;YAClB,MAAMR,UAAU,MAAMX,GAAGY,QAAQ,CAACO,WAAW;YAC7C,OAAOL,KAAKC,KAAK,CAACJ;QACpB,EAAE,OAAOM,OAAO;YACd,OAAO,EAAE;QACX;IACF;IAEA,MAAMG,iBAAiB;QACrB,IAAI;YACF,MAAMX,WAAWR,KAAKS,IAAI,CAAC,IAAI,CAACJ,UAAU,EAAE;YAC5C,MAAMK,UAAU,MAAMX,GAAGY,QAAQ,CAACH,UAAU;YAC5C,OAAOK,KAAKC,KAAK,CAACJ;QACpB,EAAE,OAAOM,OAAO;YACd,OAAO,EAAE;QACX;IACF;IAEA,MAAMI,wBAAwB;QAC5B,IAAI;YACF,MAAMZ,WAAWR,K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/REASONINGBANK-INTEGRATION-STATUS.md b/docs/REASONINGBANK-INTEGRATION-STATUS.md new file mode 100644 index 000000000..ee6674178 --- /dev/null +++ b/docs/REASONINGBANK-INTEGRATION-STATUS.md @@ -0,0 +1,179 @@ +# ReasoningBank Integration Status (v2.7.0-alpha) + +## Current Status: āš ļø Partially Implemented + +### āœ… What Works + +1. **Initialization**: `memory init --reasoningbank` + - Creates `.swarm/memory.db` database + - Initializes schema with migrations + - Fully functional + +2. **Status Check**: `memory status --reasoningbank` + - Shows database statistics + - Displays memory counts + - Fully functional + +3. **Mode Detection**: `memory detect` + - Detects available memory modes + - Shows configuration + - Fully functional + +### āŒ What Doesn't Work (v2.7.0) + +**Direct CLI Memory Operations:** +- `memory store key "value" --reasoningbank` āŒ +- `memory query "search" --reasoningbank` āŒ + +**Root Cause:** Agentic-flow's ReasoningBank doesn't expose `store/query` as CLI commands. It's designed to be used **by agents during task execution**, not as a standalone memory store. + +## How ReasoningBank Actually Works + +ReasoningBank is an **agent-centric memory system**: + +```bash +# āœ… CORRECT: Use via agent execution +npx agentic-flow --agent coder --task "Build REST API using best practices" + +# During execution, the agent: +# 1. Retrieves relevant memories from ReasoningBank +# 2. Uses them to inform its work +# 3. Stores new learnings back to ReasoningBank +# 4. Updates confidence scores based on success/failure +``` + +```bash +# āŒ INCORRECT: Direct CLI memory operations +npx claude-flow memory store pattern "..." --reasoningbank +# This doesn't work because ReasoningBank has no store/query CLI commands +``` + +## Working Solutions (v2.7.0) + +### Solution 1: Use Basic Memory Mode (Default) + +```bash +# Standard key-value memory (always works) +claude-flow memory store api_pattern "Use environment variables for config" +claude-flow memory query "API" +claude-flow memory stats +``` + +### Solution 2: Use ReasoningBank via Agents + +```bash +# Initialize ReasoningBank +claude-flow memory init --reasoningbank + +# Use agentic-flow agents (they'll use ReasoningBank automatically) +npx agentic-flow --agent coder --task "Implement user authentication" + +# The agent will: +# - Query ReasoningBank for relevant patterns +# - Learn from past successes/failures +# - Store new learnings automatically +``` + +### Solution 3: Use ReasoningBank Tools Directly + +```bash +# View available tools +npx agentic-flow reasoningbank --help + +# Available commands: +npx agentic-flow reasoningbank demo # Interactive demo +npx agentic-flow reasoningbank test # Validation tests +npx agentic-flow reasoningbank status # Statistics +npx agentic-flow reasoningbank benchmark # Performance tests +npx agentic-flow reasoningbank consolidate # Memory cleanup +npx agentic-flow reasoningbank list # List memories +``` + +## Planned for v2.7.1 + +**Full CLI Integration:** +- Implement direct `store/query` operations +- Bridge claude-flow memory commands to ReasoningBank SDK +- Add migration tool: `memory migrate --to reasoningbank` + +**Implementation Plan:** +1. Import agentic-flow's ReasoningBank SDK directly +2. Wrap SDK methods in claude-flow memory commands +3. Provide seamless experience for both modes + +## Current Workaround + +If you initialized ReasoningBank and want to use its learning capabilities: + +```bash +# 1. Initialize (one-time) +claude-flow memory init --reasoningbank + +# 2. Use basic memory for manual storage +claude-flow memory store api_best_practice "Always validate input" + +# 3. Use agentic-flow agents for AI-powered learning +npx agentic-flow --agent coder --task "Build secure API endpoints" + +# The agent will: +# - Access ReasoningBank automatically +# - Learn from your basic memory entries +# - Store new learnings with confidence scores +``` + +## + Architecture + +``` +ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” +│ claude-flow memory │ +ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤ +│ │ +│ Basic Mode (default) │ +│ ā”œā”€ store/query/stats āœ… │ +│ ā”œā”€ JSON file storage │ +│ └─ Fast, simple KV store │ +│ │ +│ ReasoningBank Mode │ +│ ā”œā”€ init āœ… │ +│ ā”œā”€ status āœ… │ +│ ā”œā”€ detect āœ… │ +│ ā”œā”€ store āŒ (v2.7.1) │ +│ └─ query āŒ (v2.7.1) │ +│ │ +ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ + │ + ā”œā”€ Used by ─┐ + │ │ + ā–¼ ā–¼ +ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” +│ Basic Memory │ │ agentic-flow │ +│ (JSON file) │ │ agents │ +ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │ + │ ā”œā”€ coder │ + │ ā”œā”€ researcher │ + │ ā”œā”€ reviewer │ + │ └─ etc. │ + │ │ + │ Uses ReasoningBank │ + │ automatically āœ… │ + ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ +``` + +## Summary + +**v2.7.0-alpha Status:** +- āœ… ReasoningBank initialization works +- āœ… Status and monitoring work +- āŒ Direct store/query CLI not implemented +- āœ… Agent-based usage fully functional + +**Recommended Approach:** +1. Use **basic mode** for manual memory operations +2. Use **agentic-flow agents** for AI-powered learning with ReasoningBank +3. Wait for **v2.7.1** for full CLI integration + +**Not a Bug:** +This is an **architectural limitation**, not a bug. ReasoningBank was designed for agent use, and v2.7.0 exposes that functionality correctly through agentic-flow agents. + +The v2.7.1 release will add convenience CLI wrappers for direct memory operations. diff --git a/memory/memory-store.json b/memory/memory-store.json index e627f7c67..2c4de90ab 100644 --- a/memory/memory-store.json +++ b/memory/memory-store.json @@ -37,6 +37,20 @@ "namespace": "default", "timestamp": 1760284936974, "redacted": false + }, + { + "key": "docker_test", + "value": "validation test", + "namespace": "default", + "timestamp": 1760288841215, + "redacted": false + }, + { + "key": "secure_key", + "value": "api=sk-ant-test", + "namespace": "default", + "timestamp": 1760288844695, + "redacted": false } ], "swarm": [ diff --git a/package-lock.json b/package-lock.json index 32ade186d..3e3c3f6f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "claude-flow", - "version": "2.6.0-alpha.2", + "version": "2.7.0-alpha.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "claude-flow", - "version": "2.6.0-alpha.2", + "version": "2.7.0-alpha.4", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 3922aad67..63418dba4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-flow", - "version": "2.6.0-alpha.2", + "version": "2.7.0-alpha.4", "description": "Enterprise-grade AI agent orchestration with multi-provider execution engine", "mcpName": "io.github.ruvnet/claude-flow", "main": "cli.mjs", diff --git a/src/cli/simple-commands/init/index.js b/src/cli/simple-commands/init/index.js index d3c4d80ec..06b878a7f 100644 --- a/src/cli/simple-commands/init/index.js +++ b/src/cli/simple-commands/init/index.js @@ -1568,6 +1568,57 @@ ${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\n')} // Initialize memory database with fallback support try { + // Check if database exists BEFORE creating it + const dbPath = '.swarm/memory.db'; + const { existsSync } = await import('fs'); + const dbExistedBefore = existsSync(dbPath); + + // Handle ReasoningBank migration BEFORE FallbackMemoryStore initialization + // This prevents schema conflicts with old databases + if (dbExistedBefore) { + console.log(' šŸ” Checking existing database for ReasoningBank schema...'); + + try { + const { + initializeReasoningBank, + checkReasoningBankTables, + migrateReasoningBank + } = await import('../../../reasoningbank/reasoningbank-adapter.js'); + + // Set the database path for ReasoningBank + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + + const tableCheck = await checkReasoningBankTables(); + + if (tableCheck.exists) { + console.log(' āœ… ReasoningBank schema already complete'); + } else if (force) { + // User used --force flag, migrate the database + console.log(` šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}`); + + const migrationResult = await migrateReasoningBank(); + + if (migrationResult.success) { + printSuccess(` āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`); + console.log(' Use --reasoningbank flag to enable AI-powered memory features'); + } else { + console.log(` āš ļø Migration failed: ${migrationResult.message}`); + console.log(' Basic memory will work, use: memory init --reasoningbank to retry'); + } + } else { + // Database exists with missing tables but no --force flag + console.log(` ā„¹ļø Database has ${tableCheck.missingTables.length} missing ReasoningBank tables`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}`); + console.log(' Use --force to migrate existing database'); + console.log(' Or use: memory init --reasoningbank'); + } + } catch (rbErr) { + console.log(` āš ļø ReasoningBank check failed: ${rbErr.message}`); + console.log(' Will attempt normal initialization...'); + } + } + // Import and initialize FallbackMemoryStore to create the database const { FallbackMemoryStore } = await import('../../../memory/fallback-store.js'); const memoryStore = new FallbackMemoryStore(); @@ -1580,6 +1631,25 @@ ${commands.map((cmd) => `- [${cmd}](./${cmd}.md)`).join('\n')} ); } else { printSuccess('āœ“ Initialized memory database (.swarm/memory.db)'); + + // Initialize ReasoningBank schema for fresh databases + if (!dbExistedBefore) { + try { + const { + initializeReasoningBank + } = await import('../../../reasoningbank/reasoningbank-adapter.js'); + + // Set the database path for ReasoningBank + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + + console.log(' 🧠 Initializing ReasoningBank schema...'); + await initializeReasoningBank(); + printSuccess(' āœ“ ReasoningBank schema initialized (use --reasoningbank flag for AI-powered memory)'); + } catch (rbErr) { + console.log(` āš ļø ReasoningBank initialization failed: ${rbErr.message}`); + console.log(' Basic memory will work, use: memory init --reasoningbank to retry'); + } + } } memoryStore.close(); diff --git a/src/cli/simple-commands/memory.js b/src/cli/simple-commands/memory.js index 7d45ff4b2..2da18ab1a 100644 --- a/src/cli/simple-commands/memory.js +++ b/src/cli/simple-commands/memory.js @@ -422,24 +422,61 @@ async function isReasoningBankInitialized() { async function handleReasoningBankCommand(command, subArgs, flags) { const initialized = await isReasoningBankInitialized(); + // Lazy load the adapter (ES modules) + const { initializeReasoningBank, storeMemory, queryMemories, listMemories, getStatus, checkReasoningBankTables, migrateReasoningBank } = await import('../../reasoningbank/reasoningbank-adapter.js'); + // Special handling for 'init' command if (command === 'init') { + const dbPath = '.swarm/memory.db'; + if (initialized) { - printWarning('āš ļø ReasoningBank already initialized'); - console.log('Database: .swarm/memory.db'); - console.log('\nTo reinitialize, delete .swarm/memory.db first'); + // Database exists - check if migration is needed + printInfo('šŸ” Checking existing database for ReasoningBank schema...\n'); + + try { + // Set the database path for ReasoningBank + process.env.CLAUDE_FLOW_DB_PATH = dbPath; + + const tableCheck = await checkReasoningBankTables(); + + if (tableCheck.exists) { + printSuccess('āœ… ReasoningBank already complete'); + console.log('Database: .swarm/memory.db'); + console.log('All ReasoningBank tables present\n'); + console.log('Use --reasoningbank flag with memory commands to enable AI features'); + return; + } + + // Missing tables found - run migration + console.log(`šŸ”„ Migrating database: ${tableCheck.missingTables.length} tables missing`); + console.log(` Missing: ${tableCheck.missingTables.join(', ')}\n`); + + const migrationResult = await migrateReasoningBank(); + + if (migrationResult.success) { + printSuccess(`āœ“ Migration complete: added ${migrationResult.addedTables?.length || 0} tables`); + console.log('\nNext steps:'); + console.log(' 1. Store memories: memory store key "value" --reasoningbank'); + console.log(' 2. Query memories: memory query "search" --reasoningbank'); + console.log(' 3. Check status: memory status --reasoningbank'); + } else { + printError(`āŒ Migration failed: ${migrationResult.message}`); + console.log('Try running: init --force to reinitialize'); + } + } catch (error) { + printError('āŒ Migration check failed'); + console.error(error.message); + console.log('\nTry running: init --force to reinitialize'); + } return; } + // Fresh initialization printInfo('🧠 Initializing ReasoningBank...'); console.log('This will create: .swarm/memory.db\n'); try { - const { stdout, stderr } = await execAsync('npx agentic-flow reasoningbank init', { - timeout: 30000, - }); - - if (stdout) console.log(stdout); + await initializeReasoningBank(); printSuccess('āœ… ReasoningBank initialized successfully!'); console.log('\nNext steps:'); console.log(' 1. Store memories: memory store key "value" --reasoningbank'); @@ -448,9 +485,6 @@ async function handleReasoningBankCommand(command, subArgs, flags) { } catch (error) { printError('āŒ Failed to initialize ReasoningBank'); console.error(error.message); - if (error.stderr) { - console.error('Details:', error.stderr); - } } return; } @@ -463,21 +497,156 @@ async function handleReasoningBankCommand(command, subArgs, flags) { return; } - // Delegate to agentic-flow reasoningbank commands printInfo(`🧠 Using ReasoningBank mode...`); try { - const cmd = buildReasoningBankCommand(command, subArgs, flags); - const { stdout, stderr } = await execAsync(cmd, { timeout: 30000 }); + // Handle different commands + switch (command) { + case 'store': + await handleReasoningBankStore(subArgs, flags, storeMemory); + break; - if (stdout) console.log(stdout); - if (stderr && !stderr.includes('Warning')) console.error(stderr); + case 'query': + await handleReasoningBankQuery(subArgs, flags, queryMemories); + break; + + case 'list': + await handleReasoningBankList(subArgs, flags, listMemories); + break; + + case 'status': + await handleReasoningBankStatus(getStatus); + break; + + case 'consolidate': + case 'demo': + case 'test': + case 'benchmark': + // These still use CLI commands + const cmd = `npx agentic-flow reasoningbank ${command}`; + const { stdout } = await execAsync(cmd, { timeout: 60000 }); + if (stdout) console.log(stdout); + break; + + default: + printError(`Unknown ReasoningBank command: ${command}`); + } } catch (error) { printError(`āŒ ReasoningBank command failed`); console.error(error.message); } } +// NEW: Handle ReasoningBank store +async function handleReasoningBankStore(subArgs, flags, storeMemory) { + const key = subArgs[1]; + const value = subArgs.slice(2).join(' '); + + if (!key || !value) { + printError('Usage: memory store --reasoningbank'); + return; + } + + try { + const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace') || 'default'; + + const memoryId = await storeMemory(key, value, { + namespace, + agent: 'memory-agent', + domain: namespace, + }); + + printSuccess('āœ… Stored successfully in ReasoningBank'); + console.log(`šŸ“ Key: ${key}`); + console.log(`🧠 Memory ID: ${memoryId}`); + console.log(`šŸ“¦ Namespace: ${namespace}`); + console.log(`šŸ’¾ Size: ${new TextEncoder().encode(value).length} bytes`); + console.log(`šŸ” Semantic search: enabled`); + } catch (error) { + printError(`Failed to store: ${error.message}`); + } +} + +// NEW: Handle ReasoningBank query +async function handleReasoningBankQuery(subArgs, flags, queryMemories) { + const search = subArgs.slice(1).join(' '); + + if (!search) { + printError('Usage: memory query --reasoningbank'); + return; + } + + try { + const namespace = flags?.namespace || flags?.ns || getArgValue(subArgs, '--namespace'); + const results = await queryMemories(search, { + domain: namespace || 'general', + limit: 10, + }); + + if (results.length === 0) { + printWarning('No results found'); + return; + } + + printSuccess(`Found ${results.length} results (semantic search):`); + + for (const entry of results) { + console.log(`\nšŸ“Œ ${entry.key}`); + console.log(` Namespace: ${entry.namespace}`); + console.log(` Value: ${entry.value.substring(0, 100)}${entry.value.length > 100 ? '...' : ''}`); + console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}%`); + console.log(` Usage: ${entry.usage_count} times`); + if (entry.score) { + console.log(` Match Score: ${(entry.score * 100).toFixed(1)}%`); + } + console.log(` Stored: ${new Date(entry.created_at).toLocaleString()}`); + } + } catch (error) { + printError(`Failed to query: ${error.message}`); + } +} + +// NEW: Handle ReasoningBank list +async function handleReasoningBankList(subArgs, flags, listMemories) { + try { + const sort = flags?.sort || getArgValue(subArgs, '--sort') || 'created_at'; + const limit = parseInt(flags?.limit || getArgValue(subArgs, '--limit') || '10'); + + const results = await listMemories({ sort, limit }); + + if (results.length === 0) { + printWarning('No memories found'); + return; + } + + printSuccess(`ReasoningBank memories (${results.length} shown):`); + + for (const entry of results) { + console.log(`\nšŸ“Œ ${entry.key}`); + console.log(` Value: ${entry.value.substring(0, 80)}${entry.value.length > 80 ? '...' : ''}`); + console.log(` Confidence: ${(entry.confidence * 100).toFixed(1)}% | Usage: ${entry.usage_count}`); + } + } catch (error) { + printError(`Failed to list: ${error.message}`); + } +} + +// NEW: Handle ReasoningBank status +async function handleReasoningBankStatus(getStatus) { + try { + const stats = await getStatus(); + + printSuccess('šŸ“Š ReasoningBank Status:'); + console.log(` Total memories: ${stats.total_memories}`); + console.log(` Average confidence: ${(stats.avg_confidence * 100).toFixed(1)}%`); + console.log(` Total usage: ${stats.total_usage}`); + console.log(` Embeddings: ${stats.total_embeddings}`); + console.log(` Trajectories: ${stats.total_trajectories}`); + } catch (error) { + printError(`Failed to get status: ${error.message}`); + } +} + // NEW: Build agentic-flow reasoningbank command function buildReasoningBankCommand(command, subArgs, flags) { const parts = ['npx', 'agentic-flow', 'reasoningbank']; @@ -504,6 +673,9 @@ function buildReasoningBankCommand(command, subArgs, flags) { } }); + // Add required --agent parameter + parts.push('--agent', 'memory-agent'); + return parts.join(' '); } diff --git a/src/reasoningbank/reasoningbank-adapter.js b/src/reasoningbank/reasoningbank-adapter.js new file mode 100644 index 000000000..6764a3810 --- /dev/null +++ b/src/reasoningbank/reasoningbank-adapter.js @@ -0,0 +1,447 @@ +/** + * ReasoningBank Adapter for Claude-Flow + * + * Wraps agentic-flow's ReasoningBank SDK for use in claude-flow memory commands + * Performance-optimized with caching, timeouts, and async embeddings + */ + +import { db, initialize, retrieveMemories, computeEmbedding, loadConfig } from 'agentic-flow/dist/reasoningbank/index.js'; +import { v4 as uuidv4 } from 'uuid'; + +// Query result cache (LRU) +const queryCache = new Map(); +const CACHE_SIZE = 100; +const CACHE_TTL = 60000; // 60 seconds + +// Async embedding processing queue +const embeddingQueue = []; +let processingQueue = false; + +/** + * Initialize ReasoningBank database with performance optimizations + */ +export async function initializeReasoningBank() { + // Set database path + process.env.CLAUDE_FLOW_DB_PATH = '.swarm/memory.db'; + + await initialize(); + await optimizeDatabase(); + return true; +} + +/** + * Add database indexes for query performance + */ +async function optimizeDatabase() { + try { + const dbInstance = db.getDb(); + + // Add indexes for common queries + dbInstance.exec(` + -- Index on confidence for sorting + CREATE INDEX IF NOT EXISTS idx_patterns_confidence + ON patterns(confidence DESC); + + -- Index on usage_count for sorting + CREATE INDEX IF NOT EXISTS idx_patterns_usage + ON patterns(usage_count DESC); + + -- Index on created_at for time-based queries + CREATE INDEX IF NOT EXISTS idx_patterns_created + ON patterns(created_at DESC); + + -- Index on memory_id for embeddings lookup + CREATE INDEX IF NOT EXISTS idx_embeddings_memory + ON pattern_embeddings(memory_id); + `); + } catch (error) { + console.warn('[ReasoningBank] Failed to create indexes:', error.message); + } +} + +/** + * Store a memory in ReasoningBank (optimized with async embeddings) + */ +export async function storeMemory(key, value, options = {}) { + const memoryId = `mem_${uuidv4()}`; + + const memory = { + id: memoryId, + type: options.type || 'fact', + pattern_data: JSON.stringify({ + key, + value, + namespace: options.namespace || 'default', + agent: options.agent || 'memory-agent', + domain: options.domain || 'general', + }), + confidence: options.confidence || 0.8, + usage_count: 0, + created_at: new Date().toISOString(), + }; + + // Store memory immediately (fast, no blocking) + db.upsertMemory(memory); + + // Invalidate query cache when new memory is added + queryCache.clear(); + + // Queue embedding computation for background processing (unless disabled) + if (options.async !== false) { + embeddingQueue.push({ memoryId, key, value }); + processEmbeddingQueue(); // Non-blocking + } else { + // Synchronous mode for critical operations + await computeAndStoreEmbedding(memoryId, key, value); + } + + return memoryId; +} + +/** + * Process embedding queue in background + */ +async function processEmbeddingQueue() { + if (processingQueue || embeddingQueue.length === 0) return; + + processingQueue = true; + + while (embeddingQueue.length > 0) { + const batch = embeddingQueue.splice(0, 5); // Process 5 at a time + + await Promise.allSettled( + batch.map(({ memoryId, key, value }) => + computeAndStoreEmbedding(memoryId, key, value) + ) + ); + } + + processingQueue = false; +} + +/** + * Compute and store embedding for a memory + */ +async function computeAndStoreEmbedding(memoryId, key, value) { + try { + const config = loadConfig(); + const embeddingModel = config.embeddings.provider || 'claude'; + + const embedding = await computeEmbedding(`${key}: ${value}`); + const vectorArray = new Float32Array(embedding); + + db.upsertEmbedding({ + memory_id: memoryId, + vector: vectorArray, + model: embeddingModel, + dims: vectorArray.length, + created_at: new Date().toISOString(), + }); + } catch (error) { + console.warn(`[ReasoningBank] Failed to compute embedding for ${memoryId}:`, error.message); + } +} + +/** + * Query memories from ReasoningBank (optimized with caching and timeout) + */ +export async function queryMemories(searchQuery, options = {}) { + // Check cache first + const cached = getCachedQuery(searchQuery, options); + if (cached) { + return cached; + } + + const timeout = options.timeout || 3000; // 3s default timeout + + try { + // Race between semantic search and timeout + const memories = await Promise.race([ + retrieveMemories(searchQuery, { + domain: options.domain || 'general', + agent: options.agent || 'memory-agent', + k: options.limit || 10, + }), + new Promise((_, reject) => + setTimeout(() => reject(new Error('Query timeout')), timeout) + ) + ]); + + const results = memories.map(mem => { + try { + const data = JSON.parse(mem.pattern_data); + return { + id: mem.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: mem.confidence, + usage_count: mem.usage_count, + created_at: mem.created_at, + score: mem.score || 0, + }; + } catch { + return null; + } + }).filter(Boolean); + + // If semantic search returns no results, try SQL fallback + // (handles case where embeddings don't exist yet) + if (results.length === 0) { + console.warn('[ReasoningBank] Semantic search returned 0 results, trying SQL fallback'); + const fallbackResults = await queryMemoriesFast(searchQuery, options); + setCachedQuery(searchQuery, options, fallbackResults); + return fallbackResults; + } + + // Cache successful results + setCachedQuery(searchQuery, options, results); + return results; + } catch (error) { + // Fast SQL fallback on timeout or error + console.warn('[ReasoningBank] Using fast SQL fallback:', error.message); + const results = await queryMemoriesFast(searchQuery, options); + + // Cache fallback results too + setCachedQuery(searchQuery, options, results); + return results; + } +} + +/** + * Fast SQL-based query fallback (optimized) + */ +async function queryMemoriesFast(searchQuery, options = {}) { + const dbInstance = db.getDb(); + const limit = options.limit || 10; + const namespace = options.namespace; + + // Use optimized query with indexes + let query = ` + SELECT + id, + pattern_data, + confidence, + usage_count, + created_at + FROM patterns + WHERE 1=1 + `; + + const params = []; + + // Add namespace filter if provided + if (namespace) { + query += ` AND pattern_data LIKE ?`; + params.push(`%"namespace":"${namespace}"%`); + } + + // Add search filter - check both key and value + query += ` AND ( + pattern_data LIKE ? OR + pattern_data LIKE ? + )`; + params.push(`%"key":"%${searchQuery}%"%`, `%"value":"%${searchQuery}%"%`); + + // Use indexed sort + query += ` ORDER BY confidence DESC, usage_count DESC LIMIT ?`; + params.push(limit); + + const rows = dbInstance.prepare(query).all(...params); + + return rows.map(row => { + try { + const data = JSON.parse(row.pattern_data); + return { + id: row.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: row.confidence, + usage_count: row.usage_count, + created_at: row.created_at, + }; + } catch { + return null; + } + }).filter(Boolean); +} + +/** + * Get cached query results + */ +function getCachedQuery(searchQuery, options) { + const cacheKey = JSON.stringify({ searchQuery, options }); + const cached = queryCache.get(cacheKey); + + if (cached && Date.now() - cached.timestamp < CACHE_TTL) { + return cached.results; + } + + return null; +} + +/** + * Set cached query results (LRU eviction) + */ +function setCachedQuery(searchQuery, options, results) { + const cacheKey = JSON.stringify({ searchQuery, options }); + + // LRU eviction + if (queryCache.size >= CACHE_SIZE) { + const firstKey = queryCache.keys().next().value; + queryCache.delete(firstKey); + } + + queryCache.set(cacheKey, { + results, + timestamp: Date.now() + }); +} + +/** + * List all memories + */ +export async function listMemories(options = {}) { + const dbInstance = db.getDb(); + + const limit = options.limit || 10; + const sortBy = options.sort || 'created_at'; + const sortOrder = options.order || 'DESC'; + + const rows = dbInstance.prepare(` + SELECT * FROM patterns + ORDER BY ${sortBy} ${sortOrder} + LIMIT ? + `).all(limit); + + return rows.map(row => { + try { + const data = JSON.parse(row.pattern_data); + return { + id: row.id, + key: data.key, + value: data.value, + namespace: data.namespace, + confidence: row.confidence, + usage_count: row.usage_count, + created_at: row.created_at, + }; + } catch { + return null; + } + }).filter(Boolean); +} + +/** + * Get ReasoningBank statistics + */ +export async function getStatus() { + const dbInstance = db.getDb(); + + const stats = dbInstance.prepare(` + SELECT + COUNT(*) as total_memories, + AVG(confidence) as avg_confidence, + SUM(usage_count) as total_usage + FROM patterns + `).get(); + + const embeddingCount = dbInstance.prepare(` + SELECT COUNT(*) as count FROM pattern_embeddings + `).get(); + + const trajectoryCount = dbInstance.prepare(` + SELECT COUNT(*) as count FROM task_trajectories + `).get(); + + return { + total_memories: stats.total_memories || 0, + avg_confidence: stats.avg_confidence || 0, + total_usage: stats.total_usage || 0, + total_embeddings: embeddingCount.count || 0, + total_trajectories: trajectoryCount.count || 0, + }; +} + +/** + * Check which ReasoningBank tables are present in the database + * Returns object with table names and their existence status + */ +export async function checkReasoningBankTables() { + try { + const dbInstance = db.getDb(); + + // Required ReasoningBank tables + const requiredTables = [ + 'patterns', + 'pattern_embeddings', + 'pattern_links', + 'task_trajectories', + 'matts_runs', + 'consolidation_runs', + 'metrics_log' + ]; + + // Query existing tables + const existingTables = dbInstance.prepare(` + SELECT name FROM sqlite_master + WHERE type='table' + `).all().map(row => row.name); + + // Check which required tables are missing + const missingTables = requiredTables.filter(table => !existingTables.includes(table)); + + return { + exists: missingTables.length === 0, + existingTables, + missingTables, + requiredTables + }; + } catch (error) { + return { + exists: false, + existingTables: [], + missingTables: [], + requiredTables: [], + error: error.message + }; + } +} + +/** + * Migrate existing database to add missing ReasoningBank tables + */ +export async function migrateReasoningBank() { + try { + // Check current state + const tableCheck = await checkReasoningBankTables(); + + if (tableCheck.exists) { + return { + success: true, + message: 'All ReasoningBank tables already exist', + migrated: false + }; + } + + // Run full initialization which will create missing tables + await initializeReasoningBank(); + + // Verify migration + const afterCheck = await checkReasoningBankTables(); + + return { + success: afterCheck.exists, + message: `Migration completed: ${tableCheck.missingTables.length} tables added`, + migrated: true, + addedTables: tableCheck.missingTables + }; + } catch (error) { + return { + success: false, + message: `Migration failed: ${error.message}`, + error: error.message + }; + } +}