Architectural comparison and structural mapping between Red-DiscordBot (Python chatbot) and OMP (TypeScript terminal AI agent).
1. π Quick Start Configuration
Red-DiscordBot (Cog Extension)
# ssot_cog.py
from redbot.core import commands
class SSOTExtension(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def ping(self, ctx):
await ctx.send("Pong!")OMP (Oh My Pi Extension)
// index.ts
import { OmpExtensionAPI } from "./types"
export default function myExtension(pi: OmpExtensionAPI) {
pi.registerTool({
name: "ping",
label: "Ping Tool",
description: "Returns pong response",
parameters: {},
execute: async () => "Pong!",
})
}2. π§ Modular Mapping Matrix
| Architectural Layer | Red-DiscordBot | OMP (Oh My Pi) / omp.sh |
|---|---|---|
| Core Runtime | Python-based Discord client (discord.py). | TypeScript/Rust terminal-first agent harness. |
| Extension Unit | Cog: Python class dynamically loaded/unloaded via Redβs command line. | Extension: Host-side TS/JS module loaded via jiti utilizing the ExtensionAPI. |
| Package / Plugin | Downloader Repo: GitHub repository containing a bundle of cogs with info.json manifests. | Plugin: Node-module packages managed in ~/.omp/plugins/ declared via package.json "pi" manifest. |
| Functional Tool | Commands: Python methods decorated with @commands.command() or @commands.hybrid_command(). | Tools: TypeScript functions registered via pi.registerTool and exposed to the LLM agent. |
| System Instruction | Handled via hardcoded python docstrings or embed responses. | Skill: Declarative Markdown instructions (SKILL.md) dynamically injected into LLM prompt contexts. |
| Constraints | Permissions/checks (@commands.admin_or_permissions). | Rules: L2 Hard Rules (memory database) and file-based Domain Rules. |
| Configuration | Red Config database (JSON-backed schema storage). | Profiles: Agent Profiles (personas/vibe) and Project Profiles (CWD-scoped boundary maps). |
| Work Unit | Background tasks.loop or asyncio.create_task. | Tasks: todo checklists and parallel subagent assignments via task tools. |
3. π¦ Packaging and Discovery Standards
Red-DiscordBot info.json
To publish a Cog, define package metadata at the root of the cog folder:
{
"author": ["Developer Name"],
"install_msg": "Cog successfully installed. Run [p]slash sync to configure slash commands.",
"short": "Embed generator with persistent session editor.",
"min_bot_version": "3.5.0",
"requirements": ["discord.py>=2.6"],
"end_user_data_statement": "This cog stores session settings and author IDs locally in Red Config."
}OMP / pi.dev package.json
To distribute an OMP extension, configure the "pi" manifest properties in npm packages:
{
"name": "pi-extension",
"version": "1.0.0",
"keywords": ["pi-package"],
"pi": {
"extensions": ["./index.ts"],
"skills": ["./skills"]
}
}4. π‘ Best Practices
- Venv Isolation: Keep Red-DiscordBot and OMP runtimes in separate virtual environments or node modules. Dependency namespaces must never overlap.
- State Restoring: Register persistent Views in Redβs
cog_load()and register tools/lifecycle events in OMPβssession_starthooks. This ensures zero data loss on reboots. - Memory Partitions: In Red, partition config variables using
Config.get_conf(self, identifier=<unique_int>). In OMP, partition memories using Project Profiles resolved from the active workspace directory.
5. π¨ Gotchas / Traps
- Dependency Clash: Installing other discord libraries in Redβs venv breaks the bot instantly.
- Precedence Trap: In OMP, programmatic settings inside
config.jsonoverride config values fromconfig.yml. - Unloaded Tasks: Unhandled background loops in Red or hanging event listeners in OMP create zombie processes. Always run cleanup logic in
cog_unload()orsession_shutdown()hooks.
6. π Verification Checklist
- Step 0: Verify Python version (Redbot min 3.11) and Node version (OMP min v22).
- Step 1: Verify the active library version using
pip show discord.py. - Step 2: Test local package load commands (
[p]cog loadfor Red,pi -e ./pathfor OMP). - Step 3: Validate manifest files (
info.jsonfor Red,package.jsonfor OMP). - Step 4: Run integration checks to ensure extensions auto-restore states on process restarts.