Documentation
¶
Index ¶
- func CostUSD(inputTokens, outputTokens int, r RateModel) float64
- func EstimateTokens(text string) int
- func FindRepoRoot() (string, error)
- func FormatShowcaseMarkdown(r MonthlyProjectionReport) string
- func LoadResults(root string) (map[string]ScenarioResults, error)
- func MissingAssertions(text string, phrases []string) []string
- func OllamaReachable(ctx context.Context, host string) error
- func PassesAssertions(text string, phrases []string) bool
- func ScaledBaselineOnly(ref ScenarioResults, rates Rates, multiplier float64) float64
- func ScaledDelegatedOnly(ref ScenarioResults, rates Rates) float64
- func ScaledSavingsPerRun(ref ScenarioResults, rates Rates, multiplier float64) (baselineUSD, delegatedUSD, savingsUSD float64, inputSaved int)
- type Assertions
- type ComparisonReport
- type Delegation
- type Mode
- type ModeResult
- type ModelRateProfile
- type ModelShowcaseRow
- type MonthlyProjectionReport
- type ProfileProjection
- type RateModel
- type Rates
- type RunOptions
- type RunSnapshot
- type ScaleProfiles
- type Scenario
- func (s *Scenario) Dir() string
- func (s *Scenario) LoadAllEvidence() (string, error)
- func (s *Scenario) LoadFullLibrary() bool
- func (s *Scenario) LoadOrchestratorContext() (string, error)
- func (s *Scenario) ReadBrief() (string, error)
- func (s *Scenario) ReadTask(rel string) (string, error)
- func (s *Scenario) SynthesisResponse() (string, error)
- type ScenarioResults
- type ShowcaseConfig
- type ShowcaseSummary
- type SummaryReport
- type Synthesis
- type Thresholds
- type UsageProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateTokens ¶
EstimateTokens approximates tokens from text (~4 characters per token).
func FindRepoRoot ¶
FindRepoRoot walks up from cwd to locate the prism repository root.
func FormatShowcaseMarkdown ¶
func FormatShowcaseMarkdown(r MonthlyProjectionReport) string
FormatShowcaseMarkdown renders the headline with-vs-without cost matrix from live results.
func LoadResults ¶
func LoadResults(root string) (map[string]ScenarioResults, error)
LoadResults reads testdata/benchmarks/results.yaml.
func MissingAssertions ¶
MissingAssertions returns required phrases not found in text (case-insensitive).
func OllamaReachable ¶
OllamaReachable reports whether the Ollama server responds at host.
func PassesAssertions ¶
PassesAssertions reports whether text contains all required phrases (case-insensitive).
func ScaledBaselineOnly ¶
func ScaledBaselineOnly(ref ScenarioResults, rates Rates, multiplier float64) float64
func ScaledDelegatedOnly ¶
func ScaledDelegatedOnly(ref ScenarioResults, rates Rates) float64
func ScaledSavingsPerRun ¶
func ScaledSavingsPerRun(ref ScenarioResults, rates Rates, multiplier float64) (baselineUSD, delegatedUSD, savingsUSD float64, inputSaved int)
ScaledSavingsPerRun adjusts committed savings for a context multiplier. Baseline orchestrator input scales linearly; delegated orchestrator input stays near flat.
Types ¶
type Assertions ¶
type Assertions struct {
RequiredPhrases []string `yaml:"required_phrases"`
}
Assertions lists required phrases in the final incident report.
type ComparisonReport ¶
type ComparisonReport struct {
ScenarioID string `json:"scenario_id"`
ScenarioTitle string `json:"scenario_title"`
Baseline string `json:"baseline"`
Delegated string `json:"delegated"`
OrchestratorOnly ModeResult `json:"orchestrator_only"`
PrismDelegated ModeResult `json:"prism_delegated"`
TokenReductionPercent float64 `json:"token_reduction_percent"`
NetCostSavingsUSD float64 `json:"net_cost_savings_usd"`
WallClockDeltaMS int64 `json:"wall_clock_delta_ms"`
PassRate map[string]float64 `json:"pass_rate"`
LatencyBudgetCompliance float64 `json:"latency_budget_compliance"`
Markdown string `json:"-"`
}
ComparisonReport is the full benchmark output comparing both modes.
func Compare ¶
func Compare(ctx context.Context, root, scenarioID string, opts RunOptions) (ComparisonReport, error)
Compare runs orchestrator-only and prism-delegated modes for one scenario.
type Delegation ¶
type Delegation struct {
ID string `yaml:"id"`
AgentID string `yaml:"agent_id"`
SkillNames []string `yaml:"skill_names"`
TaskFile string `yaml:"task_file"`
EvidenceFiles []string `yaml:"evidence_files"`
MockResponseFile string `yaml:"mock_response_file"`
}
Delegation is one Prism agent invocation in the delegated benchmark path.
func (*Delegation) MockResponse ¶
func (d *Delegation) MockResponse(scenarioDir string) (string, error)
type ModeResult ¶
type ModeResult struct {
Mode Mode `json:"mode"`
ScenarioID string `json:"scenario_id"`
OrchestratorInputTokens int `json:"orchestrator_input_tokens"`
OrchestratorOutputTokens int `json:"orchestrator_output_tokens"`
OrchestratorTokens int `json:"orchestrator_tokens"`
LocalTokens int `json:"local_tokens"`
WallClockMS int64 `json:"wall_clock_ms"`
OrchestratorCostUSD float64 `json:"orchestrator_cost_usd"`
LocalCostUSD float64 `json:"local_cost_usd"`
Pass bool `json:"pass"`
ReportText string `json:"report_text"`
DelegationCount int `json:"delegation_count"`
LatencyCompliant bool `json:"latency_compliant"`
}
ModeResult holds metrics for one benchmark mode.
func RunOrchestratorOnly ¶
func RunOrchestratorOnly(ctx context.Context, root string, scenario *Scenario, rates Rates, opts RunOptions) (ModeResult, error)
RunOrchestratorOnly benchmarks Cursor without MCP: one large orchestrator context.
func RunPrismDelegated ¶
func RunPrismDelegated(ctx context.Context, root string, scenario *Scenario, rates Rates, opts RunOptions) (ModeResult, error)
RunPrismDelegated benchmarks Prism MCP: eight agent runs plus orchestrator synthesis.
type ModelRateProfile ¶
type ModelRateProfile struct {
ID string `yaml:"id"`
InputPerMillion float64 `yaml:"input_per_million"`
OutputPerMillion float64 `yaml:"output_per_million"`
Note string `yaml:"note,omitempty"`
}
ModelRateProfile is one orchestrator pricing profile for showcase comparisons.
func LoadOrchestratorModelProfiles ¶
func LoadOrchestratorModelProfiles(root string) ([]ModelRateProfile, error)
LoadOrchestratorModelProfiles reads benchmark showcase model rates.
type ModelShowcaseRow ¶
type ModelShowcaseRow struct {
Model string `json:"model"`
WithoutPrismUSD float64 `json:"without_prism_usd_per_task"`
WithPrismUSD float64 `json:"with_prism_usd_per_task"`
SavedPerTaskUSD float64 `json:"saved_per_task_usd"`
WithoutPerDayUSD float64 `json:"without_prism_usd_per_day"`
WithPerDayUSD float64 `json:"with_prism_usd_per_day"`
WithoutPerMonthUSD float64 `json:"without_prism_usd_per_month"`
WithPerMonthUSD float64 `json:"with_prism_usd_per_month"`
WithoutPerYearUSD float64 `json:"without_prism_usd_per_year"`
WithPerYearUSD float64 `json:"with_prism_usd_per_year"`
RateConfigured bool `json:"rate_configured"`
Note string `json:"note,omitempty"`
}
ModelShowcaseRow summarizes with-vs-without orchestrator cost for one model profile.
type MonthlyProjectionReport ¶
type MonthlyProjectionReport struct {
RatesModel string `json:"rates_model"`
Profiles []ProfileProjection `json:"profiles"`
Showcase ShowcaseSummary `json:"showcase,omitempty"`
ModelShowcase []ModelShowcaseRow `json:"model_showcase,omitempty"`
Markdown string `json:"-"`
}
MonthlyProjectionReport aggregates all profiles.
func ProjectMonthly ¶
func ProjectMonthly(root string) (MonthlyProjectionReport, error)
ProjectMonthly builds a savings report from committed results and usage profiles.
func WriteShowcaseDocs ¶
func WriteShowcaseDocs(root string) (MonthlyProjectionReport, error)
WriteShowcaseDocs regenerates committed showcase docs from results.yaml.
type ProfileProjection ¶
type ProfileProjection struct {
ProfileID string `json:"profile_id"`
Description string `json:"description"`
IncidentsPerMonth int `json:"incidents_per_month"`
CodegenTasksPerMonth int `json:"codegen_tasks_per_month"`
ContextSizeMultiplier float64 `json:"context_size_multiplier"`
IncidentScenario string `json:"incident_scenario"`
SavingsPerIncidentUSD float64 `json:"savings_per_incident_usd"`
SavingsPerCodegenUSD float64 `json:"savings_per_codegen_usd"`
MonthlyBaselineUSD float64 `json:"monthly_baseline_usd"`
MonthlyDelegatedUSD float64 `json:"monthly_delegated_usd"`
MonthlyNetSavingsUSD float64 `json:"monthly_net_savings_usd"`
AnnualNetSavingsUSD float64 `json:"annual_net_savings_usd"`
OrchestratorInputSaved int `json:"orchestrator_input_tokens_saved_per_month"`
}
ProfileProjection is monthly cost/savings for one usage profile.
type RateModel ¶
type RateModel struct {
Model string `yaml:"model"`
InputPerMillion float64 `yaml:"input_per_million"`
OutputPerMillion float64 `yaml:"output_per_million"`
}
RateModel is input/output USD per million tokens.
type RunOptions ¶
RunOptions configures a benchmark execution. Mock defaults to false (real Ollama).
type RunSnapshot ¶
type RunSnapshot struct {
InputTokens int `yaml:"input_tokens"`
OutputTokens int `yaml:"output_tokens"`
TotalTokens int `yaml:"total_tokens"`
LocalTokens int `yaml:"local_tokens"`
CostUSD float64 `yaml:"cost_usd"`
WallClockMS int64 `yaml:"wall_clock_ms"`
Pass bool `yaml:"pass"`
Delegations int `yaml:"delegations"`
}
RunSnapshot is one mode's committed metrics.
type ScaleProfiles ¶
type ScaleProfiles struct {
Profiles map[string]UsageProfile `yaml:"profiles"`
ReferenceScenarios struct {
Incident string `yaml:"incident"`
IncidentAtScale string `yaml:"incident_at_scale"`
Codegen string `yaml:"codegen"`
CodingTask string `yaml:"coding_task"`
} `yaml:"reference_scenarios"`
Showcase ShowcaseConfig `yaml:"showcase"`
AtScaleThresholdMultiplier float64 `yaml:"at_scale_threshold_multiplier"`
}
ScaleProfiles configures monthly projection inputs.
func LoadScaleProfiles ¶
func LoadScaleProfiles(root string) (ScaleProfiles, error)
LoadScaleProfiles reads testdata/benchmarks/scale-profiles.yaml.
type Scenario ¶
type Scenario struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Description string `yaml:"description"`
BriefFile string `yaml:"brief_file"`
// OrchestratorLoadFullLibrary controls whether orchestrator-only baseline
// loads all skill bodies + constitutions into one prompt.
// nil/default = true for backwards compatibility.
OrchestratorLoadFullLibrary *bool `yaml:"orchestrator_load_full_library"`
// OrchestratorContextFiles are appended to the orchestrator-only prompt only
// (simulates Cursor rules, chat history, runbooks — not sent to local agents).
OrchestratorContextFiles []string `yaml:"orchestrator_context_files"`
Delegations []Delegation `yaml:"delegations"`
Assertions Assertions `yaml:"assertions"`
Synthesis Synthesis `yaml:"synthesis"`
// contains filtered or unexported fields
}
Scenario defines a benchmark fixture with eight delegations (full skill coverage).
func LoadScenario ¶
LoadScenario reads scenario.yaml from testdata/benchmarks/scenarios/<id>/.
func (*Scenario) LoadAllEvidence ¶
func (*Scenario) LoadFullLibrary ¶
func (*Scenario) LoadOrchestratorContext ¶
LoadOrchestratorContext reads extra files loaded only in orchestrator-only mode.
func (*Scenario) SynthesisResponse ¶
type ScenarioResults ¶
type ScenarioResults struct {
MeasuredAt string `yaml:"measured_at"`
ModelLocal string `yaml:"model_local"`
ModelOrchestrator string `yaml:"model_orchestrator"`
OrchestratorOnly RunSnapshot `yaml:"orchestrator_only"`
PrismDelegated RunSnapshot `yaml:"prism_delegated"`
InputTokenReductionPercent float64 `yaml:"input_token_reduction_percent"`
NetSavingsUSD float64 `yaml:"net_savings_usd"`
}
ScenarioResults holds committed per-run metrics from results.yaml.
type ShowcaseConfig ¶
type ShowcaseConfig struct {
Scenario string `yaml:"scenario"`
TasksPerDay int `yaml:"tasks_per_day"`
TasksPerMonth int `yaml:"tasks_per_month"`
TasksPerYear int `yaml:"tasks_per_year"`
}
ShowcaseConfig drives the headline with-vs-without orchestrator cost matrix.
type ShowcaseSummary ¶
type ShowcaseSummary struct {
ScenarioID string `json:"scenario_id"`
WithoutInputTokens int `json:"without_input_tokens"`
WithoutOutputTokens int `json:"without_output_tokens"`
WithInputTokens int `json:"with_input_tokens"`
WithOutputTokens int `json:"with_output_tokens"`
InputReductionPercent float64 `json:"input_reduction_percent"`
TasksPerDay int `json:"tasks_per_day"`
TasksPerMonth int `json:"tasks_per_month"`
TasksPerYear int `json:"tasks_per_year"`
}
ShowcaseSummary describes the live benchmark scenario behind the headline matrix.
type SummaryReport ¶
type SummaryReport struct {
Baseline string `json:"baseline"`
Delegated string `json:"delegated"`
Scenarios int `json:"scenarios"`
TokenReductionPercent float64 `json:"token_reduction_percent"`
PassRate map[string]float64 `json:"pass_rate"`
LatencyBudgetCompliance float64 `json:"latency_budget_compliance"`
}
SummaryReport is the JSON shape emitted by the benchmark suite.
type Synthesis ¶
type Synthesis struct {
OrchestratorPromptFile string `yaml:"orchestrator_prompt_file"`
DelegatedPromptFile string `yaml:"delegated_prompt_file"`
}
Synthesis holds prompt templates for final report assembly.
type Thresholds ¶
type Thresholds struct {
TokenReductionPercentMin float64 `yaml:"token_reduction_percent_min"`
PassRateDelegatedMin float64 `yaml:"pass_rate_delegated_min"`
LatencyBudgetComplianceMin float64 `yaml:"latency_budget_compliance_min"`
}
Thresholds holds CI benchmark targets from testdata/benchmarks/thresholds.yaml.
func LoadThresholds ¶
func LoadThresholds(root string) (Thresholds, error)
LoadThresholds reads thresholds.yaml from the repository.
type UsageProfile ¶
type UsageProfile struct {
Description string `yaml:"description"`
IncidentsPerMonth int `yaml:"incidents_per_month"`
CodegenTasksPerMonth int `yaml:"codegen_tasks_per_month"`
ContextSizeMultiplier float64 `yaml:"context_size_multiplier"`
}
UsageProfile describes monthly task volume for one team shape.