Two files, one repository
hashintel/hash ships 3 formats across 17 indexed files. The question worth asking is whether the second one says anything the first does not.
| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 14 | 4 | 0% |
| Commands | 0 | 25 | 3 | 0% |
| Section tags | 2 | 6 | 2 | 20% |
What each file covers
Sections
0 shared · 14 only in A · 4 only in B- − HASH Development Guide
- − Repository Structure and Navigation
- − Common Commands
- − Development
- − Starting Services
- − Testing
- − Linting and Fixing
- − For Specific Packages
- − For TypeScript/JavaScript packages
- − For Rust packages
- − Monorepo wiring for Rust crates
- − Documentation Maintenance
- − Petrinaut user-facing docs
- − Contextual Rules
- + Rust Review Rules
- + Language semantics reviewers commonly get wrong
- + Project conventions
- + What is worth flagging in Rust code here
Commands
0 shared · 25 only in A · 3 only in B- − turbo run <command> --filter '<package-name>'
- − cargo nextest run --package <package-name>
- − cargo test --package <package-name> --doc
- − cargo clippy --all-features --package <package-name>
- − mise run sync:turborepo
- − yarn dev
- − yarn dev:backend
- − yarn dev:backend:api
- − yarn dev:frontend
- − yarn start
- − yarn start:graph
- − yarn start:backend
- − yarn start:frontend
- − yarn start:worker
- − yarn test:unit
- − yarn test:integration
- − yarn lint
- − yarn lint:tsc
- − yarn lint:eslint
- − yarn lint:format
- − yarn fix:eslint
- − yarn fix:format
- − cargo-hack
- − cargo run --package hash-repo-chores --bin repo-chores-cli -- sync-turborepo
- − mise run fix:package-json
- + cargo
- + cargo nextest run --package <name>
- + cargo clippy --all-features --package <name>
Section tags
2 shared · 6 only in A · 2 only in B- − test
- − architecture
- − types
- − dependencies
- − monorepo
- − docs
- + code-style
- + git-pr
- lint-format
- do-not
Line diff
hashintel/hash · AGENTS.md
@@ −1 @@
1# HASH Development Guide
2
3## Repository Structure and Navigation
4
5The HASH repository is organized into several key directories:
6
7- `/apps` - Core applications powering HASH
8 - `/hash-api` - Backend API service
9 - `/hash-frontend` - Web frontend application
10 - `/hash-graph` - Graph database service
11 - `/hash-ai-worker-ts` - AI worker services
12 - `/hash-integration-worker` - Integration worker services
13
14- `/infra/compose` - Docker Compose stack for external services (Postgres, Kratos, Hydra, Temporal, observability)
15
16- `/blocks` - Block Protocol components (each subfolder contains a self-contained block)
17
18- `/libs` - Shared libraries and packages
19 - `/@blockprotocol` - Block Protocol related libraries
20 - `/@hashintel` - HASH-specific libraries
21 - `/@local` - Internal libraries for the monorepo
22 - Other core libraries (e.g., `error-stack`)
23
24- `/infra` - Deployment and infrastructure code
25 - `/docker` - Docker configurations
26 - `/terraform` - Terraform infrastructure as code
27
28- `/tests` - Test suites spanning multiple components
29
30**Navigation Tips:**
31
32- When exploring a new feature, first identify which app or lib it belongs to
33- Related code is typically co-located within the same directory
34- Check existing implementations before creating new ones
35- For understanding cross-component interactions, look for integration tests in `/tests`
36
37## Common Commands
38
39### Development
40
41- Main development: `yarn dev` (starts API and frontend)
42- Backend only: `yarn dev:backend` or `yarn dev:backend:api`
43- Frontend only: `yarn dev:frontend`
44
45### Starting Services
46
47- Start all services: `yarn start`
48- Start graph only: `yarn start:graph`
49- Start backend only: `yarn start:backend`
50- Start frontend only: `yarn start:frontend`
51- Start workers: `yarn start:worker`
52
53### Testing
54
55- Unit tests: `yarn test:unit`
56- Integration tests: `yarn test:integration`
57
58### Linting and Fixing
59
60- Lint everything: `yarn lint`
61- TypeScript type check: `yarn lint:tsc`
62- ESLint: `yarn lint:eslint`
63- Formatting check: `yarn lint:format`
64
65- Fix ESLint issues: `yarn fix:eslint`
66- Fix formatting: `yarn fix:format`
67
68### For Specific Packages
69
70When working on a specific package, use:
71
72```bash
73# For TypeScript/JavaScript packages
74turbo run <command> --filter '<package-name>'
75
76# For Rust packages
77cargo nextest run --package <package-name>
78cargo test --package <package-name> --doc # For doc tests
79cargo clippy --all-features --package <package-name>
80```
81
82For Rust packages, you can add features as needed with `--all-features`, specific features like `--features=foo,bar`, or use `cargo-hack` with `--feature-powerset` for comprehensive feature testing.
83
84### Monorepo wiring for Rust crates
85
86Each Rust crate has a `package.json` whose **identity and workspace-dependency wiring** — its `@rust/<name>` name, version, and the `dependencies` mirroring its `Cargo.toml` — is generated from `Cargo.toml`. After **adding, removing, or renaming a Rust crate**, or changing its `Cargo.toml` dependencies, re-sync that wiring:
87
88```bash
89mise run sync:turborepo # sync package.json identity + deps from Cargo.toml metadata
90```
91
92`sync:turborepo` only manages that generated wiring — the `scripts` section is hand-maintained and is used by CI and Turborepo (e.g. `test:unit`, `lint:clippy`, `doc:dependency-diagram`), so add or edit scripts by hand. The task wraps the `repo-chores` CLI; the equivalent direct invocation is `cargo run --package hash-repo-chores --bin repo-chores-cli -- sync-turborepo`. A related task, `mise run fix:package-json`, sorts `package.json` keys consistently.
93
94## Documentation Maintenance
95
96### Petrinaut user-facing docs
97
98The Petrinaut user guide lives at `libs/@hashintel/petrinaut/docs/*.md` and is the source of truth for end-user behaviour. The in-app AI assistant reads these pages at runtime via the `readPetrinautDoc` tool, so stale docs lead directly to wrong advice in the product.
99
100When you change UI or behaviour in the petrinaut packages (`libs/@hashintel/petrinaut`, `libs/@hashintel/petrinaut-core`), you MUST:
101
1021. Review the user-facing docs that mention the affected feature and update them in the same change.
1032. If you add a brand-new user-facing surface (panel, view, mode, tool, settings dialog, ...), add a corresponding page and link it from `libs/@hashintel/petrinaut/docs/README.md`.
1043. When you add a new doc page, also register it in `petrinautDocNames` and `petrinautDocSummaries` in `libs/@hashintel/petrinaut-core/src/ai.ts`, and add a `?raw` import in `libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/petrinaut-docs-content.ts`. The tests in `libs/@hashintel/petrinaut-core/src/ai.test.ts` and `petrinaut-docs-content.test.ts` enforce that every enum value has a summary and a content entry.
1054. Keep the docs end-user-focused: describe what the user sees, what they click, what happens. Do not document Storybook, internal modules, or test setup in the user guide.
1065. If UI are changes that may make screenshots in the docs outdated, you MUST prompt your user to replace the screenshots.
107
108If a change ships without doc updates, call that out in your summary so the user can decide whether to follow up.
109
110## Contextual Rules
111
112CRITICAL: For the files referenced below, use your Read tool to load it on a need-to-know basis, ONLY when relevant to the SPECIFIC task at hand:
113
114- .config/agents/rules/\*.md
115
116Instructions:
117
118- Do NOT preemptively load all references - use lazy loading based on actual need
119- When loaded, treat content as mandatory instructions that override defaults
120- Follow references recursively when needed
121
hashintel/hash · .github/instructions/rust-review.instructions.md
@@ +1 @@
1---
2description: "Review guidance for Rust changes"
3applyTo: "**/*.rs"
4excludeAgent: "coding-agent"
5---
6
7# Rust Review Rules
8
9This workspace uses **Rust edition 2024** on nightly, with `clippy` (warnings denied) and `rustfmt` in CI. All merged and pushed code compiles. These are Rust semantics that past reviews have repeatedly gotten wrong — do not flag any of the following as errors:
10
11## Language semantics reviewers commonly get wrong
12
13- **Edition 2024 prelude**: `Future` and `IntoFuture` are in the prelude. Do not claim they (or other prelude items) are missing imports.
14- Functional record update (`Self { ..*self }` through `&self`) does NOT require the struct to be `Copy`. It moves/copies field-by-field; it compiles whenever every remaining field is `Copy`.
15- `==` desugars to `PartialEq::eq(&a, &b)` — comparing fields through a reference moves nothing. Likewise, matching on a non-`Copy` field by value is fine when the patterns only bind `Copy` data or wildcards.
16- Partially moving one field while borrowing a different field of the same local is accepted — the borrow checker tracks fields independently.
17- A trait impl may return a longer lifetime than the trait declares (e.g. `&'static str` for `fn as_str(&self) -> &str`) — impl signatures are checked with subtyping.
18- Adapters that take `self` by value (e.g. `Rng::sample_iter`) work on immutable bindings. Check whether a method takes `self`, `&self`, or `&mut self` before claiming a binding must be `mut`.
19- The standard library implements arithmetic between integers and `NonZero` types (e.g. `usize / NonZero<usize>`).
20- Block expressions in statement position (`unsafe { ... }`, `if`, `match`, `loop`) do NOT need a trailing semicolon.
21- `str::strip_prefix`, `trim_matches`, and friends accept any `Pattern`, which includes `char` arrays/slices like `['n', 'N']`.
22
23If a comment of yours depends on the borrow checker, trait resolution, or the prelude rejecting code that is sitting in the diff with green CI, the comment is wrong — discard it.
24
25## Project conventions
26
27- Error handling uses `error-stack` (`Report`, `ReportSink`, `.change_context()`); suggest alternatives only within that framework.
28- Doc comments use intra-doc links; only flag a doc link if it points at a genuinely different item than the one being documented, not a re-export or moved path.
29- Prefer suggesting `cargo` tooling the repo uses: `cargo nextest run --package <name>`, `cargo clippy --all-features --package <name>`.
30
31## What is worth flagging in Rust code here
32
33- SQL built in Rust: missing `WHERE` conditions (e.g. draft/permission filters), missing `ORDER BY` when order feeds a deterministic contract, mispaired `unnest` arrays.
34- Serialization boundaries: values that serialize successfully in tests but fail on real data (e.g. `serde_json` rejects `NaN`/infinite floats), error types whose serialized form leaks internal or user data to clients.
35- Authorization: code paths that could return or leak data the actor cannot view.
36- Unbounded allocation or CPU driven by user-controlled request parameters.
37- Panics reachable from request handlers (`unwrap`, `expect`, indexing) on untrusted input.
38
@@ −1 +1 @@
1−# HASH Development Guide
1+---
2+description: "Review guidance for Rust changes"
3+applyTo: "**/*.rs"
4+excludeAgent: "coding-agent"
5+---
26
3−## Repository Structure and Navigation
7+# Rust Review Rules
48
5−The HASH repository is organized into several key directories:
9+This workspace uses **Rust edition 2024** on nightly, with `clippy` (warnings denied) and `rustfmt` in CI. All merged and pushed code compiles. These are Rust semantics that past reviews have repeatedly gotten wrong — do not flag any of the following as errors:
610
7−- `/apps` - Core applications powering HASH
8− - `/hash-api` - Backend API service
9− - `/hash-frontend` - Web frontend application
10− - `/hash-graph` - Graph database service
11− - `/hash-ai-worker-ts` - AI worker services
12− - `/hash-integration-worker` - Integration worker services
11+## Language semantics reviewers commonly get wrong
1312
14−- `/infra/compose` - Docker Compose stack for external services (Postgres, Kratos, Hydra, Temporal, observability)
13+- **Edition 2024 prelude**: `Future` and `IntoFuture` are in the prelude. Do not claim they (or other prelude items) are missing imports.
14+- Functional record update (`Self { ..*self }` through `&self`) does NOT require the struct to be `Copy`. It moves/copies field-by-field; it compiles whenever every remaining field is `Copy`.
15+- `==` desugars to `PartialEq::eq(&a, &b)` — comparing fields through a reference moves nothing. Likewise, matching on a non-`Copy` field by value is fine when the patterns only bind `Copy` data or wildcards.
16+- Partially moving one field while borrowing a different field of the same local is accepted — the borrow checker tracks fields independently.
17+- A trait impl may return a longer lifetime than the trait declares (e.g. `&'static str` for `fn as_str(&self) -> &str`) — impl signatures are checked with subtyping.
18+- Adapters that take `self` by value (e.g. `Rng::sample_iter`) work on immutable bindings. Check whether a method takes `self`, `&self`, or `&mut self` before claiming a binding must be `mut`.
19+- The standard library implements arithmetic between integers and `NonZero` types (e.g. `usize / NonZero<usize>`).
20+- Block expressions in statement position (`unsafe { ... }`, `if`, `match`, `loop`) do NOT need a trailing semicolon.
21+- `str::strip_prefix`, `trim_matches`, and friends accept any `Pattern`, which includes `char` arrays/slices like `['n', 'N']`.
1522
16−- `/blocks` - Block Protocol components (each subfolder contains a self-contained block)
23+If a comment of yours depends on the borrow checker, trait resolution, or the prelude rejecting code that is sitting in the diff with green CI, the comment is wrong — discard it.
1724
18−- `/libs` - Shared libraries and packages
19− - `/@blockprotocol` - Block Protocol related libraries
20− - `/@hashintel` - HASH-specific libraries
21− - `/@local` - Internal libraries for the monorepo
22− - Other core libraries (e.g., `error-stack`)
25+## Project conventions
2326
24−- `/infra` - Deployment and infrastructure code
25− - `/docker` - Docker configurations
26− - `/terraform` - Terraform infrastructure as code
27+- Error handling uses `error-stack` (`Report`, `ReportSink`, `.change_context()`); suggest alternatives only within that framework.
28+- Doc comments use intra-doc links; only flag a doc link if it points at a genuinely different item than the one being documented, not a re-export or moved path.
29+- Prefer suggesting `cargo` tooling the repo uses: `cargo nextest run --package <name>`, `cargo clippy --all-features --package <name>`.
2730
28−- `/tests` - Test suites spanning multiple components
31+## What is worth flagging in Rust code here
2932
30−**Navigation Tips:**
31−
32−- When exploring a new feature, first identify which app or lib it belongs to
33−- Related code is typically co-located within the same directory
34−- Check existing implementations before creating new ones
35−- For understanding cross-component interactions, look for integration tests in `/tests`
36−
37−## Common Commands
38−
39−### Development
40−
41−- Main development: `yarn dev` (starts API and frontend)
42−- Backend only: `yarn dev:backend` or `yarn dev:backend:api`
43−- Frontend only: `yarn dev:frontend`
44−
45−### Starting Services
46−
47−- Start all services: `yarn start`
48−- Start graph only: `yarn start:graph`
49−- Start backend only: `yarn start:backend`
50−- Start frontend only: `yarn start:frontend`
51−- Start workers: `yarn start:worker`
52−
53−### Testing
54−
55−- Unit tests: `yarn test:unit`
56−- Integration tests: `yarn test:integration`
57−
58−### Linting and Fixing
59−
60−- Lint everything: `yarn lint`
61−- TypeScript type check: `yarn lint:tsc`
62−- ESLint: `yarn lint:eslint`
63−- Formatting check: `yarn lint:format`
64−
65−- Fix ESLint issues: `yarn fix:eslint`
66−- Fix formatting: `yarn fix:format`
67−
68−### For Specific Packages
69−
70−When working on a specific package, use:
71−
72−```bash
73−# For TypeScript/JavaScript packages
74−turbo run <command> --filter '<package-name>'
75−
76−# For Rust packages
77−cargo nextest run --package <package-name>
78−cargo test --package <package-name> --doc # For doc tests
79−cargo clippy --all-features --package <package-name>
80−```
81−
82−For Rust packages, you can add features as needed with `--all-features`, specific features like `--features=foo,bar`, or use `cargo-hack` with `--feature-powerset` for comprehensive feature testing.
83−
84−### Monorepo wiring for Rust crates
85−
86−Each Rust crate has a `package.json` whose **identity and workspace-dependency wiring** — its `@rust/<name>` name, version, and the `dependencies` mirroring its `Cargo.toml` — is generated from `Cargo.toml`. After **adding, removing, or renaming a Rust crate**, or changing its `Cargo.toml` dependencies, re-sync that wiring:
87−
88−```bash
89−mise run sync:turborepo # sync package.json identity + deps from Cargo.toml metadata
90−```
91−
92−`sync:turborepo` only manages that generated wiring — the `scripts` section is hand-maintained and is used by CI and Turborepo (e.g. `test:unit`, `lint:clippy`, `doc:dependency-diagram`), so add or edit scripts by hand. The task wraps the `repo-chores` CLI; the equivalent direct invocation is `cargo run --package hash-repo-chores --bin repo-chores-cli -- sync-turborepo`. A related task, `mise run fix:package-json`, sorts `package.json` keys consistently.
93−
94−## Documentation Maintenance
95−
96−### Petrinaut user-facing docs
97−
98−The Petrinaut user guide lives at `libs/@hashintel/petrinaut/docs/*.md` and is the source of truth for end-user behaviour. The in-app AI assistant reads these pages at runtime via the `readPetrinautDoc` tool, so stale docs lead directly to wrong advice in the product.
99−
100−When you change UI or behaviour in the petrinaut packages (`libs/@hashintel/petrinaut`, `libs/@hashintel/petrinaut-core`), you MUST:
101−
102−1. Review the user-facing docs that mention the affected feature and update them in the same change.
103−2. If you add a brand-new user-facing surface (panel, view, mode, tool, settings dialog, ...), add a corresponding page and link it from `libs/@hashintel/petrinaut/docs/README.md`.
104−3. When you add a new doc page, also register it in `petrinautDocNames` and `petrinautDocSummaries` in `libs/@hashintel/petrinaut-core/src/ai.ts`, and add a `?raw` import in `libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/petrinaut-docs-content.ts`. The tests in `libs/@hashintel/petrinaut-core/src/ai.test.ts` and `petrinaut-docs-content.test.ts` enforce that every enum value has a summary and a content entry.
105−4. Keep the docs end-user-focused: describe what the user sees, what they click, what happens. Do not document Storybook, internal modules, or test setup in the user guide.
106−5. If UI are changes that may make screenshots in the docs outdated, you MUST prompt your user to replace the screenshots.
107−
108−If a change ships without doc updates, call that out in your summary so the user can decide whether to follow up.
109−
110−## Contextual Rules
111−
112−CRITICAL: For the files referenced below, use your Read tool to load it on a need-to-know basis, ONLY when relevant to the SPECIFIC task at hand:
113−
114−- .config/agents/rules/\*.md
115−
116−Instructions:
117−
118−- Do NOT preemptively load all references - use lazy loading based on actual need
119−- When loaded, treat content as mandatory instructions that override defaults
120−- Follow references recursively when needed
33+- SQL built in Rust: missing `WHERE` conditions (e.g. draft/permission filters), missing `ORDER BY` when order feeds a deterministic contract, mispaired `unnest` arrays.
34+- Serialization boundaries: values that serialize successfully in tests but fail on real data (e.g. `serde_json` rejects `NaN`/infinite floats), error types whose serialized form leaks internal or user data to clients.
35+- Authorization: code paths that could return or leak data the actor cannot view.
36+- Unbounded allocation or CPU driven by user-controlled request parameters.
37+- Panics reachable from request handlers (`unwrap`, `expect`, indexing) on untrusted input.
12138
