Inspiration

As AI-generated code and AI-drafted clinical documentation become ubiquitous, both software engineers and healthcare researchers face the same fundamental crisis: plausible-sounding hallucinations and subtle boundary violations. Yet teams keep building siloed, monolithic verification tools from scratch for every domain.

For Kiroween 2026 (Skeleton Crew Category), we asked: Can we build a single, lean (<800 LOC) Spec-Driven Multi-Agent Verification Skeleton in Kiro that separates formal specification compilation from domain tool execution—and prove its flexibility by powering two radically different applications?


What It Does: One Skeleton, Two Distinct Applications

SpecGuard-Crew is a spec-driven multi-agent verification engine (packages/specguard_core) orchestrated via Kiro Crew and Model Context Protocol (MCP). Using the same 3-agent pipeline (ClaimExtractor → CounterexampleHunter → EvidenceAuditor), it powers two separate applications housed in dedicated directories:

1. App #1: apps/repo-necromancer (DevSecOps & Legacy Code Resurrection)

  • Domain: Software Engineering & Formal Property-Based Security Auditing
  • Theme: Haunted CRT / Necromancer Terminal UI
  • Functionality: Takes brittle legacy Python/TypeScript code or AI-generated PRs, compiles formal EARS (WHEN ... THE SYSTEM SHALL ...) specifications, automatically synthesizes and runs Property-Based Tests (PBT) via Hypothesis inside an isolated MCP sandbox, uncovers minimal falsifying counterexamples, and generates verified patches.

2. App #2: apps/med-evidence-checker (Clinical Guideline & Medication Safety Verifier)

  • Domain: Healthcare & Clinical Decision Support (100% synthetic vignettes & public PubMedQA guidelines — Zero PHI)
  • Theme: High-Contrast Clinical Precision Dashboard UI
  • Functionality: Takes AI-drafted discharge summaries or medication plans, extracts atomic clinical claims (dosage, renal adjustments, drug-drug interactions, pregnancy contraindications), cross-examines them against structured clinical guidelines via MCP, and outputs an evidence-graded safety audit with quantitative precision/recall metrics.

How We Built It with Kiro (Full /.kiro Integration)

Every Kiro product capability is deeply integrated and exposed in the root /.kiro directory (and visualized live inside our web workbench via the .kiro Live Inspector):

  1. Kiro Specs (/.kiro/specs/):
    • Formal requirements.md using EARS syntax (WHEN, IF/THEN, WHERE, WHILE ... THE SYSTEM SHALL ... — 21 compiled EARS invariants across 3 specs), design.md defining 6 formal Correctness Properties, and tasks.md.
  2. Property-Based Testing (PBT):
    • Directly maps design.md correctness properties into executable Hypothesis property test suites (tests/test_skeleton_properties.py) and uses PBT at runtime inside RepoNecromancer to shrink edge-case counterexamples.
  3. Kiro Steering Docs (/.kiro/steering/):
    • product.md (enforces Zero-PHI clinical safety guardrails and dual-app boundaries), tech.md (mandates deterministic replay fallback alongside live LLM inference), and structure.md (enforces strict decoupling between specguard_core and the two app folders).
  4. Kiro Agent Hooks (/.kiro/hooks/):
    • spec-to-schema-sync.yaml (syncs EARS specs to JSON schemas on save), property-test-guard.yaml (runs fast PBT invariants on code edits), and benchmark-report-updater.yaml (auto-updates benchmark tables when evaluations run).
  5. Custom Agents & Kiro Crew (/.kiro/agents/):
    • Defines the 3 specialized Kiro Crew roles (claim-extractor, counterexample-hunter, evidence-auditor) that collaborate across both domains without domain-specific hardcoding in the core state machine.
  6. Model Context Protocol (/.kiro/mcp/mcp.json):
    • Connects the core crew to packages/specguard_mcp_server, dynamically swapping run_property_test_sandbox (for App #1) and query_clinical_guidelines_db (for App #2).
  7. Kiro Powers (/.kiro/powers/):
    • Packages reusable Spec-to-PBT and Evidence-Audit workflows as modular Kiro Powers with POWER.md and MCP tool bindings.

Quantitative Evaluation Report: Single-Prompt Baseline vs. SpecGuard-Crew

Generated deterministically via python3 benchmarks/run_evaluation.py

1. App #1: RepoNecromancer (benchmarks/dataset_code_bugs.json, N=15)

Method TP FP TN FN Precision Recall (Sensitivity) Specificity F1-Score False Negative Rate
Single-Prompt Baseline 2 0 5 8 100.00% 20.00% 100.00% 33.33% 80.00%
SpecGuard-Crew (Kiro + Hypothesis PBT) 10 0 5 0 100.00% 100.00% 100.00% 100.00% 0.00%

2. App #2: MedEvidence-Checker (benchmarks/dataset_clinical_cases.json, N=20, Zero-PHI)

Method TP FP TN FN Precision Recall (Sensitivity) Specificity F1-Score False Negative Rate
Single-Prompt Baseline 1 0 8 11 100.00% 8.33% 100.00% 15.38% 91.67%
SpecGuard-Crew (Kiro + MCP Guideline KB) 12 0 8 0 100.00% 100.00% 100.00% 100.00% 0.00%

Built With

Share this project:

Updates