Skip to content
Docs
Request access

Load canon from Git

The canon is the team’s shared source of truth: style rules, decisions, domain facts. It lives in a Git repository. A run loads it once from the commit you pinned, checks every file against that commit, and records the commit and a content hash in the ledger.

  • A team folder that runs (Start from a template). The examples use a dev-team folder named my-team.
  • Git on your machine.
  • Canon: what is verified and what is not.
  1. Create a repository for the canon next to the team folder, with one rules file, and commit it. An existing local clone works the same way.

    Terminal window
    mkdir team-canon
    cd team-canon
    git init
    mkdir rules
    printf '# Style\n\nChange as little as possible. Keep public function names.\n' > rules/style.md
    git add rules/style.md
    git commit -m "Add the style rules"
  2. Print the id of the commit to pin, then go back.

    Terminal window
    git rev-parse HEAD
    cd ..
  3. Add a canon section at the top level of my-team/nuramesh.yaml. Use the 40-character id from step 2.

    canon:
    repository: team-canon
    commit: a647376ccf944c822d96c5788a7a13af1b62fbcd
    paths: ["rules/*.md"]
    Key Value
    repository the path of a local repository. A relative path starts at the folder you run nuramesh in, not at the team folder
    commit the full commit id: 40 lower-case hexadecimal characters. A branch name or a short id is refused
    paths one or more patterns for the files to load
  4. Check the file and run the team from the folder that holds both my-team and team-canon.

    Terminal window
    nuramesh validate my-team/nuramesh.yaml
    nuramesh try my-team --fake --approve-as human:you --allow-unsandboxed --run-id canon-1
  5. To change the canon later, commit the change in the canon repository and put the new commit id in nuramesh.yaml. A run never follows a branch: it uses the commit you pinned until you change the pin.

The report has a Canon: line with the pinned commit, just above the Ledger: line:

Canon: a647376ccf944c822d96c5788a7a13af1b62fbcd

The run’s ledger has one canon.loaded entry. It names the commit, each loaded file with its hash, and what was re-hashed during the check. To see it, export the ledger and search the file for canon.loaded:

Terminal window
nuramesh ledger export --out canon-ledger.jsonl --team my-team
{"canon_hash": "99d3b9cb...", "commit": "a647376ccf944c822d96c5788a7a13af1b62fbcd", "documents": [{"hash": "5a7f611d...", "name": "rules/style.md"}]}

This is the entry’s payload, shortened. If documents is empty, no file matched paths.

You see Do this
error: the canon repository path isn't a directory The path is wrong from where you ran the command. Run from the folder the relative path starts at, or use an absolute path
error: object_missing: the commit ... is missing from the repository The commit id is not in that repository. Copy it again from git rev-parse HEAD
validate names $.canon.commit The id is not 40 lower-case hexadecimal characters
The run starts but documents is empty No file of the commit matched paths. The patterns are relative to the top of the repository

Was this page helpful?