Skip to content
Request Early Access

Build enterprise agents that ship to production.

Kortex is a composable runtime for AI agents. Memory, tools, guardrails, multi-agent coordination — all in one loop.

0+ tools · 0 tests · 0 modules

One loop. Everything is a tool.

Each iteration drains events, compacts context, calls the LLM, checks guardrails, executes tools, and loops back. Three exit paths.

runner.ts
 
1 / 9 iteration 1

13 modules. Zero coupling.

Swap providers, add tools, or replace memory without touching the core.

Context
3-layer compaction. Budget tracking. Provenance visualization.
Memory
3-layer persistence. Cross-session pattern learning.
Skills
L0/L1/L2 evolution. Declarative trigger routing.
Agent Def
Portable agent.yaml. Extends inheritance. Permissions.
Multi-Agent
JSONL message bus. Idle-poll-claim. Worktrees.
Guardrails
Ternary permissions. 9 rules + YAML policy engine.
Evaluator
Post-run scoring. Adaptive effort. Evolution loops.
MCP
External tool/prompt integration. Trust labels.
Worktree
Git worktree isolation. Parallel execution lanes.
Session
Transcript persistence. Compaction summaries.

Remember everything. Forget nothing useful.

3-layer memory persistence meets 3-layer context compaction. The agent learns across sessions.

Memory Hierarchy

Project Memory
Cross-session. Persists in project.md. Updated by agent via update_memory.
Session Memory
Per-session summaries. Auto-written at session end. JSON snapshots.
Working Memory
In-context only. Injected into system prompt. Volatile scratchpad.
Cross-session learning: Success patterns extracted from history, injected as heuristic hints in future runs.

Context Compaction

MICRO After each tool
Replace old tool results with [Previous: name -> preview]. Preserve recent N. Selective read_file retention.
AUTO Token > 70% budget
LLM summarizes into structured sections. 24 msgs -> 8. Replaces old messages.
MANUAL Agent calls compact
Same as auto-compact. Agent-initiated when context feels bloated.
Identity re-injection: After compaction, agent identity (SOUL, rules) is re-injected when messages drop below threshold.

Context Ledger

Every artifact loaded into a run is tracked: skills, MCP prompts, bootstrap files, memory. Records source, type, byte size, timestamp.

context_provenance chart
---
SOUL.md       2.1k  |####    |
RULES.md      0.8k  |##      |
skill:review  1.4k  |###     |
memory        0.6k  |#       |

Agent as Code.

Portable agent.yaml defines identity, permissions, knowledge, and evolution strategy. Versioned in Git. Reviewed in PRs.

.kortex/ kortex init
├─ agent.yaml manifest + config
├─ SOUL.md identity
├─ RULES.md constraints
├─ INSTRUCTIONS.md directives
├─ knowledge/ reference docs
├─ memory/ working memory
└─ MEMORY.md
├─ examples/ few-shot pairs
├─ skills/ agent-scoped skills
├─ evaluators/ post-run scoring
└─ policies/ guardrail rules
agent.yaml
name: code-reviewer
extends: base-agent
model: claude-sonnet-4-6

permissions:
  tools:
    allow: [read_file, grep_search, glob_search]
    deny:  [write_file, exec]
  exec: read-only
  network: deny

knowledge_config:
  always: [RULES.md]
  on_demand: [review/SKILL.md]
  deny: [deploy/SKILL.md]
extends Inheritance

Agents inherit from base definitions. Deep merge for config, tools, permissions. Override what you need.

AgentRegistry Discovery

Multi-source resolution: project ./agents/ > user ~/.kortex/agents/ > builtin. First match wins.

--agent CLI Flag

Run any agent: kortex --agent code-reviewer "review this". Permissions enforced as guardrail rules.

Every run makes the next one better.

Trajectory recording, post-run evaluation, adaptive effort tuning, and cross-session pattern learning. Fully automatic.

Run
Execute agent task
Record
Trajectory JSONL
Evaluate
4 built-in scorers
Adapt
Tune parameters
Learn
Extract patterns

Built-in Evaluators

TOKEN Token efficiency score. Penalizes bloated context usage.
ITER Iteration efficiency. Fewer iterations for same result = better.
COMPLETE Task completion signal. Did the agent finish its goal?
DIVERSITY Tool diversity. Rewards varied tool usage over repetition.
adaptive-effort
Recent 10 evaluations:
  avg score:    0.62
  iter pass:    0.45
  trend:        -0.03/run

Adjustments:
  maxIterations: 16 -> 24  (low pass rate)
  temperature:   0  -> 0.1 (negative trend)

Injecting 3 learned patterns...

Evolution CLI

Inspect scores, replay trajectories, diff runs, rollback bad patterns. Full observability.

$ kortex evolution status
$ kortex evolution history
$ kortex evolution rollback pat_03
$ kortex --replay traj_xxx.json

Agents that work as a team.

JSONL message bus, idle-poll-claim autonomy, git worktree isolation. Each agent runs in its own lane.

Message Bus

Append-only JSONL inbox per agent. Drained before each LLM call.

Idle-Poll-Claim

Idle agents scan unclaimed tasks and auto-claim work. Autonomous loop.

Worktree Isolation

Each teammate gets its own git worktree. Parallel, conflict-free execution.

Request-Response

Correlated request_id FSM with TTL expiry. Structured cross-agent calls.

team coordination
spawn_teammate role=reviewer task="Review auth module"
  -> worktree created: .worktrees/reviewer-a1b2
  -> agent loop started (background)

spawn_teammate role=worker task="Fix login validation"
  -> worktree created: .worktrees/worker-c3d4
  -> agent loop started (background)

read_inbox
  [reviewer] 2 issues found in auth/login.ts
  [worker]   Fix applied. Tests passing.

list_team
  reviewer  completed  2 iterations
  worker    completed  4 iterations

The agent's only interface.

Schema + validation + workspace guard.

File Ops (6)
read_file
write_file
edit_file
list_dir
glob_search
grep_search
Execution (3)
exec
background_run
background_check
Search (2)
web_search
web_fetch
Planning (5)
task_create
task_update
task_list
task_get
plan_create
Context (4)
update_memory
compact
context_budget
context_provenance
Skills (1)
load_skill
Multi-Agent (5)
spawn_subagent
spawn_teammate
send_message
read_inbox
list_team
Worktree (4)
worktree_create
worktree_list
worktree_run
worktree_remove
MCP (3)
mcp_load_prompt
mcp_read_resource
mcp_refresh_registry

Teach, don't hardcode.

Skills evolve from simple instructions to validated workflows.

L0

Instructions

A SKILL.md with rules and guidance.

# Code Review
- Check for bugs
- Verify tests
L1

+ Examples

Few-shot input/output pairs.

### Input
Review login.ts
### Output
2 issues found
L2

+ Validator

Executable quality checks.

validate: check.sh
# exit 0 = pass

Declarative Routing

Skills declare triggers. The router auto-suggests based on the user's prompt.

triggers: review, check, audit
exclusions: implement, build
priority: 10

Ternary permissions.

Every tool call passes through a guardrail engine with 9 rules.

Allow

Read-only. git status, file reads.

Ask

Writes, execution, network access.

Block

sudo, rm -rf, force push.

R01 sudo commands block
R02 Destructive commands (rm -rf /, mkfs) block
R03 git force push, reset --hard block
R04 --no-verify, --no-gpg-sign block
R05 Network commands when disallowed block
R06 Writes outside workspace block
R07 Secret file access (.env, .pem) warn
R08 Configurable tool approval prompt
R09 Safe read-only commands allow

Three commands.

From zero to running agent in under a minute.

1

Install

$ npm install -g @kortex-ai/runtime
2

Configure

$ kortex onboard
# sets up provider, model, API key
3

Run

$ kortex -- "Fix the login bug"
✓ Done in 3 iterations (4.2s, $0.02)

Start building.

One command to install. No vendor lock-in.

Get notified about releases