Files
relayview-skills/docs/authoritative/instruction-package-contract.md
T
adminandClaude Opus 5.5 8c7d967efd
Check instruction packages / check (push) Successful in 4s
Check instruction packages / check (pull_request) Successful in 8s
Validate Tester and Coordinator role/step pairs
Accept tester/testing and coordinator/coordination under schemas 1 and 3,
reject a JSON boolean schemaVersion and an inline metadata frontmatter value,
and cover the new pairs with valid fixtures plus single-mutation rejections.
The tests mirror RelayView's identity and archive computation and pin the
identity framing. Document the full instruction package contract and the
RelayView sidecar changes required before pinning v0.15.0 and v0.17.0.

Refs #20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:50:23 -05:00

122 lines
5.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Instruction package contract
An instruction package is one closed directory: `SKILL.md`, optional declared
`.md`/`.txt` resources, and the `relayview-skill.json` sidecar.
`python3 -m tools.packages check <package>` enforces this contract and prints
the package identity; `python3 -m tools.packages pack <package> <zip>` builds
the release archive and prints its SHA-256. RelayView's owner applies its own
admission check, which stays authoritative: a package that passes here can
still be refused by an owner that does not yet support its role/step pair.
## Role and step
Each package guides exactly one role during that role's one step.
| `role` | `step` | Schemas |
| --- | --- | --- |
| `planner` | `planning` | 1, 2, 3 |
| `implementer` | `implementation` | 1, 3 |
| `reviewer` | `review` | 1, 3 |
| `designer` | `design` | 1 |
| `tester` | `testing` | 1, 3 |
| `coordinator` | `coordination` | 1, 3 |
Any other pairing, including a known role with another role's step, fails the
check. Role and step names are lower-case strings.
## Sidecar fields
The sidecar is UTF-8 JSON without a BOM or NUL bytes, at most 64 KiB, with
exactly the fields its integer `schemaVersion` names:
- **Schema 1** — `schemaVersion`, `source`, `role`, `step`, `files`.
- **Schema 2** — schema 1 plus `issueClaim: {"statusLabel": <label or null>}`;
`planner`/`planning` only. A label matches `status/[a-z][a-z0-9-]{0,63}` and
is never `status/ready-for-agent`.
- **Schema 3** — schema 1 plus `treatment: "communication_context"`; every
pair except `designer`/`design`. The treatment marks the package's ablation
boundary and grants no tools or authority.
`source` is exactly `{"kind": "first-party" | "user", "reference": <1–128 of
[A-Za-z0-9._:-]>}`. `files` lists 1–16 `{"path", "sha256"}` entries: unique
relative paths without `.`/`..`/empty segments or backslashes, at most 256
characters, `SKILL.md` required, other paths ending `.md` or `.txt`, and
lower-case 64-hex SHA-256 digests. Any additional field — such as `tools`,
`permissions`, or `network` — fails the check.
## Package contents
- Every file in the directory except the sidecar is declared, and every
declared file is present with exactly its declared SHA-256.
- No symbolic links, executable bits, or non-regular files; at most 64 entries
and 8 directory levels.
- Each file is non-empty UTF-8 without a BOM or NUL bytes; the sidecar plus all
declared files total at most 128 KiB.
## `SKILL.md` frontmatter
The frontmatter allows only these keys, each at most once:
```yaml
name: <the directory name: hyphen-separated lower-case letters and digits, at most 64 characters>
description: <non-empty, at most 1024 characters>
disable-model-invocation: true # optional; true or false; true makes the package manual-only
metadata:
relayview-display-name: <at most 128 characters>
relayview-version: <major.minor.patch>
```
`metadata:` stands alone on its line, followed by exactly those two indented
keys. Any other key, such as `tools` or `allowed-tools`, fails the check.
## Identity and archive
The package identity is the SHA-256 of `relayview-instruction-package-v1\0`
followed by length-framed parts (a 4-byte big-endian length, then the bytes):
the raw sidecar bytes, then for each declared path in sorted order the UTF-8
path and the file bytes.
The release archive is an uncompressed ZIP containing the repository
`LICENSE` and `NOTICE.md`, then every package file under `<package-name>/` in
sorted path order. Every entry carries the timestamp 1980-01-01 00:00:00 and
mode `0644`, so the archive digest depends only on those bytes.
RelayView's `scripts/verify-first-party-skills-source.py` recomputes both
values from a tagged release and compares them with its
`first-party-skills/<tag>/bundle-lock.json`. The tests in
`tests/test_role_steps.py` mirror that computation and pin the identity
framing. The `v0.1.0` archive predates the bundled `LICENSE` and `NOTICE.md`;
every later release uses the archive format above.
## Releases are immutable
A published tag is never moved or rebuilt. A change to any package byte ships
under a new release tag; RelayView keeps earlier bundles to reconstruct
retained sessions.
## RelayView adoption of the Tester and Coordinator pairs
RelayView's owner admits `planner`, `implementer`, `reviewer`, and `designer`
packages. Before RelayView pins a release containing a `tester` or
`coordinator` package, its sidecar admission must accept that pair:
| Release | New pair | Packages |
| --- | --- | --- |
| `v0.15.0` | `tester`/`testing` | `tester-inspection` (schema 1), `tester-communication` (schema 3) |
| `v0.17.0` | `coordinator`/`coordination` | coordinator automatic and manual methods (schema 1), `coordinator-communication` (schema 3) |
The RelayView change for each pair:
1. Accept the pair in the owner's sidecar admission (the role-to-step map in
`src/owner/workflowPresets.ts`), with schema 1 and schema 3; keep schema 2
Planner-only and schema 3 closed to `designer`.
2. Add the step to the Skills settings contract and named-set validation so
the role's sets can be selected (`src/api/contract-skill-settings.ts`, the
generated owner schemas, and the set step check in
`src/owner/workflowPresets.ts`).
3. Pin the release in `first-party-skills/<tag>/` with its `bundle-lock.json`
and add the bundle to `scripts/verify-first-party-skills-source.py`.
The identity framing, archive format, file rules, and frontmatter rules do not
change, so existing bundle locks stay valid.