feat: build-zulip-plugin — recursive plugin generation contract

Self-improving contract that generates, validates, and iteratively
improves Hermes platform plugins. Tracks generations in knowledge
graph, learns from past successes and failures, and can update
its own rules as new patterns emerge.
This commit is contained in:
root
2026-06-26 18:39:03 +00:00
parent f340c6301d
commit be15b9c296
+81
View File
@@ -0,0 +1,81 @@
---
kind: responsibility
name: build-zulip-plugin
description: >
Generates and iteratively improves a Hermes Zulip platform plugin.
Each run can produce a new version of the plugin, learning from
previous runs and incrementally improving the adapter code.
The contract itself can be updated to capture new patterns.
---
## Maintains
- plugin_version: string — Current version of the generated plugin
- generation_count: number — How many generations have been produced
- last_generation: timestamp — When the last generation was created
- known_issues: array — Issues discovered in the current version
## Parameters
- zulip_site: string — Zulip server URL (default: "https://chat.sysloggh.net")
- bot_email_prefix: string — Prefix for bot emails (default: "abiba-bot")
- output_dir: string — Where to write the plugin (default: "plugins/platforms/zulip")
- generation_goal: string — What to improve this generation (default: "fix bugs and improve reliability")
## Remembers
Each generation stores:
- What worked well (success patterns)
- What broke (failure modes)
- What the user complained about (pain points)
## Generation Rules
### Rule 1: First Generation
- Generate complete plugin.yaml, adapter.py, __init__.py
- Follow Hermes BasePlatformAdapter pattern
- Include: connect, disconnect, send, edit_message, send_typing
- Include: DM-first routing, @mention detection, @all-bots support
### Rule 2: Subsequent Generations
- Read the previous generation's output and known issues
- Apply improvements based on generation_goal
- Fix any issues from the previous generation
- Add new capabilities if needed
### Rule 3: Testing
- After generating, run syntax check on the Python code
- Verify plugin.yaml is valid YAML
- Log the generation result to knowledge graph
### Rule 4: Self-Improvement
- After N generations, review the contract itself
- If new patterns emerged, update the Generation Rules
- If old rules are no longer relevant, remove them
## Execution
1. **Read state** — Check previous generations from knowledge graph
2. **Generate or improve** — Based on generation count:
- Generation 1: Scaffold full plugin from scratch
- Generation N: Read previous code, apply improvements
3. **Validate** — Syntax check, structure check, dependency check
4. **Log** — Save generation result to knowledge graph as [LEARN]
5. **Report** — Output what was generated, what changed, what needs review
## Example Output
```json
{
"generation": 1,
"version": "1.0.0",
"files_written": [
"plugins/platforms/zulip/plugin.yaml",
"plugins/platforms/zulip/__init__.py",
"plugins/platforms/zulip/adapter.py"
],
"syntax_check": "pass",
"known_issues": [],
"next_generation_goal": "add streaming responses via placeholder->edit pattern"
}
```