2026-07-08 16:11:12 +08:00
|
|
|
# Obelisk
|
|
|
|
|
|
|
|
|
|
Obelisk is explicit memory infrastructure for coding agents: it indexes local
|
2026-07-20 22:43:23 +08:00
|
|
|
Claude Code, Codex, and Kimi Code sessions into a queryable SQLite evidence layer, and a
|
2026-07-08 16:11:12 +08:00
|
|
|
CodeAct runtime lets an agent write a small query, run it, and answer from real
|
|
|
|
|
session history. This glossary pins the terms that are specific to Obelisk; it is
|
|
|
|
|
not a spec.
|
|
|
|
|
|
|
|
|
|
## Runtime interface
|
|
|
|
|
|
|
|
|
|
**Runtime interface**:
|
|
|
|
|
The public contract, expressed as four verbs — `build`, `search(text)`,
|
2026-07-16 17:26:23 +08:00
|
|
|
`query(code)`, `attune(code)`. CLI and a future MCP server are transports over
|
|
|
|
|
this same shape; neither adds its own retrieval surface. The agent skill is
|
|
|
|
|
docs-only guidance that invokes the CLI rather than a transport of its own.
|
2026-07-08 16:11:12 +08:00
|
|
|
_Avoid_: API, tool surface
|
|
|
|
|
|
|
|
|
|
**CodeAct**:
|
|
|
|
|
The interaction style where an agent writes JavaScript that runs inside the
|
|
|
|
|
`query(code)` sandbox and returns JSON, rather than calling many fine-grained
|
|
|
|
|
tools. This is Obelisk's core design choice.
|
|
|
|
|
_Avoid_: tool-calling, function-calling
|
|
|
|
|
|
|
|
|
|
**Helper**:
|
|
|
|
|
A convenience accessor available only inside the `query(code)` sandbox
|
|
|
|
|
(`overview`, `search`, `context`, `sql`, `memories`, …). Helpers are never
|
|
|
|
|
promoted to an external tool surface.
|
|
|
|
|
|
|
|
|
|
## Indexing
|
|
|
|
|
|
2026-07-09 12:46:02 +08:00
|
|
|
**Provider adapter**:
|
2026-07-20 22:43:23 +08:00
|
|
|
A pure per-source module (claude, codex, kimi, later pi, …) that owns its
|
|
|
|
|
descriptor, watch roots, discovery, parsing, cursor interpretation, and raw
|
|
|
|
|
record lookup. It discovers `IndexUnit`s rather than assuming one transcript
|
|
|
|
|
file per unit; Kimi uses a session directory containing multiple wire logs. It
|
|
|
|
|
never opens or writes a database; adding a source means adding one adapter and
|
|
|
|
|
registering it. The shared pure
|
2026-07-12 00:37:32 +08:00
|
|
|
parse/discover helpers live in `packages/core/src/parsing.ts`, which imports only
|
2026-07-09 12:46:02 +08:00
|
|
|
node:fs/path/os — deliberately node:sqlite-free so the compiled providers can be
|
|
|
|
|
consumed by the app (whose Electron runtime has no `node:sqlite`).
|
|
|
|
|
_Avoid_: parse core, parser, ingest
|
2026-07-08 16:11:12 +08:00
|
|
|
|
|
|
|
|
**Record**:
|
|
|
|
|
One normalized row destined for the index (session, message, tool call, tool
|
2026-07-09 12:46:02 +08:00
|
|
|
result, summary, subagent, workflow, …), emitted by a provider adapter before any
|
2026-07-08 16:11:12 +08:00
|
|
|
persistence happens.
|
|
|
|
|
|
|
|
|
|
**Persist layer**:
|
2026-07-09 12:46:02 +08:00
|
|
|
The single shared, provider- and binding-agnostic writer that consumes records
|
|
|
|
|
from any adapter and writes them into an injected SQLite handle inside a
|
2026-07-16 17:26:23 +08:00
|
|
|
transaction. The binding is injected — `node:sqlite` (CLI) or
|
2026-07-09 12:46:02 +08:00
|
|
|
`better-sqlite3` (app) — so there is one persist implementation, not one per
|
|
|
|
|
binding.
|
2026-07-08 16:11:12 +08:00
|
|
|
_Avoid_: writer, sink, DAO
|
|
|
|
|
|
|
|
|
|
**Daemon indexing mode**:
|
|
|
|
|
Continuous incremental indexing driven by a long-lived process (the desktop app,
|
|
|
|
|
later a CLI daemon) that watches transcript directories and keeps the index fresh
|
|
|
|
|
as files change.
|
|
|
|
|
_Avoid_: watcher mode, live indexing
|
|
|
|
|
|
|
|
|
|
**Passive pull mode**:
|
2026-07-16 17:26:23 +08:00
|
|
|
On-demand incremental indexing performed by a CLI invocation when there is no
|
|
|
|
|
active daemon: the command brings the index up to date, then answers.
|
2026-07-08 16:11:12 +08:00
|
|
|
_Avoid_: lazy indexing, on-read indexing
|
|
|
|
|
|
|
|
|
|
**index_state**:
|
2026-07-20 22:43:23 +08:00
|
|
|
The bookkeeping table shared by both indexing modes. It stores the adapter's
|
|
|
|
|
numeric cursor pair in the existing `mtime` and `lines_processed` columns (a
|
|
|
|
|
file adapter can use mtime + line offset; Kimi uses aggregate max-mtime + total
|
|
|
|
|
lines), plus heartbeat/last-build markers used for daemon arbitration.
|
2026-07-08 16:11:12 +08:00
|
|
|
|
|
|
|
|
**Daemon arbitration**:
|
2026-07-10 18:10:45 +08:00
|
|
|
The policy by which the passive pull mode detects a fresh daemon from the
|
2026-07-16 17:26:23 +08:00
|
|
|
`__app_heartbeat__` marker and skips every CLI-side mutation, including schema
|
2026-07-10 18:10:45 +08:00
|
|
|
setup, indexing, checkpointing, and `attune`. The heartbeat alone means “the
|
|
|
|
|
daemon should write”; `__app_last_successful_build__` records coverage/freshness,
|
|
|
|
|
not ownership. Both indexing modes use the same persist layer.
|
|
|
|
|
|
|
|
|
|
**Writer lease**:
|
|
|
|
|
The hard cross-process safety mutex behind daemon arbitration. A writer holds
|
|
|
|
|
`BEGIN IMMEDIATE` on `.obelisk/writer.lock.sqlite` for the complete mutation;
|
|
|
|
|
manual rebuild holds it through build, target-database replacement, and reopen.
|
|
|
|
|
The heartbeat expresses policy, while the writer lease prevents overlapping
|
|
|
|
|
writes during races, stale heartbeats, or processes from different versions.
|
2026-07-08 16:11:12 +08:00
|
|
|
|
|
|
|
|
## Memory
|
|
|
|
|
|
|
|
|
|
**Queryable session memory**:
|
|
|
|
|
The evidence layer — real sessions, messages, tool calls, subagents, workflows —
|
|
|
|
|
that an agent queries on demand. Obelisk deliberately does this instead of
|
|
|
|
|
implicit/ambient memory.
|
|
|
|
|
_Avoid_: implicit memory, ambient memory, auto-recall
|
|
|
|
|
|
|
|
|
|
**Approved durable memory**:
|
|
|
|
|
Human-approved conclusions persisted as markdown plus a registry record, via
|
|
|
|
|
`attune(code)` calling `remember()`/`forget()`. Auditable and revocable.
|
|
|
|
|
_Avoid_: long-term memory, vector memory
|