Exported functions in state/lib/chain/api.ts. .md file to compare - side-by-side diff against chain
chain
description: "Triggers on prompt mention of 'chain'."
What it does for you
Runs several steps in a row so one request finishes the whole job.
What it produces
A recent result, so you can see the kind of work it returns.
loading…
How to get it
These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.
For developers how this skill is built, graded, and how it runs
at a glance- the short version
what's inside - the parts that make up a skill 2/4 present
A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.
state/skills/chain/SKILL.md
present
state/lib/chain.ts
not present
state/bin/chain/
not present
state/skills/chain/AGENTS.md
present
how it's graded - what counts as a good run 4 criteria · 2 deterministic · 2 judge
Each row is one thing a good run has to get right. deterministic means a quick check decides, pass or fail. judge means the AI reads the result and rates it. Grading each piece on its own (instead of one overall score) shows exactly where a run fell short, so the fix is obvious.
how it runs - the shared frame every skill uses 4/5 present
Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.
This skill doesn't fix its own gaps yet.
state/log/pending-eval.ndjson - The lib lives at state/lib/chain/api.ts (vendored DIRECTORY, not a single file) - also imports classify.ts and chains/ subdir
- ALWAYS call dispatchOnce() for one-shot runs; registerChain() is for the registry, not for per-invocation dispatch
what it has learned - fixes written back in over time sample
When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.
- Loading feedback rows…
how the work flows- who makes it, who checks it
import { registerChain, getRegistered, dispatchOnce } from "state/lib/chain/api.ts"
npx tsx -e 'import("/Users/robertboulos/projects/snappy-os/state/lib/chain/api.ts").then(m => console.log(Object.keys(m)))'
SKILL.md- the skill, written out in plain English
chain
Ported from kernel.
Ported from kernel snappy-chain in Phase 0.5. See state/lib/chain/api.ts for the full API surface.
Steps
registerChain()- seestate/lib/chain/api.tsgetRegistered()- seestate/lib/chain/api.tsdispatchOnce()- seestate/lib/chain/api.ts
Eval
Actor: the exported functions in state/lib/chain/api.ts. Auditor: none wired yet - eval is manual (Robert review). File a state/log/pending-eval.ndjson row on each run.
Score convention:
| Outcome | Score |
|---|---|
| Pass on first try | 1.0 |
| Failed first, auto-fix applied, re-check passed | 0.5 |
| Still failing or unrecoverable | 0.0 |
Gotchas
via the Phase 0.5 driver. Only these rewrites were applied: already in state/lib/)
realpathSync(process.argv[1])CLI guard wrapped in try/catch
- See the kernel SKILL.md for the original long-form guidance if you need it
(read-only reference at the kernel path above).
Graduation
This skill is prose. Graduate by defining a deterministic auditor and flipping eval: auto.
Rubric
criteria:
- name: api_calls_present
kind: deterministic
check: "The executed code includes calls to registerChain(), getRegistered(), and dispatchOnce() as defined in state/lib/chain/api.ts."
- name: inputs_used_correctly
kind: judge
check: "The registerChain_input, getRegistered_input, and dispatchOnce_input are passed appropriately to their respective API functions."
- name: successful_dispatch
kind: judge
check: "The dispatchOnce() function appears to successfully initiate a classifier-to-chain run based on the overall execution context or logs."
- name: no_unhandled_errors
kind: deterministic
check: "The execution log shows no unhandled exceptions or critical errors originating from the snappy-chain API calls."AGENTS.md- what the AI loads when this skill comes up
chain - loader
Per-turn rules for the chain skill. Full reference: state/skills/chain/SKILL.md. Do not skip these.
Critical Rules
_(no failures recorded yet - Phase 0.5 mechanical port from kernel snappy-chain. Read state/skills/chain/SKILL.md and state/lib/chain/api.ts before invoking.)_
- The lib lives at
state/lib/chain/api.ts(vendored DIRECTORY, not a single file) - also importsclassify.tsandchains/subdir - ALWAYS call
dispatchOnce()for one-shot runs;registerChain()is for the registry, not for per-invocation dispatch
Commands
| ui model | live composition via compose_inline, persisted as artifact lang_body, reopened with OpenArtifact | |invoke: import { registerChain, getRegistered, dispatchOnce } from "state/lib/chain/api.ts" |verify: npx tsx -e 'import("/Users/robertboulos/projects/snappy-os/state/lib/chain/api.ts").then(m => console.log(Object.keys(m)))' |eval log: state/log/pending-eval.ndjson (skill: "chain")
Known Pitfalls
- Vendored directory -
state/lib/chain/is more than justapi.ts; don't move files around - Phase 0.5 port - only mechanical rewrites applied (settings path, sibling lib paths, CLI guard)
Self-Test
An agent reading this should correctly:
- [ ] Import from
state/lib/chain/api.ts, notstate/lib/chain.ts - [ ] Know
chain/is a vendored directory with sibling files - [ ] Use
dispatchOncefor one-shot,registerChainfor registry adds
Found a gap? Edit this file. <!-- footer-injection-point -->
api.ts- the code it can call
⚠ no api.ts - this skill has no typed action surface
scripts- helper scripts it can run
prose-only skill - 1 inline code block live in SKILL.md above (no state/bin/ sidecar yet).
how we check it- the checks, plus the last 10 runs
no recent runs logged - the eval contract is declared but nothing has been graded yet