monomind 1.11.14 โ 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/generated/channel-intelligence-director.md +87 -0
- package/.claude/agents/generated/chief-growth-officer.md +88 -0
- package/.claude/agents/generated/content-seo-strategist.md +90 -0
- package/.claude/agents/generated/developer-community-strategist.md +91 -0
- package/.claude/agents/generated/outreach-partnership-strategist.md +90 -0
- package/.claude/agents/generated/social-media-strategist.md +91 -0
- package/.claude/agents/generated/video-visual-strategist.md +90 -0
- package/.claude/commands/mastermind/master.md +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +13 -4
- package/.claude/helpers/control-start.cjs +5 -0
- package/.claude/helpers/event-logger.cjs +114 -0
- package/.claude/helpers/handlers/adr-draft-handler.cjs +19 -5
- package/.claude/helpers/handlers/agent-start-handler.cjs +13 -4
- package/.claude/helpers/handlers/compact-handler.cjs +2 -0
- package/.claude/helpers/handlers/edit-handler.cjs +1 -1
- package/.claude/helpers/handlers/gates-handler.cjs +3 -0
- package/.claude/helpers/handlers/graph-status-handler.cjs +14 -8
- package/.claude/helpers/handlers/loops-status-handler.cjs +5 -2
- package/.claude/helpers/handlers/route-handler.cjs +24 -10
- package/.claude/helpers/handlers/session-handler.cjs +11 -4
- package/.claude/helpers/handlers/session-restore-handler.cjs +35 -19
- package/.claude/helpers/handlers/task-handler.cjs +13 -5
- package/.claude/helpers/hook-handler.cjs +40 -0
- package/.claude/helpers/intelligence.cjs +130 -53
- package/.claude/helpers/loop-tracker.cjs +15 -3
- package/.claude/helpers/memory-palace.cjs +461 -0
- package/.claude/helpers/memory.cjs +138 -14
- package/.claude/helpers/metrics-db.mjs +87 -0
- package/.claude/helpers/router.cjs +300 -42
- package/.claude/helpers/session.cjs +89 -30
- package/.claude/helpers/statusline.cjs +148 -4
- package/.claude/helpers/toggle-statusline.cjs +73 -0
- package/.claude/helpers/token-tracker.cjs +934 -0
- package/.claude/helpers/utils/micro-agents.cjs +20 -4
- package/.claude/helpers/utils/monograph.cjs +39 -4
- package/.claude/helpers/utils/telemetry.cjs +3 -3
- package/.claude/scheduled_tasks.lock +1 -1
- package/.claude/settings.json +92 -1
- package/.claude/skills/mastermind/_protocol.md +25 -15
- package/.claude/skills/mastermind/architect.md +3 -3
- package/.claude/skills/mastermind/autodev.md +4 -2
- package/.claude/skills/mastermind/idea.md +10 -0
- package/.claude/skills/mastermind/ops.md +3 -3
- package/.claude/skills/mastermind/runorg.md +153 -86
- package/package.json +20 -3
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +2 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.js +10 -5
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +13 -0
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +20 -9
- package/packages/@monomind/cli/dist/src/browser/actions.js +10 -3
- package/packages/@monomind/cli/dist/src/browser/browser.js +12 -2
- package/packages/@monomind/cli/dist/src/browser/cdp.js +21 -3
- package/packages/@monomind/cli/dist/src/browser/har.js +27 -5
- package/packages/@monomind/cli/dist/src/commands/agent.js +11 -8
- package/packages/@monomind/cli/dist/src/commands/analyze.js +36 -21
- package/packages/@monomind/cli/dist/src/commands/autopilot.js +12 -4
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +51 -8
- package/packages/@monomind/cli/dist/src/commands/browse.js +5 -2
- package/packages/@monomind/cli/dist/src/commands/claims.js +29 -11
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +25 -5
- package/packages/@monomind/cli/dist/src/commands/config.js +15 -7
- package/packages/@monomind/cli/dist/src/commands/daemon.js +6 -0
- package/packages/@monomind/cli/dist/src/commands/deployment.js +34 -19
- package/packages/@monomind/cli/dist/src/commands/doctor.js +192 -23
- package/packages/@monomind/cli/dist/src/commands/guidance.js +15 -2
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +37 -14
- package/packages/@monomind/cli/dist/src/commands/hooks.js +42 -25
- package/packages/@monomind/cli/dist/src/commands/init.js +9 -4
- package/packages/@monomind/cli/dist/src/commands/issues.js +29 -26
- package/packages/@monomind/cli/dist/src/commands/mcp.js +11 -5
- package/packages/@monomind/cli/dist/src/commands/memory.js +10 -0
- package/packages/@monomind/cli/dist/src/commands/migrate.js +5 -5
- package/packages/@monomind/cli/dist/src/commands/monograph.js +18 -5
- package/packages/@monomind/cli/dist/src/commands/monovector/backup.js +8 -2
- package/packages/@monomind/cli/dist/src/commands/monovector/benchmark.js +20 -7
- package/packages/@monomind/cli/dist/src/commands/monovector/import.js +15 -0
- package/packages/@monomind/cli/dist/src/commands/monovector/migrate.js +4 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/optimize.js +11 -0
- package/packages/@monomind/cli/dist/src/commands/monovector/setup.js +11 -1
- package/packages/@monomind/cli/dist/src/commands/neural.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/performance.js +20 -7
- package/packages/@monomind/cli/dist/src/commands/platforms.js +90 -8
- package/packages/@monomind/cli/dist/src/commands/plugins.js +12 -5
- package/packages/@monomind/cli/dist/src/commands/process.js +33 -10
- package/packages/@monomind/cli/dist/src/commands/progress.js +5 -3
- package/packages/@monomind/cli/dist/src/commands/providers.js +5 -5
- package/packages/@monomind/cli/dist/src/commands/replay.js +8 -2
- package/packages/@monomind/cli/dist/src/commands/route.js +27 -7
- package/packages/@monomind/cli/dist/src/commands/security.js +4 -0
- package/packages/@monomind/cli/dist/src/commands/session.js +12 -1
- package/packages/@monomind/cli/dist/src/commands/start.js +11 -4
- package/packages/@monomind/cli/dist/src/commands/status.js +7 -4
- package/packages/@monomind/cli/dist/src/commands/swarm.js +27 -13
- package/packages/@monomind/cli/dist/src/commands/task.js +26 -11
- package/packages/@monomind/cli/dist/src/commands/tokens.js +7 -2
- package/packages/@monomind/cli/dist/src/commands/transfer-store.js +36 -22
- package/packages/@monomind/cli/dist/src/commands/update.js +15 -3
- package/packages/@monomind/cli/dist/src/commands/workflow.js +39 -6
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +18 -7
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.js +25 -8
- package/packages/@monomind/cli/dist/src/index.js +7 -3
- package/packages/@monomind/cli/dist/src/init/executor.js +14 -11
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +20 -4
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +36 -15
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +98 -13
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +16 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +80 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +84 -22
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +35 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +82 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.js +37 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +49 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +45 -18
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +75 -25
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +32 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +91 -20
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +188 -29
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +25 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +11 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +476 -62
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +44 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +45 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +7 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +15 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +61 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +45 -14
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +15 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +14 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +52 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +40 -6
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +37 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.js +29 -6
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +26 -10
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +80 -19
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +21 -2
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +67 -3
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +14 -4
- package/packages/@monomind/cli/dist/src/monovector/command-outcomes.js +43 -7
- package/packages/@monomind/cli/dist/src/monovector/coverage-router.js +8 -4
- package/packages/@monomind/cli/dist/src/monovector/coverage-tools.js +6 -3
- package/packages/@monomind/cli/dist/src/monovector/diff-classifier.js +13 -0
- package/packages/@monomind/cli/dist/src/monovector/route-outcomes.d.ts +2 -1
- package/packages/@monomind/cli/dist/src/monovector/route-outcomes.js +46 -4
- package/packages/@monomind/cli/dist/src/plugins/manager.js +8 -3
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +46 -2
- package/packages/@monomind/cli/dist/src/plugins/store/search.js +5 -4
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +17 -3
- package/packages/@monomind/cli/dist/src/production/error-handler.js +3 -0
- package/packages/@monomind/cli/dist/src/production/monitoring.js +20 -3
- package/packages/@monomind/cli/dist/src/production/rate-limiter.js +13 -4
- package/packages/@monomind/cli/dist/src/production/retry.js +17 -9
- package/packages/@monomind/cli/dist/src/routing/embed-worker.js +6 -2
- package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +13 -2
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +18 -3
- package/packages/@monomind/cli/dist/src/services/claim-service.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/services/claim-service.js +8 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +14 -2
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.js +18 -2
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +348 -17
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +16 -1
- package/packages/@monomind/cli/dist/src/transfer/export.js +8 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.js +33 -3
- package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.js +8 -2
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +37 -3
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.js +45 -3
- package/packages/@monomind/cli/dist/src/transfer/store/download.js +5 -0
- package/packages/@monomind/cli/dist/src/transfer/store/publish.js +13 -1
- package/packages/@monomind/cli/dist/src/transfer/store/registry.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/transfer/store/registry.js +30 -5
- package/packages/@monomind/cli/dist/src/transfer/store/search.js +20 -5
- package/packages/@monomind/cli/dist/src/update/checker.js +59 -7
- package/packages/@monomind/cli/dist/src/update/executor.js +50 -3
- package/packages/@monomind/cli/dist/src/update/index.js +18 -1
- package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +79 -7
- package/packages/@monomind/cli/dist/src/update/validator.js +52 -1
- package/packages/@monomind/cli/package.json +2 -3
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
17
17
|
const fs = require('fs');
|
|
18
18
|
const path = require('path');
|
|
19
|
-
const { execSync } = require('child_process');
|
|
19
|
+
const { execSync, spawnSync } = require('child_process');
|
|
20
20
|
const os = require('os');
|
|
21
21
|
|
|
22
22
|
// Configuration
|
|
@@ -204,6 +204,8 @@ function getModelFromSessionJSONL() {
|
|
|
204
204
|
if (files.length === 0) return null;
|
|
205
205
|
|
|
206
206
|
const sessionFile = path.join(projectsDir, files[0].f);
|
|
207
|
+
// Guard against OOM: skip session files larger than 10 MB
|
|
208
|
+
try { if (fs.statSync(sessionFile).size > 10 * 1024 * 1024) return null; } catch { return null; }
|
|
207
209
|
const raw = fs.readFileSync(sessionFile, 'utf-8');
|
|
208
210
|
const lines = raw.split('\n').filter(Boolean);
|
|
209
211
|
|
|
@@ -905,6 +907,60 @@ function getHILPending() {
|
|
|
905
907
|
return { pending };
|
|
906
908
|
}
|
|
907
909
|
|
|
910
|
+
// Active org runs โ scan .monomind/orgs/*/runs/*.jsonl for recent activity
|
|
911
|
+
// Also checks .git/monomind/orgs/ (git-safe path used by mastermind orgs).
|
|
912
|
+
// An org is "active" if it has an events file modified within the last 10 minutes.
|
|
913
|
+
function getActiveOrgs() {
|
|
914
|
+
// Try git-common-dir path first (mastermind orgs store run files there)
|
|
915
|
+
let orgsDir = path.join(CWD, '.monomind', 'orgs');
|
|
916
|
+
try {
|
|
917
|
+
const gitCommon = safeExec('git rev-parse --git-common-dir 2>/dev/null', 1000);
|
|
918
|
+
if (gitCommon) {
|
|
919
|
+
const candidate = path.isAbsolute(gitCommon)
|
|
920
|
+
? path.join(gitCommon, 'monomind', 'orgs')
|
|
921
|
+
: path.join(CWD, gitCommon, 'monomind', 'orgs');
|
|
922
|
+
if (fs.existsSync(candidate)) orgsDir = candidate;
|
|
923
|
+
}
|
|
924
|
+
} catch { /* use default */ }
|
|
925
|
+
if (!fs.existsSync(orgsDir)) return { count: 0, orgs: [] };
|
|
926
|
+
const STALE_MS = 10 * 60 * 1000; // 10 min
|
|
927
|
+
const now = Date.now();
|
|
928
|
+
const active = [];
|
|
929
|
+
try {
|
|
930
|
+
const orgNames = fs.readdirSync(orgsDir).filter(f => !f.startsWith('.'));
|
|
931
|
+
for (const orgName of orgNames.slice(0, 20)) {
|
|
932
|
+
const runsDir = path.join(orgsDir, orgName, 'runs');
|
|
933
|
+
if (!fs.existsSync(runsDir)) continue;
|
|
934
|
+
try {
|
|
935
|
+
const files = fs.readdirSync(runsDir).filter(f => f.endsWith('.jsonl'));
|
|
936
|
+
if (!files.length) continue;
|
|
937
|
+
files.sort();
|
|
938
|
+
const latest = files[files.length - 1];
|
|
939
|
+
const stat = safeStat(path.join(runsDir, latest));
|
|
940
|
+
if (!stat) continue;
|
|
941
|
+
const age = now - stat.mtimeMs;
|
|
942
|
+
if (age < STALE_MS) {
|
|
943
|
+
// Check last event type to determine if still running
|
|
944
|
+
let isRunning = true;
|
|
945
|
+
try {
|
|
946
|
+
const MAX_RUN = 512 * 1024; // 512 KiB
|
|
947
|
+
if (stat.size <= MAX_RUN) {
|
|
948
|
+
const raw = fs.readFileSync(path.join(runsDir, latest), 'utf-8');
|
|
949
|
+
const lines = raw.trim().split('\n').filter(Boolean);
|
|
950
|
+
if (lines.length) {
|
|
951
|
+
const lastEv = JSON.parse(lines[lines.length - 1]);
|
|
952
|
+
if (lastEv.type === 'run:complete' || lastEv.type === 'org:complete') isRunning = false;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
} catch { /* treat as running */ }
|
|
956
|
+
active.push({ name: orgName, runId: latest.replace('.jsonl', ''), ageMs: age, running: isRunning });
|
|
957
|
+
}
|
|
958
|
+
} catch { /* skip */ }
|
|
959
|
+
}
|
|
960
|
+
} catch { /* ignore */ }
|
|
961
|
+
return { count: active.length, orgs: active };
|
|
962
|
+
}
|
|
963
|
+
|
|
908
964
|
// Monograph knowledge graph stats
|
|
909
965
|
// Sources, in priority order:
|
|
910
966
|
// 1. .monomind/graph/stats.json โ explicit cached stats
|
|
@@ -922,7 +978,13 @@ function getGraphifyStats() {
|
|
|
922
978
|
|
|
923
979
|
try {
|
|
924
980
|
if (fs.existsSync(dbPath)) {
|
|
925
|
-
|
|
981
|
+
// Use spawnSync array args to prevent shell injection via dbPath (CWD-derived)
|
|
982
|
+
const result = spawnSync(
|
|
983
|
+
'sqlite3',
|
|
984
|
+
[dbPath, 'SELECT (SELECT COUNT(*) FROM nodes), (SELECT COUNT(*) FROM edges);'],
|
|
985
|
+
{ encoding: 'utf-8', timeout: 1000 }
|
|
986
|
+
);
|
|
987
|
+
const out = (result.stdout || '').trim();
|
|
926
988
|
if (out) {
|
|
927
989
|
const [n, e] = out.split('|').map(v => parseInt(v, 10) || 0);
|
|
928
990
|
if (n > 0) return { nodes: n, edges: e, exists: true };
|
|
@@ -952,6 +1014,36 @@ function getSIBudget() {
|
|
|
952
1014
|
} catch { return null; }
|
|
953
1015
|
}
|
|
954
1016
|
|
|
1017
|
+
// Token cost summary โ reads cached .monomind/metrics/token-summary.json (no JSONL scanning).
|
|
1018
|
+
// Returns null if file absent, stale (cachedAt is not today in UTC), or cost is zero.
|
|
1019
|
+
// All costs are aggregated across ALL Claude Code projects, not just this repo.
|
|
1020
|
+
function getTokenCostSummary() {
|
|
1021
|
+
const summaryPath = path.join(CWD, '.monomind', 'metrics', 'token-summary.json');
|
|
1022
|
+
const d = readJSON(summaryPath);
|
|
1023
|
+
if (!d) return null;
|
|
1024
|
+
|
|
1025
|
+
// Staleness guard: only show "today" figures when cachedAt is today (UTC)
|
|
1026
|
+
const todayUtc = new Date().toISOString().slice(0, 10); // "YYYY-MM-DD"
|
|
1027
|
+
const cachedDate = (d.cachedAt || '').slice(0, 10);
|
|
1028
|
+
const isFresh = cachedDate === todayUtc;
|
|
1029
|
+
|
|
1030
|
+
const todayCost = isFresh ? (d.todayCost || 0) : 0;
|
|
1031
|
+
const monthCost = d.monthCost || 0;
|
|
1032
|
+
const todayCalls = isFresh ? (d.todayCalls || 0) : 0;
|
|
1033
|
+
|
|
1034
|
+
if (monthCost === 0 && todayCost === 0) return null;
|
|
1035
|
+
|
|
1036
|
+
return { todayCost, monthCost, todayCalls, isFresh };
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// Format a dollar amount compactly: $0.0023, $1.23, $228.87
|
|
1040
|
+
function fmtCost(n) {
|
|
1041
|
+
if (n >= 100) return '$' + n.toFixed(0);
|
|
1042
|
+
if (n >= 1) return '$' + n.toFixed(2);
|
|
1043
|
+
if (n >= 0.01) return '$' + n.toFixed(3);
|
|
1044
|
+
return '$' + n.toFixed(4);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
955
1047
|
// โโ Single-line statusline (compact) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
956
1048
|
function generateStatusline() {
|
|
957
1049
|
const git = getGitInfo();
|
|
@@ -987,9 +1079,24 @@ function generateStatusline() {
|
|
|
987
1079
|
parts.push(`${col}${icon} ${x.bold}${activeAgent.name}${x.reset}`);
|
|
988
1080
|
}
|
|
989
1081
|
|
|
990
|
-
//
|
|
1082
|
+
// Active org runs โ high signal for users tracking autonomous orgs
|
|
1083
|
+
const orgStatus = getActiveOrgs();
|
|
1084
|
+
if (orgStatus.count > 0) {
|
|
1085
|
+
const runningOrgs = orgStatus.orgs.filter(o => o.running);
|
|
1086
|
+
const doneOrgs = orgStatus.orgs.filter(o => !o.running);
|
|
1087
|
+
if (runningOrgs.length > 0) {
|
|
1088
|
+
const names = runningOrgs.slice(0, 2).map(o => o.name).join(', ');
|
|
1089
|
+
parts.push(`${x.green}๐ ${x.bold}${names}${x.reset}${runningOrgs.length > 2 ? ` +${runningOrgs.length - 2}` : ''}`);
|
|
1090
|
+
} else if (doneOrgs.length > 0) {
|
|
1091
|
+
parts.push(`${x.slate}๐ ${doneOrgs[0].name} done${x.reset}`);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// Intelligence โ only show when non-trivial (>15%) to avoid misleading 0%/noise
|
|
991
1096
|
const ic = pctColor(system.intelligencePct);
|
|
992
|
-
|
|
1097
|
+
if (system.intelligencePct > 15) {
|
|
1098
|
+
parts.push(`${ic}๐ก ${system.intelligencePct}%${x.reset}`);
|
|
1099
|
+
}
|
|
993
1100
|
|
|
994
1101
|
// Knowledge chunks (Task 28) โ show when populated
|
|
995
1102
|
if (knowledge.chunks > 0) {
|
|
@@ -1011,6 +1118,17 @@ function generateStatusline() {
|
|
|
1011
1118
|
parts.push(`${x.mint}โก ${hooks.enabled}h${x.reset}`);
|
|
1012
1119
|
}
|
|
1013
1120
|
|
|
1121
|
+
// Token cost โ today's spend across all projects (from cached summary)
|
|
1122
|
+
const tokenCost = getTokenCostSummary();
|
|
1123
|
+
if (tokenCost) {
|
|
1124
|
+
if (tokenCost.isFresh && tokenCost.todayCost > 0) {
|
|
1125
|
+
const col = tokenCost.todayCost > 50 ? x.coral : tokenCost.todayCost > 10 ? x.gold : x.mint;
|
|
1126
|
+
parts.push(`${col}${fmtCost(tokenCost.todayCost)} today${x.reset}`);
|
|
1127
|
+
} else if (tokenCost.monthCost > 0) {
|
|
1128
|
+
parts.push(`${x.slate}${fmtCost(tokenCost.monthCost)} mo${x.reset}`);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1014
1132
|
return parts.join(` ${DIV} `);
|
|
1015
1133
|
}
|
|
1016
1134
|
|
|
@@ -1053,6 +1171,17 @@ function generateDashboard() {
|
|
|
1053
1171
|
hdr += ` ${DIV} ๐ค ${x.violet}${x.bold}${modelName}${x.reset}`;
|
|
1054
1172
|
if (session.duration) hdr += ` ${x.dim}โฑ ${session.duration}${x.reset}`;
|
|
1055
1173
|
|
|
1174
|
+
// Token cost in dashboard header โ today's spend (all projects)
|
|
1175
|
+
const tokenCost = getTokenCostSummary();
|
|
1176
|
+
if (tokenCost) {
|
|
1177
|
+
if (tokenCost.isFresh && tokenCost.todayCost > 0) {
|
|
1178
|
+
const col = tokenCost.todayCost > 50 ? x.coral : tokenCost.todayCost > 10 ? x.gold : x.mint;
|
|
1179
|
+
hdr += ` ${DIV} ${col}${fmtCost(tokenCost.todayCost)} today${x.reset}${x.dim} ยท ${fmtCost(tokenCost.monthCost)} mo${x.reset}`;
|
|
1180
|
+
} else if (tokenCost.monthCost > 0) {
|
|
1181
|
+
hdr += ` ${DIV} ${x.slate}${fmtCost(tokenCost.monthCost)} mo${x.reset}`;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1056
1185
|
lines.push(hdr);
|
|
1057
1186
|
lines.push(SEP);
|
|
1058
1187
|
|
|
@@ -1131,6 +1260,20 @@ function generateDashboard() {
|
|
|
1131
1260
|
|
|
1132
1261
|
lines.push(`${x.teal}๐ง CONTEXT${x.reset} ${graphStr} ${DIV} ${hilStr}`);
|
|
1133
1262
|
|
|
1263
|
+
// โโ Row 3: Active org runs โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
1264
|
+
const orgStatus = getActiveOrgs();
|
|
1265
|
+
if (orgStatus.count > 0) {
|
|
1266
|
+
lines.push(SEP);
|
|
1267
|
+
const orgParts = orgStatus.orgs.slice(0, 5).map(o => {
|
|
1268
|
+
const ageMin = Math.floor(o.ageMs / 60000);
|
|
1269
|
+
const ageFmt = ageMin < 1 ? 'just now' : ageMin < 60 ? `${ageMin}m ago` : `${Math.floor(ageMin / 60)}h ago`;
|
|
1270
|
+
const col = o.running ? x.green : x.slate;
|
|
1271
|
+
const dot2 = o.running ? `${x.green}โ${x.reset}` : `${x.slate}โ${x.reset}`;
|
|
1272
|
+
return `${dot2} ${col}${x.bold}${o.name}${x.reset} ${x.dim}${ageFmt}${x.reset}`;
|
|
1273
|
+
});
|
|
1274
|
+
lines.push(`${x.purple}๐ ORGS${x.reset} ${orgParts.join(` ${DIV} `)}`);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1134
1277
|
return lines.join('\n');
|
|
1135
1278
|
}
|
|
1136
1279
|
|
|
@@ -1148,6 +1291,7 @@ function generateJSON() {
|
|
|
1148
1291
|
agentdb: getAgentDBStats(),
|
|
1149
1292
|
tests: getTestStats(),
|
|
1150
1293
|
git: { modified: git.modified, untracked: git.untracked, staged: git.staged, ahead: git.ahead, behind: git.behind },
|
|
1294
|
+
tokenCost: getTokenCostSummary(),
|
|
1151
1295
|
lastUpdated: new Date().toISOString(),
|
|
1152
1296
|
};
|
|
1153
1297
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/**
|
|
4
|
+
* toggle-statusline.cjs โ Toggle or set the monomind statusline display mode.
|
|
5
|
+
*
|
|
6
|
+
* Modes: full | compact
|
|
7
|
+
* Storage: $CLAUDE_PROJECT_DIR/.monomind/statusline-mode.txt
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node toggle-statusline.cjs # toggle current mode
|
|
11
|
+
* node toggle-statusline.cjs --get # print current mode
|
|
12
|
+
* node toggle-statusline.cjs --set <mode> # set mode (full|compact)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const CWD = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
19
|
+
const MODE_FILE = path.join(CWD, '.monomind', 'statusline-mode.txt');
|
|
20
|
+
const VALID_MODES = ['full', 'compact'];
|
|
21
|
+
|
|
22
|
+
function ensureDir() {
|
|
23
|
+
try { fs.mkdirSync(path.dirname(MODE_FILE), { recursive: true }); } catch (_) {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function readMode() {
|
|
27
|
+
try {
|
|
28
|
+
if (!fs.existsSync(MODE_FILE)) return 'full';
|
|
29
|
+
var val = fs.readFileSync(MODE_FILE, 'utf-8').trim();
|
|
30
|
+
return VALID_MODES.includes(val) ? val : 'full';
|
|
31
|
+
} catch (_) {
|
|
32
|
+
return 'full';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function writeMode(mode) {
|
|
37
|
+
ensureDir();
|
|
38
|
+
fs.writeFileSync(MODE_FILE, mode, 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function printUsage() {
|
|
42
|
+
process.stderr.write(
|
|
43
|
+
'Usage: toggle-statusline.cjs [--get | --set <full|compact>]\n' +
|
|
44
|
+
' (no args) toggle between full and compact\n' +
|
|
45
|
+
' --get print current mode\n' +
|
|
46
|
+
' --set <mode> set mode to full or compact\n'
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var args = process.argv.slice(2);
|
|
51
|
+
|
|
52
|
+
if (args[0] === '--get') {
|
|
53
|
+
process.stdout.write(readMode() + '\n');
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (args[0] === '--set') {
|
|
58
|
+
var newMode = args[1];
|
|
59
|
+
if (!newMode || !VALID_MODES.includes(newMode)) {
|
|
60
|
+
printUsage();
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
writeMode(newMode);
|
|
64
|
+
process.stdout.write('statusline mode โ ' + newMode + '\n');
|
|
65
|
+
process.exit(0);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// No args: toggle
|
|
69
|
+
var current = readMode();
|
|
70
|
+
var toggled = current === 'full' ? 'compact' : 'full';
|
|
71
|
+
writeMode(toggled);
|
|
72
|
+
process.stdout.write('statusline mode โ ' + toggled + ' (was: ' + current + ')\n');
|
|
73
|
+
process.exit(0);
|