Internal

internal/core/agentcontract

Package agentcontract models role contracts delivered to agents.

import "github.com/nilstate/scafld/v2/internal/core/agentcontract"

Package agentcontract models role contracts delivered to agents.

Constants

Source: internal/core/agentcontract/model.go:17

const (
	RolePlan     Role = "plan"
	RoleHarden   Role = "harden"
	RoleBuild    Role = "build"
	RoleReview   Role = "review"
	RoleRecovery Role = "recovery"

	// ProjectOverrideMarker must appear in a workspace prompt before scafld will
	// treat that file as an active role-contract override. Generated prompt copies
	// intentionally omit it so a newer binary can always carry newer contracts.
	ProjectOverrideMarker = "scafld:prompt-owner=project"
)

Functions

func HasProjectOverrideMarker(body []byte) bool

Source: internal/core/agentcontract/model.go:105

HasProjectOverrideMarker reports whether body opts into replacing the embedded contract for a role. Without this marker, workspace prompt files are refreshable copies, not runtime authority.

func New(role Role, path string, body []byte) (Contract, error)

Source: internal/core/agentcontract/model.go:59

New returns a normalized contract with digest provenance.

func Roles() []Role

Source: internal/core/agentcontract/model.go:30

Roles returns every managed role contract.

Types

type Contract

Source: internal/core/agentcontract/model.go:50

Contract is a source-backed role contract resolved by an adapter.

type Contract struct {
	Role   Role   `json:"role"`
	Path   string `json:"path"`
	Body   string `json:"body"`
	SHA256 string `json:"sha256"`
	Bytes  int    `json:"bytes"`
}
Fields
  • Role Role `json:"role"`
  • Path string `json:"path"`
  • Body string `json:"body"`
  • SHA256 string `json:"sha256"`
  • Bytes int `json:"bytes"`

func Empty() bool

Source: internal/core/agentcontract/model.go:74

Empty reports whether the contract has no body.

func Section(key string, title string, order int) reviewcontext.Section

Source: internal/core/agentcontract/model.go:79

Section converts the contract into a required review context section.

type Role

Source: internal/core/agentcontract/model.go:14

Role names one agent-facing contract.

type Role string

func Filename() string

Source: internal/core/agentcontract/model.go:35

Filename returns the managed prompt filename for role.

func Valid() bool

Source: internal/core/agentcontract/model.go:40

Valid reports whether role is one of the managed contract roles.