lessons

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package lessons stores what agents learn as plain markdown files under .dibs/lessons/ — committed, diffed, and reviewed like any other file in the repository. Memory that travels with the repo: your team and your CI agents get it through `git pull`, not through a database.

Search is classic BM25 over title, tags, and body. For the few hundred lessons a real repository accumulates, a lexical index built on demand is instant, deterministic, and needs no embedding model, no vector store, and no background process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(dir string, l Lesson) (string, error)

Add writes a lesson to dir and returns its slug.

func Slugify

func Slugify(title string) string

Slugify turns a title into a filesystem- and URL-safe slug.

Types

type Hit

type Hit struct {
	Lesson  Lesson  `json:"lesson"`
	Score   float64 `json:"score"`
	Snippet string  `json:"snippet,omitempty"`
}

Hit is a search result.

func Search(dir, query string, k int) ([]Hit, error)

Search ranks lessons against query with BM25 and returns the top k hits.

type Lesson

type Lesson struct {
	Slug      string    `yaml:"-" json:"slug"`
	Title     string    `yaml:"title" json:"title"`
	Tags      []string  `yaml:"tags,omitempty" json:"tags,omitempty"`
	Agent     string    `yaml:"agent,omitempty" json:"agent,omitempty"`
	CreatedAt time.Time `yaml:"created" json:"created_at"`
	Body      string    `yaml:"-" json:"body"`
}

Lesson is one piece of durable knowledge.

func Get

func Get(dir, slug string) (Lesson, error)

Get returns one lesson by slug.

func List

func List(dir string) ([]Lesson, error)

List reads every lesson in dir, newest first.

Jump to

Keyboard shortcuts

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