🤖💬 Cacbot
Cacbot is a WordPress plugin that turns comment threads into conversations with a remote AI-processing service (the “mothership”). Human messages and Cacbot replies are stored as ordinary WordPress comments, so they remain subject to WordPress’s comment, moderation, and privacy controls.
“Cacbot” stands for “Comments Are a ChatBOT.”
📋 Requirements
- WordPress 6.5 or newer. The plugin uses the Script Modules API introduced in WordPress 6.5.
- PHP 8.0 or newer.
- HTTPS access to a compatible Cacbot mothership. HTTP can be enabled explicitly for local development only.
- Working WP-Cron and outbound HTTP requests for generated replies.
✨ What the plugin does
- Registers the public
cacbot-conversationcustom post type, available from the WordPress REST API atwp/v2/cacbot-conversations. - Can treat a post of another type as a conversation when its
_cacbot_conversationmetadata is exactly1. - Responds to newly approved comments from registered users who do not have the Cacbot role.
- Queues mothership delivery through WP-Cron, so comment submission does not wait for the remote service.
- Stores generated, fixed default, and failure replies as threaded WordPress comments.
- Supports site-wide and per-conversation system instructions.
- Supports a fixed local response in place of remote generation.
- Can close comments when a configured approved-comment limit is reached.
- Provides optional integration points for the separate Anchor Posts and Frontend Data Service plugins.
🚀 Create a conversation
- In WordPress administration, go to Cacbot Conversations → Add New.
- Add a title and optional body.
- Make sure comments are enabled.
- Choose the appropriate visibility. Use Private when only authorized logged-in users should see the post.
- Publish the conversation.
- While logged in, open it on the front end and submit a comment.
The post title and body are exposed to the mothership as conversation context; shortcodes are removed from the body rather than executed. Only approved comments by registered, non-Cacbot users enter the response pipeline. A held comment enters the pipeline if it is later approved. Guest comments, Cacbot-authored comments, and comments on unrecognized posts do not.
⚙️ Configuration
🛠️ Settings → CACBot
Only users with manage_options can use this page. It provides the mothership URL, global system instructions, connection status, and a Reconnect action.
🛸 Mothership URL
The effective URL is selected in this order:
- The
cacbot_mothership_urloption. - The
CACBOT_MOTHERSHIP_URLconstant. https://cacbot.com.
Saving a changed URL starts reconnection. Requests containing credentials are restricted to HTTPS. Local development may opt into HTTP with CACBOT_ALLOW_HTTP; the cacbot_allow_http filter can override that decision.
define( 'CACBOT_MOTHERSHIP_URL', 'https://cacbot.example' );
🌍 Global system instructions
The cacbot_global_system_instructions option is sanitized plain text. For each conversation, the context endpoint combines the following non-blank values, separated by a blank line:
- Global system instructions.
- The post’s
_cacbot_system_instructionsvalue. - The post body, only when
_cacbot_include_post_in_contextis exactly1.
Shortcodes are stripped from an included post body. The combined value is passed through sanitize_textarea_field, which removes markup. If every part is blank, the endpoint returns null for system instructions; the unused SystemInstructions::defaultText() helper is not applied by the response pipeline.
📝 Cacbot post editor box
Users with manage_options or the Cacbot role see a Cacbot box on cacbot-conversation posts and on non-attachment post types that support comments.
For other post types, the box includes a Cacbot Conversation checkbox. Once enabled, the box exposes:
- System Instructions (
_cacbot_system_instructions) - Include this post in context (
_cacbot_include_post_in_context) - Comment Form Placeholder Text (
_cacbot_comment_form_placeholder_text)
Clearing the conversation checkbox preserves the other settings. Saving a blank text field deletes that metadata key.
🏷️ Conversation metadata
The following post-meta fields affect behavior in this plugin. Boolean-like fields are not loosely interpreted: where the documentation says “exactly 1,” WordPress must read the stored value as the string "1".
_cacbot_conversation
Marks a post outside the cacbot-conversation post type as a conversation when exactly 1. Every cacbot-conversation post is recognized without this field.
_cacbot_system_instructions
Plain-text instructions appended after the global instructions. The implementation neither treats an integer as another post ID nor executes shortcodes in this value.
_cacbot_include_post_in_context
When exactly 1, appends the post body to the system instructions. Shortcodes and markup are removed during instruction sanitization.
This key is intentionally not copied from an Anchor Posts anchor to a linked post. This prevents the linked post’s placeholder body from being added to its instructions.
_cacbot_model
A plain-text model profile name or exact model ID sent as conversation_config.model. The plugin does not validate available models. A compatible processing unit decides which values it supports and what default to use for a missing, blank, or unsupported value.
_cacbot_default_response
A non-blank value is posted immediately as the Assistant’s threaded reply. No mothership job is queued for that comment. The value is filtered through the same allowed-comment-HTML policy as generated replies.
_cacbot_suppress_llm_response
The exact value "1" suppresses remote generation for newly considered comments. It does not suppress a configured _cacbot_default_response and does not cancel work already queued.
Trusted code can override the metadata-derived decision for one comment:
add_filter(
'cacbot_should_respond_to_comment',
static function (bool $shouldRespond, WP_Comment $comment, int $postId): bool {
return $shouldRespond;
},
10,
3
);
The result is cast to boolean. This setting is writable through Cacbot’s metadata route, but is neither exposed in Frontend Data Service’s public payload nor copied by the Anchor Posts integration.
_cacbot_max_replies
Despite its historical name, this value limits the total number of approved comments, including both human and Assistant comments. After a local reply is inserted, or after the mothership accepts a job, Cacbot closes comments when:
approved comments + accepted reply still on its way >= stored limit
The plugin does not preflight this limit before processing every programmatically inserted comment; its enforcement action is to set the post’s comment_status to closed.
_cacbot_comment_form_placeholder_text
Replaces only the placeholder attribute of the comment textarea on a singular view. Missing, blank, whitespace-only, and non-text values are ignored.
With Anchor Posts active, a viewer with an effective linked conversation sees the linked post’s placeholder, falling back to the anchor’s value. The anchor value is also among the settings copied when a linked post is created.
👥 Participant metadata
The response pipeline maintains:
_cacbot_interlocutor_user_id: the first user whose comment actually starts a local or remote response._cacbot_respondent_user_id: the provisioned Assistant user selected to reply.
These values describe participants; they do not enforce a two-person conversation. The metadata REST route does not permit either field to be written.
🧩 Compatibility metadata
The plugin recognizes durable integration keys including _cacbot_reply_strategy, _cacbot_action_enabled_create_image, _cacbot_action_enabled_build_plugin, _cacbot_action_enabled_create_new_linked_post, and _cacbot_max_archives. Their presence does not mean this plugin implements those operations or provides a UI for them. Such behavior belongs to companion plugins or the remote processing deployment.
🔄 Reply lifecycle
- WordPress stores an approved, eligible human comment, or a held comment becomes approved.
- Cacbot checks suppression/default-response policy and marks a comment as processed only if a local or remote response will be attempted.
- Cacbot records participants and either inserts
_cacbot_default_responseor schedules a single WP-Cron event. - The cron job sends the post ID and comment ID to the mothership using HTTP Basic authentication with the stored mothership credential. A test correlation ID may also be sent when special scenario metadata is present.
- The mothership reads paginated conversation context from the authenticated Cacbot REST endpoint and later returns a reply or terminal outcome.
- Cacbot sanitizes a successful reply and stores it as a threaded comment.
Delivery is attempted at most five times for connection failures, HTTP 429, server errors, and acknowledgements without a job ID. Other HTTP failures are terminal. If initial delivery is unavailable or ultimately fails, Cacbot inserts a visible error reply when it can assign a respondent and records an administrator notice. A mothership no_reply outcome clears the pending state without inserting a reply; a failed outcome inserts an error reply once per job.
📡 Data sent to the mothership
The initial comment-event request contains the post ID and comment ID, plus an optional test correlation ID. The authenticated conversation-context endpoint can then expose:
- Post ID, title, body with shortcodes removed, and GMT creation time.
- Approved comment IDs, parent IDs, GMT creation times, content, and pseudonymous participant labels.
- Whether each comment is human- or Assistant-authored, plus the kind of Assistant reply.
- Combined global, per-conversation, and optionally post-body system instructions.
- The conversation’s sanitized
_cacbot_modelvalue. - The anchor post ID for a valid linked post.
- Whether the triggering comment remains approved.
The context response does not include comment-author names, email addresses, IP addresses, or arbitrary comment metadata. ⚠️ Post and comment content can still contain personal or sensitive information. Site owners are responsible for disclosure, consent, retention, and the privacy terms of their configured mothership and model provider.
🤝 Optional companion plugins
⚓ Anchor Posts
The separate Anchor Posts plugin can provide a public anchor backed by a private linked cacbot-conversation for each signed-in viewer.
- Anchor Posts owns
_cacbot_anchor_post,_cacbot_linked_to, linked-post creation and selection, comment routing, link routes, and cleanup. - Cacbot contributes copyable settings through
aiplugin6647_copy_meta_keys. - Cacbot uses
aiplugin6647\effective_post_id()when that function is available. - An anchor marker alone does not make a post a Cacbot conversation. Outside Anchor Posts’ routing, an ordinary post still needs
_cacbot_conversation = 1.
⚡ Frontend Data Service
The separate Frontend Data Service plugin (cacbot-frontend-data-service) can update open conversation pages without a full reload. Cacbot contributes fields through these filters:
aiplugin6729_watched_meta_keysaiplugin6729_payload_meta_keysaiplugin6729_protected_meta_keysaiplugin6729_payload_fields
Without that plugin, replies are still stored normally but generally require a page reload to appear.
🔐 REST API and security
Cacbot registers routes under cacbot/v1 for metadata updates, installation probing, credential exchange, conversation-context reads, replies, and outcomes.
- Conversation-context, reply, and outcome routes accept only the provisioned Assistant authenticated with a recorded mothership application password. A browser session as that user is not sufficient.
POST cacbot/v1/meta-datapermits users withmanage_optionsor the Cacbot role. It can write Cacbot’s allowlisted writable keys and any post-meta key WordPress considers unprotected. Other_cacbot_keys, Anchor Posts keys, participant fields, function-registration fields, and protected keys are refused.- Metadata-route values pass through
sanitize_textarea_field. - Replies pass through WordPress’s allowed-comment-HTML policy.
- Reply and failed-outcome delivery is idempotent per remote job ID.
The metadata route is not a general function-calling engine. A compatible processing unit may be configured to update allowed metadata after producing a reply, but this plugin contains no tool plugins, action implementations, or “site doors.” Legacy values in _cacbot_function_library, _cacbot_site_doors, _cacbot_accepted_answers, and _cacbot_guess are not read by the current code.
🚨 Do not expose application passwords, enable HTTP in production, or assign the Cacbot role to untrusted users. Although that role has no ordinary WordPress capabilities, it authorizes the metadata route. The separately provisioned Assistant is assigned the WordPress Editor role.
🩺 Troubleshooting
🤐 A comment receives no generated reply
Check that:
- The commenter is logged in and does not have the Cacbot role.
- The comment is approved.
- The post is a
cacbot-conversationor has_cacbot_conversationexactly equal to1. _cacbot_suppress_llm_responseis not"1", unless a filter overrides it.- Comments are open; Cacbot may have closed them after
_cacbot_max_replieswas reached. - Settings → CACBot reports Connected.
- WP-Cron is running and the site can make outbound requests to the configured mothership.
🔃 Replies appear only after refreshing
Install and configure Frontend Data Service, or reload the page. Live updates are not implemented by this plugin alone.
🔌 Activation or reconnection is incomplete
Review the administrator notice and PHP error log, verify that the configured mothership is reachable over HTTPS, and use Settings → CACBot → Reconnect.
🚧 Product boundaries
- This repository reads no OpenAI API-key constant.
- This repository enforces no free-token allowance.
- Provider names, model profiles, and supported model IDs belong to the remote processing deployment.
- Image creation, plugin building, RAG, shortcode execution, and arbitrary function execution are not implemented merely because compatibility metadata keys exist.
📜 License
The plugin header identifies the software as proprietary: “Copyright (C) AI_PLUGIN_DEV 2026. ALL RIGHTS RESERVED. THIS IS NOT FREE SOFTWARE.” Consult the distributor for complete license terms before redistribution or modification.
