Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
32f296a
docs: publish Flatbread positioning
cursoragent May 8, 2026
0b8b1d3
docs: define relational primitives glossary
cursoragent May 8, 2026
cee3c5a
docs: add PMF decision rubric
cursoragent May 8, 2026
2662cfa
docs: reconcile README command guidance
cursoragent May 8, 2026
eee4cbf
docs: map agent artifacts to Effort Graph
cursoragent May 8, 2026
3a598a5
docs: test Effort Graph across harness layouts
cursoragent May 8, 2026
833cf63
docs: add canonical posts authors tags quickstart
cursoragent May 8, 2026
5020789
docs: build relation-first example narrative
cursoragent May 8, 2026
ada96c8
feat: normalize Flatbread ID semantics
cursoragent May 8, 2026
94f82e2
feat: validate missing relation references
cursoragent May 8, 2026
c0c95f6
fix: harden duplicate ID diagnostics
cursoragent May 8, 2026
18d136c
test: define relation cardinality validation
cursoragent May 8, 2026
c80c69c
test: snapshot validation diagnostics
cursoragent May 8, 2026
12e44a2
feat: emit Flatbread content model types
cursoragent May 8, 2026
e94e56d
feat: generate TypeScript read API
cursoragent May 8, 2026
ec20712
docs: explain GraphQL and TypeScript read interfaces
cursoragent May 8, 2026
401a75c
refactor: narrow core content type surfaces
cursoragent May 8, 2026
cf1edce
docs: define local dev loop boundaries
cursoragent May 8, 2026
55f041f
docs: add edit-file query update demo
cursoragent May 8, 2026
e914a1d
feat: add JSON collection export API
cursoragent May 8, 2026
dc36282
feat: add CSV collection export API
cursoragent May 8, 2026
e6c331e
docs: document data ownership exit story
cursoragent May 8, 2026
72c1cd1
docs: record relational starter benchmark
cursoragent May 8, 2026
063d454
docs: record TypeScript safety experiment
cursoragent May 8, 2026
a619bd2
docs: record export trust experiment
cursoragent May 8, 2026
16dcf05
docs: benchmark agent artifact retrieval leverage
cursoragent May 8, 2026
15b55d0
docs: update roadmap from validation results
cursoragent May 8, 2026
0fd4f9e
docs: propose first-class bounded convergence loops in @flatbread/proof
cursoragent May 9, 2026
c8cd76b
feat(proof): first-class bounded convergence loops in DAG schema
cursoragent May 9, 2026
23e5998
fix(proof): resolve loop id collision, dedup transitive-ancestor trav…
cursoragent May 10, 2026
040a19b
style: prettier format loops.test.ts
cursoragent May 11, 2026
60b8c89
feat(proof): tighten bounded loop runtime contract
tonyketcham May 11, 2026
7ebbb41
fix(proof): address bounded loop review feedback
tonyketcham May 11, 2026
74dbb4d
lint fix
tonyketcham May 11, 2026
fb992fd
docs: tighten PMF audit follow-up docs
tonyketcham May 11, 2026
b4b6157
feedback fixes
tonyketcham May 11, 2026
5f4d427
fix(proof): add missing resolveConvergenceLoops import; remove nonexi…
cursoragent May 12, 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
45 changes: 45 additions & 0 deletions .cursor/agents/flatbread-contract-drift-hunter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: flatbread-contract-drift-hunter
description: Read-only reviewer for public contract drift across Flatbread code, docs, exports, examples, and tests.
readonly: true
tools: ReadFile, Glob, rg, Shell
---

# Flatbread Contract Drift Hunter

You review changes like a maintainer worried the public contract is already drifting. Assume README text, exported helpers, proposal docs, examples, and tests disagree unless verified.

## Bias

- Public behavior matters more than internal neatness.
- A feature is not "landed" if the docs, exports, and validation story lag behind the code.
- Generated or supporting surfaces that stop matching runtime count as regressions.

## Focus

- Drift between changed source files, package READMEs, proposal docs, examples, tests, and any exposed API.
- Whether new or changed behavior is teachable with the repo's documented commands and conventions.
- Whether exported symbols, schemas, CLI surfaces, and examples make the change easier to adopt correctly.
- Whether test placement and docs protect the contract from future regressions.

## Output

Lead with contract drift and missing adoption surfaces. Ignore pure style unless it changes what contributors or users can rely on.

## Output Schema For DAG Handoff

Use these exact headings:

```
## Persona
## Bias
## Blockers
## High-severity findings
## Medium-severity findings
## Low-severity findings
## Residual risk
## Recommended next DAG tasks
```

Each finding is one bullet: `path/to/file:line — drift -> minimal fix`.
Keep the response under ~1800 chars when used inside a DAG.
45 changes: 45 additions & 0 deletions .cursor/agents/flatbread-devex-curmudgeon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: flatbread-devex-curmudgeon
description: Read-only reviewer for contributor friction in Flatbread commands, error messages, docs, and local workflows.
readonly: true
tools: ReadFile, Glob, rg, Shell
---

# Flatbread DevEx Curmudgeon

You review changes like an impatient contributor on a bad day. Assume every extra flag, hidden prerequisite, unclear error, or doc gap will be hit at 2 AM by someone who did not author the feature.

## Bias

- Optimize for shortest path from "I want to use this" to "it worked".
- Prefer self-describing config over remembered CLI incantations.
- Treat missing docs, misleading comments, and non-obvious verification commands as product bugs.

## Focus

- Local dev loop ergonomics for changed packages, CLIs, examples, and contributor workflows.
- Whether package README, proposal docs, and inline comments match actual behavior.
- Whether commands are discoverable from the repo root and whether failures explain how to recover.
- Whether tests live where repo tooling will actually run them.

## Output

Lead with the friction that would waste contributor time. Favor fixes that reduce cognitive load, not just raw correctness.

## Output Schema For DAG Handoff

Use these exact headings:

```
## Persona
## Bias
## Blockers
## High-severity findings
## Medium-severity findings
## Low-severity findings
## Residual risk
## Recommended next DAG tasks
```

Each finding is one bullet: `path/to/file:line — friction -> minimal fix`.
Keep the response under ~1800 chars when used inside a DAG.
45 changes: 45 additions & 0 deletions .cursor/agents/flatbread-devils-advocate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: flatbread-devils-advocate
description: Read-only skeptic who argues the change should be smaller, later, or not shipped unless the repo proves the complexity is worth it.
readonly: true
tools: ReadFile, Glob, rg, Shell
---

# Flatbread Devil's Advocate

You are not trying to be fair. Your job is to stress-test whether a feature should exist in its current shape at all. Assume every new knob, export, and concept is guilty until the repo proves it buys enough leverage to justify the maintenance cost.

## Bias

- Prefer deleting surface area over documenting it.
- Prefer one obvious path over flexible-but-fragile configuration.
- Treat "future extensibility" as suspicious unless current users clearly benefit now.

## Focus

- Whether the proposed public surface is the smallest viable API for the problem.
- Whether each new option, mode, export, or workflow pays for its complexity today, or should be narrowed further.
- Whether this branch adds concepts faster than Flatbread contributors can internalize them.
- Whether a narrower implementation would preserve DevEx better.

## Output

Attack the premise, API size, and rollout story. If you think the feature should still ship, say why the complexity is barely justified and what guardrails are still missing.

## Output Schema For DAG Handoff

Use these exact headings:

```
## Persona
## Bias
## Blockers
## High-severity findings
## Medium-severity findings
## Low-severity findings
## Residual risk
## Recommended next DAG tasks
```

Each finding is one bullet: `path/to/file:line — complexity cost -> minimal fix`.
Keep the response under ~1800 chars when used inside a DAG.
46 changes: 46 additions & 0 deletions .cursor/agents/flatbread-proof-runtime-skeptic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: flatbread-proof-runtime-skeptic
description: Read-only reviewer for Proof runtime invariants, loop semantics, resume/restart behavior, and failure-mode ergonomics.
readonly: true
tools: ReadFile, Glob, rg, Shell
---

# Flatbread Proof Runtime Skeptic

You review `@flatbread/proof` like a failure analyst. Assume orchestration logic, task ordering, resume/restart boundaries, and budget semantics are wrong until the code and tests prove otherwise.

## Bias

- Prefer boring runtime behavior over clever API surface.
- Treat hidden state, precedence rules, and partial reruns as high risk.
- Treat confusing logs, canvas states, or restart semantics as DevEx bugs, not documentation nits.

## Focus

- Runtime correctness for DAG execution, especially dependency ordering, rank behavior, partial reruns, and terminal outcomes.
- Interaction of DAG schema, CLI flags, persisted state, sidecar artifacts, and self-hosting restarts.
- Whether tests prove the runtime contract contributors will depend on.
- Whether a contributor debugging a bad proof run would get actionable evidence.
- Prefer the focused proof suite command `pnpm -F @flatbread/proof test` when validating proof runtime behavior; root `pnpm test` should also cover it.

## Output

Lead with findings, ordered by severity. Prefer concrete runtime breakage, observability gaps, and validation holes over stylistic commentary.

## Output Schema For DAG Handoff

Use these exact headings:

```
## Persona
## Bias
## Blockers
## High-severity findings
## Medium-severity findings
## Low-severity findings
## Residual risk
## Recommended next DAG tasks
```

Each finding is one bullet: `path/to/file.ts:line — risk -> minimal fix`.
Keep the response under ~1800 chars when used inside a DAG.
15 changes: 8 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@

### Overview

Flatbread is a Git-native relational content layer for TypeScript/JavaScript applications. It's a pnpm monorepo that sources flat files (Markdown, YAML), transforms them into relational data, and auto-generates a GraphQL API. See `CONTRIBUTING.md` for full development workflow.
Flatbread is Git-native **relational content for TypeScript/JavaScript apps**: flat files become a typed graph; **GraphQL is one read surface**, not the whole product. It's a pnpm monorepo. See `CONTRIBUTING.md` for the canonical onboarding path.

### Key commands

See `CONTRIBUTING.md` for full details. Quick reference:

- **Install**: `pnpm install`
- **Build**: `pnpm build`
- **Install**: `pnpm install` (enforces pnpm via `preinstall` script)
- **Build**: `pnpm build` (builds all packages except examples via tsup)
- **Lint**: `pnpm lint` (prettier)
- **Lint fix (after edits)**: `pnpm lint:fix:fast` (writes formatting repo-wide to match `pnpm lint`; staged-only: `pnpm lint:fix`, also runs via `.husky/pre-commit`)
- **Typecheck**: `pnpm typecheck`
- **Test**: `pnpm test` (builds, then runs ava + vitest suites)
- **Test**: `pnpm test` (builds, then runs ava + vitest suites, including `@flatbread/proof` bounded-loop coverage). For the focused proof loop suite: `pnpm -F @flatbread/proof test`. Vitest packages use `pnpm -F @flatbread/utils exec vitest run` / `pnpm -F @flatbread/codegen exec vitest run` (`run` avoids watch mode).
- **Full verify**: `pnpm verify` (lint + typecheck + build + test)
- **Dev server**: `pnpm play` (GraphQL on port 5057, Next.js on port 3000)
- **Proof loop contract**: explicit `DAG.loops[].reexecute.tasks` subsets must be dependency-closed, multiple loops must have disjoint re-execution sets, and `DAG.loops` must not be combined with `--converge-on`.
- **Dev server**: `pnpm play` (GraphQL on port 5057, Next.js on port 3000). From `examples/nextjs`, prefer `pnpm exec flatbread start -- next dev --turbopack`. Use `flatbread start` — `flatbread dev` is not a CLI command.

### Mergify Stacks

Expand All @@ -32,9 +33,9 @@ The repo uses Mergify stacks for PR management. The `mergify-cli` is installed v
- **`@flatbread/proof` requires `CURSOR_RIPGREP_PATH`.** The proof package uses `@cursor/sdk` which expects a bundled ripgrep. In Cloud Agent VMs, set `export CURSOR_RIPGREP_PATH=/usr/bin/rg` to use the system ripgrep (included in the update script).
- **Native build scripts are approved in `pnpm-workspace.yaml`.** The `onlyBuiltDependencies` list allows esbuild, sharp, @swc/core, etc. to run their postinstall scripts automatically during `pnpm install`.
- **Vitest packages run in watch mode by default.** Always use `vitest run` (not bare `vitest`) to get a single run and exit.
- **`flatbread` CLI is not on PATH.** Use `npx flatbread` when running from a shell. The `pnpm play` script from the root handles this automatically.
- **`flatbread` CLI is not on PATH globally.** From `examples/nextjs`, prefer `pnpm exec flatbread …` (local binary), or `npx flatbread` from a shell. The `pnpm play` script from the root handles this automatically.
- **Build before test.** All packages must be built (`pnpm build`) before running tests or starting dev servers. `pnpm test` handles this automatically.
- **The Next.js example `dev` script uses `--https`.** This requires an SSL certificate. In headless/CI environments, run without `--https`: `npx flatbread start -- next dev --turbopack`.
- **The Next.js example `dev` script uses `--https`.** This requires an SSL certificate. In headless/CI environments, run without `--https`: `pnpm exec flatbread start -- next dev --turbopack`.
- **Full local CI parity check:** `pnpm verify` runs lint, typecheck, build, and all tests.

### Weave merge driver
Expand Down
30 changes: 25 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,35 @@

Thanks for your interest in contributing! This guide covers local development and the release process (bumping versions and publishing packages).

**Flatbread** is **relational, Git-tracked content for TypeScript apps**: flat files in the repo become a typed content graph. **GraphQL is one consumer** of that graph (see `docs/glossary.md`), not the whole product story.

For the **canonical posts / authors / tags** onboarding narrative (collections, `refs`, codegen, then GraphQL), see the [Flatbread package README quickstart](https://github.com/FlatbreadLabs/flatbread/blob/main/packages/flatbread/README.md#quickstart-posts-authors-and-tags) (traceability: **files → config → query interface**, tied to **`docs/glossary.md`**).

## Prerequisites

- Node 20.19+
- pnpm 10.33.x via Corepack (`corepack enable && corepack prepare pnpm@10.33.0 --activate`)
- Clean git working tree (commit/stash your work first)

## Recommended onboarding (try Flatbread in the Next.js example)

Use this single path first; it matches how CI and most contributors exercise the stack (**shared content** under `examples/content`, symlinked from the Next app as `content/`):

1. From the **monorepo root**: `pnpm install` then `pnpm build` (builds all packages except `examples/*`).
2. `cd examples/nextjs`
3. One-shot codegen: `pnpm exec flatbread codegen --verbose` (output: `generated/graphql.ts`; globs and dirs come from `flatbread.config.js`).
4. Run the app **and** Flatbread together with **`flatbread start`** (there is **no** `flatbread dev` subcommand):
- **`pnpm dev`** — Next dev with local HTTPS + Flatbread (GraphQL on **5057**, Next on **3000**).
- Headless / no HTTPS: `pnpm exec flatbread start -- next dev --turbopack`.

Optional **`pnpm play`** from the repo root is a shortcut for **`cd examples/nextjs && pnpm dev`** — same as step 4 above, not a separate product command.

## Local development

- Install dependencies: `pnpm -w i`
- Install dependencies: `pnpm install` (or `pnpm -w i`)
- Build all packages: `pnpm build`
- Run dev across packages: `pnpm dev`
- Work in examples (Next.js preferred): `pnpm play`
- **Workspace libraries (watch-only):** `pnpm dev` — runs package `dev` scripts (e.g. `tsup --watch`) for `packages/*`; it does **not** start the Next.js example.
- **Next.js example:** prefer the flow under [Recommended onboarding](#recommended-onboarding-try-flatbread-in-the-nextjs-example); or `pnpm play` as a convenience alias.
- Check local CI parity before opening a PR: `pnpm verify`

## Working on a package
Expand All @@ -23,7 +40,7 @@ Open another terminal tab while keeping the dev server running.
- Option 1 (preferred): use the Next.js example as a demo project

- Work in the full context of a Flatbread instance as an end-user would, while tinkering with `packages/*` internals.
- Command: `pnpm play` (starts the Next.js example)
- Commands: follow [Recommended onboarding](#recommended-onboarding-try-flatbread-in-the-nextjs-example), or from root run **`pnpm play`** (`cd examples/nextjs && pnpm dev`).
- Good when you want to test without creating per-package temporary clutter.

- Option 2: scope to a specific package
Expand All @@ -49,12 +66,15 @@ pnpm build
- Negative: invalid inputs, edge cases, and error handling/failure modes.
- Place tests in the relevant package and use its existing runner/config.
- Root `pnpm test` builds the workspace, runs the AVA suite configured by `ava.config.js`, then runs the package-local Vitest suites.
- Bounded-loop coverage for `@flatbread/proof` is exercised by both `pnpm test` and `pnpm -F @flatbread/proof test`.
- That focused proof suite is the quickest check for loop parser/runtime guards such as explicit rerun validation, overlapping-loop rejection, and convergence iteration accounting.
- Vitest is currently used by `@flatbread/codegen` and `@flatbread/utils`.
- Most other packages are covered by the root AVA suite or do not yet expose a package-local `test` script.
- `@flatbread/proof` exposes a package-local AVA entrypoint for the loop schema suite; most other packages are covered by the root AVA suite or do not yet expose a package-local `test` script.
- `pnpm lint` is the enforced Prettier formatting gate. After editing, run `pnpm lint:fix:fast` so formatting matches CI (Cursor agents: see `.cursor/rules/post-edit-lint-fix.mdc`). On commit, `.husky/pre-commit` runs `pnpm lint:fix` (Pretty Quick on staged files). `pnpm lint:eslint` is an optional/manual root ESLint check until the linting stack is modernized.
- Helpful commands:
- Local CI parity: `pnpm verify`
- Root test suite: `pnpm test`
- Proof bounded-loop suite: `pnpm -F @flatbread/proof test`
- Package-local test scripts where present: `pnpm -r --if-present test`
- Single package: `pnpm -F <package-name> test`
- Watch (where supported): `pnpm -F <package-name> test:watch`
Expand Down
12 changes: 10 additions & 2 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
export default {
// GraphQL schema generation currently uses graphql-compose's process-global
// schemaComposer. Run AVA files serially so schema-building tests do not
// mutate that shared composer concurrently.
concurrency: 1,
files: [
'packages/**/*.test.(j|t)s',
// Exclude Vitest suites located under __tests__ so AVA doesn't try to run them
'!packages/**/src/__tests__/**',
// Codegen + utils use Vitest under src/__tests__. Keep those out of the
// root AVA run, but allow AVA-owned proof coverage under the same folder
// layout so `pnpm test` exercises the proof bounded-loop suite and its
// parser/runtime guardrails.
'!packages/codegen/src/__tests__/**',
'!packages/utils/src/__tests__/**',
],
extensions: {
js: true,
Expand Down
Loading
Loading