RecordCommand increments command usage counter.
(cmd string)
| 391 | |
| 392 | // RecordCommand increments command usage counter. |
| 393 | func (ps *UserProfileStore) RecordCommand(cmd string) { |
| 394 | cmd = strings.TrimSpace(cmd) |
| 395 | if cmd == "" { |
| 396 | return |
| 397 | } |
| 398 | |
| 399 | ps.mu.Lock() |
| 400 | defer ps.mu.Unlock() |
| 401 | |
| 402 | if ps.profile.TopCommands == nil { |
| 403 | ps.profile.TopCommands = make(map[string]int) |
| 404 | } |
| 405 | ps.profile.TopCommands[cmd]++ |
| 406 | ps.persist() |
| 407 | } |
| 408 | |
| 409 | // FormatForPrompt returns a concise summary for system prompt injection, |
| 410 | // with every scoped directive visible (labeled). Prefer FormatForPromptScoped |