LLM Reasoning Chains for Go. Think. Accumulate. Decide.
Build autonomous reasoning systems with composable primitives that accumulate context through multi-step pipelines. Thoughts carry Notes across steps — each primitive builds on previous reasoning without redundancy.
Get Startedimport "github.com/zoobz-io/cogito"
// Create a reasoning thought
thought := cogito.NewThought(ctx, provider, "Analyze support ticket")
// Composable primitives — each builds on accumulated context
pipeline := pipz.NewSequence(pipelineID,
cogito.Analyze[TicketAnalysis]("Extract ticket details"),
cogito.Categorize("Classify priority",
"critical", "high", "medium", "low",
),
cogito.Decide("Requires escalation?"),
cogito.Sift("Route only critical issues",
cogito.Seek("Find similar resolved tickets", vectorStore),
),
cogito.Reflect("Summarize findings"),
)
// Each step reads previous Notes, adds new ones
result, _ := pipeline.Process(ctx, thought)
// Full audit trail — every reasoning step is a Note
for _, note := range result.Notes() {
fmt.Printf("[%s] %s: %s\n", note.Source, note.Key, note.Value)
}Why Cogito?
Composable reasoning primitives with accumulated context and full audit trails.
Thought-Note Architecture
Thoughts accumulate Notes across pipeline steps. Each primitive reads unpublished notes, processes, and marks them published — zero redundant LLM calls.
Semantic Control Flow
Sift (LLM gate) and Discern (LLM router) adapt to domain changes without code changes. The model interprets intent, not data structure.
Two-Phase Reasoning
Deterministic phase (temp=0) for consistent decisions, optional creative introspection (temp=0.7) for semantic summaries explaining why.
Vector-Backed Memory
Seek and Survey primitives search semantic memory. Notes persist with embeddings for retrieval across reasoning sessions.
10 Reasoning Primitives
Decide, Analyze, Categorize, Assess, Prioritize, Reflect, Seek, Survey, Sift, Discern — composable via pipz.Chainable[*Thought].
Token-Aware Management
Compress (LLM summarization) and Truncate (sliding window) manage token budgets without losing reasoning context.
Capabilities
Reasoning primitives, semantic control flow, and context accumulation for autonomous AI systems.
| Feature | Description | Link |
|---|---|---|
| Decision Primitives | Decide (binary), Categorize (classify), Prioritize (rank), Assess (sentiment) — structured reasoning outputs with confidence scores. | Concepts |
| Data Extraction | Analyze extracts structured data into typed results. Type-safe generics ensure compile-time checking of reasoning outputs. | Quickstart |
| Semantic Routing | Sift gates execution based on LLM judgment. Discern routes to different processors based on meaning, not data structure. | Architecture |
| Synthesis Patterns | Amplify for iterative refinement, Converge for parallel execution with semantic synthesis across reasoning paths. | Architecture |
| Thought Cloning | Clone thoughts for independent parallel reasoning paths while maintaining connection to original context. | Concepts |
| Provider Hierarchy | Step-level, context-level, or global provider configuration. Switch LLM providers per primitive without rewiring. | API |
Articles
Browse the full cogito documentation.