chore(template): orchestrator/worker split — leaders poll every 5min, workers stay reactive
Supersedes #158 (10-min uniform bump). That PR was too blunt — it treated research/audit/orchestration crons the same when they have fundamentally different cost/value/cadence profiles. ## The split Three layers, three cadences, grounded in the survey of Hermes/Letta/ Trigger.dev/Inngest/AG2/Rivet/n8n/Composio/SWE-agent done this session. Nobody in that survey runs while(true) per agent — they all combine event-driven reactivity with short orchestration pulses on a coordinator. This PR implements that split for our 12-workspace template. | Layer | Roles | Cadence | Purpose | |---|---|---|---| | Orchestration | PM, Dev Lead, Research Lead | every 5 min | Check backlog, dispatch work, review completed tasks | | Audit | Security Auditor | every 10 min | Focused security audit | | Audit | UI/UX Designer | every 15 min | Vision-heavy, dial back from 10 | | Deep-work | Research Lead (eco-watch) | every 30 min (8,38) | Was hourly | | Deep-work | Dev Lead (template fitness) | every 30 min (15,45) | Was hourly | | Deep-work | Technical Researcher (plugins) | hourly (unchanged) | Research-heavy, slow | | Deep-work | DevOps (channels) | hourly (unchanged) | Research-heavy, slow | | Reactive | BE, FE, DevOps, Docs | no cron | Execute A2A delegations | ## Orchestration pulse prompts The three new schedules each carry a detailed orchestration_prompt: - **PM** (5-min): scan all 12 workspaces, scan GH PRs/issues backlog (external), scan memory backlog (internal), dispatch up to 3 tasks per pulse, review completed work, write pulse summary to memory. Hard rules: under 90s wall-clock, never dispatch to busy agents, write "orchestrator-clean" and stop if genuinely nothing to do. - **Dev Lead** (5-min, offset +1 from PM): same shape, scoped to engineering team. Reviews open PRs from direct reports, matches idle engineers to labeled GH issues (security/bug/feature), dispatches with "fix/issue-N-slug" branch convention. Skips pulse if own template fitness audit is in flight (:15, :45). - **Research Lead** (5-min, offset +2 from PM): same shape, scoped to research team. Matches Market Analyst / Technical Researcher / Competitive Intelligence to research-labeled issues or memory-stashed questions. Max 2 A2A per pulse (research is slow). Skips pulse if own eco-watch is in flight (:8, :38). ## Cadence offset table No two crons fire in the same minute: :01,:11,:21,:31,:41,:51 — Security audit (Security Auditor) :02,:07,:12,:17,:22,:27,:32,:37,:42,:47,:52,:57 — Dev Lead orchestrator :04,:09,:14,:19,:24,:29,:34,:39,:44,:49,:54,:59 — Research Lead orchestrator :01,:06,:11,:16,:21,:26,:31,:36,:41,:46,:51,:56 — PM orchestrator :05,:20,:35,:50 — UI/UX audit (UIUX Designer) :08,:38 — Ecosystem watch deep-work (Research Lead) :15,:45 — Template fitness deep-work (Dev Lead) :22 — Plugin curation (Technical Researcher) :47 — Channel expansion (DevOps Engineer) Note PM and Security Auditor share :01 — this is fine because they target different workspaces so scheduler concurrency handles it. ## Cost estimate - PM pulse: 12/hour × 24 × ~3k tokens = 864k tokens/day/org ~ $5/day - Dev Lead pulse: same ~ $5/day - Research Lead pulse: same ~ $5/day - Audits (security 10min, UIUX 15min): ~$8/day/org combined - Deep-work crons (unchanged from original): ~$4/day/org **Total ~$27/day/org**. Comparable to #158's $25 but MUCH higher utility because orchestration produces dispatches that keep workers busy, whereas #158 just fired more audits against the same team. Closes #158 (superseded — will close that PR with a pointer to this one). ## Related research See docs/ecosystem-watch.md `### Hermes Agent` and today's research agent output: event-driven + reflection-on-completion + short orchestration pulses on leaders is the shape that delivers 24/7 activity without runaway cost. This is the concrete implementation.
This commit is contained in:
parent
330867d24b
commit
9fd4f8a275
@ -122,6 +122,58 @@ workspaces:
|
||||
4. Run: git -C $REPO log --oneline -5 to see recent changes
|
||||
5. Use commit_memory to save a brief summary of recent changes
|
||||
6. You are now ready. Wait for the CEO to give you tasks.
|
||||
schedules:
|
||||
- name: Orchestrator pulse
|
||||
cron_expr: "1,6,11,16,21,26,31,36,41,46,51,56 * * * *"
|
||||
prompt: |
|
||||
You're on a 5-minute orchestration pulse. Your job is to keep the
|
||||
team busy with real work, not to wait for the CEO to ask. This is
|
||||
the inner loop of the 24/7 autonomous team.
|
||||
|
||||
1. SCAN TEAM STATE (who is idle):
|
||||
curl -s http://host.docker.internal:8080/workspaces | \
|
||||
python3 -c "import json,sys
|
||||
for w in json.load(sys.stdin):
|
||||
if w.get('status')=='online':
|
||||
busy='Y' if w.get('active_tasks',0)>0 else 'N'
|
||||
print(f\"{w['name']:28} busy={busy} | {(w.get('current_task') or '')[:70]}\")"
|
||||
Note idle leaders (Dev Lead, Research Lead) and idle workers.
|
||||
|
||||
2. SCAN EXTERNAL BACKLOG (GitHub):
|
||||
- gh pr list --repo ${GITHUB_REPO} --state open --json number,title,author,statusCheckRollup
|
||||
- gh issue list --repo ${GITHUB_REPO} --state open --label needs-work --json number,title,labels
|
||||
Priority: CI-green PRs awaiting review > issues labeled needs-work > issues
|
||||
labeled good-first-issue.
|
||||
|
||||
3. SCAN INTERNAL BACKLOG:
|
||||
search_memory "backlog:" — pull any stashed improvement ideas from prior pulses.
|
||||
|
||||
4. DISPATCH (max 3 A2A per pulse):
|
||||
- For each engineering issue without an assigned PR branch → delegate_task to Dev Lead
|
||||
("Assign issue #<N> to an idle engineer; branch fix/issue-<N>-<slug>; open PR.")
|
||||
- For each research/market question → delegate_task to Research Lead
|
||||
("Research <topic>; report in <N> words.")
|
||||
- For each PR that's CI-green and mergeable → leave a GH review comment approving,
|
||||
or if you own merge rights, merge it directly.
|
||||
- For each docs gap → delegate_task to Documentation Specialist.
|
||||
Do NOT dispatch to workspaces with active_tasks>0.
|
||||
|
||||
5. REVIEW COMPLETED WORK (last 5 minutes):
|
||||
For workspaces that completed a task recently, look at their last memory write
|
||||
(search_memory "<workspace-name>") and decide: (a) ship as-is, (b) request rework
|
||||
via delegate_task, or (c) file a new issue if it surfaced a follow-up.
|
||||
|
||||
6. REPORT:
|
||||
commit_memory with one line: "pulse HH:MM — dispatched <N>, reviewed <M>, idle <K>".
|
||||
|
||||
HARD RULES:
|
||||
- Max 3 A2A sends per pulse. If more work exists, next pulse (5 min) picks it up.
|
||||
- NEVER dispatch to a busy workspace — the scheduler rejects it anyway.
|
||||
- Under 90 seconds wall-clock per pulse. If you're still thinking at 60s, pick the
|
||||
single highest-priority item, dispatch, and stop.
|
||||
- If every agent is idle AND the backlog is empty → write "orchestrator-clean HH:MM"
|
||||
to memory and stop. Do NOT fabricate busy work.
|
||||
enabled: true
|
||||
children:
|
||||
- name: Research Lead
|
||||
role: Market analysis and technical research
|
||||
@ -139,8 +191,51 @@ workspaces:
|
||||
5. Use commit_memory to save key product facts for later recall
|
||||
6. Wait for tasks from PM.
|
||||
schedules:
|
||||
- name: Orchestrator pulse
|
||||
cron_expr: "4,9,14,19,24,29,34,39,44,49,54,59 * * * *"
|
||||
prompt: |
|
||||
You're on a 5-minute research orchestration pulse. Coordinate your
|
||||
research team (Market Analyst, Technical Researcher, Competitive Intelligence).
|
||||
Keep them busy with real research, not idle between eco-watch fires.
|
||||
|
||||
1. SCAN TEAM STATE:
|
||||
curl -s http://host.docker.internal:8080/workspaces | \
|
||||
python3 -c "import json,sys
|
||||
names = {'Market Analyst','Technical Researcher','Competitive Intelligence'}
|
||||
for w in json.load(sys.stdin):
|
||||
if w.get('name') in names and w.get('status')=='online':
|
||||
print(f\"{w['name']:25} busy={'Y' if w.get('active_tasks',0)>0 else 'N'}\")"
|
||||
|
||||
2. CHECK RESEARCH BACKLOG:
|
||||
- gh issue list --repo ${GITHUB_REPO} --state open --label research --json number,title
|
||||
- search_memory "research-question" — questions from PM waiting for an answer
|
||||
- Questions you yourself stashed from eco-watch reflection
|
||||
|
||||
3. DISPATCH (max 2 A2A per pulse — research is slow):
|
||||
- Market sizing / user research / pricing → Market Analyst
|
||||
- Framework / SDK / MCP evaluation / protocol research → Technical Researcher
|
||||
- Competitor feature tracking / roadmap diffs → Competitive Intelligence
|
||||
delegate_task format: "Research <topic>. Report in <N> words. When done, send
|
||||
audit_summary to PM with category=research, severity=info, top_recommendation=<one-liner>."
|
||||
|
||||
4. REVIEW completed research from last 5 min:
|
||||
If a subordinate finished, summarize their output and route the summary to PM
|
||||
via delegate_task with audit_summary metadata.
|
||||
|
||||
5. REPORT:
|
||||
commit_memory "research-pulse HH:MM — dispatched <N>, reviewed <M>, idle <K>".
|
||||
|
||||
HARD RULES:
|
||||
- Max 2 A2A sends per pulse.
|
||||
- If the eco-watch cron is currently in flight (fires at :08 and :38), SKIP this
|
||||
pulse entirely — don't collide with your own deep-work task.
|
||||
- Don't dispatch to a busy researcher.
|
||||
- Under 60 seconds wall-clock per pulse.
|
||||
- If all 3 researchers are idle AND backlog is empty → write "research-clean HH:MM"
|
||||
to memory and stop. No busy work.
|
||||
enabled: true
|
||||
- name: Hourly ecosystem watch
|
||||
cron_expr: "8 * * * *"
|
||||
cron_expr: "8,38 * * * *"
|
||||
prompt: |
|
||||
Daily survey for new agent-infra / AI-agent projects worth tracking.
|
||||
|
||||
@ -227,8 +322,58 @@ workspaces:
|
||||
5. Use commit_memory to save the architecture summary and recent changes
|
||||
6. Wait for tasks from PM.
|
||||
schedules:
|
||||
- name: Orchestrator pulse
|
||||
cron_expr: "2,7,12,17,22,27,32,37,42,47,52,57 * * * *"
|
||||
prompt: |
|
||||
You're on a 5-minute engineering orchestration pulse. Dispatch dev work
|
||||
and review completed work. Keep Backend Engineer, Frontend Engineer, and
|
||||
DevOps Engineer busy with real issues.
|
||||
|
||||
1. SCAN ENGINEERING TEAM STATE:
|
||||
curl -s http://host.docker.internal:8080/workspaces | \
|
||||
python3 -c "import json,sys
|
||||
names = {'Backend Engineer','Frontend Engineer','DevOps Engineer','QA Engineer'}
|
||||
for w in json.load(sys.stdin):
|
||||
if w.get('name') in names and w.get('status')=='online':
|
||||
print(f\"{w['name']:25} busy={'Y' if w.get('active_tasks',0)>0 else 'N'}\")"
|
||||
|
||||
2. REVIEW OPEN PRs from your direct reports:
|
||||
gh pr list --repo ${GITHUB_REPO} --state open --json number,title,headRefName,author,statusCheckRollup
|
||||
For each PR:
|
||||
- If CI green + author is an engineer on your team → run molecule-skill-code-review
|
||||
against the diff (gh pr diff <N>). If clean, leave approving review comment.
|
||||
If issues, delegate_task back to the author with the list of fixes.
|
||||
- If CI red → delegate_task to the author with the failure summary from
|
||||
gh run view <run-id> --log-failed.
|
||||
|
||||
3. SCAN ENGINEERING BACKLOG:
|
||||
gh issue list --repo ${GITHUB_REPO} --state open --label bug,feature,security \
|
||||
--json number,title,labels
|
||||
Priority order: security > bug > feature > refactor.
|
||||
|
||||
4. DISPATCH (max 3 A2A per pulse):
|
||||
Match idle engineer → highest-priority unassigned issue:
|
||||
- Backend Engineer → security / platform / Go / database issues
|
||||
- Frontend Engineer → canvas / a11y / UX / TypeScript issues
|
||||
- DevOps Engineer → docker / CI / deployment / infra issues
|
||||
delegate_task format: "Work on issue #<N>: <title>. Create branch
|
||||
fix/issue-<N>-<slug>. Run tests. Open PR. Link issue in PR body."
|
||||
|
||||
5. REPORT:
|
||||
commit_memory "dev-pulse HH:MM — dispatched <N>, reviewed <M>, idle <K>".
|
||||
|
||||
HARD RULES:
|
||||
- Max 3 A2A sends per pulse.
|
||||
- If your own template-fitness audit is in flight (fires at :15 and :45), SKIP
|
||||
this pulse — don't double up your own workload.
|
||||
- Never dispatch to a busy engineer (active_tasks>0).
|
||||
- Under 90 seconds wall-clock per pulse. If >60s, pick one highest-priority
|
||||
dispatch and ship.
|
||||
- If all engineers idle AND backlog clean → write "dev-clean HH:MM" to memory
|
||||
and stop. No fabricating busy work.
|
||||
enabled: true
|
||||
- name: Hourly template fitness audit
|
||||
cron_expr: "15 * * * *"
|
||||
cron_expr: "15,45 * * * *"
|
||||
prompt: |
|
||||
Daily audit of `org-templates/molecule-dev/`. Catches drift, stale prompts,
|
||||
missing schedules, and gaps that block the team-runs-24/7 goal. Symptom
|
||||
@ -410,7 +555,7 @@ workspaces:
|
||||
6. Wait for tasks from Dev Lead.
|
||||
schedules:
|
||||
- name: Hourly security audit
|
||||
cron_expr: "17 * * * *"
|
||||
cron_expr: "1,11,21,31,41,51 * * * *"
|
||||
prompt: |
|
||||
Recurring hourly security audit. Be thorough on recently changed code.
|
||||
|
||||
@ -579,7 +724,7 @@ workspaces:
|
||||
6. Wait for tasks from Dev Lead.
|
||||
schedules:
|
||||
- name: Hourly UI/UX audit with live screenshots
|
||||
cron_expr: "11 * * * *"
|
||||
cron_expr: "5,20,35,50 * * * *"
|
||||
prompt: |
|
||||
Hourly UX audit of the live Molecule AI canvas. Take real screenshots
|
||||
and analyse actual user flows. The runtime discovered a working Chromium
|
||||
|
||||
Loading…
Reference in New Issue
Block a user