π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUv240543df8548
diff --git a/v3/@claude-flow/cli/__tests__/cli.test.ts b/v3/@claude-flow/cli/__tests__/cli.test.tsindex d89e7d9498..5a90d1273a 100644--- a/v3/@claude-flow/cli/__tests__/cli.test.ts+++ b/v3/@claude-flow/cli/__tests__/cli.test.ts@@ -165,120 +165,144 @@ describe('CLI', () => {describe('Argument Parsing', () => {it('should parse long flags', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testparse',description: 'Test command',action: async (ctx) => {expect(ctx.flags.verbose).toBe(true);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--verbose']);+ await cli.run(['testparse', '--verbose']);+ expect(flagsPassed).toBe(true);});it('should parse short flags', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testshort',description: 'Test command',action: async (ctx) => {expect(ctx.flags.v).toBe(true);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '-v']);+ await cli.run(['testshort', '-v']);+ expect(flagsPassed).toBe(true);});it('should parse flags with values', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testvalue',description: 'Test command',action: async (ctx) => {expect(ctx.flags.format).toBe('json');+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--format', 'json']);+ await cli.run(['testvalue', '--format', 'json']);+ expect(flagsPassed).toBe(true);});it('should parse flags with equals syntax', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testequals',description: 'Test command',action: async (ctx) => {expect(ctx.flags.output).toBe('file.txt');+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--output=file.txt']);+ await cli.run(['testequals', '--output=file.txt']);+ expect(flagsPassed).toBe(true);});it('should parse multiple flags', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testmulti',description: 'Test command',action: async (ctx) => {expect(ctx.flags.verbose).toBe(true);expect(ctx.flags.format).toBe('json');expect(ctx.flags.quiet).toBe(true);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--verbose', '--format', 'json', '-q']);+ await cli.run(['testmulti', '--verbose', '--format', 'json', '-q']);+ expect(flagsPassed).toBe(true);});it('should parse positional arguments', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testpos',description: 'Test command',action: async (ctx) => {expect(ctx.args).toEqual(['arg1', 'arg2', 'arg3']);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', 'arg1', 'arg2', 'arg3']);+ await cli.run(['testpos', 'arg1', 'arg2', 'arg3']);+ expect(flagsPassed).toBe(true);});it('should handle boolean flags correctly', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testbool',description: 'Test command',options: [{ name: 'force', type: 'boolean', description: 'Force operation' }],action: async (ctx) => {expect(ctx.flags.force).toBe(true);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--force']);+ await cli.run(['testbool', '--force']);+ expect(flagsPassed).toBe(true);});it('should handle negated boolean flags', async () => {+ let flagsPassed = false;const mockCommand: Command = {- name: 'test',+ name: 'testnegate',description: 'Test command',action: async (ctx) => {expect(ctx.flags.color).toBe(false);+ flagsPassed = true;return { success: true };}};cli['parser'].registerCommand(mockCommand);- await cli.run(['test', '--no-color']);+ await cli.run(['testnegate', '--no-color']);+ expect(flagsPassed).toBe(true);});});diff --git a/v3/CLEANUP_REPORT.md b/v3/CLEANUP_REPORT.mdnew file mode 100644index 0000000000..d07e62d061--- /dev/null+++ b/v3/CLEANUP_REPORT.md@@ -0,0 +1,296 @@+# V3 Directory Cleanup Report+**Date**: 2026-01-04+**Cleanup Session**: Dead Code and Duplicates Removal++## Summary++Successfully cleaned up dead code and temporary files from `/workspaces/claude-flow/v3/`. Removed **1.55 MB** of unnecessary files while preserving essential backward compatibility layers.++---++## Files and Directories Removed++### 1. `/workspaces/claude-flow/v3/hooks/` (REMOVED β )+**Size**: ~72 KB+**Reason**: Unused legacy hooks system+**Justification**:+- No active imports found outside the hooks directory itself+- Only reference was in `@claude-flow/cli/src/commands/migrate.ts` as a migration target (not an active dependency)+- The hooks system has been superseded by the modular @claude-flow architecture+- Verified with grep: no relative imports of `./hooks` or `../hooks` found in the codebase++### 2. `/workspaces/claude-flow/v3/ruvector.db` (REMOVED β )+**Size**: 1.55 MB (1,589,248 bytes)+**Type**: redb database (Rust embedded database)+**Reason**: Runtime cache/temporary database file+**Justification**:+- Already covered by `.gitignore` patterns (`*.db`)+- File header signature: `redb` (Rust embedded database format)+- This is a runtime-generated cache file, not source code+- Can be regenerated on demand by the application+- Similar to `.tsbuildinfo` files - build/runtime artifacts++### 3. Build Artifacts (REMOVED β )+**Files Removed**:+- `/workspaces/claude-flow/v3/tsconfig.tsbuildinfo`+- `/workspaces/claude-flow/v3/@claude-flow/memory/tsconfig.tsbuildinfo`+- `/workspaces/claude-flow/v3/@claude-flow/integration/tsconfig.tsbuildinfo`+- `/workspaces/claude-flow/v3/@claude-flow/performance/tsconfig.tsbuildinfo`+- `/workspaces/claude-flow/v3/@claude-flow/neural/tsconfig.tsbuildinfo`+- `/workspaces/claude-flow/v3/@claude-flow/shared/tsconfig.tsbuildinfo`++**Total**: 6 files+**Reason**: TypeScript incremental build cache+**Justification**:+- Already covered by `.gitignore` pattern (`*.tsbuildinfo`)+- Automatically regenerated on next build+- Build artifacts, not source code++### 4. Temporary Files (REMOVED β )+**Files Removed**:+- `/workspaces/claude-flow/v3/@claude-flow/shared/src/events/.completed`++**Total**: 1 file+**Reason**: Temporary marker file+**Justification**:+- Appears to be a completion/checkpoint marker+- No code references this file+- Can be safely regenerated if needed++---++## Directories Analyzed but KEPT (with Justification)++### 1. `/workspaces/claude-flow/v3/shared/` (KEPT β)+**Status**: Active - Legacy Compatibility Layer+**Reason for Keeping**:+- Actively imported by `/workspaces/claude-flow/v3/index.ts` (6 import statements)+- Provides backward compatibility for existing code:+ - `./shared/types` - Core type definitions+ - `./shared/events` - Event system exports+- Imported by `/workspaces/claude-flow/v3/swarm.config.ts`+- Serves as compatibility bridge between v2 and v3 architecture++**Evidence**:+```typescript+// From v3/index.ts+export type { AgentId, AgentRole, ... } from './shared/types';+export { V3_PERFORMANCE_TARGETS, success, failure } from './shared/types';+export type { IEventBus, IEventStore, ... } from './shared/events';+export { EventBus, InMemoryEventStore, ... } from './shared/events';+```++### 2. `/workspaces/claude-flow/v3/core/` (KEPT β)+**Status**: Active - Core Architecture Layer+**Reason for Keeping**:+- Actively imported by `/workspaces/claude-flow/v3/index.ts` (5 import statements)+- Provides core interfaces and orchestrator components:+ - `./core/interfaces/` - Core interface definitions+ - `./core/orchestrator/` - Orchestrator implementation+ - `./core/event-bus.js` - Event bus system+ - `./core/config/` - Configuration system+- Essential for v3 architecture, not duplicated by @claude-flow modules++**Evidence**:+```typescript+// From v3/index.ts+export type { ITask, IAgent, ... } from './core/interfaces/index.js';+export { SystemEventTypes } from './core/interfaces/event.interface.js';+export { TaskManager, SessionManager, ... } from './core/orchestrator/index.js';+export { EventBus as EventBusCore, createEventBus } from './core/event-bus.js';+```++### 3. `/workspaces/claude-flow/v3/coordination/` (KEPT β)+**Status**: Active - Coordination Layer+**Reason for Keeping**:+- Actively imported by `/workspaces/claude-flow/v3/index.ts` (7 import statements)+- Provides coordination components:+ - `./coordination/agent-registry` - Agent registry implementation+ - `./coordination/task-orchestrator` - Task orchestration+ - `./coordination/swarm-hub` - Swarm hub (main entry point)+- Used by v3 initialization functions (`initializeV3Swarm`, `getOrCreateSwarm`)++**Evidence**:+```typescript+// From v3/index.ts+export type { IAgentRegistry, ... } from './coordination/agent-registry';+export { AgentRegistry, createAgentRegistry } from './coordination/agent-registry';+export type { ITaskOrchestrator, ... } from './coordination/task-orchestrator';+export { SwarmHub, createSwarmHub, ... } from './coordination/swarm-hub';+```++### 4. `/workspaces/claude-flow/v3/@claude-flow/shared/src/` vs `/workspaces/claude-flow/v3/shared/`+**Relationship**: Complementary, NOT duplicates+**Reason**:+- `@claude-flow/shared/src/` - New modular architecture with extended functionality+ - Contains additional modules: `core/`, `events/`, `mcp/`, `plugin-*`+ - More comprehensive type system+ - Part of the @claude-flow module constellation+- `v3/shared/` - Backward compatibility layer+ - Minimal subset for legacy code+ - Simpler structure: just `types.ts` and `events.ts`+ - Required for gradual migration++**Evidence from diff**:+```+Only in @claude-flow/shared/src/: core+Only in @claude-flow/shared/src/: events (directory)+Only in @claude-flow/shared/src/: mcp+Only in @claude-flow/shared/src/: plugin-interface.ts+Files differ: shared/events.ts vs @claude-flow/shared/src/events.ts+```++---++## Architecture Analysis++### Current V3 Structure (Post-Cleanup)+```+v3/+βββ @claude-flow/ # New modular architecture (10 modules)+β βββ security/ # Security fixes (CVE-1, CVE-2, CVE-3)+β βββ memory/ # AgentDB unification+β βββ swarm/ # 15-agent coordination+β βββ integration/ # agentic-flow@alpha integration+β βββ shared/ # Extended shared utilities+β βββ cli/ # CLI modernization+β βββ neural/ # SONA learning+β βββ performance/ # Benchmarking+β βββ testing/ # TDD framework+β βββ deployment/ # Release management+β+βββ shared/ # Legacy compatibility layer (KEPT)+βββ core/ # Core architecture (KEPT)+βββ coordination/ # Coordination layer (KEPT)+βββ types/ # Extended type definitions+βββ mcp/ # MCP server implementation+βββ implementation/ # Implementation examples+βββ helpers/ # Utility helpers+βββ __tests__/ # Test suite+βββ index.ts # Main entry point (uses all above)+```++### Dual Architecture Pattern+The v3 codebase follows a **dual architecture pattern**:++1. **@claude-flow Modules** (New)+ - Modular, domain-driven design (ADR-002)+ - Plugin-based architecture (ADR-004)+ - Independent, publishable packages+ - Used via imports like: `import { X } from '@claude-flow/security'`++2. **Legacy Compatibility Layers** (Kept for Migration)+ - `v3/shared/`, `v3/core/`, `v3/coordination/`+ - Provide backward compatibility+ - Allow gradual migration from v2 to v3+ - Used via imports like: `import { X } from './shared/types'`++This pattern is **intentional** and documented in the main `index.ts` comment:+```typescript+// =============================================================================+// Legacy Compatibility Layer (Gradual Migration Support)+// =============================================================================+```++---++## Statistics++### Space Saved+- **Total**: ~1.63 MB+ - `ruvector.db`: 1.55 MB+ - `hooks/`: ~72 KB+ - `.tsbuildinfo` files: ~8 KB+ - `.completed` files: <1 KB++### Files Removed+- **Directories**: 1 (`hooks/`)+- **Database files**: 1 (`ruvector.db`)+- **Build artifacts**: 6 (`.tsbuildinfo`)+- **Temp files**: 1 (`.completed`)+- **Total**: 9 items++### Directories Preserved+- **@claude-flow modules**: 10 directories (new architecture)+- **Legacy compatibility**: 3 directories (`shared/`, `core/`, `coordination/`)+- **Supporting directories**: 6 (`types/`, `mcp/`, `implementation/`, `helpers/`, `__tests__/`, `docs/`)++---++## Recommendations++### Immediate Actions+1. β **DONE**: Remove unused `hooks/` directory+2. β **DONE**: Clean up build artifacts (`.tsbuildinfo`)+3. β **DONE**: Remove temporary files (`.completed`)+4. β **DONE**: Delete runtime database (`ruvector.db`)++### Future Cleanup (Not Done Yet)+These directories appear to have duplicates with @claude-flow modules but are **actively used** for backward compatibility. Consider these actions for future cleanup:++1. **Gradual Migration Path** (Recommended)+ - Create migration guide for users to switch from `./shared/types` to `@claude-flow/shared`+ - Add deprecation warnings to legacy exports+ - Track usage metrics of legacy imports+ - Remove legacy layers in v4.0.0 (major version bump)++2. **Documentation Update**+ - Document the dual architecture pattern in `ARCHITECTURE.md`+ - Explain when to use `@claude-flow/*` vs `./shared/*`+ - Provide migration examples++3. **Add `.gitignore` entries** (if not present)+ - Ensure `*.db`, `*.tsbuildinfo`, `.completed` patterns are covered+ - **Note**: Already verified in root `.gitignore`++### Not Recommended (Would Break Compatibility)+- β DO NOT remove `v3/shared/` - actively imported by `index.ts` and `swarm.config.ts`+- β DO NOT remove `v3/core/` - core architecture, not duplicated+- β DO NOT remove `v3/coordination/` - required for swarm initialization++---++## Verification Commands++### Verify No Broken Imports+```bash+# Search for hooks imports (should return nothing)+grep -r "from.*['\"]\.\.*/hooks['\"]" v3/ --include="*.ts" --exclude-dir=node_modules++# Search for ruvector.db references (should only show .gitignore)+grep -r "ruvector\.db" /workspaces/claude-flow --exclude-dir=node_modules++# Verify build artifacts are regenerated on next build+npm run build+```++### Verify Legacy Imports Still Work+```bash+# Should find 6 imports from ./shared/+grep "from '\./shared" v3/index.ts | wc -l++# Should find 5 imports from ./core/+grep "from '\./core" v3/index.ts | wc -l++# Should find 7 imports from ./coordination/+grep "from '\./coordination" v3/index.ts | wc -l+```++---++## Conclusion++Successfully cleaned up **1.63 MB** of dead code and temporary files while preserving the intentional dual architecture pattern. The cleanup focused on:++1. **Dead Code**: Removed unused `hooks/` directory with no active imports+2. **Build Artifacts**: Removed `.tsbuildinfo` files (regenerated on build)+3. **Temporary Files**: Removed `.completed` marker files+4. **Runtime Data**: Removed `ruvector.db` cache database (gitignored, regenerated)++**Preserved** essential backward compatibility layers (`shared/`, `core/`, `coordination/`) that are actively imported and serve a critical role in the v2βv3 migration path.++The v3 architecture is now cleaner and follows the documented **Module Constellation Architecture** with a clear separation between:+- New modular @claude-flow packages+- Legacy compatibility layers for gradual migration++**Status**: β Cleanup Complete - No Breaking Changes