-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
PR review and issue triage are bolted onto webhook.py as ad-hoc if-branches with hardcoded patterns (cooldown, fire-and-forget, send-message). They run as isolated one-shot claude --print subprocesses with no workspace, no history, and no way for the user or Claude to interact with them. Adding similar capabilities (CI watcher, deploy manager, release manager) means copying patterns and adding more if-branches.
Proposal
Introduce a module system — a standard framework for autonomous programs that live alongside the agent.
A module:
- Does its own work reactively (webhook) or on schedule
- Keeps a journal in its own directory (
modules/{name}/events/) - Has isolated history separate from main chat (
history/{chat_id}/{module}/) - Can notify the user via Telegram (topic per module)
- Can be managed by Claude via HTTP API (
/api/modules/{name}/invoke) - Can ask the user for input via checkpoint/resume pattern (no hanging processes)
Module interface
async def handle(ctx: ModuleContext) -> ModuleResult:
# Module receives context (trigger data, config, saved state)
# Returns done (with journal entry), paused (with question), or errorKai manages the lifecycle: trigger matching, context building, state serialization, resume dispatch, journal writes, notifications.
Key design decisions
- Modules are stateless processes — run, do work, exit. State serialized to disk between runs (serverless-style checkpoint/resume)
- Claude is a helper, not orchestrator — module does the actual work, calls
claude --printonly when it needs reasoning or to formulate a question - File-based journal — Claude in the main session reads module journals directly from filesystem
- Registry-based dispatch replaces if-branches —
module.yamlmanifests declare triggers
User interaction
- Quick queries without context switch: "what happened in pr-review?" (Claude reads events/)
- Deep work via
/module pr-review(context switch analogous to/workspace) - Module questions via pending/ directory + Telegram notification
Migration path
- Extract pr-review into module with manifest and journal
- Extract issue-triage the same way
- Replace if-branches in webhook.py with registry dispatch
- Add
/modulecommand to bot.py - Add module summary to Claude session context injection
Full proposal: PROPOSAL-modules.md in repo root
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request