Expand description
Context files, skills, prompt templates and system prompt files.
Ports of the discovery parts of resource-loader.ts, skills.ts and
prompt-templates.ts in pi v1.0.0. Project .yapi/ resources load only for a
trusted project. AGENTS.md and CLAUDE.md files always load.
Structs§
- Context
File - A context file and its text.
- Prompt
Template - A prompt template, expanded by
/name args. - Skill
- A skill: instructions the model reads on demand. A handler may add one with only the fields the prompt shows, and the others take their empty value.
- Source
Info - Where a resource was found, as pi’s
SourceInfo:sourceisautofor discovered files,clifor command-line paths and the package for package resources.scopeisuser,projectortemporary.
Enums§
- Diagnostic
- A problem found while loading skills, prompt templates or themes: pi’s
ResourceDiagnostic, listed under the startup[... conflicts]sections.
Functions§
- cli_
source - A path given on the command line, as pi records it: source
cli, scopetemporary. - context_
files - The global context file from the agent directory, then those of
project_dirand its ancestors, outermost first. In a linked worktree nested in its main checkout, the main checkout’s file is left out when the worktree has its own. - expand_
prompt_ template - Expands
/name argswhennameis a template. Other text is unchanged. - format_
skills - The skills section of the prompt, read with
readorbash. - merge_
sources - pi’s
mergePaths:sourcesin order, each path once, compared after resolving symlinks. - parse_
command_ args - Splits arguments on whitespace, honoring single and double quotes.
- parse_
frontmatter - pi’s
parseFrontmatter: the frontmatter and the body, or the YAML error. - skills_
from - pi’s
loadSkillsoversources, in order, each with its source: skill files, or directories searched for skills. The first skill of a name wins, and later ones are reported as collisions. - split_
frontmatter - pi’s
extractFrontmatter: the YAML between---lines, when there is any, and the trimmed markdown body after it. - substitute_
args - pi’s
substituteArgs: replaces$1,$@,$ARGUMENTS,${N:-default}and${@:start:length}. - system_
prompt_ file SYSTEM.mdreplacing the default prompt: the trusted project’s inproject_dir, else the global one.- templates_
from - pi’s prompt template loading over
sources, in order, each with its source: markdown files, or directories of them. The first template of a name wins, and later ones are reported as collisions. Missing paths are skipped, and the caller reports the command line’s.
Type Aliases§
- Frontmatter
- Frontmatter as pi’s
yamlparser gives it to JavaScript: the top-level mapping, in document order.