/** * Workflow Telemetry Module — Agent Workflow Compliance Metrics * * Computes compliance metrics for WF-001 through WF-005 workflow rules * defined in T063. Queries existing data from tasks, sessions, and audit_log * tables — no new infrastructure required. * * Metrics produced: * - AC compliance rate: % of tasks with ≥3 acceptance criteria * - Session compliance rate: % of task completions that occurred within a session * - Gate compliance rate: Average verification gates set per completed task * - Workflow violations: Count of tasks that bypassed WF rules * * @task T065 * @epic T056 */ /** Per-rule compliance breakdown. */ export interface WorkflowRuleMetric { /** Rule identifier, e.g. WF-001. */ rule: string; /** Human-readable rule description. */ description: string; /** Total tasks or events that were subject to this rule. */ total: number; /** Number that violated the rule. */ violations: number; /** Compliance rate 0..1 (1 = fully compliant). */ complianceRate: number; } /** Full workflow compliance report. */ export interface WorkflowComplianceReport { /** ISO timestamp when metrics were computed. */ generatedAt: string; /** Time window filtered (ISO cutoff) or null for all-time. */ since: string | null; /** Overall compliance score 0..1 (average of all rule rates). */ overallScore: number; /** Grade letter derived from overallScore. */ grade: string; /** Per-rule breakdown. */ rules: WorkflowRuleMetric[]; /** Task-level violation samples (up to 20). */ violationSamples: Array<{ taskId: string; rule: string; detail: string; }>; /** Raw counts for context. */ summary: { totalTasks: number; completedTasks: number; tasksWithAC: number; tasksWithoutAC: number; completionsInSession: number; completionsOutsideSession: number; tasksWithGates: number; avgGatesSet: number; }; } /** * Compute workflow compliance metrics from existing task, session, and audit data. * * Rules evaluated: * WF-001: Tasks MUST have ≥3 acceptance criteria (T058) * WF-002: Task completions MUST occur within an active session (T059) * WF-003: Completed tasks SHOULD have verification gates set (T061) * WF-004: Tasks with verification SHOULD have all 3 gates set * WF-005: Tasks MUST have session binding on creation (non-epic) * * @remarks * Derives all metrics from existing audit_log and tasks tables — no new * tracking infrastructure is required. * * @param opts - Report options * @param opts.since - ISO 8601 date string to filter metrics from * @param opts.cwd - Working directory for database resolution * @returns Compliance report with per-rule pass/fail counts and overall rate * * @example * ```ts * const report = await getWorkflowComplianceReport({ cwd: '/my/project' }); * console.log(report.overall.passRate); // e.g. 0.85 * ``` */ export declare function getWorkflowComplianceReport(opts: { since?: string; cwd?: string; }): Promise; //# sourceMappingURL=workflow-telemetry.d.ts.map