Skip to the lesson
CivOps AI Academy · M20Projects, Jobs and Tasks: Portfolio, Schedule, Cost and Earned Value as Governed Records
0%

Chapter 1 · Sessions 1 and 2

What the old tool holds, and the tables that replace it

First you write down which projects you run, how work is requested and decided, and what the project tool costs, from its own pages and your invoices. Then one prompt adds the module's fourteen tables to your Foundation schema with the rules that keep a schedule honest, and you load a small network worked by hand as a test fixture and made-up projects as the seed.

25 min3 stepsSessions 1–2about 7 hours hands-on across six sessions

By the end of this chapter you can

  • Inventory the projects, the request route and the tool's bill from real pages, never from memory.
  • Have Claude Code check the spine and write the fourteen prj_ tables, with money as integer cents and links as rows, in one tested pull request.
  • Keep the hand-worked schedule and earned value as a fixture, and the made-up seed shifted onto today.

What this module replaces

The module plans and controls improvement, new product introduction, shutdown and capital projects: intake and portfolio scoring, a work breakdown with all four dependency types and a critical path, baselines and slip, resources and timesheets, budgets with purchase order commitments and earned value, the RAID log, punch lists and status reports. Its specification names the tools it replaces: Smartsheet, Asana, monday.com, Microsoft Project, Wrike, ClickUp and Jira for work management, and Oracle Primavera P6 and Procore for capital projects [1]. PMI's PMBOK Guide and ISO 21502 give the vocabulary a project manager already uses [2][3].

CapabilityTierBuilt in these six sessions
WBS and scheduling: four dependency types with lag, critical pathMVPYes
Views: Gantt, board, list, calendar, portfolio timelineMVPYes; the Gantt is a list on a phone
RAID and decisionsMVPYes
Intake and portfolio scoringSTDYes
Baselines and variance, slip alertsSTDYes
Resources and timesheets with approvalSTDYes
Budgets, commitments from POs, forecastSTDYes; commitments read from M12, or entered from real POs
Punch lists, status reportsSTDYes; an AI-drafted summary is optional and always approved by a person
Templates (kaizen, CAPEX, NPI, shutdown, IT)STDWritten down; optional extension
Earned value snapshotsBICYes: required in this course
Step 1

Session 1: Inventory your projects and the tool, from its own pages

60 minutes

Why

Replacing a project tool only makes sense if you know what it holds, who uses it and what it costs. Writing the inventory from the tool's own lists and your invoices gives Session 6 something real to compare against, and choosing one project to move first keeps the build anchored to work people do, not a demo.

Do this

Ask the tool's administrator for an hour with the project list, the user list and the billing page open. If your "tool" is a spreadsheet or a whiteboard, treat it as the tool and answer the same questions.

Terminal or PowerShell
cd ~/code/acme-platform && git switch main && git pull && claude
Paste into Claude Code
On a new branch projects/inventory, create docs/projects-inventory.md as an empty form for me to fill in from our current project tool. Do not invent any figure, price, date or count: every cell starts as "not yet read".

Sections, each a table:
1. Open projects: code, name, type (capex, improvement, kaizen, npi, it, shutdown, customer, regulatory), stage (proposed, approved, planning, executing, on hold, closing, closed), manager, sponsor.
2. How work is requested and decided today: the route (email, form, meeting), who decides, on what criteria, and any scoring used.
3. The tool: name, plan, users who sign in, yearly or monthly bill, renewal date, notice period, source (invoice or account page, with its date).
4. What the tool does for each capability: dependency types it allows (FS only, or SS, FF, SF too, with lag), whether it shows a critical path, whether it saves baselines, whether budgets show commitments from purchase orders, timesheets and who approves them, RAID log, punch lists, status reports.
5. The export: format (CSV or XML), which columns it holds (task, outline level, start, finish, duration, predecessors, assignee, percent complete), and three examples of how it writes a predecessor.
6. Workarounds people use today.
7. The first project to move, why, and its manager.

Add a line at the top: "Every number here comes from the tool's own pages or our invoices. Never estimate." Open a pull request titled "Projects inventory" and show me the link. I will fill it in on GitHub.

Fill it in on GitHub with the administrator. Export one small project into a private folder outside the repository to fill in section 5, then delete the file.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/projects-inventory.md)
+Every number here comes from the tool's own pages or our invoices. Never estimate.
+## 4. What the tool does
+| Capability | Today | Where seen |
+| Dependency types allowed | not yet read | not yet read |
1
⏺ Pull request #90 adds the empty inventory form with seven sections. I have not filled in any value.2
Claude Code writes the form and stops. Every value is yours to read from the tool.
  1. Section 4 is where the module's three pitfalls show: FS only, no baseline, budgets without commitments.
  2. Empty on purpose. Refuse "typical" values.

You will see recreated screen

projects-export.csv
1
IDTaskDurationStartFinishPredecessors
1Design3dMon 05/01Wed 07/01
2Order and receive2dThu 08/01Fri 09/011
3Install4dThu 08/01Tue 13/011FS+0d
4Test2dWed 14/01Thu 15/012,3SS+1d
The old tool's export of one project, opened in a spreadsheet: the predecessor column is text each tool writes its own way.
  1. Write three examples like these in section 5. Session 5's import reads them, and a guess here becomes a wrong link there.

Check it worked

Pull request Projects inventory has every section filled in, each figure with its source, the bill and renewal date from an invoice, three predecessor examples copied from a real export, and the first project chosen with its manager. Owner two approves; merge.

Fastest path

Fill sections 3 and 4 with the administrator in one screen-shared sitting; both need pages only they can open.

If it goes wrong

Claude Code filled in typical figures

Say: Replace every value you wrote with "not yet read". I fill these in from our own tool and invoices.

The tool cannot export dependencies

Write that down: Session 5 then re-enters the links by hand for the first project only, and the module's own Gantt becomes the record from then on.

Nobody knows the bill

Write who can find it (finance) and ask for the last invoice. Never use the vendor's list price: your contract may differ.

The fourteen tables

Every table carries the standard columns id, site_id, created_at, created_by, updated_at, updated_by, row_version, archived_at and ext, and points at the tables docs/spine-map.md maps the spine names onto (core_person, core_site, core_calendar, core_equipment, core_party, core_attachment) instead of keeping its own lists. site_id takes the place of the specification's tenant_id, so each table keeps one simple access rule. Money is stored as integer cents (the Foundation rule, so a total is always exactly the sum of its parts), converted only on screen; the ratios SPI and CPI stay decimal. An arrow is a foreign key; soft link is a plain uuid that names another module's row without a foreign key.

The fourteen project tablesFive groups: intake has prj_portfolio and prj_request; plan has prj_project, prj_task, prj_dependency and prj_baseline; people and time has prj_assignment and prj_time_entry; money has prj_budget_line, prj_commitment and prj_evm_snapshot; control has prj_raid_item, prj_status_report and prj_punch_item. Intakeprj_portfolioprj_requestPlanprj_projectprj_taskprj_dependencyprj_baselinePeople and timeprj_assignmentprj_time_entryMoneyprj_budget_lineprj_commitmentprj_evm_snapshotControlprj_raid_itemprj_status_reportprj_punch_itemEvery table also carries the standard columns and points at core_person, core_site and core_calendar.
The fourteen tables in five groups: intake, plan, people and time, money, and control.
TableHoldsColumns (req = required)
prj_portfolioA portfolio with its scoring modelname req, unique per site; owner_id → core_person; scoring_model json
prj_requestAn intake requestrequest_no req, unique per site; title req; problem_statement; benefits json; est_cost, est_benefit (cents); scores json; total_score num; requested_by → core_person req; status req (submitted, under_review, approved, rejected, converted); decided_by; project_id → prj_project
prj_projectA projectcode req, unique per site; name req; portfolio_id; project_type req (capex, improvement, kaizen, npi, it, shutdown, customer, regulatory); status req (proposed, approved, planning, executing, on_hold, closing, closed, cancelled); gate (idea, define, plan, execute, close); sponsor_id; manager_id req; start_date, finish_date, baseline_finish; health (green, amber, red); budget_total (cents); currency; calendar_id → core_calendar
prj_taskA WBS element with its CPM resultsproject_id req; parent_id → prj_task; wbs_code req; name req; task_type req (task, milestone, summary, gate); duration_days; start_at, finish_at; early_start, early_finish, late_start, late_finish; total_float_days; is_critical; percent_complete; assignee_id; status req (not_started, in_progress, blocked, done, cancelled); effort_hours
prj_dependencyA link with type and lagpredecessor_id req; successor_id req; dep_type req (fs, ss, ff, sf); lag_days
prj_baselineA saved plan, never editedproject_id req; name req; captured_at req; data json req
prj_assignmentA person on a tasktask_id req; person_id req; units_pct req; planned_hours; actual_hours
prj_time_entryA timesheet entryperson_id req; project_id req; task_id; work_date req; hours req; billable; status req (draft, submitted, approved, rejected); approved_by
prj_budget_lineBudget by cost codeproject_id req; cost_code req; category req (equipment, installation, engineering, construction, validation, contingency, internal_labor, software, other); budget_amount req; committed_amount; actual_amount; forecast_amount (all cents)
prj_commitmentAn amount promised on a purchase orderproject_id req; budget_line_id; po_ref soft link to inv_purchase_order; vendor_party_id → core_party; amount req (cents); committed_at
prj_raid_itemRisk, assumption, issue, decision, dependency or changeproject_id req; raid_type req; title req; description; probability int; impact int; score int; owner_id; due_at; response; status req (open, monitoring, closed)
prj_status_reportA periodic report, fixed once publishedproject_id req; period_end req; health req; summary req; accomplishments; next_steps; risks_summary; author_id; published_at
prj_punch_itemA defect to fix before handoverproject_id req; equipment_id → core_equipment; description req; category req (a, b, c); raised_by; assigned_to; due_at; status req (open, in_progress, ready_to_verify, closed); photo_attachment_id → core_attachment; closed_at
prj_evm_snapshotAn earned value reading, insert onlyproject_id req; as_of req; pv, ev, ac (cents); spi, cpi num; eac, vac (cents)
Step 2

Session 2: Check the spine, then write the fourteen tables and their tests

40 minutes

Why

The module relies on spine tables a stamping-plant Foundation may not have yet (a working calendar, suppliers, approvals, signatures). Checking first and adding them in their own migration keeps the module's migration small. Writing the rules the specification leaves to you (no self-links, links within one project, money in whole cents, baselines that never change) as database rules with tests means every screen and import keeps them, and the schema check rebuilds the lot from nothing before it merges.

Do this

Paste into Claude Code
Read docs/naming-standard.md, docs/SCHEMA-PLAN.md and every file in supabase/migrations. Change nothing yet.

Tell me which of our tables or functions plays each of these roles, and which are missing: core_person (with email), core_site, core_calendar (code, name, site_id, timezone, holidays; the working week kept in ext.work_week), core_job_role, core_equipment, core_party, core_attachment, core_comment, core_approval (owner_type, owner_id, step_no, role_required, approver_id, decision, decided_at, comment, signature_id), core_e_signature, core_action_item, core_notification, core_event_outbox, core_status_history, core_number_sequence (entity_key, prefix, next_value, padding), core_audit_log with core_audit_row(), core_touch_row() and core_block_mutation() (refuses update and delete). Where our Foundation tables already hold the same thing (sites, parts, lots, equipment, memberships), map the core_ name onto them; never a copy.

Then, on a new branch spine/projects: add a section "M20 Projects" to the one shared docs/spine-map.md (create it if no module has yet; never a separate projects map): each core_ name and our table for it, and that the prj_ tables carry site_id (→ sites) in place of the specification's tenant_id. If anything is missing, one migration (npx supabase migration new spine_for_projects) with only the missing pieces, row-level security on and forced with no policies, and pgTAP tests in supabase/tests/core.test.sql. Push, open a pull request titled "Spine for projects", wait for every check, report in plain words, and stop.

When the spine is on main, paste the table list from this page into the next prompt where it says:

Paste into Claude Code, then paste the table from this page where it says
On a new branch projects/tables:

1. Create docs/prj-tables.md from the table list I paste below, exactly as written, and docs/projects-rules.md listing every rule in point 3.
2. Run npx supabase migration new projects_tables and write all fourteen prj_ tables, following docs/naming-standard.md: the standard columns in docs/spine-map.md (site_id not null references sites, indexed, never tenant_id); timestamps as timestamptz; required means not null; allowed values are check constraints; foreign keys only to the tables docs/spine-map.md names, to sites and to each other; po_ref a plain uuid with no foreign key. Money columns (est_cost, est_benefit, budget_total, budget_amount, committed_amount, actual_amount, forecast_amount, prj_commitment.amount, pv, ev, ac, eac, vac) are bigint cents; spi and cpi numeric.
3. Rules: prj_portfolio.name, request_no and code unique per site, numbers from core_number_sequence through a security definer function with set search_path = ''; wbs_code unique within a project; a task never depends on itself; the same pair and type stored once; both ends of a link in the same project (a trigger); percent_complete 0–100; units_pct above 0; hours above 0 and at most 24 per entry; probability and impact 1–5.
4. Guards as triggers: a saved prj_baseline changes only archived_at; a prj_status_report with published_at set changes only archived_at; prj_evm_snapshot uses core_block_mutation() (insert only); a row with archived_at set refuses any update; core_audit_row() and core_touch_row() on every table. Row-level security on and forced on every table, no policies yet.
5. Add the fourteen tables to docs/matrix.json with empty cells.
6. pgTAP tests in supabase/tests/projects.test.sql: every table exists with row-level security forced; a project type outside the list, a task with no project, a self-link, a link across two projects, a budget with decimals and an update of a saved baseline are each refused; a published report refuses an edit; an EVM snapshot refuses an update.
7. Do not connect to any Supabase project.

Push, open a pull request titled "Projects tables", wait for every check, and report in plain words with the test counts. If a check fails, fix it and wait again.

The table list:
<paste the table "The fourteen tables" from element M20 here>

You will see recreated screen

claude — acme-platform
⏺ Bash(npx supabase migration new projects_tables)
⎿ Created new migration at supabase/migrations/20261109090000_projects_tables.sql
1
⏺ Write(supabase/migrations/20261109090000_projects_tables.sql)
+create table public.prj_dependency (
+ ...,
+ dep_type text not null check (dep_type in ('fs','ss','ff','sf')),
+ lag_days numeric not null default 0,
+ constraint no_self_link check (predecessor_id <> successor_id)
+);
2
⏺ Bash(gh pr checks --watch)
⎿ schema / test pass 2m18s ci / build pass clamps pass
⏺ Pull request #92 is green. 14 tables, money in whole cents, row-level security forced with no policies. 52 tests passed, 14 of them refusals: a link across two projects, a self-link, a budget of 6,000.50 cents and an edit of a saved baseline are all refused.3
The migration, the rules and the tests in one pull request; Claude Code reports only after GitHub's checks.
  1. Its timestamp puts it after the spine migration.
  2. A link is a row with a type and a lag: all four types, from the first table.
  3. Check the counts in the pull request's checks tab, not only here.

Check it worked

The M20 section is in docs/spine-map.md on main. Pull request Projects tables is green on its latest commit; docs/projects-rules.md lists every rule; owner two approves; merge, and the deploy workflow applies it to production.

Fastest path

Paste the table list into the prompt instead of describing the tables: allowed values and money types come through exactly, and the review is a comparison, not a rewrite.

If it goes wrong

Claude Code adds tenant_id, or puts the spine mapping in docs/prj-tables.md

Say: The prj_ tables carry site_id, never tenant_id, and the mapping lives only in the M20 section of docs/spine-map.md.

Money columns came out as numeric(14,4)

The specification's own DDL uses decimals; the Foundation rule is integer cents. Say: Make every money column bigint cents, converted only on screen, with a test that refuses a fraction of a cent.

The predecessor is a text column on prj_task

Say: Remove it. Every link is one prj_dependency row with dep_type and lag_days.

CI fails on a fresh database with "relation does not exist"

Something exists only where it was clicked into being. Say: Rebuild from nothing with only supabase/migrations, name the missing object, and add it as a new migration; never edit an applied one.

After merging main, a rule or test you added has gone

A revert on main took it with no conflict. Say: List every schema change and test this branch added and confirm each is still there. If any disappeared, find the commit that removed it and tell me before changing anything.

A network worked by hand

The schedule engine in Session 4 must give your answers, so the network it is tested on is worked on paper first. The convention: day 0 is the start of the first working day, a task's early finish is its early start plus its duration, and a milestone has 0 days. Dates use a Monday-to-Friday calendar starting Monday 2026-01-05. These are fixed dates, so they live in a test fixture, tests/fixtures/projects-cases.json; the seed for the screens, supabase/seeds/projects.sql, is shifted onto today.

TaskDaysPredecessors (all FS)ESEFLSLFFloatDates
A Design3none03030Jan 5–7
B Order and receive2A35572Jan 8–9
C Install4A37370Jan 8–13
D Test and hand over2B, C79790Jan 14–15
E Go-live (milestone)0D99990Jan 15

The critical path is A, C, D, E: nine working days. B can slip two days. With a budget at completion of 1,000,000 cents and percent complete A 100, B 100, C 25, D 0, as of 2026-01-09: 7 of 11 task-days were planned (PV 636,364), 6 of 11 are done (EV 545,455), the actual cost is 600,000, so SPI 0.857, CPI 0.909, EAC 1,100,000 and VAC −100,000, each within a cent of rounding.

Step 3

Session 2: The hand-worked network as a fixture, made-up projects as the seed, and a look on the development project

35 minutes

Why

The schedule engine and the earned value sums need answers you trust before any code exists, and those answers need fixed dates. The screens need projects that look current next month too. Keeping the fixture and the seed apart prevents the two seed faults we hit: dates that age until every "this week" panel is empty, and later steps that expect counts the seed never made. Then you apply the module to the development project yourself and look.

Do this

Paste into Claude Code, then paste the tables from this page where it says
On a new branch projects/seed:

1. Write tests/fixtures/projects-cases.json with the calendar (Mon–Fri, start Monday 2026-01-05, no holidays), the five tasks A–E with durations, links and percent complete, and every expected value from the tables I paste below (ES, EF, LS, LF, float, critical, dates; PV, EV, AC, SPI, CPI, EAC, VAC as of 2026-01-09 with BAC 1,000,000 cents). Add the six-task teaching network from element M20 chapter 3 (critical A, B, D, F; 14 days; C and E 4 days of float) and one pair of tasks per dependency type: A 5 days from day 0, B 3 days; FS lag 2 puts B at days 7–10; SS lag 2 at 2–5; FF lag 2 at 4–7; SF lag 4 at 1–4. These are worked by hand: never change an expected value to pass a test.

2. Write supabase/seeds/projects.sql and list it under [db.seed] sql_paths in supabase/config.toml (never append to supabase/seed.sql), with the Foundation seed's rules: the syn site, every date shifted onto today (read the clock once at seeding and keep every gap), every visible name starting "SYNTHETIC · ", safe to run twice (on conflict do nothing on every number and unique key): six people, one per role (manager, sponsor, assignee, team member, approver, stakeholder) with ext.weekly_hours 40; one portfolio weighting value 50, risk 25, fit 25; one request under review; two projects in executing with 6–10 tasks each using all four dependency types; assignments that over-allocate one person on two days; time entries in draft, submitted, approved and rejected; three budget lines with commitments, one of them archived; RAID items; four punch items (a open, b in_progress, b ready_to_verify, c closed); one draft status report.

3. Write docs/prj-seed-counts.md with every count the seed makes, and supabase/tests/projects-seed.test.sql asserting each one, that running the seed a second time changes no count, and that the newest task date is within the last 14 days.

Push, open a pull request titled "Projects seed and schedule cases", wait for the checks, and report.

The hand-worked tables:
<paste the network table and the earned value paragraph from element M20 here>

When it is merged, apply the module and its made-up data to the development project yourself, in a terminal, with the development database password from the password manager. The first time, --include-seed loads every seed file listed in config.toml, projects.sql included; after a seed change, npm run seed:dev reloads them. Never reset the project. Production gets the migration from the deploy workflow, which never seeds it.

Terminal or PowerShell
cd ~/code/acme-platform && git switch main && git pull && npx supabase link --project-ref tsrqponmlkjihgfedcba && npx supabase db push --include-seed
Open

https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/editor

The development Table Editor. Check the project name says acme-platform-dev first.

You will see recreated screen

Terminal
$ npx supabase link --project-ref tsrqponmlkjihgfedcba
Finished supabase link.1
$ npx supabase db push --include-seed
Do you want to push these migrations to the remote database? • 20261109090000_projects_tables.sql [Y/n] y
Seeding data from supabase/seeds/projects.sql...
Finished supabase db push.2
db push on the development project applies exactly the merged migrations.
  1. The development reference, never abcdefghijklmnopqrst.
  2. Production gets the same migration from the deploy workflow, never the seed.

You will see recreated screen

supabase.com/dashboard/project/tsrqponmlkjihgfedcba/editor
prj_baselineprj_budget_lineprj_dependencyprj_projectprj_task
prj_dependency
1
predecessorsuccessordep_typelag_days
SYNTHETIC · DesignSYNTHETIC · Installfs0
SYNTHETIC · DigSYNTHETIC · Surveyss1
SYNTHETIC · RepairSYNTHETIC · Final testff0
SYNTHETIC · New system liveSYNTHETIC · Old system offsf0
The development project after the seed: made-up projects with dates around today.
  1. All four types appear in the seed, so every view and test meets them from the first day.

Check it worked

The fixture holds the hand-worked values; the seed-count test is green; on the development project npx supabase migration list shows Local and Remote the same and the Table Editor shows SYNTHETIC projects dated around today.

If it goes wrong

db push lists the live project

Answer n. You are linked to abcdefghijklmnopqrst. Link to tsrqponmlkjihgfedcba and try again; production gets migrations only from the deploy workflow.

A week later every "this week" panel is empty

The seed has fixed dates. Say: Move every seeded timestamp by one offset so the newest record is the moment of seeding, reading the clock once, and test that the newest task date is recent. Our seeded data was 10.9 days old eleven days later.

A later step expects a count the seed does not make

Fix the seed, not the check, then reload it with npm run seed:dev: List every count a later step or test expects and show the seed line that makes it.

Knowledge check

Why are the A–E network and its earned value figures a test fixture rather than seed data?

Knowledge check

How is a dependency between two tasks stored?

References

  1. Smartsheet: best Gantt chart software. https://www.smartsheet.com/content/best-gantt-chart-software
  2. PMI: The PMBOK Guide and standards for project management. https://www.pmi.org/standards/pmbok
  3. ISO 21502:2020, guidance on project management. https://www.iso.org/standard/74947.html
  4. PostgreSQL Documentation: Constraints. https://www.postgresql.org/docs/current/ddl-constraints.html

Chapter 2 · Session 3

Who may request, plan, work, approve and read

Access is decided once, in the role matrix, and the database rules, the page list and the access tests are generated from it. This chapter adds six people's roles and one temporary machine login, walks every operation the later sessions need, and builds the phone screens, the approvals queue and the manager's views.

25 min3 stepsSession 36 roles, 1 machine login

By the end of this chapter you can

  • Write the project roles and the cut-over importer into docs/matrix.json, with the two-person rules as restrictive rules.
  • Keep docs/prj-operations.md and a check that fails when an operation has no cell.
  • Build the operator, supervisor and manager surfaces and try them as each demo login on a phone.

Six roles and one machine login

RoleScopeWritesNever
Project managerProjects where manager_id is theirsRequests (to under_review or converted), projects (not budget_total or approved), tasks, links, assignments, baselines, budget lines, commitments, RAID, punch, status reports (until published), EVM snapshotsApprove their own budget; set a project to approved
SponsorProjects where sponsor_id is theirs; every request under reviewDecide requests (approved, rejected); approve or cancel projects; RAID decisionsDecide a request they raised
Task assigneeOwn tasks; the rest of those projects to readstatus and percent_complete on own tasks; raise RAID risks and issues; punch items to ready_to_verifyClose a punch item
Team memberOwn rowsOwn time entries while draft or rejected (submit, correct)See anyone else's hours
ApproverProjects at their home siteApprove or reject time entries; budget approval with a signature; budget_total and currencyApprove their own time entry
StakeholderProjects that list them in ext.stakeholder_idsComments on published reportsDraft reports, time, budgets, earned value
Cut-over importer (machine, insert-only)Rows with ext.imported trueInsert imported projects, tasks, links, assignments, baselines; set to NOLOGIN at cut-overAny update or delete; anything after Session 6
Step 4

Session 3: Put the roles in the matrix, list every operation, and generate the rules

35 minutes

Why

Access rules are generated from docs/matrix.json, so a right missing there is refused in the middle of Session 4, when the temptation is to widen a rule by hand. Writing every operation of Sessions 4 to 6 in docs/prj-operations.md now, with a script that fails if any has no cell, finds the gaps while they cost one line, and keeps finding them every time a later session adds an operation.

Do this

Paste into Claude Code, then paste the role table above after it
Read docs/matrix.json, scripts/gen-policies.mjs, docs/access-review.md, docs/prj-tables.md and docs/projects-rules.md. On a new branch projects/access:

1. Add the roles project_manager, sponsor, task_assignee, team_member, approver and stakeholder and the machine login prj_importer to docs/matrix.json with the cells in the table I paste below. Nobody gets delete. Add the two-person rules as restrictive rules: approver not on own time entry; sponsor not on own request; budget approval not by the manager who proposed it; punch item closed by someone other than assigned_to; published report and saved baseline never change; the importer inserts only rows with ext.imported true.
2. Write docs/prj-operations.md: one row per operation that Sessions 4, 5 and 6 of the projects module perform (session, screen or route, acting role, table, read, insert or update, status), and scripts/check-operations.mjs, which fails if a row has no matching cell, skipping rows whose status reads "retired" and a date. List the rows with no cell at the top under "Gaps" and stop to show me.

Agree each gap with the manager you named in Session 1. The usual ones: the approver updating prj_assignment.actual_hours, the manager reading purchase order lines from M12, core_event_outbox for the slip alert, core_e_signature for the budget approval. Then:

Paste into Claude Code
Add the cells for the gaps we agreed. Run node scripts/gen-policies.mjs to generate the policy migration (never a hand-written policy) and the access tests (one allowed and one refused per cell, plus the cross-site test). In a separate migration, create the database login prj_importer with NOLOGIN, no BYPASSRLS, owning nothing, insert-only; I set its password myself in Session 5. Add tests for every restrictive rule, each giving one person both jobs; a test that runs every row of docs/prj-operations.md as its role against the seed and checks the row really changed; and run scripts/check-operations.mjs in CI. Update docs/access-review.md. Push, open a pull request titled "Projects access", wait for every check, and report with the allowed and refused counts.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/prj-operations.md)
+## Gaps (no cell yet)
+- S4 · /api/projects/timesheets/approve · approver · update · prj_assignment.actual_hours
+- S4 · /api/projects/schedule · project_manager · insert · core_event_outbox (prj.task.critical_slip)
+- S4 · /api/projects/budget/approve · approver · insert · core_e_signature
1
> Add the cells for the gaps we agreed. ...
⏺ Bash(node scripts/gen-policies.mjs)
⎿ Wrote supabase/migrations/20261111100000_policies.sql (61 policies, 7 roles, 6 restrictive)
2
⏺ Pull request #95 is green. 122 access tests (61 allowed, 61 refused), 6 two-person tests each refused, and 74 operation rows each allowed and really changing the row. scripts/check-operations.mjs passes in CI.3
The walk stops at the gaps; the generated rules and tests come after you agree them.
  1. Gaps found before any step needs them.
  2. Restrictive rules hold whatever other cells allow.
  3. "Really changed": an update a role cannot read reports success and changes nothing.

Check it worked

Pull request Projects access is green; docs/prj-operations.md has no gap; check-operations runs in CI; no generated policy allows delete; docs/access-review.md shows every new role.

If it goes wrong

An approved time entry does not change the assignment's hours

The approver can update but not read prj_assignment rows, so the update finds nothing. Add the read cell, regenerate, and test that the row really changed.

A person with two jobs can approve their own hours

The two-person rule is a permissive cell, not a restrictive one. Say: Make it a restrictive policy and add the test that gives the approver the team member job too.

Claude Code edits a generated policy by hand

Say: Revert it. Rights come only from docs/matrix.json through scripts/gen-policies.mjs. Then read the Files changed tab.

Three surfaces

SurfaceScreensFor
Operator (phone)/projects/my-tasks, /projects/time, /projects/punch, /projects/requestAssignee and team member: own tasks, hours, punch items with a photo; anyone allowed may raise a request
Supervisor/projects/approvalsApprover (hours, budgets); sponsor (requests, projects)
Manager/projects/gantt, /board, /list, /calendar, /portfolio, /budget, /raid, /statusManager and sponsor; the stakeholder reads portfolio, list, calendar and published status
Step 5

Session 3: Build the operator, supervisor and manager screens

30 minutes

Why

The screens decide whether people stop updating the old tool. Building them against the seed with the access rules already generated means each person sees only their projects from the first day. The new pages are added to the matrix and the page list regenerated, so the sign-in guard keeps denying everything it was not told about, and the phone rules matter because assignees and team members update from the floor.

Do this

Paste into Claude Code
Before writing any page, read the routing and proxy guides in node_modules/next/dist/docs/ (this Next.js version differs from older guides; request checks live in proxy.ts) and lib/access/routes.ts.

On a new branch projects/screens:
1. Add the screens /projects/my-tasks, /projects/time, /projects/punch, /projects/request, /projects/approvals, /projects/gantt, /projects/board, /projects/list, /projects/calendar, /projects/portfolio, /projects/budget, /projects/raid and /projects/status to the screens section of docs/matrix.json with the roles from element M20 chapter 2, and regenerate lib/access/routes.ts with node scripts/gen-routes.mjs, as Session 9 does. Do not edit proxy.ts or routes.ts by hand.
2. Build them against the seed. On a phone the Gantt is a list with start, finish and float; bars appear from tablet width. Critical tasks are marked in words as well as colour. Any figure with nothing behind it shows "No data" or "not yet", never 0. The person on every record comes from the signed-in session on the server.
3. Foundation phone rules: 44 px targets, 16 px fields, 15 px text, no sideways scroll at 360 and 390 px, contrast 4.5:1.
4. Screen tests at phone size: signed out, every page goes to sign-in; each role opens its pages and is refused the others; the stakeholder sees no draft report, time entry or budget.

Push, open a pull request titled "Projects screens", wait for the checks and the Vercel preview, and give me the preview address.

You will see recreated screen

acme-platform-git-projects-screens-acme-ops.vercel.app/projects/my-tasks
My tasks · SYNTHETIC · Press 4 guarding upgrade
1.3 Install guardingCritical · due in 3 working days · 25% done1
1.2 Order light curtainsFloat 2 days · 100% done
Statusin_progress ▾
Percent complete25
Save2
My tasks on the preview at phone width: progress the assignee reports, with the critical path said in words.
  1. Critical is a word, not only a red bar.
  2. Saving sends only status and percent complete: the assignee's two columns.

Check it worked

On the preview, signed out, every projects page goes to sign-in; each demo role opens its own pages on a phone with nothing scrolling sideways; the screen tests are green.

If it goes wrong

Pages compile but a link opens a 404

Test by visiting: Start the production build, sign in as each role, visit every page and every link on it, and report each 404, error page and console error.

Earned value shows 0 for a project with no progress

Say: When EV is 0, store the ratios empty and show "not yet"; never 0. Test every panel with an empty project.

Claude Code wrote middleware.ts

Say: This Next.js uses proxy.ts, and its list comes from lib/access/routes.ts generated from the matrix. Remove the hand edit and regenerate.

Step 6

Session 3: Demo logins on the development project, and a trial with the manager

20 minutes

Why

Tests prove the rules; people prove the screens. One demo login per role on the development project lets you and the manager use the module as each role will, with made-up data only. Ten silent minutes watching a manager and a person who logs time find the confusing parts before the workflow is built on them.

Do this

On the development project, create six users with Create new user and Auto confirm user: manager.test, sponsor.test, assignee.test, member.test, approver.test and stakeholder.test, all @example.com, each password generated and kept in the password manager.

Open

https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/auth/users

Authentication, Users, on acme-platform-dev.

Paste into Claude Code
Write supabase/snippets/prj-demo-logins.sql for me to run in the development SQL editor. Do not run it. It finds the six demo users by email and links each to the seeded person of the same role, with a membership at the seeded site. It refuses to run if prj_project holds any row whose name does not start "SYNTHETIC · ". Open a pull request titled "Projects demo logins" and wait for the checks.

After it merges, run it in the development SQL editor. Sign in on the preview as each role. Then watch the manager plan on /projects/gantt and a team member enter a day's hours on /projects/time, on their own phone, without explaining anything; write down where each stops.

You will see recreated screen

acme-platform-git-projects-screens-acme-ops.vercel.app/projects/approvals
Waiting for you
SYNTHETIC · Member Test · 8.0 h · TuePress 4 guarding · 1.1 Design1
Approve
Reject with a reason
The approvals queue as approver.test: the approver's own entry is not offered.
  1. Someone else's hours.
  2. The two-person rule, said on the screen as well as enforced in the database.

Check it worked

Each demo login sees exactly its role's pages on the preview; you have written notes from both trials, each fixed or decided.

If it goes wrong

The user waits for a confirmation email

You used Invite. Delete it and use Create new user with Auto confirm user: example.com addresses receive nothing.

The snippet refuses: rows not marked SYNTHETIC

Good: it found real data. Check you are in acme-platform-dev. Real records go there only with IT's written approval (Session 5).

Knowledge check

An approver also logs time on the same project. What happens when they try to approve their own entry?

Knowledge check

Where is the right for a later step added when a step is refused?

References

  1. Supabase Docs: Row Level Security. https://supabase.com/docs/guides/database/postgres/row-level-security
  2. PostgreSQL Documentation: Row Security Policies (permissive and restrictive). https://www.postgresql.org/docs/current/ddl-rowsecurity.html
  3. W3C: Web Content Accessibility Guidelines (WCAG) 2.2. https://www.w3.org/TR/WCAG22/

Chapter 3 · Session 4

The workflow: from request to critical path to earned value

One session builds the project's working life: a request is scored and decided, the schedule engine computes the critical path with all four dependency types, a baseline measures slip, hours are approved by someone else, budgets show commitments from purchase orders, earned value is a stored reading, and RAID, punch items and status reports close the loop. Every number is tested against the network you worked by hand.

35 min4 stepsSession 4tested against your hand count

By the end of this chapter you can

  • Score, decide and convert a request with the two-person rule held by the database.
  • Have Claude Code build the critical path engine with its tests written first, and show slip against a baseline.
  • Approve hours, commit budgets from purchase orders, store earned value, and publish a status report that cannot change.

Intake and scoring

A request is scored on value, risk (5 is the lowest risk) and strategic fit, 1 to 5, weighted by the portfolio's scoring_model; total_score is the sum of weight times score divided by the sum of the weights, computed on the server. A request moves submitted, under_review, approved or rejected; an approved one is converted into a project and keeps its project_id.

Weighted portfolio scoresThree requests scored on value, risk and strategic fit with weights of 0.5, 0.3 and 0.2. Request A totals 7.6, request B 6.4 and request C 6.1, drawn to scale on a zero to ten axis. Value × 0.5Risk × 0.3 (10 = lowest risk)Strategic fit × 0.20246810Request Ascores 8 · 6 · 94.01.81.87.6 totalRequest Bscores 9 · 3 · 54.50.91.06.4 totalRequest Cscores 5 · 8 · 62.52.41.26.1 totaltotal_score = the sum of each score times its weight. The weights come from the portfolio's scoring_model.
Three requests, scored. The weights are a choice the portfolio owner writes down; the arithmetic is the same whatever they are.
From request to projectA request moves from submitted to under review to approved to converted, or to rejected. A project moves from proposed to approved, planning, executing, closing and closed, and can also be on hold or cancelled. Its gate moves from idea to define, plan, execute and close. REQUEST · prj_request.statussubmittedunder_reviewapprovedconvertedrejectedA sponsor decides a request that is under review.PROJECT · prj_project.statusproposedapprovedplanningexecutingclosingclosedAlso reachable: on_hold and cancelled. A converted request keeps the project_id of the project it made.GATE · prj_project.gateideadefineplanexecuteclose
Request, project and gate. A gate is separate from status: a project can be executing and still waiting at the plan gate.
Step 7

Session 4: Intake, scoring and the decision

25 minutes

Why

Most project trouble starts before the project: work nobody chose, or chosen by the person asking for it. Scoring on the server and holding the decision to someone other than the requester turns the portfolio into a record the business can defend. Writing the rules in docs/projects-rules.md first means the code follows decisions you made, not ones Claude Code guessed.

Do this

Paste into Claude Code
Read docs/projects-rules.md, docs/prj-operations.md and docs/matrix.json. On a new branch projects/intake:

1. Add to docs/projects-rules.md, as settings I can change: the scoring scale (1–5, risk 5 = lowest risk) and formula (sum of weight × score ÷ sum of weights); which purchase order statuses count as committed (approved, sent, acknowledged, partially_received, received) and which do not (draft, pending_approval, closed, cancelled); planned and earned value weighted by duration_days; the risk score (probability × impact) and its bands; punch categories a, b, c and which must be closed before handover; when health turns amber and red; how many working days of slip on a critical task raise an alert.
2. Build /api/projects/requests (raise, numbered from core_number_sequence), /api/projects/decide (sponsor: approved or rejected, never on a request they raised), /api/projects/convert (manager: creates the prj_project, status proposed, and sets project_id) and /api/projects/approve (sponsor: project to approved). total_score is computed on the server; for weights 50, 25, 25 and scores 4, 3, 5 it is 4.00.
3. Tests: the score; the sponsor refused on their own request; a manager refused when setting a project to approved; each status move outside the allowed paths refused. Show each test failing with its rule removed, then passing.
4. Add the operations to docs/prj-operations.md and run scripts/check-operations.mjs.

Push, open a pull request titled "Projects intake", wait for every check, and report in plain words.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx vitest run tests/projects-intake.test.ts)
⎿ ✗ sponsor cannot decide own request (rule removed) ✓ 9 passed, 1 failed
1
⏺ Bash(npx vitest run tests/projects-intake.test.ts)
⎿ ✓ 10 passed (rule restored)
⏺ Pull request #98 is green. REQ-0001 scores 4.00. The sponsor's own request goes to another sponsor; a manager cannot approve a project.2
The score is computed on the server, and the refusals are tests shown red first.
  1. A test that has never failed may not be able to fail.
  2. Check the 4.00 against your own sum.

Check it worked

On the preview, assignee.test raises a request, manager.test scores it (4.00 on the seed's scores), sponsor.test approves it, manager.test converts it into a project with status proposed.

If it goes wrong

The score differs from your sum

Check whether the code divides by the sum of the weights. 4 × 50 + 3 × 25 + 5 × 25 = 400; 400 ÷ 100 = 4.00. A plain average ignores the weights.

The sponsor approved their own request

The rule is a screen check, not a database rule. Say: Enforce it as the restrictive policy from Session 3 and test it with a sponsor who raised the request.

Four dependency types and the critical path

The four dependency typesFour small schedules, each with task A above task B, drawn to scale. Finish to start with a two day lag: B starts two days after A finishes. Start to start with a one day lag. Finish to finish with a one day lag. Start to finish: B finishes when A starts. FS · finish to startABlag 2B cannot start until A finishes, plus the lag.SS · start to startABlag 1B cannot start until A has started, plus the lag.FF · finish to finishABlag 1B cannot finish until A finishes, plus the lag.SF · start to finishABB cannot finish until A has started, plus the lag.
The four types, to scale. FS with lag 2, SS with lag 1, FF with lag 1, and SF.
TypeRule for the successorPlant example
FSStart no earlier than predecessor's finish + lagPaint after the plaster has dried (lag 2)
SSStart no earlier than predecessor's start + lagBegin the survey a day after digging begins
FFFinish no earlier than predecessor's finish + lagFinal testing finishes after the last repair
SFFinish no earlier than predecessor's start + lagThe old system stays on until the new one has started

The forward pass gives each task its early start (the latest early finish of its predecessors) and early finish; the backward pass from the project finish gives late finish and late start. Total float is late start minus early start; tasks with zero float form the critical path [1][2]. A tool that knows only finish-to-start forces overlapping work into fake tasks, and the critical path then runs through links that are not real.

Early and late dates for a six-task networkSix tasks with finish-to-start links. A is 3 days, B 4, C 2, D 5, E 3 and F 2. Early start and finish, late start and finish and total float are shown on each. A, B, D and F have zero float and are the critical path of 14 days; C and E each have 4 days of float. A · 3 daysES 0 · EF 3LS 0 · LF 3float 0B · 4 daysES 3 · EF 7LS 3 · LF 7float 0C · 2 daysES 3 · EF 5LS 7 · LF 9float 4D · 5 daysES 7 · EF 12LS 7 · LF 12float 0E · 3 daysES 5 · EF 8LS 9 · LF 12float 4F · 2 daysES 12 · EF 14LS 12 · LF 14float 0Critical path A → B → D → F, 14 days. C and E can each slip 4 days before the finish moves.
The six-task teaching network. A, B, D and F are critical, 14 days; C and E have 4 days of float.
Step 8

Session 4: The critical path engine, tests first, and the five views

40 minutes

Why

The finish date the sponsor is told comes from this engine, and a wrong critical path sends effort to the wrong tasks. Writing the tests first from the network you worked by hand means the engine must match your arithmetic. A pure function (same input, same output, no database) is easy to test; the route that runs it and the views that show it are then plumbing. The specification's definition of done asks for exactly this: textbook results, and successors that move when a predecessor does.

Do this

Paste into Claude Code
On a new branch projects/schedule:

1. Write tests/projects-cpm.test.ts first, from tests/fixtures/projects-cases.json: the four dependency-type pairs, the seed network A–E (critical A, C, D, E; B float 2; nine working days; dates Jan 5–15 2026), the six-task teaching network (A, B, D, F critical; 14 days), and a cycle refused. Run them and show me they fail because there is no engine yet. Never change an expected value.
2. Write lib/projects/cpm.ts as one pure function taking tasks, links and the calendar and returning early and late start and finish, total float and is_critical for each task, with all four types and lags. Make the tests pass.
3. Build /api/projects/schedule (manager): runs the engine and writes the results to prj_task and the dates to prj_project, rolling summary rows up. /api/projects/tasks (manager: tasks, links, assignments, refusing a cycle or a link across projects; assignee: only status and percent_complete on own tasks). Every update includes row_version in its WHERE clause, so a stale save is refused with a message.
4. Wire the Gantt (dependency lines; a list on phones), board, list, calendar and portfolio timeline to the results.
5. A test that lengthens a predecessor, runs the schedule, and checks the successors moved and the critical path was recomputed.

Push, open a pull request titled "Projects schedule", wait for every check, and report in plain words.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx vitest run tests/projects-cpm.test.ts)
⎿ ✗ 9 failed: Cannot find module 'lib/projects/cpm'
1
⏺ Bash(npx vitest run tests/projects-cpm.test.ts)
⎿ ✓ 9 passed seed: A 0–3 · B 3–5 float 2 · C 3–7 · D 7–9 · E 9 · critical A,C,D,E ✓ teaching: critical A,B,D,F · 14 days ✓ SF lag 4: B days 1–4 ✓
2
⏺ Pull request #100 is green. Lengthening A by two days moves C, D and E two working days and keeps them critical; B keeps its float.3
Red because the engine does not exist, then green against the same expected values.
  1. Failing for the right reason.
  2. Your hand count, unchanged.
  3. The specification's second test: successors move and the path is recomputed.

Check it worked

The engine tests are green and tests/fixtures/projects-cases.json is not in the pull request's changed files. On the preview, manager.test opens /projects/gantt and sees the critical tasks named in words.

If it goes wrong

A test was "fixed" by changing an expected date

Say: Revert the fixture. It is worked by hand. Find which rule differs: day 0, the milestone, the lag or the calendar.

SF and FF dates come out a day off

Usually the convention: day 0 is the start of the first working day, and finish is start plus duration. Write it in docs/projects-rules.md and have the engine follow it.

Two managers edit the same task and one change is lost

The update does not check row_version. Say: Include row_version in the WHERE clause and refuse a stale save with a message; test two saves from one copy, expecting exactly one to succeed.

Baselines, money and earned value

Baseline against current datesThree tasks, each with a grey baseline bar and an amber current bar drawn to scale. Pour foundation finishes 2 days late, set equipment 4 days late and commission 5 days late. day 0day 5day 10day 15day 20day 25day 30Pour foundationstart +0 · finish +2duration +2 daysSet equipmentstart +2 · finish +4duration +2 daysCommissionstart +4 · finish +5duration +1 daysbaseline (saved in prj_baseline)current planVariance = current minus baseline. Without a saved baseline there is nothing to subtract.
Baseline against current. Slip grows down the chain because each task waits for the one before.
Budget, committed, actual and forecastThree budget lines drawn to scale. Equipment: budget 400, committed 380, actual 150, forecast 410. Installation: 250, 120, 40, 260. Validation: 100, 90, 10, 95. Forecasts above budget are red. Equipmentbudget400committed380actual150forecast410Installationbudget250committed120actual40forecast260Validationbudget100committed90actual10forecast95Total budget 750, forecast 765: budget variance = (765 − 750) ÷ 750 = 2.0%. Committed 590, actual 200.Teaching example, thousands of currency units. Commitments come from approved purchase orders.
Budget, committed, actual and forecast. A report of actuals alone would show under 40% spent on equipment with 95% already promised.
MeasureFormulaReads as
SPIEV ÷ PVBelow 1: behind schedule
CPIEV ÷ ACBelow 1: over cost
EACBAC × AC ÷ EV (round once, in cents)Likely total cost
VACBAC − EACNegative: forecast overrun
Budget variance(forecast − budget) ÷ budgetAbove 0: over budget

Earned value follows the PMBOK Guide's measures; ANSI/EIA-748 sets guidelines for a full earned value management system if a contract asks for one [2]. AACE International's RP 18R-97 classifies cost estimates from Class 5 to Class 1; keep the class in ext.estimate_class on the budget line [3].

Step 9

Session 4: Baselines and slip, hours, commitments from purchase orders, and earned value

45 minutes

Why

Two of the module's three pitfalls live here. Without a baseline nobody can say how late a project is; without commitments a budget looks healthy until the invoices arrive. Approved hours, committed purchase orders and stored earned value readings give the sponsor two numbers that say whether the project is on time and on cost, and every figure is checked against the hand count from Session 2.

Do this

Paste into Claude Code
On a new branch projects/control:

1. Baselines: /api/projects/baselines saves a prj_baseline (start, finish, duration of each task) and sets baseline_finish. On a scratch copy of the A–E network, save "Baseline 1", lengthen A to 5 days, run the schedule: C, D and E move two working days (E to 2026-01-19), the variance report on /projects/gantt shows start, finish and duration against Baseline 1, and the slip alert fires once (a prj.task.critical_slip row in core_event_outbox, a notification to manager and sponsor, an action item). Milestone hit rate as of 2026-01-19 on the scratch project is 0 of 1. Archive the scratch project.
2. Time: assignments with units_pct and planned_hours; the capacity heat map on /projects/portfolio shows the seeded over-allocation; /projects/time (draft, submit); /api/projects/timesheets/approve (approver) adds approved hours to actual_hours; a rejection needs a reason that reaches the person.
3. Money: budget lines proposed by the manager and approved by the approver with a core_e_signature, setting budget_total; /api/projects/commitments turns open purchase order lines (from M12 when installed: qty × unit_price in cents rounded once per line, keyed by po_ref and ext.po_line so a second run adds nothing) into prj_commitment rows, or the manager enters them from real POs; committed_amount = the sum of linked, non-archived commitments; contingency drawdown in one transaction with a RAID change item.
4. Earned value: /api/projects/evm takes an as_of date and inserts a prj_evm_snapshot. On the fixture as of 2026-01-09: PV 636,364; EV 545,455; AC 600,000; SPI 0.857; CPI 0.909; EAC 1,100,000; VAC −100,000 (each within one cent). When EV is 0, store the ratios empty and show "not yet".
5. Tests for every figure above against tests/fixtures/projects-cases.json, the approver refused on their own entry, and committed_amount equal to the linked open lines with an archived commitment not counted. Add the operations to docs/prj-operations.md and run the check.

Push, open a pull request titled "Projects control", wait for every check, and report in plain words.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx vitest run tests/projects-control.test.ts)
⎿ ✓ slip: E moves to 2026-01-19, one alert ✓ committed EQ-100 = 550000 (archived 50000 excluded) ✓ EVM 2026-01-09: PV 636364 EV 545455 AC 600000 SPI 0.857 CPI 0.909 EAC 1100000 VAC -100000 ✓ approver refused on own entry
1
⏺ Pull request #103 is green. The specification's third test holds: committed amounts equal the linked open purchase order lines.2
Every figure is checked against the hand count; the archived commitment never counts.
  1. Your numbers from Session 2, reproduced.
  2. The definition of done, item by item.

You will see recreated screen

acme-platform-git-projects-control-acme-ops.vercel.app/projects/budget
SYNTHETIC · Press 4 guarding upgrade · budget
1
Cost codeBudgetCommittedActualForecast
EQ-100 equipment6,000.005,500.004,000.006,200.00
IN-200 installation3,000.002,000.002,000.003,300.00
CT-900 contingency1,000.000.000.001,000.00
Budget variance+5.00%
SPI · CPI (as of 2026-01-09)0.857 · 0.9092
The budget screen on the preview: committed beside actual, so the overrun shows before the invoices arrive.
  1. Committed is promised money; actual is part of it, not added to it.
  2. A stored reading with its date, so it never silently changes.

Check it worked

The control tests are green with the fixture unchanged; on the preview the budget screen shows committed beside actual, the variance report shows the two-day slip, and approver.test cannot approve its own hours.

If it goes wrong

The slip alert fires every time the schedule runs

Say: Raise the alert once per task and baseline, with a unique key, and test that a second run adds nothing.

Committed is larger than the purchase orders

An archived or cancelled line is counted, or a second run added rows again. Say: Count only non-archived commitments on open orders, key each row by po_ref and ext.po_line, and test a second run.

EAC is a few cents out

The code divided by a rounded CPI. Say: Compute EAC as BAC × AC ÷ EV in cents and round once at the end.

RAID, punch lists and status reports

Scoring a RAID itemA five by five grid of probability against impact. Each cell shows the product. Scores 1 to 4 are green, 5 to 12 amber and 15 to 25 red. The example risk, probability 4 and impact 3, scores 12. 510152025481216203691215246810123451234554321ImpactProbabilityscore = probability × impact1 to 4: monitor5 to 12: an owner and a response15 to 25: escalate to the sponsorExample: probability 4 × impact 3 = 12.A 1 to 5 scale and these bands arecommon choices. Set your own, write themdown, and use them for every item.
Probability times impact. The bands are a choice you write down and apply the same way every time.
A punch list itemA punch item moves from open to in progress to ready to verify to closed. The assignee moves it as far as ready to verify; the project manager closes it. openraised on the walk-downin_progressassignee is fixing itready_to_verifyassignee says it is doneclosedproject manager verifiesThe assignee can never set closed. Closing publishes prj.punch_item.closed.Each item has a category a, b or c, an area or equipment, a photo, an owner and a due date.Your site defines what each category means; the KPI is the open count by category at handover.
A punch item. The person who fixed it moves it to ready_to_verify; someone else closes it.

For regulated capital projects, commissioning and qualification evidence (checklists and signatures) stays with the project record and is handed to Document Control at close; ISPE's Baseline Guide Volume 5 and ASTM E2500 describe the practice [4].

Step 10

Session 4: RAID, punch items and a status report that cannot change

30 minutes

Why

The control records are where a project's honesty shows: a risk scored the same way every time, a punch item closed by someone who checked it, and a status report that says what was true on its date and is never quietly edited. An AI-drafted summary is optional; when used it is a draft a person approves, and its key is typed by you into Vercel, never into Claude Code.

Do this

Paste into Claude Code
On a new branch projects/raid-punch-status:

1. RAID: /api/projects/raid. The assignee raises risks and issues; the manager scores probability × impact into score, sets owner, due date, response and status; the sponsor may insert only raid_type decision.
2. Punch: on a phone the assignee raises an item with a photo (core_attachment) and moves it to in_progress and ready_to_verify; someone other than assigned_to closes it, which sets closed_at and writes prj.punch_item.closed to core_event_outbox. Open punch items by category at handover on /projects/status.
3. Status reports: the manager drafts from the numbers (health, SPI, CPI, open RAID by score); publishing sets published_at, writes prj.status_report.published and notifies stakeholders; a published report never changes (a correction is a new report). The summary is typed by hand. If I later enable an AI draft, it goes through one module, lib/ai/draft.ts, reading its key from AI_API_KEY, which I set in Vercel myself; the draft is stored as core_ai_suggestion until the manager approves it. Leave AI off.
4. Tests: a punch item closed by its assignee is refused; a published report refuses an edit; a sponsor cannot insert a RAID risk; punch counts by category on the seed match docs/prj-seed-counts.md. Show each failing first.
5. Write docs/prj-events.md with the line where prj.project.approved, prj.task.critical_slip, prj.status_report.published and prj.punch_item.closed are written. Add the operations to docs/prj-operations.md and run the check.

Push, open a pull request titled "Projects RAID, punch and status", wait for every check, and report.

Then walk it on the preview: as assignee.test raise a punch item with a photo and move it to ready_to_verify; as manager.test close it; publish a status report and try to edit it (refused); as stakeholder.test read it.

You will see recreated screen

acme-platform-git-projects-raid-punch-status-acme-ops.vercel.app/projects/status
SYNTHETIC · Press 4 guarding · week ending Friday
Healthamber
SPI · CPI0.857 · 0.909
Open punch itemsa 1 · b 2 · c 01
A published status report: fixed, with its date; a correction would be a new report.
  1. Category a items must be closed before handover, as your rules say.
  2. The database refuses the edit; the screen says why.

Check it worked

The refusals are green tests; on the preview a punch item closed by its own assignee is refused and by the manager is accepted; a published report refuses an edit; docs/prj-events.md lists four events.

If it goes wrong

Claude Code wants the AI key to test the draft

Refuse. Say: Leave AI off. I set AI_API_KEY in Vercel myself if we turn it on; test with a fake provider.

The status report page claims it was sent to stakeholders, and nobody got it

Say: Count a notification as sent only when the provider returns an id; otherwise log the reason and show "not sent". A page that claims a send that did not happen locked our own operations lead out of production.

Knowledge check

In the seed network, B (2 days) and C (4 days) both follow A (3 days) and both lead to D. How much float does B have?

Knowledge check

A budget line has 4,000 actual and 5,500 committed on approved purchase orders, against a budget of 6,000. What does a report of actuals alone miss?

References

  1. PMI: standards, including the Practice Standard for Scheduling. https://www.pmi.org/standards
  2. PMI: The PMBOK Guide, including earned value and cost management. https://www.pmi.org/standards/pmbok
  3. AACE International (publisher of Recommended Practice 18R-97). https://www.aacei.org/
  4. ASTM E2500: Specification, design and verification of pharmaceutical manufacturing systems. https://store.astm.org/e2500-20.html

Chapter 4 · Sessions 5 and 6

Move the projects in, prove them, switch the old tool off

Real projects arrive only at the end, and only after a rehearsal. Session 5 maps the old tool's export, builds an import that saves the old plan as a new baseline and adds nothing when run twice, and rehearses it on the development project with a redacted copy IT has approved in writing, removed the same day. Session 6 imports into production only through the import workflow a person starts from main, with an export owner two approved, switches the importer off, and cancels the old subscription with the saving from invoices.

20 min4 stepsSessions 5–6ends with the module's gate

By the end of this chapter you can

  • Map the old export's columns and predecessor text, and build an import with a dry run and a legacy key.
  • Rehearse on the development project with a redacted, IT-approved copy, explain every difference from the old tool's dates and critical path, and remove it the same day.
  • Run the final import into production only through import-projects.yml, set the importer to NOLOGIN, and record the saving.
From the old tool to cut-overSix steps: export from the old tool, import as a new baseline, check the dates, critical path, committed amounts and earned value against the old tool, rehearse on the development project with an IT-approved copy, run the final import into production and cut over, and retire the old tool. Export from the old tooltasks, dates, dependenciesImport as a new baselinethe old plan is saved, not overwrittenCheck against the old tooldates, critical path, committed, EVRehearse on developmentan IT-approved copy firstFinal import and cut overthe workflow, from mainRetire the old toolcancel it, record the savingA CSV or XML export from Smartsheet, Asana, monday.com or Microsoft Project carries tasks, dates and dependencies.
From the old tool to cut-over. The old plan is saved as a baseline, never mixed into the live plan, so the two can be compared.
Key or secretWhat it unlocksWhere it livesWho holds itNever
prj_importer passwordThe cut-over importer's insert-only database loginPassword manager; set by a person in each project's SQL editor; inside the two secrets belowOwner one and owner twoPasted into Claude Code or a file; kept after Session 6
PRJ_IMPORT_DATABASE_URL_DEV, PRJ_IMPORT_DATABASE_URL_PRODThe import workflow's connection to the development and the live projectGitHub Actions repository secrets, typed by a person; names in docs/KEYS.mdOwnersUsed by any other workflow; left in place after cut-over
AI_API_KEY (only if you turned AI drafts on)Drafting status summariesVercel environment variableOwnersPasted into a prompt; used without a spending limit
Step 11

Session 5: Map the old export, and build an import with a dry run

40 minutes

Why

Each tool writes predecessors its own way, and a guessed mapping becomes a wrong critical path. A dry run that lists every unmatched person, unknown status, unparsable predecessor, cycle and impossible date shows the problems before anything is written. A legacy key on every imported row makes a second run add nothing, so the rehearsal can be fixed and rerun safely, and the old plan saved as a baseline keeps the comparison honest.

Do this

Paste into Claude Code
On a new branch projects/import:

1. Write docs/projects-import-map.md from the three predecessor examples and the column list in docs/projects-inventory.md: each old column to a new column; the predecessor text parsed into prj_dependency rows (dep_type and lag_days, with the lag unit stated); assignees matched to core_person by email; old statuses to prj_task.status; the old id kept in ext.import_key, unique per project.
2. A new migration (never edit an applied one) with a unique index on ext.import_key for prj_project, prj_task and prj_dependency.
3. Write scripts/import-projects.mjs, connecting as the insert-only prj_importer login with IMPORT_DATABASE_URL from the environment (never printed, never the service-role key). A dry run writes nothing and lists unmatched people, unknown statuses, unparsable predecessors, cycles, tasks with no dates and finishes before starts. A write inserts the project (ext.imported true), tasks, links and assignments, and one prj_baseline "Imported from <tool> <date>" holding the old start, finish and duration; closed projects arrive with archived_at set; on conflict do nothing on ext.import_key. No deployed upload or import page.
4. Write .github/workflows/import-projects.yml, started only by hand (workflow_dispatch) by a person, refusing any branch but main, with inputs target (development or production), file and mode (dry-run or write). It downloads the file from the private Storage bucket imports of the target project; computes its sha256; refuses the run unless that sha256, the target and the expected counts (projects, tasks, links by type, assignments) are listed in docs/imports/projects-approved.md on main; runs the script; and fails if any count differs from the listed one. Secrets: repository secrets PRJ_IMPORT_DATABASE_URL_DEV and PRJ_IMPORT_DATABASE_URL_PROD, typed by me. No GitHub environments and no "required reviewers" (not available for private repositories on our plan): the reviewed pull request that adds the approved line is the approval. Counts in the job summary.
5. scripts/import-count.mjs <file>, which I run on my own computer: prints the file's sha256 and the counts, never any content; and scripts/import-redact.mjs <file> <out>, which I run for the rehearsal copy: replaces every person's name and email with a consistent placeholder. docs/imports/projects-approved.md: one heading per approved export with target, file name, sha256, expected counts, IT's approval reference and, for the rehearsal, the date it was removed. supabase/snippets/remove-projects-rehearsal.sql, for me to run in the development SQL editor: removes only rows with ext.imported true, prints the counts, refuses unless the database is acme-platform-dev. Add the secrets' names to docs/KEYS.md.
6. Tests with a ten-row fixture export: the dry run report; running the write twice adds nothing; a non-FS link survives; an archived imported row refuses an update; the importer cannot update any row; the workflow refuses a file not listed and fails on a count mismatch.

Push, open a pull request titled "Projects import", wait for every check, and report in plain words.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx vitest run tests/projects-import.test.ts)
⎿ ✓ dry run: 1 person unmatched, 1 predecessor unparsable ("2,3SS+1d" with a space), 0 cycles ✓ second write: 0 inserted, 10 skipped (already imported) ✓ SS lag 1 link survives
1
⏺ Pull request #106 is green. The import saves the old plan as a baseline and adds nothing when run twice. The dry run lists every problem for you to decide; nothing is guessed.2
The import is proven on a fixture export before it meets any real file.
  1. The problems are named; you decide each one in the mapping file.
  2. Run twice equals run once: what makes the rehearsal safe.

Check it worked

The pull request is green, the mapping file covers every column and predecessor form from your inventory, and the fixture's second write adds nothing.

If it goes wrong

Old tasks arrive with today's dates

The import let the database default the dates. Say: Keep the export's start, finish and duration on the tasks and in the imported baseline, with a test.

Every link arrives as FS

The predecessor parser drops the type. Say: Parse the type and lag from each predecessor form in docs/projects-import-map.md, and add one fixture row per form. FS-only is the pitfall this module exists to remove.

Claude Code asks for a real export to test with

Refuse. Real records stay out of tests and chats. Say: Use the ten-row fixture only.

Claude Code builds an upload page, runs the import on merge, or adds a GitHub environment with required reviewers

Say: No import page, no import on merge, no environments: a person starts import-projects.yml from main, reading the file from the private imports bucket, and the merged line in docs/imports/projects-approved.md is the approval. Required reviewers are not available for private repositories on the Team plan.

Step 12

Session 5: Rehearse on the development project with an IT-approved copy

40 minutes

Why

The rehearsal is where mistakes are cheap: real volumes and real oddities, on the development project, with production untouched. Running the engine on the imported projects and comparing its dates and critical path with the old tool's own shows whether the mapping is right. Real project data can name people and suppliers, so it goes into the development project only redacted, with IT's written approval, and comes out the same day with the date recorded.

Do this

Ask IT in writing before any real export leaves the old tool:

Email to IT
Subject: Approval to rehearse the project import on our development database

We plan to load an export of <n> projects from <old tool> into our development database
(acme-platform-dev, Supabase, region us-east-2) for one rehearsal on <date>, and delete it the
same day. Names and email addresses are replaced with placeholders before it is loaded.
Access: the two platform owners and the project manager. Nothing leaves the company.
Please confirm in writing.

When IT approves, on the rehearsal day: in your private folder run node scripts/import-redact.mjs on the export, then node scripts/import-count.mjs on the redacted copy. Record its sha256 and counts, with IT's approval reference, in docs/imports/projects-approved.md through a pull request owner two approves and merges. In the development SQL editor set the importer's password (alter role prj_importer with login password '…';, from the password manager), type the repository secret PRJ_IMPORT_DATABASE_URL_DEV (user prj_importer.tsrqponmlkjihgfedcba; the value only), and upload the redacted copy to the private bucket imports on the development project.

Open

https://github.com/acme-ops/acme-platform/settings/secrets/actions

GitHub: Settings, Secrets and variables, Actions: New repository secret.

Open

https://github.com/acme-ops/acme-platform/actions/workflows/import-projects.yml

Run workflow from main: target development, mode dry-run; read the report, fix the mapping; then write, then write again: it must add nothing.

Paste into Claude Code
The rehearsal import has run on the development project. On a new branch projects/rehearsal, run /api/projects/schedule on each imported project (on the development project only) and write docs/projects-cutover.md: the dry-run and write counts (export rows, imported rows, skipped rows with reasons), and for each imported project the old finish date against the engine's, the old critical path against ours, and ten tasks' start and finish side by side from the imported baseline's variance report. Leave a column "Why" for me to fill. Open a pull request titled "Projects rehearsal" and wait for the checks.

The same day, when the Why column is filled: run supabase/snippets/remove-projects-rehearsal.sql in the development SQL editor, delete the file from the bucket and your local copies, write the removal date in docs/imports/projects-approved.md, reload the made-up data with npm run seed:dev, and tell IT in writing.

You will see recreated screen

github.com/acme-ops/acme-platform/actions/runs/…
import-projects · target development · dry-run · from main · nothing written
1
CheckCount
Projects in file14
Tasks612
Links (FS / SS / FF / SF)540 / 31 / 12 / 0
People not matched3
Predecessors not parsed2
Cycles0
The dry run's job summary: the file is the approved one, problems named, nothing written yet.
  1. Counts you will compare with the production run.
  2. Nothing is guessed: every problem waits for you.

Check it worked

IT's written approval is filed and the copy was redacted; expected, imported and skipped counts add up; the second write added nothing; docs/projects-cutover.md explains every difference in finish dates and critical paths; the same day the development project holds no imported row and the removal date is in docs/imports/projects-approved.md.

Fastest path

Do dry run, write and write-again from the Actions page in one sitting; the third run proves cut-over day can be rerun.

If it goes wrong

The engine's finish is two days later than the old tool's

Usually a calendar (the old tool skipped a holiday differently), a lag in hours not days, or a constraint the old tool kept. Write the cause in the Why column; never edit the imported baseline.

The run refuses the file, or fails on a count

It is doing its job: the file is not the one owner two approved, or it changed. Run import-count.mjs on the uploaded file, record its sha256 and counts through a pull request, and run again. Never loosen the check.

"password authentication failed for user prj_importer"

The user name must carry the project reference (prj_importer.tsrqponmlkjihgfedcba) and the password must be the development one.

Step 13

Session 6: The final import into production, and the importer switched off

40 minutes

Why

Production holds the record the business will run on, so the final import runs only through the same tested workflow as the rehearsal, started by you from main, with production's password typed by you and an export whose fingerprint and counts owner two approved in a merged pull request. The old tool goes read-only first so nothing changes during the copy, and the importer is switched off straight afterwards: a login that can write imported rows has no business existing once the move is done.

Do this

  • Write the cutover date, who tells the team, the date the old tool becomes read-only, and how to go back in the first week, in docs/projects-cutover.md.
  • Set the old tool to read-only on the date.
  • Take the final export, run import-count.mjs on it, and record its sha256 and counts in docs/imports/projects-approved.md through a pull request owner two approves and merges.
  • In the live SQL editor set prj_importer's password; type the repository secret PRJ_IMPORT_DATABASE_URL_PROD (user prj_importer.abcdefghijklmnopqrst); upload the export to the private bucket imports on the live project.
  • Start the workflow from main: target production, dry-run; compare its counts with the rehearsal's; then write. It refuses an export not listed and fails on any count mismatch.
Open

https://github.com/acme-ops/acme-platform/actions/workflows/import-projects.yml

Run workflow from main: target production.

Then switch the importer off at cut-over:

Paste into Claude Code, then paste the live counts
The production import is done. On a new branch projects/cutover: a migration (npx supabase migration new projects_importer_off) that sets prj_importer to NOLOGIN, with a test that it cannot log in; remove prj_importer from docs/matrix.json and regenerate the rules with scripts/gen-policies.mjs; mark its rows in docs/prj-operations.md "retired 2026-…" with today's date; mark PRJ_IMPORT_DATABASE_URL_DEV and _PROD removed in docs/KEYS.md; and in docs/projects-cutover.md record the production counts I paste below beside the rehearsal's. Then, read-only on production, check three imported tasks' dates, assignee and dependency type, including one that is not FS. Open a pull request titled "Projects cutover record" and wait for the checks.

Production counts:
<paste the count table from the production run's summary>

After it merges and the deploy workflow has applied the migration, delete both PRJ_IMPORT_DATABASE_URL secrets on GitHub.

You will see recreated screen

claude — acme-platform
⏺ Bash(node scripts/gen-policies.mjs)
⎿ Wrote supabase/migrations/20261120090000_policies.sql (prj_importer removed: 5 policies dropped)
1
⏺ Bash(gh pr checks --watch)
⎿ access pass (prj_importer: nologin, 0 policies)
⏺ Pull request #110 is green. Production holds 14 projects, 612 tasks and 583 links, matching the rehearsal; 31 SS and 12 FF links survived. The importer can no longer sign in or be granted a page.2
The importer is removed from the matrix, so the generated rules and pages refuse it everywhere.
  1. Removing the role is a matrix change like any other, reviewed and tested.
  2. The non-FS links are the proof the first pitfall is gone.

Check it worked

The production run started from main with an approved export; its counts match the approved line and the rehearsal, with every skip explained; prj_importer is NOLOGIN and its secrets are deleted; three tasks checked against the old tool.

If it goes wrong

Production pages fail with "column does not exist"

A migration is merged but not applied. Check the deploy workflow's last run and the daily freshness check from Session 11; never run db push by hand. Our live database once fell nine migrations behind.

The counts differ from the rehearsal

Projects changed in the old tool after the rehearsal, before it went read-only. List the projects that differ from the dry run and explain each before writing.

Step 14

Session 6: Retire the old tool, clear the last copies, and record the saving

25 minutes

Why

The module is finished when the old bill stops and the saving is a fact from invoices. Deleting the final export from the imports bucket and your computer, once it is in the records store, closes the last place real project data sits outside production's tables.

Do this

Paste into Claude Code
On a new branch projects/retired, update docs/projects-inventory.md: mark each project moved, archived or still in the old tool, with today's date; and add to docs/projects-cutover.md the saving: the old bill from the invoices (I will paste the figures), minus what the module adds to services we already pay for, plus any AI or message charges. Open a pull request titled "Projects retired" and wait for the checks.
Open

https://supabase.com/dashboard/project/abcdefghijklmnopqrst/storage/buckets

Live Storage: delete the final export from the imports bucket once it is in the records store.

Store the old tool's final export in the company's records store, read its cancellation terms on your account page, cancel or write the end date, and delete local copies.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/projects-cutover.md)
+## Saving (from invoices)
+Old tool: <from the invoice, number and date>
+Module: no new service; AI drafts off
+Cancelled on <date>; final export in the records store.
1
⏺ Pull request #112 is green. 14 projects moved, 22 archived, 0 left in the old tool.2
The retirement record: what moved, and the saving from invoices.
  1. Every figure from an invoice.
  2. Anything not moved is written down.

Check it worked

The old tool is cancelled or has its end date written; the final export is in the records store and gone from the bucket and local folders; docs/projects-cutover.md records the saving from invoices.

If it goes wrong

Someone wants to keep the importer for a late project

A late project is a new export: it is approved through docs/imports/projects-approved.md and the login switched on by a person for that one run, then set to NOLOGIN again.

The notice period means one more renewal

Write the end date and that renewal in docs/projects-cutover.md; count the saving from the end date.

Before you go on · The module is done whenTick each one

Knowledge check

How is an old tool's plan held after the import?

Knowledge check

What happens to the cut-over importer after the final import?

References

  1. GitHub Docs: Manually running a workflow. https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow
  2. Smartsheet: best Gantt chart software (tools this module replaces). https://www.smartsheet.com/content/best-gantt-chart-software
  3. Supabase Docs: Database migrations. https://supabase.com/docs/guides/deployment/database-migrations

Chapter 5 · 12 questions · 80% passes

Final assessment

Twelve questions across the module. Score 80% (10 of 12) to pass. Your LMS records your score and each answer; you can review the chapters and try again.

15 min12 questions≈ 15 minutesRetake allowed

Choose one answer for each question, then submit. You will see the right answer and why for every question.

1. Which project types does prj_project allow?
2. A portfolio weights value 40, risk 20 and strategic fit 40. A request scores 5 for value, 2 for risk (5 is the lowest risk) and 4 for fit. What is its total_score, as the sum of weight times score divided by the sum of the weights?
3. Which dependency type means the successor cannot finish until the predecessor has started?
4. A task has an early finish of 8 and a late finish of 11. What is its total float in days?
5. Why is a tool that supports only finish-to-start dependencies a pitfall?
6. A project has no saved baseline. What can nobody do?
7. What should the committed amount on a budget line equal?
8. A project has planned value of 250 and earned value of 300 at the status date. What is the SPI?
9. BAC is 1,000 and CPI is 0.80. What is the EAC if current cost performance continues?
10. A task assignee has finished fixing a punch item. What status do they set?
11. Risk X has probability 5 and impact 2, risk Y has probability 3 and impact 4, and risk Z has probability 2 and impact 5. Using probability × impact, which one is escalated first?
12. After the import, the new module's finish date is two working days later than the old tool's. What do you do before cutting over?