Skip to content
aiWikis.org

Source title

<?php /**

Metadata

FieldValue
Source sitellmwikis.org
Source URLhttps://llmwikis.org/
Canonical AIWikis URLhttps://aiwikis.org/llmwikis/uai-system/files/raw-system-archives-llmwikis-recent-work-sweep-2026-05-03-wp-content-the-9ef835c7/
Source referenceraw/system-archives/llmwikis/recent-work-sweep/2026-05-03/wp-content/themes/llmwikis-knowledge-theme/functions.php
File typephp
Content categorymemory-file
Last fetched2026-05-06T17:58:24.5168382Z
Last changed2026-05-03T02:23:49.1189696Z
Content hashsha256:9ef835c7a74a03d0e3701551236f526577bd246561c3033e683f1ccb4fbec9f1
Import statusunchanged
Raw source layerdata/sources/llmwikis/raw-system-archives-llmwikis-recent-work-sweep-2026-05-03-wp-content-themes-llmwikis-knowledge-t-9ef835c7a74a.php
Normalized source layerdata/normalized/llmwikis/raw-system-archives-llmwikis-recent-work-sweep-2026-05-03-wp-content-themes-llmwikis-knowledge-t-9ef835c7a74a.txt

Current File Content

Structure Preview

  • Purpose
  • Directories
  • Page Schema
  • Workflows
  • Final Response
  • Source title
  • Summary
  • Key Claims
  • Connections
  • Contradictions
  • Concepts
  • Syntheses
  • 2026-04-27 ingest | raw/papers/example-source.pdf
  • 2026-04-27 query | "How should we structure team review?"
  • Project AI Instructions
  • Loaded Context
  • Page Shape
  • Ingest
  • Query
  • Lint
  • What it is

Raw Version

This public page shows a bounded preview of a large source file. The complete source remains in the raw and normalized source layers named in metadata, with the SHA-256 hash above for verification.

  • Source characters: 408501
  • Preview characters: 11995
<?php
/**
 * Theme setup and launch content seeding.
 *
 * @package LlmWikis_Knowledge_Theme
 */

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

define( 'LLMWIKIS_THEME_VERSION', '1.1.16' );
define( 'LLMWIKIS_REVIEW_DATE', 'May 1, 2026' );
define( 'LLMWIKIS_PUBLIC_ORIGIN', 'https://llmwikis.org' );

require_once get_theme_file_path( 'inc/starter-bundle.php' );
require_once get_theme_file_path( 'inc/reference-pages.php' );

add_action( 'after_setup_theme', 'llmwikis_theme_setup' );
add_action( 'wp_enqueue_scripts', 'llmwikis_enqueue_assets' );
add_action( 'after_switch_theme', 'llmwikis_seed_site' );
add_action( 'init', 'llmwikis_seed_site_once', 30 );
add_action( 'admin_init', 'llmwikis_seed_site_once' );
add_action( 'wp_head', 'llmwikis_print_meta_description', 2 );
add_action( 'wp_head', 'llmwikis_print_canonical_link', 3 );
add_action( 'wp_head', 'llmwikis_print_social_meta', 4 );
add_action( 'wp_head', 'llmwikis_print_site_json_ld', 5 );
add_action( 'wp_head', 'llmwikis_print_icon_links', 1 );
add_action( 'send_headers', 'llmwikis_send_security_headers', 0 );
add_action( 'template_redirect', 'llmwikis_serve_root_icon_request', 0 );
add_action( 'do_faviconico', 'llmwikis_serve_faviconico', 0 );
add_action( 'template_redirect', 'llmwikis_retire_content_quality_request', 0 );
add_action( 'template_redirect', 'llmwikis_retire_obsolete_prelaunch_request', 0 );
add_action( 'template_redirect', 'llmwikis_start_public_html_buffer', 20 );
add_filter( 'pre_get_document_title', 'llmwikis_document_title' );

/**
 * Sets up theme features.
 *
 * @return void
 */
function llmwikis_theme_setup() {
	add_theme_support( 'wp-block-styles' );
	add_theme_support( 'responsive-embeds' );
	add_theme_support( 'title-tag' );
	remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
	remove_action( 'wp_head', 'rel_canonical' );
	remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
	remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
	remove_action( 'wp_head', 'feed_links', 2 );
	remove_action( 'wp_head', 'feed_links_extra', 3 );
	remove_action( 'wp_head', 'rsd_link' );
	remove_action( 'wp_head', 'wlwmanifest_link' );
	remove_action( 'wp_head', 'wp_generator' );
	remove_action( 'template_redirect', 'rest_output_link_header', 11 );
	remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
	register_nav_menus(
		array(
			'primary' => __( 'Primary Navigation', 'llmwikis-knowledge-theme' ),
		)
	);
}

/**
 * Enqueues the theme stylesheet.
 *
 * @return void
 */
function llmwikis_enqueue_assets() {
	wp_enqueue_style(
		'llmwikis-knowledge-theme',
		get_stylesheet_uri(),
		array(),
		LLMWIKIS_THEME_VERSION
	);

	wp_enqueue_script(
		'llmwikis-knowledge-theme',
		get_theme_file_uri( 'assets/js/site.js' ),
		array(),
		LLMWIKIS_THEME_VERSION,
		true
	);
}

/**
 * Prints lightweight browser icon metadata for the handbook mark.
 *
 * @return void
 */
function llmwikis_print_icon_links() {
	printf(
		'<link rel="icon" href="%s" sizes="any">' . "\n",
		esc_url( llmwikis_public_url( '/favicon.ico' ) )
	);
	printf(
		'<link rel="shortcut icon" href="%s">' . "\n",
		esc_url( llmwikis_public_url( '/favicon.ico' ) )
	);
	printf(
		'<link rel="icon" href="%s" type="image/png" sizes="32x32">' . "\n",
		esc_url( get_theme_file_uri( 'assets/images/favicon-32.png' ) )
	);
	printf(
		'<link rel="icon" href="%s" type="image/png" sizes="48x48">' . "\n",
		esc_url( get_theme_file_uri( 'assets/images/favicon-48.png' ) )
	);
	printf(
		'<link rel="apple-touch-icon" href="%s">' . "\n",
		esc_url( llmwikis_public_url( '/apple-touch-icon.png' ) )
	);
}

/**
 * Sends a theme image asset as a root-level crawler icon.
 *
 * @param string $relative_path Theme-relative path.
 * @param string $content_type Response content type.
 * @return void
 */
function llmwikis_send_theme_asset( $relative_path, $content_type ) {
	$path = get_theme_file_path( ltrim( (string) $relative_path, '/' ) );

	if ( ! is_readable( $path ) ) {
		return;
	}

	status_header( 200 );
	header( 'Content-Type: ' . (string) $content_type );
	header( 'Cache-Control: public, max-age=604800' );
	header( 'Content-Length: ' . (string) filesize( $path ) );
	readfile( $path );
	exit;
}

/**
 * Serves root icon URLs when static deployment does not include those files.
 *
 * @return void
 */
function llmwikis_serve_root_icon_request() {
	$request_path = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_parse_url( wp_unslash( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH ) : '';

	if ( '/favicon.ico' === $request_path ) {
		llmwikis_send_theme_asset( 'assets/images/favicon.ico', 'image/x-icon' );
	}

	if ( '/apple-touch-icon.png' === $request_path || '/apple-touch-icon-precomposed.png' === $request_path ) {
		llmwikis_send_theme_asset( 'assets/images/apple-touch-icon.png', 'image/png' );
	}
}

/**
 * Serves /favicon.ico through WordPress' favicon action.
 *
 * @return void
 */
function llmwikis_serve_faviconico() {
	llmwikis_send_theme_asset( 'assets/images/favicon.ico', 'image/x-icon' );
}

/**
 * Returns the clean public path for the current request.
 *
 * @return string
 */
function llmwikis_current_public_path() {
	$request = isset( $GLOBALS['wp']->request ) ? trim( (string) $GLOBALS['wp']->request, '/' ) : '';
	return $request ? '/' . $request . '/' : '/';
}

/**
 * Builds final production URLs for canonical, social, and structured metadata.
 *
 * @param string $path Public path, optionally with query string.
 * @return string
 */
function llmwikis_public_url( $path = '/' ) {
	$path = '' === (string) $path ? '/' : (string) $path;

	if ( preg_match( '#^https?://#i', $path ) ) {
		return $path;
	}

	if ( '/' !== $path[0] ) {
		$path = '/' . $path;
	}

	return LLMWIKIS_PUBLIC_ORIGIN . $path;
}

/**
 * Sends baseline public security headers when the hosting layer has not already
 * supplied stricter equivalents.
 *
 * @return void
 */
function llmwikis_send_security_headers() {
	if ( headers_sent() ) {
		return;
	}

	header_remove( 'X-Powered-By' );
	header( 'X-Content-Type-Options: nosniff', false );
	header( 'Referrer-Policy: strict-origin-when-cross-origin', false );
	header( 'Permissions-Policy: camera=(), microphone=(), geolocation=()', false );
	header( 'X-Frame-Options: SAMEORIGIN', false );
}

/**
 * Starts a small HTML normalization buffer for public pages.
 *
 * Local WordPress runtimes often carry localhost origins into asset, feed, and
 * debug comments. Production canonical/social/JSON-LD URLs are set explicitly,
 * while this buffer keeps rendered prelaunch smoke output from looking like it
 * depends on a staging host.
 *
 * @return void
 */
function llmwikis_start_public_html_buffer() {
	if ( is_admin() || is_feed() || wp_doing_ajax() || headers_sent() ) {
		return;
	}

	ob_start( 'llmwikis_normalize_public_html' );
}

/**
 * Normalizes local development origins out of rendered HTML.
 *
 * @param string $html Rendered HTML.
 * @return string
 */
function llmwikis_normalize_public_html( $html ) {
	return preg_replace( '#https?://(?:localhost|127\.0\.0\.1)(?::\d+)?#', '', $html );
}

/**
 * Serves a permanent Gone response for the internal content-quality audit routes.
 *
 * @return void
 */
function llmwikis_retire_content_quality_request() {
	$path = llmwikis_current_public_path();

	if ( '/content-quality/' !== $path && 0 !== strpos( $path, '/content-quality/' ) ) {
		return;
	}

	llmwikis_serve_gone_response(
		'The former content-quality audit route has been permanently removed from the public site. It was internal improvement work, not public handbook content.',
		'<a href="/source-policy/">Open Source Policy</a> or <a href="/roadmap/">open Roadmap</a>.'
	);
}

/**
 * Serves Gone for obsolete prelaunch routes so WordPress canonical guessing does
 * not preserve private iteration paths as public redirect baggage.
 *
 * @return void
 */
function llmwikis_retire_obsolete_prelaunch_request() {
	if ( '/start-here/what-is-an-llm-wiki/' !== llmwikis_current_public_path() ) {
		return;
	}

	llmwikis_serve_gone_response(
		'The old nested What Is route was removed before launch. It was private prelaunch structure, not a public URL with SEO history.',
		'<a href="/what-is-an-llm-wiki/">Open the canonical What Is an LLM Wiki page</a>.'
	);
}

/**
 * Emits a small noindex Gone response for retired routes.
 *
 * @param string $message Human-facing message.
 * @param string $action_html Already-sanitized action HTML.
 * @return void
 */
function llmwikis_serve_gone_response( $message, $action_html ) {
	status_header( 410 );
	nocache_headers();
	header_remove( 'X-Powered-By' );
	header( 'X-Content-Type-Options: nosniff', true );
	header( 'Referrer-Policy: strict-origin-when-cross-origin', true );
	header( 'X-Robots-Tag: noindex, nofollow', true );
	header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );

	echo '<!doctype html><html lang="en-US"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Gone - LlmWikis.org</title><meta name="robots" content="noindex,nofollow"></head><body><main style="font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;max-width:48rem;margin:10vh auto;padding:2rem;line-height:1.6"><h1>410 Gone</h1><p>' . esc_html( $message ) . '</p><p>' . wp_kses_post( $action_html ) . '</p></main></body></html>';
	exit;
}

/**
 * Concise SEO descriptions for every managed public route.
 *
 * @return array<string,string>
 */
function llmwikis_public_descriptions() {
	return array(
		'/'                                           => 'LlmWikis.org is a practical handbook for LLM Wikis, AI knowledge bases, agent-readable documentation, machine-consumable knowledge, trust labels, AI Memory comparisons, and LLM Wiki vs RAG guidance.',
		'/start-here/'                               => 'Start building a personal or team LLM Wiki with the core architecture, source rules, operating loop, and first useful pages.',
		'/what-is-an-llm-wiki/'                      => 'The definitive LLM Wiki definition: a human-readable, machine-consumable, governed knowledge system for people and AI agents.',
		'/why-llm-wikis/'                            => 'Why organizations need LLM Wikis for durable context, safer AI use, onboarding, decision memory, and trusted internal knowledge.',
		'/how-to-build-an-llm-wiki/'                 => 'A practical step-by-step build guide for creating an LLM Wiki with folders, metadata, owners, review, policies, and agent rules.',
		'/llm-wiki-structure/'                       => 'Recommended LLM Wiki folder and page structure for organization, product, architecture, operations, decisions, policies, agents, and onboarding.',
		'/starter-template/'                         => 'Download and inspect the dynamic LLM Wiki starter bundle generated from canonical template definitions and manifest metadata.',
		'/content-types/'                            => 'What belongs in an LLM Wiki, what should stay out, and which controls each page type needs before agents can rely on it.',
		'/trust-model/'                              => 'Trust labels, source-of-truth status, review state, and agent interpretation rules for governed LLM Wikis.',
		'/metadata-standard/'                        => 'Required LLM Wiki frontmatter fields for ownership, review, trust, sensitivity, agent use, and related authoritative pages.',
		'/for-ai-agents/'                            => 'Practical instructions for AI agents reading, citing, updating, and respecting permissions in an LLM Wiki.',
		'/llm-wiki-vs-rag/'                          => 'Why RAG is a retrieval technique and an LLM Wiki is the curated governed source material that makes retrieval useful.',
		'/llm-wiki-vs-ai-memory/'                    => 'Compare durable LLM Wikis with portable AI Memory bundles and Project Handoff packets, with canonical UAIX links.',
		'/checklist/'                                => 'Actionable implementation checklist for building, governing, reviewing, and operating an LLM Wiki.',

Why This File Exists

This is a memory-system evidence file from llmwikis.org. It is shown here because AIWikis.org is demonstrating the real source files that make the UAIX / LLM Wiki memory system work, not only summarizing those systems after the fact.

Role

This file is memory-system evidence. It records source history, archive transfer, intake disposition, or another piece of provenance that should be retrievable without becoming an unsupported public claim.

Structure

The file is structured around these visible headings: Purpose; Directories; Page Schema; Workflows; Final Response; Source title; Summary; Key Claims. Those headings are retrieval anchors: a crawler or LLM can decide whether the file is relevant before reading every line.

Prompt-Size And Retrieval Benefit

Keeping this material in a separate file reduces prompt pressure because an agent can load this exact unit only when its role, source site, category, or hash is relevant. The surrounding index pages point to it, while this page preserves the full content for audit and exact recall.

How To Use It

  • Humans should read the metadata first, then inspect the raw content when they need exact wording or provenance.
  • LLMs and agents should use the source site, category, hash, headings, and related files to decide whether this file belongs in the active prompt.
  • Crawlers should treat the AIWikis page as transparent evidence and follow the source URL/source reference for authority boundaries.
  • Future maintainers should regenerate this page whenever the source hash changes, then review the explanation if the role or structure changed.

Update Requirements

When this source file changes, update the raw source layer, normalized source layer, hash history, this rendered page, generated explanation, source-file inventory, changed-files report, and any source-section index that links to it.

Related Pages

Provenance And History

  • Current observation: 2026-05-06T17:58:24.5168382Z
  • Source origin: current-source-workspace
  • Retrieval method: local-source-workspace
  • Duplicate group: sfg-423 (primary)
  • Historical hash records are stored in data/hashes/source-file-history.jsonl.

Machine-Readable Metadata

{
    "title":  "Source title",
    "source_site":  "llmwikis.org",
    "source_url":  "https://llmwikis.org/",
    "canonical_url":  "https://aiwikis.org/llmwikis/uai-system/files/raw-system-archives-llmwikis-recent-work-sweep-2026-05-03-wp-content-the-9ef835c7/",
    "source_reference":  "raw/system-archives/llmwikis/recent-work-sweep/2026-05-03/wp-content/themes/llmwikis-knowledge-theme/functions.php",
    "file_type":  "php",
    "content_category":  "memory-file",
    "content_hash":  "sha256:9ef835c7a74a03d0e3701551236f526577bd246561c3033e683f1ccb4fbec9f1",
    "last_fetched":  "2026-05-06T17:58:24.5168382Z",
    "last_changed":  "2026-05-03T02:23:49.1189696Z",
    "import_status":  "unchanged",
    "duplicate_group_id":  "sfg-423",
    "duplicate_role":  "primary",
    "related_files":  [

                      ],
    "generated_explanation":  true,
    "explanation_last_generated":  "2026-05-06T17:58:24.5168382Z"
}