Skip to content

Examples

The repo ships eight self-contained sample scripts in examples/, one per feature area. They run fully offline — the boundary judge falls back to a heuristic, so no API key is needed.

bash
npx tsx examples/run-chain.ts
npx tsx examples/compose.ts
# ...etc
ExampleFeature areaShows
run-chain.tsRuntime + reliabilityrunPipeline driving the document-grounding chain — confidence routing · auto-judge · retry
verify.tsSigMap integrationrunSigMapVerify → a structured VerifyResult (grounded vs. halted)
compose.tsCOMPOSEsequential · parallel · mapPattern · reducePattern · conditional · loop · dagLayers
triggers-and-events.tsTRIGGER + EVENTcronMatches · shouldActivate; an EventBus with routed subscriptions + a custom webhook sink
memory.tsMEMORYMemoryStore across sessions · decay · conflict log · failurePatterns · recommend
observe.tsOBSERVEcheckAlerts · visualise (ASCII + Mermaid) · abTest
custom-skill.tsSkill authoring + registryauthor a skill → gradeSkill (9/9 → verified) → run → publishSkill / installSkill
todo-flagger.tsSkill authoringthe registered todo-flagger skill — extends STATE with a flags field, grades 9/9 verified
summarize.tsReliability layerthe probabilistic summarize skill — confidence routing → auto-judge → retry recovers a low-confidence attempt
security.tsSECURITYcheckSkillPermissions (default-deny) · guardWrite sandbox · redactSecrets

Each script imports from ../src/index.js so it runs in the repo with no build step. As a published consumer you'd write the same code against the package entry:

ts
import { runSigMapVerify, runPipeline, EventBus, MemoryStore, sequential } from "skillweave";

See the CLI guide for the command-line equivalents.

Real-world use cases

examples/use-cases/ holds larger scenarios that answer "why not just write a plain skill / prompt?" — each shows what the runtime adds around the model. The first five run fully offline; the sixth is a head-to-head on a real LLM (needs a provider key).

ScenarioFeature
01-support-triagereliability — confidence routing + auto-judge + retry
02-code-review-gatecontracts + hard assertions + memory across runs
03-secret-safe-logssecurity — capabilities + sandbox + secret redaction
04-batch-digestcomposition — map · reduce · parallel · DAG
05-nightly-reportproduction wrapper — trigger + events + observability
06-ab-llmlive-LLM A/B — a raw call vs. the SkillWeave-wrapped skill
bash
npx tsx examples/use-cases/01-support-triage.ts
npx tsx examples/use-cases/06-ab-llm.ts --hard   # needs ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY

MIT License