saige
AGENTS.md4 starsChanged 5 months agoApache-2.0View on GitHub
A Go SDK for building AI agents, giving them context and memory (RAG, with knowledge graphs as one backend), and evaluating them. Provider auto-detection: ANTHROPIC_API_KEY → `OPENAI_
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- llms.txtllms.txt
- agentSkill
- knowledge-graphSkill
- ragSkill
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 97
No abbreviations except established ones (KG, RAG, BM25, RRF, MMR)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
saige
A Go SDK for building AI agents, giving them context and memory (RAG, with knowledge graphs as one backend), and evaluating them.
Architecture
| Package | Role |
cmd/saige/ | CLI: chat (interactive TUI), ask (single-shot), rag/kg (standalone ops) |
cmd/saige-mcp/ | MCP server binary: exposes tool packs (research, kg) over stdio JSON-RPC |
agent/ | Streaming agent loop, tool dispatch, sub-agents, handoffs, durable runs, provider adapters |
agent/types/ | Sealed types: Message, Delta, Content, Tool/RichTool, Provider, Cache, StepRunner, FeedbackContent, HandoffContent |
agent/tree/ | Conversation tree with branching, compaction, WAL, feedback leaf nodes |
agent/provider/ | Ollama, OpenAI, Anthropic, Google adapters |
agent/provider/cache/ | Response-cache decorator: memoizes ChatStream by deterministic request hash |
agent/cache/memcache/ | In-memory LRU types.Cache[V] with TTL |
agent/durable/dbos/ | DBOS Transact-backed durable StepRunner + workflow engine (resumable runs) |
agent/tui/ | Bubbletea interactive + verbose streaming TUI |
agent/agenttest/ | ScriptedProvider, MockTool for testing |
rag/knowledge/ | Knowledge graph public API (NewGraph, query helpers) |
rag/knowledge/types/ | Core knowledge types: Entity, Relation, Fact, Episode, Graph/Store interfaces |
rag/knowledge/pgstore/ | PostgreSQL + pgvector Store implementation (HNSW, tsvector, pg_trgm) |
rag/knowledge/tool/ | Agent tool bindings for KG operations (kg_search, kg_ingest) |
rag/knowledge/graph/ | Graph formatting utilities (DOT, text) for visualization |
rag/knowledge/internal/ | Engine orchestration, extraction pipeline, fuzzy matching |
postgres/ | Shared PostgreSQL connection pool and schema migrations |
rag/ | RAG pipeline configuration and constructor |
rag/types/ | Core RAG types: Document, Section, Variant, Pipeline/Store interfaces |
rag/pgstore/ | PostgreSQL + pgvector RAG Store implementation (HNSW vector search) |
rag/memstore/ | In-memory RAG Store (for testing, no external deps) |
rag/chunker/ | Recursive and semantic text chunking |
rag/bm25retriever/ | In-memory BM25 lexical search |
rag/vectorretriever/ | Vector similarity search |
rag/graphretriever/ | Knowledge graph-based retrieval |
rag/parentretriever/ | Parent context expansion retriever |
rag/reranker/ | MMR diversity + cross-encoder reranking |
rag/hyde/ | HyDE (Hypothetical Document Embeddings) query expansion |
rag/contextassembler/ | Citation assembly + LLM-based context compression |
rag/eval/ | Evaluation metrics (precision, recall, NDCG, MRR, HitRate, faithfulness, relevancy, correctness, LLM-as-judge) |
rag/tool/ | Agent tool bindings for RAG pipeline operations |
rag/embedderregistry/ | Dispatch embedding by content type |
rag/embeddingcache/ | Caching layer for embeddings |
rag/extractor/ | Content extraction from raw documents |
rag/source/ | Source URI resolution |
rag/source/searxng/ | SearXNG metasearch HTTP client |
rag/tokenizer/ | Token counting utilities |
tools/research/ | Research tools: web search, file search/read, knowledge graph CRUD |
CLI
saige chat # interactive multi-turn TUI
saige chat --provider anthropic # use Anthropic (needs ANTHROPIC_API_KEY)
saige chat --verbose # plain-text mode
saige ask "question" # single-shot query
echo "question" | saige ask --raw # pipe-friendly raw output
saige rag search --db DSN --query Q # standalone RAG search
saige kg search --db DSN --query Q # standalone KG search
# MCP server (separate binary)
saige-mcp --tools research --searxng-url URL # research tools over MCP/stdio
saige-mcp --tools kg --db DSN # KG tools over MCP/stdio
saige-mcp --tools all --db DSN --searxng-url URLProvider auto-detection: ANTHROPIC_API_KEY → OPENAI_API_KEY → GOOGLE_API_KEY → Ollama.
Commands
go test ./... # run all tests
go vet ./... # static analysis
go build ./... # compile all packages
gofmt -w . # formatCommit Convention
Angular conventional commits enforced by gitit:
feat:new featurefix:bug fixdocs:documentationrefactor:code restructuringtest:test changeschore:maintenanceci:CI/CD changesperf:performance
Code Style
- Functional options pattern for configuration
- Interface-first design with pluggable implementations
- Sealed interfaces via unexported marker methods
- Table-driven tests with comprehensive mocks
slog.Loggerfor structured logging- No abbreviations except established ones (KG, RAG, BM25, RRF, MMR)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

