Skip to content

Latest commit

 

History

History
159 lines (137 loc) · 6.79 KB

File metadata and controls

159 lines (137 loc) · 6.79 KB

Daemora-TS — Full Rewrite Plan

Replaces the JS backend at /Users/umarfarooq/Downloads/Personal/p2/src/ Goal: production-ready, single-shot AI agent daemon with best practices


Phase 1: Core Engine — DONE

  • Config system (vault, settings, schema, env)
  • SOUL.md system prompt
  • AgentLoop (streaming, tool execution, multi-step, abort)
  • ModelRouter (provider resolution, no hardcoded fallbacks)
  • SessionStore (SQLite, multi-turn history)
  • MemoryStore (FTS5 BM25 recall, tags)
  • FilesystemGuard (symlink-safe, denylist, command scan)

Phase 2: Tools — DONE

  • Filesystem: read_file, write_file, edit_file, apply_patch, list_directory, glob, grep, create_document
  • Shell: execute_command (guarded)
  • Network: fetch_url, web_search (Brave)
  • Memory: memory_save, memory_recall
  • AI: image_analysis, transcribe_audio, text_to_speech, generate_image
  • System: clipboard, screen_capture, reply_to_user
  • Channel: send_email (Resend)
  • Agent: use_crew, parallel_crew

Phase 3: Crews — DONE

  • CrewLoader (plugin.json validation, tool resolution)
  • CrewRegistry (lookup, summary)
  • CrewAgentRunner (scoped tools, persistent sessions, model inheritance)
  • 16 crew profiles with skills (analyst → ssh-remote)

Phase 4: Providers — DONE

  • Provider catalog (18 providers: LLM + STT + TTS + search)
  • Dynamic model discovery via provider APIs (OpenAI, Anthropic, Google, Groq, Ollama, DeepSeek, Mistral, xAI, OpenRouter, Together, Fireworks, Cerebras)
  • Static fallback when discovery fails
  • Vault schema for all provider keys
  • /api/providers endpoint (one call, full landscape)

Phase 5: Subsystems — DONE

  • CostTracker (per-task token costs, daily limits)
  • AuditLog (append-only, action types, risk levels)
  • CronStore + CronScheduler (expression parser, 30s polling)
  • WatcherStore (CRUD, webhook/poll/file/cron triggers)
  • GoalStore (CRUD, check scheduling, progress tracking)
  • TaskStore (persisted to SQLite, survives restart)
  • 59 skills loaded from disk

Phase 6: MCP + Channels — DONE

  • MCPStore (JSON config persistence)
  • MCPManager (stdio + HTTP transport, tool discovery, JSON-RPC)
  • 22 built-in MCP servers (github, notion, linear, slack, postgres, etc.)
  • ChannelRegistry (19 channels: Telegram → Nostr)
  • Channel routing table (SQLite)

Phase 7: Server + UI — DONE

  • Express server with all routes
  • SSE task streaming (task-based flow matching UI)
  • SPA fallback for client-side routing
  • UI served from ui/dist
  • Compat catch-all for unimplemented endpoints
  • All API response shapes matched to UI expectations

Phase 8: Channel Implementations — TODO

  • BaseChannel abstract class (sendReply, sendTyping, isAllowed, getModel)
  • TelegramChannel (webhook + polling, markdown formatting)
  • DiscordChannel (gateway, slash commands, embeds)
  • SlackChannel (socket mode, blocks, threads)
  • WhatsAppChannel (Twilio webhook)
  • EmailChannel (IMAP polling + SMTP/Resend send)
  • Channel message normalization → task queue → response routing

Phase 9: Teams / Swarm Orchestration — TODO

  • TeamStore (SQLite persistence)
  • TeamRunner (worker DAG, dependency resolution, result passing)
  • createTeam, status, disbandTeam, relaunchProject actions
  • Templates (full-stack, microservices, research)
  • blockedByWorkers dependency chain
  • Auto-inject completed worker results into dependents

Phase 10: Learning System — TODO

  • ExtractionPipeline (auto-extract patterns from completed tasks)
  • SmartRecall (embedding-based semantic search, not just FTS5)
  • MemoryDecay (age-weight older entries, prune irrelevant)
  • BackgroundReviewer (periodic re-evaluation of stored knowledge)
  • LearningStats (track recall hit rates, extraction quality)

Phase 11: MCP Client Hardening — TODO

  • Full MCP protocol compliance (resources, prompts, sampling)
  • Reconnect on server crash
  • Tool invocation end-to-end testing
  • MCP tools registered as agent tools (mcp__server__tool)
  • useMCP(serverName, task) sub-agent delegation

Phase 12: Testing + Quality — TODO

  • Vitest unit tests (config, vault, session, memory, guard, tools)
  • Integration tests (chat flow, crew delegation, SSE streaming)
  • Supertest route tests (all API endpoints)
  • CI pipeline (typecheck + test on push)

Phase 13: Desktop Bundling — STASHED

  • S2: Python sidecar via PyInstaller (spec written, stashed)
  • S3: Bundle livekit-server binary
  • S5: Smoke test .dmg on clean machine
  • S6: GitHub Actions matrix (Mac + Win + Linux)

Phase 14: UI Adaptation — TODO

  • Modify UI source to use /api/providers instead of fragmented endpoints
  • Fix remaining UI crashes (Costs toFixed, Cron Users import)
  • Rebuild UI from source after changes
  • Remove old JS-backend-specific code from UI

Architecture

agents/daemora-ts/
├── SOUL.md                    # Agent personality
├── PLAN.md                    # This file
├── package.json               # Node 22+, ESM
├── tsconfig.json              # Strict mode
├── crew/                      # 16 crew profiles (plugin.json)
├── skills/                    # 59 skill definitions (.md)
├── ui/                        # Full UI source + dist
├── tests/                     # Vitest tests
└── src/                       # 72 TypeScript source files
    ├── cli/                   # CLI entry + commands
    ├── config/                # ConfigManager, vault, settings, schema
    ├── core/                  # AgentLoop
    ├── crew/                  # CrewLoader, Registry, AgentRunner
    ├── cron/                  # CronStore, Scheduler, parser
    ├── costs/                 # CostTracker
    ├── channels/              # ChannelRegistry
    ├── goals/                 # GoalStore
    ├── integrations/          # (future)
    ├── mcp/                   # MCPStore, MCPManager
    ├── memory/                # SessionStore, MemoryStore
    ├── models/                # ModelRouter, discovery, providers catalog
    ├── safety/                # FilesystemGuard, AuditLog
    ├── server/                # Express app + route modules
    ├── skills/                # SkillLoader, SkillRegistry
    ├── tasks/                 # TaskStore
    ├── tools/                 # 23 core tools
    ├── util/                  # errors, logger, result
    └── watchers/              # WatcherStore

Running

cd agents/daemora-ts
npm run dev          # tsx watch + auto-restart
npm run start        # production
npm run typecheck    # tsc --noEmit
npm run test         # vitest