Kulcare Docs

Hospital Instruction and Workspace Cleanup Record

Instruction corrections, exact plan preservation, merged-branch evidence, and local recovery files.

Scope

The user approved instruction corrections, preservation of eight plan edits, branch reconciliation, and removal of confirmed obsolete local references. This record does not approve deployment, clinical readiness, or Inventory pilot use.

Work uses docs/hospital-standards-and-plan-preservation, created from remote base 9e4d1c5f9e2f2c386be54aae33d2de5fd49d3416 in worktree 8a43. Instruction commit: 6b4aca8a2b. Plan preservation commit: a8536d0599.

Related: PR 2700, issue 2517.

Instruction Corrections

Root and scoped instructions now require current domain patterns, shared frontend services/UI, shell identity/RBAC, Admin flags, explicit RLS and policy tests, forward migrations, audit evidence, and the software pattern review checklist.

The instructions no longer prescribe deprecated application architecture or RSpec. They explain that Hook warnings and existing TypeScript debt are not blocked by the current ratchets. No lint rule or application behavior changed in this batch.

Preserved Plans

All eight files were committed without changing their existing working contents. Each committed Git blob was compared with the file hash recorded before staging.

Plan suffixPreserved blob
001 backend API integrationdf0c9ca249f4b9a8f8dbb8a8a23f84515c7a13b7
002 foundation and securityf02674e8522bd45bfdbf92730a18abd1be3a4561
003 surgical case and OT5a38322071863ed56ef2890fd31944b11d0fbc34
004 readiness and integrations1e849395d68a31776cb824c496794b255a1dcc9e
005 recovery, MAR, inventory6cfe7869c674960f55116321c2462f7a7eecee7c
006 Hospital 50 and migrationd2c9a0c833ddf3a55ec17e7a5e3dd0b8877775c4
007 package billing and TPAf793cca787ad1cee983824c00c107372980382f1
008 reports and pilot cutover747311f1d777f7b6fe43d96adcc3a67e05bea490

Files are under docs/plans/, with prefix 2026-09-26-. These are historical audit amendments, not a fresh completion audit. Some passages still describe work as missing or local although later implementation has merged. Reconcile those status passages against code and the release acceptance record before using a phase's text to claim completion. Preservation does not implement a workflow.

Branch Reconciliation

Squash merges do not preserve the old head as a base ancestor. Cleanup therefore used merged PR head receipts and patch comparisons, not only git branch --merged. All six PR merge commits below are ancestors of the audited remote base.

Removed local branchOld tipDelivery evidence
codex/surgery-center-on-new-schemaad0ede3aadExact merged head of PR 1731
codex/hospital-readiness-u40916365eedExact merged head of PR 2519
fix/hospital-lockfile-api-client76c8a4c4b2Exact merged head of PR 2528
feat/hospital-demo-seed90443fab54Exact merged head of PR 2597
feat/hospital-readiness-qa-inventory3708170120Exact merged head of PR 2642; working edits preserved on the new branch
codex/hospital-configuration-docs3b74220197Parent is PR 2596's merged head; seed patch equals bd34b9be01 in PR 2597
codex/hospital-surgical-case-ot18376fbc1cTwo later commits reconciled with PR 2596 as described below
codex/backup-surgery-center-pre-schema-sync-202609257ebbde543eSix UI/document patches match rebased commits in PR 1731

The old OT branch's CI commit 18376fbc1c has the same stable patch ID as d6fdb79f49, PR 2596's merged head. Range comparison of configuration commits e9a77006d7 and cd6637e5ff shows only SQL migration-marker placement and facility-switch guard context differences. The current layout retains the guard and cache cancellation; no old implementation was reapplied.

The six pre-schema patch pairs all have equal stable patch IDs: 797d5ef3e3 / 1d59fd0ab1, 65f8397762 / d520e4d7df, 6da9d4a60c / 57436086c6, d4a7ac2b0d / 54d1a3de22, a9d2396869 / 439f2f4f1b, and 7ebbde543e / e99b460a7e.

Four local remote-tracking refs were removed only after git ls-remote confirmed the GitHub branches were absent: the OT, Surgery Center, readiness/Inventory, and lockfile refs. No GitHub branch was deleted. The live remote codex/hospital-configuration-docs was retained.

Worktree And Recovery

Removed /private/tmp/kulcare-hospital-pr-base-ci, detached at 093644e755. Its tracked and untracked status was clean. lsof found no open files within it. The first removal attempt was blocked until ignored configuration was separately archived. Removal then succeeded without --force.

Recovery files remain local, outside Git, in the active worktree:

.context/hospital-cleanup-2026-10-14/old-hospital-refs.bundle
.context/hospital-cleanup-2026-10-14/base-ci-evidence.tar.gz
.context/hospital-cleanup-2026-10-14/base-ci-local-config.tar.gz

The bundle contains all eight original branch tips. git bundle verify passes. It is incremental and requires ancestors retained in the remote base. The evidence archive contains backend logs, temporary test files, and exports. The configuration archive contains the ignored database configuration and master key. Those files also matched the active worktree's copies before removal. Both gzip archives passed integrity checks. The archive directory has mode 700; the files have mode 600. Do not upload them to a PR or share them as QA evidence.

To restore an old branch, run from this repository and choose an unused name:

git fetch .context/hospital-cleanup-2026-10-14/old-hospital-refs.bundle refs/heads/codex/hospital-surgical-case-ot:refs/heads/recovered/hospital-surgical-case-ot

The current 8a43 worktree, detached 41da worktree with untracked work, main checkout, Billing worktree, and all other agents' worktrees were retained. No database was reset, reseeded, or changed.

Verification And Manual QA

  • Resolve all 23 local links in the corrected instruction files and checklist.
  • Resolve all 13 local links in the eight preserved plans.
  • Compare all eight preserved blobs with their original working-file hashes.
  • Verify merged PR receipts, base ancestry, patch comparisons, and recovery bundle.
  • Check archives, worktree status, and active file use before removal.
  • Open the checklist and this record in Fumadocs. Confirm navigation and links.
  • Review historical plan status passages before the next implementation phase.

Application tests were not rerun for this documentation-only batch. Documentation build results are recorded in PR 2700. They do not prove staging or pilot acceptance.

On this page