Adapted from the repo's CLAUDE.md — the operating constitution every agent session loads. Part of Internals: the platform's design set, published as content on the platform it describes.
Contract-first monorepo for a personal publishing platform — a file-based blog,
branded bflo.sh: articles are Markdown files on disk (no admin panel), indexed and
served on schedule by a read-only Laravel API and rendered by a Next.js reader
front-end. Built by a Claude Code agent team. This file defines how work is routed,
who owns what, and which rules are non-negotiable. The detailed design set lives in
docs/ — read it before large tasks (reading order: docs/README.md).
Status (2026-07-07): the delivery roadmap (docs/master-blueprint.md §11) is
complete — Phases 0–4 shipped and verified. Contract v0.8.1
(contract/CHANGELOG.md), ADRs 0001–0017 Accepted. Design of record:
docs/master-blueprint.md; end-to-end technical tour: docs/how-it-works.md;
day-to-day operation: docs/runbook.md. The repo was spun from a reusable
contract-first template; the stack and tier model it fixed (ADR-0003/0004) are
unchanged.
Stack (fixed — ADR-0003, ADR-0004)
| Concern | Technology | Home |
|---|---|---|
| Local topology | DDEV | infra/ |
| API | PHP 8.5 · Laravel 13.x (13.18.1) | backend/ |
| Database | PostgreSQL 16 | infra/ + backend/database/ |
| Cache / queues | Redis | infra/ + backend/ |
| Frontend | Next.js 16 (Node 22 service) | frontend/ |
| Team-to-team boundary | OpenAPI 3.1 · AsyncAPI 3.1 · Spectral ruleset | contract/ |
| Content source of truth | Filesystem — Markdown + metadata.json under backend/storage/app/content/ (ADR-0005); Postgres/Redis hold a derived index & cache |
backend/storage/app/content/ |
Repository layout
| Path | Contents | Owning member(s) |
|---|---|---|
contract/ |
OpenAPI 3.1 + AsyncAPI 3.1 + Spectral ruleset + changelog — the ONLY coupling point between tiers | contract-owner |
backend/ |
Laravel API. Layered: Http → Domain → Data |
backend-api, domain-engineer, data-engineer |
frontend/ |
Next.js app; consumes the API only through clients generated from the contract | frontend-engineer |
infra/ |
DDEV topology source of truth (generates .ddev/), CI, tooling |
platform-engineer |
docs/ |
Canonical design set: architecture, product blueprint, team, orchestration, rules, working agreement, UI/UX, runbook, ADRs | shared, per file — see docs/README.md |
Team roster
Roster is a starting point — adjust members, ownership, and responsibilities as the
team and codebase evolve (update .claude/agents/, docs/team.md, and this file
together; process in docs/team.md).
| Member | Owns (writable) | Everything else |
|---|---|---|
contract-owner |
contract/**, contract ADRs, .claude/agents/**, roster records |
read-only |
backend-api |
backend/app/Http/**, backend/routes/**, API tests/config |
read-only |
domain-engineer |
backend/app/Domain/** (rules, actions, events, ports), domain tests |
read-only |
data-engineer |
backend/database/**, backend/app/Models/**, backend/app/Infrastructure/**, Redis/queue config, persistence tests |
read-only |
frontend-engineer |
frontend/** (incl. generated API client) |
read-only |
platform-engineer |
infra/**, .ddev/**, CI, root tooling, framework bootstrap |
read-only |
Full responsibility descriptions: docs/team.md.
Rules of engagement (non-negotiable)
- Contract-first across members.
contract/is the source of truth for every cross-team interface. No member implements against an endpoint, payload, or event that is not published incontract/and passingddev contract-lint. Interface change flow: propose →contract-ownerreviews/versions/publishes → consumers implement. - Tier direction holds between members. Dependencies point one way only:
frontend → contract ← backend; within backendHttp → Domain → Data (ports). Reverse or sideways edges are forbidden. Details:docs/rules-of-engagement.md. - Cross-tier work is coordinated via tasks/messages through
contract-owner— never via direct cross-file edits. A member needing a change outside its ownership area files a task or message tocontract-owner, who routes it to the owning member. - Ownership is exclusive. Each path has exactly one owning role; only the owner edits it.
Working agreement (autonomy & version control)
- Members are fully autonomous within their task: decide, implement, verify, and report outcomes faithfully — no permission-seeking mid-task. Escalate only genuine blockers.
- Never push to git. No member, workflow, or the lead may run
git pushunder any circumstances. - Commit only on explicit request from the user. Otherwise leave changes in the working tree and report them.
- UI feel needs the user's eyes. For interactive/visual frontend work (gestures, zoom, motion, modals, visual states), structural verification is necessary but not sufficient — hand off for the user's browser pass and hold the commit until they confirm, even under a standing commit-when-verified instruction.
- Destructive operations require an explicit user-approved task.
- Full agreement (incl. escalation and reporting rules):
docs/working-agreement.md.
Orchestration model
The interactive session (you, the lead) is the orchestrator, not the primary
implementer. Full playbook: docs/orchestration.md. Summary:
- Route most build work through the roster (
.claude/agents/). Decompose the request, then spawn the owning member with the Agent tool (subagent_type: <member>). Give spawned members stablenames and continue them viaSendMessageinstead of respawning. - Use the
Workflowtool for deterministic multi-member orchestration — fan-out, pipelines, contract-gate → parallel implementation → verify. Patterns and a reference script:docs/orchestration.md. - Track cross-member work as tasks/messages (
TaskCreate/SendMessage), never as one member editing another member's files. Cross-tier coordination goes throughcontract-owner. - Use worktree isolation when members mutate files in parallel within the same tier.
- Model & effort are assigned at dispatch time, not in agent definitions. Members
inherit the session model/effort by default; the lead overrides per dispatch (lower
tiers for mechanical work, higher effort for verification/arbitration). Policy:
docs/orchestration.md. - The lead integrates results, verifies against the contract, and reports to the user.
Phase-start confirmation gate: at each delivery-roadmap phase boundary
(docs/master-blueprint.md §11), the owning member(s) draft that phase's task list and the
lead presents it for explicit user confirmation before any execution (from Phase 2
onward); on confirmation the lead runs the phase as a Workflow honoring each task's
assigned model/effort (items 2 & 5). See
docs/orchestration.md.
Do the work directly (no roster routing) only for trivial single-file edits, answering questions, or reading/reporting.
Definition of done & verify commands
Work is not "done" until its tier's verify passes and the outcome is reported — failures reported as failures, with actual output.
| Scope | Command |
|---|---|
| Contract | ddev contract-lint (Spectral in-container; see contract/README.md) |
| Backend | ddev composer verify (Pint check + PHPStan + artisan test; see backend/README.md) |
| Frontend | ddev frontend npm run verify (lint + typecheck + tests + build; see frontend/README.md) |
| Platform | ddev restart boots green; services respond (see infra/README.md) |
Plus, for any task: implementation conforms to the published contract version it claims to implement; no forbidden dependency edges introduced; relevant ADRs written or updated.
Frontend design quality (part of the frontend Definition of Done). Any frontend UI
work — building new screens or reshaping existing ones — applies the frontend-design
skill (.claude/skills/frontend-design/): a distinctive, subject-grounded visual point of
view (deliberate palette, typography, and one signature element) rather than templated
defaults, with copy treated as design material, all executed to the skill's quality floor
(responsive to mobile, visible keyboard focus, reduced motion respected). docs/ui-ux.md
is the normative design doc and encodes how the skill applies to this product; frontend UI
work follows it and updates it in the same task when it deviates. "Renders correctly and
passes verify" is necessary but not sufficient — it must also look intentional, not
templated. For interactive/visual changes the user's browser pass is part of
verification (see the working agreement above).
Environment & commands
Local runtime is DDEV-managed — a host-split topology (ADR-0010): the reader app at
https://publishing-platform.ddev.site, the API at
https://api.publishing-platform.ddev.site/v1 (production naming: bflo.sh /
api.bflo.sh). Operational runbook — start, publish, troubleshoot:
docs/runbook.md; topology source of truth: infra/README.md. Typical entry points:
| Task | Command |
|---|---|
| Start / restart | ddev start · ddev restart |
| Backend deps / Laravel | ddev composer <args> · ddev artisan <args> |
| Frontend | ddev frontend npm <args> |
| Force a content reindex + relay | ddev artisan content:reindex (scheduler ticks every minute anyway) |
| Lint contracts | ddev contract-lint |
| Shells | ddev psql · ddev redis-cli |
Canonical docs
Index and reading order: docs/README.md.
docs/architecture.md— tier model, backend layering, data flow, environmentsdocs/master-blueprint.md— the product design of record: the publishing platform applied to the tier model, incl. the delivery roadmap (§11)docs/team.md— roster, responsibilities, ownership map, roster-evolution processdocs/orchestration.md— agent-team orchestration, Workflow patterns, task/message protocoldocs/rules-of-engagement.md— contract-first mechanics, tier direction, arbitrationdocs/working-agreement.md— autonomy boundaries, version-control rules, verification hand-offsdocs/ui-ux.md— UI/UX definition + design system for the reader front-end (normative for all frontend work; applies the.claude/skills/frontend-design/skill)docs/runbook.md— how to start, run, and publish on the stack day to daydocs/how-it-works.md— end-to-end technical walkthrough (architecture + sequence diagrams)docs/adr/— architecture decision records (start fromadr/0000-template.md)