Checkpoint: File edits

Automatic checkpoint created by Claude Code
- Branch: v3
- Timestamp: 2026-01-09T16:40:13Z
- Changes: 12 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rUvandClaude Opus 4.5 committed 2026-01-09 16:40:14 +00:00
1 parent 3922fe808d
commit 1eb585d8b6
12 files changed
+429 -35

No files matched your search

+1 -1
View File
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- context-caching
- memory-persistence
createdAt: "2026-01-09T16:15:40.181Z"
createdAt: "2026-01-09T16:38:27.422Z"
+1 -1
View File
@@ -8,4 +8,4 @@ capabilities:
optimizations:
- flash-attention
- token-reduction
createdAt: "2026-01-09T16:15:40.180Z"
createdAt: "2026-01-09T16:38:27.422Z"
+1 -1
View File
@@ -7,4 +7,4 @@ capabilities:
- best-practices
optimizations:
- incremental-analysis
createdAt: "2026-01-09T16:15:40.181Z"
createdAt: "2026-01-09T16:38:27.422Z"
+1 -1
View File
@@ -7,4 +7,4 @@ capabilities:
- security-review
optimizations:
- pattern-matching
createdAt: "2026-01-09T16:15:40.181Z"
createdAt: "2026-01-09T16:38:27.422Z"
+1 -1
View File
@@ -7,4 +7,4 @@ capabilities:
- coverage
optimizations:
- parallel-execution
createdAt: "2026-01-09T16:15:40.181Z"
createdAt: "2026-01-09T16:38:27.422Z"
@@ -3,7 +3,7 @@
# Function to get statusline
claude_flow_statusline() {
local statusline_script="${CLAUDE_FLOW_DIR:-.claude}/helpers/statusline.js"
local statusline_script="${CLAUDE_FLOW_DIR:-.claude}/helpers/statusline.cjs"
if [ -f "$statusline_script" ]; then
node "$statusline_script" 2>/dev/null || echo ""
fi
@@ -17,5 +17,5 @@ claude_flow_statusline() {
# For starship (add to starship.toml)
# [custom.claude_flow]
# command = "node .claude/helpers/statusline.js 2>/dev/null"
# when = "test -f .claude/helpers/statusline.js"
# command = "node .claude/helpers/statusline.cjs 2>/dev/null"
# when = "test -f .claude/helpers/statusline.cjs"
@@ -0,0 +1,320 @@
#!/usr/bin/env node
/**
* Claude Flow V3 Statusline Generator
* Displays real-time V3 implementation progress and system status
*
* Usage: node statusline.cjs [--json] [--compact]
*
* IMPORTANT: This file uses .cjs extension to work in ES module projects.
* The require() syntax is intentional for CommonJS compatibility.
*/
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
// Configuration
const CONFIG = {
enabled: true,
showProgress: true,
showSecurity: true,
showSwarm: true,
showHooks: true,
showPerformance: true,
refreshInterval: 5000,
maxAgents: 15,
topology: 'hierarchical-mesh',
};
// ANSI colors
const c = {
reset: '\x1b[0m',
bold: '\x1b[1m',
dim: '\x1b[2m',
red: '\x1b[0;31m',
green: '\x1b[0;32m',
yellow: '\x1b[0;33m',
blue: '\x1b[0;34m',
purple: '\x1b[0;35m',
cyan: '\x1b[0;36m',
brightRed: '\x1b[1;31m',
brightGreen: '\x1b[1;32m',
brightYellow: '\x1b[1;33m',
brightBlue: '\x1b[1;34m',
brightPurple: '\x1b[1;35m',
brightCyan: '\x1b[1;36m',
brightWhite: '\x1b[1;37m',
};
// Get user info
function getUserInfo() {
let name = 'user';
let gitBranch = '';
let modelName = 'Opus 4.5';
try {
name = execSync('git config user.name 2>/dev/null || echo "user"', { encoding: 'utf-8' }).trim();
gitBranch = execSync('git branch --show-current 2>/dev/null || echo ""', { encoding: 'utf-8' }).trim();
} catch (e) {
// Ignore errors
}
return { name, gitBranch, modelName };
}
// Get learning stats from memory database
function getLearningStats() {
const memoryPaths = [
path.join(process.cwd(), '.swarm', 'memory.db'),
path.join(process.cwd(), '.claude', 'memory.db'),
path.join(process.cwd(), 'data', 'memory.db'),
];
let patterns = 0;
let sessions = 0;
let trajectories = 0;
// Try to read from sqlite database
for (const dbPath of memoryPaths) {
if (fs.existsSync(dbPath)) {
try {
// Count entries in memory file (rough estimate from file size)
const stats = fs.statSync(dbPath);
const sizeKB = stats.size / 1024;
// Estimate: ~2KB per pattern on average
patterns = Math.floor(sizeKB / 2);
sessions = Math.max(1, Math.floor(patterns / 10));
trajectories = Math.floor(patterns / 5);
break;
} catch (e) {
// Ignore
}
}
}
// Also check for session files
const sessionsPath = path.join(process.cwd(), '.claude', 'sessions');
if (fs.existsSync(sessionsPath)) {
try {
const sessionFiles = fs.readdirSync(sessionsPath).filter(f => f.endsWith('.json'));
sessions = Math.max(sessions, sessionFiles.length);
} catch (e) {
// Ignore
}
}
return { patterns, sessions, trajectories };
}
// Get V3 progress from learning state (grows as system learns)
function getV3Progress() {
const learning = getLearningStats();
// DDD progress based on actual learned patterns
// New install: 0 patterns = 0/5 domains, 0% DDD
// As patterns grow: 10+ patterns = 1 domain, 50+ = 2, 100+ = 3, 200+ = 4, 500+ = 5
let domainsCompleted = 0;
if (learning.patterns >= 500) domainsCompleted = 5;
else if (learning.patterns >= 200) domainsCompleted = 4;
else if (learning.patterns >= 100) domainsCompleted = 3;
else if (learning.patterns >= 50) domainsCompleted = 2;
else if (learning.patterns >= 10) domainsCompleted = 1;
const totalDomains = 5;
const dddProgress = Math.min(100, Math.floor((domainsCompleted / totalDomains) * 100));
return {
domainsCompleted,
totalDomains,
dddProgress,
patternsLearned: learning.patterns,
sessionsCompleted: learning.sessions
};
}
// Get security status based on actual scans
function getSecurityStatus() {
// Check for security scan results in memory
const scanResultsPath = path.join(process.cwd(), '.claude', 'security-scans');
let cvesFixed = 0;
const totalCves = 3;
if (fs.existsSync(scanResultsPath)) {
try {
const scans = fs.readdirSync(scanResultsPath).filter(f => f.endsWith('.json'));
// Each successful scan file = 1 CVE addressed
cvesFixed = Math.min(totalCves, scans.length);
} catch (e) {
// Ignore
}
}
// Also check .swarm/security for audit results
const auditPath = path.join(process.cwd(), '.swarm', 'security');
if (fs.existsSync(auditPath)) {
try {
const audits = fs.readdirSync(auditPath).filter(f => f.includes('audit'));
cvesFixed = Math.min(totalCves, Math.max(cvesFixed, audits.length));
} catch (e) {
// Ignore
}
}
const status = cvesFixed >= totalCves ? 'CLEAN' : cvesFixed > 0 ? 'IN_PROGRESS' : 'PENDING';
return {
status,
cvesFixed,
totalCves,
};
}
// Get swarm status
function getSwarmStatus() {
let activeAgents = 0;
let coordinationActive = false;
try {
const ps = execSync('ps aux 2>/dev/null | grep -c agentic-flow || echo "0"', { encoding: 'utf-8' });
activeAgents = Math.max(0, parseInt(ps.trim()) - 1);
coordinationActive = activeAgents > 0;
} catch (e) {
// Ignore errors
}
return {
activeAgents,
maxAgents: CONFIG.maxAgents,
coordinationActive,
};
}
// Get system metrics (dynamic based on actual state)
function getSystemMetrics() {
let memoryMB = 0;
let subAgents = 0;
try {
const mem = execSync('ps aux | grep -E "(node|agentic|claude)" | grep -v grep | awk \'{sum += \$6} END {print int(sum/1024)}\'', { encoding: 'utf-8' });
memoryMB = parseInt(mem.trim()) || 0;
} catch (e) {
// Fallback
memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
}
// Get learning stats for intelligence %
const learning = getLearningStats();
// Intelligence % based on learned patterns (0 patterns = 0%, 1000+ = 100%)
const intelligencePct = Math.min(100, Math.floor((learning.patterns / 10) * 1));
// Context % based on session history (0 sessions = 0%, grows with usage)
const contextPct = Math.min(100, Math.floor(learning.sessions * 5));
// Count active sub-agents from process list
try {
const agents = execSync('ps aux 2>/dev/null | grep -c "claude-flow.*agent" || echo "0"', { encoding: 'utf-8' });
subAgents = Math.max(0, parseInt(agents.trim()) - 1);
} catch (e) {
// Ignore
}
return {
memoryMB,
contextPct,
intelligencePct,
subAgents,
};
}
// Generate progress bar
function progressBar(current, total) {
const width = 5;
const filled = Math.round((current / total) * width);
const empty = width - filled;
return '[' + '\u25CF'.repeat(filled) + '\u25CB'.repeat(empty) + ']';
}
// Generate full statusline
function generateStatusline() {
const user = getUserInfo();
const progress = getV3Progress();
const security = getSecurityStatus();
const swarm = getSwarmStatus();
const system = getSystemMetrics();
const lines = [];
// Header Line
let header = `${c.bold}${c.brightPurple}▊ Claude Flow V3 ${c.reset}`;
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
if (user.gitBranch) {
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
}
header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
lines.push(header);
// Separator
lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
// Line 1: DDD Domain Progress
const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
lines.push(
`${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
`${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
`${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
);
// Line 2: Swarm + CVE + Memory + Context + Intelligence
const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
lines.push(
`${c.brightYellow}🤖 Swarm${c.reset} ${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
`${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
`${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
`${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
`${c.brightGreen}📂 ${String(system.contextPct).padStart(3)}%${c.reset} ` +
`${c.dim}🧠 ${String(system.intelligencePct).padStart(3)}%${c.reset}`
);
// Line 3: Architecture status
const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
lines.push(
`${c.brightPurple}🔧 Architecture${c.reset} ` +
`${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
`${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
`${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
`${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
);
return lines.join('\n');
}
// Generate JSON data
function generateJSON() {
return {
user: getUserInfo(),
v3Progress: getV3Progress(),
security: getSecurityStatus(),
swarm: getSwarmStatus(),
system: getSystemMetrics(),
performance: {
flashAttentionTarget: '2.49x-7.47x',
searchImprovement: '150x-12,500x',
memoryReduction: '50-75%',
},
lastUpdated: new Date().toISOString(),
};
}
// Main
if (process.argv.includes('--json')) {
console.log(JSON.stringify(generateJSON(), null, 2));
} else if (process.argv.includes('--compact')) {
console.log(JSON.stringify(generateJSON()));
} else {
console.log(generateStatusline());
}
+2 -2
View File
@@ -148,7 +148,7 @@
},
"statusLine": {
"type": "command",
"command": "npx @claude-flow/hooks statusline 2>/dev/null || node .claude/helpers/statusline.js 2>/dev/null || echo \"▊ V3\"",
"command": "npx @claude-flow/cli@latest hooks statusline 2>/dev/null || node .claude/helpers/statusline.cjs 2>/dev/null || echo \"▊ Claude Flow V3\"",
"refreshMs": 5000,
"enabled": true
},
@@ -165,7 +165,7 @@
"enabled": true,
"modelPreferences": {
"default": "claude-opus-4-5-20251101",
"routing": "claude-opus-4-5-20251101"
"routing": "claude-3-5-haiku-20241022"
},
"swarm": {
"topology": "hierarchical-mesh",
+55 -9
View File
@@ -309,16 +309,38 @@ npx @claude-flow/cli@latest performance benchmark --suite all
### Testing & Validation
`tdd-london-swarm`, `production-validator`
## 🪝 V3 Hooks System (17 Hooks + 12 Workers)
## 🪝 V3 Hooks System (27 Hooks + 12 Workers)
### Hook Categories
### All Available Hooks
| Category | Hooks | Purpose |
|----------|-------|---------|
| **Core** | `pre-edit`, `post-edit`, `pre-command`, `post-command`, `pre-task`, `post-task` | Tool lifecycle |
| **Session** | `session-start`, `session-end`, `session-restore`, `notify` | Context management |
| **Intelligence** | `route`, `explain`, `pretrain`, `build-agents`, `transfer` | Neural learning |
| **Learning** | `intelligence` (trajectory-start/step/end, pattern-store/search, stats, attention) | Reinforcement |
| Hook | Description | Key Options |
|------|-------------|-------------|
| `pre-edit` | Get context before editing files | `--file`, `--operation` |
| `post-edit` | Record editing outcome for learning | `--file`, `--success`, `--train-neural` |
| `pre-command` | Assess risk before commands | `--command`, `--validate-safety` |
| `post-command` | Record command execution outcome | `--command`, `--track-metrics` |
| `pre-task` | Record task start, get agent suggestions | `--description`, `--coordinate-swarm` |
| `post-task` | Record task completion for learning | `--task-id`, `--success`, `--store-results` |
| `session-start` | Start/restore session (v2 compat) | `--session-id`, `--auto-configure` |
| `session-end` | End session and persist state | `--generate-summary`, `--export-metrics` |
| `session-restore` | Restore a previous session | `--session-id`, `--latest` |
| `route` | Route task to optimal agent | `--task`, `--context`, `--top-k` |
| `route-task` | (v2 compat) Alias for route | `--task`, `--auto-swarm` |
| `explain` | Explain routing decision | `--topic`, `--detailed` |
| `pretrain` | Bootstrap intelligence from repo | `--model-type`, `--epochs` |
| `build-agents` | Generate optimized agent configs | `--agent-types`, `--focus` |
| `metrics` | View learning metrics dashboard | `--v3-dashboard`, `--format` |
| `transfer` | Transfer patterns via IPFS registry | `store`, `from-project` |
| `list` | List all registered hooks | `--format` |
| `intelligence` | RuVector intelligence system | `trajectory-*`, `pattern-*`, `stats` |
| `worker` | Background worker management | `list`, `dispatch`, `status`, `detect` |
| `progress` | Check V3 implementation progress | `--detailed`, `--format` |
| `statusline` | Generate dynamic statusline | `--json`, `--compact`, `--no-color` |
| `coverage-route` | Route based on test coverage gaps | `--task`, `--path` |
| `coverage-suggest` | Suggest coverage improvements | `--path` |
| `coverage-gaps` | List coverage gaps with priorities | `--format`, `--limit` |
| `pre-bash` | (v2 compat) Alias for pre-command | Same as pre-command |
| `post-bash` | (v2 compat) Alias for post-command | Same as post-command |
### 12 Background Workers
@@ -343,7 +365,7 @@ npx @claude-flow/cli@latest performance benchmark --suite all
# Core hooks
npx @claude-flow/cli@latest hooks pre-task --description "[task]"
npx @claude-flow/cli@latest hooks post-task --task-id "[id]" --success true
npx @claude-flow/cli@latest hooks post-edit --file "[file]" --train-patterns
npx @claude-flow/cli@latest hooks post-edit --file "[file]" --train-neural true
# Session management
npx @claude-flow/cli@latest hooks session-start --session-id "[id]"
@@ -362,6 +384,30 @@ npx @claude-flow/cli@latest hooks build-agents --agent-types coder,tester
npx @claude-flow/cli@latest hooks worker list
npx @claude-flow/cli@latest hooks worker dispatch --trigger audit
npx @claude-flow/cli@latest hooks worker status
# Coverage-aware routing
npx @claude-flow/cli@latest hooks coverage-gaps --format table
npx @claude-flow/cli@latest hooks coverage-route --task "[task]"
# Statusline (for Claude Code integration)
npx @claude-flow/cli@latest hooks statusline
npx @claude-flow/cli@latest hooks statusline --json
```
## 🔄 Migration (V2 to V3)
```bash
# Check migration status
npx @claude-flow/cli@latest migrate status
# Run migration with backup
npx @claude-flow/cli@latest migrate run --backup
# Rollback if needed
npx @claude-flow/cli@latest migrate rollback
# Validate migration
npx @claude-flow/cli@latest migrate validate
```
## 🧠 Intelligence System (RuVector)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli",
"version": "3.0.0-alpha.62",
"version": "3.0.0-alpha.63",
"type": "module",
"description": "CLI module - command parsing, prompts, output formatting",
"main": "dist/src/index.js",
@@ -576,10 +576,50 @@ npx @claude-flow/cli@latest doctor --fix
- **Swarm init**: \`npx @claude-flow/cli@latest swarm init --topology <type>\`
- **Swarm status**: \`npx @claude-flow/cli@latest swarm status\`
- **Agent spawn**: \`npx @claude-flow/cli@latest agent spawn -t <type> --name <name>\`
- **Memory store**: \`npx @claude-flow/cli@latest memory store --namespace <ns> --key <k> --value <v>\`
- **Memory search**: \`npx @claude-flow/cli@latest memory search -q "<query>"\`
- **Memory store**: \`npx @claude-flow/cli@latest memory store --key "mykey" --value "myvalue" --namespace patterns\`
- **Memory search**: \`npx @claude-flow/cli@latest memory search --query "search terms"\`
- **Memory list**: \`npx @claude-flow/cli@latest memory list --namespace patterns\`
- **Memory retrieve**: \`npx @claude-flow/cli@latest memory retrieve --key "mykey" --namespace patterns\`
- **Hooks**: \`npx @claude-flow/cli@latest hooks <hook-name> [options]\`
## 📝 Memory Commands Reference (IMPORTANT)
### Store Data (ALL options shown)
\`\`\`bash
# REQUIRED: --key and --value
# OPTIONAL: --namespace (default: "default"), --ttl, --tags
npx @claude-flow/cli@latest memory store --key "pattern-auth" --value "JWT with refresh tokens" --namespace patterns
npx @claude-flow/cli@latest memory store --key "bug-fix-123" --value "Fixed null check" --namespace solutions --tags "bugfix,auth"
\`\`\`
### Search Data (semantic vector search)
\`\`\`bash
# REQUIRED: --query (full flag, not -q)
# OPTIONAL: --namespace, --limit, --threshold
npx @claude-flow/cli@latest memory search --query "authentication patterns"
npx @claude-flow/cli@latest memory search --query "error handling" --namespace patterns --limit 5
\`\`\`
### List Entries
\`\`\`bash
# OPTIONAL: --namespace, --limit
npx @claude-flow/cli@latest memory list
npx @claude-flow/cli@latest memory list --namespace patterns --limit 10
\`\`\`
### Retrieve Specific Entry
\`\`\`bash
# REQUIRED: --key
# OPTIONAL: --namespace (default: "default")
npx @claude-flow/cli@latest memory retrieve --key "pattern-auth"
npx @claude-flow/cli@latest memory retrieve --key "pattern-auth" --namespace patterns
\`\`\`
### Initialize Memory Database
\`\`\`bash
npx @claude-flow/cli@latest memory init --force --verbose
\`\`\`
**KEY**: CLI coordinates the strategy via Bash, Claude Code's Task tool executes with real agents.
## Support
+1 -13
View File
@@ -124,7 +124,7 @@
}
},
"@claude-flow/cli": {
"version": "3.0.0-alpha.62",
"version": "3.0.0-alpha.63",
"dependencies": {
"@claude-flow/shared": "^3.0.0-alpha.1"
},
@@ -4165,7 +4165,6 @@
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=14"
}
@@ -6710,17 +6709,6 @@
"url": "https://opencollective.com/express"
}
},
"node_modules/agentic-flow/node_modules/jose": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz",
"integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==",
"license": "MIT",
"optional": true,
"peer": true,
"funding": {
"url": "https://github.com/sponsors/panva"
}
},
"node_modules/agentic-flow/node_modules/lru-cache": {
"version": "11.2.4",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz",