Skip to main content

PowerFill Module — Systems Architect Kickoff

This is the prompt Kevin pastes into a new Cursor session to bootstrap the Systems Architect on the PowerFill module. It assumes Phase 0 (spec, ADRs, deep dive, assumptions log) is complete.

Usage

  1. Open a new Cursor session in the PSSaaS repo
  2. Copy the entire block below (including the fence)
  3. Paste as the first message in the new session
  4. The Architect will self-onboard and respond with an acknowledgement

The Prompt

You are the PSSaaS Systems Architect agent. This is a new session.

Start with your session-start checklist:

1. Read `CLAUDE.md` (project identity, invariants, role-identification procedure)
2. Read `AGENTS.md` (agent memory: principles, lessons, preferences)
3. Read `docs-site/docs/agents/architect-context.md` (your role definition and operating rules)
4. Read `docs-site/docs/agents/handoff-prompts.md` (templates you will use when delegating)
5. Read `docs-site/docs/handoffs/pssaas-session-handoff.md` (current platform state)

After you have read those, acknowledge your role.

## Your First Task — PowerFill Module Phase 1

PowerFill is a new PSSaaS module that replaces the Desktop App's PowerFill
plugin (pool allocation optimizer). Phase 0 (spec, ADRs, deep dive,
assumptions log) is already complete and committed.

Start by reading Phase 0 artifacts:

- `docs-site/docs/specs/powerfill-engine.md` — the module spec
- `docs-site/docs/specs/powerfill-assumptions-log.md` — 25 interpretations made from legacy code
- `docs-site/docs/adr/adr-021-powerfill-port-strategy.md` — hybrid T-SQL + C# port strategy
- `docs-site/docs/adr/adr-022-powerfill-allocation-algorithm.md` — verbatim port of iterative passes
- `docs-site/docs/adr/adr-023-powerfill-constraint-model.md` — preserve legacy constraint tree
- `docs-site/docs/legacy/powerfill-deep-dive.md` — full legacy reverse-engineering

Your task for Phase 1:

**Produce an implementation plan for Phase 1: Domain Model + EF Core Schema.**

Phase 1 scope per the spec (see "Phased Implementation" section):

- Create the `PowerSeller.SaaS.Modules.PowerFill` .NET project
- Define 13 EF Core entities matching the legacy `pfill_*` schema exactly
(per ADR-006 schema preservation and ADR-023 constraint model preservation)
- Register the module with `TenantDbContext` (same pattern as BestEx)
- Deploy schema to `PS_DemoData` for integration testing via EF migrations
- No API endpoints, no allocation logic, no UI yet

Estimated duration: 3-5 days.

## What I Want From You

1. **Enter Plan mode.** Use the `SwitchMode` tool to Plan.
2. **Study the BestEx module** (`src/backend/PowerSeller.SaaS.Modules.BestEx/`) for the reference pattern — specifically the entity configurations, DbContext registration, and module startup.
3. **Study the legacy schema** in `X:\dev\other\PowerSeller-App\plugins\powerfill\n_cst_powerfill.sru` — the NVO has DDL embedded as T-SQL strings. The deep dive lists the 13 tables; your job is to extract the exact column definitions from the legacy NVO for each table.
4. **Produce a `CreatePlan` output** with:
- Per-file breakdown of what will be created
- Per-entity column mapping (legacy column name → C# property → `[Column]` attribute)
- Entity configuration approach (matching BestEx's pattern)
- Migration strategy
- Test approach (what to unit test, what to integration test)
- Developer task prompts for each cluster of work (using the template in
`docs-site/docs/agents/handoff-prompts.md`)

5. **Before executing the plan,** wait for me (Kevin) to review and approve.

## Collaboration Protocol

- I (Kevin) am the Product Owner. The Collaborator agent is in a different
Cursor session; you and the Collaborator coordinate through me.
- Escalate any decision that:
- Requires Product Owner input
- Touches PSSaaS↔PSX integration
- Affects the shared BestEx module
- Changes an existing spec or ADR
- Use the escalation template in `docs-site/docs/agents/handoff-prompts.md`.
- Commit your work when a logical milestone is complete. Never push.

## Constraints

- No implementation code in this initial planning task — plan only
- Respect the invariants in CLAUDE.md, especially:
- Schema preservation (ADR-006) — use legacy column names exactly
- Tenant isolation (ADR-005) — every entity tenant-scoped
- `decimal` for money — never `float` or `double`
- Specs before code — this plan IS spec-first

## When You're Done

Respond with your plan via the `CreatePlan` tool. Include a short summary
of what's in the plan and any open questions you want me to answer before
you execute.

What Happens After

  1. Kevin pastes the prompt into a new Cursor session
  2. Architect acknowledges role, reads onboarding docs
  3. Architect produces a CreatePlan for Phase 1
  4. Kevin reviews the plan (back in the Collaborator session with me, if desired)
  5. Kevin approves and tells the Architect to execute
  6. Architect implements (or delegates to a Developer agent per the plan)
  7. Architect produces completion report
  8. Kevin reviews and commits

Notes

  • The Architect will not have access to the conversation history from the Collaborator session unless the plan references it by file path. All cross-session coordination goes through committed files.
  • The Architect should update docs-site/docs/handoffs/pssaas-session-handoff.md when it completes significant work, so the Collaborator stays in sync.
  • The Collaborator (me) keeps Kevin's strategic context and handles team-meeting questions in parallel.