=== UAIX.org UAI Memory Management ===
Contributors: uaix
Tags: ai, memory, documentation, admin, export
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 3.171.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage .uai memory, persona files, docs/wiki records, update prompts, and portable UAI memory packages from WordPress.

== Description ==

UAIX.org UAI Memory Management gives WordPress administrators a guarded place to inspect, edit, export, import, and review local AI memory records.

The plugin manages the active site's `.uai/` files, recognizes Advanced Persona memory under `.uai/personality/` and `.uai/Personality/`, opens supported files under existing `docs/` and `wiki/` folders, and keeps portable UAI memory package export/import tools available for reviewable handoff work.

It replaces the earlier internal UAI-1 Project Handoff package. Sites that still have the legacy `uai1-project-handoff` plugin active should deactivate and remove that legacy package before activating UAIX.org UAI Memory Management.

The Memory Explorer follows a current-memory rule: hot `.uai` files should hold present truth, blockers, next actions, current constraints, and concise pointers. Old reports, superseded notes, raw source, bulky history, and stale claims belong in a durable target that fits the project. Local docs/wiki can fit bounded local work; project groups and organizations usually need a shared wiki or shared memory system with ownership, review state, governance, and retrieval.

This plugin does not call an AI model. It stores local records, validates package shape, detects nearby WordPress AI infrastructure for metadata only, and generates copyable update prompts that point agents to the UAIX.org AI Memory Package Wizard.

== Features ==

* Top-level admin menu: UAIX UAI Memory.
* Dashboard start panel with direct links to Memory Explorer, Settings, Export, Import, Validation Report, and Memory Packages.
* Memory Explorer for `.uai`, `.uai/personality`, `.uai/Personality`, existing `docs`, and existing `wiki` roots.
* Guarded editing for `.uai`, `.human`, `.json`, Markdown, text, and YAML files in supported roots.
* Advanced Persona file support including religion/worldview, political leaning, sense of style, physical appearance, birth-age-generation, age, and romantic orientation records.
* Memory health warnings for missing launch-baseline files, oversized hot memory, date-log drift, stale short-term memory review windows, and incomplete Advanced Persona file sets.
* Copyable update prompts for agents, including the default `https://uaix.org/en-us/tools/ai-memory-package-wizard/` target.
* WordPress AI ecosystem panel that detects WordPress AI Client/Connectors availability and common AI plugins without sending memory to those tools.
* UAI memory package ZIP export with manifest, AGENTS.md, `.uai/readme.human`, context files, prompts, conversations, metadata, content, model records, code index, and validation report.
* ZIP import with validation preview and human confirmation before applying imported UAI memory package records.
* REST endpoints for export, import, and validation.
* WP-CLI export command: `wp uai1 export`.
* Capability-based security with path traversal blocking, file size limits, safe extensions, nonce checks, and WordPress capability checks.
* Workspace-version guidance: generated current `.uai` records point to root `workspace.uai` when a multi-project workspace owns package versions, without restating the version number.

== Installation ==

1. Deactivate and remove the legacy `uai1-project-handoff` plugin when it is present.
2. Upload the `uai-memory-management` folder to `/wp-content/plugins/`, or install the UAIX.org UAI Memory Management ZIP package from Plugins > Add New > Upload Plugin.
3. Activate the plugin.
4. Open the top-level UAIX UAI Memory menu in wp-admin. Start on Dashboard, then open Memory Explorer to review the detected `.uai`, Advanced Persona, docs, and wiki memory roots.
5. Open UAIX UAI Memory > Settings and review the default author, JSON formatting, wizard URL, and short-term review-age settings.

== Usage ==

= Memory Explorer =

Use UAIX UAI Memory > Memory Explorer to review status, copy an update prompt, and edit supported site-relative files such as `.uai/short-term-memory.uai`, `.uai/personality/voice.uai`, `.uai/Personality/identity.uai`, `docs/memory-runbook.md`, or `wiki/source-memory.md`.

Only supported text-oriented file types can be edited. The plugin blocks path traversal, executable files, unsupported roots, oversized files, and invalid JSON saves.

= WordPress AI ecosystem =

Use UAIX UAI Memory > Dashboard to inspect the WordPress AI ecosystem panel. It reports whether the WordPress AI Client, connector registry, or common AI plugins appear to be present. The safe pattern is to review memory first, then intentionally give an AI the selected prompt, file set, or exported ZIP. The plugin does not automatically send local memory to an AI provider, sync memory into another plugin, or certify generated output.

= Export =

Use UAIX UAI Memory > Export to download a UAI memory package for selected UAI memory records, posts, pages, or custom post types. The package is meant for reviewable handoff work, not as automatic certification or endorsement.

= Import =

Use UAIX UAI Memory > Import to upload a UAI memory ZIP package, preview validation results, choose duplicate/merge/overwrite behavior, and apply imported records only after human review.

= REST =

Export a project:

`POST /wp-json/uai1/v1/export/123`

Import a package using multipart form-data:

`POST /wp-json/uai1/v1/import` with file field `package`.

Validate a package using multipart form-data:

`POST /wp-json/uai1/v1/validate` with file field `package`.

= WP-CLI =

`wp uai1 export --id=123`

`wp uai1 export --post_type=uai_project --include_media=references`

== Frequently Asked Questions ==

= Does this certify my package as UAIX compliant? =

No. The plugin creates and validates a practical WordPress UAI memory package. Public conformance claims require separate published validator and release evidence.

= Does it call an AI model? =

No. The plugin stores and exports UAI memory package metadata locally. It detects whether the WordPress AI Client is available, but export/import runs locally and does not send prompts to any AI provider.

= Can it edit docs and wiki files? =

Yes, when a `docs/` or `wiki/` folder already exists at the site root. Those roots are supported for safe text-oriented files only: `.md`, `.txt`, `.json`, `.yml`, and `.yaml`.

Site-local roots are support, not a universal recommendation. Use local docs/wiki for bounded local work. Use shared wiki or shared memory systems for project groups, departments, corporate knowledge, client portfolios, and cross-site programs.

= What does "memory out of date" mean here? =

The plugin warns when current memory appears incomplete, oversized, unchanged beyond the configured review window, or shaped like dated history. Current memory should be corrected or replaced; old evidence should move through scale-fit durable memory routing with a concise pointer.

= Where should package versions live? =

In a multi-project workspace, the root `workspace.uai` owns the current deployment/package version. Site, project, plugin, theme, and generated `.uai` memory records should point to that coordinator instead of carrying direct current/deployment/package-version numbers. Separate workspace roots keep separate version streams, so one workspace can tick forward without changing another workspace's coordinator. Package-version evidence belongs in manifests, checksums, upload instructions, package metadata, durable release reports, and archives, not active `.uai` memory ledgers.

= What is the intake folder for? =

Generated UAI memory packages include `agent-file-handoff/Content/` and `agent-file-handoff/Improvement/` as active review workspaces. Agents should inspect, summarize, and disposition active files before unrelated broad work. Processed originals should move to the configured durable memory target when one exists.

== Hooks and Filters ==

`uai1_project_handoff_manifest` filters the generated keyed manifest.

`uai1_project_handoff_manifest_extensions` adds extension records to the manifest.

`uai1_project_handoff_code_snippets` adds code snippet records to `/code/code-snippets.json`.

`uai1_project_handoff_detected_ai_plugins` customizes detected AI plugin metadata.

== Changelog ==

= 3.171.0 =

* Recovers from unknown partial early loaders by continuing bootstrap, loading missing classes conditionally, and registering the real admin pages.
* Limits duplicate-package warnings to versioned full package loads so Memory Explorer and Settings links do not point at unregistered pages.

= 3.170.0 =

* Makes duplicate-load handling idempotent so upload/activation re-entry does not show a false duplicate-copy warning or suppress admin links.
* Keeps true different-copy warnings actionable with loaded/current basenames and fallback admin row links.

= 3.169.0 =

* Renames the public package runtime symbols away from the old UAI-1 Project Handoff globals so hidden legacy symbols no longer block the UAIX UAI Memory admin menu, Settings page, or plugin-row links.

= 3.168.0 =

* Repairs admin capabilities after plugin ZIP upgrades and makes Dashboard, Settings, and Memory Explorer visible from the Plugins screen.

= 3.166.0 =

* Repairs administrator capabilities during normal upgrades and adds stronger plugin-row links.

Older release history is available in `changelog.txt`.

== Upgrade Notice ==

= 3.171.0 =
Fixes the unknown earlier-loader path that could leave Memory Explorer and Settings links visible but route them to unregistered admin pages.
