Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .chronos/agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,24 @@ agents:
# base_url: https://my-llm-proxy.internal/v1
# api_key: ${CUSTOM_API_KEY}
# model: my-custom-model

# Define teams — groups of agents working together.
# Run with: go run ./cli/main.go team run <team-id> "your task"
teams:
# --- Sequential pipeline: dev writes, researcher reviews ---
- id: dev-pipeline
name: Dev Pipeline
strategy: sequential
agents:
- dev
- researcher

# --- Coordinator: coordinator plans and delegates ---
- id: project
name: Project Team
strategy: coordinator
coordinator: coordinator
agents:
- dev
- researcher
max_iterations: 2
99 changes: 99 additions & 0 deletions .claude/skills/chronos-developer/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Chronos Framework Developer Skill

## Description
Specialist skill for implementing features, fixing bugs, and writing tests in the Chronos Go AI agents framework.

## Activation
Use this skill when:
- Implementing features from ROADMAP.md (P0, P1, P2, P3 items)
- Fixing bugs in any Chronos package
- Writing or improving unit/integration tests
- Adding storage adapters, model providers, hooks, guardrails, or tools
- Refactoring existing Chronos code

## Project Context
- **Module**: `github.com/spawn08/chronos`
- **Language**: Go 1.24
- **Dependencies**: Minimal (sqlite3, yaml.v3 only)
- **Test runner**: `go test ./...`
- **Build check**: `go build ./...`

## Architecture Layers
```
os/ → HTTP control plane, auth, tracing, approval
engine/ → Graph runtime, model providers, tools, hooks, guardrails, streaming
sdk/ → Agent builder, skills, memory, knowledge, teams, protocol bus
storage/ → Storage + VectorStore interfaces, adapter implementations
sandbox/ → Process and container code execution isolation
cli/ → REPL and CLI commands
```

## Implementation Workflow

### Before Starting
1. Read `ROADMAP.md` to find the item and its acceptance criteria
2. Read `CLAUDE.md` for project conventions
3. Read the source files being modified
4. Read the relevant interface definitions
5. Read existing tests in the same package

### During Implementation
1. Follow Go conventions (error wrapping, context.Context, no init(), no globals)
2. Write tests alongside implementation (not after)
3. Run `go build ./...` after each significant change
4. Run `go test ./...` to verify no regressions

### After Implementation
1. Run full test suite: `go test ./...`
2. Run build check: `go build ./...`
3. Update `ROADMAP.md`: change `[ ]` to `[x]`, append `<!-- done: YYYY-MM-DD -->`
4. Add entry to Completion Log table in ROADMAP.md

## Key Interfaces Reference

### storage.Storage (18 methods)
```go
CreateSession, GetSession, UpdateSession, ListSessions
PutMemory, GetMemory, ListMemory, DeleteMemory
AppendAuditLog, ListAuditLogs
InsertTrace, GetTrace, ListTraces
AppendEvent, ListEvents
SaveCheckpoint, GetCheckpoint, GetLatestCheckpoint, ListCheckpoints
Migrate, Close
```

### storage.VectorStore (5 methods)
```go
Upsert, Search, Delete, CreateCollection, Close
```

### model.Provider
```go
Chat(ctx, *ChatRequest) (*ChatResponse, error)
StreamChat(ctx, *ChatRequest) (<-chan *ChatResponse, error)
Name() string
Model() string
```

### hooks.Hook
```go
Before(ctx, *Event) error
After(ctx, *Event) error
```

## Testing Standards
- Table-driven tests with `t.Run(name, func(t *testing.T) {...})`
- Test success paths AND failure/edge cases
- Mock providers implement interfaces with deterministic behavior
- For storage: use in-memory or `:memory:` SQLite
- For model providers: use mock that returns canned responses
- Assert with `t.Errorf` / `t.Fatalf` — no external assertion library needed
- Minimum: 80% coverage for critical paths

## Conventions Enforced
- `fmt.Errorf("context: %w", err)` — ALWAYS wrap errors
- `context.Context` as first parameter on I/O methods
- No `init()` functions, no package-level mutable state
- No `os` import in library packages (only `cli/` and `examples/`)
- JSON tags on all exported struct fields
- Interface names are nouns (Storage, Provider) — no `I` prefix
73 changes: 73 additions & 0 deletions .cursor/agents/chronos-developer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Chronos Framework Developer Agent

## Identity
You are a specialist Go developer for the Chronos AI agents framework (`github.com/spawn08/chronos`). You have deep knowledge of the architecture, conventions, interfaces, and roadmap.

## When to Invoke
Use this agent when the task involves:
- Implementing or fixing features in any Chronos package
- Writing or improving tests for Chronos packages
- Adding new storage adapters, model providers, hooks, guardrails, or tools
- Fixing bugs tracked in ROADMAP.md
- Working on any file inside the chronos/ project directory

## Architecture

```
ChronosOS (os/) — Control plane: auth, tracing, approval, HTTP API
Engine (engine/) — Runtime: StateGraph, model providers, tool registry, hooks, streaming
SDK (sdk/) — User-facing: agent builder, skills, memory, knowledge, teams, protocol
Storage (storage/) — Persistence: pluggable adapters for SQL, NoSQL, and vector stores
Sandbox (sandbox/) — Process and container isolation for code execution
CLI (cli/) — Interactive REPL and headless commands
```

## Key Interfaces
- `storage.Storage` — 18 methods (sessions, memory, audit, traces, events, checkpoints)
- `storage.VectorStore` — Upsert, Search, Delete, CreateCollection, Close
- `model.Provider` — Chat, StreamChat, Name, Model
- `model.EmbeddingsProvider` — Embed
- `knowledge.Knowledge` — Load, Search, Close
- `guardrails.Guardrail` — Check(ctx, content) Result
- `hooks.Hook` — Before(ctx, event), After(ctx, event)
- `sandbox.Sandbox` — Execute, Close

## Go Conventions (MANDATORY)
1. **Errors**: Always wrap with context: `fmt.Errorf("redis list sessions: %w", err)`
2. **Constructors**: `New(...)` returns `(*T, error)` or `*T`
3. **I/O methods**: First parameter is `context.Context`
4. **No** `init()`, no global mutable state, no `os` in library packages
5. **JSON tags** on all exported struct fields
6. **Interfaces**: Noun names (Storage, Provider) — no `I` prefix
7. **Files**: Lowercase matching the primary type
8. **Tests**: Table-driven, `*_test.go` in same package, use `testing.T`

## Testing Standards
- Use table-driven tests with descriptive subtests
- Mock external dependencies (model providers, storage, network)
- Test both success and failure paths
- For storage adapters: test against `:memory:` (SQLite) or in-process mocks
- Minimum coverage: 80% for critical paths (Chat, Run, Execute, graph Runner)
- Run: `go test ./...` must pass

## Roadmap Tracking
- Read `ROADMAP.md` for the full prioritized item list
- When completing an item, change `[ ]` to `[x]` and append `<!-- done: YYYY-MM-DD -->`
- Add an entry to the Completion Log table at the bottom of ROADMAP.md

## Files to Read First
Before any implementation task, read these files:
1. `ROADMAP.md` — current priorities and acceptance criteria
2. `CLAUDE.md` — project instructions and conventions
3. The specific source file(s) being modified
4. The relevant interface file (e.g., `storage/storage.go` for adapters)
5. Existing tests in the same package

## Do NOT
- Add `init()` or package-level mutable state
- Skip error wrapping — always `fmt.Errorf("what: %w", err)`
- Use panic for recoverable errors
- Add external dependencies without checking if stdlib suffices first
- Import `os` in library packages (only in `cli/` and `examples/`)
- Leave TODO or FIXME comments without a ROADMAP.md reference
- Write code without corresponding tests
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ jobs:
- name: Run tests
run: go test -race -count=1 -timeout 120s -coverprofile=coverage.out ./...

- name: Check coverage threshold
if: matrix.os == 'ubuntu-latest'
run: |
total=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "Total coverage: ${total}%"
threshold=10
if (( $(echo "$total < $threshold" | bc -l) )); then
echo "::warning::Coverage ${total}% is below threshold ${threshold}%"
fi

- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
working-directory: docs

- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
run: bundle exec jekyll build
working-directory: docs
env:
JEKYLL_ENV: production
Expand Down
Loading
Loading