docs(spec): fourteenth pass adding subagent specialization principle
CI / benchmark-publish (push) Waiting to run
CI / lint (push) Successful in 32s
CI / push-validation (push) Successful in 23s
CI / helm (push) Successful in 34s
CI / quality (push) Successful in 36s
CI / build (push) Successful in 36s
CI / security (push) Successful in 1m4s
CI / typecheck (push) Successful in 1m8s
CI / benchmark-regression (push) Waiting to run
CI / integration_tests (push) Successful in 4m7s
CI / e2e_tests (push) Successful in 4m15s
CI / unit_tests (push) Successful in 5m21s
CI / docker (push) Successful in 1m20s
CI / coverage (push) Successful in 11m8s
CI / status-check (push) Successful in 2s

- Added Section 6.0: Subagent Specialization Principle (centralize, dont duplicate)
- Updated Section 5.3.4: interval calculation now ATM-centralized
- Updated Section 5.4: 11 operations (added CYCLE_ANNOUNCEMENT_REVIEW)
- Added v1.29.0 revision entry: 17 duplicated blocks removed
This commit is contained in:
clever-agent
2026-04-10 20:14:30 +00:00
parent cd49434c0d
commit 4029a3331a
+38 -11
View File
@@ -554,19 +554,29 @@ result = task automation-tracking-manager "CREATE_TRACKING_ISSUE" \
Every status issue MUST include an `**Estimated Cycle Interval**: Nmin` field in its header. This tells the System Watchdog and Product Builder how often the agent is expected to update, enabling them to detect frozen agents.
**Calculation (rolling average with 90/10 weighting):**
**This calculation is centralized in the Automation Tracking Manager** (per the Subagent Specialization Principle, Section 6.0). Agents do NOT calculate the interval themselves. Instead, they pass `sleep_interval_default` to `CREATE_TRACKING_ISSUE` and the ATM handles the rest:
```bash
task automation-tracking-manager "CREATE_TRACKING_ISSUE" \
--agent-prefix "AUTO-WATCHDOG" \
--tracking-type "System Health Report" \
--body "$tracking_body" \
--sleep-interval-default 5 \ # Agent's sleep duration in minutes
--repo-owner "$owner" \
--repo-name "$repo"
# ATM automatically calculates and injects the Estimated Cycle Interval
```
**ATM internal calculation (rolling average with 90/10 weighting):**
```
# On startup (no previous interval data):
estimated_interval = AGENT_SLEEP_SECONDS / 60 # default = the sleep duration
# If no previous tracking issue exists:
estimated_interval = sleep_interval_default
# On subsequent cycles (before creating new status issue):
old_interval = parse "Estimated Cycle Interval" from recovered_state.issue_body
old_created_at = recovered_state.created_at
actual_interval = (now - old_created_at) in minutes
# Rolling average: 90% previous estimate + 10% actual measurement
estimated_interval = old_interval * 0.90 + actual_interval * 0.10
# If previous tracking issue found:
old_interval = parse "Estimated Cycle Interval" from previous issue body
actual_interval = (now - previous_issue.created_at) in minutes
estimated_interval = round(old_interval * 0.90 + actual_interval * 0.10)
```
**How the Watchdog uses it:** If a status issue's age exceeds `2 × estimated_interval`, the agent is likely frozen. The Watchdog should investigate the agent's session health before restarting it. The 2× threshold accounts for natural variance (network delays, long operations, heavy Forgejo API load).
@@ -597,7 +607,7 @@ When an agent starts a new session, it does NOT reset to Cycle 1. It reads the h
### 5.4 Tracking Operations
The Automation Tracking Manager provides ten operations:
The Automation Tracking Manager provides eleven operations:
| Operation | Purpose |
|-----------|---------|
@@ -611,6 +621,7 @@ The Automation Tracking Manager provides ten operations:
| `LIST_TRACKING_ISSUES` | List all tracking issues for a given agent prefix |
| `READ_ANNOUNCEMENTS` | Read open announcements from specified agents with priority filtering |
| `REVIEW_OWN_ANNOUNCEMENTS` | Review own announcements for continued relevance |
| `CYCLE_ANNOUNCEMENT_REVIEW` | Combined per-cycle: read others' announcements + review and close own stale announcements |
### 5.5 Agent Prefix Registry
@@ -728,6 +739,21 @@ The signature must appear at the very end of the content, preceded by a horizont
The following constraints apply to every agent in the system without exception.
### 6.0 Subagent Specialization Principle
!!! info "Architectural Rule: Centralize, Don't Duplicate"
The system MUST use specialized subagents with restrictive permissions wherever possible. Functionality that multiple agents need MUST be centralized in a single subagent rather than duplicated across agent definitions. When identical logic appears in more than two agents, it is a code smell that should be refactored into a subagent.
**Examples of correct centralization:**
- **Label operations** → Forgejo Label Manager (not duplicated in each agent)
- **Tracking issue lifecycle** → Automation Tracking Manager (not duplicated in each agent)
- **Cycle interval calculation** → ATM's `CREATE_TRACKING_ISSUE` with `sleep_interval_default` (not duplicated in each agent)
- **Announcement review cycle** → ATM's `CYCLE_ANNOUNCEMENT_REVIEW` operation (not duplicated in each agent)
- **Merge verification** → Shared Merge Safety module (not duplicated in each merging agent)
**Why this matters:** Duplicated logic drifts. When a bug is fixed in one copy, the other copies remain broken. Centralized subagents ensure fixes propagate everywhere simultaneously.
### 6.1 Label Creation Prohibition
No agent in the system is permitted to create new labels. All labels exist at the organization level and are pre-configured during project bootstrapping. This constraint is enforced through three mechanisms:
@@ -3505,6 +3531,7 @@ The Branch Setup agent creates or checks out branches with a strict rebase-only
| 2026-04-10 | 1.21.0 | Twenty-fourth pass (label deny and permission consistency audit): Expanded Section 6.19 from Automation-Tracking-Manager-specific to universal label application delegation rule documenting all 77 agents with deny + 2 intentional exceptions (forgejo-label-manager, issue-state-updater); **fixed 6 agent definition bugs**: pr-editor.md, pr-manager.md, pr-merge-pool-supervisor.md, async-agent-manager.md (all 4 missing `forgejo_add_issue_labels: deny` — could bypass label delegation), forgejo-signature-appender.md (missing deny AND broken YAML `permission: {}` creating disconnected forgejo block); verified 41 edit:deny agents match spec claim exactly, 3 webfetch:allow agents match spec claim exactly |
| 2026-04-10 | 1.22.0 | Twenty-fifth pass (directory layout, bash permissions, subsystem verification): Added Section 2.4 (Directory Layout) documenting `.opencode/` structure including agents/, shared/, config/, scripts/, deprecated stubs; **fixed 1 agent definition bug**: forgejo-signature-appender.md (missing `bash: "*": deny` and `edit: deny` — the only active agent without any bash restriction, could run arbitrary commands despite being a text-formatting-only agent); verified 3-Tier Approval Detection (Section 6.17) matches pr-merge-pool-supervisor implementation; verified Mandatory Merge Verification Protocol (Section 8.3.4) matches shared/merge_safety.md; confirmed zero remaining stale names, stale labels, or stale session prefixes across all agent files |
| 2026-04-10 | 1.23.0 | Twenty-sixth pass (deep automation tracking audit): Major rewrite of Section 5.2 (Status Issues) with one-at-a-time invariant, close-ALL-then-create protocol, and explicit "even from previous sessions" language; new Section 5.3.1 (Announcement Issue Lifecycle) with mandatory self-review every 3 cycles; new Section 5.3.2 (Tracking Issue Consumption Protocol) with per-agent triage table, read depth levels, and priority-based filtering; **fixed 4 agent definitions**: automation-tracking-manager.md (strengthened CREATE_TRACKING_ISSUE to specify close-ALL-then-create invariant), backlog-grooming-pool-supervisor.md (added READ_ANNOUNCEMENTS from watchdog/liaison/owner + REVIEW_OWN_ANNOUNCEMENTS every 3 cycles), pr-review-pool-supervisor.md (added READ_ANNOUNCEMENTS for critical watchdog/liaison + REVIEW_OWN_ANNOUNCEMENTS), agent-evolution-pool-supervisor.md (added READ_ANNOUNCEMENTS for critical watchdog + REVIEW_OWN_ANNOUNCEMENTS with 24h stale threshold); updated shared/tracking_discovery_guide.md with mandatory announcement review and consumption protocols |
| 2026-04-10 | 1.29.0 | Thirty-second pass (subagent specialization, eliminate duplication): Added Section 6.0 (Subagent Specialization Principle — centralize, don't duplicate); moved interval calculation from 17 duplicated agent blocks into ATM `CREATE_TRACKING_ISSUE` via new `sleep_interval_default` parameter; added ATM operation #11 `CYCLE_ANNOUNCEMENT_REVIEW` combining read + review + close in one call; updated spec Section 5.3.4 to document ATM-centralized interval calculation; updated Section 5.4 operations table to 11 operations; updated shared/tracking_discovery_guide.md to reference ATM-handled interval; **removed 17 duplicated rolling average calculation blocks** from all supervisor agents and replaced with single `--sleep-interval-default` parameter |
| 2026-04-10 | 1.28.0 | Thirty-first pass (body template field enforcement): Added `**Estimated Cycle Interval**` field to the actual tracking body templates in all 14 agents that had inline body strings without it (agent-evolution, architecture-guard, architecture, documentation, pr-review, test-infra, timeline-update, uat-test, backlog-grooming ×2, human-liaison, system-watchdog, product-builder, implementation-pool); fixed 2 non-standard body formats (project-owner-pool-supervisor had non-standard `[HEALTH]` header → standardized to `# Project Owner Status`, bug-hunt-pool-supervisor had body starting at `## Summary` without header → added standard header); added tracking body requirement note to pr-merge-pool-supervisor; all 18 status-creating agents now have `Estimated Cycle Interval` in their actual body templates |
| 2026-04-10 | 1.27.0 | Thirtieth pass (tracking reference ordering and interval fields): Fixed tracking operations reference ordering in ALL 17 supervisor/orchestrator agents — moved READ_TRACKING_STATE before CREATE_TRACKING_ISSUE with startup note, rolling average interval calculation, and Estimated Cycle Interval requirement; added `Estimated Cycle Interval` field to IPS tracking body template; all 17 agents now include rolling average default values based on their sleep intervals |
| 2026-04-10 | 1.26.0 | Twenty-ninth pass (cycle interval, dual cleanup, cycle continuity): Added Section 5.3.4 (Estimated Cycle Interval rolling average with 90/10 weighting), Section 5.3.5 (Dual Status Issue Cleanup — agent-side + groomer-side), Section 5.3.6 (Cycle Number Continuity Across Sessions); updated Section 5.6 body template to include mandatory `Estimated Cycle Interval` field; **fixed 3 agent definitions**: system-watchdog-pool-supervisor.md (replaced hardcoded interval lookup table with parsing from status issue body, changed staleness threshold from 1.2x to 2x per spec), backlog-grooming-pool-supervisor.md (added Pass 20: Automation Tracking Status Issue Deduplication for redundant one-at-a-time enforcement), automation-tracking-manager.md (added `estimated_cycle_interval` to READ_TRACKING_STATE return schema); updated shared/tracking_discovery_guide.md with rolling average calculation pattern |