# Packs and spaces: the format

A **space** is a Git repo (private by default). A **pack** is a folder in a space: one job an agent can finish and prove.
A **workflow** is a pack whose `workflow.yaml` chains other packs.
`lp pack lint` is the validator; this page and `lp pack lint` describe the same format.

Run lp from the installed CLI (`lp ...`) or, from a checkout of logicpacks-spaces, `python3 -m lp ...`.
Python 3.9+ and nothing else.

## Space layout

```
space.yaml      id, title, category, visibility, owner, env
README.md       for people
AGENTS.md       how an agent uses this space (lp space init writes a template)
<pack>/         any folder (any depth) that holds a pack.yaml is a pack
```

`space.yaml`:

```yaml
id: web-development            # lowercase slug: a-z 0-9 -
title: Web development
category: web-development      # lowercase slug
visibility: private            # private | team | public-approved
owner: waleed
description: optional one line
env:                           # key NAMES only, never values
  - name: OPENAI_API_KEY       # UPPER_SNAKE
    packs: [hero-section]      # packs that use it
    provider: openai           # optional
```

`public-approved` in a file is only a request: the registry lists a space publicly only after a secret scan and lint.

## Pack layout

```
<pack>/pack.yaml            required
<pack>/spec/SPEC.md         required, headings: Goal, Steps, Edge cases, Don'ts
<pack>/spec/source.md       required, the redacted original conversation/notes (no secrets, no customer data)
<pack>/code/                optional (warning if missing), reusable scripts/snippets
<pack>/outcome/checks.yaml  required, what "done" means
<pack>/outcome/fixtures/    optional
<pack>/refs/                optional; refs/refs.yaml lists links + rights notes, never big binaries
<pack>/workflow.yaml        optional; makes the pack a workflow (below)
<pack>/CHANGELOG.md         written by lp push / lp pack bump
<pack>/outcome/results.json written by lp pack check (runs, levels)
<pack>/outcome/reviews/     signed human reviews (lp review)
```

`pack.yaml`:

```yaml
name: hero-section             # slug, must equal the folder name
version: 1.0.0                 # 1.0 or 1.0.0 (+ optional -suffix)
category: web-development
summary: Build a full-screen hero with a motion background   # max 280 chars
needs: {env: [OPENAI_API_KEY], tools: [node, ffmpeg]}        # both lists required, [] when none
tested_with: [claude-opus-4, gpt-5]                          # non-empty
license: proprietary           # license and/or rights (at least one)
rights: NovaMotion originals are ours; third-party references private only
```

Every `needs.env` name must be declared in `space.yaml` `env` (error), and that entry should list the pack (warning).

`spec/SPEC.md` needs these headings (any level, case-insensitive): `## Goal`, `## Steps`, `## Edge cases`, `## Don'ts`
("Donts", "Do not", "Never" also accepted for the last; "Gotchas" for Edge cases).

`outcome/checks.yaml`:

```yaml
checks:
  - name: builds               # unique
    run: npm run build         # shell command, run in the pack folder
    expect_exit: 0             # default 0
    expect_stdout: "built"     # optional substring of stdout
    expect_regex: "^ok$"       # optional regex (multiline) on stdout
    timeout: 120               # seconds, 1..3600, default 120
rubric:                        # optional; read by the agent/person, not executed
  - The hero fills the viewport on 390px and 1440px.
```

Checks get `LP_PACK_DIR` and `LP_PACK` in their env. When the pack needs keys and LogicPacks keys is set up, `lp pack check` runs them like
`lp run` does: key NAMES hold `lp_sealed_*` placeholders and HTTPS goes through LogicPacks keys (see keys.md).

`refs/refs.yaml`:

```yaml
refs:
  - url: https://motionsites.waleeds.world/v/hero-12.mp4
    rights: NovaMotion original (ours)
    note: optional
```

## Workflows

A workflow is a normal pack (pack.yaml, spec, checks) plus `workflow.yaml`:

```yaml
steps:
  - id: title                              # short slug, unique (default step1, step2, ...)
    use: launch-skills/make-title@1.0.0    # <space>/<pack>@<version>, version pin required
    with: {topic: "${{ inputs.topic }}"}   # inputs -> env LP_IN_TOPIC for run + checks
    run: python3 code/make.py              # optional command, run in that pack's folder via lp run
    outputs: [TITLE]                       # names the step must write to $LP_OUTPUTS as NAME=value lines
    timeout: 600                           # optional, seconds for run
  - id: page
    use: web-development/hero-section@1.0.0
    with:
      heading: "${{ steps.title.outputs.TITLE }}"   # only earlier steps' declared outputs
```

`lp pack lint` checks: steps non-empty, `use` pinned, ids unique, references only to earlier steps and declared outputs,
and, when the used pack is present locally (same space or cloned), that its version equals the pin.
Missing used packs are a warning (clone the space).

`lp workflow run <space>/<pack> [--with topic=rocket]` runs the steps in order. For each step: run `run` (if set) with the
pack's keys as placeholders, then that pack's `outcome/checks.yaml`; all must pass, and every declared output must be written,
before the next step starts. It stops at the first failure and prints which step and why. At the end it runs the workflow
pack's own checks (they see each output as `LP_OUT_<STEP>_<NAME>`). Each run is saved to `~/.logicpacks/runs/<id>.json`;
`lp runs` lists them. Exit code 0 only when everything passed. At the end it prints `OUTPUTS (show these to the user):` with every
declared output as `step.NAME = value` (plus any `RESULT ...` line a step printed); the MCP `run_pack` tool returns them as
`outputs`. Secret-looking values are masked.

## Routes (free first)

A pack can say how it runs, in order of preference. `lp pack use`, `lp pack check` and `lp run --pack` pick the **first route
whose needs are met** on this machine; `--route <id>` forces one. Put free routes first (lint warns otherwise).

```yaml
routes:
  - id: codex                    # slug, unique
    needs: {tools: [codex]}      # tools on PATH
    run: codex exec "follow spec/SPEC.md"
    cost: subscription           # free | subscription | local | paid
  - id: local
    needs: {machine: gpu-box}    # machines declared with `lp machine add gpu-box`
    cost: local
  - id: api
    needs: {env: [OPENAI_API_KEY]}   # key NAMES: in your vault or an active grant; must also be in pack needs.env
    run: python3 code/make.py
    cost: paid
```

The route is passed to `run` and checks as `LP_ROUTE`, recorded with the check result, and shown by `lp keys` and the
overlay ("runs free via codex; api route needs key OPENAI_API_KEY"). A pack with `needs.env` but no routes gets a warning.

## Verification levels

Every pack version has a level. lp computes it; a `verification:` value written in pack.yaml is ignored.

| level | name | how a pack gets it |
|---|---|---|
| L0 | catalogued | listed, never run |
| L1 | executed | checks ran, but did not yet pass 3 of 3 runs in a row (or some failed) |
| L2 | test-verified | every check in `outcome/checks.yaml` passed **3 of 3 runs in a row** |
| L3 | human-verified | L2 plus a signed `approve` of this exact evidence by a human who did not write the pack, with real notes |
| L4 | reproducible | L3 plus passing runs on at least 3 different inputs and 2 different environments |

- `lp push` runs the checks up to 3 times (stopping at the first failure); `lp pack check --runs 3` does the same by hand.
  Each run is recorded in `outcome/results.json`: pass/fail, route, compute seconds, environment fingerprint
  (OS, CPU, Python, machine), inputs fingerprint (`--input NAME=value`, passed as `LP_IN_NAME`), plus history.
- **Who wrote it.** `authored_by: agent:<name>` in pack.yaml (or `lp push --authored-by agent:<name>`, or `LP_AUTHORED_BY`)
  says an AI agent wrote the pack. The space owner (e.g. `@waleed`) still owns it. The no-self-review rule is about the
  human who wrote the content: for an agent-written pack, the owner's own review counts as human verification. A human
  author's own approval never counts. Stats show how many L3 outcomes were approved only by their owner.
- **Evidence hash.** A review signs `evidence_hash`: the SHA-256 of what was judged (spec, code, checks, fixtures, evidence
  files, pack.yaml minus computed fields). Re-running checks does not change it. Changing the pack does, and its L3 drops
  back to L2 until someone reviews the new evidence.
- **One at a time:** `lp review queue` lists packs at L2 waiting for a person (with `authored_by` and `evidence_hash` in
  `--json`). `lp review <space>/<pack>@<version> --verdict approve|reject|needs-work --notes "<what you checked and what you saw>"
  [--evidence <file or URL>]` writes a signed `outcome/reviews/<ver>-<handle>-<time>.yaml` and sends it to the registry.
  Notes need 30+ characters and 5+ different words; `approve` needs passing checks for that version. A review run without a
  terminal (an agent, or the MCP `review_pack` tool) is saved as `kind: agent` and never counts as human verification.
  At a terminal, lp opens a logicpacks page that shows exactly what you are signing; you confirm with your **passkey**
  (Touch ID / Face ID, Windows Hello, your phone or a security key, with fingerprint/PIN). Nothing is recorded until you do.
- **Why the passkey.** The registry accepts a human review only with a one-time confirmation whose passkey signature
  (WebAuthn, user verification required) covers a registry nonce and the digest of exactly those review records (pack,
  version, verdict, notes, evidence hash). It is used once, within 30 minutes. The private key never leaves the
  authenticator, so an agent on the same machine cannot produce it: faking a terminal, posting `kind: human` directly,
  replaying a confirmation onto other reviews or doctoring the batch are all refused (tests/test_presence.py). Reviews made
  before 1.0.7 without a passkey no longer count as human. Your first human review creates your passkey (or
  `logicpacks passkey add`); later ones can only be added or removed after confirming with an existing one, and every new
  passkey is announced in your `logicpacks inbox`. `logicpacks passkey ls` lists them. Honest limit: the very first passkey
  of an account is trusted on first use, so add yours before you let agents work under your handle; lost every device? an
  admin resets it.
- **Vetted reviewers on the public registry.** A passkey proves a person was there, not who they are, and anyone can make
  a new account. So on api.logicpacks.io an approval raises a pack to L3 (and counts in the public "human-verified"
  number) only when the reviewer is on the LogicPacks team list (`GET /v1/reviewers`) AND confirmed with the one passkey
  pinned for them when they joined the list (a Touch ID / Windows Hello passkey they registered themselves; an extra
  passkey someone else adds to the account does not count). Other passkey-confirmed
  approvals are shown per pack as `community_approvals` and never raise the level. Self-hosted registries count every
  passkey-confirmed approval unless they set `LP_REVIEWERS_VETTED_ONLY=1`.
- **Many at once (evidence grid):** `lp review apply decisions.json` records one signed review per pack in `grid` mode and
  sends them in one call (`POST /v1/reviews/batch`). One passkey confirmation (one Touch ID) covers the whole batch, and
  the page lists every decision before you confirm.

  ```json
  {"mode": "grid", "notes": "Shared note used when a row has none (30+ chars, what you checked)",
   "decisions": [{"pack": "space/pack@0.1.0", "verdict": "approve", "evidence_hash": "sha256:..."},
                 {"pack": "space/other@0.2.0", "verdict": "reject", "evidence_hash": "sha256:...",
                  "notes": "Reasons the owner can act on (required for reject / needs-work)"}]}
  ```

  A row whose evidence hash no longer matches the pack is skipped ("review it again"). A rejected pack stays at L2, and
  its owner sees the reasons with `lp review list <space/pack>`.
- **One source of truth.** The registry reports the same level everywhere (space reads, search, stats). It takes the
  pack's claimed level and caps it by what it can check: 3 recorded OK runs for L2, and a recorded human approve of the
  published version and evidence hash for L3. Reviews of a version or evidence that is not published are refused (409).
- Registry stats (`GET https://api.logicpacks.io/v1/stats`) count **public-approved packs only** (`scope=all` is admin-only):
  `packs` (coverage), `unique_outcomes` (distinct `outcome_id`; a pack without one counts alone), `levels`,
  `unique_outcomes_by_level`, the headline `headline.verified_outcomes_L2plus` with `headline.human_verified_L3plus`,
  `human_review_modes` (`single` vs `grid`) and `owner_reviewed_L3plus`.

## Evidence

Optional pack.yaml fields that say what the pack proves. Lint warns when the main ones are missing and never fails on them
(an L0 pack can be catalogued without them), except a malformed `outcome_id`.

```yaml
outcome: A placed test order on the store, with order number      # the result, in one line
outcome_id: store-place-order        # slug shared by every variant of the same outcome (431 store packs, one outcome)
inputs: [store URL, product, test card]
tools: [playwright]
compute: laptop, ~2 min
domain_knowledge: Shopify checkout flow; COD vs card
authored_by: agent:content         # or human:@handle; default: you
verification: L2                     # computed by lp; ignored if written
evidence: outcome/fixtures/order-1234.png
reliability: computed                # ok/total from run history (outcome/results.json)
cost: measured                       # compute seconds per run are recorded; API spend when known
compatibility: [macos, windows]
```

## Publishing in one step

`lp push [folder]` (see spaces.md) writes a pack.yaml if there is none, scans, lints, checks, bumps, commits and uploads.
`lp pack bump <pack> patch|minor|major -m "..."` writes CHANGELOG.md and re-runs checks; `lp pack diff <space>/<pack>@a..b`
shows what changed; `lp pack propose <pack> -m "..."` sends a change to a space you can't write to.

## Rules lint enforces everywhere

- No file over 1 MB (keep big media on the host, link it in refs/).
- No secret values (`lp scan` rules). Env holds NAMES; values live in the vault (`lp key add`).
- Errors fail lint (exit 1); warnings don't.

## Commands

```bash
lp space init space-web --id web-development --category web-development --owner waleed
lp pack new hero-section --category web-development --dir space-web
lp pack lint space-web            # whole space (or a pack folder); --json for machine output
lp scan space-web                 # secret scan; exit 1 on findings, values shown masked (sk-…243)
lp scan --install-hook space-web  # git pre-commit hook: lp scan --staged
lp pack check web-development/hero-section    # run outcome checks; exit 0 = DONE
lp pack find hero --category web-development  # local spaces + registry
lp pack use web-development/hero-section      # spec + env NAMES + whether each key is ready
lp workflow run launch-skills/launch-page --with topic=rocket
lp push ./my-folder               # make it a pack if needed, check it, push to @handle/packs
lp pack check web-development/hero-section --input file=a.csv   # vary inputs to reach L4
lp review queue
lp space publish space-web        # lint + scan, then send metadata (never files or values) to the registry
```

Local spaces are found in `~/.logicpacks/spaces/` (where `lp space clone` puts them) and in any folder listed in
`LP_SPACES_PATH` (os.pathsep-separated; a folder that is itself a space or contains spaces).

`lp scan` false positive: add `lp-scan: allow` on that line. Placeholders (`lp_sealed_...`), `${VAR}`, `<your-key>`,
`xxxx`, and UPPER_SNAKE names are never flagged.

## Super Skills: a pack as an Agent Skill

A LogicPacks Super Skill is a standard Agent Skill (skills.sh, Claude Code, Codex, Cursor, OpenCode) backed by a tested
pack. `logicpacks superskill export <space/pack> [--to <folder>]` (alias `pack export-skill`) writes `<pack>/SKILL.md` (when to use it, the exact run line,
keys/tools/inputs it needs, which checks prove the result) and `scripts/run.sh` (installs lp if missing, then
`logicpacks run --pack <space/pack> "$@"`). Copy the folder into `~/.claude/skills`, `~/.codex/skills`, `~/.agents/skills`, or
publish it in a git repo for `npx skills add`. The skill does not contain the pack's code or any key: it runs the pack
through lp, so keys stay sealed and the checks still decide "done".

## First run of someone else's pack: your OK, enforced by lp

`lp run --pack`, `lp pack check` and `lp workflow run` of a pack you did not write stop the first time and ask you, not the
agent: on a Mac a system dialog ("Run" / "Don't run", showing what the pack does, the keys it uses and its declared
network/side effects); elsewhere a prompt on your terminal where you type RUN. No flag or environment variable skips it.
With nobody to ask (CI, a headless server) it refuses and tells the agent to have you run `logicpacks pack allow
<space/pack>` in your own terminal (MCP run_pack returns `needs_user_confirmation` with the exact prompt). Your own packs and folders are never asked about. Each new version asks again;
`logicpacks pack allow <space/pack> --revoke` makes it ask again. On a desktop Mac only the dialog is used (no environment variable switches it to a terminal prompt, which an agent could
type into); the terminal prompt is for Linux, Windows and ssh sessions. Each OK is stored with an HMAC keyed from your vault,
so a hand-written entry in `~/.logicpacks/consent.json` does not count. Honest limit: a program running as you with full
access to your account (vault included) can forge anything stored on that account, and on Linux/Windows a program driving a
pseudo-terminal can type the answer.


---

Canonical URL: https://logicpacks.io/pack-format.md

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
