p31-cortex
AI Agent Orchestration
The limbic system of the P31 mesh. Six autonomous agents β benefits, finance, grant, legal, content, and kofi β run as Cloudflare Durable Objects with D1 SQLite persistence. Cortex provides proactive decision support without requiring operator availability.
01. Architecture
Each agent is a Cloudflare Durable Object β stateful, addressable, persistent. The Orchestrator DO coordinates multi-agent workflows; individual agents own their own state and lifecycle.
- βΈ BaseAgent class β common lifecycle: wake, process, sleep. Each agent extends BaseAgent and overrides the process method.
-
βΈ
D1 SQLite database β
0001_initial.sqlschema +0002_seed_legal_deadlines.sqlpre-loads critical compliance dates at deploy time. - βΈ Orchestrator DO β coordinates multi-agent workflows, manages agent wake/sleep scheduling, routes inter-agent messages.
-
βΈ
Discord notification pipeline β
src/notify/discord.tsroutes agent outputs to Discord channels via webhook. - βΈ Structured telemetry β all agents emit structured telemetry events consumed by Genesis Gate's governance pipeline.
02. Operational Role
Cortex is the "limbic system" of the P31 mesh β the layer that handles autonomic functions so the operator's cognitive bandwidth is reserved for higher-order decisions. It does not require the operator to be present or even aware of routine operations.
ESG grant window opens April 13, 2026. GrantAgent has this deadline pre-seeded in D1. It will surface preparation requirements, draft summaries, and alert via Discord as the date approaches β without operator prompting.
LegalAgent surfaces 501(c)(3) compliance requirements proactively β annual report deadlines, state registration renewals, and IRS filing windows are pre-loaded from 0002_seed_legal_deadlines.sql.
ContentAgent drafts social content for the Kenosis dispatch pipeline. The content does not post directly β it enters the Kenosis mesh where it is subject to governance hook clearance before dispatch.