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 Started
import "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)
}
75%Test Coverage
A+Go Report
MITLicense
1.24.5+Go Version
v0.0.6Latest Release

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.

FeatureDescriptionLink
Decision PrimitivesDecide (binary), Categorize (classify), Prioritize (rank), Assess (sentiment) — structured reasoning outputs with confidence scores.Concepts
Data ExtractionAnalyze extracts structured data into typed results. Type-safe generics ensure compile-time checking of reasoning outputs.Quickstart
Semantic RoutingSift gates execution based on LLM judgment. Discern routes to different processors based on meaning, not data structure.Architecture
Synthesis PatternsAmplify for iterative refinement, Converge for parallel execution with semantic synthesis across reasoning paths.Architecture
Thought CloningClone thoughts for independent parallel reasoning paths while maintaining connection to original context.Concepts
Provider HierarchyStep-level, context-level, or global provider configuration. Switch LLM providers per primitive without rewiring.API

Articles

Browse the full cogito documentation.

OverviewIntroduction to cogito - LLM-powered reasoning chains for Go

Learn

QuickstartGet started with cogito in 5 minutes
Core ConceptsUnderstanding Thought and Note in cogito
ArchitectureSystem design and architecture of cogito

Reference

API ReferenceComplete API reference for cogito