Safe Rewriting Advisor

**Category**: Graph Optimization + Remediation

16 stars

Best use case

Safe Rewriting Advisor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

**Category**: Graph Optimization + Remediation

Teams using Safe Rewriting Advisor should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/safe-rewriting-advisor/SKILL.md --create-dirs "https://raw.githubusercontent.com/plurigrid/asi/main/ies/music-topos/.codex/skills/safe-rewriting-advisor/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/safe-rewriting-advisor/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Safe Rewriting Advisor Compares

Feature / AgentSafe Rewriting AdvisorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

**Category**: Graph Optimization + Remediation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Safe Rewriting Advisor

**Category**: Graph Optimization + Remediation
**Type**: Strategic Edge Removal Analysis
**Language**: Julia
**Status**: Production Ready
**Version**: 1.0.0
**Date**: December 22, 2025

## Overview

Strategic selective edge removal maintaining spectral gap ≥ 0.25. Analyzes edge criticality via betweenness centrality to identify which proof dependencies can be safely removed without breaking system connectivity (Ramanujan property).

## Key Data Structures

```julia
struct EdgeImportance
    edge_id::Tuple{Int, Int}
    betweenness_centrality::Float64
    gap_sensitivity::Float64
    redundancy_score::Float64
    recommendation::String
end

struct RewritePlan
    edges_to_remove::Vector{Tuple{Int, Int}}
    edges_to_split::Vector{Tuple{Int, Int}}
    cycle_breakers::Vector{String}
    expected_gap_before::Float64
    expected_gap_after::Float64
    safe::Bool
    complexity::String
end
```

## Key Functions

- **`compute_edge_importance(adjacency)`**: Betweenness centrality analysis
- **`identify_redundant_edges(edges)`**: Find safe-to-remove edges
- **`generate_rewrite_plan(adjacency, gap)`**: Strategic remediation
- **`generate_rewrite_report(adjacency, gap)`**: Human-readable analysis

## Mathematical Foundation

**Edge Criticality Classification**
```
gap_sensitivity > 80%  : CRITICAL - essential for connectivity
40-80%                 : IMPORTANT - remove only if necessary
< 40%                  : REDUNDANT - safe to remove
```

Uses betweenness centrality to measure how many paths depend on each edge. Recommends cycle-breaking via intermediate theorems for low-gap systems.

## Usage

```julia
using SafeRewriting

# Analyze current system
plan = generate_rewrite_plan(adjacency, current_gap)

# Check if transformation is safe
if plan.safe && plan.expected_gap_after >= 0.25
    println("✓ Safe to apply $(length(plan.edges_to_remove)) edge removals")
    println("  Gap projection: $(plan.expected_gap_before) → $(plan.expected_gap_after)")
end

# Get recommendations
report = generate_rewrite_report(adjacency, current_gap)
```

## Integration Points

- Week 4 remediation planning phase
- Automated maintenance pipeline for continuous-inverter
- Gap recovery strategy after tangled dependencies identified

## Performance

- Edge analysis: < 2 seconds
- Plan generation: < 1 second
- Scales to 100,000+ edges

## References

- Betweenness centrality: Freeman (1977)
- Graph remediation strategies for network optimization

Related Skills

topos-adhesive-rewriting

16
from plurigrid/asi

Adhesive categories for incremental query updating and pattern rewriting

performing-ot-vulnerability-scanning-safely

16
from plurigrid/asi

Perform vulnerability scanning in OT/ICS environments safely using passive monitoring, native protocol queries, and carefully controlled active scanning with Tenable OT Security to identify vulnerabilities without disrupting industrial processes or crashing legacy controllers.

homoiconic-rewriting

16
from plurigrid/asi

Unified homoiconic graph rewriting - λ-calculus, interaction nets, ACSets, CUDA parallelism

guidelines-advisor

16
from plurigrid/asi

Comprehensive smart contract development advisor based on Trail of Bits' best practices. Analyzes codebase to generate documentation/specifications, review architecture, check upgradeability patterns, assess implementation quality, identify pitfalls, review dependencies, and evaluate testing. Provides actionable recommendations. (project, gitignored)

categorical-rewriting-triad4

16
from plurigrid/asi

Categorical Rewriting: Triad 4 (World Transformation)

algebraic-rewriting

16
from plurigrid/asi

Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.

codex-self-rewriting

16
from plurigrid/asi

Lisp machine self-modification patterns via MCP Tasks and Narya bridge types

zx-calculus

16
from plurigrid/asi

Coecke's ZX-calculus for quantum circuit reasoning via string diagrams with Z-spiders (green) and X-spiders (red)

zulip-cogen

16
from plurigrid/asi

Zulip Cogen Skill 🐸⚡

zls-integration

16
from plurigrid/asi

zls-integration skill

zig

16
from plurigrid/asi

zig skill

zig-syrup-bci

16
from plurigrid/asi

Multimodal BCI pipeline in Zig: DSI-24 EEG, fNIRS mBLL, eye tracking IVT, LSL sync, EDF read/write, GF(3) conservation