Archimedes 3.0: a personal-assistant application with Discord as a channel#26
Closed
HiLleywyn wants to merge 1 commit into
Closed
Archimedes 3.0: a personal-assistant application with Discord as a channel#26HiLleywyn wants to merge 1 commit into
HiLleywyn wants to merge 1 commit into
Conversation
Lift the agent out of the Discord cog into a coherent personal-assistant
application (arch/) and re-wire Discord as a pluggable channel
(channels/) following the same session-keyed routing pattern documented
in the OpenClaw channels reference.
New application layer (arch/):
- Soul: editable system prompt with named presets (default, short,
tutor, creative, expert), persisted in archimedes_soul.
- Heartbeat: optional autonomous self-check loop with active-hours
window, configurable interval, and a recent-activity log
(archimedes_heartbeat_log).
- Scheduler: durable cron and oneshot tasks, surviving restarts
(archimedes_scheduled_tasks). Includes a small no-dependency cron
evaluator and a liberal "in N units" parser.
- MCP: streamable HTTP and stdio Model Context Protocol client with
discovery, registry and persistence (archimedes_mcp_servers).
- Service Chain: ordered model providers with per-provider circuit
breakers and explicit fallback semantics.
- Dynamic UI: channel-agnostic Card, Section, StatTile, Button and
Suggestion primitives, plus a plaintext renderer for transports
that cannot render structure.
- Memories: verb-named facade over ai.memory.MemoryService.
- Built-in tools: arch.time, arch.location, arch.fetch_url,
arch.open_url -- added to the existing registry without removing
any prior tool.
New channel layer (channels/):
- Channel ABC + NullChannel for tests.
- DiscordChannel wraps ArchimedesBot, applies DM/guild policies,
derives session keys (arch:discord:{dm,channel,thread}:<id>) and
renders ArchResponse as embeds plus interactive views.
- PreviewStreamer for token-by-token edit streaming.
- Pure-logic policy and session-key modules.
Operator surface:
- cogs/arch_app.py adds a focused, owner-only ".app" command group
covering soul, heartbeat, schedule, mcp and services -- every 3.0
feature controllable without leaving Discord.
Existing code preserved:
- cogs/chat, ai/tools and the Node sidecar all keep their place.
- Existing memory, traits, episodes, plugin runtime and conversation
history tables are untouched.
Configuration:
- 12 new ARCHIMEDES_* env vars plus DISCORD_DM_POLICY and
DISCORD_GUILD_POLICY, every one defaulting to a no-op so an
unchanged deployment behaves exactly as 2.x did.
Database:
- Five idempotent CREATE TABLE IF NOT EXISTS additions
(archimedes_soul, archimedes_heartbeat_log, archimedes_scheduled_tasks,
archimedes_mcp_servers, archimedes_settings).
Tests:
- 59 new offline tests covering soul presets, heartbeat windowing,
cron evaluation, oneshot delay parsing, dynamic UI builders, service
chain fallback and circuit-breaker behaviour, MCP spec parsing and
registry bookkeeping, session-key derivation, and the DM/guild
policy evaluator. Full suite passes (237 tests).
Docs:
- docs/architecture.md describes the application and channel layers,
the database additions, and the operator surface.
- README.md leads with the application framing.
Project metadata:
- Version bump to 3.0.0 with a new description that names the
application rather than the bot.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A hard pivot from "Discord bot with AI features" to a personal-assistant application that lives in Discord. The agent is lifted out of the Discord cog into a coherent application layer (
arch/), and Discord becomes a pluggable channel (channels/) following the session-keyed routing pattern from the OpenClaw channels reference. Same agent core could power a web, voice or CLI channel without rewriting any of the assistant logic.Six headline features land as first-class concepts:
Plus four built-in tools (
arch.time,arch.location,arch.fetch_url,arch.open_url) and a focused, owner-only.appcommand group covering every 3.0 feature without leaving Discord.Architecture
arch/-- the application: Soul, Heartbeat, Scheduler, MCP, Memories, Services, Dynamic UI, built-in tools, config.channels/-- the transport abstraction: base Channel, Discord adapter, policy evaluator, session-key derivation, streaming preview, embed renderer.cogs/arch_app.py-- the.appoperator command group.docs/architecture.md-- the full picture.Tests
237 offline tests pass, including 59 new ones covering soul presets, heartbeat windowing, cron evaluation, oneshot delay parsing, dynamic UI builders, service-chain fallback and circuit-breaker behaviour, MCP spec parsing and registry bookkeeping, session-key derivation, and the DM/guild policy evaluator.
Backwards compatibility
Every new env var defaults to a no-op so an unchanged 2.x deployment behaves exactly as before. Existing tables, the Lua plugin runtime, the Node sidecar,
cogs/chat, andai/toolsall keep their place; the application layer wraps them rather than replacing them.Database additions (all idempotent)
archimedes_soul,archimedes_heartbeat_log,archimedes_scheduled_tasks,archimedes_mcp_servers,archimedes_settings.Test plan
pytest tests/-- 237 passed, no failures.python -c "from arch import ArchAgent, Card, ArchResponse, Heartbeat, Scheduler, ServiceChain, SoulStore, MCPRegistry"-- clean.python -c "import channels.discord_channel; import cogs.arch_app"-- clean.ArchConfig.from_env()parses every documentedARCHIMEDES_*andDISCORD_*_POLICYenv var.ServiceChain.from_specscorrectly builds the multi-provider chain from comma-separatedARCHIMEDES_SERVICES._parse_mcphandles HTTP, stdio and rejects unknown schemes silently.Generated by Claude Code