Documentation and samples for the StoryCADLib API.
StoryCADLib is the core library that powers StoryCAD, a free outlining tool for fiction writers. The library is available as a NuGet package for developers who want to:
- Build tools that create or manipulate story outlines (.stbx files)
- Integrate story structure into AI agents via Semantic Kernel
- Automate story analysis and validation
- Create custom writing assistants
View Full Documentation (coming soon)
- Getting Started - Installation and first API call
- Quick Start Tutorial - Build an outline in 5 minutes
- API Reference - Complete method documentation
Samples reference StoryCADLib via ProjectReference, so you need both repos as siblings:
dev/src/
StoryCAD/ # Main application + StoryCADLib
StoryCADAPI/ # This repo (docs + samples)
cd your-dev-directory
git clone https://github.com/storybuilder-org/StoryCAD.git
git clone https://github.com/storybuilder-org/StoryCADAPI.git- .NET 10.0 SDK
- OpenAI API key (for Semantic Kernel samples only)
dotnet add package StoryCADLibusing StoryCADLib.Services.IoC;
using StoryCADLib.Services.API;
using CommunityToolkit.Mvvm.DependencyInjection;
// Initialize (once at startup)
BootStrapper.Initialise(headless: true);
// Get the API
var api = Ioc.Default.GetRequiredService<SemanticKernelApi>();
// Create a new outline
var result = await api.CreateEmptyOutline("My Story", "Author Name", "0");
if (result.IsSuccess)
{
Console.WriteLine($"Created outline with {result.Payload.Count} elements");
}
// Add a character
var charResult = api.AddElement(
StoryItemType.Character,
result.Payload[0].ToString(), // Parent GUID (story overview)
"Alex",
"The protagonist");
// Save to file
await api.WriteOutline("my-story.stbx");| Sample | Description |
|---|---|
| StoryGraphBasics | Create, populate, link, save and reload an outline (10 API methods) |
| StoryMetrics | Analytics dashboard: element counts, character appearances, setting usage |
| ConsistencyValidation | 6 validation checks detecting story issues (orphan characters, unused settings, etc.) |
| Sample | Description |
|---|---|
| StoryDiagnosticAgent | LLM-powered diagnosis of pacing, passive protagonist, plot holes |
| StoryCADCritter | LLM scores an outline against 5 craft criteria with rubric |
| Sample | Description |
|---|---|
| StoryCADChat | Console app for natural language interaction with outlines via LLM |
| HeadlessTest | Verification harness: 7-step round-trip test of headless API |
All samples target net10.0-desktop and use Uno SDK:
cd samples/StoryGraphBasics
dotnet build -f net10.0-desktop
dotnet run -f net10.0-desktopFor Semantic Kernel samples, set your API key first:
# Windows (PowerShell)
$env:OPENAI_API_KEY="your_key_here"
# Linux/Mac
export OPENAI_API_KEY=your_key_hereSee .env.example for all environment variables.
All API methods return OperationResult<T> - always check IsSuccess before using Payload:
var result = api.GetStoryElement(guid);
if (result.IsSuccess)
{
var element = result.Payload;
// Use element...
}
else
{
Console.WriteLine($"Error: {result.ErrorMessage}");
}BootStrapper.Initialise(headless: true) configures the library for use without a UI:
- Console applications
- Web APIs
- Background services
- AI agent integrations
| Type | Description |
|---|---|
StoryOverview |
Root element with story metadata |
Problem |
Conflicts, themes, story questions |
Character |
Characters in the story |
Scene |
Individual scenes |
Setting |
Locations and places |
Folder |
Organizational containers |
The documentation site lives in docs/ and is a Jekyll
site using the Just the Docs theme. Pages are plain
Markdown with YAML front matter that drives the navigation (title, parent,
nav_order).
- Ruby 3.x and Bundler (
gem install bundler)
# From the repo root — installs gems into docs/ and serves with live reload
cd docs
bundle install
bundle exec jekyll serve --livereload
# → http://localhost:4000/StoryCADAPI/On Windows you can use the helper script instead:
pwsh serve-docs.ps1 # serves at http://localhost:4000To produce the static site without serving:
cd docs
bundle exec jekyll build # output in docs/_site/ (git-ignored)The pages under docs/api/ are hand-curated Markdown. The per-namespace model
reference (docs/api/models*.md) was converted from the StoryCADLib XML docs;
regenerate it if the public model surface changes.
The GitHub Actions workflow (.github/workflows/deploy-docs.yml) builds the site
with Bundler/Jekyll and deploys it to GitHub Pages on every push to main that
touches docs/.
One-time setup: in repo Settings → Pages, set Source to GitHub Actions. The site then publishes to https://storybuilder-org.github.io/StoryCADAPI/.
- StoryCAD - The main application
- Collaborator - AI plugin for StoryCAD
- StoryCAD Manual - User documentation
GNU GPL v3 - See LICENSE for details.
Contributions welcome! Please read the contribution guidelines in the main StoryCAD repository.