DevFlow Cognitive Task+Memory System - Project Context
Documents a TypeScript cognitive framework with hierarchical task management, SQLite-based persistent memory, and multi-platform AI orchestration.
What this file does
Documents a TypeScript cognitive framework with hierarchical task management, SQLite-based persistent memory, and multi-platform AI orchestration.
When to use it
- Building a development state manager that persists context across AI sessions
- Implementing semantic search with hybrid vector and keyword ranking
- Orchestrating tasks across multiple AI platforms like Claude Code and OpenAI Codex
- Designing an event-driven cognitive system with modular architecture
Assumes this stack
DevFlow Cognitive Task+Memory System - Project Context
Project Overview
DevFlow is a sophisticated cognitive computing framework built with TypeScript that provides intelligent task management and persistent memory systems. The project implements a structured approach to handling cognitive workloads with built-in memory persistence, semantic search capabilities, and multi-platform AI orchestration.
The system is designed to be a "Universal Development State Manager" that eliminates AI tools "digital amnesia" through persistent memory and intelligent coordination between different AI platforms including Claude Code, OpenAI Codex, Gemini CLI, and Cursor.
Core Architecture
Main Components
- Task Management System - Hierarchical task management with priority queuing
- Persistent Memory System - SQLite-based storage with TTL support and vector embeddings
- Semantic Search Engine - Hybrid vector and keyword search capabilities
- Multi-Platform Orchestration - Intelligent routing between AI platforms
- Event-Driven Architecture - Comprehensive event system for monitoring and extension
Key Directories
devflow/
├── src/ # Main source code
│ ├── cognitive/ # Core cognitive system components
│ ├── core/ # Core system modules
│ │ ├── database/ # Database schema and connection management
│ │ ├── orchestration/ # Multi-agent routing and delegation
│ │ ├── semantic-memory/ # Vector embeddings and semantic search
│ │ ├── task-hierarchy/ # Task management system
│ │ └── embeddings/ # Embedding model integrations
│ ├── test/ # Test suites and integration tests
│ └── utils/ # Utility functions
├── packages/ # Monorepo packages for modular components
├── mcp-servers/ # Model Context Protocol server implementations
├── docs/ # Documentation and guides
├── configs/ # Configuration files
└── scripts/ # Utility scripts
Key Technologies
- TypeScript - Primary language with full type safety
- Node.js - Runtime environment
- SQLite - Primary database for persistence
- Vector Embeddings - Semantic search capabilities
- Model Context Protocol (MCP) - Standardized AI tool integration
- Jest - Testing framework
Building and Running
Prerequisites
- Node.js 14+
- npm 6+
- TypeScript 4.5+
Installation
npm install
Building
npm run build
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run integration tests
npm run test:integration
# Generate coverage report
npm run test:coverage
Development Commands
# Development with watch mode
npm run dev
Development Conventions
Code Structure
- TypeScript Native - Full type safety and modern ES2020 features
- Modular Architecture - Clear separation of concerns
- Event-Driven - Extensible through event system
- Test-First - Comprehensive test coverage expected
Configuration
The system uses a flexible configuration approach:
interface SystemConfig {
debug: boolean; // Enable debug logging
memoryLimit: number; // Maximum memory entries
taskTimeout: number; // Task execution timeout (ms)
}
Core Classes
-
DevFlowSystem - Main system class
- Manages task creation and execution
- Handles memory storage and retrieval
- Provides event system for extensions
-
TaskHierarchyService - Task management
- Hierarchical task organization
- Status tracking and prioritization
- SQLite persistence
-
SemanticMemoryService - Semantic search
- Vector embedding generation and storage
- Similarity search between tasks
- Integration with embedding models
-
AgentClassificationEngine - Multi-platform orchestration
- Intelligent task routing to appropriate AI agents
- Usage monitoring and session limit prevention
- Delegation hierarchy (Sonnet → Codex → Gemini → Synthetic)
Database Schema
The system uses SQLite with a comprehensive schema including:
- task_contexts - Hierarchical task management
- memory_blocks - Content storage with metadata
- memory_block_embeddings - Vector embeddings for semantic search
- coordination_sessions - Cross-platform session tracking
- platform_performance - Performance metrics tracking
- knowledge_entities - Semantic knowledge graph
- entity_relationships - Knowledge entity relationships
Semantic Search Capabilities
The system implements hybrid semantic search with:
- Vector Similarity Search - Cosine similarity between embeddings
- Keyword Search - Traditional text-based search
- Hybrid Ranking - Combined vector and keyword scoring
- Multiple Embedding Models - Support for different embedding providers
Currently supports:
- Mock embedding models for testing
- Ollama integration with EmbeddingGemma (768 dimensions)
- OpenAI embedding models (1536+ dimensions)
Multi-Platform Orchestration
DevFlow implements intelligent routing between AI platforms:
- Claude Code (Sonnet) - Architecture design and complex reasoning
- OpenAI Codex - Code generation and implementation
- Gemini CLI - Debugging and testing
- Synthetic - Routine tasks and basic coding
The system monitors usage patterns and automatically delegates tasks to prevent session limits while optimizing for platform specializations.
Current Status
The project is in an advanced development phase with:
- ✅ Core system architecture implemented
- ✅ Task management subsystem complete
- ✅ Memory persistence layer functional
- ✅ Event system implementation complete
- ✅ Semantic search with vector embeddings
- ✅ Multi-platform orchestration engine
- ✅ Database schema with comprehensive indexing
- ✅ Integration tests for core functionality
Key Files for Understanding the System
src/index.ts- Main entry point and core DevFlowSystem classsrc/core/database/devflow-database.ts- Database schema and connection managementsrc/core/task-hierarchy/task-hierarchy-service.ts- Task management implementationsrc/core/semantic-memory/semantic-memory-service.ts- Semantic search and embeddingssrc/core/orchestration/agent-routing-engine.ts- Multi-platform routing logicsrc/test/smoke-test-semantic-memory.ts- Integration testing examples
Integration with Claude Code
The system provides full integration with Claude Code sessions through:
- MCP Tools - Custom tools for search, handoff, and memory management
- Context Injection - Automatic injection of relevant context at session start
- Memory Capture - Automatic capture of architectural decisions
- Platform Handoff - Seamless transition between AI platforms
Performance Targets
- Context Injection: <500ms
- Memory Capture: >95% success rate
- Handoff Success: >90% success rate
- Token Reduction: 30%+
- Vector Search: Sub-second response times
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a pull request
The project follows standard TypeScript development practices with comprehensive testing and type safety.
Qwen Added Memories
- Il progetto DevFlow è un sistema cognitivo per la gestione di task e memoria, con focus su TypeScript e Node.js. Utilizza un database SQLite per la persistenza e implementa un sistema di orchestrazione multi-piattaforma con Claude Code, OpenAI Codex, Google Gemini e agenti Synthetic. Il sistema è in fase di refoundation per risolvere problemi di degradazione architetturale.
- L'obiettivo principale del lavoro corrente è risolvere gli errori di compilazione TypeScript nel progetto DevFlow, completare l'implementazione dei moduli mancanti, eseguire test per verificare la funzionalità dei componenti e aggiornare le dipendenze mancanti. Il focus è su un approccio graduale e controllato per far funzionare il sistema senza modificarne la funzionalità.
What's inside
7 major sections: overview, architecture, technologies, build commands, conventions, schema, and status. 6 core classes listed.
Change this for your project
- Replace
fulvian/devflowwith your own repository name - Replace
src/core/database/devflow-database.tswith your own database module path - Replace
src/core/orchestration/agent-routing-engine.tswith your own routing logic path - Replace
src/test/smoke-test-semantic-memory.tswith your own test file path
Where it goes
Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.
Worth borrowing
- Hybrid ranking that combines cosine similarity with keyword scoring for search results
- Delegation hierarchy (Sonnet → Codex → Gemini → Synthetic) to prevent session limits
- Event-driven architecture with MCP tools for context injection and memory capture
Related Documents
Design Document: BharatSeva AI
Describes a 10-agent AWS system that helps India's informal workers access government schemes via voice-first, serverless architecture.
OpenClaw Enterprise Transformation Plan
Transforms a single-user AI agent into a dual-mode platform supporting both viral open-source and Fortune 500 enterprise deployments through phased security, IAM, audit, multi-tenancy, and Kubernetes features.
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Documents the Qwen-Image and Qwen-Image-Edit models, covering architecture, training, benchmarks, ComfyUI setup, and prompting techniques for local GGUF deployment.
Qwen3-TTS — Model Reference
Documents the architecture, weights, tokenizer, and inference algorithm for implementing Qwen3-TTS from scratch.