One graph, worked by people and agents through the same doors.
yaks is a toolkit of TypeScript packages for storing, querying and
rendering records as entities, plus the packages that run agent
sessions, tools and tasks over them. yak is its command line,
and yaks.app hosts the apps built with it.
Each bundle is an entity patch, and every list is a query.
deno run -A jsr:@yaks/cli/install
This screen runs yak: @yaks/graph over @yaks/ram, with the task
vocabulary, every package fetched from JSR as the page loaded. Type
yak help below, or slide a disk into the drive.
Every example marked run runs yak in this page:
@yaks/graph over @yaks/ram with the task vocabulary, every package
fetched from JSR. They all write to one graph.
Name
yaks — the @yaks packages: one graph, and the packages that
store, query, draw and work it
An entity is a record identified by entity.eid, a
uuid. Its components are named objects, each describing one
aspect of it. There is no kind column: an entity is what its components
make it. A task is doc{title, body} plus
task{}; a comment is doc plus
comment{target}.
bundle
One entity's components as a JSON object:
{entity: {eid}, doc: {title}}.
batch
A list of bundles applied in one transaction. Each component in a
bundle is a patch: an omitted property is unchanged, null
clears it.
vocabulary
The schema a graph accepts: each package's
vocab.json, JSON Schema 2020-12 plus a few keywords of
its own.
query
One grammar for every list: .task.status=open .priority<=1.
A bare word is a text search over the properties marked
search: true.
Start here
A whole graph in memory, from the
packages
README. It runs here as written:
import { docDoc } from '@yaks/doc'
import { graph } from '@yaks/graph'
import { ram } from '@yaks/ram'
import { loadVocab } from '@yaks/vocab'
let vocab = loadVocab([docDoc])
let g = graph({ storage: ram(vocab), vocab })
await g.apply([{
entity: { eid: 'first-note' },
doc: { title: 'Getting started', body: 'A document stored as components.' },
}])
console.log(await g.read('.doc.title="Getting started"'))
Swap ram for
@yaks/sqlite to keep it on disk,
put @yaks/api in front for HTTP,
and use @yaks/client for a
browser graph that stays in sync.
Map
Every package in the workspace, and each import of one by another, read
from its own source (bin/package-map.ts). Point at a
package for what it imports and what imports it; open one for its
README.
The package map draws here once the page's
scripts run.
Packages
Grouped by what they are for, not by dependency. Nearly all are
published on JSR; import only the
ones you need.
yak turns each tool a graph declares into a subcommand, with
arguments and help from the tool's input schema, so a new tool needs no
new CLI release. It provides five commands itself: help,
init, login, logout and
apply. The rest come from a graph opened in this process,
or from an MCP server asked at run time. A tool with a noun and a verb
is written in either order: yak task list is
yak list task.
The terminal below is cli() from @yaks/cli, handed the
graph tier of @yaks/graph and the tools of @yaks/task over a graph in
memory: the same parser, help pages and exit codes.
The examples here run through cli() from @yaks/cli, handed
the graph tier of @yaks/graph and the tools of @yaks/task over a graph
in memory: the same parser, help pages and exit codes.
yak help
yak help task
yak list task
yak task list --json
Where a command runs
A command that names a config opens that graph in its own process, runs
the tool and exits. It does not need yak serve: SQLite
runs in WAL mode, so separate commands and a server share one file.
The target is chosen in this order:
Input
Target
--config path
the local graph that config describes
--host host
the remote MCP server at host/mcp
$YAKS_HOST
the remote MCP server it names
$YAK_CONFIG
the local graph it describes
~/.yak/yak.json
the local graph in that file, if it exists
none of these
https://yaks.app/mcp
Local and remote calls both become a call entity run
through @yaks/tools, so a person and an agent get the same validation,
rules, effects, attribution and stored record.
The config
yak init writes ~/.yak/yak.json
with the plugins a graph, its tasks, sessions, /mcp and
the web canvas need. A config is plain JSON, so a plugin is one more
line:
yak --config yak.json task new 'Buy the cake' --priority 1
yak --config yak.json serve # @yaks/api's serve tool: HTTP
yak app_list # a tool on yaks.app's MCP server
Roles
A plugin is a package, and each kind of thing it contributes is a
subpath export. A process serves roles and imports only the facets of
the roles it serves, so a command line never loads a web server it will
not start.
Role
Facets
What the process does
graph
./vocab./graph./tools
opens the file, admits writes, runs tool calls
web
./routes
answers HTTP with the routes @yaks/api hosts
effects
./effects
claims and runs what commits owe, in a pool
a plugin's name
its ./service
keeps that plugin's timer or poll running
./views is for drawing: the web UI and yak import
it to show an answer, so it must work in a browser and import no SQL
or storage driver. ./tui adds terminal views for
--tui.
Duties
Working the effect pool and each plugin's ./service are
duties. Any number of processes work the pool, each claiming a run
before it runs it; each service runs under a lease named for its
package, so one process at a time runs it. A yak command runs
its duties in a thread of its own, only where no live process is
serving them. --no-duties takes no lease and runs none.
A task is doc plus task. Its status (open,
done, cancelled) is computed from its completed and
cancelled marks, never stored, by one rule that SQL and the
in-memory evaluator both read. A board is a saved query, never a stored
list: a task is on a board because it matches.
yak task new 'Buy the cake' --priority 1
yak task list
yak task list '.filed.priority<=1'
Edges are entities too (@yaks/edge): edge{from, to} plus a
relation component. This page's graph opened with two tasks and the
edge between them:
yak graph show T-1
yak task update T-2 done
yak task list .task.status=done
Sessions
A session is an entity with a session component, and each
transcript entry is an entity beside it, entry{session, seq}.
The components beside entry say what it is:
Components
Meaning
content{body}
input from a person or system
ask{to, through}
a request to a model
content + output{source}
model or process output
call{to, id, args, source}
a tool call a model requested
result{call} + content
a tool result
stop
no further transcript work
settle() runs a transcript until it has nothing more to
do, under a lease named for it, so two processes never run one
transcript at once. The example from @yaks/session's README, with a
model that is a local function; it runs here as written, types
removed:
claim{session} is stored on the entity a session holds. A
batch that would replace another session's claim fails whole with
Bounced, and the collision is then written down as a
conflict{target, loser, holder, at}, in a transaction of
its own. Claims do not expire; deleting a session releases them.
@yaks/harness
runs sessions over any model the
@yaks/model
interface covers, and names no machine: it runs on a box or in a
Cloudflare Worker. @yaks/spawn
starts claude or codex as a detached process
and reads its JSON-lines output back as the session's entries, so a run
outlives the process that started it.
agents — MCP, harness hooks, and transcripts read in from
outside
MCP
@yaks/mcp serves a
graph as an MCP server: at /mcp when a config lists it, or
over stdio. Agents get four generic tools that take and return bundles,
plus every plugin's own tools; a fifth, search, comes with
a search callback.
Tool
Purpose
graph_apply
apply bundles, answer the applied bundles
graph_query
read the entities a query selects
graph_show
read named entities, each whole
graph_schema
describe components, properties and kinds
The same four are the yak graph commands, declared once in
@yaks/graph: an agent calling graph_query and a person
typing yak graph query run one implementation, and both
leave a call in the graph.
yak hooks install writes lifecycle hooks into a
Claude-compatible settings file (~/.claude/settings.json by
default), replacing an earlier install and leaving every other entry
alone. A harness runs each hook with the event as JSON on stdin.
Event
Command
Effect
SessionStart, SubagentStart
yak session context --hook -
creates the session under the harness's id; prints its claims
SessionEnd
yak session wrap --hook -
releases the session's claims
Transcripts from outside
A session a harness runs elsewhere is read into the graph from the
harness's own log, by one importer (@yaks/session/tail)
with a reader per format, claude and codex.
Every entry carries imported{source, line}, and entry ids
are derived from the session, the line and the place in it, so a line
read twice writes nothing new. The @yaks/session/service
duty follows Claude Code's transcript files under
~/.claude/projects.
@yaks/mcp-client
reaches a remote MCP server's tools and hands them to a native session
like its own. And yak itself is an MCP client:
yak app_list is a tool on yaks.app's server.
run — the same graph on a box, on Cloudflare, or in this
page
A box
deno run -A jsr:@yaks/cli/install
yak init
yak serve
yak serve answers HTTP, WebSocket subscriptions and, when
the config lists @yaks/mcp, MCP at /mcp, over one SQLite
file. @yaks/process
runs a program so it outlives the server that started it. Secrets live
in a vault of private files beside the database.
Cloudflare
@yaks/workerd
serves the same handler from a Worker.
@yaks/durable-object
makes one Durable Object one graph, in the object's own SQLite, with
hibernatable sockets; @yaks/d1
puts the same storage over D1. One apply(), with the same
phases and plugins, runs on all three.
This page
A third place: a browser, with no server of its own. This page imports
@yaks/graph, @yaks/ram, @yaks/cli and the task and session
vocabularies from JSR through esm.sh, with no bundler and no build
step, and runs them here.
The count of what this page loaded appears once yak is running.
yaks.app is where yaks apps live. A yaks
app is an index.html and whatever files sit beside it,
served live at space.yaks.app/app/. No build
step, no framework, no install. People build them by asking Claude or
ChatGPT: the connector at https://yaks.app/mcp gives an
assistant app_new, app_files and
app_deploy, and the same tools are yak commands.
The store
Every app has a store of its own, a graph of entities, and a page reads
it in one line, from its own address:
import { apply, query, search, subscribe } from './api/client.js'
await apply({ entity: { eid: '$r' },
doc: { title: 'Lemon cake', body: '3 lemons...' } })
let all = await query('.doc') // everything, oldest first
let some = await search('lemon') // full-text search, ranked
subscribe('.doc', draw) // and again whenever it changes
Files beside index.html
vocab.json
the app's own components; each gets commands any agent finds later, add_recipe and find_recipe for a recipe
seed.json
bundles written into the store by the first deploy, so an app opens furnished
worker.js
server code for every request not under /api/; the D1, R2 and Vectorize bindings its wrangler.jsonc names are created at deploy
NOTES.md
what the person wants remembered about how the app is kept
icon.png
the icon when the app is kept on a phone's home screen
An app is readable by anyone with the link and writable by its members;
open lets anyone with the link write, and
private shows it to members alone. A space can open a
tunnel to a machine: its apps reach only the paths the machine opened,
and the machine needs no open port.
This site
This page is a yaks app: apps/yak-sh-v2 in the
repository, pushed to its space with the connector's own tools.
yak admin push apps/yak-sh-v2 --owner --space jeff