Skip to content

Lab Exercise Bank

Fifteen lab exercises that complement the 10 labs in Guidebook Chapter 12. Organized by difficulty: 5 beginner, 5 intermediate, 5 advanced.

Each exercise includes:

  • Learning objective
  • Prerequisites
  • Scaffold code or YAML
  • Expected output
  • Extension challenge
  • Difficulty and time estimate

All exercises run in mock mode unless noted. No API keys required for the beginner and intermediate tiers.


Beginner (Labs B1-B5)

B1. Inventory the persona catalog

  • Difficulty: Beginner | Time: 20 min
  • Objective: Learn the registry API and build a mental map of the 147 persona catalog.
  • Prerequisites: Completed first-30-minutes.md.
  • Scaffold:
    from fcc.personas.registry import PersonaRegistry
    
    registry = PersonaRegistry.from_package_data()
    for cat in sorted(registry.categories()):
        count = len(registry.by_category(cat))
        print(f"{cat:28} {count:3}")
    
  • Expected output: A 20-line table summing to 147.
  • Extension: Add a second column showing the percentage of personas in each category that have a champion_of field set.

B2. R.I.S.C.E.A.R. reading

  • Difficulty: Beginner | Time: 30 min
  • Objective: Build fluency with the 10-component spec.
  • Prerequisites: B1.
  • Scaffold: Pick 3 personas from 3 different categories; print each persona's full R.I.S.C.E.A.R.
  • Expected output: Three formatted blocks, one per persona.
  • Extension: Write a 1-paragraph compare/contrast on archetypes.

B3. Run three scenarios

  • Difficulty: Beginner | Time: 25 min
  • Objective: Practice the simulation loop.
  • Prerequisites: B1.
  • Scaffold:
    from fcc.scenarios.loader import ScenarioLoader
    from fcc.simulation.engine import SimulationEngine
    
    scenarios = ScenarioLoader.from_package_data()
    engine = SimulationEngine(registry=registry, mode="mock")
    
    for sid in ["basic_fcc_cycle", "compliance_quick", "docs_refresh"]:
        trace = engine.run(scenarios.get(sid))
        print(f"{sid}: {len(trace.steps)} steps, {trace.duration_ms}ms")
    
  • Expected output: Three summary lines.
  • Extension: Plot steps-per-scenario as an ASCII bar chart.

B4. Read a trace in depth

  • Difficulty: Beginner | Time: 30 min
  • Objective: Distinguish phase, action_type, and persona.
  • Prerequisites: B3.
  • Scaffold: For one trace, list every step's phase, action type, and first 40 chars of output.
  • Expected output: A table with FIND/CREATE/CRITIQUE rows.
  • Extension: Highlight any step where the phase and action type don't match the expected pairing.

B5. Author your first persona

  • Difficulty: Beginner | Time: 45 min
  • Objective: Produce a valid custom persona YAML and load it.
  • Prerequisites: B2.
  • Scaffold:
    fcc add-persona "Friendly Explainer" --phase Create --id FE
    
  • Expected output: A YAML file; registry.get("friendly_explainer") returns a PersonaSpec.
  • Extension: Add a full dimension profile (use PersonaDimensionProfile).

Intermediate (Labs I1-I5)

I1. Archetype family visualizer

  • Difficulty: Intermediate | Time: 60 min
  • Objective: Aggregate personas by archetype and produce a chart.
  • Prerequisites: B1, B2.
  • Scaffold:
    from collections import Counter
    counts = Counter(p.riscear.archetype for p in registry.all())
    for archetype, n in counts.most_common():
        print(f"{archetype:30} {n}")
    
  • Expected output: A frequency table showing The Navigator, The Guardian, The Steward, etc.
  • Extension: Build a matplotlib bar chart if available; otherwise ASCII.

I2. Event subscriber: latency monitor

  • Difficulty: Intermediate | Time: 75 min
  • Objective: Consume STEP_COMPLETED events to compute per-persona average latency.
  • Prerequisites: Notebook 05.
  • Scaffold:
    from fcc.messaging.bus import EventBus
    from fcc.messaging.events import EventType
    
    bus = EventBus()
    latencies = {}
    
    def on_step(ev):
        pid = ev.payload["persona_id"]
        latencies.setdefault(pid, []).append(ev.payload["latency_ms"])
    
    bus.subscribe(on_step, filter=EventType.STEP_COMPLETED)
    
  • Expected output: Dict of persona_id -> mean latency.
  • Extension: Add p50/p95 latency columns.

I3. Knowledge-graph query

  • Difficulty: Intermediate | Time: 60 min
  • Objective: Build and query a small knowledge graph.
  • Prerequisites: Notebook 16.
  • Scaffold: Use build_full_fcc_graph(); find all PRODUCES edges.
  • Expected output: List of (source, target) pairs.
  • Extension: Export the subgraph to Turtle.

I4. Compliance quick audit

  • Difficulty: Intermediate | Time: 90 min
  • Objective: Classify 3 personas under EU AI Act and generate an audit.
  • Prerequisites: Notebook 19.
  • Scaffold:
    from fcc.compliance.classifier import AIActClassifier
    from fcc.compliance.auditor import ComplianceAuditor
    
    classifier = AIActClassifier.default()
    for pid in ["compliance_guardian", "research_catalyst", "ux_copilot"]:
        print(pid, classifier.classify(registry.get(pid)))
    
  • Expected output: Three (persona, RiskCategory) lines.
  • Extension: Build the full ComplianceReport and render a finding summary.

I5. Scenario diffing

  • Difficulty: Intermediate | Time: 75 min
  • Objective: Detect what changes between two scenario variants.
  • Prerequisites: B3.
  • Scaffold: Write a function diff_scenarios(a, b) returning added/removed personas and workflow changes.
  • Expected output: Structured diff object.
  • Extension: Integrate into a pre-commit hook that blocks unlabeled scenario mutations.

Advanced (Labs A1-A5)

A1. Cross-family collaboration heatmap

  • Difficulty: Advanced | Time: 120 min
  • Objective: Quantify how often personas from different archetype families collaborate via the cross-reference matrix.
  • Prerequisites: I1, cross_reference.yaml familiarity.
  • Scaffold:
    from fcc.personas.cross_reference import CrossReferenceMatrix
    xref = CrossReferenceMatrix.from_package_data()
    # Build archetype x archetype edge count matrix
    
  • Expected output: A heatmap (matplotlib if available; else ASCII) of family-vs-family edge counts.
  • Extension: Identify the top 3 bridge personas with the most cross-family edges.

A2. RAG pipeline over a custom corpus

  • Difficulty: Advanced | Time: 150 min
  • Objective: Index a document corpus and run persona-aware queries.
  • Prerequisites: Notebook 17.
  • Scaffold: Use DocumentChunker with the paragraph strategy; index via SemanticRetriever; query via RAGPipeline.ask(persona_id, query).
  • Expected output: Ranked result list with scores.
  • Extension: Compare retrieval quality across the 6 chunking strategies.

A3. Federated entity resolution

  • Difficulty: Advanced | Time: 120 min
  • Objective: Resolve an entity across two FCC namespaces.
  • Prerequisites: Notebook 11.
  • Scaffold: Load NamespaceRegistry, register two mock namespaces, resolve a synthetic entity.
  • Expected output: Resolved entity with both namespace IDs.
  • Extension: Write a plugin conforming to VocabularyProviderPlugin and verify the contract.

A4. CLEAR+ benchmark harness

  • Difficulty: Advanced | Time: 180 min
  • Objective: Run a 2-arm benchmark and generate a comparison report.
  • Prerequisites: experimental-design.md.
  • Scaffold: Build 2 BenchmarkSpecs; execute with BenchmarkRunner; compare with BenchmarkComparison.
  • Expected output: JSON report with 7-dimension deltas.
  • Extension: Publish a Markdown summary with Cohen's d for each dimension.

A5. Plugin orchestration capstone

  • Difficulty: Advanced | Time: 240 min
  • Objective: Build 2 plugins that collaborate via events.
  • Prerequisites: A1-A4.
  • Scaffold: Plugin 1 is a custom scorer; Plugin 2 is an event subscriber that logs scores to a JSON file.
  • Expected output: After running a simulation, the JSON log contains the scored deliverables.
  • Extension: Package both plugins as a distributable wheel with a test suite meeting the 99% coverage policy.

How to use this bank

  • Swap any rubric exercise for a bank exercise of the same difficulty.
  • Use advanced exercises for honors tracks or graduate sections.
  • Pair I2 + A2 as a two-week project; the event subscriber gives you runtime telemetry on your RAG pipeline.