Help us shape the future of Go! Take the 2026 Go Developer Survey

context

package
v0.51.0 Latest Latest
Warning

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

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

Documentation

Overview

Package context is part of the GoFastr harness.

See docs/harness-architecture.md for the architecture this package implements.

Package context implements project-instruction file readers.

Per § Skills (SKILL.md) and context (AGENTS.md), the harness reads project context from a profile-configured list of (path, label) tuples. AGENTS.md is the open standard primary surface; vendor fallback files (CLAUDE.md, .cursorrules, GEMINI.md, …) are read if present.

Each entry in the profile's context_sources list is resolved to a Reader by Resolve. The result is fed into the engine's request middleware chain via ContextSection wrapped in <untrusted-NAME>...</untrusted-NAME> tags (rule 12).

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSourcesConfigured = errors.New("context: no sources configured")

ErrNoSourcesConfigured is returned when Reader.Sources is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// WorkingDir is the root the reader walks from. AGENTS.md
	// walks upward from this to the repo root.
	WorkingDir string

	// Sources is the configured list — names like "AGENTS.md" or
	// "CLAUDE.md". Per § Profiles, this is just a strings list, not
	// a polymorphism point.
	Sources []string
}

Reader reads project context from a working directory.

func (*Reader) Read

func (r *Reader) Read() ([]Section, error)

Read returns all sections found, in profile-configured order. Each AGENTS.md walk produces one section per file encountered (deepest first → root last, so child rules apply atop parent rules).

Missing files are silently skipped — readers don't error on the happy "no AGENTS.md in this repo" path.

type Section

type Section struct {
	Source string // canonical name (e.g. "agents-md", "claude-md")
	Path   string // absolute path the content came from
	Body   string // file content, post-newline-normalization
	SHA256 string // for TOFU comparison
}

Section is one chunk of project context read from disk.

Jump to

Keyboard shortcuts

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