Major changes: - Organized Python v1 implementation into v1/ subdirectory - Created Rust workspace with 9 modular crates: - wifi-densepose-core: Core types, traits, errors - wifi-densepose-signal: CSI processing, phase sanitization, FFT - wifi-densepose-nn: Neural network inference (ONNX/Candle/tch) - wifi-densepose-api: Axum-based REST/WebSocket API - wifi-densepose-db: SQLx database layer - wifi-densepose-config: Configuration management - wifi-densepose-hardware: Hardware abstraction - wifi-densepose-wasm: WebAssembly bindings - wifi-densepose-cli: Command-line interface Documentation: - ADR-001: Workspace structure - ADR-002: Signal processing library selection - ADR-003: Neural network inference strategy - DDD domain model with bounded contexts Testing: - 69 tests passing across all crates - Signal processing: 45 tests - Neural networks: 21 tests - Core: 3 doc tests Performance targets: - 10x faster CSI processing (~0.5ms vs ~5ms) - 5x lower memory usage (~100MB vs ~500MB) - WASM support for browser deployment
84 lines
1.8 KiB
JavaScript
84 lines
1.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Claude Flow Memory Helper
|
|
* Simple key-value memory for cross-session context
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const MEMORY_DIR = path.join(process.cwd(), '.claude-flow', 'data');
|
|
const MEMORY_FILE = path.join(MEMORY_DIR, 'memory.json');
|
|
|
|
function loadMemory() {
|
|
try {
|
|
if (fs.existsSync(MEMORY_FILE)) {
|
|
return JSON.parse(fs.readFileSync(MEMORY_FILE, 'utf-8'));
|
|
}
|
|
} catch (e) {
|
|
// Ignore
|
|
}
|
|
return {};
|
|
}
|
|
|
|
function saveMemory(memory) {
|
|
fs.mkdirSync(MEMORY_DIR, { recursive: true });
|
|
fs.writeFileSync(MEMORY_FILE, JSON.stringify(memory, null, 2));
|
|
}
|
|
|
|
const commands = {
|
|
get: (key) => {
|
|
const memory = loadMemory();
|
|
const value = key ? memory[key] : memory;
|
|
console.log(JSON.stringify(value, null, 2));
|
|
return value;
|
|
},
|
|
|
|
set: (key, value) => {
|
|
if (!key) {
|
|
console.error('Key required');
|
|
return;
|
|
}
|
|
const memory = loadMemory();
|
|
memory[key] = value;
|
|
memory._updated = new Date().toISOString();
|
|
saveMemory(memory);
|
|
console.log(`Set: ${key}`);
|
|
},
|
|
|
|
delete: (key) => {
|
|
if (!key) {
|
|
console.error('Key required');
|
|
return;
|
|
}
|
|
const memory = loadMemory();
|
|
delete memory[key];
|
|
saveMemory(memory);
|
|
console.log(`Deleted: ${key}`);
|
|
},
|
|
|
|
clear: () => {
|
|
saveMemory({});
|
|
console.log('Memory cleared');
|
|
},
|
|
|
|
keys: () => {
|
|
const memory = loadMemory();
|
|
const keys = Object.keys(memory).filter(k => !k.startsWith('_'));
|
|
console.log(keys.join('\n'));
|
|
return keys;
|
|
},
|
|
};
|
|
|
|
// CLI
|
|
const [,, command, key, ...valueParts] = process.argv;
|
|
const value = valueParts.join(' ');
|
|
|
|
if (command && commands[command]) {
|
|
commands[command](key, value);
|
|
} else {
|
|
console.log('Usage: memory.js <get|set|delete|clear|keys> [key] [value]');
|
|
}
|
|
|
|
module.exports = commands;
|