decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
+
err = decoder.Decode(&config)
if err == nil && !errors.Is(decoder.Decode(&struct{}{}), io.EOF) {
err = errors.New("data after the JSON object")
func (a *Agent) Prompt() (string, error) {
instructions, err := a.instructions()
if err != nil {
- return "", err
+ return "", fmt.Errorf("read prompt instructions: %w", err)
+ }
+
+ path, err := filepath.Abs(filepath.Join(a.dir, agentInstructionsFileName))
+ if err != nil {
+ return "", fmt.Errorf("find instructions path: %w", err)
}
- return prompt(a.config.Name, instructions), nil
+ return prompt(a.config.Name, path, instructions), nil
}
// SubagentPrompt returns the system prompt of a subagent of the agent, with the