Files
state-hub/scripts/seed.py
tegwick 0ea2788943 Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.

- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00

98 lines
2.9 KiB
Python

"""Seed the 6 canonical topics from canon/projects/."""
import asyncio
import sys
from pathlib import Path
# Allow running from state-hub/ root
sys.path.insert(0, str(Path(__file__).parent.parent))
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from api.database import async_session_factory, engine
from api.models.topic import Domain, Topic, TopicStatus
TOPICS = [
{
"slug": "custodian",
"title": "The Custodian",
"description": (
"Master agent system: transgenerational cognitive infrastructure for "
"co-creating and stewarding knowledge across all domains."
),
"domain": Domain.custodian,
},
{
"slug": "railiance",
"title": "Railiance",
"description": (
"DevOps & infrastructure reliability. Dependency for all other projects; "
"provides the deployment and operational backbone."
),
"domain": Domain.railiance,
},
{
"slug": "markitect",
"title": "Markitect",
"description": (
"Knowledge artifact management: structured authoring, versioning, and "
"retrieval of canonical documents."
),
"domain": Domain.markitect,
},
{
"slug": "coulomb-social",
"title": "Coulomb.social",
"description": (
"Co-creation marketplace experiment: connecting people around shared "
"projects and complementary capabilities."
),
"domain": Domain.coulomb_social,
},
{
"slug": "personhood",
"title": "Personhood",
"description": (
"Rights and obligations framework: defining digital personhood, consent "
"models, and data sovereignty."
),
"domain": Domain.personhood,
},
{
"slug": "foerster-capabilities",
"title": "Foerster Capabilities",
"description": (
"Agency capability taxonomy inspired by Heinz von Foerster: mapping the "
"space of possible cognitive and social actions."
),
"domain": Domain.foerster_capabilities,
},
]
async def seed() -> None:
async with async_session_factory() as session:
for data in TOPICS:
existing = await session.execute(
select(Topic).where(Topic.slug == data["slug"])
)
if existing.scalar_one_or_none() is not None:
print(f" skip (already exists): {data['slug']}")
continue
topic = Topic(
slug=data["slug"],
title=data["title"],
description=data["description"],
domain=data["domain"],
status=TopicStatus.active,
)
session.add(topic)
print(f" insert: {data['slug']}")
await session.commit()
await engine.dispose()
print("Seed complete.")
if __name__ == "__main__":
asyncio.run(seed())