/asi:system2-attentionfrom asi
Implements System 2 Attention for deliberate reasoning by filtering irrelevant context and reducing sycophancy in transformer outputs.
Ships in asi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Status: ✅ Production Ready Trit: -1 (MINUS - validator/constraint) Color: #2626D8 (Blue) Principle: Filter noise via deliberate re-attention Frame: Two-stage attention with explicit reasoning
System 2 Attention (S2A) validates and filters transformer attention by regenerating context deliberately. Standard attention (System 1) is fast but susceptible to sycophancy and irrelevant context. S2A re-attends after explicit reasoning.
S2A(x, context):
# System 1: fast pattern matching
context_filtered = LLM("Extract only relevant facts from: {context}")
# System 2: deliberate reasoning on clean context
return LLM(x, context=context_filtered)
def system2_attention(query: str, context: str, model) -> str:
# Stage 1: Regenerate context (remove sycophantic/irrelevant)
filter_prompt = f"""Given the context below, extract only the
objective facts relevant to answering questions. Remove opinions,
leading questions, and irrelevant details.
Context: {context}
Relevant facts only:"""
clean_context = model.generate(filter_prompt)
# Stage 2: Answer with filtered context
return model.generate(query, context=clean_context)
class S2AFilter:
def __init__(self, model):
self.model = model
def filter_sycophancy(self, context: str) -> str:
"""Remove opinion-seeking and leading content."""
return self.model.generate(
f"Rewrite removing any opinions or leading questions:\n{context}"
)
def filter_irrelevant(self, context: str, query: str) -> str:
"""Keep only query-relevant facts."""
return self.model.generate(
f"Extract facts from context relevant to: {query}\n\n{context}"
)
class System2AttentionLayer:
def __init__(self, base_attention, filter_model):
self.attn = base_attention
self.filter = filter_model
def forward(self, q, k, v, context_mask=None):
# Pass 1: Standard attention (System 1)
attn_weights = self.attn(q, k, v)
# Identify high-entropy (uncertain) positions
entropy = -torch.sum(attn_weights * torch.log(attn_weights + 1e-9), dim=-1)
uncertain = entropy > self.threshold
# Pass 2: Deliberate re-attention on uncertain positions
if uncertain.any():
filtered_kv = self.filter(k, v, uncertain)
attn_weights[uncertain] = self.attn(q[uncertain], filtered_kv)
return attn_weights
def validate_factual_grounding(response: str, facts: list[str]) -> float:
"""Score response grounding in verified facts."""
claims = extract_claims(response)
grounded = sum(1 for c in claims if any(entails(f, c) for f in facts))
return grounded / len(claims) if claims else 1.0
# Apply S2A filtering
just s2a-filter context.txt query.txt
# Measure sycophancy reduction
just s2a-sycophancy-test model responses/
# Validate factual grounding
just s2a-grounding response.txt facts.txt
system2-attention (-1) ⊗ causal-inference (0) ⊗ gflownet (+1) = 0 ✓ [Deliberate Search]
system2-attention (-1) ⊗ cognitive-superposition (0) ⊗ forward-forward-learning (+1) = 0 ✓ [Local Validation]
Skill Name: system2-attention Type: Deliberate Reasoning Validator Trit: -1 (MINUS) Color: #2626D8 (Blue)
This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:
general: 734 citations in bib.duckdbThis skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
The skill participates in triads satisfying:
(-1) + (0) + (+1) ≡ 0 (mod 3)
This ensures compositional coherence in the Cat# equipment structure.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (plurigrid/asi) — no native marketplace selected
npx claudepluginhub p/plurigrid-asi-plugins-asi1,393 skills in this plugin
/abductive-replHypothesis-Test Loops via REPL for Exploratory Abductive Inference/academic-researchSearch academic papers across arXiv, PubMed, Semantic Scholar, bioRxiv, medRxiv, Google Scholar, and more. Get BibTeX citations, download PDFs, analyze citation networks. Use for literature reviews, finding papers, and academic research./accept-no-substitutesThis skill should be used when agents generate placeholder tokens like "pseudo-", "mock-", "temporary", "TODO", "demo-", or similar incompleteness markers. Detects substitution patterns in agent OUTPUT and triggers mandatory user interview instead of accepting incomplete work. Activates automatically on any output containing forbidden tokens.Other plugins' skills for the same job