Skip to content

Spin out agents-api-default-stores companion plugin (guideline + markdown + CPT session) #78

@lezama

Description

@lezama

Problem

Two consumer plugins are independently shipping the same concrete store implementations against this substrate's interfaces:

  • A guideline-CPT-backed memory store. Implements AgentMemoryStoreInterface against the wp_guideline CPT defined by the substrate's Guidelines/ polyfill (or the future Gutenberg-native equivalent per WordPress/gutenberg#77230).
  • A markdown-file-backed memory store. Implements the same interface against on-disk markdown files using a deterministic path encoding.
  • A CPT-backed conversation transcript store. Implements ConversationTranscriptStoreInterface using a CPT for sessions.

Two consumers maintaining two parallel impls of the same shape is duplication, and any third-party plugin that wants to use this substrate has to write its own from scratch even though three working impls already exist in the wild.

Proposal

Spin out a sibling repo Automattic/agents-api-default-stores (working name) containing the reference store implementations consumers can opt into. Boundary:

Stays in Automattic/agents-api (canonical substrate) Moves to agents-api-default-stores
AgentMemoryStoreInterface and value objects WP_Guideline_Memory_Store (concrete)
ConversationTranscriptStoreInterface and value objects WP_Markdown_Memory_Store (concrete)
Guidelines/ CPT polyfill + capability map WP_Agent_CPT_Session_Store (concrete)
Workspace, identity, auth, consent, runtime contracts (nothing else for v1)

The companion plugin requires the substrate as a hard dependency. Substrate has zero knowledge of the companion — consumers wire one of the default stores into their AgentConversationLoop adapter slots, or write their own.

Why a separate plugin and not a src/Stores/ directory in canonical

  • Canonical stays purist. The README's existing boundary is contracts + value objects, no concrete persistence policy. Adding concrete stores to canonical would either bloat that contract or force an opt-in build flag.
  • Adopters can pin separately. A WPCOM-like consumer might pin canonical at v2 but stay on default-stores v1 because of a schema migration that doesn't fit their rollout window. Coupling them in one repo loses that flexibility.
  • Deletion path is clean. When Gutenberg ships the native guideline post type, the polyfill in canonical becomes a no-op (per its existing wp_guidelines_substrate_enabled filter), and the guideline-backed store in default-stores keeps working unchanged. If both lived in canonical, the deletion has more surface to coordinate.
  • Match the WordPress core / abilities-api pattern. Core ships the contract, plugins ship implementations. Default-stores is the official-but-optional implementation, exactly like the abilities-api ecosystem assumes.

Acceptance criteria

  • New repo Automattic/agents-api-default-stores exists with the three default stores, smoke tests, and a clear README pointing back to canonical.
  • Each default store has an interop test that runs against the canonical interface as ground truth.
  • The two consumer extractions can opt into the default stores (deleting their local copies) in one focused PR each.
  • Outside adopters get a working store wired up in <10 lines of bootstrapping code.
  • Canonical's Guidelines/ polyfill exposes the constants and capability map the guideline-backed store depends on (it does today: WP_Guidelines_Substrate::POST_TYPE, TAXONOMY, META_SCOPE, META_USER_ID, META_WORKSPACE_ID).

Open questions

  • Should the markdown store live in the same default-stores repo, or should disk-shaped storage be its own thing? Leaning same repo for v1 — both are "reference impls of the substrate's interfaces" and that's the unifying theme. Splitting later if the dependency surfaces diverge is cheap.
  • The two existing guideline-store implementations have different capability_type defaults — one uses 'post' (matches the PRD direction), one uses the substrate's 'guideline' custom map. Default-stores needs to settle this; canonical's Guidelines/class-wp-guidelines-substrate.php currently uses 'guideline' with _wp_guidelines_map_meta_cap. This is a substrate decision, not a default-stores decision — worth a separate sub-issue.
  • Versioning relationship between canonical and default-stores: hard semver lock (default-stores v1 requires canonical v1.x) or loose (default-stores compatible with canonical >= some floor)?

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Opus 4.7)
  • Used for: Identifying that two parallel consumers ship the same three concrete store implementations and proposing the companion-plugin extraction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions