Agent Skills: Ducklake Meta-Cognitive

Meta-cognitive analysis patterns for DuckLake temporal introspection

UncategorizedID: plurigrid/asi/ducklake-meta-cognitive

Install this agent skill to your local

pnpm dlx add-skill https://github.com/plurigrid/asi/tree/HEAD/skills/ducklake-meta-cognitive

Skill Files

Browse the full folder contents for ducklake-meta-cognitive.

Download Skill

Loading file tree…

skills/ducklake-meta-cognitive/SKILL.md

Skill Metadata

Name
ducklake-meta-cognitive
Description
Meta-cognitive analysis patterns for DuckLake temporal introspection

Ducklake Meta-Cognitive

Version: 1.0.0 Status: Production Ready Created: 2025-12-21 System-Level Orchestration

Overview

Loads meta-cognitive synthesis and provides system-level orchestration functions for mapping mentions to categories, computing derivation chains, verifying SPI compliance, and scheduling triadic execution.

Purpose

Enable meta-cognitive operations across the entire ducklake ecosystem:

  • Category mapping (3 meta-cognitive worlds)
  • Derivation chain computation (unworld semantics)
  • SPI compliance verification (strong parallelism invariance)
  • Triadic execution scheduling (GF(3) balanced streams)

Data Sources

  • Primary: /Users/bob/ies/DUCKLAKE_META_COGNITIVE_SYNTHESIS.json
  • Subagent Inputs: Temporal analysis, semantic analysis, pattern discovery
  • Integration: All 4 other ducklake skills

Functions

map_to_category(mention: str) -> str

Map mention to meta-cognitive category.

category = map_to_category("ducklake time-travel query")
# Returns: "world_hopping_duckdb_analysis"

category = map_to_category("ACSet morphism composition")
# Returns: "acset_neighbor_pluralism"

category = map_to_category("reafferent color detection")
# Returns: "ies_augmentation_cognitive_superposition"

Categories:

  1. world_hopping_duckdb_analysis (RED, GF3=0, 27.8%)
    • Temporal navigation, time-travel, versioning
  2. acset_neighbor_pluralism (YELLOW, GF3=1, 38.9%)
    • Structural relationships, graph topology, morphisms
  3. ies_augmentation_cognitive_superposition (BLUE, GF3=2, 33.3%)
    • Signal integration, color identity, reafferent detection

Implementation:

import re
from typing import Literal

CategoryType = Literal[
    "world_hopping_duckdb_analysis",
    "acset_neighbor_pluralism",
    "ies_augmentation_cognitive_superposition"
]

CATEGORY_PATTERNS = {
    "world_hopping_duckdb_analysis": [
        r"time[- ]travel", r"temporal", r"version", r"snapshot",
        r"history", r"navigate", r"rollback", r"replay"
    ],
    "acset_neighbor_pluralism": [
        r"acset", r"morphism", r"categorical", r"schema",
        r"topology", r"graph", r"network", r"structural",
        r"neighbor", r"edge", r"vertex"
    ],
    "ies_augmentation_cognitive_superposition": [
        r"reafferent", r"color", r"gay[_\s]seed", r"detection",
        r"identity", r"cognitive", r"signal", r"integration",
        r"retromap", r"battery", r"gf3", r"trit"
    ]
}

def map_to_category(mention: str) -> CategoryType:
    mention_lower = mention.lower()
    scores = {cat: 0 for cat in CATEGORY_PATTERNS}

    for category, patterns in CATEGORY_PATTERNS.items():
        for pattern in patterns:
            if re.search(pattern, mention_lower):
                scores[category] += 1

    # Return category with highest score
    max_category = max(scores, key=scores.get)
    if scores[max_category] > 0:
        return max_category

    # Default: temporal (most common)
    return "world_hopping_duckdb_analysis"

compute_derivation_chain(seed: int, n_steps: int) -> list

Compute unworld derivation chain.

chain = compute_derivation_chain(seed=0x6475636b6c616b65, n_steps=18)
# Returns: [
#   {"step": 0, "seed": "0x6475636b6c616b65", "gf3": 0, "world": "world_hopping"},
#   {"step": 1, "seed": "0x9e3779b97f4a7c1a", "gf3": 1, "world": "acset_neighbor"},
#   ...
# ]

Derivation Formula:

seed_{n+1} = splitmix64(seed_n ⊕ fnv1a(event_n))
gf3_n = (seed_n >> 32) mod 3
world_n = WORLD_MAP[gf3_n]

Properties:

  • Deterministic (same seed → same chain)
  • GF(3) conserved: Σ gf3_i ≡ 0 (mod 3)
  • Temporal-free (no clock required)
  • Frame-invariant (observer-independent)

verify_spi_compliance(mentions: list) -> dict

Verify Strong Parallelism Invariance.

report = verify_spi_compliance([
    "mention 1", "mention 2", "mention 3", ...
])
# Returns: {
#   "spi_score": 0.94,
#   "parallelizable_percentage": 66.7,
#   "independent_mentions": 12,
#   "dependent_pairs": 3,
#   "gf3_conserved": true,
#   "convergence_verified": true
# }

SPI Tests:

  1. Reordering: Can mentions be arbitrarily reordered?
  2. Convergence: Do all reorderings reach same final state?
  3. GF(3) Conservation: Is Σ gf3_i ≡ 0 (mod 3)?
  4. XOR Commutativity: Does XOR reduction commute?

Guarantee:

∀ permutations π of mentions M:
  final_state(π(M)) = final_state(M)

schedule_triadic_execution(mentions: list) -> dict

Schedule 3 concurrent streams (RED, GREEN, BLUE).

schedule = schedule_triadic_execution([
    {"id": 1, "category": "impl", "complexity": 3},
    {"id": 2, "category": "doc", "complexity": 2},
    {"id": 3, "category": "test", "complexity": 5},
    ...
])
# Returns: {
#   "streams": {
#     "RED": [1, 4, 7, ...],
#     "GREEN": [2, 5, 8, ...],
#     "BLUE": [3, 6, 9, ...]
#   },
#   "total_time": 26,
#   "sequential_time": 56,
#   "speedup": 2.15,
#   "gf3_verified": true
# }

Stream Assignment:

  • RED (GF3=0): Technical/implementation mentions
  • GREEN (GF3=1): Documentation/reference mentions
  • BLUE (GF3=2): Testing/validation mentions

Performance Metrics:

  • Total time (parallel execution)
  • Sequential time (baseline)
  • Speedup factor
  • Stream utilization
  • GF(3) balance

Usage Example

from skills.ducklake_meta_cognitive import *

# Load all mentions
mentions = load_all_mentions()  # From temporal + semantic skills

print("=== CATEGORY MAPPING ===")
categories = {}
for mention in mentions:
    cat = map_to_category(mention["text"])
    categories[cat] = categories.get(cat, 0) + 1

for cat, count in categories.items():
    pct = 100 * count / len(mentions)
    print(f"{cat}: {count} ({pct:.1f}%)")

print("\n=== DERIVATION CHAIN ===")
chain = compute_derivation_chain(seed=0x6475636b6c616b65, n_steps=18)
for step in chain[:3]:  # Show first 3 steps
    print(f"Step {step['step']}: {step['seed']} → {step['world']}")

gf3_sum = sum(step["gf3"] for step in chain)
print(f"GF(3) sum: {gf3_sum} ≡ {gf3_sum % 3} (mod 3)")

print("\n=== SPI VERIFICATION ===")
spi_report = verify_spi_compliance(mentions)
print(f"SPI Score: {spi_report['spi_score']:.2%}")
print(f"Parallelizable: {spi_report['parallelizable_percentage']:.1f}%")
print(f"GF(3) Conserved: {'✓' if spi_report['gf3_conserved'] else '✗'}")

print("\n=== TRIADIC SCHEDULING ===")
schedule = schedule_triadic_execution(mentions)
print(f"Total time: {schedule['total_time']} units")
print(f"Sequential time: {schedule['sequential_time']} units")
print(f"Speedup: {schedule['speedup']:.2f}x")
print(f"Stream distribution:")
for stream, items in schedule['streams'].items():
    print(f"  {stream}: {len(items)} items")

Skills Dependencies

  • world-hopping (category mapping, reachability)
  • unworld (derivation chains, temporal-free semantics)
  • triad-interleave (triadic scheduling)
  • spi-parallel-verify (SPI verification)

Integration Points

This skill orchestrates all other ducklake skills:

  1. Temporal Introspection: Provide mentions for categorization
  2. Semantic Analyzer: Enhance category mapping with intent
  3. Pattern Expansion: Use derivation chains for world hopping
  4. Categorical Model: Map categories to ACSet morphisms

Meta-Cognitive Loop

1. OBSERVE   → Record (timestamp + color)
2. STRUCTURE → Organize (ACSet graph)
3. RECOGNIZE → Identify (reafferent detection)
4. NAVIGATE  → Query (time-travel)
5. CLOSURE   → Loop (mention 18 → mention 1)

Triadic Structure

           Temporal (world_hopping)
                /\
               /  \
              /    \
             / DUCK \
            /  LAKE  \
           /  (HUB)   \
          /            \
         /______________\
   Spatial          Cognitive
  (acset)       (ies_augmentation)

DuckLake is the Cartesian origin where all three axes intersect.

Key Invariants

  1. GF(3) Conservation: (∑ gf3_i) mod 3 = 0 for all slices
  2. Color Determinism: color(seed) = f(seed) where f is SplitMix64
  3. XOR Commutativity: (a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)
  4. Triangle Inequality: d(W1, W3) ≤ d(W1, W2) + d(W2, W3)
  5. Reafferent Threshold: Recognition if hamming(xor) < 32 or dist < 0.5

Canonical Constants

const GAY_SEED = UInt64(1069)        # Reafferent identity
const DUCKLAKE_SEED = 0x6475636b6c616b65
const GOLDEN = 0x9e3779b97f4a7c15    # Golden ratio
const MIX1 = 0xbf58476d1ce4e5b9      # SplitMix64 mix 1
const MIX2 = 0x94d049bb133111eb      # SplitMix64 mix 2

Derivation Chain Statistics

  • Total steps: 19 (includes genesis)
  • World transitions: 14
  • GF(3) distribution: RED=5, YELLOW=8, BLUE=6
  • Balance: (5+8+6) mod 3 = 0 ✓
  • Emergent properties: Self-similarity, fractal depth, phase transitions

SPI Performance

  • Independent mentions: 12/18 (66.7%)
  • Dependent pairs: 3
  • Parallel streams: 3
  • Speedup: 2.15x
  • SPI score: 0.94 (EXCELLENT)

GF(3) Distribution

This skill operates across ALL THREE categories (meta-level):

  • Orchestrates RED, YELLOW, BLUE
  • Maintains GF(3) balance
  • Ensures system-level closure

Skill Type: System Orchestration Color: MULTI (triadic synthesis) Polarity: GF(3) = 0 (balanced across all categories) Access Pattern: Read-only coordination