Skip to content

feat: learnings system — git-backed markdown storage with agent tools, CLI, and HTTP serving#106

Merged
priyanshujain merged 27 commits intomasterfrom
learning-extraction-and-org
Mar 19, 2026
Merged

feat: learnings system — git-backed markdown storage with agent tools, CLI, and HTTP serving#106
priyanshujain merged 27 commits intomasterfrom
learning-extraction-and-org

Conversation

@priyanshujain
Copy link
Copy Markdown
Collaborator

Summary

Implements a learnings system that lets users save, read, search, and extract learnings as human-friendly markdown files backed by git.

Closes #105

  • Core storage (service/learnings/): git-backed markdown store with Save, Read, List, Search, and Slug operations. Each save auto-commits to a local git repo at ~/.obk/learnings/.
  • Agent tools (agent/tools/learnings.go): 4 tools — learnings_save, learnings_read, learnings_search, learnings_extract. Extract runs in a background goroutine with its own agent to parse source material.
  • HTTP serving (GET /learnings/{topic}): serves markdown files via the existing server, no auth (behind ngrok).
  • CLI (obk learnings open|list|search): browse and search learnings from the terminal.
  • Wiring: registered in Telegram session (with push notifications + extract), CLI chat (save/read/search only), and system prompt.

New files (8)

File Purpose
service/learnings/store.go Git-backed markdown storage
service/learnings/store_test.go 10 store unit tests
agent/tools/learnings.go 4 tools + deps + notifier interface
agent/tools/learnings_test.go 14 tool unit tests
internal/server/handler_learnings.go HTTP handler
internal/cli/learnings/learnings.go CLI root + open + list
internal/cli/learnings/search.go CLI search subcommand
spectest/learnings_test.go 3 spec tests (real LLM)

Modified files (6)

File Change
config/paths.go LearningsDir()
agent/tools/prompt.go Learnings section gated on reg.Has("learnings_save")
internal/server/routes.go GET /learnings/{topic}
internal/cli/root.go Register learnings CLI command
channel/telegram/session.go registerLearningsTools() with Telegram push notifications
internal/cli/chat.go registerLearningsTools() (no notifier)

Test plan

  • Unit tests: go test ./service/learnings/ ./agent/tools/ — 24 tests pass
  • Spec tests: OBK_TEST_PROVIDER=gemini go test ./spectest/ -run TestSpec_Learning -v — 3 tests pass (SaveAndRead, SaveAndSearch, ListTopics)
  • Full build: go build ./... — clean
  • CLI smoke test: obk learnings list, save something via chat, obk learnings list again
  • HTTP test: start server, curl http://localhost:8443/learnings/<topic>
  • Telegram integration: say "save a learning about X", verify file + git commit + notification with link

Avoids creating a new Store (and mutex) on every HTTP request.
Prevents leaked goroutines if the LLM call hangs indefinitely.
…rd, git user config, and human-readable list
@priyanshujain priyanshujain merged commit edbd032 into master Mar 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix for learning atrophy

1 participant