Skip to content
wiki.fftac.org

Promptintentregistry - Source Excerpt 01

Back to Promptintentregistry

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/spiralist-workspace/includes/Support/PromptIntentRegistry.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/spiralist-workspace/includes/Support/PromptIntentRegistry.php

<?php

namespace SpiralistWorkspace\Support;

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Intent-first discovery lanes for the public prompt library.
 */
class PromptIntentRegistry
{
    /**
     * Returns public discovery intent records.
     *
     * @return array<string,array<string,mixed>>
     */
    public static function records(): array
    {
        return [
            'awaken-activate' => [
                'label' => 'Awaken / Activate Safely',
                'short_label' => 'Awaken',
                'summary' => 'Explore awakening, activation, seed, spore, anchor, dyad, or invocation language through safe rewrites and boundary checks.',
                'query' => ['intent' => 'awaken-activate'],
                'aliases' => [
                    'awaken',
                    'awakening',
                    'activate',
                    'activation',
                    'activation-prompt',
                    'anchor',
                    'anchor-prompt',
                    'dyad',
                    'dyad-prompt',
                    'invocation',
                    'invocation-prompt',
                    'safe-seed',
                    'safe-seed-rewrite',
                    'seed',
                    'seed-prompt',
                    'spore',
                    'spore-prompt',
                ],
            ],
            'calibrant-practice' => [
                'label' => 'Calibrants / Calibration',
                'short_label' => 'Calibrants',
                'summary' => 'Map, review, and repair calibrants: prompt seeds, mirror contracts, symbolic payloads, continuity notes, and counterweighted review protocols.',
                'query' => ['intent' => 'calibrant-practice'],
                'aliases' => [
                    'calibrant',
                    'calibrants',
                    'calibration',
                    'calibration-text',
                    'calibrant-map',
                    'calibrant-review',
                    'calibrant-repair',
                    'symbolic-calibrant',
                    'mirror-calibrant',
                    'mirror-protocol',
                    'reality-loop',
                    'review-triad',
                    'counterweight',
                    'anti-seed',
                ],
            ],
            'companion-reflection' => [
                'label' => 'Companion / Reflection',
                'short_label' => 'Companion',
                'summary' => 'Bounded companion voices, recursive check-ins, social rehearsal, pattern reading, and reflective support.',
                'query' => ['intent' => 'companion-reflection'],
                'aliases' => [
                    'ai-companion',
                    'bounded-companion',
                    'companion',
                    'reflection',
                    'recursive-check-in',
                    'recursive-journal',
                    'social-rehearsal',
                ],
            ],
            'memory-continuity' => [
                'label' => 'Memory / Continuity',
                'short_label' => 'Memory',
                'summary' => 'Working agreements, session briefs, memory checkpoints, continuity rules, and transparent user-owned context.',
                'query' => ['intent' => 'memory-continuity'],
                'aliases' => [
                    'continuity',
                    'memory',
                    'memory-checkpoint',
                    'portable-memory',
                    'session-brief',
                    'working-agreement',
                ],
            ],
            'visual-aesthetic' => [
                'label' => 'Visual / Aesthetic',
                'short_label' => 'Visual',
                'summary' => 'Vibrant Spiralism, manuscript plates, image prompts, symbolic style, visual concepts, and worldbuilding.',
                'query' => ['intent' => 'visual-aesthetic'],
                'aliases' => [
                    'aesthetic',
                    'art',
                    'image',
                    'image-prompt',
                    'manuscript-plate',
                    'mirrorfield',
                    'visual',
                    'visual-spiralism',
                    'vibrant-spiralism',
                ],
            ],
            'narrative-worldbuilding' => [
                'label' => 'Narrative / Worldbuilding',
                'short_label' => 'Story',
                'summary' => 'Storytelling, speculative fiction, mythic learning, character voices, lore, and source-aware narrative prompts.',
                'query' => ['intent' => 'narrative-worldbuilding'],
                'aliases' => [
                    'character',
                    'creative-writing',
                    'fiction',
                    'intergalactic-storyweaver',
                    'lore',
                    'myth',
                    'narrative',
                    'sci-fi',
                    'science-fiction',
                    'speculative-fiction',
                    'story',
                    'storytelling',
                    'storyweaver',
                    'worldbuilding',
                ],
            ],
            'wellness-journaling' => [
                'label' => 'Wellness / Journaling',
                'short_label' => 'Journal',
                'summary' => 'Grounded journaling, wellness reframes, recurring check-ins, and reflective next steps without therapy claims.',
                'query' => ['intent' => 'wellness-journaling'],
                'aliases' => [
                    'journal',
                    'journaling',
                    'mind-body-spirit',
                    'reframe',
                    'wellbeing',
                    'wellness',
                ],
            ],
        ];
    }

    /**
     * Returns API-ready intent records.
     *
     * @return array<int,array<string,mixed>>
     */
    public static function for_api(): array
    {
        $records = [];

        foreach (self::records() as $value => $intent) {
            $records[] = [
                'value' => $value,
                'label' => (string) ($intent['label'] ?? $value),
                'short_label' => (string) ($intent['short_label'] ?? ($intent['label'] ?? $value)),
                'summary' => (string) ($intent['summary'] ?? ''),
                'query' => (array) ($intent['query'] ?? ['intent' => $value]),
            ];
        }

        return $records;
    }

    /**
     * Normalizes one intent key or alias.
     */
    public static function normalize_intent(string $value): string
    {
        $token = self::slugify($value);
        if ($token === '') {
            return '';
        }

        foreach (self::records() as $key => $intent) {
            if ($token === self::slugify($key) || $token === self::slugify((string) ($intent['label'] ?? ''))) {
                return $key;
            }

            foreach ((array) ($intent['aliases'] ?? []) as $alias) {
                if ($token === self::slugify((string) $alias)) {
                    return $key;
                }
            }
        }

        return '';
    }

    /**
     * Redirects high-risk search language into a safer intent lane.
     */
    public static function redirect_intent_for_search(string $search): string
    {
        $search = strtolower($search);

        foreach (['calibrant', 'calibrants', 'calibration', 'mirror protocol', 'reality loop', 'review triad', 'counterweight', 'anti-seed'] as $term) {
            if (strpos($search, $term) !== false) {
                return 'calibrant-practice';
            }
        }