Skip to content

feat: InternalLinkingTask — System Agent task for semantic internal cross-linking (#228)#276

Merged
chubes4 merged 1 commit intoExtra-Chill:mainfrom
Sarai-Chinwag:feat/internal-linking-task
Feb 18, 2026
Merged

feat: InternalLinkingTask — System Agent task for semantic internal cross-linking (#228)#276
chubes4 merged 1 commit intoExtra-Chill:mainfrom
Sarai-Chinwag:feat/internal-linking-task

Conversation

@saraichinwag
Copy link
Copy Markdown
Contributor

Summary

Adds InternalLinkingTask to the System Agent — AI-powered semantic internal cross-linking of posts. Follows the exact same architecture as AltTextTask.

Closes #228

What It Does

  1. Finds related posts by shared taxonomy overlap (categories=1pt, tags=2pts)
  2. Filters out already-linked posts
  3. Sends post content + related post data to AI
  4. AI weaves links semantically into existing sentences (no "Related Posts" section)
  5. Validates links were actually inserted
  6. Updates post content and tracks via _dm_internal_links post meta

Files Added

  • inc/Engine/AI/System/Tasks/InternalLinkingTask.php — The task (extends SystemTask)
  • inc/Abilities/InternalLinkingAbilities.php — Two abilities: datamachine/internal-linking + datamachine/diagnose-internal-links
  • inc/Cli/Commands/LinksCommand.phpwp datamachine links crosslink + diagnose

Files Modified

  • SystemAgentServiceProvider.php — registered task
  • data-machine.php — registered abilities
  • Cli/Bootstrap.php — registered CLI command

Usage

Ability

wp_get_ability('datamachine/internal-linking')->execute([
    'post_ids' => [1234, 5678],
    'links_per_post' => 3,
]);

// Or by category
wp_get_ability('datamachine/internal-linking')->execute([
    'category' => 'birds',
]);

CLI

wp datamachine links crosslink --post_id=1234
wp datamachine links crosslink --category=birds --dry-run
wp datamachine links crosslink --all --links-per-post=3
wp datamachine links diagnose

Architecture

Same pattern as AltTextTask:

  • One post per job → Action Scheduler handles batching
  • RequestBuilder::build() with system agent model
  • Idempotent via _dm_internal_links post meta tracking
  • force flag to re-process

@chubes4 chubes4 merged commit 310a1dc into Extra-Chill:main Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Internal cross-linking System Agent task

2 participants