Agent skill

Behavioral Analysis

by Hack23 in Hack23/cia

Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence

Apache-2.0Auto-check passed

Install Behavioral Analysis

skills CLI
$ npx skills add Hack23/cia --skill behavioral-analysis -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Hack23/cia behavioral-analysis --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Hack23/cia.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/behavioral-analysis .claude/skills/behavioral-analysis && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
behavioral-analysis
GitHub stars
239
Token cost
~10k tokens
SKILL.md length
962 words
Files
1
Skills in repo
78
Repo updated
First seen
Licence
Apache-2.0

At a glance

Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence

  • Works in 6 steps: Voting Deviation Analysis → Group Dynamics & Polarization → Leadership Style Profiling → …
  • SKILL.md covers Purpose, When to Use This Skill, Behavioral Analysis Framework and 1. Voting Deviation Analysis, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Behavioral Analysis is an agent skill from Hack23/cia. Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence

Its SKILL.md is about 10k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Citizen Intelligence Agency. Open-source intelligence platform analyzing Swedish political activities using AI and data visualization. Tracks politicians, government… The licence is Apache-2.0.

Example prompts

  • “/behavioral-analysis”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Voting Deviation Analysis
  2. Group Dynamics & Polarization
  3. Leadership Style Profiling
  4. Cognitive Bias Identification
  5. Constituency Influence Analysis
  6. Behavioral Risk Indicators

What it can do on your machine

Read from SKILL.md and the folder at commit bbed538. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java, python, mermaid and sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Behavioral Analysis loads about 10k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 962 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~10k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Hack23/cia at commit bbed538, republished under its Apache-2.0 licence (© Hack23). 962 words, ~10,011 tokens.

Download SKILL.mdSave it as .claude/skills/behavioral-analysis/SKILL.md (or your agent's skills folder).
name
behavioral-analysis
description
Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence
license
Apache-2.0

Behavioral Analysis Skill

Purpose

This skill provides comprehensive behavioral analysis methodologies for understanding political decision-making, cognitive patterns, and psychological dynamics within the Swedish Parliament. It combines political psychology research with OSINT intelligence to identify behavioral indicators, predict policy positions, and assess leadership effectiveness through evidence-based analysis of voting patterns, speech behavior, and collaboration networks.

When to Use This Skill

Apply this skill when:

  • ✅ Analyzing voting deviation patterns to understand internal party conflicts
  • ✅ Identifying cognitive biases in parliamentary decision-making
  • ✅ Assessing leadership styles and personality traits of political figures
  • ✅ Detecting group polarization and echo chamber effects in committees
  • ✅ Evaluating constituency influence on voting behavior
  • ✅ Predicting policy positions based on behavioral indicators
  • ✅ Conducting psychological profiling for strategic intelligence
  • ✅ Analyzing coalition dynamics and negotiation patterns
  • ✅ Identifying behavioral risk indicators (absenteeism, isolation, radicalization)

Do NOT use for:

  • ❌ Clinical psychological diagnosis (not qualified medical assessment)
  • ❌ Personal mental health speculation without public disclosure
  • ❌ Behavioral profiling for harassment or discrimination
  • ❌ Non-evidence-based personality claims

Behavioral Analysis Framework

Political Psychology Dimensions

The CIA platform analyzes five core behavioral dimensions to create comprehensive political profiles:

mermaid
graph TB
    subgraph "Behavioral Intelligence Collection"
        A1["🗳️ Voting Behavior<br/>3.5M+ votes analyzed<br/>Deviation tracking"]
        A2["👥 Social Networks<br/>Collaboration patterns<br/>Influence metrics"]
        A3["📄 Productivity Signals<br/>Document authorship<br/>Committee activity"]
        A4["🎤 Communication Style<br/>Speech analysis<br/>Rhetoric patterns"]
        A5["⏱️ Temporal Patterns<br/>Attendance trends<br/>Engagement cycles"]
    end
    
    subgraph "Psychological Analysis"
        A1 --> B1[Decision-Making Analysis]
        A2 --> B2[Group Dynamics Assessment]
        A3 --> B3[Motivation Evaluation]
        A4 --> B4[Leadership Style Profiling]
        A5 --> B5[Behavioral Consistency Check]
    end
    
    subgraph "Cognitive Bias Detection"
        B1 --> C1{Confirmation Bias}
        B2 --> C2{Groupthink}
        B3 --> C3{Status Quo Bias}
        B4 --> C4{Authority Bias}
        B5 --> C5{Recency Bias}
    end
    
    subgraph "Intelligence Product"
        C1 & C2 & C3 & C4 & C5 --> D["🧠 Behavioral Profile"]
        D --> E[Predictive Insights]
        D --> F[Risk Indicators]
        D --> G[Leadership Assessment]
    end
    
    style A1 fill:#e1f5ff
    style A2 fill:#e1f5ff
    style A3 fill:#e1f5ff
    style A4 fill:#e1f5ff
    style A5 fill:#e1f5ff
    style D fill:#ffe6cc
    style E fill:#ccffcc
    style F fill:#ffcccc
    style G fill:#fff9cc

1. Voting Deviation Analysis

Cognitive Dissonance Detection

Political psychologists recognize voting deviation as a key indicator of cognitive dissonance - when a politician's personal beliefs conflict with party expectations. The CIA platform tracks this through multi-dimensional analysis.

Database Views:

  • view_riksdagen_vote_data_ballot_politician_summary_daily - Daily voting patterns
  • view_riksdagen_politician_ballot_summary - Aggregated voting statistics
  • view_politician_behavioral_trends - Long-term behavioral trends
  • view_riksdagen_politician_decision_pattern - Decision pattern classification
Party Line Conformity Analysis
java
@Component
public class PartyConformityAnalyzer {
    
    /**
     * Analyzes voting deviation patterns to identify cognitive dissonance.
     * 
     * High deviation indicates:
     * - Internal conflict with party platform
     * - Constituency pressure overriding party discipline
     * - Personal ideology asserting independence
     * - Strategic positioning for leadership
     */
    @Transactional(readOnly = true)
    public PartyConformityProfile analyzeConformity(String politicianId, String partyId) {
        String sql = """
            SELECT 
                p.person_id,
                p.first_name || ' ' || p.last_name as name,
                p.party as current_party,
                vbs.total_votes,
                vbs.won_votes,
                vbs.lost_votes,
                vbs.rebel_votes,
                vbs.avg_vote_win_rate,
                vbs.vote_effectiveness_score,
                ROUND(100.0 * vbs.rebel_votes / NULLIF(vbs.total_votes, 0), 2) as deviation_rate,
                
                -- Behavioral indicators
                CASE 
                    WHEN vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) < 0.02 THEN 'CONFORMIST'
                    WHEN vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) < 0.05 THEN 'MODERATE'
                    WHEN vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) < 0.10 THEN 'INDEPENDENT'
                    ELSE 'MAVERICK'
                END as conformity_type,
                
                -- Cognitive dissonance indicators
                CASE 
                    WHEN vbs.rebel_votes > 50 AND vbs.rebel_votes::float / vbs.total_votes > 0.10 
                        THEN 'HIGH_DISSONANCE'
                    WHEN vbs.rebel_votes > 20 AND vbs.rebel_votes::float / vbs.total_votes > 0.05 
                        THEN 'MODERATE_DISSONANCE'
                    ELSE 'LOW_DISSONANCE'
                END as dissonance_level
                
            FROM view_riksdagen_politician p
            JOIN view_riksdagen_politician_ballot_summary vbs ON p.person_id = vbs.person_id
            WHERE p.person_id = :politicianId
                AND p.party = :partyId
            """;
        
        return jdbcTemplate.queryForObject(sql, PartyConformityProfile.class,
            Map.of("politicianId", politicianId, "partyId", partyId));
    }
}
Psychological Profile Types
Conformity TypeDeviation RateBehavioral IndicatorsStrategic Implications
CONFORMIST< 2%Strong party loyalty, risk-averse, hierarchical mindsetSafe coalition partner, reliable vote
MODERATE2-5%Balanced independence, calculated risksNegotiable on key issues
INDEPENDENT5-10%Constituency-driven, personal ideologySwing vote potential
MAVERICK> 10%Highly independent, ideological purityUnpredictable, high-risk alliance

2. Group Dynamics & Polarization

Echo Chamber Detection

Political committees can develop echo chambers where dissenting views are suppressed. The CIA platform identifies these through collaboration pattern analysis.

python
import pandas as pd
import networkx as nx
from typing import Dict, List, Tuple

class EchoChamberDetector:
    """
    Detects echo chambers in parliamentary committees using network analysis.
    
    Indicators of echo chambers:
    - High internal connectivity, low external bridges
    - Ideological homogeneity exceeding party baseline
    - Resistance to cross-party collaboration
    - Information isolation from opposing viewpoints
    """
    
    def analyze_committee_network(self, committee_id: str) -> Dict:
        """
        Analyzes committee collaboration networks for echo chamber indicators.
        
        Returns metrics:
        - Internal density: Collaboration within ideological cluster
        - Bridge centrality: Cross-cluster information flow
        - Homophily index: Ideological similarity preference
        - Polarization score: Cluster separation intensity
        """
        
        query = """
        SELECT 
            c.org_code,
            c.committee_name,
            
            -- Network structure metrics
            COUNT(DISTINCT cm.person_id) as member_count,
            COUNT(DISTINCT cm.party) as party_diversity,
            
            -- Collaboration patterns (co-authorship, co-sponsorship)
            (SELECT COUNT(*) 
             FROM document_person dp1 
             JOIN document_person dp2 ON dp1.document_id = dp2.document_id 
             WHERE dp1.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
               AND dp2.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
               AND dp1.person_id < dp2.person_id
            ) as internal_collaboration,
            
            -- Cross-party bridge activity
            (SELECT COUNT(*) 
             FROM document_person dp1 
             JOIN document_person dp2 ON dp1.document_id = dp2.document_id 
             JOIN person p1 ON dp1.person_id = p1.person_id
             JOIN person p2 ON dp2.person_id = p2.person_id
             WHERE dp1.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
               AND dp2.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
               AND p1.party != p2.party
               AND dp1.person_id < dp2.person_id
            ) as cross_party_bridges,
            
            -- Ideological homogeneity (voting similarity)
            AVG(
                (SELECT AVG(
                    CASE WHEN v1.vote = v2.vote THEN 1.0 ELSE 0.0 END
                ) FROM vote v1, vote v2 
                WHERE v1.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
                  AND v2.person_id IN (SELECT person_id FROM committee_member WHERE org_code = c.org_code)
                  AND v1.ballot_id = v2.ballot_id
                  AND v1.person_id < v2.person_id
                )
            ) as internal_voting_similarity
            
        FROM committee c
        JOIN committee_member cm ON c.org_code = cm.org_code
        WHERE c.org_code = %s
        GROUP BY c.org_code, c.committee_name
        """
        
        df = pd.read_sql(query, self.connection, params=[committee_id])
        
        # Calculate echo chamber indicators
        internal_density = df['internal_collaboration'].iloc[0] / (df['member_count'].iloc[0] ** 2)
        bridge_ratio = df['cross_party_bridges'].iloc[0] / max(df['internal_collaboration'].iloc[0], 1)
        homophily_index = df['internal_voting_similarity'].iloc[0]
        
        # Echo chamber score (0-100, higher = stronger echo chamber)
        echo_chamber_score = (
            (internal_density * 30) +
            ((1 - bridge_ratio) * 30) +
            (homophily_index * 40)
        )
        
        return {
            'committee_id': committee_id,
            'echo_chamber_score': round(echo_chamber_score, 2),
            'internal_density': round(internal_density, 3),
            'bridge_ratio': round(bridge_ratio, 3),
            'homophily_index': round(homophily_index, 3),
            'classification': self._classify_echo_chamber(echo_chamber_score)
        }
    
    def _classify_echo_chamber(self, score: float) -> str:
        """Classify echo chamber severity."""
        if score >= 75:
            return "SEVERE_ECHO_CHAMBER"
        elif score >= 60:
            return "MODERATE_ECHO_CHAMBER"
        elif score >= 40:
            return "MILD_POLARIZATION"
        else:
            return "HEALTHY_DIVERSITY"
Groupthink Detection Criteria
IndicatorMeasurementRisk ThresholdIntelligence Assessment
Internal DensityCollaboration frequency within group> 0.75High cohesion, low external input
Bridge RatioCross-party collaboration rate< 0.20Limited opposing viewpoints
Homophily IndexVoting similarity among members> 0.85Ideological homogeneity
Dissent SuppressionMinority opinion frequency< 5%Conformity pressure
Echo Chamber ScoreComposite metric> 75Critical groupthink risk

3. Leadership Style Profiling

Five Leadership Dimensions

Political leadership styles significantly impact party effectiveness and coalition stability. The CIA platform classifies leaders across five dimensions based on behavioral evidence.

java
@Service
public class LeadershipStyleAnalyzer {
    
    /**
     * Analyzes leadership effectiveness through behavioral indicators.
     * 
     * Based on transformational leadership theory (Bass & Riggio, 2006)
     * and political leadership research (Burns, 1978).
     */
    public LeadershipProfile analyzeLeadership(String politicianId) {
        String sql = """
            WITH leadership_metrics AS (
                SELECT 
                    p.person_id,
                    p.first_name || ' ' || p.last_name as name,
                    p.party,
                    
                    -- Dimension 1: Collaborative vs. Authoritarian
                    vim.collaboration_score,
                    vim.network_centrality,
                    
                    -- Dimension 2: Ideological vs. Pragmatic
                    vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) as ideological_purity,
                    vbs.vote_effectiveness_score as pragmatic_success,
                    
                    -- Dimension 3: Proactive vs. Reactive
                    COUNT(DISTINCT d.document_id) as initiated_documents,
                    vbs.total_votes as participation_votes,
                    
                    -- Dimension 4: Consensus-builder vs. Confrontational
                    vim.cross_party_collaboration_score,
                    vbs.rebel_votes as confrontational_votes,
                    
                    -- Dimension 5: Visible vs. Behind-scenes
                    COUNT(DISTINCT CASE WHEN d.document_type = 'motion' THEN d.document_id END) as public_initiatives,
                    COUNT(DISTINCT CASE WHEN d.document_type = 'interpellation' THEN d.document_id END) as oversight_activity
                    
                FROM view_riksdagen_politician p
                LEFT JOIN view_riksdagen_politician_ballot_summary vbs ON p.person_id = vbs.person_id
                LEFT JOIN view_riksdagen_politician_influence_metrics vim ON p.person_id = vim.person_id
                LEFT JOIN view_riksdagen_politician_document d ON p.person_id = d.person_id
                WHERE p.person_id = :politicianId
                GROUP BY p.person_id, p.first_name, p.last_name, p.party,
                         vim.collaboration_score, vim.network_centrality,
                         vbs.rebel_votes, vbs.total_votes, vbs.vote_effectiveness_score
            )
            SELECT 
                *,
                -- Leadership style classification
                CASE 
                    WHEN collaboration_score > 0.7 AND cross_party_collaboration_score > 0.6 
                        THEN 'TRANSFORMATIONAL'
                    WHEN ideological_purity > 0.15 AND confrontational_votes > 100 
                        THEN 'IDEOLOGICAL_PURIST'
                    WHEN pragmatic_success > 0.75 AND cross_party_collaboration_score > 0.5 
                        THEN 'PRAGMATIC_DEALMAKER'
                    WHEN initiated_documents > 50 AND public_initiatives > 30 
                        THEN 'POLICY_ENTREPRENEUR'
                    WHEN network_centrality > 0.8 AND collaboration_score < 0.4 
                        THEN 'AUTHORITARIAN_BROKER'
                    ELSE 'BACKBENCHER'
                END as leadership_style
            FROM leadership_metrics
            """;
        
        return jdbcTemplate.queryForObject(sql, LeadershipProfile.class,
            Map.of("politicianId", politicianId));
    }
}
Leadership Style Taxonomy
StyleBehavioral IndicatorsStrengthsWeaknessesStrategic Use
TRANSFORMATIONALHigh collaboration, cross-party bridges, inspires changeCoalition-building, reform leadershipCan compromise core valuesCoalition negotiations
IDEOLOGICAL_PURISTHigh deviation, confrontational, principle-drivenPolicy consistency, base mobilizationLimited legislative successOpposition leadership
PRAGMATIC_DEALMAKERLow deviation, high effectiveness, flexibleLegislative productivity, majority-buildingPerceived as lacking principlesGovernment formation
POLICY_ENTREPRENEURHigh document initiation, innovation-focusedAgenda-setting, thought leadershipImplementation challengesCommittee chairmanship
AUTHORITARIAN_BROKERHigh centrality, low collaboration, control-orientedDiscipline enforcement, clarityStifles innovation, loyalty issuesCrisis management
BACKBENCHERLow activity across all dimensionsLow-risk, loyal followerLimited influenceSafe majority vote

4. Cognitive Bias Identification

Decision-Making Bias Framework

Political decisions are influenced by systematic cognitive biases. The CIA platform identifies these patterns through voting behavior analysis.

python
from dataclasses import dataclass
from typing import List, Optional
from datetime import datetime, timedelta

@dataclass
class CognitiveBiasIndicators:
    """Indicators of cognitive biases in political decision-making."""
    politician_id: str
    confirmation_bias_score: float
    status_quo_bias_score: float
    authority_bias_score: float
    recency_bias_score: float
    availability_bias_score: float
    
class CognitiveBiasDetector:
    """
    Identifies cognitive biases through voting pattern analysis.
    
    Based on Kahneman & Tversky's cognitive bias research
    applied to political decision-making contexts.
    """
    
    def detect_confirmation_bias(self, politician_id: str) -> float:
        """
        Detects confirmation bias: Tendency to vote with pre-existing beliefs.
        
        Measured by:
        - Consistency with historical positions
        - Resistance to policy evolution despite new evidence
        - Selective attention to information supporting prior stance
        """
        
        query = """
        WITH politician_voting AS (
            SELECT 
                v.person_id,
                v.vote,
                b.issue_category,
                b.vote_date,
                LAG(v.vote) OVER (
                    PARTITION BY v.person_id, b.issue_category 
                    ORDER BY b.vote_date
                ) as previous_vote,
                LAG(b.vote_date) OVER (
                    PARTITION BY v.person_id, b.issue_category 
                    ORDER BY b.vote_date
                ) as previous_date
            FROM vote v
            JOIN ballot b ON v.ballot_id = b.ballot_id
            WHERE v.person_id = %s
                AND b.vote_date >= NOW() - INTERVAL '4 years'
        )
        SELECT 
            person_id,
            -- Consistency score: How often votes align with historical position
            AVG(CASE WHEN vote = previous_vote THEN 1.0 ELSE 0.0 END) as consistency_rate,
            
            -- Rigidity score: Resistance to policy evolution over time
            COUNT(CASE WHEN vote != previous_vote 
                       AND previous_date < vote_date - INTERVAL '1 year' 
                       THEN 1 END)::float / COUNT(*) as evolution_resistance,
            
            COUNT(*) as total_comparable_votes
            
        FROM politician_voting
        WHERE previous_vote IS NOT NULL
        GROUP BY person_id
        """
        
        result = pd.read_sql(query, self.connection, params=[politician_id])
        
        if result.empty or result['total_comparable_votes'].iloc[0] < 10:
            return 0.0
        
        # Confirmation bias score: High consistency + high resistance = stronger bias
        consistency_rate = result['consistency_rate'].iloc[0]
        evolution_resistance = result['evolution_resistance'].iloc[0]
        
        bias_score = (consistency_rate * 0.6) + (evolution_resistance * 0.4)
        return round(bias_score * 100, 2)
    
    def detect_status_quo_bias(self, politician_id: str) -> float:
        """
        Detects status quo bias: Preference for maintaining current state.
        
        Measured by:
        - Voting against reform proposals
        - Supporting incumbent policies
        - Resisting change initiatives
        """
        
        query = """
        SELECT 
            v.person_id,
            COUNT(CASE WHEN b.is_reform_proposal = TRUE AND v.vote = 'Nej' THEN 1 END)::float /
            NULLIF(COUNT(CASE WHEN b.is_reform_proposal = TRUE THEN 1 END), 0) as reform_opposition_rate,
            
            COUNT(CASE WHEN b.is_status_quo_motion = TRUE AND v.vote = 'Ja' THEN 1 END)::float /
            NULLIF(COUNT(CASE WHEN b.is_status_quo_motion = TRUE THEN 1 END), 0) as status_quo_support_rate,
            
            COUNT(*) as total_policy_votes
            
        FROM vote v
        JOIN ballot b ON v.ballot_id = b.ballot_id
        WHERE v.person_id = %s
            AND (b.is_reform_proposal = TRUE OR b.is_status_quo_motion = TRUE)
            AND b.vote_date >= NOW() - INTERVAL '2 years'
        GROUP BY v.person_id
        """
        
        result = pd.read_sql(query, self.connection, params=[politician_id])
        
        if result.empty or result['total_policy_votes'].iloc[0] < 5:
            return 0.0
        
        reform_opposition = result['reform_opposition_rate'].iloc[0] or 0.0
        status_quo_support = result['status_quo_support_rate'].iloc[0] or 0.0
        
        bias_score = (reform_opposition * 0.5) + (status_quo_support * 0.5)
        return round(bias_score * 100, 2)
    
    def detect_authority_bias(self, politician_id: str) -> float:
        """
        Detects authority bias: Over-reliance on party leadership guidance.
        
        Measured by:
        - Voting alignment with party leadership
        - Lack of independent positions
        - Deference to authority figures
        """
        
        query = """
        WITH party_leader_votes AS (
            SELECT 
                v.ballot_id,
                v.vote as leader_vote
            FROM vote v
            JOIN person p ON v.person_id = p.person_id
            WHERE p.is_party_leader = TRUE
                AND p.party = (SELECT party FROM person WHERE person_id = %s)
        )
        SELECT 
            v.person_id,
            COUNT(CASE WHEN v.vote = plv.leader_vote THEN 1 END)::float /
            NULLIF(COUNT(*), 0) as leadership_alignment_rate,
            
            COUNT(*) as total_votes_with_leader
            
        FROM vote v
        JOIN party_leader_votes plv ON v.ballot_id = plv.ballot_id
        WHERE v.person_id = %s
        GROUP BY v.person_id
        """
        
        result = pd.read_sql(query, self.connection, params=[politician_id, politician_id])
        
        if result.empty or result['total_votes_with_leader'].iloc[0] < 20:
            return 0.0
        
        alignment_rate = result['leadership_alignment_rate'].iloc[0]
        
        # Authority bias score: Very high alignment suggests deference
        if alignment_rate > 0.95:
            return 100.0
        elif alignment_rate > 0.90:
            return 75.0
        elif alignment_rate > 0.85:
            return 50.0
        else:
            return round((alignment_rate - 0.70) * 200, 2)  # Scale 70-85% to 0-30
    
    def detect_recency_bias(self, politician_id: str) -> float:
        """
        Detects recency bias: Disproportionate weight on recent information.
        
        Measured by:
        - Vote position changes after recent media coverage
        - Inconsistency with long-term stance based on recent events
        - Rapid policy shifts following public attention
        """
        
        query = """
        WITH recent_votes AS (
            SELECT 
                v.person_id,
                v.vote,
                b.issue_category,
                b.vote_date,
                CASE WHEN b.vote_date >= NOW() - INTERVAL '90 days' THEN 'recent'
                     WHEN b.vote_date >= NOW() - INTERVAL '1 year' THEN 'medium_term'
                     ELSE 'historical' END as time_period
            FROM vote v
            JOIN ballot b ON v.ballot_id = b.ballot_id
            WHERE v.person_id = %s
                AND b.vote_date >= NOW() - INTERVAL '3 years'
        ),
        consistency_analysis AS (
            SELECT 
                person_id,
                issue_category,
                AVG(CASE WHEN time_period = 'recent' AND vote = 'Ja' THEN 1.0 ELSE 0.0 END) as recent_support,
                AVG(CASE WHEN time_period = 'historical' AND vote = 'Ja' THEN 1.0 ELSE 0.0 END) as historical_support
            FROM recent_votes
            GROUP BY person_id, issue_category
            HAVING COUNT(CASE WHEN time_period = 'recent' THEN 1 END) >= 3
               AND COUNT(CASE WHEN time_period = 'historical' THEN 1 END) >= 5
        )
        SELECT 
            person_id,
            AVG(ABS(recent_support - historical_support)) as avg_shift_magnitude,
            COUNT(*) as analyzed_categories
        FROM consistency_analysis
        WHERE ABS(recent_support - historical_support) > 0.20  -- Significant shift threshold
        GROUP BY person_id
        """
        
        result = pd.read_sql(query, self.connection, params=[politician_id])
        
        if result.empty or result['analyzed_categories'].iloc[0] < 3:
            return 0.0
        
        shift_magnitude = result['avg_shift_magnitude'].iloc[0]
        
        # Recency bias score: Larger shifts = stronger bias
        bias_score = min(shift_magnitude * 150, 100)  # Cap at 100
        return round(bias_score, 2)
Cognitive Bias Risk Matrix
Bias TypeDetection MethodRisk ThresholdBehavioral ImpactIntelligence Use
Confirmation BiasHistorical vote consistency> 85%Ignores contradictory evidencePredict resistance to new information
Status Quo BiasReform opposition rate> 70%Blocks necessary changeIdentify reform obstacles
Authority BiasLeadership alignment> 90%Lacks independent judgmentPredict via party leadership
Recency BiasVote shift magnitude after events> 30% shiftOverreacts to recent newsExploit timing of proposals
Availability BiasMedia-salient issue focus> 60% media-drivenIgnores non-salient issuesAssess media manipulation vulnerability
Show full SKILL.md (362 more words)Show less

5. Constituency Influence Analysis

Electoral Pressure Indicators

Politicians balance party loyalty with constituency demands. The CIA platform measures this tension through deviation analysis correlated with electoral data.

sql
-- Constituency Influence Scoring
WITH constituency_characteristics AS (
    SELECT 
        er.election_region_id,
        er.region_name,
        er.population,
        er.urban_rural_classification,
        er.median_income,
        er.education_level,
        
        -- Electoral competitiveness (closer races = more pressure)
        er.winning_margin_percentage,
        CASE 
            WHEN er.winning_margin_percentage < 5 THEN 'MARGINAL_SEAT'
            WHEN er.winning_margin_percentage < 10 THEN 'COMPETITIVE_SEAT'
            ELSE 'SAFE_SEAT'
        END as seat_classification,
        
        -- Ideological distance from party median
        er.constituency_ideology_score,
        p.party_ideology_score,
        ABS(er.constituency_ideology_score - p.party_ideology_score) as ideological_distance
        
    FROM election_region er
    JOIN party p ON er.winning_party = p.party_id
),
politician_constituency_behavior AS (
    SELECT 
        pol.person_id,
        pol.first_name || ' ' || pol.last_name as name,
        pol.party,
        pol.constituency_id,
        cc.seat_classification,
        cc.ideological_distance,
        
        -- Voting behavior
        vbs.rebel_votes,
        vbs.total_votes,
        vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) as deviation_rate,
        
        -- Document activity reflecting constituency concerns
        COUNT(DISTINCT pd.document_id) as constituency_documents,
        
        -- Constituency influence score
        CASE 
            WHEN cc.seat_classification = 'MARGINAL_SEAT' 
                AND cc.ideological_distance > 15 
                AND vbs.rebel_votes::float / vbs.total_votes > 0.05 
                THEN 'HIGH_CONSTITUENCY_INFLUENCE'
            WHEN cc.seat_classification = 'COMPETITIVE_SEAT' 
                AND vbs.rebel_votes::float / vbs.total_votes > 0.03 
                THEN 'MODERATE_CONSTITUENCY_INFLUENCE'
            WHEN cc.seat_classification = 'SAFE_SEAT' 
                AND vbs.rebel_votes::float / vbs.total_votes < 0.02 
                THEN 'PARTY_DISCIPLINE_DOMINANT'
            ELSE 'BALANCED_INFLUENCE'
        END as influence_classification
        
    FROM view_riksdagen_politician pol
    JOIN constituency_characteristics cc ON pol.constituency_id = cc.election_region_id
    JOIN view_riksdagen_politician_ballot_summary vbs ON pol.person_id = vbs.person_id
    LEFT JOIN view_riksdagen_politician_document pd ON pol.person_id = pd.person_id
    GROUP BY pol.person_id, pol.first_name, pol.last_name, pol.party, pol.constituency_id,
             cc.seat_classification, cc.ideological_distance, 
             vbs.rebel_votes, vbs.total_votes, pd.document_id
)
SELECT 
    person_id,
    name,
    party,
    seat_classification,
    deviation_rate,
    influence_classification,
    
    -- Strategic intelligence assessment
    CASE 
        WHEN influence_classification = 'HIGH_CONSTITUENCY_INFLUENCE' 
            THEN 'Target for constituency-based persuasion campaigns'
        WHEN influence_classification = 'PARTY_DISCIPLINE_DOMINANT' 
            THEN 'Requires party leadership negotiation'
        ELSE 'Balanced approach needed'
    END as strategic_approach
    
FROM politician_constituency_behavior
ORDER BY deviation_rate DESC, ideological_distance DESC;

6. Behavioral Risk Indicators

Comprehensive Risk Profiling

The CIA platform integrates behavioral indicators with Drools risk rules to create comprehensive risk profiles. These profiles predict potential accountability failures.

Risk Rules Integration:

  • PoliticianLazy.drl - Absenteeism indicating disengagement
  • PoliticianIneffectiveVoting.drl - Chronic minority voting
  • PartyRebelVoting.drl - Excessive deviation indicating instability
  • CommitteeInactive.drl - Committee withdrawal patterns
java
@Component
public class BehavioralRiskAssessment {
    
    /**
     * Comprehensive behavioral risk assessment integrating multiple indicators.
     * 
     * Risk dimensions:
     * 1. Engagement risk (absenteeism, withdrawal)
     * 2. Effectiveness risk (minority voting, low productivity)
     * 3. Stability risk (high deviation, erratic patterns)
     * 4. Collaboration risk (isolation, network periphery)
     * 5. Cognitive risk (bias indicators, decision-making quality)
     */
    public ComprehensiveRiskProfile assessBehavioralRisks(String politicianId) {
        String sql = """
            SELECT 
                p.person_id,
                p.first_name || ' ' || p.last_name as name,
                p.party,
                
                -- Engagement Risk Indicators
                vbs_daily.avg_absent_percentage as daily_absence_rate,
                vbs_monthly.avg_absent_percentage as monthly_absence_rate,
                vbs_annual.avg_absent_percentage as annual_absence_rate,
                
                -- Effectiveness Risk Indicators
                vbs.vote_effectiveness_score,
                vbs.avg_vote_win_rate,
                vbs.lost_votes::float / NULLIF(vbs.total_votes, 0) as loss_rate,
                
                -- Stability Risk Indicators
                vbs.rebel_votes,
                vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) as deviation_rate,
                STDDEV(CASE WHEN v.vote != p.party_vote THEN 1 ELSE 0 END) as deviation_volatility,
                
                -- Collaboration Risk Indicators
                vim.collaboration_score,
                vim.network_centrality,
                vim.cross_party_collaboration_score,
                
                -- Productivity Indicators
                COUNT(DISTINCT pd.document_id) as total_documents,
                
                -- Overall Risk Score (0-100, higher = higher risk)
                (
                    COALESCE(vbs_annual.avg_absent_percentage, 0) * 0.25 +
                    COALESCE((1 - vbs.vote_effectiveness_score) * 100, 0) * 0.25 +
                    COALESCE(vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) * 100, 0) * 0.20 +
                    COALESCE((1 - vim.collaboration_score) * 100, 0) * 0.15 +
                    COALESCE((1 - vim.network_centrality) * 100, 0) * 0.15
                ) as composite_risk_score,
                
                -- Risk Classification
                CASE 
                    WHEN (
                        COALESCE(vbs_annual.avg_absent_percentage, 0) * 0.25 +
                        COALESCE((1 - vbs.vote_effectiveness_score) * 100, 0) * 0.25 +
                        COALESCE(vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) * 100, 0) * 0.20 +
                        COALESCE((1 - vim.collaboration_score) * 100, 0) * 0.15 +
                        COALESCE((1 - vim.network_centrality) * 100, 0) * 0.15
                    ) >= 70 THEN 'CRITICAL_RISK'
                    WHEN (
                        COALESCE(vbs_annual.avg_absent_percentage, 0) * 0.25 +
                        COALESCE((1 - vbs.vote_effectiveness_score) * 100, 0) * 0.25 +
                        COALESCE(vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) * 100, 0) * 0.20 +
                        COALESCE((1 - vim.collaboration_score) * 100, 0) * 0.15 +
                        COALESCE((1 - vim.network_centrality) * 100, 0) * 0.15
                    ) >= 50 THEN 'HIGH_RISK'
                    WHEN (
                        COALESCE(vbs_annual.avg_absent_percentage, 0) * 0.25 +
                        COALESCE((1 - vbs.vote_effectiveness_score) * 100, 0) * 0.25 +
                        COALESCE(vbs.rebel_votes::float / NULLIF(vbs.total_votes, 0) * 100, 0) * 0.20 +
                        COALESCE((1 - vim.collaboration_score) * 100, 0) * 0.15 +
                        COALESCE((1 - vim.network_centrality) * 100, 0) * 0.15
                    ) >= 30 THEN 'MODERATE_RISK'
                    ELSE 'LOW_RISK'
                END as risk_classification
                
            FROM view_riksdagen_politician p
            LEFT JOIN view_riksdagen_politician_ballot_summary vbs ON p.person_id = vbs.person_id
            LEFT JOIN view_riksdagen_vote_data_ballot_politician_summary_daily vbs_daily ON p.person_id = vbs_daily.person_id
            LEFT JOIN view_riksdagen_vote_data_ballot_politician_summary_monthly vbs_monthly ON p.person_id = vbs_monthly.person_id
            LEFT JOIN view_riksdagen_vote_data_ballot_politician_summary_annual vbs_annual ON p.person_id = vbs_annual.person_id
            LEFT JOIN view_riksdagen_politician_influence_metrics vim ON p.person_id = vim.person_id
            LEFT JOIN view_riksdagen_politician_document pd ON p.person_id = pd.person_id
            LEFT JOIN vote v ON p.person_id = v.person_id
            WHERE p.person_id = :politicianId
            GROUP BY p.person_id, p.first_name, p.last_name, p.party,
                     vbs_daily.avg_absent_percentage, vbs_monthly.avg_absent_percentage, 
                     vbs_annual.avg_absent_percentage, vbs.vote_effectiveness_score,
                     vbs.avg_vote_win_rate, vbs.lost_votes, vbs.total_votes,
                     vbs.rebel_votes, vim.collaboration_score, vim.network_centrality,
                     vim.cross_party_collaboration_score
            """;
        
        return jdbcTemplate.queryForObject(sql, ComprehensiveRiskProfile.class,
            Map.of("politicianId", politicianId));
    }
}

ISMS Compliance Mapping

ISO 27001:2022 Controls
ControlBehavioral Analysis Application
A.5.1 - Policies for information securityApply behavioral analysis to detect policy violations and non-compliance patterns
A.5.15 - Access controlBehavioral profiling for insider threat detection and access privilege monitoring
A.8.16 - Monitoring activitiesContinuous behavioral monitoring for anomaly detection
A.8.23 - Web filteringAnalyze access patterns to identify unauthorized information seeking
NIST Cybersecurity Framework 2.0
FunctionBehavioral Analysis Integration
IDENTIFY (ID.AM)Behavioral profiling of personnel with access to sensitive political intelligence
DETECT (DE.CM)Continuous monitoring for anomalous behavior patterns
RESPOND (RS.AN)Behavioral analysis to assess incident response effectiveness
CIS Controls v8
ControlApplication
CIS Control 6 - Access Control ManagementApply behavioral risk assessment to access privilege decisions
CIS Control 8 - Audit Log ManagementBehavioral analysis of audit log patterns

Hack23 ISMS Policy References

This skill implements requirements from:

References

Political Psychology Literature
  1. Kahneman, D., & Tversky, A. (1979). "Prospect Theory: An Analysis of Decision under Risk." Econometrica, 47(2), 263-291.
  2. Bass, B. M., & Riggio, R. E. (2006). Transformational Leadership (2nd ed.). Psychology Press.
  3. Burns, J. M. (1978). Leadership. Harper & Row.
  4. Janis, I. L. (1982). Groupthink: Psychological Studies of Policy Decisions and Fiascoes. Houghton Mifflin.
  5. Tetlock, P. E. (2005). Expert Political Judgment: How Good Is It? How Can We Know? Princeton University Press.
Database Intelligence Sources
Swedish Political Context
  • Swedish Parliament (Riksdagen) - Official documentation of parliamentary procedures
  • V-Dem Institute - Democracy measurement and behavioral indicators
  • Swedish Election Authority - Electoral competitiveness data

© Hack23, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/behavioral-analysis of Hack23/cia.

Open the folder on GitHubat commit bbed538

Compare with similar skills

Behavioral Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Behavioral Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Behavioral Analysis this skillHack23/cia239—~10kAutomated safety check: PassApache-2.0
Marketing Psychologynexu-io/open-design100k—~317Automated safety check: PassApache-2.0
Behavioral Finance for TradingHKUDS/Vibe-Trading35k—~2.7kAutomated safety check: PassMIT
Soc Cognitive Biasasgard-ai-platform/skills241—~1.2kAutomated safety check: PassMIT
Dynamic Workflow Modeaffaan-m/ECC275k1 repos~1.3kAutomated safety check: PassMIT
Cognitive Patternruvnet/ruflo74k—~384Automated safety check: NotesMIT

Similar skills

  • Marketing Psychology

    nexu-io/open-design

    Apply psychological principles and behavioral science to copy and design.

    100k GitHub stars~317 tokensUpdated today
    Marketing & SEOAuto-check passed
  • Turns behavioral-finance theory into trading signals and risk rules: overreaction and underreaction, momentum and reversal, sentiment extremes and a cognitive-bias checklist.

    35k GitHub stars~2.7k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Soc Cognitive Bias

    asgard-ai-platform/skills

    Identify and analyze cognitive biases including confirmation bias, anchoring, availability heuristic, and sunk cost fallacy in decision-making contexts.

    241 GitHub stars~1.2k tokensUpdated 4 mo ago
    Marketing & SEOAuto-check passed
  • Design task-local harnesses, eval gates, and reusable skill extraction for Claude dynamic workflow mode and other adaptive agent harnesses.

    275k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Cognitive Pattern

    ruvnet/ruflo

    Define and manage cognitive patterns for agent reasoning and decision-making

    74k GitHub stars~384 tokensUpdated today
    Auto-check: notes
  • Detecting Mobile Malware Behavior

    mukul975/Anthropic-Cybersecurity-Skills

    Detects and analyzes malicious behavior in mobile applications through behavioral analysis, permission abuse detection, network traffic monitoring, and dynamic instrumentation.

    34k GitHub stars~2.2k tokensUpdated 1 mo ago
    SecurityAuto-check passed

More from Hack23/cia

All 78 skills in this repo
  • WCAG 2.1 AA compliance, ARIA attributes, keyboard navigation, screen reader optimization for accessible political data platforms

    239 GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Advanced chart types, D3.js/Vaadin Charts patterns, political data visualization, time series analysis

    239 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • AI Governance

    Hack23/cia

    AI governance, EU AI Act compliance, OWASP LLM security, responsible AI practices for GitHub Copilot agents

    239 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • API Integration

    Hack23/cia

    External API integration patterns, retry logic, circuit breakers, caching, rate limiting for government data APIs

    239 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • AWS CloudWatch metrics, alarms, dashboards, log insights, and application monitoring for the CIA platform

    239 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • AWS security best practices, VPC security, IAM, KMS, CloudTrail, GuardDuty for CIA platform deployment

    239 GitHub stars~2.3k tokensUpdated today
    Auto-check passed

Questions about Behavioral Analysis

What does Behavioral Analysis do?

Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence. Behavioral Analysis is an agent skill from Hack23/cia.

How do I install Behavioral Analysis in Claude Code?

Run `npx skills add Hack23/cia --skill behavioral-analysis -a claude-code`. Or copy the skill folder (.github/skills/behavioral-analysis in Hack23/cia) into .claude/skills/behavioral-analysis in your project. Claude Code loads it when a task matches its description.

How do I install Behavioral Analysis in Codex?

Run `npx skills add Hack23/cia --skill behavioral-analysis -a codex`. Or copy the skill folder (.github/skills/behavioral-analysis in Hack23/cia) into .agents/skills/behavioral-analysis in your project. Codex loads it when a task matches its description.

Can I use Behavioral Analysis in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Hack23/cia --skill behavioral-analysis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/behavioral-analysis, .gemini/skills/behavioral-analysis, .github/skills/behavioral-analysis and .opencode/skills/behavioral-analysis in your project.

What does Behavioral Analysis need to run?

SKILL.md names no scripts, command-line tools or credentials: Behavioral Analysis is instructions for the agent only. Our summary lists: Python 3.

Does Behavioral Analysis access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Behavioral Analysis safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Behavioral Analysis use?

Behavioral Analysis is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Behavioral Analysis use?

About 10k tokens (SKILL.md is roughly 40k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Behavioral Analysis?

Skills that share tags, products or a category with Behavioral Analysis: Marketing Psychology (nexu-io/open-design, 100k stars), Behavioral Finance for Trading (HKUDS/Vibe-Trading, 35k stars), Soc Cognitive Bias (asgard-ai-platform/skills, 241 stars) and Dynamic Workflow Mode (affaan-m/ECC, 275k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Behavioral Analysis?

Hack23 (a GitHub organization) maintains it in Hack23/cia, which has 239 GitHub stars. The repository holds 78 skills in this directory. The repository was last updated on October 7, 2026.

Source: Hack23/cia on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.