/maludb-os-integration:os-adoptfrom maludb-os-integration
Fit an EXISTING PHP application (one not built for the MaluDB Business OS) into the kernel — single sign-on from the kernel's launcher, users managed in the kernel's directory, and, for a multi-tenant application, each tenant (a restaurant, a branch, a department's space) mapped to a kernel scope with the application's own roles granted per scope. Works in the application's own repository and leaves it installable by `os-install`. Use when the user says "integrate this existing app with the OS", "adopt <app>", "add OS sign-on to <app>", "make <app> use the kernel's users", or points at a repository that has its own login, users table or tenants.
Ships in maludb-os-integration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An adopted application keeps its code, its schema and its users table. It gains the kernel's
sign-on beside them and hands the management of people to the kernel. Nothing is rewritten that does
not have to be. The contract it must meet is the os-integration skill; this skill is the route an
existing codebase takes to get there. Read os-integration's SKILL.md first, then
../os-integration/references/sign-on-and-directory.md and, when the application has tenants,
../os-integration/references/scoped-applications.md.
kernel launcher ──hand-off token──▶ /sso (new) ──▶ link users.os_member_id ──▶ the app's OWN login function
kernel change feed ──every minute──▶ bin/os_directory_sync.php (new) ──▶ users / tenant table / memberships
the app's guard ──no session──▶ kernel launcher (instead of /login.php, while OS_ENABLED is on)
OS_ENABLED in the application's config. Off: the application runs exactly as it
does today, standalone. On: the kernel's sign-on is the only way in, and the local account screens
are read-only. The flag is also the way back.os_member_id bigint UNIQUE to the users table. When the tenant table
maps to a scope, add os_scope_id bigint UNIQUE to it. The application's own ids stay the keys of
its own data.login_user(), do_login(), Auth::login()). The /sso receiver verifies,
links, then calls it, so every session key the application expects is filled the way it always was.OS_ENABLED is on.Honour the repository's own rules first. Read its CLAUDE.md, README and contribution notes.
If they require a written plan and approval before changes (a tasks/todo.md, an activity log,
pushes after each change), follow them. Work on a branch named os-adoption, never directly on a
server.
Survey. Follow references/survey.md and write the answers into
docs/os-adoption.md in the application's repository: stack and database, the login function and
every path into a session, the guard and how many files call it, the users table, the tenant table
and the per-tenant role table, the local account screens, API and MCP authentication, webhooks,
cron, the model keys it holds, and the security gaps found. Cite each answer as file:line.
Decide the profile, and stop for the owner on anything the survey cannot decide:
location when the tenant is a place (a restaurant, a shop), department when
it is a team's space, none when there is no tenant;OS_ENABLED is on.Record the decisions in docs/os-adoption.md.
Fix the security gaps that would be exposed behind the kernel's name before adding sign-on. Examples: unsigned webhooks, signature checks commented out, public diagnostic pages, cron reachable from the web, one tenant's secrets used as another's fallback, state changes without CSRF. Each fix is its own commit.
Build the adapter in the order of references/adapter.md:
/sso and /sso/logout;maludb-os.json;/api/v1/health;deploy/.The code comes from ../os-integration/references/php-sign-on-kit.md, renamed to the
application's conventions. An application built with htmx-php-builder ≤ 0.4.x has one known
shape; its deltas and the fixes that worked are references/htmx-php-builder-profile.md —
read it before the survey, and expect the survey to confirm it.
Prove it without a kernel (../os-integration/references/testing-without-a-kernel.md), plus
the adoption proofs in adapter.md §9. The most important of those is the standalone proof:
with OS_ENABLED off, the application behaves exactly as before.
Report. Record what changed, what is proven, what the owner decided, and what the application
still owes the rest of the contract. The rest of the contract means the activity log shipped to
MaluDB, the mcp_* views and the MCP servers, and the model keys that should move to the kernel.
Hand these over by name as the next phase, and do not build substitutes. Commit on the branch and
leave the merge to the owner.
OS_ENABLED is on. Password login, Google sign-in, invitation
acceptance, password reset and "remember me" all redirect to the launcher. API keys stay, but a key
whose user the kernel deactivated stops working, because the guard and the API auth both check the link.OS_ENABLED is on. Its screens say
"Managed in the operating system" and link to it.ACTION_TOKEN_KEY and OS_APPLICATION_TOKEN come
from the installer, in config, git-ignored.os-install.htmx-php-builder-profile.md) keeps one code path for people and agents.What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/os-installInstall an application from its repository onto a server that runs the MaluDB Business OS kernel, and integrate it — database, config, Apache virtual host, services, registration in the kernel (catalog entry, application, roles, endpoints, application token), scopes and per-scope grants for a multi-site or multi-department application, the action registry, skills, the proposed expert — then prove sign-on end to end. Use when the user says "install <app> on the OS", "deploy <repo> into the business OS", "register this application with the kernel", or gives a repository URL to put beside a kernel. The repository must carry a maludb-os.json (built with os-integration, or adopted with os-adopt)./os-integrationPrepare an application for integration into the MaluDB Business OS kernel — including a scoped one that serves several sites (a restaurant each) or several departments, and its own roles and rights published to the kernel (app_roles) and granted by the super-admin — how its memories must be stored (record memory in PostgreSQL 17 with mcp_* visibility views; activity memory as an activity_log shipped to the tenant's MaluDB), how its tables reuse the estate's one data model (survey the sibling applications' schemas first; the same table as a sibling whenever one is close, copied verbatim into the application's own migrations so it installs on any server; data another application owns read through the kernel, never copied — shared-schema.md), how its MCP servers and action manifest must cover every question and every action, how the kernel signs people in (the hand-off token, the directory mirror, the directory API), and how the kernel's agents reach it (run tokens, tool grants, approvals, the ledger, skills, the shipped expert, the command bar through the kernel's chat endpoint, the maludb-os.json registration). Use when building or auditing an Apache/PHP/HTMX application that will be installed beside the Business OS on a tenant's server, when the user says "integrate with the OS", "make this app agent-ready", "prepare for the installation agent", or asks how an app should expose memory, MCP, sign-on or agents to the platform.Other plugins' skills for the same job
npx claudepluginhub maludb/maludb-os-integration --plugin maludb-os-integration