Samples

Six sample applications that show you the StoryCADLib API in action. The first three use the core API only; the last three bring in Semantic Kernel and an LLM.

Sample Type What You’ll Learn
Story Graph Basics Core Create, populate, link, save, and reload an outline
Story Metrics Core Query an outline for analytics and statistics
Consistency Validation Core Detect structural issues in an outline
Story Diagnostic Agent Semantic Kernel LLM-powered structural diagnosis
Outliner Semantic Kernel Reverse-engineer a StoryCAD outline from prose
StoryCADCritter Semantic Kernel Per-element craft critique walk with Key Questions

Prerequisites

Every sample needs:

  • .NET 10.0 SDK
  • StoryCADLib: each sample references it as a NuGet package by default (version pinned by StoryCADLibVersion in Directory.Build.props). Set UseStoryCADLibNuGet=false to build against a local StoryCAD checkout via ProjectReference instead.

The Semantic Kernel samples also need:

  • An OpenAI API key set as the OPENAI_API_KEY environment variable
  • Internet access for OpenAI API calls

Running a Sample

Same pattern for all of them:

cd samples/<sample-folder>
dotnet build -f net10.0-desktop
dotnet run -f net10.0-desktop

For the Semantic Kernel samples, set your API key first:

export OPENAI_API_KEY="your-key-here"

Repository Layout

Each sample lives in its own folder under the samples/ directory of the StoryCADAPI repository. You’ll find four files inside:

samples/
  SampleName/
    global.json          # SDK and Uno.Sdk versions
    SampleName.csproj    # Uno.Sdk console app targeting net10.0-desktop
    Program.cs           # Complete sample code
    README.md            # Quick reference

API Coverage

Here’s which API methods each sample exercises, so you can jump straight to the one that covers what you need:

Method Samples
CreateEmptyOutline All
AddElement All
UpdateElementProperties All
AddCastMember All except Diagnostic Agent
AddRelationship Story Graph Basics
GetAllElements All
GetElementsByType Story Graph Basics, Story Metrics, Consistency Validation
GetElement Story Graph Basics, Diagnostic Agent, StoryCADCritter
GetStoryElement Story Metrics, Consistency Validation
WriteOutline Story Graph Basics
OpenOutline Story Graph Basics
SearchForReferences Story Metrics, Consistency Validation
GetKeyQuestionElements StoryCADCritter
GetKeyQuestions StoryCADCritter

Table of contents