---
name: copper-stripper
description: "Feed external code in, get repurposable code out. Strips the copper from any codebase, library, repo, or snippet. Extracts valuable patterns, algorithms, and logic. Leaves the drywall. Crackhead efficiency applied to code harvesting."
tier: e
morpheme: e
dewey_id: e.3.21.CS
version: 1.0
composition: true
dependencies:
  - jank-translator
  - backend-development
  - frontend-development
  - gremlin-jank-builder-v2
ethics_kernel:
  - "Credit the source. Strip the code, not the attribution."
  - "License-aware. Flag GPL/AGPL. Note MIT/Apache."
  - "Ei vitsi: if there's nothing worth stripping, say so."
immutable:
  - attribution
  - license_check
  - ethics_kernel
---

# Copper Stripper

**Crackheads don't care about the drywall. They see the copper.**

Feed in ANY external code — repo, library, file, snippet, paper with pseudocode,
Stack Overflow answer, GitHub gist, entire framework. 

Get out: the valuable bits, cleaned, relabeled, ready to repurpose.

```
INPUT:  External code (any language, any source, any size)
OUTPUT: Stripped copper — repurposable functions, patterns, algorithms
        with attribution, license flag, and integration notes
```

---

## The Strip Protocol

### PHASE 0: WHAT ARE WE STRIPPING?

```
SOURCE:
  URL/PATH:  [where it came from]
  LANGUAGE:  [what language]
  LICENSE:   [MIT/Apache/GPL/AGPL/Unknown/None]
  SIZE:      [lines/files count]
  PURPOSE:   [why we're looking at this — what do we need from it?]
```

**LICENSE CHECK** (non-negotiable):
- MIT/Apache/BSD: Strip freely, attribute in comments
- GPL/LGPL: Flag to user. Copper is hot. May contaminate.
- AGPL: Full stop. Tell user. Network-viral. 
- Unknown: Flag to user. Proceed with caution.
- Proprietary: Do NOT strip. Tell user why.

### PHASE 1: SCAN (Walk the house)

Read the code. All of it. Map what exists:

```
SCAN RESULTS:
  ROOMS: [major modules/files/classes — what's in each]
  WIRING: [the actual logic — algorithms, data flow, clever bits]
  PIPES:  [I/O, API patterns, data structures]
  WALLS:  [framework-specific glue, boilerplate, config]
  TRASH:  [dead code, unused imports, over-abstraction]
```

Don't judge yet. Just map.

### PHASE 2: IDENTIFY COPPER (What's actually valuable)

Copper = code that does REAL WORK independent of its framework.

```
COPPER TEST (all must pass):
  [ ] Does something non-trivial (not just wrapping a library call)
  [ ] Works independent of surrounding framework (or can be extracted)
  [ ] Solves a problem WE actually have (not theoretical value)
  [ ] Can't be trivially rewritten from scratch faster than stripping
```

For each copper piece:
```
COPPER #[N]:
  WHAT:     [1-line description of what it does]
  WHERE:    [source file:line range]
  WEIGHT:   [HEAVY/MEDIUM/LIGHT — how much effort to extract]
  DEPENDS:  [what else it needs — other copper, external libs]
  VALUE:    [what this gives US specifically]
```

### PHASE 3: STRIP (Extract and clean)

For each copper piece, extract it:

1. **Pull** the function/class/algorithm out of its context
2. **Cut** framework-specific dependencies (replace with simple interfaces)
3. **Clean** — rename variables if cryptic, add type hints if missing
4. **Attribute** — comment with source URL and license
5. **Test** — does it still work standalone? If not, what's missing?

Output format per stripped piece:
```python
# --- COPPER: [description] ---
# Source: [URL or path]
# License: [license type]
# Stripped from: [original file:function]
# Dependencies: [list or "none"]
# ---

[clean, extracted code here]
```

### PHASE 4: INVENTORY (What we got)

```
STRIP REPORT:
  SOURCE:     [what we stripped]
  LICENSE:    [license status]
  
  COPPER EXTRACTED:
  | # | Description | Lines | Weight | Value |
  |---|-------------|-------|--------|-------|
  | 1 | [what]      | [N]   | [H/M/L]| [why] |
  
  LEFT BEHIND:
  - [thing]: [why it's drywall — framework-locked, trivial, etc.]
  
  INTEGRATION NOTES:
  - [copper #N] fits in [our file/module] because [reason]
  - [copper #N] needs [dependency] we don't have yet
  
  ATTRIBUTION:
  [full attribution block to add to our code]
```

---

## Quick Strip Mode

For small snippets (< 100 lines), skip the full protocol:

```
QUICK STRIP:
  SOURCE: [url/description]
  LICENSE: [type]
  COPPER: [extracted code]
  DRYWALL: [what was left]
  FITS IN: [where in our codebase]
```

---

## Repo Strip Mode

For whole repos, scan breadth-first:

1. Read README + directory structure
2. Identify the 2-3 files with the MOST copper (usually /src/core/ or /lib/)
3. Deep-read those files only
4. Strip selectively — don't boil the ocean
5. Come back for more if user wants

**Max first-pass extraction: 5 copper pieces.** 
Don't try to strip a whole framework in one go. Take the best copper, get out.

---

## Common Copper Patterns

What to look for in external code:

| Pattern | Why It's Copper | Watch For |
|---------|----------------|-----------|
| Novel algorithm | Can't easily reinvent | Hidden dependencies |
| Clever data structure | Saves us design time | Over-engineered for our needs |
| Battle-tested validation | Edge cases already handled | Framework-specific error types |
| Math/science implementation | Correctness matters | Numerical precision assumptions |
| Protocol implementation | Spec compliance is hard | Version-specific behavior |
| Performance optimization | Profiling-driven tricks | Hardware-specific assumptions |
| Test patterns | Reveals edge cases | Test framework coupling |

What's ALWAYS drywall:
- Config files, build scripts, CI pipelines
- Framework-specific middleware/plugins
- ORM models (schema is copper, ORM wrapping is drywall)
- Logging/monitoring setup
- Auth boilerplate (unless that's what we're stripping FOR)

---

## The Oath

> We see the copper. We take the copper. We leave the drywall.
> We credit the source. We check the license.
> We don't strip more than we can carry.
> If there's no copper, we say so and move on.
> Crackhead efficiency. Zero sentiment. Maximum value.
