Skip to content

embedded memory gap re-brand#2

Open
mikeajijola wants to merge 30 commits into
devfrom
dev
Open

embedded memory gap re-brand#2
mikeajijola wants to merge 30 commits into
devfrom
dev

Conversation

@mikeajijola
Copy link
Copy Markdown

No description provided.

robot-rubik and others added 30 commits March 25, 2026 09:48
- Add axum 0.8 HTTP API with POST /v1/message, GET /v1/health,
  GET /v1/sessions/:user_id, GET /v1/stats
- Add identity layer: maps (channel, external_id) to internal user IDs
- Add session manager: one active session per (user_id, channel)
- Add 'serve' CLI subcommand to start the API server
- Rebrand binary to omni-cede, update Cargo.toml with new deps
- Auth via x-api-key header (optional, dev mode when API_KEY unset)
- tracing-subscriber for HTTP request logging
- All 28 tests pass
Merge dev into master: API, identity, sessions, agents.md, claude.md, README
…and adapters

Phase 1-3 implementation of the omnichannel integration plan:

- Channel trait: async_trait-based contract every adapter implements
  (id, display_name, start, stop, send, health + optional typing/edit/media)
- ChannelRegistry: manages lifecycle, start_all/stop_all, health_all, routing
- Pipeline: unified inbound/outbound message processing
  (normalise -> identity -> session -> hooks -> agent -> outbound -> chunking)
- Hooks system: ChannelHook trait with before_agent, after_agent, before_send,
  after_send lifecycle interception points. Built-in TracingHook included.
- Types: InboundEnvelope, OutboundTarget, OutboundMessage, MediaPayload,
  ChannelHealth, ChannelContext, PipelineResult
- Webhook adapter: passive channel for generic JSON POST integrations
- Telegram adapter: polling + webhook modes via Bot API (reqwest-based)
- Discord adapter: REST-only with health heartbeat (serenity gateway in future)
- WebChat adapter: WebSocket chat state management for the built-in web UI
- Error variants: Channel, Unsupported, Pipeline added to CortexError
- API refactored: handle_message now routes through Pipeline.process_sync(),
  new /v1/channels/webhook/inbound and GET /v1/channels endpoints
- CLI updated: serve command now initializes registry + pipeline + all adapters
- 31 tests passing (9 unit including 3 new chunking tests + 22 integration)
- start_all now skips channels that fail (no token = skip, not crash)
- Pipeline inbound loop spawned on startup to process Telegram messages
- Channel configs auto-detected from env vars (TELEGRAM_BOT_TOKEN, etc.)
- Discord gracefully skipped when DISCORD_BOT_TOKEN not set
feat: omnichannel system + embedded memory graph docs
- New 'bash' tool for host command execution via /bin/sh or cmd /C
- Async with timeout, output truncation, blocked command safety patterns
- Config fields: bash_enabled, bash_timeout_secs, bash_max_output_bytes, bash_blocked_patterns
feat: add bash/shell execution tool
…d tasks

- Remove SubAgent/Delegation/Synthesis node kinds, add BackgroundTask
- Delete agent/subagent.rs and SubAgentSpec/SubAgentResult types
- Replace sequential tool execution with JoinSet-based parallel execution
- Replace delegate tool with spawn_task (non-blocking background agent loops)
- Add get_handler() and record_tool_call() to ToolRegistry
- Update TUI/viz categories from Sub-Agents to Tasks
- Update integration tests for new architecture
refactor: parallel tool execution + background tasks
- WebChat WebSocket: add /v1/ws/chat endpoint with auth via query param,
  connection limits, typing indicators, and full pipeline integration
- Discord polling: implement REST-based DM and guild channel message
  polling with bot self-filtering and last-seen tracking
- Tool validation: add jsonschema-based input validation before tool
  execution in both sequential and parallel paths
- Ollama tools: implement complete_with_tools() with tool call parsing
  from Ollama's function calling response format, fix Role::Tool mapping
- Soul editing: implement interactive CLI editor with $EDITOR support
  and inline fallback, including DB update and re-embedding
- README: correct test count from 28 to 22

https://claude.ai/code/session_015h3ze5iDD5wH27Bizmh1RW
…atui framework

- Add SoulEdit focus mode to graph TUI with Ctrl+S save, Esc cancel,
  and multiline editing via Enter for newlines
- Add run_with_edit() async entry point for soul edit without needing
  an LLM/agent — provides DB + embed + HNSW for saving and re-embedding
- Wire 'e' key binding in graph mode to open edit modal on identity nodes
  (Soul, Belief, Goal only)
- Update run_with_chat() to accept embed/hnsw for edit saves during
  graph explore sessions
- Draw modal overlay with title, content area, and help bar

https://claude.ai/code/session_015h3ze5iDD5wH27Bizmh1RW
When no Soul/Belief/Goal nodes are found via HNSW search, the system
prompt now includes a minimal identity section that tells the agent:
- Its name (Omni-Cede)
- It has a remember tool for storing identity/knowledge
- To use Soul/Belief/Goal node kinds for identity
- Basic personality direction

This bootstraps the chicken-and-egg problem: the agent needs identity
to know what to remember, but needs to remember to have identity.
Once it creates nodes via remember (which embeds automatically), they
surface through HNSW in future conversations and this fallback stops.
Instead of telling the agent who it is and how to behave, the first
contact prompt now asks the agent to learn from the user — who they
are, what role they want the agent to play — and build its own identity
through conversation using the remember tool.
fix: close 6 implementation gaps identified in codebase audit
Three major features implemented:

1. Proactive Cron/Heartbeats
   - src/scheduler.rs: background cron scheduler (30s tick)
   - Agent tools: schedule_cron, delete_cron, list_crons
   - CronJob + CronExecution NodeKind variants
   - Wired into start_background_tasks()

2. Dynamic Skills/Plugins
   - Agent tools: create_skill, delete_skill
   - Persisted skill loader: Skill nodes become skill_{name} tools at startup
   - Skill NodeKind variant (decay_rate 0.0, importance 0.8)

3. Browser Module (feature-gated: --features browser)
   - src/browser/cdp.rs: CDP WebSocket client with Chrome auto-detection
   - src/browser/snapshot.rs: compact DOM extraction (<=300 elements)
   - src/browser/stealth.rs: anti-detection flags + JS patches
   - src/browser/webmcp.rs: WebMCP discovery + invocation
   - src/browser/store.rs: stored tool definitions with step execution
   - src/browser/workflow.rs: multi-step workflow engine
   - src/browser/tools.rs: 10 agent tools (launch, navigate, snapshot,
     click, fill, screenshot, evaluate, wait, close, webmcp)

Architecture:
- Split builtin_registry into sync core + async wrapper for Send safety
- All new node kinds follow graph-centric patterns (decay, importance, edges)
- 22/22 tests passing, 0 warnings on both default and browser profiles
feat: cron scheduler, dynamic skills, and browser module
…efing

Part A — Channel Awareness:
- Add TurnContext struct (channel, sender_name, user_id, is_group)
- Pass TurnContext through pipeline → run_turn → briefing
- Briefing includes '## Current conversation' with channel/sender context
- CLI and TUI pass local TurnContext

Part B — Background Notifications:
- Add notifications table + index to schema
- Add Notification struct and insert/get/mark_delivered queries
- Background spawn writes notification on success, failure, or panic
- run_turn prepends '## Updates while you were away' from pending notifications
- Replace silent 'let _ =' with logged error handling on DB writes

Part C — Human-Friendly Briefing:
- Rewrite format_context_doc: drop [kind] tags, numeric scores, raw node IDs
- Contradictions show titles instead of IDs
- Clean node titles: 'Used X', 'Output from X', 'Working on: X', 'Finished: X'
- Scheduler titles: 'Ran scheduled task: X', 'Result of scheduled task: X'
- Natural-language immediate reply and iteration-limit messages
- Add briefing_max_nodes to Config (default 16), replacing hardcoded values

0 errors, 0 new warnings, 22/22 tests pass.
…operational node titles

- Replace separate notifications table with NodeKind::Notification graph nodes
- Delivery tracking via access_count (0 = undelivered, touch_nodes marks delivered)
- Delete Notification struct, insert_notification, get_pending_notifications, mark_notifications_delivered
- Add get_pending_notification_nodes query (joins nodes+edges by session)
- Orchestrator writes Notification nodes linked to session via PartOf edge
- Notification -> background task linked via DerivesFrom edge
- Add timestamp [YYYY-MM-DD HH:MM:SS UTC] prefix to:
  ToolCall, tool output Fact, BackgroundTask start, LoopIteration,
  CronExecution, cron result Fact, Notification node titles
- Add Notification arms to graph_viz.rs and graph_tui.rs color/category matches
- Add server_debug.log to .gitignore
- 0 errors, 0 warnings, 22/22 tests pass
- Replace hardcoded 'Working on this in the background' with LLM's own natural acknowledgment text
- Add system prompt instruction telling agent to include brief tool-use acknowledgments
- Add notification_delivery module: timer-based loop (10s) that detects undelivered Notification nodes, runs a brief LLM call to formulate a natural update, and pushes it to the user's channel proactively
- Add get_external_id() to identity module for resolving outbound routing from session data
- Add get_sessions_with_pending_notifications() query joining managed_sessions with notification nodes
- Add CortexEmbedded::shutdown_rx() for sharing shutdown signal with new background tasks
- Wire notification delivery loop into serve startup alongside pipeline inbound loop
- Add Message::user_with_image() for Anthropic vision content blocks
- Agent::run_turn() now accepts optional MediaPayload
- Pipeline forwards envelope.media to agent
- Telegram: parse photo array, download via getFile, populate MediaPayload
- Discord: parse attachments, download image URLs, populate MediaPayload
- base64 crate promoted to non-optional dependency
- LLM layer already handles content_blocks pass-through (no changes needed)
…dies

- LLM can respond [SKIP] when notification content isn't worth delivering
- Fetch full BackgroundTask node bodies via DerivesFrom edges for richer context
- Mark skipped notifications as delivered so they don't retry forever
- Fixes hollow 'something completed but no details' messages
- run() max iterations: LLM summarises what it accomplished with full context
- run_turn() empty tool-use text: LLM generates natural ack with full briefing
- background_tool_loop() max iterations: LLM wraps up with tool result context
- Panic notification: includes actual error for delivery LLM to work with

All 4 user-facing hardcoded strings now go through the LLM with proper
briefing context, so responses stay in character and are context-aware.
- Add user_id/channel to CronJobMeta (serde default for backward compat)
- schedule_cron looks up active session owner from managed_sessions
- fire_cron_job creates Notification node in user's session after execution
- Notification delivery loop picks up cron results and sends to correct channel
The notification delivery loop was firing LLM calls with zero awareness
of the ongoing conversation, causing double-messages that repeated what
the agent already told the user.

Now feeds the last 10 session nodes (user messages, tool calls, background
tasks) into the notification delivery prompt so the LLM can:
- [SKIP] when the user already knows the result
- Blend naturally into the current conversation tone
- Stop parroting things already discussed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants