chore: update intelligence data and version bump to v0.1.71

This commit is contained in:
rUv 2025-12-31 17:40:37 +00:00
parent 4f4e80381d
commit ae32e23d5b
6 changed files with 2038 additions and 41 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,216 @@
# RuVector Intelligence Statusline for Windows PowerShell
# Multi-line display showcasing self-learning capabilities
$ErrorActionPreference = "SilentlyContinue"
# Read JSON input from stdin
$input = [Console]::In.ReadToEnd()
$data = $input | ConvertFrom-Json
$Model = if ($data.model.display_name) { $data.model.display_name } else { "Claude" }
$CWD = if ($data.workspace.current_dir) { $data.workspace.current_dir } else { $data.cwd }
$Dir = Split-Path -Leaf $CWD
# Get git branch
$Branch = $null
Push-Location $CWD 2>$null
$Branch = git branch --show-current 2>$null
Pop-Location
# ANSI colors (Windows Terminal supports these)
$Reset = "`e[0m"
$Bold = "`e[1m"
$Cyan = "`e[36m"
$Yellow = "`e[33m"
$Green = "`e[32m"
$Magenta = "`e[35m"
$Blue = "`e[34m"
$Red = "`e[31m"
$Dim = "`e[2m"
# ═══════════════════════════════════════════════════════════════════════════════
# LINE 1: Model, Directory, Git
# ═══════════════════════════════════════════════════════════════════════════════
$Line1 = "${Bold}${Model}${Reset} in ${Cyan}${Dir}${Reset}"
if ($Branch) {
$Line1 += " on ${Yellow}${Branch}${Reset}"
}
Write-Host $Line1
# ═══════════════════════════════════════════════════════════════════════════════
# LINE 2: RuVector Intelligence Stats
# ═══════════════════════════════════════════════════════════════════════════════
$IntelFile = $null
$IntelPaths = @(
"$CWD\.ruvector\intelligence.json",
"$CWD\npm\packages\ruvector\.ruvector\intelligence.json",
"$env:USERPROFILE\.ruvector\intelligence.json"
)
foreach ($path in $IntelPaths) {
if (Test-Path $path) {
$IntelFile = $path
break
}
}
if ($IntelFile) {
$Intel = Get-Content $IntelFile -Raw | ConvertFrom-Json
# Detect schema version
$HasLearning = $Intel.PSObject.Properties.Name -contains "learning"
if ($HasLearning) {
# v2 Schema
$PatternCount = 0
if ($Intel.learning.qTables) {
foreach ($table in $Intel.learning.qTables.PSObject.Properties) {
$PatternCount += $table.Value.PSObject.Properties.Count
}
}
$ActiveAlgos = 0
$TotalAlgos = 0
$BestAlgo = "none"
$BestScore = 0
if ($Intel.learning.stats) {
$stats = $Intel.learning.stats.PSObject.Properties
$TotalAlgos = $stats.Count
foreach ($stat in $stats) {
if ($stat.Value.updates -gt 0) {
$ActiveAlgos++
if ($stat.Value.convergenceScore -gt $BestScore) {
$BestScore = $stat.Value.convergenceScore
$BestAlgo = $stat.Name
}
}
}
}
$RoutingAlgo = if ($Intel.learning.configs.'agent-routing'.algorithm) {
$Intel.learning.configs.'agent-routing'.algorithm
} else { "double-q" }
$LearningRate = if ($Intel.learning.configs.'agent-routing'.learningRate) {
$Intel.learning.configs.'agent-routing'.learningRate
} else { 0.1 }
$Epsilon = if ($Intel.learning.configs.'agent-routing'.epsilon) {
$Intel.learning.configs.'agent-routing'.epsilon
} else { 0.1 }
$Schema = "v2"
}
else {
# v1 Schema
$PatternCount = if ($Intel.patterns) { $Intel.patterns.PSObject.Properties.Count } else { 0 }
$TrajCount = if ($Intel.trajectories) { $Intel.trajectories.Count } else { 0 }
$ActiveAlgos = 0
$TotalAlgos = 0
$BestAlgo = "none"
$BestScore = 0
$RoutingAlgo = "q-learning"
$LearningRate = 0.1
$Epsilon = 0.1
$Schema = "v1"
}
# Common fields
$MemoryCount = if ($Intel.memories) { $Intel.memories.Count } else { 0 }
$TrajCount = if ($Intel.trajectories) { $Intel.trajectories.Count } else { 0 }
$ErrorCount = if ($Intel.errors) { $Intel.errors.Count } else { 0 }
$SessionCount = if ($Intel.stats.session_count) { $Intel.stats.session_count } else { 0 }
# Build Line 2
$Line2 = "${Magenta}🧠 RuVector${Reset}"
if ($PatternCount -gt 0) {
$Line2 += " ${Green}${Reset} $PatternCount patterns"
} else {
$Line2 += " ${Dim}◇ learning${Reset}"
}
if ($ActiveAlgos -gt 0) {
$Line2 += " ${Cyan}${Reset} $ActiveAlgos/$TotalAlgos algos"
}
if ($BestAlgo -ne "none") {
$ShortAlgo = switch ($BestAlgo) {
"double-q" { "DQ" }
"q-learning" { "QL" }
"actor-critic" { "AC" }
"decision-transformer" { "DT" }
"monte-carlo" { "MC" }
"td-lambda" { "TD" }
default { $BestAlgo.Substring(0,3) }
}
$ScorePct = [math]::Round($BestScore * 100)
$ScoreColor = if ($ScorePct -ge 80) { $Green } elseif ($ScorePct -ge 50) { $Yellow } else { $Red }
$Line2 += " ${ScoreColor}${ShortAlgo}:${ScorePct}%${Reset}"
}
if ($MemoryCount -gt 0) {
$Line2 += " ${Blue}${Reset} $MemoryCount mem"
}
if ($TrajCount -gt 0) {
$Line2 += " ${Yellow}${Reset}$TrajCount"
}
if ($ErrorCount -gt 0) {
$Line2 += " ${Red}🔧${Reset}$ErrorCount"
}
if ($SessionCount -gt 0) {
$Line2 += " ${Dim}#$SessionCount${Reset}"
}
Write-Host $Line2
# ═══════════════════════════════════════════════════════════════════════════════
# LINE 3: Agent Routing
# ═══════════════════════════════════════════════════════════════════════════════
$AlgoIcon = switch ($RoutingAlgo) {
"double-q" { "⚡DQ" }
"sarsa" { "🔄SA" }
"actor-critic" { "🎭AC" }
default { $RoutingAlgo }
}
$LrPct = [math]::Round($LearningRate * 100)
$EpsPct = [math]::Round($Epsilon * 100)
$Line3 = "${Blue}🎯 Routing${Reset} ${Cyan}${AlgoIcon}${Reset} lr:${LrPct}% ε:${EpsPct}%"
Write-Host $Line3
}
else {
Write-Host "${Dim}🧠 RuVector: run 'npx ruvector hooks session-start' to initialize${Reset}"
}
# ═══════════════════════════════════════════════════════════════════════════════
# LINE 4: Claude Flow (if available)
# ═══════════════════════════════════════════════════════════════════════════════
$FlowDir = "$CWD\.claude-flow"
if (Test-Path $FlowDir) {
$FlowOutput = ""
$SwarmConfig = "$FlowDir\swarm-config.json"
if (Test-Path $SwarmConfig) {
$Config = Get-Content $SwarmConfig -Raw | ConvertFrom-Json
if ($Config.defaultStrategy) {
$Topo = switch ($Config.defaultStrategy) {
"balanced" { "mesh" }
"conservative" { "hier" }
"aggressive" { "ring" }
default { $Config.defaultStrategy }
}
$FlowOutput += " ${Magenta}${Topo}${Reset}"
}
if ($Config.agentProfiles -and $Config.agentProfiles.Count -gt 0) {
$FlowOutput += " ${Cyan}🤖$($Config.agentProfiles.Count)${Reset}"
}
}
if ($FlowOutput) {
Write-Host "${Dim}⚡ Flow:${Reset}$FlowOutput"
}
}

View file

@ -1212,22 +1212,32 @@ pub fn init_hooks(force: bool, postgres: bool, _config: &Config) -> Result<()> {
fs::create_dir_all(&claude_dir)?;
// Create statusline script
let statusline_path = claude_dir.join("statusline-command.sh");
let statusline_script = include_str!("../../scripts/statusline-command.sh");
fs::write(&statusline_path, statusline_script)?;
// Create platform-specific statusline script
let (statusline_path, statusline_config) = if cfg!(windows) {
// Windows: Use PowerShell script
let path = claude_dir.join("statusline-command.ps1");
let script = include_str!("../../scripts/statusline-command.ps1");
fs::write(&path, script)?;
(Some(path), Some(".claude/statusline-command.ps1"))
} else {
// Unix (macOS, Linux): Use bash script
let path = claude_dir.join("statusline-command.sh");
let script = include_str!("../../scripts/statusline-command.sh");
fs::write(&path, script)?;
// Make executable on Unix
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let mut perms = fs::metadata(&statusline_path)?.permissions();
perms.set_mode(0o755);
fs::set_permissions(&statusline_path, perms)?;
}
// Make executable
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let mut perms = fs::metadata(&path)?.permissions();
perms.set_mode(0o755);
fs::set_permissions(&path, perms)?;
}
(Some(path), Some(".claude/statusline-command.sh"))
};
let hooks_config = serde_json::json!({
"statusline": ".claude/statusline-command.sh",
"statusline": statusline_config,
"hooks": {
// Pre-tool hooks: provide guidance before actions
"PreToolUse": [{
@ -1352,7 +1362,9 @@ pub fn init_hooks(force: bool, postgres: bool, _config: &Config) -> Result<()> {
println!("{}", "✅ Hooks initialized!".green().bold());
println!(" Created: {}", settings_path.display());
println!(" Created: {}", statusline_path.display());
if let Some(ref path) = statusline_path {
println!(" Created: {}", path.display());
}
println!("\n{}", "Next steps:".bold());
println!(" 1. Restart Claude Code to activate hooks");
println!(" 2. Run 'npx ruvector hooks stats' to verify");

View file

@ -3,9 +3,9 @@
"cmd_shell_general|success": {
"state": "cmd_shell_general",
"action": "success",
"q_value": 0.795876979834144,
"visits": 50,
"last_update": 1767196937
"q_value": 0.7962892818507296,
"visits": 51,
"last_update": 1767196950
},
"edit_ts_in_project|successful-edit": {
"state": "edit_ts_in_project",
@ -4562,6 +4562,79 @@
],
"metadata": {},
"timestamp": 1767196937
},
{
"id": "mem_1767196950",
"memory_type": "command",
"content": " succeeded",
"embedding": [
0,
0,
0,
0.31622776601683794,
0,
0,
0,
0,
0.31622776601683794,
0,
0,
0,
0,
0,
0,
0.31622776601683794,
0,
0,
0,
0,
0,
0.31622776601683794,
0,
0,
0,
0,
0,
0,
0,
0.31622776601683794,
0,
0,
0.31622776601683794,
0,
0,
0.31622776601683794,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0.31622776601683794,
0,
0.31622776601683794,
0,
0,
0,
0,
0.31622776601683794
],
"metadata": {},
"timestamp": 1767196950
}
],
"trajectories": [
@ -5020,6 +5093,14 @@
"outcome": "completed",
"reward": 0.8,
"timestamp": 1767196937
},
{
"id": "traj_1767196950",
"state": "cmd_shell_general",
"action": "success",
"outcome": "completed",
"reward": 0.8,
"timestamp": 1767196950
}
],
"errors": {},
@ -5028,8 +5109,8 @@
"edges": [],
"stats": {
"total_patterns": 5,
"total_memories": 62,
"total_trajectories": 57,
"total_memories": 63,
"total_trajectories": 58,
"total_errors": 0,
"session_count": 6,
"last_session": 1767195588

View file

@ -2836,26 +2836,87 @@ hooksCmd.command('init')
// StatusLine configuration (unless --minimal or --no-statusline)
if (!opts.minimal && opts.statusline !== false) {
if (!settings.statusLine) {
// Create a simple statusline script
const statuslineScript = path.join(settingsDir, 'statusline.sh');
const statuslineContent = `#!/bin/bash
# RuVector Status Line - shows intelligence stats
INTEL_FILE=".ruvector/intelligence.json"
if [ -f "$INTEL_FILE" ]; then
PATTERNS=$(jq -r '.patterns | length // 0' "$INTEL_FILE" 2>/dev/null || echo "0")
MEMORIES=$(jq -r '.memories | length // 0' "$INTEL_FILE" 2>/dev/null || echo "0")
echo "🧠 $PATTERNS patterns | 💾 $MEMORIES memories"
const isWindows = process.platform === 'win32';
if (isWindows) {
// Windows: PowerShell statusline
const statuslineScript = path.join(settingsDir, 'statusline-command.ps1');
const statuslineContent = `# RuVector Intelligence Statusline for Windows PowerShell
# Compatible with PowerShell 5.1+ and PowerShell Core
$ErrorActionPreference = "SilentlyContinue"
$e = [char]27
$inputData = [Console]::In.ReadToEnd()
$data = $inputData | ConvertFrom-Json
$Model = if ($data.model.display_name) { $data.model.display_name } else { "Claude" }
$CWD = if ($data.workspace.current_dir) { $data.workspace.current_dir } else { $data.cwd }
$Dir = Split-Path -Leaf $CWD
$Branch = $null
try { Push-Location $CWD -ErrorAction Stop; $Branch = git branch --show-current 2>$null; Pop-Location } catch {}
Write-Host "$e[1m$Model$e[0m in $e[36m$Dir$e[0m$(if($Branch){" on $e[33m$Branch$e[0m"})"
$IntelFile = Join-Path $CWD ".ruvector\intelligence.json"
if (Test-Path $IntelFile) {
$Intel = Get-Content $IntelFile -Raw | ConvertFrom-Json
$Mem = if ($Intel.memories) { $Intel.memories.Count } else { 0 }
$Traj = if ($Intel.trajectories) { $Intel.trajectories.Count } else { 0 }
$Sess = if ($Intel.stats -and $Intel.stats.session_count) { $Intel.stats.session_count } else { 0 }
$Pat = if ($Intel.patterns) { ($Intel.patterns | Get-Member -MemberType NoteProperty).Count } else { 0 }
$Line2 = "$e[35m RuVector$e[0m"
if ($Pat -gt 0) { $Line2 += " $e[32m$Pat patterns$e[0m" } else { $Line2 += " $e[2mlearning$e[0m" }
if ($Mem -gt 0) { $Line2 += " $e[34m$Mem mem$e[0m" }
if ($Traj -gt 0) { $Line2 += " $e[33m$Traj traj$e[0m" }
if ($Sess -gt 0) { $Line2 += " $e[2m#$Sess$e[0m" }
Write-Host $Line2
} else {
Write-Host "$e[2m RuVector: run 'npx ruvector hooks session-start'$e[0m"
}
`;
fs.writeFileSync(statuslineScript, statuslineContent);
settings.statusLine = {
type: 'command',
command: 'powershell -NoProfile -ExecutionPolicy Bypass -File .claude/statusline-command.ps1'
};
} else {
// Unix (macOS, Linux): Bash statusline
const statuslineScript = path.join(settingsDir, 'statusline-command.sh');
const statuslineContent = `#!/bin/bash
# RuVector Intelligence Statusline - Multi-line display
INPUT=\$(cat)
MODEL=\$(echo "\$INPUT" | jq -r '.model.display_name // "Claude"')
CWD=\$(echo "\$INPUT" | jq -r '.workspace.current_dir // .cwd')
DIR=\$(basename "\$CWD")
BRANCH=\$(cd "\$CWD" 2>/dev/null && git branch --show-current 2>/dev/null)
RESET="\\033[0m"; BOLD="\\033[1m"; CYAN="\\033[36m"; YELLOW="\\033[33m"; GREEN="\\033[32m"; MAGENTA="\\033[35m"; BLUE="\\033[34m"; DIM="\\033[2m"; RED="\\033[31m"
printf "\$BOLD\$MODEL\$RESET in \$CYAN\$DIR\$RESET"
[ -n "\$BRANCH" ] && printf " on \$YELLOW⎇ \$BRANCH\$RESET"
echo
INTEL_FILE=""
for P in "\$CWD/.ruvector/intelligence.json" "\$CWD/npm/packages/ruvector/.ruvector/intelligence.json" "\$HOME/.ruvector/intelligence.json"; do
[ -f "\$P" ] && INTEL_FILE="\$P" && break
done
if [ -n "\$INTEL_FILE" ]; then
INTEL=\$(cat "\$INTEL_FILE" 2>/dev/null)
MEMORY_COUNT=\$(echo "\$INTEL" | jq -r '.memories | length // 0' 2>/dev/null)
TRAJ_COUNT=\$(echo "\$INTEL" | jq -r '.trajectories | length // 0' 2>/dev/null)
SESSION_COUNT=\$(echo "\$INTEL" | jq -r '.stats.session_count // 0' 2>/dev/null)
PATTERN_COUNT=\$(echo "\$INTEL" | jq -r '.patterns | length // 0' 2>/dev/null)
printf "\$MAGENTA🧠 RuVector\$RESET"
[ "\$PATTERN_COUNT" != "null" ] && [ "\$PATTERN_COUNT" -gt 0 ] 2>/dev/null && printf " \$GREEN\$RESET \$PATTERN_COUNT patterns" || printf " \$DIM learning\$RESET"
[ "\$MEMORY_COUNT" != "null" ] && [ "\$MEMORY_COUNT" -gt 0 ] 2>/dev/null && printf " \$BLUE\$RESET \$MEMORY_COUNT mem"
[ "\$TRAJ_COUNT" != "null" ] && [ "\$TRAJ_COUNT" -gt 0 ] 2>/dev/null && printf " \$YELLOW\$RESET\$TRAJ_COUNT"
[ "\$SESSION_COUNT" != "null" ] && [ "\$SESSION_COUNT" -gt 0 ] 2>/dev/null && printf " \$DIM#\$SESSION_COUNT\$RESET"
echo
else
echo "🧠 RuVector"
printf "\$DIM🧠 RuVector: run 'npx ruvector hooks session-start' to initialize\$RESET\\n"
fi
`;
fs.writeFileSync(statuslineScript, statuslineContent);
fs.chmodSync(statuslineScript, '755');
settings.statusLine = {
type: 'command',
command: '.claude/statusline.sh'
};
console.log(chalk.blue(' ✓ StatusLine configured'));
fs.writeFileSync(statuslineScript, statuslineContent);
fs.chmodSync(statuslineScript, '755');
settings.statusLine = {
type: 'command',
command: '.claude/statusline-command.sh'
};
}
console.log(chalk.blue(` ✓ StatusLine configured (${isWindows ? 'PowerShell' : 'Bash'})`));
}
}

View file

@ -1,6 +1,6 @@
{
"name": "ruvector",
"version": "0.1.71",
"version": "0.1.74",
"description": "High-performance vector database for Node.js with automatic native/WASM fallback",
"main": "dist/index.js",
"types": "dist/index.d.ts",