specs / 002-monorepo-refactor/data-model

Data Model: Monorepo Refactor

Feature: 002-monorepo-refactor Date: 2026-01-09


Overview

This refactoring does not introduce new data entities. It reorganizes existing code and configuration. This document describes the file/directory structure as the “data model” for this refactoring.


Directory Entities

1. Workspace Package

A self-contained package with its own configuration and dependencies.

AttributeTypeDescription
namestringPackage name in package.json or pyproject.toml
pathstringLocation under packages/ directory
typeenumnode or python
config_filestringpackage.json or pyproject.toml

Instances:

  • packages/web (Node.js - Next.js/Nextra)
  • packages/resume-review (Python - LangGraph agents)

2. Resume Source

The canonical resume content file.

AttributeTypeDescription
pathstringresume/resume-ja.qmd
formatstringQuarto Markdown
outputslistPDF, HTML generated to resume/output/

Relationship: Resume Source → Resume Output (1:N)

3. Resume Output

Generated artifacts from resume source.

AttributeTypeDescription
pathstringresume/output/{format}
formatenumpdf, html
sourcereferenceLink to Resume Source

4. Workflow Module

A Python module containing workflow logic.

AttributeTypeDescription
pathstringLocation under workflow/ directory
responsibilitystringSingle concern (state, nodes, conditions, graph, runner)
max_linesint≤200 lines

Instances:

  • workflow/state.py - State schema
  • workflow/nodes/supervisor.py - Supervisor node
  • workflow/nodes/aggregator.py - Aggregator node
  • workflow/nodes/revisor.py - Revisor node
  • workflow/nodes/portfolio.py - Portfolio node
  • workflow/conditions.py - Edge conditions
  • workflow/graph.py - Graph builder
  • workflow/runner.py - Workflow class

Configuration Entities

5. Config Module

Centralized configuration for the resume-review package.

AttributeTypeDescription
pathstringconfig/{name}.py
content_typeenumsettings, prompts, weights

Instances:

  • config/settings.py - API keys, thresholds, paths
  • config/prompts.py - System prompts for agents
  • config/weights.py - Scoring weights

File Migration Map

Files Moving

Current PathNew PathNotes
public/assets/resume-ja.qmdresume/resume-ja.qmdCanonical source
resume.pdf (root)resume/output/resume-ja.pdfGenerated output
components/packages/web/components/React components
pages/packages/web/pages/Next.js pages
styles/packages/web/styles/CSS
next.config.mjspackages/web/next.config.mjsNext.js config
theme.config.tsxpackages/web/theme.config.tsxNextra theme
tailwind.config.jspackages/web/tailwind.config.jsTailwind config
tsconfig.jsonpackages/web/tsconfig.jsonTypeScript config
middleware.tspackages/web/middleware.tsNext.js middleware
agents/packages/resume-review/Python package
agents/src/orchestration/packages/resume-review/src/workflow/Renamed

Files Created

New PathPurpose
packages/web/package.jsonWeb package config
resume/output/Output directory
packages/resume-review/src/workflow/nodes/Node modules
packages/resume-review/src/workflow/conditions.pyEdge conditions
packages/resume-review/src/workflow/graph.pyGraph builder
packages/resume-review/src/workflow/runner.pyWorkflow class
packages/resume-review/src/config/Configuration modules

Files Updated

PathChanges
package.json (root)Remove web deps, add workspace scripts
pnpm-workspace.yamlAdd packages/web to packages list
scripts/sync_qmd_to_mdx.pyUpdate paths
CLAUDE.mdUpdate paths in commands

State Transitions

Migration Phases

Phase 1: Create Directories
├── mkdir packages/
├── mkdir packages/web/
├── mkdir resume/
└── mkdir resume/output/

Phase 2: Move Web Package
├── mv components/ → packages/web/
├── mv pages/ → packages/web/
├── mv styles/ → packages/web/
├── mv *.config.* → packages/web/
├── Create packages/web/package.json
└── Update pnpm-workspace.yaml

Phase 3: Move Resume Source
├── mv public/assets/resume-ja.qmd → resume/
├── mv resume.pdf → resume/output/
└── Update build scripts

Phase 4: Move Python Package
├── mv agents/ → packages/resume-review/
└── Update root scripts

Phase 5: Refactor Workflow
├── Rename orchestration/ → workflow/
├── Split workflow.py → nodes/, conditions.py, graph.py, runner.py
├── Create config/
└── Update imports

Phase 6: Verification
├── Run tests
├── Start web dev server
├── Generate PDF
└── Run review command

Validation Rules

Workspace Package Validation

  • Each package under packages/ MUST have a valid config file
  • Node.js packages MUST have package.json
  • Python packages MUST have pyproject.toml
  • All packages MUST be recognized by their respective tooling

Workflow Module Validation

  • No file in workflow/ directory MAY exceed 200 lines
  • All existing tests MUST pass after migration
  • No circular imports MUST exist between modules
  • Import flow MUST be: state → nodes/conditions → graph → runner

Resume Source Validation

  • resume/resume-ja.qmd MUST exist
  • resume/output/ MUST be creatable by build scripts
  • Generated files MUST appear in resume/output/