prompts

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSubAgentPrompt

func BuildSubAgentPrompt(ctx PromptContext) (string, error)

BuildSubAgentPrompt assembles the sub-agent variant of the system prompt.

func BuildSystemPrompt

func BuildSystemPrompt(ctx PromptContext) (string, error)

BuildSystemPrompt assembles the main template sections into a complete system prompt. It checks ~/.hawk/prompts/ first for user overrides, then falls back to embedded templates.

func ListTemplates

func ListTemplates() []string

ListTemplates returns all available template names from the embedded templates.

func LoadTemplate

func LoadTemplate(name string) (string, error)

LoadTemplate loads a single template by name. It checks ~/.hawk/prompts/<name> first (user overrides), then falls back to embedded.

Types

type PromptContext

type PromptContext struct {
	Date          string
	WorkDir       string
	OS            string
	Shell         string
	Model         string
	Provider      string
	GitBranch     string
	GitStatus     string
	RecentCommits string
	TopFiles      string
	MaxTurns      int
	Task          string
}

PromptContext holds the variables available to prompt templates.

func DefaultContext

func DefaultContext() PromptContext

DefaultContext builds a PromptContext from the current environment.

type WorkspaceContext

type WorkspaceContext struct {
	GitBranch     string
	GitStatus     string   // short status (modified files)
	RecentCommits []string // last 5 commit onelines
	TopFiles      []string // top-level files/dirs
	Language      string   // detected primary language
	ChangedFiles  []string // files with uncommitted changes (for change-set context)
}

WorkspaceContext gathers git and project info for prompt injection.

func GatherWorkspaceContext

func GatherWorkspaceContext(dir string) *WorkspaceContext

GatherWorkspaceContext collects workspace info from the given directory. It uses the filesystem for top-level files and detects language from extensions. It uses git commands for branch, status, and recent commits.

func (*WorkspaceContext) Format

func (w *WorkspaceContext) Format() string

Format returns the workspace context as a prompt section.

Jump to

Keyboard shortcuts

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