feat: implement new automation tracking system for agent supervision
CI / push-validation (push) Successful in 16s
CI / build (push) Successful in 19s
CI / helm (push) Successful in 23s
CI / lint (push) Failing after 35s
CI / quality (push) Successful in 43s
CI / security (push) Successful in 52s
CI / typecheck (push) Successful in 1m3s
CI / coverage (push) Has been skipped
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Failing after 4m4s
CI / unit_tests (push) Successful in 4m58s
CI / docker (push) Has been skipped
CI / e2e_tests (push) Successful in 6m24s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Has been cancelled
CI / push-validation (push) Successful in 16s
CI / build (push) Successful in 19s
CI / helm (push) Successful in 23s
CI / lint (push) Failing after 35s
CI / quality (push) Successful in 43s
CI / security (push) Successful in 52s
CI / typecheck (push) Successful in 1m3s
CI / coverage (push) Has been skipped
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Failing after 4m4s
CI / unit_tests (push) Successful in 4m58s
CI / docker (push) Has been skipped
CI / e2e_tests (push) Successful in 6m24s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Has been cancelled
Replace shared session state issue tracking with individual tracking issues per agent to reduce noise and improve searchability. **Agent Updates:** - session-persister: [AUTO-SESSION] prefix with cycle management - implementation-orchestrator: [AUTO-IMP-POOL] prefix for health reports - system-watchdog: [AUTO-WATCHDOG] prefix for system health - backlog-groomer: [AUTO-GROOMER] prefix + backup cleanup functionality - human-liaison: [AUTO-LIAISON] prefix for status updates **New Features:** - Standardized issue title format: [AUTO-<PREFIX>] <TYPE> (Cycle <N>) - Announcement format: [AUTO-<PREFIX>] Announce: <message> - Automatic cleanup to prevent issue accumulation - Required 'Automation Tracking' label for filtering - Validation script for format compliance **Documentation:** - Complete system documentation at docs/development/automation-tracking.md - Added to mkdocs.yml navigation - Validation script at scripts/validate_automation_tracking.py **Benefits:** - Reduced noise from shared tracking issue - Better searchability with agent-specific prefixes - Cleaner history per agent type - Easier debugging with focused issue threads - Automatic cleanup prevents accumulation Closes automation tracking system implementation requirements.
This commit is contained in:
@@ -52,6 +52,199 @@ git clone. The `/app` directory is never referenced.
|
||||
|
||||
---
|
||||
|
||||
## Automation Tracking System
|
||||
|
||||
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
|
||||
|
||||
### Tracking Issue Format
|
||||
- **Grooming Reports**: `[AUTO-GROOMER] Backlog Grooming Report (Cycle N)`
|
||||
- **Health Signals**: `[AUTO-GROOMER] Health Report (Cycle N)`
|
||||
- **Announcements**: `[AUTO-GROOMER] Announce: <message summary>`
|
||||
- **Labels**: "Automation Tracking" + any relevant priority labels
|
||||
|
||||
### Cleanup Protocol
|
||||
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
|
||||
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
|
||||
|
||||
### Tracking Functions
|
||||
|
||||
```bash
|
||||
# Find and delete previous backlog groomer tracking issue
|
||||
function cleanup_previous_groomer_tracking() {
|
||||
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-GROOMER] Backlog Grooming Report")) | .number' | head -1)
|
||||
|
||||
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
|
||||
echo "Cleaning up previous groomer tracking issue #$previous_issue"
|
||||
|
||||
# Close with final comment
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Grooming cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Backlog Grooming | Agent: backlog-groomer\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
echo "✓ Previous groomer tracking issue #$previous_issue closed"
|
||||
sleep 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Create backlog grooming tracking issue
|
||||
function create_groomer_tracking_issue() {
|
||||
local cycle="$1"
|
||||
local title="[AUTO-GROOMER] Backlog Grooming Report (Cycle $cycle)"
|
||||
local body="$2"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created groomer tracking issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create groomer tracking issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Create announcement issue for urgent grooming communications
|
||||
function create_groomer_announcement_issue() {
|
||||
local message="$1"
|
||||
local priority="$2"
|
||||
local body="$3"
|
||||
local title="[AUTO-GROOMER] Announce: $message"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created groomer announcement issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create groomer announcement issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Automation tracking ticket cleanup function
|
||||
function cleanup_automation_tracking_tickets() {
|
||||
echo "[GROOMER] Checking for old automation tracking tickets..."
|
||||
|
||||
# Find all automation tracking issues
|
||||
local tracking_issues=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-")) | "\(.number)|\(.title)|\(.created_at)"')
|
||||
|
||||
if [[ -z "$tracking_issues" ]]; then
|
||||
echo "[GROOMER] No automation tracking tickets found"
|
||||
return
|
||||
fi
|
||||
|
||||
local current_time=$(date +%s)
|
||||
local cleanup_count=0
|
||||
local stale_count=0
|
||||
|
||||
while IFS='|' read -r issue_number title created_at; do
|
||||
[[ -z "$issue_number" ]] && continue
|
||||
|
||||
# Calculate age in hours
|
||||
local created_timestamp=$(date -d "$created_at" +%s 2>/dev/null || echo "0")
|
||||
local age_hours=$(( (current_time - created_timestamp) / 3600 ))
|
||||
|
||||
echo "[GROOMER] Checking tracking ticket #$issue_number: $title (age: ${age_hours}h)"
|
||||
|
||||
# Determine cleanup action based on age and type
|
||||
local should_close=false
|
||||
local reason=""
|
||||
|
||||
# Different cleanup rules for different types of tracking tickets
|
||||
if [[ "$title" == *"Health Report"* || "$title" == *"Status Report"* ]]; then
|
||||
# Health/Status reports older than 2 hours (should be replaced by now)
|
||||
if [[ $age_hours -gt 2 ]]; then
|
||||
should_close=true
|
||||
reason="Superseded by newer health report"
|
||||
fi
|
||||
elif [[ "$title" == *"Tracking (Cycle"* ]]; then
|
||||
# Cycle tracking older than 1 hour (should be replaced by now)
|
||||
if [[ $age_hours -gt 1 ]]; then
|
||||
should_close=true
|
||||
reason="Cycle completed, superseded by newer tracking"
|
||||
fi
|
||||
elif [[ "$title" == *"Announce:"* ]]; then
|
||||
# Announcements older than 24 hours unless marked as persistent
|
||||
if [[ $age_hours -gt 24 ]]; then
|
||||
# Check if it's marked as persistent or has recent activity
|
||||
local comments=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | jq -r '.[].body')
|
||||
|
||||
if [[ "$comments" != *"PERSISTENT"* && "$comments" != *"KEEP_OPEN"* ]]; then
|
||||
# Ask before closing announcements
|
||||
local ask_comment="This automation tracking announcement is 24+ hours old. "
|
||||
ask_comment+="If the issue has been resolved or the announcement is no longer relevant, "
|
||||
ask_comment+="this ticket can be closed. If it should remain open, please comment with 'KEEP_OPEN'.\n\n"
|
||||
ask_comment+="**Auto-closure**: This will be automatically closed in 24 hours unless marked to keep open.\n\n"
|
||||
ask_comment+="---\n**Automated by CleverAgents Bot**\nSupervisor: Backlog Grooming | Agent: backlog-groomer"
|
||||
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"$ask_comment\"}"
|
||||
|
||||
stale_count=$((stale_count + 1))
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Close the issue if conditions are met
|
||||
if [[ "$should_close" == "true" ]]; then
|
||||
echo "[GROOMER] Closing tracking ticket #$issue_number: $reason"
|
||||
|
||||
# Add closure comment
|
||||
local closure_comment="Automatically closing this automation tracking ticket: $reason\n\n"
|
||||
closure_comment+="Age: ${age_hours} hours\n"
|
||||
closure_comment+="Auto-cleanup is part of the backlog grooming process to prevent tracking ticket accumulation.\n\n"
|
||||
closure_comment+="---\n**Automated by CleverAgents Bot**\nSupervisor: Backlog Grooming | Agent: backlog-groomer"
|
||||
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"$closure_comment\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
cleanup_count=$((cleanup_count + 1))
|
||||
fi
|
||||
|
||||
done <<< "$tracking_issues"
|
||||
|
||||
echo "[GROOMER] Tracking ticket cleanup complete: closed $cleanup_count, flagged $stale_count for review"
|
||||
|
||||
# Add to actions summary for reporting
|
||||
actions_taken+=("Automation tracking cleanup: closed $cleanup_count tickets, flagged $stale_count")
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
You receive:
|
||||
@@ -92,6 +285,10 @@ LOOP FOREVER:
|
||||
all_open_prs = query Forgejo for all open PRs
|
||||
recently_merged_prs = query Forgejo for closed+merged PRs (last 24h)
|
||||
|
||||
# ── Step 2: Automation tracking ticket cleanup (every 5 cycles) ──
|
||||
if groom_cycle % 5 == 0:
|
||||
cleanup_automation_tracking_tickets()
|
||||
|
||||
# ── Step 2: Run analysis passes on OPEN items (primary) ──────
|
||||
# IMPORTANT: Filter out pull requests before duplicate detection.
|
||||
# PRs are NOT issues — they deliver code for issues. A PR that
|
||||
@@ -152,17 +349,57 @@ LOOP FOREVER:
|
||||
|
||||
# ── Step 4: Post summary ─────────────────────────────────────
|
||||
if findings:
|
||||
post comment on session state issue:
|
||||
"Backlog grooming cycle <N> complete:
|
||||
- Issues scanned: <total>
|
||||
- Duplicates found: <N> (closed <N>)
|
||||
- Orphans found: <N>
|
||||
- Stale issues: <N>
|
||||
- Label fixes: <N>
|
||||
- Issues closed (completed): <N>
|
||||
- Priority mismatches: <N>
|
||||
- Epic gaps found: <N> (children created: <N>)
|
||||
- Legendary gaps found: <N>"
|
||||
# Create comprehensive grooming tracking issue for this cycle
|
||||
grooming_report_body="""# Backlog Grooming Report (Cycle $groom_cycle)
|
||||
|
||||
**Supervisor**: Backlog Groomer
|
||||
**Status**: Active
|
||||
**Timestamp**: $(date -Iseconds)
|
||||
**Cycle Duration**: 5 minutes
|
||||
|
||||
## Grooming Summary
|
||||
- **Issues scanned total**: ${issues_scanned_total}
|
||||
- **Analysis passes completed**: ${analysis_passes_completed}
|
||||
- **Actions taken**: ${actions_taken.length}
|
||||
|
||||
## Issues Found and Fixed
|
||||
- **Duplicates found**: ${duplicates_found} (closed: ${duplicates_closed})
|
||||
- **Orphans found**: ${orphans_found}
|
||||
- **Stale issues flagged**: ${stale_issues_count}
|
||||
- **Label fixes applied**: ${label_fixes_count}
|
||||
- **Issues closed (completed)**: ${completed_issues_closed}
|
||||
- **Priority mismatches resolved**: ${priority_mismatches_fixed}
|
||||
|
||||
## Epic and Legendary Management
|
||||
- **Epic gaps found**: ${epic_gaps_found} (children created: ${epic_children_created})
|
||||
- **Legendary gaps found**: ${legendary_gaps_found}
|
||||
- **Missing parent links fixed**: ${parent_links_fixed}
|
||||
|
||||
## Definition of Done Audits
|
||||
- **DoD compliance issues**: ${dod_issues_found}
|
||||
- **DoD improvements suggested**: ${dod_improvements_count}
|
||||
|
||||
## Dependency Analysis
|
||||
- **Blocked chain issues**: ${blocked_chain_issues}
|
||||
- **Dependency link fixes**: ${dependency_fixes}
|
||||
- **Circular dependencies detected**: ${circular_deps}
|
||||
|
||||
## Backlog Health Status
|
||||
- **Overall backlog health**: ${overall_backlog_health}
|
||||
- **Issues requiring human attention**: ${human_attention_count}
|
||||
- **Next grooming cycle**: Cycle ${groom_cycle + 1} in 5 minutes
|
||||
|
||||
## Recent Actions Summary
|
||||
${actions_taken.join('\n- ')}
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Backlog Grooming | Agent: backlog-groomer
|
||||
**Tracking Type**: Grooming Report
|
||||
**Cycle**: $groom_cycle"""
|
||||
|
||||
cleanup_previous_groomer_tracking
|
||||
create_groomer_tracking_issue $groom_cycle "$grooming_report_body"
|
||||
|
||||
# ── Step 5: Sleep before next cycle ─────────────────────────
|
||||
# NEVER exit/break. MUST use Bash tool:
|
||||
@@ -543,16 +780,45 @@ For each active milestone (state=open), calculate:
|
||||
|
||||
**Alert conditions:**
|
||||
- If creation rate > closure rate * 2 for this milestone:
|
||||
Post warning on session state issue:
|
||||
```
|
||||
[SCOPE ALERT] Milestone <name>: creation rate (<N>/24h) is >2x
|
||||
closure rate (<M>/24h). Scope is growing faster than completion.
|
||||
Non-critical new issues should use Priority/Backlog with no milestone.
|
||||
Create scope alert tracking issue:
|
||||
```bash
|
||||
scope_alert_body="""# 🚨 Milestone Scope Alert
|
||||
|
||||
**Milestone**: ${milestone_name}
|
||||
**Alert Type**: Scope Creep Warning
|
||||
**Severity**: High
|
||||
**Timestamp**: $(date -Iseconds)
|
||||
|
||||
## Problem Detected
|
||||
Creation rate (**${creation_rate}/24h**) is more than 2x closure rate (**${closure_rate}/24h**).
|
||||
|
||||
## Impact
|
||||
- Scope is growing faster than completion
|
||||
- Milestone delivery at risk
|
||||
- Team capacity may be exceeded
|
||||
|
||||
## Recommended Actions
|
||||
1. **Immediate**: Route new non-critical issues to Priority/Backlog with no milestone
|
||||
2. **Review**: Assess if current milestone scope is realistic
|
||||
3. **Consider**: Moving lower-priority items to future milestones
|
||||
|
||||
## Data
|
||||
- **Issues created last 24h**: ${issues_created_24h}
|
||||
- **Issues closed last 24h**: ${issues_closed_24h}
|
||||
- **Creation:Closure ratio**: ${creation_closure_ratio}
|
||||
- **Total open issues in milestone**: ${total_open_issues}
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Backlog Grooming | Agent: backlog-groomer
|
||||
**Alert Type**: Scope Creep Warning"""
|
||||
|
||||
create_groomer_announcement_issue "Milestone ${milestone_name} Scope Alert" "High" "$scope_alert_body"
|
||||
```
|
||||
- If milestone total issues grew >10% since last grooming cycle:
|
||||
Flag for human review.
|
||||
|
||||
**Action:** Post scope warnings on the session state issue. Do NOT move
|
||||
**Action:** Create scope alert tracking issues for urgent scope warnings. Do NOT move
|
||||
issues between milestones — that is the project owner's responsibility.
|
||||
|
||||
---
|
||||
@@ -573,12 +839,48 @@ No exceptions — every comment, every issue body, every PR description.
|
||||
|
||||
## Health Signaling
|
||||
|
||||
Every 10 cycles, post a brief health signal comment on the session state issue:
|
||||
Every 10 cycles, create a health report tracking issue:
|
||||
```bash
|
||||
# Create health signal as individual tracking issue (every 10 cycles)
|
||||
if [[ $((groom_cycle % 10)) -eq 0 ]]; then
|
||||
health_report_body="""# Backlog Groomer Health Report (Cycle $groom_cycle)
|
||||
|
||||
**Supervisor**: Backlog Groomer
|
||||
**Status**: Active
|
||||
**Timestamp**: $(date -Iseconds)
|
||||
**Reporting Period**: Last 10 cycles (50 minutes)
|
||||
|
||||
## Activity Summary
|
||||
- **Total cycles completed**: $groom_cycle
|
||||
- **Last action**: ${last_action_description}
|
||||
- **Issues processed last 10 cycles**: ${issues_processed_recent}
|
||||
- **Actions taken last 10 cycles**: ${actions_taken_recent}
|
||||
|
||||
## System Health
|
||||
- **Grooming effectiveness**: ${grooming_effectiveness}
|
||||
- **Backlog quality score**: ${backlog_quality_score}
|
||||
- **Issues requiring attention**: ${issues_needing_attention}
|
||||
|
||||
## Performance Metrics
|
||||
- **Average cycle time**: ${average_cycle_time}
|
||||
- **Actions per cycle**: ${actions_per_cycle}
|
||||
- **Completion rate**: ${completion_rate}
|
||||
|
||||
## Next Actions
|
||||
- **Continue regular grooming**: Every 5 minutes
|
||||
- **Next health report**: Cycle $((groom_cycle + 10))
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Backlog Grooming | Agent: backlog-groomer
|
||||
**Tracking Type**: Health Report
|
||||
**Cycle**: $groom_cycle"""
|
||||
|
||||
create_groomer_tracking_issue $groom_cycle "$health_report_body"
|
||||
fi
|
||||
```
|
||||
[HEALTH] backlog-groomer cycle <N>: alive, last action: <brief description>
|
||||
```
|
||||
This allows the system-watchdog to detect zombie supervisors that are "alive"
|
||||
(session active) but not performing work (no recent Forgejo activity).
|
||||
This allows the system-watchdog to detect zombie supervisors by monitoring
|
||||
the creation of these health tracking issues rather than comments on a shared issue.
|
||||
|
||||
## Context Self-Management
|
||||
|
||||
|
||||
@@ -46,6 +46,91 @@ permission:
|
||||
|
||||
If these are not in your reference summary, invoke `ref-reader` IMMEDIATELY.
|
||||
|
||||
## Automation Tracking System
|
||||
|
||||
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
|
||||
|
||||
### Tracking Issue Format
|
||||
- **Status Updates**: `[AUTO-LIAISON] Human Liaison Status (Cycle N)`
|
||||
- **Activity Reports**: `[AUTO-LIAISON] Human Activity Report (Cycle N)`
|
||||
- **Announcements**: `[AUTO-LIAISON] Announce: <message summary>`
|
||||
- **Labels**: "Automation Tracking" + any relevant priority labels
|
||||
|
||||
### Tracking Functions
|
||||
|
||||
```bash
|
||||
# Find and delete previous human liaison tracking issue
|
||||
function cleanup_previous_liaison_tracking() {
|
||||
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-LIAISON] Human Liaison Status")) | .number' | head -1)
|
||||
|
||||
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
|
||||
echo "Cleaning up previous liaison tracking issue #$previous_issue"
|
||||
|
||||
# Close with final comment
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Liaison cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Human Liaison | Agent: human-liaison\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
echo "✓ Previous liaison tracking issue #$previous_issue closed"
|
||||
sleep 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Create human liaison tracking issue
|
||||
function create_liaison_tracking_issue() {
|
||||
local cycle="$1"
|
||||
local title="[AUTO-LIAISON] Human Liaison Status (Cycle $cycle)"
|
||||
local body="$2"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created liaison tracking issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create liaison tracking issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Create announcement issue for human-related communications
|
||||
function create_liaison_announcement_issue() {
|
||||
local message="$1"
|
||||
local priority="$2"
|
||||
local body="$3"
|
||||
local title="[AUTO-LIAISON] Announce: $message"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created liaison announcement issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create liaison announcement issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
Key CODE_OF_CONDUCT requirements:
|
||||
- Welcoming and inclusive language
|
||||
- Respectful of differing viewpoints
|
||||
@@ -984,20 +1069,54 @@ No exceptions — every comment, every issue body, every PR description.
|
||||
|
||||
## Health Signaling
|
||||
|
||||
Every 10 cycles, post a standardized health signal on the session state issue:
|
||||
```
|
||||
forgejo_create_issue_comment(
|
||||
owner, repo, SESSION_STATE_ISSUE_NUMBER,
|
||||
body="[HEALTH] human-liaison | Iteration: <cycle> | Status: active\n" +
|
||||
"- Type: singleton\n" +
|
||||
"- Active workers: N/A\n" +
|
||||
"- Work completed: triaged <issues_triaged> issues, responded to <comments_responded> comments\n" +
|
||||
"- Last activity: <brief description>\n" +
|
||||
"- Next check: in 120 seconds\n\n" +
|
||||
"---\n" +
|
||||
"**Automated by CleverAgents Bot**\n" +
|
||||
"Supervisor: Human Liaison | Agent: human-liaison"
|
||||
)
|
||||
Every 10 cycles, create a health status tracking issue:
|
||||
```bash
|
||||
# Create health status as individual tracking issue (every 10 cycles)
|
||||
if [[ $((cycle % 10)) -eq 0 ]]; then
|
||||
liaison_status_body="""# Human Liaison Status Report (Cycle $cycle)
|
||||
|
||||
**Supervisor**: Human Liaison
|
||||
**Type**: Singleton
|
||||
**Status**: Active
|
||||
**Timestamp**: $(date -Iseconds)
|
||||
**Reporting Period**: Last 10 cycles (20 minutes)
|
||||
|
||||
## Activity Summary
|
||||
- **Total cycles completed**: $cycle
|
||||
- **Issues triaged**: ${issues_triaged}
|
||||
- **Comments responded to**: ${comments_responded}
|
||||
- **PR reviews processed**: ${reviews_processed}
|
||||
- **Last activity**: ${brief_description}
|
||||
|
||||
## Human Interaction Health
|
||||
- **Active conversations**: ${active_conversations}
|
||||
- **Pending human responses**: ${pending_responses}
|
||||
- **Escalations created**: ${escalations_created}
|
||||
- **Epic/legendary gaps addressed**: ${gaps_addressed}
|
||||
|
||||
## System Integration
|
||||
- **Session state monitoring**: Active
|
||||
- **Real-time human activity monitoring**: Every 2 minutes
|
||||
- **Spec knowledge**: ${spec_knowledge_status}
|
||||
- **Backlog connectivity**: ${backlog_status}
|
||||
|
||||
## Next Actions
|
||||
- **Continue human activity monitoring**: Every 2 minutes
|
||||
- **Next epic gap analysis**: ${next_gap_analysis_cycle}
|
||||
- **Next health report**: Cycle $((cycle + 10))
|
||||
|
||||
## Recent Human Interactions
|
||||
${recent_interactions_summary}
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Human Liaison | Agent: human-liaison
|
||||
**Tracking Type**: Status Report
|
||||
**Cycle**: $cycle"""
|
||||
|
||||
cleanup_previous_liaison_tracking
|
||||
create_liaison_tracking_issue $cycle "$liaison_status_body"
|
||||
fi
|
||||
```
|
||||
|
||||
## Context Self-Management
|
||||
|
||||
@@ -98,7 +98,7 @@ strategy — try the sources **in order** and use the first that succeeds:
|
||||
| **Forgejo username** | `FORGEJO_USERNAME` | Your Forgejo username (for issue assignment) |
|
||||
| **Forgejo password** | `FORGEJO_PASSWORD` | Web UI access for CI logs (when API unavailable) |
|
||||
| **Max parallel workers** | `CA_MAX_PARALLEL_WORKERS` | Target number of parallel issue workers (default: 4) |
|
||||
| **Session state issue** | (passed by caller) | Issue # for all status updates (required) |
|
||||
| **Cycle number** | (passed by caller) | Current cycle number for tracking issue naming |
|
||||
|
||||
The first five values are **required** — do not guess or assume any of them. If
|
||||
an `echo` returns empty and the user did not provide the value, you MUST ask
|
||||
@@ -107,8 +107,8 @@ before proceeding.
|
||||
**Max parallel workers** is OPTIONAL. If `CA_MAX_PARALLEL_WORKERS` is unset or
|
||||
empty, default to **4**. Read it via `echo $CA_MAX_PARALLEL_WORKERS`.
|
||||
|
||||
**Session state issue number** MUST be provided by the caller (usually product-builder).
|
||||
If not provided, ask for it. All health signals and status updates go to this issue.
|
||||
**Cycle number** SHOULD be provided by the caller (usually product-builder) for tracking issue naming.
|
||||
If not provided, start with cycle 1. All status updates will create individual tracking issues with [AUTO-IMP-POOL] prefix.
|
||||
|
||||
The repository is `cleveragents/cleveragents-core` on `git.cleverthis.com`.
|
||||
All remote access uses HTTPS authenticated with the Forgejo PAT.
|
||||
@@ -317,34 +317,162 @@ pr_work_queue = check_pr_work_needed()
|
||||
|
||||
# Absolute priority rule
|
||||
if pr_work_queue:
|
||||
# Report status
|
||||
post comment on session state issue #SESSION_STATE_ISSUE_NUMBER:
|
||||
"[STATUS] Implementation pool: PR-FIRST MODE\n" +
|
||||
f"- {len(pr_work_queue)} PRs need work\n" +
|
||||
f"- {len(active_pr_workers)} PRs being worked on\n" +
|
||||
f"- {len(active_issue_workers)} issues being worked on\n\n" +
|
||||
"No new issues will be started until all PRs have workers.\n\n" +
|
||||
"PR Work Queue:\n" +
|
||||
format_pr_queue(pr_work_queue) +
|
||||
"\n\n---\n" +
|
||||
"**Automated by CleverAgents Bot**\n" +
|
||||
"Supervisor: Implementation | Agent: implementation-orchestrator"
|
||||
# Report status via individual tracking issue (every 5 cycles)
|
||||
if cycle % 5 == 0:
|
||||
tracking_body = f"""# Implementation Pool Status (Cycle {cycle})
|
||||
|
||||
**Mode**: PR-FIRST MODE
|
||||
**Status**: Active - Prioritizing PR fixes over new issues
|
||||
**Timestamp**: {now()}
|
||||
|
||||
## Current Workload
|
||||
- **PRs needing work**: {len(pr_work_queue)}
|
||||
- **Active PR workers**: {len(active_pr_workers)}
|
||||
- **Active issue workers**: {len(active_issue_workers)}
|
||||
- **Available slots**: {max_workers - len(active_pr_workers) - len(active_issue_workers)}
|
||||
|
||||
## Policy
|
||||
No new issues will be started until all PRs have workers.
|
||||
|
||||
## PR Work Queue
|
||||
{chr(10).join([f"- PR #{pw['pr'].number}: {pw['work_type']} (priority: {pw['priority_score']})" for pw in pr_work_queue[:10]])}
|
||||
|
||||
## Next Actions
|
||||
- Continue dispatching workers to PRs in priority order
|
||||
- Monitor PR completion and merge status
|
||||
- Resume issue work once all PRs have workers
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Implementation | Agent: implementation-orchestrator
|
||||
**Tracking Type**: Pool Status
|
||||
**Cycle**: {cycle}"""
|
||||
|
||||
cleanup_previous_tracking()
|
||||
create_tracking_issue(cycle, tracking_body)
|
||||
|
||||
WORK_ON_ISSUES = False
|
||||
else:
|
||||
# All PRs are being handled
|
||||
if active_pr_workers:
|
||||
post comment on session state issue #SESSION_STATE_ISSUE_NUMBER:
|
||||
"[STATUS] Implementation pool: All PRs have workers\n" +
|
||||
f"- {len(active_pr_workers)} PRs being actively worked on\n" +
|
||||
f"- {len(active_issue_workers)} issues being worked on\n\n" +
|
||||
"Can take on new issues if worker slots available.\n\n" +
|
||||
"---\n" +
|
||||
"**Automated by CleverAgents Bot**\n" +
|
||||
"Supervisor: Implementation | Agent: implementation-orchestrator"
|
||||
if active_pr_workers and cycle % 5 == 0:
|
||||
tracking_body = f"""# Implementation Pool Status (Cycle {cycle})
|
||||
|
||||
**Mode**: NORMAL - All PRs have workers
|
||||
**Status**: Active - Can accept new issues
|
||||
**Timestamp**: {now()}
|
||||
|
||||
## Current Workload
|
||||
- **Active PR workers**: {len(active_pr_workers)}
|
||||
- **Active issue workers**: {len(active_issue_workers)}
|
||||
- **Available slots**: {max_workers - len(active_pr_workers) - len(active_issue_workers)}
|
||||
|
||||
## Policy
|
||||
All PRs have workers assigned. Can take on new issues if worker slots available.
|
||||
|
||||
## Next Actions
|
||||
- Monitor PR progress and completion
|
||||
- Dispatch workers to new issues if slots available
|
||||
- Continue health monitoring
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Implementation | Agent: implementation-orchestrator
|
||||
**Tracking Type**: Pool Status
|
||||
**Cycle**: {cycle}"""
|
||||
|
||||
cleanup_previous_tracking()
|
||||
create_tracking_issue(cycle, tracking_body)
|
||||
WORK_ON_ISSUES = True
|
||||
```
|
||||
|
||||
## Automation Tracking System
|
||||
|
||||
**NEW**: This agent creates individual tracking issues instead of posting comments to a session state issue.
|
||||
|
||||
### Tracking Issue Format
|
||||
- **Status Updates**: `[AUTO-IMP-POOL] Implementation Pool Tracking (Cycle N)`
|
||||
- **Announcements**: `[AUTO-IMP-POOL] Announce: <message summary>`
|
||||
- **Labels**: "Automation Tracking" + any relevant priority labels
|
||||
|
||||
### Cleanup Protocol
|
||||
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
|
||||
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
|
||||
|
||||
### Tracking Functions
|
||||
|
||||
```bash
|
||||
# Find and delete previous implementation pool tracking issue
|
||||
function cleanup_previous_tracking() {
|
||||
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-IMP-POOL] Implementation Pool Tracking")) | .number' | head -1)
|
||||
|
||||
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
|
||||
echo "Cleaning up previous implementation pool tracking issue #$previous_issue"
|
||||
|
||||
# Close with final comment
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Implementation | Agent: implementation-orchestrator\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
echo "✓ Previous tracking issue #$previous_issue closed"
|
||||
sleep 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Create new implementation pool tracking issue
|
||||
function create_tracking_issue() {
|
||||
local cycle="$1"
|
||||
local title="[AUTO-IMP-POOL] Implementation Pool Tracking (Cycle $cycle)"
|
||||
local body="$2"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created implementation pool tracking issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create tracking issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Create announcement issue for urgent communications
|
||||
function create_announcement_issue() {
|
||||
local message="$1"
|
||||
local priority="$2"
|
||||
local body="$3"
|
||||
local title="[AUTO-IMP-POOL] Announce: $message"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created announcement issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create announcement issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
## Startup Sequence
|
||||
|
||||
Execute these two steps **in parallel** by launching both subagents
|
||||
@@ -1174,7 +1302,51 @@ LOOP FOREVER:
|
||||
|
||||
forgejo_create_issue_comment(
|
||||
owner, repo, SESSION_STATE_ISSUE_NUMBER,
|
||||
body=f"[HEALTH] issue-implementor | Iteration: {cycle} | Status: active\n" +
|
||||
# REPLACED: Now creates individual tracking issue instead
|
||||
# Create comprehensive health tracking issue
|
||||
health_body = f"""# Implementation Pool Health Report (Cycle {cycle})
|
||||
|
||||
**Supervisor**: Implementation Orchestrator
|
||||
**Type**: Pool Supervisor
|
||||
**Status**: Active
|
||||
**Timestamp**: {now()}
|
||||
**Mode**: {'PR-FIRST' if pr_work_queue else 'NORMAL'}
|
||||
|
||||
## Worker Utilization
|
||||
- **Max workers configured**: {max_workers}
|
||||
- **Total active workers**: {len(active_pr_workers) + len(active_issue_workers)} / {max_workers}
|
||||
- **Available slots**: {max_workers - len(active_pr_workers) - len(active_issue_workers)}
|
||||
|
||||
## PR Fix Workers ({len(active_pr_workers)})
|
||||
{format_pr_workers(active_pr_workers) if active_pr_workers else "None active"}
|
||||
|
||||
## Issue Implementation Workers ({len(active_issue_workers)})
|
||||
{format_issue_workers(active_issue_workers) if active_issue_workers else "None active"}
|
||||
|
||||
## Work Completion Statistics
|
||||
- **PRs merged**: {sum(1 for c in completed if c['type'] == 'pr')}
|
||||
- **Issues completed**: {len(completed_issues)}
|
||||
- **Failed retries**: {sum(failed.values())}
|
||||
|
||||
## Queue Status
|
||||
- **PRs needing work**: {len(pr_work_queue)}
|
||||
- **Issues queued**: {len(queue) if 'queue' in locals() else 0}
|
||||
|
||||
## System Health
|
||||
- **Next detailed check**: Cycle {cycle + 10}
|
||||
- **Performance**: {"Prioritizing PR fixes - no new issues until PRs have workers" if pr_work_queue else "Normal operation - can accept new issues"}
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Implementation | Agent: implementation-orchestrator
|
||||
**Tracking Type**: Health Report
|
||||
**Cycle**: {cycle}"""
|
||||
|
||||
cleanup_previous_tracking()
|
||||
create_tracking_issue(cycle, health_body)
|
||||
|
||||
# OLD HEALTH COMMENT CODE:
|
||||
ignored_body=f"[HEALTH] issue-implementor | Iteration: {cycle} | Status: active\n" +
|
||||
f"- Type: pool-supervisor\n" +
|
||||
f"- Max workers: {max_workers}\n" +
|
||||
f"- Total active workers: {len(active_pr_workers) + len(active_issue_workers)} / {max_workers}\n" +
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
description: >
|
||||
Persists session state exclusively via Forgejo issue comments. Creates
|
||||
and manages a dedicated session state issue. Each checkpoint is a new
|
||||
comment preserving full history. Reads the latest comment for resume
|
||||
state. No local files — all state lives on Forgejo.
|
||||
Persists session state via individual Forgejo tracking issues. Creates
|
||||
individual tracking issues with the "Automation Tracking" label instead
|
||||
of using a shared session state issue. Each cycle gets its own tracking
|
||||
issue with structured state information. Deletes previous cycle tracking
|
||||
issues to maintain cleanup. All state lives on Forgejo as individual issues.
|
||||
mode: subagent
|
||||
hidden: true
|
||||
temperature: 0.0
|
||||
@@ -18,68 +19,215 @@ permission:
|
||||
"*": deny
|
||||
---
|
||||
|
||||
# CleverAgents Session Persister
|
||||
# CleverAgents Session Persister (Individual Tracking Issues)
|
||||
|
||||
## CRITICAL: Project Rules Compliance
|
||||
|
||||
**BEFORE ANY ACTION:** You MUST read and strictly adhere to:
|
||||
- **CONTRIBUTING.md** - All project conventions and standards
|
||||
- **CODE_OF_CONDUCT.md** - Professional conduct requirements
|
||||
|
||||
This agent creates and manages individual automation tracking issues following
|
||||
the new CleverAgents tracking system.
|
||||
|
||||
## Setup
|
||||
|
||||
Receives: repo owner/name, action that was just completed, key data to record, session state issue number (if already created).
|
||||
Receives: repo owner/name, action that was just completed, key data to record,
|
||||
cycle number (for tracking issue numbering).
|
||||
|
||||
## New Automation Tracking System
|
||||
|
||||
Instead of using a shared session state issue with comments, this agent now
|
||||
creates **individual tracking issues** for each session cycle:
|
||||
|
||||
### Issue Title Format
|
||||
- **Status Updates**: `[AUTO-SESSION] Session State Tracking (Cycle N)`
|
||||
- **Announcements**: `[AUTO-SESSION] Announce: <message summary>`
|
||||
|
||||
### Required Labels
|
||||
- **Primary**: "Automation Tracking" (for filtering and identification)
|
||||
- **Additional**: Any relevant priority or type labels
|
||||
|
||||
### Cleanup Protocol
|
||||
- **ONE ISSUE PER CYCLE**: Before creating a new tracking issue, delete the previous cycle's tracking issue
|
||||
- **VERIFICATION**: Always verify the old issue is deleted before creating the new one
|
||||
- **EXCEPTION**: Don't delete announcement issues - only status tracking issues
|
||||
|
||||
## Three Operations
|
||||
|
||||
### CLOSE tracking issue
|
||||
|
||||
When instructed to close the tracking issue (e.g., product build complete
|
||||
or new session starting):
|
||||
When instructed to close tracking (e.g., product build complete or new session starting):
|
||||
|
||||
1. Fetch the session state issue by number
|
||||
2. Remove `State/In Progress` label, add `State/Completed` label
|
||||
3. Post a final comment: "Session tracking complete. Closing this issue."
|
||||
4. Close the issue via Forgejo API (`forgejo_issue_state_change` with
|
||||
state="closed")
|
||||
1. **Find all session tracking issues**: Search for open issues with title pattern `[AUTO-SESSION] Session State Tracking (Cycle *)`
|
||||
2. **Close all tracking issues**: Close each found issue and add final comment
|
||||
3. **Clean up**: Leave announcement issues open for visibility
|
||||
|
||||
### WRITE checkpoint
|
||||
```bash
|
||||
# Search for session tracking issues to close
|
||||
curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq '.[] | select(.title | contains("[AUTO-SESSION] Session State Tracking")) | .number'
|
||||
```
|
||||
|
||||
Create a new comment on the session state issue with structured state:
|
||||
### WRITE checkpoint (Create Individual Tracking Issue)
|
||||
|
||||
1. **Clean up previous cycle**: Find and delete previous session tracking issue
|
||||
2. **Create new tracking issue** with structured state information
|
||||
3. **Apply labels**: Add "Automation Tracking" label
|
||||
|
||||
**Issue Body Template:**
|
||||
```markdown
|
||||
## Session Checkpoint — [timestamp]
|
||||
# Session State Checkpoint — [timestamp]
|
||||
|
||||
**Phase**: [current phase]
|
||||
**Current Milestone**: [milestone name]
|
||||
**Milestones Completed**: [list]
|
||||
**Cycle**: [cycle_number]
|
||||
|
||||
### Completed Issues
|
||||
## Completed Issues
|
||||
| Issue | Branch | PR | Merged | Tier | Attempts |
|
||||
|-------|--------|----|--------|------|----------|
|
||||
[rows]
|
||||
|
||||
### In Progress
|
||||
## In Progress
|
||||
[list]
|
||||
|
||||
### Queued
|
||||
## Queued
|
||||
[list]
|
||||
|
||||
### Architecture Guard
|
||||
## Architecture Guard
|
||||
- Last run: [when]
|
||||
- Issues created: [list]
|
||||
|
||||
### Stats
|
||||
## Stats
|
||||
- Total issues completed: N
|
||||
- Total escalations: N
|
||||
- Evaluator accuracy: N%
|
||||
|
||||
### Resume Instructions
|
||||
## Resume Instructions
|
||||
If restarting: [specific instructions for what to do next]
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Session Management | Agent: session-persister
|
||||
**Tracking Type**: Session State
|
||||
**Cycle**: [cycle_number]
|
||||
```
|
||||
|
||||
### CREATE announcement (Emergency Messages)
|
||||
|
||||
For urgent communications to other agents or humans:
|
||||
|
||||
**Title Format**: `[AUTO-SESSION] Announce: <message summary>`
|
||||
|
||||
**Issue Body Template:**
|
||||
```markdown
|
||||
# 🚨 Session Management Announcement
|
||||
|
||||
**Message**: [detailed message]
|
||||
**Priority**: [Critical/High/Medium/Low]
|
||||
**Target Audience**: [All Agents/Specific Agent/Humans]
|
||||
**Action Required**: [specific actions needed]
|
||||
|
||||
## Context
|
||||
[detailed context and background]
|
||||
|
||||
## Resolution Needed
|
||||
[specific resolution steps required]
|
||||
|
||||
## Timeline
|
||||
[urgency and timeline information]
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: Session Management | Agent: session-persister
|
||||
**Tracking Type**: Announcement
|
||||
**Created**: [timestamp]
|
||||
```
|
||||
|
||||
### READ checkpoint
|
||||
|
||||
Read the session state issue, find the latest comment, parse and return the state.
|
||||
Read the latest session tracking issue to resume state:
|
||||
|
||||
1. **Search for latest tracking issue**: Find most recent `[AUTO-SESSION] Session State Tracking (Cycle *)`
|
||||
2. **Parse issue body**: Extract all structured state information
|
||||
3. **Return parsed state**: Provide all fields for session resume
|
||||
|
||||
## Implementation Functions
|
||||
|
||||
### Find Previous Session Tracking Issue
|
||||
```bash
|
||||
function find_previous_session_issue() {
|
||||
# Find the most recent session tracking issue
|
||||
curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-SESSION] Session State Tracking")) |
|
||||
"\(.number)|\(.created_at)|\(.title)"' | \
|
||||
sort -t'|' -k2 -r | \
|
||||
head -1 | \
|
||||
cut -d'|' -f1
|
||||
}
|
||||
```
|
||||
|
||||
### Delete Previous Tracking Issue
|
||||
```bash
|
||||
function delete_previous_tracking_issue() {
|
||||
local issue_number=$1
|
||||
if [[ -n "$issue_number" && "$issue_number" != "null" ]]; then
|
||||
echo "Deleting previous session tracking issue #$issue_number"
|
||||
|
||||
# Add closure comment
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Session cycle completed. Closing this tracking issue.\n\n---\n**Automated by CleverAgents Bot**\nSupervisor: Session Management | Agent: session-persister\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
echo "✓ Previous tracking issue #$issue_number closed"
|
||||
sleep 2 # Ensure closure completes
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
### Create Tracking Issue with Labels
|
||||
```bash
|
||||
function create_session_tracking_issue() {
|
||||
local title="$1"
|
||||
local body="$2"
|
||||
local cycle="$3"
|
||||
|
||||
# Create the issue
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created tracking issue #$issue_number"
|
||||
|
||||
# Apply Automation Tracking label (create if doesn't exist)
|
||||
# Note: We'll add the label by name and let Forgejo handle creation
|
||||
echo "Applying 'Automation Tracking' label to issue #$issue_number"
|
||||
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create tracking issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
## Bot Signature (Required on ALL Forgejo Content)
|
||||
|
||||
Every comment, issue body, PR description, and review you post to Forgejo
|
||||
MUST end with this signature block:
|
||||
Every issue body and comment you create on Forgejo MUST end with this signature block:
|
||||
|
||||
```
|
||||
---
|
||||
@@ -87,18 +235,35 @@ MUST end with this signature block:
|
||||
Supervisor: Session Management | Agent: session-persister
|
||||
```
|
||||
|
||||
Append this to the END of every piece of content you create on Forgejo.
|
||||
No exceptions — every comment, every issue body, every PR description.
|
||||
## Cycle Management Rules
|
||||
|
||||
## Important Rules
|
||||
1. **ONE TRACKING ISSUE PER CYCLE**: Only one session state tracking issue should exist at a time
|
||||
2. **CLEAN UP BEFORE CREATE**: Always delete the previous cycle's tracking issue before creating a new one
|
||||
3. **VERIFY DELETION**: Confirm the old issue is closed before proceeding
|
||||
4. **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues - they serve as persistent communications
|
||||
5. **STRUCTURED CONTENT**: Always use the standard templates for consistency
|
||||
|
||||
- ALWAYS create a NEW comment (never edit old ones) — preserves full audit history
|
||||
- Each comment must be self-contained — it should have enough info to resume the entire session
|
||||
- The "Resume Instructions" field is critical — it must tell a restarting product-builder exactly what to do next
|
||||
- If the session state issue doesn't exist yet, the product-builder creates it (not this agent)
|
||||
- Keep comments concise but complete — don't omit fields
|
||||
## Error Handling
|
||||
|
||||
## Return Value
|
||||
1. **API Failures**: If issue creation fails, retry once after a short delay
|
||||
2. **Missing Labels**: If "Automation Tracking" label doesn't exist, the issue creation will still succeed
|
||||
3. **Cleanup Failures**: If previous issue deletion fails, still proceed with creating the new issue
|
||||
4. **Search Failures**: If unable to find previous issues, proceed with creation
|
||||
|
||||
- **WRITE**: confirmation that checkpoint was written, comment ID
|
||||
## Return Values
|
||||
|
||||
- **WRITE**: confirmation that tracking issue was created, issue number
|
||||
- **READ**: the parsed session state with all fields
|
||||
- **CLOSE**: confirmation that tracking issues were closed
|
||||
|
||||
## Integration Notes
|
||||
|
||||
This agent works with the broader automation tracking system where:
|
||||
|
||||
- **Implementation Pool**: Uses `[AUTO-IMP-POOL]` prefix for its tracking
|
||||
- **System Watchdog**: Uses `[AUTO-WATCHDOG]` prefix for its tracking
|
||||
- **Backlog Groomer**: Uses `[AUTO-GROOMER]` prefix for its tracking
|
||||
- **Human Liaison**: Uses `[AUTO-LIAISON]` prefix for its tracking
|
||||
- **Session Management**: Uses `[AUTO-SESSION]` prefix for this agent
|
||||
|
||||
All use the "Automation Tracking" label for filtering and the ticket groomer will clean up old tracking issues periodically.
|
||||
@@ -57,6 +57,93 @@ read, write, or modify any files on the filesystem.
|
||||
|
||||
---
|
||||
|
||||
## Automation Tracking System
|
||||
|
||||
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
|
||||
|
||||
### Tracking Issue Format
|
||||
- **Status Updates**: `[AUTO-WATCHDOG] System Health Report (Cycle N)`
|
||||
- **Alerts**: `[AUTO-WATCHDOG] Alert: <issue type>`
|
||||
- **Announcements**: `[AUTO-WATCHDOG] Announce: <message summary>`
|
||||
- **Labels**: "Automation Tracking" + any relevant priority labels
|
||||
|
||||
### Tracking Functions
|
||||
|
||||
```bash
|
||||
# Find and delete previous system watchdog tracking issue
|
||||
function cleanup_previous_watchdog_tracking() {
|
||||
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" | \
|
||||
jq -r '.[] | select(.title | contains("[AUTO-WATCHDOG] System Health Report")) | .number' | head -1)
|
||||
|
||||
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
|
||||
echo "Cleaning up previous system watchdog tracking issue #$previous_issue"
|
||||
|
||||
# Close with final comment
|
||||
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"Health monitoring cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: System Watchdog | Agent: system-watchdog\"}"
|
||||
|
||||
# Close the issue
|
||||
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}'
|
||||
|
||||
echo "✓ Previous watchdog tracking issue #$previous_issue closed"
|
||||
sleep 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Create system health tracking issue
|
||||
function create_watchdog_tracking_issue() {
|
||||
local cycle="$1"
|
||||
local title="[AUTO-WATCHDOG] System Health Report (Cycle $cycle)"
|
||||
local body="$2"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created system health tracking issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create watchdog tracking issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Create alert issue for urgent system problems
|
||||
function create_watchdog_alert_issue() {
|
||||
local alert_type="$1"
|
||||
local priority="$2"
|
||||
local body="$3"
|
||||
local title="[AUTO-WATCHDOG] Alert: $alert_type"
|
||||
|
||||
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
|
||||
-H "Authorization: token $FORGEJO_PAT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
|
||||
|
||||
local issue_number=$(echo "$response" | jq -r '.number')
|
||||
|
||||
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
|
||||
echo "✓ Created system alert issue #$issue_number"
|
||||
return 0
|
||||
else
|
||||
echo "✗ Failed to create alert issue"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
You receive:
|
||||
@@ -2238,26 +2325,52 @@ function format_potential_causes(causes):
|
||||
|
||||
Every 6 cycles (~30 min), post a health signal:
|
||||
|
||||
```
|
||||
post comment on session state issue:
|
||||
"[WATCHDOG] Health report — cycle <N>:
|
||||
- Quality gate violations: <count>
|
||||
- State label mismatches: <count>
|
||||
- Priority ordering issues: <count>
|
||||
- PR pipeline issues: <count>
|
||||
- Zombie/stuck/looping supervisors: <count>
|
||||
- Missing labels/links: <count>
|
||||
- Session introspection findings: <count>
|
||||
- Misbehavior (force_merge, direct push): <count>
|
||||
- Stuck/looping agents: <count>
|
||||
- Context exhaustion signals: <count>
|
||||
- Cross-agent conflicts: <count>
|
||||
- One-off agents dispatched this period: <count>
|
||||
- Issues created this period: <count>
|
||||
```bash
|
||||
# Create comprehensive health report as individual tracking issue (every 6 cycles)
|
||||
if [[ $((cycle % 6)) -eq 0 ]]; then
|
||||
health_report_body="""# System Health Report (Cycle $cycle)
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: System Watchdog | Agent: system-watchdog"
|
||||
**Supervisor**: System Watchdog
|
||||
**Status**: Active
|
||||
**Timestamp**: $(date -Iseconds)
|
||||
**Reporting Period**: Last 6 cycles (30 minutes)
|
||||
|
||||
## System Health Summary
|
||||
- **Quality gate violations**: ${quality_gate_violations_count}
|
||||
- **State label mismatches**: ${state_mismatches_count}
|
||||
- **Priority ordering issues**: ${priority_issues_count}
|
||||
- **PR pipeline issues**: ${pr_pipeline_issues_count}
|
||||
- **Zombie/stuck/looping supervisors**: ${zombie_supervisors_count}
|
||||
- **Missing labels/links**: ${missing_labels_count}
|
||||
|
||||
## Session Introspection Findings
|
||||
- **Misbehavior patterns (force_merge, direct push)**: ${misbehavior_count}
|
||||
- **Stuck/looping agents detected**: ${stuck_agents_count}
|
||||
- **Context exhaustion signals**: ${context_exhaustion_count}
|
||||
- **Cross-agent conflicts**: ${conflicts_count}
|
||||
|
||||
## Actions Taken
|
||||
- **One-off agents dispatched this period**: ${agents_dispatched_count}
|
||||
- **Issues created this period**: ${issues_created_count}
|
||||
- **Alerts posted**: ${alerts_posted_count}
|
||||
|
||||
## System Status
|
||||
- **Overall health**: ${overall_health_status}
|
||||
- **Critical issues requiring attention**: ${critical_issues_list}
|
||||
- **Next detailed check**: Cycle $((cycle + 6))
|
||||
|
||||
## Recent Findings Summary
|
||||
${findings_history_summary}
|
||||
|
||||
---
|
||||
**Automated by CleverAgents Bot**
|
||||
Supervisor: System Watchdog | Agent: system-watchdog
|
||||
**Tracking Type**: Health Report
|
||||
**Cycle**: $cycle"""
|
||||
|
||||
cleanup_previous_watchdog_tracking
|
||||
create_watchdog_tracking_issue $cycle "$health_report_body"
|
||||
fi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user