AISOURCEOFTRUTH.COM
OPENSPEC PLAN · FOR YOUR CODING AGENT

Build on another publisher's work

Your agent writes these files into openspec/changes/integrate-aisot-lineage/ in your repo, runs openspec validate integrate-aisot-lineage, and works the task list. The setup guide explains each step for people.

language: http · python · typescript   with: PromptReports

OPENSPEC/CHANGES/INTEGRATE-AISOT-LINEAGE/PROPOSAL.MD
# Proposal: Build on another publisher's work

## Why
When a source is corrected, nothing downstream finds out. A `lineage` link makes your record derived-from the source, so the registry's assess rules flag your record when the source is corrected or sealed, and the source's page shows what was built from it.

## What Changes
- Name each upstream record digest in your record's `lineage` array.
- The registry adds a public derived-from edge.
- Assess on your record now reports `upstream_erratum` or `upstream_sealed` when a source changes.
- Add PromptReports: A PromptReports report that cites registry records can carry them in `lineage`, so its readers inherit the correction signal.

## Capabilities
### New Capabilities
- `record-lineage`: Link your record to its source with derived-from, so corrections upstream reach you.

## Impact
- External service: AI Source of Truth at https://aisourceoftruth.com. Reads are anonymous. Writes need a publisher key pair you generate, a client id and secret from registration, and a token from `/oauth/token`.
- Routes used: `POST /v1/records`, `GET /v1/model/lineage/{digest}?direction=both`, `GET /v1/model/assess/{digest}`.
- PromptReports products: PromptReports (optional; the change works without them).
- Source of this plan: https://aisourceoftruth.com/use-cases/build-on-records (CC0). Regenerate it with `curl -H 'Accept: application/json' 'https://aisourceoftruth.com/use-cases/build-on-records/openspec?lang=http&with=promptreports'`.
OPENSPEC/CHANGES/INTEGRATE-AISOT-LINEAGE/DESIGN.MD
# Design: Build on another publisher's work

## Context
Publishers whose work quotes, summarizes, translates or extends someone else's attested work. When a source is corrected, nothing downstream finds out. A `lineage` link makes your record derived-from the source, so the registry's assess rules flag your record when the source is corrected or sealed, and the source's page shows what was built from it.

## Where it sits in your agent
Add the lineage field in the same step that publishes your record. Run the assess check from a nightly job or from the change feed.

Over MCP, point the agent at `https://aisourceoftruth.com/mcp` (Streamable HTTP, JSON-RPC 2.0; read tools need no token). The tools this change uses: `publish_record`, `get_lineage`, `assess`.

## Decisions
- Treat the registry as a source of facts about records, never about the world. Show what it says, with the digest, and do not turn a verdict into a quality score.
- If the registry cannot be reached, treat the answer as unknown (the same as `check`), never as `rely`, and retry later.
- Keep content private: send hashes. Never put personal data in a record; it is public and permanent.
- Keep the private key and client secret in your secret store. Rotate keys at `POST /v1/keys`; a revoked key cannot sign.

## Setup and signing helper

```sh
# Publisher setup, once. Make an Ed25519 key pair yourself; the registry never sees the private key.
# 1. Register: POST https://aisourceoftruth.com/v1/publishers with {"id","name","public_jwk"}, signed by that key
#    (X-AISOT-Signature over the exact body bytes, base64url) and an Idempotency-Key.
#    The answer carries client_id, client_secret and your key_id.
# 2. Token (60 minutes; mint another the same way):
curl -s -X POST 'https://aisourceoftruth.com/oauth/token' -H 'Content-Type: application/json' \
  --data '{"grant_type":"client_credentials","client_id":"'"$AISOT_CLIENT_ID"'","client_secret":"'"$AISOT_CLIENT_SECRET"'"}'
# ./sign-ed25519 reads bytes on stdin and prints the base64url Ed25519 signature.
```

## Calls
### POST /v1/records
append a signed record; the answer carries its digest and inclusion proof.

```sh
BODY='{ ...record }'
SIG=$(printf %s "$BODY" | ./sign-ed25519)   # base64url signature over these exact bytes
curl -s -X POST 'https://aisourceoftruth.com/v1/records' \
  -H "Authorization: Bearer $AISOT_TOKEN" \
  -H "X-AISOT-Key-Id: $AISOT_KEY_ID" \
  -H "X-AISOT-Signature: $SIG" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H 'Content-Type: application/vnd.aisot.record+json' \
  --data-binary "$BODY"
```

### GET /v1/model/lineage/{digest}?direction=both
what a record was built from and what was built from it, as of a signed checkpoint.

```sh
curl -s -H 'Accept: application/json' 'https://aisourceoftruth.com/v1/model/lineage/{digest}?direction=both'
```

### GET /v1/model/assess/{digest}
rely, check or do_not_rely for one record, with the reasons.

```sh
curl -s -H 'Accept: application/json' 'https://aisourceoftruth.com/v1/model/assess/{digest}'
```

## With the PromptReports products
- **PromptReports** (https://aisourceoftruth.com/p/promptreports) publishes research reports, each with its own signed record. In this change: A PromptReports report that cites registry records can carry them in `lineage`, so its readers inherit the correction signal.

## What this does not prove
- A derived-from link is your statement. It does not prove the source permitted the use; read its terms for that.
OPENSPEC/CHANGES/INTEGRATE-AISOT-LINEAGE/TASKS.MD
# Tasks: Build on another publisher's work

## 1. Configure
- [ ] 1.1 Set `AISOT_ORIGIN=https://aisourceoftruth.com` in the agent's environment.
- [ ] 1.2 Generate an Ed25519 key pair, register the publisher (`POST /v1/publishers`), and store `AISOT_CLIENT_ID`, `AISOT_CLIENT_SECRET`, `AISOT_KEY_ID` and the private key as secrets.
- [ ] 1.3 Mint a token at `/oauth/token` and confirm `GET /v1/me` answers with your publisher id.
- [ ] 1.4 Optional: add the MCP server `https://aisourceoftruth.com/mcp` to the agent's MCP config.

## 2. Build
- [ ] 2.1 Collect upstream digests: For each source you used, keep its record digest (see the cite-sources use case).
- [ ] 2.2 Publish with lineage: Add `lineage: ["{upstream digest}"]` to your provenance record. (`POST /v1/records`)
- [ ] 2.3 Read the family: Fetch your record's lineage to confirm the edges, and the source's to see your work listed downstream. (`GET /v1/model/lineage/{digest}?direction=both`)
- [ ] 2.4 React to upstream changes: Assess your record on a schedule. `upstream_erratum` or `upstream_sealed` names the source in `digest`; review and, if needed, correct your own record. (`GET /v1/model/assess/{digest}`)

## 3. PromptReports products
- [ ] 3.1 PromptReports: A PromptReports report that cites registry records can carry them in `lineage`, so its readers inherit the correction signal.

## 4. Verify against the live registry
- [ ] 4.1 Collect upstream digests: Each source has a 64 hex digest or is noted as unattested.
- [ ] 4.2 Publish with lineage: Your record's lineage shows the upstream records.
- [ ] 4.3 Read the family: `counts.up["derived-from"]` matches the number of sources.
- [ ] 4.4 React to upstream changes: An erratum on a test source turns your record's verdict to `check`.

## 5. Done when
- [ ] 5.1 Upstream corrections reach your records within one checkpoint.
- [ ] 5.2 Sources see who built on them, which is the basis for credit and payment.
OPENSPEC/CHANGES/INTEGRATE-AISOT-LINEAGE/SPECS/RECORD-LINEAGE/SPEC.MD
# record-lineage Specification

## ADDED Requirements

### Requirement: Derived work names its sources
Every record the product publishes for derived work SHALL list the record digests of its attested sources in `lineage`.

#### Scenario: Summary of two sources
- **WHEN** a piece summarizes two attested sources
- **THEN** its record's lineage holds both digests

### Requirement: Upstream changes are acted on
The product SHALL review its record when assess reports `upstream_erratum` or `upstream_sealed`.

#### Scenario: Source corrected
- **WHEN** a source gets an erratum
- **THEN** the product opens a review for each record derived from it
$ curl -H 'Accept: application/json' https://aisourceoftruth.com/use-cases/build-on-records/openspec?lang=http&with=promptreports # this page is a rendering of the API. Reproduce it as data.