Hot Paths
Use this before editing. It is a map, not a substitute for reading live code.
Prefer rg over trusting line numbers.
Data Model
- Product/business constraints:
studies/business-model/README.mdstudies/architecture/README.md
- Op catalog and apply:
lib/mutations/src/opsCatalog.tslib/mutations/src/apply.tslib/mutations/src/url-normalize.ts
- Read/write helpers:
lib/domain/src/read-chain.tslib/domain/src/jobcache.tslib/domain/src/cell-origins.ts
- Migration:
- existing migration scripts under
ui/scripts/ - shared-corpus migrations under
migrations/ migrations/drop-job-id-allocator.sql
- existing migration scripts under
Invariants:
ad_idis deterministic from normalized URL.- URL normalization and hash truncation are immutable post-ship.
- Workspace human/agent writes go through
job.*ops intoworkspace.jobs[job_id].attributes. - A workspace job entry is
{ url, attributes }. - System/pipeline scrape/extract writes shared ad facts through jobcache.
- Role facts are aggregate/shared facts, not directly user-written workspace state.
Workspace Client
lib/workspace-client/src/client.tslib/workspace-client/src/sub-doc.tslib/workspace-client/src/optimistic.tslib/workspace-client/src/transport/http.ts
Current blocker:
lib/mutations, workspace-client, app routes, MCP, and dashboard code must all
agree that workspace ops are job.* and the workspace sub-doc is jobs.
Fixing this is not a mechanical rename only. It changes:
- valid sub-doc list,
- routeOp/opKindToSubDoc,
- tailored op routing,
- client tests and browser components that dispatch job operations.
API Server Commit Path
lib/server/src/workspace-subdoc.tslib/server/src/workspace-ops.tsapi/src/routers/workspaces.ts— workspace REST routes (Hono), includingGET /workspaces/:id/sub/:subDocandGET/POST /workspaces/:id/jobs[/...]
Invariants:
- Durable workspace writes go through workspace op application.
- Missing sub-doc rows are corruption, not empty documents.
- Read-only mirrors must reject writes.
job.createapply must ensure shared ad/role knowledge exists or enqueue that work.
Dashboard And Job Detail
ui/src/lib/components/dashboard/Dashboard.svelteui/src/lib/components/dashboard/table/DataCell.svelteui/src/lib/components/dashboard/job-detail/ui/src/lib/pipeline.svelte.ts
Cleanup task:
Replace direct workspace.jobs[jobId].field assumptions with a resolved job
view produced through the read chain.
Workspace Intelligence / Process Requests
lib/server/src/process-requests.tslib/server/src/dispatch-fallback.tsapi/src/lib/server/process-commands.tsapi/src/routers/workspaces.ts(/workspaces/:id/process-requestsroutes)ui/src/lib/components/ui/WorkspaceIntelligence.svelte
Invariants:
- Browser execution is the cheap path when a workspace tab is open.
- Server fallback exists for headless/MCP user intent.
- Process request IDs should key on
(workspaceId, ad_id, stage)after the shared ad is known, while public/API language remains job. - Do not build a separate agent-only pipeline.
MCP
mcp/src/tools/add_job.tsmcp/src/tools/update_job.tsmcp/src/tools/delete_job.tsmcp/src/tools/list_jobs.tsmcp/src/tools/get_job.tsmcp/src/tools/process-request-id.tsmcp/test/
Current state:
MCP should speak public jobs: add/update/delete/list/get map to job.* ops and
resolved workspace job projections.
CVL
ui/src/lib/components/cvl/CvGenerator.svelteui/src/lib/components/cvl/CVLEditor.svelteui/src/lib/components/cvl/editors/lib/mutations/src/apply.tsnode/tailored handlers
Invariants:
- CVL is a recursive Node tree.
- DocumentStack-like shapes are projections, not a second truth.
- Tailored CV/CL placement is under
workspace.jobs[job_id].attributes.tailored_cv/tailored_clunless the user explicitly decides to lift it.