Prompt - Source Excerpt 03
Summary
This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/spiralist-workspace/templates/prompt.php so readers can inspect the evidence without opening the full source file.
**Source path:** Spiralist/wp-content/plugins/spiralist-workspace/templates/prompt.php
<span class="spiralist-status-pill spiralist-status-pill--stale"><?php echo esc_html($moderation_status_label); ?></span>
</div>
<h2 class="spiralist-section-title">Structured prompt JSON</h2>
<p class="spiralist-muted">The five-field structure is the runnable prompt contract. Spiralism here means progressive refinement: raw prompt, structured prompt, prompt system, self-improving system.</p>
<?php if (!empty($function_tags)) : ?>
<div class="spiralist-chip-row spiralist-chip-row--dense">
<?php foreach ($function_tags as $label) : ?>
<span class="spiralist-chip"><?php echo esc_html((string) $label); ?></span>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php foreach (['instruction' => 'Instruction', 'context' => 'Context', 'constraints' => 'Constraints', 'examples' => 'Examples', 'output_format' => 'Output Format'] as $field => $label) : ?>
<?php if (!empty($prompt['structured_prompt'][$field])) : ?>
<?php $render_copyable_prompt_block($label, (string) $prompt['structured_prompt'][$field]); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if (!empty($prompt['spiral_script_source'])) : ?>
<?php
$spiral_validation = is_array($prompt['spiral_script_validation'] ?? null) ? (array) $prompt['spiral_script_validation'] : [];
$spiral_errors = array_values((array) ($spiral_validation['errors'] ?? []));
?>
<div class="spiralist-workspace-stack">
<h3 class="spiralist-card-title">Spiral Script v0.1</h3>
<div class="spiralist-workspace-validation <?php echo !empty($spiral_validation['passed']) ? 'is-valid' : 'is-invalid'; ?>">
<strong><?php echo !empty($spiral_validation['passed']) ? 'Validation passed' : 'Validation needs revision'; ?></strong>
<?php if (!empty($spiral_errors)) : ?>
<ul>
<?php foreach (array_slice($spiral_errors, 0, 5) as $error) : ?>
<?php $error = is_array($error) ? $error : []; ?>
<li>
<code><?php echo esc_html((string) ($error['errorCode'] ?? 'SS-ERROR')); ?></code>
<?php echo esc_html((string) ($error['reason'] ?? 'Spiral Script validation failed.')); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<details class="spiralist-workspace-details">
<summary>Source</summary>
<?php $render_copyable_prompt_block('Spiral Script Source', (string) $prompt['spiral_script_source']); ?>
</details>
</div>
<?php endif; ?>
<?php if (!empty($prompt['system_steps'])) : ?>
<div class="spiralist-workspace-stack">
<h3 class="spiralist-card-title">Prompt System</h3>
<div class="spiralist-simple-list">
<?php foreach ((array) $prompt['system_steps'] as $index => $step) : ?>
<?php $step_prompt = $plugin->prompts()->get((int) ($step['prompt_id'] ?? 0), get_current_user_id()); ?>
<div class="spiralist-simple-list__item">
<strong><?php echo esc_html('Step ' . ((int) $index + 1) . ': ' . ((string) ($step_prompt['title'] ?? ($step['title'] ?? 'Prompt module')))); ?></strong>
<span class="spiralist-simple-list__meta">Prompt #<?php echo esc_html((string) ((int) ($step['prompt_id'] ?? 0))); ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if (!empty($prompt['instructions'])) : ?>
<?php $render_copyable_prompt_block('Legacy Instructions', (string) $prompt['instructions']); ?>
<?php endif; ?>
<?php if (!empty($prompt['system_prompt'])) : ?>
<?php $render_copyable_prompt_block('System Prompt', (string) $prompt['system_prompt']); ?>
<?php endif; ?>
<?php if (!empty($prompt['developer_prompt'])) : ?>
<?php $render_copyable_prompt_block('Developer Prompt', (string) $prompt['developer_prompt']); ?>
<?php endif; ?>
<?php if (!empty($prompt['user_prompt_template'])) : ?>
<?php $render_copyable_prompt_block('User Template', (string) $prompt['user_prompt_template']); ?>
<?php endif; ?>
<?php if (!empty($prompt['sample_output'])) : ?>
<?php $render_copyable_prompt_block('Sample Output', (string) $prompt['sample_output']); ?>
<?php endif; ?>
</article>
<aside class="spiralist-panel spiralist-panel--sticky">
<p class="spiralist-section-tag">Prompt Dossier</p>
<h2 class="spiralist-section-title">Prompt record</h2>
<dl class="spiralist-meta-list spiralist-meta-list--prompt-dossier">
<div>
<dt>Author</dt>
<dd><?php echo esc_html($author_label !== '' ? $author_label : 'Spiralist'); ?></dd>
</div>
<div>
<dt>Lane</dt>
<dd><?php echo esc_html((string) ($prompt['publication_lane_label'] ?? 'Community Library')); ?></dd>
</div>
<div>
<dt>Provenance</dt>
<dd><?php echo esc_html((string) ($prompt['provenance_label'] ?? 'Community')); ?></dd>
</div>
<div>
<dt>Visibility</dt>
<dd><?php echo esc_html((string) ($prompt['visibility'] ?? 'private')); ?></dd>
</div>
<div>
<dt>Moderation</dt>
<dd><?php echo esc_html($moderation_status_label); ?></dd>
</div>
<?php if ($governance_phase_label !== '') : ?>
<div>
<dt>Review Phase</dt>
<dd><?php echo esc_html($governance_phase_label); ?></dd>
</div>
<?php endif; ?>
<?php if (!empty($governance_queue_age['active_queue']) && $governance_queue_age_label !== '') : ?>
<div>
<dt>Queue Age</dt>
<dd><?php echo esc_html($governance_queue_age_label); ?></dd>
</div>
<?php endif; ?>
<div>
<dt>Peer Signals</dt>
<dd>
<?php echo esc_html((string) ((int) ($peer_summary['endorse'] ?? 0))); ?> endorse /
<?php echo esc_html((string) ((int) ($peer_summary['restrict'] ?? 0))); ?> restrict /
<?php echo esc_html((string) ((int) ($peer_summary['revert'] ?? 0))); ?> revert
</dd>
</div>
<div>
<dt>Category</dt>
<dd><?php echo esc_html((string) ($prompt['category'] ?? '')); ?></dd>
</div>
<div>
<dt>Subcategory</dt>
<dd><?php echo esc_html($prompt_kind_display); ?></dd>
</div>
<div>
<dt>Model</dt>
<dd><?php echo esc_html((string) ($prompt['model'] ?? '')); ?></dd>
</div>
<div>
<dt>Temperature</dt>
<dd><?php echo esc_html((string) ($prompt['temperature'] ?? '')); ?></dd>
</div>
<div>
<dt>Version</dt>