← Lab L4 — Governed Multi-Agent Fabric All modules Lab L6 — Dynamic DAG Orchestrator →

Lab L5 — Role Capability Matrix & Tool Scoping Engine

Phase 3 · ROLES — Lab L5
Status: Authored & Empirically Verified.
Student Lab Package: Authenticated Direct Download from VTAlgo Platform
Branches: main (starter template) · solution (reference architecture).
Video Master: 05:21 min @ 1080p FHD 60fps NVENC · Audio Elmer Oficial (-16 LUFS, Zero BGM) · Curated Synchronized Subtitles (ASS).
Canonical Path: Student repo only — not E:\bridle, not the Kratos live product.

1. Laboratory Objective

Construct from scratch in pure Go an industrial Role Capability Matrix & Dynamic Tool Scoping Engine, proving empirically that agent safety and authority boundaries cannot be entrusted to natural language prompts.

The student implements:


2. The Five Cardinal Subsystems

┌──────────────────────────────────────────────────────────────────────────┐
│             ROLE CAPABILITY MATRIX & SCOPING ENGINE (PURE GO)            │
│                                                                          │
│  ┌─────────────────────────┐           ┌──────────────────────────────┐  │
│  │  1. Bitmask Capability  │           │  2. Dynamic Tool Scoping     │  │
│  │     Matrix [uint64]     ├──────────►│     Engine (HMAC-SHA256)     │  │
│  │  (O(1) Nanosecond Gate) │           │  (Step Quotas / Sandbox)     │  │
│  └─────────────────────────┘           └──────────────┬───────────────┘  │
│                                                       │                  │
│                                                       ▼                  │
│  ┌─────────────────────────┐           ┌──────────────────────────────┐  │
│  │  4. Ephemeral Subagent  │           │  3. In-Flight Tool           │  │
│  │     Recycler (Anti-Drift)│◄──────────┤     Interceptor (AST Oracle) │  │
│  │  (State Checkpointing)  │           │  (go/parser Static Audit)    │  │
│  └───────────┬─────────────┘           └──────────────────────────────┘  │
│              │                                                           │
│              ▼                                                           │
│  ┌────────────────────────────────────────────────────────────────────┐  │
│  │  5. Deterministic In-Memory Test Suite (10/10 in <50ms)            │  │
│  └────────────────────────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────────────────────────┘

1. Bitmask Capability Matrix (pkg/matrix)

2. Dynamic Tool Scoping Engine (pkg/scoping)

3. In-Flight Tool Interceptor (pkg/interceptor)

4. Ephemeral Subagent Recycler (pkg/recycler)

5. Deterministic Test Suite (tests/matrix_test.go)


3. Hands-On Verification Protocol

To run the complete test suite locally:

cd hefesto-lab5-role-matrix
go test -v -race ./...

All 10 deterministic tests must pass with zero data races.