living-architecture
AGENTS.md139 starsChanged 3 months agoApache-2.0View on GitHub
⚠️ NEW WORKTREE? Run pnpm install --frozen-lockfile before running tests or verification. Extract software architecture from code as living documentation, using Riviere schema for flow-based (not structural) architecture Read @docs/project/project-overview.md then check @docs/project/PRD/*/PRD.md for the current PRD. For planning, discovery, PRD, architecture, delivery planning, or future-project discussion, read @project-memory/AGENTS.md and apply the project memory rules for deferred work. Current packages: - packages/living-documentation/domain-model - Living documentation architecture model and comparison - packages/living-documentation/use-cases - Architecture summary and pull request architecture diff queries…
- Installs packages
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- project-memory/AGENTS.mdAGENTS.md
- analyze-sessionSkill
- dddSkill
- role-check-and-lint-error-remediationSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
30 rules. About 2 are common, 10 are distinctive, and 18 are very specific to this project.
≈2
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 7
Read @docs/project/project-overview.md then check @docs/project/PRD/*/PRD.md for the current PRD.
- Very specific: line 50
All code must follow ADR-002 and the executable rules in .riviere/role-enforcement.config.ts.
- Distinctive: line 52
Use domain terminology from the contextive definitions.
- Very specific: line 54
When discussing domain concepts, clarify terminology with the user.
- Very specific: line 60
Always use nx commands for build, test, lint.
- Distinctive: line 98
After generating a new project:
- Very specific: line 99
Update the project's package.json with the correct published package name
- Very specific: line 100
Create the 3-file tsconfig structure (tsconfig.json, tsconfig.lib.json, tsconfig.spec.json)
- Very specific: line 101
Add vitest.config.ts if tests are needed with 100% coverage as the default
- Very specific: line 102
If importing from another project, add its published package name with "workspace:*" to dependencies
- Very specific: line 103
Run pnpm nx sync to update TypeScript project references
- Distinctive: line 104
Update this AGENTS.md "Current packages" section
- Very specific: line 110
Maintainer workflow: when working as part of the maintainer team, follow docs/workflow/task-workflow.md from start to finish.
- Distinctive: line 121
When writing, editing, refactoring, or reviewing code:
- Very specific: line 124
look for standard implementation patterns defined in docs/conventions/standard-patterns.md
- Very specific: line 137
Never run role-check through tail otherwise you will not see the exact failure reason and will waste time reading files.
- Very specific: line 143
All UI and UX design must conform to global brand guidelines: /docs/brand/ (logo, colors, typography, icons)
- Common: line 147
Never commit secrets, API keys, or credentials
- Distinctive: line 148
Use environment variables for sensitive configuration
- Common: line 149
Do not log sensitive data (passwords, tokens, PII)
- Very specific: line 154
Use generators: - Don't manually create project folders.
- Very specific: line 155
Run
pnpm nx sync: - After modifying tsconfig references or adding dependencies between projects. - Very specific: line 156
Debugging stale cache: - If something seems stale, run pnpm nx reset to clear the cache.
- Very specific: line 165
When a bundled package (e.g., riviere-extract-config) gets released, NX automatically triggers a patch bump for riviere-cli
- Distinctive: line 167
Only packages within the release group are updated (not external dependencies)
- Distinctive: line 180
Process before fix: - When you encounter a problem, improve the process/tooling first, then apply the fix.
- Distinctive: line 185
When in doubt, use judgment: obvious fixes → proceed.
- Very specific: line 188
Cross-project imports: use package names (e.g., import { X } from '@living-architecture/[pkg-name]'), not relative paths.
- Distinctive: line 190
Browser debugging: - When building new UI features or debugging browser issues, use Chrome MCP tools instead of guessing from code …
- Distinctive: line 202
Always strive for exhaustive type safety.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
living-architecture
⚠️ NEW WORKTREE? Run
pnpm install --frozen-lockfilebefore running tests or verification.
Extract software architecture from code as living documentation, using Riviere schema for flow-based (not structural) architecture
Read @docs/project/project-overview.md then check @docs/project/PRD/*/PRD.md for the current PRD.
For planning, discovery, PRD, architecture, delivery planning, or future-project discussion, read @project-memory/AGENTS.md and apply the project memory rules for deferred work.
Monorepo Structure
apps/ - Applications that aggregate subdomain use cases
packages/ - Subdomains split into domain-model, use-cases, and published-language packages
tools/ - Standalone app packages; their subdomain packages live under packages/Current packages:
packages/living-documentation/domain-model- Living documentation architecture model and comparisonpackages/living-documentation/use-cases- Architecture summary and pull request architecture diff queriespackages/dev-workflow-v2/domain-model- Maintainer workflow domain modelpackages/dev-workflow-v2/use-cases- Maintainer workflow commands and adapterspackages/riviere-builder/domain-model- Browser-safe graph construction and querying domain modelpackages/riviere-builder/use-cases- Commands, queries and data access for graph building and queryingpackages/riviere-schema/published-language- Rivière graph contractpackages/riviere-extract-config/published-language- Extraction config contractpackages/riviere-extract-conventions/published-language- Annotations and ESLint integration for extraction conventionspackages/riviere-extract-ts/domain-model- TypeScript extraction domain model using ts-morphpackages/riviere-extract-ts/use-cases- TypeScript extraction commands and data accesspackages/riviere-role-enforcement/domain-model- Role-enforcement domain model and Oxlint pluginpackages/riviere-role-enforcement/use-cases- Role-enforcement command, repository, adapter and external clients
Apps:
apps/cli- CLI entrypoints and composition shellapps/eclair- Web app for viewing your software architecture via a Rivière schemaapps/docs- Living architecture documentation website
Tools:
tools/dev-workflow-v2- Maintainer workflow app and plugin entrypointstools/living-documentation- CLI for generating architecture summaries and pull request architecture diffs
Key documents:
docs/project/PRD/- Current PRD foldersproject-memory/- Cross-PRD planning memory for deferred ideas, priorities, and future-work contextdocs/architecture/overview.md- System designdocs/architecture/domain-terminology/contextive/definitions.glossary.ymldocs/architecture/adr/- Decision records
All code must follow ADR-002 and the executable rules in .riviere/role-enforcement.config.ts. Keep those two files aligned.
Use domain terminology from the contextive definitions. Do not invent new terms or use technical jargon when domain terminology exists.
When discussing domain concepts, clarify terminology with the user. Add new terms to docs/architecture/domain-terminology/contextive/definitions.glossary.yml.
Commands
Build & Test
Always use nx commands for build, test, lint. Don't try to run directly e.g. pnpm vitest ...
# All projects
pnpm nx run-many -t build
# Specific project
pnpm nx lint [project-name]Single Test File
pnpm nx test [project-name] -- --testNamePattern "should validate"Verify (Full Gate)
pnpm verifyDependency Graph
pnpm nx graphAdding New Projects
# Add backend application
pnpm nx g @nx/node:application apps/[app-name]
# Add a subdomain package
pnpm nx g @nx/js:library packages/[subdomain]/[domain-model|use-cases|published-language] --publishable --importPath=@living-architecture/[package-name]After generating a new project:
- Update the project's package.json with the correct published package name
- Create the 3-file tsconfig structure (tsconfig.json, tsconfig.lib.json, tsconfig.spec.json)
- Add vitest.config.ts if tests are needed with 100% coverage as the default
- If importing from another project, add its published package name with
"workspace:*"to dependencies - Run
pnpm nx syncto update TypeScript project references - Update this AGENTS.md "Current packages" section
Task Workflow
There are two contribution workflows. Team membership determines the workflow, not the agent provider or harness being used.
- Maintainer workflow: when working as part of the maintainer team, follow
docs/workflow/task-workflow.mdfrom start to finish. Maintainers can create GitHub issues and usedev-workflow-v2to run the full planning and implementation lifecycle. - External contribution workflow: anyone not explicitly working as part of the maintainer team follows
CONTRIBUTING.md. This is a lightweight pull-request workflow. Do not create a GitHub issue and do not attempt to use or install the maintainer harness. The pull request description is the specification for the change.
Testing
Follow docs/conventions/testing.md.
100% test coverage is mandatory and enforced.
Code Conventions
When writing, editing, refactoring, or reviewing code:
- always follow
docs/conventions/software-design.md - look for standard implementation patterns defined in
docs/conventions/standard-patterns.md - avoid
docs/conventions/anti-patterns.md
CRUCIAL: If you see any code that is not aligned with our conventions, always fix it. Quality code aligned with our conventions is always the top priority. Far more important than rushing to finish a new feature.
Role Enforcement
Enforced packages require /** @riviere-role <role-name> */ on every exported declaration. Before writing code in an enforced package, read .riviere/role-enforcement.config.ts and .riviere/role-selection-guide.md.
Quick check: pnpm nx lint <package-name>
IMPORTANT: when role-enforcement or lint fail, run this skill: .agents/skills/role-check-and-lint-error-remediation/SKILL.md
Never run role-check through tail otherwise you will not see the exact failure reason and will waste time reading files.
docs/factory/agent-efficiency-report.md is auto-generated by the factory, you must commit it whenever it changes.
Brand Identity, theme, design, UI, UX
All UI and UX design must conform to global brand guidelines: /docs/brand/ (logo, colors, typography, icons)
Security
- Never commit secrets, API keys, or credentials
- Use environment variables for sensitive configuration
- Do not log sensitive data (passwords, tokens, PII)
- Validate and sanitize all external input
NX Guidelines
- Use generators - Don't manually create project folders. Use
pnpm nx g @nx/js:libraryorpnpm nx g @nx/node:application. - Run
pnpm nx sync- After modifying tsconfig references or adding dependencies between projects. - Debugging stale cache - If something seems stale, run
pnpm nx resetto clear the cache.
Release Strategy
Bundled Package Updates
The CLI (riviere-cli) bundles several packages via esbuild. To ensure users always get the latest bundled content, we use NX's updateDependents: "auto" configuration.
How it works:
- When a bundled package (e.g.,
riviere-extract-config) gets released, NX automatically triggers a patch bump forriviere-cli - This ensures CLI users receive updated schemas and features without manual intervention
- Only packages within the release group are updated (not external dependencies)
Example:
riviere-extract-configv0.2.0 → v0.2.1 (bug fix or feature)- NX detects that
riviere-clibundlesriviere-extract-config riviere-cliv0.7.16 → v0.7.17 automatically (with latest config schema bundled)
Configuration: See nx.json release.version section, updateDependents: "auto" field.
Reference: Follows the same pattern as employee-management repo. For details, see NX updateDependents docs.
General Guidelines
- Process before fix - When you encounter a problem, improve the process/tooling first, then apply the fix. This ensures the same issue won't recur and benefits future work. Never just fix the symptom without addressing the root cause.
- Maintainer workflow operations - Maintainers use the scripts and
dev-workflow-v2commands documented indocs/workflow/task-workflow.md. Directgit add/git commitis fine;git pushandgh prare blocked by maintainer harness hooks. External contributors instead followCONTRIBUTING.mdand raise their pull request normally. - Command failures vs code quality issues:
- Command failures (script doesn't exist, tool errors, missing dependencies) → STOP and consult with user
- Code quality issues (lint errors, unused dependencies, test failures, knip warnings) → fix them directly
- When in doubt, use judgment: obvious fixes → proceed; non-obvious → ask
- Do not modify root configuration files (eslint.config.mjs, tsconfig.base.json, nx.json, vite.config, vitest.config.mts). If you believe a change is genuinely necessary, provide the suggested changes and ask the user.
- Do not use
--no-verify,--force, or--hardflags. These are blocked by hooks and will fail. All commits must pass theverifygate. - Cross-project imports use package names (e.g.,
import { X } from '@living-architecture/[pkg-name]'), not relative paths. - Adding dependencies between projects requires adding
"@living-architecture/[pkg-name]": "workspace:*"to the consuming project's package.json. - Browser debugging - When building new UI features or debugging browser issues, use Chrome MCP tools instead of guessing from code inspection.
If you are not explicitly working as part of the maintainer team, read and follow @CONTRIBUTING.md. That public contribution guide replaces the Maintainer Workflow in @CLAUDE.md. Do not create an issue or install the maintainer harness; make the change and raise a pull request whose description is the specification.
For planning, discovery, PRD, architecture, delivery planning, or future-project discussion, also read and follow @project-memory/AGENTS.md.
For domain modelling or architecture questions, start with the generated current model at @docs/architecture/ddd/domain-guide.md. Use it to locate the relevant subdomains, aggregates, use cases, and operations, then inspect their code and tests before drawing conclusions.
DOMAIN concepts must be modelled honestly. Do not compromise the design with a misleading name just to make role check pass.
Domain model code must not use the TypeScript in operator. This includes using in to distinguish union members, such as 'fromClassName' in rule. Model these values as explicit discriminated unions and match them exhaustively instead.
Always strive for exhaustive type safety. Match closed unions exhaustively, and make the compiler reject every new, removed, or renamed member until all consumers handle the change. Never duplicate published language member names in unchecked string literals.
Coverage workarounds are forbidden without explicit user approval. This includes coverage ignore directives, coverage exclusions, reduced coverage thresholds, and unreachable branches added only to satisfy coverage tooling. Cover real behaviour with tests or restructure the code so the unreachable branch does not exist.
When running the Codex workflow command in a non-interactive shell, set CI=true. The workflow command runs pnpm dependency checks, and pnpm otherwise tries to remove node_modules through a TTY prompt. In the Codex sandbox, use external execution permission if tsx cannot create its temporary IPC socket.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

