Documentation
¶
Index ¶
Constants ¶
const PageSchemaV1 = "ctx.page.v1"
Variables ¶
This section is empty.
Functions ¶
func SanitizeContent ¶ added in v0.5.0
SanitizeContent removes characters that have no legitimate place in a knowledge page and are classic prompt-injection obfuscation vectors: terminal/ANSI escapes and other C0/C1 control codes (tab, newline, and carriage return are kept), Unicode bidirectional overrides, and zero-width / invisible characters. All visible text is preserved.
It is applied to shared page content before it reaches a consuming agent, so an attacker cannot smuggle hidden instructions (e.g. via a bidi override or a zero-width-spaced "ignore previous instructions") into a teammate's context.
func SerializePage ¶
SerializePage writes a Page to bytes with frontmatter + body, always LF line endings.
Types ¶
type Page ¶
type Page struct {
Frontmatter PageFrontmatter
Body string
}
type PageFrontmatter ¶
type PageFrontmatter struct {
Schema string `yaml:"schema"`
Slug string `yaml:"slug"`
Type PageType `yaml:"type"`
Author string `yaml:"author"`
Agent string `yaml:"agent,omitempty"`
Created time.Time `yaml:"created"`
Updated time.Time `yaml:"updated"`
ParentSHA string `yaml:"parent_sha"`
Sources []string `yaml:"sources,omitempty"`
Related []string `yaml:"related,omitempty"`
Tags []string `yaml:"tags,omitempty"`
ReasoningSummary string `yaml:"reasoning_summary,omitempty"`
}
func (*PageFrontmatter) RelPath ¶
func (fm *PageFrontmatter) RelPath() string
RelPath returns the path under .contexo/ where a page of this type and slug lives.
func (*PageFrontmatter) Validate ¶
func (fm *PageFrontmatter) Validate() error