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| Example | Feature area | Shows |
|---|---|---|
| run-chain.ts | Runtime + reliability | runPipeline driving the document-grounding chain — confidence routing · auto-judge · retry |
| verify.ts | SigMap integration | runSigMapVerify → a structured VerifyResult (grounded vs. halted) |
| compose.ts | COMPOSE | sequential · parallel · mapPattern · reducePattern · conditional · loop · dagLayers |
| triggers-and-events.ts | TRIGGER + EVENT | cronMatches · shouldActivate; an EventBus with routed subscriptions + a custom webhook sink |
| memory.ts | MEMORY | MemoryStore across sessions · decay · conflict log · failurePatterns · recommend |
| observe.ts | OBSERVE | checkAlerts · visualise (ASCII + Mermaid) · abTest |
| custom-skill.ts | Skill authoring + registry | author a skill → gradeSkill (9/9 → verified) → run → publishSkill / installSkill |
| todo-flagger.ts | Skill authoring | the registered todo-flagger skill — extends STATE with a flags field, grades 9/9 verified |
| summarize.ts | Reliability layer | the probabilistic summarize skill — confidence routing → auto-judge → retry recovers a low-confidence attempt |
| security.ts | SECURITY | checkSkillPermissions (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).
| Scenario | Feature |
|---|---|
| 01-support-triage | reliability — confidence routing + auto-judge + retry |
| 02-code-review-gate | contracts + hard assertions + memory across runs |
| 03-secret-safe-logs | security — capabilities + sandbox + secret redaction |
| 04-batch-digest | composition — map · reduce · parallel · DAG |
| 05-nightly-report | production wrapper — trigger + events + observability |
| 06-ab-llm | live-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