Thomas Piacentini
← Atelier

Étape de projet

Translate metadata and hash content

Texte original · anglais120 min

Stage 2 of 4. Typescript. Plan about 2 hours.

Keep one body of instructions while regenerating a small quoted metadata header. Preserve references byte-for-byte. Compute a SHA-256 digest over sorted path/content pairs, so file insertion order cannot change integrity. The digest detects changed content but does not establish publisher identity; obtaining a trusted expected digest is the caller's responsibility.

The boundary for this stage is digest, translate. Keep earlier stage behavior intact: the final grader runs every stage against the same workspace.

pj skill installer 2

Worked Orchard case

Before coding, review TypeScript object types and Data management. Complete stage 1 first.

Serialize name and description as JSON-compatible double-quoted YAML scalars. The Rust validator accepts that same subset, including escapes. Source and translated digests differ because translation rewrites metadata.

text
source bundle digest -> expected source identity
translated SKILL.md: name: "orchard-release"
translated digest -> installed content identity

Build and inspect

Sort file entries before hashing. A digest verifies content against a trusted expectation; computing it from untrusted bytes does not establish publisher identity.

Implement the stage in your learner workspace. The CLI helpers are provided adapters and import your functions; they do not substitute the reference solution.

bash
python3 scripts/project_test.py skill-installer --stage 2 --path learning-artifacts/skill-installer

Predict the intermediate state above, then run the stage. A fresh stub fails; a passing reference run does not establish completion of your learner workspace.

Investigate next

How should a description containing a quote survive installer-to-validator round trip?

Code et livrables 3
Ce que vous en retenez

Enregistré dans votre carnet sur cet appareil.

Sources et limites

Les repères de lecture sont déclaratifs. Les résultats de tests sont enregistrés séparément ; ils valent pour les cas exécutés.

AI Engineering from Scratch · 3f9715c · MIT

Télécharger ce fichier ↓