# internal/core/agentcontract

Package agentcontract models role contracts delivered to agents.

## RolePlan

```go
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"
)
```

## RoleHarden

```go
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"
)
```

## RoleBuild

```go
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"
)
```

## RoleReview

```go
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"
)
```

## RoleRecovery

```go
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"
)
```

## ProjectOverrideMarker

```go
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"
)
```

## HasProjectOverrideMarker

```go
func HasProjectOverrideMarker(body []byte) bool
```

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.

## New

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

New returns a normalized contract with digest provenance.

## Roles

```go
func Roles() []Role
```

Roles returns every managed role contract.

## Contract

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

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

- `Role: Role` (json:"role"): 
- `Path: string` (json:"path"): 
- `Body: string` (json:"body"): 
- `SHA256: string` (json:"sha256"): 
- `Bytes: int` (json:"bytes"): 

## Empty

```go
func (c Contract) Empty() bool
```

Empty reports whether the contract has no body.

## Section

```go
func (c Contract) Section(key string, title string, order int) reviewcontext.Section
```

Section converts the contract into a required review context section.

## Role

```go
type Role string
```

Role names one agent-facing contract.

## Filename

```go
func (r Role) Filename() string
```

Filename returns the managed prompt filename for role.

## Valid

```go
func (r Role) Valid() bool
```

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