aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
83 lines • 2.55 kB
TypeScript
/**
* Artifact Metrics — record and query per-artifact token metrics
*
* Hooks into artifact save events, records path/type/agent/timestamp/tokens,
* and persists to `.aiwg/metrics/tokens/`.
*
* @module metrics/artifact-metrics
* @issue #173
* @schema @agentic/code/frameworks/sdlc-complete/schemas/flows/token-efficiency.yaml
*/
import { type ThresholdStatus } from './token-counter.js';
export interface ArtifactMetricRecord {
/** Artifact file path (relative to project root) */
artifactPath: string;
/** Artifact type (requirement, use_case, architecture, etc.) */
artifactType: string;
/** Agent that produced the artifact */
agent: string;
/** ISO 8601 timestamp */
timestamp: string;
/** Token metrics */
tokens: {
totalTokens: number;
nonBlankLines: number;
tokensPerLine: number;
characters: number;
};
/** Threshold status */
thresholdStatus: ThresholdStatus['level'];
}
export interface AgentEfficiencySummary {
agentName: string;
period: string;
totalArtifacts: number;
totalTokens: number;
totalLines: number;
avgTokensPerLine: number;
minTokensPerLine: number;
maxTokensPerLine: number;
vsBenchmark: number;
vsBaseline: number;
trend: 'improving' | 'stable' | 'degrading';
thresholdStatus: ThresholdStatus['level'];
}
export interface MetricsQueryOptions {
/** Filter by agent name */
agent?: string;
/** Filter records since this ISO date or duration string (e.g. '7d', '30d') */
since?: string;
/** Include benchmark comparison */
compareBenchmark?: boolean;
}
export declare class ArtifactMetricsStore {
private projectPath;
private metricsDir;
private records;
constructor(projectPath: string);
/**
* Record metrics for an artifact after save.
*/
recordArtifact(artifactPath: string, content: string, artifactType: string, agent: string): Promise<ArtifactMetricRecord>;
/**
* Query records with optional filters.
*/
queryRecords(options?: MetricsQueryOptions): ArtifactMetricRecord[];
/**
* Get per-agent efficiency summaries.
*/
getAgentSummaries(options?: MetricsQueryOptions): AgentEfficiencySummary[];
/**
* Load records from disk.
*/
load(): Promise<void>;
/**
* Persist records to disk.
*/
private persist;
/**
* Get all records (for testing).
*/
getAllRecords(): ArtifactMetricRecord[];
}
//# sourceMappingURL=artifact-metrics.d.ts.map