Skill Wiki v0.1.0

Docs / usage / compile

On this page

Compile

Compilation walks primes/sources/ and emits primes/compiled/ — one directory per atom plus the global _index.xml.

Two entry points

# Single file — useful for iterating on one atom
prime compile primes/sources/@my/rule-x.prime

# Whole tree — what you ship
bun scripts/build-atom-dirs.ts \
  --src primes/sources \
  --out primes/compiled

# With L2 (LLM semantic check)
DEEPSEEK_API_KEY=sk-... \
  bun scripts/build-atom-dirs.ts \
    --src primes/sources \
    --out primes/compiled \
    --deep

What gets written

primes/compiled/
├── _index.xml                              ← always-loaded surface
└── @my/
    ├── rule-x/
    │   ├── atom.yaml                       ← metadata only
    │   ├── graph.yaml                      ← resolved edges
    │   └── chunks/
    │       ├── summary.md                  ← ~30 tok
    │       ├── core.md                     ← ~150 tok
    │       └── full.md                     ← ~380 tok
    └── term-y/
        ├── atom.yaml
        ├── graph.yaml
        └── chunks/...

Output guarantees

  • Idempotent: compiling the same sources twice produces byte-identical output.
  • L2-cached: LLM check results are stored in .l2-cache.json; unchanged atoms don't re-pay.
  • Atomic per atom: a compile failure in atom A doesn't corrupt atom B's output. Each atom directory is written then renamed.

Inspect after compile

# List everything
prime list --dir primes/compiled

# Show one atom's full body
prime show @my/rule-x --dir primes/compiled

# Walk the dep tree from one seed
prime deps @my/method-foo --dir primes/compiled

# Print the index size
wc -c primes/compiled/_index.xml

Continuous compile

For development, watch + recompile:

bun --watch scripts/build-atom-dirs.ts \
  --src primes/sources \
  --out primes/compiled

Common errors

ErrorCauseFix
L1: required field missingAtom doesn't have a kind-required fieldAdd it; see Atoms
L1: unknown atom id @x/yEdge points to a non-existent atomAuthor the target or remove the edge
L3: cycle detected in requiresA→B→C→ABreak the cycle by replacing one edge with see-also
L3: kind mismatch on validates-withEdge points to wrong kindUse source/metric/check as the target
L2: AI client unreachableAPI key missing or rate-limitedRun without --deep or set the key