Harness Intelligence Wiki
SpecsCLIEntities Layer Model

Entities Layer Model

Spec: Entities Layer Model

Context

The frontend-domain-structure skill defines Modules as shared domain code and Integrations as the owner of mock runtimes. The CTO review of devpunks-intelligence PR #79 showed the result: business providers in Composition, layouts inside page folders, route.tsx importing its own index, domain code in modules/, and domain data sources in integrations/. The user accepted that feedback (Q16).

This spec adds a repository-like Entity layer below Feature, makes Module business-agnostic, restricts Integration to third-party adapters, defines Composition as global providers, proxy and routing, and enforces it in the frontend-layers plugin. The ci-solution-structure package tiers take the same words. One Registry Baseline ships the change. devpunks-intelligence, emera-platform and apito adopt it, one open pull request each. Canonical terms: glossary.

Non-Goals

  • A warn transition for the new rules (Q41).
  • A local plugin-copy stopgap in any consumer (Q42).
  • Restating the app layer model in ci-solution-structure (Q43).
  • Stricter lint presets in devpunks-intelligence workspaces (Q48).
  • A lint check for product terms in Modules (Q24).
  • Renaming pages/ (Q5).
  • Adopting the Baseline in ci-emera, ci-assolombarda or pegasus.

Requirements and Outcomes

OUT-001: The skill teaches the entities layer model

frontend-domain-structure states the order app | routes → composition → features → entities → modules → integrations → ui, the Composition shape, the Feature, Entity, Module, Integration and Data Source meanings, the import rules and a migration map. Every text that restates the model agrees.

Architecture: OUT-001, ARC-001, ARC-004.

OUT-002: Lint enforces the model

The frontend-layers plugin implements exactly the skill's rule table, ships in the react-frontend-layers asset as error, and consumers' formatters leave the copied plugins unchanged.

Architecture: OUT-002, ARC-002, ARC-003.

OUT-003: Package tiers use the same words

ci-solution-structure names packages/entities and agnostic packages/modules, retires foundation, carries a migration note, and ships in @collective-intelligence/lint 0.2.0, which HI pins.

Architecture: OUT-003, ARC-005.

OUT-004: One Registry Baseline carries the change

A published Registry Baseline contains the synced skill texts, the plugin, the asset, the oxfmt merge and the 0.2.0 package skill, with a BASELINE_CHANGELOG.md entry that links the migration map.

Architecture: OUT-004, ARC-006, FLOW-001.

OUT-005: devpunks-intelligence adopts the Baseline in PR #79

PR #79 carries the new Baseline, the shared @devpunks/oxlint-config package for every workspace, and the Recruiter Portal restructure.

Architecture: OUT-005, ARC-007, ARC-008, FLOW-003.

OUT-006: emera-platform and apito adopt the Baseline

Each repository has one open pull request that installs the new Baseline and migrates its frontend layout (and, for emera-platform, its package tiers).

Architecture: OUT-006, ARC-009, ARC-010.

Acceptance Criteria

  • AC-001: structure.md lists the layers app/routes, composition, features, entities, modules, integrations, ui in that rank, and defines Composition as providers/, proxy/, routing/ with routing/{index.ts,access/,shells/<name>/,pages/<page>/}.
    • Covers: OUT-001
    • Architecture: AC-001
  • AC-002: The skill defines Entity (contract, port, CRUD/query, providers, remote/{index,server}.ts, simulated/, views/), Feature (combines Entities, owns providers), Module (no product terms, as a review rule) and Integration (third-party only), and states that only Composition and tests import remote/ and simulated/.
    • Covers: OUT-001
    • Architecture: AC-002
  • AC-003: references/migration.md maps modules/<domain> → entities/<entity>, composition/<surface>/{shell,pages} → composition/routing/{shells,pages}, mock folders → */simulated, and SKILL.md points to it when such folders exist.
    • Covers: OUT-001
    • Architecture: AC-003
  • AC-004: create-plan/references/architecture-convergence.md, implement-spec/references/architecture-conformance.md, hi-cli/references/managed-lint.md, ask-hi/references/discovery-and-docs.md, the HI wiki pages skill-packs.mdx, skill-reference.mdx, hooks.mdx and the catalog description in apps/cli/src/data/catalog/lint.ts state the new order and terms.
    • Covers: OUT-001
    • Architecture: AC-004
  • AC-005: skill-parity.test.ts passes with the 14 rule ids layer-order, route-imports, no-peer-feature, no-peer-entity, public-entrypoint, data-source-imports, index-reexports-only, no-self-index-import, layout-placement, composition-shape, no-prefix-siblings, no-prototype-folder, known-top-level, ui-placement.
    • Covers: OUT-002
    • Architecture: AC-005
  • AC-006: For each rule, frontend-layers.test.ts has a fixture that reports the violation and a clean fixture that passes, including: server/ imported from entities/*/remote/ passes and from features/<f>/components fails; a client import of remote/server.ts passes public-entrypoint; a *.test.ts file is exempt from data-source-imports and no-self-index-import only.
    • Covers: OUT-002
    • Architecture: AC-006
  • AC-007: hi update in a repository with .oxfmtrc.json adds **/tools/oxlint/** to its ignorePatterns once; in a repository without it, the report names the pattern and no formatter file is created.
    • Covers: OUT-002
    • Architecture: AC-007
  • AC-008: The react-frontend-layers asset sets every rule in AC-005 to "error".
    • Covers: OUT-002
    • Architecture: AC-008
  • AC-009: ci-solution-structure names tiers organization, features, entities, modules, tooling with tags tier:entities and tier:modules, states the Modules no-product-terms invariant, and has a migration note for tier:foundation and the old tier:modules; README and CHANGELOG.md agree; test:pack passes.
    • Covers: OUT-003
    • Architecture: AC-009
  • AC-010: npm @collective-intelligence/lint@0.2.0 is published and HI collectiveIntelligenceLintVersion equals "0.2.0" with the synced skill byte-equal to the package.
    • Covers: OUT-003
    • Architecture: AC-010
  • AC-011: The Registry root registry.json names a new latest Baseline whose readback matches the build, and BASELINE_CHANGELOG.md for it names the sync tag, lint 0.2.0 and the migration map link.
    • Covers: OUT-004
    • Architecture: AC-011
  • AC-012: In PR #79, hi check --json reports current at the new Baseline and managed lint, type-check, tests and build of the Recruiter Portal pass.
    • Covers: OUT-005
    • Architecture: AC-012
  • AC-013: In PR #79, every workspace lint script uses its oxlint.config.ts, each imports @devpunks/oxlint-config/<subpath> by package name, pnpm-workspace.yaml has a catalog with oxlint and @oxlint/plugins at 1.90.0, the effective rules per workspace equal the pre-change JSON chain, and no ci-solution/package-entrypoint finding remains.
    • Covers: OUT-005
    • Architecture: AC-013
  • AC-014: In PR #79, the Recruiter Portal tree matches the mapping in the architecture (entities candidate, challenge, interview, vocabulary; features access, candidate/{cv,database,intake}, interview/{assignment,summaries}, challenge, vocabulary, dashboard, active-search; composition/{providers,proxy,routing}; modules/async; integrations/{ci,document}), and the recruiter-portal-architecture-quality ARCHITECTURE.md marks ARC-003 and ARC-004 superseded by this spec.
    • Covers: OUT-005
    • Architecture: AC-014
  • AC-015: emera-platform has one open PR where hi check --json reports current, packages/foundation/* became packages/modules/*, packages/modules/* became packages/entities/*, tier tags, turbo.json boundaries and tools/boundaries/boundaries.test.ts use the new names, and its lint, type-check and tests pass or each remaining failure is reported in the PR.
    • Covers: OUT-006
    • Architecture: AC-015
  • AC-016: apito has one open PR where hi check --json reports current and its frontend layout passes the new frontend-layers rules, or each remaining finding is listed in the PR.
    • Covers: OUT-006
    • Architecture: AC-016

Spec Invariants

INVRuleSource (Q anchor)FormPatternSeamModel
INV-001Each layer imports only lower layers.Q1, Q19examplenonefrontend-layers layer-order on fixture treesnone
INV-002No Feature imports a Feature; no Entity imports an Entity.Q9examplenoneno-peer-feature, no-peer-entitynone
INV-003Only Composition and tests import a Data Source.Q10, Q23examplenonedata-source-importsnone
INV-004A remote/ Data Source exposes browser code through index.ts and server code through server.ts.Q50examplenonepublic-entrypoint; build of a client importing server.tsnone
INV-005An index file only re-exports.Q11examplenoneindex-reexports-onlynone

Constraints

  • Rule text and rule ids change together; skill-parity.test.ts is the gate (Q26).
  • Consumers start only after the Registry publishes the Baseline (Q46, Q52).
  • Upstream pull requests merge as soon as their checks pass; each consumer gets exactly one open pull request for review (Q51, Q52).
  • The Recruiter Portal keeps its behavior; the restructure moves code and changes no user flow (Q46).

Dependency Readiness

Ready.

  • wearedevpunks/skills base origin/main@173064678783ce7d7593d749590e29448cf4fe7f.
  • collective-intelligence-platform/ci-app base origin/main@5bad70fcc605a305f68b3954ced10cb5a6498e0b; release .github/workflows/release-npm-packages.yml (workflow_dispatch, bump minor).
  • wearedevpunks/harness-intelligence base origin/main@886966be7 with this spec on team/stefan/entities-layer-model; Baseline release by .github/workflows/release.yml on main when BASELINE_CHANGELOG.md changes.
  • Consumers depend on the published Baseline (OUT-004).

Branch/Base Intent

Touched RepositoryBranchBaseConstraintEvidence
wearedevpunks/skillsteam/stefan/entities-layer-modelmainMerge when green; then tag sync/entities-layer-model-<sha12> on the merge commitQ52
collective-intelligence-platform/ci-appteam/stefan/entities-layer-modelmainMerge when green; then release 0.2.0Q29, Q52
wearedevpunks/harness-intelligenceteam/stefan/entities-layer-model (this branch)mainMerge when green after skills tag and lint 0.2.0; merge publishes the BaselineQ52, S9
wearedevpunks/devpunks-intelligencecodex/active-search-recruiter-portal-followup (PR #79)developLeave open for reviewQ46, Q51
collective-intelligence-solutions/emera-platformteam/stefan/entities-layer-modelmainLeave open for reviewQ51, Q52
Collective-Intelligence-Solutions/apitoteam/stefan/entities-layer-modelmainLeave open for reviewQ51, Q52

Architecture Source

Accepted Technical Decisions

  • Rule set, ranks and test predicate: architecture "Modules and Interfaces" rule table (Q26, Q27, Q50).
  • Data Source subpaths remote/ (index.ts browser-safe, server.ts with import "server-only") and simulated/ (Q44, Q50).
  • Only entities/*/remote/, features/*/remote/ and app/api/ import server/ (Q10, Q26).
  • oxfmt: managed JSON merge of **/tools/oxlint/** into an existing .oxfmtrc.json only (Q28, Q49).
  • ci-app: one PR updates the skill, README, CHANGELOG.md, references/enforcement.md; minor release to 0.2.0 (Q29).
  • @devpunks/oxlint-config (packages/oxlint-config, tooling tier): subpaths ./repository, ./backend, ./frontend, ./packages, ./infra; peer oxlint; catalog oxlint and @oxlint/plugins 1.90.0; dormant ultracite/anti-slop oxlint.config.ts content deleted; app/backend/extensions keeps ./tools/oxlint/imports.mjs (Q25, Q40, Q48).
  • Recruiter Portal mapping: architecture ARC-008 table (Q14–Q16, Q31–Q39).

Accepted Testing Decisions

  • Plugin rules: real oxlint on fixture trees in frontend-layers.test.ts, one report case and one accept case per rule; parity by skill-parity.test.ts.
  • oxfmt merge: installer test against a temporary repository with and without .oxfmtrc.json.
  • Consumers: managed lint, type-check, tests and build of each touched workspace; the Recruiter Portal's existing behavior tests prove the restructure preserves behavior.

Verification Seams

  • frontend-layers plugin through the oxlint CLI.
  • hi update / hi check --json against the local or published Registry.
  • Registry readback at https://api.harness-intelligence.devpunks.com/r.
  • Consumer workspace scripts (lint, type-check, test, build).

Decision Log

DecisionEvidenceRationale
Entities layer, agnostic ModulesQ1, Q7, Q8Features were too broad; Composition too high
remote/ instead of api/Q44api/ means the HttpApiGroup contract in packages
One PR per consumer; upstream merges when greenQ51, Q52User review on 2026-11-02

On this page