feat!: rebuild Facility around persistent story workspaces - #289
Conversation
Make stories the durable unit of work, configure all agents through .agents, expose the workflow through MCP and the UI, and run Claude Code or Codex with full workspace and GitHub installation access. BREAKING CHANGE: Facility 0.12 replaces the 0.11 run, receipt, approval, budget, delivery, and separate-preview model with persistent story workspaces and a new database schema.
7eb262a to
181f1f3
Compare
|
Durable workspaces look directionally strong. Before this closes #284, could the PR include a criterion-by-criterion evidence table distinguishing automated CI, completed manual validation, and still-pending gates—especially the 14-day soak and live-engine pilots? I’d also like to understand the threat model for giving GitHub-triggered reviewers and scheduled agents the same maintainer capability as builders when their inputs are explicitly untrusted. |
|
One thing I noticed while reading the 0.12 branch, in case it helps before this lands. The workspace GitHub token is minted for the whole installation, not for the project's repositories.
Consequence: when two projects share an App installation, an agent in project A holds a maintainer-capable token for project B's repositories (and for any other repository the installation covers). That seems at odds with the boundary the epic keeps: #279 says "a request for another tenant, project, installation, or repository is denied", and the new Suggested fix: pass the project's repositories for that installation in the token request ( Happy to open a PR for it if you'd take one. |
|
Thanks for this massive rebuild – the persistent workspace concept is a great evolution. I am new to this project, and going through the changes to understand the data model, and I have a quick question about the removal of the old runs, receipts, and proposals tables. The PR description says these are removed, but I don’t see a migration script that drops or archives them. For existing self‑hosted instances (even in 0.x), what’s the expected upgrade path? Should users manually back up and drop those tables, or is the plan to keep them around until a later migration? I’m happy to help draft a migration script if we decide to archive the old data before removal. Let me know what you’d prefer. |
|
Documentation follow-up in e5ea723:
Validation on the current head:
The first audit attempt timed out against the npm advisories service in both local and CI runs. The unchanged CI retry passed. The PR remains a draft; no package or image publication ran. |
|
@manuelgm0518 Thanks for raising this. These are useful release-confidence checks, but Facility is still experimental and evolving within the 0.x series. We have decided not to hold this merge for the 14-day soak or the live-engine pilots. The automated end-to-end journey passes, and we will continue the soak and hosted validation after the merge while iterating towards a stable release. The maintainer-access model is intentional. GitHub-triggered and scheduled agents receive the same project capability as interactive agents. Inputs are treated as untrusted, credentials are short-lived and restricted to the repositories connected to the project, and branch protection, required CI, and human review remain the merge boundary. This is a breaking release with a documented upgrade path rather than an in-place migration. Existing users can remain on 0.11 until they are ready to back up their installation and start 0.12 with a separate, empty database. |
|
@BrunoInz Thanks for catching this. You were right, and it has now been fixed. Installation tokens are minted with the explicit repository list connected to the project, grouped by installation. Agents still receive the same maintainer-level permissions, but the token cannot reach other repositories covered by the GitHub App installation. We also added regression coverage for the token request and for denying credentials to repositories outside the configured project. |
|
@EaglewithGlasses Thanks for raising this. The upgrade behavior is now implemented and documented. Facility 0.12 uses a clean database boundary. It does not drop, archive, or modify the 0.11 tables. The upgrade path is to back up the existing installation, keep the 0.11 database available for rollback, and start 0.12 against a separate, empty database. The migration command now detects a 0.11 database and refuses to continue before creating migration metadata or changing any schema objects. This behavior is covered by an integration test. Existing users can remain on 0.11 until they are ready to move to the new model. |
Purpose
Facility 0.12 makes a persistent story workspace the unit of work. A story, its shared conversation, Git worktree, native Claude Code and Codex sessions, development services, previews, commits, and pull request now follow one lifecycle.
Compute can sleep or be replaced. The workspace stays available until a maintainer explicitly deletes it. Merging or archiving a story does not remove its worktree, local data, conversation, or engine sessions.
MCP is the primary control surface. The web UI remains supported and uses the same application services.
Workspace behavior
.facility.yml.Agents as code
.agents/is the source of agent configuration. Kickstart, the API, MCP, the scheduler, and the UI use the same strict parser, normalized representation, and content hash.Kickstart installs six agents:
architectbuilderpr-revieweraddress-reviewci-doctorsecurity-auditEach manifest declares its prompt, engine, model, enabled state, and manual, GitHub, or schedule triggers. Permission, sandbox, tool allowlist, and
max_turnsfields are rejected. Every agent receives full workspace access and the GitHub App's configured maintainer capability for the repositories connected to the project.Agent changes made in the UI are proposed on a branch and pull request. Repeated requests are idempotent, later edits advance the open pull request without force-pushing, and stale branches are rejected.
Facility also inventories valid repository-owned skills under
.agents/skills/**/SKILL.mdand.claude/skills/**/SKILL.md. The Agents page, REST API, SDK, andfacility_list_skillsMCP tool expose their names, descriptions, paths, hashes, and source commit. Facility does not install or upgrade a separate catalog.Scheduled agents remain part of the product. Manual, MCP, UI, GitHub, and scheduled work all enter the same turn dispatcher. A second message waits behind the active turn and is promoted after success, failure, cancellation, or stale-worker recovery.
Cost and budget controls
Cost analysis and budgeting stay in Facility without a separate model gateway or metering service.
Observability and delivery analytics
Operational monitoring, product analytics, and audit history stay in the existing API, worker, and PostgreSQL database.
The Insights surface reports:
AWS deployments also enable ECS Container Insights, RDS Performance Insights, PostgreSQL logs, and service log groups in CloudWatch.
GitHub mirror and pipeline
Facility keeps a project-scoped mirror of GitHub issues, branches, pull requests, reviews, checks, and CI state.
MCP, API, SDK, and UI
The MCP server exposes 20 tools. The original workspace and conversation tools remain, with project skill inventory plus costs, budgets, observability, the delivery pipeline, and GitHub reconciliation.
The REST API and generated TypeScript SDK expose the same capabilities. The web UI adds Pipeline and Insights while keeping project setup, agent and skill inspection, stories, conversation history, workspace controls, previews, attention handling, archive, restore, and deletion.
Each turn records agent, engine, model, session, workspace, branch, and initial Git SHA before engine execution. Final SHA, commits, changed files, and dirty state are captured when it settles, including failure and cancellation paths. GitHub branch, pull request, review, and check facts join those records in one ordered story timeline in the UI and
facility_get_story. Ten-minute reconciliation discovers changes made outside Facility without falsely attributing them to an agent turn.Security model
Agents are trusted repository maintainers inside an isolated workspace. Facility does not maintain receipts, approval workflows, delivery brokers, or per-agent permission profiles.
Authentication, project membership, tenant isolation, webhook signatures, secret handling, preview authorization, branch protection, and control-plane isolation remain enforced. Installation tokens are short-lived. They keep the GitHub App's configured maintainer permissions and are limited to repositories connected to the active project.
Project repositories can request only explicitly configured, project-namespaced environment values. They cannot read arbitrary Facility process environment variables. Preview handoffs are single-use, expire, and are revoked when a workspace is suspended or deleted.
Reference deployment
The new Terraform module keeps the durable control plane in AWS and all story workspaces in Vercel Sandbox.
AWS provides:
Vercel provides the isolated development workspace, retained snapshots, Docker and Compose execution, and exposed service endpoints. AWS does not provision workspace tasks, CodeBuild sandboxes, preview containers, or a model gateway.
0.12 cutover
The package set and generated SDK are versioned at
0.12.0. The legacy run, receipt, HITL, proposal, model gateway, agent registry, and separate preview paths no longer ship. Their required cost, budget, monitoring, analytics, audit, scheduling, mirror, and pipeline capabilities are implemented in the smaller 0.12 control plane.0.12 uses a clean database schema. The migration command detects a 0.11
runstable and exits before creating a migration ledger or changing schema objects. The upgrade guide documents backup, export, clean installation, and rollback to an untouched 0.11 database.Persistent storage is an operator responsibility. Local conformance tests use deterministic export and restore. Hosted installations must retain Vercel workspace snapshots and RDS backups according to their policy.
Acceptance evidence
The following local checks passed on commit
ccb2487:pnpm verifycompleted successfully.pnpm migrations:checkpassed.facility-runner:dev.GitHub CI for this commit is reported by the pull request checks. No live repository or hosted environment was changed during local acceptance. This pull request remains a draft. It has not been merged, and no package or container image has been published.
Release gates still open
These checks need private infrastructure or elapsed time and remain open:
The proposal is in progress and assigned to @adrian-lorenzo. The PR should remain a draft until these gates and the owner's review are complete.
Related to #272
Related to #273
Related to #274
Related to #275
Related to #276
Related to #277
Related to #278
Related to #279
Related to #280
Related to #281
Related to #282
Related to #283
Related to #284