notes

package
v1.0.0-alpha.44 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderInContextBlock

func RenderInContextBlock(pinned []Note) string

RenderInContextBlock renders the pinned-notes section that flows into the system prompt on every step. Distinct from RenderPromptSection (the table of all notes by preview) in that each pinned note appears as a full-content `## <key>` markdown section — the model gets the whole body, not just a one-line preview, because pinned notes are facts it's expected to lean on without re-fetching.

Empty input → empty string so the caller can skip the separator.

func RenderPromptSection

func RenderPromptSection(notes []Note) string

RenderPromptSection turns a list of notes into the `## Notes` block injected into the agent's system prompt by the PrepareStep callback. Empty input returns the empty string so the caller can skip the separator entirely.

Output shape (markdown):

## Notes

| Key | Updated | Preview |
|-----|---------|---------|
| `k8s-cluster`   | 5m ago | homelab cluster, 3 nodes |
| `kubeconfig-path` | 2d ago | /kubeconfig.yaml         |

Notes persist across sessions. Use `note_show <key>` for full content;
`note_save` / `note_delete` to mutate.

Cells are sanitised: pipes in the preview are escaped to keep the table well-formed (rare, but cheap).

Types

type Note

type Note struct {
	Key       string
	Content   string
	Preview   string
	InContext bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

Note mirrors one row from the daemon's agent_notes table. Content is only populated by GetNote / SaveNote responses; ListNotes returns rows with empty Content to keep payloads small. Preview is denormalised server-side (first non-empty line, capped at 80 runes).

The runtime no longer owns the storage layer — pkg/notesclient is the wire client and pkg/notes only carries the in-memory shape + the markdown renderers used by the PrepareStep callback and the note_* tool descriptions.

Jump to

Keyboard shortcuts

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