Chronos is a Go-based agentic framework for building durable, scalable AI agents. Module: github.com/spawn08/chronos.
ChronosOS (os/) — Control plane: auth, tracing, approval, dashboard HTTP API
Engine (engine/) — Runtime: StateGraph execution, model providers, tool registry, streaming
SDK (sdk/) — User-facing: agent builder, skills, memory, knowledge, teams
Storage (storage/) — Persistence: pluggable adapters for SQL, NoSQL, and vector stores
| Package | Path | Purpose |
|---|---|---|
| Agent builder | sdk/agent/ |
Fluent agent.New().WithModel().WithStorage().Build() API |
| Skills | sdk/skill/ |
Skill metadata, versioning, registry |
| Memory | sdk/memory/ |
Short/long-term memory + LLM-powered Manager |
| Knowledge | sdk/knowledge/ |
RAG: Knowledge interface, VectorKnowledge impl |
| Teams | sdk/team/ |
Multi-agent orchestration (sequential, parallel, router, coordinator) |
| StateGraph | engine/graph/ |
Durable graph runtime: nodes, edges, checkpoints, resume |
| Models | engine/model/ |
Provider interface, EmbeddingsProvider, caching |
| Tools | engine/tool/ |
Tool Registry with permissions and approval hooks |
| Hooks | engine/hooks/ |
Before/After middleware Hook interface, Chain |
| Guardrails | engine/guardrails/ |
Input/output validation Guardrail interface |
| Streaming | engine/stream/ |
SSE event Broker |
| ChronosOS | os/ |
HTTP control plane server |
| Auth | os/auth/ |
RBAC stubs |
| Tracing | os/trace/ |
Span collector + audit logging |
| Approval | os/approval/ |
Human-in-the-loop approval service |
| Storage | storage/ |
Storage and VectorStore interfaces |
| SQLite | storage/adapters/sqlite/ |
Full Storage impl (dev/test) |
| PostgreSQL | storage/adapters/postgres/ |
Full Storage impl (production) |
| Qdrant | storage/adapters/qdrant/ |
VectorStore impl via REST |
| CLI | cli/ |
Interactive REPL + headless commands |
| Sandbox | sandbox/ |
Process-level isolation for untrusted code |
When implementing new adapters, providers, or extensions, implement these interfaces:
storage.Storage(storage/storage.go) — 18 methods for sessions, memory, audit logs, traces, events, checkpointsstorage.VectorStore(storage/vector.go) — Upsert, Search, Delete, CreateCollection, Closemodel.Provider(engine/model/provider.go) — Chat, StreamChatmodel.EmbeddingsProvider(engine/model/embeddings.go) — Embedknowledge.Knowledge(sdk/knowledge/knowledge.go) — Load, Search, Closeguardrails.Guardrail(engine/guardrails/guardrails.go) — Check(ctx, content) Resulthooks.Hook(engine/hooks/hooks.go) — Before(ctx, event), After(ctx, event)sandbox.Sandbox(sandbox/sandbox.go) — Execute, Close
- Builder pattern —
sdk/agent/agent.go:agent.New(id, name).WithModel(...).AddTool(...).Build() - Adapter pattern — All storage backends implement
storage.Storage; swap via config - Chain/middleware —
hooks.Chaincomposes multipleHookimplementations - Registry pattern —
tool.Registryandskill.Registryfor dynamic registration - Interface segregation —
Storage(relational) is separate fromVectorStore(embeddings)
- Package comments on every package (first line of first file)
- Errors: return
fmt.Errorf("context: %w", err)— always wrap with context - Constructors:
New(...)returns(*T, error)or*Tif infallible - No init() functions; explicit initialization via constructors
- JSON tags on all exported struct fields
- Use
context.Contextas first parameter on all I/O methods
- Interfaces: verb or noun (e.g.,
Storage,Provider,Guardrail) — noIprefix - Implementations: descriptive noun (e.g.,
Store,Anthropic,VectorKnowledge) - Files: lowercase, match the primary type (e.g.,
runner.goforRunner)
- Each adapter lives in
storage/adapters/<name>/ - Must implement all methods of
storage.Storageorstorage.VectorStore - SQL adapters: use
database/sqlwith?(SQLite) or$N(Postgres) placeholders - JSON columns: marshal with
encoding/json, scan into[]byteorstring - Always provide a
Migrate(ctx)method for schema creation
- Test files:
*_test.goin the same package - Use table-driven tests
- For storage adapters: test against
:memory:(SQLite) or testcontainers
# Build everything
go build ./...
# Run quickstart example
go run ./examples/quickstart/main.go
# Run CLI
go run ./cli/main.go help
go run ./cli/main.go repl
go run ./cli/main.go serve :8420
# Tidy modules
go mod tidy
# Pre-push CI validation (run BEFORE pushing to avoid CI failures)
./scripts/pre-push-check.sh # full: format + vet + lint + build + test
./scripts/pre-push-check.sh --quick # fast: format + vet + build only
# Install as git hook (runs automatically on git push)
ln -sf ../../scripts/pre-push-check.sh .git/hooks/pre-push- Create
storage/adapters/<name>/<name>.go - Implement
storage.Storage(orstorage.VectorStore) - Include
Migrate()andClose()methods - Use
/new-adapterslash command for scaffolding
- Create
engine/model/<name>.go - Implement
model.Provider(Chat + StreamChat) - Constructor:
New<Name>(apiKey string) *<Name>
- Define a
tool.Definitionwith Name, Description, Parameters (JSON Schema), Permission, Handler - Register via
registry.Register(def)oragent.New().AddTool(def)
- Write a
graph.NodeFunc:func(ctx context.Context, state graph.State) (graph.State, error) - Register:
graph.New("id").AddNode("name", fn)or.AddInterruptNode("name", fn)for human-in-the-loop
- Working: Agent builder, Chat, Execute, Run, Resume; StateGraph with checkpoints; team orchestration (sequential, parallel, router, coordinator) with lightweight model-only agents; protocol bus with back-pressure, object pooling, direct channels; memory Store + Manager; VectorKnowledge; model providers (OpenAI, Anthropic, Gemini, Mistral, Ollama, Azure, Compatible); SQLite + Postgres Storage; Qdrant VectorStore; tool registry + approval; guardrails + hooks; stream Broker; ProcessSandbox; ChronosOS server + approval API.
- Not wired in agent: OutputSchema, NumHistoryRuns are stored on the agent but not fully used in Run. Fix in Tier 1 (see DEVELOPMENT.md).
- Stubs or missing: Storage adapters (dynamo, mongo, redis, redisvector, pinecone, weaviate, milvus); concrete EmbeddingsProvider (none yet); CLI
runand most subcommands (sessions, skills, kb, memory, mcp, config, db, monitor); ChronosOS sessions/traces APIs (return empty); auth (always allows); Runner→Broker publishing; trace collector during execution; container sandbox; Helm secrets/Ingress/HPA; migration framework; MCP client; evals; built-in skill tool implementations; tests.
Re-run a full gap report with the gap-analysis slash command (see below).
- Full Roadmap: See ROADMAP.md for 101 prioritized items (P0–P3) with checkboxes. When completing an item, change
[ ]to[x]and append<!-- done: YYYY-MM-DD -->in that file. Also add an entry to the Completion Log table at the bottom.
- Roadmap: See DEVELOPMENT.md for the seven-tier implementation plan, acceptance criteria, and dependency order (Tier 1 → 4 → 2 → 5 → 3 → 6 → 7).
- Slash commands (in
.claude/commands/): Use implement-tier with a tier number (1–7) to implement that tier. Use gap-analysis to regenerate the gap report. Use add-tests with a package path to add table-driven tests. Use add-embedding-provider or add-cli-command with a name/spec to scaffold. Use scale-sandbox for container-based sandbox work. - Cursor rules (in
.cursor/rules/): Apply when editing matching paths —chronos-go.mdc(always),storage-adapters.mdcforstorage/adapters/**/*.go,cli-commands.mdcforcli/**/*.go,model-providers.mdcforengine/model/**/*.go.
- Add
init()functions - Use global state or package-level variables (except constants)
- Import
osin library packages (only incli/andexamples/) - Skip error wrapping — always
fmt.Errorf("what: %w", err) - Use panic for recoverable errors
- Add dependencies without checking if stdlib suffices first