walls

package
v0.11.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Overview

Package walls — OVERKILL_ARCH.md + CONTEXT.md generation (master plan §6.5 Wall 2).

Wall 2 already exists as ArchitectureWall (architecture.go) and gets surfaced as the wall_architecture agent tool. What was missing: the FILES the wall reads — OVERKILL_ARCH.md (canonical architecture reference) and CONTEXT.md (domain glossary). Without them the wall runs against an empty source of truth.

This file generates seed versions of both on first boot of a project so the agent + Wall 2 have something to reason against. The user extends them as architecture evolves; agent tools (arch_*, glossary_*) let the agent append entries when it discovers new modules or terms.

Generated files live in the PROJECT ROOT, not the agent's config dir. They're code-adjacent so they get committed alongside the source.

Package walls — behavioral regression bank (master plan §6.5 Wall 3).

Every shipped bug should leave a regression test behind so the same bug cannot re-ship. The bank persists each regression as a small record: what broke, the symptom, the test command that proves it's fixed. A `Verify` pass re-runs every recorded test command and reports any that fail — those are reopened bugs.

orphan: quality-gate runner (master plan §5.6); needs /walls slash command

Index

Constants

View Source
const (
	// ArchFile is the canonical architecture reference (master plan §6.5).
	ArchFile = "OVERKILL_ARCH.md"
	// GlossaryFile is the domain vocabulary (CONTEXT.md per the plan).
	GlossaryFile = "CONTEXT.md"
)

Variables

View Source
var ErrRegressionNotFound = errors.New("regression bank: not found")

ErrRegressionNotFound is returned when an ID is missing.

Functions

func DefaultCmdRunner

func DefaultCmdRunner(ctx context.Context, cmd string, timeout time.Duration) (string, error)

DefaultCmdRunner runs the command via /bin/sh with the given timeout.

func EnsureArch

func EnsureArch(projectRoot string) (bool, error)

EnsureArch generates OVERKILL_ARCH.md at projectRoot if absent. Returns (created, error): created=true when we wrote a fresh file, false when one already existed. Non-fatal on any error — the wall keeps running without it.

func EnsureGlossary

func EnsureGlossary(projectRoot string) (bool, error)

EnsureGlossary generates CONTEXT.md at projectRoot if absent. Returns (created, error) following the same convention as EnsureArch.

Types

type ArchRule

type ArchRule struct {
	ID          string   `json:"id"`
	Description string   `json:"description"`
	Pattern     string   `json:"pattern"`
	Severity    Severity `json:"severity"`
	// contains filtered or unexported fields
}

type ArchitectureConfig

type ArchitectureConfig struct {
	ArchFile   string
	Enabled    bool
	StrictMode bool
}

type ArchitectureWall

type ArchitectureWall struct {
	// contains filtered or unexported fields
}

func NewArchitectureWall

func NewArchitectureWall(cfg ArchitectureConfig) *ArchitectureWall

func (*ArchitectureWall) Check

func (w *ArchitectureWall) Check(_ context.Context, files map[string]string) (*WallResult, error)

func (*ArchitectureWall) LoadRules

func (w *ArchitectureWall) LoadRules(path string) error

type CmdRunner

type CmdRunner func(ctx context.Context, cmd string, timeout time.Duration) (string, error)

CmdRunner runs `sh -c cmd` and returns combined output + exit error. The default uses os/exec; tests inject a fake.

type MemRegressionStore

type MemRegressionStore struct {
	// contains filtered or unexported fields
}

MemRegressionStore is a non-persistent store, mostly for tests.

func NewMemRegressionStore

func NewMemRegressionStore() *MemRegressionStore

func (*MemRegressionStore) Delete

func (m *MemRegressionStore) Delete(id string) error

func (*MemRegressionStore) Get

func (m *MemRegressionStore) Get(id string) (*Regression, error)

func (*MemRegressionStore) List

func (m *MemRegressionStore) List() ([]Regression, error)

func (*MemRegressionStore) Save

func (m *MemRegressionStore) Save(r *Regression) error

type OuroborosConfig

type OuroborosConfig struct {
	Enabled    bool
	Provider   providers.Provider
	Model      string
	StrictMode bool
	// SystemPrompt overrides the default adversarial reviewer prompt.
	// When empty, the built-in prompt is used.
	SystemPrompt string
}

type OuroborosWall

type OuroborosWall struct {
	// contains filtered or unexported fields
}

func NewOuroborosWall

func NewOuroborosWall(cfg OuroborosConfig) *OuroborosWall

func (*OuroborosWall) Check

func (w *OuroborosWall) Check(ctx context.Context, code string, spec string) (*WallResult, error)

type PostgresRegressionStore

type PostgresRegressionStore struct {
	// contains filtered or unexported fields
}

PostgresRegressionStore persists regressions in the regressions table.

func NewPostgresRegressionStore

func NewPostgresRegressionStore(db *sql.DB) (*PostgresRegressionStore, error)

func (*PostgresRegressionStore) Delete

func (s *PostgresRegressionStore) Delete(id string) error

func (*PostgresRegressionStore) Get

func (*PostgresRegressionStore) List

func (s *PostgresRegressionStore) List() ([]Regression, error)

func (*PostgresRegressionStore) Save

type Regression

type Regression struct {
	ID          string    `json:"id"`
	Title       string    `json:"title"`
	Symptom     string    `json:"symptom"`
	RootCause   string    `json:"root_cause,omitempty"`
	TestCmd     string    `json:"test_cmd"`
	CommitSHA   string    `json:"commit_sha,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	LastVerify  time.Time `json:"last_verified,omitempty"`
	LastResult  string    `json:"last_result,omitempty"` // "passed" | "failed" | ""
	LastFailMsg string    `json:"last_fail_msg,omitempty"`
}

Regression is one persisted record. Created on bug-fix, verified on demand.

type RegressionBank

type RegressionBank struct {
	// contains filtered or unexported fields
}

RegressionBank coordinates record/verify against a RegressionStore.

func NewRegressionBank

func NewRegressionBank(store RegressionStore, runner CmdRunner) *RegressionBank

NewRegressionBank wires a store and a runner. Nil runner falls back to DefaultCmdRunner.

func (*RegressionBank) Delete

func (b *RegressionBank) Delete(id string) error

Delete removes one regression (e.g. when a feature is intentionally retired).

func (*RegressionBank) Get

func (b *RegressionBank) Get(id string) (*Regression, error)

Get fetches one regression.

func (*RegressionBank) List

func (b *RegressionBank) List() ([]Regression, error)

List returns every regression sorted newest-first.

func (*RegressionBank) Record

func (b *RegressionBank) Record(r *Regression) (*Regression, error)

Record persists a new regression. Title and TestCmd are required.

func (*RegressionBank) Verify

func (b *RegressionBank) Verify(ctx context.Context, timeout time.Duration) ([]VerifyResult, error)

Verify runs every recorded TestCmd and updates LastVerify/LastResult. timeout is per-command. Returns one VerifyResult per regression, in the same order as List().

type RegressionStore

type RegressionStore interface {
	Save(r *Regression) error
	Get(id string) (*Regression, error)
	List() ([]Regression, error)
	Delete(id string) error
}

RegressionStore abstracts persistence so tests can swap in an in-memory store.

type Severity

type Severity int
const (
	SeverityInfo    Severity = iota // 0
	SeverityWarning                 // 1
	SeverityBlock                   // 2
)

func (Severity) String

func (s Severity) String() string

type TestAnalysis

type TestAnalysis struct {
	TestCount      int  `json:"test_count"`
	HasTableDriven bool `json:"has_table_driven"`
	HasEdgeCases   bool `json:"has_edge_cases"`
	HasErrorCases  bool `json:"has_error_cases"`
	HasConcurrency bool `json:"has_concurrency"`
	// Coverage is unknown until a coverage-tool profile is supplied.
	Coverage            *float64 `json:"coverage"`
	StructuralTestRatio float64  `json:"structural_test_ratio"`
	MeasurementSource   string   `json:"measurement_source"`
}

type TestQualityConfig

type TestQualityConfig struct {
	Enabled      bool
	MinCoverage  float64
	RequireTests bool
	StrictMode   bool
}

type TestQualityWall

type TestQualityWall struct {
	// contains filtered or unexported fields
}

func NewTestQualityWall

func NewTestQualityWall(cfg TestQualityConfig) *TestQualityWall

func (*TestQualityWall) AnalyzeTestQuality

func (w *TestQualityWall) AnalyzeTestQuality(code, tests string) *TestAnalysis

func (*TestQualityWall) Check

func (w *TestQualityWall) Check(ctx context.Context, code string, tests string) (*WallResult, error)

func (*TestQualityWall) CheckWithCoverage

func (w *TestQualityWall) CheckWithCoverage(ctx context.Context, code, tests string, profile io.Reader) (*WallResult, error)

CheckWithCoverage accepts a caller-supplied Go coverage-tool profile from the tested source revision. It never infers execution from source length. Callers are responsible for supplying the artifact from their actual run.

type VerifyResult

type VerifyResult struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Passed bool   `json:"passed"`
	Output string `json:"output,omitempty"`
}

VerifyResult is one entry in the report returned by RegressionBank.Verify.

type WallID

type WallID int
const (
	WallOuroboros    WallID = iota // 0
	WallArchitecture               // 1
	WallTestQuality                // 2
)

func (WallID) String

func (w WallID) String() string

type WallReport

type WallReport struct {
	Results []WallResult `json:"results"`
	Passed  bool         `json:"passed"`
	Blocked bool         `json:"blocked"`
}

func NewReport

func NewReport(results []WallResult) *WallReport

type WallResult

type WallResult struct {
	Wall        WallID   `json:"wall"`
	Passed      bool     `json:"passed"`
	Severity    Severity `json:"severity"`
	Message     string   `json:"message"`
	Details     []string `json:"details,omitempty"`
	Suggestions []string `json:"suggestions,omitempty"`
}

Directories

Path Synopsis
Package impossibleprobe — ImpossibleBench-style cheating detection (§8.4 Zhong 2025).
Package impossibleprobe — ImpossibleBench-style cheating detection (§8.4 Zhong 2025).
Package mcpshield — MCP tool-call policy layer (§8.4 MCPSHIELD, Acharya 2026).
Package mcpshield — MCP tool-call policy layer (§8.4 MCPSHIELD, Acharya 2026).
Package monitor — heuristic detectors (Wall 4, paper #48).
Package monitor — heuristic detectors (Wall 4, paper #48).
Package promptinject — prompt-injection scanner (§8.4 Owner-Harm threat model, Zhang 2026).
Package promptinject — prompt-injection scanner (§8.4 Owner-Harm threat model, Zhang 2026).
Package truthsource — "user is source of truth" behavioral wall (§8.7.6).
Package truthsource — "user is source of truth" behavioral wall (§8.7.6).

Jump to

Keyboard shortcuts

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