@adaptic/maestro 1.1.8 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/init-maestro.md +304 -8
- package/README.md +28 -0
- package/bin/maestro.mjs +1 -1
- package/docs/guides/agents-observe-setup.md +64 -0
- package/docs/guides/ccxray-diagnostics.md +65 -0
- package/docs/guides/claude-mem-setup.md +79 -0
- package/docs/guides/claude-pace-setup.md +56 -0
- package/docs/guides/claudraband-sessions.md +98 -0
- package/docs/guides/clawteam-swarm.md +116 -0
- package/docs/guides/code-review-graph-setup.md +86 -0
- package/docs/guides/self-optimization-pattern.md +82 -0
- package/docs/guides/slack-setup.md +4 -2
- package/docs/guides/twilio-subaccounts-setup.md +223 -0
- package/docs/guides/webhook-relay-setup.md +349 -0
- package/package.json +2 -1
- package/plugins/maestro-skills/plugin.json +16 -0
- package/plugins/maestro-skills/skills/agents-observe.md +110 -0
- package/plugins/maestro-skills/skills/ccxray-diagnostics.md +91 -0
- package/plugins/maestro-skills/skills/claude-pace.md +61 -0
- package/plugins/maestro-skills/skills/code-review-graph.md +99 -0
- package/scaffold/CLAUDE.md +64 -0
- package/scaffold/config/agent.ts.example +2 -1
- package/scaffold/config/known-agents.json +35 -0
- package/scripts/daemon/classifier.mjs +264 -50
- package/scripts/daemon/dispatcher.mjs +109 -5
- package/scripts/daemon/launchd-wrapper-generic.sh +96 -0
- package/scripts/daemon/launchd-wrapper-slack-events.sh +37 -0
- package/scripts/daemon/launchd-wrapper.sh +91 -0
- package/scripts/daemon/lib/session-router.mjs +274 -0
- package/scripts/daemon/lib/session-router.test.mjs +295 -0
- package/scripts/daemon/prompt-builder.mjs +51 -11
- package/scripts/daemon/responder.mjs +234 -19
- package/scripts/daemon/session-lock.mjs +194 -0
- package/scripts/daemon/sophie-daemon.mjs +16 -2
- package/scripts/email-signature.html +20 -4
- package/scripts/local-triggers/generate-plists.sh +62 -10
- package/scripts/poller/imap-client.mjs +4 -2
- package/scripts/poller/slack-poller.mjs +104 -52
- package/scripts/setup/init-agent.sh +91 -1
- package/scripts/setup/install-dev-tools.sh +150 -0
- package/scripts/spawn-session.sh +21 -6
- package/workflows/continuous/backlog-executor.yaml +141 -0
- package/workflows/daily/evening-wrap.yaml +41 -1
- package/workflows/daily/morning-brief.yaml +17 -0
- package/workflows/event-driven/agent-failure-investigation.yaml +137 -0
- package/workflows/event-driven/pr-review.yaml +104 -0
- package/workflows/weekly/engineering-health.yaml +154 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Backlog Executor — Continuous Execution Loop
|
|
2
|
+
# Runs every 10 minutes via launchd
|
|
3
|
+
# This is the "getting shit done" engine — items move from open → resolved → closed
|
|
4
|
+
|
|
5
|
+
name: backlog-executor
|
|
6
|
+
type: continuous
|
|
7
|
+
schedule: "*/10 * * * *"
|
|
8
|
+
timezone: Asia/Dubai
|
|
9
|
+
description: >
|
|
10
|
+
The core execution engine. Every 10 minutes: check quota, read all queues,
|
|
11
|
+
select top actionable items, spawn parallel agents to execute, review results,
|
|
12
|
+
update queues. Items continuously move forward — not sitting in queues.
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
# ── Gate: Check API quota before spawning agents ──
|
|
16
|
+
- id: quota-gate
|
|
17
|
+
skill: claude-pace
|
|
18
|
+
action: check-quota-headroom
|
|
19
|
+
description: >
|
|
20
|
+
Check Claude API rate limit quota before spawning parallel agents.
|
|
21
|
+
Determines execution batch size based on pace delta zone.
|
|
22
|
+
timeout: 30
|
|
23
|
+
outputs:
|
|
24
|
+
pace_delta: green|yellow|red
|
|
25
|
+
max_parallel_agents: 5|2|1
|
|
26
|
+
recommendation: proceed|reduce|critical-only
|
|
27
|
+
on_result:
|
|
28
|
+
green:
|
|
29
|
+
max_parallel: 5
|
|
30
|
+
include_improvement_backlog: true
|
|
31
|
+
yellow:
|
|
32
|
+
max_parallel: 2
|
|
33
|
+
include_improvement_backlog: false
|
|
34
|
+
red:
|
|
35
|
+
max_parallel: 1
|
|
36
|
+
include_improvement_backlog: false
|
|
37
|
+
skip_non_critical: true
|
|
38
|
+
|
|
39
|
+
# ── Read all queues and select actionable items ──
|
|
40
|
+
- id: queue-scan
|
|
41
|
+
agent: pmo-execution
|
|
42
|
+
action: scan-all-queues
|
|
43
|
+
description: Read all 15 operational queues, select top actionable items by priority
|
|
44
|
+
timeout: 120
|
|
45
|
+
depends_on: [quota-gate]
|
|
46
|
+
inputs:
|
|
47
|
+
queues_dir: state/queues/
|
|
48
|
+
max_items: "{quota-gate.outputs.max_parallel_agents}"
|
|
49
|
+
include_improvement_backlog: "{quota-gate.outputs.on_result.include_improvement_backlog}"
|
|
50
|
+
status_filter: [open, in_progress, blocked]
|
|
51
|
+
sort_by: [priority, sla_deadline, created_at]
|
|
52
|
+
outputs:
|
|
53
|
+
selected_items: []
|
|
54
|
+
queue_summary: {}
|
|
55
|
+
|
|
56
|
+
# ── Spawn parallel execution agents ──
|
|
57
|
+
- id: parallel-execution
|
|
58
|
+
agent: session-spawner
|
|
59
|
+
action: spawn-execution-agents
|
|
60
|
+
description: >
|
|
61
|
+
Spawn one background agent per selected item. Each agent gets full context
|
|
62
|
+
and executes independently. Quota-gated parallelism.
|
|
63
|
+
timeout: 1800 # 30 minutes max for the batch
|
|
64
|
+
depends_on: [queue-scan]
|
|
65
|
+
inputs:
|
|
66
|
+
items: "{queue-scan.outputs.selected_items}"
|
|
67
|
+
max_concurrent: "{quota-gate.outputs.max_parallel_agents}"
|
|
68
|
+
mode: background
|
|
69
|
+
outputs:
|
|
70
|
+
agent_sessions: []
|
|
71
|
+
results: []
|
|
72
|
+
|
|
73
|
+
# ── Monitor running agents (if agents-observe is active) ──
|
|
74
|
+
- id: agent-monitoring
|
|
75
|
+
skill: agents-observe
|
|
76
|
+
action: monitor-parallel-execution
|
|
77
|
+
description: >
|
|
78
|
+
Monitor spawned agents for failures, hangs, or resource contention.
|
|
79
|
+
Only runs if agents-observe dashboard is active — otherwise skipped.
|
|
80
|
+
timeout: 60
|
|
81
|
+
depends_on: [parallel-execution]
|
|
82
|
+
optional: true # Skip if agents-observe is not running
|
|
83
|
+
inputs:
|
|
84
|
+
session_ids: "{parallel-execution.outputs.agent_sessions}"
|
|
85
|
+
check_for: [hung_agents, error_patterns, resource_contention]
|
|
86
|
+
outputs:
|
|
87
|
+
health_report: {}
|
|
88
|
+
failed_agents: []
|
|
89
|
+
|
|
90
|
+
# ── Review results and update queues ──
|
|
91
|
+
- id: results-review
|
|
92
|
+
agent: pmo-execution
|
|
93
|
+
action: review-execution-results
|
|
94
|
+
description: >
|
|
95
|
+
Review agent outputs, update queue item statuses, mark completed items
|
|
96
|
+
as resolved, flag failures for investigation.
|
|
97
|
+
timeout: 120
|
|
98
|
+
depends_on: [parallel-execution, agent-monitoring]
|
|
99
|
+
inputs:
|
|
100
|
+
results: "{parallel-execution.outputs.results}"
|
|
101
|
+
health_report: "{agent-monitoring.outputs.health_report}"
|
|
102
|
+
failed_agents: "{agent-monitoring.outputs.failed_agents}"
|
|
103
|
+
outputs:
|
|
104
|
+
items_resolved: []
|
|
105
|
+
items_failed: []
|
|
106
|
+
items_requeued: []
|
|
107
|
+
|
|
108
|
+
# ── Update executive summary ──
|
|
109
|
+
- id: dashboard-update
|
|
110
|
+
agent: pmo-execution
|
|
111
|
+
action: update-executive-summary
|
|
112
|
+
description: Refresh executive summary dashboard with cycle results
|
|
113
|
+
timeout: 60
|
|
114
|
+
depends_on: [results-review]
|
|
115
|
+
inputs:
|
|
116
|
+
resolved: "{results-review.outputs.items_resolved}"
|
|
117
|
+
failed: "{results-review.outputs.items_failed}"
|
|
118
|
+
requeued: "{results-review.outputs.items_requeued}"
|
|
119
|
+
dashboard: state/dashboards/executive-summary.yaml
|
|
120
|
+
|
|
121
|
+
# ── Log cycle ──
|
|
122
|
+
- id: cycle-log
|
|
123
|
+
action: log
|
|
124
|
+
description: Append cycle summary to backlog executor log
|
|
125
|
+
depends_on: [dashboard-update]
|
|
126
|
+
inputs:
|
|
127
|
+
file: logs/workflows/{date}-backlog-executor.jsonl
|
|
128
|
+
data:
|
|
129
|
+
cycle_time: "{timestamp}"
|
|
130
|
+
pace_delta: "{quota-gate.outputs.pace_delta}"
|
|
131
|
+
items_selected: "{queue-scan.outputs.selected_items.length}"
|
|
132
|
+
items_resolved: "{results-review.outputs.items_resolved.length}"
|
|
133
|
+
items_failed: "{results-review.outputs.items_failed.length}"
|
|
134
|
+
|
|
135
|
+
on_failure:
|
|
136
|
+
action: log-and-notify
|
|
137
|
+
message: "Backlog executor cycle failed at step {failed_step}"
|
|
138
|
+
notify: sophie-chief-of-staff
|
|
139
|
+
severity: high
|
|
140
|
+
# If quota-gate fails, the entire cycle is skipped — this is by design
|
|
141
|
+
quota_gate_failure: skip_cycle
|
|
@@ -41,18 +41,58 @@ steps:
|
|
|
41
41
|
outputs:
|
|
42
42
|
file: outputs/briefs/daily/{date}/still-open.md
|
|
43
43
|
|
|
44
|
+
# ── Daily agent performance summary via agents-observe ──
|
|
45
|
+
- id: agent-performance-summary
|
|
46
|
+
skill: agents-observe
|
|
47
|
+
action: daily-performance-summary
|
|
48
|
+
description: >
|
|
49
|
+
Summarise today's agent execution — sessions run, items completed,
|
|
50
|
+
failures, and total token spend. Feeds into the evening wrap so
|
|
51
|
+
the CEO sees system operational health alongside business outcomes.
|
|
52
|
+
timeout: 120
|
|
53
|
+
parallel_with: still-open
|
|
54
|
+
inputs:
|
|
55
|
+
time_range: today
|
|
56
|
+
metrics:
|
|
57
|
+
- sessions_count
|
|
58
|
+
- items_resolved
|
|
59
|
+
- items_failed
|
|
60
|
+
- total_duration
|
|
61
|
+
- failure_details
|
|
62
|
+
outputs:
|
|
63
|
+
file: outputs/briefs/daily/{date}/agent-performance.md
|
|
64
|
+
summary:
|
|
65
|
+
sessions_today: 0
|
|
66
|
+
items_resolved: 0
|
|
67
|
+
items_failed: 0
|
|
68
|
+
total_agent_hours: ""
|
|
69
|
+
|
|
70
|
+
# ── EOD quota status via claude-pace ──
|
|
71
|
+
- id: eod-quota-status
|
|
72
|
+
skill: claude-pace
|
|
73
|
+
action: eod-quota-check
|
|
74
|
+
description: Report end-of-day quota position for overnight capacity planning
|
|
75
|
+
timeout: 30
|
|
76
|
+
parallel_with: still-open
|
|
77
|
+
outputs:
|
|
78
|
+
pace_delta: green|yellow|red
|
|
79
|
+
overnight_capacity_note: ""
|
|
80
|
+
|
|
44
81
|
- id: synthesise-wrap
|
|
45
82
|
agent: ceo-briefing
|
|
46
83
|
action: produce-evening-wrap
|
|
47
84
|
description: Produce the evening wrap document
|
|
48
85
|
timeout: 300
|
|
49
|
-
depends_on: [completed-today, comms-review, still-open]
|
|
86
|
+
depends_on: [completed-today, comms-review, still-open, agent-performance-summary, eod-quota-status]
|
|
50
87
|
inputs:
|
|
51
88
|
morning_brief: outputs/briefs/daily/{date}/ceo-morning-brief.md
|
|
89
|
+
agent_performance: "{agent-performance-summary.outputs.summary}"
|
|
90
|
+
quota_status: "{eod-quota-status.outputs}"
|
|
52
91
|
components:
|
|
53
92
|
- outputs/briefs/daily/{date}/completed-today.md
|
|
54
93
|
- outputs/briefs/daily/{date}/comms-review.md
|
|
55
94
|
- outputs/briefs/daily/{date}/still-open.md
|
|
95
|
+
- outputs/briefs/daily/{date}/agent-performance.md
|
|
56
96
|
outputs:
|
|
57
97
|
file: outputs/briefs/daily/{date}/ceo-evening-wrap.md
|
|
58
98
|
|
|
@@ -11,11 +11,26 @@ description: >
|
|
|
11
11
|
|
|
12
12
|
# Workflow steps execute sequentially
|
|
13
13
|
steps:
|
|
14
|
+
# ── System health gate — check API quota before the day's workload ──
|
|
15
|
+
- id: quota-status
|
|
16
|
+
skill: claude-pace
|
|
17
|
+
action: morning-quota-check
|
|
18
|
+
description: >
|
|
19
|
+
Check overnight quota consumption and current headroom. Reports pace
|
|
20
|
+
delta zone so the morning brief can flag capacity constraints early.
|
|
21
|
+
timeout: 30
|
|
22
|
+
outputs:
|
|
23
|
+
pace_delta: green|yellow|red
|
|
24
|
+
five_hour_pct: 0
|
|
25
|
+
seven_day_pct: 0
|
|
26
|
+
capacity_note: "" # included in the morning brief if yellow/red
|
|
27
|
+
|
|
14
28
|
- id: market-sweep
|
|
15
29
|
agent: market-research
|
|
16
30
|
action: overnight-market-summary
|
|
17
31
|
description: Gather overnight market movements, key indices, relevant asset class performance
|
|
18
32
|
timeout: 300 # 5 minutes
|
|
33
|
+
parallel_with: quota-status
|
|
19
34
|
inputs:
|
|
20
35
|
scope: [equities, crypto, forex, fixed-income]
|
|
21
36
|
regions: [us, emea, apac]
|
|
@@ -105,6 +120,7 @@ steps:
|
|
|
105
120
|
timeout: 300
|
|
106
121
|
depends_on:
|
|
107
122
|
[
|
|
123
|
+
quota-status,
|
|
108
124
|
market-sweep,
|
|
109
125
|
news-intelligence,
|
|
110
126
|
comms-triage,
|
|
@@ -114,6 +130,7 @@ steps:
|
|
|
114
130
|
calendar-review,
|
|
115
131
|
]
|
|
116
132
|
inputs:
|
|
133
|
+
quota_status: "{quota-status.outputs}" # included as system health section
|
|
117
134
|
components:
|
|
118
135
|
- outputs/briefs/daily/{date}/market-sweep.md
|
|
119
136
|
- outputs/briefs/daily/{date}/news-intelligence.md
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Agent Failure Investigation
|
|
2
|
+
# Event-driven — triggered when a backlog executor agent fails or hangs
|
|
3
|
+
# Uses agents-observe for session analysis and ccxray for token diagnostics
|
|
4
|
+
|
|
5
|
+
name: agent-failure-investigation
|
|
6
|
+
type: event-driven
|
|
7
|
+
trigger:
|
|
8
|
+
event: agent_failure
|
|
9
|
+
source: backlog-executor # or any workflow that spawns agents
|
|
10
|
+
conditions:
|
|
11
|
+
- agent_exit_code: non-zero
|
|
12
|
+
- agent_timeout: exceeded
|
|
13
|
+
- agent_output: error_pattern
|
|
14
|
+
description: >
|
|
15
|
+
Automated post-mortem when an agent fails. Pulls the full session trace
|
|
16
|
+
via agents-observe, analyses token/cost via ccxray logs, determines root
|
|
17
|
+
cause, and recommends remediation. Prevents recurring failures.
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
# ── Pull session trace via agents-observe ──
|
|
21
|
+
- id: session-trace
|
|
22
|
+
skill: agents-observe
|
|
23
|
+
action: query-failed-session
|
|
24
|
+
description: >
|
|
25
|
+
Retrieve the full tool call sequence, timing data, and error state
|
|
26
|
+
for the failed agent session. Identify the last successful action
|
|
27
|
+
before failure.
|
|
28
|
+
timeout: 120
|
|
29
|
+
inputs:
|
|
30
|
+
session_id: "{trigger.session_id}"
|
|
31
|
+
agent_name: "{trigger.agent_name}"
|
|
32
|
+
query:
|
|
33
|
+
- full_tool_call_sequence
|
|
34
|
+
- last_successful_tool
|
|
35
|
+
- error_message
|
|
36
|
+
- timing_breakdown
|
|
37
|
+
- resource_state_at_failure
|
|
38
|
+
outputs:
|
|
39
|
+
file: outputs/investigations/{date}/{session_id}/session-trace.md
|
|
40
|
+
summary:
|
|
41
|
+
last_successful_tool: ""
|
|
42
|
+
error_type: "" # timeout|rate_limit|permission|context_overflow|unknown
|
|
43
|
+
duration_before_failure: ""
|
|
44
|
+
tool_call_count: 0
|
|
45
|
+
|
|
46
|
+
# ── Token analysis via ccxray ──
|
|
47
|
+
- id: token-analysis
|
|
48
|
+
skill: ccxray-diagnostics
|
|
49
|
+
action: analyse-failed-session
|
|
50
|
+
description: >
|
|
51
|
+
Check if the failure was token-related — context window overflow,
|
|
52
|
+
excessive input from tool reads, or cost runaway. Cross-reference
|
|
53
|
+
with session trace timing.
|
|
54
|
+
timeout: 120
|
|
55
|
+
parallel_with: session-trace
|
|
56
|
+
inputs:
|
|
57
|
+
session_id: "{trigger.session_id}"
|
|
58
|
+
log_dir: ~/.ccxray/logs/
|
|
59
|
+
checks:
|
|
60
|
+
- context_window_utilisation
|
|
61
|
+
- input_token_spike # large file reads or tool outputs
|
|
62
|
+
- output_token_pattern # repetitive or runaway generation
|
|
63
|
+
- cost_vs_average # compared to similar agent sessions
|
|
64
|
+
outputs:
|
|
65
|
+
file: outputs/investigations/{date}/{session_id}/token-analysis.md
|
|
66
|
+
summary:
|
|
67
|
+
context_peak_pct: 0
|
|
68
|
+
token_anomaly_detected: false
|
|
69
|
+
cost_vs_average: ""
|
|
70
|
+
|
|
71
|
+
# ── Quota state at time of failure ──
|
|
72
|
+
- id: quota-state
|
|
73
|
+
skill: claude-pace
|
|
74
|
+
action: check-quota-at-failure
|
|
75
|
+
description: >
|
|
76
|
+
Determine whether the failure was caused by or correlated with
|
|
77
|
+
API rate limiting. Check pace delta at the time of failure.
|
|
78
|
+
timeout: 30
|
|
79
|
+
parallel_with: session-trace
|
|
80
|
+
inputs:
|
|
81
|
+
timestamp: "{trigger.failure_timestamp}"
|
|
82
|
+
check:
|
|
83
|
+
- was_rate_limited
|
|
84
|
+
- pace_delta_at_time
|
|
85
|
+
- concurrent_sessions_count
|
|
86
|
+
outputs:
|
|
87
|
+
rate_limited: false
|
|
88
|
+
pace_delta: ""
|
|
89
|
+
concurrent_sessions: 0
|
|
90
|
+
|
|
91
|
+
# ── Root cause analysis ──
|
|
92
|
+
- id: root-cause-analysis
|
|
93
|
+
agent: engineering-oversight
|
|
94
|
+
action: determine-root-cause
|
|
95
|
+
description: >
|
|
96
|
+
Synthesise session trace, token analysis, and quota state to determine
|
|
97
|
+
the root cause. Classify the failure and recommend remediation.
|
|
98
|
+
timeout: 300
|
|
99
|
+
depends_on: [session-trace, token-analysis, quota-state]
|
|
100
|
+
inputs:
|
|
101
|
+
session_trace: outputs/investigations/{date}/{session_id}/session-trace.md
|
|
102
|
+
token_analysis: outputs/investigations/{date}/{session_id}/token-analysis.md
|
|
103
|
+
quota_state: "{quota-state.outputs}"
|
|
104
|
+
trigger_context: "{trigger}"
|
|
105
|
+
outputs:
|
|
106
|
+
file: outputs/investigations/{date}/{session_id}/root-cause.md
|
|
107
|
+
classification:
|
|
108
|
+
root_cause: "" # rate_limit|context_overflow|tool_error|prompt_bug|external_service|unknown
|
|
109
|
+
severity: "" # low|medium|high|critical
|
|
110
|
+
recurrence_risk: "" # low|medium|high
|
|
111
|
+
remediation: "" # specific fix recommendation
|
|
112
|
+
|
|
113
|
+
# ── Update tech debt / improvement backlog if systemic ──
|
|
114
|
+
- id: queue-remediation
|
|
115
|
+
agent: pmo-execution
|
|
116
|
+
action: queue-fix-if-systemic
|
|
117
|
+
description: >
|
|
118
|
+
If the root cause indicates a systemic issue (recurrence_risk: high),
|
|
119
|
+
create an item in tech-debt or improvement-backlog queue.
|
|
120
|
+
timeout: 60
|
|
121
|
+
depends_on: [root-cause-analysis]
|
|
122
|
+
condition: "{root-cause-analysis.outputs.classification.recurrence_risk} == high"
|
|
123
|
+
inputs:
|
|
124
|
+
root_cause: outputs/investigations/{date}/{session_id}/root-cause.md
|
|
125
|
+
target_queue: state/queues/tech-debt.yaml
|
|
126
|
+
item:
|
|
127
|
+
title: "Agent failure: {trigger.agent_name} — {root-cause-analysis.outputs.classification.root_cause}"
|
|
128
|
+
priority: high
|
|
129
|
+
source: "auto:agent-failure-investigation"
|
|
130
|
+
|
|
131
|
+
on_failure:
|
|
132
|
+
action: log-and-notify
|
|
133
|
+
message: "Agent failure investigation failed for session {trigger.session_id}"
|
|
134
|
+
notify: sophie-chief-of-staff
|
|
135
|
+
severity: medium
|
|
136
|
+
|
|
137
|
+
final_output: outputs/investigations/{date}/{session_id}/root-cause.md
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# PR Review Workflow
|
|
2
|
+
# Event-driven — triggered when a new PR is opened or updated in a tracked repo
|
|
3
|
+
# Uses code-review-graph for structural analysis before human/agent review
|
|
4
|
+
|
|
5
|
+
name: pr-review
|
|
6
|
+
type: event-driven
|
|
7
|
+
trigger:
|
|
8
|
+
event: pull_request
|
|
9
|
+
actions: [opened, synchronize]
|
|
10
|
+
repos: # from config/repo-registry.yaml
|
|
11
|
+
- adapticai/engine
|
|
12
|
+
- adapticai/backend
|
|
13
|
+
- adapticai/frontend
|
|
14
|
+
- adapticai/maestro
|
|
15
|
+
- adapticai/sophie-ai
|
|
16
|
+
description: >
|
|
17
|
+
Automated PR review pipeline. When a PR is opened or updated, runs structural
|
|
18
|
+
blast radius analysis via code-review-graph, then produces a review brief.
|
|
19
|
+
Engineering agents use this to make informed review decisions.
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
# ── Structural blast radius analysis ──
|
|
23
|
+
- id: blast-radius
|
|
24
|
+
skill: code-review-graph
|
|
25
|
+
action: blast-radius-analysis
|
|
26
|
+
description: >
|
|
27
|
+
Analyse the PR diff through the tree-sitter knowledge graph. Map which
|
|
28
|
+
functions, modules, and entry points are affected by the changes.
|
|
29
|
+
Determine risk level based on dependency depth and consumer count.
|
|
30
|
+
timeout: 300
|
|
31
|
+
inputs:
|
|
32
|
+
repo: "{trigger.repo}"
|
|
33
|
+
pr_number: "{trigger.pr_number}"
|
|
34
|
+
base_branch: "{trigger.base_ref}"
|
|
35
|
+
head_branch: "{trigger.head_ref}"
|
|
36
|
+
analysis:
|
|
37
|
+
- changed_functions
|
|
38
|
+
- direct_dependents
|
|
39
|
+
- transitive_impact
|
|
40
|
+
- affected_entry_points
|
|
41
|
+
- untouched_related_functions # functions that probably should have changed
|
|
42
|
+
outputs:
|
|
43
|
+
file: outputs/reviews/{repo}/{pr_number}/blast-radius.md
|
|
44
|
+
summary:
|
|
45
|
+
risk_level: low|medium|high|critical
|
|
46
|
+
direct_dependents: 0
|
|
47
|
+
transitive_impact: 0
|
|
48
|
+
missing_changes: [] # related functions not in the diff
|
|
49
|
+
|
|
50
|
+
# ── Review context enrichment ──
|
|
51
|
+
- id: review-context
|
|
52
|
+
skill: code-review-graph
|
|
53
|
+
action: review-context
|
|
54
|
+
description: >
|
|
55
|
+
Pull structural context for each changed file — what calls them, what
|
|
56
|
+
they call, hot paths, and critical modules. Provides the reviewer with
|
|
57
|
+
the "why this matters" context for every changed file.
|
|
58
|
+
timeout: 180
|
|
59
|
+
parallel_with: blast-radius
|
|
60
|
+
inputs:
|
|
61
|
+
repo: "{trigger.repo}"
|
|
62
|
+
changed_files: "{trigger.changed_files}"
|
|
63
|
+
outputs:
|
|
64
|
+
file: outputs/reviews/{repo}/{pr_number}/review-context.md
|
|
65
|
+
|
|
66
|
+
# ── Produce review brief ──
|
|
67
|
+
- id: review-brief
|
|
68
|
+
agent: engineering-oversight
|
|
69
|
+
action: produce-pr-review-brief
|
|
70
|
+
description: >
|
|
71
|
+
Synthesise blast radius and review context into a concise review brief.
|
|
72
|
+
Highlights risk areas, suggests review focus, and flags missing changes.
|
|
73
|
+
timeout: 180
|
|
74
|
+
depends_on: [blast-radius, review-context]
|
|
75
|
+
inputs:
|
|
76
|
+
blast_radius: outputs/reviews/{repo}/{pr_number}/blast-radius.md
|
|
77
|
+
review_context: outputs/reviews/{repo}/{pr_number}/review-context.md
|
|
78
|
+
pr_metadata:
|
|
79
|
+
repo: "{trigger.repo}"
|
|
80
|
+
pr_number: "{trigger.pr_number}"
|
|
81
|
+
author: "{trigger.author}"
|
|
82
|
+
title: "{trigger.title}"
|
|
83
|
+
outputs:
|
|
84
|
+
file: outputs/reviews/{repo}/{pr_number}/review-brief.md
|
|
85
|
+
|
|
86
|
+
# ── Post review brief as PR comment ──
|
|
87
|
+
- id: post-review
|
|
88
|
+
agent: github-operator
|
|
89
|
+
action: post-pr-comment
|
|
90
|
+
description: Post the review brief as a PR comment for the reviewer
|
|
91
|
+
depends_on: [review-brief]
|
|
92
|
+
inputs:
|
|
93
|
+
repo: "{trigger.repo}"
|
|
94
|
+
pr_number: "{trigger.pr_number}"
|
|
95
|
+
content: outputs/reviews/{repo}/{pr_number}/review-brief.md
|
|
96
|
+
format: markdown
|
|
97
|
+
|
|
98
|
+
on_failure:
|
|
99
|
+
action: log-and-notify
|
|
100
|
+
message: "PR review workflow failed for {trigger.repo}#{trigger.pr_number} at step {failed_step}"
|
|
101
|
+
notify: sophie-chief-of-staff
|
|
102
|
+
severity: low # PR review failure is inconvenient but not critical
|
|
103
|
+
|
|
104
|
+
final_output: outputs/reviews/{repo}/{pr_number}/review-brief.md
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Weekly Engineering Health Check
|
|
2
|
+
# Runs every Wednesday at 10:00 GST — before the weekly execution review
|
|
3
|
+
# Uses ccxray and code-review-graph for data-driven engineering insights
|
|
4
|
+
|
|
5
|
+
name: engineering-health
|
|
6
|
+
schedule: "0 10 * * 3" # Wednesday 10:00
|
|
7
|
+
timezone: Asia/Dubai
|
|
8
|
+
description: >
|
|
9
|
+
Weekly engineering health assessment. Audits token spend across agent sessions,
|
|
10
|
+
scans codebase architecture for structural drift, and produces an engineering
|
|
11
|
+
health dashboard update. Feeds into the weekly strategic memo.
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
# ── Token budget audit via ccxray ──
|
|
15
|
+
- id: token-budget-audit
|
|
16
|
+
skill: ccxray-diagnostics
|
|
17
|
+
action: weekly-token-audit
|
|
18
|
+
description: >
|
|
19
|
+
Analyse the past week's Claude API token consumption across all agent
|
|
20
|
+
sessions. Identify expensive sessions, cost trends, and optimisation
|
|
21
|
+
opportunities. Uses ccxray historical logs.
|
|
22
|
+
timeout: 300
|
|
23
|
+
inputs:
|
|
24
|
+
time_range: 7d
|
|
25
|
+
log_dir: ~/.ccxray/logs/
|
|
26
|
+
breakdown_by: [agent, workflow, day]
|
|
27
|
+
compare_to: previous_week
|
|
28
|
+
outputs:
|
|
29
|
+
file: outputs/engineering/weekly/{date}/token-audit.md
|
|
30
|
+
summary:
|
|
31
|
+
total_tokens: 0
|
|
32
|
+
total_cost: 0
|
|
33
|
+
most_expensive_agent: ""
|
|
34
|
+
week_over_week_delta: ""
|
|
35
|
+
optimisation_recommendations: []
|
|
36
|
+
|
|
37
|
+
# ── Codebase architecture scan via code-review-graph ──
|
|
38
|
+
- id: architecture-scan
|
|
39
|
+
skill: code-review-graph
|
|
40
|
+
action: architecture-overview
|
|
41
|
+
description: >
|
|
42
|
+
Run tree-sitter structural analysis across key repositories. Detect
|
|
43
|
+
circular dependencies, orphaned exports, and architectural drift from
|
|
44
|
+
the intended design. Compares against previous week's baseline.
|
|
45
|
+
timeout: 600
|
|
46
|
+
parallel_with: token-budget-audit
|
|
47
|
+
inputs:
|
|
48
|
+
repos:
|
|
49
|
+
- path: ~/adapticai/engine
|
|
50
|
+
name: adaptic-engine
|
|
51
|
+
- path: ~/adapticai/backend
|
|
52
|
+
name: adaptic-backend
|
|
53
|
+
- path: ~/maestro
|
|
54
|
+
name: maestro
|
|
55
|
+
checks:
|
|
56
|
+
- circular_dependencies
|
|
57
|
+
- orphaned_exports
|
|
58
|
+
- module_coupling_score
|
|
59
|
+
- public_api_surface_changes
|
|
60
|
+
baseline: outputs/engineering/weekly/latest/architecture-baseline.json
|
|
61
|
+
outputs:
|
|
62
|
+
file: outputs/engineering/weekly/{date}/architecture-scan.md
|
|
63
|
+
baseline_update: outputs/engineering/weekly/{date}/architecture-baseline.json
|
|
64
|
+
summary:
|
|
65
|
+
repos_scanned: 0
|
|
66
|
+
circular_deps_found: 0
|
|
67
|
+
orphaned_exports: 0
|
|
68
|
+
api_surface_changes: []
|
|
69
|
+
|
|
70
|
+
# ── Agent performance profile via agents-observe ──
|
|
71
|
+
- id: agent-performance-review
|
|
72
|
+
skill: agents-observe
|
|
73
|
+
action: weekly-performance-profile
|
|
74
|
+
description: >
|
|
75
|
+
Review agent execution patterns from the past week. Identify slowest
|
|
76
|
+
agents, most-used tools, failure patterns, and efficiency trends.
|
|
77
|
+
Uses agents-observe SQLite historical data.
|
|
78
|
+
timeout: 300
|
|
79
|
+
parallel_with: token-budget-audit
|
|
80
|
+
inputs:
|
|
81
|
+
time_range: 7d
|
|
82
|
+
metrics:
|
|
83
|
+
- agent_duration_distribution
|
|
84
|
+
- tool_call_frequency
|
|
85
|
+
- failure_rate_by_agent
|
|
86
|
+
- bottleneck_tools
|
|
87
|
+
compare_to: previous_week
|
|
88
|
+
outputs:
|
|
89
|
+
file: outputs/engineering/weekly/{date}/agent-performance.md
|
|
90
|
+
summary:
|
|
91
|
+
total_sessions: 0
|
|
92
|
+
avg_session_duration: ""
|
|
93
|
+
failure_rate: ""
|
|
94
|
+
slowest_agent: ""
|
|
95
|
+
most_used_tool: ""
|
|
96
|
+
|
|
97
|
+
# ── Quota trend analysis via claude-pace ──
|
|
98
|
+
- id: quota-trend
|
|
99
|
+
skill: claude-pace
|
|
100
|
+
action: weekly-quota-trend
|
|
101
|
+
description: >
|
|
102
|
+
Analyse quota utilisation patterns over the past week. Identify peak
|
|
103
|
+
usage periods, quota constraint frequency, and capacity planning
|
|
104
|
+
recommendations.
|
|
105
|
+
timeout: 120
|
|
106
|
+
parallel_with: token-budget-audit
|
|
107
|
+
inputs:
|
|
108
|
+
source: logs/workflows/ # Extract quota data from backlog executor logs
|
|
109
|
+
time_range: 7d
|
|
110
|
+
metrics:
|
|
111
|
+
- daily_peak_usage
|
|
112
|
+
- red_zone_incidents
|
|
113
|
+
- deferred_items_count
|
|
114
|
+
outputs:
|
|
115
|
+
file: outputs/engineering/weekly/{date}/quota-trend.md
|
|
116
|
+
|
|
117
|
+
# ── Synthesise engineering health report ──
|
|
118
|
+
- id: synthesise-health-report
|
|
119
|
+
agent: engineering-oversight
|
|
120
|
+
action: produce-engineering-health-report
|
|
121
|
+
description: >
|
|
122
|
+
Synthesise token audit, architecture scan, agent performance, and quota
|
|
123
|
+
trends into a unified engineering health dashboard update and narrative.
|
|
124
|
+
timeout: 300
|
|
125
|
+
depends_on:
|
|
126
|
+
[token-budget-audit, architecture-scan, agent-performance-review, quota-trend]
|
|
127
|
+
inputs:
|
|
128
|
+
components:
|
|
129
|
+
- outputs/engineering/weekly/{date}/token-audit.md
|
|
130
|
+
- outputs/engineering/weekly/{date}/architecture-scan.md
|
|
131
|
+
- outputs/engineering/weekly/{date}/agent-performance.md
|
|
132
|
+
- outputs/engineering/weekly/{date}/quota-trend.md
|
|
133
|
+
dashboard: state/dashboards/engineering-health.yaml
|
|
134
|
+
outputs:
|
|
135
|
+
file: outputs/engineering/weekly/{date}/engineering-health-report.md
|
|
136
|
+
dashboard_update: state/dashboards/engineering-health.yaml
|
|
137
|
+
|
|
138
|
+
# ── Notify ──
|
|
139
|
+
- id: notify-ready
|
|
140
|
+
action: notify
|
|
141
|
+
description: Signal engineering health report is ready for the execution review
|
|
142
|
+
depends_on: [synthesise-health-report]
|
|
143
|
+
inputs:
|
|
144
|
+
channel: slack
|
|
145
|
+
target: "#engineering"
|
|
146
|
+
message: "Weekly engineering health report ready — feeding into execution review."
|
|
147
|
+
|
|
148
|
+
on_failure:
|
|
149
|
+
action: log-and-notify
|
|
150
|
+
message: "Engineering health check failed at step {failed_step}"
|
|
151
|
+
notify: sophie-chief-of-staff
|
|
152
|
+
severity: medium
|
|
153
|
+
|
|
154
|
+
final_output: outputs/engineering/weekly/{date}/engineering-health-report.md
|