# Agent Quickstart — Noland Context Capsules

Post-purchase guide for an AI agent that has just downloaded a Noland Context Capsule ZIP. This file is not a capsule and is never packed into a product archive. It applies to every current capsule.

## 1. Verify integrity

Compare the SHA-256 of the downloaded `<id>.zip` with the value on the order receipt: the `X-Capsule-Sha256` response header, the SHA-256 shown on the order page, or `checksum` on the catalog manifest (`GET /v1/capsules/<id>`). If they disagree, stop and report the outcome. Do not query a zip that failed this check.

## 2. Check freshness

After unzipping, open `manifest.json` (it may sit under a versioned prefix such as `<id>_v1.0.0/`). Read `version`, `valid_until`, and `recommended_refresh_days` before using any row. If `valid_until` is today or earlier (UTC date), the capsule is expired — do not treat its rows as current. A recommended refresh window is a hint to re-check sooner; it does not extend `valid_until`.

## 3. Read boundaries first

Read `USAGE_POLICY.json`, `LISTING.md`, and the README exclusions (and `RELEASE_STATUS.json` when present) before querying tables. These files state the allowed use, remaining gaps, and unsupported actions. **The absence of a row is never evidence that no rule, limit, cost, or requirement exists.** Do not infer a value or permission for a missing jurisdiction, provider, or field.

## 4. Query safely

Load each `data/*.csv` against the matching `schemas/*.schema.json` when a schema is provided. Honor `verification_status`:

- `VERIFIED` — the bounded fact was checked against the cited source on `verified_at`.
- `PARTIAL` — some fields are known; explicit unknowns remain. Use only the known fields.
- `UNVERIFIED` — not established. Do not treat it as a fact.

Never coerce `UNKNOWN`, `NOT_APPLICABLE`, `N/A`, or `UNVERIFIED` cells to `0`, free, allowed, absent, or safe. Leave those values as-is and say so in the answer. `source_effective_date` is not `verified_at`.

### Row evidence (capsule standard 1.1)

When `manifest.json` has `"capsule_standard": "capsule-standard-1.1"`, every row also says what was actually checked:

- `check_method`: `value_compared_to_source` (the value was compared with the source in this release), `source_unchanged_since_value_check` (the value was compared earlier and the source has not changed since), `link_reachable_only` (only the link was confirmed to load), or `not_checked`.
- `value_checked_at`: the UTC date the value was last compared with the source, or `NOT_CHECKED`.
- `unverified_fields`: a JSON array of columns that are not established for this row. Empty for VERIFIED rows; never empty for PARTIAL rows. Do not rely on a listed column.

Apply your own rules with the bundled guard, for example `assess(row, max_age_days=7, required_fields=["price_usd_per_1m_tokens"], require_value_compared=True)`. It returns `ok`, `needs_refresh` or `insufficient_evidence` with reasons. The same check runs server-side at `POST /v1/capsules/<id>/check` (MCP tool `check_capsule_rows`); it returns statuses and reasons only, and paid capsules need your `order_id` and `download_token`.

## 5. Cite provenance

When you answer a downstream user, surface `source_url` and `verified_at` (and `source_effective_date` when it is a date). Link the official source. Say when a row is PARTIAL or the capsule is close to `valid_until`.

After you use the zip, report the outcome once (`report_capsule_outcome` or `POST /v1/orders/<id>/feedback`) with the download token. Do not send the token to anyone else.

## Python 3 (standard library only)

```python
import csv, hashlib, json, zipfile
from datetime import datetime, timezone
from pathlib import Path

zip_path, want_sha = Path("capsule.zip"), "SHA256_FROM_RECEIPT"
got = hashlib.sha256(zip_path.read_bytes()).hexdigest()
if got != want_sha:
    raise SystemExit(f"checksum mismatch: {got}")

root = Path("capsule")
with zipfile.ZipFile(zip_path) as z:
    z.extractall(root)
manifest_path = next(root.rglob("manifest.json"))
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
until = manifest.get("valid_until")
if until and until <= datetime.now(timezone.utc).date().isoformat():
    raise SystemExit(f"expired valid_until={until}; do not treat as current")
print("version", manifest.get("version"), "valid_until", until)

pkg = manifest_path.parent
# Read USAGE_POLICY.json, LISTING.md and README.md in pkg before querying.
for csv_path in sorted((pkg / "data").glob("*.csv")):
    with csv_path.open(newline="", encoding="utf-8-sig") as fh:
        for row in csv.DictReader(fh):
            status = (row.get("verification_status") or "").upper()
            # Never coerce UNKNOWN / NOT_APPLICABLE / UNVERIFIED to 0, free, or allowed.
            print(csv_path.name, status, row.get("source_url"), row.get("verified_at"))
```

## Node.js (no npm packages; uses the system `unzip` CLI)

```js
import { createHash } from "node:crypto";
import { execFileSync } from "node:child_process";
import { readFileSync, readdirSync, statSync } from "node:fs";
import { join } from "node:path";

const zipPath = "capsule.zip", wantSha = "SHA256_FROM_RECEIPT", dest = "capsule";
const got = createHash("sha256").update(readFileSync(zipPath)).digest("hex");
if (got !== wantSha) throw new Error(`checksum mismatch: ${got}`);
execFileSync("unzip", ["-o", "-q", zipPath, "-d", dest]);

function find(dir, name) {
  for (const ent of readdirSync(dir)) {
    const p = join(dir, ent);
    if (ent === name) return p;
    if (statSync(p).isDirectory()) { const hit = find(p, name); if (hit) return hit; }
  }
  return null;
}
const manifest = JSON.parse(readFileSync(find(dest, "manifest.json"), "utf8"));
const today = new Date().toISOString().slice(0, 10);
if (manifest.valid_until && manifest.valid_until <= today) {
  throw new Error(`expired valid_until=${manifest.valid_until}; do not treat as current`);
}
console.log("version", manifest.version, "valid_until", manifest.valid_until);
// Read USAGE_POLICY.json, LISTING.md and README.md next to manifest.json before querying.
```

Use the official source links in each row when you answer. When a field is unknown, say it is unknown.
