Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: CI

# One full gate per tree. A pull request runs it on its head; a merge-queue draft runs it on the merged tree. A push
# to main runs it once for the commit that landed. A newer push to a pull request cancels its older run.
# to main runs it once for the commit that landed. A newer push to a pull request cancels its older run. Commit
# linting of the squashed message lives in `squash-message.yml`, so a title or body edit never re-runs this gate.
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, edited]
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -41,12 +42,6 @@ jobs:
with:
mode: save
key: ${{ steps.pnpm-store.outputs.key }}
# The squash merge takes the pull request title and body as the commit message, so that is what is linted.
- if: github.event_name == 'pull_request'
env:
TITLE: ${{ github.event.pull_request.title }}
BODY: ${{ github.event.pull_request.body }}
run: printf '%s\n\n%s\n' "$TITLE" "$BODY" | pnpm exec commitlint
- run: pnpm format:check
- run: pnpm lint
- run: pnpm typecheck
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/squash-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Squash message

# The squash commit takes the pull request's title and body, so those are linted here rather than in `ci.yml`: a
# title or body edit starts this job alone, never another run of the full gate on an unchanged tree. A queue draft is
# titled "merge queue: ..." and is not the message that lands, so it skips the lint; the pull request it embeds was
# linted, and the queue conditions require this check on that pull request. A fork that names its branch
# `mergify/merge-queue/...` gets the skip but then fails that queue condition, so the spoof cannot slip a message.
on:
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
squash-message:
name: squash message
if: ${{ !startsWith(github.head_ref, 'mergify/merge-queue/') }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- run: pnpm install --frozen-lockfile --filter .
- name: Lint the squash message
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
title=${PR_TITLE//$'\r'/}
body=${PR_BODY//$'\r'/}
printf '%s\n\n%s' "$title" "$body" | pnpm exec commitlint --verbose
28 changes: 28 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mergify: the policy lives in systemfsoftware/.github (.mergify.yml). This file only names this repository's checks.
extends: .github

queue_rules:
- name: subtree
merge_method: merge
queue_conditions:
# Org convention (systemfsoftware/.github README, "Subtree PRs"): one commit
# carries both trailers, and the PR history is not linear.
- 'commits[*].commit_message ~= (?ms)\A(?=.*^git-subtree-dir: \S+$)(?=.*^git-subtree-split: [0-9a-f]{40}$)'
- -linear-history
- check-success = checks / check
# The squash message is the pull request's title and body; `squash-message.yml` lints it on the pull request.
- check-success = squash message
merge_conditions:
- check-success = checks / check

- name: default
queue_conditions:
# Subtree PRs merge via the subtree queue above; a subtree
# claim without trailers matches no queue and cannot merge at all.
- "-commits[*].commit_message ~= (?m)^git-subtree-dir: \\S+$"
- "-title ~= (?i)\\b(add|pull|update|sync|vendor|refresh|import)\\b[^.]*\\bsubtrees?\\b|\\bsubtrees?\\b[^.]*(\\badd\\b|\\bpull\\b|\\bupdate\\b|\\bsync\\b|\\bvendor\\b|\\brefresh\\b|\\bimport\\b)"
- check-success = checks / check
# The squash message is the pull request's title and body; `squash-message.yml` lints it on the pull request.
- check-success = squash message
merge_conditions:
- check-success = checks / check
278 changes: 41 additions & 237 deletions AGENTS.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@AGENTS.md
@subtrees.toml
@repos/constitution/WORKING.md
83 changes: 83 additions & 0 deletions CODING_STANDARDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Coding Standards

Review criteria for every change in this repository. They add to the organization's
`repos/constitution/CODING_STANDARDS.md` (included by `REVIEW.md`) and take local precedence,
except that they cannot loosen anything `REVIEW.md` rates P0. This file holds rules that no CI check
fully enforces; each names what enforces it, or says that review does.

## Non-negotiable architecture rules

1. Public asynchronous operations return `Effect` or `Stream`, not naked `Promise` values.
Enforced by review.
2. Expected failures remain typed in `E`; dependency requirements remain visible in `R`. `pnpm typecheck`
(`effect-tsgo` `anyUnknownInErrorContext`) rejects `any` and `unknown` in either channel; review
enforces the rest.
3. Effect `Schema` is the canonical source for persisted, transported, tool, and structured model
values. Enforced by review; `pnpm check:record-format` pins the persisted record format.
4. Every acquired resource belongs to `Scope`. The engine must not create daemon fibers. Enforced by review.
5. Use the pinned Effect v4 AI primitives directly. Do not introduce framework-owned copies of
Effect AI `Tool`, `Toolkit`, `LanguageModel`, `Prompt`, `Response`, or `Model`. Enforced by review.
6. Provider SDK values never become canonical thread records. Effect AI values may be used
by the interpreter, but durable records remain explicit, versioned Schemas. Enforced by review.
7. The canonical log is append-only and owns conversation content, operation evidence and terminal
outcomes. An unfinished Run's versioned checkpoint is authoritative operational state, committed
atomically with its new history under the single owner's mutation gate and revision check. Delete
it at canonical settlement; unresolved operations and handoffs retain their own rows. Projections and lookup indexes
remain disposable. `verify` checks retained history and active checkpoints, including original
context consistency through `historyDigest`; it does not attest discarded intermediate
checkpoint revisions or provide tamper evidence. Storage validates schema, version, identity,
sequence and atomic commit boundaries without a hash chain or per-record integrity digests.
Enforced by `packages/storage-sqlite/test/sqlite-ledger.test.ts` and the shared store conformance
suites it runs; review enforces the rest.
8. No code may claim exactly-once external side-effect execution. Enforced by review.
9. An unresolved ordinary tool call is never automatically replayed after ownership loss.
One process owns a Thread at a time on every backend. Local owner generations reject late
results; distributed claims, ownership leases and multi-worker PostgreSQL are out of scope.
Enforced by `packages/platform-node/test/crash/crash.test.ts` and the ledger tests above; review
enforces the rest.
10. Tool/model/subagent concurrency is bounded and deterministic at commit time. Tool batches use
Effect structured concurrency and Semaphore permits rather than a separate Promise scheduler.
Enforced by `packages/effect-agent/test/engine/tool-broker.test.ts` and
`packages/effect-agent/test/capabilities/subagent-reservation.test.ts`; review enforces the rest.
11. Security decisions are fail-closed. Model output is untrusted input. Enforced by review.
12. Node platform assumptions must not enter core domain modules. `pnpm check:exports` restricts core
modules to relative framework imports and `effect`; `pnpm check:package-purity` bundles each
published entrypoint for the neutral platform.

## Package dependency direction

```text
@yielded/agent <- storage-sql <- storage-sqlite
@yielded/agent + selected adapters <- platform-node
```

An inward package must not import an outward package. If a feature appears to require that, define
or deepen an inward port and implement an outward adapter. `pnpm check:exports` requires every
cross-package import to be a public export and a declared dependency; review enforces the direction
itself. The direction of the internal layers under `packages/effect-agent/src` is enforced by
`pnpm check:exports` and is not restated here.

Framework code lives only in `packages/*`; do not create an `apps/` workspace. Create a new framework
package only for a genuinely new framework concern agreed with the repository owner. Provider
integrations remain upstream Effect AI Layers, not framework provider packages. Enforced by review.

## Change discipline

- This library is a v0 beta. Prefer simpler machinery and measured performance gains over
compatibility with superseded APIs or storage formats. Do not preserve obsolete paths or add
compatibility layers unless the owner requires compatibility. Enforced by review.
- Add or update Effect Schema definitions before implementing new wire or persisted values. Enforced by review.
- Do not silently widen errors to `unknown`, `Error`, or `any`. `pnpm typecheck` rejects the error and
requirements channels; review enforces the rest.
- Do not use type assertions to cross a schema boundary. Enforced by review.
- Change canonical history through export, re-encode and import, never through in-place payload
rewrites. Export only idle Threads and keep the source quiescent until the archive is complete.
Current Run state and operation state carry explicit versions. Storage-layout steps remain
adapter-owned, ordered, and atomic. Refuse formats and layouts newer than the running code before
mutation. Enforced by review; `pnpm check:record-format` fails a changed record format without a
version bump.
- Write changesets as one or two imperative sentences naming the consumer-visible change. Add only
a short usage example or an explicit BEHAVIOR CHANGE note when consumers must act; keep IDs,
root-cause, review and test stories, and implementation mechanics in the pull request. Enforced by review.
- Explain rejected alternatives in the pull request when a future agent could reasonably
re-propose them. Enforced by review.
7 changes: 7 additions & 0 deletions REVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Review instructions

How review behaves in this repository. The rules a finding cites are in `CODING_STANDARDS.md`, in
`repos/constitution/CODING_STANDARDS.md` and `repos/constitution/REVIEW.md` (included below).

@repos/constitution/CODING_STANDARDS.md
@repos/constitution/REVIEW.md
1 change: 1 addition & 0 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"**/dist",
"pnpm-lock.yaml",
"coverage/**",
"repos/**",
"**/CHANGELOG.md",
".agents/**",
".claude/**",
Expand Down
2 changes: 1 addition & 1 deletion oxlint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function spellings(key: string): ReadonlyArray<string> {

export default defineConfig({
extends: [recommended],
ignorePatterns: ['.agents/**', '.claude/**', '**/dist/**'],
ignorePatterns: ['.agents/**', '.claude/**', 'repos/**', '**/dist/**'],
overrides: Object.entries(baseline).map(([key, files]) => ({
files: [...files],
rules: Object.fromEntries(spellings(key).map((name) => [name, 'off' as const])),
Expand Down
31 changes: 31 additions & 0 deletions repos/constitution/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

# One job on every pull request, with no path filter, so the required `check` is emitted for every change, docs-only
# ones included. It runs the same check as the pre-commit hook.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
check:
name: check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.x
- name: Check markdown formatting
run: deno task check
1 change: 1 addition & 0 deletions repos/constitution/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions repos/constitution/.husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno run --allow-read --allow-env --allow-run --allow-sys npm:@commitlint/cli@21 --edit $1
1 change: 1 addition & 0 deletions repos/constitution/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno task check
11 changes: 11 additions & 0 deletions repos/constitution/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# constitution

The organization's shared `CODING_STANDARDS.md` and `REVIEW.md`. Consumer
repositories vendor this repository at `repos/constitution/`. There is no code
here.

- Read `CODING_STANDARDS.md`, `REVIEW.md` and `CONTRIBUTING.md` before you
change a rule.
- This repository is public. Nothing private goes in it (`SF-SEC-1`).
- Verify with `deno task check` before you push. Never pass `--no-verify`.
- Work on a branch; `main` changes only through a pull request.
1 change: 1 addition & 0 deletions repos/constitution/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
Loading
Loading