Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,14 @@ Kilo archive provenance. The existing remote Skills service, released Continue
grep transport and Rust KG MCP are distinct optional integrations. Actual Kilo
installation, OAuth/provider methods and catalog admission remain unqualified
until their individual output checks pass. No current Kilo listing is claimed.

### Skill signatures and CLI download checksums

The TSM signature verifies the original signed skill files. It does not authenticate
separately installed `terraphim-grep` or `terraphim-agent` binaries. The Clients
v1.21.20 download evidence establishes checksums; no archive-signature claim is
made here. The Kilo imports of grep, memory and learn 1.0.3 correct the inherited
phrase “signed, checksummed release archives” to “checksummed release archives”.
Their provenance records the exact old/new text and source version/commit, and
the verifier permits only that reviewed correction. Original signed source files
and existing release assets remain unchanged.
18 changes: 9 additions & 9 deletions integrations/kilo/release-inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"files": {
"LICENSE": "bd6930ed220ef9feae8be4721c84e845318b060bcd08e19007d4d10171dd45f2",
"NOTICE": "52f3456ba8b6e845956338bd08bc2fadadbcf1263a052dc968f1524521367115",
"SKILL.md": "dd2f32d2a627014b66e74f9610643b8138fd64fddfb55f3319472c2a28a12746",
"local.patch": "da385469b27e450e3e9b72e73da56346fa414fcb633e55a3a0ba3a1c2d53d091",
"SKILL.md": "fee56aa6c00d781b13defe6b195b77d870d72ee15eed24490ace98b348e6245a",
"local.patch": "b0be529f02cbf7d0d344a8925d68d3900600701f95ecd5697124f9f396c453e9",
"local.remove": "b6d386395a64b4912c766a87e22759691237c477a58643cb7d62c1c248545436",
"references/command-guide.md": "79b5993fd6087dc104b5270d16abd4beddbecbd5f038f1eb1f711326645aa97b",
"references/kilo-provenance.json": "a2d2d01dab9b414874d3cab956bc8b0f87759d05630be749c67b60df5585ba63",
"references/kilo-provenance.json": "d7b60f52720585d83aa8cd2f99d0b830c0218d153626ee9b48aa1133d4961984",
"references/risk-concern.knowledge-graph.json": "f8648b16470e764bdff5c95064078419d71e8d41d2ca30d4b1508017c166a45d",
"references/workflows.md": "77d840f59c99c502413161985be10eedb09162a6e3dd337caa2a24aceccc0fad"
},
Expand Down Expand Up @@ -70,11 +70,11 @@
"files": {
"LICENSE": "bd6930ed220ef9feae8be4721c84e845318b060bcd08e19007d4d10171dd45f2",
"NOTICE": "52f3456ba8b6e845956338bd08bc2fadadbcf1263a052dc968f1524521367115",
"SKILL.md": "bd5eb837483548e4666ea9569d76473c7f0c6e8f04da2a7e1a645797f0ab7ede",
"local.patch": "834514919748b7783d8e1a21381515497c5aa4a647ea848464529f71a628737c",
"SKILL.md": "738eaf7fd3896d091c58a6a060166d67e240f919bbe40d9b2eeb8b3826252ea4",
"local.patch": "b2116ea9d1a2d15f1fe4ffc4d5f37f44e969a221f66236bcd84dd954802568f9",
"local.remove": "b6d386395a64b4912c766a87e22759691237c477a58643cb7d62c1c248545436",
"references/command-guide.md": "fd9af409bae86ec3b77495fad94694af021c1fc1d42081fd0ce13cdeab99bc89",
"references/kilo-provenance.json": "0cec09d5fa2c0b88aea47b9e462115b43d248bfe95243263c7d3421f39fc4a17",
"references/kilo-provenance.json": "75368221c945f004c13e4a5cd6c820c89a203d609eac90aeacd8e5766f721c07",
"references/risk-concern.knowledge-graph.json": "f8648b16470e764bdff5c95064078419d71e8d41d2ca30d4b1508017c166a45d",
"references/workflows.md": "77d840f59c99c502413161985be10eedb09162a6e3dd337caa2a24aceccc0fad"
},
Expand Down Expand Up @@ -109,11 +109,11 @@
"files": {
"LICENSE": "bd6930ed220ef9feae8be4721c84e845318b060bcd08e19007d4d10171dd45f2",
"NOTICE": "52f3456ba8b6e845956338bd08bc2fadadbcf1263a052dc968f1524521367115",
"SKILL.md": "cc798f22c6e3901b8ef41bb20f08eef13dea09f7352a2509c239ba4a89d5c643",
"local.patch": "d0794fd7c59143022ea5c60010f07306606a6425a7240e17cb93ac675cf53ef9",
"SKILL.md": "2672a6200c2e0210d6403faab86880b3e9f0104324875d8212d21d1c23039dca",
"local.patch": "f526f46f135182875cfcb8674539376bcc2fcfe8b577e37b2752634a757b13df",
"local.remove": "b6d386395a64b4912c766a87e22759691237c477a58643cb7d62c1c248545436",
"references/command-guide.md": "d076dfb8ad82fc2db1296549fa2c2cab606b28836a42a43e20e4f91b056529b2",
"references/kilo-provenance.json": "0952086ea703ca400e8f62ecf6096984ce0bee36facd87f2f3bcdab710644014",
"references/kilo-provenance.json": "c7478a3be9a331dd9a5d93525fba5b0e3541dd295204d41657e861aa6c3bd82d",
"references/risk-concern.knowledge-graph.json": "f8648b16470e764bdff5c95064078419d71e8d41d2ca30d4b1508017c166a45d",
"references/workflows.md": "77d840f59c99c502413161985be10eedb09162a6e3dd337caa2a24aceccc0fad"
},
Expand Down
42 changes: 37 additions & 5 deletions scripts/verify_kilo_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,39 @@ def _body(data: bytes) -> bytes:
return sections[1]


def wording_corrections(row: dict, entry_id: str) -> list[dict]:
"""Return the single reviewed factual correction for the original 1.0.3 skills."""
if (
entry_id
not in {"terraphim-grep", "terraphim-agent-memory", "terraphim-agent-learn"}
or row.get("version") != "1.0.3"
or row.get("sourceCommit") != "391c7e4ebc103f1770b9dca589fcce7ccd211d5f"
):
return []
return [
{
"sourceVersion": "1.0.3",
"sourceCommit": "391c7e4ebc103f1770b9dca589fcce7ccd211d5f",
"oldText": "For signed,\nchecksummed release archives",
"newText": "For checksummed release archives",
"reason": "The verified skill signature does not authenticate separate CLI archives; only CLI release checksums were verified.",
}
]


def expected_instruction_body(data: bytes, row: dict, entry_id: str) -> bytes:
"""Preserve original instructions except an exact admitted factual correction."""
body = _body(data).rstrip(b"\n")
for correction in wording_corrections(row, entry_id):
old = correction["oldText"].encode()
if body.count(old) != 1:
raise VerificationError(
"reviewed wording correction is not uniquely applicable"
)
body = body.replace(old, correction["newText"].encode())
return body + b"\n" + FOOTER.encode()


def _archive_files(row: dict) -> dict:
imported = row.get("import")
if not imported:
Expand Down Expand Up @@ -255,11 +288,8 @@ def verify_import(source: Path, imported: Path, inputs: dict, entry_id: str) ->
)
if (imported / "local.remove").read_bytes() != b"skill.toml\n":
raise VerificationError("root signature removal is not exact")
if (
_body((imported / "SKILL.md").read_bytes())
!= _body((source / "SKILL.md").read_bytes()).rstrip(b"\n")
+ b"\n"
+ FOOTER.encode()
if _body((imported / "SKILL.md").read_bytes()) != expected_instruction_body(
(source / "SKILL.md").read_bytes(), row, entry_id
):
raise VerificationError("imported instruction body changed")
for name in row["sourceBlake3"]:
Expand All @@ -271,6 +301,8 @@ def verify_import(source: Path, imported: Path, inputs: dict, entry_id: str) ->
if actual.get(name) != expected:
raise VerificationError(f"license/notice changed: {name}")
provenance = json.loads((imported / PROVENANCE_PATH).read_text(encoding="utf-8"))
if provenance.get("wordingCorrections", []) != wording_corrections(row, entry_id):
raise VerificationError("wording provenance differs from reviewed correction")
original = provenance["source"]
if (
provenance.get("schemaVersion") != 1
Expand Down
3 changes: 1 addition & 2 deletions tests/fixtures/kilo/terraphim-grep/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ terraphim-grep --help
```

The examples target released **Clients 1.21.20**. Homebrew may install a different
version; inspect the installed help before using a command. For signed,
checksummed release archives, follow the
version; inspect the installed help before using a command. For checksummed release archives, follow the
[installation guide](https://terraphim-skills.md/docs/non-technical/).
The skill does not install software automatically.

Expand Down
28 changes: 24 additions & 4 deletions tests/fixtures/kilo/terraphim-grep/local.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
diff --git a/terraphim-grep/SKILL.md b/terraphim-grep/SKILL.md
--- a/terraphim-grep/SKILL.md
+++ b/terraphim-grep/SKILL.md
@@ -81,3 +81,11 @@
@@ -31,8 +31,7 @@
```

The examples target released **Clients 1.21.20**. Homebrew may install a different
-version; inspect the installed help before using a command. For signed,
-checksummed release archives, follow the
+version; inspect the installed help before using a command. For checksummed release archives, follow the
[installation guide](https://terraphim-skills.md/docs/non-technical/).
The skill does not install software automatically.

@@ -81,3 +80,11 @@

Browse the [Community, Core, and Premium skill catalogue](https://terraphim-skills.md/skills/).
Discovering a related skill never starts checkout or changes an entitlement.
Expand All @@ -27,7 +37,7 @@ diff --git a/terraphim-grep/references/kilo-provenance.json b/terraphim-grep/ref
new file mode 100644
--- /dev/null
+++ b/terraphim-grep/references/kilo-provenance.json
@@ -0,0 +1,42 @@
@@ -0,0 +1,52 @@
+{
+ "schemaVersion": 1,
+ "entryId": "terraphim-grep",
Expand Down Expand Up @@ -66,7 +76,17 @@ new file mode 100644
+ "upstream text whitespace normalization",
+ "root LICENSE via metadata.source.license_path",
+ "root skill.toml removed via local.remove",
+ "NOTICE, provenance and explanation added via local.patch"
+ "NOTICE, provenance and explanation added via local.patch",
+ "exact CLI archive wording correction recorded in wordingCorrections"
+ ],
+ "signatureScope": "The original signature verifies the immutable source skill, not this transformed Kilo copy."
+ "signatureScope": "The original signature verifies the immutable source skill, not this transformed Kilo copy.",
+ "wordingCorrections": [
+ {
+ "sourceVersion": "1.0.3",
+ "sourceCommit": "391c7e4ebc103f1770b9dca589fcce7ccd211d5f",
+ "oldText": "For signed,\nchecksummed release archives",
+ "newText": "For checksummed release archives",
+ "reason": "The verified skill signature does not authenticate separate CLI archives; only CLI release checksums were verified."
+ }
+ ]
+}
14 changes: 12 additions & 2 deletions tests/fixtures/kilo/terraphim-grep/references/kilo-provenance.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@
"upstream text whitespace normalization",
"root LICENSE via metadata.source.license_path",
"root skill.toml removed via local.remove",
"NOTICE, provenance and explanation added via local.patch"
"NOTICE, provenance and explanation added via local.patch",
"exact CLI archive wording correction recorded in wordingCorrections"
],
"signatureScope": "The original signature verifies the immutable source skill, not this transformed Kilo copy."
"signatureScope": "The original signature verifies the immutable source skill, not this transformed Kilo copy.",
"wordingCorrections": [
{
"sourceVersion": "1.0.3",
"sourceCommit": "391c7e4ebc103f1770b9dca589fcce7ccd211d5f",
"oldText": "For signed,\nchecksummed release archives",
"newText": "For checksummed release archives",
"reason": "The verified skill signature does not authenticate separate CLI archives; only CLI release checksums were verified."
}
]
}
54 changes: 54 additions & 0 deletions tests/test_kilo_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,60 @@ def test_actual_official_import_matches_pinned_tree_and_original_body(self):
self.assertIn("NOTICE", receipt["archiveFiles"])
self.assertIn("references/kilo-provenance.json", receipt["archiveFiles"])

def test_exact_cli_checksum_wording_correction_is_accepted(self):
skill = self.imported / "SKILL.md"
skill.write_text(
skill.read_text().replace(
"For signed,\nchecksummed release archives",
"For checksummed release archives",
)
)
inputs = json.loads(json.dumps(INPUTS))
inputs["skills"][ID]["import"]["files"] = V.read_tree(self.imported)
receipt = V.verify_import(ROOT / "skills" / ID, self.imported, inputs, ID)
self.assertEqual("PASS", receipt["status"])
self.assertIn("For checksummed release archives", skill.read_text())

def test_cli_wording_transform_is_limited_to_admitted_version_and_commit(self):
for name in (
"terraphim-grep",
"terraphim-agent-memory",
"terraphim-agent-learn",
):
data = (ROOT / "skills" / name / "SKILL.md").read_bytes()
row = INPUTS["skills"][name]
expected = V.expected_instruction_body(data, row, name)
self.assertNotIn(b"For signed,\nchecksummed release archives", expected)
self.assertIn(b"For checksummed release archives", expected)
for field, changed in (("version", "1.0.4"), ("sourceCommit", "0" * 40)):
unsupported = dict(row, **{field: changed})
unchanged = V.expected_instruction_body(data, unsupported, name)
self.assertIn(b"For signed,\nchecksummed release archives", unchanged)
self.assertNotIn(b"For checksummed release archives", unchanged)

def test_original_cli_signature_claim_refused_even_if_hash_is_recomputed(self):
skill = self.imported / "SKILL.md"
skill.write_text(
skill.read_text().replace(
"For checksummed release archives",
"For signed,\nchecksummed release archives",
)
)
inputs = json.loads(json.dumps(INPUTS))
inputs["skills"][ID]["import"]["files"] = V.read_tree(self.imported)
with self.assertRaisesRegex(V.VerificationError, "body"):
V.verify_import(ROOT / "skills" / ID, self.imported, inputs, ID)

def test_wording_provenance_refused_even_if_hash_is_recomputed(self):
path = self.imported / "references/kilo-provenance.json"
provenance = json.loads(path.read_text())
provenance["wordingCorrections"] = []
path.write_text(json.dumps(provenance, indent=2) + "\n")
inputs = json.loads(json.dumps(INPUTS))
inputs["skills"][ID]["import"]["files"] = V.read_tree(self.imported)
with self.assertRaisesRegex(V.VerificationError, "wording provenance"):
V.verify_import(ROOT / "skills" / ID, self.imported, inputs, ID)

def test_all_original_skills_have_exact_admitted_file_hashes(self):
for name in INPUTS["skills"]:
self.assertEqual(
Expand Down
Loading