name: ‘step-04-evaluate-and-score’ description: ‘Orchestrate adaptive NFR evidence domain audits (agent-team, subagent, or sequential)’
Select execution mode deterministically, then audit NFR evidence domains using agent-team, subagent, or sequential execution while preserving output contracts.
{communication_language}tea_execution_mode, tea_capability_probe)Generate unique timestamp:
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
Prepare context:
const parseBooleanFlag = (value, defaultValue = true) => {
if (typeof value === 'string') {
const normalized = value.trim().toLowerCase();
if (['false', '0', 'off', 'no'].includes(normalized)) return false;
if (['true', '1', 'on', 'yes'].includes(normalized)) return true;
}
if (value === undefined || value === null) return defaultValue;
return Boolean(value);
};
const subagentContext = {
system_context: /* from Step 1 */,
nfr_thresholds: /* from Step 2 */,
evidence_gathered: /* from Step 3 */,
config: {
execution_mode: config.tea_execution_mode || 'auto', // "auto" | "subagent" | "agent-team" | "sequential"
capability_probe: parseBooleanFlag(config.tea_capability_probe, true), // supports booleans and "false"/"true" strings
},
timestamp: timestamp
};
const normalizeUserExecutionMode = (mode) => {
if (typeof mode !== 'string') return null;
const normalized = mode.trim().toLowerCase().replace(/[-_]/g, ' ').replace(/\s+/g, ' ');
if (normalized === 'auto') return 'auto';
if (normalized === 'sequential') return 'sequential';
if (normalized === 'subagent' || normalized === 'sub agent' || normalized === 'subagents' || normalized === 'sub agents') {
return 'subagent';
}
if (normalized === 'agent team' || normalized === 'agent teams' || normalized === 'agentteam') {
return 'agent-team';
}
return null;
};
const normalizeConfigExecutionMode = (mode) => {
if (mode === 'subagent') return 'subagent';
if (mode === 'auto' || mode === 'sequential' || mode === 'subagent' || mode === 'agent-team') {
return mode;
}
return null;
};
// Explicit user instruction in the active run takes priority over config.
const explicitModeFromUser = normalizeUserExecutionMode(runtime.getExplicitExecutionModeHint?.() || null);
const requestedMode = explicitModeFromUser || normalizeConfigExecutionMode(subagentContext.config.execution_mode) || 'auto';
const probeEnabled = subagentContext.config.capability_probe;
const supports = {
subagent: false,
agentTeam: false,
};
if (probeEnabled) {
supports.subagent = runtime.canLaunchSubagents?.() === true;
supports.agentTeam = runtime.canLaunchAgentTeams?.() === true;
}
let resolvedMode = requestedMode;
if (requestedMode === 'auto') {
if (supports.agentTeam) resolvedMode = 'agent-team';
else if (supports.subagent) resolvedMode = 'subagent';
else resolvedMode = 'sequential';
} else if (probeEnabled && requestedMode === 'agent-team' && !supports.agentTeam) {
resolvedMode = supports.subagent ? 'subagent' : 'sequential';
} else if (probeEnabled && requestedMode === 'subagent' && !supports.subagent) {
resolvedMode = 'sequential';
}
subagentContext.execution = {
requestedMode,
resolvedMode,
probeEnabled,
supports,
};
Resolution precedence:
agent team => agent-team; subagent => subagent; sequential; auto)tea_execution_mode from configIf probing is disabled, honor the requested mode strictly. If that mode cannot be executed at runtime, fail with explicit error instead of silent fallback.
Subagent A: Security Evidence Audit
./step-04a-subagent-security.md/tmp/tea-nfr-security-${timestamp}.jsonagent-team or subagent: launch non-blockingsequential: run blocking and waitSubagent B: Performance Evidence Audit
./step-04b-subagent-performance.md/tmp/tea-nfr-performance-${timestamp}.jsonSubagent C: Reliability Evidence Audit
./step-04c-subagent-reliability.md/tmp/tea-nfr-reliability-${timestamp}.jsonSubagent D: Scalability Evidence Audit
./step-04d-subagent-scalability.md/tmp/tea-nfr-scalability-${timestamp}.jsonIn agent-team and subagent modes, runtime decides worker scheduling and concurrency.
If resolvedMode is agent-team or subagent:
⏳ Waiting for 4 NFR subagents to complete...
├── Subagent A (Security): Running... ⟳
├── Subagent B (Performance): Running... ⟳
├── Subagent C (Reliability): Running... ⟳
└── Subagent D (Scalability): Running... ⟳
[... time passes ...]
✅ All 4 NFR subagents completed!
If resolvedMode is sequential:
✅ Sequential mode: each worker already completed during dispatch.
const outputs = ['security', 'performance', 'reliability', 'scalability'].map((domain) => `/tmp/tea-nfr-${domain}-${timestamp}.json`);
outputs.forEach((output) => {
if (!fs.existsSync(output)) {
throw new Error(`Subagent output missing: ${output}`);
}
});
🚀 Performance Report:
- Execution Mode: {resolvedMode}
- Total Elapsed: ~mode-dependent
- Parallel Gain: ~67% faster when mode is subagent/agent-team
Load next step: {nextStepFile}
The aggregation step will:
Proceed when all 4 required worker steps completed and outputs exist.