spec

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package spec holds the cross-cutting state and domain value types that both internal/core and internal/context depend on. It is a leaf: it imports only the standard library and must never import internal/core, so the two heavier packages can share these enums without an import cycle.

Index

Constants

This section is empty.

Variables

View Source
var Roles = []RoleDef{
	{
		Name:          "scout",
		RW:            "readonly",
		BudgetTier:    "minimal",
		PhaseAffinity: []Phase{PhasePerceive, PhaseAnalyze, PhasePlan, PhaseExecute, PhaseVerify, PhaseReflect},
		Tools:         []string{"specd_inspect", "specd_read", "specd_query", "specd_status", "specd_context"},
		FilePolicy:    "no writes",
		PromptClass:   "gate-only",
	},
	{
		Name:          "researcher",
		RW:            "readonly",
		BudgetTier:    "large",
		PhaseAffinity: []Phase{PhasePerceive, PhaseAnalyze, PhasePlan, PhaseExecute, PhaseVerify, PhaseReflect},
		Tools:         []string{"specd_inspect", "specd_read", "specd_query", "specd_status", "specd_context", "specd_diff", "specd_report", "specd_check"},
		FilePolicy:    "no writes",
		PromptClass:   "gate-only",
	},
	{
		Name:          "auditor",
		RW:            "readonly",
		BudgetTier:    "medium",
		PhaseAffinity: []Phase{PhasePerceive, PhaseAnalyze, PhasePlan, PhaseExecute, PhaseVerify, PhaseReflect},
		Tools:         []string{"specd_inspect", "specd_read", "specd_query", "specd_status", "specd_context", "specd_diff", "specd_report", "specd_check", "specd_waves"},
		FilePolicy:    "no writes",
		PromptClass:   "gate-only",
	},
	{
		Name:          "architect",
		RW:            "readonly",
		BudgetTier:    "medium",
		PhaseAffinity: []Phase{PhaseAnalyze, PhasePlan},
		Tools:         []string{"specd_inspect", "specd_read", "specd_query", "specd_status", "specd_context", "specd_check", "specd_approve", "specd_waves", "specd_report", "specd_diff"},
		FilePolicy:    "no writes",
		PromptClass:   "gate-only",
	},
	{
		Name:          "craftsman",
		RW:            "readwrite",
		BudgetTier:    "focused",
		PhaseAffinity: []Phase{PhaseExecute},
		Tools:         []string{"specd_inspect", "specd_read", "specd_context", "specd_status", "specd_next", "specd_dispatch", "specd_verify", "specd_task", "specd_report"},
		FilePolicy:    "task scope only",
		PromptClass:   "card",
	},
	{
		Name:          "tester",
		RW:            "readwrite",
		BudgetTier:    "focused",
		PhaseAffinity: []Phase{PhaseExecute, PhaseVerify},
		Tools:         []string{"specd_inspect", "specd_read", "specd_context", "specd_status", "specd_check", "specd_verify", "specd_task", "specd_report"},
		FilePolicy:    "task scope only",
		PromptClass:   "card",
	},
	{
		Name:          "documenter",
		RW:            "readwrite",
		BudgetTier:    "focused",
		PhaseAffinity: []Phase{PhaseAnalyze, PhasePlan, PhaseExecute, PhaseVerify, PhaseReflect},
		Tools:         []string{"specd_inspect", "specd_read", "specd_context", "specd_status", "specd_memory", "specd_decision", "specd_report", "specd_diff", "specd_check"},
		FilePolicy:    "unrestricted within files:",
		PromptClass:   "card",
	},
	{
		Name:          "validator",
		RW:            "readwrite",
		BudgetTier:    "medium",
		PhaseAffinity: []Phase{PhaseExecute, PhaseVerify},
		Tools:         []string{"specd_check", "specd_status", "specd_state_read", "specd_doctor"},
		FilePolicy:    "specd state only",
		PromptClass:   "contract",
	},
}

Roles is single registry of declared role contracts, in stable order.

Functions

func IsReadonlyRole

func IsReadonlyRole(r string) bool

IsReadonlyRole reports whether r is a read-only task role.

func ReadonlyRoleNames

func ReadonlyRoleNames() []string

ReadonlyRoleNames returns stable readonly-role names.

func RoleAllowsPhase

func RoleAllowsPhase(name string, phase Phase) bool

RoleAllowsPhase reports whether role may operate in phase.

func RoleAllowsTool

func RoleAllowsTool(name, tool string) bool

RoleAllowsTool reports whether role may expose tool.

func RoleBudgetTier

func RoleBudgetTier(name string) string

RoleBudgetTier returns budget tier for role.

func RoleFilePolicy

func RoleFilePolicy(name string) string

RoleFilePolicy returns file policy for role.

func RoleNames

func RoleNames() []string

RoleNames returns stable registry order.

func RolePromptClass

func RolePromptClass(name string) string

RolePromptClass returns prompt class for role.

func RoleToolSet

func RoleToolSet(name string) map[string]bool

RoleToolSet returns the allowed MCP tool names for role as a set.

func RoleTools

func RoleTools(name string) []string

RoleTools returns allowed MCP tool names for role.

Types

type Phase

type Phase string

Phase is the PDCA-style execution phase a spec status maps to.

const (
	PhasePerceive Phase = "perceive"
	PhaseAnalyze  Phase = "analyze"
	PhasePlan     Phase = "plan"
	PhaseExecute  Phase = "execute"
	PhaseVerify   Phase = "verify"
	PhaseReflect  Phase = "reflect"
)

func PhaseForStatus

func PhaseForStatus(status SpecStatus) Phase

PhaseForStatus maps a spec status to its execution phase.

func RolePhaseAffinity

func RolePhaseAffinity(name string) []Phase

RolePhaseAffinity returns phase affinity for role.

type RoleDef

type RoleDef struct {
	Name          string
	RW            string
	BudgetTier    string
	PhaseAffinity []Phase
	Tools         []string
	FilePolicy    string
	PromptClass   string
}

RoleDef is one role contract: permission, budget, phase affinity, allowed tools, file policy, and prompt class.

func RoleByName

func RoleByName(name string) (RoleDef, bool)

RoleByName looks up a role contract.

type SpecStatus

type SpecStatus string

SpecStatus is the lifecycle status of a spec, recorded in state.json.

const (
	StatusRequirements SpecStatus = "requirements"
	StatusDesign       SpecStatus = "design"
	StatusTasks        SpecStatus = "tasks"
	StatusExecuting    SpecStatus = "executing"
	StatusVerifying    SpecStatus = "verifying"
	StatusComplete     SpecStatus = "complete"
	StatusBlocked      SpecStatus = "blocked"
)

func (SpecStatus) IsValid

func (s SpecStatus) IsValid() bool

IsValid reports whether s is one of the recognized lifecycle statuses. It is the single source of truth for "is this a status specd ever writes", so a resume that finds a hand-edited or corrupt on-disk status can fail loud instead of silently coercing it to a default.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL