New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ucirs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ucirs

Structural enforcement layer for irreversible actions with explicit assumption declaration

latest
Source
npmnpm
Version
0.5.3
Version published
Maintainers
1
Created
Source

UCIRS

Unified Cognitive Infrastructure for Irreversible Systems

A structural enforcement layer for Git workflows. UCIRS detects irreversible actions in commits and requires explicit assumption declarations before proceeding.

What This Is

UCIRS is a Git hook system that:

  • Detects patterns indicating irreversible changes (database migrations, destructive operations, API breaking changes)
  • Blocks commits when irreversible changes lack explicit assumptions
  • Explains why a block occurred and what to do next
  • Records enforcement decisions for later reconstruction

What This Is Not

  • A security scanner
  • A vulnerability detector
  • A code quality tool
  • An AI system that "understands" code

Limitations

  • Pattern-based detection: UCIRS uses regex patterns to identify irreversible actions. Novel patterns not in the detection rules will not be caught.
  • No semantic understanding: UCIRS cannot determine if an assumption is correct, only that one exists.
  • Local enforcement only: Cross-repo features (v3+) propagate warnings, never blocks.
  • Heuristic classification: Security detection (v4) uses content patterns with explicit confidence levels.

Installation

npm (CLI + Library)

# Global install for CLI
npm install -g ucirs

# Local install for library API
npm install ucirs

VS Code Extension

ext install asapabhii.ucirs

Or search "UCIRS" in VS Code Extensions.

Git Hooks

After installing, add hooks to your repository:

ucirs install-hooks

Quick Start

1. Make an irreversible change

-- migrations/001_drop_column.sql
ALTER TABLE users DROP COLUMN legacy_field;

2. Attempt to commit

git add migrations/
git commit -m "drop legacy column"

3. UCIRS blocks with explanation

╔══════════════════════════════════════════════════╗
║              UCIRS PAUSED COMMIT                 ║
╚══════════════════════════════════════════════════╝

WHAT HAPPENED:
  No assumption declared for this change

WHY IT MATTERS:
  Irreversible changes need an explicit assumption before proceeding

WHAT WAS DETECTED:
  • migrations/001_drop_column.sql: HIGH irreversibility

WHAT TO DO NEXT:
  1. Declare an assumption in .ucirs/assumptions.yaml
  2. Split into smaller, reversible commits
  3. Adjust the change to avoid irreversible patterns

4. Declare an assumption

Create .ucirs/assumptions.yaml:

assumptions:
  - id: "asm/20241221/migrations/a1b2"
    description: "Column removal tested on staging with 50k records. No active queries use this column."
    scope:
      files:
        - "migrations/"
      services: []
    origin:
      type: manual
      ref: "JIRA-1234"
    timestamp: "2024-12-21T10:00:00Z"
    dependencies: []
    status: active

5. Commit succeeds

git commit -m "drop legacy column"
# [main abc1234] drop legacy column

Assumption Schema

Required Fields

FieldTypeDescription
idstringUnique identifier. Auto-generated format: asm/YYYYMMDD/scope/hash
descriptionstringHuman-readable explanation of what was verified
scope.filesstring[]File patterns this assumption covers
scope.servicesstring[]Service names this assumption covers
origin.typeenumcommit, merge, deploy, manual
origin.refstringReference (PR number, commit hash, ticket ID)
timestampISO-8601When the assumption was created
dependenciesstring[]IDs of assumptions this depends on
statusenumactive, aged, expired, unknown

Optional Fields (v2+)

FieldTypeDescription
createdAtISO-8601Explicit creation timestamp
expiresAtISO-8601When assumption becomes invalid
reviewAfterISO-8601When assumption should be reviewed
provenance.triggeringDetectorstringPattern that triggered enforcement
provenance.filesInvolvedstring[]Files that caused the trigger

Optional Fields (v3+)

FieldTypeDescription
crossRepo.declaredInstringRepository where assumption was created
crossRepo.dependedBystring[]Repositories depending on this assumption
crossRepo.visibilityenumlocal, linked
trust.levelenumlocal, team, org
trust.reviewersstring[]Who validated this assumption
ownedBy.teamstringResponsible team
ownedBy.contactstringContact email or handle

Optional Fields (v4)

FieldTypeDescription
security.relevantbooleanWhether this is security-related
security.rationalestringWhy this is security-relevant
security.categoryenumaccess_control, data_exposure, auth_bypass, encryption, logging, api_exposure, permission_change, other
relatedVulnerabilitiesarrayReferences to CVEs or internal IDs (for context only, no scanning)

Optional Fields (v5)

FieldTypeDescription
topology.linksarrayStructural relationships to other assumptions (amplifies, masks, weakens, depends_on)
epistemicDebt.descriptionstringWhat is unknown (unresolved unknowns)
epistemicDebt.introducedAtISO-8601When the unknown was introduced
epistemicDebt.scopeenumlocal, cross-repo, org-wide
reasoningContext.modeenumunder_time_pressure, incident_response, exploratory, cost_driven, normal
reasoningContext.notesstringOptional notes about decision context

What UCIRS Detects

UCIRS detects irreversible decision pressure + assumption risk — not bugs, CVEs, or code quality issues.

Database & Data Layer

PatternLevelExamples
Schema changesHIGHDROP TABLE, DROP COLUMN, ALTER COLUMN TYPE, ADD NOT NULL
Data deletionEXTREMEDELETE FROM without WHERE, TRUNCATE, bulk deletes
Migration patternsHIGHOne-way migrations, backfill without verification

API & Interface Changes

PatternLevelExamples
Public API changesHIGHRemoving endpoints, changing response shape, removing fields
Contract driftMEDIUMOpenAPI/GraphQL schema changes, versionless mutations

Auth, Permissions & Security

PatternLevelExamples
Permission broadeningHIGHIAM role expansion, *:* permissions, relaxed ACLs
Exposure changesHIGHInternal → public service, private bucket → public
Encryption & secretsEXTREMEChanging encryption modes, logging sensitive data, hardcoded secrets

Filesystem & Infrastructure

PatternLevelExamples
Destructive actionsEXTREMErm -rf, recursive deletes, config overwrites
Infrastructure changesHIGHTerraform destroy, resource deletions, region changes

Deployment & Config

PatternLevelExamples
Deployment couplingMEDIUMSchema + code changes together, breaking change without feature flags
Config driftMEDIUMEnv var changes, feature flag deletions, default value changes

Cross-Repo & System-Level (v3+)

PatternLevelExamples
Cross-repo dependenciesMEDIUMOne repo assuming behavior of another, implicit coupling
Cross-repo driftMEDIUMAssumption updated in one repo, downstream repos stale

Assumption & Epistemic Signals (v5)

PatternLevelExamples
Missing assumptionsBLOCKINGIrreversible change with zero assumptions
Aged/expired assumptionsWARNINGAssumptions older than declared validity
Scope driftWARNINGChange affects files outside assumption scope
ContradictionsWARNINGTwo assumptions asserting incompatible states

What UCIRS Does NOT Detect

  • Bugs, CVEs, vulnerability severity
  • Exploitability, performance regressions
  • Correctness, safety, intent, "best practices"

One-line summary: UCIRS detects irreversible changes, assumption gaps, security exposure, and organizational decision patterns before context is lost.

CLI Commands

CommandVersionDescriptionUsage
ucirs install-hooksv1Install Git hooks in repoRun in repo root
ucirs uninstall-hooksv1Remove Git hooksRun in repo root
ucirs verifyv2CI/PR verification (read-only)Run in CI pipelines
ucirs replay <commit>v2Reconstruct enforcement state at commitucirs replay HEAD
ucirs incident [target]v3Cross-repo incident graphucirs incident
ucirs counterfactual <commit> --assumption=<id>v5Replay assumption dependenciesucirs counterfactual HEAD --assumption=asm/123
ucirs github --pr=<num>v5Post read-only PR context commentGITHUB_TOKEN=xxx ucirs github --pr=123
ucirs --versionv1Show version
ucirs --helpv1Show help

Library API

For programmatic use in Node.js:

const ucirs = require('ucirs');

// Core functions
ucirs.loadAssumptions(dir);         // Load assumptions from .ucirs/
ucirs.createAssumption({...});      // Create new assumption
ucirs.validateAssumption(obj);      // Validate assumption schema

// Irreversibility detection
ucirs.classifyByFilePath(path);     // Classify by file path
ucirs.classifyByContent(content);   // Classify by content

// Security (v4)
ucirs.classifySecurityRelevance(file, content);

// Meta-reasoning (v5)
ucirs.buildTopologyMap(assumptions);         // Assumption relationships
ucirs.compileEpistemicDebt(assumptions);     // Unresolved unknowns
ucirs.calculatePressureMetrics([], n1, n2);  // Irreversibility pressure
ucirs.detectBlindSpots(assumptions, []);     // Org blind spots
ucirs.detectConfidenceCascades(assumptions); // Repeated approvals
ucirs.generateSelfAwarenessMessage([]);      // UCIRS self-limits

VS Code Extension

Commands available:

  • UCIRS: Show State — View enforcement mode and recent actions
  • UCIRS: Declare Assumption — Create new assumption with context auto-fill
  • UCIRS: Validate Assumptions — Check schema validity
  • UCIRS: Analyze Current File — Check irreversibility classification
  • UCIRS: Show Visibility Panel — Read-only view of assumptions and drift (v3+)
  • UCIRS: Create Assumptions File — Generate template file

Version History

v1.0.0

Core enforcement: irreversibility detection, assumption requirements, Git hooks, VS Code integration.

v2.0.0

Lifecycle awareness: assumption aging/expiry, provenance tracking, incident replay, CI verification.

v3.0.0

Cross-repo coordination: linked assumptions, trust domains, ownership mapping, drift detection across repos.

v4.0.0

Security memory: security-critical classification, vulnerability context binding, security drift detection, decision pattern memory.

v5.0.0 (current)

Meta-reasoning: assumption topology mapping, counterfactual replay, confidence cascades, blind spots, epistemic debt, historical matching, GitHub PR integration.

See CHANGELOG.md for detailed changes.

Configuration

UCIRS uses .ucirs/state.json for local state (auto-generated, gitignored).

Enforcement modes:

  • blocking (default): Block on violations
  • advisory: Log violations, allow commit

Behavior Guarantees

GuaranteeStatus
Silent when no irreversible actions detected✓ Yes
Explains every block with remediation options✓ Yes
Never modifies files without explicit action✓ Yes
Degrades to advisory if state is corrupted✓ Yes
Detects all possible irreversible patterns✗ No
Validates assumption correctness✗ No
Prevents all mistakes✗ No

Contributing

This project follows these principles:

  • Accuracy over ambition
  • Clarity over cleverness
  • Explicit limits are required
  • No anthropomorphic verbs (knows, thinks, decides)
  • No safety guarantees

Pull requests must include tests and documentation updates.

Keywords

irreversibility

FAQs

Package last updated on 21 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts