Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a18574f
docs: reframe UCF around persistent machine operation
sinethxyz Sep 25, 2026
0e24a8a
docs: add UCF retrospective and historical boundary
sinethxyz Sep 25, 2026
6c2b23d
docs: map historical Foundry architecture to general UCF
sinethxyz Sep 25, 2026
fbadc90
refactor: define provider-neutral intelligence contract
sinethxyz Sep 25, 2026
8169ed7
refactor: add execution environment package
sinethxyz Sep 25, 2026
47aa72f
refactor: define execution environment contract
sinethxyz Sep 25, 2026
2a7e286
refactor: adapt git worktrees to environment contract
sinethxyz Sep 25, 2026
c3a3dc0
refactor: inject intelligence provider into AgentRunner
sinethxyz Sep 25, 2026
c92e0bc
refactor: remove Unicorn-only execution target restriction
sinethxyz Sep 25, 2026
a87e5fd
test: cover provider injection boundary
sinethxyz Sep 25, 2026
803768c
feat: add provider-neutral transition contracts
sinethxyz Sep 25, 2026
15c193e
docs: audit remaining Foundry runtime couplings
sinethxyz Sep 25, 2026
5e81f71
test: prove transition contracts are environment neutral
sinethxyz Sep 25, 2026
3296321
feat: add action and verification transition contracts
sinethxyz Sep 25, 2026
7813a35
feat: add provider-neutral transition runtime package
sinethxyz Sep 25, 2026
6bd2cf0
feat: define transition loop capability interfaces
sinethxyz Sep 25, 2026
d550250
feat: add provider-neutral TransitionEngine
sinethxyz Sep 25, 2026
cee4b4c
test: prove provider-neutral transition loop end to end
sinethxyz Sep 25, 2026
a85f754
fix: complete provider-neutral AgentRunner injection
sinethxyz Sep 25, 2026
b4c2ac7
test: cover provider injection boundary
sinethxyz Sep 25, 2026
243bce3
chore: clean provider-neutral runner imports
sinethxyz Sep 25, 2026
f5c0187
chore: format generalized task target contract
sinethxyz Sep 25, 2026
3181258
feat: add durable transition journal boundary
sinethxyz Sep 25, 2026
5447f73
feat: persist verified transition outcomes through journal
sinethxyz Sep 25, 2026
8c68c36
test: require verified outcomes to be journaled
sinethxyz Sep 25, 2026
4496f0c
chore: keep transition interfaces strict-type clean
sinethxyz Sep 25, 2026
2b1ec25
test: prove journal typing and state continuity
sinethxyz Sep 25, 2026
8b9faf6
docs: reflect provider-neutral transition runtime foundation
sinethxyz Sep 25, 2026
d538539
docs: mark generic transition foundation and next migration step
sinethxyz Sep 25, 2026
8cd9523
ci: verify UCF foundation boundary
sinethxyz Sep 25, 2026
ade51d3
ci: run UCF foundation checks on relevant branch pushes
sinethxyz Sep 25, 2026
e2bb5a8
build: declare runtime packages for Hatch editable installs
sinethxyz Sep 25, 2026
7970037
docs: align agent guidance with UCF foundation and historical Foundry
sinethxyz Sep 25, 2026
422fd27
chore: satisfy Ruff import ordering
sinethxyz Sep 25, 2026
ead2d72
chore: apply Ruff import block formatting
sinethxyz Sep 25, 2026
5c96a88
test: declare SQLite async driver for full suite
sinethxyz Sep 25, 2026
79e538e
ci: add full regression suite after foundation checks
sinethxyz Sep 25, 2026
fbfbe6d
docs: separate UCF foundation from historical Foundry runtime
sinethxyz Sep 25, 2026
41e412a
fix: restore review completion event summary
sinethxyz Sep 25, 2026
5cc2c8e
ci: lint repaired historical review lifecycle
sinethxyz Sep 25, 2026
4426aba
chore: clean historical run engine lint debt
sinethxyz Sep 25, 2026
04bb325
test: align event logging with review completion contract
sinethxyz Sep 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/ucf-foundation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: UCF foundation

on:
pull_request:
paths:
- "foundry/contracts/transition_models.py"
- "foundry/environments/**"
- "foundry/providers/base.py"
- "foundry/runtime/**"
- "foundry/orchestration/agent_runner.py"
- "foundry/orchestration/run_engine.py"
- "foundry/contracts/task_types.py"
- "tests/unit/runtime/**"
- "tests/unit/test_transition_models.py"
- "tests/unit/orchestration/test_agent_runner.py"
- ".github/workflows/ucf-foundation.yml"
push:
paths:
- "foundry/contracts/transition_models.py"
- "foundry/environments/**"
- "foundry/providers/base.py"
- "foundry/runtime/**"

jobs:
foundation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install
run: python -m pip install -e ".[dev]"
- name: Compile
run: python -m compileall -q foundry tests
- name: Lint changed foundation
run: |
ruff check foundry/contracts/transition_models.py foundry/contracts/task_types.py foundry/environments foundry/providers/base.py foundry/runtime foundry/orchestration/agent_runner.py foundry/orchestration/run_engine.py tests/unit/test_transition_models.py tests/unit/runtime/test_transition_engine.py tests/unit/orchestration/test_agent_runner.py
- name: Test foundation
run: |
pytest -q tests/unit/test_transition_models.py tests/unit/runtime/test_transition_engine.py tests/unit/orchestration/test_agent_runner.py
- name: Test full suite
run: pytest -q
52 changes: 35 additions & 17 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
# Unicorn Foundry — Project Guidance
# UCF — Project Guidance

## What This Repo Is

unicorn-foundry is the internal Claude orchestration system for Unicorn Protocol.
It plans, builds, reviews, extracts, evaluates, and improves the Unicorn system.
UCF is an experiment in persistent machine operation across changing state.

It is NOT a chatbot. It is a controlled run engine that produces artifacts, diffs, PRs, and structured data.
The repository now contains two layers:

There are two repos:
- `unicorn-app` — the product (Next.js + Go + Postgres). Users touch this.
- `unicorn-foundry` — this repo. The build system. Humans and Claude touch this.
- **UCF foundation** — provider-neutral contracts and a minimal transition runtime built around explicit state, evidence, action, verification, outcomes, and continuity.
- **Historical Foundry runtime** — the original Claude/Git/PR orchestration system built while working on the now-discontinued Unicorn project.

Foundry writes code INTO unicorn-app via git worktrees and PRs. It never writes to unicorn-app's database directly. It never deploys anything.
The historical implementation is evidence of how the experiment emerged. Preserve it, but do not treat Unicorn, Claude, GitHub, source code, or pull requests as architectural invariants of UCF.

The general loop is:

**State(t) → Reason/Plan → Controlled Action → Observation → Verification → Outcome → State(t+1)**

The important object is the state transition. The model is a participant in the loop, not the loop itself.

## Core Thesis

Unicorn Protocol makes startup reality computationally legible.
UCF explores the boundary between **intelligence at an instant** and **intelligence through time**.

New foundation work should preserve these invariants:

1. state is explicit;
2. evidence remains attached to claims about state and outcomes;
3. actions occur through controlled environment boundaries;
4. verification is separate from generation;
5. meaningful transitions leave durable history;
6. intelligence providers are replaceable;
7. resulting state can seed the next transition.

The original Unicorn chain — **Signals → Evidence → State → Legibility** — remains historical context, not the active product objective.

## Compatibility Rule

The chain: **Signals → Evidence → State → Legibility**
Do not mass-rename or delete historical Foundry code merely to make terminology look generic. Generalization must be earned through exercised interfaces and tests.

A startup emits signals. Those signals become evidence. Evidence is used to infer state. State becomes legible to humans and software.
When touching new UCF foundation code, prefer the contracts under `foundry/contracts/transition_models.py`, `foundry/runtime/`, `foundry/environments/`, and `foundry/providers/base.py`.

Everything Foundry builds must serve that chain.
When touching historical Foundry code, preserve existing behavior unless the task explicitly migrates that behavior onto the new transition interfaces.

## Non-Negotiable Rules

Expand All @@ -43,7 +61,7 @@ Everything Foundry builds must serve that chain.

9. **Structured output over prose.** Plans, reviews, extractions, evals, and verification results must return validated JSON matching their defined schemas. Never return prose where structured output is expected.

10. **No Claude in the hot path.** unicorn-app serves precomputed truth. Claude lives in Foundry, before the read models, not inside user requests.
10. **Do not introduce new provider coupling into the UCF foundation.** Claude remains the default provider for the historical Foundry runtime, but new transition/runtime interfaces must depend on capabilities rather than a model vendor.

## Repo Layout

Expand Down Expand Up @@ -71,9 +89,9 @@ unicorn-foundry/
└── tests/ ← unit + integration
```

## Canon
## Historical Foundry Canon

The source of truth for Unicorn's domain model lives in `canon/`.
The source of truth for the historical Unicorn domain model lives in `canon/`. It is not the general UCF state model.

Before doing any extraction, schema, or domain work, always read the relevant canon document:
- `canon/docs/event_taxonomy.md` — what counts as an event, event types, required fields
Expand All @@ -93,15 +111,15 @@ Use the right model for the right job:

Default routing is defined in `foundry/orchestration/model_router.py`. Override via `model_override` in task requests only when justified.

## Language Boundaries
## Historical Foundry Language Boundaries

- **Go** — unicorn-app backend (API, workers). When implementing Go code, follow the patterns already in `services/api/`.
- **TypeScript** — unicorn-app frontend (Next.js). Follow patterns in `apps/web/`.
- **Python** — this repo (Foundry). All orchestration, extraction, eval code.

Never mix these. A task that touches Go code uses the backend-implementer subagent. A task that touches TS uses the frontend-implementer. Foundry itself is always Python.

## How Runs Work
## Historical Foundry Run Lifecycle

1. A task is submitted via the control plane API.
2. A worktree is created for the target repo + branch.
Expand Down
Loading
Loading