promptfiles

package
v1.63.0 Latest Latest
Warning

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

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

Documentation

Overview

Package promptfiles centralises the search rules used to resolve add_prompt_files entries (typically AGENTS.md, CLAUDE.md, ...). The rules are shared by:

  • the runtime add_prompt_files hook, which executes inside the sandbox at turn-start;
  • the docker-agent kit builder, which walks the same paths on the host before sandbox launch so it can stage every relevant file into the kit (see pkg/sandbox/kit).

Keeping the rules in one place guarantees both ends pick the same files and avoids drift when, for example, the kit ships a redacted copy of ~/AGENTS.md that the in-sandbox lookup must then prefer over the now-missing host $HOME entry.

Index

Constants

View Source
const KitSubdir = "prompt_files"

KitSubdir is the subdirectory inside a docker-agent kit that holds staged prompt files. The host writes to it; the in-sandbox lookup reads from it.

Variables

This section is empty.

Functions

func FindInHierarchy

func FindInHierarchy(startDir, filename string) string

FindInHierarchy searches for filename starting at startDir and walking up the directory tree. Returns the path of the first match, or "" if none.

func Paths

func Paths(workDir, homeDir, kitDir, filename string) []string

Paths returns the prompt-file paths to load for filename, in order:

  1. The closest match found while walking up from workDir, if any.
  2. Either a kitDir match (when kitDir is non-empty — running inside a sandbox with a staged kit), or a homeDir match.

kitDir takes precedence over homeDir because, in the sandbox, $HOME does not contain the host's prompt files; the kit is what brought them along (already redacted). Returns at most two paths. Passing homeDir == "" disables the home-dir lookup — useful in tests so they don't need to touch the real $HOME.

func PathsFromEnv

func PathsFromEnv(workDir, homeDir, filename string) []string

PathsFromEnv is a convenience wrapper around Paths that reads the kit directory from skills.KitDirEnv. The runtime in-sandbox hook uses it; host-side callers (the kit builder) pass kitDir explicitly to Paths instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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