Skip to content

Policy lifecycle

The policy lifecycle module starts from a policy document (Markdown, PDF or DOCX) and a list of departments. It prepares one Course Builder course for each department, every lesson and quiz question citing the policy text, and gives the policy owner a dashboard of who is trained. Everything is available through the API (/api/admin/policies), the CLI (ulams policies) and the Policies screens of the Studio (/studio/policies, in English, Polish and Chinese).

The Studio rail has a Policies entry (for people with policy_owner or policy_manage).

  • Policies lists your policies with the version in force and any version in review.
  • New policy takes the file, the course length and the departments (name, seniority, prior experience, optional minutes) and creates the policy; nothing is generated yet.
  • A policy shows each department’s stage with a link to its builder session, who is trained (assigned, completed, pending, overdue, completion rate), the people with their course version, policy version and certificate (filter by department and status, page through, export as CSV), the versions, and the buttons that apply now: generate the department courses (with the cost estimate), approve version 1 (the reasons it cannot be approved yet are listed), and upload a change.
  • A version in review shows what changed in the policy text, how each department’s course is updated (with a link to its update in the Studio), the suggested change class with its reasons, the pre-flight (certificates to revoke and people to reassign per department, which follows the class you pick), the reason field (required to lower the class), approve, and reject with a reason.

Every state is written out, tables scroll sideways in a focusable region on a small screen, and everything works by keyboard; the screens are checked with axe (WCAG 2.2 AA) at desktop and phone width.

A department can have a separate academy: its own tenant (database, files, theme and users), created from a tenant template. On the policy page each department has an Own academy block: pick a theme preset and an accent colour, and ask. The platform creates the tenant from the template (POLICY_ACADEMY_TEMPLATE, or the template you send), styled for the department, records it as created for that department, and moves the department’s reviewed builder session there; its author is invited by e-mail and applies and publishes the course in the academy. Asking again after a failure resumes the same tenant and does not move the course twice. Remove the academy (after a confirmation) deletes that tenant with everything in it.

It is a platform operation, so it needs TENANCY_NEW_SITES=true and a platform administrator, like a new site for a course (ADR 0048); a platform limit (TENANCY_MAX_DERIVED_PER_PARENT, default 5) applies and its message is shown if it is reached. What stays here: the policy, its versions and changes, the certificates and this dashboard. What the academy has: the department’s course (cited as before), its own learners (invite or import them there) and its own certificates, which this dashboard does not count. Departments that need only a look and an address of their own, without separate data, use branded entry points inside one academy instead (ADR 0195, a separate effort).

API: GET|POST|DELETE /api/admin/policies/{policy}/variants/{variant}/academy.

A person who was given training again because of a policy change sees it on My training: the policy and its new version, whether they take the exam or the course, and the source diff in one sentence (GET /api/policies/my-changes, only their own rows). The public verification page of a certificate that a policy change replaced says which policy version replaced it.

Permission Allows
policy_manage Every policy of the tenant: create, generate, approve, read the dashboard. The admin role has it.
policy_owner The policies the user owns. Give it to the people who own policies (HR, compliance, a team lead).

An admin can act for an absent owner; the audit records that the approver was not the owner. Both permissions also need the Course Builder permission (course_builder_use) for the owner to review the courses in the Studio.

  1. Create the policy. POST /api/admin/policies (multipart) with title, file, the shared brief (totalMinutes, lessonMinutes, language, tone) and departments. Each department has a label, an optional group_id (the audience; a new group is created when omitted), seniority (junior, mid, senior, mixed), priorExperience (none, some, expert) and optionally its own totalMinutes. The file is stored privately as version 1, a draft. Nothing is generated yet.
  2. Look at the estimate. GET /api/admin/policies/{policy} returns an estimate of the generation cost per department, from the builder’s per-lesson figure. It is an estimate, not a quote.
  3. Generate. POST /api/admin/policies/{policy}/variants/generate starts one builder session per department, each with its own copy of the policy file as the source. Departments run one after the other. The module answers the builder’s interview from the policy and department brief (seniority sets the level, prior experience is stated in the target group, a final test is always included) and stops at the outline review.
  4. Review in the Studio. Approve the outline, let the lessons generate, approve the apply and publish the course, exactly as for any generated course. Each department’s session is in the owner’s list of builder sessions, titled <policy> / <department>.
  5. Approve the version. POST /api/admin/policies/{policy}/versions/1/approve works once every department course is applied and published; the answer lists what is still missing otherwise.

On approval each department’s course becomes mandatory (default_due_days is the policy’s major due days, 30 by default), a one-course learning path is created, and an enrolment rule group equals <audience group> enrols the group’s members now and everyone who joins the group later. Reminders, escalation, certificates and the compliance reports apply unchanged.

  1. Upload the new file. POST /api/admin/policies/{policy}/versions (multipart file). The first version must be approved and no other version may wait. The file becomes version N+1, in review, and a new revision of each department’s source, so Living Course finds what changed and prepares one update proposal per department. A file with the same text is refused. A department whose course cites nothing that changed shows no_change and is left alone.
  2. Review. GET /api/admin/policies/{policy}/versions/{n} returns the source diff (built from the stored fragment changes, not generated), each department’s proposal and what still blocks approval, the suggested change class with its reasons, and a pre-flight: per department, how many certificates approving will revoke and how many people it will reassign. Decide each item of each proposal in the Studio (or living-course endpoints). Items the model could not propose a change for (for example final-test questions) are yours to edit; until you do, the exam carries the old question.
  3. Approve. POST .../versions/{n}/approve with an optional change_class (minor or major), reason and overwrite. The class is suggested from the proposals: major when an item changes the meaning of a lesson, changes a quiz answer, adds a lesson or removes a question, otherwise minor. You may raise it freely; lowering it needs a reason, which is recorded. Every department course is updated; nothing below runs unless all of them are. If one fails, the version returns to review and approving again resumes.
  4. Roll out. For everyone whose live certificate certified the previous version of a department’s course, the certificate is revoked (reason policy_superseded:v<N>) and they are given the exam (minor change, due in minor_due_days, 14 by default) or the department course (major change, major_due_days, 30) with the assignment source policy_change. People who never finished keep their open assignment and see the updated course. The rollout is idempotent per person and version.
  5. Replacement certificate. Finishing the exam or the course issues a certificate as usual; it is linked to the new policy version.

POST .../versions/{n}/reject (with a reason) drops a change in review: its proposals are rejected, the current version stays in force and nobody is retrained.

The exam course is the department course’s own final test, with every question cited to the policy, as a course of its own (one heading lesson and the final test). It is derived from the course you approved, rebuilt after every change, published and kept out of the catalogue. Compliance certifies whole courses, so assignment, certificates and reports work on it unchanged; there is no topic-level exam.

Notices: each reassigned person gets one e-mail and one in-app notice with the source diff, the course or exam and the due date (policy.retraining.assigned webhook); the owner gets one notice with the counts per department (policy.change.approved). A revoked certificate that no policy change superseded sends the holder a notice too. Templates are editable like any other; Polish texts ship. Nothing here is decided by AI: the class is a suggestion, approval is the owner’s, and completion is the course’s own.

GET /api/admin/policies/{policy}/dashboard returns, per department, the stage of the generation (waiting, ingesting, outline_review, generating, apply_review, applied, failed) and the counts assigned, completed, pending and overdue; and a page of people with the course version they took, the policy version their certificate certifies, and the certificate with its verification path. Filters: variant (department), status, per_page.

GET /api/admin/policies/{policy}/dashboard/export streams the same people as CSV. Each export is recorded in compliance_exports with who exported it. Scoped tokens use the reports area for both dashboard routes and the builder area for the rest.

The people of the dashboard are also the policy_training dataset of the report builder (one row per person and department, with the policy version the certificate certifies): policy_manage sees every policy, policy_owner only their own. The CSV export above stays as it is.

Every state change (policy.created, policy.variants.requested, policy.version.submitted, policy.version.approved, policy.version.rejected, policy.certificate.revoked, policy.reassigned, policy.rollout.applied) is written to the Living Course audit chain, so the existing audit export and verification cover it.

Run the migrations and the permission seeder after an upgrade, once per tenant:

Terminal window
php artisan migrate --force
php artisan db:seed --class="Ulams\\PolicyLifecycle\\Database\\Seeders\\PolicyPermissionSeeder" --force

The module needs a configured AI_DRIVER and a queue worker for the builder queue, like the Course Builder. Without AI, creating a policy and reading its dashboard still work; generating is refused with a clear message.