Harness Intelligence Wiki
Grilling

Entities Layer Model Brainstorm Brief

Entities Layer Model Brainstorm Brief

Context

  • Source: user /brainstorm session, 2026-10-30, T3 thread on devpunks-intelligence PR #79, after CTO review feedback on that PR.
  • CTO feedback: review of wearedevpunks/devpunks-intelligence#79, meeting transcript https://notes.granola.ai/t/fb4de828-5c61-4a6c-bda1-1a5cf6850d19. The user accepted the feedback: "yes thats right. feedback is right".
  • The closed Frontend Composition Layer grill (PR #272) defined the current model app → composition → features → modules → integrations. This topic supersedes parts of it.

Bounded System And Operators

The system is the frontend layer model and its enforcement across four repositories:

RepositoryOwned part
wearedevpunks/skillsfrontend-domain-structure skill text (skills/agnostic/frontend/frontend-domain-structure/)
wearedevpunks/harness-intelligencefrontend-layers Oxlint plugin (apps/cli/src/data/lint/frontend-layers/), its skill-parity test, the react-frontend-layers lint asset, the npm-synced ci-solution-structure copy
collective-intelligence-platform/ci-appci-solution-structure skill and @collective-intelligence/lint (packages/public/lint/)
wearedevpunks/devpunks-intelligenceRecruiter Portal restructure (PR #79) and a shared Oxlint config package for every workspace

Operators: developers and agents that place frontend code, reviewers (human and agent) that check placement, and the CTO and team that accept the folder structure. Team process for the portal structure: Manuel posts the proposed structure in chat, Simone validates it, Stefan commits it.

Problem

Evidence from devpunks-intelligence@5971a9ab (app/frontend/recruiter-portal/src/):

  • composition/providers/ mixes global setup with business providers: portal-root.tsx SharedCandidates patches hiring_status when hrStatus === "HR OK"; active-search-providers.tsx and cv-workspace-providers.tsx each serve one route group. InterviewAssignmentProviders has no consumer.
  • composition/portal/pages/active-search/layout.tsx and pages/cv-workspace/layout.tsx are layouts inside page folders.
  • 13 route.tsx files import ./index; about 25 index.ts(x) files hold implementation; the largest are features/challenges/views/*/index.tsx (390, 319, 155 non-export lines).
  • modules/ mixes agnostic code (form, navigation-guard, react-instance, session, theme) with domain code (candidates, developer-options, interview-assignments).
  • integrations/ mixes third-party adapters (ci-runtime, the pdf-lib and html-to-image export in candidate-cv) with domain data sources, server bridges (candidate-access, interview-api, portal-server) and simulated runtimes.
  • Folder names repeat a prefix: integrations/candidate-{access,challenges,cv,data,database,intake}, features/candidate-{access,cv,database,intake}.
  • candidate-access is not about candidates: it is portal access for all roles (candidate, hr, manager, tech; server/features/candidate-access/model/policy.ts).
  • composition/portal/architecture.test.ts checks server and protocol isolation, browser storage, Backoffice isolation and route gating. It does not check the layer layout; tools/oxlint/frontend-layers/index.mjs does.
  • The installed skill texts call Modules a shared domain capability (frontend-domain-structure references/structure.md; ci-solution-structure tiers: modules = "a domain capability that several features need", foundation = generic machinery).
  • The ci-solution/package-entrypoint rule reports 2 findings in the portal's oxlint.local.ts: relative imports of ../../../.oxlintrc.json and ../.oxlintrc.json. Other workspaces reach the same files through JSON extends and --config ../.oxlintrc.json scripts, which the rule does not see. Oxlint 1.87 .oxlintrc.json extends accepts only relative file paths; a package name fails with NotFound (tested 2026-10-30).

Accepted Shape

Layers

  1. Layer order: app → composition → features → entities → modules → integrations. Each layer imports only lower layers. server/ stays outside the layers.
  2. Every layer is split by domain. Each domain's index exports its common primitives (providers, hooks, components, ports). Higher layers combine lower ones through dependency injection and composition.
  3. composition/ contains:
    • providers/: global root providers only (CI runtime and QueryClient, mock-session retention, Toaster).
    • proxy/.
    • routing/ (was portal/): index.ts, access/, shells/<name>/, pages/<page>/.
  4. A layout file exists only in routing/shells/<name>/, one layout per folder, with only the files it governs. A shell combines feature providers with the data sources that composition selects.
  5. A page folder holds index.ts (re-export only), route.tsx and the page template at its root. Other components and hooks go in components/ and hooks/ only when needed. One folder per route: the six flat files in pages/challenges/ split. pages/ keeps its name.
  6. features/<capability>/ combines several entities into one user-facing capability. A feature owns its workflow, policy, state and providers. It takes its dependencies as inputs.
  7. entities/<entity>/ is repository-like, one folder per business entity: contract, port, CRUD and query machinery, entity providers, data sources in api/ and simulated/ subpaths, and entity-bound UI in views/ (pickers, badges, formatters).
  8. modules/ is business-agnostic: it carries no product terms.
  9. integrations/ holds third-party adapters only (CI SDK runtime, pdf-lib, html-to-image, LogRocket-style).

Rules

  1. A feature never imports another feature. An entity never imports another entity. Logic that spans two entities lives in a feature.
  2. Code that is not a clear single-entity concern is a feature. Code that combines several entities is a feature.
  3. Only composition/ and tests import */api/ and */simulated/ data sources. Features and entity views use the entity root.
  4. Only entities/*/api/, features/*/api/ and app/api/ import server/.
  5. A cross-domain import targets a domain index or a subpath index (@/entities/candidate/cv). Subpaths of one domain import each other freely.
  6. An index file only re-exports. Production code never imports its own folder's ./index; tests may.
  7. No repeated name prefix: one domain folder with subpaths (entities/candidate/cv, not candidate-cv).
  8. Folders named simulated/ replace mock* folders.

Recruiter Portal mapping

  1. entities/candidate/ (with cv/, intake/, options/ from developer-options, views/), entities/challenge/ (templates, authoring, review), entities/interview/ (assignment read contract, projection, booking).
  2. features/candidate/ with cv/, database/, intake/; features/access/ (role policy, flow catalog, access screens, sidebar, api/ for session and gate); active-search and interview-summaries stay features.
  3. The SharedCandidates sync moves into a feature; the portal shell wires it. Feature-scoped providers move into their features. InterviewAssignmentProviders is deleted.
  4. integrations/portal-server splits: readSession, requestPath and checkAccess to features/access/api; readInterviewSnapshot and readInterviewScope to entities/interview/api; getRuntime to integrations/ci.

Enforcement and skills

  1. The frontend-domain-structure skill text and the frontend-layers plugin carry the new model and rules. Until the Registry ships them, the portal's local plugin copy enforces them.
  2. The ci-solution-structure package tiers follow the same names: packages/entities/<name> for entity repositories, packages/modules/<name> for agnostic code; foundation is retired.
  3. A shared Oxlint config package in devpunks-intelligence holds the root and frontend policies. Every workspace moves to an oxlint.config.ts that imports it by package name. This clears the 2 ci-solution/package-entrypoint findings.
  4. The decisions supersede devpunks-intelligence ARC-003 and ARC-004 (apps/wiki/content/docs/project/specs/hr/recruiter-portal-architecture-quality/ARCHITECTURE.md).

Rejected Shapes

  • Low-level layer named bridge: implies middleware or adapter semantics (CTO feedback).
  • Atomic design names (atoms, molecules): UI-specific (CTO feedback).
  • modules/ as the domain layer with a new foundation/ for agnostic code: user stated modules are agnostic.
  • Layer name kernel/: replaced by entities/ once the layer became per-entity and repository-like.
  • repositories/, models/, data/: repositories excludes the providers and views; models clashes with feature model/ subfolders; data is too generic.
  • All adapters, real or simulated, in integrations/; later integrations/simulated/<entity>: replaced by api/ and simulated/ subpaths inside each entity.
  • integrations/api/ for the app's own API: the user moved api/ out of integrations.
  • Entities that import other entities, or only their types.
  • Cross-entity sync logic placed in an entity (entities/interview patching candidates).
  • A shared common domain per layer: needs a peer-import exception.
  • features/candidate/access: access is portal access, not a candidate concern.
  • Mandatory empty components/ and hooks/ in every page folder.
  • Renaming pages/ to page-templates/: not selected.
  • Tests banned from importing ./index: tests exercise the public entry.
  • Enforcement in architecture.test.ts only, or no enforcement until the upstream release.
  • Package tiers that keep modules/foundation with a documented mapping: the same word would mean opposite things one level apart.
  • Inlining the shared lint policies, or exporting .oxlintrc.json from the root dp-ai package.

User-Stated Preferences

  • "modules is meant to be business-agnostic tho."
  • "yes thats right. feedback is right"
  • "what we meant is providers inside composition should be global root providers. not providers from certain features etc..."
  • "this new lower level folder layer could. below features/ but business aware"
  • "overall the idea is that we should persist domain based split. features can have providers."
  • "we must abstract by dependency and composition, so that each layer can have its common primitives exported"
  • "fix it" (on: other workspaces reach the shared lint policy through relative paths the rule does not check)
  • "keep in mind that we picture kernel/ to be kinda like repository/ in backend code."
  • "fatures/ was too broad since it could technically include wiring machinery for entities crud etc... whereas composition/ was too higher level"
  • "features can combine kernels into proper single features. eg: hr feature includes developers an salaries entity domains"
  • "repetition of prefix-* is bad. no [...] candidate-challenges/ candidate-cv/ just one [...] candidate/ with subpaths"
  • "candidate entity" (on: developer-options)
  • "i guess theyre features if theyre not a clear kernel for one entity. if they combine multiple entities theyre a feature"
  • "we use integrations for 3rd party data. also api data for the actual app. simulated seems fitting in there"
  • "mhh actually in this case i guess /api is out of integrations. kernel handles api/ and simulated/"
  • "if not business entity why not in /features?"
  • "only thing, lets rename kernel" → entities/
  • "ok this is agreed. well done we reached a good state."
  • "no actually this is a new grill that touches ci-app harness-intelligence and this repo here"
  • "yeah grill should probably live in harness-intelligence"

Open Forks

  1. Feature-owned data sources (features/access/api): do features/*/api and features/*/simulated follow the same names and import rule as entities? Proposed default: yes.
  2. modules/ agnostic check: product terms cannot be detected by import rank. Proposed default: rank rules in lint; the agnostic test stays a review rule in the skill.
  3. Lint tooling package name and location. Proposed default: packages/oxlint-config, @devpunks/oxlint-config, subpath exports ./repository and ./frontend.
  4. Existing CI solutions with tier:modules and tier:foundation tags. Proposed default: the tier rename ships with a migration note in the ci-solution-structure enforcement reference and a minor version of @collective-intelligence/lint.
  5. Lint rule set for the new rules (entity rank, peer-entity ban, data source import rule, index re-export only, no non-test ./index import, layout placement, simulated/ naming). Proposed default: all of them in frontend-layers, with the skill-parity test updated.
  6. Canonical glossary for Entity, Feature, Module, Integration, Data Source, Shell and Page Template. Proposed default: pin them in this grill.
  7. File-by-file moves for active-search, interview-summaries and challenges. Proposed default: decided at L3 in this grill from code evidence.

Evidence Anchors

  • devpunks-intelligence@5971a9ab: app/frontend/recruiter-portal/src/composition/providers/portal-root.tsx (SharedCandidates), composition/providers/index.tsx, composition/portal/index.ts, composition/portal/architecture.test.ts, composition/portal/pages/*/route.tsx, app/frontend/recruiter-portal/tools/oxlint/frontend-layers/index.mjs, app/frontend/recruiter-portal/oxlint.local.ts, server/features/candidate-access/model/policy.ts, integrations/portal-server/index.ts.
  • devpunks-intelligence accepted architecture: apps/wiki/content/docs/project/specs/hr/recruiter-portal-architecture-quality/ARCHITECTURE.md ARC-003, ARC-004 (grill Q10, Q15).
  • wearedevpunks/skills@1730646: skills/agnostic/frontend/frontend-domain-structure/{SKILL.md,references/structure.md,references/react/structure.md}.
  • harness-intelligence@886966be7: apps/cli/src/data/lint/frontend-layers/{index.mjs,frontend-layers.test.ts,skill-parity.test.ts}, apps/cli/skills/npm/collective-intelligence-lint/ci-solution-structure/.
  • ci-app@5b906d6ed5: packages/public/lint/{src/index.ts,src/rule.ts,skills/ci-solution-structure/SKILL.md}.
  • Oxlint 1.87.0 configuration_schema.json properties.extends: JSON extends entries are paths relative to the config file.

On this page