init_schema (kernel/schema.py)

cheetahclaws · cheetahclaws/kernel/schema.py · python · Apache-2.0
database

Initializes and upgrades the kernel SQLite database schema to the latest version.

# Source: https://github.com/SAIL-Research-Lab/cheetahclaws | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""schema.py — kernel.db DDL and idempotent initialisation.

The kernel uses its own SQLite database (``~/.cheetahclaws/kernel.db``)
separate from F-2's ``sessions.db``. Rationale is documented in
RFC 0003 §4 ("Why a separate database from sessions.db").

This module exposes a single entry point:

    init_schema(conn) -> int       # returns schema_version

It is safe to call repeatedly; tables are created with ``IF NOT EXISTS``
and ``schema_version`` is upserted only when missing. Callers should
have set the connection's row_factory before invoking this function so
later rea

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key