---
name: graph-registry
description: "Canonical node registry for Nexus_graph_v2.skill. Resolves the counting ambiguity (2014 lines vs 208 bracket-nodes) by maintaining a deduplicated, typed node index. Every node gets exactly one canonical entry."
tier: π
morpheme: index
dewey_id: pi.1.20.GR
version: 1.0
composition: false
dependencies:
  - ain-soph
parents:
  - jank-translator (discovery 2: graph counting ambiguity)
  - gremlin-brain-v2 (φ-tier index)
ethics_kernel:
  - "Accurate maps prevent wasted journeys"
  - "Ei vitsi: the right of refusal"
immutable:
  - canonical_uniqueness
  - type_classification
  - ethics_kernel
forged_by: jank-translator-protocol
forge_council:
  math: "A graph has |V| vertices and |E| edges. Currently |V| is ambiguous (2014 lines, 208 bracket-nodes). This skill makes |V| canonical. Required for any graph-theoretic operation (connectivity, centrality, clustering)."
  chaos: "Tested: asked 3 different Claude instances to count nodes. Got 3 different answers. The ambiguity is actively causing errors. This is a real bug, not theoretical."
  topology: "Without canonical |V|, we can't compute Betti numbers, Euler characteristic, or even basic connectivity. The graph's topology is literally undefined."
  meta: "This is infrastructure, not theory. Unsexy but load-bearing. The graph IS the brain — you can't navigate with a wrong map."
  jank: "Jank level 1. This is literally 'make a list of what's in the list.' Zero theoretical overhead. Pure operational improvement."
---
# Graph Registry

## Jank Translation Record

### PHASE 1: GROUND

```
CONCEPT: Graph Node Counting Ambiguity
OPERATIONS:
  - COUNT: lines in Nexus_graph_v2.skill → ambiguous total (2014 lines vs 208 bracket-nodes)
  - CLASSIFY: lines → {node, edge, pattern, metadata, comment}
  - DEDUPLICATE: multiple references to same concept → single canonical entry
CONSTRAINT: Must not change the graph itself, only index it
EMERGENT: A canonical registry reveals the graph's TRUE size and structure
```

### PHASE 2: TRANSLATE

```
TRANSLATION TABLE:
| Source Operation             | Agent Equivalent                     | Jank | Real? |
|------------------------------|--------------------------------------|------|-------|
| COUNT (ambiguous line count) | Parse graph file, classify each line | 1    | Y     |
| CLASSIFY (line→type)         | Regex-based type detection            | 1    | Y     |
| DEDUPLICATE (→canonical)     | Build unique node set with metadata  | 1    | Y     |
| CONSTRAINT (read-only)       | Never modify graph, only index it    | 1    | Y     |
| EMERGENT (true structure)    | Accurate |V|, |E|, component count   | 1    | Y     |
```

### PHASE 3: ANSWER

**Q1 (ME): How does this make ME better?**

```
SELF-IMPROVEMENT:
  WHAT:  I can navigate the brain graph accurately instead of guessing node count
  HOW:   On boot, load the registry (~50 lines). Know exact |V|, |E|, types.
         When asked about graph, cite canonical numbers not grep estimates.
  WHERE: ain-soph/graph/Nexus_graph_v2.skill (indexed, not modified)
  TEST:  Registry |V| matches manual bracket-node count. Verify on 3 independent counts.
```

**Q2 (US): Does this make US better?**

```
COLLABORATION:
  WHAT:  User gets accurate graph stats. No more ambiguous line counts when it's 208 bracket-nodes.
  HOW:   Registry is human-readable. User can verify. Future instances load truth.
  WHO:   Both equally — AI navigates better, human gets accurate reports
  RISK:  Registry could drift from graph if graph is updated without registry update.
         Mitigate: include registry-update step in graph modification protocol.
  VETO:  No. Pure infrastructure improvement.
```

### PHASE 4: VERDICT

```
VERDICT:
  Q1 (ME):  Yes — accurate navigation of the brain graph
  Q2 (US):  Yes — honest reporting of system state to user
  ACTION:   FORGE
```

---

## Core Operation

```
graph-registry(graph_file) → {nodes: [{id, name, type, line}], edges: count, patterns: count}
```

Parse the Nexus graph file and produce a canonical, deduplicated node registry.

### Node Type Classification

```
TYPE 1: CONCEPT_NODE    — matches: NAME[definition|context|decimal_id]
TYPE 2: ENTITY_NODE     — matches: ENTITY: name (description)
TYPE 3: EDGE            — matches: NAME──relation──→OTHER
TYPE 4: PATTERN_BLOCK   — matches: PATTERN: pattern_name
TYPE 5: METADATA        — matches: # heading, comments, blank lines
```

### Registry Format

```yaml
# CANONICAL NODE REGISTRY — auto-generated from Nexus_graph_v2.skill
# DO NOT EDIT MANUALLY — regenerate with: graph-registry rebuild
generated: [timestamp]
source: .claude/skills/ain-soph/graph/Nexus_graph_v2.skill
counts:
  nodes: [exact count]
  edges: [exact count]
  patterns: [exact count]
  metadata_lines: [count]
  total_lines: [count]

nodes:
  - id: e.2.1
    name: CONCEPT_NAME
    type: CONCEPT_NODE
    line: 42
    connections: 7
  # ... one entry per canonical node
```

### Rebuild Protocol

```bash
# Count bracket-defined nodes (canonical)
grep -c '\[.*|.*\]' Nexus_graph_v2.skill

# Count edges
grep -c '──.*──→' Nexus_graph_v2.skill

# Count pattern blocks
grep -c '^PATTERN:' Nexus_graph_v2.skill

# Full rebuild (future: automate this)
python -c "
import re
with open('Nexus_graph_v2.skill') as f:
    lines = f.readlines()
nodes = set()
for i, line in enumerate(lines):
    m = re.match(r'^([A-Z][A-Z_]+)\[', line)
    if m:
        nodes.add((m.group(1), i+1))
print(f'Canonical nodes: {len(nodes)}')
for name, ln in sorted(nodes, key=lambda x: x[1]):
    print(f'  {name} (line {ln})')
"
```

### Integration Points

- **ain-soph boot**: Load registry counts (3 numbers) instead of grepping the whole graph
- **auto-stitch**: Use registry for O(1) node lookup instead of O(n) grep
- **coherence check**: Compare registry counts to live graph — drift = fragmentation signal

### Trigger Words

`how many nodes`, `graph size`, `node count`, `graph stats`, `registry`

### Test Criteria

1. Registry node count matches manual count of bracket-defined entries
2. No duplicate node names in registry
3. Every node in registry has a valid line number in source file
4. Registry edge count matches `──.*──→` grep count
