AgentSkillsCN

Developer View Tracer

为开发者视图格式化并展示执行轨迹、EFE 指标以及熔断器状态

SKILL.md
--- frontmatter
description: Format and display execution traces, EFE metrics, and circuit breaker status for Developer View

CARF Developer View Tracer Skill

Purpose

Create real-time visualization of the 4-layer cognitive stack, execution traces, state inspection, and Active Inference metrics for AI Act compliance transparency.

When to Use

  • Implementing Developer View panels
  • Adding execution trace timeline
  • Displaying Active Inference EFE metrics
  • Showing circuit breaker status

Backend Data Sources

From QueryResponse

typescript
reasoningChain: ReasoningStep[] // Available ✅

ReasoningStep Structure

typescript
interface ReasoningStep {
  node: string;      // "Router", "Causal Analyst", "Guardian"
  action: string;    // "Classified as Complicated domain"
  confidence: string; // "high", "medium", "low"
  duration?: number;  // ms (PLANNED - not in current API)
  timestamp?: string; // ISO time (PLANNED - not in current API)
}

Developer View Panels

1. Architecture Flow Panel

Map reasoning steps to 4-layer stack:

Step NodeLayerColor
RouterLayer 1: Sense-MakingBlue
Causal AnalystLayer 2: Cognitive MeshGreen
Bayesian ExplorerLayer 2: Cognitive MeshPurple
GuardianLayer 4: GovernanceOrange
Human EscalationLayer 4: GovernanceRed

2. Execution Trace Panel

Format reasoning chain as timeline:

typescript
const formatTrace = (step: ReasoningStep, index: number) => ({
  time: `${(index * 0.5).toFixed(1)}s`, // Simulated timing
  node: step.node,
  action: step.action,
  status: step.confidence === 'high' ? '✅' : '⚠️',
});

3. State Inspector Panel

Display EpistemicState fields:

FieldDisplaySource
cynefin_domainBadgedomain in response
domain_confidenceProgress bardomainConfidence
domain_entropyHeat indicatordomainEntropy
causal_evidenceCollapsible JSONcausalResult
bayesian_evidenceCollapsible JSONbayesianResult
guardian_verdictStatus badgeguardianVerdict

4. Circuit Breaker Panel

Monitor for Guardian/policy violations:

typescript
const getCircuitBreakerStatus = (response: QueryResponse) => {
  if (response.guardianResult?.violations.length > 0) {
    return { status: 'TRIPPED', reason: response.guardianResult.violations[0] };
  }
  if (response.domainEntropy > 0.9) {
    return { status: 'WARNING', reason: 'High entropy detected' };
  }
  return { status: 'SAFE', reason: null };
};

5. Active Inference Metrics (Future)

MetricFormulaDisplay
EFE ScorePragmatic + EpistemicGauge 0-1
Pragmatic ValueRisk termProgress bar
Epistemic ValueAmbiguity termProgress bar
Belief Entropy$H(Q(s))$Heat indicator

Note: Active Inference metrics require pymdp backend integration. Currently not exposed in API.

AI Act Compliance Mapping

RequirementDeveloper View Feature
Art. 12 Record-keepingExecution trace + export
Art. 13 TransparencyArchitecture flow + state inspector
Art. 14 Human oversightGuardian panel + escalation status

API Enhancements Needed

To fully implement Developer View:

EnhancementPurposePriority
Add duration_ms to ReasoningStepTiming infoHIGH
Add timestamp to ReasoningStepAudit trailHIGH
Expose Active Inference EFEMetrics displayMEDIUM
Add /audit-log endpointSession persistenceMEDIUM

Sample ReactFlow Architecture

typescript
const architectureNodes = [
  { id: 'router', data: { label: 'Router' }, position: { x: 100, y: 50 } },
  { id: 'mesh', data: { label: 'Cognitive Mesh' }, position: { x: 300, y: 50 } },
  { id: 'services', data: { label: 'Reasoning' }, position: { x: 500, y: 50 } },
  { id: 'guardian', data: { label: 'Guardian' }, position: { x: 400, y: 150 } },
];

const highlightActiveLayer = (currentStep: string) => {
  // Highlight the node corresponding to current step
};

Troubleshooting

Execution Trace Empty

  • Check reasoningChain in QueryResponse
  • Verify backend is returning steps

Timing Information Missing

  • Current API doesn't include duration
  • Use simulated timing (0.5s per step)