Skip to content

feat(contract): add contract 1.0 model - #197

Open
niallroche wants to merge 1 commit into
accordproject:mainfrom
niallroche:codex/contract-1.0-model
Open

feat(contract): add contract 1.0 model#197
niallroche wants to merge 1 commit into
accordproject:mainfrom
niallroche:codex/contract-1.0-model

Conversation

@niallroche

@niallroche niallroche commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Closes N/A

Introduces a substantive org.accordproject.contract@1.0.0 model for agreement provenance and template identity. This is the first prerequisite for moving signature, runtime and obligation models onto a coherent 1.0 dependency family.

Changes

  • Add Contract and Clause assets in the versioned 1.0 namespace.
  • Require an agreement content hash and template reference on new contract instances.
  • Add a portable AgreementReference for downstream obligation, evidence and protocol models.
  • Add TemplateReference with archive and optional artifact-manifest hashes.
  • Add named, hash-addressed TemplateArtifact entries for logic, model, grammar, prose, documentation, tests and resources.
  • Allow executable artifacts such as logic.ts to record their path, language, runtime and entry-point role.
  • Preserve the existing unversioned and contract@0.2.0 models unchanged for compatibility.

Flags

  • org.accordproject.contract is proposed as the canonical family for new models; the legacy org.accordproject.cicero.contract family remains unchanged pending explicit migration guidance.
  • archiveHash is mandatory in 1.0 so template provenance is verifiable rather than descriptive.
  • An artifact list requires a normative manifest canonicalization rule before publication; the model cannot express the conditional requirement that artifactManifestHash accompany artifacts.
  • AgreementReference.agreementId maps to Contract.contractId when the complete asset is available.
  • Signature PR feat(signature): add org.accordproject.signature@1.0.0 #195 should import TemplateReference from this namespace once published.
  • Obligation PR Codex/obligation 1.0 models #196 should replace its local agreement reference with the shared 1.0 type once published.

Screenshots or Video

Not applicable. This PR contains a Concerto model change only.

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from niallroche:codex/contract-1.0-model

Signed-off-by: Niall Roche <niall.roche@gmail.com>
Comment thread src/accordproject/contract@1.0.0.cto
Comment thread src/accordproject/contract@1.0.0.cto
*/
abstract asset Clause identified by clauseId {
o String clauseId
o ContentHash clauseHash optional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Template reference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes—good catch @mttrbrts , although I want to distinguish a clause’s source template from an enclosing contract template.
As in our current model a clause may be authored independently, maintained in a clause bank, and reused by multiple contract templates. A clause should therefore optionally identify its own source template rather than inherit provenance from whichever contract happens to use it.
Here is what I propose:

abstract asset Clause identified by clauseId {
  o String clauseId
  o ContentHash clauseHash optional
  o TemplateReference sourceTemplate optional
}

I have added sourceTemplate that identifies an independently versioned clause template or archive when one exists. It does not identify the contract templates that subsequently incorporate the clause.
The field is optional because a standalone or directly authored clause may not have been produced from a template at all. In serialised data, the property would be omitted rather than represented as null.

A contract template that consumes a banked clause should record that composition in its own manifest or composition metadata. I don't think it makes sense for a reusable clause should not maintain a changing list of every template that uses it. We could maybe build some tooling to aggregate this if needed

mttrbrts added a commit that referenced this pull request Aug 27, 2026
Builds on the contract, runtime and obligation 1.0 models from #197, #198
and #196, which are included here unchanged as the commits beneath this
one. This commit is the delta: it keeps their type inventory and reworks
the structure underneath it.

This is a design target, not a migration-ready change. It settles the
structural questions that a stable 1.0 release needs answered, so that the
answers can be reviewed together rather than one PR at a time.

- Rename contract@1.0.0 to agreement@1.0.0, and model an agreement as a
  set of documents rather than a single instrument, so that a master
  agreement with schedules and confirmations is expressible.
- Add party@1.0.0 defining Party and its portable PartyRef projection, so
  the 1.0 family has one party representation instead of three.
- Address clause instances by TemplateMark instance path in a map, rather
  than by a static tree, since clause instances are data-driven: a list
  block yields one instance per element and a conditional may yield none.
- Carry template data by composition in TemplateData rather than by
  subclassing the agreement envelope, so the envelope's type and its
  relationship URIs stay stable across template versions.
- Hold runtime state as one revisioned document per agreement, with
  per-clause state keyed by the same instance paths.
- Point obligation@1.0.0 at the shared PartyRef and AgreementReference in
  place of its local equivalents.

contract@1.0.0 is deleted rather than kept alongside agreement@1.0.0.
Model URLs are permanent, so it must never be published if this direction
is taken: a dead namespace is worse than the rename.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Matt Roberts <code@rbrts.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants