prompts

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package prompts holds byte-identical copies of every prompt template that ships inside the Python package at src/sec_af/prompts, embedded into the Go binary.

Python reads each template lazily, at call time, from a path computed off __file__:

PROMPT_PATH = Path(__file__).resolve().parents[2] / "prompts" / "hunt" / "injection.txt"
template = PROMPT_PATH.read_text(encoding="utf-8")

A missing template therefore raises FileNotFoundError inside the reasoner (a 500), not at import. The Go port embeds the same tree with //go:embed, so "missing file" is a compile-time impossibility for any name that exists — a bad name is a programmer typo. Load reports it as an error for callers that want to handle it; MustLoad panics, which is the shape agent code wants (Python's read_text would blow up just as loudly).

Relative names are exactly the Python-relative paths under src/sec_af/prompts with forward slashes, e.g. "hunt/injection.txt", "prove/verdict.txt", "remediation.txt".

The copies are verified against the Python tree by TestPromptsMatchPythonTree (prompts_test.go), which walks both trees in both directions whenever the Python source is present next to the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(rel string) (string, error)

Load returns the prompt template stored at rel (a path relative to src/sec_af/prompts, forward-slash separated, e.g. "hunt/injection.txt").

Ports the `PROMPT_PATH.read_text(encoding="utf-8")` call every agent module performs. The bytes are returned verbatim — no trailing-newline trimming, no normalization — because prompt text reaches the LLM byte-for-byte.

func MustLoad

func MustLoad(rel string) string

MustLoad is Load for the call sites that treat a missing template as a programmer error — which is every agent module, since Python hard-codes the path in a module-level constant. Panics when rel does not exist.

func Names

func Names() []string

Names lists every embedded template path (relative form, sorted). Used by the drift test and useful for diagnostics; agent code addresses templates by literal name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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