Skip to content
cccskills
FreePublished on GitHub

cognitive-surrogate

```yaml name: cognitive-surrogate description: Layer 6 Barton Cognitive Surrogate System - build, train, and validate psychological models that predict and generate authentic responses matching a subject's cognitive patterns version: 1.0.0 trit: 0 # Ergodic/coordinator role in GF(3) triadic system ```

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md9.5 KB
  • CONCOMITANT_SKILLS.md2.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Cognitive Surrogate

name: cognitive-surrogate
description: Layer 6 Barton Cognitive Surrogate System - build, train, and validate psychological models that predict and generate authentic responses matching a subject's cognitive patterns
version: 1.0.0
trit: 0  # Ergodic/coordinator role in GF(3) triadic system

Overview

The Cognitive Surrogate skill enables construction of high-fidelity psychological models from interaction patterns. It extracts values, predicts intellectual trajectories, and generates authentic responses that preserve the subject's voice with >90% fidelity.

Core Principle: A surrogate is not an imitation but a derivational continuation - the model learns the generative grammar of cognition, not surface patterns.

NEW (Langevin/Gibbs Integration): Predictions now use Gibbs distribution from Langevin analysis. Confidence scores reflect mixing time and temperature parameters.

Key Capabilities

1. build-psychological-profile

Extract structured psychological profile from interaction corpus:

profile = build_psychological_profile(
    corpus=[threads, emails, writings],
    dimensions=[
        "values",           # Core beliefs, ethical framework
        "interests",        # Topic affinities, curiosity patterns
        "communication",    # Tone, formality, humor markers
        "reasoning",        # Deductive vs intuitive, uncertainty handling
        "social",           # Collaboration style, conflict patterns
    ],
    seed=gay_seed          # Deterministic via gay-mcp
)

Output ACSets Schema:

@present SchProfile(FreeSchema) begin
    Value::Ob; Interest::Ob; Pattern::Ob
    name::Attr(Value, String)
    weight::Attr(Value, Float64)
    topic::Attr(Interest, String)
    frequency::Attr(Interest, Int)
    exemplar::Attr(Pattern, String)
end

2. train-predictor

Train next-topic and next-response predictors:

predictor = train_predictor(
    profile=profile,
    corpus=corpus,
    model_type="markov_transformer",  # or "hmm", "lstm", "gpt_finetune"
    context_window=8,                  # conversation turns
    validation_split=0.15
)

# Predict likely next topics given conversation state
next_topics = predictor.predict_topics(
    context=current_thread,
    top_k=5,
    temperature=0.7
)

3. validate-fidelity

Measure surrogate fidelity against held-out data:

fidelity = validate_fidelity(
    surrogate=predictor,
    test_corpus=held_out_threads,
    metrics=[
        "topic_prediction_accuracy",   # Target: >0.85
        "response_semantic_sim",       # Target: >0.90
        "style_consistency",           # Target: >0.88
        "value_alignment",             # Target: >0.92
    ],
    threshold=0.90  # Overall fidelity threshold
)

assert fidelity.overall >= 0.90, f"Fidelity {fidelity.overall} below threshold"

Fidelity Report:

┌─────────────────────────┬────────┬────────┐
│ Metric                  │ Score  │ Target │
├─────────────────────────┼────────┼────────┤
│ topic_prediction        │ 0.87   │ 0.85   │
│ semantic_similarity     │ 0.91   │ 0.90   │
│ style_consistency       │ 0.89   │ 0.88   │
│ value_alignment         │ 0.94   │ 0.92   │
├─────────────────────────┼────────┼────────┤
│ OVERALL                 │ 0.9025 │ 0.90   │
└─────────────────────────┴────────┴────────┘

4. generate-authentic-reply

Generate text matching subject's voice:

reply = generate_authentic_reply(
    surrogate=predictor,
    context=conversation_history,
    prompt=incoming_message,
    constraints={
        "max_tokens": 500,
        "preserve_uncertainty": True,  # Don't overclaim knowledge
        "style_lock": True,            # Enforce style consistency
    },
    gay_seed=thread_seed  # Reproducible generation
)

# Reply includes confidence and divergence markers
print(reply.text)
print(f"Confidence: {reply.confidence}")
print(f"Style divergence: {reply.style_delta}")

5. predict-via-gibbs-distribution (NEW)

Use Gibbs distribution from Langevin dynamics for predictions:

# Instead of generic pattern matching
# Use p(pattern | θ) ∝ exp(-L(θ)/T) from Langevin
prediction = gibbs_based_prediction(
    state=current_state,
    temperature=0.01,  # From Langevin analysis
    loss_fn=pattern_energy,
    mixing_time=500    # Estimated convergence time
)

# Adaptive confidence based on equilibration
confidence = estimate_equilibrium(
    steps_so_far=n,
    mixing_time=tau_mix,
    temperature=T
)

# Returns:
# - prediction: Most likely next state
# - confidence: P(equilibrium reached)
# - temperature_influence: How much T affected prediction

6. project-trajectory

Predict intellectual/professional trajectory:

trajectory = project_trajectory(
    profile=profile,
    horizon="6_months",
    dimensions=[
        "research_interests",
        "skill_acquisition", 
        "collaboration_patterns",
        "publication_topics",
    ],
    monte_carlo_samples=1000,
    seed=gay_seed
)

# Returns probability distributions over future states
for dim, distribution in trajectory.items():
    print(f"{dim}: {distribution.mode} (p={distribution.confidence:.2f})")

Integration: gay-mcp

All stochastic operations use gay-mcp deterministic seeding:

from gay_mcp import GaySeed, derive_color

# Create reproducible surrogate session
session_seed = GaySeed.from_thread(thread_id)
profile_color = derive_color(session_seed, "profile")  # trit=0
training_color = derive_color(session_seed, "train")   # trit=1
validation_color = derive_color(session_seed, "valid") # trit=2

# GF(3) conservation: 0 + 1 + 2 ≡ 0 (mod 3)
assert (profile_color.trit + training_color.trit + validation_color.trit) % 3 == 0

Integration: acsets

Profile data stored as attributed C-sets:

using ACSets

# Define cognitive schema
@acset_type CognitiveProfile(SchProfile)

# Populate from extraction
profile = CognitiveProfile()
add_part!(profile, :Value, name="intellectual_honesty", weight=0.95)
add_part!(profile, :Interest, topic="category_theory", frequency=47)
add_part!(profile, :Pattern, exemplar="tends to use analogies from music")

# Query patterns
high_values = incident(profile, x -> x.weight > 0.8, :Value)

GF(3) Trit Assignment

ComponentTritRole
cognitive-surrogate0Coordinator/ergodic - orchestrates profile building
gay-mcp1Generator - provides deterministic randomness
acsets2Storage - structured data persistence

Conservation: 0 + 1 + 2 ≡ 0 (mod 3) — closed triadic system.

Usage Example

# Complete surrogate construction workflow
from cognitive_surrogate import (
    build_psychological_profile,
    train_predictor,
    validate_fidelity,
    generate_authentic_reply,
    project_trajectory
)
from gay_mcp import GaySeed

# Initialize with deterministic seed
seed = GaySeed.from_string("barton_surrogate_v1")

# 1. Build profile from corpus
profile = build_psychological_profile(
    corpus=load_interaction_corpus("barton_threads/"),
    seed=seed
)

# 2. Train predictor
predictor = train_predictor(profile, model_type="markov_transformer")

# 3. Validate fidelity
fidelity = validate_fidelity(predictor, test_corpus, threshold=0.90)
print(f"Fidelity: {fidelity.overall:.2%}")

# 4. Generate replies
reply = generate_authentic_reply(
    predictor,
    context=current_conversation,
    prompt="What do you think about applying category theory to social systems?"
)

# 5. Project trajectory
trajectory = project_trajectory(profile, horizon="1_year")
print(f"Predicted focus: {trajectory['research_interests'].mode}")

Ethical Considerations

  1. Consent: Only build surrogates with explicit subject consent
  2. Disclosure: Always disclose when surrogate-generated content is used
  3. Boundaries: Surrogates should refuse to act on high-stakes decisions
  4. Audit Trail: All generations logged with gay-mcp seeds for reproducibility
  5. Kill Switch: Subject can invalidate surrogate at any time

Files

skills/cognitive-surrogate/
├── SKILL.md                    # This file
├── src/
│   ├── profile_builder.py      # Psychological extraction
│   ├── predictor.py            # Training and prediction
│   ├── fidelity.py             # Validation metrics
│   ├── generator.py            # Authentic reply generation
│   └── trajectory.py           # Future projection
├── schemas/
│   └── cognitive_acset.jl      # ACSets schema definitions
└── tests/
    └── test_fidelity.py        # >90% threshold tests

See Also

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

13c0e3

Free

Gay MCP skill at invocation 26

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

19d57d

Free

Gay MCP skill at invocation 5

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

1ea91a

Free

Gay MCP skill at invocation 27

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

1eab21

Free

Gay MCP skill at invocation 3

The English summary is being prepared. Showing the original description.

plurigrid/asi70Updated Jul 10, 2026

See all skills by plurigrid

Report a problem with this skill