-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchat_subcommand_memory.go
More file actions
31 lines (25 loc) · 1.08 KB
/
Copy pathchat_subcommand_memory.go
File metadata and controls
31 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import (
"strings"
tea "github.com/charmbracelet/bubbletea"
hawkconfig "github.com/GrayCodeAI/hawk/internal/config"
)
// memorySubcommand implements the /memory slash command.
// It prints the project's AGENTS.md content.
type memorySubcommand struct{}
func (m *memorySubcommand) Name() string { return "memory" }
func (m *memorySubcommand) Aliases() []string { return nil }
func (m *memorySubcommand) Description() string { return "print project instructions (AGENTS.md)" }
func (m *memorySubcommand) Usage() string { return "" }
func (m *memorySubcommand) Handle(ml *chatModel, args []string, text string) (tea.Model, tea.Cmd) {
md := strings.TrimSpace(hawkconfig.LoadAgentsMD())
if md == "" {
ml.messages = append(ml.messages, displayMsg{role: "system", content: "No AGENTS.md project instructions found.\nUse /yaad for persistent graph memory."})
} else {
ml.messages = append(ml.messages, displayMsg{role: "system", content: "Project instructions (AGENTS.md):\n" + md})
}
return ml, nil
}
func init() {
subcommandRegistry.Register(&memorySubcommand{})
}