Skip to content

kviethp/Sofia-master

Repository files navigation

Sofia Master

Language:

Sofia Master is a self-hostable orchestration and operations layer for AI product engineering.

It is designed to run above:

  • OpenClaw for agent execution
  • 9Router for model routing, fallback, and provider abstraction

Sofia adds:

  • task and run lifecycle control
  • policy-aware model selection
  • multi-phase workflows such as planner -> builder -> verifier
  • approval gates for risky work
  • artifacts, decisions, usage evidence, and audit trail
  • recovery, replay, and operator tooling for self-hosted runtime

See PRODUCT-OVERVIEW.md for the product-level summary.

Highlights

  • self-host first
  • vendor-neutral runtime stack
  • deployable on a single VPS
  • built-in backup, restore, release, rollback, and diagnostics
  • supports staging and production split on the same host

Repository layout

  • apps/ API, worker, web, and admin surfaces
  • packages/ policy, adapters, routing, shared contracts
  • docs/ architecture, install, release, and operations guides
  • infra/ Compose, Docker, systemd, and Nginx templates
  • prompts/ canonical multi-agent role prompts
  • scripts/ doctor, smoke, conformance, release, backup, restore, diagnostics
  • skills/ authored skill sources compiled into .sofia/skills
  • sql/ PostgreSQL schema
  • openapi/ HTTP contract

Install

Prerequisites

  • Node.js 22+
  • pnpm
  • PostgreSQL
  • Redis
  • OpenClaw
  • 9Router

For local Compose bootstrap, also install Docker.

Quick install

Easiest path

Run the unified setup flow:

node scripts/setup.mjs

It supports:

  • quick mode for new users
  • advanced mode for custom ports / execution mode / token setup
  • start everything in the same window
  • or setup-only mode that prints the exact service start commands
  • startup persistence options: run now, auto-start on boot, or manual mode
  • tooling preflight + dry-run support before applying the full setup flow

Manual path

  1. Copy .env.example to .env
  2. Run node scripts/bootstrap.mjs
  3. Run pnpm install
  4. Start the stack:
docker compose -f infra/compose/docker-compose.yml up -d postgres redis api web admin
  1. Initialize runtime:
node apps/sofia-api/scripts/migrate.js
node apps/sofia-api/scripts/doctor.js
node apps/sofia-api/scripts/smoke.js

Full install detail is in 28-quickstart.md.

Quickstart

Open:

  • Web: http://127.0.0.1:3000
  • Admin: http://127.0.0.1:3001
  • API health: http://127.0.0.1:8080/health

Create a task:

curl -X POST http://127.0.0.1:8080/v1/tasks \
  -H "content-type: application/json" \
  -d "{\"title\":\"Add a simple login page scaffold to a demo app\",\"templateId\":\"default\"}"

Then inspect:

  • /v1/tasks
  • /v1/runs
  • /v1/runtime/status
  • .sofia/reports/
  • .sofia/artifacts/

Deploy

Single-host self-host

Use:

  • systemd templates in infra/systemd/
  • Nginx template in infra/nginx/sofia.conf
  • release scripts in scripts/

Recommended deploy flow:

node scripts/release-bundle.mjs
node scripts/release-acceptance.mjs
node scripts/self-host-acceptance.mjs
node scripts/final-readiness.mjs

Operational references:

Runtime validation

The pack includes machine-readable gates for self-host readiness:

  • skills:validate
  • skills:compile
  • agent-system:conformance
  • doctor
  • smoke
  • conformance
  • release-readiness
  • release-acceptance
  • self-host-acceptance
  • final-readiness

These scripts are intended to prove that the deployable artifact, not just the source tree, is healthy.

Publish status

This repository is structured to be publish-ready as a self-host implementation pack and runnable Sofia Master scaffold.

Primary docs:

Additional public docs:

About

Sofia Master is a self-hostable orchestration and operations layer for AI product engineering.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors